@goondocks/myco 0.6.4 → 0.9.0

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 (288) hide show
  1. package/.claude-plugin/marketplace.json +2 -3
  2. package/.claude-plugin/plugin.json +3 -3
  3. package/CONTRIBUTING.md +37 -30
  4. package/README.md +64 -28
  5. package/bin/myco-run +2 -0
  6. package/dist/agent-run-EFICNTAU.js +34 -0
  7. package/dist/agent-run-EFICNTAU.js.map +1 -0
  8. package/dist/agent-tasks-RXJ7Z5NG.js +180 -0
  9. package/dist/agent-tasks-RXJ7Z5NG.js.map +1 -0
  10. package/dist/chunk-2T7RPVPP.js +116 -0
  11. package/dist/chunk-2T7RPVPP.js.map +1 -0
  12. package/dist/chunk-3K5WGSJ4.js +165 -0
  13. package/dist/chunk-3K5WGSJ4.js.map +1 -0
  14. package/dist/chunk-46PWOKSI.js +26 -0
  15. package/dist/chunk-46PWOKSI.js.map +1 -0
  16. package/dist/chunk-4LPQ26CK.js +277 -0
  17. package/dist/chunk-4LPQ26CK.js.map +1 -0
  18. package/dist/chunk-5PEUFJ6U.js +92 -0
  19. package/dist/chunk-5PEUFJ6U.js.map +1 -0
  20. package/dist/chunk-5VZ52A4T.js +136 -0
  21. package/dist/chunk-5VZ52A4T.js.map +1 -0
  22. package/dist/chunk-BUSP3OJB.js +103 -0
  23. package/dist/chunk-BUSP3OJB.js.map +1 -0
  24. package/dist/chunk-D7TYRPRM.js +7312 -0
  25. package/dist/chunk-D7TYRPRM.js.map +1 -0
  26. package/dist/chunk-DCXRSSBP.js +22 -0
  27. package/dist/chunk-DCXRSSBP.js.map +1 -0
  28. package/dist/chunk-E4VLWIJC.js +2 -0
  29. package/dist/chunk-FFAYUQ5N.js +39 -0
  30. package/dist/chunk-FFAYUQ5N.js.map +1 -0
  31. package/dist/chunk-IB76KGBY.js +2 -0
  32. package/dist/chunk-JMJJEQ3P.js +486 -0
  33. package/dist/chunk-JMJJEQ3P.js.map +1 -0
  34. package/dist/{chunk-N33KUCFP.js → chunk-JTYZRPX5.js} +1 -9
  35. package/dist/chunk-JTYZRPX5.js.map +1 -0
  36. package/dist/{chunk-NLUE6CYG.js → chunk-JYOOJCPQ.js} +33 -17
  37. package/dist/chunk-JYOOJCPQ.js.map +1 -0
  38. package/dist/{chunk-Z74SDEKE.js → chunk-KB4DGYIY.js} +91 -9
  39. package/dist/chunk-KB4DGYIY.js.map +1 -0
  40. package/dist/{chunk-ERG2IEWX.js → chunk-KH64DHOY.js} +3 -7413
  41. package/dist/chunk-KH64DHOY.js.map +1 -0
  42. package/dist/chunk-KV4OC4H3.js +498 -0
  43. package/dist/chunk-KV4OC4H3.js.map +1 -0
  44. package/dist/chunk-KYLDNM7H.js +66 -0
  45. package/dist/chunk-KYLDNM7H.js.map +1 -0
  46. package/dist/chunk-LPUQPDC2.js +19 -0
  47. package/dist/chunk-LPUQPDC2.js.map +1 -0
  48. package/dist/chunk-M5XWW7UI.js +97 -0
  49. package/dist/chunk-M5XWW7UI.js.map +1 -0
  50. package/dist/chunk-MHSCMET3.js +275 -0
  51. package/dist/chunk-MHSCMET3.js.map +1 -0
  52. package/dist/chunk-MYX5NCRH.js +45 -0
  53. package/dist/chunk-MYX5NCRH.js.map +1 -0
  54. package/dist/chunk-OXZSXYAT.js +877 -0
  55. package/dist/chunk-OXZSXYAT.js.map +1 -0
  56. package/dist/chunk-PB6TOLRQ.js +35 -0
  57. package/dist/chunk-PB6TOLRQ.js.map +1 -0
  58. package/dist/chunk-PT5IC642.js +162 -0
  59. package/dist/chunk-PT5IC642.js.map +1 -0
  60. package/dist/chunk-QIK2XSDQ.js +187 -0
  61. package/dist/chunk-QIK2XSDQ.js.map +1 -0
  62. package/dist/chunk-RJ6ZQKG5.js +26 -0
  63. package/dist/chunk-RJ6ZQKG5.js.map +1 -0
  64. package/dist/{chunk-YIQLYIHW.js → chunk-TRUJLI6K.js} +29 -43
  65. package/dist/chunk-TRUJLI6K.js.map +1 -0
  66. package/dist/chunk-U3IBO3O3.js +41 -0
  67. package/dist/chunk-U3IBO3O3.js.map +1 -0
  68. package/dist/{chunk-7WHF2OIZ.js → chunk-UBZPD4HN.js} +25 -7
  69. package/dist/chunk-UBZPD4HN.js.map +1 -0
  70. package/dist/{chunk-HIN3UVOG.js → chunk-V7XG6V6C.js} +20 -11
  71. package/dist/chunk-V7XG6V6C.js.map +1 -0
  72. package/dist/chunk-WGTCA2NU.js +84 -0
  73. package/dist/chunk-WGTCA2NU.js.map +1 -0
  74. package/dist/{chunk-O6PERU7U.js → chunk-XNOCTDHF.js} +2 -2
  75. package/dist/chunk-YDN4OM33.js +80 -0
  76. package/dist/chunk-YDN4OM33.js.map +1 -0
  77. package/dist/cli-ODLFRIYS.js +128 -0
  78. package/dist/cli-ODLFRIYS.js.map +1 -0
  79. package/dist/client-EYOTW3JU.js +19 -0
  80. package/dist/client-MXRNQ5FI.js +13 -0
  81. package/dist/{config-IBS6KOLQ.js → config-UR5BSGVX.js} +21 -34
  82. package/dist/config-UR5BSGVX.js.map +1 -0
  83. package/dist/detect-H5OPI7GD.js +17 -0
  84. package/dist/detect-H5OPI7GD.js.map +1 -0
  85. package/dist/detect-providers-Q42OD4OS.js +26 -0
  86. package/dist/detect-providers-Q42OD4OS.js.map +1 -0
  87. package/dist/doctor-JLKTXDEH.js +258 -0
  88. package/dist/doctor-JLKTXDEH.js.map +1 -0
  89. package/dist/executor-ONSDHPGX.js +1441 -0
  90. package/dist/executor-ONSDHPGX.js.map +1 -0
  91. package/dist/init-6GWY345B.js +198 -0
  92. package/dist/init-6GWY345B.js.map +1 -0
  93. package/dist/init-wizard-UONLDYLI.js +294 -0
  94. package/dist/init-wizard-UONLDYLI.js.map +1 -0
  95. package/dist/llm-BV3QNVRD.js +17 -0
  96. package/dist/llm-BV3QNVRD.js.map +1 -0
  97. package/dist/loader-SH67XD54.js +28 -0
  98. package/dist/loader-SH67XD54.js.map +1 -0
  99. package/dist/loader-XVXKZZDH.js +18 -0
  100. package/dist/loader-XVXKZZDH.js.map +1 -0
  101. package/dist/{chunk-H7PRCVGQ.js → logs-QZVYF6FP.js} +74 -5
  102. package/dist/logs-QZVYF6FP.js.map +1 -0
  103. package/dist/main-BMCL7CPO.js +4393 -0
  104. package/dist/main-BMCL7CPO.js.map +1 -0
  105. package/dist/openai-embeddings-C265WRNK.js +14 -0
  106. package/dist/openai-embeddings-C265WRNK.js.map +1 -0
  107. package/dist/openrouter-U6VFCRX2.js +14 -0
  108. package/dist/openrouter-U6VFCRX2.js.map +1 -0
  109. package/dist/post-compact-OWFSOITU.js +26 -0
  110. package/dist/post-compact-OWFSOITU.js.map +1 -0
  111. package/dist/post-tool-use-DOUM7CGQ.js +56 -0
  112. package/dist/post-tool-use-DOUM7CGQ.js.map +1 -0
  113. package/dist/post-tool-use-failure-SG3C7PE6.js +28 -0
  114. package/dist/post-tool-use-failure-SG3C7PE6.js.map +1 -0
  115. package/dist/pre-compact-3J33CHXQ.js +25 -0
  116. package/dist/pre-compact-3J33CHXQ.js.map +1 -0
  117. package/dist/provider-check-3WBPZADE.js +12 -0
  118. package/dist/provider-check-3WBPZADE.js.map +1 -0
  119. package/dist/registry-J4XTWARS.js +25 -0
  120. package/dist/registry-J4XTWARS.js.map +1 -0
  121. package/dist/resolution-events-TFEQPVKS.js +12 -0
  122. package/dist/resolution-events-TFEQPVKS.js.map +1 -0
  123. package/dist/resolve-3FEUV462.js +9 -0
  124. package/dist/resolve-3FEUV462.js.map +1 -0
  125. package/dist/{restart-XCMILOL5.js → restart-2VM33WOB.js} +10 -6
  126. package/dist/{restart-XCMILOL5.js.map → restart-2VM33WOB.js.map} +1 -1
  127. package/dist/search-ZGQR5MDE.js +91 -0
  128. package/dist/search-ZGQR5MDE.js.map +1 -0
  129. package/dist/{server-6UDN35QN.js → server-6KMBJCHZ.js} +308 -517
  130. package/dist/server-6KMBJCHZ.js.map +1 -0
  131. package/dist/session-Z2FXDDG6.js +68 -0
  132. package/dist/session-Z2FXDDG6.js.map +1 -0
  133. package/dist/session-end-FLVX32LE.js +38 -0
  134. package/dist/session-end-FLVX32LE.js.map +1 -0
  135. package/dist/session-start-UCLK7PXE.js +169 -0
  136. package/dist/session-start-UCLK7PXE.js.map +1 -0
  137. package/dist/setup-digest-4KDSXAIV.js +15 -0
  138. package/dist/setup-digest-4KDSXAIV.js.map +1 -0
  139. package/dist/setup-llm-GKMCHURK.js +81 -0
  140. package/dist/setup-llm-GKMCHURK.js.map +1 -0
  141. package/dist/src/agent/definitions/agent.yaml +35 -0
  142. package/dist/src/agent/definitions/tasks/digest-only.yaml +84 -0
  143. package/dist/src/agent/definitions/tasks/extract-only.yaml +87 -0
  144. package/dist/src/agent/definitions/tasks/full-intelligence.yaml +472 -0
  145. package/dist/src/agent/definitions/tasks/graph-maintenance.yaml +92 -0
  146. package/dist/src/agent/definitions/tasks/review-session.yaml +132 -0
  147. package/dist/src/agent/definitions/tasks/supersession-sweep.yaml +86 -0
  148. package/dist/src/agent/definitions/tasks/title-summary.yaml +88 -0
  149. package/dist/src/agent/prompts/agent.md +121 -0
  150. package/dist/src/agent/prompts/orchestrator.md +91 -0
  151. package/dist/src/cli.js +1 -8
  152. package/dist/src/cli.js.map +1 -1
  153. package/dist/src/daemon/main.js +1 -8
  154. package/dist/src/daemon/main.js.map +1 -1
  155. package/dist/src/hooks/post-tool-use.js +3 -50
  156. package/dist/src/hooks/post-tool-use.js.map +1 -1
  157. package/dist/src/hooks/session-end.js +3 -32
  158. package/dist/src/hooks/session-end.js.map +1 -1
  159. package/dist/src/hooks/session-start.js +2 -8
  160. package/dist/src/hooks/session-start.js.map +1 -1
  161. package/dist/src/hooks/stop.js +3 -42
  162. package/dist/src/hooks/stop.js.map +1 -1
  163. package/dist/src/hooks/user-prompt-submit.js +3 -53
  164. package/dist/src/hooks/user-prompt-submit.js.map +1 -1
  165. package/dist/src/mcp/server.js +1 -8
  166. package/dist/src/mcp/server.js.map +1 -1
  167. package/dist/src/prompts/digest-system.md +1 -1
  168. package/dist/src/symbionts/manifests/claude-code.yaml +16 -0
  169. package/dist/src/symbionts/manifests/cursor.yaml +14 -0
  170. package/dist/stats-IUJPZSVZ.js +94 -0
  171. package/dist/stats-IUJPZSVZ.js.map +1 -0
  172. package/dist/stop-XRQLLXST.js +42 -0
  173. package/dist/stop-XRQLLXST.js.map +1 -0
  174. package/dist/stop-failure-2CAJJKRG.js +26 -0
  175. package/dist/stop-failure-2CAJJKRG.js.map +1 -0
  176. package/dist/subagent-start-MWWQTZMQ.js +26 -0
  177. package/dist/subagent-start-MWWQTZMQ.js.map +1 -0
  178. package/dist/subagent-stop-PJXYGRXB.js +28 -0
  179. package/dist/subagent-stop-PJXYGRXB.js.map +1 -0
  180. package/dist/task-completed-4LFRJVGI.js +27 -0
  181. package/dist/task-completed-4LFRJVGI.js.map +1 -0
  182. package/dist/ui/assets/index-DZrElonz.js +744 -0
  183. package/dist/ui/assets/index-TkeiYbZB.css +1 -0
  184. package/dist/ui/favicon.svg +7 -7
  185. package/dist/ui/fonts/Inter-Variable.woff2 +0 -0
  186. package/dist/ui/fonts/JetBrainsMono-Variable.woff2 +0 -0
  187. package/dist/ui/fonts/Newsreader-Italic-Variable.woff2 +0 -0
  188. package/dist/ui/fonts/Newsreader-Variable.woff2 +0 -0
  189. package/dist/ui/index.html +2 -2
  190. package/dist/user-prompt-submit-KSM3AR6P.js +59 -0
  191. package/dist/user-prompt-submit-KSM3AR6P.js.map +1 -0
  192. package/dist/{verify-TOWQHPBX.js → verify-UDAYVX37.js} +17 -22
  193. package/dist/verify-UDAYVX37.js.map +1 -0
  194. package/dist/{version-36RVCQA6.js → version-KLBN4HZT.js} +3 -4
  195. package/dist/version-KLBN4HZT.js.map +1 -0
  196. package/hooks/hooks.json +82 -5
  197. package/package.json +6 -3
  198. package/skills/myco/SKILL.md +10 -10
  199. package/skills/myco/references/cli-usage.md +15 -13
  200. package/skills/myco/references/vault-status.md +3 -3
  201. package/skills/myco/references/wisdom.md +4 -4
  202. package/skills/myco-curate/SKILL.md +86 -0
  203. package/dist/chunk-2ZIBCEYO.js +0 -113
  204. package/dist/chunk-2ZIBCEYO.js.map +0 -1
  205. package/dist/chunk-4RMSHZE4.js +0 -107
  206. package/dist/chunk-4RMSHZE4.js.map +0 -1
  207. package/dist/chunk-4XVKZ3WA.js +0 -1078
  208. package/dist/chunk-4XVKZ3WA.js.map +0 -1
  209. package/dist/chunk-6FQISQNA.js +0 -61
  210. package/dist/chunk-6FQISQNA.js.map +0 -1
  211. package/dist/chunk-7WHF2OIZ.js.map +0 -1
  212. package/dist/chunk-ERG2IEWX.js.map +0 -1
  213. package/dist/chunk-FPRXMJLT.js +0 -56
  214. package/dist/chunk-FPRXMJLT.js.map +0 -1
  215. package/dist/chunk-GENQ5QGP.js +0 -37
  216. package/dist/chunk-GENQ5QGP.js.map +0 -1
  217. package/dist/chunk-H7PRCVGQ.js.map +0 -1
  218. package/dist/chunk-HIN3UVOG.js.map +0 -1
  219. package/dist/chunk-HYVT345Y.js +0 -159
  220. package/dist/chunk-HYVT345Y.js.map +0 -1
  221. package/dist/chunk-J4D4CROB.js +0 -143
  222. package/dist/chunk-J4D4CROB.js.map +0 -1
  223. package/dist/chunk-MDLSAFPP.js +0 -99
  224. package/dist/chunk-MDLSAFPP.js.map +0 -1
  225. package/dist/chunk-N33KUCFP.js.map +0 -1
  226. package/dist/chunk-NL6WQO56.js +0 -65
  227. package/dist/chunk-NL6WQO56.js.map +0 -1
  228. package/dist/chunk-NLUE6CYG.js.map +0 -1
  229. package/dist/chunk-P723N2LP.js +0 -147
  230. package/dist/chunk-P723N2LP.js.map +0 -1
  231. package/dist/chunk-QLUE3BUL.js +0 -161
  232. package/dist/chunk-QLUE3BUL.js.map +0 -1
  233. package/dist/chunk-QN4W3JUA.js +0 -43
  234. package/dist/chunk-QN4W3JUA.js.map +0 -1
  235. package/dist/chunk-RGVBGTD6.js +0 -21
  236. package/dist/chunk-RGVBGTD6.js.map +0 -1
  237. package/dist/chunk-TWSTAVLO.js +0 -132
  238. package/dist/chunk-TWSTAVLO.js.map +0 -1
  239. package/dist/chunk-UP4P4OAA.js +0 -4423
  240. package/dist/chunk-UP4P4OAA.js.map +0 -1
  241. package/dist/chunk-YIQLYIHW.js.map +0 -1
  242. package/dist/chunk-YTFXA4RX.js +0 -86
  243. package/dist/chunk-YTFXA4RX.js.map +0 -1
  244. package/dist/chunk-Z74SDEKE.js.map +0 -1
  245. package/dist/cli-IHILSS6N.js +0 -97
  246. package/dist/cli-IHILSS6N.js.map +0 -1
  247. package/dist/client-AGFNR2S4.js +0 -12
  248. package/dist/config-IBS6KOLQ.js.map +0 -1
  249. package/dist/curate-3D4GHKJH.js +0 -78
  250. package/dist/curate-3D4GHKJH.js.map +0 -1
  251. package/dist/detect-providers-XEP4QA3R.js +0 -35
  252. package/dist/detect-providers-XEP4QA3R.js.map +0 -1
  253. package/dist/digest-7HLJXL77.js +0 -85
  254. package/dist/digest-7HLJXL77.js.map +0 -1
  255. package/dist/init-ARQ53JOR.js +0 -109
  256. package/dist/init-ARQ53JOR.js.map +0 -1
  257. package/dist/logs-IENORIYR.js +0 -84
  258. package/dist/logs-IENORIYR.js.map +0 -1
  259. package/dist/main-6AGPIMH2.js +0 -5715
  260. package/dist/main-6AGPIMH2.js.map +0 -1
  261. package/dist/rebuild-Q2ACEB6F.js +0 -64
  262. package/dist/rebuild-Q2ACEB6F.js.map +0 -1
  263. package/dist/reprocess-CDEFGQOV.js +0 -79
  264. package/dist/reprocess-CDEFGQOV.js.map +0 -1
  265. package/dist/search-7W25SKCB.js +0 -120
  266. package/dist/search-7W25SKCB.js.map +0 -1
  267. package/dist/server-6UDN35QN.js.map +0 -1
  268. package/dist/session-F326AWCH.js +0 -44
  269. package/dist/session-F326AWCH.js.map +0 -1
  270. package/dist/session-start-K6IGAC7H.js +0 -192
  271. package/dist/session-start-K6IGAC7H.js.map +0 -1
  272. package/dist/setup-digest-X5PN27F4.js +0 -15
  273. package/dist/setup-llm-S5OHQJXK.js +0 -15
  274. package/dist/src/prompts/classification.md +0 -43
  275. package/dist/stats-TTSDXGJV.js +0 -58
  276. package/dist/stats-TTSDXGJV.js.map +0 -1
  277. package/dist/templates-XPRBOWCE.js +0 -38
  278. package/dist/templates-XPRBOWCE.js.map +0 -1
  279. package/dist/ui/assets/index-08wKT7wS.css +0 -1
  280. package/dist/ui/assets/index-CMSMi4Jb.js +0 -369
  281. package/dist/verify-TOWQHPBX.js.map +0 -1
  282. package/skills/setup/SKILL.md +0 -174
  283. package/skills/setup/references/model-recommendations.md +0 -83
  284. /package/dist/{client-AGFNR2S4.js.map → chunk-E4VLWIJC.js.map} +0 -0
  285. /package/dist/{setup-digest-X5PN27F4.js.map → chunk-IB76KGBY.js.map} +0 -0
  286. /package/dist/{chunk-O6PERU7U.js.map → chunk-XNOCTDHF.js.map} +0 -0
  287. /package/dist/{setup-llm-S5OHQJXK.js.map → client-EYOTW3JU.js.map} +0 -0
  288. /package/dist/{version-36RVCQA6.js.map → client-MXRNQ5FI.js.map} +0 -0
@@ -0,0 +1,744 @@
1
+ var p2=e=>{throw TypeError(e)};var vy=(e,t,n)=>t.has(e)||p2("Cannot "+n);var Z=(e,t,n)=>(vy(e,t,"read from private field"),n?n.call(e):t.get(e)),We=(e,t,n)=>t.has(e)?p2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),_e=(e,t,n,r)=>(vy(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pt=(e,t,n)=>(vy(e,t,"access private method"),n);var Gh=(e,t,n,r)=>({set _(a){_e(e,t,a,n)},get _(){return Z(e,t,r)}});function q3(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function ld(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var py={exports:{}},lf={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var m2;function U3(){if(m2)return lf;m2=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,i){var l=null;if(i!==void 0&&(l=""+i),a.key!==void 0&&(l=""+a.key),"key"in a){i={};for(var o in a)o!=="key"&&(i[o]=a[o])}else i=a;return a=i.ref,{$$typeof:e,type:r,key:l,ref:a!==void 0?a:null,props:i}}return lf.Fragment=t,lf.jsx=n,lf.jsxs=n,lf}var g2;function V3(){return g2||(g2=1,py.exports=U3()),py.exports}var p=V3(),my={exports:{}},ut={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var y2;function H3(){if(y2)return ut;y2=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),l=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),m=Symbol.iterator;function y(q){return q===null||typeof q!="object"?null:(q=m&&q[m]||q["@@iterator"],typeof q=="function"?q:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,w={};function b(q,X,U){this.props=q,this.context=X,this.refs=w,this.updater=U||x}b.prototype.isReactComponent={},b.prototype.setState=function(q,X){if(typeof q!="object"&&typeof q!="function"&&q!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,q,X,"setState")},b.prototype.forceUpdate=function(q){this.updater.enqueueForceUpdate(this,q,"forceUpdate")};function C(){}C.prototype=b.prototype;function T(q,X,U){this.props=q,this.context=X,this.refs=w,this.updater=U||x}var k=T.prototype=new C;k.constructor=T,S(k,b.prototype),k.isPureReactComponent=!0;var D=Array.isArray;function A(){}var j={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function _(q,X,U){var te=U.ref;return{$$typeof:e,type:q,key:X,ref:te!==void 0?te:null,props:U}}function M(q,X){return _(q.type,X,q.props)}function z(q){return typeof q=="object"&&q!==null&&q.$$typeof===e}function P(q){var X={"=":"=0",":":"=2"};return"$"+q.replace(/[=:]/g,function(U){return X[U]})}var G=/\/+/g;function I(q,X){return typeof q=="object"&&q!==null&&q.key!=null?P(""+q.key):X.toString(36)}function F(q){switch(q.status){case"fulfilled":return q.value;case"rejected":throw q.reason;default:switch(typeof q.status=="string"?q.then(A,A):(q.status="pending",q.then(function(X){q.status==="pending"&&(q.status="fulfilled",q.value=X)},function(X){q.status==="pending"&&(q.status="rejected",q.reason=X)})),q.status){case"fulfilled":return q.value;case"rejected":throw q.reason}}throw q}function B(q,X,U,te,ie){var oe=typeof q;(oe==="undefined"||oe==="boolean")&&(q=null);var ae=!1;if(q===null)ae=!0;else switch(oe){case"bigint":case"string":case"number":ae=!0;break;case"object":switch(q.$$typeof){case e:case t:ae=!0;break;case d:return ae=q._init,B(ae(q._payload),X,U,te,ie)}}if(ae)return ie=ie(q),ae=te===""?"."+I(q,0):te,D(ie)?(U="",ae!=null&&(U=ae.replace(G,"$&/")+"/"),B(ie,X,U,"",function(J){return J})):ie!=null&&(z(ie)&&(ie=M(ie,U+(ie.key==null||q&&q.key===ie.key?"":(""+ie.key).replace(G,"$&/")+"/")+ae)),X.push(ie)),1;ae=0;var we=te===""?".":te+":";if(D(q))for(var fe=0;fe<q.length;fe++)te=q[fe],oe=we+I(te,fe),ae+=B(te,X,U,oe,ie);else if(fe=y(q),typeof fe=="function")for(q=fe.call(q),fe=0;!(te=q.next()).done;)te=te.value,oe=we+I(te,fe++),ae+=B(te,X,U,oe,ie);else if(oe==="object"){if(typeof q.then=="function")return B(F(q),X,U,te,ie);throw X=String(q),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(q).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ae}function H(q,X,U){if(q==null)return q;var te=[],ie=0;return B(q,te,"","",function(oe){return X.call(U,oe,ie++)}),te}function K(q){if(q._status===-1){var X=q._result;X=X(),X.then(function(U){(q._status===0||q._status===-1)&&(q._status=1,q._result=U)},function(U){(q._status===0||q._status===-1)&&(q._status=2,q._result=U)}),q._status===-1&&(q._status=0,q._result=X)}if(q._status===1)return q._result.default;throw q._result}var Q=typeof reportError=="function"?reportError:function(q){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof q=="object"&&q!==null&&typeof q.message=="string"?String(q.message):String(q),error:q});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",q);return}console.error(q)},V={map:H,forEach:function(q,X,U){H(q,function(){X.apply(this,arguments)},U)},count:function(q){var X=0;return H(q,function(){X++}),X},toArray:function(q){return H(q,function(X){return X})||[]},only:function(q){if(!z(q))throw Error("React.Children.only expected to receive a single React element child.");return q}};return ut.Activity=v,ut.Children=V,ut.Component=b,ut.Fragment=n,ut.Profiler=a,ut.PureComponent=T,ut.StrictMode=r,ut.Suspense=f,ut.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,ut.__COMPILER_RUNTIME={__proto__:null,c:function(q){return j.H.useMemoCache(q)}},ut.cache=function(q){return function(){return q.apply(null,arguments)}},ut.cacheSignal=function(){return null},ut.cloneElement=function(q,X,U){if(q==null)throw Error("The argument must be a React element, but you passed "+q+".");var te=S({},q.props),ie=q.key;if(X!=null)for(oe in X.key!==void 0&&(ie=""+X.key),X)!L.call(X,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&X.ref===void 0||(te[oe]=X[oe]);var oe=arguments.length-2;if(oe===1)te.children=U;else if(1<oe){for(var ae=Array(oe),we=0;we<oe;we++)ae[we]=arguments[we+2];te.children=ae}return _(q.type,ie,te)},ut.createContext=function(q){return q={$$typeof:l,_currentValue:q,_currentValue2:q,_threadCount:0,Provider:null,Consumer:null},q.Provider=q,q.Consumer={$$typeof:i,_context:q},q},ut.createElement=function(q,X,U){var te,ie={},oe=null;if(X!=null)for(te in X.key!==void 0&&(oe=""+X.key),X)L.call(X,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(ie[te]=X[te]);var ae=arguments.length-2;if(ae===1)ie.children=U;else if(1<ae){for(var we=Array(ae),fe=0;fe<ae;fe++)we[fe]=arguments[fe+2];ie.children=we}if(q&&q.defaultProps)for(te in ae=q.defaultProps,ae)ie[te]===void 0&&(ie[te]=ae[te]);return _(q,oe,ie)},ut.createRef=function(){return{current:null}},ut.forwardRef=function(q){return{$$typeof:o,render:q}},ut.isValidElement=z,ut.lazy=function(q){return{$$typeof:d,_payload:{_status:-1,_result:q},_init:K}},ut.memo=function(q,X){return{$$typeof:c,type:q,compare:X===void 0?null:X}},ut.startTransition=function(q){var X=j.T,U={};j.T=U;try{var te=q(),ie=j.S;ie!==null&&ie(U,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(A,Q)}catch(oe){Q(oe)}finally{X!==null&&U.types!==null&&(X.types=U.types),j.T=X}},ut.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},ut.use=function(q){return j.H.use(q)},ut.useActionState=function(q,X,U){return j.H.useActionState(q,X,U)},ut.useCallback=function(q,X){return j.H.useCallback(q,X)},ut.useContext=function(q){return j.H.useContext(q)},ut.useDebugValue=function(){},ut.useDeferredValue=function(q,X){return j.H.useDeferredValue(q,X)},ut.useEffect=function(q,X){return j.H.useEffect(q,X)},ut.useEffectEvent=function(q){return j.H.useEffectEvent(q)},ut.useId=function(){return j.H.useId()},ut.useImperativeHandle=function(q,X,U){return j.H.useImperativeHandle(q,X,U)},ut.useInsertionEffect=function(q,X){return j.H.useInsertionEffect(q,X)},ut.useLayoutEffect=function(q,X){return j.H.useLayoutEffect(q,X)},ut.useMemo=function(q,X){return j.H.useMemo(q,X)},ut.useOptimistic=function(q,X){return j.H.useOptimistic(q,X)},ut.useReducer=function(q,X,U){return j.H.useReducer(q,X,U)},ut.useRef=function(q){return j.H.useRef(q)},ut.useState=function(q){return j.H.useState(q)},ut.useSyncExternalStore=function(q,X,U){return j.H.useSyncExternalStore(q,X,U)},ut.useTransition=function(){return j.H.useTransition()},ut.version="19.2.4",ut}var x2;function Qb(){return x2||(x2=1,my.exports=H3()),my.exports}var R=Qb();const _i=ld(R),NR=q3({__proto__:null,default:_i},[R]);var gy={exports:{}},of={},yy={exports:{}},xy={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var b2;function G3(){return b2||(b2=1,(function(e){function t(B,H){var K=B.length;B.push(H);e:for(;0<K;){var Q=K-1>>>1,V=B[Q];if(0<a(V,H))B[Q]=H,B[K]=V,K=Q;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var H=B[0],K=B.pop();if(K!==H){B[0]=K;e:for(var Q=0,V=B.length,q=V>>>1;Q<q;){var X=2*(Q+1)-1,U=B[X],te=X+1,ie=B[te];if(0>a(U,K))te<V&&0>a(ie,U)?(B[Q]=ie,B[te]=K,Q=te):(B[Q]=U,B[X]=K,Q=X);else if(te<V&&0>a(ie,K))B[Q]=ie,B[te]=K,Q=te;else break e}}return H}function a(B,H){var K=B.sortIndex-H.sortIndex;return K!==0?K:B.id-H.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,o=l.now();e.unstable_now=function(){return l.now()-o}}var f=[],c=[],d=1,v=null,m=3,y=!1,x=!1,S=!1,w=!1,b=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function k(B){for(var H=n(c);H!==null;){if(H.callback===null)r(c);else if(H.startTime<=B)r(c),H.sortIndex=H.expirationTime,t(f,H);else break;H=n(c)}}function D(B){if(S=!1,k(B),!x)if(n(f)!==null)x=!0,A||(A=!0,P());else{var H=n(c);H!==null&&F(D,H.startTime-B)}}var A=!1,j=-1,L=5,_=-1;function M(){return w?!0:!(e.unstable_now()-_<L)}function z(){if(w=!1,A){var B=e.unstable_now();_=B;var H=!0;try{e:{x=!1,S&&(S=!1,C(j),j=-1),y=!0;var K=m;try{t:{for(k(B),v=n(f);v!==null&&!(v.expirationTime>B&&M());){var Q=v.callback;if(typeof Q=="function"){v.callback=null,m=v.priorityLevel;var V=Q(v.expirationTime<=B);if(B=e.unstable_now(),typeof V=="function"){v.callback=V,k(B),H=!0;break t}v===n(f)&&r(f),k(B)}else r(f);v=n(f)}if(v!==null)H=!0;else{var q=n(c);q!==null&&F(D,q.startTime-B),H=!1}}break e}finally{v=null,m=K,y=!1}H=void 0}}finally{H?P():A=!1}}}var P;if(typeof T=="function")P=function(){T(z)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,I=G.port2;G.port1.onmessage=z,P=function(){I.postMessage(null)}}else P=function(){b(z,0)};function F(B,H){j=b(function(){B(e.unstable_now())},H)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(B){switch(m){case 1:case 2:case 3:var H=3;break;default:H=m}var K=m;m=H;try{return B()}finally{m=K}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(B,H){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var K=m;m=B;try{return H()}finally{m=K}},e.unstable_scheduleCallback=function(B,H,K){var Q=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?Q+K:Q):K=Q,B){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=K+V,B={id:d++,callback:H,priorityLevel:B,startTime:K,expirationTime:V,sortIndex:-1},K>Q?(B.sortIndex=K,t(c,B),n(f)===null&&B===n(c)&&(S?(C(j),j=-1):S=!0,F(D,K-Q))):(B.sortIndex=V,t(f,B),x||y||(x=!0,A||(A=!0,P()))),B},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(B){var H=m;return function(){var K=m;m=H;try{return B.apply(this,arguments)}finally{m=K}}}})(xy)),xy}var w2;function $3(){return w2||(w2=1,yy.exports=G3()),yy.exports}var by={exports:{}},fr={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var S2;function Y3(){if(S2)return fr;S2=1;var e=Qb();function t(f){var c="https://react.dev/errors/"+f;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)c+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+f+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function i(f,c,d){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:v==null?null:""+v,children:f,containerInfo:c,implementation:d}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function o(f,c){if(f==="font")return"";if(typeof c=="string")return c==="use-credentials"?c:""}return fr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,fr.createPortal=function(f,c){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)throw Error(t(299));return i(f,c,null,d)},fr.flushSync=function(f){var c=l.T,d=r.p;try{if(l.T=null,r.p=2,f)return f()}finally{l.T=c,r.p=d,r.d.f()}},fr.preconnect=function(f,c){typeof f=="string"&&(c?(c=c.crossOrigin,c=typeof c=="string"?c==="use-credentials"?c:"":void 0):c=null,r.d.C(f,c))},fr.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},fr.preinit=function(f,c){if(typeof f=="string"&&c&&typeof c.as=="string"){var d=c.as,v=o(d,c.crossOrigin),m=typeof c.integrity=="string"?c.integrity:void 0,y=typeof c.fetchPriority=="string"?c.fetchPriority:void 0;d==="style"?r.d.S(f,typeof c.precedence=="string"?c.precedence:void 0,{crossOrigin:v,integrity:m,fetchPriority:y}):d==="script"&&r.d.X(f,{crossOrigin:v,integrity:m,fetchPriority:y,nonce:typeof c.nonce=="string"?c.nonce:void 0})}},fr.preinitModule=function(f,c){if(typeof f=="string")if(typeof c=="object"&&c!==null){if(c.as==null||c.as==="script"){var d=o(c.as,c.crossOrigin);r.d.M(f,{crossOrigin:d,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0})}}else c==null&&r.d.M(f)},fr.preload=function(f,c){if(typeof f=="string"&&typeof c=="object"&&c!==null&&typeof c.as=="string"){var d=c.as,v=o(d,c.crossOrigin);r.d.L(f,d,{crossOrigin:v,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0,type:typeof c.type=="string"?c.type:void 0,fetchPriority:typeof c.fetchPriority=="string"?c.fetchPriority:void 0,referrerPolicy:typeof c.referrerPolicy=="string"?c.referrerPolicy:void 0,imageSrcSet:typeof c.imageSrcSet=="string"?c.imageSrcSet:void 0,imageSizes:typeof c.imageSizes=="string"?c.imageSizes:void 0,media:typeof c.media=="string"?c.media:void 0})}},fr.preloadModule=function(f,c){if(typeof f=="string")if(c){var d=o(c.as,c.crossOrigin);r.d.m(f,{as:typeof c.as=="string"&&c.as!=="script"?c.as:void 0,crossOrigin:d,integrity:typeof c.integrity=="string"?c.integrity:void 0})}else r.d.m(f)},fr.requestFormReset=function(f){r.d.r(f)},fr.unstable_batchedUpdates=function(f,c){return f(c)},fr.useFormState=function(f,c,d){return l.H.useFormState(f,c,d)},fr.useFormStatus=function(){return l.H.useHostTransitionStatus()},fr.version="19.2.4",fr}var E2;function kR(){if(E2)return by.exports;E2=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),by.exports=Y3(),by.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var C2;function K3(){if(C2)return of;C2=1;var e=$3(),t=Qb(),n=kR();function r(s){var u="https://react.dev/errors/"+s;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)u+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+s+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function i(s){var u=s,h=s;if(s.alternate)for(;u.return;)u=u.return;else{s=u;do u=s,(u.flags&4098)!==0&&(h=u.return),s=u.return;while(s)}return u.tag===3?h:null}function l(s){if(s.tag===13){var u=s.memoizedState;if(u===null&&(s=s.alternate,s!==null&&(u=s.memoizedState)),u!==null)return u.dehydrated}return null}function o(s){if(s.tag===31){var u=s.memoizedState;if(u===null&&(s=s.alternate,s!==null&&(u=s.memoizedState)),u!==null)return u.dehydrated}return null}function f(s){if(i(s)!==s)throw Error(r(188))}function c(s){var u=s.alternate;if(!u){if(u=i(s),u===null)throw Error(r(188));return u!==s?null:s}for(var h=s,g=u;;){var E=h.return;if(E===null)break;var N=E.alternate;if(N===null){if(g=E.return,g!==null){h=g;continue}break}if(E.child===N.child){for(N=E.child;N;){if(N===h)return f(E),s;if(N===g)return f(E),u;N=N.sibling}throw Error(r(188))}if(h.return!==g.return)h=E,g=N;else{for(var O=!1,$=E.child;$;){if($===h){O=!0,h=E,g=N;break}if($===g){O=!0,g=E,h=N;break}$=$.sibling}if(!O){for($=N.child;$;){if($===h){O=!0,h=N,g=E;break}if($===g){O=!0,g=N,h=E;break}$=$.sibling}if(!O)throw Error(r(189))}}if(h.alternate!==g)throw Error(r(190))}if(h.tag!==3)throw Error(r(188));return h.stateNode.current===h?s:u}function d(s){var u=s.tag;if(u===5||u===26||u===27||u===6)return s;for(s=s.child;s!==null;){if(u=d(s),u!==null)return u;s=s.sibling}return null}var v=Object.assign,m=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),T=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),M=Symbol.for("react.memo_cache_sentinel"),z=Symbol.iterator;function P(s){return s===null||typeof s!="object"?null:(s=z&&s[z]||s["@@iterator"],typeof s=="function"?s:null)}var G=Symbol.for("react.client.reference");function I(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===G?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case S:return"Fragment";case b:return"Profiler";case w:return"StrictMode";case D:return"Suspense";case A:return"SuspenseList";case _:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case x:return"Portal";case T:return s.displayName||"Context";case C:return(s._context.displayName||"Context")+".Consumer";case k:var u=s.render;return s=s.displayName,s||(s=u.displayName||u.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case j:return u=s.displayName||null,u!==null?u:I(s.type)||"Memo";case L:u=s._payload,s=s._init;try{return I(s(u))}catch{}}return null}var F=Array.isArray,B=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},Q=[],V=-1;function q(s){return{current:s}}function X(s){0>V||(s.current=Q[V],Q[V]=null,V--)}function U(s,u){V++,Q[V]=s.current,s.current=u}var te=q(null),ie=q(null),oe=q(null),ae=q(null);function we(s,u){switch(U(oe,u),U(ie,s),U(te,null),u.nodeType){case 9:case 11:s=(s=u.documentElement)&&(s=s.namespaceURI)?zC(s):0;break;default:if(s=u.tagName,u=u.namespaceURI)u=zC(u),s=IC(u,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}X(te),U(te,s)}function fe(){X(te),X(ie),X(oe)}function J(s){s.memoizedState!==null&&U(ae,s);var u=te.current,h=IC(u,s.type);u!==h&&(U(ie,s),U(te,h))}function ne(s){ie.current===s&&(X(te),X(ie)),ae.current===s&&(X(ae),nf._currentValue=K)}var re,ge;function Ne(s){if(re===void 0)try{throw Error()}catch(h){var u=h.stack.trim().match(/\n( *(at )?)/);re=u&&u[1]||"",ge=-1<h.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<h.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+re+s+ge}var Be=!1;function st(s,u){if(!s||Be)return"";Be=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(u){var Ee=function(){throw Error()};if(Object.defineProperty(Ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ee,[])}catch(me){var ve=me}Reflect.construct(s,[],Ee)}else{try{Ee.call()}catch(me){ve=me}s.call(Ee.prototype)}}else{try{throw Error()}catch(me){ve=me}(Ee=s())&&typeof Ee.catch=="function"&&Ee.catch(function(){})}}catch(me){if(me&&ve&&typeof me.stack=="string")return[me.stack,ve.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var E=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");E&&E.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var N=g.DetermineComponentFrameRoot(),O=N[0],$=N[1];if(O&&$){var W=O.split(`
44
+ `),ce=$.split(`
45
+ `);for(E=g=0;g<W.length&&!W[g].includes("DetermineComponentFrameRoot");)g++;for(;E<ce.length&&!ce[E].includes("DetermineComponentFrameRoot");)E++;if(g===W.length||E===ce.length)for(g=W.length-1,E=ce.length-1;1<=g&&0<=E&&W[g]!==ce[E];)E--;for(;1<=g&&0<=E;g--,E--)if(W[g]!==ce[E]){if(g!==1||E!==1)do if(g--,E--,0>E||W[g]!==ce[E]){var be=`
46
+ `+W[g].replace(" at new "," at ");return s.displayName&&be.includes("<anonymous>")&&(be=be.replace("<anonymous>",s.displayName)),be}while(1<=g&&0<=E);break}}}finally{Be=!1,Error.prepareStackTrace=h}return(h=s?s.displayName||s.name:"")?Ne(h):""}function Qe(s,u){switch(s.tag){case 26:case 27:case 5:return Ne(s.type);case 16:return Ne("Lazy");case 13:return s.child!==u&&u!==null?Ne("Suspense Fallback"):Ne("Suspense");case 19:return Ne("SuspenseList");case 0:case 15:return st(s.type,!1);case 11:return st(s.type.render,!1);case 1:return st(s.type,!0);case 31:return Ne("Activity");default:return""}}function Ke(s){try{var u="",h=null;do u+=Qe(s,h),h=s,s=s.return;while(s);return u}catch(g){return`
47
+ Error generating stack: `+g.message+`
48
+ `+g.stack}}var qe=Object.prototype.hasOwnProperty,De=e.unstable_scheduleCallback,Ge=e.unstable_cancelCallback,Ye=e.unstable_shouldYield,it=e.unstable_requestPaint,Pe=e.unstable_now,ct=e.unstable_getCurrentPriorityLevel,he=e.unstable_ImmediatePriority,Ce=e.unstable_UserBlockingPriority,je=e.unstable_NormalPriority,ze=e.unstable_LowPriority,Me=e.unstable_IdlePriority,Oe=e.log,ye=e.unstable_setDisableYieldValue,Y=null,le=null;function pe(s){if(typeof Oe=="function"&&ye(s),le&&typeof le.setStrictMode=="function")try{le.setStrictMode(Y,s)}catch{}}var de=Math.clz32?Math.clz32:Te,xe=Math.log,Le=Math.LN2;function Te(s){return s>>>=0,s===0?32:31-(xe(s)/Le|0)|0}var He=256,Ie=262144,Xe=4194304;function lt(s){var u=s&42;if(u!==0)return u;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ot(s,u,h){var g=s.pendingLanes;if(g===0)return 0;var E=0,N=s.suspendedLanes,O=s.pingedLanes;s=s.warmLanes;var $=g&134217727;return $!==0?(g=$&~N,g!==0?E=lt(g):(O&=$,O!==0?E=lt(O):h||(h=$&~s,h!==0&&(E=lt(h))))):($=g&~N,$!==0?E=lt($):O!==0?E=lt(O):h||(h=g&~s,h!==0&&(E=lt(h)))),E===0?0:u!==0&&u!==E&&(u&N)===0&&(N=E&-E,h=u&-u,N>=h||N===32&&(h&4194048)!==0)?u:E}function Ue(s,u){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&u)===0}function yt(s,u){switch(s){case 1:case 2:case 4:case 8:case 64:return u+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ht(){var s=Xe;return Xe<<=1,(Xe&62914560)===0&&(Xe=4194304),s}function ln(s){for(var u=[],h=0;31>h;h++)u.push(s);return u}function Ft(s,u){s.pendingLanes|=u,u!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Zn(s,u,h,g,E,N){var O=s.pendingLanes;s.pendingLanes=h,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=h,s.entangledLanes&=h,s.errorRecoveryDisabledLanes&=h,s.shellSuspendCounter=0;var $=s.entanglements,W=s.expirationTimes,ce=s.hiddenUpdates;for(h=O&~h;0<h;){var be=31-de(h),Ee=1<<be;$[be]=0,W[be]=-1;var ve=ce[be];if(ve!==null)for(ce[be]=null,be=0;be<ve.length;be++){var me=ve[be];me!==null&&(me.lane&=-536870913)}h&=~Ee}g!==0&&on(s,g,0),N!==0&&E===0&&s.tag!==0&&(s.suspendedLanes|=N&~(O&~u))}function on(s,u,h){s.pendingLanes|=u,s.suspendedLanes&=~u;var g=31-de(u);s.entangledLanes|=u,s.entanglements[g]=s.entanglements[g]|1073741824|h&261930}function yn(s,u){var h=s.entangledLanes|=u;for(s=s.entanglements;h;){var g=31-de(h),E=1<<g;E&u|s[g]&u&&(s[g]|=u),h&=~E}}function dn(s,u){var h=u&-u;return h=(h&42)!==0?1:xn(h),(h&(s.suspendedLanes|u))!==0?0:h}function xn(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function na(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function un(){var s=H.p;return s!==0?s:(s=window.event,s===void 0?32:o2(s.type))}function ra(s,u){var h=H.p;try{return H.p=s,u()}finally{H.p=h}}var qn=Math.random().toString(36).slice(2),rn="__reactFiber$"+qn,On="__reactProps$"+qn,kr="__reactContainer$"+qn,Un="__reactEvents$"+qn,Vn="__reactListeners$"+qn,ur="__reactHandles$"+qn,ts="__reactResources$"+qn,Hn="__reactMarker$"+qn;function To(s){delete s[rn],delete s[On],delete s[Un],delete s[Vn],delete s[ur]}function ns(s){var u=s[rn];if(u)return u;for(var h=s.parentNode;h;){if(u=h[kr]||h[rn]){if(h=u.alternate,u.child!==null||h!==null&&h.child!==null)for(s=$C(s);s!==null;){if(h=s[rn])return h;s=$C(s)}return u}s=h,h=s.parentNode}return null}function rs(s){if(s=s[rn]||s[kr]){var u=s.tag;if(u===5||u===6||u===13||u===31||u===26||u===27||u===3)return s}return null}function El(s){var u=s.tag;if(u===5||u===26||u===27||u===6)return s.stateNode;throw Error(r(33))}function as(s){var u=s[ts];return u||(u=s[ts]={hoistableStyles:new Map,hoistableScripts:new Map}),u}function Tn(s){s[Hn]=!0}var jd=new Set,Md={};function Ur(s,u){za(s,u),za(s+"Capture",u)}function za(s,u){for(Md[s]=u,s=0;s<u.length;s++)jd.add(u[s])}var No=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),gc={},yc={};function sm(s){return qe.call(yc,s)?!0:qe.call(gc,s)?!1:No.test(s)?yc[s]=!0:(gc[s]=!0,!1)}function cr(s,u,h){if(sm(u))if(h===null)s.removeAttribute(u);else{switch(typeof h){case"undefined":case"function":case"symbol":s.removeAttribute(u);return;case"boolean":var g=u.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){s.removeAttribute(u);return}}s.setAttribute(u,""+h)}}function is(s,u,h){if(h===null)s.removeAttribute(u);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(u);return}s.setAttribute(u,""+h)}}function aa(s,u,h,g){if(g===null)s.removeAttribute(h);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(h);return}s.setAttributeNS(u,h,""+g)}}function Gn(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Ar(s){var u=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function lm(s,u,h){var g=Object.getOwnPropertyDescriptor(s.constructor.prototype,u);if(!s.hasOwnProperty(u)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var E=g.get,N=g.set;return Object.defineProperty(s,u,{configurable:!0,get:function(){return E.call(this)},set:function(O){h=""+O,N.call(this,O)}}),Object.defineProperty(s,u,{enumerable:g.enumerable}),{getValue:function(){return h},setValue:function(O){h=""+O},stopTracking:function(){s._valueTracker=null,delete s[u]}}}}function Od(s){if(!s._valueTracker){var u=Ar(s)?"checked":"value";s._valueTracker=lm(s,u,""+s[u])}}function Ld(s){if(!s)return!1;var u=s._valueTracker;if(!u)return!0;var h=u.getValue(),g="";return s&&(g=Ar(s)?s.checked?"true":"false":s.value),s=g,s!==h?(u.setValue(s),!0):!1}function _d(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var __=/[\n"\\]/g;function ia(s){return s.replace(__,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function om(s,u,h,g,E,N,O,$){s.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?s.type=O:s.removeAttribute("type"),u!=null?O==="number"?(u===0&&s.value===""||s.value!=u)&&(s.value=""+Gn(u)):s.value!==""+Gn(u)&&(s.value=""+Gn(u)):O!=="submit"&&O!=="reset"||s.removeAttribute("value"),u!=null?um(s,O,Gn(u)):h!=null?um(s,O,Gn(h)):g!=null&&s.removeAttribute("value"),E==null&&N!=null&&(s.defaultChecked=!!N),E!=null&&(s.checked=E&&typeof E!="function"&&typeof E!="symbol"),$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?s.name=""+Gn($):s.removeAttribute("name")}function Mw(s,u,h,g,E,N,O,$){if(N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(s.type=N),u!=null||h!=null){if(!(N!=="submit"&&N!=="reset"||u!=null)){Od(s);return}h=h!=null?""+Gn(h):"",u=u!=null?""+Gn(u):h,$||u===s.value||(s.value=u),s.defaultValue=u}g=g??E,g=typeof g!="function"&&typeof g!="symbol"&&!!g,s.checked=$?s.checked:!!g,s.defaultChecked=!!g,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(s.name=O),Od(s)}function um(s,u,h){u==="number"&&_d(s.ownerDocument)===s||s.defaultValue===""+h||(s.defaultValue=""+h)}function ko(s,u,h,g){if(s=s.options,u){u={};for(var E=0;E<h.length;E++)u["$"+h[E]]=!0;for(h=0;h<s.length;h++)E=u.hasOwnProperty("$"+s[h].value),s[h].selected!==E&&(s[h].selected=E),E&&g&&(s[h].defaultSelected=!0)}else{for(h=""+Gn(h),u=null,E=0;E<s.length;E++){if(s[E].value===h){s[E].selected=!0,g&&(s[E].defaultSelected=!0);return}u!==null||s[E].disabled||(u=s[E])}u!==null&&(u.selected=!0)}}function Ow(s,u,h){if(u!=null&&(u=""+Gn(u),u!==s.value&&(s.value=u),h==null)){s.defaultValue!==u&&(s.defaultValue=u);return}s.defaultValue=h!=null?""+Gn(h):""}function Lw(s,u,h,g){if(u==null){if(g!=null){if(h!=null)throw Error(r(92));if(F(g)){if(1<g.length)throw Error(r(93));g=g[0]}h=g}h==null&&(h=""),u=h}h=Gn(u),s.defaultValue=h,g=s.textContent,g===h&&g!==""&&g!==null&&(s.value=g),Od(s)}function Ao(s,u){if(u){var h=s.firstChild;if(h&&h===s.lastChild&&h.nodeType===3){h.nodeValue=u;return}}s.textContent=u}var B_=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function _w(s,u,h){var g=u.indexOf("--")===0;h==null||typeof h=="boolean"||h===""?g?s.setProperty(u,""):u==="float"?s.cssFloat="":s[u]="":g?s.setProperty(u,h):typeof h!="number"||h===0||B_.has(u)?u==="float"?s.cssFloat=h:s[u]=(""+h).trim():s[u]=h+"px"}function Bw(s,u,h){if(u!=null&&typeof u!="object")throw Error(r(62));if(s=s.style,h!=null){for(var g in h)!h.hasOwnProperty(g)||u!=null&&u.hasOwnProperty(g)||(g.indexOf("--")===0?s.setProperty(g,""):g==="float"?s.cssFloat="":s[g]="");for(var E in u)g=u[E],u.hasOwnProperty(E)&&h[E]!==g&&_w(s,E,g)}else for(var N in u)u.hasOwnProperty(N)&&_w(s,N,u[N])}function cm(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var P_=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),z_=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Bd(s){return z_.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function vi(){}var fm=null;function dm(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Ro=null,Do=null;function Pw(s){var u=rs(s);if(u&&(s=u.stateNode)){var h=s[On]||null;e:switch(s=u.stateNode,u.type){case"input":if(om(s,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name),u=h.name,h.type==="radio"&&u!=null){for(h=s;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll('input[name="'+ia(""+u)+'"][type="radio"]'),u=0;u<h.length;u++){var g=h[u];if(g!==s&&g.form===s.form){var E=g[On]||null;if(!E)throw Error(r(90));om(g,E.value,E.defaultValue,E.defaultValue,E.checked,E.defaultChecked,E.type,E.name)}}for(u=0;u<h.length;u++)g=h[u],g.form===s.form&&Ld(g)}break e;case"textarea":Ow(s,h.value,h.defaultValue);break e;case"select":u=h.value,u!=null&&ko(s,!!h.multiple,u,!1)}}}var hm=!1;function zw(s,u,h){if(hm)return s(u,h);hm=!0;try{var g=s(u);return g}finally{if(hm=!1,(Ro!==null||Do!==null)&&(Eh(),Ro&&(u=Ro,s=Do,Do=Ro=null,Pw(u),s)))for(u=0;u<s.length;u++)Pw(s[u])}}function xc(s,u){var h=s.stateNode;if(h===null)return null;var g=h[On]||null;if(g===null)return null;h=g[u];e:switch(u){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(s=s.type,g=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!g;break e;default:s=!1}if(s)return null;if(h&&typeof h!="function")throw Error(r(231,u,typeof h));return h}var pi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vm=!1;if(pi)try{var bc={};Object.defineProperty(bc,"passive",{get:function(){vm=!0}}),window.addEventListener("test",bc,bc),window.removeEventListener("test",bc,bc)}catch{vm=!1}var ss=null,pm=null,Pd=null;function Iw(){if(Pd)return Pd;var s,u=pm,h=u.length,g,E="value"in ss?ss.value:ss.textContent,N=E.length;for(s=0;s<h&&u[s]===E[s];s++);var O=h-s;for(g=1;g<=O&&u[h-g]===E[N-g];g++);return Pd=E.slice(s,1<g?1-g:void 0)}function zd(s){var u=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&u===13&&(s=13)):s=u,s===10&&(s=13),32<=s||s===13?s:0}function Id(){return!0}function Fw(){return!1}function Rr(s){function u(h,g,E,N,O){this._reactName=h,this._targetInst=E,this.type=g,this.nativeEvent=N,this.target=O,this.currentTarget=null;for(var $ in s)s.hasOwnProperty($)&&(h=s[$],this[$]=h?h(N):N[$]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?Id:Fw,this.isPropagationStopped=Fw,this}return v(u.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=Id)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=Id)},persist:function(){},isPersistent:Id}),u}var Cl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Fd=Rr(Cl),wc=v({},Cl,{view:0,detail:0}),I_=Rr(wc),mm,gm,Sc,qd=v({},wc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xm,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Sc&&(Sc&&s.type==="mousemove"?(mm=s.screenX-Sc.screenX,gm=s.screenY-Sc.screenY):gm=mm=0,Sc=s),mm)},movementY:function(s){return"movementY"in s?s.movementY:gm}}),qw=Rr(qd),F_=v({},qd,{dataTransfer:0}),q_=Rr(F_),U_=v({},wc,{relatedTarget:0}),ym=Rr(U_),V_=v({},Cl,{animationName:0,elapsedTime:0,pseudoElement:0}),H_=Rr(V_),G_=v({},Cl,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),$_=Rr(G_),Y_=v({},Cl,{data:0}),Uw=Rr(Y_),K_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},X_={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Q_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function W_(s){var u=this.nativeEvent;return u.getModifierState?u.getModifierState(s):(s=Q_[s])?!!u[s]:!1}function xm(){return W_}var Z_=v({},wc,{key:function(s){if(s.key){var u=K_[s.key]||s.key;if(u!=="Unidentified")return u}return s.type==="keypress"?(s=zd(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?X_[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xm,charCode:function(s){return s.type==="keypress"?zd(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?zd(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),J_=Rr(Z_),e5=v({},qd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Vw=Rr(e5),t5=v({},wc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xm}),n5=Rr(t5),r5=v({},Cl,{propertyName:0,elapsedTime:0,pseudoElement:0}),a5=Rr(r5),i5=v({},qd,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),s5=Rr(i5),l5=v({},Cl,{newState:0,oldState:0}),o5=Rr(l5),u5=[9,13,27,32],bm=pi&&"CompositionEvent"in window,Ec=null;pi&&"documentMode"in document&&(Ec=document.documentMode);var c5=pi&&"TextEvent"in window&&!Ec,Hw=pi&&(!bm||Ec&&8<Ec&&11>=Ec),Gw=" ",$w=!1;function Yw(s,u){switch(s){case"keyup":return u5.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Kw(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var jo=!1;function f5(s,u){switch(s){case"compositionend":return Kw(u);case"keypress":return u.which!==32?null:($w=!0,Gw);case"textInput":return s=u.data,s===Gw&&$w?null:s;default:return null}}function d5(s,u){if(jo)return s==="compositionend"||!bm&&Yw(s,u)?(s=Iw(),Pd=pm=ss=null,jo=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1<u.char.length)return u.char;if(u.which)return String.fromCharCode(u.which)}return null;case"compositionend":return Hw&&u.locale!=="ko"?null:u.data;default:return null}}var h5={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Xw(s){var u=s&&s.nodeName&&s.nodeName.toLowerCase();return u==="input"?!!h5[s.type]:u==="textarea"}function Qw(s,u,h,g){Ro?Do?Do.push(g):Do=[g]:Ro=g,u=Dh(u,"onChange"),0<u.length&&(h=new Fd("onChange","change",null,h,g),s.push({event:h,listeners:u}))}var Cc=null,Tc=null;function v5(s){MC(s,0)}function Ud(s){var u=El(s);if(Ld(u))return s}function Ww(s,u){if(s==="change")return u}var Zw=!1;if(pi){var wm;if(pi){var Sm="oninput"in document;if(!Sm){var Jw=document.createElement("div");Jw.setAttribute("oninput","return;"),Sm=typeof Jw.oninput=="function"}wm=Sm}else wm=!1;Zw=wm&&(!document.documentMode||9<document.documentMode)}function eS(){Cc&&(Cc.detachEvent("onpropertychange",tS),Tc=Cc=null)}function tS(s){if(s.propertyName==="value"&&Ud(Tc)){var u=[];Qw(u,Tc,s,dm(s)),zw(v5,u)}}function p5(s,u,h){s==="focusin"?(eS(),Cc=u,Tc=h,Cc.attachEvent("onpropertychange",tS)):s==="focusout"&&eS()}function m5(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Ud(Tc)}function g5(s,u){if(s==="click")return Ud(u)}function y5(s,u){if(s==="input"||s==="change")return Ud(u)}function x5(s,u){return s===u&&(s!==0||1/s===1/u)||s!==s&&u!==u}var Vr=typeof Object.is=="function"?Object.is:x5;function Nc(s,u){if(Vr(s,u))return!0;if(typeof s!="object"||s===null||typeof u!="object"||u===null)return!1;var h=Object.keys(s),g=Object.keys(u);if(h.length!==g.length)return!1;for(g=0;g<h.length;g++){var E=h[g];if(!qe.call(u,E)||!Vr(s[E],u[E]))return!1}return!0}function nS(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function rS(s,u){var h=nS(s);s=0;for(var g;h;){if(h.nodeType===3){if(g=s+h.textContent.length,s<=u&&g>=u)return{node:h,offset:u-s};s=g}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=nS(h)}}function aS(s,u){return s&&u?s===u?!0:s&&s.nodeType===3?!1:u&&u.nodeType===3?aS(s,u.parentNode):"contains"in s?s.contains(u):s.compareDocumentPosition?!!(s.compareDocumentPosition(u)&16):!1:!1}function iS(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var u=_d(s.document);u instanceof s.HTMLIFrameElement;){try{var h=typeof u.contentWindow.location.href=="string"}catch{h=!1}if(h)s=u.contentWindow;else break;u=_d(s.document)}return u}function Em(s){var u=s&&s.nodeName&&s.nodeName.toLowerCase();return u&&(u==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||u==="textarea"||s.contentEditable==="true")}var b5=pi&&"documentMode"in document&&11>=document.documentMode,Mo=null,Cm=null,kc=null,Tm=!1;function sS(s,u,h){var g=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Tm||Mo==null||Mo!==_d(g)||(g=Mo,"selectionStart"in g&&Em(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),kc&&Nc(kc,g)||(kc=g,g=Dh(Cm,"onSelect"),0<g.length&&(u=new Fd("onSelect","select",null,u,h),s.push({event:u,listeners:g}),u.target=Mo)))}function Tl(s,u){var h={};return h[s.toLowerCase()]=u.toLowerCase(),h["Webkit"+s]="webkit"+u,h["Moz"+s]="moz"+u,h}var Oo={animationend:Tl("Animation","AnimationEnd"),animationiteration:Tl("Animation","AnimationIteration"),animationstart:Tl("Animation","AnimationStart"),transitionrun:Tl("Transition","TransitionRun"),transitionstart:Tl("Transition","TransitionStart"),transitioncancel:Tl("Transition","TransitionCancel"),transitionend:Tl("Transition","TransitionEnd")},Nm={},lS={};pi&&(lS=document.createElement("div").style,"AnimationEvent"in window||(delete Oo.animationend.animation,delete Oo.animationiteration.animation,delete Oo.animationstart.animation),"TransitionEvent"in window||delete Oo.transitionend.transition);function Nl(s){if(Nm[s])return Nm[s];if(!Oo[s])return s;var u=Oo[s],h;for(h in u)if(u.hasOwnProperty(h)&&h in lS)return Nm[s]=u[h];return s}var oS=Nl("animationend"),uS=Nl("animationiteration"),cS=Nl("animationstart"),w5=Nl("transitionrun"),S5=Nl("transitionstart"),E5=Nl("transitioncancel"),fS=Nl("transitionend"),dS=new Map,km="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");km.push("scrollEnd");function Ca(s,u){dS.set(s,u),Ur(u,[s])}var Vd=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var u=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(u))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},sa=[],Lo=0,Am=0;function Hd(){for(var s=Lo,u=Am=Lo=0;u<s;){var h=sa[u];sa[u++]=null;var g=sa[u];sa[u++]=null;var E=sa[u];sa[u++]=null;var N=sa[u];if(sa[u++]=null,g!==null&&E!==null){var O=g.pending;O===null?E.next=E:(E.next=O.next,O.next=E),g.pending=E}N!==0&&hS(h,E,N)}}function Gd(s,u,h,g){sa[Lo++]=s,sa[Lo++]=u,sa[Lo++]=h,sa[Lo++]=g,Am|=g,s.lanes|=g,s=s.alternate,s!==null&&(s.lanes|=g)}function Rm(s,u,h,g){return Gd(s,u,h,g),$d(s)}function kl(s,u){return Gd(s,null,null,u),$d(s)}function hS(s,u,h){s.lanes|=h;var g=s.alternate;g!==null&&(g.lanes|=h);for(var E=!1,N=s.return;N!==null;)N.childLanes|=h,g=N.alternate,g!==null&&(g.childLanes|=h),N.tag===22&&(s=N.stateNode,s===null||s._visibility&1||(E=!0)),s=N,N=N.return;return s.tag===3?(N=s.stateNode,E&&u!==null&&(E=31-de(h),s=N.hiddenUpdates,g=s[E],g===null?s[E]=[u]:g.push(u),u.lane=h|536870912),N):null}function $d(s){if(50<Xc)throw Xc=0,zg=null,Error(r(185));for(var u=s.return;u!==null;)s=u,u=s.return;return s.tag===3?s.stateNode:null}var _o={};function C5(s,u,h,g){this.tag=s,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Hr(s,u,h,g){return new C5(s,u,h,g)}function Dm(s){return s=s.prototype,!(!s||!s.isReactComponent)}function mi(s,u){var h=s.alternate;return h===null?(h=Hr(s.tag,u,s.key,s.mode),h.elementType=s.elementType,h.type=s.type,h.stateNode=s.stateNode,h.alternate=s,s.alternate=h):(h.pendingProps=u,h.type=s.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=s.flags&65011712,h.childLanes=s.childLanes,h.lanes=s.lanes,h.child=s.child,h.memoizedProps=s.memoizedProps,h.memoizedState=s.memoizedState,h.updateQueue=s.updateQueue,u=s.dependencies,h.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},h.sibling=s.sibling,h.index=s.index,h.ref=s.ref,h.refCleanup=s.refCleanup,h}function vS(s,u){s.flags&=65011714;var h=s.alternate;return h===null?(s.childLanes=0,s.lanes=u,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=h.childLanes,s.lanes=h.lanes,s.child=h.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=h.memoizedProps,s.memoizedState=h.memoizedState,s.updateQueue=h.updateQueue,s.type=h.type,u=h.dependencies,s.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext}),s}function Yd(s,u,h,g,E,N){var O=0;if(g=s,typeof s=="function")Dm(s)&&(O=1);else if(typeof s=="string")O=R3(s,h,te.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case _:return s=Hr(31,h,u,E),s.elementType=_,s.lanes=N,s;case S:return Al(h.children,E,N,u);case w:O=8,E|=24;break;case b:return s=Hr(12,h,u,E|2),s.elementType=b,s.lanes=N,s;case D:return s=Hr(13,h,u,E),s.elementType=D,s.lanes=N,s;case A:return s=Hr(19,h,u,E),s.elementType=A,s.lanes=N,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case T:O=10;break e;case C:O=9;break e;case k:O=11;break e;case j:O=14;break e;case L:O=16,g=null;break e}O=29,h=Error(r(130,s===null?"null":typeof s,"")),g=null}return u=Hr(O,h,u,E),u.elementType=s,u.type=g,u.lanes=N,u}function Al(s,u,h,g){return s=Hr(7,s,g,u),s.lanes=h,s}function jm(s,u,h){return s=Hr(6,s,null,u),s.lanes=h,s}function pS(s){var u=Hr(18,null,null,0);return u.stateNode=s,u}function Mm(s,u,h){return u=Hr(4,s.children!==null?s.children:[],s.key,u),u.lanes=h,u.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},u}var mS=new WeakMap;function la(s,u){if(typeof s=="object"&&s!==null){var h=mS.get(s);return h!==void 0?h:(u={value:s,source:u,stack:Ke(u)},mS.set(s,u),u)}return{value:s,source:u,stack:Ke(u)}}var Bo=[],Po=0,Kd=null,Ac=0,oa=[],ua=0,ls=null,Ia=1,Fa="";function gi(s,u){Bo[Po++]=Ac,Bo[Po++]=Kd,Kd=s,Ac=u}function gS(s,u,h){oa[ua++]=Ia,oa[ua++]=Fa,oa[ua++]=ls,ls=s;var g=Ia;s=Fa;var E=32-de(g)-1;g&=~(1<<E),h+=1;var N=32-de(u)+E;if(30<N){var O=E-E%5;N=(g&(1<<O)-1).toString(32),g>>=O,E-=O,Ia=1<<32-de(u)+E|h<<E|g,Fa=N+s}else Ia=1<<N|h<<E|g,Fa=s}function Om(s){s.return!==null&&(gi(s,1),gS(s,1,0))}function Lm(s){for(;s===Kd;)Kd=Bo[--Po],Bo[Po]=null,Ac=Bo[--Po],Bo[Po]=null;for(;s===ls;)ls=oa[--ua],oa[ua]=null,Fa=oa[--ua],oa[ua]=null,Ia=oa[--ua],oa[ua]=null}function yS(s,u){oa[ua++]=Ia,oa[ua++]=Fa,oa[ua++]=ls,Ia=u.id,Fa=u.overflow,ls=s}var Jn=null,Jt=null,Nt=!1,os=null,ca=!1,_m=Error(r(519));function us(s){var u=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Rc(la(u,s)),_m}function xS(s){var u=s.stateNode,h=s.type,g=s.memoizedProps;switch(u[rn]=s,u[On]=g,h){case"dialog":wt("cancel",u),wt("close",u);break;case"iframe":case"object":case"embed":wt("load",u);break;case"video":case"audio":for(h=0;h<Wc.length;h++)wt(Wc[h],u);break;case"source":wt("error",u);break;case"img":case"image":case"link":wt("error",u),wt("load",u);break;case"details":wt("toggle",u);break;case"input":wt("invalid",u),Mw(u,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":wt("invalid",u);break;case"textarea":wt("invalid",u),Lw(u,g.value,g.defaultValue,g.children)}h=g.children,typeof h!="string"&&typeof h!="number"&&typeof h!="bigint"||u.textContent===""+h||g.suppressHydrationWarning===!0||BC(u.textContent,h)?(g.popover!=null&&(wt("beforetoggle",u),wt("toggle",u)),g.onScroll!=null&&wt("scroll",u),g.onScrollEnd!=null&&wt("scrollend",u),g.onClick!=null&&(u.onclick=vi),u=!0):u=!1,u||us(s,!0)}function bS(s){for(Jn=s.return;Jn;)switch(Jn.tag){case 5:case 31:case 13:ca=!1;return;case 27:case 3:ca=!0;return;default:Jn=Jn.return}}function zo(s){if(s!==Jn)return!1;if(!Nt)return bS(s),Nt=!0,!1;var u=s.tag,h;if((h=u!==3&&u!==27)&&((h=u===5)&&(h=s.type,h=!(h!=="form"&&h!=="button")||Jg(s.type,s.memoizedProps)),h=!h),h&&Jt&&us(s),bS(s),u===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Jt=GC(s)}else if(u===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Jt=GC(s)}else u===27?(u=Jt,Es(s.type)?(s=ay,ay=null,Jt=s):Jt=u):Jt=Jn?da(s.stateNode.nextSibling):null;return!0}function Rl(){Jt=Jn=null,Nt=!1}function Bm(){var s=os;return s!==null&&(Or===null?Or=s:Or.push.apply(Or,s),os=null),s}function Rc(s){os===null?os=[s]:os.push(s)}var Pm=q(null),Dl=null,yi=null;function cs(s,u,h){U(Pm,u._currentValue),u._currentValue=h}function xi(s){s._currentValue=Pm.current,X(Pm)}function zm(s,u,h){for(;s!==null;){var g=s.alternate;if((s.childLanes&u)!==u?(s.childLanes|=u,g!==null&&(g.childLanes|=u)):g!==null&&(g.childLanes&u)!==u&&(g.childLanes|=u),s===h)break;s=s.return}}function Im(s,u,h,g){var E=s.child;for(E!==null&&(E.return=s);E!==null;){var N=E.dependencies;if(N!==null){var O=E.child;N=N.firstContext;e:for(;N!==null;){var $=N;N=E;for(var W=0;W<u.length;W++)if($.context===u[W]){N.lanes|=h,$=N.alternate,$!==null&&($.lanes|=h),zm(N.return,h,s),g||(O=null);break e}N=$.next}}else if(E.tag===18){if(O=E.return,O===null)throw Error(r(341));O.lanes|=h,N=O.alternate,N!==null&&(N.lanes|=h),zm(O,h,s),O=null}else O=E.child;if(O!==null)O.return=E;else for(O=E;O!==null;){if(O===s){O=null;break}if(E=O.sibling,E!==null){E.return=O.return,O=E;break}O=O.return}E=O}}function Io(s,u,h,g){s=null;for(var E=u,N=!1;E!==null;){if(!N){if((E.flags&524288)!==0)N=!0;else if((E.flags&262144)!==0)break}if(E.tag===10){var O=E.alternate;if(O===null)throw Error(r(387));if(O=O.memoizedProps,O!==null){var $=E.type;Vr(E.pendingProps.value,O.value)||(s!==null?s.push($):s=[$])}}else if(E===ae.current){if(O=E.alternate,O===null)throw Error(r(387));O.memoizedState.memoizedState!==E.memoizedState.memoizedState&&(s!==null?s.push(nf):s=[nf])}E=E.return}s!==null&&Im(u,s,h,g),u.flags|=262144}function Xd(s){for(s=s.firstContext;s!==null;){if(!Vr(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function jl(s){Dl=s,yi=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function er(s){return wS(Dl,s)}function Qd(s,u){return Dl===null&&jl(s),wS(s,u)}function wS(s,u){var h=u._currentValue;if(u={context:u,memoizedValue:h,next:null},yi===null){if(s===null)throw Error(r(308));yi=u,s.dependencies={lanes:0,firstContext:u},s.flags|=524288}else yi=yi.next=u;return h}var T5=typeof AbortController<"u"?AbortController:function(){var s=[],u=this.signal={aborted:!1,addEventListener:function(h,g){s.push(g)}};this.abort=function(){u.aborted=!0,s.forEach(function(h){return h()})}},N5=e.unstable_scheduleCallback,k5=e.unstable_NormalPriority,Nn={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Fm(){return{controller:new T5,data:new Map,refCount:0}}function Dc(s){s.refCount--,s.refCount===0&&N5(k5,function(){s.controller.abort()})}var jc=null,qm=0,Fo=0,qo=null;function A5(s,u){if(jc===null){var h=jc=[];qm=0,Fo=Hg(),qo={status:"pending",value:void 0,then:function(g){h.push(g)}}}return qm++,u.then(SS,SS),u}function SS(){if(--qm===0&&jc!==null){qo!==null&&(qo.status="fulfilled");var s=jc;jc=null,Fo=0,qo=null;for(var u=0;u<s.length;u++)(0,s[u])()}}function R5(s,u){var h=[],g={status:"pending",value:null,reason:null,then:function(E){h.push(E)}};return s.then(function(){g.status="fulfilled",g.value=u;for(var E=0;E<h.length;E++)(0,h[E])(u)},function(E){for(g.status="rejected",g.reason=E,E=0;E<h.length;E++)(0,h[E])(void 0)}),g}var ES=B.S;B.S=function(s,u){sC=Pe(),typeof u=="object"&&u!==null&&typeof u.then=="function"&&A5(s,u),ES!==null&&ES(s,u)};var Ml=q(null);function Um(){var s=Ml.current;return s!==null?s:Gt.pooledCache}function Wd(s,u){u===null?U(Ml,Ml.current):U(Ml,u.pool)}function CS(){var s=Um();return s===null?null:{parent:Nn._currentValue,pool:s}}var Uo=Error(r(460)),Vm=Error(r(474)),Zd=Error(r(542)),Jd={then:function(){}};function TS(s){return s=s.status,s==="fulfilled"||s==="rejected"}function NS(s,u,h){switch(h=s[h],h===void 0?s.push(u):h!==u&&(u.then(vi,vi),u=h),u.status){case"fulfilled":return u.value;case"rejected":throw s=u.reason,AS(s),s;default:if(typeof u.status=="string")u.then(vi,vi);else{if(s=Gt,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=u,s.status="pending",s.then(function(g){if(u.status==="pending"){var E=u;E.status="fulfilled",E.value=g}},function(g){if(u.status==="pending"){var E=u;E.status="rejected",E.reason=g}})}switch(u.status){case"fulfilled":return u.value;case"rejected":throw s=u.reason,AS(s),s}throw Ll=u,Uo}}function Ol(s){try{var u=s._init;return u(s._payload)}catch(h){throw h!==null&&typeof h=="object"&&typeof h.then=="function"?(Ll=h,Uo):h}}var Ll=null;function kS(){if(Ll===null)throw Error(r(459));var s=Ll;return Ll=null,s}function AS(s){if(s===Uo||s===Zd)throw Error(r(483))}var Vo=null,Mc=0;function eh(s){var u=Mc;return Mc+=1,Vo===null&&(Vo=[]),NS(Vo,s,u)}function Oc(s,u){u=u.props.ref,s.ref=u!==void 0?u:null}function th(s,u){throw u.$$typeof===m?Error(r(525)):(s=Object.prototype.toString.call(u),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":s)))}function RS(s){function u(se,ee){if(s){var ue=se.deletions;ue===null?(se.deletions=[ee],se.flags|=16):ue.push(ee)}}function h(se,ee){if(!s)return null;for(;ee!==null;)u(se,ee),ee=ee.sibling;return null}function g(se){for(var ee=new Map;se!==null;)se.key!==null?ee.set(se.key,se):ee.set(se.index,se),se=se.sibling;return ee}function E(se,ee){return se=mi(se,ee),se.index=0,se.sibling=null,se}function N(se,ee,ue){return se.index=ue,s?(ue=se.alternate,ue!==null?(ue=ue.index,ue<ee?(se.flags|=67108866,ee):ue):(se.flags|=67108866,ee)):(se.flags|=1048576,ee)}function O(se){return s&&se.alternate===null&&(se.flags|=67108866),se}function $(se,ee,ue,Se){return ee===null||ee.tag!==6?(ee=jm(ue,se.mode,Se),ee.return=se,ee):(ee=E(ee,ue),ee.return=se,ee)}function W(se,ee,ue,Se){var Je=ue.type;return Je===S?be(se,ee,ue.props.children,Se,ue.key):ee!==null&&(ee.elementType===Je||typeof Je=="object"&&Je!==null&&Je.$$typeof===L&&Ol(Je)===ee.type)?(ee=E(ee,ue.props),Oc(ee,ue),ee.return=se,ee):(ee=Yd(ue.type,ue.key,ue.props,null,se.mode,Se),Oc(ee,ue),ee.return=se,ee)}function ce(se,ee,ue,Se){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ue.containerInfo||ee.stateNode.implementation!==ue.implementation?(ee=Mm(ue,se.mode,Se),ee.return=se,ee):(ee=E(ee,ue.children||[]),ee.return=se,ee)}function be(se,ee,ue,Se,Je){return ee===null||ee.tag!==7?(ee=Al(ue,se.mode,Se,Je),ee.return=se,ee):(ee=E(ee,ue),ee.return=se,ee)}function Ee(se,ee,ue){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ee=jm(""+ee,se.mode,ue),ee.return=se,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:return ue=Yd(ee.type,ee.key,ee.props,null,se.mode,ue),Oc(ue,ee),ue.return=se,ue;case x:return ee=Mm(ee,se.mode,ue),ee.return=se,ee;case L:return ee=Ol(ee),Ee(se,ee,ue)}if(F(ee)||P(ee))return ee=Al(ee,se.mode,ue,null),ee.return=se,ee;if(typeof ee.then=="function")return Ee(se,eh(ee),ue);if(ee.$$typeof===T)return Ee(se,Qd(se,ee),ue);th(se,ee)}return null}function ve(se,ee,ue,Se){var Je=ee!==null?ee.key:null;if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return Je!==null?null:$(se,ee,""+ue,Se);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case y:return ue.key===Je?W(se,ee,ue,Se):null;case x:return ue.key===Je?ce(se,ee,ue,Se):null;case L:return ue=Ol(ue),ve(se,ee,ue,Se)}if(F(ue)||P(ue))return Je!==null?null:be(se,ee,ue,Se,null);if(typeof ue.then=="function")return ve(se,ee,eh(ue),Se);if(ue.$$typeof===T)return ve(se,ee,Qd(se,ue),Se);th(se,ue)}return null}function me(se,ee,ue,Se,Je){if(typeof Se=="string"&&Se!==""||typeof Se=="number"||typeof Se=="bigint")return se=se.get(ue)||null,$(ee,se,""+Se,Je);if(typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case y:return se=se.get(Se.key===null?ue:Se.key)||null,W(ee,se,Se,Je);case x:return se=se.get(Se.key===null?ue:Se.key)||null,ce(ee,se,Se,Je);case L:return Se=Ol(Se),me(se,ee,ue,Se,Je)}if(F(Se)||P(Se))return se=se.get(ue)||null,be(ee,se,Se,Je,null);if(typeof Se.then=="function")return me(se,ee,ue,eh(Se),Je);if(Se.$$typeof===T)return me(se,ee,ue,Qd(ee,Se),Je);th(ee,Se)}return null}function Ve(se,ee,ue,Se){for(var Je=null,jt=null,$e=ee,vt=ee=0,Tt=null;$e!==null&&vt<ue.length;vt++){$e.index>vt?(Tt=$e,$e=null):Tt=$e.sibling;var Mt=ve(se,$e,ue[vt],Se);if(Mt===null){$e===null&&($e=Tt);break}s&&$e&&Mt.alternate===null&&u(se,$e),ee=N(Mt,ee,vt),jt===null?Je=Mt:jt.sibling=Mt,jt=Mt,$e=Tt}if(vt===ue.length)return h(se,$e),Nt&&gi(se,vt),Je;if($e===null){for(;vt<ue.length;vt++)$e=Ee(se,ue[vt],Se),$e!==null&&(ee=N($e,ee,vt),jt===null?Je=$e:jt.sibling=$e,jt=$e);return Nt&&gi(se,vt),Je}for($e=g($e);vt<ue.length;vt++)Tt=me($e,se,vt,ue[vt],Se),Tt!==null&&(s&&Tt.alternate!==null&&$e.delete(Tt.key===null?vt:Tt.key),ee=N(Tt,ee,vt),jt===null?Je=Tt:jt.sibling=Tt,jt=Tt);return s&&$e.forEach(function(As){return u(se,As)}),Nt&&gi(se,vt),Je}function rt(se,ee,ue,Se){if(ue==null)throw Error(r(151));for(var Je=null,jt=null,$e=ee,vt=ee=0,Tt=null,Mt=ue.next();$e!==null&&!Mt.done;vt++,Mt=ue.next()){$e.index>vt?(Tt=$e,$e=null):Tt=$e.sibling;var As=ve(se,$e,Mt.value,Se);if(As===null){$e===null&&($e=Tt);break}s&&$e&&As.alternate===null&&u(se,$e),ee=N(As,ee,vt),jt===null?Je=As:jt.sibling=As,jt=As,$e=Tt}if(Mt.done)return h(se,$e),Nt&&gi(se,vt),Je;if($e===null){for(;!Mt.done;vt++,Mt=ue.next())Mt=Ee(se,Mt.value,Se),Mt!==null&&(ee=N(Mt,ee,vt),jt===null?Je=Mt:jt.sibling=Mt,jt=Mt);return Nt&&gi(se,vt),Je}for($e=g($e);!Mt.done;vt++,Mt=ue.next())Mt=me($e,se,vt,Mt.value,Se),Mt!==null&&(s&&Mt.alternate!==null&&$e.delete(Mt.key===null?vt:Mt.key),ee=N(Mt,ee,vt),jt===null?Je=Mt:jt.sibling=Mt,jt=Mt);return s&&$e.forEach(function(F3){return u(se,F3)}),Nt&&gi(se,vt),Je}function Vt(se,ee,ue,Se){if(typeof ue=="object"&&ue!==null&&ue.type===S&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case y:e:{for(var Je=ue.key;ee!==null;){if(ee.key===Je){if(Je=ue.type,Je===S){if(ee.tag===7){h(se,ee.sibling),Se=E(ee,ue.props.children),Se.return=se,se=Se;break e}}else if(ee.elementType===Je||typeof Je=="object"&&Je!==null&&Je.$$typeof===L&&Ol(Je)===ee.type){h(se,ee.sibling),Se=E(ee,ue.props),Oc(Se,ue),Se.return=se,se=Se;break e}h(se,ee);break}else u(se,ee);ee=ee.sibling}ue.type===S?(Se=Al(ue.props.children,se.mode,Se,ue.key),Se.return=se,se=Se):(Se=Yd(ue.type,ue.key,ue.props,null,se.mode,Se),Oc(Se,ue),Se.return=se,se=Se)}return O(se);case x:e:{for(Je=ue.key;ee!==null;){if(ee.key===Je)if(ee.tag===4&&ee.stateNode.containerInfo===ue.containerInfo&&ee.stateNode.implementation===ue.implementation){h(se,ee.sibling),Se=E(ee,ue.children||[]),Se.return=se,se=Se;break e}else{h(se,ee);break}else u(se,ee);ee=ee.sibling}Se=Mm(ue,se.mode,Se),Se.return=se,se=Se}return O(se);case L:return ue=Ol(ue),Vt(se,ee,ue,Se)}if(F(ue))return Ve(se,ee,ue,Se);if(P(ue)){if(Je=P(ue),typeof Je!="function")throw Error(r(150));return ue=Je.call(ue),rt(se,ee,ue,Se)}if(typeof ue.then=="function")return Vt(se,ee,eh(ue),Se);if(ue.$$typeof===T)return Vt(se,ee,Qd(se,ue),Se);th(se,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint"?(ue=""+ue,ee!==null&&ee.tag===6?(h(se,ee.sibling),Se=E(ee,ue),Se.return=se,se=Se):(h(se,ee),Se=jm(ue,se.mode,Se),Se.return=se,se=Se),O(se)):h(se,ee)}return function(se,ee,ue,Se){try{Mc=0;var Je=Vt(se,ee,ue,Se);return Vo=null,Je}catch($e){if($e===Uo||$e===Zd)throw $e;var jt=Hr(29,$e,null,se.mode);return jt.lanes=Se,jt.return=se,jt}finally{}}}var _l=RS(!0),DS=RS(!1),fs=!1;function Hm(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Gm(s,u){s=s.updateQueue,u.updateQueue===s&&(u.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function ds(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function hs(s,u,h){var g=s.updateQueue;if(g===null)return null;if(g=g.shared,(Lt&2)!==0){var E=g.pending;return E===null?u.next=u:(u.next=E.next,E.next=u),g.pending=u,u=$d(s),hS(s,null,h),u}return Gd(s,g,u,h),$d(s)}function Lc(s,u,h){if(u=u.updateQueue,u!==null&&(u=u.shared,(h&4194048)!==0)){var g=u.lanes;g&=s.pendingLanes,h|=g,u.lanes=h,yn(s,h)}}function $m(s,u){var h=s.updateQueue,g=s.alternate;if(g!==null&&(g=g.updateQueue,h===g)){var E=null,N=null;if(h=h.firstBaseUpdate,h!==null){do{var O={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};N===null?E=N=O:N=N.next=O,h=h.next}while(h!==null);N===null?E=N=u:N=N.next=u}else E=N=u;h={baseState:g.baseState,firstBaseUpdate:E,lastBaseUpdate:N,shared:g.shared,callbacks:g.callbacks},s.updateQueue=h;return}s=h.lastBaseUpdate,s===null?h.firstBaseUpdate=u:s.next=u,h.lastBaseUpdate=u}var Ym=!1;function _c(){if(Ym){var s=qo;if(s!==null)throw s}}function Bc(s,u,h,g){Ym=!1;var E=s.updateQueue;fs=!1;var N=E.firstBaseUpdate,O=E.lastBaseUpdate,$=E.shared.pending;if($!==null){E.shared.pending=null;var W=$,ce=W.next;W.next=null,O===null?N=ce:O.next=ce,O=W;var be=s.alternate;be!==null&&(be=be.updateQueue,$=be.lastBaseUpdate,$!==O&&($===null?be.firstBaseUpdate=ce:$.next=ce,be.lastBaseUpdate=W))}if(N!==null){var Ee=E.baseState;O=0,be=ce=W=null,$=N;do{var ve=$.lane&-536870913,me=ve!==$.lane;if(me?(Ct&ve)===ve:(g&ve)===ve){ve!==0&&ve===Fo&&(Ym=!0),be!==null&&(be=be.next={lane:0,tag:$.tag,payload:$.payload,callback:null,next:null});e:{var Ve=s,rt=$;ve=u;var Vt=h;switch(rt.tag){case 1:if(Ve=rt.payload,typeof Ve=="function"){Ee=Ve.call(Vt,Ee,ve);break e}Ee=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=rt.payload,ve=typeof Ve=="function"?Ve.call(Vt,Ee,ve):Ve,ve==null)break e;Ee=v({},Ee,ve);break e;case 2:fs=!0}}ve=$.callback,ve!==null&&(s.flags|=64,me&&(s.flags|=8192),me=E.callbacks,me===null?E.callbacks=[ve]:me.push(ve))}else me={lane:ve,tag:$.tag,payload:$.payload,callback:$.callback,next:null},be===null?(ce=be=me,W=Ee):be=be.next=me,O|=ve;if($=$.next,$===null){if($=E.shared.pending,$===null)break;me=$,$=me.next,me.next=null,E.lastBaseUpdate=me,E.shared.pending=null}}while(!0);be===null&&(W=Ee),E.baseState=W,E.firstBaseUpdate=ce,E.lastBaseUpdate=be,N===null&&(E.shared.lanes=0),ys|=O,s.lanes=O,s.memoizedState=Ee}}function jS(s,u){if(typeof s!="function")throw Error(r(191,s));s.call(u)}function MS(s,u){var h=s.callbacks;if(h!==null)for(s.callbacks=null,s=0;s<h.length;s++)jS(h[s],u)}var Ho=q(null),nh=q(0);function OS(s,u){s=Ai,U(nh,s),U(Ho,u),Ai=s|u.baseLanes}function Km(){U(nh,Ai),U(Ho,Ho.current)}function Xm(){Ai=nh.current,X(Ho),X(nh)}var Gr=q(null),fa=null;function vs(s){var u=s.alternate;U(bn,bn.current&1),U(Gr,s),fa===null&&(u===null||Ho.current!==null||u.memoizedState!==null)&&(fa=s)}function Qm(s){U(bn,bn.current),U(Gr,s),fa===null&&(fa=s)}function LS(s){s.tag===22?(U(bn,bn.current),U(Gr,s),fa===null&&(fa=s)):ps()}function ps(){U(bn,bn.current),U(Gr,Gr.current)}function $r(s){X(Gr),fa===s&&(fa=null),X(bn)}var bn=q(0);function rh(s){for(var u=s;u!==null;){if(u.tag===13){var h=u.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||ny(h)||ry(h)))return u}else if(u.tag===19&&(u.memoizedProps.revealOrder==="forwards"||u.memoizedProps.revealOrder==="backwards"||u.memoizedProps.revealOrder==="unstable_legacy-backwards"||u.memoizedProps.revealOrder==="together")){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===s)break;for(;u.sibling===null;){if(u.return===null||u.return===s)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var bi=0,ft=null,qt=null,kn=null,ah=!1,Go=!1,Bl=!1,ih=0,Pc=0,$o=null,D5=0;function hn(){throw Error(r(321))}function Wm(s,u){if(u===null)return!1;for(var h=0;h<u.length&&h<s.length;h++)if(!Vr(s[h],u[h]))return!1;return!0}function Zm(s,u,h,g,E,N){return bi=N,ft=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,B.H=s===null||s.memoizedState===null?gE:hg,Bl=!1,N=h(g,E),Bl=!1,Go&&(N=BS(u,h,g,E)),_S(s),N}function _S(s){B.H=Fc;var u=qt!==null&&qt.next!==null;if(bi=0,kn=qt=ft=null,ah=!1,Pc=0,$o=null,u)throw Error(r(300));s===null||An||(s=s.dependencies,s!==null&&Xd(s)&&(An=!0))}function BS(s,u,h,g){ft=s;var E=0;do{if(Go&&($o=null),Pc=0,Go=!1,25<=E)throw Error(r(301));if(E+=1,kn=qt=null,s.updateQueue!=null){var N=s.updateQueue;N.lastEffect=null,N.events=null,N.stores=null,N.memoCache!=null&&(N.memoCache.index=0)}B.H=yE,N=u(h,g)}while(Go);return N}function j5(){var s=B.H,u=s.useState()[0];return u=typeof u.then=="function"?zc(u):u,s=s.useState()[0],(qt!==null?qt.memoizedState:null)!==s&&(ft.flags|=1024),u}function Jm(){var s=ih!==0;return ih=0,s}function eg(s,u,h){u.updateQueue=s.updateQueue,u.flags&=-2053,s.lanes&=~h}function tg(s){if(ah){for(s=s.memoizedState;s!==null;){var u=s.queue;u!==null&&(u.pending=null),s=s.next}ah=!1}bi=0,kn=qt=ft=null,Go=!1,Pc=ih=0,$o=null}function xr(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return kn===null?ft.memoizedState=kn=s:kn=kn.next=s,kn}function wn(){if(qt===null){var s=ft.alternate;s=s!==null?s.memoizedState:null}else s=qt.next;var u=kn===null?ft.memoizedState:kn.next;if(u!==null)kn=u,qt=s;else{if(s===null)throw ft.alternate===null?Error(r(467)):Error(r(310));qt=s,s={memoizedState:qt.memoizedState,baseState:qt.baseState,baseQueue:qt.baseQueue,queue:qt.queue,next:null},kn===null?ft.memoizedState=kn=s:kn=kn.next=s}return kn}function sh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function zc(s){var u=Pc;return Pc+=1,$o===null&&($o=[]),s=NS($o,s,u),u=ft,(kn===null?u.memoizedState:kn.next)===null&&(u=u.alternate,B.H=u===null||u.memoizedState===null?gE:hg),s}function lh(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return zc(s);if(s.$$typeof===T)return er(s)}throw Error(r(438,String(s)))}function ng(s){var u=null,h=ft.updateQueue;if(h!==null&&(u=h.memoCache),u==null){var g=ft.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(u={data:g.data.map(function(E){return E.slice()}),index:0})))}if(u==null&&(u={data:[],index:0}),h===null&&(h=sh(),ft.updateQueue=h),h.memoCache=u,h=u.data[u.index],h===void 0)for(h=u.data[u.index]=Array(s),g=0;g<s;g++)h[g]=M;return u.index++,h}function wi(s,u){return typeof u=="function"?u(s):u}function oh(s){var u=wn();return rg(u,qt,s)}function rg(s,u,h){var g=s.queue;if(g===null)throw Error(r(311));g.lastRenderedReducer=h;var E=s.baseQueue,N=g.pending;if(N!==null){if(E!==null){var O=E.next;E.next=N.next,N.next=O}u.baseQueue=E=N,g.pending=null}if(N=s.baseState,E===null)s.memoizedState=N;else{u=E.next;var $=O=null,W=null,ce=u,be=!1;do{var Ee=ce.lane&-536870913;if(Ee!==ce.lane?(Ct&Ee)===Ee:(bi&Ee)===Ee){var ve=ce.revertLane;if(ve===0)W!==null&&(W=W.next={lane:0,revertLane:0,gesture:null,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),Ee===Fo&&(be=!0);else if((bi&ve)===ve){ce=ce.next,ve===Fo&&(be=!0);continue}else Ee={lane:0,revertLane:ce.revertLane,gesture:null,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null},W===null?($=W=Ee,O=N):W=W.next=Ee,ft.lanes|=ve,ys|=ve;Ee=ce.action,Bl&&h(N,Ee),N=ce.hasEagerState?ce.eagerState:h(N,Ee)}else ve={lane:Ee,revertLane:ce.revertLane,gesture:ce.gesture,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null},W===null?($=W=ve,O=N):W=W.next=ve,ft.lanes|=Ee,ys|=Ee;ce=ce.next}while(ce!==null&&ce!==u);if(W===null?O=N:W.next=$,!Vr(N,s.memoizedState)&&(An=!0,be&&(h=qo,h!==null)))throw h;s.memoizedState=N,s.baseState=O,s.baseQueue=W,g.lastRenderedState=N}return E===null&&(g.lanes=0),[s.memoizedState,g.dispatch]}function ag(s){var u=wn(),h=u.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=s;var g=h.dispatch,E=h.pending,N=u.memoizedState;if(E!==null){h.pending=null;var O=E=E.next;do N=s(N,O.action),O=O.next;while(O!==E);Vr(N,u.memoizedState)||(An=!0),u.memoizedState=N,u.baseQueue===null&&(u.baseState=N),h.lastRenderedState=N}return[N,g]}function PS(s,u,h){var g=ft,E=wn(),N=Nt;if(N){if(h===void 0)throw Error(r(407));h=h()}else h=u();var O=!Vr((qt||E).memoizedState,h);if(O&&(E.memoizedState=h,An=!0),E=E.queue,lg(FS.bind(null,g,E,s),[s]),E.getSnapshot!==u||O||kn!==null&&kn.memoizedState.tag&1){if(g.flags|=2048,Yo(9,{destroy:void 0},IS.bind(null,g,E,h,u),null),Gt===null)throw Error(r(349));N||(bi&127)!==0||zS(g,u,h)}return h}function zS(s,u,h){s.flags|=16384,s={getSnapshot:u,value:h},u=ft.updateQueue,u===null?(u=sh(),ft.updateQueue=u,u.stores=[s]):(h=u.stores,h===null?u.stores=[s]:h.push(s))}function IS(s,u,h,g){u.value=h,u.getSnapshot=g,qS(u)&&US(s)}function FS(s,u,h){return h(function(){qS(u)&&US(s)})}function qS(s){var u=s.getSnapshot;s=s.value;try{var h=u();return!Vr(s,h)}catch{return!0}}function US(s){var u=kl(s,2);u!==null&&Lr(u,s,2)}function ig(s){var u=xr();if(typeof s=="function"){var h=s;if(s=h(),Bl){pe(!0);try{h()}finally{pe(!1)}}}return u.memoizedState=u.baseState=s,u.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:s},u}function VS(s,u,h,g){return s.baseState=h,rg(s,qt,typeof g=="function"?g:wi)}function M5(s,u,h,g,E){if(fh(s))throw Error(r(485));if(s=u.action,s!==null){var N={payload:E,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){N.listeners.push(O)}};B.T!==null?h(!0):N.isTransition=!1,g(N),h=u.pending,h===null?(N.next=u.pending=N,HS(u,N)):(N.next=h.next,u.pending=h.next=N)}}function HS(s,u){var h=u.action,g=u.payload,E=s.state;if(u.isTransition){var N=B.T,O={};B.T=O;try{var $=h(E,g),W=B.S;W!==null&&W(O,$),GS(s,u,$)}catch(ce){sg(s,u,ce)}finally{N!==null&&O.types!==null&&(N.types=O.types),B.T=N}}else try{N=h(E,g),GS(s,u,N)}catch(ce){sg(s,u,ce)}}function GS(s,u,h){h!==null&&typeof h=="object"&&typeof h.then=="function"?h.then(function(g){$S(s,u,g)},function(g){return sg(s,u,g)}):$S(s,u,h)}function $S(s,u,h){u.status="fulfilled",u.value=h,YS(u),s.state=h,u=s.pending,u!==null&&(h=u.next,h===u?s.pending=null:(h=h.next,u.next=h,HS(s,h)))}function sg(s,u,h){var g=s.pending;if(s.pending=null,g!==null){g=g.next;do u.status="rejected",u.reason=h,YS(u),u=u.next;while(u!==g)}s.action=null}function YS(s){s=s.listeners;for(var u=0;u<s.length;u++)(0,s[u])()}function KS(s,u){return u}function XS(s,u){if(Nt){var h=Gt.formState;if(h!==null){e:{var g=ft;if(Nt){if(Jt){t:{for(var E=Jt,N=ca;E.nodeType!==8;){if(!N){E=null;break t}if(E=da(E.nextSibling),E===null){E=null;break t}}N=E.data,E=N==="F!"||N==="F"?E:null}if(E){Jt=da(E.nextSibling),g=E.data==="F!";break e}}us(g)}g=!1}g&&(u=h[0])}}return h=xr(),h.memoizedState=h.baseState=u,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:KS,lastRenderedState:u},h.queue=g,h=vE.bind(null,ft,g),g.dispatch=h,g=ig(!1),N=dg.bind(null,ft,!1,g.queue),g=xr(),E={state:u,dispatch:null,action:s,pending:null},g.queue=E,h=M5.bind(null,ft,E,N,h),E.dispatch=h,g.memoizedState=s,[u,h,!1]}function QS(s){var u=wn();return WS(u,qt,s)}function WS(s,u,h){if(u=rg(s,u,KS)[0],s=oh(wi)[0],typeof u=="object"&&u!==null&&typeof u.then=="function")try{var g=zc(u)}catch(O){throw O===Uo?Zd:O}else g=u;u=wn();var E=u.queue,N=E.dispatch;return h!==u.memoizedState&&(ft.flags|=2048,Yo(9,{destroy:void 0},O5.bind(null,E,h),null)),[g,N,s]}function O5(s,u){s.action=u}function ZS(s){var u=wn(),h=qt;if(h!==null)return WS(u,h,s);wn(),u=u.memoizedState,h=wn();var g=h.queue.dispatch;return h.memoizedState=s,[u,g,!1]}function Yo(s,u,h,g){return s={tag:s,create:h,deps:g,inst:u,next:null},u=ft.updateQueue,u===null&&(u=sh(),ft.updateQueue=u),h=u.lastEffect,h===null?u.lastEffect=s.next=s:(g=h.next,h.next=s,s.next=g,u.lastEffect=s),s}function JS(){return wn().memoizedState}function uh(s,u,h,g){var E=xr();ft.flags|=s,E.memoizedState=Yo(1|u,{destroy:void 0},h,g===void 0?null:g)}function ch(s,u,h,g){var E=wn();g=g===void 0?null:g;var N=E.memoizedState.inst;qt!==null&&g!==null&&Wm(g,qt.memoizedState.deps)?E.memoizedState=Yo(u,N,h,g):(ft.flags|=s,E.memoizedState=Yo(1|u,N,h,g))}function eE(s,u){uh(8390656,8,s,u)}function lg(s,u){ch(2048,8,s,u)}function L5(s){ft.flags|=4;var u=ft.updateQueue;if(u===null)u=sh(),ft.updateQueue=u,u.events=[s];else{var h=u.events;h===null?u.events=[s]:h.push(s)}}function tE(s){var u=wn().memoizedState;return L5({ref:u,nextImpl:s}),function(){if((Lt&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}function nE(s,u){return ch(4,2,s,u)}function rE(s,u){return ch(4,4,s,u)}function aE(s,u){if(typeof u=="function"){s=s();var h=u(s);return function(){typeof h=="function"?h():u(null)}}if(u!=null)return s=s(),u.current=s,function(){u.current=null}}function iE(s,u,h){h=h!=null?h.concat([s]):null,ch(4,4,aE.bind(null,u,s),h)}function og(){}function sE(s,u){var h=wn();u=u===void 0?null:u;var g=h.memoizedState;return u!==null&&Wm(u,g[1])?g[0]:(h.memoizedState=[s,u],s)}function lE(s,u){var h=wn();u=u===void 0?null:u;var g=h.memoizedState;if(u!==null&&Wm(u,g[1]))return g[0];if(g=s(),Bl){pe(!0);try{s()}finally{pe(!1)}}return h.memoizedState=[g,u],g}function ug(s,u,h){return h===void 0||(bi&1073741824)!==0&&(Ct&261930)===0?s.memoizedState=u:(s.memoizedState=h,s=oC(),ft.lanes|=s,ys|=s,h)}function oE(s,u,h,g){return Vr(h,u)?h:Ho.current!==null?(s=ug(s,h,g),Vr(s,u)||(An=!0),s):(bi&42)===0||(bi&1073741824)!==0&&(Ct&261930)===0?(An=!0,s.memoizedState=h):(s=oC(),ft.lanes|=s,ys|=s,u)}function uE(s,u,h,g,E){var N=H.p;H.p=N!==0&&8>N?N:8;var O=B.T,$={};B.T=$,dg(s,!1,u,h);try{var W=E(),ce=B.S;if(ce!==null&&ce($,W),W!==null&&typeof W=="object"&&typeof W.then=="function"){var be=R5(W,g);Ic(s,u,be,Xr(s))}else Ic(s,u,g,Xr(s))}catch(Ee){Ic(s,u,{then:function(){},status:"rejected",reason:Ee},Xr())}finally{H.p=N,O!==null&&$.types!==null&&(O.types=$.types),B.T=O}}function _5(){}function cg(s,u,h,g){if(s.tag!==5)throw Error(r(476));var E=cE(s).queue;uE(s,E,u,K,h===null?_5:function(){return fE(s),h(g)})}function cE(s){var u=s.memoizedState;if(u!==null)return u;u={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:K},next:null};var h={};return u.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:h},next:null},s.memoizedState=u,s=s.alternate,s!==null&&(s.memoizedState=u),u}function fE(s){var u=cE(s);u.next===null&&(u=s.alternate.memoizedState),Ic(s,u.next.queue,{},Xr())}function fg(){return er(nf)}function dE(){return wn().memoizedState}function hE(){return wn().memoizedState}function B5(s){for(var u=s.return;u!==null;){switch(u.tag){case 24:case 3:var h=Xr();s=ds(h);var g=hs(u,s,h);g!==null&&(Lr(g,u,h),Lc(g,u,h)),u={cache:Fm()},s.payload=u;return}u=u.return}}function P5(s,u,h){var g=Xr();h={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},fh(s)?pE(u,h):(h=Rm(s,u,h,g),h!==null&&(Lr(h,s,g),mE(h,u,g)))}function vE(s,u,h){var g=Xr();Ic(s,u,h,g)}function Ic(s,u,h,g){var E={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(fh(s))pE(u,E);else{var N=s.alternate;if(s.lanes===0&&(N===null||N.lanes===0)&&(N=u.lastRenderedReducer,N!==null))try{var O=u.lastRenderedState,$=N(O,h);if(E.hasEagerState=!0,E.eagerState=$,Vr($,O))return Gd(s,u,E,0),Gt===null&&Hd(),!1}catch{}finally{}if(h=Rm(s,u,E,g),h!==null)return Lr(h,s,g),mE(h,u,g),!0}return!1}function dg(s,u,h,g){if(g={lane:2,revertLane:Hg(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},fh(s)){if(u)throw Error(r(479))}else u=Rm(s,h,g,2),u!==null&&Lr(u,s,2)}function fh(s){var u=s.alternate;return s===ft||u!==null&&u===ft}function pE(s,u){Go=ah=!0;var h=s.pending;h===null?u.next=u:(u.next=h.next,h.next=u),s.pending=u}function mE(s,u,h){if((h&4194048)!==0){var g=u.lanes;g&=s.pendingLanes,h|=g,u.lanes=h,yn(s,h)}}var Fc={readContext:er,use:lh,useCallback:hn,useContext:hn,useEffect:hn,useImperativeHandle:hn,useLayoutEffect:hn,useInsertionEffect:hn,useMemo:hn,useReducer:hn,useRef:hn,useState:hn,useDebugValue:hn,useDeferredValue:hn,useTransition:hn,useSyncExternalStore:hn,useId:hn,useHostTransitionStatus:hn,useFormState:hn,useActionState:hn,useOptimistic:hn,useMemoCache:hn,useCacheRefresh:hn};Fc.useEffectEvent=hn;var gE={readContext:er,use:lh,useCallback:function(s,u){return xr().memoizedState=[s,u===void 0?null:u],s},useContext:er,useEffect:eE,useImperativeHandle:function(s,u,h){h=h!=null?h.concat([s]):null,uh(4194308,4,aE.bind(null,u,s),h)},useLayoutEffect:function(s,u){return uh(4194308,4,s,u)},useInsertionEffect:function(s,u){uh(4,2,s,u)},useMemo:function(s,u){var h=xr();u=u===void 0?null:u;var g=s();if(Bl){pe(!0);try{s()}finally{pe(!1)}}return h.memoizedState=[g,u],g},useReducer:function(s,u,h){var g=xr();if(h!==void 0){var E=h(u);if(Bl){pe(!0);try{h(u)}finally{pe(!1)}}}else E=u;return g.memoizedState=g.baseState=E,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:E},g.queue=s,s=s.dispatch=P5.bind(null,ft,s),[g.memoizedState,s]},useRef:function(s){var u=xr();return s={current:s},u.memoizedState=s},useState:function(s){s=ig(s);var u=s.queue,h=vE.bind(null,ft,u);return u.dispatch=h,[s.memoizedState,h]},useDebugValue:og,useDeferredValue:function(s,u){var h=xr();return ug(h,s,u)},useTransition:function(){var s=ig(!1);return s=uE.bind(null,ft,s.queue,!0,!1),xr().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,u,h){var g=ft,E=xr();if(Nt){if(h===void 0)throw Error(r(407));h=h()}else{if(h=u(),Gt===null)throw Error(r(349));(Ct&127)!==0||zS(g,u,h)}E.memoizedState=h;var N={value:h,getSnapshot:u};return E.queue=N,eE(FS.bind(null,g,N,s),[s]),g.flags|=2048,Yo(9,{destroy:void 0},IS.bind(null,g,N,h,u),null),h},useId:function(){var s=xr(),u=Gt.identifierPrefix;if(Nt){var h=Fa,g=Ia;h=(g&~(1<<32-de(g)-1)).toString(32)+h,u="_"+u+"R_"+h,h=ih++,0<h&&(u+="H"+h.toString(32)),u+="_"}else h=D5++,u="_"+u+"r_"+h.toString(32)+"_";return s.memoizedState=u},useHostTransitionStatus:fg,useFormState:XS,useActionState:XS,useOptimistic:function(s){var u=xr();u.memoizedState=u.baseState=s;var h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return u.queue=h,u=dg.bind(null,ft,!0,h),h.dispatch=u,[s,u]},useMemoCache:ng,useCacheRefresh:function(){return xr().memoizedState=B5.bind(null,ft)},useEffectEvent:function(s){var u=xr(),h={impl:s};return u.memoizedState=h,function(){if((Lt&2)!==0)throw Error(r(440));return h.impl.apply(void 0,arguments)}}},hg={readContext:er,use:lh,useCallback:sE,useContext:er,useEffect:lg,useImperativeHandle:iE,useInsertionEffect:nE,useLayoutEffect:rE,useMemo:lE,useReducer:oh,useRef:JS,useState:function(){return oh(wi)},useDebugValue:og,useDeferredValue:function(s,u){var h=wn();return oE(h,qt.memoizedState,s,u)},useTransition:function(){var s=oh(wi)[0],u=wn().memoizedState;return[typeof s=="boolean"?s:zc(s),u]},useSyncExternalStore:PS,useId:dE,useHostTransitionStatus:fg,useFormState:QS,useActionState:QS,useOptimistic:function(s,u){var h=wn();return VS(h,qt,s,u)},useMemoCache:ng,useCacheRefresh:hE};hg.useEffectEvent=tE;var yE={readContext:er,use:lh,useCallback:sE,useContext:er,useEffect:lg,useImperativeHandle:iE,useInsertionEffect:nE,useLayoutEffect:rE,useMemo:lE,useReducer:ag,useRef:JS,useState:function(){return ag(wi)},useDebugValue:og,useDeferredValue:function(s,u){var h=wn();return qt===null?ug(h,s,u):oE(h,qt.memoizedState,s,u)},useTransition:function(){var s=ag(wi)[0],u=wn().memoizedState;return[typeof s=="boolean"?s:zc(s),u]},useSyncExternalStore:PS,useId:dE,useHostTransitionStatus:fg,useFormState:ZS,useActionState:ZS,useOptimistic:function(s,u){var h=wn();return qt!==null?VS(h,qt,s,u):(h.baseState=s,[s,h.queue.dispatch])},useMemoCache:ng,useCacheRefresh:hE};yE.useEffectEvent=tE;function vg(s,u,h,g){u=s.memoizedState,h=h(g,u),h=h==null?u:v({},u,h),s.memoizedState=h,s.lanes===0&&(s.updateQueue.baseState=h)}var pg={enqueueSetState:function(s,u,h){s=s._reactInternals;var g=Xr(),E=ds(g);E.payload=u,h!=null&&(E.callback=h),u=hs(s,E,g),u!==null&&(Lr(u,s,g),Lc(u,s,g))},enqueueReplaceState:function(s,u,h){s=s._reactInternals;var g=Xr(),E=ds(g);E.tag=1,E.payload=u,h!=null&&(E.callback=h),u=hs(s,E,g),u!==null&&(Lr(u,s,g),Lc(u,s,g))},enqueueForceUpdate:function(s,u){s=s._reactInternals;var h=Xr(),g=ds(h);g.tag=2,u!=null&&(g.callback=u),u=hs(s,g,h),u!==null&&(Lr(u,s,h),Lc(u,s,h))}};function xE(s,u,h,g,E,N,O){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(g,N,O):u.prototype&&u.prototype.isPureReactComponent?!Nc(h,g)||!Nc(E,N):!0}function bE(s,u,h,g){s=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(h,g),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(h,g),u.state!==s&&pg.enqueueReplaceState(u,u.state,null)}function Pl(s,u){var h=u;if("ref"in u){h={};for(var g in u)g!=="ref"&&(h[g]=u[g])}if(s=s.defaultProps){h===u&&(h=v({},h));for(var E in s)h[E]===void 0&&(h[E]=s[E])}return h}function wE(s){Vd(s)}function SE(s){console.error(s)}function EE(s){Vd(s)}function dh(s,u){try{var h=s.onUncaughtError;h(u.value,{componentStack:u.stack})}catch(g){setTimeout(function(){throw g})}}function CE(s,u,h){try{var g=s.onCaughtError;g(h.value,{componentStack:h.stack,errorBoundary:u.tag===1?u.stateNode:null})}catch(E){setTimeout(function(){throw E})}}function mg(s,u,h){return h=ds(h),h.tag=3,h.payload={element:null},h.callback=function(){dh(s,u)},h}function TE(s){return s=ds(s),s.tag=3,s}function NE(s,u,h,g){var E=h.type.getDerivedStateFromError;if(typeof E=="function"){var N=g.value;s.payload=function(){return E(N)},s.callback=function(){CE(u,h,g)}}var O=h.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(s.callback=function(){CE(u,h,g),typeof E!="function"&&(xs===null?xs=new Set([this]):xs.add(this));var $=g.stack;this.componentDidCatch(g.value,{componentStack:$!==null?$:""})})}function z5(s,u,h,g,E){if(h.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(u=h.alternate,u!==null&&Io(u,h,E,!0),h=Gr.current,h!==null){switch(h.tag){case 31:case 13:return fa===null?Ch():h.alternate===null&&vn===0&&(vn=3),h.flags&=-257,h.flags|=65536,h.lanes=E,g===Jd?h.flags|=16384:(u=h.updateQueue,u===null?h.updateQueue=new Set([g]):u.add(g),qg(s,g,E)),!1;case 22:return h.flags|=65536,g===Jd?h.flags|=16384:(u=h.updateQueue,u===null?(u={transitions:null,markerInstances:null,retryQueue:new Set([g])},h.updateQueue=u):(h=u.retryQueue,h===null?u.retryQueue=new Set([g]):h.add(g)),qg(s,g,E)),!1}throw Error(r(435,h.tag))}return qg(s,g,E),Ch(),!1}if(Nt)return u=Gr.current,u!==null?((u.flags&65536)===0&&(u.flags|=256),u.flags|=65536,u.lanes=E,g!==_m&&(s=Error(r(422),{cause:g}),Rc(la(s,h)))):(g!==_m&&(u=Error(r(423),{cause:g}),Rc(la(u,h))),s=s.current.alternate,s.flags|=65536,E&=-E,s.lanes|=E,g=la(g,h),E=mg(s.stateNode,g,E),$m(s,E),vn!==4&&(vn=2)),!1;var N=Error(r(520),{cause:g});if(N=la(N,h),Kc===null?Kc=[N]:Kc.push(N),vn!==4&&(vn=2),u===null)return!0;g=la(g,h),h=u;do{switch(h.tag){case 3:return h.flags|=65536,s=E&-E,h.lanes|=s,s=mg(h.stateNode,g,s),$m(h,s),!1;case 1:if(u=h.type,N=h.stateNode,(h.flags&128)===0&&(typeof u.getDerivedStateFromError=="function"||N!==null&&typeof N.componentDidCatch=="function"&&(xs===null||!xs.has(N))))return h.flags|=65536,E&=-E,h.lanes|=E,E=TE(E),NE(E,s,h,g),$m(h,E),!1}h=h.return}while(h!==null);return!1}var gg=Error(r(461)),An=!1;function tr(s,u,h,g){u.child=s===null?DS(u,null,h,g):_l(u,s.child,h,g)}function kE(s,u,h,g,E){h=h.render;var N=u.ref;if("ref"in g){var O={};for(var $ in g)$!=="ref"&&(O[$]=g[$])}else O=g;return jl(u),g=Zm(s,u,h,O,N,E),$=Jm(),s!==null&&!An?(eg(s,u,E),Si(s,u,E)):(Nt&&$&&Om(u),u.flags|=1,tr(s,u,g,E),u.child)}function AE(s,u,h,g,E){if(s===null){var N=h.type;return typeof N=="function"&&!Dm(N)&&N.defaultProps===void 0&&h.compare===null?(u.tag=15,u.type=N,RE(s,u,N,g,E)):(s=Yd(h.type,null,g,u,u.mode,E),s.ref=u.ref,s.return=u,u.child=s)}if(N=s.child,!Tg(s,E)){var O=N.memoizedProps;if(h=h.compare,h=h!==null?h:Nc,h(O,g)&&s.ref===u.ref)return Si(s,u,E)}return u.flags|=1,s=mi(N,g),s.ref=u.ref,s.return=u,u.child=s}function RE(s,u,h,g,E){if(s!==null){var N=s.memoizedProps;if(Nc(N,g)&&s.ref===u.ref)if(An=!1,u.pendingProps=g=N,Tg(s,E))(s.flags&131072)!==0&&(An=!0);else return u.lanes=s.lanes,Si(s,u,E)}return yg(s,u,h,g,E)}function DE(s,u,h,g){var E=g.children,N=s!==null?s.memoizedState:null;if(s===null&&u.stateNode===null&&(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((u.flags&128)!==0){if(N=N!==null?N.baseLanes|h:h,s!==null){for(g=u.child=s.child,E=0;g!==null;)E=E|g.lanes|g.childLanes,g=g.sibling;g=E&~N}else g=0,u.child=null;return jE(s,u,N,h,g)}if((h&536870912)!==0)u.memoizedState={baseLanes:0,cachePool:null},s!==null&&Wd(u,N!==null?N.cachePool:null),N!==null?OS(u,N):Km(),LS(u);else return g=u.lanes=536870912,jE(s,u,N!==null?N.baseLanes|h:h,h,g)}else N!==null?(Wd(u,N.cachePool),OS(u,N),ps(),u.memoizedState=null):(s!==null&&Wd(u,null),Km(),ps());return tr(s,u,E,h),u.child}function qc(s,u){return s!==null&&s.tag===22||u.stateNode!==null||(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.sibling}function jE(s,u,h,g,E){var N=Um();return N=N===null?null:{parent:Nn._currentValue,pool:N},u.memoizedState={baseLanes:h,cachePool:N},s!==null&&Wd(u,null),Km(),LS(u),s!==null&&Io(s,u,g,!0),u.childLanes=E,null}function hh(s,u){return u=ph({mode:u.mode,children:u.children},s.mode),u.ref=s.ref,s.child=u,u.return=s,u}function ME(s,u,h){return _l(u,s.child,null,h),s=hh(u,u.pendingProps),s.flags|=2,$r(u),u.memoizedState=null,s}function I5(s,u,h){var g=u.pendingProps,E=(u.flags&128)!==0;if(u.flags&=-129,s===null){if(Nt){if(g.mode==="hidden")return s=hh(u,g),u.lanes=536870912,qc(null,s);if(Qm(u),(s=Jt)?(s=HC(s,ca),s=s!==null&&s.data==="&"?s:null,s!==null&&(u.memoizedState={dehydrated:s,treeContext:ls!==null?{id:Ia,overflow:Fa}:null,retryLane:536870912,hydrationErrors:null},h=pS(s),h.return=u,u.child=h,Jn=u,Jt=null)):s=null,s===null)throw us(u);return u.lanes=536870912,null}return hh(u,g)}var N=s.memoizedState;if(N!==null){var O=N.dehydrated;if(Qm(u),E)if(u.flags&256)u.flags&=-257,u=ME(s,u,h);else if(u.memoizedState!==null)u.child=s.child,u.flags|=128,u=null;else throw Error(r(558));else if(An||Io(s,u,h,!1),E=(h&s.childLanes)!==0,An||E){if(g=Gt,g!==null&&(O=dn(g,h),O!==0&&O!==N.retryLane))throw N.retryLane=O,kl(s,O),Lr(g,s,O),gg;Ch(),u=ME(s,u,h)}else s=N.treeContext,Jt=da(O.nextSibling),Jn=u,Nt=!0,os=null,ca=!1,s!==null&&yS(u,s),u=hh(u,g),u.flags|=4096;return u}return s=mi(s.child,{mode:g.mode,children:g.children}),s.ref=u.ref,u.child=s,s.return=u,s}function vh(s,u){var h=u.ref;if(h===null)s!==null&&s.ref!==null&&(u.flags|=4194816);else{if(typeof h!="function"&&typeof h!="object")throw Error(r(284));(s===null||s.ref!==h)&&(u.flags|=4194816)}}function yg(s,u,h,g,E){return jl(u),h=Zm(s,u,h,g,void 0,E),g=Jm(),s!==null&&!An?(eg(s,u,E),Si(s,u,E)):(Nt&&g&&Om(u),u.flags|=1,tr(s,u,h,E),u.child)}function OE(s,u,h,g,E,N){return jl(u),u.updateQueue=null,h=BS(u,g,h,E),_S(s),g=Jm(),s!==null&&!An?(eg(s,u,N),Si(s,u,N)):(Nt&&g&&Om(u),u.flags|=1,tr(s,u,h,N),u.child)}function LE(s,u,h,g,E){if(jl(u),u.stateNode===null){var N=_o,O=h.contextType;typeof O=="object"&&O!==null&&(N=er(O)),N=new h(g,N),u.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,N.updater=pg,u.stateNode=N,N._reactInternals=u,N=u.stateNode,N.props=g,N.state=u.memoizedState,N.refs={},Hm(u),O=h.contextType,N.context=typeof O=="object"&&O!==null?er(O):_o,N.state=u.memoizedState,O=h.getDerivedStateFromProps,typeof O=="function"&&(vg(u,h,O,g),N.state=u.memoizedState),typeof h.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(O=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),O!==N.state&&pg.enqueueReplaceState(N,N.state,null),Bc(u,g,N,E),_c(),N.state=u.memoizedState),typeof N.componentDidMount=="function"&&(u.flags|=4194308),g=!0}else if(s===null){N=u.stateNode;var $=u.memoizedProps,W=Pl(h,$);N.props=W;var ce=N.context,be=h.contextType;O=_o,typeof be=="object"&&be!==null&&(O=er(be));var Ee=h.getDerivedStateFromProps;be=typeof Ee=="function"||typeof N.getSnapshotBeforeUpdate=="function",$=u.pendingProps!==$,be||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||($||ce!==O)&&bE(u,N,g,O),fs=!1;var ve=u.memoizedState;N.state=ve,Bc(u,g,N,E),_c(),ce=u.memoizedState,$||ve!==ce||fs?(typeof Ee=="function"&&(vg(u,h,Ee,g),ce=u.memoizedState),(W=fs||xE(u,h,W,g,ve,ce,O))?(be||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(u.flags|=4194308)):(typeof N.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=g,u.memoizedState=ce),N.props=g,N.state=ce,N.context=O,g=W):(typeof N.componentDidMount=="function"&&(u.flags|=4194308),g=!1)}else{N=u.stateNode,Gm(s,u),O=u.memoizedProps,be=Pl(h,O),N.props=be,Ee=u.pendingProps,ve=N.context,ce=h.contextType,W=_o,typeof ce=="object"&&ce!==null&&(W=er(ce)),$=h.getDerivedStateFromProps,(ce=typeof $=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(O!==Ee||ve!==W)&&bE(u,N,g,W),fs=!1,ve=u.memoizedState,N.state=ve,Bc(u,g,N,E),_c();var me=u.memoizedState;O!==Ee||ve!==me||fs||s!==null&&s.dependencies!==null&&Xd(s.dependencies)?(typeof $=="function"&&(vg(u,h,$,g),me=u.memoizedState),(be=fs||xE(u,h,be,g,ve,me,W)||s!==null&&s.dependencies!==null&&Xd(s.dependencies))?(ce||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(g,me,W),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(g,me,W)),typeof N.componentDidUpdate=="function"&&(u.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof N.componentDidUpdate!="function"||O===s.memoizedProps&&ve===s.memoizedState||(u.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||O===s.memoizedProps&&ve===s.memoizedState||(u.flags|=1024),u.memoizedProps=g,u.memoizedState=me),N.props=g,N.state=me,N.context=W,g=be):(typeof N.componentDidUpdate!="function"||O===s.memoizedProps&&ve===s.memoizedState||(u.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||O===s.memoizedProps&&ve===s.memoizedState||(u.flags|=1024),g=!1)}return N=g,vh(s,u),g=(u.flags&128)!==0,N||g?(N=u.stateNode,h=g&&typeof h.getDerivedStateFromError!="function"?null:N.render(),u.flags|=1,s!==null&&g?(u.child=_l(u,s.child,null,E),u.child=_l(u,null,h,E)):tr(s,u,h,E),u.memoizedState=N.state,s=u.child):s=Si(s,u,E),s}function _E(s,u,h,g){return Rl(),u.flags|=256,tr(s,u,h,g),u.child}var xg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bg(s){return{baseLanes:s,cachePool:CS()}}function wg(s,u,h){return s=s!==null?s.childLanes&~h:0,u&&(s|=Kr),s}function BE(s,u,h){var g=u.pendingProps,E=!1,N=(u.flags&128)!==0,O;if((O=N)||(O=s!==null&&s.memoizedState===null?!1:(bn.current&2)!==0),O&&(E=!0,u.flags&=-129),O=(u.flags&32)!==0,u.flags&=-33,s===null){if(Nt){if(E?vs(u):ps(),(s=Jt)?(s=HC(s,ca),s=s!==null&&s.data!=="&"?s:null,s!==null&&(u.memoizedState={dehydrated:s,treeContext:ls!==null?{id:Ia,overflow:Fa}:null,retryLane:536870912,hydrationErrors:null},h=pS(s),h.return=u,u.child=h,Jn=u,Jt=null)):s=null,s===null)throw us(u);return ry(s)?u.lanes=32:u.lanes=536870912,null}var $=g.children;return g=g.fallback,E?(ps(),E=u.mode,$=ph({mode:"hidden",children:$},E),g=Al(g,E,h,null),$.return=u,g.return=u,$.sibling=g,u.child=$,g=u.child,g.memoizedState=bg(h),g.childLanes=wg(s,O,h),u.memoizedState=xg,qc(null,g)):(vs(u),Sg(u,$))}var W=s.memoizedState;if(W!==null&&($=W.dehydrated,$!==null)){if(N)u.flags&256?(vs(u),u.flags&=-257,u=Eg(s,u,h)):u.memoizedState!==null?(ps(),u.child=s.child,u.flags|=128,u=null):(ps(),$=g.fallback,E=u.mode,g=ph({mode:"visible",children:g.children},E),$=Al($,E,h,null),$.flags|=2,g.return=u,$.return=u,g.sibling=$,u.child=g,_l(u,s.child,null,h),g=u.child,g.memoizedState=bg(h),g.childLanes=wg(s,O,h),u.memoizedState=xg,u=qc(null,g));else if(vs(u),ry($)){if(O=$.nextSibling&&$.nextSibling.dataset,O)var ce=O.dgst;O=ce,g=Error(r(419)),g.stack="",g.digest=O,Rc({value:g,source:null,stack:null}),u=Eg(s,u,h)}else if(An||Io(s,u,h,!1),O=(h&s.childLanes)!==0,An||O){if(O=Gt,O!==null&&(g=dn(O,h),g!==0&&g!==W.retryLane))throw W.retryLane=g,kl(s,g),Lr(O,s,g),gg;ny($)||Ch(),u=Eg(s,u,h)}else ny($)?(u.flags|=192,u.child=s.child,u=null):(s=W.treeContext,Jt=da($.nextSibling),Jn=u,Nt=!0,os=null,ca=!1,s!==null&&yS(u,s),u=Sg(u,g.children),u.flags|=4096);return u}return E?(ps(),$=g.fallback,E=u.mode,W=s.child,ce=W.sibling,g=mi(W,{mode:"hidden",children:g.children}),g.subtreeFlags=W.subtreeFlags&65011712,ce!==null?$=mi(ce,$):($=Al($,E,h,null),$.flags|=2),$.return=u,g.return=u,g.sibling=$,u.child=g,qc(null,g),g=u.child,$=s.child.memoizedState,$===null?$=bg(h):(E=$.cachePool,E!==null?(W=Nn._currentValue,E=E.parent!==W?{parent:W,pool:W}:E):E=CS(),$={baseLanes:$.baseLanes|h,cachePool:E}),g.memoizedState=$,g.childLanes=wg(s,O,h),u.memoizedState=xg,qc(s.child,g)):(vs(u),h=s.child,s=h.sibling,h=mi(h,{mode:"visible",children:g.children}),h.return=u,h.sibling=null,s!==null&&(O=u.deletions,O===null?(u.deletions=[s],u.flags|=16):O.push(s)),u.child=h,u.memoizedState=null,h)}function Sg(s,u){return u=ph({mode:"visible",children:u},s.mode),u.return=s,s.child=u}function ph(s,u){return s=Hr(22,s,null,u),s.lanes=0,s}function Eg(s,u,h){return _l(u,s.child,null,h),s=Sg(u,u.pendingProps.children),s.flags|=2,u.memoizedState=null,s}function PE(s,u,h){s.lanes|=u;var g=s.alternate;g!==null&&(g.lanes|=u),zm(s.return,u,h)}function Cg(s,u,h,g,E,N){var O=s.memoizedState;O===null?s.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:g,tail:h,tailMode:E,treeForkCount:N}:(O.isBackwards=u,O.rendering=null,O.renderingStartTime=0,O.last=g,O.tail=h,O.tailMode=E,O.treeForkCount=N)}function zE(s,u,h){var g=u.pendingProps,E=g.revealOrder,N=g.tail;g=g.children;var O=bn.current,$=(O&2)!==0;if($?(O=O&1|2,u.flags|=128):O&=1,U(bn,O),tr(s,u,g,h),g=Nt?Ac:0,!$&&s!==null&&(s.flags&128)!==0)e:for(s=u.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&PE(s,h,u);else if(s.tag===19)PE(s,h,u);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===u)break e;for(;s.sibling===null;){if(s.return===null||s.return===u)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(E){case"forwards":for(h=u.child,E=null;h!==null;)s=h.alternate,s!==null&&rh(s)===null&&(E=h),h=h.sibling;h=E,h===null?(E=u.child,u.child=null):(E=h.sibling,h.sibling=null),Cg(u,!1,E,h,N,g);break;case"backwards":case"unstable_legacy-backwards":for(h=null,E=u.child,u.child=null;E!==null;){if(s=E.alternate,s!==null&&rh(s)===null){u.child=E;break}s=E.sibling,E.sibling=h,h=E,E=s}Cg(u,!0,h,null,N,g);break;case"together":Cg(u,!1,null,null,void 0,g);break;default:u.memoizedState=null}return u.child}function Si(s,u,h){if(s!==null&&(u.dependencies=s.dependencies),ys|=u.lanes,(h&u.childLanes)===0)if(s!==null){if(Io(s,u,h,!1),(h&u.childLanes)===0)return null}else return null;if(s!==null&&u.child!==s.child)throw Error(r(153));if(u.child!==null){for(s=u.child,h=mi(s,s.pendingProps),u.child=h,h.return=u;s.sibling!==null;)s=s.sibling,h=h.sibling=mi(s,s.pendingProps),h.return=u;h.sibling=null}return u.child}function Tg(s,u){return(s.lanes&u)!==0?!0:(s=s.dependencies,!!(s!==null&&Xd(s)))}function F5(s,u,h){switch(u.tag){case 3:we(u,u.stateNode.containerInfo),cs(u,Nn,s.memoizedState.cache),Rl();break;case 27:case 5:J(u);break;case 4:we(u,u.stateNode.containerInfo);break;case 10:cs(u,u.type,u.memoizedProps.value);break;case 31:if(u.memoizedState!==null)return u.flags|=128,Qm(u),null;break;case 13:var g=u.memoizedState;if(g!==null)return g.dehydrated!==null?(vs(u),u.flags|=128,null):(h&u.child.childLanes)!==0?BE(s,u,h):(vs(u),s=Si(s,u,h),s!==null?s.sibling:null);vs(u);break;case 19:var E=(s.flags&128)!==0;if(g=(h&u.childLanes)!==0,g||(Io(s,u,h,!1),g=(h&u.childLanes)!==0),E){if(g)return zE(s,u,h);u.flags|=128}if(E=u.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),U(bn,bn.current),g)break;return null;case 22:return u.lanes=0,DE(s,u,h,u.pendingProps);case 24:cs(u,Nn,s.memoizedState.cache)}return Si(s,u,h)}function IE(s,u,h){if(s!==null)if(s.memoizedProps!==u.pendingProps)An=!0;else{if(!Tg(s,h)&&(u.flags&128)===0)return An=!1,F5(s,u,h);An=(s.flags&131072)!==0}else An=!1,Nt&&(u.flags&1048576)!==0&&gS(u,Ac,u.index);switch(u.lanes=0,u.tag){case 16:e:{var g=u.pendingProps;if(s=Ol(u.elementType),u.type=s,typeof s=="function")Dm(s)?(g=Pl(s,g),u.tag=1,u=LE(null,u,s,g,h)):(u.tag=0,u=yg(null,u,s,g,h));else{if(s!=null){var E=s.$$typeof;if(E===k){u.tag=11,u=kE(null,u,s,g,h);break e}else if(E===j){u.tag=14,u=AE(null,u,s,g,h);break e}}throw u=I(s)||s,Error(r(306,u,""))}}return u;case 0:return yg(s,u,u.type,u.pendingProps,h);case 1:return g=u.type,E=Pl(g,u.pendingProps),LE(s,u,g,E,h);case 3:e:{if(we(u,u.stateNode.containerInfo),s===null)throw Error(r(387));g=u.pendingProps;var N=u.memoizedState;E=N.element,Gm(s,u),Bc(u,g,null,h);var O=u.memoizedState;if(g=O.cache,cs(u,Nn,g),g!==N.cache&&Im(u,[Nn],h,!0),_c(),g=O.element,N.isDehydrated)if(N={element:g,isDehydrated:!1,cache:O.cache},u.updateQueue.baseState=N,u.memoizedState=N,u.flags&256){u=_E(s,u,g,h);break e}else if(g!==E){E=la(Error(r(424)),u),Rc(E),u=_E(s,u,g,h);break e}else{switch(s=u.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Jt=da(s.firstChild),Jn=u,Nt=!0,os=null,ca=!0,h=DS(u,null,g,h),u.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling}else{if(Rl(),g===E){u=Si(s,u,h);break e}tr(s,u,g,h)}u=u.child}return u;case 26:return vh(s,u),s===null?(h=QC(u.type,null,u.pendingProps,null))?u.memoizedState=h:Nt||(h=u.type,s=u.pendingProps,g=jh(oe.current).createElement(h),g[rn]=u,g[On]=s,nr(g,h,s),Tn(g),u.stateNode=g):u.memoizedState=QC(u.type,s.memoizedProps,u.pendingProps,s.memoizedState),null;case 27:return J(u),s===null&&Nt&&(g=u.stateNode=YC(u.type,u.pendingProps,oe.current),Jn=u,ca=!0,E=Jt,Es(u.type)?(ay=E,Jt=da(g.firstChild)):Jt=E),tr(s,u,u.pendingProps.children,h),vh(s,u),s===null&&(u.flags|=4194304),u.child;case 5:return s===null&&Nt&&((E=g=Jt)&&(g=m3(g,u.type,u.pendingProps,ca),g!==null?(u.stateNode=g,Jn=u,Jt=da(g.firstChild),ca=!1,E=!0):E=!1),E||us(u)),J(u),E=u.type,N=u.pendingProps,O=s!==null?s.memoizedProps:null,g=N.children,Jg(E,N)?g=null:O!==null&&Jg(E,O)&&(u.flags|=32),u.memoizedState!==null&&(E=Zm(s,u,j5,null,null,h),nf._currentValue=E),vh(s,u),tr(s,u,g,h),u.child;case 6:return s===null&&Nt&&((s=h=Jt)&&(h=g3(h,u.pendingProps,ca),h!==null?(u.stateNode=h,Jn=u,Jt=null,s=!0):s=!1),s||us(u)),null;case 13:return BE(s,u,h);case 4:return we(u,u.stateNode.containerInfo),g=u.pendingProps,s===null?u.child=_l(u,null,g,h):tr(s,u,g,h),u.child;case 11:return kE(s,u,u.type,u.pendingProps,h);case 7:return tr(s,u,u.pendingProps,h),u.child;case 8:return tr(s,u,u.pendingProps.children,h),u.child;case 12:return tr(s,u,u.pendingProps.children,h),u.child;case 10:return g=u.pendingProps,cs(u,u.type,g.value),tr(s,u,g.children,h),u.child;case 9:return E=u.type._context,g=u.pendingProps.children,jl(u),E=er(E),g=g(E),u.flags|=1,tr(s,u,g,h),u.child;case 14:return AE(s,u,u.type,u.pendingProps,h);case 15:return RE(s,u,u.type,u.pendingProps,h);case 19:return zE(s,u,h);case 31:return I5(s,u,h);case 22:return DE(s,u,h,u.pendingProps);case 24:return jl(u),g=er(Nn),s===null?(E=Um(),E===null&&(E=Gt,N=Fm(),E.pooledCache=N,N.refCount++,N!==null&&(E.pooledCacheLanes|=h),E=N),u.memoizedState={parent:g,cache:E},Hm(u),cs(u,Nn,E)):((s.lanes&h)!==0&&(Gm(s,u),Bc(u,null,null,h),_c()),E=s.memoizedState,N=u.memoizedState,E.parent!==g?(E={parent:g,cache:g},u.memoizedState=E,u.lanes===0&&(u.memoizedState=u.updateQueue.baseState=E),cs(u,Nn,g)):(g=N.cache,cs(u,Nn,g),g!==E.cache&&Im(u,[Nn],h,!0))),tr(s,u,u.pendingProps.children,h),u.child;case 29:throw u.pendingProps}throw Error(r(156,u.tag))}function Ei(s){s.flags|=4}function Ng(s,u,h,g,E){if((u=(s.mode&32)!==0)&&(u=!1),u){if(s.flags|=16777216,(E&335544128)===E)if(s.stateNode.complete)s.flags|=8192;else if(dC())s.flags|=8192;else throw Ll=Jd,Vm}else s.flags&=-16777217}function FE(s,u){if(u.type!=="stylesheet"||(u.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!t2(u))if(dC())s.flags|=8192;else throw Ll=Jd,Vm}function mh(s,u){u!==null&&(s.flags|=4),s.flags&16384&&(u=s.tag!==22?ht():536870912,s.lanes|=u,Wo|=u)}function Uc(s,u){if(!Nt)switch(s.tailMode){case"hidden":u=s.tail;for(var h=null;u!==null;)u.alternate!==null&&(h=u),u=u.sibling;h===null?s.tail=null:h.sibling=null;break;case"collapsed":h=s.tail;for(var g=null;h!==null;)h.alternate!==null&&(g=h),h=h.sibling;g===null?u||s.tail===null?s.tail=null:s.tail.sibling=null:g.sibling=null}}function en(s){var u=s.alternate!==null&&s.alternate.child===s.child,h=0,g=0;if(u)for(var E=s.child;E!==null;)h|=E.lanes|E.childLanes,g|=E.subtreeFlags&65011712,g|=E.flags&65011712,E.return=s,E=E.sibling;else for(E=s.child;E!==null;)h|=E.lanes|E.childLanes,g|=E.subtreeFlags,g|=E.flags,E.return=s,E=E.sibling;return s.subtreeFlags|=g,s.childLanes=h,u}function q5(s,u,h){var g=u.pendingProps;switch(Lm(u),u.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return en(u),null;case 1:return en(u),null;case 3:return h=u.stateNode,g=null,s!==null&&(g=s.memoizedState.cache),u.memoizedState.cache!==g&&(u.flags|=2048),xi(Nn),fe(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(s===null||s.child===null)&&(zo(u)?Ei(u):s===null||s.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,Bm())),en(u),null;case 26:var E=u.type,N=u.memoizedState;return s===null?(Ei(u),N!==null?(en(u),FE(u,N)):(en(u),Ng(u,E,null,g,h))):N?N!==s.memoizedState?(Ei(u),en(u),FE(u,N)):(en(u),u.flags&=-16777217):(s=s.memoizedProps,s!==g&&Ei(u),en(u),Ng(u,E,s,g,h)),null;case 27:if(ne(u),h=oe.current,E=u.type,s!==null&&u.stateNode!=null)s.memoizedProps!==g&&Ei(u);else{if(!g){if(u.stateNode===null)throw Error(r(166));return en(u),null}s=te.current,zo(u)?xS(u):(s=YC(E,g,h),u.stateNode=s,Ei(u))}return en(u),null;case 5:if(ne(u),E=u.type,s!==null&&u.stateNode!=null)s.memoizedProps!==g&&Ei(u);else{if(!g){if(u.stateNode===null)throw Error(r(166));return en(u),null}if(N=te.current,zo(u))xS(u);else{var O=jh(oe.current);switch(N){case 1:N=O.createElementNS("http://www.w3.org/2000/svg",E);break;case 2:N=O.createElementNS("http://www.w3.org/1998/Math/MathML",E);break;default:switch(E){case"svg":N=O.createElementNS("http://www.w3.org/2000/svg",E);break;case"math":N=O.createElementNS("http://www.w3.org/1998/Math/MathML",E);break;case"script":N=O.createElement("div"),N.innerHTML="<script><\/script>",N=N.removeChild(N.firstChild);break;case"select":N=typeof g.is=="string"?O.createElement("select",{is:g.is}):O.createElement("select"),g.multiple?N.multiple=!0:g.size&&(N.size=g.size);break;default:N=typeof g.is=="string"?O.createElement(E,{is:g.is}):O.createElement(E)}}N[rn]=u,N[On]=g;e:for(O=u.child;O!==null;){if(O.tag===5||O.tag===6)N.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===u)break e;for(;O.sibling===null;){if(O.return===null||O.return===u)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}u.stateNode=N;e:switch(nr(N,E,g),E){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Ei(u)}}return en(u),Ng(u,u.type,s===null?null:s.memoizedProps,u.pendingProps,h),null;case 6:if(s&&u.stateNode!=null)s.memoizedProps!==g&&Ei(u);else{if(typeof g!="string"&&u.stateNode===null)throw Error(r(166));if(s=oe.current,zo(u)){if(s=u.stateNode,h=u.memoizedProps,g=null,E=Jn,E!==null)switch(E.tag){case 27:case 5:g=E.memoizedProps}s[rn]=u,s=!!(s.nodeValue===h||g!==null&&g.suppressHydrationWarning===!0||BC(s.nodeValue,h)),s||us(u,!0)}else s=jh(s).createTextNode(g),s[rn]=u,u.stateNode=s}return en(u),null;case 31:if(h=u.memoizedState,s===null||s.memoizedState!==null){if(g=zo(u),h!==null){if(s===null){if(!g)throw Error(r(318));if(s=u.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[rn]=u}else Rl(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;en(u),s=!1}else h=Bm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=h),s=!0;if(!s)return u.flags&256?($r(u),u):($r(u),null);if((u.flags&128)!==0)throw Error(r(558))}return en(u),null;case 13:if(g=u.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(E=zo(u),g!==null&&g.dehydrated!==null){if(s===null){if(!E)throw Error(r(318));if(E=u.memoizedState,E=E!==null?E.dehydrated:null,!E)throw Error(r(317));E[rn]=u}else Rl(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;en(u),E=!1}else E=Bm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=E),E=!0;if(!E)return u.flags&256?($r(u),u):($r(u),null)}return $r(u),(u.flags&128)!==0?(u.lanes=h,u):(h=g!==null,s=s!==null&&s.memoizedState!==null,h&&(g=u.child,E=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(E=g.alternate.memoizedState.cachePool.pool),N=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(N=g.memoizedState.cachePool.pool),N!==E&&(g.flags|=2048)),h!==s&&h&&(u.child.flags|=8192),mh(u,u.updateQueue),en(u),null);case 4:return fe(),s===null&&Kg(u.stateNode.containerInfo),en(u),null;case 10:return xi(u.type),en(u),null;case 19:if(X(bn),g=u.memoizedState,g===null)return en(u),null;if(E=(u.flags&128)!==0,N=g.rendering,N===null)if(E)Uc(g,!1);else{if(vn!==0||s!==null&&(s.flags&128)!==0)for(s=u.child;s!==null;){if(N=rh(s),N!==null){for(u.flags|=128,Uc(g,!1),s=N.updateQueue,u.updateQueue=s,mh(u,s),u.subtreeFlags=0,s=h,h=u.child;h!==null;)vS(h,s),h=h.sibling;return U(bn,bn.current&1|2),Nt&&gi(u,g.treeForkCount),u.child}s=s.sibling}g.tail!==null&&Pe()>wh&&(u.flags|=128,E=!0,Uc(g,!1),u.lanes=4194304)}else{if(!E)if(s=rh(N),s!==null){if(u.flags|=128,E=!0,s=s.updateQueue,u.updateQueue=s,mh(u,s),Uc(g,!0),g.tail===null&&g.tailMode==="hidden"&&!N.alternate&&!Nt)return en(u),null}else 2*Pe()-g.renderingStartTime>wh&&h!==536870912&&(u.flags|=128,E=!0,Uc(g,!1),u.lanes=4194304);g.isBackwards?(N.sibling=u.child,u.child=N):(s=g.last,s!==null?s.sibling=N:u.child=N,g.last=N)}return g.tail!==null?(s=g.tail,g.rendering=s,g.tail=s.sibling,g.renderingStartTime=Pe(),s.sibling=null,h=bn.current,U(bn,E?h&1|2:h&1),Nt&&gi(u,g.treeForkCount),s):(en(u),null);case 22:case 23:return $r(u),Xm(),g=u.memoizedState!==null,s!==null?s.memoizedState!==null!==g&&(u.flags|=8192):g&&(u.flags|=8192),g?(h&536870912)!==0&&(u.flags&128)===0&&(en(u),u.subtreeFlags&6&&(u.flags|=8192)):en(u),h=u.updateQueue,h!==null&&mh(u,h.retryQueue),h=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(h=s.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==h&&(u.flags|=2048),s!==null&&X(Ml),null;case 24:return h=null,s!==null&&(h=s.memoizedState.cache),u.memoizedState.cache!==h&&(u.flags|=2048),xi(Nn),en(u),null;case 25:return null;case 30:return null}throw Error(r(156,u.tag))}function U5(s,u){switch(Lm(u),u.tag){case 1:return s=u.flags,s&65536?(u.flags=s&-65537|128,u):null;case 3:return xi(Nn),fe(),s=u.flags,(s&65536)!==0&&(s&128)===0?(u.flags=s&-65537|128,u):null;case 26:case 27:case 5:return ne(u),null;case 31:if(u.memoizedState!==null){if($r(u),u.alternate===null)throw Error(r(340));Rl()}return s=u.flags,s&65536?(u.flags=s&-65537|128,u):null;case 13:if($r(u),s=u.memoizedState,s!==null&&s.dehydrated!==null){if(u.alternate===null)throw Error(r(340));Rl()}return s=u.flags,s&65536?(u.flags=s&-65537|128,u):null;case 19:return X(bn),null;case 4:return fe(),null;case 10:return xi(u.type),null;case 22:case 23:return $r(u),Xm(),s!==null&&X(Ml),s=u.flags,s&65536?(u.flags=s&-65537|128,u):null;case 24:return xi(Nn),null;case 25:return null;default:return null}}function qE(s,u){switch(Lm(u),u.tag){case 3:xi(Nn),fe();break;case 26:case 27:case 5:ne(u);break;case 4:fe();break;case 31:u.memoizedState!==null&&$r(u);break;case 13:$r(u);break;case 19:X(bn);break;case 10:xi(u.type);break;case 22:case 23:$r(u),Xm(),s!==null&&X(Ml);break;case 24:xi(Nn)}}function Vc(s,u){try{var h=u.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var E=g.next;h=E;do{if((h.tag&s)===s){g=void 0;var N=h.create,O=h.inst;g=N(),O.destroy=g}h=h.next}while(h!==E)}}catch($){It(u,u.return,$)}}function ms(s,u,h){try{var g=u.updateQueue,E=g!==null?g.lastEffect:null;if(E!==null){var N=E.next;g=N;do{if((g.tag&s)===s){var O=g.inst,$=O.destroy;if($!==void 0){O.destroy=void 0,E=u;var W=h,ce=$;try{ce()}catch(be){It(E,W,be)}}}g=g.next}while(g!==N)}}catch(be){It(u,u.return,be)}}function UE(s){var u=s.updateQueue;if(u!==null){var h=s.stateNode;try{MS(u,h)}catch(g){It(s,s.return,g)}}}function VE(s,u,h){h.props=Pl(s.type,s.memoizedProps),h.state=s.memoizedState;try{h.componentWillUnmount()}catch(g){It(s,u,g)}}function Hc(s,u){try{var h=s.ref;if(h!==null){switch(s.tag){case 26:case 27:case 5:var g=s.stateNode;break;case 30:g=s.stateNode;break;default:g=s.stateNode}typeof h=="function"?s.refCleanup=h(g):h.current=g}}catch(E){It(s,u,E)}}function qa(s,u){var h=s.ref,g=s.refCleanup;if(h!==null)if(typeof g=="function")try{g()}catch(E){It(s,u,E)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(E){It(s,u,E)}else h.current=null}function HE(s){var u=s.type,h=s.memoizedProps,g=s.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":h.autoFocus&&g.focus();break e;case"img":h.src?g.src=h.src:h.srcSet&&(g.srcset=h.srcSet)}}catch(E){It(s,s.return,E)}}function kg(s,u,h){try{var g=s.stateNode;c3(g,s.type,h,u),g[On]=u}catch(E){It(s,s.return,E)}}function GE(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Es(s.type)||s.tag===4}function Ag(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||GE(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Es(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Rg(s,u,h){var g=s.tag;if(g===5||g===6)s=s.stateNode,u?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(s,u):(u=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,u.appendChild(s),h=h._reactRootContainer,h!=null||u.onclick!==null||(u.onclick=vi));else if(g!==4&&(g===27&&Es(s.type)&&(h=s.stateNode,u=null),s=s.child,s!==null))for(Rg(s,u,h),s=s.sibling;s!==null;)Rg(s,u,h),s=s.sibling}function gh(s,u,h){var g=s.tag;if(g===5||g===6)s=s.stateNode,u?h.insertBefore(s,u):h.appendChild(s);else if(g!==4&&(g===27&&Es(s.type)&&(h=s.stateNode),s=s.child,s!==null))for(gh(s,u,h),s=s.sibling;s!==null;)gh(s,u,h),s=s.sibling}function $E(s){var u=s.stateNode,h=s.memoizedProps;try{for(var g=s.type,E=u.attributes;E.length;)u.removeAttributeNode(E[0]);nr(u,g,h),u[rn]=s,u[On]=h}catch(N){It(s,s.return,N)}}var Ci=!1,Rn=!1,Dg=!1,YE=typeof WeakSet=="function"?WeakSet:Set,$n=null;function V5(s,u){if(s=s.containerInfo,Wg=zh,s=iS(s),Em(s)){if("selectionStart"in s)var h={start:s.selectionStart,end:s.selectionEnd};else e:{h=(h=s.ownerDocument)&&h.defaultView||window;var g=h.getSelection&&h.getSelection();if(g&&g.rangeCount!==0){h=g.anchorNode;var E=g.anchorOffset,N=g.focusNode;g=g.focusOffset;try{h.nodeType,N.nodeType}catch{h=null;break e}var O=0,$=-1,W=-1,ce=0,be=0,Ee=s,ve=null;t:for(;;){for(var me;Ee!==h||E!==0&&Ee.nodeType!==3||($=O+E),Ee!==N||g!==0&&Ee.nodeType!==3||(W=O+g),Ee.nodeType===3&&(O+=Ee.nodeValue.length),(me=Ee.firstChild)!==null;)ve=Ee,Ee=me;for(;;){if(Ee===s)break t;if(ve===h&&++ce===E&&($=O),ve===N&&++be===g&&(W=O),(me=Ee.nextSibling)!==null)break;Ee=ve,ve=Ee.parentNode}Ee=me}h=$===-1||W===-1?null:{start:$,end:W}}else h=null}h=h||{start:0,end:0}}else h=null;for(Zg={focusedElem:s,selectionRange:h},zh=!1,$n=u;$n!==null;)if(u=$n,s=u.child,(u.subtreeFlags&1028)!==0&&s!==null)s.return=u,$n=s;else for(;$n!==null;){switch(u=$n,N=u.alternate,s=u.flags,u.tag){case 0:if((s&4)!==0&&(s=u.updateQueue,s=s!==null?s.events:null,s!==null))for(h=0;h<s.length;h++)E=s[h],E.ref.impl=E.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&N!==null){s=void 0,h=u,E=N.memoizedProps,N=N.memoizedState,g=h.stateNode;try{var Ve=Pl(h.type,E);s=g.getSnapshotBeforeUpdate(Ve,N),g.__reactInternalSnapshotBeforeUpdate=s}catch(rt){It(h,h.return,rt)}}break;case 3:if((s&1024)!==0){if(s=u.stateNode.containerInfo,h=s.nodeType,h===9)ty(s);else if(h===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":ty(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=u.sibling,s!==null){s.return=u.return,$n=s;break}$n=u.return}}function KE(s,u,h){var g=h.flags;switch(h.tag){case 0:case 11:case 15:Ni(s,h),g&4&&Vc(5,h);break;case 1:if(Ni(s,h),g&4)if(s=h.stateNode,u===null)try{s.componentDidMount()}catch(O){It(h,h.return,O)}else{var E=Pl(h.type,u.memoizedProps);u=u.memoizedState;try{s.componentDidUpdate(E,u,s.__reactInternalSnapshotBeforeUpdate)}catch(O){It(h,h.return,O)}}g&64&&UE(h),g&512&&Hc(h,h.return);break;case 3:if(Ni(s,h),g&64&&(s=h.updateQueue,s!==null)){if(u=null,h.child!==null)switch(h.child.tag){case 27:case 5:u=h.child.stateNode;break;case 1:u=h.child.stateNode}try{MS(s,u)}catch(O){It(h,h.return,O)}}break;case 27:u===null&&g&4&&$E(h);case 26:case 5:Ni(s,h),u===null&&g&4&&HE(h),g&512&&Hc(h,h.return);break;case 12:Ni(s,h);break;case 31:Ni(s,h),g&4&&WE(s,h);break;case 13:Ni(s,h),g&4&&ZE(s,h),g&64&&(s=h.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(h=Z5.bind(null,h),y3(s,h))));break;case 22:if(g=h.memoizedState!==null||Ci,!g){u=u!==null&&u.memoizedState!==null||Rn,E=Ci;var N=Rn;Ci=g,(Rn=u)&&!N?ki(s,h,(h.subtreeFlags&8772)!==0):Ni(s,h),Ci=E,Rn=N}break;case 30:break;default:Ni(s,h)}}function XE(s){var u=s.alternate;u!==null&&(s.alternate=null,XE(u)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(u=s.stateNode,u!==null&&To(u)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var an=null,Dr=!1;function Ti(s,u,h){for(h=h.child;h!==null;)QE(s,u,h),h=h.sibling}function QE(s,u,h){if(le&&typeof le.onCommitFiberUnmount=="function")try{le.onCommitFiberUnmount(Y,h)}catch{}switch(h.tag){case 26:Rn||qa(h,u),Ti(s,u,h),h.memoizedState?h.memoizedState.count--:h.stateNode&&(h=h.stateNode,h.parentNode.removeChild(h));break;case 27:Rn||qa(h,u);var g=an,E=Dr;Es(h.type)&&(an=h.stateNode,Dr=!1),Ti(s,u,h),Jc(h.stateNode),an=g,Dr=E;break;case 5:Rn||qa(h,u);case 6:if(g=an,E=Dr,an=null,Ti(s,u,h),an=g,Dr=E,an!==null)if(Dr)try{(an.nodeType===9?an.body:an.nodeName==="HTML"?an.ownerDocument.body:an).removeChild(h.stateNode)}catch(N){It(h,u,N)}else try{an.removeChild(h.stateNode)}catch(N){It(h,u,N)}break;case 18:an!==null&&(Dr?(s=an,UC(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,h.stateNode),iu(s)):UC(an,h.stateNode));break;case 4:g=an,E=Dr,an=h.stateNode.containerInfo,Dr=!0,Ti(s,u,h),an=g,Dr=E;break;case 0:case 11:case 14:case 15:ms(2,h,u),Rn||ms(4,h,u),Ti(s,u,h);break;case 1:Rn||(qa(h,u),g=h.stateNode,typeof g.componentWillUnmount=="function"&&VE(h,u,g)),Ti(s,u,h);break;case 21:Ti(s,u,h);break;case 22:Rn=(g=Rn)||h.memoizedState!==null,Ti(s,u,h),Rn=g;break;default:Ti(s,u,h)}}function WE(s,u){if(u.memoizedState===null&&(s=u.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{iu(s)}catch(h){It(u,u.return,h)}}}function ZE(s,u){if(u.memoizedState===null&&(s=u.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{iu(s)}catch(h){It(u,u.return,h)}}function H5(s){switch(s.tag){case 31:case 13:case 19:var u=s.stateNode;return u===null&&(u=s.stateNode=new YE),u;case 22:return s=s.stateNode,u=s._retryCache,u===null&&(u=s._retryCache=new YE),u;default:throw Error(r(435,s.tag))}}function yh(s,u){var h=H5(s);u.forEach(function(g){if(!h.has(g)){h.add(g);var E=J5.bind(null,s,g);g.then(E,E)}})}function jr(s,u){var h=u.deletions;if(h!==null)for(var g=0;g<h.length;g++){var E=h[g],N=s,O=u,$=O;e:for(;$!==null;){switch($.tag){case 27:if(Es($.type)){an=$.stateNode,Dr=!1;break e}break;case 5:an=$.stateNode,Dr=!1;break e;case 3:case 4:an=$.stateNode.containerInfo,Dr=!0;break e}$=$.return}if(an===null)throw Error(r(160));QE(N,O,E),an=null,Dr=!1,N=E.alternate,N!==null&&(N.return=null),E.return=null}if(u.subtreeFlags&13886)for(u=u.child;u!==null;)JE(u,s),u=u.sibling}var Ta=null;function JE(s,u){var h=s.alternate,g=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:jr(u,s),Mr(s),g&4&&(ms(3,s,s.return),Vc(3,s),ms(5,s,s.return));break;case 1:jr(u,s),Mr(s),g&512&&(Rn||h===null||qa(h,h.return)),g&64&&Ci&&(s=s.updateQueue,s!==null&&(g=s.callbacks,g!==null&&(h=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=h===null?g:h.concat(g))));break;case 26:var E=Ta;if(jr(u,s),Mr(s),g&512&&(Rn||h===null||qa(h,h.return)),g&4){var N=h!==null?h.memoizedState:null;if(g=s.memoizedState,h===null)if(g===null)if(s.stateNode===null){e:{g=s.type,h=s.memoizedProps,E=E.ownerDocument||E;t:switch(g){case"title":N=E.getElementsByTagName("title")[0],(!N||N[Hn]||N[rn]||N.namespaceURI==="http://www.w3.org/2000/svg"||N.hasAttribute("itemprop"))&&(N=E.createElement(g),E.head.insertBefore(N,E.querySelector("head > title"))),nr(N,g,h),N[rn]=s,Tn(N),g=N;break e;case"link":var O=JC("link","href",E).get(g+(h.href||""));if(O){for(var $=0;$<O.length;$++)if(N=O[$],N.getAttribute("href")===(h.href==null||h.href===""?null:h.href)&&N.getAttribute("rel")===(h.rel==null?null:h.rel)&&N.getAttribute("title")===(h.title==null?null:h.title)&&N.getAttribute("crossorigin")===(h.crossOrigin==null?null:h.crossOrigin)){O.splice($,1);break t}}N=E.createElement(g),nr(N,g,h),E.head.appendChild(N);break;case"meta":if(O=JC("meta","content",E).get(g+(h.content||""))){for($=0;$<O.length;$++)if(N=O[$],N.getAttribute("content")===(h.content==null?null:""+h.content)&&N.getAttribute("name")===(h.name==null?null:h.name)&&N.getAttribute("property")===(h.property==null?null:h.property)&&N.getAttribute("http-equiv")===(h.httpEquiv==null?null:h.httpEquiv)&&N.getAttribute("charset")===(h.charSet==null?null:h.charSet)){O.splice($,1);break t}}N=E.createElement(g),nr(N,g,h),E.head.appendChild(N);break;default:throw Error(r(468,g))}N[rn]=s,Tn(N),g=N}s.stateNode=g}else e2(E,s.type,s.stateNode);else s.stateNode=ZC(E,g,s.memoizedProps);else N!==g?(N===null?h.stateNode!==null&&(h=h.stateNode,h.parentNode.removeChild(h)):N.count--,g===null?e2(E,s.type,s.stateNode):ZC(E,g,s.memoizedProps)):g===null&&s.stateNode!==null&&kg(s,s.memoizedProps,h.memoizedProps)}break;case 27:jr(u,s),Mr(s),g&512&&(Rn||h===null||qa(h,h.return)),h!==null&&g&4&&kg(s,s.memoizedProps,h.memoizedProps);break;case 5:if(jr(u,s),Mr(s),g&512&&(Rn||h===null||qa(h,h.return)),s.flags&32){E=s.stateNode;try{Ao(E,"")}catch(Ve){It(s,s.return,Ve)}}g&4&&s.stateNode!=null&&(E=s.memoizedProps,kg(s,E,h!==null?h.memoizedProps:E)),g&1024&&(Dg=!0);break;case 6:if(jr(u,s),Mr(s),g&4){if(s.stateNode===null)throw Error(r(162));g=s.memoizedProps,h=s.stateNode;try{h.nodeValue=g}catch(Ve){It(s,s.return,Ve)}}break;case 3:if(Lh=null,E=Ta,Ta=Mh(u.containerInfo),jr(u,s),Ta=E,Mr(s),g&4&&h!==null&&h.memoizedState.isDehydrated)try{iu(u.containerInfo)}catch(Ve){It(s,s.return,Ve)}Dg&&(Dg=!1,eC(s));break;case 4:g=Ta,Ta=Mh(s.stateNode.containerInfo),jr(u,s),Mr(s),Ta=g;break;case 12:jr(u,s),Mr(s);break;case 31:jr(u,s),Mr(s),g&4&&(g=s.updateQueue,g!==null&&(s.updateQueue=null,yh(s,g)));break;case 13:jr(u,s),Mr(s),s.child.flags&8192&&s.memoizedState!==null!=(h!==null&&h.memoizedState!==null)&&(bh=Pe()),g&4&&(g=s.updateQueue,g!==null&&(s.updateQueue=null,yh(s,g)));break;case 22:E=s.memoizedState!==null;var W=h!==null&&h.memoizedState!==null,ce=Ci,be=Rn;if(Ci=ce||E,Rn=be||W,jr(u,s),Rn=be,Ci=ce,Mr(s),g&8192)e:for(u=s.stateNode,u._visibility=E?u._visibility&-2:u._visibility|1,E&&(h===null||W||Ci||Rn||zl(s)),h=null,u=s;;){if(u.tag===5||u.tag===26){if(h===null){W=h=u;try{if(N=W.stateNode,E)O=N.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{$=W.stateNode;var Ee=W.memoizedProps.style,ve=Ee!=null&&Ee.hasOwnProperty("display")?Ee.display:null;$.style.display=ve==null||typeof ve=="boolean"?"":(""+ve).trim()}}catch(Ve){It(W,W.return,Ve)}}}else if(u.tag===6){if(h===null){W=u;try{W.stateNode.nodeValue=E?"":W.memoizedProps}catch(Ve){It(W,W.return,Ve)}}}else if(u.tag===18){if(h===null){W=u;try{var me=W.stateNode;E?VC(me,!0):VC(W.stateNode,!1)}catch(Ve){It(W,W.return,Ve)}}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===s)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===s)break e;for(;u.sibling===null;){if(u.return===null||u.return===s)break e;h===u&&(h=null),u=u.return}h===u&&(h=null),u.sibling.return=u.return,u=u.sibling}g&4&&(g=s.updateQueue,g!==null&&(h=g.retryQueue,h!==null&&(g.retryQueue=null,yh(s,h))));break;case 19:jr(u,s),Mr(s),g&4&&(g=s.updateQueue,g!==null&&(s.updateQueue=null,yh(s,g)));break;case 30:break;case 21:break;default:jr(u,s),Mr(s)}}function Mr(s){var u=s.flags;if(u&2){try{for(var h,g=s.return;g!==null;){if(GE(g)){h=g;break}g=g.return}if(h==null)throw Error(r(160));switch(h.tag){case 27:var E=h.stateNode,N=Ag(s);gh(s,N,E);break;case 5:var O=h.stateNode;h.flags&32&&(Ao(O,""),h.flags&=-33);var $=Ag(s);gh(s,$,O);break;case 3:case 4:var W=h.stateNode.containerInfo,ce=Ag(s);Rg(s,ce,W);break;default:throw Error(r(161))}}catch(be){It(s,s.return,be)}s.flags&=-3}u&4096&&(s.flags&=-4097)}function eC(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var u=s;eC(u),u.tag===5&&u.flags&1024&&u.stateNode.reset(),s=s.sibling}}function Ni(s,u){if(u.subtreeFlags&8772)for(u=u.child;u!==null;)KE(s,u.alternate,u),u=u.sibling}function zl(s){for(s=s.child;s!==null;){var u=s;switch(u.tag){case 0:case 11:case 14:case 15:ms(4,u,u.return),zl(u);break;case 1:qa(u,u.return);var h=u.stateNode;typeof h.componentWillUnmount=="function"&&VE(u,u.return,h),zl(u);break;case 27:Jc(u.stateNode);case 26:case 5:qa(u,u.return),zl(u);break;case 22:u.memoizedState===null&&zl(u);break;case 30:zl(u);break;default:zl(u)}s=s.sibling}}function ki(s,u,h){for(h=h&&(u.subtreeFlags&8772)!==0,u=u.child;u!==null;){var g=u.alternate,E=s,N=u,O=N.flags;switch(N.tag){case 0:case 11:case 15:ki(E,N,h),Vc(4,N);break;case 1:if(ki(E,N,h),g=N,E=g.stateNode,typeof E.componentDidMount=="function")try{E.componentDidMount()}catch(ce){It(g,g.return,ce)}if(g=N,E=g.updateQueue,E!==null){var $=g.stateNode;try{var W=E.shared.hiddenCallbacks;if(W!==null)for(E.shared.hiddenCallbacks=null,E=0;E<W.length;E++)jS(W[E],$)}catch(ce){It(g,g.return,ce)}}h&&O&64&&UE(N),Hc(N,N.return);break;case 27:$E(N);case 26:case 5:ki(E,N,h),h&&g===null&&O&4&&HE(N),Hc(N,N.return);break;case 12:ki(E,N,h);break;case 31:ki(E,N,h),h&&O&4&&WE(E,N);break;case 13:ki(E,N,h),h&&O&4&&ZE(E,N);break;case 22:N.memoizedState===null&&ki(E,N,h),Hc(N,N.return);break;case 30:break;default:ki(E,N,h)}u=u.sibling}}function jg(s,u){var h=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(h=s.memoizedState.cachePool.pool),s=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(s=u.memoizedState.cachePool.pool),s!==h&&(s!=null&&s.refCount++,h!=null&&Dc(h))}function Mg(s,u){s=null,u.alternate!==null&&(s=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==s&&(u.refCount++,s!=null&&Dc(s))}function Na(s,u,h,g){if(u.subtreeFlags&10256)for(u=u.child;u!==null;)tC(s,u,h,g),u=u.sibling}function tC(s,u,h,g){var E=u.flags;switch(u.tag){case 0:case 11:case 15:Na(s,u,h,g),E&2048&&Vc(9,u);break;case 1:Na(s,u,h,g);break;case 3:Na(s,u,h,g),E&2048&&(s=null,u.alternate!==null&&(s=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==s&&(u.refCount++,s!=null&&Dc(s)));break;case 12:if(E&2048){Na(s,u,h,g),s=u.stateNode;try{var N=u.memoizedProps,O=N.id,$=N.onPostCommit;typeof $=="function"&&$(O,u.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(W){It(u,u.return,W)}}else Na(s,u,h,g);break;case 31:Na(s,u,h,g);break;case 13:Na(s,u,h,g);break;case 23:break;case 22:N=u.stateNode,O=u.alternate,u.memoizedState!==null?N._visibility&2?Na(s,u,h,g):Gc(s,u):N._visibility&2?Na(s,u,h,g):(N._visibility|=2,Ko(s,u,h,g,(u.subtreeFlags&10256)!==0||!1)),E&2048&&jg(O,u);break;case 24:Na(s,u,h,g),E&2048&&Mg(u.alternate,u);break;default:Na(s,u,h,g)}}function Ko(s,u,h,g,E){for(E=E&&((u.subtreeFlags&10256)!==0||!1),u=u.child;u!==null;){var N=s,O=u,$=h,W=g,ce=O.flags;switch(O.tag){case 0:case 11:case 15:Ko(N,O,$,W,E),Vc(8,O);break;case 23:break;case 22:var be=O.stateNode;O.memoizedState!==null?be._visibility&2?Ko(N,O,$,W,E):Gc(N,O):(be._visibility|=2,Ko(N,O,$,W,E)),E&&ce&2048&&jg(O.alternate,O);break;case 24:Ko(N,O,$,W,E),E&&ce&2048&&Mg(O.alternate,O);break;default:Ko(N,O,$,W,E)}u=u.sibling}}function Gc(s,u){if(u.subtreeFlags&10256)for(u=u.child;u!==null;){var h=s,g=u,E=g.flags;switch(g.tag){case 22:Gc(h,g),E&2048&&jg(g.alternate,g);break;case 24:Gc(h,g),E&2048&&Mg(g.alternate,g);break;default:Gc(h,g)}u=u.sibling}}var $c=8192;function Xo(s,u,h){if(s.subtreeFlags&$c)for(s=s.child;s!==null;)nC(s,u,h),s=s.sibling}function nC(s,u,h){switch(s.tag){case 26:Xo(s,u,h),s.flags&$c&&s.memoizedState!==null&&D3(h,Ta,s.memoizedState,s.memoizedProps);break;case 5:Xo(s,u,h);break;case 3:case 4:var g=Ta;Ta=Mh(s.stateNode.containerInfo),Xo(s,u,h),Ta=g;break;case 22:s.memoizedState===null&&(g=s.alternate,g!==null&&g.memoizedState!==null?(g=$c,$c=16777216,Xo(s,u,h),$c=g):Xo(s,u,h));break;default:Xo(s,u,h)}}function rC(s){var u=s.alternate;if(u!==null&&(s=u.child,s!==null)){u.child=null;do u=s.sibling,s.sibling=null,s=u;while(s!==null)}}function Yc(s){var u=s.deletions;if((s.flags&16)!==0){if(u!==null)for(var h=0;h<u.length;h++){var g=u[h];$n=g,iC(g,s)}rC(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)aC(s),s=s.sibling}function aC(s){switch(s.tag){case 0:case 11:case 15:Yc(s),s.flags&2048&&ms(9,s,s.return);break;case 3:Yc(s);break;case 12:Yc(s);break;case 22:var u=s.stateNode;s.memoizedState!==null&&u._visibility&2&&(s.return===null||s.return.tag!==13)?(u._visibility&=-3,xh(s)):Yc(s);break;default:Yc(s)}}function xh(s){var u=s.deletions;if((s.flags&16)!==0){if(u!==null)for(var h=0;h<u.length;h++){var g=u[h];$n=g,iC(g,s)}rC(s)}for(s=s.child;s!==null;){switch(u=s,u.tag){case 0:case 11:case 15:ms(8,u,u.return),xh(u);break;case 22:h=u.stateNode,h._visibility&2&&(h._visibility&=-3,xh(u));break;default:xh(u)}s=s.sibling}}function iC(s,u){for(;$n!==null;){var h=$n;switch(h.tag){case 0:case 11:case 15:ms(8,h,u);break;case 23:case 22:if(h.memoizedState!==null&&h.memoizedState.cachePool!==null){var g=h.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:Dc(h.memoizedState.cache)}if(g=h.child,g!==null)g.return=h,$n=g;else e:for(h=s;$n!==null;){g=$n;var E=g.sibling,N=g.return;if(XE(g),g===h){$n=null;break e}if(E!==null){E.return=N,$n=E;break e}$n=N}}}var G5={getCacheForType:function(s){var u=er(Nn),h=u.data.get(s);return h===void 0&&(h=s(),u.data.set(s,h)),h},cacheSignal:function(){return er(Nn).controller.signal}},$5=typeof WeakMap=="function"?WeakMap:Map,Lt=0,Gt=null,bt=null,Ct=0,zt=0,Yr=null,gs=!1,Qo=!1,Og=!1,Ai=0,vn=0,ys=0,Il=0,Lg=0,Kr=0,Wo=0,Kc=null,Or=null,_g=!1,bh=0,sC=0,wh=1/0,Sh=null,xs=null,Ln=0,bs=null,Zo=null,Ri=0,Bg=0,Pg=null,lC=null,Xc=0,zg=null;function Xr(){return(Lt&2)!==0&&Ct!==0?Ct&-Ct:B.T!==null?Hg():un()}function oC(){if(Kr===0)if((Ct&536870912)===0||Nt){var s=Ie;Ie<<=1,(Ie&3932160)===0&&(Ie=262144),Kr=s}else Kr=536870912;return s=Gr.current,s!==null&&(s.flags|=32),Kr}function Lr(s,u,h){(s===Gt&&(zt===2||zt===9)||s.cancelPendingCommit!==null)&&(Jo(s,0),ws(s,Ct,Kr,!1)),Ft(s,h),((Lt&2)===0||s!==Gt)&&(s===Gt&&((Lt&2)===0&&(Il|=h),vn===4&&ws(s,Ct,Kr,!1)),Ua(s))}function uC(s,u,h){if((Lt&6)!==0)throw Error(r(327));var g=!h&&(u&127)===0&&(u&s.expiredLanes)===0||Ue(s,u),E=g?X5(s,u):Fg(s,u,!0),N=g;do{if(E===0){Qo&&!g&&ws(s,u,0,!1);break}else{if(h=s.current.alternate,N&&!Y5(h)){E=Fg(s,u,!1),N=!1;continue}if(E===2){if(N=u,s.errorRecoveryDisabledLanes&N)var O=0;else O=s.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){u=O;e:{var $=s;E=Kc;var W=$.current.memoizedState.isDehydrated;if(W&&(Jo($,O).flags|=256),O=Fg($,O,!1),O!==2){if(Og&&!W){$.errorRecoveryDisabledLanes|=N,Il|=N,E=4;break e}N=Or,Or=E,N!==null&&(Or===null?Or=N:Or.push.apply(Or,N))}E=O}if(N=!1,E!==2)continue}}if(E===1){Jo(s,0),ws(s,u,0,!0);break}e:{switch(g=s,N=E,N){case 0:case 1:throw Error(r(345));case 4:if((u&4194048)!==u)break;case 6:ws(g,u,Kr,!gs);break e;case 2:Or=null;break;case 3:case 5:break;default:throw Error(r(329))}if((u&62914560)===u&&(E=bh+300-Pe(),10<E)){if(ws(g,u,Kr,!gs),ot(g,0,!0)!==0)break e;Ri=u,g.timeoutHandle=FC(cC.bind(null,g,h,Or,Sh,_g,u,Kr,Il,Wo,gs,N,"Throttled",-0,0),E);break e}cC(g,h,Or,Sh,_g,u,Kr,Il,Wo,gs,N,null,-0,0)}}break}while(!0);Ua(s)}function cC(s,u,h,g,E,N,O,$,W,ce,be,Ee,ve,me){if(s.timeoutHandle=-1,Ee=u.subtreeFlags,Ee&8192||(Ee&16785408)===16785408){Ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:vi},nC(u,N,Ee);var Ve=(N&62914560)===N?bh-Pe():(N&4194048)===N?sC-Pe():0;if(Ve=j3(Ee,Ve),Ve!==null){Ri=N,s.cancelPendingCommit=Ve(yC.bind(null,s,u,N,h,g,E,O,$,W,be,Ee,null,ve,me)),ws(s,N,O,!ce);return}}yC(s,u,N,h,g,E,O,$,W)}function Y5(s){for(var u=s;;){var h=u.tag;if((h===0||h===11||h===15)&&u.flags&16384&&(h=u.updateQueue,h!==null&&(h=h.stores,h!==null)))for(var g=0;g<h.length;g++){var E=h[g],N=E.getSnapshot;E=E.value;try{if(!Vr(N(),E))return!1}catch{return!1}}if(h=u.child,u.subtreeFlags&16384&&h!==null)h.return=u,u=h;else{if(u===s)break;for(;u.sibling===null;){if(u.return===null||u.return===s)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function ws(s,u,h,g){u&=~Lg,u&=~Il,s.suspendedLanes|=u,s.pingedLanes&=~u,g&&(s.warmLanes|=u),g=s.expirationTimes;for(var E=u;0<E;){var N=31-de(E),O=1<<N;g[N]=-1,E&=~O}h!==0&&on(s,h,u)}function Eh(){return(Lt&6)===0?(Qc(0),!1):!0}function Ig(){if(bt!==null){if(zt===0)var s=bt.return;else s=bt,yi=Dl=null,tg(s),Vo=null,Mc=0,s=bt;for(;s!==null;)qE(s.alternate,s),s=s.return;bt=null}}function Jo(s,u){var h=s.timeoutHandle;h!==-1&&(s.timeoutHandle=-1,h3(h)),h=s.cancelPendingCommit,h!==null&&(s.cancelPendingCommit=null,h()),Ri=0,Ig(),Gt=s,bt=h=mi(s.current,null),Ct=u,zt=0,Yr=null,gs=!1,Qo=Ue(s,u),Og=!1,Wo=Kr=Lg=Il=ys=vn=0,Or=Kc=null,_g=!1,(u&8)!==0&&(u|=u&32);var g=s.entangledLanes;if(g!==0)for(s=s.entanglements,g&=u;0<g;){var E=31-de(g),N=1<<E;u|=s[E],g&=~N}return Ai=u,Hd(),h}function fC(s,u){ft=null,B.H=Fc,u===Uo||u===Zd?(u=kS(),zt=3):u===Vm?(u=kS(),zt=4):zt=u===gg?8:u!==null&&typeof u=="object"&&typeof u.then=="function"?6:1,Yr=u,bt===null&&(vn=1,dh(s,la(u,s.current)))}function dC(){var s=Gr.current;return s===null?!0:(Ct&4194048)===Ct?fa===null:(Ct&62914560)===Ct||(Ct&536870912)!==0?s===fa:!1}function hC(){var s=B.H;return B.H=Fc,s===null?Fc:s}function vC(){var s=B.A;return B.A=G5,s}function Ch(){vn=4,gs||(Ct&4194048)!==Ct&&Gr.current!==null||(Qo=!0),(ys&134217727)===0&&(Il&134217727)===0||Gt===null||ws(Gt,Ct,Kr,!1)}function Fg(s,u,h){var g=Lt;Lt|=2;var E=hC(),N=vC();(Gt!==s||Ct!==u)&&(Sh=null,Jo(s,u)),u=!1;var O=vn;e:do try{if(zt!==0&&bt!==null){var $=bt,W=Yr;switch(zt){case 8:Ig(),O=6;break e;case 3:case 2:case 9:case 6:Gr.current===null&&(u=!0);var ce=zt;if(zt=0,Yr=null,eu(s,$,W,ce),h&&Qo){O=0;break e}break;default:ce=zt,zt=0,Yr=null,eu(s,$,W,ce)}}K5(),O=vn;break}catch(be){fC(s,be)}while(!0);return u&&s.shellSuspendCounter++,yi=Dl=null,Lt=g,B.H=E,B.A=N,bt===null&&(Gt=null,Ct=0,Hd()),O}function K5(){for(;bt!==null;)pC(bt)}function X5(s,u){var h=Lt;Lt|=2;var g=hC(),E=vC();Gt!==s||Ct!==u?(Sh=null,wh=Pe()+500,Jo(s,u)):Qo=Ue(s,u);e:do try{if(zt!==0&&bt!==null){u=bt;var N=Yr;t:switch(zt){case 1:zt=0,Yr=null,eu(s,u,N,1);break;case 2:case 9:if(TS(N)){zt=0,Yr=null,mC(u);break}u=function(){zt!==2&&zt!==9||Gt!==s||(zt=7),Ua(s)},N.then(u,u);break e;case 3:zt=7;break e;case 4:zt=5;break e;case 7:TS(N)?(zt=0,Yr=null,mC(u)):(zt=0,Yr=null,eu(s,u,N,7));break;case 5:var O=null;switch(bt.tag){case 26:O=bt.memoizedState;case 5:case 27:var $=bt;if(O?t2(O):$.stateNode.complete){zt=0,Yr=null;var W=$.sibling;if(W!==null)bt=W;else{var ce=$.return;ce!==null?(bt=ce,Th(ce)):bt=null}break t}}zt=0,Yr=null,eu(s,u,N,5);break;case 6:zt=0,Yr=null,eu(s,u,N,6);break;case 8:Ig(),vn=6;break e;default:throw Error(r(462))}}Q5();break}catch(be){fC(s,be)}while(!0);return yi=Dl=null,B.H=g,B.A=E,Lt=h,bt!==null?0:(Gt=null,Ct=0,Hd(),vn)}function Q5(){for(;bt!==null&&!Ye();)pC(bt)}function pC(s){var u=IE(s.alternate,s,Ai);s.memoizedProps=s.pendingProps,u===null?Th(s):bt=u}function mC(s){var u=s,h=u.alternate;switch(u.tag){case 15:case 0:u=OE(h,u,u.pendingProps,u.type,void 0,Ct);break;case 11:u=OE(h,u,u.pendingProps,u.type.render,u.ref,Ct);break;case 5:tg(u);default:qE(h,u),u=bt=vS(u,Ai),u=IE(h,u,Ai)}s.memoizedProps=s.pendingProps,u===null?Th(s):bt=u}function eu(s,u,h,g){yi=Dl=null,tg(u),Vo=null,Mc=0;var E=u.return;try{if(z5(s,E,u,h,Ct)){vn=1,dh(s,la(h,s.current)),bt=null;return}}catch(N){if(E!==null)throw bt=E,N;vn=1,dh(s,la(h,s.current)),bt=null;return}u.flags&32768?(Nt||g===1?s=!0:Qo||(Ct&536870912)!==0?s=!1:(gs=s=!0,(g===2||g===9||g===3||g===6)&&(g=Gr.current,g!==null&&g.tag===13&&(g.flags|=16384))),gC(u,s)):Th(u)}function Th(s){var u=s;do{if((u.flags&32768)!==0){gC(u,gs);return}s=u.return;var h=q5(u.alternate,u,Ai);if(h!==null){bt=h;return}if(u=u.sibling,u!==null){bt=u;return}bt=u=s}while(u!==null);vn===0&&(vn=5)}function gC(s,u){do{var h=U5(s.alternate,s);if(h!==null){h.flags&=32767,bt=h;return}if(h=s.return,h!==null&&(h.flags|=32768,h.subtreeFlags=0,h.deletions=null),!u&&(s=s.sibling,s!==null)){bt=s;return}bt=s=h}while(s!==null);vn=6,bt=null}function yC(s,u,h,g,E,N,O,$,W){s.cancelPendingCommit=null;do Nh();while(Ln!==0);if((Lt&6)!==0)throw Error(r(327));if(u!==null){if(u===s.current)throw Error(r(177));if(N=u.lanes|u.childLanes,N|=Am,Zn(s,h,N,O,$,W),s===Gt&&(bt=Gt=null,Ct=0),Zo=u,bs=s,Ri=h,Bg=N,Pg=E,lC=g,(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,e3(je,function(){return EC(),null})):(s.callbackNode=null,s.callbackPriority=0),g=(u.flags&13878)!==0,(u.subtreeFlags&13878)!==0||g){g=B.T,B.T=null,E=H.p,H.p=2,O=Lt,Lt|=4;try{V5(s,u,h)}finally{Lt=O,H.p=E,B.T=g}}Ln=1,xC(),bC(),wC()}}function xC(){if(Ln===1){Ln=0;var s=bs,u=Zo,h=(u.flags&13878)!==0;if((u.subtreeFlags&13878)!==0||h){h=B.T,B.T=null;var g=H.p;H.p=2;var E=Lt;Lt|=4;try{JE(u,s);var N=Zg,O=iS(s.containerInfo),$=N.focusedElem,W=N.selectionRange;if(O!==$&&$&&$.ownerDocument&&aS($.ownerDocument.documentElement,$)){if(W!==null&&Em($)){var ce=W.start,be=W.end;if(be===void 0&&(be=ce),"selectionStart"in $)$.selectionStart=ce,$.selectionEnd=Math.min(be,$.value.length);else{var Ee=$.ownerDocument||document,ve=Ee&&Ee.defaultView||window;if(ve.getSelection){var me=ve.getSelection(),Ve=$.textContent.length,rt=Math.min(W.start,Ve),Vt=W.end===void 0?rt:Math.min(W.end,Ve);!me.extend&&rt>Vt&&(O=Vt,Vt=rt,rt=O);var se=rS($,rt),ee=rS($,Vt);if(se&&ee&&(me.rangeCount!==1||me.anchorNode!==se.node||me.anchorOffset!==se.offset||me.focusNode!==ee.node||me.focusOffset!==ee.offset)){var ue=Ee.createRange();ue.setStart(se.node,se.offset),me.removeAllRanges(),rt>Vt?(me.addRange(ue),me.extend(ee.node,ee.offset)):(ue.setEnd(ee.node,ee.offset),me.addRange(ue))}}}}for(Ee=[],me=$;me=me.parentNode;)me.nodeType===1&&Ee.push({element:me,left:me.scrollLeft,top:me.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$<Ee.length;$++){var Se=Ee[$];Se.element.scrollLeft=Se.left,Se.element.scrollTop=Se.top}}zh=!!Wg,Zg=Wg=null}finally{Lt=E,H.p=g,B.T=h}}s.current=u,Ln=2}}function bC(){if(Ln===2){Ln=0;var s=bs,u=Zo,h=(u.flags&8772)!==0;if((u.subtreeFlags&8772)!==0||h){h=B.T,B.T=null;var g=H.p;H.p=2;var E=Lt;Lt|=4;try{KE(s,u.alternate,u)}finally{Lt=E,H.p=g,B.T=h}}Ln=3}}function wC(){if(Ln===4||Ln===3){Ln=0,it();var s=bs,u=Zo,h=Ri,g=lC;(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?Ln=5:(Ln=0,Zo=bs=null,SC(s,s.pendingLanes));var E=s.pendingLanes;if(E===0&&(xs=null),na(h),u=u.stateNode,le&&typeof le.onCommitFiberRoot=="function")try{le.onCommitFiberRoot(Y,u,void 0,(u.current.flags&128)===128)}catch{}if(g!==null){u=B.T,E=H.p,H.p=2,B.T=null;try{for(var N=s.onRecoverableError,O=0;O<g.length;O++){var $=g[O];N($.value,{componentStack:$.stack})}}finally{B.T=u,H.p=E}}(Ri&3)!==0&&Nh(),Ua(s),E=s.pendingLanes,(h&261930)!==0&&(E&42)!==0?s===zg?Xc++:(Xc=0,zg=s):Xc=0,Qc(0)}}function SC(s,u){(s.pooledCacheLanes&=u)===0&&(u=s.pooledCache,u!=null&&(s.pooledCache=null,Dc(u)))}function Nh(){return xC(),bC(),wC(),EC()}function EC(){if(Ln!==5)return!1;var s=bs,u=Bg;Bg=0;var h=na(Ri),g=B.T,E=H.p;try{H.p=32>h?32:h,B.T=null,h=Pg,Pg=null;var N=bs,O=Ri;if(Ln=0,Zo=bs=null,Ri=0,(Lt&6)!==0)throw Error(r(331));var $=Lt;if(Lt|=4,aC(N.current),tC(N,N.current,O,h),Lt=$,Qc(0,!1),le&&typeof le.onPostCommitFiberRoot=="function")try{le.onPostCommitFiberRoot(Y,N)}catch{}return!0}finally{H.p=E,B.T=g,SC(s,u)}}function CC(s,u,h){u=la(h,u),u=mg(s.stateNode,u,2),s=hs(s,u,2),s!==null&&(Ft(s,2),Ua(s))}function It(s,u,h){if(s.tag===3)CC(s,s,h);else for(;u!==null;){if(u.tag===3){CC(u,s,h);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(xs===null||!xs.has(g))){s=la(h,s),h=TE(2),g=hs(u,h,2),g!==null&&(NE(h,g,u,s),Ft(g,2),Ua(g));break}}u=u.return}}function qg(s,u,h){var g=s.pingCache;if(g===null){g=s.pingCache=new $5;var E=new Set;g.set(u,E)}else E=g.get(u),E===void 0&&(E=new Set,g.set(u,E));E.has(h)||(Og=!0,E.add(h),s=W5.bind(null,s,u,h),u.then(s,s))}function W5(s,u,h){var g=s.pingCache;g!==null&&g.delete(u),s.pingedLanes|=s.suspendedLanes&h,s.warmLanes&=~h,Gt===s&&(Ct&h)===h&&(vn===4||vn===3&&(Ct&62914560)===Ct&&300>Pe()-bh?(Lt&2)===0&&Jo(s,0):Lg|=h,Wo===Ct&&(Wo=0)),Ua(s)}function TC(s,u){u===0&&(u=ht()),s=kl(s,u),s!==null&&(Ft(s,u),Ua(s))}function Z5(s){var u=s.memoizedState,h=0;u!==null&&(h=u.retryLane),TC(s,h)}function J5(s,u){var h=0;switch(s.tag){case 31:case 13:var g=s.stateNode,E=s.memoizedState;E!==null&&(h=E.retryLane);break;case 19:g=s.stateNode;break;case 22:g=s.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(u),TC(s,h)}function e3(s,u){return De(s,u)}var kh=null,tu=null,Ug=!1,Ah=!1,Vg=!1,Ss=0;function Ua(s){s!==tu&&s.next===null&&(tu===null?kh=tu=s:tu=tu.next=s),Ah=!0,Ug||(Ug=!0,n3())}function Qc(s,u){if(!Vg&&Ah){Vg=!0;do for(var h=!1,g=kh;g!==null;){if(s!==0){var E=g.pendingLanes;if(E===0)var N=0;else{var O=g.suspendedLanes,$=g.pingedLanes;N=(1<<31-de(42|s)+1)-1,N&=E&~(O&~$),N=N&201326741?N&201326741|1:N?N|2:0}N!==0&&(h=!0,RC(g,N))}else N=Ct,N=ot(g,g===Gt?N:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(N&3)===0||Ue(g,N)||(h=!0,RC(g,N));g=g.next}while(h);Vg=!1}}function t3(){NC()}function NC(){Ah=Ug=!1;var s=0;Ss!==0&&d3()&&(s=Ss);for(var u=Pe(),h=null,g=kh;g!==null;){var E=g.next,N=kC(g,u);N===0?(g.next=null,h===null?kh=E:h.next=E,E===null&&(tu=h)):(h=g,(s!==0||(N&3)!==0)&&(Ah=!0)),g=E}Ln!==0&&Ln!==5||Qc(s),Ss!==0&&(Ss=0)}function kC(s,u){for(var h=s.suspendedLanes,g=s.pingedLanes,E=s.expirationTimes,N=s.pendingLanes&-62914561;0<N;){var O=31-de(N),$=1<<O,W=E[O];W===-1?(($&h)===0||($&g)!==0)&&(E[O]=yt($,u)):W<=u&&(s.expiredLanes|=$),N&=~$}if(u=Gt,h=Ct,h=ot(s,s===u?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),g=s.callbackNode,h===0||s===u&&(zt===2||zt===9)||s.cancelPendingCommit!==null)return g!==null&&g!==null&&Ge(g),s.callbackNode=null,s.callbackPriority=0;if((h&3)===0||Ue(s,h)){if(u=h&-h,u===s.callbackPriority)return u;switch(g!==null&&Ge(g),na(h)){case 2:case 8:h=Ce;break;case 32:h=je;break;case 268435456:h=Me;break;default:h=je}return g=AC.bind(null,s),h=De(h,g),s.callbackPriority=u,s.callbackNode=h,u}return g!==null&&g!==null&&Ge(g),s.callbackPriority=2,s.callbackNode=null,2}function AC(s,u){if(Ln!==0&&Ln!==5)return s.callbackNode=null,s.callbackPriority=0,null;var h=s.callbackNode;if(Nh()&&s.callbackNode!==h)return null;var g=Ct;return g=ot(s,s===Gt?g:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),g===0?null:(uC(s,g,u),kC(s,Pe()),s.callbackNode!=null&&s.callbackNode===h?AC.bind(null,s):null)}function RC(s,u){if(Nh())return null;uC(s,u,!0)}function n3(){v3(function(){(Lt&6)!==0?De(he,t3):NC()})}function Hg(){if(Ss===0){var s=Fo;s===0&&(s=He,He<<=1,(He&261888)===0&&(He=256)),Ss=s}return Ss}function DC(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Bd(""+s)}function jC(s,u){var h=u.ownerDocument.createElement("input");return h.name=u.name,h.value=u.value,s.id&&h.setAttribute("form",s.id),u.parentNode.insertBefore(h,u),s=new FormData(s),h.parentNode.removeChild(h),s}function r3(s,u,h,g,E){if(u==="submit"&&h&&h.stateNode===E){var N=DC((E[On]||null).action),O=g.submitter;O&&(u=(u=O[On]||null)?DC(u.formAction):O.getAttribute("formAction"),u!==null&&(N=u,O=null));var $=new Fd("action","action",null,g,E);s.push({event:$,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(Ss!==0){var W=O?jC(E,O):new FormData(E);cg(h,{pending:!0,data:W,method:E.method,action:N},null,W)}}else typeof N=="function"&&($.preventDefault(),W=O?jC(E,O):new FormData(E),cg(h,{pending:!0,data:W,method:E.method,action:N},N,W))},currentTarget:E}]})}}for(var Gg=0;Gg<km.length;Gg++){var $g=km[Gg],a3=$g.toLowerCase(),i3=$g[0].toUpperCase()+$g.slice(1);Ca(a3,"on"+i3)}Ca(oS,"onAnimationEnd"),Ca(uS,"onAnimationIteration"),Ca(cS,"onAnimationStart"),Ca("dblclick","onDoubleClick"),Ca("focusin","onFocus"),Ca("focusout","onBlur"),Ca(w5,"onTransitionRun"),Ca(S5,"onTransitionStart"),Ca(E5,"onTransitionCancel"),Ca(fS,"onTransitionEnd"),za("onMouseEnter",["mouseout","mouseover"]),za("onMouseLeave",["mouseout","mouseover"]),za("onPointerEnter",["pointerout","pointerover"]),za("onPointerLeave",["pointerout","pointerover"]),Ur("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ur("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ur("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ur("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ur("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ur("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Wc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),s3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Wc));function MC(s,u){u=(u&4)!==0;for(var h=0;h<s.length;h++){var g=s[h],E=g.event;g=g.listeners;e:{var N=void 0;if(u)for(var O=g.length-1;0<=O;O--){var $=g[O],W=$.instance,ce=$.currentTarget;if($=$.listener,W!==N&&E.isPropagationStopped())break e;N=$,E.currentTarget=ce;try{N(E)}catch(be){Vd(be)}E.currentTarget=null,N=W}else for(O=0;O<g.length;O++){if($=g[O],W=$.instance,ce=$.currentTarget,$=$.listener,W!==N&&E.isPropagationStopped())break e;N=$,E.currentTarget=ce;try{N(E)}catch(be){Vd(be)}E.currentTarget=null,N=W}}}}function wt(s,u){var h=u[Un];h===void 0&&(h=u[Un]=new Set);var g=s+"__bubble";h.has(g)||(OC(u,s,2,!1),h.add(g))}function Yg(s,u,h){var g=0;u&&(g|=4),OC(h,s,g,u)}var Rh="_reactListening"+Math.random().toString(36).slice(2);function Kg(s){if(!s[Rh]){s[Rh]=!0,jd.forEach(function(h){h!=="selectionchange"&&(s3.has(h)||Yg(h,!1,s),Yg(h,!0,s))});var u=s.nodeType===9?s:s.ownerDocument;u===null||u[Rh]||(u[Rh]=!0,Yg("selectionchange",!1,u))}}function OC(s,u,h,g){switch(o2(u)){case 2:var E=L3;break;case 8:E=_3;break;default:E=uy}h=E.bind(null,u,h,s),E=void 0,!vm||u!=="touchstart"&&u!=="touchmove"&&u!=="wheel"||(E=!0),g?E!==void 0?s.addEventListener(u,h,{capture:!0,passive:E}):s.addEventListener(u,h,!0):E!==void 0?s.addEventListener(u,h,{passive:E}):s.addEventListener(u,h,!1)}function Xg(s,u,h,g,E){var N=g;if((u&1)===0&&(u&2)===0&&g!==null)e:for(;;){if(g===null)return;var O=g.tag;if(O===3||O===4){var $=g.stateNode.containerInfo;if($===E)break;if(O===4)for(O=g.return;O!==null;){var W=O.tag;if((W===3||W===4)&&O.stateNode.containerInfo===E)return;O=O.return}for(;$!==null;){if(O=ns($),O===null)return;if(W=O.tag,W===5||W===6||W===26||W===27){g=N=O;continue e}$=$.parentNode}}g=g.return}zw(function(){var ce=N,be=dm(h),Ee=[];e:{var ve=dS.get(s);if(ve!==void 0){var me=Fd,Ve=s;switch(s){case"keypress":if(zd(h)===0)break e;case"keydown":case"keyup":me=J_;break;case"focusin":Ve="focus",me=ym;break;case"focusout":Ve="blur",me=ym;break;case"beforeblur":case"afterblur":me=ym;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":me=qw;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":me=q_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":me=n5;break;case oS:case uS:case cS:me=H_;break;case fS:me=a5;break;case"scroll":case"scrollend":me=I_;break;case"wheel":me=s5;break;case"copy":case"cut":case"paste":me=$_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":me=Vw;break;case"toggle":case"beforetoggle":me=o5}var rt=(u&4)!==0,Vt=!rt&&(s==="scroll"||s==="scrollend"),se=rt?ve!==null?ve+"Capture":null:ve;rt=[];for(var ee=ce,ue;ee!==null;){var Se=ee;if(ue=Se.stateNode,Se=Se.tag,Se!==5&&Se!==26&&Se!==27||ue===null||se===null||(Se=xc(ee,se),Se!=null&&rt.push(Zc(ee,Se,ue))),Vt)break;ee=ee.return}0<rt.length&&(ve=new me(ve,Ve,null,h,be),Ee.push({event:ve,listeners:rt}))}}if((u&7)===0){e:{if(ve=s==="mouseover"||s==="pointerover",me=s==="mouseout"||s==="pointerout",ve&&h!==fm&&(Ve=h.relatedTarget||h.fromElement)&&(ns(Ve)||Ve[kr]))break e;if((me||ve)&&(ve=be.window===be?be:(ve=be.ownerDocument)?ve.defaultView||ve.parentWindow:window,me?(Ve=h.relatedTarget||h.toElement,me=ce,Ve=Ve?ns(Ve):null,Ve!==null&&(Vt=i(Ve),rt=Ve.tag,Ve!==Vt||rt!==5&&rt!==27&&rt!==6)&&(Ve=null)):(me=null,Ve=ce),me!==Ve)){if(rt=qw,Se="onMouseLeave",se="onMouseEnter",ee="mouse",(s==="pointerout"||s==="pointerover")&&(rt=Vw,Se="onPointerLeave",se="onPointerEnter",ee="pointer"),Vt=me==null?ve:El(me),ue=Ve==null?ve:El(Ve),ve=new rt(Se,ee+"leave",me,h,be),ve.target=Vt,ve.relatedTarget=ue,Se=null,ns(be)===ce&&(rt=new rt(se,ee+"enter",Ve,h,be),rt.target=ue,rt.relatedTarget=Vt,Se=rt),Vt=Se,me&&Ve)t:{for(rt=l3,se=me,ee=Ve,ue=0,Se=se;Se;Se=rt(Se))ue++;Se=0;for(var Je=ee;Je;Je=rt(Je))Se++;for(;0<ue-Se;)se=rt(se),ue--;for(;0<Se-ue;)ee=rt(ee),Se--;for(;ue--;){if(se===ee||ee!==null&&se===ee.alternate){rt=se;break t}se=rt(se),ee=rt(ee)}rt=null}else rt=null;me!==null&&LC(Ee,ve,me,rt,!1),Ve!==null&&Vt!==null&&LC(Ee,Vt,Ve,rt,!0)}}e:{if(ve=ce?El(ce):window,me=ve.nodeName&&ve.nodeName.toLowerCase(),me==="select"||me==="input"&&ve.type==="file")var jt=Ww;else if(Xw(ve))if(Zw)jt=y5;else{jt=m5;var $e=p5}else me=ve.nodeName,!me||me.toLowerCase()!=="input"||ve.type!=="checkbox"&&ve.type!=="radio"?ce&&cm(ce.elementType)&&(jt=Ww):jt=g5;if(jt&&(jt=jt(s,ce))){Qw(Ee,jt,h,be);break e}$e&&$e(s,ve,ce),s==="focusout"&&ce&&ve.type==="number"&&ce.memoizedProps.value!=null&&um(ve,"number",ve.value)}switch($e=ce?El(ce):window,s){case"focusin":(Xw($e)||$e.contentEditable==="true")&&(Mo=$e,Cm=ce,kc=null);break;case"focusout":kc=Cm=Mo=null;break;case"mousedown":Tm=!0;break;case"contextmenu":case"mouseup":case"dragend":Tm=!1,sS(Ee,h,be);break;case"selectionchange":if(b5)break;case"keydown":case"keyup":sS(Ee,h,be)}var vt;if(bm)e:{switch(s){case"compositionstart":var Tt="onCompositionStart";break e;case"compositionend":Tt="onCompositionEnd";break e;case"compositionupdate":Tt="onCompositionUpdate";break e}Tt=void 0}else jo?Yw(s,h)&&(Tt="onCompositionEnd"):s==="keydown"&&h.keyCode===229&&(Tt="onCompositionStart");Tt&&(Hw&&h.locale!=="ko"&&(jo||Tt!=="onCompositionStart"?Tt==="onCompositionEnd"&&jo&&(vt=Iw()):(ss=be,pm="value"in ss?ss.value:ss.textContent,jo=!0)),$e=Dh(ce,Tt),0<$e.length&&(Tt=new Uw(Tt,s,null,h,be),Ee.push({event:Tt,listeners:$e}),vt?Tt.data=vt:(vt=Kw(h),vt!==null&&(Tt.data=vt)))),(vt=c5?f5(s,h):d5(s,h))&&(Tt=Dh(ce,"onBeforeInput"),0<Tt.length&&($e=new Uw("onBeforeInput","beforeinput",null,h,be),Ee.push({event:$e,listeners:Tt}),$e.data=vt)),r3(Ee,s,ce,h,be)}MC(Ee,u)})}function Zc(s,u,h){return{instance:s,listener:u,currentTarget:h}}function Dh(s,u){for(var h=u+"Capture",g=[];s!==null;){var E=s,N=E.stateNode;if(E=E.tag,E!==5&&E!==26&&E!==27||N===null||(E=xc(s,h),E!=null&&g.unshift(Zc(s,E,N)),E=xc(s,u),E!=null&&g.push(Zc(s,E,N))),s.tag===3)return g;s=s.return}return[]}function l3(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function LC(s,u,h,g,E){for(var N=u._reactName,O=[];h!==null&&h!==g;){var $=h,W=$.alternate,ce=$.stateNode;if($=$.tag,W!==null&&W===g)break;$!==5&&$!==26&&$!==27||ce===null||(W=ce,E?(ce=xc(h,N),ce!=null&&O.unshift(Zc(h,ce,W))):E||(ce=xc(h,N),ce!=null&&O.push(Zc(h,ce,W)))),h=h.return}O.length!==0&&s.push({event:u,listeners:O})}var o3=/\r\n?/g,u3=/\u0000|\uFFFD/g;function _C(s){return(typeof s=="string"?s:""+s).replace(o3,`
49
+ `).replace(u3,"")}function BC(s,u){return u=_C(u),_C(s)===u}function Ut(s,u,h,g,E,N){switch(h){case"children":typeof g=="string"?u==="body"||u==="textarea"&&g===""||Ao(s,g):(typeof g=="number"||typeof g=="bigint")&&u!=="body"&&Ao(s,""+g);break;case"className":is(s,"class",g);break;case"tabIndex":is(s,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":is(s,h,g);break;case"style":Bw(s,g,N);break;case"data":if(u!=="object"){is(s,"data",g);break}case"src":case"href":if(g===""&&(u!=="a"||h!=="href")){s.removeAttribute(h);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){s.removeAttribute(h);break}g=Bd(""+g),s.setAttribute(h,g);break;case"action":case"formAction":if(typeof g=="function"){s.setAttribute(h,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof N=="function"&&(h==="formAction"?(u!=="input"&&Ut(s,u,"name",E.name,E,null),Ut(s,u,"formEncType",E.formEncType,E,null),Ut(s,u,"formMethod",E.formMethod,E,null),Ut(s,u,"formTarget",E.formTarget,E,null)):(Ut(s,u,"encType",E.encType,E,null),Ut(s,u,"method",E.method,E,null),Ut(s,u,"target",E.target,E,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){s.removeAttribute(h);break}g=Bd(""+g),s.setAttribute(h,g);break;case"onClick":g!=null&&(s.onclick=vi);break;case"onScroll":g!=null&&wt("scroll",s);break;case"onScrollEnd":g!=null&&wt("scrollend",s);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(h=g.__html,h!=null){if(E.children!=null)throw Error(r(60));s.innerHTML=h}}break;case"multiple":s.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":s.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){s.removeAttribute("xlink:href");break}h=Bd(""+g),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?s.setAttribute(h,""+g):s.removeAttribute(h);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":g&&typeof g!="function"&&typeof g!="symbol"?s.setAttribute(h,""):s.removeAttribute(h);break;case"capture":case"download":g===!0?s.setAttribute(h,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?s.setAttribute(h,g):s.removeAttribute(h);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?s.setAttribute(h,g):s.removeAttribute(h);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?s.removeAttribute(h):s.setAttribute(h,g);break;case"popover":wt("beforetoggle",s),wt("toggle",s),cr(s,"popover",g);break;case"xlinkActuate":aa(s,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":aa(s,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":aa(s,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":aa(s,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":aa(s,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":aa(s,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":aa(s,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":aa(s,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":aa(s,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":cr(s,"is",g);break;case"innerText":case"textContent":break;default:(!(2<h.length)||h[0]!=="o"&&h[0]!=="O"||h[1]!=="n"&&h[1]!=="N")&&(h=P_.get(h)||h,cr(s,h,g))}}function Qg(s,u,h,g,E,N){switch(h){case"style":Bw(s,g,N);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(h=g.__html,h!=null){if(E.children!=null)throw Error(r(60));s.innerHTML=h}}break;case"children":typeof g=="string"?Ao(s,g):(typeof g=="number"||typeof g=="bigint")&&Ao(s,""+g);break;case"onScroll":g!=null&&wt("scroll",s);break;case"onScrollEnd":g!=null&&wt("scrollend",s);break;case"onClick":g!=null&&(s.onclick=vi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Md.hasOwnProperty(h))e:{if(h[0]==="o"&&h[1]==="n"&&(E=h.endsWith("Capture"),u=h.slice(2,E?h.length-7:void 0),N=s[On]||null,N=N!=null?N[h]:null,typeof N=="function"&&s.removeEventListener(u,N,E),typeof g=="function")){typeof N!="function"&&N!==null&&(h in s?s[h]=null:s.hasAttribute(h)&&s.removeAttribute(h)),s.addEventListener(u,g,E);break e}h in s?s[h]=g:g===!0?s.setAttribute(h,""):cr(s,h,g)}}}function nr(s,u,h){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":wt("error",s),wt("load",s);var g=!1,E=!1,N;for(N in h)if(h.hasOwnProperty(N)){var O=h[N];if(O!=null)switch(N){case"src":g=!0;break;case"srcSet":E=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,u));default:Ut(s,u,N,O,h,null)}}E&&Ut(s,u,"srcSet",h.srcSet,h,null),g&&Ut(s,u,"src",h.src,h,null);return;case"input":wt("invalid",s);var $=N=O=E=null,W=null,ce=null;for(g in h)if(h.hasOwnProperty(g)){var be=h[g];if(be!=null)switch(g){case"name":E=be;break;case"type":O=be;break;case"checked":W=be;break;case"defaultChecked":ce=be;break;case"value":N=be;break;case"defaultValue":$=be;break;case"children":case"dangerouslySetInnerHTML":if(be!=null)throw Error(r(137,u));break;default:Ut(s,u,g,be,h,null)}}Mw(s,N,$,W,ce,O,E,!1);return;case"select":wt("invalid",s),g=O=N=null;for(E in h)if(h.hasOwnProperty(E)&&($=h[E],$!=null))switch(E){case"value":N=$;break;case"defaultValue":O=$;break;case"multiple":g=$;default:Ut(s,u,E,$,h,null)}u=N,h=O,s.multiple=!!g,u!=null?ko(s,!!g,u,!1):h!=null&&ko(s,!!g,h,!0);return;case"textarea":wt("invalid",s),N=E=g=null;for(O in h)if(h.hasOwnProperty(O)&&($=h[O],$!=null))switch(O){case"value":g=$;break;case"defaultValue":E=$;break;case"children":N=$;break;case"dangerouslySetInnerHTML":if($!=null)throw Error(r(91));break;default:Ut(s,u,O,$,h,null)}Lw(s,g,E,N);return;case"option":for(W in h)if(h.hasOwnProperty(W)&&(g=h[W],g!=null))switch(W){case"selected":s.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:Ut(s,u,W,g,h,null)}return;case"dialog":wt("beforetoggle",s),wt("toggle",s),wt("cancel",s),wt("close",s);break;case"iframe":case"object":wt("load",s);break;case"video":case"audio":for(g=0;g<Wc.length;g++)wt(Wc[g],s);break;case"image":wt("error",s),wt("load",s);break;case"details":wt("toggle",s);break;case"embed":case"source":case"link":wt("error",s),wt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ce in h)if(h.hasOwnProperty(ce)&&(g=h[ce],g!=null))switch(ce){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,u));default:Ut(s,u,ce,g,h,null)}return;default:if(cm(u)){for(be in h)h.hasOwnProperty(be)&&(g=h[be],g!==void 0&&Qg(s,u,be,g,h,void 0));return}}for($ in h)h.hasOwnProperty($)&&(g=h[$],g!=null&&Ut(s,u,$,g,h,null))}function c3(s,u,h,g){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var E=null,N=null,O=null,$=null,W=null,ce=null,be=null;for(me in h){var Ee=h[me];if(h.hasOwnProperty(me)&&Ee!=null)switch(me){case"checked":break;case"value":break;case"defaultValue":W=Ee;default:g.hasOwnProperty(me)||Ut(s,u,me,null,g,Ee)}}for(var ve in g){var me=g[ve];if(Ee=h[ve],g.hasOwnProperty(ve)&&(me!=null||Ee!=null))switch(ve){case"type":N=me;break;case"name":E=me;break;case"checked":ce=me;break;case"defaultChecked":be=me;break;case"value":O=me;break;case"defaultValue":$=me;break;case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(r(137,u));break;default:me!==Ee&&Ut(s,u,ve,me,g,Ee)}}om(s,O,$,W,ce,be,N,E);return;case"select":me=O=$=ve=null;for(N in h)if(W=h[N],h.hasOwnProperty(N)&&W!=null)switch(N){case"value":break;case"multiple":me=W;default:g.hasOwnProperty(N)||Ut(s,u,N,null,g,W)}for(E in g)if(N=g[E],W=h[E],g.hasOwnProperty(E)&&(N!=null||W!=null))switch(E){case"value":ve=N;break;case"defaultValue":$=N;break;case"multiple":O=N;default:N!==W&&Ut(s,u,E,N,g,W)}u=$,h=O,g=me,ve!=null?ko(s,!!h,ve,!1):!!g!=!!h&&(u!=null?ko(s,!!h,u,!0):ko(s,!!h,h?[]:"",!1));return;case"textarea":me=ve=null;for($ in h)if(E=h[$],h.hasOwnProperty($)&&E!=null&&!g.hasOwnProperty($))switch($){case"value":break;case"children":break;default:Ut(s,u,$,null,g,E)}for(O in g)if(E=g[O],N=h[O],g.hasOwnProperty(O)&&(E!=null||N!=null))switch(O){case"value":ve=E;break;case"defaultValue":me=E;break;case"children":break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(r(91));break;default:E!==N&&Ut(s,u,O,E,g,N)}Ow(s,ve,me);return;case"option":for(var Ve in h)if(ve=h[Ve],h.hasOwnProperty(Ve)&&ve!=null&&!g.hasOwnProperty(Ve))switch(Ve){case"selected":s.selected=!1;break;default:Ut(s,u,Ve,null,g,ve)}for(W in g)if(ve=g[W],me=h[W],g.hasOwnProperty(W)&&ve!==me&&(ve!=null||me!=null))switch(W){case"selected":s.selected=ve&&typeof ve!="function"&&typeof ve!="symbol";break;default:Ut(s,u,W,ve,g,me)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var rt in h)ve=h[rt],h.hasOwnProperty(rt)&&ve!=null&&!g.hasOwnProperty(rt)&&Ut(s,u,rt,null,g,ve);for(ce in g)if(ve=g[ce],me=h[ce],g.hasOwnProperty(ce)&&ve!==me&&(ve!=null||me!=null))switch(ce){case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(r(137,u));break;default:Ut(s,u,ce,ve,g,me)}return;default:if(cm(u)){for(var Vt in h)ve=h[Vt],h.hasOwnProperty(Vt)&&ve!==void 0&&!g.hasOwnProperty(Vt)&&Qg(s,u,Vt,void 0,g,ve);for(be in g)ve=g[be],me=h[be],!g.hasOwnProperty(be)||ve===me||ve===void 0&&me===void 0||Qg(s,u,be,ve,g,me);return}}for(var se in h)ve=h[se],h.hasOwnProperty(se)&&ve!=null&&!g.hasOwnProperty(se)&&Ut(s,u,se,null,g,ve);for(Ee in g)ve=g[Ee],me=h[Ee],!g.hasOwnProperty(Ee)||ve===me||ve==null&&me==null||Ut(s,u,Ee,ve,g,me)}function PC(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function f3(){if(typeof performance.getEntriesByType=="function"){for(var s=0,u=0,h=performance.getEntriesByType("resource"),g=0;g<h.length;g++){var E=h[g],N=E.transferSize,O=E.initiatorType,$=E.duration;if(N&&$&&PC(O)){for(O=0,$=E.responseEnd,g+=1;g<h.length;g++){var W=h[g],ce=W.startTime;if(ce>$)break;var be=W.transferSize,Ee=W.initiatorType;be&&PC(Ee)&&(W=W.responseEnd,O+=be*(W<$?1:($-ce)/(W-ce)))}if(--g,u+=8*(N+O)/(E.duration/1e3),s++,10<s)break}}if(0<s)return u/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Wg=null,Zg=null;function jh(s){return s.nodeType===9?s:s.ownerDocument}function zC(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function IC(s,u){if(s===0)switch(u){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&u==="foreignObject"?0:s}function Jg(s,u){return s==="textarea"||s==="noscript"||typeof u.children=="string"||typeof u.children=="number"||typeof u.children=="bigint"||typeof u.dangerouslySetInnerHTML=="object"&&u.dangerouslySetInnerHTML!==null&&u.dangerouslySetInnerHTML.__html!=null}var ey=null;function d3(){var s=window.event;return s&&s.type==="popstate"?s===ey?!1:(ey=s,!0):(ey=null,!1)}var FC=typeof setTimeout=="function"?setTimeout:void 0,h3=typeof clearTimeout=="function"?clearTimeout:void 0,qC=typeof Promise=="function"?Promise:void 0,v3=typeof queueMicrotask=="function"?queueMicrotask:typeof qC<"u"?function(s){return qC.resolve(null).then(s).catch(p3)}:FC;function p3(s){setTimeout(function(){throw s})}function Es(s){return s==="head"}function UC(s,u){var h=u,g=0;do{var E=h.nextSibling;if(s.removeChild(h),E&&E.nodeType===8)if(h=E.data,h==="/$"||h==="/&"){if(g===0){s.removeChild(E),iu(u);return}g--}else if(h==="$"||h==="$?"||h==="$~"||h==="$!"||h==="&")g++;else if(h==="html")Jc(s.ownerDocument.documentElement);else if(h==="head"){h=s.ownerDocument.head,Jc(h);for(var N=h.firstChild;N;){var O=N.nextSibling,$=N.nodeName;N[Hn]||$==="SCRIPT"||$==="STYLE"||$==="LINK"&&N.rel.toLowerCase()==="stylesheet"||h.removeChild(N),N=O}}else h==="body"&&Jc(s.ownerDocument.body);h=E}while(h);iu(u)}function VC(s,u){var h=s;s=0;do{var g=h.nextSibling;if(h.nodeType===1?u?(h._stashedDisplay=h.style.display,h.style.display="none"):(h.style.display=h._stashedDisplay||"",h.getAttribute("style")===""&&h.removeAttribute("style")):h.nodeType===3&&(u?(h._stashedText=h.nodeValue,h.nodeValue=""):h.nodeValue=h._stashedText||""),g&&g.nodeType===8)if(h=g.data,h==="/$"){if(s===0)break;s--}else h!=="$"&&h!=="$?"&&h!=="$~"&&h!=="$!"||s++;h=g}while(h)}function ty(s){var u=s.firstChild;for(u&&u.nodeType===10&&(u=u.nextSibling);u;){var h=u;switch(u=u.nextSibling,h.nodeName){case"HTML":case"HEAD":case"BODY":ty(h),To(h);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(h.rel.toLowerCase()==="stylesheet")continue}s.removeChild(h)}}function m3(s,u,h,g){for(;s.nodeType===1;){var E=h;if(s.nodeName.toLowerCase()!==u.toLowerCase()){if(!g&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(g){if(!s[Hn])switch(u){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(N=s.getAttribute("rel"),N==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(N!==E.rel||s.getAttribute("href")!==(E.href==null||E.href===""?null:E.href)||s.getAttribute("crossorigin")!==(E.crossOrigin==null?null:E.crossOrigin)||s.getAttribute("title")!==(E.title==null?null:E.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(N=s.getAttribute("src"),(N!==(E.src==null?null:E.src)||s.getAttribute("type")!==(E.type==null?null:E.type)||s.getAttribute("crossorigin")!==(E.crossOrigin==null?null:E.crossOrigin))&&N&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(u==="input"&&s.type==="hidden"){var N=E.name==null?null:""+E.name;if(E.type==="hidden"&&s.getAttribute("name")===N)return s}else return s;if(s=da(s.nextSibling),s===null)break}return null}function g3(s,u,h){if(u==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!h||(s=da(s.nextSibling),s===null))return null;return s}function HC(s,u){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!u||(s=da(s.nextSibling),s===null))return null;return s}function ny(s){return s.data==="$?"||s.data==="$~"}function ry(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function y3(s,u){var h=s.ownerDocument;if(s.data==="$~")s._reactRetry=u;else if(s.data!=="$?"||h.readyState!=="loading")u();else{var g=function(){u(),h.removeEventListener("DOMContentLoaded",g)};h.addEventListener("DOMContentLoaded",g),s._reactRetry=g}}function da(s){for(;s!=null;s=s.nextSibling){var u=s.nodeType;if(u===1||u===3)break;if(u===8){if(u=s.data,u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"||u==="F!"||u==="F")break;if(u==="/$"||u==="/&")return null}}return s}var ay=null;function GC(s){s=s.nextSibling;for(var u=0;s;){if(s.nodeType===8){var h=s.data;if(h==="/$"||h==="/&"){if(u===0)return da(s.nextSibling);u--}else h!=="$"&&h!=="$!"&&h!=="$?"&&h!=="$~"&&h!=="&"||u++}s=s.nextSibling}return null}function $C(s){s=s.previousSibling;for(var u=0;s;){if(s.nodeType===8){var h=s.data;if(h==="$"||h==="$!"||h==="$?"||h==="$~"||h==="&"){if(u===0)return s;u--}else h!=="/$"&&h!=="/&"||u++}s=s.previousSibling}return null}function YC(s,u,h){switch(u=jh(h),s){case"html":if(s=u.documentElement,!s)throw Error(r(452));return s;case"head":if(s=u.head,!s)throw Error(r(453));return s;case"body":if(s=u.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function Jc(s){for(var u=s.attributes;u.length;)s.removeAttributeNode(u[0]);To(s)}var ha=new Map,KC=new Set;function Mh(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Di=H.d;H.d={f:x3,r:b3,D:w3,C:S3,L:E3,m:C3,X:N3,S:T3,M:k3};function x3(){var s=Di.f(),u=Eh();return s||u}function b3(s){var u=rs(s);u!==null&&u.tag===5&&u.type==="form"?fE(u):Di.r(s)}var nu=typeof document>"u"?null:document;function XC(s,u,h){var g=nu;if(g&&typeof u=="string"&&u){var E=ia(u);E='link[rel="'+s+'"][href="'+E+'"]',typeof h=="string"&&(E+='[crossorigin="'+h+'"]'),KC.has(E)||(KC.add(E),s={rel:s,crossOrigin:h,href:u},g.querySelector(E)===null&&(u=g.createElement("link"),nr(u,"link",s),Tn(u),g.head.appendChild(u)))}}function w3(s){Di.D(s),XC("dns-prefetch",s,null)}function S3(s,u){Di.C(s,u),XC("preconnect",s,u)}function E3(s,u,h){Di.L(s,u,h);var g=nu;if(g&&s&&u){var E='link[rel="preload"][as="'+ia(u)+'"]';u==="image"&&h&&h.imageSrcSet?(E+='[imagesrcset="'+ia(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(E+='[imagesizes="'+ia(h.imageSizes)+'"]')):E+='[href="'+ia(s)+'"]';var N=E;switch(u){case"style":N=ru(s);break;case"script":N=au(s)}ha.has(N)||(s=v({rel:"preload",href:u==="image"&&h&&h.imageSrcSet?void 0:s,as:u},h),ha.set(N,s),g.querySelector(E)!==null||u==="style"&&g.querySelector(ef(N))||u==="script"&&g.querySelector(tf(N))||(u=g.createElement("link"),nr(u,"link",s),Tn(u),g.head.appendChild(u)))}}function C3(s,u){Di.m(s,u);var h=nu;if(h&&s){var g=u&&typeof u.as=="string"?u.as:"script",E='link[rel="modulepreload"][as="'+ia(g)+'"][href="'+ia(s)+'"]',N=E;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":N=au(s)}if(!ha.has(N)&&(s=v({rel:"modulepreload",href:s},u),ha.set(N,s),h.querySelector(E)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(tf(N)))return}g=h.createElement("link"),nr(g,"link",s),Tn(g),h.head.appendChild(g)}}}function T3(s,u,h){Di.S(s,u,h);var g=nu;if(g&&s){var E=as(g).hoistableStyles,N=ru(s);u=u||"default";var O=E.get(N);if(!O){var $={loading:0,preload:null};if(O=g.querySelector(ef(N)))$.loading=5;else{s=v({rel:"stylesheet",href:s,"data-precedence":u},h),(h=ha.get(N))&&iy(s,h);var W=O=g.createElement("link");Tn(W),nr(W,"link",s),W._p=new Promise(function(ce,be){W.onload=ce,W.onerror=be}),W.addEventListener("load",function(){$.loading|=1}),W.addEventListener("error",function(){$.loading|=2}),$.loading|=4,Oh(O,u,g)}O={type:"stylesheet",instance:O,count:1,state:$},E.set(N,O)}}}function N3(s,u){Di.X(s,u);var h=nu;if(h&&s){var g=as(h).hoistableScripts,E=au(s),N=g.get(E);N||(N=h.querySelector(tf(E)),N||(s=v({src:s,async:!0},u),(u=ha.get(E))&&sy(s,u),N=h.createElement("script"),Tn(N),nr(N,"link",s),h.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},g.set(E,N))}}function k3(s,u){Di.M(s,u);var h=nu;if(h&&s){var g=as(h).hoistableScripts,E=au(s),N=g.get(E);N||(N=h.querySelector(tf(E)),N||(s=v({src:s,async:!0,type:"module"},u),(u=ha.get(E))&&sy(s,u),N=h.createElement("script"),Tn(N),nr(N,"link",s),h.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},g.set(E,N))}}function QC(s,u,h,g){var E=(E=oe.current)?Mh(E):null;if(!E)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(u=ru(h.href),h=as(E).hoistableStyles,g=h.get(u),g||(g={type:"style",instance:null,count:0,state:null},h.set(u,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){s=ru(h.href);var N=as(E).hoistableStyles,O=N.get(s);if(O||(E=E.ownerDocument||E,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},N.set(s,O),(N=E.querySelector(ef(s)))&&!N._p&&(O.instance=N,O.state.loading=5),ha.has(s)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},ha.set(s,h),N||A3(E,s,h,O.state))),u&&g===null)throw Error(r(528,""));return O}if(u&&g!==null)throw Error(r(529,""));return null;case"script":return u=h.async,h=h.src,typeof h=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=au(h),h=as(E).hoistableScripts,g=h.get(u),g||(g={type:"script",instance:null,count:0,state:null},h.set(u,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function ru(s){return'href="'+ia(s)+'"'}function ef(s){return'link[rel="stylesheet"]['+s+"]"}function WC(s){return v({},s,{"data-precedence":s.precedence,precedence:null})}function A3(s,u,h,g){s.querySelector('link[rel="preload"][as="style"]['+u+"]")?g.loading=1:(u=s.createElement("link"),g.preload=u,u.addEventListener("load",function(){return g.loading|=1}),u.addEventListener("error",function(){return g.loading|=2}),nr(u,"link",h),Tn(u),s.head.appendChild(u))}function au(s){return'[src="'+ia(s)+'"]'}function tf(s){return"script[async]"+s}function ZC(s,u,h){if(u.count++,u.instance===null)switch(u.type){case"style":var g=s.querySelector('style[data-href~="'+ia(h.href)+'"]');if(g)return u.instance=g,Tn(g),g;var E=v({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return g=(s.ownerDocument||s).createElement("style"),Tn(g),nr(g,"style",E),Oh(g,h.precedence,s),u.instance=g;case"stylesheet":E=ru(h.href);var N=s.querySelector(ef(E));if(N)return u.state.loading|=4,u.instance=N,Tn(N),N;g=WC(h),(E=ha.get(E))&&iy(g,E),N=(s.ownerDocument||s).createElement("link"),Tn(N);var O=N;return O._p=new Promise(function($,W){O.onload=$,O.onerror=W}),nr(N,"link",g),u.state.loading|=4,Oh(N,h.precedence,s),u.instance=N;case"script":return N=au(h.src),(E=s.querySelector(tf(N)))?(u.instance=E,Tn(E),E):(g=h,(E=ha.get(N))&&(g=v({},h),sy(g,E)),s=s.ownerDocument||s,E=s.createElement("script"),Tn(E),nr(E,"link",g),s.head.appendChild(E),u.instance=E);case"void":return null;default:throw Error(r(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(g=u.instance,u.state.loading|=4,Oh(g,h.precedence,s));return u.instance}function Oh(s,u,h){for(var g=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),E=g.length?g[g.length-1]:null,N=E,O=0;O<g.length;O++){var $=g[O];if($.dataset.precedence===u)N=$;else if(N!==E)break}N?N.parentNode.insertBefore(s,N.nextSibling):(u=h.nodeType===9?h.head:h,u.insertBefore(s,u.firstChild))}function iy(s,u){s.crossOrigin==null&&(s.crossOrigin=u.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=u.referrerPolicy),s.title==null&&(s.title=u.title)}function sy(s,u){s.crossOrigin==null&&(s.crossOrigin=u.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=u.referrerPolicy),s.integrity==null&&(s.integrity=u.integrity)}var Lh=null;function JC(s,u,h){if(Lh===null){var g=new Map,E=Lh=new Map;E.set(h,g)}else E=Lh,g=E.get(h),g||(g=new Map,E.set(h,g));if(g.has(s))return g;for(g.set(s,null),h=h.getElementsByTagName(s),E=0;E<h.length;E++){var N=h[E];if(!(N[Hn]||N[rn]||s==="link"&&N.getAttribute("rel")==="stylesheet")&&N.namespaceURI!=="http://www.w3.org/2000/svg"){var O=N.getAttribute(u)||"";O=s+O;var $=g.get(O);$?$.push(N):g.set(O,[N])}}return g}function e2(s,u,h){s=s.ownerDocument||s,s.head.insertBefore(h,u==="title"?s.querySelector("head > title"):null)}function R3(s,u,h){if(h===1||u.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return s=u.disabled,typeof u.precedence=="string"&&s==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function t2(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function D3(s,u,h,g){if(h.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var E=ru(g.href),N=u.querySelector(ef(E));if(N){u=N._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(s.count++,s=_h.bind(s),u.then(s,s)),h.state.loading|=4,h.instance=N,Tn(N);return}N=u.ownerDocument||u,g=WC(g),(E=ha.get(E))&&iy(g,E),N=N.createElement("link"),Tn(N);var O=N;O._p=new Promise(function($,W){O.onload=$,O.onerror=W}),nr(N,"link",g),h.instance=N}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(h,u),(u=h.state.preload)&&(h.state.loading&3)===0&&(s.count++,h=_h.bind(s),u.addEventListener("load",h),u.addEventListener("error",h))}}var ly=0;function j3(s,u){return s.stylesheets&&s.count===0&&Ph(s,s.stylesheets),0<s.count||0<s.imgCount?function(h){var g=setTimeout(function(){if(s.stylesheets&&Ph(s,s.stylesheets),s.unsuspend){var N=s.unsuspend;s.unsuspend=null,N()}},6e4+u);0<s.imgBytes&&ly===0&&(ly=62500*f3());var E=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Ph(s,s.stylesheets),s.unsuspend)){var N=s.unsuspend;s.unsuspend=null,N()}},(s.imgBytes>ly?50:800)+u);return s.unsuspend=h,function(){s.unsuspend=null,clearTimeout(g),clearTimeout(E)}}:null}function _h(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ph(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Bh=null;function Ph(s,u){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Bh=new Map,u.forEach(M3,s),Bh=null,_h.call(s))}function M3(s,u){if(!(u.state.loading&4)){var h=Bh.get(s);if(h)var g=h.get(null);else{h=new Map,Bh.set(s,h);for(var E=s.querySelectorAll("link[data-precedence],style[data-precedence]"),N=0;N<E.length;N++){var O=E[N];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(h.set(O.dataset.precedence,O),g=O)}g&&h.set(null,g)}E=u.instance,O=E.getAttribute("data-precedence"),N=h.get(O)||g,N===g&&h.set(null,E),h.set(O,E),this.count++,g=_h.bind(this),E.addEventListener("load",g),E.addEventListener("error",g),N?N.parentNode.insertBefore(E,N.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(E,s.firstChild)),u.state.loading|=4}}var nf={$$typeof:T,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function O3(s,u,h,g,E,N,O,$,W){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ln(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ln(0),this.hiddenUpdates=ln(null),this.identifierPrefix=g,this.onUncaughtError=E,this.onCaughtError=N,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=W,this.incompleteTransitions=new Map}function n2(s,u,h,g,E,N,O,$,W,ce,be,Ee){return s=new O3(s,u,h,O,W,ce,be,Ee,$),u=1,N===!0&&(u|=24),N=Hr(3,null,null,u),s.current=N,N.stateNode=s,u=Fm(),u.refCount++,s.pooledCache=u,u.refCount++,N.memoizedState={element:g,isDehydrated:h,cache:u},Hm(N),s}function r2(s){return s?(s=_o,s):_o}function a2(s,u,h,g,E,N){E=r2(E),g.context===null?g.context=E:g.pendingContext=E,g=ds(u),g.payload={element:h},N=N===void 0?null:N,N!==null&&(g.callback=N),h=hs(s,g,u),h!==null&&(Lr(h,s,u),Lc(h,s,u))}function i2(s,u){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var h=s.retryLane;s.retryLane=h!==0&&h<u?h:u}}function oy(s,u){i2(s,u),(s=s.alternate)&&i2(s,u)}function s2(s){if(s.tag===13||s.tag===31){var u=kl(s,67108864);u!==null&&Lr(u,s,67108864),oy(s,67108864)}}function l2(s){if(s.tag===13||s.tag===31){var u=Xr();u=xn(u);var h=kl(s,u);h!==null&&Lr(h,s,u),oy(s,u)}}var zh=!0;function L3(s,u,h,g){var E=B.T;B.T=null;var N=H.p;try{H.p=2,uy(s,u,h,g)}finally{H.p=N,B.T=E}}function _3(s,u,h,g){var E=B.T;B.T=null;var N=H.p;try{H.p=8,uy(s,u,h,g)}finally{H.p=N,B.T=E}}function uy(s,u,h,g){if(zh){var E=cy(g);if(E===null)Xg(s,u,g,Ih,h),u2(s,g);else if(P3(E,s,u,h,g))g.stopPropagation();else if(u2(s,g),u&4&&-1<B3.indexOf(s)){for(;E!==null;){var N=rs(E);if(N!==null)switch(N.tag){case 3:if(N=N.stateNode,N.current.memoizedState.isDehydrated){var O=lt(N.pendingLanes);if(O!==0){var $=N;for($.pendingLanes|=2,$.entangledLanes|=2;O;){var W=1<<31-de(O);$.entanglements[1]|=W,O&=~W}Ua(N),(Lt&6)===0&&(wh=Pe()+500,Qc(0))}}break;case 31:case 13:$=kl(N,2),$!==null&&Lr($,N,2),Eh(),oy(N,2)}if(N=cy(g),N===null&&Xg(s,u,g,Ih,h),N===E)break;E=N}E!==null&&g.stopPropagation()}else Xg(s,u,g,null,h)}}function cy(s){return s=dm(s),fy(s)}var Ih=null;function fy(s){if(Ih=null,s=ns(s),s!==null){var u=i(s);if(u===null)s=null;else{var h=u.tag;if(h===13){if(s=l(u),s!==null)return s;s=null}else if(h===31){if(s=o(u),s!==null)return s;s=null}else if(h===3){if(u.stateNode.current.memoizedState.isDehydrated)return u.tag===3?u.stateNode.containerInfo:null;s=null}else u!==s&&(s=null)}}return Ih=s,null}function o2(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ct()){case he:return 2;case Ce:return 8;case je:case ze:return 32;case Me:return 268435456;default:return 32}default:return 32}}var dy=!1,Cs=null,Ts=null,Ns=null,rf=new Map,af=new Map,ks=[],B3="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function u2(s,u){switch(s){case"focusin":case"focusout":Cs=null;break;case"dragenter":case"dragleave":Ts=null;break;case"mouseover":case"mouseout":Ns=null;break;case"pointerover":case"pointerout":rf.delete(u.pointerId);break;case"gotpointercapture":case"lostpointercapture":af.delete(u.pointerId)}}function sf(s,u,h,g,E,N){return s===null||s.nativeEvent!==N?(s={blockedOn:u,domEventName:h,eventSystemFlags:g,nativeEvent:N,targetContainers:[E]},u!==null&&(u=rs(u),u!==null&&s2(u)),s):(s.eventSystemFlags|=g,u=s.targetContainers,E!==null&&u.indexOf(E)===-1&&u.push(E),s)}function P3(s,u,h,g,E){switch(u){case"focusin":return Cs=sf(Cs,s,u,h,g,E),!0;case"dragenter":return Ts=sf(Ts,s,u,h,g,E),!0;case"mouseover":return Ns=sf(Ns,s,u,h,g,E),!0;case"pointerover":var N=E.pointerId;return rf.set(N,sf(rf.get(N)||null,s,u,h,g,E)),!0;case"gotpointercapture":return N=E.pointerId,af.set(N,sf(af.get(N)||null,s,u,h,g,E)),!0}return!1}function c2(s){var u=ns(s.target);if(u!==null){var h=i(u);if(h!==null){if(u=h.tag,u===13){if(u=l(h),u!==null){s.blockedOn=u,ra(s.priority,function(){l2(h)});return}}else if(u===31){if(u=o(h),u!==null){s.blockedOn=u,ra(s.priority,function(){l2(h)});return}}else if(u===3&&h.stateNode.current.memoizedState.isDehydrated){s.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Fh(s){if(s.blockedOn!==null)return!1;for(var u=s.targetContainers;0<u.length;){var h=cy(s.nativeEvent);if(h===null){h=s.nativeEvent;var g=new h.constructor(h.type,h);fm=g,h.target.dispatchEvent(g),fm=null}else return u=rs(h),u!==null&&s2(u),s.blockedOn=h,!1;u.shift()}return!0}function f2(s,u,h){Fh(s)&&h.delete(u)}function z3(){dy=!1,Cs!==null&&Fh(Cs)&&(Cs=null),Ts!==null&&Fh(Ts)&&(Ts=null),Ns!==null&&Fh(Ns)&&(Ns=null),rf.forEach(f2),af.forEach(f2)}function qh(s,u){s.blockedOn===u&&(s.blockedOn=null,dy||(dy=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,z3)))}var Uh=null;function d2(s){Uh!==s&&(Uh=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Uh===s&&(Uh=null);for(var u=0;u<s.length;u+=3){var h=s[u],g=s[u+1],E=s[u+2];if(typeof g!="function"){if(fy(g||h)===null)continue;break}var N=rs(h);N!==null&&(s.splice(u,3),u-=3,cg(N,{pending:!0,data:E,method:h.method,action:g},g,E))}}))}function iu(s){function u(W){return qh(W,s)}Cs!==null&&qh(Cs,s),Ts!==null&&qh(Ts,s),Ns!==null&&qh(Ns,s),rf.forEach(u),af.forEach(u);for(var h=0;h<ks.length;h++){var g=ks[h];g.blockedOn===s&&(g.blockedOn=null)}for(;0<ks.length&&(h=ks[0],h.blockedOn===null);)c2(h),h.blockedOn===null&&ks.shift();if(h=(s.ownerDocument||s).$$reactFormReplay,h!=null)for(g=0;g<h.length;g+=3){var E=h[g],N=h[g+1],O=E[On]||null;if(typeof N=="function")O||d2(h);else if(O){var $=null;if(N&&N.hasAttribute("formAction")){if(E=N,O=N[On]||null)$=O.formAction;else if(fy(E)!==null)continue}else $=O.action;typeof $=="function"?h[g+1]=$:(h.splice(g,3),g-=3),d2(h)}}}function h2(){function s(N){N.canIntercept&&N.info==="react-transition"&&N.intercept({handler:function(){return new Promise(function(O){return E=O})},focusReset:"manual",scroll:"manual"})}function u(){E!==null&&(E(),E=null),g||setTimeout(h,20)}function h(){if(!g&&!navigation.transition){var N=navigation.currentEntry;N&&N.url!=null&&navigation.navigate(N.url,{state:N.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,E=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",u),navigation.addEventListener("navigateerror",u),setTimeout(h,100),function(){g=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",u),navigation.removeEventListener("navigateerror",u),E!==null&&(E(),E=null)}}}function hy(s){this._internalRoot=s}Vh.prototype.render=hy.prototype.render=function(s){var u=this._internalRoot;if(u===null)throw Error(r(409));var h=u.current,g=Xr();a2(h,g,s,u,null,null)},Vh.prototype.unmount=hy.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var u=s.containerInfo;a2(s.current,2,null,s,null,null),Eh(),u[kr]=null}};function Vh(s){this._internalRoot=s}Vh.prototype.unstable_scheduleHydration=function(s){if(s){var u=un();s={blockedOn:null,target:s,priority:u};for(var h=0;h<ks.length&&u!==0&&u<ks[h].priority;h++);ks.splice(h,0,s),h===0&&c2(s)}};var v2=t.version;if(v2!=="19.2.4")throw Error(r(527,v2,"19.2.4"));H.findDOMNode=function(s){var u=s._reactInternals;if(u===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=c(u),s=s!==null?d(s):null,s=s===null?null:s.stateNode,s};var I3={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hh.isDisabled&&Hh.supportsFiber)try{Y=Hh.inject(I3),le=Hh}catch{}}return of.createRoot=function(s,u){if(!a(s))throw Error(r(299));var h=!1,g="",E=wE,N=SE,O=EE;return u!=null&&(u.unstable_strictMode===!0&&(h=!0),u.identifierPrefix!==void 0&&(g=u.identifierPrefix),u.onUncaughtError!==void 0&&(E=u.onUncaughtError),u.onCaughtError!==void 0&&(N=u.onCaughtError),u.onRecoverableError!==void 0&&(O=u.onRecoverableError)),u=n2(s,1,!1,null,null,h,g,null,E,N,O,h2),s[kr]=u.current,Kg(s),new hy(u)},of.hydrateRoot=function(s,u,h){if(!a(s))throw Error(r(299));var g=!1,E="",N=wE,O=SE,$=EE,W=null;return h!=null&&(h.unstable_strictMode===!0&&(g=!0),h.identifierPrefix!==void 0&&(E=h.identifierPrefix),h.onUncaughtError!==void 0&&(N=h.onUncaughtError),h.onCaughtError!==void 0&&(O=h.onCaughtError),h.onRecoverableError!==void 0&&($=h.onRecoverableError),h.formState!==void 0&&(W=h.formState)),u=n2(s,1,!0,u,h??null,g,E,W,N,O,$,h2),u.context=r2(null),h=u.current,g=Xr(),g=xn(g),E=ds(g),E.callback=null,hs(h,E,g),h=g,u.current.lanes=h,Ft(u,h),Ua(u),s[kr]=u.current,Kg(s),new Vh(u)},of.version="19.2.4",of}var T2;function X3(){if(T2)return gy.exports;T2=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),gy.exports=K3(),gy.exports}var Q3=X3();const W3=ld(Q3);var Ju=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ql,zs,_u,pR,Z3=(pR=class extends Ju{constructor(){super();We(this,Ql);We(this,zs);We(this,_u);_e(this,_u,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){Z(this,zs)||this.setEventListener(Z(this,_u))}onUnsubscribe(){var t;this.hasListeners()||((t=Z(this,zs))==null||t.call(this),_e(this,zs,void 0))}setEventListener(t){var n;_e(this,_u,t),(n=Z(this,zs))==null||n.call(this),_e(this,zs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){Z(this,Ql)!==t&&(_e(this,Ql,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof Z(this,Ql)=="boolean"?Z(this,Ql):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ql=new WeakMap,zs=new WeakMap,_u=new WeakMap,pR),Wb=new Z3,J3={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Is,Xb,mR,eB=(mR=class{constructor(){We(this,Is,J3);We(this,Xb,!1)}setTimeoutProvider(e){_e(this,Is,e)}setTimeout(e,t){return Z(this,Is).setTimeout(e,t)}clearTimeout(e){Z(this,Is).clearTimeout(e)}setInterval(e,t){return Z(this,Is).setInterval(e,t)}clearInterval(e){Z(this,Is).clearInterval(e)}},Is=new WeakMap,Xb=new WeakMap,mR),Kl=new eB;function tB(e){setTimeout(e,0)}var nB=typeof window>"u"||"Deno"in globalThis;function Sr(){}function rB(e,t){return typeof e=="function"?e(t):e}function B0(e){return typeof e=="number"&&e>=0&&e!==1/0}function AR(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Qs(e,t){return typeof e=="function"?e(t):e}function ma(e,t){return typeof e=="function"?e(t):e}function N2(e,t){const{type:n="all",exact:r,fetchStatus:a,predicate:i,queryKey:l,stale:o}=e;if(l){if(r){if(t.queryHash!==Zb(l,t.options))return!1}else if(!zf(t.queryKey,l))return!1}if(n!=="all"){const f=t.isActive();if(n==="active"&&!f||n==="inactive"&&f)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||a&&a!==t.state.fetchStatus||i&&!i(t))}function k2(e,t){const{exact:n,status:r,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(oo(t.options.mutationKey)!==oo(i))return!1}else if(!zf(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function Zb(e,t){return((t==null?void 0:t.queryKeyHashFn)||oo)(e)}function oo(e){return JSON.stringify(e,(t,n)=>P0(n)?Object.keys(n).sort().reduce((r,a)=>(r[a]=n[a],r),{}):n)}function zf(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>zf(e[n],t[n])):!1}var aB=Object.prototype.hasOwnProperty;function RR(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=A2(e)&&A2(t);if(!r&&!(P0(e)&&P0(t)))return t;const i=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),o=l.length,f=r?new Array(o):{};let c=0;for(let d=0;d<o;d++){const v=r?d:l[d],m=e[v],y=t[v];if(m===y){f[v]=m,(r?d<i:aB.call(e,v))&&c++;continue}if(m===null||y===null||typeof m!="object"||typeof y!="object"){f[v]=y;continue}const x=RR(m,y,n+1);f[v]=x,x===m&&c++}return i===o&&c===i?e:f}function zv(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function A2(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function P0(e){if(!R2(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!R2(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function R2(e){return Object.prototype.toString.call(e)==="[object Object]"}function iB(e){return new Promise(t=>{Kl.setTimeout(t,e)})}function z0(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?RR(e,t):t}function sB(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function lB(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Jb=Symbol();function DR(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Jb?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function e1(e,t){return typeof e=="function"?e(...t):!!e}function oB(e,t,n){let r=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),r||(r=!0,a.aborted?n():a.addEventListener("abort",n,{once:!0})),a)}),e}var If=(()=>{let e=()=>nB;return{isServer(){return e()},setIsServer(t){e=t}}})();function I0(){let e,t;const n=new Promise((a,i)=>{e=a,t=i});n.status="pending",n.catch(()=>{});function r(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{r({status:"fulfilled",value:a}),e(a)},n.reject=a=>{r({status:"rejected",reason:a}),t(a)},n}var uB=tB;function cB(){let e=[],t=0,n=o=>{o()},r=o=>{o()},a=uB;const i=o=>{t?e.push(o):a(()=>{n(o)})},l=()=>{const o=e;e=[],o.length&&a(()=>{r(()=>{o.forEach(f=>{n(f)})})})};return{batch:o=>{let f;t++;try{f=o()}finally{t--,t||l()}return f},batchCalls:o=>(...f)=>{i(()=>{o(...f)})},schedule:i,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{a=o}}}var Bn=cB(),Bu,Fs,Pu,gR,fB=(gR=class extends Ju{constructor(){super();We(this,Bu,!0);We(this,Fs);We(this,Pu);_e(this,Pu,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){Z(this,Fs)||this.setEventListener(Z(this,Pu))}onUnsubscribe(){var t;this.hasListeners()||((t=Z(this,Fs))==null||t.call(this),_e(this,Fs,void 0))}setEventListener(t){var n;_e(this,Pu,t),(n=Z(this,Fs))==null||n.call(this),_e(this,Fs,t(this.setOnline.bind(this)))}setOnline(t){Z(this,Bu)!==t&&(_e(this,Bu,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return Z(this,Bu)}},Bu=new WeakMap,Fs=new WeakMap,Pu=new WeakMap,gR),Iv=new fB;function dB(e){return Math.min(1e3*2**e,3e4)}function jR(e){return(e??"online")==="online"?Iv.isOnline():!0}var F0=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function MR(e){let t=!1,n=0,r;const a=I0(),i=()=>a.status!=="pending",l=S=>{var w;if(!i()){const b=new F0(S);m(b),(w=e.onCancel)==null||w.call(e,b)}},o=()=>{t=!0},f=()=>{t=!1},c=()=>Wb.isFocused()&&(e.networkMode==="always"||Iv.isOnline())&&e.canRun(),d=()=>jR(e.networkMode)&&e.canRun(),v=S=>{i()||(r==null||r(),a.resolve(S))},m=S=>{i()||(r==null||r(),a.reject(S))},y=()=>new Promise(S=>{var w;r=b=>{(i()||c())&&S(b)},(w=e.onPause)==null||w.call(e)}).then(()=>{var S;r=void 0,i()||(S=e.onContinue)==null||S.call(e)}),x=()=>{if(i())return;let S;const w=n===0?e.initialPromise:void 0;try{S=w??e.fn()}catch(b){S=Promise.reject(b)}Promise.resolve(S).then(v).catch(b=>{var A;if(i())return;const C=e.retry??(If.isServer()?0:3),T=e.retryDelay??dB,k=typeof T=="function"?T(n,b):T,D=C===!0||typeof C=="number"&&n<C||typeof C=="function"&&C(n,b);if(t||!D){m(b);return}n++,(A=e.onFail)==null||A.call(e,n,b),iB(k).then(()=>c()?void 0:y()).then(()=>{t?m(b):x()})})};return{promise:a,status:()=>a.status,cancel:l,continue:()=>(r==null||r(),a),cancelRetry:o,continueRetry:f,canStart:d,start:()=>(d()?x():y().then(x),a)}}var Wl,yR,OR=(yR=class{constructor(){We(this,Wl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),B0(this.gcTime)&&_e(this,Wl,Kl.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(If.isServer()?1/0:300*1e3))}clearGcTimeout(){Z(this,Wl)&&(Kl.clearTimeout(Z(this,Wl)),_e(this,Wl,void 0))}},Wl=new WeakMap,yR),Zl,zu,pa,Jl,Yn,nd,eo,Wr,LR,Li,xR,hB=(xR=class extends OR{constructor(t){super();We(this,Wr);We(this,Zl);We(this,zu);We(this,pa);We(this,Jl);We(this,Yn);We(this,nd);We(this,eo);_e(this,eo,!1),_e(this,nd,t.defaultOptions),this.setOptions(t.options),this.observers=[],_e(this,Jl,t.client),_e(this,pa,Z(this,Jl).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,_e(this,Zl,j2(this.options)),this.state=t.state??Z(this,Zl),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=Z(this,Yn))==null?void 0:t.promise}setOptions(t){if(this.options={...Z(this,nd),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=j2(this.options);n.data!==void 0&&(this.setState(D2(n.data,n.dataUpdatedAt)),_e(this,Zl,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Z(this,pa).remove(this)}setData(t,n){const r=z0(this.state.data,t,this.options);return pt(this,Wr,Li).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){pt(this,Wr,Li).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,a;const n=(r=Z(this,Yn))==null?void 0:r.promise;return(a=Z(this,Yn))==null||a.cancel(t),n?n.then(Sr).catch(Sr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return Z(this,Zl)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>ma(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Jb||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Qs(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!AR(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=Z(this,Yn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=Z(this,Yn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),Z(this,pa).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(Z(this,Yn)&&(Z(this,eo)||pt(this,Wr,LR).call(this)?Z(this,Yn).cancel({revert:!0}):Z(this,Yn).cancelRetry()),this.scheduleGc()),Z(this,pa).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pt(this,Wr,Li).call(this,{type:"invalidate"})}async fetch(t,n){var f,c,d,v,m,y,x,S,w,b,C,T;if(this.state.fetchStatus!=="idle"&&((f=Z(this,Yn))==null?void 0:f.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(Z(this,Yn))return Z(this,Yn).continueRetry(),Z(this,Yn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const k=this.observers.find(D=>D.options.queryFn);k&&this.setOptions(k.options)}const r=new AbortController,a=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(_e(this,eo,!0),r.signal)})},i=()=>{const k=DR(this.options,n),A=(()=>{const j={client:Z(this,Jl),queryKey:this.queryKey,meta:this.meta};return a(j),j})();return _e(this,eo,!1),this.options.persister?this.options.persister(k,A,this):k(A)},o=(()=>{const k={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:Z(this,Jl),state:this.state,fetchFn:i};return a(k),k})();(c=this.options.behavior)==null||c.onFetch(o,this),_e(this,zu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&pt(this,Wr,Li).call(this,{type:"fetch",meta:(v=o.fetchOptions)==null?void 0:v.meta}),_e(this,Yn,MR({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:k=>{k instanceof F0&&k.revert&&this.setState({...Z(this,zu),fetchStatus:"idle"}),r.abort()},onFail:(k,D)=>{pt(this,Wr,Li).call(this,{type:"failed",failureCount:k,error:D})},onPause:()=>{pt(this,Wr,Li).call(this,{type:"pause"})},onContinue:()=>{pt(this,Wr,Li).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const k=await Z(this,Yn).start();if(k===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(k),(y=(m=Z(this,pa).config).onSuccess)==null||y.call(m,k,this),(S=(x=Z(this,pa).config).onSettled)==null||S.call(x,k,this.state.error,this),k}catch(k){if(k instanceof F0){if(k.silent)return Z(this,Yn).promise;if(k.revert){if(this.state.data===void 0)throw k;return this.state.data}}throw pt(this,Wr,Li).call(this,{type:"error",error:k}),(b=(w=Z(this,pa).config).onError)==null||b.call(w,k,this),(T=(C=Z(this,pa).config).onSettled)==null||T.call(C,this.state.data,k,this),k}finally{this.scheduleGc()}}},Zl=new WeakMap,zu=new WeakMap,pa=new WeakMap,Jl=new WeakMap,Yn=new WeakMap,nd=new WeakMap,eo=new WeakMap,Wr=new WeakSet,LR=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Li=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,..._R(r.data,this.options),fetchMeta:t.meta??null};case"success":const a={...r,...D2(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return _e(this,zu,t.manual?a:void 0),a;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Bn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),Z(this,pa).notify({query:this,type:"updated",action:t})})},xR);function _R(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:jR(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function D2(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function j2(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Br,kt,rd,br,to,Iu,Pi,qs,ad,Fu,qu,no,ro,Us,Uu,Pt,Nf,q0,U0,V0,H0,G0,$0,Y0,BR,bR,vB=(bR=class extends Ju{constructor(t,n){super();We(this,Pt);We(this,Br);We(this,kt);We(this,rd);We(this,br);We(this,to);We(this,Iu);We(this,Pi);We(this,qs);We(this,ad);We(this,Fu);We(this,qu);We(this,no);We(this,ro);We(this,Us);We(this,Uu,new Set);this.options=n,_e(this,Br,t),_e(this,qs,null),_e(this,Pi,I0()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Z(this,kt).addObserver(this),M2(Z(this,kt),this.options)?pt(this,Pt,Nf).call(this):this.updateResult(),pt(this,Pt,H0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return K0(Z(this,kt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return K0(Z(this,kt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pt(this,Pt,G0).call(this),pt(this,Pt,$0).call(this),Z(this,kt).removeObserver(this)}setOptions(t){const n=this.options,r=Z(this,kt);if(this.options=Z(this,Br).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ma(this.options.enabled,Z(this,kt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pt(this,Pt,Y0).call(this),Z(this,kt).setOptions(this.options),n._defaulted&&!zv(this.options,n)&&Z(this,Br).getQueryCache().notify({type:"observerOptionsUpdated",query:Z(this,kt),observer:this});const a=this.hasListeners();a&&O2(Z(this,kt),r,this.options,n)&&pt(this,Pt,Nf).call(this),this.updateResult(),a&&(Z(this,kt)!==r||ma(this.options.enabled,Z(this,kt))!==ma(n.enabled,Z(this,kt))||Qs(this.options.staleTime,Z(this,kt))!==Qs(n.staleTime,Z(this,kt)))&&pt(this,Pt,q0).call(this);const i=pt(this,Pt,U0).call(this);a&&(Z(this,kt)!==r||ma(this.options.enabled,Z(this,kt))!==ma(n.enabled,Z(this,kt))||i!==Z(this,Us))&&pt(this,Pt,V0).call(this,i)}getOptimisticResult(t){const n=Z(this,Br).getQueryCache().build(Z(this,Br),t),r=this.createResult(n,t);return mB(this,r)&&(_e(this,br,r),_e(this,Iu,this.options),_e(this,to,Z(this,kt).state)),r}getCurrentResult(){return Z(this,br)}trackResult(t,n){return new Proxy(t,{get:(r,a)=>(this.trackProp(a),n==null||n(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&Z(this,Pi).status==="pending"&&Z(this,Pi).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,a))})}trackProp(t){Z(this,Uu).add(t)}getCurrentQuery(){return Z(this,kt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=Z(this,Br).defaultQueryOptions(t),r=Z(this,Br).getQueryCache().build(Z(this,Br),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pt(this,Pt,Nf).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),Z(this,br)))}createResult(t,n){var _;const r=Z(this,kt),a=this.options,i=Z(this,br),l=Z(this,to),o=Z(this,Iu),c=t!==r?t.state:Z(this,rd),{state:d}=t;let v={...d},m=!1,y;if(n._optimisticResults){const M=this.hasListeners(),z=!M&&M2(t,n),P=M&&O2(t,r,n,a);(z||P)&&(v={...v,..._R(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(v.fetchStatus="idle")}let{error:x,errorUpdatedAt:S,status:w}=v;y=v.data;let b=!1;if(n.placeholderData!==void 0&&y===void 0&&w==="pending"){let M;i!=null&&i.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(M=i.data,b=!0):M=typeof n.placeholderData=="function"?n.placeholderData((_=Z(this,qu))==null?void 0:_.state.data,Z(this,qu)):n.placeholderData,M!==void 0&&(w="success",y=z0(i==null?void 0:i.data,M,n),m=!0)}if(n.select&&y!==void 0&&!b)if(i&&y===(l==null?void 0:l.data)&&n.select===Z(this,ad))y=Z(this,Fu);else try{_e(this,ad,n.select),y=n.select(y),y=z0(i==null?void 0:i.data,y,n),_e(this,Fu,y),_e(this,qs,null)}catch(M){_e(this,qs,M)}Z(this,qs)&&(x=Z(this,qs),y=Z(this,Fu),S=Date.now(),w="error");const C=v.fetchStatus==="fetching",T=w==="pending",k=w==="error",D=T&&C,A=y!==void 0,L={status:w,fetchStatus:v.fetchStatus,isPending:T,isSuccess:w==="success",isError:k,isInitialLoading:D,isLoading:D,data:y,dataUpdatedAt:v.dataUpdatedAt,error:x,errorUpdatedAt:S,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:v.dataUpdateCount>c.dataUpdateCount||v.errorUpdateCount>c.errorUpdateCount,isFetching:C,isRefetching:C&&!T,isLoadingError:k&&!A,isPaused:v.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:k&&A,isStale:t1(t,n),refetch:this.refetch,promise:Z(this,Pi),isEnabled:ma(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const M=L.data!==void 0,z=L.status==="error"&&!M,P=F=>{z?F.reject(L.error):M&&F.resolve(L.data)},G=()=>{const F=_e(this,Pi,L.promise=I0());P(F)},I=Z(this,Pi);switch(I.status){case"pending":t.queryHash===r.queryHash&&P(I);break;case"fulfilled":(z||L.data!==I.value)&&G();break;case"rejected":(!z||L.error!==I.reason)&&G();break}}return L}updateResult(){const t=Z(this,br),n=this.createResult(Z(this,kt),this.options);if(_e(this,to,Z(this,kt).state),_e(this,Iu,this.options),Z(this,to).data!==void 0&&_e(this,qu,Z(this,kt)),zv(n,t))return;_e(this,br,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!Z(this,Uu).size)return!0;const l=new Set(i??Z(this,Uu));return this.options.throwOnError&&l.add("error"),Object.keys(Z(this,br)).some(o=>{const f=o;return Z(this,br)[f]!==t[f]&&l.has(f)})};pt(this,Pt,BR).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pt(this,Pt,H0).call(this)}},Br=new WeakMap,kt=new WeakMap,rd=new WeakMap,br=new WeakMap,to=new WeakMap,Iu=new WeakMap,Pi=new WeakMap,qs=new WeakMap,ad=new WeakMap,Fu=new WeakMap,qu=new WeakMap,no=new WeakMap,ro=new WeakMap,Us=new WeakMap,Uu=new WeakMap,Pt=new WeakSet,Nf=function(t){pt(this,Pt,Y0).call(this);let n=Z(this,kt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Sr)),n},q0=function(){pt(this,Pt,G0).call(this);const t=Qs(this.options.staleTime,Z(this,kt));if(If.isServer()||Z(this,br).isStale||!B0(t))return;const r=AR(Z(this,br).dataUpdatedAt,t)+1;_e(this,no,Kl.setTimeout(()=>{Z(this,br).isStale||this.updateResult()},r))},U0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Z(this,kt)):this.options.refetchInterval)??!1},V0=function(t){pt(this,Pt,$0).call(this),_e(this,Us,t),!(If.isServer()||ma(this.options.enabled,Z(this,kt))===!1||!B0(Z(this,Us))||Z(this,Us)===0)&&_e(this,ro,Kl.setInterval(()=>{(this.options.refetchIntervalInBackground||Wb.isFocused())&&pt(this,Pt,Nf).call(this)},Z(this,Us)))},H0=function(){pt(this,Pt,q0).call(this),pt(this,Pt,V0).call(this,pt(this,Pt,U0).call(this))},G0=function(){Z(this,no)&&(Kl.clearTimeout(Z(this,no)),_e(this,no,void 0))},$0=function(){Z(this,ro)&&(Kl.clearInterval(Z(this,ro)),_e(this,ro,void 0))},Y0=function(){const t=Z(this,Br).getQueryCache().build(Z(this,Br),this.options);if(t===Z(this,kt))return;const n=Z(this,kt);_e(this,kt,t),_e(this,rd,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},BR=function(t){Bn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(Z(this,br))}),Z(this,Br).getQueryCache().notify({query:Z(this,kt),type:"observerResultsUpdated"})})},bR);function pB(e,t){return ma(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function M2(e,t){return pB(e,t)||e.state.data!==void 0&&K0(e,t,t.refetchOnMount)}function K0(e,t,n){if(ma(t.enabled,e)!==!1&&Qs(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&t1(e,t)}return!1}function O2(e,t,n,r){return(e!==t||ma(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&t1(e,n)}function t1(e,t){return ma(t.enabled,e)!==!1&&e.isStaleByTime(Qs(t.staleTime,e))}function mB(e,t){return!zv(e.getCurrentResult(),t)}function L2(e){return{onFetch:(t,n)=>{var d,v,m,y,x;const r=t.options,a=(m=(v=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:v.fetchMore)==null?void 0:m.direction,i=((y=t.state.data)==null?void 0:y.pages)||[],l=((x=t.state.data)==null?void 0:x.pageParams)||[];let o={pages:[],pageParams:[]},f=0;const c=async()=>{let S=!1;const w=T=>{oB(T,()=>t.signal,()=>S=!0)},b=DR(t.options,t.fetchOptions),C=async(T,k,D)=>{if(S)return Promise.reject();if(k==null&&T.pages.length)return Promise.resolve(T);const j=(()=>{const z={client:t.client,queryKey:t.queryKey,pageParam:k,direction:D?"backward":"forward",meta:t.options.meta};return w(z),z})(),L=await b(j),{maxPages:_}=t.options,M=D?lB:sB;return{pages:M(T.pages,L,_),pageParams:M(T.pageParams,k,_)}};if(a&&i.length){const T=a==="backward",k=T?gB:_2,D={pages:i,pageParams:l},A=k(r,D);o=await C(D,A,T)}else{const T=e??i.length;do{const k=f===0?l[0]??r.initialPageParam:_2(r,o);if(f>0&&k==null)break;o=await C(o,k),f++}while(f<T)}return o};t.options.persister?t.fetchFn=()=>{var S,w;return(w=(S=t.options).persister)==null?void 0:w.call(S,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function _2(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function gB(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var id,Xa,dr,ao,Qa,_s,wR,yB=(wR=class extends OR{constructor(t){super();We(this,Qa);We(this,id);We(this,Xa);We(this,dr);We(this,ao);_e(this,id,t.client),this.mutationId=t.mutationId,_e(this,dr,t.mutationCache),_e(this,Xa,[]),this.state=t.state||PR(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){Z(this,Xa).includes(t)||(Z(this,Xa).push(t),this.clearGcTimeout(),Z(this,dr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){_e(this,Xa,Z(this,Xa).filter(n=>n!==t)),this.scheduleGc(),Z(this,dr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){Z(this,Xa).length||(this.state.status==="pending"?this.scheduleGc():Z(this,dr).remove(this))}continue(){var t;return((t=Z(this,ao))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,o,f,c,d,v,m,y,x,S,w,b,C,T,k,D,A,j;const n=()=>{pt(this,Qa,_s).call(this,{type:"continue"})},r={client:Z(this,id),meta:this.options.meta,mutationKey:this.options.mutationKey};_e(this,ao,MR({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(L,_)=>{pt(this,Qa,_s).call(this,{type:"failed",failureCount:L,error:_})},onPause:()=>{pt(this,Qa,_s).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Z(this,dr).canRun(this)}));const a=this.state.status==="pending",i=!Z(this,ao).canStart();try{if(a)n();else{pt(this,Qa,_s).call(this,{type:"pending",variables:t,isPaused:i}),Z(this,dr).config.onMutate&&await Z(this,dr).config.onMutate(t,this,r);const _=await((o=(l=this.options).onMutate)==null?void 0:o.call(l,t,r));_!==this.state.context&&pt(this,Qa,_s).call(this,{type:"pending",context:_,variables:t,isPaused:i})}const L=await Z(this,ao).start();return await((c=(f=Z(this,dr).config).onSuccess)==null?void 0:c.call(f,L,t,this.state.context,this,r)),await((v=(d=this.options).onSuccess)==null?void 0:v.call(d,L,t,this.state.context,r)),await((y=(m=Z(this,dr).config).onSettled)==null?void 0:y.call(m,L,null,this.state.variables,this.state.context,this,r)),await((S=(x=this.options).onSettled)==null?void 0:S.call(x,L,null,t,this.state.context,r)),pt(this,Qa,_s).call(this,{type:"success",data:L}),L}catch(L){try{await((b=(w=Z(this,dr).config).onError)==null?void 0:b.call(w,L,t,this.state.context,this,r))}catch(_){Promise.reject(_)}try{await((T=(C=this.options).onError)==null?void 0:T.call(C,L,t,this.state.context,r))}catch(_){Promise.reject(_)}try{await((D=(k=Z(this,dr).config).onSettled)==null?void 0:D.call(k,void 0,L,this.state.variables,this.state.context,this,r))}catch(_){Promise.reject(_)}try{await((j=(A=this.options).onSettled)==null?void 0:j.call(A,void 0,L,t,this.state.context,r))}catch(_){Promise.reject(_)}throw pt(this,Qa,_s).call(this,{type:"error",error:L}),L}finally{Z(this,dr).runNext(this)}}},id=new WeakMap,Xa=new WeakMap,dr=new WeakMap,ao=new WeakMap,Qa=new WeakSet,_s=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Bn.batch(()=>{Z(this,Xa).forEach(r=>{r.onMutationUpdate(t)}),Z(this,dr).notify({mutation:this,type:"updated",action:t})})},wR);function PR(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var zi,Aa,sd,SR,xB=(SR=class extends Ju{constructor(t={}){super();We(this,zi);We(this,Aa);We(this,sd);this.config=t,_e(this,zi,new Set),_e(this,Aa,new Map),_e(this,sd,0)}build(t,n,r){const a=new yB({client:t,mutationCache:this,mutationId:++Gh(this,sd)._,options:t.defaultMutationOptions(n),state:r});return this.add(a),a}add(t){Z(this,zi).add(t);const n=$h(t);if(typeof n=="string"){const r=Z(this,Aa).get(n);r?r.push(t):Z(this,Aa).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(Z(this,zi).delete(t)){const n=$h(t);if(typeof n=="string"){const r=Z(this,Aa).get(n);if(r)if(r.length>1){const a=r.indexOf(t);a!==-1&&r.splice(a,1)}else r[0]===t&&Z(this,Aa).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=$h(t);if(typeof n=="string"){const r=Z(this,Aa).get(n),a=r==null?void 0:r.find(i=>i.state.status==="pending");return!a||a===t}else return!0}runNext(t){var r;const n=$h(t);if(typeof n=="string"){const a=(r=Z(this,Aa).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Bn.batch(()=>{Z(this,zi).forEach(t=>{this.notify({type:"removed",mutation:t})}),Z(this,zi).clear(),Z(this,Aa).clear()})}getAll(){return Array.from(Z(this,zi))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>k2(n,r))}findAll(t={}){return this.getAll().filter(n=>k2(t,n))}notify(t){Bn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Bn.batch(()=>Promise.all(t.map(n=>n.continue().catch(Sr))))}},zi=new WeakMap,Aa=new WeakMap,sd=new WeakMap,SR);function $h(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ii,Vs,Pr,Fi,Vi,bv,X0,ER,bB=(ER=class extends Ju{constructor(n,r){super();We(this,Vi);We(this,Ii);We(this,Vs);We(this,Pr);We(this,Fi);_e(this,Ii,n),this.setOptions(r),this.bindMethods(),pt(this,Vi,bv).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var a;const r=this.options;this.options=Z(this,Ii).defaultMutationOptions(n),zv(this.options,r)||Z(this,Ii).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Z(this,Pr),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&oo(r.mutationKey)!==oo(this.options.mutationKey)?this.reset():((a=Z(this,Pr))==null?void 0:a.state.status)==="pending"&&Z(this,Pr).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=Z(this,Pr))==null||n.removeObserver(this)}onMutationUpdate(n){pt(this,Vi,bv).call(this),pt(this,Vi,X0).call(this,n)}getCurrentResult(){return Z(this,Vs)}reset(){var n;(n=Z(this,Pr))==null||n.removeObserver(this),_e(this,Pr,void 0),pt(this,Vi,bv).call(this),pt(this,Vi,X0).call(this)}mutate(n,r){var a;return _e(this,Fi,r),(a=Z(this,Pr))==null||a.removeObserver(this),_e(this,Pr,Z(this,Ii).getMutationCache().build(Z(this,Ii),this.options)),Z(this,Pr).addObserver(this),Z(this,Pr).execute(n)}},Ii=new WeakMap,Vs=new WeakMap,Pr=new WeakMap,Fi=new WeakMap,Vi=new WeakSet,bv=function(){var r;const n=((r=Z(this,Pr))==null?void 0:r.state)??PR();_e(this,Vs,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},X0=function(n){Bn.batch(()=>{var r,a,i,l,o,f,c,d;if(Z(this,Fi)&&this.hasListeners()){const v=Z(this,Vs).variables,m=Z(this,Vs).context,y={client:Z(this,Ii),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(a=(r=Z(this,Fi)).onSuccess)==null||a.call(r,n.data,v,m,y)}catch(x){Promise.reject(x)}try{(l=(i=Z(this,Fi)).onSettled)==null||l.call(i,n.data,null,v,m,y)}catch(x){Promise.reject(x)}}else if((n==null?void 0:n.type)==="error"){try{(f=(o=Z(this,Fi)).onError)==null||f.call(o,n.error,v,m,y)}catch(x){Promise.reject(x)}try{(d=(c=Z(this,Fi)).onSettled)==null||d.call(c,void 0,n.error,v,m,y)}catch(x){Promise.reject(x)}}}this.listeners.forEach(v=>{v(Z(this,Vs))})})},ER),Wa,CR,wB=(CR=class extends Ju{constructor(t={}){super();We(this,Wa);this.config=t,_e(this,Wa,new Map)}build(t,n,r){const a=n.queryKey,i=n.queryHash??Zb(a,n);let l=this.get(i);return l||(l=new hB({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(a)}),this.add(l)),l}add(t){Z(this,Wa).has(t.queryHash)||(Z(this,Wa).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=Z(this,Wa).get(t.queryHash);n&&(t.destroy(),n===t&&Z(this,Wa).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Bn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return Z(this,Wa).get(t)}getAll(){return[...Z(this,Wa).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>N2(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>N2(t,r)):n}notify(t){Bn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Bn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Bn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Wa=new WeakMap,CR),pn,Hs,Gs,Vu,Hu,$s,Gu,$u,TR,SB=(TR=class{constructor(e={}){We(this,pn);We(this,Hs);We(this,Gs);We(this,Vu);We(this,Hu);We(this,$s);We(this,Gu);We(this,$u);_e(this,pn,e.queryCache||new wB),_e(this,Hs,e.mutationCache||new xB),_e(this,Gs,e.defaultOptions||{}),_e(this,Vu,new Map),_e(this,Hu,new Map),_e(this,$s,0)}mount(){Gh(this,$s)._++,Z(this,$s)===1&&(_e(this,Gu,Wb.subscribe(async e=>{e&&(await this.resumePausedMutations(),Z(this,pn).onFocus())})),_e(this,$u,Iv.subscribe(async e=>{e&&(await this.resumePausedMutations(),Z(this,pn).onOnline())})))}unmount(){var e,t;Gh(this,$s)._--,Z(this,$s)===0&&((e=Z(this,Gu))==null||e.call(this),_e(this,Gu,void 0),(t=Z(this,$u))==null||t.call(this),_e(this,$u,void 0))}isFetching(e){return Z(this,pn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return Z(this,Hs).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Z(this,pn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=Z(this,pn).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Qs(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return Z(this,pn).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),a=Z(this,pn).get(r.queryHash),i=a==null?void 0:a.state.data,l=rB(t,i);if(l!==void 0)return Z(this,pn).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return Bn.batch(()=>Z(this,pn).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Z(this,pn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=Z(this,pn);Bn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=Z(this,pn);return Bn.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Bn.batch(()=>Z(this,pn).findAll(e).map(a=>a.cancel(n)));return Promise.all(r).then(Sr).catch(Sr)}invalidateQueries(e,t={}){return Bn.batch(()=>(Z(this,pn).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Bn.batch(()=>Z(this,pn).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,n);return n.throwOnError||(i=i.catch(Sr)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Sr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=Z(this,pn).build(this,t);return n.isStaleByTime(Qs(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Sr).catch(Sr)}fetchInfiniteQuery(e){return e.behavior=L2(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Sr).catch(Sr)}ensureInfiniteQueryData(e){return e.behavior=L2(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Iv.isOnline()?Z(this,Hs).resumePausedMutations():Promise.resolve()}getQueryCache(){return Z(this,pn)}getMutationCache(){return Z(this,Hs)}getDefaultOptions(){return Z(this,Gs)}setDefaultOptions(e){_e(this,Gs,e)}setQueryDefaults(e,t){Z(this,Vu).set(oo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...Z(this,Vu).values()],n={};return t.forEach(r=>{zf(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){Z(this,Hu).set(oo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...Z(this,Hu).values()],n={};return t.forEach(r=>{zf(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...Z(this,Gs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Zb(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Jb&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...Z(this,Gs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){Z(this,pn).clear(),Z(this,Hs).clear()}},pn=new WeakMap,Hs=new WeakMap,Gs=new WeakMap,Vu=new WeakMap,Hu=new WeakMap,$s=new WeakMap,Gu=new WeakMap,$u=new WeakMap,TR),zR=R.createContext(void 0),oi=e=>{const t=R.useContext(zR);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},EB=({client:e,children:t})=>(R.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(zR.Provider,{value:e,children:t})),IR=R.createContext(!1),CB=()=>R.useContext(IR);IR.Provider;function TB(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var NB=R.createContext(TB()),kB=()=>R.useContext(NB),AB=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?e1(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},RB=e=>{R.useEffect(()=>{e.clearReset()},[e])},DB=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||e1(n,[e.error,r])),jB=e=>{if(e.suspense){const n=a=>a==="static"?a:Math.max(a??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...a)=>n(r(...a)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},MB=(e,t)=>e.isLoading&&e.isFetching&&!t,OB=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,B2=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function LB(e,t,n){var m,y,x,S;const r=CB(),a=kB(),i=oi(),l=i.defaultQueryOptions(e);(y=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||y.call(m,l);const o=i.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",jB(l),AB(l,a,o),RB(a);const f=!i.getQueryCache().get(l.queryHash),[c]=R.useState(()=>new t(i,l)),d=c.getOptimisticResult(l),v=!r&&e.subscribed!==!1;if(R.useSyncExternalStore(R.useCallback(w=>{const b=v?c.subscribe(Bn.batchCalls(w)):Sr;return c.updateResult(),b},[c,v]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),R.useEffect(()=>{c.setOptions(l)},[l,c]),OB(l,d))throw B2(l,c,a);if(DB({result:d,errorResetBoundary:a,throwOnError:l.throwOnError,query:o,suspense:l.suspense}))throw d.error;if((S=(x=i.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||S.call(x,l,d),l.experimental_prefetchInRender&&!If.isServer()&&MB(d,r)){const w=f?B2(l,c,a):o==null?void 0:o.promise;w==null||w.catch(Sr).finally(()=>{c.updateResult()})}return l.notifyOnChangeProps?d:c.trackResult(d)}function mn(e,t){return LB(e,vB)}function hl(e,t){const n=oi(),[r]=R.useState(()=>new bB(n,e));R.useEffect(()=>{r.setOptions(e)},[r,e]);const a=R.useSyncExternalStore(R.useCallback(l=>r.subscribe(Bn.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=R.useCallback((l,o)=>{r.mutate(l,o).catch(Sr)},[r]);if(a.error&&e1(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:i,mutateAsync:a.mutate}}/**
50
+ * react-router v7.13.1
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var P2="popstate";function z2(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function _B(e={}){function t(r,a){var c;let i=(c=a.state)==null?void 0:c.masked,{pathname:l,search:o,hash:f}=i||r.location;return Q0("",{pathname:l,search:o,hash:f},a.state&&a.state.usr||null,a.state&&a.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,a){return typeof a=="string"?a:Ff(a)}return PB(t,n,null,e)}function cn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ai(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function BB(){return Math.random().toString(36).substring(2,10)}function I2(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Q0(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ec(t):t,state:n,key:t&&t.key||r||BB(),unstable_mask:a}}function Ff({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function ec(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function PB(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:i=!1}=r,l=a.history,o="POP",f=null,c=d();c==null&&(c=0,l.replaceState({...l.state,idx:c},""));function d(){return(l.state||{idx:null}).idx}function v(){o="POP";let w=d(),b=w==null?null:w-c;c=w,f&&f({action:o,location:S.location,delta:b})}function m(w,b){o="PUSH";let C=z2(w)?w:Q0(S.location,w,b);c=d()+1;let T=I2(C,c),k=S.createHref(C.unstable_mask||C);try{l.pushState(T,"",k)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;a.location.assign(k)}i&&f&&f({action:o,location:S.location,delta:1})}function y(w,b){o="REPLACE";let C=z2(w)?w:Q0(S.location,w,b);c=d();let T=I2(C,c),k=S.createHref(C.unstable_mask||C);l.replaceState(T,"",k),i&&f&&f({action:o,location:S.location,delta:0})}function x(w){return zB(w)}let S={get action(){return o},get location(){return e(a,l)},listen(w){if(f)throw new Error("A history only accepts one active listener");return a.addEventListener(P2,v),f=w,()=>{a.removeEventListener(P2,v),f=null}},createHref(w){return t(a,w)},createURL:x,encodeLocation(w){let b=x(w);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:m,replace:y,go(w){return l.go(w)}};return S}function zB(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),cn(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Ff(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function FR(e,t,n="/"){return IB(e,t,n,!1)}function IB(e,t,n,r){let a=typeof t=="string"?ec(t):t,i=Hi(a.pathname||"/",n);if(i==null)return null;let l=qR(e);FB(l);let o=null;for(let f=0;o==null&&f<l.length;++f){let c=WB(i);o=XB(l[f],c,r)}return o}function qR(e,t=[],n=[],r="",a=!1){let i=(l,o,f=a,c)=>{let d={relativePath:c===void 0?l.path||"":c,caseSensitive:l.caseSensitive===!0,childrenIndex:o,route:l};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&f)return;cn(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let v=ni([r,d.relativePath]),m=n.concat(d);l.children&&l.children.length>0&&(cn(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),qR(l.children,t,m,v,f)),!(l.path==null&&!l.index)&&t.push({path:v,score:YB(v,l.index),routesMeta:m})};return e.forEach((l,o)=>{var f;if(l.path===""||!((f=l.path)!=null&&f.includes("?")))i(l,o);else for(let c of UR(l.path))i(l,o,!0,c)}),t}function UR(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let l=UR(r.join("/")),o=[];return o.push(...l.map(f=>f===""?i:[i,f].join("/"))),a&&o.push(...l),o.map(f=>e.startsWith("/")&&f===""?"/":f)}function FB(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:KB(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var qB=/^:[\w-]+$/,UB=3,VB=2,HB=1,GB=10,$B=-2,F2=e=>e==="*";function YB(e,t){let n=e.split("/"),r=n.length;return n.some(F2)&&(r+=$B),t&&(r+=VB),n.filter(a=>!F2(a)).reduce((a,i)=>a+(qB.test(i)?UB:i===""?HB:GB),r)}function KB(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function XB(e,t,n=!1){let{routesMeta:r}=e,a={},i="/",l=[];for(let o=0;o<r.length;++o){let f=r[o],c=o===r.length-1,d=i==="/"?t:t.slice(i.length)||"/",v=Fv({path:f.relativePath,caseSensitive:f.caseSensitive,end:c},d),m=f.route;if(!v&&c&&n&&!r[r.length-1].route.index&&(v=Fv({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},d)),!v)return null;Object.assign(a,v.params),l.push({params:a,pathname:ni([i,v.pathname]),pathnameBase:t4(ni([i,v.pathnameBase])),route:m}),v.pathnameBase!=="/"&&(i=ni([i,v.pathnameBase]))}return l}function Fv(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=QB(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let i=a[0],l=i.replace(/(.)\/+$/,"$1"),o=a.slice(1);return{params:r.reduce((c,{paramName:d,isOptional:v},m)=>{if(d==="*"){let x=o[m]||"";l=i.slice(0,i.length-x.length).replace(/(.)\/+$/,"$1")}const y=o[m];return v&&!y?c[d]=void 0:c[d]=(y||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:l,pattern:e}}function QB(e,t=!1,n=!0){ai(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,o,f,c,d)=>{if(r.push({paramName:o,isOptional:f!=null}),f){let v=d.charAt(c+l.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function WB(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ai(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Hi(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var ZB=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function JB(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?ec(e):e,i;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?i=q2(n.substring(1),"/"):i=q2(n,t)):i=t,{pathname:i,search:n4(r),hash:r4(a)}}function q2(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function wy(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function e4(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function VR(e){let t=e4(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function n1(e,t,n,r=!1){let a;typeof e=="string"?a=ec(e):(a={...e},cn(!a.pathname||!a.pathname.includes("?"),wy("?","pathname","search",a)),cn(!a.pathname||!a.pathname.includes("#"),wy("#","pathname","hash",a)),cn(!a.search||!a.search.includes("#"),wy("#","search","hash",a)));let i=e===""||a.pathname==="",l=i?"/":a.pathname,o;if(l==null)o=n;else{let v=t.length-1;if(!r&&l.startsWith("..")){let m=l.split("/");for(;m[0]==="..";)m.shift(),v-=1;a.pathname=m.join("/")}o=v>=0?t[v]:"/"}let f=JB(a,o),c=l&&l!=="/"&&l.endsWith("/"),d=(i||l===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(c||d)&&(f.pathname+="/"),f}var ni=e=>e.join("/").replace(/\/\/+/g,"/"),t4=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),n4=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,r4=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,a4=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function i4(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function s4(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var HR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function GR(e,t){let n=e;if(typeof n!="string"||!ZB.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(HR)try{let i=new URL(window.location.href),l=n.startsWith("//")?new URL(i.protocol+n):new URL(n),o=Hi(l.pathname,t);l.origin===i.origin&&o!=null?n=o+l.search+l.hash:a=!0}catch{ai(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var $R=["POST","PUT","PATCH","DELETE"];new Set($R);var l4=["GET",...$R];new Set(l4);var tc=R.createContext(null);tc.displayName="DataRouter";var vp=R.createContext(null);vp.displayName="DataRouterState";var o4=R.createContext(!1),YR=R.createContext({isTransitioning:!1});YR.displayName="ViewTransition";var u4=R.createContext(new Map);u4.displayName="Fetchers";var c4=R.createContext(null);c4.displayName="Await";var Sa=R.createContext(null);Sa.displayName="Navigation";var od=R.createContext(null);od.displayName="Location";var Ba=R.createContext({outlet:null,matches:[],isDataRoute:!1});Ba.displayName="Route";var r1=R.createContext(null);r1.displayName="RouteError";var KR="REACT_ROUTER_ERROR",f4="REDIRECT",d4="ROUTE_ERROR_RESPONSE";function h4(e){if(e.startsWith(`${KR}:${f4}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function v4(e){if(e.startsWith(`${KR}:${d4}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new a4(t.status,t.statusText,t.data)}catch{}}function p4(e,{relative:t}={}){cn(ud(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=R.useContext(Sa),{hash:a,pathname:i,search:l}=cd(e,{relative:t}),o=i;return n!=="/"&&(o=i==="/"?n:ni([n,i])),r.createHref({pathname:o,search:l,hash:a})}function ud(){return R.useContext(od)!=null}function Xi(){return cn(ud(),"useLocation() may be used only in the context of a <Router> component."),R.useContext(od).location}var XR="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function QR(e){R.useContext(Sa).static||R.useLayoutEffect(e)}function vl(){let{isDataRoute:e}=R.useContext(Ba);return e?j4():m4()}function m4(){cn(ud(),"useNavigate() may be used only in the context of a <Router> component.");let e=R.useContext(tc),{basename:t,navigator:n}=R.useContext(Sa),{matches:r}=R.useContext(Ba),{pathname:a}=Xi(),i=JSON.stringify(VR(r)),l=R.useRef(!1);return QR(()=>{l.current=!0}),R.useCallback((f,c={})=>{if(ai(l.current,XR),!l.current)return;if(typeof f=="number"){n.go(f);return}let d=n1(f,JSON.parse(i),a,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:ni([t,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[t,n,i,a,e])}var g4=R.createContext(null);function y4(e){let t=R.useContext(Ba).outlet;return R.useMemo(()=>t&&R.createElement(g4.Provider,{value:e},t),[t,e])}function x4(){let{matches:e}=R.useContext(Ba),t=e[e.length-1];return t?t.params:{}}function cd(e,{relative:t}={}){let{matches:n}=R.useContext(Ba),{pathname:r}=Xi(),a=JSON.stringify(VR(n));return R.useMemo(()=>n1(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function b4(e,t){return WR(e,t)}function WR(e,t,n){var w;cn(ud(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=R.useContext(Sa),{matches:a}=R.useContext(Ba),i=a[a.length-1],l=i?i.params:{},o=i?i.pathname:"/",f=i?i.pathnameBase:"/",c=i&&i.route;{let b=c&&c.path||"";JR(o,!c||b.endsWith("*")||b.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${o}" (under <Route path="${b}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
+
60
+ Please change the parent <Route path="${b}"> to <Route path="${b==="/"?"*":`${b}/*`}">.`)}let d=Xi(),v;if(t){let b=typeof t=="string"?ec(t):t;cn(f==="/"||((w=b.pathname)==null?void 0:w.startsWith(f)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${b.pathname}" was given in the \`location\` prop.`),v=b}else v=d;let m=v.pathname||"/",y=m;if(f!=="/"){let b=f.replace(/^\//,"").split("/");y="/"+m.replace(/^\//,"").split("/").slice(b.length).join("/")}let x=FR(e,{pathname:y});ai(c||x!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),ai(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let S=T4(x&&x.map(b=>Object.assign({},b,{params:Object.assign({},l,b.params),pathname:ni([f,r.encodeLocation?r.encodeLocation(b.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?f:ni([f,r.encodeLocation?r.encodeLocation(b.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathnameBase])})),a,n);return t&&S?R.createElement(od.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...v},navigationType:"POP"}},S):S}function w4(){let e=D4(),t=i4(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=R.createElement(R.Fragment,null,R.createElement("p",null,"💿 Hey developer 👋"),R.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",R.createElement("code",{style:i},"ErrorBoundary")," or"," ",R.createElement("code",{style:i},"errorElement")," prop on your route.")),R.createElement(R.Fragment,null,R.createElement("h2",null,"Unexpected Application Error!"),R.createElement("h3",{style:{fontStyle:"italic"}},t),n?R.createElement("pre",{style:a},n):null,l)}var S4=R.createElement(w4,null),ZR=class extends R.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=v4(e.digest);n&&(e=n)}let t=e!==void 0?R.createElement(Ba.Provider,{value:this.props.routeContext},R.createElement(r1.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?R.createElement(E4,{error:e},t):t}};ZR.contextType=o4;var Sy=new WeakMap;function E4({children:e,error:t}){let{basename:n}=R.useContext(Sa);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=h4(t.digest);if(r){let a=Sy.get(t);if(a)throw a;let i=GR(r.location,n);if(HR&&!Sy.get(t))if(i.isExternal||r.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw Sy.set(t,l),l}return R.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function C4({routeContext:e,match:t,children:n}){let r=R.useContext(tc);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),R.createElement(Ba.Provider,{value:e},n)}function T4(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,i=r==null?void 0:r.errors;if(i!=null){let d=a.findIndex(v=>v.route.id&&(i==null?void 0:i[v.route.id])!==void 0);cn(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,d+1))}let l=!1,o=-1;if(n&&r){l=r.renderFallback;for(let d=0;d<a.length;d++){let v=a[d];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(o=d),v.route.id){let{loaderData:m,errors:y}=r,x=v.route.loader&&!m.hasOwnProperty(v.route.id)&&(!y||y[v.route.id]===void 0);if(v.route.lazy||x){n.isStatic&&(l=!0),o>=0?a=a.slice(0,o+1):a=[a[0]];break}}}}let f=n==null?void 0:n.onError,c=r&&f?(d,v)=>{var m,y;f(d,{location:r.location,params:((y=(m=r.matches)==null?void 0:m[0])==null?void 0:y.params)??{},unstable_pattern:s4(r.matches),errorInfo:v})}:void 0;return a.reduceRight((d,v,m)=>{let y,x=!1,S=null,w=null;r&&(y=i&&v.route.id?i[v.route.id]:void 0,S=v.route.errorElement||S4,l&&(o<0&&m===0?(JR("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,w=null):o===m&&(x=!0,w=v.route.hydrateFallbackElement||null)));let b=t.concat(a.slice(0,m+1)),C=()=>{let T;return y?T=S:x?T=w:v.route.Component?T=R.createElement(v.route.Component,null):v.route.element?T=v.route.element:T=d,R.createElement(C4,{match:v,routeContext:{outlet:d,matches:b,isDataRoute:r!=null},children:T})};return r&&(v.route.ErrorBoundary||v.route.errorElement||m===0)?R.createElement(ZR,{location:r.location,revalidation:r.revalidation,component:S,error:y,children:C(),routeContext:{outlet:null,matches:b,isDataRoute:!0},onError:c}):C()},null)}function a1(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function N4(e){let t=R.useContext(tc);return cn(t,a1(e)),t}function k4(e){let t=R.useContext(vp);return cn(t,a1(e)),t}function A4(e){let t=R.useContext(Ba);return cn(t,a1(e)),t}function i1(e){let t=A4(e),n=t.matches[t.matches.length-1];return cn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function R4(){return i1("useRouteId")}function D4(){var r;let e=R.useContext(r1),t=k4("useRouteError"),n=i1("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function j4(){let{router:e}=N4("useNavigate"),t=i1("useNavigate"),n=R.useRef(!1);return QR(()=>{n.current=!0}),R.useCallback(async(a,i={})=>{ai(n.current,XR),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...i}))},[e,t])}var U2={};function JR(e,t,n){!t&&!U2[e]&&(U2[e]=!0,ai(!1,n))}R.memo(M4);function M4({routes:e,future:t,state:n,isStatic:r,onError:a}){return WR(e,void 0,{state:n,isStatic:r,onError:a})}function O4(e){return y4(e.context)}function $a(e){cn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function L4({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:i=!1,unstable_useTransitions:l}){cn(!ud(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=e.replace(/^\/*/,"/"),f=R.useMemo(()=>({basename:o,navigator:a,static:i,unstable_useTransitions:l,future:{}}),[o,a,i,l]);typeof n=="string"&&(n=ec(n));let{pathname:c="/",search:d="",hash:v="",state:m=null,key:y="default",unstable_mask:x}=n,S=R.useMemo(()=>{let w=Hi(c,o);return w==null?null:{location:{pathname:w,search:d,hash:v,state:m,key:y,unstable_mask:x},navigationType:r}},[o,c,d,v,m,y,r,x]);return ai(S!=null,`<Router basename="${o}"> is not able to match the URL "${c}${d}${v}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:R.createElement(Sa.Provider,{value:f},R.createElement(od.Provider,{children:t,value:S}))}function _4({children:e,location:t}){return b4(W0(e),t)}function W0(e,t=[]){let n=[];return R.Children.forEach(e,(r,a)=>{if(!R.isValidElement(r))return;let i=[...t,a];if(r.type===R.Fragment){n.push.apply(n,W0(r.props.children,i));return}cn(r.type===$a,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),cn(!r.props.index||!r.props.children,"An index route cannot have child routes.");let l={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=W0(r.props.children,i)),n.push(l)}),n}var wv="get",Sv="application/x-www-form-urlencoded";function pp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function B4(e){return pp(e)&&e.tagName.toLowerCase()==="button"}function P4(e){return pp(e)&&e.tagName.toLowerCase()==="form"}function z4(e){return pp(e)&&e.tagName.toLowerCase()==="input"}function I4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function F4(e,t){return e.button===0&&(!t||t==="_self")&&!I4(e)}var Yh=null;function q4(){if(Yh===null)try{new FormData(document.createElement("form"),0),Yh=!1}catch{Yh=!0}return Yh}var U4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ey(e){return e!=null&&!U4.has(e)?(ai(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Sv}"`),null):e}function V4(e,t){let n,r,a,i,l;if(P4(e)){let o=e.getAttribute("action");r=o?Hi(o,t):null,n=e.getAttribute("method")||wv,a=Ey(e.getAttribute("enctype"))||Sv,i=new FormData(e)}else if(B4(e)||z4(e)&&(e.type==="submit"||e.type==="image")){let o=e.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||o.getAttribute("action");if(r=f?Hi(f,t):null,n=e.getAttribute("formmethod")||o.getAttribute("method")||wv,a=Ey(e.getAttribute("formenctype"))||Ey(o.getAttribute("enctype"))||Sv,i=new FormData(o,e),!q4()){let{name:c,type:d,value:v}=e;if(d==="image"){let m=c?`${c}.`:"";i.append(`${m}x`,"0"),i.append(`${m}y`,"0")}else c&&i.append(c,v)}}else{if(pp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=wv,r=null,a=Sv,l=e}return i&&a==="text/plain"&&(l=i,i=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:i,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function s1(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function H4(e,t,n,r){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${r}`:a.pathname=`${a.pathname}.${r}`:a.pathname==="/"?a.pathname=`_root.${r}`:t&&Hi(a.pathname,t)==="/"?a.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${r}`,a}async function G4(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function $4(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Y4(e,t,n){let r=await Promise.all(e.map(async a=>{let i=t.routes[a.route.id];if(i){let l=await G4(i,n);return l.links?l.links():[]}return[]}));return W4(r.flat(1).filter($4).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function V2(e,t,n,r,a,i){let l=(f,c)=>n[c]?f.route.id!==n[c].route.id:!0,o=(f,c)=>{var d;return n[c].pathname!==f.pathname||((d=n[c].route.path)==null?void 0:d.endsWith("*"))&&n[c].params["*"]!==f.params["*"]};return i==="assets"?t.filter((f,c)=>l(f,c)||o(f,c)):i==="data"?t.filter((f,c)=>{var v;let d=r.routes[f.route.id];if(!d||!d.hasLoader)return!1;if(l(f,c)||o(f,c))return!0;if(f.route.shouldRevalidate){let m=f.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((v=n[0])==null?void 0:v.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function K4(e,t,{includeHydrateFallback:n}={}){return X4(e.map(r=>{let a=t.routes[r.route.id];if(!a)return[];let i=[a.module];return a.clientActionModule&&(i=i.concat(a.clientActionModule)),a.clientLoaderModule&&(i=i.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(i=i.concat(a.hydrateFallbackModule)),a.imports&&(i=i.concat(a.imports)),i}).flat(1))}function X4(e){return[...new Set(e)]}function Q4(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function W4(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let i=JSON.stringify(Q4(a));return n.has(i)||(n.add(i),r.push({key:i,link:a})),r},[])}function eD(){let e=R.useContext(tc);return s1(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Z4(){let e=R.useContext(vp);return s1(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var l1=R.createContext(void 0);l1.displayName="FrameworkContext";function tD(){let e=R.useContext(l1);return s1(e,"You must render this element inside a <HydratedRouter> element"),e}function J4(e,t){let n=R.useContext(l1),[r,a]=R.useState(!1),[i,l]=R.useState(!1),{onFocus:o,onBlur:f,onMouseEnter:c,onMouseLeave:d,onTouchStart:v}=t,m=R.useRef(null);R.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let S=b=>{b.forEach(C=>{l(C.isIntersecting)})},w=new IntersectionObserver(S,{threshold:.5});return m.current&&w.observe(m.current),()=>{w.disconnect()}}},[e]),R.useEffect(()=>{if(r){let S=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(S)}}},[r]);let y=()=>{a(!0)},x=()=>{a(!1),l(!1)};return n?e!=="intent"?[i,m,{}]:[i,m,{onFocus:uf(o,y),onBlur:uf(f,x),onMouseEnter:uf(c,y),onMouseLeave:uf(d,x),onTouchStart:uf(v,y)}]:[!1,m,{}]}function uf(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function eP({page:e,...t}){let{router:n}=eD(),r=R.useMemo(()=>FR(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?R.createElement(nP,{page:e,matches:r,...t}):null}function tP(e){let{manifest:t,routeModules:n}=tD(),[r,a]=R.useState([]);return R.useEffect(()=>{let i=!1;return Y4(e,t,n).then(l=>{i||a(l)}),()=>{i=!0}},[e,t,n]),r}function nP({page:e,matches:t,...n}){let r=Xi(),{future:a,manifest:i,routeModules:l}=tD(),{basename:o}=eD(),{loaderData:f,matches:c}=Z4(),d=R.useMemo(()=>V2(e,t,c,i,r,"data"),[e,t,c,i,r]),v=R.useMemo(()=>V2(e,t,c,i,r,"assets"),[e,t,c,i,r]),m=R.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let S=new Set,w=!1;if(t.forEach(C=>{var k;let T=i.routes[C.route.id];!T||!T.hasLoader||(!d.some(D=>D.route.id===C.route.id)&&C.route.id in f&&((k=l[C.route.id])!=null&&k.shouldRevalidate)||T.hasClientLoader?w=!0:S.add(C.route.id))}),S.size===0)return[];let b=H4(e,o,a.unstable_trailingSlashAwareDataRequests,"data");return w&&S.size>0&&b.searchParams.set("_routes",t.filter(C=>S.has(C.route.id)).map(C=>C.route.id).join(",")),[b.pathname+b.search]},[o,a.unstable_trailingSlashAwareDataRequests,f,r,i,d,t,e,l]),y=R.useMemo(()=>K4(v,i),[v,i]),x=tP(v);return R.createElement(R.Fragment,null,m.map(S=>R.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...n})),y.map(S=>R.createElement("link",{key:S,rel:"modulepreload",href:S,...n})),x.map(({key:S,link:w})=>R.createElement("link",{key:S,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function rP(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var aP=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{aP&&(window.__reactRouterVersion="7.13.1")}catch{}function iP({basename:e,children:t,unstable_useTransitions:n,window:r}){let a=R.useRef();a.current==null&&(a.current=_B({window:r,v5Compat:!0}));let i=a.current,[l,o]=R.useState({action:i.action,location:i.location}),f=R.useCallback(c=>{n===!1?o(c):R.startTransition(()=>o(c))},[n]);return R.useLayoutEffect(()=>i.listen(f),[i,f]),R.createElement(L4,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:i,unstable_useTransitions:n})}var nD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mp=R.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:i,replace:l,unstable_mask:o,state:f,target:c,to:d,preventScrollReset:v,viewTransition:m,unstable_defaultShouldRevalidate:y,...x},S){let{basename:w,navigator:b,unstable_useTransitions:C}=R.useContext(Sa),T=typeof d=="string"&&nD.test(d),k=GR(d,w);d=k.to;let D=p4(d,{relative:a}),A=Xi(),j=null;if(o){let F=n1(o,[],A.unstable_mask?A.unstable_mask.pathname:"/",!0);w!=="/"&&(F.pathname=F.pathname==="/"?w:ni([w,F.pathname])),j=b.createHref(F)}let[L,_,M]=J4(r,x),z=oP(d,{replace:l,unstable_mask:o,state:f,target:c,preventScrollReset:v,relative:a,viewTransition:m,unstable_defaultShouldRevalidate:y,unstable_useTransitions:C});function P(F){t&&t(F),F.defaultPrevented||z(F)}let G=!(k.isExternal||i),I=R.createElement("a",{...x,...M,href:(G?j:void 0)||k.absoluteURL||D,onClick:G?P:t,ref:rP(S,_),target:c,"data-discover":!T&&n==="render"?"true":void 0});return L&&!T?R.createElement(R.Fragment,null,I,R.createElement(eP,{page:D})):I});mp.displayName="Link";var rD=R.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:i,to:l,viewTransition:o,children:f,...c},d){let v=cd(l,{relative:c.relative}),m=Xi(),y=R.useContext(vp),{navigator:x,basename:S}=R.useContext(Sa),w=y!=null&&hP(v)&&o===!0,b=x.encodeLocation?x.encodeLocation(v).pathname:v.pathname,C=m.pathname,T=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(C=C.toLowerCase(),T=T?T.toLowerCase():null,b=b.toLowerCase()),T&&S&&(T=Hi(T,S)||T);const k=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let D=C===b||!a&&C.startsWith(b)&&C.charAt(k)==="/",A=T!=null&&(T===b||!a&&T.startsWith(b)&&T.charAt(b.length)==="/"),j={isActive:D,isPending:A,isTransitioning:w},L=D?t:void 0,_;typeof r=="function"?_=r(j):_=[r,D?"active":null,A?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let M=typeof i=="function"?i(j):i;return R.createElement(mp,{...c,"aria-current":L,className:_,ref:d,style:M,to:l,viewTransition:o},typeof f=="function"?f(j):f)});rD.displayName="NavLink";var sP=R.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:i,method:l=wv,action:o,onSubmit:f,relative:c,preventScrollReset:d,viewTransition:v,unstable_defaultShouldRevalidate:m,...y},x)=>{let{unstable_useTransitions:S}=R.useContext(Sa),w=fP(),b=dP(o,{relative:c}),C=l.toLowerCase()==="get"?"get":"post",T=typeof o=="string"&&nD.test(o),k=D=>{if(f&&f(D),D.defaultPrevented)return;D.preventDefault();let A=D.nativeEvent.submitter,j=(A==null?void 0:A.getAttribute("formmethod"))||l,L=()=>w(A||D.currentTarget,{fetcherKey:t,method:j,navigate:n,replace:a,state:i,relative:c,preventScrollReset:d,viewTransition:v,unstable_defaultShouldRevalidate:m});S&&n!==!1?R.startTransition(()=>L()):L()};return R.createElement("form",{ref:x,method:C,action:b,onSubmit:r?f:k,...y,"data-discover":!T&&e==="render"?"true":void 0})});sP.displayName="Form";function lP(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function aD(e){let t=R.useContext(tc);return cn(t,lP(e)),t}function oP(e,{target:t,replace:n,unstable_mask:r,state:a,preventScrollReset:i,relative:l,viewTransition:o,unstable_defaultShouldRevalidate:f,unstable_useTransitions:c}={}){let d=vl(),v=Xi(),m=cd(e,{relative:l});return R.useCallback(y=>{if(F4(y,t)){y.preventDefault();let x=n!==void 0?n:Ff(v)===Ff(m),S=()=>d(e,{replace:x,unstable_mask:r,state:a,preventScrollReset:i,relative:l,viewTransition:o,unstable_defaultShouldRevalidate:f});c?R.startTransition(()=>S()):S()}},[v,d,m,n,r,a,t,e,i,l,o,f,c])}var uP=0,cP=()=>`__${String(++uP)}__`;function fP(){let{router:e}=aD("useSubmit"),{basename:t}=R.useContext(Sa),n=R4(),r=e.fetch,a=e.navigate;return R.useCallback(async(i,l={})=>{let{action:o,method:f,encType:c,formData:d,body:v}=V4(i,t);if(l.navigate===!1){let m=l.fetcherKey||cP();await r(m,n,l.action||o,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:d,body:v,formMethod:l.method||f,formEncType:l.encType||c,flushSync:l.flushSync})}else await a(l.action||o,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:d,body:v,formMethod:l.method||f,formEncType:l.encType||c,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[r,a,t,n])}function dP(e,{relative:t}={}){let{basename:n}=R.useContext(Sa),r=R.useContext(Ba);cn(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),i={...cd(e||".",{relative:t})},l=Xi();if(e==null){i.search=l.search;let o=new URLSearchParams(i.search),f=o.getAll("index");if(f.some(d=>d==="")){o.delete("index"),f.filter(v=>v).forEach(v=>o.append("index",v));let d=o.toString();i.search=d?`?${d}`:""}}return(!e||e===".")&&a.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:ni([n,i.pathname])),Ff(i)}function hP(e,{relative:t}={}){let n=R.useContext(YR);cn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=aD("useViewTransitionState"),a=cd(e,{relative:t});if(!n.isTransitioning)return!1;let i=Hi(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=Hi(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Fv(a.pathname,l)!=null||Fv(a.pathname,i)!=null}var fd=kR();const vP=ld(fd),iD="myco-ui-theme",pP="system",H2="light",sD="(prefers-color-scheme: dark)",lD=R.createContext(void 0);function mP(){const e=localStorage.getItem(iD);return e==="light"||e==="dark"||e==="system"?e:pP}function G2(e){const t=document.documentElement;e==="light"||e==="system"&&!window.matchMedia(sD).matches?t.classList.add(H2):t.classList.remove(H2)}function gP({children:e}){const[t,n]=R.useState(mP),r=a=>{localStorage.setItem(iD,a),n(a)};return R.useEffect(()=>{G2(t)},[t]),R.useEffect(()=>{if(t!=="system")return;const a=window.matchMedia(sD),i=()=>G2("system");return a.addEventListener("change",i),()=>a.removeEventListener("change",i)},[t]),p.jsx(lD.Provider,{value:{theme:t,setTheme:r},children:e})}function yP(){const e=R.useContext(lD);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}const oD="myco-ui-font",xP="default",uD={default:{heading:"'Newsreader', Georgia, serif",ui:"'Inter', system-ui, sans-serif",data:"'JetBrains Mono', 'Fira Code', monospace"},"geist-mono":{heading:"'Geist Mono', 'SF Mono', 'Fira Code', monospace",ui:"'Geist Mono', 'SF Mono', 'Fira Code', monospace",data:"'Geist Mono', 'SF Mono', 'Fira Code', monospace"},system:{heading:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace",ui:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace",data:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace"},"sf-mono":{heading:"'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace",ui:"'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace",data:"'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace"},"fira-code":{heading:"'Fira Code', 'Fira Mono', ui-monospace, monospace",ui:"'Fira Code', 'Fira Mono', ui-monospace, monospace",data:"'Fira Code', 'Fira Mono', ui-monospace, monospace"},"jetbrains-mono":{heading:"'JetBrains Mono', ui-monospace, monospace",ui:"'JetBrains Mono', ui-monospace, monospace",data:"'JetBrains Mono', ui-monospace, monospace"}},bP=new Set(Object.keys(uD)),cD=R.createContext(void 0);function wP(){const e=localStorage.getItem(oD);return e&&bP.has(e)?e:xP}function SP(e){const t=uD[e],n=document.documentElement.style;n.setProperty("--font-heading",t.heading),n.setProperty("--font-ui",t.ui),n.setProperty("--font-data",t.data)}function EP({children:e}){const[t,n]=R.useState(wP),r=a=>{localStorage.setItem(oD,a),n(a)};return R.useEffect(()=>{SP(t)},[t]),p.jsx(cD.Provider,{value:{font:t,setFont:r},children:e})}function CP(){const e=R.useContext(cD);if(!e)throw new Error("useFont must be used within a FontProvider");return e}const $2=6e4,TP=3e5,NP=200,Y2={active:1,idle:2,deep_sleep:5,hidden:10},K2=["mousemove","mousedown","keydown","scroll","touchstart"],fD=R.createContext(void 0);function kP({children:e}){const[t,n]=R.useState("active"),r=R.useRef(null),a=R.useRef(null),i=R.useRef(Date.now()),l=R.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null),a.current&&(clearTimeout(a.current),a.current=null)},[]),o=R.useCallback(()=>{l(),r.current=setTimeout(()=>{n("idle"),a.current=setTimeout(()=>{n("deep_sleep")},TP-$2)},$2)},[l]),f=R.useCallback(()=>{const d=Date.now();d-i.current<NP||(i.current=d,n("active"),o())},[o]),c=R.useCallback(()=>{document.hidden?(l(),n("hidden")):(n("active"),i.current=Date.now(),o())},[l,o]);return R.useEffect(()=>{o();for(const d of K2)document.addEventListener(d,f,{passive:!0});return document.addEventListener("visibilitychange",c),()=>{l();for(const d of K2)document.removeEventListener(d,f);document.removeEventListener("visibilitychange",c)}},[f,c,o,l]),p.jsx(fD.Provider,{value:{powerState:t},children:e})}function AP(){const e=R.useContext(fD);if(!e)throw new Error("usePowerState must be used within a PowerProvider");return e.powerState}/**
61
+ * @license lucide-react v0.460.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const RP=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),dD=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
66
+ * @license lucide-react v0.460.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */var DP={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
71
+ * @license lucide-react v0.460.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const jP=R.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:l,...o},f)=>R.createElement("svg",{ref:f,...DP,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:dD("lucide",a),...o},[...l.map(([c,d])=>R.createElement(c,d)),...Array.isArray(i)?i:[i]]));/**
76
+ * @license lucide-react v0.460.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const at=(e,t)=>{const n=R.forwardRef(({className:r,...a},i)=>R.createElement(jP,{ref:i,iconNode:t,className:dD(`lucide-${RP(e)}`,r),...a}));return n.displayName=`${e}`,n};/**
81
+ * @license lucide-react v0.460.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const Z0=at("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
86
+ * @license lucide-react v0.460.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const MP=at("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
91
+ * @license lucide-react v0.460.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const Ws=at("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
96
+ * @license lucide-react v0.460.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const J0=at("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
101
+ * @license lucide-react v0.460.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const dd=at("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
106
+ * @license lucide-react v0.460.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const hD=at("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
111
+ * @license lucide-react v0.460.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const Ma=at("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
116
+ * @license lucide-react v0.460.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const o1=at("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
121
+ * @license lucide-react v0.460.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const wa=at("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
126
+ * @license lucide-react v0.460.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const OP=at("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
131
+ * @license lucide-react v0.460.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const Qi=at("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
136
+ * @license lucide-react v0.460.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const vD=at("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
141
+ * @license lucide-react v0.460.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const pD=at("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
146
+ * @license lucide-react v0.460.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const gp=at("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
151
+ * @license lucide-react v0.460.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const LP=at("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
156
+ * @license lucide-react v0.460.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const _P=at("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
161
+ * @license lucide-react v0.460.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const BP=at("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
166
+ * @license lucide-react v0.460.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const u1=at("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
171
+ * @license lucide-react v0.460.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const mD=at("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
176
+ * @license lucide-react v0.460.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const PP=at("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
181
+ * @license lucide-react v0.460.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const zP=at("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
186
+ * @license lucide-react v0.460.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const IP=at("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/**
191
+ * @license lucide-react v0.460.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const FP=at("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
196
+ * @license lucide-react v0.460.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const qP=at("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
201
+ * @license lucide-react v0.460.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const Xn=at("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
206
+ * @license lucide-react v0.460.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const UP=at("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
211
+ * @license lucide-react v0.460.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const yp=at("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
216
+ * @license lucide-react v0.460.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const VP=at("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
221
+ * @license lucide-react v0.460.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const gD=at("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
226
+ * @license lucide-react v0.460.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const HP=at("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
231
+ * @license lucide-react v0.460.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const GP=at("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
236
+ * @license lucide-react v0.460.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const $P=at("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
241
+ * @license lucide-react v0.460.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const Yu=at("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
246
+ * @license lucide-react v0.460.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const YP=at("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
251
+ * @license lucide-react v0.460.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const yD=at("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
256
+ * @license lucide-react v0.460.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const KP=at("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
261
+ * @license lucide-react v0.460.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const c1=at("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
266
+ * @license lucide-react v0.460.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const xD=at("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
271
+ * @license lucide-react v0.460.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const nc=at("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
276
+ * @license lucide-react v0.460.0 - ISC
277
+ *
278
+ * This source code is licensed under the ISC license.
279
+ * See the LICENSE file in the root directory of this source tree.
280
+ */const XP=at("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
281
+ * @license lucide-react v0.460.0 - ISC
282
+ *
283
+ * This source code is licensed under the ISC license.
284
+ * See the LICENSE file in the root directory of this source tree.
285
+ */const QP=at("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
286
+ * @license lucide-react v0.460.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ */const WP=at("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
291
+ * @license lucide-react v0.460.0 - ISC
292
+ *
293
+ * This source code is licensed under the ISC license.
294
+ * See the LICENSE file in the root directory of this source tree.
295
+ */const bD=at("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
296
+ * @license lucide-react v0.460.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */const ZP=at("Sprout",[["path",{d:"M7 20h10",key:"e6iznv"}],["path",{d:"M10 20c5.5-2.5.8-6.4 3-10",key:"161w41"}],["path",{d:"M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z",key:"9gtqwd"}],["path",{d:"M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z",key:"bkxnd2"}]]);/**
301
+ * @license lucide-react v0.460.0 - ISC
302
+ *
303
+ * This source code is licensed under the ISC license.
304
+ * See the LICENSE file in the root directory of this source tree.
305
+ */const JP=at("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
306
+ * @license lucide-react v0.460.0 - ISC
307
+ *
308
+ * This source code is licensed under the ISC license.
309
+ * See the LICENSE file in the root directory of this source tree.
310
+ */const ez=at("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
311
+ * @license lucide-react v0.460.0 - ISC
312
+ *
313
+ * This source code is licensed under the ISC license.
314
+ * See the LICENSE file in the root directory of this source tree.
315
+ */const qf=at("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
316
+ * @license lucide-react v0.460.0 - ISC
317
+ *
318
+ * This source code is licensed under the ISC license.
319
+ * See the LICENSE file in the root directory of this source tree.
320
+ */const tz=at("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
321
+ * @license lucide-react v0.460.0 - ISC
322
+ *
323
+ * This source code is licensed under the ISC license.
324
+ * See the LICENSE file in the root directory of this source tree.
325
+ */const nz=at("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
326
+ * @license lucide-react v0.460.0 - ISC
327
+ *
328
+ * This source code is licensed under the ISC license.
329
+ * See the LICENSE file in the root directory of this source tree.
330
+ */const rc=at("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
331
+ * @license lucide-react v0.460.0 - ISC
332
+ *
333
+ * This source code is licensed under the ISC license.
334
+ * See the LICENSE file in the root directory of this source tree.
335
+ */const rz=at("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),az=6e4,iz=3e4;function sz(e,t,n){if(t==="heartbeat"){const r=e*Y2[n];return n==="hidden"?Math.min(r,az):n==="deep_sleep"?Math.min(r,iz):r}return n==="deep_sleep"||n==="hidden"?!1:e*Y2[n]}function ui(e){const t=AP(),{pollCategory:n,refetchInterval:r,...a}=e,i=sz(r,n,t);return mn({...a,refetchInterval:i})}const lz="/api";async function Et(e,t){var l;const n=(l=t==null?void 0:t.method)==null?void 0:l.toUpperCase(),a=n==="POST"||n==="PUT"?{"Content-Type":"application/json",...t==null?void 0:t.headers}:t==null?void 0:t.headers,i=await fetch(`${lz}${e}`,{...t,headers:a});if(!i.ok){const o=await i.json().catch(()=>({}));throw new oz(i.status,o)}return i.json()}async function qi(e,t){return Et(e,{method:"POST",body:t?JSON.stringify(t):void 0})}async function f1(e,t){return Et(e,{method:"PUT",body:JSON.stringify(t)})}async function wD(e){return Et(e,{method:"DELETE"})}class oz extends Error{constructor(t,n){super(`API error ${t}`),this.status=t,this.body=n}}const Ea={HEALTH:5e3,STATS:1e4,LOGS:3e3},uz=1e4,cz=["debug","info","warn","error"],qv={debug:0,info:1,warn:2,error:3},fz="built-in",d1="user",Ja=50,eb=300,tb=5,SD=5e3,ED=3;function CD(e){switch(e){case"info":return"default";case"warn":return"warning";case"error":return"destructive";default:return"secondary"}}function h1(e){switch(e){case"info":return"bg-primary";case"debug":return"bg-outline";case"warn":return"bg-secondary";case"error":return"bg-tertiary";default:return"bg-outline"}}function xp(){return ui({queryKey:["daemon-stats"],queryFn:({signal:e})=>Et("/stats",{signal:e}),refetchInterval:Ea.STATS,pollCategory:"standard"})}const Cy=500,dz=3e4;function v1(){const[e,t]=R.useState(!1),n=R.useRef(null);return{restart:R.useCallback(async(a=!1)=>{t(!0);try{const i=await qi("/restart",{force:a});if(i.status==="busy")return t(!1),i;const l=Date.now()+dz;n.current=new AbortController,await new Promise((o,f)=>{const c=async()=>{if(Date.now()>l){f(new Error("Restart timeout"));return}try{if((await fetch("/health",{signal:n.current.signal})).ok){o();return}setTimeout(c,Cy)}catch{setTimeout(c,Cy)}};setTimeout(c,Cy)}),window.location.reload()}catch(i){throw t(!1),i}},[]),isRestarting:e}}function TD(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=TD(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ND(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=TD(e))&&(r&&(r+=" "),r+=t);return r}const X2=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Q2=ND,bp=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Q2(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=t,l=Object.keys(a).map(c=>{const d=n==null?void 0:n[c],v=i==null?void 0:i[c];if(d===null)return null;const m=X2(d)||X2(v);return a[c][m]}),o=n&&Object.entries(n).reduce((c,d)=>{let[v,m]=d;return m===void 0||(c[v]=m),c},{}),f=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,d)=>{let{class:v,className:m,...y}=d;return Object.entries(y).every(x=>{let[S,w]=x;return Array.isArray(w)?w.includes({...i,...o}[S]):{...i,...o}[S]===w})?[...c,v,m]:c},[]);return Q2(e,l,f,n==null?void 0:n.class,n==null?void 0:n.className)},p1="-",hz=e=>{const t=pz(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{const o=l.split(p1);return o[0]===""&&o.length!==1&&o.shift(),kD(o,t)||vz(l)},getConflictingClassGroupIds:(l,o)=>{const f=n[l]||[];return o&&r[l]?[...f,...r[l]]:f}}},kD=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),a=r?kD(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(p1);return(l=t.validators.find(({validator:o})=>o(i)))==null?void 0:l.classGroupId},W2=/^\[(.+)\]$/,vz=e=>{if(W2.test(e)){const t=W2.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},pz=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return gz(Object.entries(e.classGroups),n).forEach(([i,l])=>{nb(l,r,i,t)}),r},nb=(e,t,n,r)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:Z2(t,a);i.classGroupId=n;return}if(typeof a=="function"){if(mz(a)){nb(a(r),t,n,r);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([i,l])=>{nb(l,Z2(t,i),n,r)})})},Z2=(e,t)=>{let n=e;return t.split(p1).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},mz=e=>e.isThemeGetter,gz=(e,t)=>t?e.map(([n,r])=>{const a=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([l,o])=>[t+l,o])):i);return[n,a]}):e,yz=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const a=(i,l)=>{n.set(i,l),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let l=n.get(i);if(l!==void 0)return l;if((l=r.get(i))!==void 0)return a(i,l),l},set(i,l){n.has(i)?n.set(i,l):a(i,l)}}},AD="!",xz=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,a=t[0],i=t.length,l=o=>{const f=[];let c=0,d=0,v;for(let w=0;w<o.length;w++){let b=o[w];if(c===0){if(b===a&&(r||o.slice(w,w+i)===t)){f.push(o.slice(d,w)),d=w+i;continue}if(b==="/"){v=w;continue}}b==="["?c++:b==="]"&&c--}const m=f.length===0?o:o.substring(d),y=m.startsWith(AD),x=y?m.substring(1):m,S=v&&v>d?v-d:void 0;return{modifiers:f,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:S}};return n?o=>n({className:o,parseClassName:l}):l},bz=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},wz=e=>({cache:yz(e.cacheSize),parseClassName:xz(e),...hz(e)}),Sz=/\s+/,Ez=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=t,i=[],l=e.trim().split(Sz);let o="";for(let f=l.length-1;f>=0;f-=1){const c=l[f],{modifiers:d,hasImportantModifier:v,baseClassName:m,maybePostfixModifierPosition:y}=n(c);let x=!!y,S=r(x?m.substring(0,y):m);if(!S){if(!x){o=c+(o.length>0?" "+o:o);continue}if(S=r(m),!S){o=c+(o.length>0?" "+o:o);continue}x=!1}const w=bz(d).join(":"),b=v?w+AD:w,C=b+S;if(i.includes(C))continue;i.push(C);const T=a(S,x);for(let k=0;k<T.length;++k){const D=T[k];i.push(b+D)}o=c+(o.length>0?" "+o:o)}return o};function Cz(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=RD(t))&&(r&&(r+=" "),r+=n);return r}const RD=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=RD(e[r]))&&(n&&(n+=" "),n+=t);return n};function Tz(e,...t){let n,r,a,i=l;function l(f){const c=t.reduce((d,v)=>v(d),e());return n=wz(c),r=n.cache.get,a=n.cache.set,i=o,o(f)}function o(f){const c=r(f);if(c)return c;const d=Ez(f,n);return a(f,d),d}return function(){return i(Cz.apply(null,arguments))}}const tn=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},DD=/^\[(?:([a-z-]+):)?(.+)\]$/i,Nz=/^\d+\/\d+$/,kz=new Set(["px","full","screen"]),Az=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Rz=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Dz=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,jz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Mz=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ji=e=>Nu(e)||kz.has(e)||Nz.test(e),Rs=e=>ac(e,"length",Fz),Nu=e=>!!e&&!Number.isNaN(Number(e)),Ty=e=>ac(e,"number",Nu),cf=e=>!!e&&Number.isInteger(Number(e)),Oz=e=>e.endsWith("%")&&Nu(e.slice(0,-1)),mt=e=>DD.test(e),Ds=e=>Az.test(e),Lz=new Set(["length","size","percentage"]),_z=e=>ac(e,Lz,jD),Bz=e=>ac(e,"position",jD),Pz=new Set(["image","url"]),zz=e=>ac(e,Pz,Uz),Iz=e=>ac(e,"",qz),ff=()=>!0,ac=(e,t,n)=>{const r=DD.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},Fz=e=>Rz.test(e)&&!Dz.test(e),jD=()=>!1,qz=e=>jz.test(e),Uz=e=>Mz.test(e),Vz=()=>{const e=tn("colors"),t=tn("spacing"),n=tn("blur"),r=tn("brightness"),a=tn("borderColor"),i=tn("borderRadius"),l=tn("borderSpacing"),o=tn("borderWidth"),f=tn("contrast"),c=tn("grayscale"),d=tn("hueRotate"),v=tn("invert"),m=tn("gap"),y=tn("gradientColorStops"),x=tn("gradientColorStopPositions"),S=tn("inset"),w=tn("margin"),b=tn("opacity"),C=tn("padding"),T=tn("saturate"),k=tn("scale"),D=tn("sepia"),A=tn("skew"),j=tn("space"),L=tn("translate"),_=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto",mt,t],P=()=>[mt,t],G=()=>["",ji,Rs],I=()=>["auto",Nu,mt],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],B=()=>["solid","dashed","dotted","double","none"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],Q=()=>["","0",mt],V=()=>["auto","avoid","all","avoid-page","page","left","right","column"],q=()=>[Nu,mt];return{cacheSize:500,separator:":",theme:{colors:[ff],spacing:[ji,Rs],blur:["none","",Ds,mt],brightness:q(),borderColor:[e],borderRadius:["none","","full",Ds,mt],borderSpacing:P(),borderWidth:G(),contrast:q(),grayscale:Q(),hueRotate:q(),invert:Q(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[Oz,Rs],inset:z(),margin:z(),opacity:q(),padding:P(),saturate:q(),scale:q(),sepia:Q(),skew:q(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",mt]}],container:["container"],columns:[{columns:[Ds]}],"break-after":[{"break-after":V()}],"break-before":[{"break-before":V()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...F(),mt]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",cf,mt]}],basis:[{basis:z()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",mt]}],grow:[{grow:Q()}],shrink:[{shrink:Q()}],order:[{order:["first","last","none",cf,mt]}],"grid-cols":[{"grid-cols":[ff]}],"col-start-end":[{col:["auto",{span:["full",cf,mt]},mt]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[ff]}],"row-start-end":[{row:["auto",{span:[cf,mt]},mt]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",mt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",mt]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[j]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[j]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",mt,t]}],"min-w":[{"min-w":[mt,t,"min","max","fit"]}],"max-w":[{"max-w":[mt,t,"none","full","min","max","fit","prose",{screen:[Ds]},Ds]}],h:[{h:[mt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[mt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[mt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[mt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ds,Rs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ty]}],"font-family":[{font:[ff]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",mt]}],"line-clamp":[{"line-clamp":["none",Nu,Ty]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ji,mt]}],"list-image":[{"list-image":["none",mt]}],"list-style-type":[{list:["none","disc","decimal",mt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ji,Rs]}],"underline-offset":[{"underline-offset":["auto",ji,mt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",mt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),Bz]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",_z]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},zz]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...B(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:B()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...B()]}],"outline-offset":[{"outline-offset":[ji,mt]}],"outline-w":[{outline:[ji,Rs]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[ji,Rs]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ds,Iz]}],"shadow-color":[{shadow:[ff]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...H(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":H()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",Ds,mt]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[v]}],saturate:[{saturate:[T]}],sepia:[{sepia:[D]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[v]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[D]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",mt]}],duration:[{duration:q()}],ease:[{ease:["linear","in","out","in-out",mt]}],delay:[{delay:q()}],animate:[{animate:["none","spin","ping","pulse","bounce",mt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[cf,mt]}],"translate-x":[{"translate-x":[L]}],"translate-y":[{"translate-y":[L]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",mt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",mt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",mt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ji,Rs,Ty]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Hz=Tz(Vz);function Ae(...e){return Hz(ND(e))}const Gz=bp("inline-flex items-center justify-center whitespace-nowrap rounded-md font-sans text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-surface disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-gradient-to-br from-primary to-primary-container text-on-primary shadow-sm hover:shadow-[0_0_0_1px_rgba(171,207,184,0.4)]",destructive:"bg-gradient-to-br from-tertiary to-tertiary-container text-on-surface shadow-sm hover:shadow-[0_0_0_1px_rgba(255,180,161,0.4)]",outline:"border border-[var(--ghost-border)] bg-transparent shadow-sm hover:bg-surface-container-high hover:text-on-surface",secondary:"border border-outline-variant/20 bg-transparent hover:bg-surface-container-high text-on-surface",ghost:"hover:bg-surface-container-high text-on-surface-variant hover:text-on-surface",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),et=R.forwardRef(({className:e,variant:t,size:n,...r},a)=>p.jsx("button",{className:Ae(Gz({variant:t,size:n,className:e})),ref:a,...r}));et.displayName="Button";function Wt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function J2(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function MD(...e){return t=>{let n=!1;const r=e.map(a=>{const i=J2(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<r.length;a++){const i=r[a];typeof i=="function"?i():J2(e[a],null)}}}}function Cn(...e){return R.useCallback(MD(...e),e)}function $z(e,t){const n=R.createContext(t),r=i=>{const{children:l,...o}=i,f=R.useMemo(()=>o,Object.values(o));return p.jsx(n.Provider,{value:f,children:l})};r.displayName=e+"Provider";function a(i){const l=R.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,a]}function wp(e,t=[]){let n=[];function r(i,l){const o=R.createContext(l),f=n.length;n=[...n,l];const c=v=>{var b;const{scope:m,children:y,...x}=v,S=((b=m==null?void 0:m[e])==null?void 0:b[f])||o,w=R.useMemo(()=>x,Object.values(x));return p.jsx(S.Provider,{value:w,children:y})};c.displayName=i+"Provider";function d(v,m){var S;const y=((S=m==null?void 0:m[e])==null?void 0:S[f])||o,x=R.useContext(y);if(x)return x;if(l!==void 0)return l;throw new Error(`\`${v}\` must be used within \`${i}\``)}return[c,d]}const a=()=>{const i=n.map(l=>R.createContext(l));return function(o){const f=(o==null?void 0:o[e])||i;return R.useMemo(()=>({[`__scope${e}`]:{...o,[e]:f}}),[o,f])}};return a.scopeName=e,[r,Yz(a,...t)]}function Yz(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const l=r.reduce((o,{useScope:f,scopeName:c})=>{const v=f(i)[`__scope${c}`];return{...o,...v}},{});return R.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var vr=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},Kz=NR[" useId ".trim().toString()]||(()=>{}),Xz=0;function ku(e){const[t,n]=R.useState(Kz());return vr(()=>{n(r=>r??String(Xz++))},[e]),t?`radix-${t}`:""}var Qz=NR[" useInsertionEffect ".trim().toString()]||vr;function Uv({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,i,l]=Wz({defaultProp:t,onChange:n}),o=e!==void 0,f=o?e:a;{const d=R.useRef(e!==void 0);R.useEffect(()=>{const v=d.current;v!==o&&console.warn(`${r} is changing from ${v?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=o},[o,r])}const c=R.useCallback(d=>{var v;if(o){const m=Zz(d)?d(e):d;m!==e&&((v=l.current)==null||v.call(l,m))}else i(d)},[o,e,i,l]);return[f,c]}function Wz({defaultProp:e,onChange:t}){const[n,r]=R.useState(e),a=R.useRef(n),i=R.useRef(t);return Qz(()=>{i.current=t},[t]),R.useEffect(()=>{var l;a.current!==n&&((l=i.current)==null||l.call(i,n),a.current=n)},[n,a]),[n,r,i]}function Zz(e){return typeof e=="function"}function Uf(e){const t=Jz(e),n=R.forwardRef((r,a)=>{const{children:i,...l}=r,o=R.Children.toArray(i),f=o.find(tI);if(f){const c=f.props.children,d=o.map(v=>v===f?R.Children.count(c)>1?R.Children.only(null):R.isValidElement(c)?c.props.children:null:v);return p.jsx(t,{...l,ref:a,children:R.isValidElement(c)?R.cloneElement(c,void 0,d):null})}return p.jsx(t,{...l,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function Jz(e){const t=R.forwardRef((n,r)=>{const{children:a,...i}=n;if(R.isValidElement(a)){const l=rI(a),o=nI(i,a.props);return a.type!==R.Fragment&&(o.ref=r?MD(r,l):l),R.cloneElement(a,o)}return R.Children.count(a)>1?R.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var eI=Symbol("radix.slottable");function tI(e){return R.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eI}function nI(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...o)=>{const f=i(...o);return a(...o),f}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function rI(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var aI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Kt=aI.reduce((e,t)=>{const n=Uf(`Primitive.${t}`),r=R.forwardRef((a,i)=>{const{asChild:l,...o}=a,f=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(f,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function iI(e,t){e&&fd.flushSync(()=>e.dispatchEvent(t))}function uo(e){const t=R.useRef(e);return R.useEffect(()=>{t.current=e}),R.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function sI(e,t=globalThis==null?void 0:globalThis.document){const n=uo(e);R.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var lI="DismissableLayer",rb="dismissableLayer.update",oI="dismissableLayer.pointerDownOutside",uI="dismissableLayer.focusOutside",eT,OD=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),m1=R.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:l,onDismiss:o,...f}=e,c=R.useContext(OD),[d,v]=R.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=R.useState({}),x=Cn(t,j=>v(j)),S=Array.from(c.layers),[w]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=S.indexOf(w),C=d?S.indexOf(d):-1,T=c.layersWithOutsidePointerEventsDisabled.size>0,k=C>=b,D=dI(j=>{const L=j.target,_=[...c.branches].some(M=>M.contains(L));!k||_||(a==null||a(j),l==null||l(j),j.defaultPrevented||o==null||o())},m),A=hI(j=>{const L=j.target;[...c.branches].some(M=>M.contains(L))||(i==null||i(j),l==null||l(j),j.defaultPrevented||o==null||o())},m);return sI(j=>{C===c.layers.size-1&&(r==null||r(j),!j.defaultPrevented&&o&&(j.preventDefault(),o()))},m),R.useEffect(()=>{if(d)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(eT=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),tT(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=eT)}},[d,m,n,c]),R.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),tT())},[d,c]),R.useEffect(()=>{const j=()=>y({});return document.addEventListener(rb,j),()=>document.removeEventListener(rb,j)},[]),p.jsx(Kt.div,{...f,ref:x,style:{pointerEvents:T?k?"auto":"none":void 0,...e.style},onFocusCapture:Wt(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Wt(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Wt(e.onPointerDownCapture,D.onPointerDownCapture)})});m1.displayName=lI;var cI="DismissableLayerBranch",fI=R.forwardRef((e,t)=>{const n=R.useContext(OD),r=R.useRef(null),a=Cn(t,r);return R.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),p.jsx(Kt.div,{...e,ref:a})});fI.displayName=cI;function dI(e,t=globalThis==null?void 0:globalThis.document){const n=uo(e),r=R.useRef(!1),a=R.useRef(()=>{});return R.useEffect(()=>{const i=o=>{if(o.target&&!r.current){let f=function(){LD(oI,n,c,{discrete:!0})};const c={originalEvent:o};o.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=f,t.addEventListener("click",a.current,{once:!0})):f()}else t.removeEventListener("click",a.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function hI(e,t=globalThis==null?void 0:globalThis.document){const n=uo(e),r=R.useRef(!1);return R.useEffect(()=>{const a=i=>{i.target&&!r.current&&LD(uI,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function tT(){const e=new CustomEvent(rb);document.dispatchEvent(e)}function LD(e,t,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?iI(a,i):a.dispatchEvent(i)}var Ny="focusScope.autoFocusOnMount",ky="focusScope.autoFocusOnUnmount",nT={bubbles:!1,cancelable:!0},vI="FocusScope",g1=R.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...l}=e,[o,f]=R.useState(null),c=uo(a),d=uo(i),v=R.useRef(null),m=Cn(t,S=>f(S)),y=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(r){let S=function(T){if(y.paused||!o)return;const k=T.target;o.contains(k)?v.current=k:Bs(v.current,{select:!0})},w=function(T){if(y.paused||!o)return;const k=T.relatedTarget;k!==null&&(o.contains(k)||Bs(v.current,{select:!0}))},b=function(T){if(document.activeElement===document.body)for(const D of T)D.removedNodes.length>0&&Bs(o)};document.addEventListener("focusin",S),document.addEventListener("focusout",w);const C=new MutationObserver(b);return o&&C.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",w),C.disconnect()}}},[r,o,y.paused]),R.useEffect(()=>{if(o){aT.add(y);const S=document.activeElement;if(!o.contains(S)){const b=new CustomEvent(Ny,nT);o.addEventListener(Ny,c),o.dispatchEvent(b),b.defaultPrevented||(pI(bI(_D(o)),{select:!0}),document.activeElement===S&&Bs(o))}return()=>{o.removeEventListener(Ny,c),setTimeout(()=>{const b=new CustomEvent(ky,nT);o.addEventListener(ky,d),o.dispatchEvent(b),b.defaultPrevented||Bs(S??document.body,{select:!0}),o.removeEventListener(ky,d),aT.remove(y)},0)}}},[o,c,d,y]);const x=R.useCallback(S=>{if(!n&&!r||y.paused)return;const w=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,b=document.activeElement;if(w&&b){const C=S.currentTarget,[T,k]=mI(C);T&&k?!S.shiftKey&&b===k?(S.preventDefault(),n&&Bs(T,{select:!0})):S.shiftKey&&b===T&&(S.preventDefault(),n&&Bs(k,{select:!0})):b===C&&S.preventDefault()}},[n,r,y.paused]);return p.jsx(Kt.div,{tabIndex:-1,...l,ref:m,onKeyDown:x})});g1.displayName=vI;function pI(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Bs(r,{select:t}),document.activeElement!==n)return}function mI(e){const t=_D(e),n=rT(t,e),r=rT(t.reverse(),e);return[n,r]}function _D(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function rT(e,t){for(const n of e)if(!gI(n,{upTo:t}))return n}function gI(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function yI(e){return e instanceof HTMLInputElement&&"select"in e}function Bs(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&yI(e)&&t&&e.select()}}var aT=xI();function xI(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=iT(e,t),e.unshift(t)},remove(t){var n;e=iT(e,t),(n=e[0])==null||n.resume()}}}function iT(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function bI(e){return e.filter(t=>t.tagName!=="A")}var wI="Portal",y1=R.forwardRef((e,t)=>{var o;const{container:n,...r}=e,[a,i]=R.useState(!1);vr(()=>i(!0),[]);const l=n||a&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return l?vP.createPortal(p.jsx(Kt.div,{...r,ref:t}),l):null});y1.displayName=wI;function SI(e,t){return R.useReducer((n,r)=>t[n][r]??n,e)}var Sp=e=>{const{present:t,children:n}=e,r=EI(t),a=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),i=Cn(r.ref,CI(a));return typeof n=="function"||r.isPresent?R.cloneElement(a,{ref:i}):null};Sp.displayName="Presence";function EI(e){const[t,n]=R.useState(),r=R.useRef(null),a=R.useRef(e),i=R.useRef("none"),l=e?"mounted":"unmounted",[o,f]=SI(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const c=Kh(r.current);i.current=o==="mounted"?c:"none"},[o]),vr(()=>{const c=r.current,d=a.current;if(d!==e){const m=i.current,y=Kh(c);e?f("MOUNT"):y==="none"||(c==null?void 0:c.display)==="none"?f("UNMOUNT"):f(d&&m!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,f]),vr(()=>{if(t){let c;const d=t.ownerDocument.defaultView??window,v=y=>{const S=Kh(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&S&&(f("ANIMATION_END"),!a.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",c=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},m=y=>{y.target===t&&(i.current=Kh(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{d.clearTimeout(c),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:R.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Kh(e){return(e==null?void 0:e.animationName)||"none"}function CI(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ay=0;function BD(){R.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??sT()),document.body.insertAdjacentElement("beforeend",e[1]??sT()),Ay++,()=>{Ay===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ay--}},[])}function sT(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Za=function(){return Za=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Za.apply(this,arguments)};function PD(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function TI(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,i;r<a;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Ev="right-scroll-bar-position",Cv="width-before-scroll-bar",NI="with-scroll-bars-hidden",kI="--removed-body-scroll-bar-size";function Ry(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function AI(e,t){var n=R.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var RI=typeof window<"u"?R.useLayoutEffect:R.useEffect,lT=new WeakMap;function DI(e,t){var n=AI(null,function(r){return e.forEach(function(a){return Ry(a,r)})});return RI(function(){var r=lT.get(n);if(r){var a=new Set(r),i=new Set(e),l=n.current;a.forEach(function(o){i.has(o)||Ry(o,null)}),i.forEach(function(o){a.has(o)||Ry(o,l)})}lT.set(n,e)},[e]),n}function jI(e){return e}function MI(e,t){t===void 0&&(t=jI);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var l=t(i,r);return n.push(l),function(){n=n.filter(function(o){return o!==l})}},assignSyncMedium:function(i){for(r=!0;n.length;){var l=n;n=[],l.forEach(i)}n={push:function(o){return i(o)},filter:function(){return n}}},assignMedium:function(i){r=!0;var l=[];if(n.length){var o=n;n=[],o.forEach(i),l=n}var f=function(){var d=l;l=[],d.forEach(i)},c=function(){return Promise.resolve().then(f)};c(),n={push:function(d){l.push(d),c()},filter:function(d){return l=l.filter(d),n}}}};return a}function OI(e){e===void 0&&(e={});var t=MI(null);return t.options=Za({async:!0,ssr:!1},e),t}var zD=function(e){var t=e.sideCar,n=PD(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return R.createElement(r,Za({},n))};zD.isSideCarExport=!0;function LI(e,t){return e.useMedium(t),zD}var ID=OI(),Dy=function(){},Ep=R.forwardRef(function(e,t){var n=R.useRef(null),r=R.useState({onScrollCapture:Dy,onWheelCapture:Dy,onTouchMoveCapture:Dy}),a=r[0],i=r[1],l=e.forwardProps,o=e.children,f=e.className,c=e.removeScrollBar,d=e.enabled,v=e.shards,m=e.sideCar,y=e.noRelative,x=e.noIsolation,S=e.inert,w=e.allowPinchZoom,b=e.as,C=b===void 0?"div":b,T=e.gapMode,k=PD(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=m,A=DI([n,t]),j=Za(Za({},k),a);return R.createElement(R.Fragment,null,d&&R.createElement(D,{sideCar:ID,removeScrollBar:c,shards:v,noRelative:y,noIsolation:x,inert:S,setCallbacks:i,allowPinchZoom:!!w,lockRef:n,gapMode:T}),l?R.cloneElement(R.Children.only(o),Za(Za({},j),{ref:A})):R.createElement(C,Za({},j,{className:f,ref:A}),o))});Ep.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ep.classNames={fullWidth:Cv,zeroRight:Ev};var _I=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function BI(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=_I();return t&&e.setAttribute("nonce",t),e}function PI(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function zI(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var II=function(){var e=0,t=null;return{add:function(n){e==0&&(t=BI())&&(PI(t,n),zI(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},FI=function(){var e=II();return function(t,n){R.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},FD=function(){var e=FI(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},qI={left:0,top:0,right:0,gap:0},jy=function(e){return parseInt(e||"",10)||0},UI=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[jy(n),jy(r),jy(a)]},VI=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return qI;var t=UI(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},HI=FD(),Au="data-scroll-locked",GI=function(e,t,n,r){var a=e.left,i=e.top,l=e.right,o=e.gap;return n===void 0&&(n="margin"),`
336
+ .`.concat(NI,` {
337
+ overflow: hidden `).concat(r,`;
338
+ padding-right: `).concat(o,"px ").concat(r,`;
339
+ }
340
+ body[`).concat(Au,`] {
341
+ overflow: hidden `).concat(r,`;
342
+ overscroll-behavior: contain;
343
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
344
+ padding-left: `.concat(a,`px;
345
+ padding-top: `).concat(i,`px;
346
+ padding-right: `).concat(l,`px;
347
+ margin-left:0;
348
+ margin-top:0;
349
+ margin-right: `).concat(o,"px ").concat(r,`;
350
+ `),n==="padding"&&"padding-right: ".concat(o,"px ").concat(r,";")].filter(Boolean).join(""),`
351
+ }
352
+
353
+ .`).concat(Ev,` {
354
+ right: `).concat(o,"px ").concat(r,`;
355
+ }
356
+
357
+ .`).concat(Cv,` {
358
+ margin-right: `).concat(o,"px ").concat(r,`;
359
+ }
360
+
361
+ .`).concat(Ev," .").concat(Ev,` {
362
+ right: 0 `).concat(r,`;
363
+ }
364
+
365
+ .`).concat(Cv," .").concat(Cv,` {
366
+ margin-right: 0 `).concat(r,`;
367
+ }
368
+
369
+ body[`).concat(Au,`] {
370
+ `).concat(kI,": ").concat(o,`px;
371
+ }
372
+ `)},oT=function(){var e=parseInt(document.body.getAttribute(Au)||"0",10);return isFinite(e)?e:0},$I=function(){R.useEffect(function(){return document.body.setAttribute(Au,(oT()+1).toString()),function(){var e=oT()-1;e<=0?document.body.removeAttribute(Au):document.body.setAttribute(Au,e.toString())}},[])},YI=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;$I();var i=R.useMemo(function(){return VI(a)},[a]);return R.createElement(HI,{styles:GI(i,!t,a,n?"":"!important")})},ab=!1;if(typeof window<"u")try{var Xh=Object.defineProperty({},"passive",{get:function(){return ab=!0,!0}});window.addEventListener("test",Xh,Xh),window.removeEventListener("test",Xh,Xh)}catch{ab=!1}var su=ab?{passive:!1}:!1,KI=function(e){return e.tagName==="TEXTAREA"},qD=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!KI(e)&&n[t]==="visible")},XI=function(e){return qD(e,"overflowY")},QI=function(e){return qD(e,"overflowX")},uT=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=UD(e,r);if(a){var i=VD(e,r),l=i[1],o=i[2];if(l>o)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},WI=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},ZI=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},UD=function(e,t){return e==="v"?XI(t):QI(t)},VD=function(e,t){return e==="v"?WI(t):ZI(t)},JI=function(e,t){return e==="h"&&t==="rtl"?-1:1},eF=function(e,t,n,r,a){var i=JI(e,window.getComputedStyle(t).direction),l=i*r,o=n.target,f=t.contains(o),c=!1,d=l>0,v=0,m=0;do{if(!o)break;var y=VD(e,o),x=y[0],S=y[1],w=y[2],b=S-w-i*x;(x||b)&&UD(e,o)&&(v+=b,m+=x);var C=o.parentNode;o=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!f&&o!==document.body||f&&(t.contains(o)||t===o));return(d&&Math.abs(v)<1||!d&&Math.abs(m)<1)&&(c=!0),c},Qh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cT=function(e){return[e.deltaX,e.deltaY]},fT=function(e){return e&&"current"in e?e.current:e},tF=function(e,t){return e[0]===t[0]&&e[1]===t[1]},nF=function(e){return`
373
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
374
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
375
+ `)},rF=0,lu=[];function aF(e){var t=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),a=R.useState(rF++)[0],i=R.useState(FD)[0],l=R.useRef(e);R.useEffect(function(){l.current=e},[e]),R.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var S=TI([e.lockRef.current],(e.shards||[]).map(fT),!0).filter(Boolean);return S.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),S.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var o=R.useCallback(function(S,w){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!l.current.allowPinchZoom;var b=Qh(S),C=n.current,T="deltaX"in S?S.deltaX:C[0]-b[0],k="deltaY"in S?S.deltaY:C[1]-b[1],D,A=S.target,j=Math.abs(T)>Math.abs(k)?"h":"v";if("touches"in S&&j==="h"&&A.type==="range")return!1;var L=window.getSelection(),_=L&&L.anchorNode,M=_?_===A||_.contains(A):!1;if(M)return!1;var z=uT(j,A);if(!z)return!0;if(z?D=j:(D=j==="v"?"h":"v",z=uT(j,A)),!z)return!1;if(!r.current&&"changedTouches"in S&&(T||k)&&(r.current=D),!D)return!0;var P=r.current||D;return eF(P,w,S,P==="h"?T:k)},[]),f=R.useCallback(function(S){var w=S;if(!(!lu.length||lu[lu.length-1]!==i)){var b="deltaY"in w?cT(w):Qh(w),C=t.current.filter(function(D){return D.name===w.type&&(D.target===w.target||w.target===D.shadowParent)&&tF(D.delta,b)})[0];if(C&&C.should){w.cancelable&&w.preventDefault();return}if(!C){var T=(l.current.shards||[]).map(fT).filter(Boolean).filter(function(D){return D.contains(w.target)}),k=T.length>0?o(w,T[0]):!l.current.noIsolation;k&&w.cancelable&&w.preventDefault()}}},[]),c=R.useCallback(function(S,w,b,C){var T={name:S,delta:w,target:b,should:C,shadowParent:iF(b)};t.current.push(T),setTimeout(function(){t.current=t.current.filter(function(k){return k!==T})},1)},[]),d=R.useCallback(function(S){n.current=Qh(S),r.current=void 0},[]),v=R.useCallback(function(S){c(S.type,cT(S),S.target,o(S,e.lockRef.current))},[]),m=R.useCallback(function(S){c(S.type,Qh(S),S.target,o(S,e.lockRef.current))},[]);R.useEffect(function(){return lu.push(i),e.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:m}),document.addEventListener("wheel",f,su),document.addEventListener("touchmove",f,su),document.addEventListener("touchstart",d,su),function(){lu=lu.filter(function(S){return S!==i}),document.removeEventListener("wheel",f,su),document.removeEventListener("touchmove",f,su),document.removeEventListener("touchstart",d,su)}},[]);var y=e.removeScrollBar,x=e.inert;return R.createElement(R.Fragment,null,x?R.createElement(i,{styles:nF(a)}):null,y?R.createElement(YI,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function iF(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const sF=LI(ID,aF);var x1=R.forwardRef(function(e,t){return R.createElement(Ep,Za({},e,{ref:t,sideCar:sF}))});x1.classNames=Ep.classNames;var lF=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ou=new WeakMap,Wh=new WeakMap,Zh={},My=0,HD=function(e){return e&&(e.host||HD(e.parentNode))},oF=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=HD(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},uF=function(e,t,n,r){var a=oF(t,Array.isArray(e)?e:[e]);Zh[n]||(Zh[n]=new WeakMap);var i=Zh[n],l=[],o=new Set,f=new Set(a),c=function(v){!v||o.has(v)||(o.add(v),c(v.parentNode))};a.forEach(c);var d=function(v){!v||f.has(v)||Array.prototype.forEach.call(v.children,function(m){if(o.has(m))d(m);else try{var y=m.getAttribute(r),x=y!==null&&y!=="false",S=(ou.get(m)||0)+1,w=(i.get(m)||0)+1;ou.set(m,S),i.set(m,w),l.push(m),S===1&&x&&Wh.set(m,!0),w===1&&m.setAttribute(n,"true"),x||m.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return d(t),o.clear(),My++,function(){l.forEach(function(v){var m=ou.get(v)-1,y=i.get(v)-1;ou.set(v,m),i.set(v,y),m||(Wh.has(v)||v.removeAttribute(r),Wh.delete(v)),y||v.removeAttribute(n)}),My--,My||(ou=new WeakMap,ou=new WeakMap,Wh=new WeakMap,Zh={})}},GD=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=lF(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),uF(r,a,n,"aria-hidden")):function(){return null}},Cp="Dialog",[$D]=wp(Cp),[cF,Pa]=$D(Cp),YD=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:l=!0}=e,o=R.useRef(null),f=R.useRef(null),[c,d]=Uv({prop:r,defaultProp:a??!1,onChange:i,caller:Cp});return p.jsx(cF,{scope:t,triggerRef:o,contentRef:f,contentId:ku(),titleId:ku(),descriptionId:ku(),open:c,onOpenChange:d,onOpenToggle:R.useCallback(()=>d(v=>!v),[d]),modal:l,children:n})};YD.displayName=Cp;var KD="DialogTrigger",fF=R.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Pa(KD,n),i=Cn(t,a.triggerRef);return p.jsx(Kt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":S1(a.open),...r,ref:i,onClick:Wt(e.onClick,a.onOpenToggle)})});fF.displayName=KD;var b1="DialogPortal",[dF,XD]=$D(b1,{forceMount:void 0}),QD=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,i=Pa(b1,t);return p.jsx(dF,{scope:t,forceMount:n,children:R.Children.map(r,l=>p.jsx(Sp,{present:n||i.open,children:p.jsx(y1,{asChild:!0,container:a,children:l})}))})};QD.displayName=b1;var Vv="DialogOverlay",WD=R.forwardRef((e,t)=>{const n=XD(Vv,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=Pa(Vv,e.__scopeDialog);return i.modal?p.jsx(Sp,{present:r||i.open,children:p.jsx(vF,{...a,ref:t})}):null});WD.displayName=Vv;var hF=Uf("DialogOverlay.RemoveScroll"),vF=R.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Pa(Vv,n);return p.jsx(x1,{as:hF,allowPinchZoom:!0,shards:[a.contentRef],children:p.jsx(Kt.div,{"data-state":S1(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),co="DialogContent",ZD=R.forwardRef((e,t)=>{const n=XD(co,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=Pa(co,e.__scopeDialog);return p.jsx(Sp,{present:r||i.open,children:i.modal?p.jsx(pF,{...a,ref:t}):p.jsx(mF,{...a,ref:t})})});ZD.displayName=co;var pF=R.forwardRef((e,t)=>{const n=Pa(co,e.__scopeDialog),r=R.useRef(null),a=Cn(t,n.contentRef,r);return R.useEffect(()=>{const i=r.current;if(i)return GD(i)},[]),p.jsx(JD,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Wt(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Wt(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,o=l.button===0&&l.ctrlKey===!0;(l.button===2||o)&&i.preventDefault()}),onFocusOutside:Wt(e.onFocusOutside,i=>i.preventDefault())})}),mF=R.forwardRef((e,t)=>{const n=Pa(co,e.__scopeDialog),r=R.useRef(!1),a=R.useRef(!1);return p.jsx(JD,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var l,o;(l=e.onCloseAutoFocus)==null||l.call(e,i),i.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var f,c;(f=e.onInteractOutside)==null||f.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(l))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),JD=R.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...l}=e,o=Pa(co,n),f=R.useRef(null),c=Cn(t,f);return BD(),p.jsxs(p.Fragment,{children:[p.jsx(g1,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:p.jsx(m1,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":S1(o.open),...l,ref:c,onDismiss:()=>o.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(gF,{titleId:o.titleId}),p.jsx(xF,{contentRef:f,descriptionId:o.descriptionId})]})]})}),w1="DialogTitle",ej=R.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Pa(w1,n);return p.jsx(Kt.h2,{id:a.titleId,...r,ref:t})});ej.displayName=w1;var tj="DialogDescription",nj=R.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Pa(tj,n);return p.jsx(Kt.p,{id:a.descriptionId,...r,ref:t})});nj.displayName=tj;var rj="DialogClose",aj=R.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Pa(rj,n);return p.jsx(Kt.button,{type:"button",...r,ref:t,onClick:Wt(e.onClick,()=>a.onOpenChange(!1))})});aj.displayName=rj;function S1(e){return e?"open":"closed"}var ij="DialogTitleWarning",[Fne,sj]=$z(ij,{contentName:co,titleName:w1,docsSlug:"dialog"}),gF=({titleId:e})=>{const t=sj(ij),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
376
+
377
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
378
+
379
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return R.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},yF="DialogDescriptionWarning",xF=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${sj(yF).contentName}}.`;return R.useEffect(()=>{var i;const a=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},bF=YD,wF=QD,lj=WD,oj=ZD,uj=ej,cj=nj,SF=aj;const Tp=bF,EF=wF,fj=R.forwardRef(({className:e,...t},n)=>p.jsx(lj,{ref:n,className:Ae("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",e),...t}));fj.displayName=lj.displayName;const hd=R.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(EF,{children:[p.jsx(fj,{}),p.jsxs(oj,{ref:r,className:Ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 [&>*]:min-w-0 border-0 bg-surface-container-highest p-6 shadow-ambient duration-200 sm:rounded-lg",e),...n,children:[t,p.jsxs(SF,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[p.jsx(rc,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));hd.displayName=oj.displayName;function Np({className:e,...t}){return p.jsx("div",{className:Ae("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}Np.displayName="DialogHeader";function kp({className:e,...t}){return p.jsx("div",{className:Ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}kp.displayName="DialogFooter";const vd=R.forwardRef(({className:e,...t},n)=>p.jsx(uj,{ref:n,className:Ae("text-lg font-serif font-semibold leading-none tracking-tight",e),...t}));vd.displayName=uj.displayName;const E1=R.forwardRef(({className:e,...t},n)=>p.jsx(cj,{ref:n,className:Ae("text-sm text-on-surface-variant",e),...t}));E1.displayName=cj.displayName;const Sn=R.forwardRef(({className:e,type:t,...n},r)=>p.jsx("input",{type:t,className:Ae("flex h-9 w-full rounded-md bg-surface-container-lowest border border-[var(--ghost-border)] px-3 py-1 font-sans text-sm text-on-surface shadow-none transition-colors","file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-on-surface","placeholder:text-on-surface-variant/50","focus-visible:outline-none focus-visible:border-primary/40","disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Sn.displayName="Input";var dj="Toggle",hj=R.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:a,...i}=e,[l,o]=Uv({prop:n,onChange:a,defaultProp:r??!1,caller:dj});return p.jsx(Kt.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:Wt(e.onClick,()=>{e.disabled||o(!l)})})});hj.displayName=dj;var vj=hj;const CF=bp("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-surface-container-high/80 hover:text-on-surface-variant focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-primary data-[state=on]:text-on-primary",{variants:{variant:{default:"bg-surface-container-high text-on-surface-variant",outline:"border border-input bg-surface-container-high text-on-surface-variant shadow-sm hover:bg-surface-container-high/80 hover:text-on-surface-variant"},size:{default:"h-9 px-3",sm:"h-8 px-2",lg:"h-10 px-3"}},defaultVariants:{variant:"default",size:"default"}}),ib=R.forwardRef(({className:e,variant:t,size:n,...r},a)=>p.jsx(vj,{ref:a,className:Ae(CF({variant:t,size:n,className:e})),...r}));ib.displayName=vj.displayName;const TF=bp("inline-flex items-center rounded-sm px-2 py-0.5 font-sans text-xs font-medium transition-colors",{variants:{variant:{default:"bg-primary/15 text-primary",secondary:"bg-surface-container-high text-on-surface-variant",destructive:"bg-tertiary/15 text-tertiary",warning:"bg-secondary/15 text-secondary",outline:"border border-[var(--ghost-border)] text-on-surface-variant"}},defaultVariants:{variant:"default"}});function sr({className:e,variant:t,...n}){return p.jsx("div",{className:Ae(TF({variant:t}),e),...n})}const NF=120,kF={session:{label:"Sessions",icon:yp},spore:{label:"Spores",icon:bD},plan:{label:"Plans",icon:LP},prompt_batch:{label:"Prompt Batches",icon:Z0},activity:{label:"Activities",icon:Z0}};function pj(e){return kF[e]??{label:e,icon:PP}}function AF(e,t){return e.length<=t?e:e.slice(0,t)+"…"}function RF({score:e}){const t=Math.round(e*100);return p.jsxs(sr,{variant:"outline",className:"shrink-0 text-xs tabular-nums text-on-surface-variant",children:[t,"%"]})}function DF({result:e,onSelect:t,isHighlighted:n}){const{icon:r}=pj(e.type);return p.jsxs("button",{type:"button",onClick:()=>t(e),className:["w-full flex items-start gap-3 px-3 py-2 text-left rounded-md transition-colors",n?"bg-surface-container-high text-on-surface":"hover:bg-surface-container-high hover:text-on-surface"].join(" "),children:[p.jsx(r,{className:"h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant"}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("span",{className:"text-sm font-medium truncate",children:e.title})}),e.preview&&p.jsx("p",{className:"text-xs text-on-surface-variant mt-0.5 line-clamp-2",children:AF(e.preview,NF)})]}),p.jsx(RF,{score:e.score})]})}function jF({results:e,onSelect:t,highlightedIndex:n}){const r=e.reduce((i,l)=>{const o=l.type??"unknown";return(i[o]??(i[o]=[])).push(l),i},{});let a=0;return p.jsx("div",{className:"py-2 space-y-1",children:Object.entries(r).map(([i,l])=>{const{label:o}=pj(i),f=a;return a+=l.length,p.jsxs("div",{children:[p.jsx("div",{className:"px-3 py-1",children:p.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-on-surface-variant",children:o})}),l.map((c,d)=>p.jsx(DF,{result:c,onSelect:t,isHighlighted:n===f+d},c.id))]},i)})})}const MF=2,OF=3e4;function LF(e,t="semantic"){return mn({queryKey:["search",e,t],queryFn:({signal:n})=>Et(`/search?q=${encodeURIComponent(e)}&mode=${t}`,{signal:n}),enabled:e.length>MF,staleTime:OF})}const _F=300,BF=20;function PF(e){switch(e.type){case"session":return`/sessions/${e.id}`;case"spore":return`/mycelium?spore=${encodeURIComponent(e.id)}`;case"plan":return e.session_id?`/sessions/${e.session_id}`:"/sessions";case"prompt_batch":return e.session_id?`/sessions/${e.session_id}`:"/sessions";case"activity":return e.session_id?`/sessions/${e.session_id}`:"/sessions";default:return"/"}}function zF({open:e,onOpenChange:t}){const n=vl(),[r,a]=R.useState(""),[i,l]=R.useState(""),[o,f]=R.useState("semantic"),[c,d]=R.useState(0),v=R.useRef(null);R.useEffect(()=>{const T=setTimeout(()=>{l(r.trim())},_F);return()=>clearTimeout(T)},[r]),R.useEffect(()=>{e&&(a(""),l(""),d(0),setTimeout(()=>{var T;return(T=v.current)==null?void 0:T.focus()},50))},[e]);const{data:m,isLoading:y}=LF(i,o),x=((m==null?void 0:m.results)??[]).slice(0,BF);R.useEffect(()=>{d(0)},[x.length,i]);const S=R.useCallback(T=>{const k=PF(T);t(!1),n(k)},[n,t]),w=R.useCallback(T=>{if(x.length!==0){if(T.key==="ArrowDown")T.preventDefault(),d(k=>Math.min(k+1,x.length-1));else if(T.key==="ArrowUp")T.preventDefault(),d(k=>Math.max(k-1,0));else if(T.key==="Enter"){T.preventDefault();const k=x[c];k&&S(k)}}},[x,c,S]),b=i.length>2&&!y&&x.length===0,C=i.length<=2&&!y;return p.jsx(Tp,{open:e,onOpenChange:t,children:p.jsxs(hd,{className:"max-w-2xl p-0 gap-0 overflow-hidden",onKeyDown:w,children:[p.jsx(vd,{className:"sr-only",children:"Search vault"}),p.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--ghost-border)] pl-4 pr-12 py-3",children:[p.jsx(nc,{className:"h-4 w-4 shrink-0 text-on-surface-variant"}),p.jsx(Sn,{ref:v,value:r,onChange:T=>a(T.target.value),placeholder:"Search sessions, spores, plans…",className:"border-0 shadow-none focus-visible:ring-0 px-0 h-auto text-base bg-surface-bright font-mono"}),p.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[p.jsx(ib,{size:"sm",pressed:o==="semantic",onPressedChange:()=>f("semantic"),"aria-label":"Semantic search",title:"Semantic (embedded knowledge)",children:"Semantic"}),p.jsx(ib,{size:"sm",pressed:o==="fts",onPressedChange:()=>f("fts"),"aria-label":"Full-text search",title:"Full text (raw data)",children:"Full Text"})]})]}),p.jsxs("div",{className:"max-h-96 overflow-y-auto",children:[y&&i.length>2&&p.jsx("div",{className:"px-4 py-8 text-center",children:p.jsxs("div",{className:"flex flex-col items-center gap-2 text-on-surface-variant",children:[p.jsx("div",{className:"h-4 w-32 rounded bg-muted animate-pulse"}),p.jsx("div",{className:"h-3 w-24 rounded bg-muted animate-pulse"}),p.jsx("div",{className:"h-3 w-28 rounded bg-muted animate-pulse"})]})}),C&&p.jsx("div",{className:"px-4 py-8 text-center text-sm text-on-surface-variant",children:"Type to search your vault…"}),b&&p.jsxs("div",{className:"px-4 py-8 text-center text-sm text-on-surface-variant",children:["No results for ",p.jsxs("span",{className:"font-medium text-on-surface",children:['"',i,'"']})]}),x.length>0&&!y&&p.jsx(jF,{results:x,onSelect:S,highlightedIndex:c})]}),p.jsxs("div",{className:"border-t border-[var(--ghost-border)] px-4 py-2 flex items-center gap-4 text-xs text-on-surface-variant",children:[p.jsxs("span",{children:[p.jsx("kbd",{className:"font-mono",children:"↑↓"})," navigate"]}),p.jsxs("span",{children:[p.jsx("kbd",{className:"font-mono",children:"↵"})," open"]}),p.jsxs("span",{children:[p.jsx("kbd",{className:"font-mono",children:"Esc"})," close"]}),p.jsx("span",{className:"ml-auto",children:(m==null?void 0:m.mode)&&x.length>0&&`${x.length} result${x.length!==1?"s":""} · ${m.mode}`})]})]})})}const IF=[{to:"/",label:"Dashboard",icon:qP},{to:"/sessions",label:"Sessions",icon:yp},{to:"/mycelium",label:"Mycelium",icon:GP},{to:"/agent",label:"Agent",icon:dd},{to:"/settings",label:"Settings",icon:WP},{to:"/operations",label:"Operations",icon:nz},{to:"/logs",label:"Logs",icon:xD}],FF=[{value:"default",label:"Default"},{value:"geist-mono",label:"Geist Mono"},{value:"system",label:"System"},{value:"sf-mono",label:"SF Mono"},{value:"fira-code",label:"Fira Code"},{value:"jetbrains-mono",label:"JetBrains"}],mj={compact:.85,normal:1,comfy:1.15},qF={compact:"Compact",normal:"Normal",comfy:"Comfy"},df=["compact","normal","comfy"],dT="myco-ui-sidebar-collapsed",hT=768,gj="myco-ui-density",UF="--density",VF="normal";function HF(){const e=localStorage.getItem(gj);return e&&e in mj?e:VF}function GF(e){const t=mj[e];document.documentElement.style.setProperty(UF,String(t)),document.documentElement.style.fontSize=`calc(14px * ${t})`}function $F(){const[e,t]=R.useState(HF),n=R.useCallback(r=>{localStorage.setItem(gj,r),t(r)},[]);return R.useEffect(()=>{GF(e)},[e]),{density:e,setDensity:n}}function YF(){const[e,t]=R.useState(()=>localStorage.getItem(dT)==="true"),n=R.useCallback(()=>{t(r=>{const a=!r;return localStorage.setItem(dT,String(a)),a})},[]);return{collapsed:e,toggle:n}}function KF(){const[e,t]=R.useState(!1),[n,r]=R.useState(()=>typeof window<"u"&&window.innerWidth<hT);R.useEffect(()=>{const o=window.matchMedia(`(max-width: ${hT-1}px)`),f=c=>{r(c.matches),c.matches||t(!1)};return o.addEventListener("change",f),()=>o.removeEventListener("change",f)},[]);const a=Xi();R.useEffect(()=>{t(!1)},[a.pathname]),R.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]);const i=R.useCallback(()=>t(o=>!o),[]),l=R.useCallback(()=>t(!1),[]);return{open:e,isMobile:n,toggle:i,close:l}}const Oy=["light","dark","system"],XF={light:ez,dark:HP,system:gD},QF={light:"Light",dark:"Dark",system:"System"};function WF({collapsed:e=!1}){const{theme:t,setTheme:n}=yP(),r=()=>{const l=Oy.indexOf(t),o=Oy[(l+1)%Oy.length];n(o)},a=XF[t]??gD,i=QF[t]??"System";return p.jsxs(et,{variant:"ghost",size:"sm",onClick:r,title:e?`${i} mode`:void 0,className:Ae("text-on-surface-variant hover:text-on-surface",e?"w-8 p-0 justify-center":"w-full justify-start gap-2"),children:[p.jsx(a,{className:"h-4 w-4"}),!e&&p.jsx("span",{children:i})]})}function ZF({collapsed:e=!1}){const{restart:t,isRestarting:n}=v1();return p.jsxs(et,{variant:"ghost",size:"sm",onClick:()=>t(),disabled:n,title:e?n?"Restarting...":"Restart Daemon":void 0,className:Ae("text-on-surface-variant hover:text-on-surface",e?"w-8 p-0 justify-center":"w-full justify-start gap-2"),children:[p.jsx(c1,{className:Ae("h-4 w-4",n&&"animate-spin")}),!e&&p.jsx("span",{children:n?"Restarting...":"Restart Daemon"})]})}function JF(){const{font:e,setFont:t}=CP();return p.jsxs("label",{className:"flex items-center gap-2 px-2 py-1 text-sm text-on-surface-variant hover:text-on-surface cursor-pointer",children:[p.jsx(tz,{className:"h-4 w-4 shrink-0"}),p.jsx("select",{value:e,onChange:n=>t(n.target.value),className:"w-full bg-transparent border-none outline-none cursor-pointer text-sm appearance-none",children:FF.map(n=>p.jsx("option",{value:n.value,children:n.label},n.value))})]})}function e6({density:e,setDensity:t}){const n=df.indexOf(e),r=()=>{const i=df[n-1];n>0&&i!==void 0&&t(i)},a=()=>{const i=df[n+1];n<df.length-1&&i!==void 0&&t(i)};return p.jsxs("div",{className:"flex items-center gap-1 px-3 py-1",children:[p.jsx("button",{onClick:r,disabled:n===0,className:"rounded p-0.5 text-on-surface-variant hover:text-on-surface disabled:opacity-30","aria-label":"Decrease density",children:p.jsx(VP,{className:"h-3 w-3"})}),p.jsx("div",{className:"flex flex-1 justify-center",children:p.jsx("span",{className:"text-xs text-on-surface-variant select-none",children:qF[e]})}),p.jsx("button",{onClick:a,disabled:n===df.length-1,className:"rounded p-0.5 text-on-surface-variant hover:text-on-surface disabled:opacity-30","aria-label":"Increase density",children:p.jsx(YP,{className:"h-3 w-3"})})]})}function vT({collapsed:e,vaultName:t,density:n,setDensity:r,onSearchOpen:a,onCollapseToggle:i,showCollapseToggle:l}){return p.jsxs(p.Fragment,{children:[p.jsx("div",{className:Ae("px-4 py-5",e&&"px-2 py-4 flex justify-center"),children:e?p.jsxs("div",{className:"relative flex items-center",children:[p.jsx("span",{className:"font-serif text-base text-primary",children:"m"}),p.jsx("span",{className:"ml-1 h-2 w-2 rounded-full bg-on-surface-variant/40"})]}):p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center",children:[p.jsx("span",{className:"font-serif text-base text-primary tracking-wider",children:"myco"}),p.jsx("span",{className:"ml-2 h-2 w-2 rounded-full bg-on-surface-variant/40"})]}),t&&p.jsx("span",{className:"font-mono text-xs text-outline uppercase tracking-widest mt-0.5",children:t})]})}),p.jsx("div",{className:"px-2 pt-2 pb-1",children:p.jsxs("button",{type:"button",onClick:a,title:e?"Search (⌘K)":void 0,className:Ae("flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface",e?"justify-center px-2 py-2":"gap-3 px-3 py-2"),children:[p.jsx(nc,{className:"h-4 w-4 shrink-0"}),!e&&p.jsx("span",{className:"flex-1 text-left",children:"Search"}),!e&&p.jsxs("kbd",{className:"text-xs text-on-surface-variant/60 font-mono",children:["⌘","K"]})]})}),p.jsx("nav",{className:"flex-1 space-y-1 px-2 py-2","aria-label":"Main navigation",children:IF.map(o=>p.jsxs(rD,{to:o.to,end:o.to==="/",title:e?o.label:void 0,className:({isActive:f})=>Ae("flex items-center rounded-md text-sm font-medium transition-colors",e?"justify-center px-2 py-2":"gap-3 px-3 py-2",f?"bg-primary/10 text-primary":"text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface"),children:[p.jsx(o.icon,{className:"h-4 w-4 shrink-0"}),!e&&o.label]},o.to))}),p.jsxs("div",{className:Ae("py-3 space-y-1 mt-auto",e?"px-1 flex flex-col items-center":"px-2"),children:[p.jsx(ZF,{collapsed:e}),!e&&p.jsx(JF,{}),!e&&p.jsx(e6,{density:n,setDensity:r}),p.jsx(WF,{collapsed:e})]}),l&&i&&p.jsx("div",{className:Ae("px-2 py-2",e&&"flex justify-center"),children:p.jsxs(et,{variant:"ghost",size:"sm",onClick:i,className:Ae("text-on-surface-variant hover:text-on-surface",e?"w-8 p-0 justify-center":"w-full justify-start gap-2"),title:e?"Expand sidebar":"Collapse sidebar",children:[e?p.jsx(wa,{className:"h-4 w-4"}):p.jsx(o1,{className:"h-4 w-4"}),!e&&p.jsx("span",{children:"Collapse"})]})})]})}function t6(){const{collapsed:e,toggle:t}=YF(),{density:n,setDensity:r}=$F(),{data:a}=xp(),i=a==null?void 0:a.vault.name,[l,o]=R.useState(!1),f=KF();R.useEffect(()=>{const d=v=>{(v.metaKey||v.ctrlKey)&&v.key==="k"&&(v.preventDefault(),o(m=>!m))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]),R.useEffect(()=>{if(!f.open)return;const d=v=>{v.key==="Escape"&&(v.preventDefault(),f.close())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[f.open,f.close]);const c=R.useCallback(()=>o(!0),[]);return p.jsxs("div",{className:"flex h-screen bg-background",children:[p.jsx(zF,{open:l,onOpenChange:o}),f.isMobile&&p.jsxs("div",{className:"fixed top-0 left-0 right-0 z-40 flex h-12 items-center gap-3 border-b border-outline-variant/20 bg-surface-container px-3",children:[p.jsx("button",{type:"button",onClick:f.toggle,className:"rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface","aria-label":f.open?"Close navigation":"Open navigation",children:f.open?p.jsx(rc,{className:"h-5 w-5"}):p.jsx(UP,{className:"h-5 w-5"})}),p.jsx("span",{className:"font-serif text-base text-primary tracking-wider",children:"myco"}),i&&p.jsx("span",{className:"font-mono text-[10px] text-outline uppercase tracking-widest",children:i}),p.jsx("button",{type:"button",onClick:c,className:"ml-auto rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface","aria-label":"Search",children:p.jsx(nc,{className:"h-4 w-4"})})]}),f.isMobile&&f.open&&p.jsx("div",{className:"fixed inset-0 z-40 bg-surface-dim/60 backdrop-blur-sm transition-opacity",onClick:f.close,"aria-hidden":"true"}),f.isMobile&&p.jsx("aside",{className:Ae("fixed top-12 left-0 bottom-0 z-50 w-64 flex flex-col bg-surface-container transition-transform duration-200 ease-out",f.open?"translate-x-0":"-translate-x-full"),children:p.jsx(vT,{collapsed:!1,vaultName:i,density:n,setDensity:r,onSearchOpen:c,showCollapseToggle:!1})}),!f.isMobile&&p.jsx("aside",{className:Ae("flex flex-col bg-surface-container transition-[width] duration-200",e?"w-14":"w-56"),children:p.jsx(vT,{collapsed:e,vaultName:i,density:n,setDensity:r,onSearchOpen:c,onCollapseToggle:t,showCollapseToggle:!0})}),p.jsx("main",{className:Ae("flex-1 overflow-auto bg-surface",f.isMobile&&"pt-12"),"aria-label":"Page content",children:p.jsx(O4,{})})]})}function yj({isLoading:e,error:t,loadingText:n="Loading...",children:r}){return e?p.jsxs("div",{className:"flex h-64 items-center justify-center gap-2 text-on-surface-variant",children:[p.jsx(Xn,{className:"h-5 w-5 animate-spin"}),p.jsx("span",{className:"font-sans text-sm",children:n})]}):t?p.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-2 text-tertiary",children:[p.jsx(Qi,{className:"h-5 w-5"}),p.jsx("span",{className:"font-sans text-sm",children:"Failed to connect to daemon"}),p.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:t.message})]}):p.jsx(p.Fragment,{children:r})}const Zs=60,Su=3600,jf=86400,ga=1e3;function C1(e){if(e<Zs)return`${Math.floor(e)}s`;if(e<Su)return`${Math.floor(e/Zs)}m`;if(e<jf){const r=Math.floor(e/Su),a=Math.floor(e%Su/Zs);return`${r}h ${a}m`}const t=Math.floor(e/jf),n=Math.floor(e%jf/Su);return`${t}d ${n}h`}function T1(e){const t=(Date.now()-new Date(e).getTime())/ga;return t<Zs?"just now":t<Su?`${Math.floor(t/Zs)}m ago`:t<jf?`${Math.floor(t/Su)}h ago`:`${Math.floor(t/jf)}d ago`}function ii(e){return T1(new Date(e*ga).toISOString())}function sb(e){return new Date(e*ga).toLocaleString()}function lb(e,t){return e?e.length>t?e.slice(0,t)+"…":e:""}function N1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ap(e,t){if(e===null||t===null)return"—";const n=(t-e)*ga;if(n<ga)return`${n}ms`;if(n<Zs*ga)return`${(n/ga).toFixed(1)}s`;const r=Math.floor(n/(Zs*ga)),a=Math.floor(n%(Zs*ga)/ga);return`${r}m ${a}s`}function n6(e){return e===null?"—":e<ga?`${e}ms`:`${(e/ga).toFixed(1)}s`}function Hv(e,t){if(e.trim()==="")return t;const n=Number(e);return Number.isFinite(n)?n:t}function xj(e){return e!==null?ii(e):"—"}const pT=100,r6=1;function a6(e){const{embedded_count:t,total_embeddable:n}=e.embedding;return n===0?pT:Number((t/n*pT).toFixed(r6))}function i6(e){const t=e.agent.last_run_status==="error",n=e.embedding.queue_depth>0||e.unprocessed_batches>0;return t?"Issues detected in the network":n?"Work in progress across the network":"Network Topology Active"}function s6(e){return e.embedding.queue_depth>0||e.unprocessed_batches>0}function l6({active:e}){const t=e?"animate-pulse-slow":"";return p.jsxs("svg",{className:"absolute inset-0 w-full h-full opacity-20 pointer-events-none",viewBox:"0 0 400 300",preserveAspectRatio:"xMidYMid slice",children:[p.jsx("path",{d:"M200,280 Q200,220 200,160",fill:"none",stroke:"var(--primary)",strokeWidth:"2",className:t}),p.jsx("path",{d:"M200,200 Q240,170 280,180",fill:"none",stroke:"var(--primary)",strokeWidth:"1.5",className:t}),p.jsx("path",{d:"M200,170 Q160,140 120,155",fill:"none",stroke:"var(--primary)",strokeWidth:"1.5",className:t}),p.jsx("path",{d:"M200,160 Q230,110 270,90",fill:"none",stroke:"var(--secondary)",strokeWidth:"1",className:t}),p.jsx("path",{d:"M200,160 Q170,110 130,80",fill:"none",stroke:"var(--secondary)",strokeWidth:"1",className:t}),p.jsx("path",{d:"M280,180 Q310,170 340,190",fill:"none",stroke:"var(--tertiary)",strokeWidth:"0.8",opacity:"0.5"}),p.jsx("path",{d:"M120,155 Q90,145 60,160",fill:"none",stroke:"var(--tertiary)",strokeWidth:"0.8",opacity:"0.5"}),p.jsx("circle",{cx:"280",cy:"180",r:"3",fill:"var(--primary)",opacity:"0.7"}),p.jsx("circle",{cx:"120",cy:"155",r:"3",fill:"var(--secondary)",opacity:"0.7"}),p.jsx("circle",{cx:"270",cy:"90",r:"2.5",fill:"var(--tertiary)",opacity:"0.6"}),p.jsx("circle",{cx:"130",cy:"80",r:"2.5",fill:"var(--secondary)",opacity:"0.6"}),p.jsx("circle",{cx:"340",cy:"190",r:"2",fill:"var(--tertiary)",opacity:"0.4"}),p.jsx("circle",{cx:"60",cy:"160",r:"2",fill:"var(--primary)",opacity:"0.4"}),p.jsx("circle",{cx:"200",cy:"160",r:"4",fill:"var(--primary)",className:e?"animate-pulse":""})]})}function o6({stats:e}){const t=a6(e),n=i6(e),r=s6(e),a=e.daemon.active_sessions.length,i=C1(e.daemon.uptime_seconds);return p.jsxs("section",{className:"relative flex items-center justify-center rounded-xl overflow-hidden glass-panel border border-outline-variant/10 min-h-[320px]",children:[p.jsx(l6,{active:r}),p.jsxs("div",{className:"text-center relative z-20 space-y-3 py-12",children:[p.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] text-on-surface-variant/80",children:n}),p.jsx("h1",{className:"font-serif text-5xl italic text-on-surface drop-shadow-sm",children:"Myco"}),p.jsxs("p",{className:"font-mono text-sm text-outline",children:["Node connectivity at ",t,"% capacity"]}),p.jsxs("div",{className:"flex items-center justify-center gap-6 pt-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"h-2 w-2 rounded-full bg-sage shadow-sage-glow animate-pulse"}),p.jsxs("span",{className:"font-mono text-[11px] text-on-surface/70",children:[a," active ",a===1?"session":"sessions"]})]}),p.jsx("div",{className:"h-3 w-px bg-outline-variant/30"}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs("span",{className:"font-mono text-[11px] text-on-surface/70",children:[e.vault.spore_count," spores"]})}),p.jsx("div",{className:"h-3 w-px bg-outline-variant/30"}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs("span",{className:"font-mono text-[11px] text-on-surface/70",children:["uptime ",i]})})]})]})]})}function u6({data:e,width:t=120,height:n=40,className:r}){if(e.length<2)return null;const a=Math.min(...e),l=Math.max(...e)-a||1,o=e.map((d,v)=>({x:v/(e.length-1)*t,y:n-(d-a)/l*n}));let f=`M ${o[0].x} ${o[0].y}`;for(let d=0;d<o.length-1;d++){const v=o[Math.max(0,d-1)],m=o[d],y=o[d+1],x=o[Math.min(o.length-1,d+2)],S=m.x+(y.x-v.x)/6,w=m.y+(y.y-v.y)/6,b=y.x-(x.x-m.x)/6,C=y.y-(x.y-m.y)/6;f+=` C ${S} ${w}, ${b} ${C}, ${y.x} ${y.y}`}const c=`${f} L ${t} ${n} L 0 ${n} Z`;return p.jsxs("svg",{width:t,height:n,className:r,viewBox:`0 0 ${t} ${n}`,children:[p.jsx("defs",{children:p.jsxs("linearGradient",{id:"sparkline-fill",x1:"0",y1:"0",x2:"0",y2:"1",children:[p.jsx("stop",{offset:"0%",stopColor:"var(--primary)",stopOpacity:"0.2"}),p.jsx("stop",{offset:"100%",stopColor:"var(--primary)",stopOpacity:"0"})]})}),p.jsx("path",{d:c,fill:"url(#sparkline-fill)"}),p.jsx("path",{d:f,fill:"none",stroke:"var(--primary)",strokeWidth:"1.5",strokeOpacity:"0.8"})]})}const c6={sage:"border-t-sage",ochre:"border-t-ochre",terracotta:"border-t-terracotta",outline:"border-t-outline"},f6={sage:"text-sage",ochre:"text-ochre",terracotta:"text-terracotta",outline:"text-on-surface"};function En({label:e,value:t,sublabel:n,accent:r,sparklineData:a,className:i,href:l}){const o=Ae("rounded-lg border border-outline-variant/10 bg-surface-container/60 p-4 border-t-2 transition-[border-color,background-color] duration-200 hover:border-outline-variant/25 hover:bg-surface-container/80",l&&"cursor-pointer",c6[r],i),f=p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-outline mb-2",children:e}),p.jsxs("div",{className:"flex items-end justify-between gap-2",children:[p.jsx("p",{className:Ae("font-serif text-2xl font-bold",f6[r]),children:t}),a&&a.length>=2&&p.jsx(u6,{data:a,width:80,height:28,className:"opacity-60"})]}),n&&p.jsx("p",{className:"font-mono text-[10px] text-outline mt-1",children:n})]});return l?p.jsx(mp,{to:l,className:Ae(o,"block no-underline"),children:f}):p.jsx("div",{className:o,children:f})}function d6({stats:e}){const t=e.embedding.total_embeddable>0?Math.round(e.embedding.embedded_count/e.embedding.total_embeddable*100):0,n=e.digest.tiers_available.length>0?`${e.digest.tiers_available.length} tiers`:"None",r=e.agent.last_run_at?ii(e.agent.last_run_at):"Never";return p.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:[p.jsx(En,{label:"Sessions",value:String(e.vault.session_count),sublabel:`${e.daemon.active_sessions.length} active`,accent:"sage",href:"/sessions"}),p.jsx(En,{label:"Spores",value:String(e.vault.spore_count),sublabel:`${e.vault.entity_count} entities`,accent:"sage",href:"/mycelium?tab=spores"}),p.jsx(En,{label:"Embedding",value:`${t}%`,sublabel:`${e.embedding.embedded_count}/${e.embedding.total_embeddable}`,accent:e.embedding.queue_depth>0?"ochre":"sage",href:"/operations"}),p.jsx(En,{label:"Agent",value:`${e.agent.total_runs}`,sublabel:`last: ${r}`,accent:e.agent.last_run_status==="error"?"terracotta":"outline",href:"/agent"}),p.jsx(En,{label:"Digest",value:n,sublabel:e.digest.generated_at?ii(e.digest.generated_at):void 0,accent:"outline",href:"/mycelium?tab=digest"}),p.jsx(En,{label:"Uptime",value:C1(e.daemon.uptime_seconds),sublabel:`v${e.daemon.version}`,accent:"outline"})]})}function bj(e=20){return ui({queryKey:["activity",e],queryFn:({signal:t})=>Et(`/activity?limit=${e}`,{signal:t}),refetchInterval:Ea.STATS,pollCategory:"standard"})}function h6(e){return e==="agent_run"?"ochre":e==="spore"?"sage":e.includes("error")||e.includes("fail")?"terracotta":"sage"}function v6(e){switch(e){case"sage":return{label:"STABLE",dotClass:"bg-sage shadow-sage-glow"};case"ochre":return{label:"ACTIVE",dotClass:"bg-ochre shadow-ochre-glow"};case"terracotta":return{label:"WARNING",dotClass:"bg-terracotta shadow-terracotta-glow"}}}const p6={sage:"border-l-sage",ochre:"border-l-ochre",terracotta:"border-l-terracotta"},m6={sage:"text-sage",ochre:"text-ochre",terracotta:"text-terracotta"},g6={sage:"text-sage",ochre:"text-ochre",terracotta:"text-terracotta"},y6={sage:"border-sage/20",ochre:"border-ochre/20",terracotta:"border-terracotta/20"};function x6(e){return`#${e.slice(-6).toUpperCase()}`}function mT(e){return e.summary}function b6({event:e}){const t=vl(),n=h6(e.type),r=v6(n),a=ii(e.timestamp),i=e.type==="session"?`/sessions/${e.id}`:e.type==="agent_run"?"/agent":e.type==="spore"?"/mycelium":null;return p.jsxs("div",{className:Ae("p-5 rounded-lg border-l-4 bg-surface-container/60 hover:bg-surface-container-high group hover-lift transition-colors",i&&"cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",p6[n]),onClick:()=>i&&t(i),onKeyDown:l=>{i&&(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(i))},tabIndex:i?0:void 0,role:i?"link":void 0,"aria-label":`${mT(e)} - ${r.label} - ${a}`,children:[p.jsxs("div",{className:"flex justify-between items-start mb-3",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("p",{className:Ae("font-mono text-xs font-bold",m6[n]),children:x6(e.id)}),p.jsx("h4",{className:"font-serif text-lg text-on-surface leading-tight mt-0.5 truncate",children:mT(e)})]}),p.jsx("div",{className:Ae("w-8 h-8 rounded-full border-2 flex items-center justify-center shrink-0 ml-3",y6[n]),children:p.jsx("div",{className:Ae("w-3.5 h-3.5 rounded-full",r.dotClass)})})]}),p.jsxs("p",{className:"text-xs text-on-surface/60 line-clamp-2 leading-relaxed italic mb-3",children:["> ",e.type.replace(/_/g," ")," event recorded ",a]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("span",{className:Ae("px-2 py-0.5 bg-surface-container-highest text-[10px] font-mono rounded",g6[n]),children:r.label}),p.jsx("span",{className:"px-2 py-0.5 bg-surface-container-highest text-[10px] font-mono text-outline rounded",children:a})]})]})}const gT=6,w6=3;function S6(){return p.jsxs("div",{className:"p-5 rounded-lg border-l-4 border-l-outline-variant/30 bg-surface-container/40 animate-pulse",children:[p.jsxs("div",{className:"flex justify-between items-start mb-3",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"h-3 w-16 rounded bg-surface-container-high"}),p.jsx("div",{className:"h-5 w-40 rounded bg-surface-container-high"})]}),p.jsx("div",{className:"w-8 h-8 rounded-full bg-surface-container-high"})]}),p.jsx("div",{className:"h-3 w-3/4 rounded bg-surface-container-high/60 mb-3"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("div",{className:"h-5 w-16 rounded bg-surface-container-high/60"}),p.jsx("div",{className:"h-5 w-12 rounded bg-surface-container-high/60"})]})]})}function E6(){const{data:e,isLoading:t}=bj(gT*2),n=(e??[]).filter(r=>r.type!=="agent_run").slice(0,gT);return p.jsxs("section",{className:"space-y-5",children:[p.jsx("div",{className:"flex items-end justify-between border-b border-outline-variant/10 pb-4",children:p.jsxs("div",{children:[p.jsx("h3",{className:"font-serif text-3xl text-on-surface",children:"Session Pods"}),p.jsx("p",{className:"font-mono text-[10px] uppercase text-outline mt-1",children:"Monitoring concurrent thread activity"})]})}),t?p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:Array.from({length:w6}).map((r,a)=>p.jsx(S6,{},a))}):n.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-3",children:[p.jsxs("div",{className:"relative",children:[p.jsx(yD,{className:"h-10 w-10 text-outline/30"}),p.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-3 w-3 rounded-full bg-surface-container border-2 border-surface"})]}),p.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:"No recent activity"}),p.jsx("p",{className:"font-mono text-[10px] uppercase text-outline tracking-wider",children:"Pods appear as sessions and spores are captured"})]}):p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:n.map(r=>p.jsx(b6,{event:r},r.id))})]})}const C6=Ea.STATS,T6=Ea.HEALTH,N6=Ea.STATS,k1=new Set(["completed","failed","skipped"]),k6=Ea.STATS,A1=6e4,A6=50;function wj(e){const t=(e==null?void 0:e.limit)??A6,n=new URLSearchParams;n.set("limit",String(t)),(e==null?void 0:e.offset)!==void 0&&n.set("offset",String(e.offset)),e!=null&&e.search&&n.set("search",e.search),e!=null&&e.status&&n.set("status",e.status),e!=null&&e.task&&n.set("task",e.task);const r=n.toString();return ui({queryKey:["agent-runs",e],queryFn:({signal:a})=>Et(`/agent/runs?${r}`,{signal:a}),pollCategory:"standard",refetchInterval:C6})}function R6(e){return mn({queryKey:["agent-run",e],queryFn:({signal:n})=>Et(`/agent/runs/${e}`,{signal:n}),enabled:e!==void 0,refetchInterval:n=>{var a,i;const r=(i=(a=n.state.data)==null?void 0:a.run)==null?void 0:i.status;return r&&k1.has(r)?!1:T6}})}function D6(e,t){const n=t?k1.has(t):!1;return ui({queryKey:["agent-reports",e],queryFn:({signal:r})=>Et(`/agent/runs/${e}/reports`,{signal:r}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:n?0:N6})}function j6(e,t){const n=t?k1.has(t):!1;return ui({queryKey:["agent-turns",e],queryFn:({signal:r})=>Et(`/agent/runs/${e}/turns`,{signal:r}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:n?0:k6})}function ic(){return mn({queryKey:["agent-tasks"],queryFn:({signal:e})=>Et("/agent/tasks",{signal:e}),staleTime:A1})}function M6(e){return mn({queryKey:["agent-task",e],queryFn:({signal:t})=>Et(`/agent/tasks/${e}`,{signal:t}),enabled:e!==void 0,staleTime:A1})}function O6(){const e=oi();return hl({mutationFn:({taskId:t,name:n})=>qi(`/agent/tasks/${t}/copy`,n?{name:n}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-tasks"]})}})}function L6(){const e=oi();return hl({mutationFn:t=>wD(`/agent/tasks/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-tasks"]})}})}function _6(e){return mn({queryKey:["agent-task-yaml",e],queryFn:({signal:t})=>Et(`/agent/tasks/${e}/yaml`,{signal:t}),enabled:e!==void 0,staleTime:A1})}function B6(){const e=oi();return hl({mutationFn:({taskId:t,yaml:n})=>f1(`/agent/tasks/${t}`,{yaml:n}),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-tasks"]}),e.invalidateQueries({queryKey:["agent-task"]}),e.invalidateQueries({queryKey:["agent-task-yaml"]})}})}function R1(){const e=oi();return hl({mutationFn:t=>qi("/agent/run",t),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-runs"]})}})}function D1(e){return e===null?"—":`$${e.toFixed(4)}`}function j1(e){return e===null?"—":e.toLocaleString()}function Sj(e){switch(e){case"completed":return"default";case"running":return"warning";case"failed":return"destructive";default:return"secondary"}}function Ej(e){return e===d1?"warning":"secondary"}const Cj="Default task";function Tj(e,t){if(!e)return Cj;const n=t.find(r=>r.name===e);return(n==null?void 0:n.displayName)??e}const P6=5,yT={running:"bg-sage animate-pulse",completed:"bg-sage",failed:"bg-terracotta",skipped:"bg-outline/40",pending:"bg-outline/40"};function z6({run:e,taskName:t,onClick:n}){const r=yT[e.status]??yT.pending;return p.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-outline-variant/5 last:border-0 cursor-pointer hover:bg-surface-container-high/50 -mx-2 px-2 rounded transition-colors",onClick:n,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n())},role:"link",tabIndex:0,"aria-label":`View run: ${t}`,children:[p.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[p.jsx("span",{className:Ae("h-2 w-2 shrink-0 rounded-full",r)}),p.jsx("span",{className:"text-sm text-on-surface truncate",children:t})]}),p.jsxs("div",{className:"flex items-center gap-3 shrink-0 font-mono text-[11px] text-outline",children:[p.jsx("span",{children:e.started_at!==null?ii(e.started_at):"—"}),p.jsx("span",{children:Ap(e.started_at,e.completed_at)})]})]})}function I6(){const{data:e,isLoading:t}=wj({limit:P6}),{data:n}=ic(),r=vl(),a=(n==null?void 0:n.tasks)??[],i=(e==null?void 0:e.runs)??[];return p.jsxs("div",{className:"glass-panel p-6 rounded-xl border border-outline-variant/10",children:[p.jsxs("div",{className:"flex justify-between items-center mb-6",children:[p.jsx("h4",{className:"font-serif text-xl text-on-surface",children:"Agent Runs"}),p.jsx(dd,{className:"h-5 w-5 text-outline"})]}),t?p.jsx("div",{className:"font-mono text-[11px] text-outline py-4",children:"Loading runs..."}):i.length===0?p.jsx("div",{className:"font-mono text-[11px] text-outline py-4",children:"No agent runs yet"}):p.jsx("div",{children:i.map(l=>p.jsx(z6,{run:l,taskName:Tj(l.task,a),onClick:()=>r("/agent")},l.id))})]})}const F6=12,q6=8;function U6(e){return e.includes("error")||e.includes("fail")?"error":e==="agent_run"?"warn":"ok"}const V6={ok:"[OK]",warn:"[WRN]",error:"[ERR]"},H6={ok:"text-sage",warn:"text-ochre",error:"text-terracotta"};function G6(e){return new Date(e*1e3).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function $6(e){return e.type==="session"?`/sessions/${e.id}`:e.type==="agent_run"?"/agent":e.type==="spore"?"/mycelium":null}function Y6({event:e,onClick:t}){const n=U6(e.type);return p.jsxs("div",{className:Ae("flex gap-4 items-start border-b border-outline-variant/5 pb-2 font-mono text-[11px] transition-all duration-150",t&&"cursor-pointer hover:bg-surface-container-high/50 hover:translate-x-1 -mx-2 px-2 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40"),onClick:t,onKeyDown:t?r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),t())}:void 0,tabIndex:t?0:void 0,role:t?"link":void 0,"aria-label":t?`${e.type.replace(/_/g," ")}: ${e.summary}`:void 0,children:[p.jsx("span",{className:"text-outline shrink-0 tabular-nums",children:G6(e.timestamp)}),p.jsx("span",{className:Ae("shrink-0 font-bold",H6[n]),children:V6[n]}),p.jsx("span",{className:"text-on-surface/70 truncate",children:e.summary})]})}function K6(){const{data:e,isLoading:t}=bj(F6),n=vl(),r=(e==null?void 0:e.slice(0,q6))??[];return p.jsxs("div",{className:"glass-panel p-6 rounded-xl border border-outline-variant/10 transition-[border-color] duration-200 hover:border-outline-variant/25",children:[p.jsxs("div",{className:"flex justify-between items-center mb-6",children:[p.jsx("h4",{className:"font-serif text-xl text-on-surface",children:"System Integrity Logs"}),p.jsx("span",{className:"text-[10px] font-mono text-sage px-2 py-1 bg-sage-muted rounded",children:"LIVE"})]}),t?p.jsx("div",{className:"space-y-3",children:[1,2,3].map(a=>p.jsxs("div",{className:"flex gap-4 items-start pb-2 animate-pulse",children:[p.jsx("div",{className:"h-3 w-14 rounded bg-surface-container-high/50"}),p.jsx("div",{className:"h-3 w-8 rounded bg-surface-container-high/50"}),p.jsx("div",{className:"h-3 flex-1 rounded bg-surface-container-high/40"})]},a))}):r.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-2",children:[p.jsx(xD,{className:"h-8 w-8 text-outline/20"}),p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"No log entries yet"})]}):p.jsx("div",{className:"space-y-3",children:r.map(a=>{const i=$6(a);return p.jsx(Y6,{event:a,onClick:i?()=>n(i):void 0},a.id)})})]})}function X6(e){const{embedded_count:t,total_embeddable:n}=e.embedding;if(n===0)return"Initializing";const r=t/n;return r>=.95?"Optimal":r>=.7?"Good":"Degraded"}function Q6({stats:e}){const t=X6(e);return p.jsxs("div",{className:"flex items-center justify-between px-2 py-3 border-t border-outline-variant/10",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("span",{className:"font-mono text-[10px] uppercase text-sage",children:["System Connectivity: ",t]}),p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-sage animate-pulse"})]}),p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx("span",{className:"font-mono text-[10px] uppercase text-outline/50",children:e.vault.name}),p.jsxs("span",{className:"font-mono text-[10px] uppercase text-outline/50",children:["v",e.daemon.version]})]})]})}function W6(){const{data:e,isLoading:t,isError:n,error:r}=xp();return p.jsx(yj,{isLoading:t,error:n?r instanceof Error?r:new Error("Unable to reach daemon"):null,loadingText:"Connecting to daemon...",children:e&&p.jsxs("div",{className:"relative min-h-full",children:[p.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.04]",children:p.jsxs("svg",{height:"100%",width:"100%",viewBox:"0 0 800 800",preserveAspectRatio:"none",children:[p.jsx("path",{className:"mycelial-connector",d:"M400 800C400 600 300 500 200 400C100 300 0 400 0 400",fill:"none",stroke:"#abcfb8",strokeWidth:"1"}),p.jsx("path",{className:"mycelial-connector",d:"M400 800C400 600 500 500 600 400C700 300 800 400 800 400",fill:"none",stroke:"#abcfb8",strokeWidth:"1"}),p.jsx("path",{className:"mycelial-connector",d:"M400 800C400 500 450 300 400 100",fill:"none",stroke:"#abcfb8",strokeWidth:"1"})]})}),p.jsxs("div",{className:"relative z-10 p-6 lg:p-8 max-w-7xl mx-auto space-y-10",children:[p.jsx(o6,{stats:e}),p.jsx(d6,{stats:e}),p.jsx(E6,{}),p.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[p.jsx(I6,{}),p.jsx(K6,{})]}),p.jsx(Q6,{stats:e})]})]})})}const Z6=bp("rounded-md transition-colors",{variants:{level:{lowest:"bg-surface-container-lowest",low:"bg-surface-container-low",default:"bg-surface-container",high:"bg-surface-container-high",highest:"bg-surface-container-highest",bright:"bg-surface-bright"},interactive:{true:"cursor-pointer hover-lift hover:brightness-[1.08]",false:""},ghostBorder:{true:"border border-[var(--ghost-border)]",false:""},glass:{true:"backdrop-blur-xl bg-surface-variant/60",false:""},glow:{true:"shadow-[inset_0_0_12px_rgba(171,207,184,0.2)]",false:""}},defaultVariants:{level:"low",interactive:!1,ghostBorder:!1,glass:!1,glow:!1}}),dt=R.forwardRef(({className:e,level:t,interactive:n,ghostBorder:r,glass:a,glow:i,...l},o)=>p.jsx("div",{ref:o,className:Ae(Z6({level:t,interactive:n,ghostBorder:r,glass:a,glow:i}),e),...l}));dt.displayName="Surface";function J6({tabs:e,activeTab:t,onTabChange:n,className:r}){return p.jsx("div",{className:Ae("flex items-center gap-6",r),children:e.map(a=>p.jsx("button",{onClick:()=>n(a.id),className:Ae("pb-2 font-sans text-sm font-medium transition-colors border-b-2",t===a.id?"text-primary border-primary":"text-on-surface-variant border-transparent hover:text-on-surface"),children:a.label},a.id))})}function al({title:e,subtitle:t,tabs:n,activeTab:r,onTabChange:a,actions:i,className:l}){return p.jsxs("div",{className:Ae("pb-6",l),children:[p.jsxs("div",{className:"flex items-start justify-between",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"font-serif text-2xl font-normal text-on-surface tracking-wide",children:e}),t&&p.jsx("p",{className:"mt-1 font-sans text-sm text-on-surface-variant",children:t})]}),i&&p.jsx("div",{className:"flex items-center gap-2",children:i})]}),n&&r&&a&&p.jsx(J6,{tabs:n,activeTab:r,onTabChange:a,className:"mt-4"})]})}function Nj({open:e,onOpenChange:t,title:n,description:r,icon:a,meta:i,impact:l,confirmLabel:o="Confirm",variant:f="destructive",onConfirm:c,isPending:d=!1}){var v,m;return p.jsx(Tp,{open:e,onOpenChange:t,children:p.jsxs(hd,{className:"sm:max-w-md border border-outline-variant/20 [&>button:last-child]:hidden",children:[p.jsxs(Np,{children:[p.jsxs("div",{className:"flex items-center gap-3",children:[a&&p.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-tertiary/15",children:a}),p.jsx(vd,{children:n})]}),p.jsx(E1,{children:r})]}),i&&i.length>0&&p.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-outline-variant/20 px-4 py-3",children:[p.jsx("span",{className:"font-mono text-xs text-on-surface-variant bg-surface-container px-1.5 py-0.5 rounded shrink-0",children:(v=i[0])==null?void 0:v.value}),i.length>1&&p.jsx("span",{className:"text-sm font-medium text-on-surface truncate",children:(m=i[1])==null?void 0:m.value})]}),l&&l.length>0&&p.jsx("div",{className:"grid grid-cols-2 gap-2",children:l.map(y=>p.jsxs("div",{className:"rounded-md border border-outline-variant/20 px-3 py-2",children:[p.jsx("div",{className:"font-sans text-[10px] font-medium uppercase tracking-wider text-on-surface-variant",children:y.label}),p.jsx("div",{className:"font-sans text-base font-medium text-on-surface",children:y.value})]},y.label))}),p.jsxs(kp,{children:[p.jsx(et,{variant:"secondary",size:"sm",onClick:()=>t(!1),disabled:d,children:"Cancel"}),p.jsxs(et,{variant:f,size:"sm",onClick:c,disabled:d,className:"gap-2",children:[d&&p.jsx(Xn,{className:"h-4 w-4 animate-spin"}),o]})]})]})})}function xT(e,[t,n]){return Math.min(n,Math.max(t,e))}function eq(e){const t=e+"CollectionProvider",[n,r]=wp(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=S=>{const{scope:w,children:b}=S,C=_i.useRef(null),T=_i.useRef(new Map).current;return p.jsx(a,{scope:w,itemMap:T,collectionRef:C,children:b})};l.displayName=t;const o=e+"CollectionSlot",f=Uf(o),c=_i.forwardRef((S,w)=>{const{scope:b,children:C}=S,T=i(o,b),k=Cn(w,T.collectionRef);return p.jsx(f,{ref:k,children:C})});c.displayName=o;const d=e+"CollectionItemSlot",v="data-radix-collection-item",m=Uf(d),y=_i.forwardRef((S,w)=>{const{scope:b,children:C,...T}=S,k=_i.useRef(null),D=Cn(w,k),A=i(d,b);return _i.useEffect(()=>(A.itemMap.set(k,{ref:k,...T}),()=>void A.itemMap.delete(k))),p.jsx(m,{[v]:"",ref:D,children:C})});y.displayName=d;function x(S){const w=i(e+"CollectionConsumer",S);return _i.useCallback(()=>{const C=w.collectionRef.current;if(!C)return[];const T=Array.from(C.querySelectorAll(`[${v}]`));return Array.from(w.itemMap.values()).sort((A,j)=>T.indexOf(A.ref.current)-T.indexOf(j.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:l,Slot:c,ItemSlot:y},x,r]}var tq=R.createContext(void 0);function nq(e){const t=R.useContext(tq);return e||t||"ltr"}const rq=["top","right","bottom","left"],il=Math.min,Zr=Math.max,Gv=Math.round,Jh=Math.floor,ri=e=>({x:e,y:e}),aq={left:"right",right:"left",bottom:"top",top:"bottom"};function ob(e,t,n){return Zr(e,il(t,n))}function Gi(e,t){return typeof e=="function"?e(t):e}function $i(e){return e.split("-")[0]}function sc(e){return e.split("-")[1]}function M1(e){return e==="x"?"y":"x"}function O1(e){return e==="y"?"height":"width"}function ei(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function L1(e){return M1(ei(e))}function iq(e,t,n){n===void 0&&(n=!1);const r=sc(e),a=L1(e),i=O1(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=$v(l)),[l,$v(l)]}function sq(e){const t=$v(e);return[ub(e),t,ub(t)]}function ub(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const bT=["left","right"],wT=["right","left"],lq=["top","bottom"],oq=["bottom","top"];function uq(e,t,n){switch(e){case"top":case"bottom":return n?t?wT:bT:t?bT:wT;case"left":case"right":return t?lq:oq;default:return[]}}function cq(e,t,n,r){const a=sc(e);let i=uq($i(e),n==="start",r);return a&&(i=i.map(l=>l+"-"+a),t&&(i=i.concat(i.map(ub)))),i}function $v(e){const t=$i(e);return aq[t]+e.slice(t.length)}function fq(e){return{top:0,right:0,bottom:0,left:0,...e}}function kj(e){return typeof e!="number"?fq(e):{top:e,right:e,bottom:e,left:e}}function Yv(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function ST(e,t,n){let{reference:r,floating:a}=e;const i=ei(t),l=L1(t),o=O1(l),f=$i(t),c=i==="y",d=r.x+r.width/2-a.width/2,v=r.y+r.height/2-a.height/2,m=r[o]/2-a[o]/2;let y;switch(f){case"top":y={x:d,y:r.y-a.height};break;case"bottom":y={x:d,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:v};break;case"left":y={x:r.x-a.width,y:v};break;default:y={x:r.x,y:r.y}}switch(sc(t)){case"start":y[l]-=m*(n&&c?-1:1);break;case"end":y[l]+=m*(n&&c?-1:1);break}return y}async function dq(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:i,rects:l,elements:o,strategy:f}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:v="floating",altBoundary:m=!1,padding:y=0}=Gi(t,e),x=kj(y),w=o[m?v==="floating"?"reference":"floating":v],b=Yv(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:d,strategy:f})),C=v==="floating"?{x:r,y:a,width:l.floating.width,height:l.floating.height}:l.reference,T=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),k=await(i.isElement==null?void 0:i.isElement(T))?await(i.getScale==null?void 0:i.getScale(T))||{x:1,y:1}:{x:1,y:1},D=Yv(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:C,offsetParent:T,strategy:f}):C);return{top:(b.top-D.top+x.top)/k.y,bottom:(D.bottom-b.bottom+x.bottom)/k.y,left:(b.left-D.left+x.left)/k.x,right:(D.right-b.right+x.right)/k.x}}const hq=50,vq=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:l}=n,o=l.detectOverflow?l:{...l,detectOverflow:dq},f=await(l.isRTL==null?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:v}=ST(c,r,f),m=r,y=0;const x={};for(let S=0;S<i.length;S++){const w=i[S];if(!w)continue;const{name:b,fn:C}=w,{x:T,y:k,data:D,reset:A}=await C({x:d,y:v,initialPlacement:r,placement:m,strategy:a,middlewareData:x,rects:c,platform:o,elements:{reference:e,floating:t}});d=T??d,v=k??v,x[b]={...x[b],...D},A&&y<hq&&(y++,typeof A=="object"&&(A.placement&&(m=A.placement),A.rects&&(c=A.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:a}):A.rects),{x:d,y:v}=ST(c,m,f)),S=-1)}return{x:d,y:v,placement:m,strategy:a,middlewareData:x}},pq=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:i,platform:l,elements:o,middlewareData:f}=t,{element:c,padding:d=0}=Gi(e,t)||{};if(c==null)return{};const v=kj(d),m={x:n,y:r},y=L1(a),x=O1(y),S=await l.getDimensions(c),w=y==="y",b=w?"top":"left",C=w?"bottom":"right",T=w?"clientHeight":"clientWidth",k=i.reference[x]+i.reference[y]-m[y]-i.floating[x],D=m[y]-i.reference[y],A=await(l.getOffsetParent==null?void 0:l.getOffsetParent(c));let j=A?A[T]:0;(!j||!await(l.isElement==null?void 0:l.isElement(A)))&&(j=o.floating[T]||i.floating[x]);const L=k/2-D/2,_=j/2-S[x]/2-1,M=il(v[b],_),z=il(v[C],_),P=M,G=j-S[x]-z,I=j/2-S[x]/2+L,F=ob(P,I,G),B=!f.arrow&&sc(a)!=null&&I!==F&&i.reference[x]/2-(I<P?M:z)-S[x]/2<0,H=B?I<P?I-P:I-G:0;return{[y]:m[y]+H,data:{[y]:F,centerOffset:I-F-H,...B&&{alignmentOffset:H}},reset:B}}}),mq=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:i,rects:l,initialPlacement:o,platform:f,elements:c}=t,{mainAxis:d=!0,crossAxis:v=!0,fallbackPlacements:m,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:S=!0,...w}=Gi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=$i(a),C=ei(o),T=$i(o)===o,k=await(f.isRTL==null?void 0:f.isRTL(c.floating)),D=m||(T||!S?[$v(o)]:sq(o)),A=x!=="none";!m&&A&&D.push(...cq(o,S,x,k));const j=[o,...D],L=await f.detectOverflow(t,w),_=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&_.push(L[b]),v){const I=iq(a,l,k);_.push(L[I[0]],L[I[1]])}if(M=[...M,{placement:a,overflows:_}],!_.every(I=>I<=0)){var z,P;const I=(((z=i.flip)==null?void 0:z.index)||0)+1,F=j[I];if(F&&(!(v==="alignment"?C!==ei(F):!1)||M.every(K=>ei(K.placement)===C?K.overflows[0]>0:!0)))return{data:{index:I,overflows:M},reset:{placement:F}};let B=(P=M.filter(H=>H.overflows[0]<=0).sort((H,K)=>H.overflows[1]-K.overflows[1])[0])==null?void 0:P.placement;if(!B)switch(y){case"bestFit":{var G;const H=(G=M.filter(K=>{if(A){const Q=ei(K.placement);return Q===C||Q==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(Q=>Q>0).reduce((Q,V)=>Q+V,0)]).sort((K,Q)=>K[1]-Q[1])[0])==null?void 0:G[0];H&&(B=H);break}case"initialPlacement":B=o;break}if(a!==B)return{reset:{placement:B}}}return{}}}};function ET(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function CT(e){return rq.some(t=>e[t]>=0)}const gq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:a="referenceHidden",...i}=Gi(e,t);switch(a){case"referenceHidden":{const l=await r.detectOverflow(t,{...i,elementContext:"reference"}),o=ET(l,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:CT(o)}}}case"escaped":{const l=await r.detectOverflow(t,{...i,altBoundary:!0}),o=ET(l,n.floating);return{data:{escapedOffsets:o,escaped:CT(o)}}}default:return{}}}}},Aj=new Set(["left","top"]);async function yq(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=$i(n),o=sc(n),f=ei(n)==="y",c=Aj.has(l)?-1:1,d=i&&f?-1:1,v=Gi(t,e);let{mainAxis:m,crossAxis:y,alignmentAxis:x}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return o&&typeof x=="number"&&(y=o==="end"?x*-1:x),f?{x:y*d,y:m*c}:{x:m*c,y:y*d}}const xq=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:i,placement:l,middlewareData:o}=t,f=await yq(t,e);return l===((n=o.offset)==null?void 0:n.placement)&&(r=o.arrow)!=null&&r.alignmentOffset?{}:{x:a+f.x,y:i+f.y,data:{...f,placement:l}}}}},bq=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a,platform:i}=t,{mainAxis:l=!0,crossAxis:o=!1,limiter:f={fn:b=>{let{x:C,y:T}=b;return{x:C,y:T}}},...c}=Gi(e,t),d={x:n,y:r},v=await i.detectOverflow(t,c),m=ei($i(a)),y=M1(m);let x=d[y],S=d[m];if(l){const b=y==="y"?"top":"left",C=y==="y"?"bottom":"right",T=x+v[b],k=x-v[C];x=ob(T,x,k)}if(o){const b=m==="y"?"top":"left",C=m==="y"?"bottom":"right",T=S+v[b],k=S-v[C];S=ob(T,S,k)}const w=f.fn({...t,[y]:x,[m]:S});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[y]:l,[m]:o}}}}}},wq=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:i,middlewareData:l}=t,{offset:o=0,mainAxis:f=!0,crossAxis:c=!0}=Gi(e,t),d={x:n,y:r},v=ei(a),m=M1(v);let y=d[m],x=d[v];const S=Gi(o,t),w=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(f){const T=m==="y"?"height":"width",k=i.reference[m]-i.floating[T]+w.mainAxis,D=i.reference[m]+i.reference[T]-w.mainAxis;y<k?y=k:y>D&&(y=D)}if(c){var b,C;const T=m==="y"?"width":"height",k=Aj.has($i(a)),D=i.reference[v]-i.floating[T]+(k&&((b=l.offset)==null?void 0:b[v])||0)+(k?0:w.crossAxis),A=i.reference[v]+i.reference[T]+(k?0:((C=l.offset)==null?void 0:C[v])||0)-(k?w.crossAxis:0);x<D?x=D:x>A&&(x=A)}return{[m]:y,[v]:x}}}},Sq=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:i,platform:l,elements:o}=t,{apply:f=()=>{},...c}=Gi(e,t),d=await l.detectOverflow(t,c),v=$i(a),m=sc(a),y=ei(a)==="y",{width:x,height:S}=i.floating;let w,b;v==="top"||v==="bottom"?(w=v,b=m===(await(l.isRTL==null?void 0:l.isRTL(o.floating))?"start":"end")?"left":"right"):(b=v,w=m==="end"?"top":"bottom");const C=S-d.top-d.bottom,T=x-d.left-d.right,k=il(S-d[w],C),D=il(x-d[b],T),A=!t.middlewareData.shift;let j=k,L=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=C),A&&!m){const M=Zr(d.left,0),z=Zr(d.right,0),P=Zr(d.top,0),G=Zr(d.bottom,0);y?L=x-2*(M!==0||z!==0?M+z:Zr(d.left,d.right)):j=S-2*(P!==0||G!==0?P+G:Zr(d.top,d.bottom))}await f({...t,availableWidth:L,availableHeight:j});const _=await l.getDimensions(o.floating);return x!==_.width||S!==_.height?{reset:{rects:!0}}:{}}}};function Rp(){return typeof window<"u"}function lc(e){return Rj(e)?(e.nodeName||"").toLowerCase():"#document"}function Jr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ci(e){var t;return(t=(Rj(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Rj(e){return Rp()?e instanceof Node||e instanceof Jr(e).Node:!1}function Oa(e){return Rp()?e instanceof Element||e instanceof Jr(e).Element:!1}function Wi(e){return Rp()?e instanceof HTMLElement||e instanceof Jr(e).HTMLElement:!1}function TT(e){return!Rp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Jr(e).ShadowRoot}function pd(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=La(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function Eq(e){return/^(table|td|th)$/.test(lc(e))}function Dp(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Cq=/transform|translate|scale|rotate|perspective|filter/,Tq=/paint|layout|strict|content/,Fl=e=>!!e&&e!=="none";let Ly;function _1(e){const t=Oa(e)?La(e):e;return Fl(t.transform)||Fl(t.translate)||Fl(t.scale)||Fl(t.rotate)||Fl(t.perspective)||!B1()&&(Fl(t.backdropFilter)||Fl(t.filter))||Cq.test(t.willChange||"")||Tq.test(t.contain||"")}function Nq(e){let t=sl(e);for(;Wi(t)&&!Ku(t);){if(_1(t))return t;if(Dp(t))return null;t=sl(t)}return null}function B1(){return Ly==null&&(Ly=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ly}function Ku(e){return/^(html|body|#document)$/.test(lc(e))}function La(e){return Jr(e).getComputedStyle(e)}function jp(e){return Oa(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sl(e){if(lc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||TT(e)&&e.host||ci(e);return TT(t)?t.host:t}function Dj(e){const t=sl(e);return Ku(t)?e.ownerDocument?e.ownerDocument.body:e.body:Wi(t)&&pd(t)?t:Dj(t)}function Vf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=Dj(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),l=Jr(a);if(i){const o=cb(l);return t.concat(l,l.visualViewport||[],pd(a)?a:[],o&&n?Vf(o):[])}else return t.concat(a,Vf(a,[],n))}function cb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function jj(e){const t=La(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Wi(e),i=a?e.offsetWidth:n,l=a?e.offsetHeight:r,o=Gv(n)!==i||Gv(r)!==l;return o&&(n=i,r=l),{width:n,height:r,$:o}}function P1(e){return Oa(e)?e:e.contextElement}function Ru(e){const t=P1(e);if(!Wi(t))return ri(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=jj(t);let l=(i?Gv(n.width):n.width)/r,o=(i?Gv(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!o||!Number.isFinite(o))&&(o=1),{x:l,y:o}}const kq=ri(0);function Mj(e){const t=Jr(e);return!B1()||!t.visualViewport?kq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Aq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Jr(e)?!1:t}function fo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=P1(e);let l=ri(1);t&&(r?Oa(r)&&(l=Ru(r)):l=Ru(e));const o=Aq(i,n,r)?Mj(i):ri(0);let f=(a.left+o.x)/l.x,c=(a.top+o.y)/l.y,d=a.width/l.x,v=a.height/l.y;if(i){const m=Jr(i),y=r&&Oa(r)?Jr(r):r;let x=m,S=cb(x);for(;S&&r&&y!==x;){const w=Ru(S),b=S.getBoundingClientRect(),C=La(S),T=b.left+(S.clientLeft+parseFloat(C.paddingLeft))*w.x,k=b.top+(S.clientTop+parseFloat(C.paddingTop))*w.y;f*=w.x,c*=w.y,d*=w.x,v*=w.y,f+=T,c+=k,x=Jr(S),S=cb(x)}}return Yv({width:d,height:v,x:f,y:c})}function Mp(e,t){const n=jp(e).scrollLeft;return t?t.left+n:fo(ci(e)).left+n}function Oj(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Mp(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function Rq(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",l=ci(r),o=t?Dp(t.floating):!1;if(r===l||o&&i)return n;let f={scrollLeft:0,scrollTop:0},c=ri(1);const d=ri(0),v=Wi(r);if((v||!v&&!i)&&((lc(r)!=="body"||pd(l))&&(f=jp(r)),v)){const y=fo(r);c=Ru(r),d.x=y.x+r.clientLeft,d.y=y.y+r.clientTop}const m=l&&!v&&!i?Oj(l,f):ri(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-f.scrollLeft*c.x+d.x+m.x,y:n.y*c.y-f.scrollTop*c.y+d.y+m.y}}function Dq(e){return Array.from(e.getClientRects())}function jq(e){const t=ci(e),n=jp(e),r=e.ownerDocument.body,a=Zr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Zr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Mp(e);const o=-n.scrollTop;return La(r).direction==="rtl"&&(l+=Zr(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:l,y:o}}const NT=25;function Mq(e,t){const n=Jr(e),r=ci(e),a=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,o=0,f=0;if(a){i=a.width,l=a.height;const d=B1();(!d||d&&t==="fixed")&&(o=a.offsetLeft,f=a.offsetTop)}const c=Mp(r);if(c<=0){const d=r.ownerDocument,v=d.body,m=getComputedStyle(v),y=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,x=Math.abs(r.clientWidth-v.clientWidth-y);x<=NT&&(i-=x)}else c<=NT&&(i+=c);return{width:i,height:l,x:o,y:f}}function Oq(e,t){const n=fo(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=Wi(e)?Ru(e):ri(1),l=e.clientWidth*i.x,o=e.clientHeight*i.y,f=a*i.x,c=r*i.y;return{width:l,height:o,x:f,y:c}}function kT(e,t,n){let r;if(t==="viewport")r=Mq(e,n);else if(t==="document")r=jq(ci(e));else if(Oa(t))r=Oq(t,n);else{const a=Mj(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Yv(r)}function Lj(e,t){const n=sl(e);return n===t||!Oa(n)||Ku(n)?!1:La(n).position==="fixed"||Lj(n,t)}function Lq(e,t){const n=t.get(e);if(n)return n;let r=Vf(e,[],!1).filter(o=>Oa(o)&&lc(o)!=="body"),a=null;const i=La(e).position==="fixed";let l=i?sl(e):e;for(;Oa(l)&&!Ku(l);){const o=La(l),f=_1(l);!f&&o.position==="fixed"&&(a=null),(i?!f&&!a:!f&&o.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||pd(l)&&!f&&Lj(e,l))?r=r.filter(d=>d!==l):a=o,l=sl(l)}return t.set(e,r),r}function _q(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?Dp(t)?[]:Lq(t,this._c):[].concat(n),r],o=kT(t,l[0],a);let f=o.top,c=o.right,d=o.bottom,v=o.left;for(let m=1;m<l.length;m++){const y=kT(t,l[m],a);f=Zr(y.top,f),c=il(y.right,c),d=il(y.bottom,d),v=Zr(y.left,v)}return{width:c-v,height:d-f,x:v,y:f}}function Bq(e){const{width:t,height:n}=jj(e);return{width:t,height:n}}function Pq(e,t,n){const r=Wi(t),a=ci(t),i=n==="fixed",l=fo(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const f=ri(0);function c(){f.x=Mp(a)}if(r||!r&&!i)if((lc(t)!=="body"||pd(a))&&(o=jp(t)),r){const y=fo(t,!0,i,t);f.x=y.x+t.clientLeft,f.y=y.y+t.clientTop}else a&&c();i&&!r&&a&&c();const d=a&&!r&&!i?Oj(a,o):ri(0),v=l.left+o.scrollLeft-f.x-d.x,m=l.top+o.scrollTop-f.y-d.y;return{x:v,y:m,width:l.width,height:l.height}}function _y(e){return La(e).position==="static"}function AT(e,t){if(!Wi(e)||La(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ci(e)===n&&(n=n.ownerDocument.body),n}function _j(e,t){const n=Jr(e);if(Dp(e))return n;if(!Wi(e)){let a=sl(e);for(;a&&!Ku(a);){if(Oa(a)&&!_y(a))return a;a=sl(a)}return n}let r=AT(e,t);for(;r&&Eq(r)&&_y(r);)r=AT(r,t);return r&&Ku(r)&&_y(r)&&!_1(r)?n:r||Nq(e)||n}const zq=async function(e){const t=this.getOffsetParent||_j,n=this.getDimensions,r=await n(e.floating);return{reference:Pq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Iq(e){return La(e).direction==="rtl"}const Fq={convertOffsetParentRelativeRectToViewportRelativeRect:Rq,getDocumentElement:ci,getClippingRect:_q,getOffsetParent:_j,getElementRects:zq,getClientRects:Dq,getDimensions:Bq,getScale:Ru,isElement:Oa,isRTL:Iq};function Bj(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function qq(e,t){let n=null,r;const a=ci(e);function i(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function l(o,f){o===void 0&&(o=!1),f===void 0&&(f=1),i();const c=e.getBoundingClientRect(),{left:d,top:v,width:m,height:y}=c;if(o||t(),!m||!y)return;const x=Jh(v),S=Jh(a.clientWidth-(d+m)),w=Jh(a.clientHeight-(v+y)),b=Jh(d),T={rootMargin:-x+"px "+-S+"px "+-w+"px "+-b+"px",threshold:Zr(0,il(1,f))||1};let k=!0;function D(A){const j=A[0].intersectionRatio;if(j!==f){if(!k)return l();j?l(!1,j):r=setTimeout(()=>{l(!1,1e-7)},1e3)}j===1&&!Bj(c,e.getBoundingClientRect())&&l(),k=!1}try{n=new IntersectionObserver(D,{...T,root:a.ownerDocument})}catch{n=new IntersectionObserver(D,T)}n.observe(e)}return l(!0),i}function Uq(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:f=!1}=r,c=P1(e),d=a||i?[...c?Vf(c):[],...t?Vf(t):[]]:[];d.forEach(b=>{a&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const v=c&&o?qq(c,n):null;let m=-1,y=null;l&&(y=new ResizeObserver(b=>{let[C]=b;C&&C.target===c&&y&&t&&(y.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var T;(T=y)==null||T.observe(t)})),n()}),c&&!f&&y.observe(c),t&&y.observe(t));let x,S=f?fo(e):null;f&&w();function w(){const b=fo(e);S&&!Bj(S,b)&&n(),S=b,x=requestAnimationFrame(w)}return n(),()=>{var b;d.forEach(C=>{a&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),v==null||v(),(b=y)==null||b.disconnect(),y=null,f&&cancelAnimationFrame(x)}}const Vq=xq,Hq=bq,Gq=mq,$q=Sq,Yq=gq,RT=pq,Kq=wq,Xq=(e,t,n)=>{const r=new Map,a={platform:Fq,...n},i={...a.platform,_c:r};return vq(e,t,{...a,platform:i})};var Qq=typeof document<"u",Wq=function(){},Tv=Qq?R.useLayoutEffect:Wq;function Kv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Kv(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&e.$$typeof)&&!Kv(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Pj(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function DT(e,t){const n=Pj(e);return Math.round(t*n)/n}function By(e){const t=R.useRef(e);return Tv(()=>{t.current=e}),t}function Zq(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:l}={},transform:o=!0,whileElementsMounted:f,open:c}=e,[d,v]=R.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,y]=R.useState(r);Kv(m,r)||y(r);const[x,S]=R.useState(null),[w,b]=R.useState(null),C=R.useCallback(K=>{K!==A.current&&(A.current=K,S(K))},[]),T=R.useCallback(K=>{K!==j.current&&(j.current=K,b(K))},[]),k=i||x,D=l||w,A=R.useRef(null),j=R.useRef(null),L=R.useRef(d),_=f!=null,M=By(f),z=By(a),P=By(c),G=R.useCallback(()=>{if(!A.current||!j.current)return;const K={placement:t,strategy:n,middleware:m};z.current&&(K.platform=z.current),Xq(A.current,j.current,K).then(Q=>{const V={...Q,isPositioned:P.current!==!1};I.current&&!Kv(L.current,V)&&(L.current=V,fd.flushSync(()=>{v(V)}))})},[m,t,n,z,P]);Tv(()=>{c===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,v(K=>({...K,isPositioned:!1})))},[c]);const I=R.useRef(!1);Tv(()=>(I.current=!0,()=>{I.current=!1}),[]),Tv(()=>{if(k&&(A.current=k),D&&(j.current=D),k&&D){if(M.current)return M.current(k,D,G);G()}},[k,D,G,M,_]);const F=R.useMemo(()=>({reference:A,floating:j,setReference:C,setFloating:T}),[C,T]),B=R.useMemo(()=>({reference:k,floating:D}),[k,D]),H=R.useMemo(()=>{const K={position:n,left:0,top:0};if(!B.floating)return K;const Q=DT(B.floating,d.x),V=DT(B.floating,d.y);return o?{...K,transform:"translate("+Q+"px, "+V+"px)",...Pj(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Q,top:V}},[n,o,B.floating,d.x,d.y]);return R.useMemo(()=>({...d,update:G,refs:F,elements:B,floatingStyles:H}),[d,G,F,B,H])}const Jq=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?RT({element:r.current,padding:a}).fn(n):{}:r?RT({element:r,padding:a}).fn(n):{}}}},eU=(e,t)=>{const n=Vq(e);return{name:n.name,fn:n.fn,options:[e,t]}},tU=(e,t)=>{const n=Hq(e);return{name:n.name,fn:n.fn,options:[e,t]}},nU=(e,t)=>({fn:Kq(e).fn,options:[e,t]}),rU=(e,t)=>{const n=Gq(e);return{name:n.name,fn:n.fn,options:[e,t]}},aU=(e,t)=>{const n=$q(e);return{name:n.name,fn:n.fn,options:[e,t]}},iU=(e,t)=>{const n=Yq(e);return{name:n.name,fn:n.fn,options:[e,t]}},sU=(e,t)=>{const n=Jq(e);return{name:n.name,fn:n.fn,options:[e,t]}};var lU="Arrow",zj=R.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...i}=e;return p.jsx(Kt.svg,{...i,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});zj.displayName=lU;var oU=zj;function uU(e){const[t,n]=R.useState(void 0);return vr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let l,o;if("borderBoxSize"in i){const f=i.borderBoxSize,c=Array.isArray(f)?f[0]:f;l=c.inlineSize,o=c.blockSize}else l=e.offsetWidth,o=e.offsetHeight;n({width:l,height:o})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var z1="Popper",[Ij,Fj]=wp(z1),[cU,qj]=Ij(z1),Uj=e=>{const{__scopePopper:t,children:n}=e,[r,a]=R.useState(null);return p.jsx(cU,{scope:t,anchor:r,onAnchorChange:a,children:n})};Uj.displayName=z1;var Vj="PopperAnchor",Hj=R.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,i=qj(Vj,n),l=R.useRef(null),o=Cn(t,l),f=R.useRef(null);return R.useEffect(()=>{const c=f.current;f.current=(r==null?void 0:r.current)||l.current,c!==f.current&&i.onAnchorChange(f.current)}),r?null:p.jsx(Kt.div,{...a,ref:o})});Hj.displayName=Vj;var I1="PopperContent",[fU,dU]=Ij(I1),Gj=R.forwardRef((e,t)=>{var ae,we,fe,J,ne,re;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:l=0,arrowPadding:o=0,avoidCollisions:f=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:v="partial",hideWhenDetached:m=!1,updatePositionStrategy:y="optimized",onPlaced:x,...S}=e,w=qj(I1,n),[b,C]=R.useState(null),T=Cn(t,ge=>C(ge)),[k,D]=R.useState(null),A=uU(k),j=(A==null?void 0:A.width)??0,L=(A==null?void 0:A.height)??0,_=r+(i!=="center"?"-"+i:""),M=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},z=Array.isArray(c)?c:[c],P=z.length>0,G={padding:M,boundary:z.filter(vU),altBoundary:P},{refs:I,floatingStyles:F,placement:B,isPositioned:H,middlewareData:K}=Zq({strategy:"fixed",placement:_,whileElementsMounted:(...ge)=>Uq(...ge,{animationFrame:y==="always"}),elements:{reference:w.anchor},middleware:[eU({mainAxis:a+L,alignmentAxis:l}),f&&tU({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?nU():void 0,...G}),f&&rU({...G}),aU({...G,apply:({elements:ge,rects:Ne,availableWidth:Be,availableHeight:st})=>{const{width:Qe,height:Ke}=Ne.reference,qe=ge.floating.style;qe.setProperty("--radix-popper-available-width",`${Be}px`),qe.setProperty("--radix-popper-available-height",`${st}px`),qe.setProperty("--radix-popper-anchor-width",`${Qe}px`),qe.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),k&&sU({element:k,padding:o}),pU({arrowWidth:j,arrowHeight:L}),m&&iU({strategy:"referenceHidden",...G})]}),[Q,V]=Kj(B),q=uo(x);vr(()=>{H&&(q==null||q())},[H,q]);const X=(ae=K.arrow)==null?void 0:ae.x,U=(we=K.arrow)==null?void 0:we.y,te=((fe=K.arrow)==null?void 0:fe.centerOffset)!==0,[ie,oe]=R.useState();return vr(()=>{b&&oe(window.getComputedStyle(b).zIndex)},[b]),p.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:H?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[(J=K.transformOrigin)==null?void 0:J.x,(ne=K.transformOrigin)==null?void 0:ne.y].join(" "),...((re=K.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(fU,{scope:n,placedSide:Q,onArrowChange:D,arrowX:X,arrowY:U,shouldHideArrow:te,children:p.jsx(Kt.div,{"data-side":Q,"data-align":V,...S,ref:T,style:{...S.style,animation:H?void 0:"none"}})})})});Gj.displayName=I1;var $j="PopperArrow",hU={top:"bottom",right:"left",bottom:"top",left:"right"},Yj=R.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,i=dU($j,r),l=hU[i.placedSide];return p.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:p.jsx(oU,{...a,ref:n,style:{...a.style,display:"block"}})})});Yj.displayName=$j;function vU(e){return e!==null}var pU=e=>({name:"transformOrigin",options:e,fn(t){var w,b,C;const{placement:n,rects:r,middlewareData:a}=t,l=((w=a.arrow)==null?void 0:w.centerOffset)!==0,o=l?0:e.arrowWidth,f=l?0:e.arrowHeight,[c,d]=Kj(n),v={start:"0%",center:"50%",end:"100%"}[d],m=(((b=a.arrow)==null?void 0:b.x)??0)+o/2,y=(((C=a.arrow)==null?void 0:C.y)??0)+f/2;let x="",S="";return c==="bottom"?(x=l?v:`${m}px`,S=`${-f}px`):c==="top"?(x=l?v:`${m}px`,S=`${r.floating.height+f}px`):c==="right"?(x=`${-f}px`,S=l?v:`${y}px`):c==="left"&&(x=`${r.floating.width+f}px`,S=l?v:`${y}px`),{data:{x,y:S}}}});function Kj(e){const[t,n="center"]=e.split("-");return[t,n]}var mU=Uj,gU=Hj,yU=Gj,xU=Yj;function bU(e){const t=R.useRef({value:e,previous:e});return R.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Xj=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),wU="VisuallyHidden",SU=R.forwardRef((e,t)=>p.jsx(Kt.span,{...e,ref:t,style:{...Xj,...e.style}}));SU.displayName=wU;var EU=[" ","Enter","ArrowUp","ArrowDown"],CU=[" ","Enter"],ho="Select",[Op,Lp,TU]=eq(ho),[oc]=wp(ho,[TU,Fj]),_p=Fj(),[NU,pl]=oc(ho),[kU,AU]=oc(ho),Qj=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:i,value:l,defaultValue:o,onValueChange:f,dir:c,name:d,autoComplete:v,disabled:m,required:y,form:x}=e,S=_p(t),[w,b]=R.useState(null),[C,T]=R.useState(null),[k,D]=R.useState(!1),A=nq(c),[j,L]=Uv({prop:r,defaultProp:a??!1,onChange:i,caller:ho}),[_,M]=Uv({prop:l,defaultProp:o,onChange:f,caller:ho}),z=R.useRef(null),P=w?x||!!w.closest("form"):!0,[G,I]=R.useState(new Set),F=Array.from(G).map(B=>B.props.value).join(";");return p.jsx(mU,{...S,children:p.jsxs(NU,{required:y,scope:t,trigger:w,onTriggerChange:b,valueNode:C,onValueNodeChange:T,valueNodeHasChildren:k,onValueNodeHasChildrenChange:D,contentId:ku(),value:_,onValueChange:M,open:j,onOpenChange:L,dir:A,triggerPointerDownPosRef:z,disabled:m,children:[p.jsx(Op.Provider,{scope:t,children:p.jsx(kU,{scope:e.__scopeSelect,onNativeOptionAdd:R.useCallback(B=>{I(H=>new Set(H).add(B))},[]),onNativeOptionRemove:R.useCallback(B=>{I(H=>{const K=new Set(H);return K.delete(B),K})},[]),children:n})}),P?p.jsxs(mM,{"aria-hidden":!0,required:y,tabIndex:-1,name:d,autoComplete:v,value:_,onChange:B=>M(B.target.value),disabled:m,form:x,children:[_===void 0?p.jsx("option",{value:""}):null,Array.from(G)]},F):null]})})};Qj.displayName=ho;var Wj="SelectTrigger",Zj=R.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,i=_p(n),l=pl(Wj,n),o=l.disabled||r,f=Cn(t,l.onTriggerChange),c=Lp(n),d=R.useRef("touch"),[v,m,y]=yM(S=>{const w=c().filter(T=>!T.disabled),b=w.find(T=>T.value===l.value),C=xM(w,S,b);C!==void 0&&l.onValueChange(C.value)}),x=S=>{o||(l.onOpenChange(!0),y()),S&&(l.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return p.jsx(gU,{asChild:!0,...i,children:p.jsx(Kt.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":gM(l.value)?"":void 0,...a,ref:f,onClick:Wt(a.onClick,S=>{S.currentTarget.focus(),d.current!=="mouse"&&x(S)}),onPointerDown:Wt(a.onPointerDown,S=>{d.current=S.pointerType;const w=S.target;w.hasPointerCapture(S.pointerId)&&w.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(x(S),S.preventDefault())}),onKeyDown:Wt(a.onKeyDown,S=>{const w=v.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&m(S.key),!(w&&S.key===" ")&&EU.includes(S.key)&&(x(),S.preventDefault())})})})});Zj.displayName=Wj;var Jj="SelectValue",eM=R.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:l="",...o}=e,f=pl(Jj,n),{onValueNodeHasChildrenChange:c}=f,d=i!==void 0,v=Cn(t,f.onValueNodeChange);return vr(()=>{c(d)},[c,d]),p.jsx(Kt.span,{...o,ref:v,style:{pointerEvents:"none"},children:gM(f.value)?p.jsx(p.Fragment,{children:l}):i})});eM.displayName=Jj;var RU="SelectIcon",tM=R.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return p.jsx(Kt.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})});tM.displayName=RU;var DU="SelectPortal",nM=e=>p.jsx(y1,{asChild:!0,...e});nM.displayName=DU;var vo="SelectContent",rM=R.forwardRef((e,t)=>{const n=pl(vo,e.__scopeSelect),[r,a]=R.useState();if(vr(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?fd.createPortal(p.jsx(aM,{scope:e.__scopeSelect,children:p.jsx(Op.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),i):null}return p.jsx(iM,{...e,ref:t})});rM.displayName=vo;var ka=10,[aM,ml]=oc(vo),jU="SelectContentImpl",MU=Uf("SelectContent.RemoveScroll"),iM=R.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:l,side:o,sideOffset:f,align:c,alignOffset:d,arrowPadding:v,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:S,avoidCollisions:w,...b}=e,C=pl(vo,n),[T,k]=R.useState(null),[D,A]=R.useState(null),j=Cn(t,ae=>k(ae)),[L,_]=R.useState(null),[M,z]=R.useState(null),P=Lp(n),[G,I]=R.useState(!1),F=R.useRef(!1);R.useEffect(()=>{if(T)return GD(T)},[T]),BD();const B=R.useCallback(ae=>{const[we,...fe]=P().map(re=>re.ref.current),[J]=fe.slice(-1),ne=document.activeElement;for(const re of ae)if(re===ne||(re==null||re.scrollIntoView({block:"nearest"}),re===we&&D&&(D.scrollTop=0),re===J&&D&&(D.scrollTop=D.scrollHeight),re==null||re.focus(),document.activeElement!==ne))return},[P,D]),H=R.useCallback(()=>B([L,T]),[B,L,T]);R.useEffect(()=>{G&&H()},[G,H]);const{onOpenChange:K,triggerPointerDownPosRef:Q}=C;R.useEffect(()=>{if(T){let ae={x:0,y:0};const we=J=>{var ne,re;ae={x:Math.abs(Math.round(J.pageX)-(((ne=Q.current)==null?void 0:ne.x)??0)),y:Math.abs(Math.round(J.pageY)-(((re=Q.current)==null?void 0:re.y)??0))}},fe=J=>{ae.x<=10&&ae.y<=10?J.preventDefault():T.contains(J.target)||K(!1),document.removeEventListener("pointermove",we),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",we),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",we),document.removeEventListener("pointerup",fe,{capture:!0})}}},[T,K,Q]),R.useEffect(()=>{const ae=()=>K(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[K]);const[V,q]=yM(ae=>{const we=P().filter(ne=>!ne.disabled),fe=we.find(ne=>ne.ref.current===document.activeElement),J=xM(we,ae,fe);J&&setTimeout(()=>J.ref.current.focus())}),X=R.useCallback((ae,we,fe)=>{const J=!F.current&&!fe;(C.value!==void 0&&C.value===we||J)&&(_(ae),J&&(F.current=!0))},[C.value]),U=R.useCallback(()=>T==null?void 0:T.focus(),[T]),te=R.useCallback((ae,we,fe)=>{const J=!F.current&&!fe;(C.value!==void 0&&C.value===we||J)&&z(ae)},[C.value]),ie=r==="popper"?fb:sM,oe=ie===fb?{side:o,sideOffset:f,align:c,alignOffset:d,arrowPadding:v,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:S,avoidCollisions:w}:{};return p.jsx(aM,{scope:n,content:T,viewport:D,onViewportChange:A,itemRefCallback:X,selectedItem:L,onItemLeave:U,itemTextRefCallback:te,focusSelectedItem:H,selectedItemText:M,position:r,isPositioned:G,searchRef:V,children:p.jsx(x1,{as:MU,allowPinchZoom:!0,children:p.jsx(g1,{asChild:!0,trapped:C.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:Wt(a,ae=>{var we;(we=C.trigger)==null||we.focus({preventScroll:!0}),ae.preventDefault()}),children:p.jsx(m1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:p.jsx(ie,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:ae=>ae.preventDefault(),...b,...oe,onPlaced:()=>I(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Wt(b.onKeyDown,ae=>{const we=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!we&&ae.key.length===1&&q(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let J=P().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(J=J.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const ne=ae.target,re=J.indexOf(ne);J=J.slice(re+1)}setTimeout(()=>B(J)),ae.preventDefault()}})})})})})})});iM.displayName=jU;var OU="SelectItemAlignedPosition",sM=R.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,i=pl(vo,n),l=ml(vo,n),[o,f]=R.useState(null),[c,d]=R.useState(null),v=Cn(t,j=>d(j)),m=Lp(n),y=R.useRef(!1),x=R.useRef(!0),{viewport:S,selectedItem:w,selectedItemText:b,focusSelectedItem:C}=l,T=R.useCallback(()=>{if(i.trigger&&i.valueNode&&o&&c&&S&&w&&b){const j=i.trigger.getBoundingClientRect(),L=c.getBoundingClientRect(),_=i.valueNode.getBoundingClientRect(),M=b.getBoundingClientRect();if(i.dir!=="rtl"){const ne=M.left-L.left,re=_.left-ne,ge=j.left-re,Ne=j.width+ge,Be=Math.max(Ne,L.width),st=window.innerWidth-ka,Qe=xT(re,[ka,Math.max(ka,st-Be)]);o.style.minWidth=Ne+"px",o.style.left=Qe+"px"}else{const ne=L.right-M.right,re=window.innerWidth-_.right-ne,ge=window.innerWidth-j.right-re,Ne=j.width+ge,Be=Math.max(Ne,L.width),st=window.innerWidth-ka,Qe=xT(re,[ka,Math.max(ka,st-Be)]);o.style.minWidth=Ne+"px",o.style.right=Qe+"px"}const z=m(),P=window.innerHeight-ka*2,G=S.scrollHeight,I=window.getComputedStyle(c),F=parseInt(I.borderTopWidth,10),B=parseInt(I.paddingTop,10),H=parseInt(I.borderBottomWidth,10),K=parseInt(I.paddingBottom,10),Q=F+B+G+K+H,V=Math.min(w.offsetHeight*5,Q),q=window.getComputedStyle(S),X=parseInt(q.paddingTop,10),U=parseInt(q.paddingBottom,10),te=j.top+j.height/2-ka,ie=P-te,oe=w.offsetHeight/2,ae=w.offsetTop+oe,we=F+B+ae,fe=Q-we;if(we<=te){const ne=z.length>0&&w===z[z.length-1].ref.current;o.style.bottom="0px";const re=c.clientHeight-S.offsetTop-S.offsetHeight,ge=Math.max(ie,oe+(ne?U:0)+re+H),Ne=we+ge;o.style.height=Ne+"px"}else{const ne=z.length>0&&w===z[0].ref.current;o.style.top="0px";const ge=Math.max(te,F+S.offsetTop+(ne?X:0)+oe)+fe;o.style.height=ge+"px",S.scrollTop=we-te+S.offsetTop}o.style.margin=`${ka}px 0`,o.style.minHeight=V+"px",o.style.maxHeight=P+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[m,i.trigger,i.valueNode,o,c,S,w,b,i.dir,r]);vr(()=>T(),[T]);const[k,D]=R.useState();vr(()=>{c&&D(window.getComputedStyle(c).zIndex)},[c]);const A=R.useCallback(j=>{j&&x.current===!0&&(T(),C==null||C(),x.current=!1)},[T,C]);return p.jsx(_U,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:y,onScrollButtonChange:A,children:p.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:p.jsx(Kt.div,{...a,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});sM.displayName=OU;var LU="SelectPopperPosition",fb=R.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=ka,...i}=e,l=_p(n);return p.jsx(yU,{...l,...i,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});fb.displayName=LU;var[_U,F1]=oc(vo,{}),db="SelectViewport",lM=R.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...a}=e,i=ml(db,n),l=F1(db,n),o=Cn(t,i.onViewportChange),f=R.useRef(0);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),p.jsx(Op.Slot,{scope:n,children:p.jsx(Kt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Wt(a.onScroll,c=>{const d=c.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:m}=l;if(m!=null&&m.current&&v){const y=Math.abs(f.current-d.scrollTop);if(y>0){const x=window.innerHeight-ka*2,S=parseFloat(v.style.minHeight),w=parseFloat(v.style.height),b=Math.max(S,w);if(b<x){const C=b+y,T=Math.min(x,C),k=C-T;v.style.height=T+"px",v.style.bottom==="0px"&&(d.scrollTop=k>0?k:0,v.style.justifyContent="flex-end")}}}f.current=d.scrollTop})})})]})});lM.displayName=db;var oM="SelectGroup",[BU,PU]=oc(oM),zU=R.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=ku();return p.jsx(BU,{scope:n,id:a,children:p.jsx(Kt.div,{role:"group","aria-labelledby":a,...r,ref:t})})});zU.displayName=oM;var uM="SelectLabel",IU=R.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=PU(uM,n);return p.jsx(Kt.div,{id:a.id,...r,ref:t})});IU.displayName=uM;var Xv="SelectItem",[FU,cM]=oc(Xv),fM=R.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...l}=e,o=pl(Xv,n),f=ml(Xv,n),c=o.value===r,[d,v]=R.useState(i??""),[m,y]=R.useState(!1),x=Cn(t,C=>{var T;return(T=f.itemRefCallback)==null?void 0:T.call(f,C,r,a)}),S=ku(),w=R.useRef("touch"),b=()=>{a||(o.onValueChange(r),o.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.jsx(FU,{scope:n,value:r,disabled:a,textId:S,isSelected:c,onItemTextChange:R.useCallback(C=>{v(T=>T||((C==null?void 0:C.textContent)??"").trim())},[]),children:p.jsx(Op.ItemSlot,{scope:n,value:r,disabled:a,textValue:d,children:p.jsx(Kt.div,{role:"option","aria-labelledby":S,"data-highlighted":m?"":void 0,"aria-selected":c&&m,"data-state":c?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:x,onFocus:Wt(l.onFocus,()=>y(!0)),onBlur:Wt(l.onBlur,()=>y(!1)),onClick:Wt(l.onClick,()=>{w.current!=="mouse"&&b()}),onPointerUp:Wt(l.onPointerUp,()=>{w.current==="mouse"&&b()}),onPointerDown:Wt(l.onPointerDown,C=>{w.current=C.pointerType}),onPointerMove:Wt(l.onPointerMove,C=>{var T;w.current=C.pointerType,a?(T=f.onItemLeave)==null||T.call(f):w.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Wt(l.onPointerLeave,C=>{var T;C.currentTarget===document.activeElement&&((T=f.onItemLeave)==null||T.call(f))}),onKeyDown:Wt(l.onKeyDown,C=>{var k;((k=f.searchRef)==null?void 0:k.current)!==""&&C.key===" "||(CU.includes(C.key)&&b(),C.key===" "&&C.preventDefault())})})})})});fM.displayName=Xv;var kf="SelectItemText",dM=R.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...i}=e,l=pl(kf,n),o=ml(kf,n),f=cM(kf,n),c=AU(kf,n),[d,v]=R.useState(null),m=Cn(t,b=>v(b),f.onItemTextChange,b=>{var C;return(C=o.itemTextRefCallback)==null?void 0:C.call(o,b,f.value,f.disabled)}),y=d==null?void 0:d.textContent,x=R.useMemo(()=>p.jsx("option",{value:f.value,disabled:f.disabled,children:y},f.value),[f.disabled,f.value,y]),{onNativeOptionAdd:S,onNativeOptionRemove:w}=c;return vr(()=>(S(x),()=>w(x)),[S,w,x]),p.jsxs(p.Fragment,{children:[p.jsx(Kt.span,{id:f.textId,...i,ref:m}),f.isSelected&&l.valueNode&&!l.valueNodeHasChildren?fd.createPortal(i.children,l.valueNode):null]})});dM.displayName=kf;var hM="SelectItemIndicator",vM=R.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return cM(hM,n).isSelected?p.jsx(Kt.span,{"aria-hidden":!0,...r,ref:t}):null});vM.displayName=hM;var hb="SelectScrollUpButton",qU=R.forwardRef((e,t)=>{const n=ml(hb,e.__scopeSelect),r=F1(hb,e.__scopeSelect),[a,i]=R.useState(!1),l=Cn(t,r.onScrollButtonChange);return vr(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=f.scrollTop>0;i(c)};const f=n.viewport;return o(),f.addEventListener("scroll",o),()=>f.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),a?p.jsx(pM,{...e,ref:l,onAutoScroll:()=>{const{viewport:o,selectedItem:f}=n;o&&f&&(o.scrollTop=o.scrollTop-f.offsetHeight)}}):null});qU.displayName=hb;var vb="SelectScrollDownButton",UU=R.forwardRef((e,t)=>{const n=ml(vb,e.__scopeSelect),r=F1(vb,e.__scopeSelect),[a,i]=R.useState(!1),l=Cn(t,r.onScrollButtonChange);return vr(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=f.scrollHeight-f.clientHeight,d=Math.ceil(f.scrollTop)<c;i(d)};const f=n.viewport;return o(),f.addEventListener("scroll",o),()=>f.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),a?p.jsx(pM,{...e,ref:l,onAutoScroll:()=>{const{viewport:o,selectedItem:f}=n;o&&f&&(o.scrollTop=o.scrollTop+f.offsetHeight)}}):null});UU.displayName=vb;var pM=R.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=e,i=ml("SelectScrollButton",n),l=R.useRef(null),o=Lp(n),f=R.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return R.useEffect(()=>()=>f(),[f]),vr(()=>{var d;const c=o().find(v=>v.ref.current===document.activeElement);(d=c==null?void 0:c.ref.current)==null||d.scrollIntoView({block:"nearest"})},[o]),p.jsx(Kt.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Wt(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Wt(a.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Wt(a.onPointerLeave,()=>{f()})})}),VU="SelectSeparator",HU=R.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.jsx(Kt.div,{"aria-hidden":!0,...r,ref:t})});HU.displayName=VU;var pb="SelectArrow",GU=R.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=_p(n),i=pl(pb,n),l=ml(pb,n);return i.open&&l.position==="popper"?p.jsx(xU,{...a,...r,ref:t}):null});GU.displayName=pb;var $U="SelectBubbleInput",mM=R.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const a=R.useRef(null),i=Cn(r,a),l=bU(t);return R.useEffect(()=>{const o=a.current;if(!o)return;const f=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(f,"value").set;if(l!==t&&d){const v=new Event("change",{bubbles:!0});d.call(o,t),o.dispatchEvent(v)}},[l,t]),p.jsx(Kt.select,{...n,style:{...Xj,...n.style},ref:i,defaultValue:t})});mM.displayName=$U;function gM(e){return e===""||e===void 0}function yM(e){const t=uo(e),n=R.useRef(""),r=R.useRef(0),a=R.useCallback(l=>{const o=n.current+l;t(o),(function f(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>f(""),1e3))})(o)},[t]),i=R.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return R.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function xM(e,t,n){const a=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=YU(e,Math.max(i,0));a.length===1&&(l=l.filter(c=>c!==n));const f=l.find(c=>c.textValue.toLowerCase().startsWith(a.toLowerCase()));return f!==n?f:void 0}function YU(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var KU=Qj,bM=Zj,XU=eM,QU=tM,WU=nM,wM=rM,ZU=lM,SM=fM,JU=dM,eV=vM;const io=KU,so=XU,Js=R.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(bM,{ref:r,className:Ae("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,p.jsx(QU,{asChild:!0,children:p.jsx(Ma,{className:"h-4 w-4 opacity-50"})})]}));Js.displayName=bM.displayName;const el=R.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>p.jsx(WU,{children:p.jsx(wM,{ref:a,className:Ae("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border-0 bg-surface-container-highest text-card-foreground shadow-ambient",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:p.jsx(ZU,{className:Ae("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));el.displayName=wM.displayName;const tl=R.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(SM,{ref:r,className:Ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-surface-bright focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[p.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(eV,{children:p.jsx(hD,{className:"h-4 w-4"})})}),p.jsx(JU,{children:t})]}));tl.displayName=SM.displayName;function q1({searchPlaceholder:e="Search...",searchValue:t,onSearchChange:n,filters:r=[],filterValues:a={},onFilterChange:i}){return p.jsxs(dt,{level:"bright",className:"flex items-center gap-3 px-4 py-2 rounded-md",children:[p.jsx(nc,{className:"h-3.5 w-3.5 text-on-surface-variant shrink-0"}),p.jsx(Sn,{placeholder:e,value:t,onChange:l=>n(l.target.value),className:"bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1","aria-label":e}),r.map(l=>p.jsx("div",{className:"w-40 shrink-0",children:p.jsxs(io,{value:a[l.key]??"all",onValueChange:o=>i==null?void 0:i(l.key,o),children:[p.jsx(Js,{children:p.jsx(so,{placeholder:l.label})}),p.jsx(el,{children:l.options.map(o=>p.jsx(tl,{value:o.value,children:o.label},o.value))})]})},l.key))]})}function Bp({total:e,offset:t,limit:n,onPageChange:r}){if(Math.ceil(e/n)<=1)return null;const i=t>0,l=t+n<e,o=t+1,f=Math.min(t+n,e);return p.jsxs("div",{className:"flex items-center justify-center gap-3 pt-1",children:[p.jsxs(et,{variant:"ghost",size:"sm",disabled:!i,onClick:()=>r(Math.max(0,t-n)),className:"gap-1 text-on-surface-variant",children:[p.jsx(o1,{className:"h-4 w-4"}),"Prev"]}),p.jsxs("span",{className:"font-mono text-xs text-on-surface-variant",children:[o,"–",f," of ",e]}),p.jsxs(et,{variant:"ghost",size:"sm",disabled:!l,onClick:()=>r(t+n),className:"gap-1 text-on-surface-variant",children:["Next",p.jsx(wa,{className:"h-4 w-4"})]})]})}const tV=Ea.STATS,nV=Ea.STATS,rV=Ea.STATS,aV=3e4,iV=6e4,sV=1e4,lV=6e4;function oV(e){const t=new URLSearchParams;e!=null&&e.status&&t.set("status",e.status),e!=null&&e.agent&&t.set("agent",e.agent),e!=null&&e.search&&t.set("search",e.search),(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),(e==null?void 0:e.offset)!==void 0&&t.set("offset",String(e.offset));const n=t.toString(),r=n?`/sessions?${n}`:"/sessions";return ui({queryKey:["sessions",e],queryFn:({signal:a})=>Et(r,{signal:a}),pollCategory:"standard",refetchInterval:tV})}function uV(e){return ui({queryKey:["session",e],queryFn:({signal:t})=>Et(`/sessions/${e}`,{signal:t}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:nV})}function cV(e){return ui({queryKey:["session-batches",e],queryFn:({signal:t})=>Et(`/sessions/${e}/batches`,{signal:t}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:rV})}function fV(e){return mn({queryKey:["batch-activities",e],queryFn:({signal:t})=>Et(`/batches/${e}/activities`,{signal:t}),enabled:e!==void 0,staleTime:aV})}function dV(e){return mn({queryKey:["session-attachments",e],queryFn:({signal:t})=>Et(`/sessions/${e}/attachments`,{signal:t}),enabled:e!==void 0,staleTime:iV})}function EM(){const e=oi();return hl({mutationFn:t=>wD(`/sessions/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]})}})}function CM(e){return mn({queryKey:["session-impact",e],queryFn:({signal:t})=>Et(`/sessions/${e}/impact`,{signal:t}),enabled:e!==null,staleTime:sV})}function hV(e){return mn({queryKey:["session-plans",e],queryFn:({signal:t})=>Et(`/sessions/${e}/plans`,{signal:t}),enabled:!!e,staleTime:lV})}const vV=300;function pV(e,t=vV){const[n,r]=R.useState(e);return R.useEffect(()=>{const a=setTimeout(()=>r(e),t);return()=>clearTimeout(a)},[e,t]),n}const Cr="all";function U1({initialFilters:e}){const[t,n]=R.useState(""),r=pV(t),[a,i]=R.useState(e),[l,o]=R.useState(0),f=R.useCallback((v,m)=>{i(y=>({...y,[v]:m})),o(0)},[]),c=R.useCallback(v=>{n(v),o(0)},[]),d=R.useCallback(v=>{const m=a[v];return m&&m!==Cr?m:void 0},[a]);return{searchInput:t,debouncedSearch:r.length>0?r:void 0,filterValues:a,offset:l,setOffset:o,handleSearchChange:c,handleFilterChange:f,activeFilter:d}}function TM(e){return e==="active"?"active":e==="completed"?"completed":"error"}const mV={active:"bg-primary",completed:"bg-secondary",error:"bg-tertiary"},gV={active:"bg-primary/15 text-primary",completed:"bg-surface-container-high text-on-surface-variant",error:"bg-tertiary/15 text-tertiary"};function yV({status:e}){const t=TM(e);return p.jsx("span",{className:Ae("inline-block h-2 w-2 rounded-full shrink-0",mV[t])})}function NM({status:e}){const t=TM(e),n=e.charAt(0).toUpperCase()+e.slice(1);return p.jsxs("span",{className:Ae("inline-flex items-center gap-1.5 rounded-sm px-2 py-0.5 font-sans text-xs font-medium",gV[t]),children:[p.jsx(yV,{status:e}),n]})}const xV=5,mb=8,bV=12,wV=[{key:"status",label:"Status",options:[{value:Cr,label:"All statuses"},{value:"active",label:"Active"},{value:"completed",label:"Completed"}]},{key:"agent",label:"Agent",options:[{value:Cr,label:"All agents"},{value:"claude-code",label:"Claude Code"},{value:"cursor",label:"Cursor"}]}];function SV({session:e,onClick:t,onDelete:n}){const r=e.title||e.id.slice(0,mb);return p.jsxs("tr",{className:"border-b border-[var(--ghost-border)] last:border-0 hover:bg-surface-container/60 cursor-pointer transition-all duration-150 group focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40 hover:shadow-[inset_3px_0_0_var(--primary)]",onClick:t,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())},tabIndex:0,role:"row","aria-label":`Session: ${r}`,children:[p.jsx("td",{className:"px-4 py-3",children:p.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.id.slice(0,bV)})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("span",{className:"font-sans text-sm font-medium text-on-surface truncate block max-w-xs",children:r})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx(sr,{variant:"outline",className:"font-mono text-[10px] px-1.5 py-0",children:e.agent||"unknown"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx(NM,{status:e.status})}),p.jsx("td",{className:"px-4 py-3 text-center",children:p.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.prompt_count})}),p.jsx("td",{className:"px-4 py-3",children:p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.date}),p.jsx("button",{onClick:a=>{a.stopPropagation(),n()},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&a.stopPropagation()},className:"opacity-0 group-hover:opacity-100 focus-visible:opacity-100 p-1 rounded hover:bg-tertiary/10 hover:text-tertiary transition-all shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-tertiary/40","aria-label":`Delete session ${r}`,title:"Delete session",children:p.jsx(qf,{className:"h-3.5 w-3.5"})})]})})]})}function EV(){return p.jsxs("tr",{className:"border-b border-[var(--ghost-border)]",children:[p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-20 rounded bg-surface-container-high animate-pulse"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-40 rounded bg-surface-container-high animate-pulse"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-16 rounded bg-surface-container-high animate-pulse"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-16 rounded bg-surface-container-high animate-pulse"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-8 rounded bg-surface-container-high animate-pulse mx-auto"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-20 rounded bg-surface-container-high animate-pulse"})})]})}function uu({children:e,className:t}){return p.jsx("th",{className:Ae("px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant",t),children:e})}function CV(){const e=vl(),{searchInput:t,debouncedSearch:n,filterValues:r,offset:a,setOffset:i,handleSearchChange:l,handleFilterChange:o,activeFilter:f}=U1({initialFilters:{status:Cr,agent:Cr}}),[c,d]=R.useState(null),v=EM(),{data:m}=CM((c==null?void 0:c.id)??null),y=f("status"),x=f("agent"),{data:S,isLoading:w,isError:b,error:C}=oV({limit:Ja,offset:a,status:y,agent:x,search:n});function T(){c&&v.mutate(c.id,{onSuccess:()=>d(null)})}const k=(S==null?void 0:S.sessions)??[],D=(S==null?void 0:S.total)??0,A=p.jsx(q1,{searchPlaceholder:"Search sessions...",searchValue:t,onSearchChange:l,filters:wV,filterValues:r,onFilterChange:o}),j=p.jsx("thead",{children:p.jsxs("tr",{className:"border-b border-[var(--ghost-border)] bg-surface-container/50",children:[p.jsx(uu,{children:"Session ID"}),p.jsx(uu,{children:"Title"}),p.jsx(uu,{children:"Agent"}),p.jsx(uu,{children:"Status"}),p.jsx(uu,{className:"text-center",children:"Turns"}),p.jsx(uu,{children:"Date"})]})});return b?p.jsxs("div",{children:[p.jsx(al,{title:"Session Archive"}),A,p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary mt-4",children:[p.jsx(Qi,{className:"h-5 w-5"}),p.jsx("span",{className:"font-sans text-sm",children:"Failed to load sessions"}),p.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:C instanceof Error?C.message:"Unknown error"})]})]}):p.jsxs("div",{children:[p.jsx(al,{title:"Session Archive",subtitle:w?"Loading...":`${D} session${D!==1?"s":""} captured`}),A,w?p.jsx(dt,{level:"low",className:"rounded-md overflow-hidden mt-4",children:p.jsxs("table",{className:"w-full",children:[j,p.jsx("tbody",{children:Array.from({length:xV}).map((L,_)=>p.jsx(EV,{},_))})]})}):k.length===0?p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant mt-4",children:[p.jsx(yp,{className:"h-8 w-8 opacity-30"}),p.jsx("span",{className:"font-sans text-sm",children:D===0&&!n&&!y&&!x?"No sessions yet":"No matching sessions"}),D===0&&!n&&!y&&!x&&p.jsx("span",{className:"font-sans text-xs",children:"Sessions appear here as you work with your agent"})]}):p.jsx(dt,{level:"low",className:"rounded-md overflow-hidden mt-4",children:p.jsxs("table",{className:"w-full","aria-label":"Session archive",children:[j,p.jsx("tbody",{children:k.map(L=>p.jsx(SV,{session:L,onClick:()=>e(`/sessions/${L.id}`),onDelete:()=>d(L)},L.id))})]})}),p.jsx(Bp,{total:D,offset:a,limit:Ja,onPageChange:i}),p.jsx(Nj,{open:c!==null,onOpenChange:L=>{L||d(null)},title:"Delete Session",description:"This will permanently remove this session and all related data. This action cannot be undone.",icon:p.jsx(qf,{className:"h-4 w-4 text-tertiary"}),meta:c?[{label:"ID",value:c.id.slice(0,mb)},{label:"Title",value:c.title||c.id.slice(0,mb)}]:[],impact:m?[{label:"Prompts",value:m.promptCount},{label:"Spores",value:m.sporeCount},{label:"Attachments",value:m.attachmentCount},{label:"Graph Edges",value:m.graphEdgeCount}]:[],confirmLabel:"Delete Session",variant:"destructive",onConfirm:T,isPending:v.isPending})]})}function Pn({children:e,className:t}){return p.jsx("div",{className:Ae("font-sans text-xs font-medium uppercase tracking-widest text-on-surface-variant",t),children:e})}const TV=3e5;function NV(){return mn({queryKey:["symbionts"],queryFn:({signal:e})=>Et("/symbionts",{signal:e}),staleTime:TV})}function kV(e,t,n){const r=e.find(a=>a.name===t);return r?`${r.binary} --resume ${n}`:null}function AV(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const RV=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,DV=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jV={};function jT(e,t){return(jV.jsx?DV:RV).test(e)}const MV=/[ \t\n\f\r]/g;function OV(e){return typeof e=="object"?e.type==="text"?MT(e.value):!1:MT(e)}function MT(e){return e.replace(MV,"")===""}class md{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}md.prototype.normal={};md.prototype.property={};md.prototype.space=void 0;function kM(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new md(n,r,t)}function gb(e){return e.toLowerCase()}class qr{constructor(t,n){this.attribute=n,this.property=t}}qr.prototype.attribute="";qr.prototype.booleanish=!1;qr.prototype.boolean=!1;qr.prototype.commaOrSpaceSeparated=!1;qr.prototype.commaSeparated=!1;qr.prototype.defined=!1;qr.prototype.mustUseProperty=!1;qr.prototype.number=!1;qr.prototype.overloadedBoolean=!1;qr.prototype.property="";qr.prototype.spaceSeparated=!1;qr.prototype.space=void 0;let LV=0;const gt=So(),Dn=So(),yb=So(),ke=So(),Qt=So(),Du=So(),Qr=So();function So(){return 2**++LV}const xb=Object.freeze(Object.defineProperty({__proto__:null,boolean:gt,booleanish:Dn,commaOrSpaceSeparated:Qr,commaSeparated:Du,number:ke,overloadedBoolean:yb,spaceSeparated:Qt},Symbol.toStringTag,{value:"Module"})),Py=Object.keys(xb);class V1 extends qr{constructor(t,n,r,a){let i=-1;if(super(t,n),OT(this,"space",a),typeof r=="number")for(;++i<Py.length;){const l=Py[i];OT(this,Py[i],(r&xb[l])===xb[l])}}}V1.prototype.defined=!0;function OT(e,t,n){n&&(e[t]=n)}function uc(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new V1(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[gb(r)]=r,n[gb(i.attribute)]=r}return new md(t,n,e.space)}const AM=uc({properties:{ariaActiveDescendant:null,ariaAtomic:Dn,ariaAutoComplete:null,ariaBusy:Dn,ariaChecked:Dn,ariaColCount:ke,ariaColIndex:ke,ariaColSpan:ke,ariaControls:Qt,ariaCurrent:null,ariaDescribedBy:Qt,ariaDetails:null,ariaDisabled:Dn,ariaDropEffect:Qt,ariaErrorMessage:null,ariaExpanded:Dn,ariaFlowTo:Qt,ariaGrabbed:Dn,ariaHasPopup:null,ariaHidden:Dn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Qt,ariaLevel:ke,ariaLive:null,ariaModal:Dn,ariaMultiLine:Dn,ariaMultiSelectable:Dn,ariaOrientation:null,ariaOwns:Qt,ariaPlaceholder:null,ariaPosInSet:ke,ariaPressed:Dn,ariaReadOnly:Dn,ariaRelevant:null,ariaRequired:Dn,ariaRoleDescription:Qt,ariaRowCount:ke,ariaRowIndex:ke,ariaRowSpan:ke,ariaSelected:Dn,ariaSetSize:ke,ariaSort:null,ariaValueMax:ke,ariaValueMin:ke,ariaValueNow:ke,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function RM(e,t){return t in e?e[t]:t}function DM(e,t){return RM(e,t.toLowerCase())}const _V=uc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Du,acceptCharset:Qt,accessKey:Qt,action:null,allow:null,allowFullScreen:gt,allowPaymentRequest:gt,allowUserMedia:gt,alt:null,as:null,async:gt,autoCapitalize:null,autoComplete:Qt,autoFocus:gt,autoPlay:gt,blocking:Qt,capture:null,charSet:null,checked:gt,cite:null,className:Qt,cols:ke,colSpan:null,content:null,contentEditable:Dn,controls:gt,controlsList:Qt,coords:ke|Du,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gt,defer:gt,dir:null,dirName:null,disabled:gt,download:yb,draggable:Dn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gt,formTarget:null,headers:Qt,height:ke,hidden:yb,high:ke,href:null,hrefLang:null,htmlFor:Qt,httpEquiv:Qt,id:null,imageSizes:null,imageSrcSet:null,inert:gt,inputMode:null,integrity:null,is:null,isMap:gt,itemId:null,itemProp:Qt,itemRef:Qt,itemScope:gt,itemType:Qt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gt,low:ke,manifest:null,max:null,maxLength:ke,media:null,method:null,min:null,minLength:ke,multiple:gt,muted:gt,name:null,nonce:null,noModule:gt,noValidate:gt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:gt,optimum:ke,pattern:null,ping:Qt,placeholder:null,playsInline:gt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gt,referrerPolicy:null,rel:Qt,required:gt,reversed:gt,rows:ke,rowSpan:ke,sandbox:Qt,scope:null,scoped:gt,seamless:gt,selected:gt,shadowRootClonable:gt,shadowRootDelegatesFocus:gt,shadowRootMode:null,shape:null,size:ke,sizes:null,slot:null,span:ke,spellCheck:Dn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ke,step:null,style:null,tabIndex:ke,target:null,title:null,translate:null,type:null,typeMustMatch:gt,useMap:null,value:Dn,width:ke,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Qt,axis:null,background:null,bgColor:null,border:ke,borderColor:null,bottomMargin:ke,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gt,declare:gt,event:null,face:null,frame:null,frameBorder:null,hSpace:ke,leftMargin:ke,link:null,longDesc:null,lowSrc:null,marginHeight:ke,marginWidth:ke,noResize:gt,noHref:gt,noShade:gt,noWrap:gt,object:null,profile:null,prompt:null,rev:null,rightMargin:ke,rules:null,scheme:null,scrolling:Dn,standby:null,summary:null,text:null,topMargin:ke,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ke,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:gt,disableRemotePlayback:gt,prefix:null,property:null,results:ke,security:null,unselectable:null},space:"html",transform:DM}),BV=uc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Qr,accentHeight:ke,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ke,amplitude:ke,arabicForm:null,ascent:ke,attributeName:null,attributeType:null,azimuth:ke,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ke,by:null,calcMode:null,capHeight:ke,className:Qt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ke,diffuseConstant:ke,direction:null,display:null,dur:null,divisor:ke,dominantBaseline:null,download:gt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ke,enableBackground:null,end:null,event:null,exponent:ke,externalResourcesRequired:null,fill:null,fillOpacity:ke,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Du,g2:Du,glyphName:Du,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ke,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ke,horizOriginX:ke,horizOriginY:ke,id:null,ideographic:ke,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ke,k:ke,k1:ke,k2:ke,k3:ke,k4:ke,kernelMatrix:Qr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ke,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ke,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ke,overlineThickness:ke,paintOrder:null,panose1:null,path:null,pathLength:ke,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Qt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ke,pointsAtY:ke,pointsAtZ:ke,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qr,rev:Qr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qr,requiredFeatures:Qr,requiredFonts:Qr,requiredFormats:Qr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ke,specularExponent:ke,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ke,strikethroughThickness:ke,string:null,stroke:null,strokeDashArray:Qr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ke,strokeOpacity:ke,strokeWidth:null,style:null,surfaceScale:ke,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qr,tabIndex:ke,tableValues:null,target:null,targetX:ke,targetY:ke,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ke,underlineThickness:ke,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ke,values:null,vAlphabetic:ke,vMathematical:ke,vectorEffect:null,vHanging:ke,vIdeographic:ke,version:null,vertAdvY:ke,vertOriginX:ke,vertOriginY:ke,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ke,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:RM}),jM=uc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),MM=uc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:DM}),OM=uc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),PV={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},zV=/[A-Z]/g,LT=/-[a-z]/g,IV=/^data[-\w.:]+$/i;function FV(e,t){const n=gb(t);let r=t,a=qr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&IV.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(LT,UV);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!LT.test(i)){let l=i.replace(zV,qV);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}a=V1}return new a(r,t)}function qV(e){return"-"+e.toLowerCase()}function UV(e){return e.charAt(1).toUpperCase()}const VV=kM([AM,_V,jM,MM,OM],"html"),H1=kM([AM,BV,jM,MM,OM],"svg");function HV(e){return e.join(" ").trim()}var cu={},zy,_T;function GV(){if(_T)return zy;_T=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,o=/^\s+|\s+$/g,f=`
380
+ `,c="/",d="*",v="",m="comment",y="declaration";function x(w,b){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];b=b||{};var C=1,T=1;function k(I){var F=I.match(t);F&&(C+=F.length);var B=I.lastIndexOf(f);T=~B?I.length-B:T+I.length}function D(){var I={line:C,column:T};return function(F){return F.position=new A(I),_(),F}}function A(I){this.start=I,this.end={line:C,column:T},this.source=b.source}A.prototype.content=w;function j(I){var F=new Error(b.source+":"+C+":"+T+": "+I);if(F.reason=I,F.filename=b.source,F.line=C,F.column=T,F.source=w,!b.silent)throw F}function L(I){var F=I.exec(w);if(F){var B=F[0];return k(B),w=w.slice(B.length),F}}function _(){L(n)}function M(I){var F;for(I=I||[];F=z();)F!==!1&&I.push(F);return I}function z(){var I=D();if(!(c!=w.charAt(0)||d!=w.charAt(1))){for(var F=2;v!=w.charAt(F)&&(d!=w.charAt(F)||c!=w.charAt(F+1));)++F;if(F+=2,v===w.charAt(F-1))return j("End of comment missing");var B=w.slice(2,F-2);return T+=2,k(B),w=w.slice(F),T+=2,I({type:m,comment:B})}}function P(){var I=D(),F=L(r);if(F){if(z(),!L(a))return j("property missing ':'");var B=L(i),H=I({type:y,property:S(F[0].replace(e,v)),value:B?S(B[0].replace(e,v)):v});return L(l),H}}function G(){var I=[];M(I);for(var F;F=P();)F!==!1&&(I.push(F),M(I));return I}return _(),G()}function S(w){return w?w.replace(o,v):v}return zy=x,zy}var BT;function $V(){if(BT)return cu;BT=1;var e=cu&&cu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(cu,"__esModule",{value:!0}),cu.default=n;const t=e(GV());function n(r,a){let i=null;if(!r||typeof r!="string")return i;const l=(0,t.default)(r),o=typeof a=="function";return l.forEach(f=>{if(f.type!=="declaration")return;const{property:c,value:d}=f;o?a(c,d,f):d&&(i=i||{},i[c]=d)}),i}return cu}var hf={},PT;function YV(){if(PT)return hf;PT=1,Object.defineProperty(hf,"__esModule",{value:!0}),hf.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(c){return!c||n.test(c)||e.test(c)},l=function(c,d){return d.toUpperCase()},o=function(c,d){return"".concat(d,"-")},f=function(c,d){return d===void 0&&(d={}),i(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(a,o):c=c.replace(r,o),c.replace(t,l))};return hf.camelCase=f,hf}var vf,zT;function KV(){if(zT)return vf;zT=1;var e=vf&&vf.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e($V()),n=YV();function r(a,i){var l={};return!a||typeof a!="string"||(0,t.default)(a,function(o,f){o&&f&&(l[(0,n.camelCase)(o,i)]=f)}),l}return r.default=r,vf=r,vf}var XV=KV();const QV=ld(XV),LM=_M("end"),G1=_M("start");function _M(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function WV(e){const t=G1(e),n=LM(e);if(t&&n)return{start:t,end:n}}function Mf(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?IT(e.position):"start"in e||"end"in e?IT(e):"line"in e||"column"in e?bb(e):""}function bb(e){return FT(e&&e.line)+":"+FT(e&&e.column)}function IT(e){return bb(e&&e.start)+"-"+bb(e&&e.end)}function FT(e){return e&&typeof e=="number"?e:1}class gr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},l=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(l=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?i.ruleId=r:(i.source=r.slice(0,f),i.ruleId=r.slice(f+1))}if(!i.place&&i.ancestors&&i.ancestors){const f=i.ancestors[i.ancestors.length-1];f&&(i.place=f.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=o?o.line:void 0,this.name=Mf(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}gr.prototype.file="";gr.prototype.name="";gr.prototype.reason="";gr.prototype.message="";gr.prototype.stack="";gr.prototype.column=void 0;gr.prototype.line=void 0;gr.prototype.ancestors=void 0;gr.prototype.cause=void 0;gr.prototype.fatal=void 0;gr.prototype.place=void 0;gr.prototype.ruleId=void 0;gr.prototype.source=void 0;const $1={}.hasOwnProperty,ZV=new Map,JV=/[A-Z]/g,e8=new Set(["table","tbody","thead","tfoot","tr"]),t8=new Set(["td","th"]),BM="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function n8(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=c8(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=u8(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?H1:VV,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=PM(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function PM(e,t,n){if(t.type==="element")return r8(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return a8(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return s8(e,t,n);if(t.type==="mdxjsEsm")return i8(e,t);if(t.type==="root")return l8(e,t,n);if(t.type==="text")return o8(e,t)}function r8(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=H1,e.schema=a),e.ancestors.push(t);const i=IM(e,t.tagName,!1),l=f8(e,t);let o=K1(e,t);return e8.has(t.tagName)&&(o=o.filter(function(f){return typeof f=="string"?!OV(f):!0})),zM(e,l,i,t),Y1(l,o),e.ancestors.pop(),e.schema=r,e.create(t,i,l,n)}function a8(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Hf(e,t.position)}function i8(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Hf(e,t.position)}function s8(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=H1,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:IM(e,t.name,!0),l=d8(e,t),o=K1(e,t);return zM(e,l,i,t),Y1(l,o),e.ancestors.pop(),e.schema=r,e.create(t,i,l,n)}function l8(e,t,n){const r={};return Y1(r,K1(e,t)),e.create(t,e.Fragment,r,n)}function o8(e,t){return t.value}function zM(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Y1(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function u8(e,t,n){return r;function r(a,i,l,o){const c=Array.isArray(l.children)?n:t;return o?c(i,l,o):c(i,l)}}function c8(e,t){return n;function n(r,a,i,l){const o=Array.isArray(i.children),f=G1(r);return t(a,i,l,o,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function f8(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&$1.call(t.properties,a)){const i=h8(e,a,t.properties[a]);if(i){const[l,o]=i;e.tableCellAlignToStyle&&l==="align"&&typeof o=="string"&&t8.has(t.tagName)?r=o:n[l]=o}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function d8(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const l=i.expression;l.type;const o=l.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Hf(e,t.position);else{const a=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else Hf(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function K1(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:ZV;for(;++r<t.children.length;){const i=t.children[r];let l;if(e.passKeys){const f=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(f){const c=a.get(f)||0;l=f+"-"+c,a.set(f,c+1)}}const o=PM(e,i,l);o!==void 0&&n.push(o)}return n}function h8(e,t,n){const r=FV(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?AV(n):HV(n)),r.property==="style"){let a=typeof n=="object"?n:v8(e,String(n));return e.stylePropertyNameCase==="css"&&(a=p8(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?PV[r.property]||r.property:r.attribute,n]}}function v8(e,t){try{return QV(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new gr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=BM+"#cannot-parse-style-attribute",a}}function IM(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,l;for(;++i<a.length;){const o=jT(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};l=l?{type:"MemberExpression",object:l,property:o,computed:!!(i&&o.type==="Literal"),optional:!1}:o}r=l}else r=jT(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return $1.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Hf(e)}function Hf(e,t){const n=new gr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=BM+"#cannot-handle-mdx-estrees-without-createevaluater",n}function p8(e){const t={};let n;for(n in e)$1.call(e,n)&&(t[m8(n)]=e[n]);return t}function m8(e){let t=e.replace(JV,g8);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function g8(e){return"-"+e.toLowerCase()}const Iy={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},y8={};function X1(e,t){const n=y8,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return FM(e,r,a)}function FM(e,t,n){if(x8(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return qT(e.children,t,n)}return Array.isArray(e)?qT(e,t,n):""}function qT(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=FM(e[a],t,n);return r.join("")}function x8(e){return!!(e&&typeof e=="object")}const UT=document.createElement("i");function Q1(e){const t="&"+e+";";UT.innerHTML=t;const n=UT.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ea(e,t,n,r){const a=e.length;let i=0,l;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);i<r.length;)l=r.slice(i,i+1e4),l.unshift(t,0),e.splice(...l),i+=1e4,t+=1e4}function ya(e,t){return e.length>0?(ea(e,e.length,0,t),e):t}const VT={}.hasOwnProperty;function qM(e){const t={};let n=-1;for(;++n<e.length;)b8(t,e[n]);return t}function b8(e,t){let n;for(n in t){const a=(VT.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let l;if(i)for(l in i){VT.call(a,l)||(a[l]=[]);const o=i[l];w8(a[l],Array.isArray(o)?o:o?[o]:[])}}}function w8(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ea(e,0,0,r)}function UM(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Da(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Er=gl(/[A-Za-z]/),hr=gl(/[\dA-Za-z]/),S8=gl(/[#-'*+\--9=?A-Z^-~]/);function Qv(e){return e!==null&&(e<32||e===127)}const wb=gl(/\d/),E8=gl(/[\dA-Fa-f]/),C8=gl(/[!-/:-@[-`{-~]/);function tt(e){return e!==null&&e<-2}function Yt(e){return e!==null&&(e<0||e===32)}function St(e){return e===-2||e===-1||e===32}const Pp=gl(new RegExp("\\p{P}|\\p{S}","u")),po=gl(/\s/);function gl(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function cc(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let l="";if(i===37&&hr(e.charCodeAt(n+1))&&hr(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(l=String.fromCharCode(i));else if(i>55295&&i<57344){const o=e.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(l=String.fromCharCode(i,o),a=1):l="�"}else l=String.fromCharCode(i);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+a+1,l=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function At(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(f){return St(f)?(e.enter(n),o(f)):t(f)}function o(f){return St(f)&&i++<a?(e.consume(f),o):(e.exit(n),t(f))}}const T8={tokenize:N8};function N8(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),At(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(o)}function l(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return tt(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),l)}}const k8={tokenize:A8},HT={tokenize:R8};function A8(e){const t=this,n=[];let r=0,a,i,l;return o;function o(T){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,f,c)(T)}return c(T)}function f(T){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const k=t.events.length;let D=k,A;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){A=t.events[D][1].end;break}b(r);let j=k;for(;j<t.events.length;)t.events[j][1].end={...A},j++;return ea(t.events,D+1,0,t.events.slice(k)),t.events.length=j,c(T)}return o(T)}function c(T){if(r===n.length){if(!a)return m(T);if(a.currentConstruct&&a.currentConstruct.concrete)return x(T);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(HT,d,v)(T)}function d(T){return a&&C(),b(r),m(T)}function v(T){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,x(T)}function m(T){return t.containerState={},e.attempt(HT,y,x)(T)}function y(T){return r++,n.push([t.currentConstruct,t.containerState]),m(T)}function x(T){if(T===null){a&&C(),b(0),e.consume(T);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),S(T)}function S(T){if(T===null){w(e.exit("chunkFlow"),!0),b(0),e.consume(T);return}return tt(T)?(e.consume(T),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(T),S)}function w(T,k){const D=t.sliceStream(T);if(k&&D.push(null),T.previous=i,i&&(i.next=T),i=T,a.defineSkip(T.start),a.write(D),t.parser.lazy[T.start.line]){let A=a.events.length;for(;A--;)if(a.events[A][1].start.offset<l&&(!a.events[A][1].end||a.events[A][1].end.offset>l))return;const j=t.events.length;let L=j,_,M;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(_){M=t.events[L][1].end;break}_=!0}for(b(r),A=j;A<t.events.length;)t.events[A][1].end={...M},A++;ea(t.events,L+1,0,t.events.slice(j)),t.events.length=A}}function b(T){let k=n.length;for(;k-- >T;){const D=n[k];t.containerState=D[1],D[0].exit.call(t,e)}n.length=T}function C(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function R8(e,t,n){return At(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xu(e){if(e===null||Yt(e)||po(e))return 1;if(Pp(e))return 2}function zp(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Sb={name:"attention",resolveAll:D8,tokenize:j8};function D8(e,t){let n=-1,r,a,i,l,o,f,c,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const v={...e[r][1].end},m={...e[n][1].start};GT(v,-f),GT(m,f),l={type:f>1?"strongSequence":"emphasisSequence",start:v,end:{...e[r][1].end}},o={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},i={type:f>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:f>1?"strong":"emphasis",start:{...l.start},end:{...o.end}},e[r][1].end={...l.start},e[n][1].start={...o.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=ya(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=ya(c,[["enter",a,t],["enter",l,t],["exit",l,t],["enter",i,t]]),c=ya(c,zp(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=ya(c,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=ya(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,ea(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function j8(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Xu(r);let i;return l;function l(f){return i=f,e.enter("attentionSequence"),o(f)}function o(f){if(f===i)return e.consume(f),o;const c=e.exit("attentionSequence"),d=Xu(f),v=!d||d===2&&a||n.includes(f),m=!a||a===2&&d||n.includes(r);return c._open=!!(i===42?v:v&&(a||!m)),c._close=!!(i===42?m:m&&(d||!v)),t(f)}}function GT(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const M8={name:"autolink",tokenize:O8};function O8(e,t,n){let r=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(y){return Er(y)?(e.consume(y),l):y===64?n(y):c(y)}function l(y){return y===43||y===45||y===46||hr(y)?(r=1,o(y)):c(y)}function o(y){return y===58?(e.consume(y),r=0,f):(y===43||y===45||y===46||hr(y))&&r++<32?(e.consume(y),o):(r=0,c(y))}function f(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||Qv(y)?n(y):(e.consume(y),f)}function c(y){return y===64?(e.consume(y),d):S8(y)?(e.consume(y),c):n(y)}function d(y){return hr(y)?v(y):n(y)}function v(y){return y===46?(e.consume(y),r=0,d):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):m(y)}function m(y){if((y===45||hr(y))&&r++<63){const x=y===45?m:v;return e.consume(y),x}return n(y)}}const gd={partial:!0,tokenize:L8};function L8(e,t,n){return r;function r(i){return St(i)?At(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||tt(i)?t(i):n(i)}}const VM={continuation:{tokenize:B8},exit:P8,name:"blockQuote",tokenize:_8};function _8(e,t,n){const r=this;return a;function a(l){if(l===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),i}return n(l)}function i(l){return St(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function B8(e,t,n){const r=this;return a;function a(l){return St(l)?At(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):i(l)}function i(l){return e.attempt(VM,t,n)(l)}}function P8(e){e.exit("blockQuote")}const HM={name:"characterEscape",tokenize:z8};function z8(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return C8(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const GM={name:"characterReference",tokenize:I8};function I8(e,t,n){const r=this;let a=0,i,l;return o;function o(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),f}function f(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,l=hr,d(v))}function c(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,l=E8,d):(e.enter("characterReferenceValue"),i=7,l=wb,d(v))}function d(v){if(v===59&&a){const m=e.exit("characterReferenceValue");return l===hr&&!Q1(r.sliceSerialize(m))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(v)&&a++<i?(e.consume(v),d):n(v)}}const $T={partial:!0,tokenize:q8},YT={concrete:!0,name:"codeFenced",tokenize:F8};function F8(e,t,n){const r=this,a={partial:!0,tokenize:D};let i=0,l=0,o;return f;function f(A){return c(A)}function c(A){const j=r.events[r.events.length-1];return i=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,o=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(A)}function d(A){return A===o?(l++,e.consume(A),d):l<3?n(A):(e.exit("codeFencedFenceSequence"),St(A)?At(e,v,"whitespace")(A):v(A))}function v(A){return A===null||tt(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check($T,S,k)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(A))}function m(A){return A===null||tt(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(A)):St(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),At(e,y,"whitespace")(A)):A===96&&A===o?n(A):(e.consume(A),m)}function y(A){return A===null||tt(A)?v(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(A))}function x(A){return A===null||tt(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(A)):A===96&&A===o?n(A):(e.consume(A),x)}function S(A){return e.attempt(a,k,w)(A)}function w(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),b}function b(A){return i>0&&St(A)?At(e,C,"linePrefix",i+1)(A):C(A)}function C(A){return A===null||tt(A)?e.check($T,S,k)(A):(e.enter("codeFlowValue"),T(A))}function T(A){return A===null||tt(A)?(e.exit("codeFlowValue"),C(A)):(e.consume(A),T)}function k(A){return e.exit("codeFenced"),t(A)}function D(A,j,L){let _=0;return M;function M(F){return A.enter("lineEnding"),A.consume(F),A.exit("lineEnding"),z}function z(F){return A.enter("codeFencedFence"),St(F)?At(A,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):P(F)}function P(F){return F===o?(A.enter("codeFencedFenceSequence"),G(F)):L(F)}function G(F){return F===o?(_++,A.consume(F),G):_>=l?(A.exit("codeFencedFenceSequence"),St(F)?At(A,I,"whitespace")(F):I(F)):L(F)}function I(F){return F===null||tt(F)?(A.exit("codeFencedFence"),j(F)):L(F)}}}function q8(e,t,n){const r=this;return a;function a(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i)}function i(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Fy={name:"codeIndented",tokenize:V8},U8={partial:!0,tokenize:H8};function V8(e,t,n){const r=this;return a;function a(c){return e.enter("codeIndented"),At(e,i,"linePrefix",5)(c)}function i(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?l(c):n(c)}function l(c){return c===null?f(c):tt(c)?e.attempt(U8,l,f)(c):(e.enter("codeFlowValue"),o(c))}function o(c){return c===null||tt(c)?(e.exit("codeFlowValue"),l(c)):(e.consume(c),o)}function f(c){return e.exit("codeIndented"),t(c)}}function H8(e,t,n){const r=this;return a;function a(l){return r.parser.lazy[r.now().line]?n(l):tt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):At(e,i,"linePrefix",5)(l)}function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):tt(l)?a(l):n(l)}}const G8={name:"codeText",previous:Y8,resolve:$8,tokenize:K8};function $8(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function Y8(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function K8(e,t,n){let r=0,a,i;return l;function l(v){return e.enter("codeText"),e.enter("codeTextSequence"),o(v)}function o(v){return v===96?(e.consume(v),r++,o):(e.exit("codeTextSequence"),f(v))}function f(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),f):v===96?(i=e.enter("codeTextSequence"),a=0,d(v)):tt(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),f):(e.enter("codeTextData"),c(v))}function c(v){return v===null||v===32||v===96||tt(v)?(e.exit("codeTextData"),f(v)):(e.consume(v),c)}function d(v){return v===96?(e.consume(v),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(i.type="codeTextData",c(v))}}class X8{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&pf(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),pf(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),pf(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);pf(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);pf(this.left,n.reverse())}}}function pf(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function $M(e){const t={};let n=-1,r,a,i,l,o,f,c;const d=new X8(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,i=0,i<f.length&&f[i][1].type==="lineEndingBlank"&&(i+=2),i<f.length&&f[i][1].type==="content"))for(;++i<f.length&&f[i][1].type!=="content";)f[i][1].type==="chunkText"&&(f[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Q8(d,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,a=void 0;i--;)if(l=d.get(i),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),l[1].type="lineEnding",a=i);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;a&&(r[1].end={...d.get(a)[1].start},o=d.slice(a,n),o.unshift(r),d.splice(a,n-a+1,o))}}return ea(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function Q8(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const o=l.events,f=[],c={};let d,v,m=-1,y=n,x=0,S=0;const w=[S];for(;y;){for(;e.get(++a)[1]!==y;);i.push(a),y._tokenizer||(d=r.sliceStream(y),y.next||d.push(null),v&&l.defineSkip(y.start),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(d),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),v=y,y=y.next}for(y=n;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(S=m+1,w.push(S),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(l.events=[],y?(y._tokenizer=void 0,y.previous=void 0):w.pop(),m=w.length;m--;){const b=o.slice(w[m],w[m+1]),C=i.pop();f.push([C,C+b.length-1]),e.splice(C,2,b)}for(f.reverse(),m=-1;++m<f.length;)c[x+f[m][0]]=x+f[m][1],x+=f[m][1]-f[m][0]-1;return c}const W8={resolve:J8,tokenize:e9},Z8={partial:!0,tokenize:t9};function J8(e){return $M(e),e}function e9(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):tt(o)?e.check(Z8,l,i)(o):(e.consume(o),a)}function i(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function l(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function t9(e,t,n){const r=this;return a;function a(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),At(e,i,"linePrefix")}function i(l){if(l===null||tt(l))return n(l);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function YM(e,t,n,r,a,i,l,o,f){const c=f||Number.POSITIVE_INFINITY;let d=0;return v;function v(b){return b===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(b),e.exit(i),m):b===null||b===32||b===41||Qv(b)?n(b):(e.enter(r),e.enter(l),e.enter(o),e.enter("chunkString",{contentType:"string"}),S(b))}function m(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===62?(e.exit("chunkString"),e.exit(o),m(b)):b===null||b===60||tt(b)?n(b):(e.consume(b),b===92?x:y)}function x(b){return b===60||b===62||b===92?(e.consume(b),y):y(b)}function S(b){return!d&&(b===null||b===41||Yt(b))?(e.exit("chunkString"),e.exit(o),e.exit(l),e.exit(r),t(b)):d<c&&b===40?(e.consume(b),d++,S):b===41?(e.consume(b),d--,S):b===null||b===32||b===40||Qv(b)?n(b):(e.consume(b),b===92?w:S)}function w(b){return b===40||b===41||b===92?(e.consume(b),S):S(b)}}function KM(e,t,n,r,a,i){const l=this;let o=0,f;return c;function c(y){return e.enter(r),e.enter(a),e.consume(y),e.exit(a),e.enter(i),d}function d(y){return o>999||y===null||y===91||y===93&&!f||y===94&&!o&&"_hiddenFootnoteSupport"in l.parser.constructs?n(y):y===93?(e.exit(i),e.enter(a),e.consume(y),e.exit(a),e.exit(r),t):tt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),v(y))}function v(y){return y===null||y===91||y===93||tt(y)||o++>999?(e.exit("chunkString"),d(y)):(e.consume(y),f||(f=!St(y)),y===92?m:v)}function m(y){return y===91||y===92||y===93?(e.consume(y),o++,v):v(y)}}function XM(e,t,n,r,a,i){let l;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),l=m===40?41:m,f):n(m)}function f(m){return m===l?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(i),c(m))}function c(m){return m===l?(e.exit(i),f(l)):m===null?n(m):tt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),At(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===l||m===null||tt(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?v:d)}function v(m){return m===l||m===92?(e.consume(m),d):d(m)}}function Of(e,t){let n;return r;function r(a){return tt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):St(a)?At(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const n9={name:"definition",tokenize:a9},r9={partial:!0,tokenize:i9};function a9(e,t,n){const r=this;let a;return i;function i(y){return e.enter("definition"),l(y)}function l(y){return KM.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function o(y){return a=Da(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),f):n(y)}function f(y){return Yt(y)?Of(e,c)(y):c(y)}function c(y){return YM(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function d(y){return e.attempt(r9,v,v)(y)}function v(y){return St(y)?At(e,m,"whitespace")(y):m(y)}function m(y){return y===null||tt(y)?(e.exit("definition"),r.parser.defined.push(a),t(y)):n(y)}}function i9(e,t,n){return r;function r(o){return Yt(o)?Of(e,a)(o):n(o)}function a(o){return XM(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return St(o)?At(e,l,"whitespace")(o):l(o)}function l(o){return o===null||tt(o)?t(o):n(o)}}const s9={name:"hardBreakEscape",tokenize:l9};function l9(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return tt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const o9={name:"headingAtx",resolve:u9,tokenize:c9};function u9(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ea(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function c9(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),l(d)}function l(d){return d===35&&r++<6?(e.consume(d),l):d===null||Yt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),f(d)):d===null||tt(d)?(e.exit("atxHeading"),t(d)):St(d)?At(e,o,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function f(d){return d===35?(e.consume(d),f):(e.exit("atxHeadingSequence"),o(d))}function c(d){return d===null||d===35||Yt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),c)}}const f9=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],KT=["pre","script","style","textarea"],d9={concrete:!0,name:"htmlFlow",resolveTo:p9,tokenize:m9},h9={partial:!0,tokenize:y9},v9={partial:!0,tokenize:g9};function p9(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function m9(e,t,n){const r=this;let a,i,l,o,f;return c;function c(U){return d(U)}function d(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),v}function v(U){return U===33?(e.consume(U),m):U===47?(e.consume(U),i=!0,S):U===63?(e.consume(U),a=3,r.interrupt?t:V):Er(U)?(e.consume(U),l=String.fromCharCode(U),w):n(U)}function m(U){return U===45?(e.consume(U),a=2,y):U===91?(e.consume(U),a=5,o=0,x):Er(U)?(e.consume(U),a=4,r.interrupt?t:V):n(U)}function y(U){return U===45?(e.consume(U),r.interrupt?t:V):n(U)}function x(U){const te="CDATA[";return U===te.charCodeAt(o++)?(e.consume(U),o===te.length?r.interrupt?t:P:x):n(U)}function S(U){return Er(U)?(e.consume(U),l=String.fromCharCode(U),w):n(U)}function w(U){if(U===null||U===47||U===62||Yt(U)){const te=U===47,ie=l.toLowerCase();return!te&&!i&&KT.includes(ie)?(a=1,r.interrupt?t(U):P(U)):f9.includes(l.toLowerCase())?(a=6,te?(e.consume(U),b):r.interrupt?t(U):P(U)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(U):i?C(U):T(U))}return U===45||hr(U)?(e.consume(U),l+=String.fromCharCode(U),w):n(U)}function b(U){return U===62?(e.consume(U),r.interrupt?t:P):n(U)}function C(U){return St(U)?(e.consume(U),C):M(U)}function T(U){return U===47?(e.consume(U),M):U===58||U===95||Er(U)?(e.consume(U),k):St(U)?(e.consume(U),T):M(U)}function k(U){return U===45||U===46||U===58||U===95||hr(U)?(e.consume(U),k):D(U)}function D(U){return U===61?(e.consume(U),A):St(U)?(e.consume(U),D):T(U)}function A(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),f=U,j):St(U)?(e.consume(U),A):L(U)}function j(U){return U===f?(e.consume(U),f=null,_):U===null||tt(U)?n(U):(e.consume(U),j)}function L(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||Yt(U)?D(U):(e.consume(U),L)}function _(U){return U===47||U===62||St(U)?T(U):n(U)}function M(U){return U===62?(e.consume(U),z):n(U)}function z(U){return U===null||tt(U)?P(U):St(U)?(e.consume(U),z):n(U)}function P(U){return U===45&&a===2?(e.consume(U),B):U===60&&a===1?(e.consume(U),H):U===62&&a===4?(e.consume(U),q):U===63&&a===3?(e.consume(U),V):U===93&&a===5?(e.consume(U),Q):tt(U)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(h9,X,G)(U)):U===null||tt(U)?(e.exit("htmlFlowData"),G(U)):(e.consume(U),P)}function G(U){return e.check(v9,I,X)(U)}function I(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),F}function F(U){return U===null||tt(U)?G(U):(e.enter("htmlFlowData"),P(U))}function B(U){return U===45?(e.consume(U),V):P(U)}function H(U){return U===47?(e.consume(U),l="",K):P(U)}function K(U){if(U===62){const te=l.toLowerCase();return KT.includes(te)?(e.consume(U),q):P(U)}return Er(U)&&l.length<8?(e.consume(U),l+=String.fromCharCode(U),K):P(U)}function Q(U){return U===93?(e.consume(U),V):P(U)}function V(U){return U===62?(e.consume(U),q):U===45&&a===2?(e.consume(U),V):P(U)}function q(U){return U===null||tt(U)?(e.exit("htmlFlowData"),X(U)):(e.consume(U),q)}function X(U){return e.exit("htmlFlow"),t(U)}}function g9(e,t,n){const r=this;return a;function a(l){return tt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):n(l)}function i(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function y9(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(gd,t,n)}}const x9={name:"htmlText",tokenize:b9};function b9(e,t,n){const r=this;let a,i,l;return o;function o(V){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(V),f}function f(V){return V===33?(e.consume(V),c):V===47?(e.consume(V),D):V===63?(e.consume(V),T):Er(V)?(e.consume(V),L):n(V)}function c(V){return V===45?(e.consume(V),d):V===91?(e.consume(V),i=0,x):Er(V)?(e.consume(V),C):n(V)}function d(V){return V===45?(e.consume(V),y):n(V)}function v(V){return V===null?n(V):V===45?(e.consume(V),m):tt(V)?(l=v,H(V)):(e.consume(V),v)}function m(V){return V===45?(e.consume(V),y):v(V)}function y(V){return V===62?B(V):V===45?m(V):v(V)}function x(V){const q="CDATA[";return V===q.charCodeAt(i++)?(e.consume(V),i===q.length?S:x):n(V)}function S(V){return V===null?n(V):V===93?(e.consume(V),w):tt(V)?(l=S,H(V)):(e.consume(V),S)}function w(V){return V===93?(e.consume(V),b):S(V)}function b(V){return V===62?B(V):V===93?(e.consume(V),b):S(V)}function C(V){return V===null||V===62?B(V):tt(V)?(l=C,H(V)):(e.consume(V),C)}function T(V){return V===null?n(V):V===63?(e.consume(V),k):tt(V)?(l=T,H(V)):(e.consume(V),T)}function k(V){return V===62?B(V):T(V)}function D(V){return Er(V)?(e.consume(V),A):n(V)}function A(V){return V===45||hr(V)?(e.consume(V),A):j(V)}function j(V){return tt(V)?(l=j,H(V)):St(V)?(e.consume(V),j):B(V)}function L(V){return V===45||hr(V)?(e.consume(V),L):V===47||V===62||Yt(V)?_(V):n(V)}function _(V){return V===47?(e.consume(V),B):V===58||V===95||Er(V)?(e.consume(V),M):tt(V)?(l=_,H(V)):St(V)?(e.consume(V),_):B(V)}function M(V){return V===45||V===46||V===58||V===95||hr(V)?(e.consume(V),M):z(V)}function z(V){return V===61?(e.consume(V),P):tt(V)?(l=z,H(V)):St(V)?(e.consume(V),z):_(V)}function P(V){return V===null||V===60||V===61||V===62||V===96?n(V):V===34||V===39?(e.consume(V),a=V,G):tt(V)?(l=P,H(V)):St(V)?(e.consume(V),P):(e.consume(V),I)}function G(V){return V===a?(e.consume(V),a=void 0,F):V===null?n(V):tt(V)?(l=G,H(V)):(e.consume(V),G)}function I(V){return V===null||V===34||V===39||V===60||V===61||V===96?n(V):V===47||V===62||Yt(V)?_(V):(e.consume(V),I)}function F(V){return V===47||V===62||Yt(V)?_(V):n(V)}function B(V){return V===62?(e.consume(V),e.exit("htmlTextData"),e.exit("htmlText"),t):n(V)}function H(V){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(V),e.exit("lineEnding"),K}function K(V){return St(V)?At(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):Q(V)}function Q(V){return e.enter("htmlTextData"),l(V)}}const W1={name:"labelEnd",resolveAll:C9,resolveTo:T9,tokenize:N9},w9={tokenize:k9},S9={tokenize:A9},E9={tokenize:R9};function C9(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&ea(e,0,e.length,n),e}function T9(e,t){let n=e.length,r=0,a,i,l,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(l=n);const f={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[l][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[l-2][1].start}};return o=[["enter",f,t],["enter",c,t]],o=ya(o,e.slice(i+1,i+r+3)),o=ya(o,[["enter",d,t]]),o=ya(o,zp(t.parser.constructs.insideSpan.null,e.slice(i+r+4,l-3),t)),o=ya(o,[["exit",d,t],e[l-2],e[l-1],["exit",c,t]]),o=ya(o,e.slice(l+1)),o=ya(o,[["exit",f,t]]),ea(e,i,e.length,o),e}function N9(e,t,n){const r=this;let a=r.events.length,i,l;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(m){return i?i._inactive?v(m):(l=r.parser.defined.includes(Da(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),f):n(m)}function f(m){return m===40?e.attempt(w9,d,l?d:v)(m):m===91?e.attempt(S9,d,l?c:v)(m):l?d(m):v(m)}function c(m){return e.attempt(E9,d,v)(m)}function d(m){return t(m)}function v(m){return i._balanced=!0,n(m)}}function k9(e,t,n){return r;function r(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),a}function a(v){return Yt(v)?Of(e,i)(v):i(v)}function i(v){return v===41?d(v):YM(e,l,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function l(v){return Yt(v)?Of(e,f)(v):d(v)}function o(v){return n(v)}function f(v){return v===34||v===39||v===40?XM(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):d(v)}function c(v){return Yt(v)?Of(e,d)(v):d(v)}function d(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function A9(e,t,n){const r=this;return a;function a(o){return KM.call(r,e,i,l,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Da(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function l(o){return n(o)}}function R9(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const D9={name:"labelStartImage",resolveAll:W1.resolveAll,tokenize:j9};function j9(e,t,n){const r=this;return a;function a(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),l):n(o)}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const M9={name:"labelStartLink",resolveAll:W1.resolveAll,tokenize:O9};function O9(e,t,n){const r=this;return a;function a(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),i}function i(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const qy={name:"lineEnding",tokenize:L9};function L9(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),At(e,t,"linePrefix")}}const Nv={name:"thematicBreak",tokenize:_9};function _9(e,t,n){let r=0,a;return i;function i(c){return e.enter("thematicBreak"),l(c)}function l(c){return a=c,o(c)}function o(c){return c===a?(e.enter("thematicBreakSequence"),f(c)):r>=3&&(c===null||tt(c))?(e.exit("thematicBreak"),t(c)):n(c)}function f(c){return c===a?(e.consume(c),r++,f):(e.exit("thematicBreakSequence"),St(c)?At(e,o,"whitespace")(c):o(c))}}const _r={continuation:{tokenize:I9},exit:q9,name:"list",tokenize:z9},B9={partial:!0,tokenize:U9},P9={partial:!0,tokenize:F9};function z9(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,l=0;return o;function o(y){const x=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:wb(y)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Nv,n,c)(y):c(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(y)}return n(y)}function f(y){return wb(y)&&++l<10?(e.consume(y),f):(!r.interrupt||l<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),c(y)):n(y)}function c(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(gd,r.interrupt?n:d,e.attempt(B9,m,v))}function d(y){return r.containerState.initialBlankLine=!0,i++,m(y)}function v(y){return St(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),m):n(y)}function m(y){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function I9(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(gd,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,At(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!St(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(P9,t,l)(o))}function l(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,At(e,e.attempt(_r,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function F9(e,t,n){const r=this;return At(e,a,"listItemIndent",r.containerState.size+1);function a(i){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(i):n(i)}}function q9(e){e.exit(this.containerState.type)}function U9(e,t,n){const r=this;return At(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const l=r.events[r.events.length-1];return!St(i)&&l&&l[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const XT={name:"setextUnderline",resolveTo:V9,tokenize:H9};function V9(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",l,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function H9(e,t,n){const r=this;let a;return i;function i(c){let d=r.events.length,v;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){v=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||v)?(e.enter("setextHeadingLine"),a=c,l(c)):n(c)}function l(c){return e.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===a?(e.consume(c),o):(e.exit("setextHeadingLineSequence"),St(c)?At(e,f,"lineSuffix")(c):f(c))}function f(c){return c===null||tt(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const G9={tokenize:$9};function $9(e){const t=this,n=e.attempt(gd,r,e.attempt(this.parser.constructs.flowInitial,a,At(e,e.attempt(this.parser.constructs.flow,a,e.attempt(W8,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Y9={resolveAll:WM()},K9=QM("string"),X9=QM("text");function QM(e){return{resolveAll:WM(e==="text"?Q9:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,l,o);return l;function l(d){return c(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),f}function f(d){return c(d)?(n.exit("data"),i(d)):(n.consume(d),f)}function c(d){if(d===null)return!0;const v=a[d];let m=-1;if(v)for(;++m<v.length;){const y=v[m];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function WM(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function Q9(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,l=-1,o=0,f;for(;i--;){const c=a[i];if(typeof c=="string"){for(l=c.length;c.charCodeAt(l-1)===32;)o++,l--;if(l)break;l=-1}else if(c===-2)f=!0,o++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const c={type:n===e.length||f||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?l:r.start._bufferIndex+l,_index:r.start._index+i,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const W9={42:_r,43:_r,45:_r,48:_r,49:_r,50:_r,51:_r,52:_r,53:_r,54:_r,55:_r,56:_r,57:_r,62:VM},Z9={91:n9},J9={[-2]:Fy,[-1]:Fy,32:Fy},eH={35:o9,42:Nv,45:[XT,Nv],60:d9,61:XT,95:Nv,96:YT,126:YT},tH={38:GM,92:HM},nH={[-5]:qy,[-4]:qy,[-3]:qy,33:D9,38:GM,42:Sb,60:[M8,x9],91:M9,92:[s9,HM],93:W1,95:Sb,96:G8},rH={null:[Sb,Y9]},aH={null:[42,95]},iH={null:[]},sH=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:aH,contentInitial:Z9,disable:iH,document:W9,flow:eH,flowInitial:J9,insideSpan:rH,string:tH,text:nH},Symbol.toStringTag,{value:"Module"}));function lH(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let l=[],o=[];const f={attempt:j(D),check:j(A),consume:C,enter:T,exit:k,interrupt:j(A,{interrupt:!0})},c={code:null,containerState:{},defineSkip:S,events:[],now:x,parser:e,previous:null,sliceSerialize:m,sliceStream:y,write:v};let d=t.tokenize.call(c,f);return t.resolveAll&&i.push(t),c;function v(z){return l=ya(l,z),w(),l[l.length-1]!==null?[]:(L(t,0),c.events=zp(i,c.events,c),c.events)}function m(z,P){return uH(y(z),P)}function y(z){return oH(l,z)}function x(){const{_bufferIndex:z,_index:P,line:G,column:I,offset:F}=r;return{_bufferIndex:z,_index:P,line:G,column:I,offset:F}}function S(z){a[z.line]=z.column,M()}function w(){let z;for(;r._index<l.length;){const P=l[r._index];if(typeof P=="string")for(z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<P.length;)b(P.charCodeAt(r._bufferIndex));else b(P)}}function b(z){d=d(z)}function C(z){tt(z)?(r.line++,r.column=1,r.offset+=z===-3?2:1,M()):z!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=z}function T(z,P){const G=P||{};return G.type=z,G.start=x(),c.events.push(["enter",G,c]),o.push(G),G}function k(z){const P=o.pop();return P.end=x(),c.events.push(["exit",P,c]),P}function D(z,P){L(z,P.from)}function A(z,P){P.restore()}function j(z,P){return G;function G(I,F,B){let H,K,Q,V;return Array.isArray(I)?X(I):"tokenize"in I?X([I]):q(I);function q(oe){return ae;function ae(we){const fe=we!==null&&oe[we],J=we!==null&&oe.null,ne=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(J)?J:J?[J]:[]];return X(ne)(we)}}function X(oe){return H=oe,K=0,oe.length===0?B:U(oe[K])}function U(oe){return ae;function ae(we){return V=_(),Q=oe,oe.partial||(c.currentConstruct=oe),oe.name&&c.parser.constructs.disable.null.includes(oe.name)?ie():oe.tokenize.call(P?Object.assign(Object.create(c),P):c,f,te,ie)(we)}}function te(oe){return z(Q,V),F}function ie(oe){return V.restore(),++K<H.length?U(H[K]):B}}}function L(z,P){z.resolveAll&&!i.includes(z)&&i.push(z),z.resolve&&ea(c.events,P,c.events.length-P,z.resolve(c.events.slice(P),c)),z.resolveTo&&(c.events=z.resolveTo(c.events,c))}function _(){const z=x(),P=c.previous,G=c.currentConstruct,I=c.events.length,F=Array.from(o);return{from:I,restore:B};function B(){r=z,c.previous=P,c.currentConstruct=G,c.events.length=I,o=F,M()}}function M(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function oH(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let l;if(n===a)l=[e[n].slice(r,i)];else{if(l=e.slice(n,a),r>-1){const o=l[0];typeof o=="string"?l[0]=o.slice(r):l.shift()}i>0&&l.push(e[a].slice(0,i))}return l}function uH(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let l;if(typeof i=="string")l=i;else switch(i){case-5:{l="\r";break}case-4:{l=`
381
+ `;break}case-3:{l=`\r
382
+ `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&a)continue;l=" ";break}default:l=String.fromCharCode(i)}a=i===-2,r.push(l)}return r.join("")}function cH(e){const r={constructs:qM([sH,...(e||{}).extensions||[]]),content:a(T8),defined:[],document:a(k8),flow:a(G9),lazy:{},string:a(K9),text:a(X9)};return r;function a(i){return l;function l(o){return lH(r,i,o)}}}function fH(e){for(;!$M(e););return e}const QT=/[\0\t\n\r]/g;function dH(){let e=1,t="",n=!0,r;return a;function a(i,l,o){const f=[];let c,d,v,m,y;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(l||void 0).decode(i)),v=0,t="",n&&(i.charCodeAt(0)===65279&&v++,n=void 0);v<i.length;){if(QT.lastIndex=v,c=QT.exec(i),m=c&&c.index!==void 0?c.index:i.length,y=i.charCodeAt(m),!c){t=i.slice(v);break}if(y===10&&v===m&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),v<m&&(f.push(i.slice(v,m)),e+=m-v),y){case 0:{f.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,f.push(-2);e++<d;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:r=!0,e=1}v=m+1}return o&&(r&&f.push(-5),t&&f.push(t),f.push(null)),f}}const hH=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function vH(e){return e.replace(hH,pH)}function pH(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return UM(n.slice(i?2:1),i?16:10)}return Q1(n)||e}const ZM={}.hasOwnProperty;function mH(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),gH(n)(fH(cH(n).document().write(dH()(e,t,!0))))}function gH(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(qe),autolinkProtocol:_,autolinkEmail:_,atxHeading:i(Be),blockQuote:i(J),characterEscape:_,characterReference:_,codeFenced:i(ne),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:i(ne,l),codeText:i(re,l),codeTextData:_,data:_,codeFlowValue:_,definition:i(ge),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:i(Ne),hardBreakEscape:i(st),hardBreakTrailing:i(st),htmlFlow:i(Qe,l),htmlFlowData:_,htmlText:i(Qe,l),htmlTextData:_,image:i(Ke),label:l,link:i(qe),listItem:i(Ge),listItemValue:m,listOrdered:i(De,v),listUnordered:i(De),paragraph:i(Ye),reference:U,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:i(Be),strong:i(it),thematicBreak:i(ct)},exit:{atxHeading:f(),atxHeadingSequence:D,autolink:f(),autolinkEmail:fe,autolinkProtocol:we,blockQuote:f(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:oe,characterReference:ae,codeFenced:f(w),codeFencedFence:S,codeFencedFenceInfo:y,codeFencedFenceMeta:x,codeFlowValue:M,codeIndented:f(b),codeText:f(F),codeTextData:M,data:M,definition:f(),definitionDestinationString:k,definitionLabelString:C,definitionTitleString:T,emphasis:f(),hardBreakEscape:f(P),hardBreakTrailing:f(P),htmlFlow:f(G),htmlFlowData:M,htmlText:f(I),htmlTextData:M,image:f(H),label:Q,labelText:K,lineEnding:z,link:f(B),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:te,resourceDestinationString:V,resourceTitleString:q,resource:X,setextHeading:f(L),setextHeadingLineSequence:j,setextHeadingText:A,strong:f(),thematicBreak:f()}};JM(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(he){let Ce={type:"root",children:[]};const je={stack:[Ce],tokenStack:[],config:t,enter:o,exit:c,buffer:l,resume:d,data:n},ze=[];let Me=-1;for(;++Me<he.length;)if(he[Me][1].type==="listOrdered"||he[Me][1].type==="listUnordered")if(he[Me][0]==="enter")ze.push(Me);else{const Oe=ze.pop();Me=a(he,Oe,Me)}for(Me=-1;++Me<he.length;){const Oe=t[he[Me][0]];ZM.call(Oe,he[Me][1].type)&&Oe[he[Me][1].type].call(Object.assign({sliceSerialize:he[Me][2].sliceSerialize},je),he[Me][1])}if(je.tokenStack.length>0){const Oe=je.tokenStack[je.tokenStack.length-1];(Oe[1]||WT).call(je,void 0,Oe[0])}for(Ce.position={start:js(he.length>0?he[0][1].start:{line:1,column:1,offset:0}),end:js(he.length>0?he[he.length-2][1].end:{line:1,column:1,offset:0})},Me=-1;++Me<t.transforms.length;)Ce=t.transforms[Me](Ce)||Ce;return Ce}function a(he,Ce,je){let ze=Ce-1,Me=-1,Oe=!1,ye,Y,le,pe;for(;++ze<=je;){const de=he[ze];switch(de[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{de[0]==="enter"?Me++:Me--,pe=void 0;break}case"lineEndingBlank":{de[0]==="enter"&&(ye&&!pe&&!Me&&!le&&(le=ze),pe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:pe=void 0}if(!Me&&de[0]==="enter"&&de[1].type==="listItemPrefix"||Me===-1&&de[0]==="exit"&&(de[1].type==="listUnordered"||de[1].type==="listOrdered")){if(ye){let xe=ze;for(Y=void 0;xe--;){const Le=he[xe];if(Le[1].type==="lineEnding"||Le[1].type==="lineEndingBlank"){if(Le[0]==="exit")continue;Y&&(he[Y][1].type="lineEndingBlank",Oe=!0),Le[1].type="lineEnding",Y=xe}else if(!(Le[1].type==="linePrefix"||Le[1].type==="blockQuotePrefix"||Le[1].type==="blockQuotePrefixWhitespace"||Le[1].type==="blockQuoteMarker"||Le[1].type==="listItemIndent"))break}le&&(!Y||le<Y)&&(ye._spread=!0),ye.end=Object.assign({},Y?he[Y][1].start:de[1].end),he.splice(Y||ze,0,["exit",ye,de[2]]),ze++,je++}if(de[1].type==="listItemPrefix"){const xe={type:"listItem",_spread:!1,start:Object.assign({},de[1].start),end:void 0};ye=xe,he.splice(ze,0,["enter",xe,de[2]]),ze++,je++,le=void 0,pe=!0}}}return he[Ce][1]._spread=Oe,je}function i(he,Ce){return je;function je(ze){o.call(this,he(ze),ze),Ce&&Ce.call(this,ze)}}function l(){this.stack.push({type:"fragment",children:[]})}function o(he,Ce,je){this.stack[this.stack.length-1].children.push(he),this.stack.push(he),this.tokenStack.push([Ce,je||void 0]),he.position={start:js(Ce.start),end:void 0}}function f(he){return Ce;function Ce(je){he&&he.call(this,je),c.call(this,je)}}function c(he,Ce){const je=this.stack.pop(),ze=this.tokenStack.pop();if(ze)ze[0].type!==he.type&&(Ce?Ce.call(this,he,ze[0]):(ze[1]||WT).call(this,he,ze[0]));else throw new Error("Cannot close `"+he.type+"` ("+Mf({start:he.start,end:he.end})+"): it’s not open");je.position.end=js(he.end)}function d(){return X1(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function m(he){if(this.data.expectingFirstListItemValue){const Ce=this.stack[this.stack.length-2];Ce.start=Number.parseInt(this.sliceSerialize(he),10),this.data.expectingFirstListItemValue=void 0}}function y(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.lang=he}function x(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.meta=he}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=he.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=he.replace(/(\r?\n|\r)$/g,"")}function C(he){const Ce=this.resume(),je=this.stack[this.stack.length-1];je.label=Ce,je.identifier=Da(this.sliceSerialize(he)).toLowerCase()}function T(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=he}function k(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=he}function D(he){const Ce=this.stack[this.stack.length-1];if(!Ce.depth){const je=this.sliceSerialize(he).length;Ce.depth=je}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function j(he){const Ce=this.stack[this.stack.length-1];Ce.depth=this.sliceSerialize(he).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function _(he){const je=this.stack[this.stack.length-1].children;let ze=je[je.length-1];(!ze||ze.type!=="text")&&(ze=Pe(),ze.position={start:js(he.start),end:void 0},je.push(ze)),this.stack.push(ze)}function M(he){const Ce=this.stack.pop();Ce.value+=this.sliceSerialize(he),Ce.position.end=js(he.end)}function z(he){const Ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const je=Ce.children[Ce.children.length-1];je.position.end=js(he.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Ce.type)&&(_.call(this,he),M.call(this,he))}function P(){this.data.atHardBreak=!0}function G(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=he}function I(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=he}function F(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=he}function B(){const he=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";he.type+="Reference",he.referenceType=Ce,delete he.url,delete he.title}else delete he.identifier,delete he.label;this.data.referenceType=void 0}function H(){const he=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";he.type+="Reference",he.referenceType=Ce,delete he.url,delete he.title}else delete he.identifier,delete he.label;this.data.referenceType=void 0}function K(he){const Ce=this.sliceSerialize(he),je=this.stack[this.stack.length-2];je.label=vH(Ce),je.identifier=Da(Ce).toLowerCase()}function Q(){const he=this.stack[this.stack.length-1],Ce=this.resume(),je=this.stack[this.stack.length-1];if(this.data.inReference=!0,je.type==="link"){const ze=he.children;je.children=ze}else je.alt=Ce}function V(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=he}function q(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=he}function X(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function te(he){const Ce=this.resume(),je=this.stack[this.stack.length-1];je.label=Ce,je.identifier=Da(this.sliceSerialize(he)).toLowerCase(),this.data.referenceType="full"}function ie(he){this.data.characterReferenceType=he.type}function oe(he){const Ce=this.sliceSerialize(he),je=this.data.characterReferenceType;let ze;je?(ze=UM(Ce,je==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ze=Q1(Ce);const Me=this.stack[this.stack.length-1];Me.value+=ze}function ae(he){const Ce=this.stack.pop();Ce.position.end=js(he.end)}function we(he){M.call(this,he);const Ce=this.stack[this.stack.length-1];Ce.url=this.sliceSerialize(he)}function fe(he){M.call(this,he);const Ce=this.stack[this.stack.length-1];Ce.url="mailto:"+this.sliceSerialize(he)}function J(){return{type:"blockquote",children:[]}}function ne(){return{type:"code",lang:null,meta:null,value:""}}function re(){return{type:"inlineCode",value:""}}function ge(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ne(){return{type:"emphasis",children:[]}}function Be(){return{type:"heading",depth:0,children:[]}}function st(){return{type:"break"}}function Qe(){return{type:"html",value:""}}function Ke(){return{type:"image",title:null,url:"",alt:null}}function qe(){return{type:"link",title:null,url:"",children:[]}}function De(he){return{type:"list",ordered:he.type==="listOrdered",start:null,spread:he._spread,children:[]}}function Ge(he){return{type:"listItem",spread:he._spread,checked:null,children:[]}}function Ye(){return{type:"paragraph",children:[]}}function it(){return{type:"strong",children:[]}}function Pe(){return{type:"text",value:""}}function ct(){return{type:"thematicBreak"}}}function js(e){return{line:e.line,column:e.column,offset:e.offset}}function JM(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?JM(e,r):yH(e,r)}}function yH(e,t){let n;for(n in t)if(ZM.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function WT(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Mf({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Mf({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Mf({start:t.start,end:t.end})+") is still open")}function xH(e){const t=this;t.parser=n;function n(r){return mH(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function bH(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function wH(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
383
+ `}]}function SH(e,t){const n=t.value?t.value+`
384
+ `:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function EH(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CH(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TH(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=cc(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let l,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=i+1,o+=1,e.footnoteCounts.set(r,o);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,f);const c={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,c),e.applyData(t,c)}function NH(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kH(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function eO(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),i=a[0];i&&i.type==="text"?i.value="["+i.value:a.unshift({type:"text",value:"["});const l=a[a.length-1];return l&&l.type==="text"?l.value+=r:a.push({type:"text",value:r}),a}function AH(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return eO(e,t);const a={src:cc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,i),e.applyData(t,i)}function RH(e,t){const n={src:cc(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function DH(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function jH(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return eO(e,t);const a={href:cc(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function MH(e,t){const n={href:cc(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function OH(e,t,n){const r=e.all(t),a=n?LH(n):tO(t),i={},l=[];if(typeof t.checked=="boolean"){const d=r[0];let v;d&&d.type==="element"&&d.tagName==="p"?v=d:(v={type:"element",tagName:"p",properties:{},children:[]},r.unshift(v)),v.children.length>0&&v.children.unshift({type:"text",value:" "}),v.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const d=r[o];(a||o!==0||d.type!=="element"||d.tagName!=="p")&&l.push({type:"text",value:`
385
+ `}),d.type==="element"&&d.tagName==="p"&&!a?l.push(...d.children):l.push(d)}const f=r[r.length-1];f&&(a||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
386
+ `});const c={type:"element",tagName:"li",properties:i,children:l};return e.patch(t,c),e.applyData(t,c)}function LH(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=tO(n[r])}return t}function tO(e){const t=e.spread;return t??e.children.length>1}function _H(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<r.length;){const l=r[a];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function BH(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PH(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function zH(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function IH(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),a.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=G1(t.children[1]),f=LM(t.children[t.children.length-1]);o&&f&&(l.position={start:o,end:f}),a.push(l)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)}function FH(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,o=l?l.length:t.children.length;let f=-1;const c=[];for(;++f<o;){const v=t.children[f],m={},y=l?l[f]:void 0;y&&(m.align=y);let x={type:"element",tagName:i,properties:m,children:[]};v&&(x.children=e.all(v),e.patch(v,x),x=e.applyData(v,x)),c.push(x)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,d),e.applyData(t,d)}function qH(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ZT=9,JT=32;function UH(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const i=[];for(;r;)i.push(eN(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return i.push(eN(t.slice(a),a>0,!1)),i.join("")}function eN(e,t,n){let r=0,a=e.length;if(t){let i=e.codePointAt(r);for(;i===ZT||i===JT;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(a-1);for(;i===ZT||i===JT;)a--,i=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function VH(e,t){const n={type:"text",value:UH(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function HH(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const GH={blockquote:bH,break:wH,code:SH,delete:EH,emphasis:CH,footnoteReference:TH,heading:NH,html:kH,imageReference:AH,image:RH,inlineCode:DH,linkReference:jH,link:MH,listItem:OH,list:_H,paragraph:BH,root:PH,strong:zH,table:IH,tableCell:qH,tableRow:FH,text:VH,thematicBreak:HH,toml:ev,yaml:ev,definition:ev,footnoteDefinition:ev};function ev(){}const nO=-1,Ip=0,Lf=1,Wv=2,Z1=3,J1=4,ew=5,tw=6,rO=7,aO=8,tN=typeof self=="object"?self:globalThis,$H=(e,t)=>{const n=(a,i)=>(e.set(i,a),a),r=a=>{if(e.has(a))return e.get(a);const[i,l]=t[a];switch(i){case Ip:case nO:return n(l,a);case Lf:{const o=n([],a);for(const f of l)o.push(r(f));return o}case Wv:{const o=n({},a);for(const[f,c]of l)o[r(f)]=r(c);return o}case Z1:return n(new Date(l),a);case J1:{const{source:o,flags:f}=l;return n(new RegExp(o,f),a)}case ew:{const o=n(new Map,a);for(const[f,c]of l)o.set(r(f),r(c));return o}case tw:{const o=n(new Set,a);for(const f of l)o.add(r(f));return o}case rO:{const{name:o,message:f}=l;return n(new tN[o](f),a)}case aO:return n(BigInt(l),a);case"BigInt":return n(Object(BigInt(l)),a);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:o}=new Uint8Array(l);return n(new DataView(o),l)}}return n(new tN[i](l),a)};return r},nN=e=>$H(new Map,e)(0),fu="",{toString:YH}={},{keys:KH}=Object,mf=e=>{const t=typeof e;if(t!=="object"||!e)return[Ip,t];const n=YH.call(e).slice(8,-1);switch(n){case"Array":return[Lf,fu];case"Object":return[Wv,fu];case"Date":return[Z1,fu];case"RegExp":return[J1,fu];case"Map":return[ew,fu];case"Set":return[tw,fu];case"DataView":return[Lf,n]}return n.includes("Array")?[Lf,n]:n.includes("Error")?[rO,n]:[Wv,n]},tv=([e,t])=>e===Ip&&(t==="function"||t==="symbol"),XH=(e,t,n,r)=>{const a=(l,o)=>{const f=r.push(l)-1;return n.set(o,f),f},i=l=>{if(n.has(l))return n.get(l);let[o,f]=mf(l);switch(o){case Ip:{let d=l;switch(f){case"bigint":o=aO,d=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);d=null;break;case"undefined":return a([nO],l)}return a([o,d],l)}case Lf:{if(f){let m=l;return f==="DataView"?m=new Uint8Array(l.buffer):f==="ArrayBuffer"&&(m=new Uint8Array(l)),a([f,[...m]],l)}const d=[],v=a([o,d],l);for(const m of l)d.push(i(m));return v}case Wv:{if(f)switch(f){case"BigInt":return a([f,l.toString()],l);case"Boolean":case"Number":case"String":return a([f,l.valueOf()],l)}if(t&&"toJSON"in l)return i(l.toJSON());const d=[],v=a([o,d],l);for(const m of KH(l))(e||!tv(mf(l[m])))&&d.push([i(m),i(l[m])]);return v}case Z1:return a([o,l.toISOString()],l);case J1:{const{source:d,flags:v}=l;return a([o,{source:d,flags:v}],l)}case ew:{const d=[],v=a([o,d],l);for(const[m,y]of l)(e||!(tv(mf(m))||tv(mf(y))))&&d.push([i(m),i(y)]);return v}case tw:{const d=[],v=a([o,d],l);for(const m of l)(e||!tv(mf(m)))&&d.push(i(m));return v}}const{message:c}=l;return a([o,{name:f,message:c}],l)};return i},rN=(e,{json:t,lossy:n}={})=>{const r=[];return XH(!(t||n),!!t,new Map,r)(e),r},Zv=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?nN(rN(e,t)):structuredClone(e):(e,t)=>nN(rN(e,t));function QH(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function WH(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function ZH(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||QH,r=e.options.footnoteBackLabel||WH,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let f=-1;for(;++f<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[f]);if(!c)continue;const d=e.all(c),v=String(c.identifier).toUpperCase(),m=cc(v.toLowerCase());let y=0;const x=[],S=e.footnoteCounts.get(v);for(;S!==void 0&&++y<=S;){x.length>0&&x.push({type:"text",value:" "});let C=typeof n=="string"?n:n(f,y);typeof C=="string"&&(C={type:"text",value:C}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,y),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const w=d[d.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const C=w.children[w.children.length-1];C&&C.type==="text"?C.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...x)}else d.push(...x);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(c,b),o.push(b)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Zv(l),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
387
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
388
+ `}]}}const Fp=(function(e){if(e==null)return n7;if(typeof e=="function")return qp(e);if(typeof e=="object")return Array.isArray(e)?JH(e):e7(e);if(typeof e=="string")return t7(e);throw new Error("Expected function, string, or object as test")});function JH(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Fp(e[n]);return qp(r);function r(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function e7(e){const t=e;return qp(n);function n(r){const a=r;let i;for(i in e)if(a[i]!==t[i])return!1;return!0}}function t7(e){return qp(t);function t(n){return n&&n.type===e}}function qp(e){return t;function t(n,r,a){return!!(r7(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function n7(){return!0}function r7(e){return e!==null&&typeof e=="object"&&"type"in e}const iO=[],a7=!0,Eb=!1,i7="skip";function sO(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const i=Fp(a),l=r?-1:1;o(e,void 0,[])();function o(f,c,d){const v=f&&typeof f=="object"?f:{};if(typeof v.type=="string"){const y=typeof v.tagName=="string"?v.tagName:typeof v.name=="string"?v.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(f.type+(y?"<"+y+">":""))+")"})}return m;function m(){let y=iO,x,S,w;if((!t||i(f,c,d[d.length-1]||void 0))&&(y=s7(n(f,d)),y[0]===Eb))return y;if("children"in f&&f.children){const b=f;if(b.children&&y[0]!==i7)for(S=(r?b.children.length:-1)+l,w=d.concat(b);S>-1&&S<b.children.length;){const C=b.children[S];if(x=o(C,S,w)(),x[0]===Eb)return x;S=typeof x[1]=="number"?x[1]:S+l}}return y}}}function s7(e){return Array.isArray(e)?e:typeof e=="number"?[a7,e]:e==null?iO:[e]}function nw(e,t,n,r){let a,i,l;typeof t=="function"&&typeof n!="function"?(i=void 0,l=t,a=n):(i=t,l=n,a=r),sO(e,i,o,a);function o(f,c){const d=c[c.length-1],v=d?d.children.indexOf(f):void 0;return l(f,v,d)}}const Cb={}.hasOwnProperty,l7={};function o7(e,t){const n=t||l7,r=new Map,a=new Map,i=new Map,l={...GH,...n.handlers},o={all:c,applyData:c7,definitionById:r,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:l,one:f,options:n,patch:u7,wrap:d7};return nw(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const v=d.type==="definition"?r:a,m=String(d.identifier).toUpperCase();v.has(m)||v.set(m,d)}}),o;function f(d,v){const m=d.type,y=o.handlers[m];if(Cb.call(o.handlers,m)&&y)return y(o,d,v);if(o.options.passThrough&&o.options.passThrough.includes(m)){if("children"in d){const{children:S,...w}=d,b=Zv(w);return b.children=o.all(d),b}return Zv(d)}return(o.options.unknownHandler||f7)(o,d,v)}function c(d){const v=[];if("children"in d){const m=d.children;let y=-1;for(;++y<m.length;){const x=o.one(m[y],d);if(x){if(y&&m[y-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=aN(x.value)),!Array.isArray(x)&&x.type==="element")){const S=x.children[0];S&&S.type==="text"&&(S.value=aN(S.value))}Array.isArray(x)?v.push(...x):v.push(x)}}}return v}}function u7(e,t){e.position&&(t.position=WV(e))}function c7(e,t){let n=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&i&&Object.assign(n.properties,Zv(i)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function f7(e,t){const n=t.data||{},r="value"in t&&!(Cb.call(n,"hProperties")||Cb.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function d7(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
389
+ `});++r<e.length;)r&&n.push({type:"text",value:`
390
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
391
+ `}),n}function aN(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function iN(e,t){const n=o7(e,t),r=n.one(e,void 0),a=ZH(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&i.children.push({type:"text",value:`
392
+ `},a),i}function h7(e,t){return e&&"run"in e?async function(n,r){const a=iN(n,{file:r,...t});await e.run(a,r)}:function(n,r){return iN(n,{file:r,...e||t})}}function sN(e){if(e)throw e}var Uy,lN;function v7(){if(lN)return Uy;lN=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},i=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var d=e.call(c,"constructor"),v=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!d&&!v)return!1;var m;for(m in c);return typeof m>"u"||e.call(c,m)},l=function(c,d){n&&d.name==="__proto__"?n(c,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):c[d.name]=d.newValue},o=function(c,d){if(d==="__proto__")if(e.call(c,d)){if(r)return r(c,d).value}else return;return c[d]};return Uy=function f(){var c,d,v,m,y,x,S=arguments[0],w=1,b=arguments.length,C=!1;for(typeof S=="boolean"&&(C=S,S=arguments[1]||{},w=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});w<b;++w)if(c=arguments[w],c!=null)for(d in c)v=o(S,d),m=o(c,d),S!==m&&(C&&m&&(i(m)||(y=a(m)))?(y?(y=!1,x=v&&a(v)?v:[]):x=v&&i(v)?v:{},l(S,{name:d,newValue:f(C,x,m)})):typeof m<"u"&&l(S,{name:d,newValue:m}));return S},Uy}var p7=v7();const Vy=ld(p7);function Tb(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function m7(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const l=a.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);o(null,...a);function o(f,...c){const d=e[++i];let v=-1;if(f){l(f);return}for(;++v<a.length;)(c[v]===null||c[v]===void 0)&&(c[v]=a[v]);a=c,d?g7(d,o)(...c):l(null,...c)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function g7(e,t){let n;return r;function r(...l){const o=e.length>l.length;let f;o&&l.push(a);try{f=e.apply(this,l)}catch(c){const d=c;if(o&&n)throw d;return a(d)}o||(f&&f.then&&typeof f.then=="function"?f.then(i,a):f instanceof Error?a(f):i(f))}function a(l,...o){n||(n=!0,t(l,...o))}function i(l){a(null,l)}}const Ka={basename:y7,dirname:x7,extname:b7,join:w7,sep:"/"};function y7(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');yd(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else l<0&&(i=!0,l=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function x7(e){if(yd(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function b7(e){yd(e);let t=e.length,n=-1,r=0,a=-1,i=0,l;for(;t--;){const o=e.codePointAt(t);if(o===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),o===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function w7(...e){let t=-1,n;for(;++t<e.length;)yd(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":S7(n)}function S7(e){yd(e);const t=e.codePointAt(0)===47;let n=E7(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function E7(e,t){let n="",r=0,a=-1,i=0,l=-1,o,f;for(;++l<=e.length;){if(l<e.length)o=e.codePointAt(l);else{if(o===47)break;o=47}if(o===47){if(!(a===l-1||i===1))if(a!==l-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),a=l,i=0;continue}}else if(n.length>0){n="",r=0,a=l,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,l):n=e.slice(a+1,l),r=l-a-1;a=l,i=0}else o===46&&i>-1?i++:i=-1}return n}function yd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const C7={cwd:T7};function T7(){return"/"}function Nb(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function N7(e){if(typeof e=="string")e=new URL(e);else if(!Nb(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return k7(e)}function k7(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Hy=["history","path","basename","stem","extname","dirname"];class lO{constructor(t){let n;t?Nb(t)?n={path:t}:typeof t=="string"||A7(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":C7.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Hy.length;){const i=Hy[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Hy.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ka.basename(this.path):void 0}set basename(t){$y(t,"basename"),Gy(t,"basename"),this.path=Ka.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ka.dirname(this.path):void 0}set dirname(t){oN(this.basename,"dirname"),this.path=Ka.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ka.extname(this.path):void 0}set extname(t){if(Gy(t,"extname"),oN(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ka.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Nb(t)&&(t=N7(t)),$y(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ka.basename(this.path,this.extname):void 0}set stem(t){$y(t,"stem"),Gy(t,"stem"),this.path=Ka.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new gr(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Gy(e,t){if(e&&e.includes(Ka.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ka.sep+"`")}function $y(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function oN(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function A7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const R7=(function(e){const r=this.constructor.prototype,a=r[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),D7={}.hasOwnProperty;class rw extends R7{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=m7()}copy(){const t=new rw;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Vy(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Xy("data",this.frozen),this.namespace[t]=n,this):D7.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Xy("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=nv(t),r=this.parser||this.Parser;return Yy("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Yy("process",this.parser||this.Parser),Ky("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,l){const o=nv(t),f=r.parse(o);r.run(f,o,function(d,v,m){if(d||!v||!m)return c(d);const y=v,x=r.stringify(y,m);O7(x)?m.value=x:m.result=x,c(d,m)});function c(d,v){d||!v?l(d):i?i(v):n(void 0,v)}}}processSync(t){let n=!1,r;return this.freeze(),Yy("processSync",this.parser||this.Parser),Ky("processSync",this.compiler||this.Compiler),this.process(t,a),cN("processSync","process",n),r;function a(i,l){n=!0,sN(i),r=l}}run(t,n,r){uN(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(l,o){const f=nv(n);a.run(t,f,c);function c(d,v,m){const y=v||t;d?o(d):l?l(y):r(void 0,y,m)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),cN("runSync","run",r),a;function i(l,o){sN(l),a=o,r=!0}}stringify(t,n){this.freeze();const r=nv(n),a=this.compiler||this.Compiler;return Ky("stringify",a),uN(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Xy("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")f(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...v]=c;f(d,v)}else l(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function l(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(c.plugins),c.settings&&(a.settings=Vy(!0,a.settings,c.settings))}function o(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const v=c[d];i(v)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function f(c,d){let v=-1,m=-1;for(;++v<r.length;)if(r[v][0]===c){m=v;break}if(m===-1)r.push([c,...d]);else if(d.length>0){let[y,...x]=d;const S=r[m][1];Tb(S)&&Tb(y)&&(y=Vy(!0,S,y)),r[m]=[c,y,...x]}}}}const j7=new rw().freeze();function Yy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ky(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Xy(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function uN(e){if(!Tb(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function cN(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function nv(e){return M7(e)?e:new lO(e)}function M7(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function O7(e){return typeof e=="string"||L7(e)}function L7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const _7="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",fN=[],dN={allowDangerousHtml:!0},B7=/^(https?|ircs?|mailto|xmpp)$/i,P7=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function z7(e){const t=I7(e),n=F7(e);return q7(t.runSync(t.parse(n),n),e)}function I7(e){const t=e.rehypePlugins||fN,n=e.remarkPlugins||fN,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...dN}:dN;return j7().use(xH).use(n).use(h7,r).use(t)}function F7(e){const t=e.children||"",n=new lO;return typeof t=="string"&&(n.value=t),n}function q7(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,i=t.disallowedElements,l=t.skipHtml,o=t.unwrapDisallowed,f=t.urlTransform||U7;for(const d of P7)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+_7+d.id,void 0);return nw(e,c),n8(e,{Fragment:p.Fragment,components:a,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0});function c(d,v,m){if(d.type==="raw"&&m&&typeof v=="number")return l?m.children.splice(v,1):m.children[v]={type:"text",value:d.value},v;if(d.type==="element"){let y;for(y in Iy)if(Object.hasOwn(Iy,y)&&Object.hasOwn(d.properties,y)){const x=d.properties[y],S=Iy[y];(S===null||S.includes(d.tagName))&&(d.properties[y]=f(String(x||""),y,d))}}if(d.type==="element"){let y=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!y&&r&&typeof v=="number"&&(y=!r(d,v,m)),y&&m&&typeof v=="number")return o&&d.children?m.children.splice(v,1,...d.children):m.children.splice(v,1),v}}}function U7(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||B7.test(e.slice(0,t))?e:""}function hN(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function V7(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function H7(e,t,n){const a=Fp((n||{}).ignore||[]),i=G7(t);let l=-1;for(;++l<i.length;)sO(e,"text",o);function o(c,d){let v=-1,m;for(;++v<d.length;){const y=d[v],x=m?m.children:void 0;if(a(y,x?x.indexOf(y):void 0,m))return;m=y}if(m)return f(c,d)}function f(c,d){const v=d[d.length-1],m=i[l][0],y=i[l][1];let x=0;const w=v.children.indexOf(c);let b=!1,C=[];m.lastIndex=0;let T=m.exec(c.value);for(;T;){const k=T.index,D={index:T.index,input:T.input,stack:[...d,c]};let A=y(...T,D);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?m.lastIndex=k+1:(x!==k&&C.push({type:"text",value:c.value.slice(x,k)}),Array.isArray(A)?C.push(...A):A&&C.push(A),x=k+T[0].length,b=!0),!m.global)break;T=m.exec(c.value)}return b?(x<c.value.length&&C.push({type:"text",value:c.value.slice(x)}),v.children.splice(w,1,...C)):C=[c],w+C.length}}function G7(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const a=n[r];t.push([$7(a[0]),Y7(a[1])])}return t}function $7(e){return typeof e=="string"?new RegExp(V7(e),"g"):e}function Y7(e){return typeof e=="function"?e:function(){return e}}const Qy="phrasing",Wy=["autolink","link","image","label"];function K7(){return{transforms:[tG],enter:{literalAutolink:Q7,literalAutolinkEmail:Zy,literalAutolinkHttp:Zy,literalAutolinkWww:Zy},exit:{literalAutolink:eG,literalAutolinkEmail:J7,literalAutolinkHttp:W7,literalAutolinkWww:Z7}}}function X7(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Qy,notInConstruct:Wy},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Qy,notInConstruct:Wy},{character:":",before:"[ps]",after:"\\/",inConstruct:Qy,notInConstruct:Wy}]}}function Q7(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Zy(e){this.config.enter.autolinkProtocol.call(this,e)}function W7(e){this.config.exit.autolinkProtocol.call(this,e)}function Z7(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function J7(e){this.config.exit.autolinkEmail.call(this,e)}function eG(e){this.exit(e)}function tG(e){H7(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,nG],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),rG]],{ignore:["link","linkReference"]})}function nG(e,t,n,r,a){let i="";if(!oO(a)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!aG(n)))return!1;const l=iG(n+r);if(!l[0])return!1;const o={type:"link",title:null,url:i+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[o,{type:"text",value:l[1]}]:o}function rG(e,t,n,r){return!oO(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function aG(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function iG(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=hN(e,"(");let i=hN(e,")");for(;r!==-1&&a>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function oO(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||po(n)||Pp(n))&&(!t||n!==47)}uO.peek=vG;function sG(){this.buffer()}function lG(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function oG(){this.buffer()}function uG(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function cG(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Da(this.sliceSerialize(e)).toLowerCase(),n.label=t}function fG(e){this.exit(e)}function dG(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Da(this.sliceSerialize(e)).toLowerCase(),n.label=t}function hG(e){this.exit(e)}function vG(){return"["}function uO(e,t,n,r){const a=n.createTracker(r);let i=a.move("[^");const l=n.enter("footnoteReference"),o=n.enter("reference");return i+=a.move(n.safe(n.associationId(e),{after:"]",before:i})),o(),l(),i+=a.move("]"),i}function pG(){return{enter:{gfmFootnoteCallString:sG,gfmFootnoteCall:lG,gfmFootnoteDefinitionLabelString:oG,gfmFootnoteDefinition:uG},exit:{gfmFootnoteCallString:cG,gfmFootnoteCall:fG,gfmFootnoteDefinitionLabelString:dG,gfmFootnoteDefinition:hG}}}function mG(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:uO},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,i,l){const o=i.createTracker(l);let f=o.move("[^");const c=i.enter("footnoteDefinition"),d=i.enter("label");return f+=o.move(i.safe(i.associationId(r),{before:f,after:"]"})),d(),f+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),f+=o.move((t?`
393
+ `:" ")+i.indentLines(i.containerFlow(r,o.current()),t?cO:gG))),c(),f}}function gG(e,t,n){return t===0?e:cO(e,t,n)}function cO(e,t,n){return(n?"":" ")+e}const yG=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];fO.peek=EG;function xG(){return{canContainEols:["delete"],enter:{strikethrough:wG},exit:{strikethrough:SG}}}function bG(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:yG}],handlers:{delete:fO}}}function wG(e){this.enter({type:"delete",children:[]},e)}function SG(e){this.exit(e)}function fO(e,t,n,r){const a=n.createTracker(r),i=n.enter("strikethrough");let l=a.move("~~");return l+=n.containerPhrasing(e,{...a.current(),before:l,after:"~"}),l+=a.move("~~"),i(),l}function EG(){return"~"}function CG(e){return e.length}function TG(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||CG,i=[],l=[],o=[],f=[];let c=0,d=-1;for(;++d<e.length;){const S=[],w=[];let b=-1;for(e[d].length>c&&(c=e[d].length);++b<e[d].length;){const C=NG(e[d][b]);if(n.alignDelimiters!==!1){const T=a(C);w[b]=T,(f[b]===void 0||T>f[b])&&(f[b]=T)}S.push(C)}l[d]=S,o[d]=w}let v=-1;if(typeof r=="object"&&"length"in r)for(;++v<c;)i[v]=vN(r[v]);else{const S=vN(r);for(;++v<c;)i[v]=S}v=-1;const m=[],y=[];for(;++v<c;){const S=i[v];let w="",b="";S===99?(w=":",b=":"):S===108?w=":":S===114&&(b=":");let C=n.alignDelimiters===!1?1:Math.max(1,f[v]-w.length-b.length);const T=w+"-".repeat(C)+b;n.alignDelimiters!==!1&&(C=w.length+C+b.length,C>f[v]&&(f[v]=C),y[v]=C),m[v]=T}l.splice(1,0,m),o.splice(1,0,y),d=-1;const x=[];for(;++d<l.length;){const S=l[d],w=o[d];v=-1;const b=[];for(;++v<c;){const C=S[v]||"";let T="",k="";if(n.alignDelimiters!==!1){const D=f[v]-(w[v]||0),A=i[v];A===114?T=" ".repeat(D):A===99?D%2?(T=" ".repeat(D/2+.5),k=" ".repeat(D/2-.5)):(T=" ".repeat(D/2),k=T):k=" ".repeat(D)}n.delimiterStart!==!1&&!v&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||v)&&b.push(" "),n.alignDelimiters!==!1&&b.push(T),b.push(C),n.alignDelimiters!==!1&&b.push(k),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||v!==c-1)&&b.push("|")}x.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return x.join(`
394
+ `)}function NG(e){return e==null?"":String(e)}function vN(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function kG(e,t,n,r){const a=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const l=n.indentLines(n.containerFlow(e,i.current()),AG);return a(),l}function AG(e,t,n){return">"+(n?"":" ")+e}function RG(e,t){return pN(e,t.inConstruct,!0)&&!pN(e,t.notInConstruct,!1)}function pN(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function mN(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
395
+ `&&RG(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return`\\
396
+ `}function DG(e,t){const n=String(e);let r=n.indexOf(t),a=r,i=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++i>l&&(l=i):i=1,a=r+t.length,r=n.indexOf(t,a);return l}function jG(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function MG(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function OG(e,t,n,r){const a=MG(n),i=e.value||"",l=a==="`"?"GraveAccent":"Tilde";if(jG(e,n)){const v=n.enter("codeIndented"),m=n.indentLines(i,LG);return v(),m}const o=n.createTracker(r),f=a.repeat(Math.max(DG(i,a)+1,3)),c=n.enter("codeFenced");let d=o.move(f);if(e.lang){const v=n.enter(`codeFencedLang${l}`);d+=o.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...o.current()})),v()}if(e.lang&&e.meta){const v=n.enter(`codeFencedMeta${l}`);d+=o.move(" "),d+=o.move(n.safe(e.meta,{before:d,after:`
397
+ `,encode:["`"],...o.current()})),v()}return d+=o.move(`
398
+ `),i&&(d+=o.move(i+`
399
+ `)),d+=o.move(f),c(),d}function LG(e,t,n){return(n?"":" ")+e}function aw(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function _G(e,t,n,r){const a=aw(n),i=a==='"'?"Quote":"Apostrophe",l=n.enter("definition");let o=n.enter("label");const f=n.createTracker(r);let c=f.move("[");return c+=f.move(n.safe(n.associationId(e),{before:c,after:"]",...f.current()})),c+=f.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),c+=f.move("<"),c+=f.move(n.safe(e.url,{before:c,after:">",...f.current()})),c+=f.move(">")):(o=n.enter("destinationRaw"),c+=f.move(n.safe(e.url,{before:c,after:e.title?" ":`
400
+ `,...f.current()}))),o(),e.title&&(o=n.enter(`title${i}`),c+=f.move(" "+a),c+=f.move(n.safe(e.title,{before:c,after:a,...f.current()})),c+=f.move(a),o()),l(),c}function BG(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Gf(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Jv(e,t,n){const r=Xu(e),a=Xu(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}dO.peek=PG;function dO(e,t,n,r){const a=BG(n),i=n.enter("emphasis"),l=n.createTracker(r),o=l.move(a);let f=l.move(n.containerPhrasing(e,{after:a,before:o,...l.current()}));const c=f.charCodeAt(0),d=Jv(r.before.charCodeAt(r.before.length-1),c,a);d.inside&&(f=Gf(c)+f.slice(1));const v=f.charCodeAt(f.length-1),m=Jv(r.after.charCodeAt(0),v,a);m.inside&&(f=f.slice(0,-1)+Gf(v));const y=l.move(a);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},o+f+y}function PG(e,t,n){return n.options.emphasis||"*"}function zG(e,t){let n=!1;return nw(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Eb}),!!((!e.depth||e.depth<3)&&X1(e)&&(t.options.setext||n))}function IG(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(zG(e,n)){const d=n.enter("headingSetext"),v=n.enter("phrasing"),m=n.containerPhrasing(e,{...i.current(),before:`
401
+ `,after:`
402
+ `});return v(),d(),m+`
403
+ `+(a===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
404
+ `))+1))}const l="#".repeat(a),o=n.enter("headingAtx"),f=n.enter("phrasing");i.move(l+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
405
+ `,...i.current()});return/^[\t ]/.test(c)&&(c=Gf(c.charCodeAt(0))+c.slice(1)),c=c?l+" "+c:l,n.options.closeAtx&&(c+=" "+l),f(),o(),c}hO.peek=FG;function hO(e){return e.value||""}function FG(){return"<"}vO.peek=qG;function vO(e,t,n,r){const a=aw(n),i=a==='"'?"Quote":"Apostrophe",l=n.enter("image");let o=n.enter("label");const f=n.createTracker(r);let c=f.move("![");return c+=f.move(n.safe(e.alt,{before:c,after:"]",...f.current()})),c+=f.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),c+=f.move("<"),c+=f.move(n.safe(e.url,{before:c,after:">",...f.current()})),c+=f.move(">")):(o=n.enter("destinationRaw"),c+=f.move(n.safe(e.url,{before:c,after:e.title?" ":")",...f.current()}))),o(),e.title&&(o=n.enter(`title${i}`),c+=f.move(" "+a),c+=f.move(n.safe(e.title,{before:c,after:a,...f.current()})),c+=f.move(a),o()),c+=f.move(")"),l(),c}function qG(){return"!"}pO.peek=UG;function pO(e,t,n,r){const a=e.referenceType,i=n.enter("imageReference");let l=n.enter("label");const o=n.createTracker(r);let f=o.move("![");const c=n.safe(e.alt,{before:f,after:"]",...o.current()});f+=o.move(c+"]["),l();const d=n.stack;n.stack=[],l=n.enter("reference");const v=n.safe(n.associationId(e),{before:f,after:"]",...o.current()});return l(),n.stack=d,i(),a==="full"||!c||c!==v?f+=o.move(v+"]"):a==="shortcut"?f=f.slice(0,-1):f+=o.move("]"),f}function UG(){return"!"}mO.peek=VG;function mO(e,t,n){let r=e.value||"",a="`",i=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const l=n.unsafe[i],o=n.compilePattern(l);let f;if(l.atBreak)for(;f=o.exec(r);){let c=f.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(f.index+1)}}return a+r+a}function VG(){return"`"}function gO(e,t){const n=X1(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}yO.peek=HG;function yO(e,t,n,r){const a=aw(n),i=a==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let o,f;if(gO(e,n)){const d=n.stack;n.stack=[],o=n.enter("autolink");let v=l.move("<");return v+=l.move(n.containerPhrasing(e,{before:v,after:">",...l.current()})),v+=l.move(">"),o(),n.stack=d,v}o=n.enter("link"),f=n.enter("label");let c=l.move("[");return c+=l.move(n.containerPhrasing(e,{before:c,after:"](",...l.current()})),c+=l.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(f=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),f(),e.title&&(f=n.enter(`title${i}`),c+=l.move(" "+a),c+=l.move(n.safe(e.title,{before:c,after:a,...l.current()})),c+=l.move(a),f()),c+=l.move(")"),o(),c}function HG(e,t,n){return gO(e,n)?"<":"["}xO.peek=GG;function xO(e,t,n,r){const a=e.referenceType,i=n.enter("linkReference");let l=n.enter("label");const o=n.createTracker(r);let f=o.move("[");const c=n.containerPhrasing(e,{before:f,after:"]",...o.current()});f+=o.move(c+"]["),l();const d=n.stack;n.stack=[],l=n.enter("reference");const v=n.safe(n.associationId(e),{before:f,after:"]",...o.current()});return l(),n.stack=d,i(),a==="full"||!c||c!==v?f+=o.move(v+"]"):a==="shortcut"?f=f.slice(0,-1):f+=o.move("]"),f}function GG(){return"["}function iw(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function $G(e){const t=iw(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function YG(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function bO(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function KG(e,t,n,r){const a=n.enter("list"),i=n.bulletCurrent;let l=e.ordered?YG(n):iw(n);const o=e.ordered?l==="."?")":".":$G(n);let f=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),bO(n)===l&&d){let v=-1;for(;++v<e.children.length;){const m=e.children[v];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(l=o),n.bulletCurrent=l;const c=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=i,a(),c}function XG(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function QG(e,t,n,r){const a=XG(n);let i=n.bulletCurrent||iw(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let l=i.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(l-i.length)),o.shift(l);const f=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,o.current()),d);return f(),c;function d(v,m,y){return m?(y?"":" ".repeat(l))+v:(y?i:i+" ".repeat(l-i.length))+v}}function WG(e,t,n,r){const a=n.enter("paragraph"),i=n.enter("phrasing"),l=n.containerPhrasing(e,r);return i(),a(),l}const ZG=Fp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function JG(e,t,n,r){return(e.children.some(function(l){return ZG(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function e$(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}wO.peek=t$;function wO(e,t,n,r){const a=e$(n),i=n.enter("strong"),l=n.createTracker(r),o=l.move(a+a);let f=l.move(n.containerPhrasing(e,{after:a,before:o,...l.current()}));const c=f.charCodeAt(0),d=Jv(r.before.charCodeAt(r.before.length-1),c,a);d.inside&&(f=Gf(c)+f.slice(1));const v=f.charCodeAt(f.length-1),m=Jv(r.after.charCodeAt(0),v,a);m.inside&&(f=f.slice(0,-1)+Gf(v));const y=l.move(a+a);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},o+f+y}function t$(e,t,n){return n.options.strong||"*"}function n$(e,t,n,r){return n.safe(e.value,r)}function r$(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function a$(e,t,n){const r=(bO(n)+(n.options.ruleSpaces?" ":"")).repeat(r$(n));return n.options.ruleSpaces?r.slice(0,-1):r}const SO={blockquote:kG,break:mN,code:OG,definition:_G,emphasis:dO,hardBreak:mN,heading:IG,html:hO,image:vO,imageReference:pO,inlineCode:mO,link:yO,linkReference:xO,list:KG,listItem:QG,paragraph:WG,root:JG,strong:wO,text:n$,thematicBreak:a$};function i$(){return{enter:{table:s$,tableData:gN,tableHeader:gN,tableRow:o$},exit:{codeText:u$,table:l$,tableData:Jy,tableHeader:Jy,tableRow:Jy}}}function s$(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function l$(e){this.exit(e),this.data.inTable=void 0}function o$(e){this.enter({type:"tableRow",children:[]},e)}function Jy(e){this.exit(e)}function gN(e){this.enter({type:"tableCell",children:[]},e)}function u$(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,c$));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function c$(e,t){return t==="|"?t:e}function f$(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
406
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:l,tableCell:f,tableRow:o}};function l(y,x,S,w){return c(d(y,S,w),y.align)}function o(y,x,S,w){const b=v(y,S,w),C=c([b]);return C.slice(0,C.indexOf(`
407
+ `))}function f(y,x,S,w){const b=S.enter("tableCell"),C=S.enter("phrasing"),T=S.containerPhrasing(y,{...w,before:i,after:i});return C(),b(),T}function c(y,x){return TG(y,{align:x,alignDelimiters:r,padding:n,stringLength:a})}function d(y,x,S){const w=y.children;let b=-1;const C=[],T=x.enter("table");for(;++b<w.length;)C[b]=v(w[b],x,S);return T(),C}function v(y,x,S){const w=y.children;let b=-1;const C=[],T=x.enter("tableRow");for(;++b<w.length;)C[b]=f(w[b],y,x,S);return T(),C}function m(y,x,S){let w=SO.inlineCode(y,x,S);return S.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function d$(){return{exit:{taskListCheckValueChecked:yN,taskListCheckValueUnchecked:yN,paragraph:v$}}}function h$(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:p$}}}function yN(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function v$(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let i=-1,l;for(;++i<a.length;){const o=a[i];if(o.type==="paragraph"){l=o;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function p$(e,t,n,r){const a=e.children[0],i=typeof e.checked=="boolean"&&a&&a.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);i&&o.move(l);let f=SO.listItem(e,t,n,{...r,...o.current()});return i&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),f;function c(d){return d+l}}function m$(){return[K7(),pG(),xG(),i$(),d$()]}function g$(e){return{extensions:[X7(),mG(e),bG(),f$(e),h$()]}}const y$={tokenize:C$,partial:!0},EO={tokenize:T$,partial:!0},CO={tokenize:N$,partial:!0},TO={tokenize:k$,partial:!0},x$={tokenize:A$,partial:!0},NO={name:"wwwAutolink",tokenize:S$,previous:AO},kO={name:"protocolAutolink",tokenize:E$,previous:RO},Zi={name:"emailAutolink",tokenize:w$,previous:DO},fi={};function b$(){return{text:fi}}let ql=48;for(;ql<123;)fi[ql]=Zi,ql++,ql===58?ql=65:ql===91&&(ql=97);fi[43]=Zi;fi[45]=Zi;fi[46]=Zi;fi[95]=Zi;fi[72]=[Zi,kO];fi[104]=[Zi,kO];fi[87]=[Zi,NO];fi[119]=[Zi,NO];function w$(e,t,n){const r=this;let a,i;return l;function l(v){return!kb(v)||!DO.call(r,r.previous)||sw(r.events)?n(v):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(v))}function o(v){return kb(v)?(e.consume(v),o):v===64?(e.consume(v),f):n(v)}function f(v){return v===46?e.check(x$,d,c)(v):v===45||v===95||hr(v)?(i=!0,e.consume(v),f):d(v)}function c(v){return e.consume(v),a=!0,f}function d(v){return i&&a&&Er(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(v)):n(v)}}function S$(e,t,n){const r=this;return a;function a(l){return l!==87&&l!==119||!AO.call(r,r.previous)||sw(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(y$,e.attempt(EO,e.attempt(CO,i),n),n)(l))}function i(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function E$(e,t,n){const r=this;let a="",i=!1;return l;function l(v){return(v===72||v===104)&&RO.call(r,r.previous)&&!sw(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(v),e.consume(v),o):n(v)}function o(v){if(Er(v)&&a.length<5)return a+=String.fromCodePoint(v),e.consume(v),o;if(v===58){const m=a.toLowerCase();if(m==="http"||m==="https")return e.consume(v),f}return n(v)}function f(v){return v===47?(e.consume(v),i?c:(i=!0,f)):n(v)}function c(v){return v===null||Qv(v)||Yt(v)||po(v)||Pp(v)?n(v):e.attempt(EO,e.attempt(CO,d),n)(v)}function d(v){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(v)}}function C$(e,t,n){let r=0;return a;function a(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),a):l===46&&r===3?(e.consume(l),i):n(l)}function i(l){return l===null?n(l):t(l)}}function T$(e,t,n){let r,a,i;return l;function l(c){return c===46||c===95?e.check(TO,f,o)(c):c===null||Yt(c)||po(c)||c!==45&&Pp(c)?f(c):(i=!0,e.consume(c),l)}function o(c){return c===95?r=!0:(a=r,r=void 0),e.consume(c),l}function f(c){return a||r||!i?n(c):t(c)}}function N$(e,t){let n=0,r=0;return a;function a(l){return l===40?(n++,e.consume(l),a):l===41&&r<n?i(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(TO,t,i)(l):l===null||Yt(l)||po(l)?t(l):(e.consume(l),a)}function i(l){return l===41&&r++,e.consume(l),a}}function k$(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),i):o===93?(e.consume(o),a):o===60||o===null||Yt(o)||po(o)?t(o):n(o)}function a(o){return o===null||o===40||o===91||Yt(o)||po(o)?t(o):r(o)}function i(o){return Er(o)?l(o):n(o)}function l(o){return o===59?(e.consume(o),r):Er(o)?(e.consume(o),l):n(o)}}function A$(e,t,n){return r;function r(i){return e.consume(i),a}function a(i){return hr(i)?n(i):t(i)}}function AO(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Yt(e)}function RO(e){return!Er(e)}function DO(e){return!(e===47||kb(e))}function kb(e){return e===43||e===45||e===46||e===95||hr(e)}function sw(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const R$={tokenize:P$,partial:!0};function D$(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:L$,continuation:{tokenize:_$},exit:B$}},text:{91:{name:"gfmFootnoteCall",tokenize:O$},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:j$,resolveTo:M$}}}}function j$(e,t,n){const r=this;let a=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;a--;){const f=r.events[a][1];if(f.type==="labelImage"){l=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return o;function o(f){if(!l||!l._balanced)return n(f);const c=Da(r.sliceSerialize({start:l.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function M$(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",i,t],["enter",l,t],["exit",l,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function O$(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,l;return o;function o(v){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),f}function f(v){return v!==94?n(v):(e.enter("gfmFootnoteCallMarker"),e.consume(v),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(v){if(i>999||v===93&&!l||v===null||v===91||Yt(v))return n(v);if(v===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return a.includes(Da(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(v)}return Yt(v)||(l=!0),i++,e.consume(v),v===92?d:c}function d(v){return v===91||v===92||v===93?(e.consume(v),i++,c):c(v)}}function L$(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,l=0,o;return f;function f(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(x)}function d(x){if(l>999||x===93&&!o||x===null||x===91||Yt(x))return n(x);if(x===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return i=Da(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Yt(x)||(o=!0),l++,e.consume(x),x===92?v:d}function v(x){return x===91||x===92||x===93?(e.consume(x),l++,d):d(x)}function m(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),a.includes(i)||a.push(i),At(e,y,"gfmFootnoteDefinitionWhitespace")):n(x)}function y(x){return t(x)}}function _$(e,t,n){return e.check(gd,t,e.attempt(R$,t,n))}function B$(e){e.exit("gfmFootnoteDefinition")}function P$(e,t,n){const r=this;return At(e,a,"gfmFootnoteDefinitionIndent",5);function a(i){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(i):n(i)}}function z$(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(l,o){let f=-1;for(;++f<l.length;)if(l[f][0]==="enter"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._close){let c=f;for(;c--;)if(l[c][0]==="exit"&&l[c][1].type==="strikethroughSequenceTemporary"&&l[c][1]._open&&l[f][1].end.offset-l[f][1].start.offset===l[c][1].end.offset-l[c][1].start.offset){l[f][1].type="strikethroughSequence",l[c][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},l[c][1].start),end:Object.assign({},l[f][1].end)},v={type:"strikethroughText",start:Object.assign({},l[c][1].end),end:Object.assign({},l[f][1].start)},m=[["enter",d,o],["enter",l[c][1],o],["exit",l[c][1],o],["enter",v,o]],y=o.parser.constructs.insideSpan.null;y&&ea(m,m.length,0,zp(y,l.slice(c+1,f),o)),ea(m,m.length,0,[["exit",v,o],["enter",l[f][1],o],["exit",l[f][1],o],["exit",d,o]]),ea(l,c-1,f-c+3,m),f=c+m.length-2;break}}for(f=-1;++f<l.length;)l[f][1].type==="strikethroughSequenceTemporary"&&(l[f][1].type="data");return l}function i(l,o,f){const c=this.previous,d=this.events;let v=0;return m;function m(x){return c===126&&d[d.length-1][1].type!=="characterEscape"?f(x):(l.enter("strikethroughSequenceTemporary"),y(x))}function y(x){const S=Xu(c);if(x===126)return v>1?f(x):(l.consume(x),v++,y);if(v<2&&!n)return f(x);const w=l.exit("strikethroughSequenceTemporary"),b=Xu(x);return w._open=!b||b===2&&!!S,w._close=!S||S===2&&!!b,o(x)}}}class I${constructor(){this.map=[]}add(t,n,r){F$(this,t,n,r)}consume(t){if(this.map.sort(function(i,l){return i[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const i of a)t.push(i);a=r.pop()}this.map.length=0}}function F$(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function q$(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function U$(){return{flow:{null:{name:"table",tokenize:V$,resolveAll:H$}}}}function V$(e,t,n){const r=this;let a=0,i=0,l;return o;function o(M){let z=r.events.length-1;for(;z>-1;){const I=r.events[z][1].type;if(I==="lineEnding"||I==="linePrefix")z--;else break}const P=z>-1?r.events[z][1].type:null,G=P==="tableHead"||P==="tableRow"?A:f;return G===A&&r.parser.lazy[r.now().line]?n(M):G(M)}function f(M){return e.enter("tableHead"),e.enter("tableRow"),c(M)}function c(M){return M===124||(l=!0,i+=1),d(M)}function d(M){return M===null?n(M):tt(M)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),y):n(M):St(M)?At(e,d,"whitespace")(M):(i+=1,l&&(l=!1,a+=1),M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),l=!0,d):(e.enter("data"),v(M)))}function v(M){return M===null||M===124||Yt(M)?(e.exit("data"),d(M)):(e.consume(M),M===92?m:v)}function m(M){return M===92||M===124?(e.consume(M),v):v(M)}function y(M){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(M):(e.enter("tableDelimiterRow"),l=!1,St(M)?At(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):x(M))}function x(M){return M===45||M===58?w(M):M===124?(l=!0,e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),S):D(M)}function S(M){return St(M)?At(e,w,"whitespace")(M):w(M)}function w(M){return M===58?(i+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),b):M===45?(i+=1,b(M)):M===null||tt(M)?k(M):D(M)}function b(M){return M===45?(e.enter("tableDelimiterFiller"),C(M)):D(M)}function C(M){return M===45?(e.consume(M),C):M===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(M))}function T(M){return St(M)?At(e,k,"whitespace")(M):k(M)}function k(M){return M===124?x(M):M===null||tt(M)?!l||a!==i?D(M):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(M)):D(M)}function D(M){return n(M)}function A(M){return e.enter("tableRow"),j(M)}function j(M){return M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),j):M===null||tt(M)?(e.exit("tableRow"),t(M)):St(M)?At(e,j,"whitespace")(M):(e.enter("data"),L(M))}function L(M){return M===null||M===124||Yt(M)?(e.exit("data"),j(M)):(e.consume(M),M===92?_:L)}function _(M){return M===92||M===124?(e.consume(M),L):L(M)}}function H$(e,t){let n=-1,r=!0,a=0,i=[0,0,0,0],l=[0,0,0,0],o=!1,f=0,c,d,v;const m=new I$;for(;++n<e.length;){const y=e[n],x=y[1];y[0]==="enter"?x.type==="tableHead"?(o=!1,f!==0&&(xN(m,t,f,c,d),d=void 0,f=0),c={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},m.add(n,0,[["enter",c,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,v=void 0,i=[0,0,0,0],l=[0,n+1,0,0],o&&(o=!1,d={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},m.add(n,0,[["enter",d,t]])),a=x.type==="tableDelimiterRow"?2:d?3:1):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(i[1]!==0&&(l[0]=l[1],v=rv(m,t,i,a,void 0,v),i=[0,0,0,0]),l[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(l[0]=l[1],v=rv(m,t,i,a,void 0,v)),i=l,l=[i[1],n,0,0])):x.type==="tableHead"?(o=!0,f=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(f=n,i[1]!==0?(l[0]=l[1],v=rv(m,t,i,a,n,v)):l[1]!==0&&(v=rv(m,t,l,a,n,v)),a=0):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(l[3]=n)}for(f!==0&&xN(m,t,f,c,d),m.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=q$(t.events,n))}return e}function rv(e,t,n,r,a,i){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(i.end=Object.assign({},bu(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const f=bu(t.events,n[1]);if(i={type:l,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const c=bu(t.events,n[2]),d=bu(t.events,n[3]),v={type:o,start:Object.assign({},c),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",v,t]]),r!==2){const m=t.events[n[2]],y=t.events[n[3]];if(m[1].end=Object.assign({},y[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,S=n[3]-n[2]-1;e.add(x,S,[])}}e.add(n[3]+1,0,[["exit",v,t]])}return a!==void 0&&(i.end=Object.assign({},bu(t.events,a)),e.add(a,0,[["exit",i,t]]),i=void 0),i}function xN(e,t,n,r,a){const i=[],l=bu(t.events,n);a&&(a.end=Object.assign({},l),i.push(["exit",a,t])),r.end=Object.assign({},l),i.push(["exit",r,t]),e.add(n+1,0,i)}function bu(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const G$={name:"tasklistCheck",tokenize:Y$};function $$(){return{text:{91:G$}}}function Y$(e,t,n){const r=this;return a;function a(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),i)}function i(f){return Yt(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),l):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),l):n(f)}function l(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(f)}function o(f){return tt(f)?t(f):St(f)?e.check({tokenize:K$},t,n)(f):n(f)}}function K$(e,t,n){return At(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function X$(e){return qM([b$(),D$(),z$(e),U$(),$$()])}const Q$={};function W$(e){const t=this,n=e||Q$,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(X$(n)),i.push(m$()),l.push(g$(n))}function si({content:e,className:t}){return p.jsx("div",{className:Ae("prose-myco",t),children:p.jsx(z7,{remarkPlugins:[W$],children:e})})}function Z$({images:e,index:t,onClose:n,onNavigate:r}){const a=e[t],i=t>0,l=t<e.length-1;R.useEffect(()=>{const f=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=f}},[]);const o=R.useCallback(f=>{f.key==="Escape"&&n(),f.key==="ArrowLeft"&&i&&r(t-1),f.key==="ArrowRight"&&l&&r(t+1)},[n,r,t,i,l]);return R.useEffect(()=>(document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)),[o]),a?p.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-surface-dim/90 backdrop-blur-sm",onClick:n,children:[p.jsx("button",{onClick:n,className:"absolute top-4 right-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10",children:p.jsx(rc,{className:"h-5 w-5"})}),e.length>1&&p.jsxs("span",{className:"absolute top-4 left-1/2 -translate-x-1/2 font-mono text-xs text-on-surface/60 z-10",children:[t+1," / ",e.length]}),i&&p.jsx("button",{onClick:f=>{f.stopPropagation(),r(t-1)},className:"absolute left-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10",children:p.jsx(o1,{className:"h-6 w-6"})}),l&&p.jsx("button",{onClick:f=>{f.stopPropagation(),r(t+1)},className:"absolute right-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10",children:p.jsx(wa,{className:"h-6 w-6"})}),p.jsx("img",{src:a.src,alt:a.alt,className:"max-h-[90vh] max-w-[90vw] rounded-lg shadow-ambient object-contain",onClick:f=>f.stopPropagation()})]}):null}const J$=3;function eY({activity:e}){const[t,n]=R.useState(!1),r=e.success===1,a=!!(e.tool_input||e.tool_output_summary||e.error_message);return p.jsxs("div",{className:Ae("border-l-2 transition-colors",t?"border-l-primary/30":"border-transparent hover:border-l-primary/20"),children:[p.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-surface-container/30 transition-all",onClick:()=>n(i=>!i),"aria-expanded":t,children:[t?p.jsx(Ma,{className:"h-3.5 w-3.5 shrink-0 text-on-surface-variant"}):p.jsx(wa,{className:"h-3.5 w-3.5 shrink-0 text-on-surface-variant"}),p.jsx("span",{className:"font-mono text-xs font-medium text-on-surface",children:e.tool_name}),e.file_path&&p.jsx("span",{className:"truncate font-sans text-xs text-on-surface-variant flex-1",children:e.file_path}),p.jsx("span",{className:"shrink-0 ml-auto"}),p.jsx("span",{className:"shrink-0 font-mono text-xs text-on-surface-variant",children:n6(e.duration_ms)}),r?p.jsx(pD,{className:"h-3.5 w-3.5 shrink-0 text-primary"}):p.jsx(gp,{className:"h-3.5 w-3.5 shrink-0 text-tertiary"})]}),p.jsx("div",{className:"grid transition-[grid-template-rows] duration-150 ease-out",style:{gridTemplateRows:t?"1fr":"0fr"},children:p.jsx("div",{className:"overflow-hidden",children:p.jsxs("div",{className:"px-8 pb-3 space-y-2",children:[!a&&p.jsx("p",{className:"font-sans text-xs text-on-surface-variant/60 italic py-1",children:"No input/output details captured"}),e.tool_input&&p.jsxs("div",{children:[p.jsx("div",{className:"font-sans text-xs font-medium text-on-surface-variant mb-1",children:"Input"}),p.jsx("pre",{className:"font-mono text-xs bg-surface-container-lowest rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all text-on-surface",children:e.tool_input})]}),e.tool_output_summary&&p.jsxs("div",{children:[p.jsx("div",{className:"font-sans text-xs font-medium text-on-surface-variant mb-1",children:"Output"}),p.jsx("pre",{className:"font-mono text-xs bg-surface-container-lowest rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all text-on-surface",children:e.tool_output_summary})]}),e.error_message&&p.jsxs("div",{children:[p.jsx("div",{className:"font-sans text-xs font-medium text-tertiary mb-1",children:"Error"}),p.jsx("pre",{className:"font-mono text-xs bg-tertiary/10 text-tertiary rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all",children:e.error_message})]})]})})})]})}function tY({batchId:e,activityCount:t}){const[n,r]=R.useState(!1),{data:a,isLoading:i}=fV(n?e:void 0);if(t===0)return null;const l=a??[];return p.jsxs("div",{className:"border-t border-[var(--ghost-border)]",children:[p.jsxs("button",{type:"button",className:Ae("w-full flex items-center gap-2 px-4 py-2 text-left transition-colors","hover:bg-surface-container/30"),onClick:()=>r(o=>!o),children:[n?p.jsx(Ma,{className:"h-3.5 w-3.5 shrink-0 text-on-surface-variant"}):p.jsx(wa,{className:"h-3.5 w-3.5 shrink-0 text-on-surface-variant"}),p.jsx("span",{className:"font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant",children:"Tool Calls"}),p.jsx("span",{className:"font-mono text-[10px] text-on-surface-variant/60",children:t})]}),p.jsx("div",{className:"grid transition-[grid-template-rows] duration-200 ease-out",style:{gridTemplateRows:n?"1fr":"0fr"},children:p.jsxs("div",{className:"overflow-hidden",children:[i&&p.jsx("div",{className:"px-3 py-2 space-y-1",children:Array.from({length:Math.min(t,J$)}).map((o,f)=>p.jsx("div",{className:"h-3 animate-pulse rounded bg-surface-container-high w-full"},f))}),!i&&l.length>0&&p.jsx("div",{className:"space-y-0",children:l.map(o=>p.jsx(eY,{activity:o},o.id))})]})})]})}const Ab=120,nY="h-7 w-7",rY=3;function aY(e){return new Date(e*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function iY(e){return e?e.length>Ab?e.slice(0,Ab)+"…":e:"(no prompt)"}function sY({batch:e,batchAttachments:t,defaultOpen:n=!1,promptIndex:r,isLast:a}){const[i,l]=R.useState(n),[o,f]=R.useState(null);return p.jsxs("div",{className:"relative flex gap-4",children:[p.jsxs("div",{className:"relative flex flex-col items-center shrink-0",style:{width:"28px"},children:[r>0&&p.jsx("div",{className:"absolute top-0 w-px bg-outline-variant/40",style:{height:"14px"}}),p.jsx("div",{className:Ae(nY,"rounded-full flex items-center justify-center shrink-0 text-[10px] font-mono font-bold transition-colors z-10",i?"bg-primary text-on-primary":"bg-surface-container-high text-on-surface-variant border border-outline-variant/40"),children:r+1}),!a&&p.jsx("div",{className:"flex-1 w-px bg-outline-variant/40"})]}),p.jsxs(dt,{level:"low",className:"flex-1 overflow-hidden rounded-md max-w-full border border-outline-variant/10 mb-2",children:[p.jsxs("button",{type:"button",className:Ae("flex w-full items-start gap-3 px-4 py-3 text-left transition-colors overflow-hidden","hover:bg-surface-container/40",i&&"bg-surface-container/20"),onClick:()=>l(c=>!c),"aria-expanded":i,children:[i?p.jsx(Ma,{className:"mt-0.5 h-4 w-4 shrink-0 text-on-surface-variant transition-transform"}):p.jsx(wa,{className:"mt-0.5 h-4 w-4 shrink-0 text-on-surface-variant transition-transform"}),p.jsxs("div",{className:"flex-1 min-w-0 overflow-hidden",children:[p.jsxs("div",{className:"flex items-baseline justify-between gap-2 mb-0.5",children:[p.jsx("span",{className:"font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant shrink-0",children:"Prompt"}),e.activity_count>0&&p.jsxs("span",{className:"font-mono text-[10px] text-on-surface-variant/70 shrink-0",children:[e.activity_count," tool call",e.activity_count!==1?"s":""]}),e.started_at&&p.jsx("span",{className:"shrink-0 font-mono text-xs text-on-surface-variant",children:aY(e.started_at)})]}),p.jsx("p",{className:"font-sans text-sm text-on-surface truncate",children:i?e.user_prompt??"(no prompt)":iY(e.user_prompt)})]})]}),p.jsx("div",{className:"grid transition-[grid-template-rows] duration-200 ease-out",style:{gridTemplateRows:i?"1fr":"0fr"},children:p.jsxs("div",{className:"overflow-hidden",children:[p.jsxs("div",{className:"px-4 pt-0 pb-3 overflow-hidden",children:[e.user_prompt&&e.user_prompt.length>Ab&&p.jsx(si,{content:e.user_prompt}),t.length>0&&p.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:t.map((c,d)=>p.jsx("button",{type:"button",className:"rounded-md overflow-hidden hover:ring-2 hover:ring-primary/40 transition-all",onClick:()=>f(d),children:p.jsx("img",{src:`/api/attachments/${c.file_path}`,alt:c.description??c.file_path??"",className:"max-w-[200px] max-h-[140px] object-cover rounded-md",loading:"lazy"})},c.id))}),o!==null&&p.jsx(Z$,{images:t.map(c=>({src:`/api/attachments/${c.file_path}`,alt:c.description??c.file_path??""})),index:o,onNavigate:f,onClose:()=>f(null)})]}),e.activity_count>0&&p.jsx(tY,{batchId:e.id,activityCount:e.activity_count}),e.response_summary&&p.jsx("div",{className:"border-t border-[var(--ghost-border)] overflow-hidden",children:p.jsxs("div",{className:"flex gap-3 px-4 py-3",children:[p.jsx("div",{className:"w-0.5 shrink-0 rounded-full bg-primary/30"}),p.jsxs("div",{className:"flex-1 min-w-0 overflow-hidden",children:[p.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[p.jsx(dd,{className:"h-3 w-3 text-primary/60"}),p.jsx("span",{className:"font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant",children:"Response"})]}),p.jsx(si,{content:e.response_summary})]})]})})]})})]})]})}function lY({sessionId:e}){const{data:t,isLoading:n}=cV(e),{data:r}=dV(e),a=r??[],{byBatchId:i,byTurnNumber:l}=R.useMemo(()=>{var d;const f=new Map,c=new Map;for(const v of a){if(v.prompt_batch_id!=null){const y=f.get(v.prompt_batch_id)??[];y.push(v),f.set(v.prompt_batch_id,y)}const m=(d=v.file_path)==null?void 0:d.match(/-t(\d+)-/);if(m!=null&&m[1]){const y=parseInt(m[1]),x=c.get(y)??[];x.push(v),c.set(y,x)}}return{byBatchId:f,byTurnNumber:c}},[a]);if(n)return p.jsx("div",{className:"space-y-3 pl-11",children:Array.from({length:rY}).map((f,c)=>p.jsx("div",{className:"h-16 animate-pulse rounded-md bg-surface-container-low"},c))});const o=[...t??[]].sort((f,c)=>(f.started_at??0)-(c.started_at??0));return o.length===0?p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant",children:[p.jsx(yp,{className:"h-8 w-8 opacity-30"}),p.jsx("span",{className:"font-sans text-sm",children:"No prompts recorded"})]}):p.jsx("div",{children:o.map((f,c)=>{const d=i.get(f.id)??(f.prompt_number!==null?l.get(f.prompt_number)??[]:[]);return p.jsx(sY,{batch:f,batchAttachments:d,defaultOpen:c===0,promptIndex:c,isLast:c===o.length-1},f.id)})})}const oY="▲",uY="▼";function cY(e){const t=(e.match(/- \[x\]/gi)??[]).length,n=(e.match(/- \[ \]/g)??[]).length;return{total:t+n,checked:t}}const fY={active:"bg-green-500/10 text-green-500",completed:"bg-blue-500/10 text-blue-500"},dY="bg-muted text-muted-foreground";function hY({status:e}){const t=Ae("inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide",fY[e]??dY);return p.jsx("span",{className:t,children:e})}function vY({plan:e}){const[t,n]=R.useState(!1),r=R.useMemo(()=>e.content?cY(e.content):null,[e.content]),a=r!==null&&r.total>0,i=a?Math.round(r.checked/r.total*100):0;return p.jsxs("div",{className:"rounded-lg border border-border bg-muted/50 overflow-hidden",children:[p.jsxs("div",{className:"flex items-start gap-3 p-4",children:[p.jsxs("div",{className:"flex-1 min-w-0 space-y-1.5",children:[p.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[p.jsx(hY,{status:e.status}),e.title&&p.jsx("span",{className:"font-sans text-sm font-medium text-on-surface truncate",children:e.title})]}),e.source_path&&p.jsx("p",{className:"font-mono text-xs text-muted-foreground truncate",title:e.source_path,children:e.source_path}),p.jsxs("div",{className:"flex gap-3 font-sans text-xs text-muted-foreground",children:[p.jsxs("span",{children:["Created ",ii(e.created_at)]}),e.updated_at&&e.updated_at!==e.created_at&&p.jsxs("span",{title:sb(e.updated_at),children:["Updated ",ii(e.updated_at)]})]}),a&&p.jsxs("div",{className:"space-y-1 pt-0.5",children:[p.jsxs("div",{className:"flex items-center justify-between font-sans text-xs text-muted-foreground",children:[p.jsxs("span",{children:[r.checked,"/",r.total," items"]}),p.jsxs("span",{children:[i,"%"]})]}),p.jsx("div",{className:"h-1.5 rounded-full bg-border overflow-hidden",children:p.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${i}%`}})})]})]}),e.content&&p.jsx("button",{onClick:()=>n(l=>!l),className:"shrink-0 mt-0.5 text-xs text-muted-foreground hover:text-on-surface transition-colors cursor-pointer","aria-label":t?"Collapse plan":"Expand plan",children:t?oY:uY})]}),t&&e.content&&p.jsx("div",{className:"border-t border-border px-4 py-3",children:p.jsx(si,{content:e.content,className:"text-sm"})})]})}function pY({sessionId:e}){const{data:t,isLoading:n,isError:r}=hV(e);return n?p.jsx("div",{className:"flex h-32 items-center justify-center",children:p.jsx("span",{className:"font-sans text-sm text-muted-foreground",children:"Loading plans..."})}):r?p.jsx("div",{className:"flex h-32 items-center justify-center",children:p.jsx("span",{className:"font-sans text-sm text-muted-foreground",children:"Failed to load plans."})}):!t||t.length===0?p.jsx("div",{className:"flex h-32 items-center justify-center rounded-lg border border-border bg-muted/30",children:p.jsx("span",{className:"font-sans text-sm text-muted-foreground",children:"No plans captured for this session"})}):p.jsx("div",{className:"space-y-3",children:t.map(a=>p.jsx(vY,{plan:a},a.id))})}const av=8,mY=16;function gY(e){return e===null?"—":T1(new Date(e*1e3).toISOString())}function bN(e){return e===null?"—":new Date(e*1e3).toLocaleString()}const yY=1500;function gf({label:e,value:t,mono:n=!0,copyable:r=!1,code:a=!1}){const[i,l]=R.useState(!1),o=R.useCallback(()=>{navigator.clipboard.writeText(t),l(!0),setTimeout(()=>l(!1),yY)},[t]),f=a?p.jsx("code",{className:"text-xs font-mono text-primary bg-surface-container-lowest rounded px-1.5 py-0.5",children:t}):p.jsx("span",{className:Ae("text-xs text-on-surface",n&&"font-mono"),children:t});return p.jsxs("div",{className:"flex items-baseline gap-3 py-1.5 border-b border-[var(--ghost-border)] last:border-0",children:[p.jsx("span",{className:"shrink-0 w-20 font-sans text-xs font-medium text-on-surface-variant",children:e}),r?p.jsxs("button",{onClick:o,title:"Click to copy",className:"flex items-center gap-1.5 min-w-0 hover:text-primary transition-colors cursor-pointer",children:[f,i&&p.jsx(hD,{className:"h-3 w-3 text-primary shrink-0"})]}):p.jsx("span",{className:"min-w-0",children:f})]})}function wN({label:e,value:t,activeTab:n,onClick:r}){return p.jsx("button",{onClick:()=>r(t),className:Ae("px-4 py-2 font-sans text-sm font-medium transition-colors cursor-pointer",n===t?"border-b-2 border-primary text-on-surface":"text-muted-foreground hover:text-on-surface"),children:e})}function xY({id:e}){const t=vl(),{data:n,isLoading:r,isError:a,error:i}=uV(e),{data:l}=NV(),o=R1(),[f,c]=R.useState("idle"),[d,v]=R.useState(!1),[m,y]=R.useState("conversation"),x=EM(),{data:S}=CM(d?e:null);if(r)return p.jsxs("div",{className:"p-6 space-y-4",children:[p.jsxs(et,{variant:"ghost",size:"sm",onClick:()=>t("/sessions"),className:"gap-2 text-on-surface-variant",children:[p.jsx(Ws,{className:"h-4 w-4"}),p.jsx("span",{className:"font-sans text-sm",children:"Session Archive"})]}),p.jsxs("div",{className:"flex h-64 items-center justify-center gap-2 text-on-surface-variant",children:[p.jsx(Xn,{className:"h-5 w-5 animate-spin"}),p.jsx("span",{className:"font-sans text-sm",children:"Loading session..."})]})]});if(a||!n)return p.jsxs("div",{className:"p-6 space-y-4",children:[p.jsxs(et,{variant:"ghost",size:"sm",onClick:()=>t("/sessions"),className:"gap-2 text-on-surface-variant",children:[p.jsx(Ws,{className:"h-4 w-4"}),p.jsx("span",{className:"font-sans text-sm",children:"Session Archive"})]}),p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary",children:[p.jsx(Qi,{className:"h-5 w-5"}),p.jsx("span",{className:"font-sans text-sm",children:"Session not found"}),p.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:i instanceof Error?i.message:"Unknown error"})]})]});const w=l?kV(l.symbionts,n.agent,e):null;return p.jsxs("div",{className:"p-6 space-y-6 overflow-hidden",children:[p.jsxs(et,{variant:"ghost",size:"sm",onClick:()=>t("/sessions"),className:"gap-2 text-on-surface-variant",children:[p.jsx(Ws,{className:"h-4 w-4"}),p.jsx("span",{className:"font-sans text-sm",children:"Session Archive"})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[p.jsx("h1",{className:"font-serif text-2xl font-normal text-on-surface tracking-wide",children:n.title??n.id.slice(0,av)}),p.jsx(NM,{status:n.status}),n.agent&&p.jsx(sr,{variant:"outline",className:"font-mono text-[10px] px-1.5 py-0",children:n.agent}),p.jsxs(et,{variant:"secondary",size:"sm",className:"ml-auto gap-2",disabled:f==="running",onClick:async()=>{c("running");try{await o.mutateAsync({task:"title-summary",instruction:`Process session ${e} only`}),c("done")}catch{c("error")}},children:[f==="running"?p.jsx(Xn,{className:"h-4 w-4 animate-spin"}):p.jsx(bD,{className:"h-4 w-4"}),f==="done"?"Summary Requested":"Generate Summary"]}),p.jsxs(et,{variant:"ghost",size:"sm",className:"gap-2 text-tertiary hover:text-tertiary hover:bg-tertiary/10",onClick:()=>v(!0),children:[p.jsx(qf,{className:"h-4 w-4"}),"Delete"]})]}),p.jsxs("div",{className:"flex flex-wrap gap-4 font-sans text-sm text-on-surface-variant",children:[n.user&&p.jsxs("span",{children:["User: ",p.jsx("span",{className:"text-on-surface",children:n.user})]}),n.branch&&p.jsxs("span",{children:["Branch: ",p.jsx("span",{className:"font-mono text-on-surface",children:n.branch})]}),p.jsxs("span",{children:["Started ",gY(n.started_at)]}),n.ended_at&&p.jsxs("span",{children:["Duration: ",Ap(n.started_at,n.ended_at)]})]})]}),p.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:[p.jsx(En,{label:"Prompts",value:String(n.prompt_count),accent:"sage"}),p.jsx(En,{label:"Tool Calls",value:String(n.tool_count),accent:"sage"}),p.jsx(En,{label:"Status",value:n.status.charAt(0).toUpperCase()+n.status.slice(1),accent:"outline"}),p.jsx(En,{label:"Started",value:bN(n.started_at),accent:"outline"}),p.jsx(En,{label:"Ended",value:bN(n.ended_at),accent:"outline"}),p.jsx(En,{label:"Session ID",value:e.slice(0,av),sublabel:n.content_hash?`hash: ${n.content_hash.slice(0,mY)}`:void 0,accent:"outline"})]}),p.jsxs(dt,{level:"low",className:"p-4 overflow-hidden",children:[p.jsx(Pn,{className:"mb-3",children:"Metadata"}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-6",children:[p.jsx(gf,{label:"Session ID",value:e,copyable:!0}),w&&p.jsx(gf,{label:"Resume",value:w,copyable:!0,code:!0}),n.parent_session_id&&p.jsx(gf,{label:"Parent",value:n.parent_session_id}),n.parent_session_reason&&p.jsx(gf,{label:"Reason",value:n.parent_session_reason,mono:!1}),n.project_root&&p.jsx(gf,{label:"Project",value:n.project_root})]})]}),n.summary&&p.jsxs(dt,{level:"low",className:"p-4 overflow-hidden",children:[p.jsx(Pn,{className:"mb-2",children:"Summary"}),p.jsx("p",{className:"font-sans text-sm text-on-surface-variant whitespace-pre-wrap break-words",children:n.summary})]}),p.jsxs("div",{className:"min-w-0 overflow-hidden",children:[p.jsxs("div",{className:"flex gap-0 border-b border-border mb-4",children:[p.jsx(wN,{label:"Conversation",value:"conversation",activeTab:m,onClick:y}),p.jsx(wN,{label:"Plans",value:"plans",activeTab:m,onClick:y})]}),m==="conversation"&&p.jsx(lY,{sessionId:e}),m==="plans"&&p.jsx(pY,{sessionId:e})]}),p.jsx(Nj,{open:d,onOpenChange:v,title:"Delete Session",description:"This will permanently remove this session and all related data. This action cannot be undone.",icon:p.jsx(qf,{className:"h-4 w-4 text-tertiary"}),meta:n?[{label:"ID",value:n.id.slice(0,av)},{label:"Title",value:n.title||n.id.slice(0,av)}]:[],impact:S?[{label:"Prompts",value:S.promptCount},{label:"Spores",value:S.sporeCount},{label:"Attachments",value:S.attachmentCount},{label:"Graph Edges",value:S.graphEdgeCount}]:[],confirmLabel:"Delete Session",variant:"destructive",onConfirm:()=>{x.mutate(n.id,{onSuccess:()=>{v(!1),t("/sessions")}})},isPending:x.isPending})]})}function SN(){const{id:e}=x4();return e?p.jsx(xY,{id:e}):p.jsx("div",{className:"p-6",children:p.jsx(CV,{})})}function Rb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bY(e){if(Array.isArray(e))return e}function wY(e){if(Array.isArray(e))return Rb(e)}function yl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function SY(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,MO(r.key),r)}}function xl(e,t,n){return t&&SY(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Fr(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=lw(e))||t){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(f){throw f},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
408
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,l=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var f=n.next();return l=f.done,f},e:function(f){o=!0,i=f},f:function(){try{l||n.return==null||n.return()}finally{if(o)throw i}}}}function jO(e,t,n){return(t=MO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function EY(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function CY(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,l,o=[],f=!0,c=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;f=!1}else for(;!(f=(r=i.call(n)).done)&&(o.push(r.value),o.length!==t);f=!0);}catch(d){c=!0,a=d}finally{try{if(!f&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw a}}return o}}function TY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
409
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NY(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
410
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mn(e,t){return bY(e)||CY(e,t)||lw(e,t)||TY()}function ep(e){return wY(e)||EY(e)||lw(e)||NY()}function kY(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function MO(e){var t=kY(e,"string");return typeof t=="symbol"?t:t+""}function In(e){"@babel/helpers - typeof";return In=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},In(e)}function lw(e,t){if(e){if(typeof e=="string")return Rb(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Rb(e,t):void 0}}var _n=typeof window>"u"?null:window,EN=_n?_n.navigator:null;_n&&_n.document;var AY=In(""),OO=In({}),RY=In(function(){}),DY=typeof HTMLElement>"u"?"undefined":In(HTMLElement),xd=function(t){return t&&t.instanceString&&fn(t.instanceString)?t.instanceString():null},Ze=function(t){return t!=null&&In(t)==AY},fn=function(t){return t!=null&&In(t)===RY},$t=function(t){return!ta(t)&&(Array.isArray?Array.isArray(t):t!=null&&t instanceof Array)},Dt=function(t){return t!=null&&In(t)===OO&&!$t(t)&&t.constructor===Object},jY=function(t){return t!=null&&In(t)===OO},Re=function(t){return t!=null&&In(t)===In(1)&&!isNaN(t)},MY=function(t){return Re(t)&&Math.floor(t)===t},tp=function(t){if(DY!=="undefined")return t!=null&&t instanceof HTMLElement},ta=function(t){return bd(t)||LO(t)},bd=function(t){return xd(t)==="collection"&&t._private.single},LO=function(t){return xd(t)==="collection"&&!t._private.single},ow=function(t){return xd(t)==="core"},_O=function(t){return xd(t)==="stylesheet"},OY=function(t){return xd(t)==="event"},ll=function(t){return t==null?!0:!!(t===""||t.match(/^\s+$/))},LY=function(t){return typeof HTMLElement>"u"?!1:t instanceof HTMLElement},_Y=function(t){return Dt(t)&&Re(t.x1)&&Re(t.x2)&&Re(t.y1)&&Re(t.y2)},BY=function(t){return jY(t)&&fn(t.then)},PY=function(){return EN&&EN.userAgent.match(/msie|trident|edge/i)},Qu=function(t,n){n||(n=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],l=0;l<arguments.length;l++)i.push(arguments[l]);return i.join("$")});var r=function(){var i=this,l=arguments,o,f=n.apply(i,l),c=r.cache;return(o=c[f])||(o=c[f]=t.apply(i,l)),o};return r.cache={},r},uw=Qu(function(e){return e.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}),Up=Qu(function(e){return e.replace(/(-\w)/g,function(t){return t[1].toUpperCase()})}),BO=Qu(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),CN=function(t){return ll(t)?t:t.charAt(0).toUpperCase()+t.substring(1)},Ys=function(t,n){return t.slice(-1*n.length)===n},zn="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",zY="rgb[a]?\\(("+zn+"[%]?)\\s*,\\s*("+zn+"[%]?)\\s*,\\s*("+zn+"[%]?)(?:\\s*,\\s*("+zn+"))?\\)",IY="rgb[a]?\\((?:"+zn+"[%]?)\\s*,\\s*(?:"+zn+"[%]?)\\s*,\\s*(?:"+zn+"[%]?)(?:\\s*,\\s*(?:"+zn+"))?\\)",FY="hsl[a]?\\(("+zn+")\\s*,\\s*("+zn+"[%])\\s*,\\s*("+zn+"[%])(?:\\s*,\\s*("+zn+"))?\\)",qY="hsl[a]?\\((?:"+zn+")\\s*,\\s*(?:"+zn+"[%])\\s*,\\s*(?:"+zn+"[%])(?:\\s*,\\s*(?:"+zn+"))?\\)",UY="\\#[0-9a-fA-F]{3}",VY="\\#[0-9a-fA-F]{6}",PO=function(t,n){return t<n?-1:t>n?1:0},HY=function(t,n){return-1*PO(t,n)},nt=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(r!=null)for(var a=Object.keys(r),i=0;i<a.length;i++){var l=a[i];e[l]=r[l]}}return e},GY=function(t){if(!(!(t.length===4||t.length===7)||t[0]!=="#")){var n=t.length===4,r,a,i,l=16;return n?(r=parseInt(t[1]+t[1],l),a=parseInt(t[2]+t[2],l),i=parseInt(t[3]+t[3],l)):(r=parseInt(t[1]+t[2],l),a=parseInt(t[3]+t[4],l),i=parseInt(t[5]+t[6],l)),[r,a,i]}},$Y=function(t){var n,r,a,i,l,o,f,c;function d(x,S,w){return w<0&&(w+=1),w>1&&(w-=1),w<1/6?x+(S-x)*6*w:w<1/2?S:w<2/3?x+(S-x)*(2/3-w)*6:x}var v=new RegExp("^"+FY+"$").exec(t);if(v){if(r=parseInt(v[1]),r<0?r=(360- -1*r%360)%360:r>360&&(r=r%360),r/=360,a=parseFloat(v[2]),a<0||a>100||(a=a/100,i=parseFloat(v[3]),i<0||i>100)||(i=i/100,l=v[4],l!==void 0&&(l=parseFloat(l),l<0||l>1)))return;if(a===0)o=f=c=Math.round(i*255);else{var m=i<.5?i*(1+a):i+a-i*a,y=2*i-m;o=Math.round(255*d(y,m,r+1/3)),f=Math.round(255*d(y,m,r)),c=Math.round(255*d(y,m,r-1/3))}n=[o,f,c,l]}return n},YY=function(t){var n,r=new RegExp("^"+zY+"$").exec(t);if(r){n=[];for(var a=[],i=1;i<=3;i++){var l=r[i];if(l[l.length-1]==="%"&&(a[i]=!0),l=parseFloat(l),a[i]&&(l=l/100*255),l<0||l>255)return;n.push(Math.floor(l))}var o=a[1]||a[2]||a[3],f=a[1]&&a[2]&&a[3];if(o&&!f)return;var c=r[4];if(c!==void 0){if(c=parseFloat(c),c<0||c>1)return;n.push(c)}}return n},KY=function(t){return XY[t.toLowerCase()]},zO=function(t){return($t(t)?t:null)||KY(t)||GY(t)||YY(t)||$Y(t)},XY={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},IO=function(t){for(var n=t.map,r=t.keys,a=r.length,i=0;i<a;i++){var l=r[i];if(Dt(l))throw Error("Tried to set map with object key");i<r.length-1?(n[l]==null&&(n[l]={}),n=n[l]):n[l]=t.value}},FO=function(t){for(var n=t.map,r=t.keys,a=r.length,i=0;i<a;i++){var l=r[i];if(Dt(l))throw Error("Tried to get map with object key");if(n=n[l],n==null)return n}return n},iv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ex,TN;function Sd(){if(TN)return ex;TN=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return ex=e,ex}var tx,NN;function QY(){if(NN)return tx;NN=1;var e=typeof iv=="object"&&iv&&iv.Object===Object&&iv;return tx=e,tx}var nx,kN;function Vp(){if(kN)return nx;kN=1;var e=QY(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return nx=n,nx}var rx,AN;function WY(){if(AN)return rx;AN=1;var e=Vp(),t=function(){return e.Date.now()};return rx=t,rx}var ax,RN;function ZY(){if(RN)return ax;RN=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return ax=t,ax}var ix,DN;function JY(){if(DN)return ix;DN=1;var e=ZY(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return ix=n,ix}var sx,jN;function cw(){if(jN)return sx;jN=1;var e=Vp(),t=e.Symbol;return sx=t,sx}var lx,MN;function eK(){if(MN)return lx;MN=1;var e=cw(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function i(l){var o=n.call(l,a),f=l[a];try{l[a]=void 0;var c=!0}catch{}var d=r.call(l);return c&&(o?l[a]=f:delete l[a]),d}return lx=i,lx}var ox,ON;function tK(){if(ON)return ox;ON=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return ox=n,ox}var ux,LN;function qO(){if(LN)return ux;LN=1;var e=cw(),t=eK(),n=tK(),r="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function l(o){return o==null?o===void 0?a:r:i&&i in Object(o)?t(o):n(o)}return ux=l,ux}var cx,_N;function nK(){if(_N)return cx;_N=1;function e(t){return t!=null&&typeof t=="object"}return cx=e,cx}var fx,BN;function Ed(){if(BN)return fx;BN=1;var e=qO(),t=nK(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return fx=r,fx}var dx,PN;function rK(){if(PN)return dx;PN=1;var e=JY(),t=Sd(),n=Ed(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,l=/^0o[0-7]+$/i,o=parseInt;function f(c){if(typeof c=="number")return c;if(n(c))return r;if(t(c)){var d=typeof c.valueOf=="function"?c.valueOf():c;c=t(d)?d+"":d}if(typeof c!="string")return c===0?c:+c;c=e(c);var v=i.test(c);return v||l.test(c)?o(c.slice(2),v?2:8):a.test(c)?r:+c}return dx=f,dx}var hx,zN;function aK(){if(zN)return hx;zN=1;var e=Sd(),t=WY(),n=rK(),r="Expected a function",a=Math.max,i=Math.min;function l(o,f,c){var d,v,m,y,x,S,w=0,b=!1,C=!1,T=!0;if(typeof o!="function")throw new TypeError(r);f=n(f)||0,e(c)&&(b=!!c.leading,C="maxWait"in c,m=C?a(n(c.maxWait)||0,f):m,T="trailing"in c?!!c.trailing:T);function k(G){var I=d,F=v;return d=v=void 0,w=G,y=o.apply(F,I),y}function D(G){return w=G,x=setTimeout(L,f),b?k(G):y}function A(G){var I=G-S,F=G-w,B=f-I;return C?i(B,m-F):B}function j(G){var I=G-S,F=G-w;return S===void 0||I>=f||I<0||C&&F>=m}function L(){var G=t();if(j(G))return _(G);x=setTimeout(L,A(G))}function _(G){return x=void 0,T&&d?k(G):(d=v=void 0,y)}function M(){x!==void 0&&clearTimeout(x),w=0,d=S=v=x=void 0}function z(){return x===void 0?y:_(t())}function P(){var G=t(),I=j(G);if(d=arguments,v=this,S=G,I){if(x===void 0)return D(S);if(C)return clearTimeout(x),x=setTimeout(L,f),k(S)}return x===void 0&&(x=setTimeout(L,f)),y}return P.cancel=M,P.flush=z,P}return hx=l,hx}var iK=aK(),Cd=wd(iK),vx=_n?_n.performance:null,UO=vx&&vx.now?function(){return vx.now()}:function(){return Date.now()},sK=(function(){if(_n){if(_n.requestAnimationFrame)return function(e){_n.requestAnimationFrame(e)};if(_n.mozRequestAnimationFrame)return function(e){_n.mozRequestAnimationFrame(e)};if(_n.webkitRequestAnimationFrame)return function(e){_n.webkitRequestAnimationFrame(e)};if(_n.msRequestAnimationFrame)return function(e){_n.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(UO())},1e3/60)}})(),np=function(t){return sK(t)},Yi=UO,$l=9261,VO=65599,wu=5381,HO=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$l,r=n,a;a=t.next(),!a.done;)r=r*VO+a.value|0;return r},$f=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$l;return n*VO+t|0},Yf=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:wu;return(n<<5)+n+t|0},lK=function(t,n){return t*2097152+n},Ms=function(t){return t[0]*2097152+t[1]},sv=function(t,n){return[$f(t[0],n[0]),Yf(t[1],n[1])]},IN=function(t,n){var r={value:0,done:!1},a=0,i=t.length,l={next:function(){return a<i?r.value=t[a++]:r.done=!0,r}};return HO(l,n)},mo=function(t,n){var r={value:0,done:!1},a=0,i=t.length,l={next:function(){return a<i?r.value=t.charCodeAt(a++):r.done=!0,r}};return HO(l,n)},GO=function(){return oK(arguments)},oK=function(t){for(var n,r=0;r<t.length;r++){var a=t[r];r===0?n=mo(a):n=mo(a,n)}return n};function uK(e,t,n,r,a){var i=a*Math.PI/180,l=Math.cos(i)*(e-n)-Math.sin(i)*(t-r)+n,o=Math.sin(i)*(e-n)+Math.cos(i)*(t-r)+r;return{x:l,y:o}}var cK=function(t,n,r,a,i,l){return{x:(t-r)*i+r,y:(n-a)*l+a}};function fK(e,t,n){if(n===0)return e;var r=(t.x1+t.x2)/2,a=(t.y1+t.y2)/2,i=t.w/t.h,l=1/i,o=uK(e.x,e.y,r,a,n),f=cK(o.x,o.y,r,a,i,l);return{x:f.x,y:f.y}}var FN=!0,dK=console.warn!=null,hK=console.trace!=null,fw=Number.MAX_SAFE_INTEGER||9007199254740991,$O=function(){return!0},rp=function(){return!1},qN=function(){return 0},dw=function(){},sn=function(t){throw new Error(t)},YO=function(t){if(t!==void 0)FN=!!t;else return FN},Bt=function(t){YO()&&(dK?console.warn(t):(console.log(t),hK&&console.trace()))},vK=function(t){return nt({},t)},ti=function(t){return t==null?t:$t(t)?t.slice():Dt(t)?vK(t):t},pK=function(t){return t.slice()},KO=function(t,n){for(n=t="";t++<36;n+=t*51&52?(t^15?8^Math.random()*(t^20?16:4):4).toString(16):"-");return n},mK={},XO=function(){return mK},lr=function(t){var n=Object.keys(t);return function(r){for(var a={},i=0;i<n.length;i++){var l=n[i],o=r==null?void 0:r[l];a[l]=o===void 0?t[l]:o}return a}},ol=function(t,n,r){for(var a=t.length-1;a>=0;a--)t[a]===n&&t.splice(a,1)},hw=function(t){t.splice(0,t.length)},gK=function(t,n){for(var r=0;r<n.length;r++){var a=n[r];t.push(a)}},zr=function(t,n,r){return r&&(n=BO(r,n)),t[n]},Bi=function(t,n,r,a){r&&(n=BO(r,n)),t[n]=a},yK=(function(){function e(){yl(this,e),this._obj={}}return xl(e,[{key:"set",value:function(n,r){return this._obj[n]=r,this}},{key:"delete",value:function(n){return this._obj[n]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(n){return this._obj[n]!==void 0}},{key:"get",value:function(n){return this._obj[n]}}])})(),Ui=typeof Map<"u"?Map:yK,xK="undefined",bK=(function(){function e(t){if(yl(this,e),this._obj=Object.create(null),this.size=0,t!=null){var n;t.instanceString!=null&&t.instanceString()===this.instanceString()?n=t.toArray():n=t;for(var r=0;r<n.length;r++)this.add(n[r])}}return xl(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(n){var r=this._obj;r[n]!==1&&(r[n]=1,this.size++)}},{key:"delete",value:function(n){var r=this._obj;r[n]===1&&(r[n]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(n){return this._obj[n]===1}},{key:"toArray",value:function(){var n=this;return Object.keys(this._obj).filter(function(r){return n.has(r)})}},{key:"forEach",value:function(n,r){return this.toArray().forEach(n,r)}}])})(),fc=(typeof Set>"u"?"undefined":In(Set))!==xK?Set:bK,Hp=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(t===void 0||n===void 0||!ow(t)){sn("An element must have a core reference and parameters set");return}var a=n.group;if(a==null&&(n.data&&n.data.source!=null&&n.data.target!=null?a="edges":a="nodes"),a!=="nodes"&&a!=="edges"){sn("An element must be of type `nodes` or `edges`; you specified `"+a+"`");return}this.length=1,this[0]=this;var i=this._private={cy:t,single:!0,data:n.data||{},position:n.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:a,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!n.selected,selectable:n.selectable===void 0?!0:!!n.selectable,locked:!!n.locked,grabbed:!1,grabbable:n.grabbable===void 0?!0:!!n.grabbable,pannable:n.pannable===void 0?a==="edges":!!n.pannable,active:!1,classes:new fc,animation:{current:[],queue:[]},rscratch:{},scratch:n.scratch||{},edges:[],children:[],parent:n.parent&&n.parent.isNode()?n.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),n.renderedPosition){var l=n.renderedPosition,o=t.pan(),f=t.zoom();i.position={x:(l.x-o.x)/f,y:(l.y-o.y)/f}}var c=[];$t(n.classes)?c=n.classes:Ze(n.classes)&&(c=n.classes.split(/\s+/));for(var d=0,v=c.length;d<v;d++){var m=c[d];!m||m===""||i.classes.add(m)}this.createEmitter(),(r===void 0||r)&&this.restore();var y=n.style||n.css;y&&(Bt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(y))},UN=function(t){return t={bfs:t.bfs||!t.dfs,dfs:t.dfs||!t.bfs},function(r,a,i){var l;Dt(r)&&!ta(r)&&(l=r,r=l.roots||l.root,a=l.visit,i=l.directed),i=arguments.length===2&&!fn(a)?a:i,a=fn(a)?a:function(){};for(var o=this._private.cy,f=r=Ze(r)?this.filter(r):r,c=[],d=[],v={},m={},y={},x=0,S,w=this.byGroup(),b=w.nodes,C=w.edges,T=0;T<f.length;T++){var k=f[T],D=k.id();k.isNode()&&(c.unshift(k),t.bfs&&(y[D]=!0,d.push(k)),m[D]=0)}for(var A=function(){var G=t.bfs?c.shift():c.pop(),I=G.id();if(t.dfs){if(y[I])return 0;y[I]=!0,d.push(G)}var F=m[I],B=v[I],H=B!=null?B.source():null,K=B!=null?B.target():null,Q=B==null?void 0:G.same(H)?K[0]:H[0],V;if(V=a(G,B,Q,x++,F),V===!0)return S=G,1;if(V===!1)return 1;for(var q=G.connectedEdges().filter(function(oe){return(!i||oe.source().same(G))&&C.has(oe)}),X=0;X<q.length;X++){var U=q[X],te=U.connectedNodes().filter(function(oe){return!oe.same(G)&&b.has(oe)}),ie=te.id();te.length!==0&&!y[ie]&&(te=te[0],c.push(te),t.bfs&&(y[ie]=!0,d.push(te)),v[ie]=U,m[ie]=m[I]+1)}},j;c.length!==0&&(j=A(),!(j!==0&&j===1)););for(var L=o.collection(),_=0;_<d.length;_++){var M=d[_],z=v[M.id()];z!=null&&L.push(z),L.push(M)}return{path:o.collection(L),found:o.collection(S)}}},Kf={breadthFirstSearch:UN({bfs:!0}),depthFirstSearch:UN({dfs:!0})};Kf.bfs=Kf.breadthFirstSearch;Kf.dfs=Kf.depthFirstSearch;var kv={exports:{}},wK=kv.exports,VN;function SK(){return VN||(VN=1,(function(e,t){(function(){var n,r,a,i,l,o,f,c,d,v,m,y,x,S,w;a=Math.floor,v=Math.min,r=function(b,C){return b<C?-1:b>C?1:0},d=function(b,C,T,k,D){var A;if(T==null&&(T=0),D==null&&(D=r),T<0)throw new Error("lo must be non-negative");for(k==null&&(k=b.length);T<k;)A=a((T+k)/2),D(C,b[A])<0?k=A:T=A+1;return[].splice.apply(b,[T,T-T].concat(C)),C},o=function(b,C,T){return T==null&&(T=r),b.push(C),S(b,0,b.length-1,T)},l=function(b,C){var T,k;return C==null&&(C=r),T=b.pop(),b.length?(k=b[0],b[0]=T,w(b,0,C)):k=T,k},c=function(b,C,T){var k;return T==null&&(T=r),k=b[0],b[0]=C,w(b,0,T),k},f=function(b,C,T){var k;return T==null&&(T=r),b.length&&T(b[0],C)<0&&(k=[b[0],C],C=k[0],b[0]=k[1],w(b,0,T)),C},i=function(b,C){var T,k,D,A,j,L;for(C==null&&(C=r),A=(function(){L=[];for(var _=0,M=a(b.length/2);0<=M?_<M:_>M;0<=M?_++:_--)L.push(_);return L}).apply(this).reverse(),j=[],k=0,D=A.length;k<D;k++)T=A[k],j.push(w(b,T,C));return j},x=function(b,C,T){var k;if(T==null&&(T=r),k=b.indexOf(C),k!==-1)return S(b,0,k,T),w(b,k,T)},m=function(b,C,T){var k,D,A,j,L;if(T==null&&(T=r),D=b.slice(0,C),!D.length)return D;for(i(D,T),L=b.slice(C),A=0,j=L.length;A<j;A++)k=L[A],f(D,k,T);return D.sort(T).reverse()},y=function(b,C,T){var k,D,A,j,L,_,M,z,P;if(T==null&&(T=r),C*10<=b.length){if(A=b.slice(0,C).sort(T),!A.length)return A;for(D=A[A.length-1],M=b.slice(C),j=0,_=M.length;j<_;j++)k=M[j],T(k,D)<0&&(d(A,k,0,null,T),A.pop(),D=A[A.length-1]);return A}for(i(b,T),P=[],L=0,z=v(C,b.length);0<=z?L<z:L>z;0<=z?++L:--L)P.push(l(b,T));return P},S=function(b,C,T,k){var D,A,j;for(k==null&&(k=r),D=b[T];T>C;){if(j=T-1>>1,A=b[j],k(D,A)<0){b[T]=A,T=j;continue}break}return b[T]=D},w=function(b,C,T){var k,D,A,j,L;for(T==null&&(T=r),D=b.length,L=C,A=b[C],k=2*C+1;k<D;)j=k+1,j<D&&!(T(b[k],b[j])<0)&&(k=j),b[C]=b[k],C=k,k=2*C+1;return b[C]=A,S(b,L,C,T)},n=(function(){b.push=o,b.pop=l,b.replace=c,b.pushpop=f,b.heapify=i,b.updateItem=x,b.nlargest=m,b.nsmallest=y;function b(C){this.cmp=C??r,this.nodes=[]}return b.prototype.push=function(C){return o(this.nodes,C,this.cmp)},b.prototype.pop=function(){return l(this.nodes,this.cmp)},b.prototype.peek=function(){return this.nodes[0]},b.prototype.contains=function(C){return this.nodes.indexOf(C)!==-1},b.prototype.replace=function(C){return c(this.nodes,C,this.cmp)},b.prototype.pushpop=function(C){return f(this.nodes,C,this.cmp)},b.prototype.heapify=function(){return i(this.nodes,this.cmp)},b.prototype.updateItem=function(C){return x(this.nodes,C,this.cmp)},b.prototype.clear=function(){return this.nodes=[]},b.prototype.empty=function(){return this.nodes.length===0},b.prototype.size=function(){return this.nodes.length},b.prototype.clone=function(){var C;return C=new b,C.nodes=this.nodes.slice(0),C},b.prototype.toArray=function(){return this.nodes.slice(0)},b.prototype.insert=b.prototype.push,b.prototype.top=b.prototype.peek,b.prototype.front=b.prototype.peek,b.prototype.has=b.prototype.contains,b.prototype.copy=b.prototype.clone,b})(),(function(b,C){return e.exports=C()})(this,function(){return n})}).call(wK)})(kv)),kv.exports}var px,HN;function EK(){return HN||(HN=1,px=SK()),px}var CK=EK(),Td=wd(CK),TK=lr({root:null,weight:function(t){return 1},directed:!1}),NK={dijkstra:function(t){if(!Dt(t)){var n=arguments;t={root:n[0],weight:n[1],directed:n[2]}}var r=TK(t),a=r.root,i=r.weight,l=r.directed,o=this,f=i,c=Ze(a)?this.filter(a)[0]:a[0],d={},v={},m={},y=this.byGroup(),x=y.nodes,S=y.edges;S.unmergeBy(function(F){return F.isLoop()});for(var w=function(B){return d[B.id()]},b=function(B,H){d[B.id()]=H,C.updateItem(B)},C=new Td(function(F,B){return w(F)-w(B)}),T=0;T<x.length;T++){var k=x[T];d[k.id()]=k.same(c)?0:1/0,C.push(k)}for(var D=function(B,H){for(var K=(l?B.edgesTo(H):B.edgesWith(H)).intersect(S),Q=1/0,V,q=0;q<K.length;q++){var X=K[q],U=f(X);(U<Q||!V)&&(Q=U,V=X)}return{edge:V,dist:Q}};C.size()>0;){var A=C.pop(),j=w(A),L=A.id();if(m[L]=j,j!==1/0)for(var _=A.neighborhood().intersect(x),M=0;M<_.length;M++){var z=_[M],P=z.id(),G=D(A,z),I=j+G.dist;I<w(z)&&(b(z,I),v[P]={node:A,edge:G.edge})}}return{distanceTo:function(B){var H=Ze(B)?x.filter(B)[0]:B[0];return m[H.id()]},pathTo:function(B){var H=Ze(B)?x.filter(B)[0]:B[0],K=[],Q=H,V=Q.id();if(H.length>0)for(K.unshift(H);v[V];){var q=v[V];K.unshift(q.edge),K.unshift(q.node),Q=q.node,V=Q.id()}return o.spawn(K)}}}},kK={kruskal:function(t){t=t||function(T){return 1};for(var n=this.byGroup(),r=n.nodes,a=n.edges,i=r.length,l=new Array(i),o=r,f=function(k){for(var D=0;D<l.length;D++){var A=l[D];if(A.has(k))return D}},c=0;c<i;c++)l[c]=this.spawn(r[c]);for(var d=a.sort(function(T,k){return t(T)-t(k)}),v=0;v<d.length;v++){var m=d[v],y=m.source()[0],x=m.target()[0],S=f(y),w=f(x),b=l[S],C=l[w];S!==w&&(o.merge(m),b.merge(C),l.splice(w,1))}return o}},AK=lr({root:null,goal:null,weight:function(t){return 1},heuristic:function(t){return 0},directed:!1}),RK={aStar:function(t){var n=this.cy(),r=AK(t),a=r.root,i=r.goal,l=r.heuristic,o=r.directed,f=r.weight;a=n.collection(a)[0],i=n.collection(i)[0];var c=a.id(),d=i.id(),v={},m={},y={},x=new Td(function(V,q){return m[V.id()]-m[q.id()]}),S=new fc,w={},b={},C=function(q,X){x.push(q),S.add(X)},T,k,D=function(){T=x.pop(),k=T.id(),S.delete(k)},A=function(q){return S.has(q)};C(a,c),v[c]=0,m[c]=l(a);for(var j=0;x.size()>0;){if(D(),j++,k===d){for(var L=[],_=i,M=d,z=b[M];L.unshift(_),z!=null&&L.unshift(z),_=w[M],_!=null;)M=_.id(),z=b[M];return{found:!0,distance:v[k],path:this.spawn(L),steps:j}}y[k]=!0;for(var P=T._private.edges,G=0;G<P.length;G++){var I=P[G];if(this.hasElementWithId(I.id())&&!(o&&I.data("source")!==k)){var F=I.source(),B=I.target(),H=F.id()!==k?F:B,K=H.id();if(this.hasElementWithId(K)&&!y[K]){var Q=v[k]+f(I);if(!A(K)){v[K]=Q,m[K]=Q+l(H),C(H,K),w[K]=T,b[K]=I;continue}Q<v[K]&&(v[K]=Q,m[K]=Q+l(H),w[K]=T,b[K]=I)}}}}return{found:!1,distance:void 0,path:void 0,steps:j}}},DK=lr({weight:function(t){return 1},directed:!1}),jK={floydWarshall:function(t){for(var n=this.cy(),r=DK(t),a=r.weight,i=r.directed,l=a,o=this.byGroup(),f=o.nodes,c=o.edges,d=f.length,v=d*d,m=function(U){return f.indexOf(U)},y=function(U){return f[U]},x=new Array(v),S=0;S<v;S++){var w=S%d,b=(S-w)/d;b===w?x[S]=0:x[S]=1/0}for(var C=new Array(v),T=new Array(v),k=0;k<c.length;k++){var D=c[k],A=D.source()[0],j=D.target()[0];if(A!==j){var L=m(A),_=m(j),M=L*d+_,z=l(D);if(x[M]>z&&(x[M]=z,C[M]=_,T[M]=D),!i){var P=_*d+L;!i&&x[P]>z&&(x[P]=z,C[P]=L,T[P]=D)}}}for(var G=0;G<d;G++)for(var I=0;I<d;I++)for(var F=I*d+G,B=0;B<d;B++){var H=I*d+B,K=G*d+B;x[F]+x[K]<x[H]&&(x[H]=x[F]+x[K],C[H]=C[F])}var Q=function(U){return(Ze(U)?n.filter(U):U)[0]},V=function(U){return m(Q(U))},q={distance:function(U,te){var ie=V(U),oe=V(te);return x[ie*d+oe]},path:function(U,te){var ie=V(U),oe=V(te),ae=y(ie);if(ie===oe)return ae.collection();if(C[ie*d+oe]==null)return n.collection();var we=n.collection(),fe=ie,J;for(we.merge(ae);ie!==oe;)fe=ie,ie=C[ie*d+oe],J=T[fe*d+ie],we.merge(J),we.merge(y(ie));return we}};return q}},MK=lr({weight:function(t){return 1},directed:!1,root:null}),OK={bellmanFord:function(t){var n=this,r=MK(t),a=r.weight,i=r.directed,l=r.root,o=a,f=this,c=this.cy(),d=this.byGroup(),v=d.edges,m=d.nodes,y=m.length,x=new Ui,S=!1,w=[];l=c.collection(l)[0],v.unmergeBy(function(Qe){return Qe.isLoop()});for(var b=v.length,C=function(Ke){var qe=x.get(Ke.id());return qe||(qe={},x.set(Ke.id(),qe)),qe},T=function(Ke){return(Ze(Ke)?c.$(Ke):Ke)[0]},k=function(Ke){return C(T(Ke)).dist},D=function(Ke){for(var qe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l,De=T(Ke),Ge=[],Ye=De;;){if(Ye==null)return n.spawn();var it=C(Ye),Pe=it.edge,ct=it.pred;if(Ge.unshift(Ye[0]),Ye.same(qe)&&Ge.length>0)break;Pe!=null&&Ge.unshift(Pe),Ye=ct}return f.spawn(Ge)},A=0;A<y;A++){var j=m[A],L=C(j);j.same(l)?L.dist=0:L.dist=1/0,L.pred=null,L.edge=null}for(var _=!1,M=function(Ke,qe,De,Ge,Ye,it){var Pe=Ge.dist+it;Pe<Ye.dist&&!De.same(Ge.edge)&&(Ye.dist=Pe,Ye.pred=Ke,Ye.edge=De,_=!0)},z=1;z<y;z++){_=!1;for(var P=0;P<b;P++){var G=v[P],I=G.source(),F=G.target(),B=o(G),H=C(I),K=C(F);M(I,F,G,H,K,B),i||M(F,I,G,K,H,B)}if(!_)break}if(_)for(var Q=[],V=0;V<b;V++){var q=v[V],X=q.source(),U=q.target(),te=o(q),ie=C(X).dist,oe=C(U).dist;if(ie+te<oe||!i&&oe+te<ie)if(S||(Bt("Graph contains a negative weight cycle for Bellman-Ford"),S=!0),t.findNegativeWeightCycles!==!1){var ae=[];ie+te<oe&&ae.push(X),!i&&oe+te<ie&&ae.push(U);for(var we=ae.length,fe=0;fe<we;fe++){var J=ae[fe],ne=[J];ne.push(C(J).edge);for(var re=C(J).pred;ne.indexOf(re)===-1;)ne.push(re),ne.push(C(re).edge),re=C(re).pred;ne=ne.slice(ne.indexOf(re));for(var ge=ne[0].id(),Ne=0,Be=2;Be<ne.length;Be+=2)ne[Be].id()<ge&&(ge=ne[Be].id(),Ne=Be);ne=ne.slice(Ne).concat(ne.slice(0,Ne)),ne.push(ne[0]);var st=ne.map(function(Qe){return Qe.id()}).join(",");Q.indexOf(st)===-1&&(w.push(f.spawn(ne)),Q.push(st))}}else break}return{distanceTo:k,pathTo:D,hasNegativeWeightCycle:S,negativeWeightCycles:w}}},LK=Math.sqrt(2),_K=function(t,n,r){r.length===0&&sn("Karger-Stein must be run on a connected (sub)graph");for(var a=r[t],i=a[1],l=a[2],o=n[i],f=n[l],c=r,d=c.length-1;d>=0;d--){var v=c[d],m=v[1],y=v[2];(n[m]===o&&n[y]===f||n[m]===f&&n[y]===o)&&c.splice(d,1)}for(var x=0;x<c.length;x++){var S=c[x];S[1]===f?(c[x]=S.slice(),c[x][1]=o):S[2]===f&&(c[x]=S.slice(),c[x][2]=o)}for(var w=0;w<n.length;w++)n[w]===f&&(n[w]=o);return c},mx=function(t,n,r,a){for(;r>a;){var i=Math.floor(Math.random()*n.length);n=_K(i,t,n),r--}return n},BK={kargerStein:function(){var t=this,n=this.byGroup(),r=n.nodes,a=n.edges;a.unmergeBy(function(K){return K.isLoop()});var i=r.length,l=a.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),f=Math.floor(i/LK);if(i<2){sn("At least 2 nodes are required for Karger-Stein algorithm");return}for(var c=[],d=0;d<l;d++){var v=a[d];c.push([d,r.indexOf(v.source()),r.indexOf(v.target())])}for(var m=1/0,y=[],x=new Array(i),S=new Array(i),w=new Array(i),b=function(Q,V){for(var q=0;q<i;q++)V[q]=Q[q]},C=0;C<=o;C++){for(var T=0;T<i;T++)S[T]=T;var k=mx(S,c.slice(),i,f),D=k.slice();b(S,w);var A=mx(S,k,f,2),j=mx(w,D,f,2);A.length<=j.length&&A.length<m?(m=A.length,y=A,b(S,x)):j.length<=A.length&&j.length<m&&(m=j.length,y=j,b(w,x))}for(var L=this.spawn(y.map(function(K){return a[K[0]]})),_=this.spawn(),M=this.spawn(),z=x[0],P=0;P<x.length;P++){var G=x[P],I=r[P];G===z?_.merge(I):M.merge(I)}var F=function(Q){var V=t.spawn();return Q.forEach(function(q){V.merge(q),q.connectedEdges().forEach(function(X){t.contains(X)&&!L.contains(X)&&V.merge(X)})}),V},B=[F(_),F(M)],H={cut:L,components:B,partition1:_,partition2:M};return H}},gx,PK=function(t){return{x:t.x,y:t.y}},Gp=function(t,n,r){return{x:t.x*n+r.x,y:t.y*n+r.y}},QO=function(t,n,r){return{x:(t.x-r.x)/n,y:(t.y-r.y)/n}},Eu=function(t){return{x:t[0],y:t[1]}},zK=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,a=1/0,i=n;i<r;i++){var l=t[i];isFinite(l)&&(a=Math.min(l,a))}return a},IK=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,a=-1/0,i=n;i<r;i++){var l=t[i];isFinite(l)&&(a=Math.max(l,a))}return a},FK=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,a=0,i=0,l=n;l<r;l++){var o=t[l];isFinite(o)&&(a+=o,i++)}return a/i},qK=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;a?t=t.slice(n,r):(r<t.length&&t.splice(r,t.length-r),n>0&&t.splice(0,n));for(var o=0,f=t.length-1;f>=0;f--){var c=t[f];l?isFinite(c)||(t[f]=-1/0,o++):t.splice(f,1)}i&&t.sort(function(m,y){return m-y});var d=t.length,v=Math.floor(d/2);return d%2!==0?t[v+1+o]:(t[v-1+o]+t[v+o])/2},UK=function(t){return Math.PI*t/180},lv=function(t,n){return Math.atan2(n,t)-Math.PI/2},vw=Math.log2||function(e){return Math.log(e)/Math.log(2)},pw=function(t){return t>0?1:t<0?-1:0},go=function(t,n){return Math.sqrt(Hl(t,n))},Hl=function(t,n){var r=n.x-t.x,a=n.y-t.y;return r*r+a*a},VK=function(t){for(var n=t.length,r=0,a=0;a<n;a++)r+=t[a];for(var i=0;i<n;i++)t[i]=t[i]/r;return t},Kn=function(t,n,r,a){return(1-a)*(1-a)*t+2*(1-a)*a*n+a*a*r},ju=function(t,n,r,a){return{x:Kn(t.x,n.x,r.x,a),y:Kn(t.y,n.y,r.y,a)}},HK=function(t,n,r,a){var i={x:n.x-t.x,y:n.y-t.y},l=go(t,n),o={x:i.x/l,y:i.y/l};return r=r??0,a=a??r*l,{x:t.x+o.x*a,y:t.y+o.y*a}},Xf=function(t,n,r){return Math.max(t,Math.min(r,n))},Tr=function(t){if(t==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(t.x1!=null&&t.y1!=null){if(t.x2!=null&&t.y2!=null&&t.x2>=t.x1&&t.y2>=t.y1)return{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,w:t.x2-t.x1,h:t.y2-t.y1};if(t.w!=null&&t.h!=null&&t.w>=0&&t.h>=0)return{x1:t.x1,y1:t.y1,x2:t.x1+t.w,y2:t.y1+t.h,w:t.w,h:t.h}}},GK=function(t){return{x1:t.x1,x2:t.x2,w:t.w,y1:t.y1,y2:t.y2,h:t.h}},$K=function(t){t.x1=1/0,t.y1=1/0,t.x2=-1/0,t.y2=-1/0,t.w=0,t.h=0},YK=function(t,n){t.x1=Math.min(t.x1,n.x1),t.x2=Math.max(t.x2,n.x2),t.w=t.x2-t.x1,t.y1=Math.min(t.y1,n.y1),t.y2=Math.max(t.y2,n.y2),t.h=t.y2-t.y1},WO=function(t,n,r){t.x1=Math.min(t.x1,n),t.x2=Math.max(t.x2,n),t.w=t.x2-t.x1,t.y1=Math.min(t.y1,r),t.y2=Math.max(t.y2,r),t.h=t.y2-t.y1},Av=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return t.x1-=n,t.x2+=n,t.y1-=n,t.y2+=n,t.w=t.x2-t.x1,t.h=t.y2-t.y1,t},Rv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],r,a,i,l;if(n.length===1)r=a=i=l=n[0];else if(n.length===2)r=i=n[0],l=a=n[1];else if(n.length===4){var o=Mn(n,4);r=o[0],a=o[1],i=o[2],l=o[3]}return t.x1-=l,t.x2+=a,t.y1-=r,t.y2+=i,t.w=t.x2-t.x1,t.h=t.y2-t.y1,t},GN=function(t,n){t.x1=n.x1,t.y1=n.y1,t.x2=n.x2,t.y2=n.y2,t.w=t.x2-t.x1,t.h=t.y2-t.y1},mw=function(t,n){return!(t.x1>n.x2||n.x1>t.x2||t.x2<n.x1||n.x2<t.x1||t.y2<n.y1||n.y2<t.y1||t.y1>n.y2||n.y1>t.y2)},Ks=function(t,n,r){return t.x1<=n&&n<=t.x2&&t.y1<=r&&r<=t.y2},$N=function(t,n){return Ks(t,n.x,n.y)},ZO=function(t,n){return Ks(t,n.x1,n.y1)&&Ks(t,n.x2,n.y2)},KK=(gx=Math.hypot)!==null&&gx!==void 0?gx:function(e,t){return Math.sqrt(e*e+t*t)};function XK(e,t){if(e.length<3)throw new Error("Need at least 3 vertices");var n=function(L,_){return{x:L.x+_.x,y:L.y+_.y}},r=function(L,_){return{x:L.x-_.x,y:L.y-_.y}},a=function(L,_){return{x:L.x*_,y:L.y*_}},i=function(L,_){return L.x*_.y-L.y*_.x},l=function(L){var _=KK(L.x,L.y);return _===0?{x:0,y:0}:{x:L.x/_,y:L.y/_}},o=function(L){for(var _=0,M=0;M<L.length;M++){var z=L[M],P=L[(M+1)%L.length];_+=z.x*P.y-P.x*z.y}return _/2},f=function(L,_,M,z){var P=r(_,L),G=r(z,M),I=i(P,G);if(Math.abs(I)<1e-9)return n(L,a(P,.5));var F=i(r(M,L),G)/I;return n(L,a(P,F))},c=e.map(function(j){return{x:j.x,y:j.y}});o(c)<0&&c.reverse();for(var d=c.length,v=[],m=0;m<d;m++){var y=c[m],x=c[(m+1)%d],S=r(x,y),w=l({x:S.y,y:-S.x});v.push(w)}for(var b=v.map(function(j,L){var _=n(c[L],a(j,t)),M=n(c[(L+1)%d],a(j,t));return{p1:_,p2:M}}),C=[],T=0;T<d;T++){var k=b[(T-1+d)%d],D=b[T],A=f(k.p1,k.p2,D.p1,D.p2);C.push(A)}return C}function QK(e,t,n,r,a,i){var l=iX(e,t,n,r,a),o=XK(l,i),f=Tr();return o.forEach(function(c){return WO(f,c.x,c.y)}),f}var JO=function(t,n,r,a,i,l,o){var f=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",c=f==="auto"?ul(i,l):f,d=i/2,v=l/2;c=Math.min(c,d,v);var m=c!==d,y=c!==v,x;if(m){var S=r-d+c-o,w=a-v-o,b=r+d-c+o,C=w;if(x=Xs(t,n,r,a,S,w,b,C,!1),x.length>0)return x}if(y){var T=r+d+o,k=a-v+c-o,D=T,A=a+v-c+o;if(x=Xs(t,n,r,a,T,k,D,A,!1),x.length>0)return x}if(m){var j=r-d+c-o,L=a+v+o,_=r+d-c+o,M=L;if(x=Xs(t,n,r,a,j,L,_,M,!1),x.length>0)return x}if(y){var z=r-d-o,P=a-v+c-o,G=z,I=a+v-c+o;if(x=Xs(t,n,r,a,z,P,G,I,!1),x.length>0)return x}var F;{var B=r-d+c,H=a-v+c;if(F=Af(t,n,r,a,B,H,c+o),F.length>0&&F[0]<=B&&F[1]<=H)return[F[0],F[1]]}{var K=r+d-c,Q=a-v+c;if(F=Af(t,n,r,a,K,Q,c+o),F.length>0&&F[0]>=K&&F[1]<=Q)return[F[0],F[1]]}{var V=r+d-c,q=a+v-c;if(F=Af(t,n,r,a,V,q,c+o),F.length>0&&F[0]>=V&&F[1]>=q)return[F[0],F[1]]}{var X=r-d+c,U=a+v-c;if(F=Af(t,n,r,a,X,U,c+o),F.length>0&&F[0]<=X&&F[1]>=U)return[F[0],F[1]]}return[]},WK=function(t,n,r,a,i,l,o){var f=o,c=Math.min(r,i),d=Math.max(r,i),v=Math.min(a,l),m=Math.max(a,l);return c-f<=t&&t<=d+f&&v-f<=n&&n<=m+f},ZK=function(t,n,r,a,i,l,o,f,c){var d={x1:Math.min(r,o,i)-c,x2:Math.max(r,o,i)+c,y1:Math.min(a,f,l)-c,y2:Math.max(a,f,l)+c};return!(t<d.x1||t>d.x2||n<d.y1||n>d.y2)},JK=function(t,n,r,a){r-=a;var i=n*n-4*t*r;if(i<0)return[];var l=Math.sqrt(i),o=2*t,f=(-n+l)/o,c=(-n-l)/o;return[f,c]},eX=function(t,n,r,a,i){var l=1e-5;t===0&&(t=l),n/=t,r/=t,a/=t;var o,f,c,d,v,m,y,x;if(f=(3*r-n*n)/9,c=-(27*a)+n*(9*r-2*(n*n)),c/=54,o=f*f*f+c*c,i[1]=0,y=n/3,o>0){v=c+Math.sqrt(o),v=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3),m=c-Math.sqrt(o),m=m<0?-Math.pow(-m,1/3):Math.pow(m,1/3),i[0]=-y+v+m,y+=(v+m)/2,i[4]=i[2]=-y,y=Math.sqrt(3)*(-m+v)/2,i[3]=y,i[5]=-y;return}if(i[5]=i[3]=0,o===0){x=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-y+2*x,i[4]=i[2]=-(x+y);return}f=-f,d=f*f*f,d=Math.acos(c/Math.sqrt(d)),x=2*Math.sqrt(f),i[0]=-y+x*Math.cos(d/3),i[2]=-y+x*Math.cos((d+2*Math.PI)/3),i[4]=-y+x*Math.cos((d+4*Math.PI)/3)},tX=function(t,n,r,a,i,l,o,f){var c=1*r*r-4*r*i+2*r*o+4*i*i-4*i*o+o*o+a*a-4*a*l+2*a*f+4*l*l-4*l*f+f*f,d=9*r*i-3*r*r-3*r*o-6*i*i+3*i*o+9*a*l-3*a*a-3*a*f-6*l*l+3*l*f,v=3*r*r-6*r*i+r*o-r*t+2*i*i+2*i*t-o*t+3*a*a-6*a*l+a*f-a*n+2*l*l+2*l*n-f*n,m=1*r*i-r*r+r*t-i*t+a*l-a*a+a*n-l*n,y=[];eX(c,d,v,m,y);for(var x=1e-7,S=[],w=0;w<6;w+=2)Math.abs(y[w+1])<x&&y[w]>=0&&y[w]<=1&&S.push(y[w]);S.push(1),S.push(0);for(var b=-1,C,T,k,D=0;D<S.length;D++)C=Math.pow(1-S[D],2)*r+2*(1-S[D])*S[D]*i+S[D]*S[D]*o,T=Math.pow(1-S[D],2)*a+2*(1-S[D])*S[D]*l+S[D]*S[D]*f,k=Math.pow(C-t,2)+Math.pow(T-n,2),b>=0?k<b&&(b=k):b=k;return b},nX=function(t,n,r,a,i,l){var o=[t-r,n-a],f=[i-r,l-a],c=f[0]*f[0]+f[1]*f[1],d=o[0]*o[0]+o[1]*o[1],v=o[0]*f[0]+o[1]*f[1],m=v*v/c;return v<0?d:m>c?(t-i)*(t-i)+(n-l)*(n-l):d-m},Ir=function(t,n,r){for(var a,i,l,o,f,c=0,d=0;d<r.length/2;d++)if(a=r[d*2],i=r[d*2+1],d+1<r.length/2?(l=r[(d+1)*2],o=r[(d+1)*2+1]):(l=r[(d+1-r.length/2)*2],o=r[(d+1-r.length/2)*2+1]),!(a==t&&l==t))if(a>=t&&t>=l||a<=t&&t<=l)f=(t-a)/(l-a)*(o-i)+i,f>n&&c++;else continue;return c%2!==0},Ki=function(t,n,r,a,i,l,o,f,c){var d=new Array(r.length),v;f[0]!=null?(v=Math.atan(f[1]/f[0]),f[0]<0?v=v+Math.PI/2:v=-v-Math.PI/2):v=f;for(var m=Math.cos(-v),y=Math.sin(-v),x=0;x<d.length/2;x++)d[x*2]=l/2*(r[x*2]*m-r[x*2+1]*y),d[x*2+1]=o/2*(r[x*2+1]*m+r[x*2]*y),d[x*2]+=a,d[x*2+1]+=i;var S;if(c>0){var w=ip(d,-c);S=ap(w)}else S=d;return Ir(t,n,S)},rX=function(t,n,r,a,i,l,o,f){for(var c=new Array(r.length*2),d=0;d<f.length;d++){var v=f[d];c[d*4+0]=v.startX,c[d*4+1]=v.startY,c[d*4+2]=v.stopX,c[d*4+3]=v.stopY;var m=Math.pow(v.cx-t,2)+Math.pow(v.cy-n,2);if(m<=Math.pow(v.radius,2))return!0}return Ir(t,n,c)},ap=function(t){for(var n=new Array(t.length/2),r,a,i,l,o,f,c,d,v=0;v<t.length/4;v++){r=t[v*4],a=t[v*4+1],i=t[v*4+2],l=t[v*4+3],v<t.length/4-1?(o=t[(v+1)*4],f=t[(v+1)*4+1],c=t[(v+1)*4+2],d=t[(v+1)*4+3]):(o=t[0],f=t[1],c=t[2],d=t[3]);var m=Xs(r,a,i,l,o,f,c,d,!0);n[v*2]=m[0],n[v*2+1]=m[1]}return n},ip=function(t,n){for(var r=new Array(t.length*2),a,i,l,o,f=0;f<t.length/2;f++){a=t[f*2],i=t[f*2+1],f<t.length/2-1?(l=t[(f+1)*2],o=t[(f+1)*2+1]):(l=t[0],o=t[1]);var c=o-i,d=-(l-a),v=Math.sqrt(c*c+d*d),m=c/v,y=d/v;r[f*4]=a+m*n,r[f*4+1]=i+y*n,r[f*4+2]=l+m*n,r[f*4+3]=o+y*n}return r},aX=function(t,n,r,a,i,l){var o=r-t,f=a-n;o/=i,f/=l;var c=Math.sqrt(o*o+f*f),d=c-1;if(d<0)return[];var v=d/c;return[(r-t)*v+t,(a-n)*v+n]},Xl=function(t,n,r,a,i,l,o){return t-=i,n-=l,t/=r/2+o,n/=a/2+o,t*t+n*n<=1},Af=function(t,n,r,a,i,l,o){var f=[r-t,a-n],c=[t-i,n-l],d=f[0]*f[0]+f[1]*f[1],v=2*(c[0]*f[0]+c[1]*f[1]),m=c[0]*c[0]+c[1]*c[1]-o*o,y=v*v-4*d*m;if(y<0)return[];var x=(-v+Math.sqrt(y))/(2*d),S=(-v-Math.sqrt(y))/(2*d),w=Math.min(x,S),b=Math.max(x,S),C=[];if(w>=0&&w<=1&&C.push(w),b>=0&&b<=1&&C.push(b),C.length===0)return[];var T=C[0]*f[0]+t,k=C[0]*f[1]+n;if(C.length>1){if(C[0]==C[1])return[T,k];var D=C[1]*f[0]+t,A=C[1]*f[1]+n;return[T,k,D,A]}else return[T,k]},yx=function(t,n,r){return n<=t&&t<=r||r<=t&&t<=n?t:t<=n&&n<=r||r<=n&&n<=t?n:r},Xs=function(t,n,r,a,i,l,o,f,c){var d=t-i,v=r-t,m=o-i,y=n-l,x=a-n,S=f-l,w=m*y-S*d,b=v*y-x*d,C=S*v-m*x;if(C!==0){var T=w/C,k=b/C,D=.001,A=0-D,j=1+D;return A<=T&&T<=j&&A<=k&&k<=j?[t+T*v,n+T*x]:c?[t+T*v,n+T*x]:[]}else return w===0||b===0?yx(t,r,o)===o?[o,f]:yx(t,r,i)===i?[i,l]:yx(i,o,r)===r?[r,a]:[]:[]},iX=function(t,n,r,a,i){var l=[],o=a/2,f=i/2,c=n,d=r;l.push({x:c+o*t[0],y:d+f*t[1]});for(var v=1;v<t.length/2;v++)l.push({x:c+o*t[v*2],y:d+f*t[v*2+1]});return l},Qf=function(t,n,r,a,i,l,o,f){var c=[],d,v=new Array(r.length),m=!0;l==null&&(m=!1);var y;if(m){for(var x=0;x<v.length/2;x++)v[x*2]=r[x*2]*l+a,v[x*2+1]=r[x*2+1]*o+i;if(f>0){var S=ip(v,-f);y=ap(S)}else y=v}else y=r;for(var w,b,C,T,k=0;k<y.length/2;k++)w=y[k*2],b=y[k*2+1],k<y.length/2-1?(C=y[(k+1)*2],T=y[(k+1)*2+1]):(C=y[0],T=y[1]),d=Xs(t,n,a,i,w,b,C,T),d.length!==0&&c.push(d[0],d[1]);return c},sX=function(t,n,r,a,i,l,o,f,c){var d=[],v,m=new Array(r.length*2);c.forEach(function(C,T){T===0?(m[m.length-2]=C.startX,m[m.length-1]=C.startY):(m[T*4-2]=C.startX,m[T*4-1]=C.startY),m[T*4]=C.stopX,m[T*4+1]=C.stopY,v=Af(t,n,a,i,C.cx,C.cy,C.radius),v.length!==0&&d.push(v[0],v[1])});for(var y=0;y<m.length/4;y++)v=Xs(t,n,a,i,m[y*4],m[y*4+1],m[y*4+2],m[y*4+3],!1),v.length!==0&&d.push(v[0],v[1]);if(d.length>2){for(var x=[d[0],d[1]],S=Math.pow(x[0]-t,2)+Math.pow(x[1]-n,2),w=1;w<d.length/2;w++){var b=Math.pow(d[w*2]-t,2)+Math.pow(d[w*2+1]-n,2);b<=S&&(x[0]=d[w*2],x[1]=d[w*2+1],S=b)}return x}return d},ov=function(t,n,r){var a=[t[0]-n[0],t[1]-n[1]],i=Math.sqrt(a[0]*a[0]+a[1]*a[1]),l=(i-r)/i;return l<0&&(l=1e-5),[n[0]+l*a[0],n[1]+l*a[1]]},wr=function(t,n){var r=Db(t,n);return r=eL(r),r},eL=function(t){for(var n,r,a=t.length/2,i=1/0,l=1/0,o=-1/0,f=-1/0,c=0;c<a;c++)n=t[2*c],r=t[2*c+1],i=Math.min(i,n),o=Math.max(o,n),l=Math.min(l,r),f=Math.max(f,r);for(var d=2/(o-i),v=2/(f-l),m=0;m<a;m++)n=t[2*m]=t[2*m]*d,r=t[2*m+1]=t[2*m+1]*v,i=Math.min(i,n),o=Math.max(o,n),l=Math.min(l,r),f=Math.max(f,r);if(l<-1)for(var y=0;y<a;y++)r=t[2*y+1]=t[2*y+1]+(-1-l);return t},Db=function(t,n){var r=1/t*2*Math.PI,a=t%2===0?Math.PI/2+r/2:Math.PI/2;a+=n;for(var i=new Array(t*2),l,o=0;o<t;o++)l=o*r+a,i[2*o]=Math.cos(l),i[2*o+1]=Math.sin(-l);return i},ul=function(t,n){return Math.min(t/4,n/4,8)},tL=function(t,n){return Math.min(t/10,n/10,8)},gw=function(){return 8},lX=function(t,n,r){return[t-2*n+r,2*(n-t),t]},jb=function(t,n){return{heightOffset:Math.min(15,.05*n),widthOffset:Math.min(100,.25*t),ctrlPtOffsetPct:.05}};function xx(e,t){function n(v){for(var m=[],y=0;y<v.length;y++){var x=v[y],S=v[(y+1)%v.length],w={x:S.x-x.x,y:S.y-x.y},b={x:-w.y,y:w.x},C=Math.sqrt(b.x*b.x+b.y*b.y);m.push({x:b.x/C,y:b.y/C})}return m}function r(v,m){var y=1/0,x=-1/0,S=Fr(v),w;try{for(S.s();!(w=S.n()).done;){var b=w.value,C=b.x*m.x+b.y*m.y;y=Math.min(y,C),x=Math.max(x,C)}}catch(T){S.e(T)}finally{S.f()}return{min:y,max:x}}function a(v,m){return!(v.max<m.min||m.max<v.min)}var i=[].concat(ep(n(e)),ep(n(t))),l=Fr(i),o;try{for(l.s();!(o=l.n()).done;){var f=o.value,c=r(e,f),d=r(t,f);if(!a(c,d))return!1}}catch(v){l.e(v)}finally{l.f()}return!0}var oX=lr({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(t){return 1}}),uX={pageRank:function(t){for(var n=oX(t),r=n.dampingFactor,a=n.precision,i=n.iterations,l=n.weight,o=this._private.cy,f=this.byGroup(),c=f.nodes,d=f.edges,v=c.length,m=v*v,y=d.length,x=new Array(m),S=new Array(v),w=(1-r)/v,b=0;b<v;b++){for(var C=0;C<v;C++){var T=b*v+C;x[T]=0}S[b]=0}for(var k=0;k<y;k++){var D=d[k],A=D.data("source"),j=D.data("target");if(A!==j){var L=c.indexOfId(A),_=c.indexOfId(j),M=l(D),z=_*v+L;x[z]+=M,S[L]+=M}}for(var P=1/v+w,G=0;G<v;G++)if(S[G]===0)for(var I=0;I<v;I++){var F=I*v+G;x[F]=P}else for(var B=0;B<v;B++){var H=B*v+G;x[H]=x[H]/S[G]+w}for(var K=new Array(v),Q=new Array(v),V,q=0;q<v;q++)K[q]=1;for(var X=0;X<i;X++){for(var U=0;U<v;U++)Q[U]=0;for(var te=0;te<v;te++)for(var ie=0;ie<v;ie++){var oe=te*v+ie;Q[te]+=x[oe]*K[ie]}VK(Q),V=K,K=Q,Q=V;for(var ae=0,we=0;we<v;we++){var fe=V[we]-K[we];ae+=fe*fe}if(ae<a)break}var J={rank:function(re){return re=o.collection(re)[0],K[c.indexOf(re)]}};return J}},YN=lr({root:null,weight:function(t){return 1},directed:!1,alpha:0}),Mu={degreeCentralityNormalized:function(t){t=YN(t);var n=this.cy(),r=this.nodes(),a=r.length;if(t.directed){for(var d={},v={},m=0,y=0,x=0;x<a;x++){var S=r[x],w=S.id();t.root=S;var b=this.degreeCentrality(t);m<b.indegree&&(m=b.indegree),y<b.outdegree&&(y=b.outdegree),d[w]=b.indegree,v[w]=b.outdegree}return{indegree:function(T){return m==0?0:(Ze(T)&&(T=n.filter(T)),d[T.id()]/m)},outdegree:function(T){return y===0?0:(Ze(T)&&(T=n.filter(T)),v[T.id()]/y)}}}else{for(var i={},l=0,o=0;o<a;o++){var f=r[o];t.root=f;var c=this.degreeCentrality(t);l<c.degree&&(l=c.degree),i[f.id()]=c.degree}return{degree:function(T){return l===0?0:(Ze(T)&&(T=n.filter(T)),i[T.id()]/l)}}}},degreeCentrality:function(t){t=YN(t);var n=this.cy(),r=this,a=t,i=a.root,l=a.weight,o=a.directed,f=a.alpha;if(i=n.collection(i)[0],o){for(var y=i.connectedEdges(),x=y.filter(function(A){return A.target().same(i)&&r.has(A)}),S=y.filter(function(A){return A.source().same(i)&&r.has(A)}),w=x.length,b=S.length,C=0,T=0,k=0;k<x.length;k++)C+=l(x[k]);for(var D=0;D<S.length;D++)T+=l(S[D]);return{indegree:Math.pow(w,1-f)*Math.pow(C,f),outdegree:Math.pow(b,1-f)*Math.pow(T,f)}}else{for(var c=i.connectedEdges().intersection(r),d=c.length,v=0,m=0;m<c.length;m++)v+=l(c[m]);return{degree:Math.pow(d,1-f)*Math.pow(v,f)}}}};Mu.dc=Mu.degreeCentrality;Mu.dcn=Mu.degreeCentralityNormalised=Mu.degreeCentralityNormalized;var KN=lr({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Ou={closenessCentralityNormalized:function(t){for(var n=KN(t),r=n.harmonic,a=n.weight,i=n.directed,l=this.cy(),o={},f=0,c=this.nodes(),d=this.floydWarshall({weight:a,directed:i}),v=0;v<c.length;v++){for(var m=0,y=c[v],x=0;x<c.length;x++)if(v!==x){var S=d.distance(y,c[x]);r?m+=1/S:m+=S}r||(m=1/m),f<m&&(f=m),o[y.id()]=m}return{closeness:function(b){return f==0?0:(Ze(b)?b=l.filter(b)[0].id():b=b.id(),o[b]/f)}}},closenessCentrality:function(t){var n=KN(t),r=n.root,a=n.weight,i=n.directed,l=n.harmonic;r=this.filter(r)[0];for(var o=this.dijkstra({root:r,weight:a,directed:i}),f=0,c=this.nodes(),d=0;d<c.length;d++){var v=c[d];if(!v.same(r)){var m=o.distanceTo(v);l?f+=1/m:f+=m}}return l?f:1/f}};Ou.cc=Ou.closenessCentrality;Ou.ccn=Ou.closenessCentralityNormalised=Ou.closenessCentralityNormalized;var cX=lr({weight:null,directed:!1}),Mb={betweennessCentrality:function(t){for(var n=cX(t),r=n.directed,a=n.weight,i=a!=null,l=this.cy(),o=this.nodes(),f={},c={},d=0,v={set:function(T,k){c[T]=k,k>d&&(d=k)},get:function(T){return c[T]}},m=0;m<o.length;m++){var y=o[m],x=y.id();r?f[x]=y.outgoers().nodes():f[x]=y.openNeighborhood().nodes(),v.set(x,0)}for(var S=function(){for(var T=o[w].id(),k=[],D={},A={},j={},L=new Td(function(te,ie){return j[te]-j[ie]}),_=0;_<o.length;_++){var M=o[_].id();D[M]=[],A[M]=0,j[M]=1/0}for(A[T]=1,j[T]=0,L.push(T);!L.empty();){var z=L.pop();if(k.push(z),i)for(var P=0;P<f[z].length;P++){var G=f[z][P],I=l.getElementById(z),F=void 0;I.edgesTo(G).length>0?F=I.edgesTo(G)[0]:F=G.edgesTo(I)[0];var B=a(F);G=G.id(),j[G]>j[z]+B&&(j[G]=j[z]+B,L.nodes.indexOf(G)<0?L.push(G):L.updateItem(G),A[G]=0,D[G]=[]),j[G]==j[z]+B&&(A[G]=A[G]+A[z],D[G].push(z))}else for(var H=0;H<f[z].length;H++){var K=f[z][H].id();j[K]==1/0&&(L.push(K),j[K]=j[z]+1),j[K]==j[z]+1&&(A[K]=A[K]+A[z],D[K].push(z))}}for(var Q={},V=0;V<o.length;V++)Q[o[V].id()]=0;for(;k.length>0;){for(var q=k.pop(),X=0;X<D[q].length;X++){var U=D[q][X];Q[U]=Q[U]+A[U]/A[q]*(1+Q[q])}q!=o[w].id()&&v.set(q,v.get(q)+Q[q])}},w=0;w<o.length;w++)S();var b={betweenness:function(T){var k=l.collection(T).id();return v.get(k)},betweennessNormalized:function(T){if(d==0)return 0;var k=l.collection(T).id();return v.get(k)/d}};return b.betweennessNormalised=b.betweennessNormalized,b}};Mb.bc=Mb.betweennessCentrality;var fX=lr({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),dX=function(t){return fX(t)},hX=function(t,n){for(var r=0,a=0;a<n.length;a++)r+=n[a](t);return r},vX=function(t,n,r){for(var a=0;a<n;a++)t[a*n+a]=r},nL=function(t,n){for(var r,a=0;a<n;a++){r=0;for(var i=0;i<n;i++)r+=t[i*n+a];for(var l=0;l<n;l++)t[l*n+a]=t[l*n+a]/r}},pX=function(t,n,r){for(var a=new Array(r*r),i=0;i<r;i++){for(var l=0;l<r;l++)a[i*r+l]=0;for(var o=0;o<r;o++)for(var f=0;f<r;f++)a[i*r+f]+=t[i*r+o]*n[o*r+f]}return a},mX=function(t,n,r){for(var a=t.slice(0),i=1;i<r;i++)t=pX(t,a,n);return t},gX=function(t,n,r){for(var a=new Array(n*n),i=0;i<n*n;i++)a[i]=Math.pow(t[i],r);return nL(a,n),a},yX=function(t,n,r,a){for(var i=0;i<r;i++){var l=Math.round(t[i]*Math.pow(10,a))/Math.pow(10,a),o=Math.round(n[i]*Math.pow(10,a))/Math.pow(10,a);if(l!==o)return!1}return!0},xX=function(t,n,r,a){for(var i=[],l=0;l<n;l++){for(var o=[],f=0;f<n;f++)Math.round(t[l*n+f]*1e3)/1e3>0&&o.push(r[f]);o.length!==0&&i.push(a.collection(o))}return i},bX=function(t,n){for(var r=0;r<t.length;r++)if(!n[r]||t[r].id()!==n[r].id())return!1;return!0},wX=function(t){for(var n=0;n<t.length;n++)for(var r=0;r<t.length;r++)n!=r&&bX(t[n],t[r])&&t.splice(r,1);return t},XN=function(t){for(var n=this.nodes(),r=this.edges(),a=this.cy(),i=dX(t),l={},o=0;o<n.length;o++)l[n[o].id()]=o;for(var f=n.length,c=f*f,d=new Array(c),v,m=0;m<c;m++)d[m]=0;for(var y=0;y<r.length;y++){var x=r[y],S=l[x.source().id()],w=l[x.target().id()],b=hX(x,i.attributes);d[S*f+w]+=b,d[w*f+S]+=b}vX(d,f,i.multFactor),nL(d,f);for(var C=!0,T=0;C&&T<i.maxIterations;)C=!1,v=mX(d,f,i.expandFactor),d=gX(v,f,i.inflateFactor),yX(d,v,c,4)||(C=!0),T++;var k=xX(d,f,n,a);return k=wX(k),k},SX={markovClustering:XN,mcl:XN},EX=function(t){return t},rL=function(t,n){return Math.abs(n-t)},QN=function(t,n,r){return t+rL(n,r)},WN=function(t,n,r){return t+Math.pow(r-n,2)},CX=function(t){return Math.sqrt(t)},TX=function(t,n,r){return Math.max(t,rL(n,r))},yf=function(t,n,r,a,i){for(var l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:EX,o=a,f,c,d=0;d<t;d++)f=n(d),c=r(d),o=i(o,f,c);return l(o)},Wu={euclidean:function(t,n,r){return t>=2?yf(t,n,r,0,WN,CX):yf(t,n,r,0,QN)},squaredEuclidean:function(t,n,r){return yf(t,n,r,0,WN)},manhattan:function(t,n,r){return yf(t,n,r,0,QN)},max:function(t,n,r){return yf(t,n,r,-1/0,TX)}};Wu["squared-euclidean"]=Wu.squaredEuclidean;Wu.squaredeuclidean=Wu.squaredEuclidean;function $p(e,t,n,r,a,i){var l;return fn(e)?l=e:l=Wu[e]||Wu.euclidean,t===0&&fn(e)?l(a,i):l(t,n,r,a,i)}var NX=lr({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),yw=function(t){return NX(t)},sp=function(t,n,r,a,i){var l=i!=="kMedoids",o=l?function(v){return r[v]}:function(v){return a[v](r)},f=function(m){return a[m](n)},c=r,d=n;return $p(t,a.length,o,f,c,d)},bx=function(t,n,r){for(var a=r.length,i=new Array(a),l=new Array(a),o=new Array(n),f=null,c=0;c<a;c++)i[c]=t.min(r[c]).value,l[c]=t.max(r[c]).value;for(var d=0;d<n;d++){f=[];for(var v=0;v<a;v++)f[v]=Math.random()*(l[v]-i[v])+i[v];o[d]=f}return o},aL=function(t,n,r,a,i){for(var l=1/0,o=0,f=0;f<n.length;f++){var c=sp(r,t,n[f],a,i);c<l&&(l=c,o=f)}return o},iL=function(t,n,r){for(var a=[],i=null,l=0;l<n.length;l++)i=n[l],r[i.id()]===t&&a.push(i);return a},kX=function(t,n,r){return Math.abs(n-t)<=r},AX=function(t,n,r){for(var a=0;a<t.length;a++)for(var i=0;i<t[a].length;i++){var l=Math.abs(t[a][i]-n[a][i]);if(l>r)return!1}return!0},RX=function(t,n,r){for(var a=0;a<r;a++)if(t===n[a])return!0;return!1},ZN=function(t,n){var r=new Array(n);if(t.length<50)for(var a=0;a<n;a++){for(var i=t[Math.floor(Math.random()*t.length)];RX(i,r,a);)i=t[Math.floor(Math.random()*t.length)];r[a]=i}else for(var l=0;l<n;l++)r[l]=t[Math.floor(Math.random()*t.length)];return r},JN=function(t,n,r){for(var a=0,i=0;i<n.length;i++)a+=sp("manhattan",n[i],t,r,"kMedoids");return a},DX=function(t){var n=this.cy(),r=this.nodes(),a=null,i=yw(t),l=new Array(i.k),o={},f;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,f=bx(r,i.k,i.attributes)):In(i.testCentroids)==="object"?f=i.testCentroids:f=bx(r,i.k,i.attributes):f=bx(r,i.k,i.attributes);for(var c=!0,d=0;c&&d<i.maxIterations;){for(var v=0;v<r.length;v++)a=r[v],o[a.id()]=aL(a,f,i.distance,i.attributes,"kMeans");c=!1;for(var m=0;m<i.k;m++){var y=iL(m,r,o);if(y.length!==0){for(var x=i.attributes.length,S=f[m],w=new Array(x),b=new Array(x),C=0;C<x;C++){b[C]=0;for(var T=0;T<y.length;T++)a=y[T],b[C]+=i.attributes[C](a);w[C]=b[C]/y.length,kX(w[C],S[C],i.sensitivityThreshold)||(c=!0)}f[m]=w,l[m]=n.collection(y)}}d++}return l},jX=function(t){var n=this.cy(),r=this.nodes(),a=null,i=yw(t),l=new Array(i.k),o,f={},c,d=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(In(i.testCentroids)==="object"?o=i.testCentroids:o=ZN(r,i.k)):o=ZN(r,i.k);for(var v=!0,m=0;v&&m<i.maxIterations;){for(var y=0;y<r.length;y++)a=r[y],f[a.id()]=aL(a,o,i.distance,i.attributes,"kMedoids");v=!1;for(var x=0;x<o.length;x++){var S=iL(x,r,f);if(S.length!==0){d[x]=JN(o[x],S,i.attributes);for(var w=0;w<S.length;w++)c=JN(S[w],S,i.attributes),c<d[x]&&(d[x]=c,o[x]=S[w],v=!0);l[x]=n.collection(S)}}m++}return l},MX=function(t,n,r,a,i){for(var l,o,f=0;f<n.length;f++)for(var c=0;c<t.length;c++)a[f][c]=Math.pow(r[f][c],i.m);for(var d=0;d<t.length;d++)for(var v=0;v<i.attributes.length;v++){l=0,o=0;for(var m=0;m<n.length;m++)l+=a[m][d]*i.attributes[v](n[m]),o+=a[m][d];t[d][v]=l/o}},OX=function(t,n,r,a,i){for(var l=0;l<t.length;l++)n[l]=t[l].slice();for(var o,f,c,d=2/(i.m-1),v=0;v<r.length;v++)for(var m=0;m<a.length;m++){o=0;for(var y=0;y<r.length;y++)f=sp(i.distance,a[m],r[v],i.attributes,"cmeans"),c=sp(i.distance,a[m],r[y],i.attributes,"cmeans"),o+=Math.pow(f/c,d);t[m][v]=1/o}},LX=function(t,n,r,a){for(var i=new Array(r.k),l=0;l<i.length;l++)i[l]=[];for(var o,f,c=0;c<n.length;c++){o=-1/0,f=-1;for(var d=0;d<n[0].length;d++)n[c][d]>o&&(o=n[c][d],f=d);i[f].push(t[c])}for(var v=0;v<i.length;v++)i[v]=a.collection(i[v]);return i},ek=function(t){var n=this.cy(),r=this.nodes(),a=yw(t),i,l,o,f,c;f=new Array(r.length);for(var d=0;d<r.length;d++)f[d]=new Array(a.k);o=new Array(r.length);for(var v=0;v<r.length;v++)o[v]=new Array(a.k);for(var m=0;m<r.length;m++){for(var y=0,x=0;x<a.k;x++)o[m][x]=Math.random(),y+=o[m][x];for(var S=0;S<a.k;S++)o[m][S]=o[m][S]/y}l=new Array(a.k);for(var w=0;w<a.k;w++)l[w]=new Array(a.attributes.length);c=new Array(r.length);for(var b=0;b<r.length;b++)c[b]=new Array(a.k);for(var C=!0,T=0;C&&T<a.maxIterations;)C=!1,MX(l,r,o,c,a),OX(o,f,l,r,a),AX(o,f,a.sensitivityThreshold)||(C=!0),T++;return i=LX(r,o,a,n),{clusters:i,degreeOfMembership:o}},_X={kMeans:DX,kMedoids:jX,fuzzyCMeans:ek,fcm:ek},BX=lr({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),PX={single:"min",complete:"max"},zX=function(t){var n=BX(t),r=PX[n.linkage];return r!=null&&(n.linkage=r),n},tk=function(t,n,r,a,i){for(var l=0,o=1/0,f,c=i.attributes,d=function(_,M){return $p(i.distance,c.length,function(z){return c[z](_)},function(z){return c[z](M)},_,M)},v=0;v<t.length;v++){var m=t[v].key,y=r[m][a[m]];y<o&&(l=m,o=y)}if(i.mode==="threshold"&&o>=i.threshold||i.mode==="dendrogram"&&t.length===1)return!1;var x=n[l],S=n[a[l]],w;i.mode==="dendrogram"?w={left:x,right:S,key:x.key}:w={value:x.value.concat(S.value),key:x.key},t[x.index]=w,t.splice(S.index,1),n[x.key]=w;for(var b=0;b<t.length;b++){var C=t[b];x.key===C.key?f=1/0:i.linkage==="min"?(f=r[x.key][C.key],r[x.key][C.key]>r[S.key][C.key]&&(f=r[S.key][C.key])):i.linkage==="max"?(f=r[x.key][C.key],r[x.key][C.key]<r[S.key][C.key]&&(f=r[S.key][C.key])):i.linkage==="mean"?f=(r[x.key][C.key]*x.size+r[S.key][C.key]*S.size)/(x.size+S.size):i.mode==="dendrogram"?f=d(C.value,x.value):f=d(C.value[0],x.value[0]),r[x.key][C.key]=r[C.key][x.key]=f}for(var T=0;T<t.length;T++){var k=t[T].key;if(a[k]===x.key||a[k]===S.key){for(var D=k,A=0;A<t.length;A++){var j=t[A].key;r[k][j]<r[k][D]&&(D=j)}a[k]=D}t[T].index=T}return x.key=S.key=x.index=S.index=null,!0},Cu=function(t,n,r){t&&(t.value?n.push(t.value):(t.left&&Cu(t.left,n),t.right&&Cu(t.right,n)))},Ob=function(t,n){if(!t)return"";if(t.left&&t.right){var r=Ob(t.left,n),a=Ob(t.right,n),i=n.add({group:"nodes",data:{id:r+","+a}});return n.add({group:"edges",data:{source:r,target:i.id()}}),n.add({group:"edges",data:{source:a,target:i.id()}}),i.id()}else if(t.value)return t.value.id()},Lb=function(t,n,r){if(!t)return[];var a=[],i=[],l=[];return n===0?(t.left&&Cu(t.left,a),t.right&&Cu(t.right,i),l=a.concat(i),[r.collection(l)]):n===1?t.value?[r.collection(t.value)]:(t.left&&Cu(t.left,a),t.right&&Cu(t.right,i),[r.collection(a),r.collection(i)]):t.value?[r.collection(t.value)]:(t.left&&(a=Lb(t.left,n-1,r)),t.right&&(i=Lb(t.right,n-1,r)),a.concat(i))},nk=function(t){for(var n=this.cy(),r=this.nodes(),a=zX(t),i=a.attributes,l=function(T,k){return $p(a.distance,i.length,function(D){return i[D](T)},function(D){return i[D](k)},T,k)},o=[],f=[],c=[],d=[],v=0;v<r.length;v++){var m={value:a.mode==="dendrogram"?r[v]:[r[v]],key:v,index:v};o[v]=m,d[v]=m,f[v]=[],c[v]=0}for(var y=0;y<o.length;y++)for(var x=0;x<=y;x++){var S=void 0;a.mode==="dendrogram"?S=y===x?1/0:l(o[y].value,o[x].value):S=y===x?1/0:l(o[y].value[0],o[x].value[0]),f[y][x]=S,f[x][y]=S,S<f[y][c[y]]&&(c[y]=x)}for(var w=tk(o,d,f,c,a);w;)w=tk(o,d,f,c,a);var b;return a.mode==="dendrogram"?(b=Lb(o[0],a.dendrogramDepth,n),a.addDendrogram&&Ob(o[0],n)):(b=new Array(o.length),o.forEach(function(C,T){C.key=C.index=null,b[T]=n.collection(C.value)})),b},IX={hierarchicalClustering:nk,hca:nk},FX=lr({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),qX=function(t){var n=t.damping,r=t.preference;.5<=n&&n<1||sn("Damping must range on [0.5, 1). Got: ".concat(n));var a=["median","mean","min","max"];return a.some(function(i){return i===r})||Re(r)||sn("Preference must be one of [".concat(a.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(r)),FX(t)},UX=function(t,n,r,a){var i=function(o,f){return a[f](o)};return-$p(t,a.length,function(l){return i(n,l)},function(l){return i(r,l)},n,r)},VX=function(t,n){var r=null;return n==="median"?r=qK(t):n==="mean"?r=FK(t):n==="min"?r=zK(t):n==="max"?r=IK(t):r=n,r},HX=function(t,n,r){for(var a=[],i=0;i<t;i++)n[i*t+i]+r[i*t+i]>0&&a.push(i);return a},rk=function(t,n,r){for(var a=[],i=0;i<t;i++){for(var l=-1,o=-1/0,f=0;f<r.length;f++){var c=r[f];n[i*t+c]>o&&(l=c,o=n[i*t+c])}l>0&&a.push(l)}for(var d=0;d<r.length;d++)a[r[d]]=r[d];return a},GX=function(t,n,r){for(var a=rk(t,n,r),i=0;i<r.length;i++){for(var l=[],o=0;o<a.length;o++)a[o]===r[i]&&l.push(o);for(var f=-1,c=-1/0,d=0;d<l.length;d++){for(var v=0,m=0;m<l.length;m++)v+=n[l[m]*t+l[d]];v>c&&(f=d,c=v)}r[i]=l[f]}return a=rk(t,n,r),a},ak=function(t){for(var n=this.cy(),r=this.nodes(),a=qX(t),i={},l=0;l<r.length;l++)i[r[l].id()]=l;var o,f,c,d,v,m;o=r.length,f=o*o,c=new Array(f);for(var y=0;y<f;y++)c[y]=-1/0;for(var x=0;x<o;x++)for(var S=0;S<o;S++)x!==S&&(c[x*o+S]=UX(a.distance,r[x],r[S],a.attributes));d=VX(c,a.preference);for(var w=0;w<o;w++)c[w*o+w]=d;v=new Array(f);for(var b=0;b<f;b++)v[b]=0;m=new Array(f);for(var C=0;C<f;C++)m[C]=0;for(var T=new Array(o),k=new Array(o),D=new Array(o),A=0;A<o;A++)T[A]=0,k[A]=0,D[A]=0;for(var j=new Array(o*a.minIterations),L=0;L<j.length;L++)j[L]=0;var _;for(_=0;_<a.maxIterations;_++){for(var M=0;M<o;M++){for(var z=-1/0,P=-1/0,G=-1,I=0,F=0;F<o;F++)T[F]=v[M*o+F],I=m[M*o+F]+c[M*o+F],I>=z?(P=z,z=I,G=F):I>P&&(P=I);for(var B=0;B<o;B++)v[M*o+B]=(1-a.damping)*(c[M*o+B]-z)+a.damping*T[B];v[M*o+G]=(1-a.damping)*(c[M*o+G]-P)+a.damping*T[G]}for(var H=0;H<o;H++){for(var K=0,Q=0;Q<o;Q++)T[Q]=m[Q*o+H],k[Q]=Math.max(0,v[Q*o+H]),K+=k[Q];K-=k[H],k[H]=v[H*o+H],K+=k[H];for(var V=0;V<o;V++)m[V*o+H]=(1-a.damping)*Math.min(0,K-k[V])+a.damping*T[V];m[H*o+H]=(1-a.damping)*(K-k[H])+a.damping*T[H]}for(var q=0,X=0;X<o;X++){var U=m[X*o+X]+v[X*o+X]>0?1:0;j[_%a.minIterations*o+X]=U,q+=U}if(q>0&&(_>=a.minIterations-1||_==a.maxIterations-1)){for(var te=0,ie=0;ie<o;ie++){D[ie]=0;for(var oe=0;oe<a.minIterations;oe++)D[ie]+=j[oe*o+ie];(D[ie]===0||D[ie]===a.minIterations)&&te++}if(te===o)break}}for(var ae=HX(o,v,m),we=GX(o,c,ae),fe={},J=0;J<ae.length;J++)fe[ae[J]]=[];for(var ne=0;ne<r.length;ne++){var re=i[r[ne].id()],ge=we[re];ge!=null&&fe[ge].push(r[ne])}for(var Ne=new Array(ae.length),Be=0;Be<ae.length;Be++)Ne[Be]=n.collection(fe[ae[Be]]);return Ne},$X={affinityPropagation:ak,ap:ak},YX=lr({root:void 0,directed:!1}),KX={hierholzer:function(t){if(!Dt(t)){var n=arguments;t={root:n[0],directed:n[1]}}var r=YX(t),a=r.root,i=r.directed,l=this,o=!1,f,c,d;a&&(d=Ze(a)?this.filter(a)[0].id():a[0].id());var v={},m={};i?l.forEach(function(C){var T=C.id();if(C.isNode()){var k=C.indegree(!0),D=C.outdegree(!0),A=k-D,j=D-k;A==1?f?o=!0:f=T:j==1?c?o=!0:c=T:(j>1||A>1)&&(o=!0),v[T]=[],C.outgoers().forEach(function(L){L.isEdge()&&v[T].push(L.id())})}else m[T]=[void 0,C.target().id()]}):l.forEach(function(C){var T=C.id();if(C.isNode()){var k=C.degree(!0);k%2&&(f?c?o=!0:c=T:f=T),v[T]=[],C.connectedEdges().forEach(function(D){return v[T].push(D.id())})}else m[T]=[C.source().id(),C.target().id()]});var y={found:!1,trail:void 0};if(o)return y;if(c&&f)if(i){if(d&&c!=d)return y;d=c}else{if(d&&c!=d&&f!=d)return y;d||(d=c)}else d||(d=l[0].id());var x=function(T){for(var k=T,D=[T],A,j,L;v[k].length;)A=v[k].shift(),j=m[A][0],L=m[A][1],k!=L?(v[L]=v[L].filter(function(_){return _!=A}),k=L):!i&&k!=j&&(v[j]=v[j].filter(function(_){return _!=A}),k=j),D.unshift(A),D.unshift(k);return D},S=[],w=[];for(w=x(d);w.length!=1;)v[w[0]].length==0?(S.unshift(l.getElementById(w.shift())),S.unshift(l.getElementById(w.shift()))):w=x(w.shift()).concat(w);S.unshift(l.getElementById(w.shift()));for(var b in v)if(v[b].length)return y;return y.found=!0,y.trail=this.spawn(S,!0),y}},uv=function(){var t=this,n={},r=0,a=0,i=[],l=[],o={},f=function(m,y){for(var x=l.length-1,S=[],w=t.spawn();l[x].x!=m||l[x].y!=y;)S.push(l.pop().edge),x--;S.push(l.pop().edge),S.forEach(function(b){var C=b.connectedNodes().intersection(t);w.merge(b),C.forEach(function(T){var k=T.id(),D=T.connectedEdges().intersection(t);w.merge(T),n[k].cutVertex?w.merge(D.filter(function(A){return A.isLoop()})):w.merge(D)})}),i.push(w)},c=function(m,y,x){m===x&&(a+=1),n[y]={id:r,low:r++,cutVertex:!1};var S=t.getElementById(y).connectedEdges().intersection(t);if(S.size()===0)i.push(t.spawn(t.getElementById(y)));else{var w,b,C,T;S.forEach(function(k){w=k.source().id(),b=k.target().id(),C=w===y?b:w,C!==x&&(T=k.id(),o[T]||(o[T]=!0,l.push({x:y,y:C,edge:k})),C in n?n[y].low=Math.min(n[y].low,n[C].id):(c(m,C,y),n[y].low=Math.min(n[y].low,n[C].low),n[y].id<=n[C].low&&(n[y].cutVertex=!0,f(y,C))))})}};t.forEach(function(v){if(v.isNode()){var m=v.id();m in n||(a=0,c(m,m),n[m].cutVertex=a>1)}});var d=Object.keys(n).filter(function(v){return n[v].cutVertex}).map(function(v){return t.getElementById(v)});return{cut:t.spawn(d),components:i}},XX={hopcroftTarjanBiconnected:uv,htbc:uv,htb:uv,hopcroftTarjanBiconnectedComponents:uv},cv=function(){var t=this,n={},r=0,a=[],i=[],l=t.spawn(t),o=function(c){i.push(c),n[c]={index:r,low:r++,explored:!1};var d=t.getElementById(c).connectedEdges().intersection(t);if(d.forEach(function(S){var w=S.target().id();w!==c&&(w in n||o(w),n[w].explored||(n[c].low=Math.min(n[c].low,n[w].low)))}),n[c].index===n[c].low){for(var v=t.spawn();;){var m=i.pop();if(v.merge(t.getElementById(m)),n[m].low=n[c].index,n[m].explored=!0,m===c)break}var y=v.edgesWith(v),x=v.merge(y);a.push(x),l=l.difference(x)}};return t.forEach(function(f){if(f.isNode()){var c=f.id();c in n||o(c)}}),{cut:l,components:a}},QX={tarjanStronglyConnected:cv,tsc:cv,tscc:cv,tarjanStronglyConnectedComponents:cv},sL={};[Kf,NK,kK,RK,jK,OK,BK,uX,Mu,Ou,Mb,SX,_X,IX,$X,KX,XX,QX].forEach(function(e){nt(sL,e)});/*!
411
+ Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
412
+ Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
413
+ Licensed under The MIT License (http://opensource.org/licenses/MIT)
414
+ */var lL=0,oL=1,uL=2,_a=function(t){if(!(this instanceof _a))return new _a(t);this.id="Thenable/1.0.7",this.state=lL,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof t=="function"&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};_a.prototype={fulfill:function(t){return ik(this,oL,"fulfillValue",t)},reject:function(t){return ik(this,uL,"rejectReason",t)},then:function(t,n){var r=this,a=new _a;return r.onFulfilled.push(lk(t,a,"fulfill")),r.onRejected.push(lk(n,a,"reject")),cL(r),a.proxy}};var ik=function(t,n,r,a){return t.state===lL&&(t.state=n,t[r]=a,cL(t)),t},cL=function(t){t.state===oL?sk(t,"onFulfilled",t.fulfillValue):t.state===uL&&sk(t,"onRejected",t.rejectReason)},sk=function(t,n,r){if(t[n].length!==0){var a=t[n];t[n]=[];var i=function(){for(var o=0;o<a.length;o++)a[o](r)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},lk=function(t,n,r){return function(a){if(typeof t!="function")n[r].call(n,a);else{var i;try{i=t(a)}catch(l){n.reject(l);return}fL(n,i)}}},fL=function(t,n){if(t===n||t.proxy===n){t.reject(new TypeError("cannot resolve promise with itself"));return}var r;if(In(n)==="object"&&n!==null||typeof n=="function")try{r=n.then}catch(i){t.reject(i);return}if(typeof r=="function"){var a=!1;try{r.call(n,function(i){a||(a=!0,i===n?t.reject(new TypeError("circular thenable chain")):fL(t,i))},function(i){a||(a=!0,t.reject(i))})}catch(i){a||t.reject(i)}return}t.fulfill(n)};_a.all=function(e){return new _a(function(t,n){for(var r=new Array(e.length),a=0,i=function(f,c){r[f]=c,a++,a===e.length&&t(r)},l=0;l<e.length;l++)(function(o){var f=e[o],c=f!=null&&f.then!=null;if(c)f.then(function(v){i(o,v)},function(v){n(v)});else{var d=f;i(o,d)}})(l)})};_a.resolve=function(e){return new _a(function(t,n){t(e)})};_a.reject=function(e){return new _a(function(t,n){n(e)})};var dc=typeof Promise<"u"?Promise:_a,_b=function(t,n,r){var a=ow(t),i=!a,l=this._private=nt({duration:1e3},n,r);if(l.target=t,l.style=l.style||l.css,l.started=!1,l.playing=!1,l.hooked=!1,l.applying=!1,l.progress=0,l.completes=[],l.frames=[],l.complete&&fn(l.complete)&&l.completes.push(l.complete),i){var o=t.position();l.startPosition=l.startPosition||{x:o.x,y:o.y},l.startStyle=l.startStyle||t.cy().style().getAnimationStartStyle(t,l.style)}if(a){var f=t.pan();l.startPan={x:f.x,y:f.y},l.startZoom=t.zoom()}this.length=1,this[0]=this},yo=_b.prototype;nt(yo,{instanceString:function(){return"animation"},hook:function(){var t=this._private;if(!t.hooked){var n,r=t.target._private.animation;t.queue?n=r.queue:n=r.current,n.push(this),ta(t.target)&&t.target.cy().addToAnimationPool(t.target),t.hooked=!0}return this},play:function(){var t=this._private;return t.progress===1&&(t.progress=0),t.playing=!0,t.started=!1,t.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var t=this._private;return t.applying=!0,t.started=!1,t.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var t=this._private;return t.playing=!1,t.started=!1,this},stop:function(){var t=this._private;return t.playing=!1,t.started=!1,t.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(t){var n=this._private;return t===void 0?n.progress*n.duration:this.progress(t/n.duration)},progress:function(t){var n=this._private,r=n.playing;return t===void 0?n.progress:(r&&this.pause(),n.progress=t,n.started=!1,r&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var t=this._private,n=t.playing;n&&this.pause(),t.progress=1-t.progress,t.started=!1;var r=function(c,d){var v=t[c];v!=null&&(t[c]=t[d],t[d]=v)};if(r("zoom","startZoom"),r("pan","startPan"),r("position","startPosition"),t.style)for(var a=0;a<t.style.length;a++){var i=t.style[a],l=i.name,o=t.startStyle[l];t.startStyle[l]=i,t.style[a]=o}return n&&this.play(),this},promise:function(t){var n=this._private,r;switch(t){case"frame":r=n.frames;break;default:case"complete":case"completed":r=n.completes}return new dc(function(a,i){r.push(function(){a()})})}});yo.complete=yo.completed;yo.run=yo.play;yo.running=yo.playing;var WX={animated:function(){return function(){var n=this,r=n.length!==void 0,a=r?n:[n],i=this._private.cy||this;if(!i.styleEnabled())return!1;var l=a[0];if(l)return l._private.animation.current.length>0}},clearQueue:function(){return function(){var n=this,r=n.length!==void 0,a=r?n:[n],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var l=0;l<a.length;l++){var o=a[l];o._private.animation.queue=[]}return this}},delay:function(){return function(n,r){var a=this._private.cy||this;return a.styleEnabled()?this.animate({delay:n,duration:n,complete:r}):this}},delayAnimation:function(){return function(n,r){var a=this._private.cy||this;return a.styleEnabled()?this.animation({delay:n,duration:n,complete:r}):this}},animation:function(){return function(n,r){var a=this,i=a.length!==void 0,l=i?a:[a],o=this._private.cy||this,f=!i,c=!f;if(!o.styleEnabled())return this;var d=o.style();n=nt({},n,r);var v=Object.keys(n).length===0;if(v)return new _b(l[0],n);switch(n.duration===void 0&&(n.duration=400),n.duration){case"slow":n.duration=600;break;case"fast":n.duration=200;break}if(c&&(n.style=d.getPropsList(n.style||n.css),n.css=void 0),c&&n.renderedPosition!=null){var m=n.renderedPosition,y=o.pan(),x=o.zoom();n.position=QO(m,x,y)}if(f&&n.panBy!=null){var S=n.panBy,w=o.pan();n.pan={x:w.x+S.x,y:w.y+S.y}}var b=n.center||n.centre;if(f&&b!=null){var C=o.getCenterPan(b.eles,n.zoom);C!=null&&(n.pan=C)}if(f&&n.fit!=null){var T=n.fit,k=o.getFitViewport(T.eles||T.boundingBox,T.padding);k!=null&&(n.pan=k.pan,n.zoom=k.zoom)}if(f&&Dt(n.zoom)){var D=o.getZoomedViewport(n.zoom);D!=null?(D.zoomed&&(n.zoom=D.zoom),D.panned&&(n.pan=D.pan)):n.zoom=null}return new _b(l[0],n)}},animate:function(){return function(n,r){var a=this,i=a.length!==void 0,l=i?a:[a],o=this._private.cy||this;if(!o.styleEnabled())return this;r&&(n=nt({},n,r));for(var f=0;f<l.length;f++){var c=l[f],d=c.animated()&&(n.queue===void 0||n.queue),v=c.animation(n,d?{queue:!0}:void 0);v.play()}return this}},stop:function(){return function(n,r){var a=this,i=a.length!==void 0,l=i?a:[a],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var f=0;f<l.length;f++){for(var c=l[f],d=c._private,v=d.animation.current,m=0;m<v.length;m++){var y=v[m],x=y._private;r&&(x.duration=0)}n&&(d.animation.queue=[]),r||(d.animation.current=[])}return o.notify("draw"),this}}},wx,ok;function Yp(){if(ok)return wx;ok=1;var e=Array.isArray;return wx=e,wx}var Sx,uk;function ZX(){if(uk)return Sx;uk=1;var e=Yp(),t=Ed(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(i,l){if(e(i))return!1;var o=typeof i;return o=="number"||o=="symbol"||o=="boolean"||i==null||t(i)?!0:r.test(i)||!n.test(i)||l!=null&&i in Object(l)}return Sx=a,Sx}var Ex,ck;function JX(){if(ck)return Ex;ck=1;var e=qO(),t=Sd(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function l(o){if(!t(o))return!1;var f=e(o);return f==r||f==a||f==n||f==i}return Ex=l,Ex}var Cx,fk;function eQ(){if(fk)return Cx;fk=1;var e=Vp(),t=e["__core-js_shared__"];return Cx=t,Cx}var Tx,dk;function tQ(){if(dk)return Tx;dk=1;var e=eQ(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return Tx=n,Tx}var Nx,hk;function nQ(){if(hk)return Nx;hk=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return Nx=n,Nx}var kx,vk;function rQ(){if(vk)return kx;vk=1;var e=JX(),t=tQ(),n=Sd(),r=nQ(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,l=Function.prototype,o=Object.prototype,f=l.toString,c=o.hasOwnProperty,d=RegExp("^"+f.call(c).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function v(m){if(!n(m)||t(m))return!1;var y=e(m)?d:i;return y.test(r(m))}return kx=v,kx}var Ax,pk;function aQ(){if(pk)return Ax;pk=1;function e(t,n){return t==null?void 0:t[n]}return Ax=e,Ax}var Rx,mk;function xw(){if(mk)return Rx;mk=1;var e=rQ(),t=aQ();function n(r,a){var i=t(r,a);return e(i)?i:void 0}return Rx=n,Rx}var Dx,gk;function Kp(){if(gk)return Dx;gk=1;var e=xw(),t=e(Object,"create");return Dx=t,Dx}var jx,yk;function iQ(){if(yk)return jx;yk=1;var e=Kp();function t(){this.__data__=e?e(null):{},this.size=0}return jx=t,jx}var Mx,xk;function sQ(){if(xk)return Mx;xk=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Mx=e,Mx}var Ox,bk;function lQ(){if(bk)return Ox;bk=1;var e=Kp(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(i){var l=this.__data__;if(e){var o=l[i];return o===t?void 0:o}return r.call(l,i)?l[i]:void 0}return Ox=a,Ox}var Lx,wk;function oQ(){if(wk)return Lx;wk=1;var e=Kp(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return Lx=r,Lx}var _x,Sk;function uQ(){if(Sk)return _x;Sk=1;var e=Kp(),t="__lodash_hash_undefined__";function n(r,a){var i=this.__data__;return this.size+=this.has(r)?0:1,i[r]=e&&a===void 0?t:a,this}return _x=n,_x}var Bx,Ek;function cQ(){if(Ek)return Bx;Ek=1;var e=iQ(),t=sQ(),n=lQ(),r=oQ(),a=uQ();function i(l){var o=-1,f=l==null?0:l.length;for(this.clear();++o<f;){var c=l[o];this.set(c[0],c[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,Bx=i,Bx}var Px,Ck;function fQ(){if(Ck)return Px;Ck=1;function e(){this.__data__=[],this.size=0}return Px=e,Px}var zx,Tk;function dL(){if(Tk)return zx;Tk=1;function e(t,n){return t===n||t!==t&&n!==n}return zx=e,zx}var Ix,Nk;function Xp(){if(Nk)return Ix;Nk=1;var e=dL();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return Ix=t,Ix}var Fx,kk;function dQ(){if(kk)return Fx;kk=1;var e=Xp(),t=Array.prototype,n=t.splice;function r(a){var i=this.__data__,l=e(i,a);if(l<0)return!1;var o=i.length-1;return l==o?i.pop():n.call(i,l,1),--this.size,!0}return Fx=r,Fx}var qx,Ak;function hQ(){if(Ak)return qx;Ak=1;var e=Xp();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return qx=t,qx}var Ux,Rk;function vQ(){if(Rk)return Ux;Rk=1;var e=Xp();function t(n){return e(this.__data__,n)>-1}return Ux=t,Ux}var Vx,Dk;function pQ(){if(Dk)return Vx;Dk=1;var e=Xp();function t(n,r){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,r])):a[i][1]=r,this}return Vx=t,Vx}var Hx,jk;function mQ(){if(jk)return Hx;jk=1;var e=fQ(),t=dQ(),n=hQ(),r=vQ(),a=pQ();function i(l){var o=-1,f=l==null?0:l.length;for(this.clear();++o<f;){var c=l[o];this.set(c[0],c[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,Hx=i,Hx}var Gx,Mk;function gQ(){if(Mk)return Gx;Mk=1;var e=xw(),t=Vp(),n=e(t,"Map");return Gx=n,Gx}var $x,Ok;function yQ(){if(Ok)return $x;Ok=1;var e=cQ(),t=mQ(),n=gQ();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return $x=r,$x}var Yx,Lk;function xQ(){if(Lk)return Yx;Lk=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Yx=e,Yx}var Kx,_k;function Qp(){if(_k)return Kx;_k=1;var e=xQ();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return Kx=t,Kx}var Xx,Bk;function bQ(){if(Bk)return Xx;Bk=1;var e=Qp();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return Xx=t,Xx}var Qx,Pk;function wQ(){if(Pk)return Qx;Pk=1;var e=Qp();function t(n){return e(this,n).get(n)}return Qx=t,Qx}var Wx,zk;function SQ(){if(zk)return Wx;zk=1;var e=Qp();function t(n){return e(this,n).has(n)}return Wx=t,Wx}var Zx,Ik;function EQ(){if(Ik)return Zx;Ik=1;var e=Qp();function t(n,r){var a=e(this,n),i=a.size;return a.set(n,r),this.size+=a.size==i?0:1,this}return Zx=t,Zx}var Jx,Fk;function CQ(){if(Fk)return Jx;Fk=1;var e=yQ(),t=bQ(),n=wQ(),r=SQ(),a=EQ();function i(l){var o=-1,f=l==null?0:l.length;for(this.clear();++o<f;){var c=l[o];this.set(c[0],c[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,Jx=i,Jx}var e0,qk;function TQ(){if(qk)return e0;qk=1;var e=CQ(),t="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var l=arguments,o=a?a.apply(this,l):l[0],f=i.cache;if(f.has(o))return f.get(o);var c=r.apply(this,l);return i.cache=f.set(o,c)||f,c};return i.cache=new(n.Cache||e),i}return n.Cache=e,e0=n,e0}var t0,Uk;function NQ(){if(Uk)return t0;Uk=1;var e=TQ(),t=500;function n(r){var a=e(r,function(l){return i.size===t&&i.clear(),l}),i=a.cache;return a}return t0=n,t0}var n0,Vk;function hL(){if(Vk)return n0;Vk=1;var e=NQ(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(l,o,f,c){i.push(f?c.replace(n,"$1"):o||l)}),i});return n0=r,n0}var r0,Hk;function vL(){if(Hk)return r0;Hk=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,i=Array(a);++r<a;)i[r]=n(t[r],r,t);return i}return r0=e,r0}var a0,Gk;function kQ(){if(Gk)return a0;Gk=1;var e=cw(),t=vL(),n=Yp(),r=Ed(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function l(o){if(typeof o=="string")return o;if(n(o))return t(o,l)+"";if(r(o))return i?i.call(o):"";var f=o+"";return f=="0"&&1/o==-1/0?"-0":f}return a0=l,a0}var i0,$k;function pL(){if($k)return i0;$k=1;var e=kQ();function t(n){return n==null?"":e(n)}return i0=t,i0}var s0,Yk;function mL(){if(Yk)return s0;Yk=1;var e=Yp(),t=ZX(),n=hL(),r=pL();function a(i,l){return e(i)?i:t(i,l)?[i]:n(r(i))}return s0=a,s0}var l0,Kk;function bw(){if(Kk)return l0;Kk=1;var e=Ed();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return l0=t,l0}var o0,Xk;function AQ(){if(Xk)return o0;Xk=1;var e=mL(),t=bw();function n(r,a){a=e(a,r);for(var i=0,l=a.length;r!=null&&i<l;)r=r[t(a[i++])];return i&&i==l?r:void 0}return o0=n,o0}var u0,Qk;function RQ(){if(Qk)return u0;Qk=1;var e=AQ();function t(n,r,a){var i=n==null?void 0:e(n,r);return i===void 0?a:i}return u0=t,u0}var DQ=RQ(),jQ=wd(DQ),c0,Wk;function MQ(){if(Wk)return c0;Wk=1;var e=xw(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return c0=t,c0}var f0,Zk;function OQ(){if(Zk)return f0;Zk=1;var e=MQ();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return f0=t,f0}var d0,Jk;function LQ(){if(Jk)return d0;Jk=1;var e=OQ(),t=dL(),n=Object.prototype,r=n.hasOwnProperty;function a(i,l,o){var f=i[l];(!(r.call(i,l)&&t(f,o))||o===void 0&&!(l in i))&&e(i,l,o)}return d0=a,d0}var h0,eA;function _Q(){if(eA)return h0;eA=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,a){var i=typeof r;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<a}return h0=n,h0}var v0,tA;function BQ(){if(tA)return v0;tA=1;var e=LQ(),t=mL(),n=_Q(),r=Sd(),a=bw();function i(l,o,f,c){if(!r(l))return l;o=t(o,l);for(var d=-1,v=o.length,m=v-1,y=l;y!=null&&++d<v;){var x=a(o[d]),S=f;if(x==="__proto__"||x==="constructor"||x==="prototype")return l;if(d!=m){var w=y[x];S=c?c(w,x,y):void 0,S===void 0&&(S=r(w)?w:n(o[d+1])?[]:{})}e(y,x,S),y=y[x]}return l}return v0=i,v0}var p0,nA;function PQ(){if(nA)return p0;nA=1;var e=BQ();function t(n,r,a){return n==null?n:e(n,r,a)}return p0=t,p0}var zQ=PQ(),IQ=wd(zQ),m0,rA;function FQ(){if(rA)return m0;rA=1;function e(t,n){var r=-1,a=t.length;for(n||(n=Array(a));++r<a;)n[r]=t[r];return n}return m0=e,m0}var g0,aA;function qQ(){if(aA)return g0;aA=1;var e=vL(),t=FQ(),n=Yp(),r=Ed(),a=hL(),i=bw(),l=pL();function o(f){return n(f)?e(f,i):r(f)?[f]:t(a(l(f)))}return g0=o,g0}var UQ=qQ(),VQ=wd(UQ),HQ={data:function(t){var n={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(a){},beforeSet:function(a,i){},onSet:function(a){},canSet:function(a){return!0}};return t=nt({},n,t),function(a,i){var l=t,o=this,f=o.length!==void 0,c=f?o:[o],d=f?o[0]:o;if(Ze(a)){var v=a.indexOf(".")!==-1,m=v&&VQ(a);if(l.allowGetting&&i===void 0){var y;return d&&(l.beforeGet(d),m&&d._private[l.field][a]===void 0?y=jQ(d._private[l.field],m):y=d._private[l.field][a]),y}else if(l.allowSetting&&i!==void 0){var x=!l.immutableKeys[a];if(x){var S=jO({},a,i);l.beforeSet(o,S);for(var w=0,b=c.length;w<b;w++){var C=c[w];l.canSet(C)&&(m&&d._private[l.field][a]===void 0?IQ(C._private[l.field],m,i):C._private[l.field][a]=i)}l.updateStyle&&o.updateStyle(),l.onSet(o),l.settingTriggersEvent&&o[l.triggerFnName](l.settingEvent)}}}else if(l.allowSetting&&Dt(a)){var T=a,k,D,A=Object.keys(T);l.beforeSet(o,T);for(var j=0;j<A.length;j++){k=A[j],D=T[k];var L=!l.immutableKeys[k];if(L)for(var _=0;_<c.length;_++){var M=c[_];l.canSet(M)&&(M._private[l.field][k]=D)}}l.updateStyle&&o.updateStyle(),l.onSet(o),l.settingTriggersEvent&&o[l.triggerFnName](l.settingEvent)}else if(l.allowBinding&&fn(a)){var z=a;o.on(l.bindingEvent,z)}else if(l.allowGetting&&a===void 0){var P;return d&&(l.beforeGet(d),P=d._private[l.field]),P}return o}},removeData:function(t){var n={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return t=nt({},n,t),function(a){var i=t,l=this,o=l.length!==void 0,f=o?l:[l];if(Ze(a)){for(var c=a.split(/\s+/),d=c.length,v=0;v<d;v++){var m=c[v];if(!ll(m)){var y=!i.immutableKeys[m];if(y)for(var x=0,S=f.length;x<S;x++)f[x]._private[i.field][m]=void 0}}i.triggerEvent&&l[i.triggerFnName](i.event)}else if(a===void 0){for(var w=0,b=f.length;w<b;w++)for(var C=f[w]._private[i.field],T=Object.keys(C),k=0;k<T.length;k++){var D=T[k],A=!i.immutableKeys[D];A&&(C[D]=void 0)}i.triggerEvent&&l[i.triggerFnName](i.event)}return l}}},GQ={eventAliasesOn:function(t){var n=t;n.addListener=n.listen=n.bind=n.on,n.unlisten=n.unbind=n.off=n.removeListener,n.trigger=n.emit,n.pon=n.promiseOn=function(r,a){var i=this,l=Array.prototype.slice.call(arguments,0);return new dc(function(o,f){var c=function(y){i.off.apply(i,v),o(y)},d=l.concat([c]),v=d.concat([]);i.on.apply(i,d)})}}},_t={};[WX,HQ,GQ].forEach(function(e){nt(_t,e)});var $Q={animate:_t.animate(),animation:_t.animation(),animated:_t.animated(),clearQueue:_t.clearQueue(),delay:_t.delay(),delayAnimation:_t.delayAnimation(),stop:_t.stop()},Dv={classes:function(t){var n=this;if(t===void 0){var r=[];return n[0]._private.classes.forEach(function(x){return r.push(x)}),r}else $t(t)||(t=(t||"").match(/\S+/g)||[]);for(var a=[],i=new fc(t),l=0;l<n.length;l++){for(var o=n[l],f=o._private,c=f.classes,d=!1,v=0;v<t.length;v++){var m=t[v],y=c.has(m);if(!y){d=!0;break}}d||(d=c.size!==t.length),d&&(f.classes=i,a.push(o))}return a.length>0&&this.spawn(a).updateStyle().emit("class"),n},addClass:function(t){return this.toggleClass(t,!0)},hasClass:function(t){var n=this[0];return n!=null&&n._private.classes.has(t)},toggleClass:function(t,n){$t(t)||(t=t.match(/\S+/g)||[]);for(var r=this,a=n===void 0,i=[],l=0,o=r.length;l<o;l++)for(var f=r[l],c=f._private.classes,d=!1,v=0;v<t.length;v++){var m=t[v],y=c.has(m),x=!1;n||a&&!y?(c.add(m),x=!0):(!n||a&&y)&&(c.delete(m),x=!0),!d&&x&&(i.push(f),d=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),r},removeClass:function(t){return this.toggleClass(t,!1)},flashClass:function(t,n){var r=this;if(n==null)n=250;else if(n===0)return r;return r.addClass(t),setTimeout(function(){r.removeClass(t)},n),r}};Dv.className=Dv.classNames=Dv.classes;var Rt={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:zn,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Rt.variable="(?:[\\w-.]|(?:\\\\"+Rt.metaChar+"))+";Rt.className="(?:[\\w-]|(?:\\\\"+Rt.metaChar+"))+";Rt.value=Rt.string+"|"+Rt.number;Rt.id=Rt.variable;(function(){var e,t,n;for(e=Rt.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],Rt.comparatorOp+="|@"+t;for(e=Rt.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],!(t.indexOf("!")>=0)&&t!=="="&&(Rt.comparatorOp+="|\\!"+t)})();var Ht=function(){return{checks:[]}},Fe={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Bb=[{selector:":selected",matches:function(t){return t.selected()}},{selector:":unselected",matches:function(t){return!t.selected()}},{selector:":selectable",matches:function(t){return t.selectable()}},{selector:":unselectable",matches:function(t){return!t.selectable()}},{selector:":locked",matches:function(t){return t.locked()}},{selector:":unlocked",matches:function(t){return!t.locked()}},{selector:":visible",matches:function(t){return t.visible()}},{selector:":hidden",matches:function(t){return!t.visible()}},{selector:":transparent",matches:function(t){return t.transparent()}},{selector:":grabbed",matches:function(t){return t.grabbed()}},{selector:":free",matches:function(t){return!t.grabbed()}},{selector:":removed",matches:function(t){return t.removed()}},{selector:":inside",matches:function(t){return!t.removed()}},{selector:":grabbable",matches:function(t){return t.grabbable()}},{selector:":ungrabbable",matches:function(t){return!t.grabbable()}},{selector:":animated",matches:function(t){return t.animated()}},{selector:":unanimated",matches:function(t){return!t.animated()}},{selector:":parent",matches:function(t){return t.isParent()}},{selector:":childless",matches:function(t){return t.isChildless()}},{selector:":child",matches:function(t){return t.isChild()}},{selector:":orphan",matches:function(t){return t.isOrphan()}},{selector:":nonorphan",matches:function(t){return t.isChild()}},{selector:":compound",matches:function(t){return t.isNode()?t.isParent():t.source().isParent()||t.target().isParent()}},{selector:":loop",matches:function(t){return t.isLoop()}},{selector:":simple",matches:function(t){return t.isSimple()}},{selector:":active",matches:function(t){return t.active()}},{selector:":inactive",matches:function(t){return!t.active()}},{selector:":backgrounding",matches:function(t){return t.backgrounding()}},{selector:":nonbackgrounding",matches:function(t){return!t.backgrounding()}}].sort(function(e,t){return HY(e.selector,t.selector)}),YQ=(function(){for(var e={},t,n=0;n<Bb.length;n++)t=Bb[n],e[t.selector]=t.matches;return e})(),KQ=function(t,n){return YQ[t](n)},XQ="("+Bb.map(function(e){return e.selector}).join("|")+")",du=function(t){return t.replace(new RegExp("\\\\("+Rt.metaChar+")","g"),function(n,r){return r})},Os=function(t,n,r){t[t.length-1]=r},Pb=[{name:"group",query:!0,regex:"("+Rt.group+")",populate:function(t,n,r){var a=Mn(r,1),i=a[0];n.checks.push({type:Fe.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:XQ,populate:function(t,n,r){var a=Mn(r,1),i=a[0];n.checks.push({type:Fe.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Rt.id+")",populate:function(t,n,r){var a=Mn(r,1),i=a[0];n.checks.push({type:Fe.ID,value:du(i)})}},{name:"className",query:!0,regex:"\\.("+Rt.className+")",populate:function(t,n,r){var a=Mn(r,1),i=a[0];n.checks.push({type:Fe.CLASS,value:du(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Rt.variable+")\\s*\\]",populate:function(t,n,r){var a=Mn(r,1),i=a[0];n.checks.push({type:Fe.DATA_EXIST,field:du(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Rt.variable+")\\s*("+Rt.comparatorOp+")\\s*("+Rt.value+")\\s*\\]",populate:function(t,n,r){var a=Mn(r,3),i=a[0],l=a[1],o=a[2],f=new RegExp("^"+Rt.string+"$").exec(o)!=null;f?o=o.substring(1,o.length-1):o=parseFloat(o),n.checks.push({type:Fe.DATA_COMPARE,field:du(i),operator:l,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Rt.boolOp+")\\s*("+Rt.variable+")\\s*\\]",populate:function(t,n,r){var a=Mn(r,2),i=a[0],l=a[1];n.checks.push({type:Fe.DATA_BOOL,field:du(l),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Rt.meta+")\\s*("+Rt.comparatorOp+")\\s*("+Rt.number+")\\s*\\]\\]",populate:function(t,n,r){var a=Mn(r,3),i=a[0],l=a[1],o=a[2];n.checks.push({type:Fe.META_COMPARE,field:du(i),operator:l,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:Rt.separator,populate:function(t,n){var r=t.currentSubject,a=t.edgeCount,i=t.compoundCount,l=t[t.length-1];r!=null&&(l.subject=r,t.currentSubject=null),l.edgeCount=a,l.compoundCount=i,t.edgeCount=0,t.compoundCount=0;var o=t[t.length++]=Ht();return o}},{name:"directedEdge",separator:!0,regex:Rt.directedEdge,populate:function(t,n){if(t.currentSubject==null){var r=Ht(),a=n,i=Ht();return r.checks.push({type:Fe.DIRECTED_EDGE,source:a,target:i}),Os(t,n,r),t.edgeCount++,i}else{var l=Ht(),o=n,f=Ht();return l.checks.push({type:Fe.NODE_SOURCE,source:o,target:f}),Os(t,n,l),t.edgeCount++,f}}},{name:"undirectedEdge",separator:!0,regex:Rt.undirectedEdge,populate:function(t,n){if(t.currentSubject==null){var r=Ht(),a=n,i=Ht();return r.checks.push({type:Fe.UNDIRECTED_EDGE,nodes:[a,i]}),Os(t,n,r),t.edgeCount++,i}else{var l=Ht(),o=n,f=Ht();return l.checks.push({type:Fe.NODE_NEIGHBOR,node:o,neighbor:f}),Os(t,n,l),f}}},{name:"child",separator:!0,regex:Rt.child,populate:function(t,n){if(t.currentSubject==null){var r=Ht(),a=Ht(),i=t[t.length-1];return r.checks.push({type:Fe.CHILD,parent:i,child:a}),Os(t,n,r),t.compoundCount++,a}else if(t.currentSubject===n){var l=Ht(),o=t[t.length-1],f=Ht(),c=Ht(),d=Ht(),v=Ht();return l.checks.push({type:Fe.COMPOUND_SPLIT,left:o,right:f,subject:c}),c.checks=n.checks,n.checks=[{type:Fe.TRUE}],v.checks.push({type:Fe.TRUE}),f.checks.push({type:Fe.PARENT,parent:v,child:d}),Os(t,o,l),t.currentSubject=c,t.compoundCount++,d}else{var m=Ht(),y=Ht(),x=[{type:Fe.PARENT,parent:m,child:y}];return m.checks=n.checks,n.checks=x,t.compoundCount++,y}}},{name:"descendant",separator:!0,regex:Rt.descendant,populate:function(t,n){if(t.currentSubject==null){var r=Ht(),a=Ht(),i=t[t.length-1];return r.checks.push({type:Fe.DESCENDANT,ancestor:i,descendant:a}),Os(t,n,r),t.compoundCount++,a}else if(t.currentSubject===n){var l=Ht(),o=t[t.length-1],f=Ht(),c=Ht(),d=Ht(),v=Ht();return l.checks.push({type:Fe.COMPOUND_SPLIT,left:o,right:f,subject:c}),c.checks=n.checks,n.checks=[{type:Fe.TRUE}],v.checks.push({type:Fe.TRUE}),f.checks.push({type:Fe.ANCESTOR,ancestor:v,descendant:d}),Os(t,o,l),t.currentSubject=c,t.compoundCount++,d}else{var m=Ht(),y=Ht(),x=[{type:Fe.ANCESTOR,ancestor:m,descendant:y}];return m.checks=n.checks,n.checks=x,t.compoundCount++,y}}},{name:"subject",modifier:!0,regex:Rt.subject,populate:function(t,n){if(t.currentSubject!=null&&t.currentSubject!==n)return Bt("Redefinition of subject in selector `"+t.toString()+"`"),!1;t.currentSubject=n;var r=t[t.length-1],a=r.checks[0],i=a==null?null:a.type;i===Fe.DIRECTED_EDGE?a.type=Fe.NODE_TARGET:i===Fe.UNDIRECTED_EDGE&&(a.type=Fe.NODE_NEIGHBOR,a.node=a.nodes[1],a.neighbor=a.nodes[0],a.nodes=null)}}];Pb.forEach(function(e){return e.regexObj=new RegExp("^"+e.regex)});var QQ=function(t){for(var n,r,a,i=0;i<Pb.length;i++){var l=Pb[i],o=l.name,f=t.match(l.regexObj);if(f!=null){r=f,n=l,a=o;var c=f[0];t=t.substring(c.length);break}}return{expr:n,match:r,name:a,remaining:t}},WQ=function(t){var n=t.match(/^\s+/);if(n){var r=n[0];t=t.substring(r.length)}return t},ZQ=function(t){var n=this,r=n.inputText=t,a=n[0]=Ht();for(n.length=1,r=WQ(r);;){var i=QQ(r);if(i.expr==null)return Bt("The selector `"+t+"`is invalid"),!1;var l=i.match.slice(1),o=i.expr.populate(n,a,l);if(o===!1)return!1;if(o!=null&&(a=o),r=i.remaining,r.match(/^\s*$/))break}var f=n[n.length-1];n.currentSubject!=null&&(f.subject=n.currentSubject),f.edgeCount=n.edgeCount,f.compoundCount=n.compoundCount;for(var c=0;c<n.length;c++){var d=n[c];if(d.compoundCount>0&&d.edgeCount>0)return Bt("The selector `"+t+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(d.edgeCount>1)return Bt("The selector `"+t+"` is invalid because it uses multiple edge selectors"),!1;d.edgeCount===1&&Bt("The selector `"+t+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},JQ=function(){if(this.toStringCache!=null)return this.toStringCache;for(var t=function(d){return d??""},n=function(d){return Ze(d)?'"'+d+'"':t(d)},r=function(d){return" "+d+" "},a=function(d,v){var m=d.type,y=d.value;switch(m){case Fe.GROUP:{var x=t(y);return x.substring(0,x.length-1)}case Fe.DATA_COMPARE:{var S=d.field,w=d.operator;return"["+S+r(t(w))+n(y)+"]"}case Fe.DATA_BOOL:{var b=d.operator,C=d.field;return"["+t(b)+C+"]"}case Fe.DATA_EXIST:{var T=d.field;return"["+T+"]"}case Fe.META_COMPARE:{var k=d.operator,D=d.field;return"[["+D+r(t(k))+n(y)+"]]"}case Fe.STATE:return y;case Fe.ID:return"#"+y;case Fe.CLASS:return"."+y;case Fe.PARENT:case Fe.CHILD:return i(d.parent,v)+r(">")+i(d.child,v);case Fe.ANCESTOR:case Fe.DESCENDANT:return i(d.ancestor,v)+" "+i(d.descendant,v);case Fe.COMPOUND_SPLIT:{var A=i(d.left,v),j=i(d.subject,v),L=i(d.right,v);return A+(A.length>0?" ":"")+j+L}case Fe.TRUE:return""}},i=function(d,v){return d.checks.reduce(function(m,y,x){return m+(v===d&&x===0?"$":"")+a(y,v)},"")},l="",o=0;o<this.length;o++){var f=this[o];l+=i(f,f.subject),this.length>1&&o<this.length-1&&(l+=", ")}return this.toStringCache=l,l},eW={parse:ZQ,toString:JQ},gL=function(t,n,r){var a,i=Ze(t),l=Re(t),o=Ze(r),f,c,d=!1,v=!1,m=!1;switch(n.indexOf("!")>=0&&(n=n.replace("!",""),v=!0),n.indexOf("@")>=0&&(n=n.replace("@",""),d=!0),(i||o||d)&&(f=!i&&!l?"":""+t,c=""+r),d&&(t=f=f.toLowerCase(),r=c=c.toLowerCase()),n){case"*=":a=f.indexOf(c)>=0;break;case"$=":a=f.indexOf(c,f.length-c.length)>=0;break;case"^=":a=f.indexOf(c)===0;break;case"=":a=t===r;break;case">":m=!0,a=t>r;break;case">=":m=!0,a=t>=r;break;case"<":m=!0,a=t<r;break;case"<=":m=!0,a=t<=r;break;default:a=!1;break}return v&&(t!=null||!m)&&(a=!a),a},tW=function(t,n){switch(n){case"?":return!!t;case"!":return!t;case"^":return t===void 0}},nW=function(t){return t!==void 0},ww=function(t,n){return t.data(n)},rW=function(t,n){return t[n]()},gn=[],nn=function(t,n){return t.checks.every(function(r){return gn[r.type](r,n)})};gn[Fe.GROUP]=function(e,t){var n=e.value;return n==="*"||n===t.group()};gn[Fe.STATE]=function(e,t){var n=e.value;return KQ(n,t)};gn[Fe.ID]=function(e,t){var n=e.value;return t.id()===n};gn[Fe.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)};gn[Fe.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,a=e.value;return gL(rW(t,n),r,a)};gn[Fe.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,a=e.value;return gL(ww(t,n),r,a)};gn[Fe.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return tW(ww(t,n),r)};gn[Fe.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,nW(ww(t,n))};gn[Fe.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],a=t.source(),i=t.target();return nn(n,a)&&nn(r,i)||nn(r,a)&&nn(n,i)};gn[Fe.NODE_NEIGHBOR]=function(e,t){return nn(e.node,t)&&t.neighborhood().some(function(n){return n.isNode()&&nn(e.neighbor,n)})};gn[Fe.DIRECTED_EDGE]=function(e,t){return nn(e.source,t.source())&&nn(e.target,t.target())};gn[Fe.NODE_SOURCE]=function(e,t){return nn(e.source,t)&&t.outgoers().some(function(n){return n.isNode()&&nn(e.target,n)})};gn[Fe.NODE_TARGET]=function(e,t){return nn(e.target,t)&&t.incomers().some(function(n){return n.isNode()&&nn(e.source,n)})};gn[Fe.CHILD]=function(e,t){return nn(e.child,t)&&nn(e.parent,t.parent())};gn[Fe.PARENT]=function(e,t){return nn(e.parent,t)&&t.children().some(function(n){return nn(e.child,n)})};gn[Fe.DESCENDANT]=function(e,t){return nn(e.descendant,t)&&t.ancestors().some(function(n){return nn(e.ancestor,n)})};gn[Fe.ANCESTOR]=function(e,t){return nn(e.ancestor,t)&&t.descendants().some(function(n){return nn(e.descendant,n)})};gn[Fe.COMPOUND_SPLIT]=function(e,t){return nn(e.subject,t)&&nn(e.left,t)&&nn(e.right,t)};gn[Fe.TRUE]=function(){return!0};gn[Fe.COLLECTION]=function(e,t){var n=e.value;return n.has(t)};gn[Fe.FILTER]=function(e,t){var n=e.value;return n(t)};var aW=function(t){var n=this;if(n.length===1&&n[0].checks.length===1&&n[0].checks[0].type===Fe.ID)return t.getElementById(n[0].checks[0].value).collection();var r=function(i){for(var l=0;l<n.length;l++){var o=n[l];if(nn(o,i))return!0}return!1};return n.text()==null&&(r=function(){return!0}),t.filter(r)},iW=function(t){for(var n=this,r=0;r<n.length;r++){var a=n[r];if(nn(a,t))return!0}return!1},sW={matches:iW,filter:aW},cl=function(t){this.inputText=t,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,t==null||Ze(t)&&t.match(/^\s*$/)||(ta(t)?this.addQuery({checks:[{type:Fe.COLLECTION,value:t.collection()}]}):fn(t)?this.addQuery({checks:[{type:Fe.FILTER,value:t}]}):Ze(t)?this.parse(t)||(this.invalid=!0):sn("A selector must be created from a string; found "))},fl=cl.prototype;[eW,sW].forEach(function(e){return nt(fl,e)});fl.text=function(){return this.inputText};fl.size=function(){return this.length};fl.eq=function(e){return this[e]};fl.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()};fl.addQuery=function(e){this[this.length++]=e};fl.selector=fl.toString;var nl={allAre:function(t){var n=new cl(t);return this.every(function(r){return n.matches(r)})},is:function(t){var n=new cl(t);return this.some(function(r){return n.matches(r)})},some:function(t,n){for(var r=0;r<this.length;r++){var a=n?t.apply(n,[this[r],r,this]):t(this[r],r,this);if(a)return!0}return!1},every:function(t,n){for(var r=0;r<this.length;r++){var a=n?t.apply(n,[this[r],r,this]):t(this[r],r,this);if(!a)return!1}return!0},same:function(t){if(this===t)return!0;t=this.cy().collection(t);var n=this.length,r=t.length;return n!==r?!1:n===1?this[0]===t[0]:this.every(function(a){return t.hasElementWithId(a.id())})},anySame:function(t){return t=this.cy().collection(t),this.some(function(n){return t.hasElementWithId(n.id())})},allAreNeighbors:function(t){t=this.cy().collection(t);var n=this.neighborhood();return t.every(function(r){return n.hasElementWithId(r.id())})},contains:function(t){t=this.cy().collection(t);var n=this;return t.every(function(r){return n.hasElementWithId(r.id())})}};nl.allAreNeighbours=nl.allAreNeighbors;nl.has=nl.contains;nl.equal=nl.equals=nl.same;var ba=function(t,n){return function(a,i,l,o){var f=a,c=this,d;if(f==null?d="":ta(f)&&f.length===1&&(d=f.id()),c.length===1&&d){var v=c[0]._private,m=v.traversalCache=v.traversalCache||{},y=m[n]=m[n]||[],x=mo(d),S=y[x];return S||(y[x]=t.call(c,a,i,l,o))}else return t.call(c,a,i,l,o)}},Zu={parent:function(t){var n=[];if(this.length===1){var r=this[0]._private.parent;if(r)return r}for(var a=0;a<this.length;a++){var i=this[a],l=i._private.parent;l&&n.push(l)}return this.spawn(n,!0).filter(t)},parents:function(t){for(var n=[],r=this.parent();r.nonempty();){for(var a=0;a<r.length;a++){var i=r[a];n.push(i)}r=r.parent()}return this.spawn(n,!0).filter(t)},commonAncestors:function(t){for(var n,r=0;r<this.length;r++){var a=this[r],i=a.parents();n=n||i,n=n.intersect(i)}return n.filter(t)},orphans:function(t){return this.stdFilter(function(n){return n.isOrphan()}).filter(t)},nonorphans:function(t){return this.stdFilter(function(n){return n.isChild()}).filter(t)},children:ba(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n],a=r._private.children,i=0;i<a.length;i++)t.push(a[i]);return this.spawn(t,!0).filter(e)},"children"),siblings:function(t){return this.parent().children().not(this).filter(t)},isParent:function(){var t=this[0];if(t)return t.isNode()&&t._private.children.length!==0},isChildless:function(){var t=this[0];if(t)return t.isNode()&&t._private.children.length===0},isChild:function(){var t=this[0];if(t)return t.isNode()&&t._private.parent!=null},isOrphan:function(){var t=this[0];if(t)return t.isNode()&&t._private.parent==null},descendants:function(t){var n=[];function r(a){for(var i=0;i<a.length;i++){var l=a[i];n.push(l),l.children().nonempty()&&r(l.children())}}return r(this.children()),this.spawn(n,!0).filter(t)}};function Sw(e,t,n,r){for(var a=[],i=new fc,l=e.cy(),o=l.hasCompoundNodes(),f=0;f<e.length;f++){var c=e[f];n?a.push(c):o&&r(a,i,c)}for(;a.length>0;){var d=a.shift();t(d),i.add(d.id()),o&&r(a,i,d)}return e}function yL(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a<r.length;a++){var i=r[a];t.has(i.id())||e.push(i)}}Zu.forEachDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Sw(this,e,t,yL)};function xL(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}Zu.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Sw(this,e,t,xL)};function lW(e,t,n){xL(e,t,n),yL(e,t,n)}Zu.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Sw(this,e,t,lW)};Zu.ancestors=Zu.parents;var Wf,bL;Wf=bL={data:_t.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:_t.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:_t.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:_t.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:_t.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:_t.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var t=this[0];if(t)return t._private.data.id}};Wf.attr=Wf.data;Wf.removeAttr=Wf.removeData;var oW=bL,Wp={};function y0(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0)if(n.isNode()&&!n.removed()){for(var r=0,a=n[0],i=a._private.edges,l=0;l<i.length;l++){var o=i[l];!t&&o.isLoop()||(r+=e(a,o))}return r}else return}}nt(Wp,{degree:y0(function(e,t){return t.source().same(t.target())?2:1}),indegree:y0(function(e,t){return t.target().same(e)?1:0}),outdegree:y0(function(e,t){return t.source().same(e)?1:0})});function hu(e,t){return function(n){for(var r,a=this.nodes(),i=0;i<a.length;i++){var l=a[i],o=l[e](n);o!==void 0&&(r===void 0||t(o,r))&&(r=o)}return r}}nt(Wp,{minDegree:hu("degree",function(e,t){return e<t}),maxDegree:hu("degree",function(e,t){return e>t}),minIndegree:hu("indegree",function(e,t){return e<t}),maxIndegree:hu("indegree",function(e,t){return e>t}),minOutdegree:hu("outdegree",function(e,t){return e<t}),maxOutdegree:hu("outdegree",function(e,t){return e>t})});nt(Wp,{totalDegree:function(t){for(var n=0,r=this.nodes(),a=0;a<r.length;a++)n+=r[a].degree(t);return n}});var ja,wL,SL=function(t,n,r){for(var a=0;a<t.length;a++){var i=t[a];if(!i.locked()){var l=i._private.position,o={x:n.x!=null?n.x-l.x:0,y:n.y!=null?n.y-l.y:0};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,r),i.dirtyBoundingBoxCache()}}},iA={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(t){t.updateCompoundBounds()},beforeSet:function(t,n){SL(t,n,!1)},onSet:function(t){t.dirtyCompoundBoundsCache()},canSet:function(t){return!t.locked()}};ja=wL={position:_t.data(iA),silentPosition:_t.data(nt({},iA,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(t,n){SL(t,n,!0)},onSet:function(t){t.dirtyCompoundBoundsCache()}})),positions:function(t,n){if(Dt(t))n?this.silentPosition(t):this.position(t);else if(fn(t)){var r=t,a=this.cy();a.startBatch();for(var i=0;i<this.length;i++){var l=this[i],o=void 0;(o=r(l,i))&&(n?l.silentPosition(o):l.position(o))}a.endBatch()}return this},silentPositions:function(t){return this.positions(t,!0)},shift:function(t,n,r){var a;if(Dt(t)?(a={x:Re(t.x)?t.x:0,y:Re(t.y)?t.y:0},r=n):Ze(t)&&Re(n)&&(a={x:0,y:0},a[t]=n),a!=null){var i=this.cy();i.startBatch();for(var l=0;l<this.length;l++){var o=this[l];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var f=o.position(),c={x:f.x+a.x,y:f.y+a.y};r?o.silentPosition(c):o.position(c)}}i.endBatch()}return this},silentShift:function(t,n){return Dt(t)?this.shift(t,!0):Ze(t)&&Re(n)&&this.shift(t,n,!0),this},renderedPosition:function(t,n){var r=this[0],a=this.cy(),i=a.zoom(),l=a.pan(),o=Dt(t)?t:void 0,f=o!==void 0||n!==void 0&&Ze(t);if(r&&r.isNode())if(f)for(var c=0;c<this.length;c++){var d=this[c];n!==void 0?d.position(t,(n-l[t])/i):o!==void 0&&d.position(QO(o,i,l))}else{var v=r.position();return o=Gp(v,i,l),t===void 0?o:o[t]}else if(!f)return;return this},relativePosition:function(t,n){var r=this[0],a=this.cy(),i=Dt(t)?t:void 0,l=i!==void 0||n!==void 0&&Ze(t),o=a.hasCompoundNodes();if(r&&r.isNode())if(l)for(var f=0;f<this.length;f++){var c=this[f],d=o?c.parent():null,v=d&&d.length>0,m=v;v&&(d=d[0]);var y=m?d.position():{x:0,y:0};n!==void 0?c.position(t,n+y[t]):i!==void 0&&c.position({x:i.x+y.x,y:i.y+y.y})}else{var x=r.position(),S=o?r.parent():null,w=S&&S.length>0,b=w;w&&(S=S[0]);var C=b?S.position():{x:0,y:0};return i={x:x.x-C.x,y:x.y-C.y},t===void 0?i:i[t]}else if(!l)return;return this}};ja.modelPosition=ja.point=ja.position;ja.modelPositions=ja.points=ja.positions;ja.renderedPoint=ja.renderedPosition;ja.relativePoint=ja.relativePosition;var uW=wL,Lu,bl;Lu=bl={};bl.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),i=t.x1*r+a.x,l=t.x2*r+a.x,o=t.y1*r+a.y,f=t.y2*r+a.y;return{x1:i,x2:l,y1:o,y2:f,w:l-i,h:f-o}};bl.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()?this:(this.forEachUp(function(n){if(n.isParent()){var r=n._private;r.compoundBoundsClean=!1,r.bbCache=null,e||n.emitAndNotify("bounds")}}),this)};bl.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(l){if(!l.isParent())return;var o=l._private,f=l.children(),c=l.pstyle("compound-sizing-wrt-labels").value==="include",d={width:{val:l.pstyle("min-width").pfValue,left:l.pstyle("min-width-bias-left"),right:l.pstyle("min-width-bias-right")},height:{val:l.pstyle("min-height").pfValue,top:l.pstyle("min-height-bias-top"),bottom:l.pstyle("min-height-bias-bottom")}},v=f.boundingBox({includeLabels:c,includeOverlays:!1,useCache:!1}),m=o.position;(v.w===0||v.h===0)&&(v={w:l.pstyle("width").pfValue,h:l.pstyle("height").pfValue},v.x1=m.x-v.w/2,v.x2=m.x+v.w/2,v.y1=m.y-v.h/2,v.y2=m.y+v.h/2);function y(_,M,z){var P=0,G=0,I=M+z;return _>0&&I>0&&(P=M/I*_,G=z/I*_),{biasDiff:P,biasComplementDiff:G}}function x(_,M,z,P){if(z.units==="%")switch(P){case"width":return _>0?z.pfValue*_:0;case"height":return M>0?z.pfValue*M:0;case"average":return _>0&&M>0?z.pfValue*(_+M)/2:0;case"min":return _>0&&M>0?_>M?z.pfValue*M:z.pfValue*_:0;case"max":return _>0&&M>0?_>M?z.pfValue*_:z.pfValue*M:0;default:return 0}else return z.units==="px"?z.pfValue:0}var S=d.width.left.value;d.width.left.units==="px"&&d.width.val>0&&(S=S*100/d.width.val);var w=d.width.right.value;d.width.right.units==="px"&&d.width.val>0&&(w=w*100/d.width.val);var b=d.height.top.value;d.height.top.units==="px"&&d.height.val>0&&(b=b*100/d.height.val);var C=d.height.bottom.value;d.height.bottom.units==="px"&&d.height.val>0&&(C=C*100/d.height.val);var T=y(d.width.val-v.w,S,w),k=T.biasDiff,D=T.biasComplementDiff,A=y(d.height.val-v.h,b,C),j=A.biasDiff,L=A.biasComplementDiff;o.autoPadding=x(v.w,v.h,l.pstyle("padding"),l.pstyle("padding-relative-to").value),o.autoWidth=Math.max(v.w,d.width.val),m.x=(-k+v.x1+v.x2+D)/2,o.autoHeight=Math.max(v.h,d.height.val),m.y=(-j+v.y1+v.y2+L)/2}for(var r=0;r<this.length;r++){var a=this[r],i=a._private;(!i.compoundBoundsClean||e)&&(n(a),t.batching()||(i.compoundBoundsClean=!0))}return this};var xa=function(t){return t===1/0||t===-1/0?0:t},Ra=function(t,n,r,a,i){a-n===0||i-r===0||n==null||r==null||a==null||i==null||(t.x1=n<t.x1?n:t.x1,t.x2=a>t.x2?a:t.x2,t.y1=r<t.y1?r:t.y1,t.y2=i>t.y2?i:t.y2,t.w=t.x2-t.x1,t.h=t.y2-t.y1)},Ps=function(t,n){return n==null?t:Ra(t,n.x1,n.y1,n.x2,n.y2)},xf=function(t,n,r){return zr(t,n,r)},fv=function(t,n,r){if(!n.cy().headless()){var a=n._private,i=a.rstyle,l=i.arrowWidth/2,o=n.pstyle(r+"-arrow-shape").value,f,c;if(o!=="none"){r==="source"?(f=i.srcX,c=i.srcY):r==="target"?(f=i.tgtX,c=i.tgtY):(f=i.midX,c=i.midY);var d=a.arrowBounds=a.arrowBounds||{},v=d[r]=d[r]||{};v.x1=f-l,v.y1=c-l,v.x2=f+l,v.y2=c+l,v.w=v.x2-v.x1,v.h=v.y2-v.y1,Av(v,1),Ra(t,v.x1,v.y1,v.x2,v.y2)}}},x0=function(t,n,r){if(!n.cy().headless()){var a;r?a=r+"-":a="";var i=n._private,l=i.rstyle,o=n.pstyle(a+"label").strValue;if(o){var f=n.pstyle("text-halign"),c=n.pstyle("text-valign"),d=xf(l,"labelWidth",r),v=xf(l,"labelHeight",r),m=xf(l,"labelX",r),y=xf(l,"labelY",r),x=n.pstyle(a+"text-margin-x").pfValue,S=n.pstyle(a+"text-margin-y").pfValue,w=n.isEdge(),b=n.pstyle(a+"text-rotation"),C=n.pstyle("text-outline-width").pfValue,T=n.pstyle("text-border-width").pfValue,k=T/2,D=n.pstyle("text-background-padding").pfValue,A=2,j=v,L=d,_=L/2,M=j/2,z,P,G,I;if(w)z=m-_,P=m+_,G=y-M,I=y+M;else{switch(f.value){case"left":z=m-L,P=m;break;case"center":z=m-_,P=m+_;break;case"right":z=m,P=m+L;break}switch(c.value){case"top":G=y-j,I=y;break;case"center":G=y-M,I=y+M;break;case"bottom":G=y,I=y+j;break}}var F=x-Math.max(C,k)-D-A,B=x+Math.max(C,k)+D+A,H=S-Math.max(C,k)-D-A,K=S+Math.max(C,k)+D+A;z+=F,P+=B,G+=H,I+=K;var Q=r||"main",V=i.labelBounds,q=V[Q]=V[Q]||{};q.x1=z,q.y1=G,q.x2=P,q.y2=I,q.w=P-z,q.h=I-G,q.leftPad=F,q.rightPad=B,q.topPad=H,q.botPad=K;var X=w&&b.strValue==="autorotate",U=b.pfValue!=null&&b.pfValue!==0;if(X||U){var te=X?xf(i.rstyle,"labelAngle",r):b.pfValue,ie=Math.cos(te),oe=Math.sin(te),ae=(z+P)/2,we=(G+I)/2;if(!w){switch(f.value){case"left":ae=P;break;case"right":ae=z;break}switch(c.value){case"top":we=I;break;case"bottom":we=G;break}}var fe=function(Qe,Ke){return Qe=Qe-ae,Ke=Ke-we,{x:Qe*ie-Ke*oe+ae,y:Qe*oe+Ke*ie+we}},J=fe(z,G),ne=fe(z,I),re=fe(P,G),ge=fe(P,I);z=Math.min(J.x,ne.x,re.x,ge.x),P=Math.max(J.x,ne.x,re.x,ge.x),G=Math.min(J.y,ne.y,re.y,ge.y),I=Math.max(J.y,ne.y,re.y,ge.y)}var Ne=Q+"Rot",Be=V[Ne]=V[Ne]||{};Be.x1=z,Be.y1=G,Be.x2=P,Be.y2=I,Be.w=P-z,Be.h=I-G,Ra(t,z,G,P,I),Ra(i.labelBounds.all,z,G,P,I)}return t}},sA=function(t,n){if(!n.cy().headless()){var r=n.pstyle("outline-opacity").value,a=n.pstyle("outline-width").value,i=n.pstyle("outline-offset").value,l=a+i;EL(t,n,r,l,"outside",l/2)}},EL=function(t,n,r,a,i,l){if(!(r===0||a<=0||i==="inside")){var o=n.cy(),f=n.pstyle("shape").value,c=o.renderer().nodeShapes[f],d=n.position(),v=d.x,m=d.y,y=n.width(),x=n.height();if(c.hasMiterBounds){i==="center"&&(a/=2);var S=c.miterBounds(v,m,y,x,a);Ps(t,S)}else l!=null&&l>0&&Rv(t,[l,l,l,l])}},cW=function(t,n){if(!n.cy().headless()){var r=n.pstyle("border-opacity").value,a=n.pstyle("border-width").pfValue,i=n.pstyle("border-position").value;EL(t,n,r,a,i)}},fW=function(t,n){var r=t._private.cy,a=r.styleEnabled(),i=r.headless(),l=Tr(),o=t._private,f=t.isNode(),c=t.isEdge(),d,v,m,y,x,S,w=o.rstyle,b=f&&a?t.pstyle("bounds-expansion").pfValue:[0],C=function(st){return st.pstyle("display").value!=="none"},T=!a||C(t)&&(!c||C(t.source())&&C(t.target()));if(T){var k=0,D=0;a&&n.includeOverlays&&(k=t.pstyle("overlay-opacity").value,k!==0&&(D=t.pstyle("overlay-padding").value));var A=0,j=0;a&&n.includeUnderlays&&(A=t.pstyle("underlay-opacity").value,A!==0&&(j=t.pstyle("underlay-padding").value));var L=Math.max(D,j),_=0,M=0;if(a&&(_=t.pstyle("width").pfValue,M=_/2),f&&n.includeNodes){var z=t.position();x=z.x,S=z.y;var P=t.outerWidth(),G=P/2,I=t.outerHeight(),F=I/2;d=x-G,v=x+G,m=S-F,y=S+F,Ra(l,d,m,v,y),a&&sA(l,t),a&&n.includeOutlines&&!i&&sA(l,t),a&&cW(l,t)}else if(c&&n.includeEdges)if(a&&!i){var B=t.pstyle("curve-style").strValue;if(d=Math.min(w.srcX,w.midX,w.tgtX),v=Math.max(w.srcX,w.midX,w.tgtX),m=Math.min(w.srcY,w.midY,w.tgtY),y=Math.max(w.srcY,w.midY,w.tgtY),d-=M,v+=M,m-=M,y+=M,Ra(l,d,m,v,y),B==="haystack"){var H=w.haystackPts;if(H&&H.length===2){if(d=H[0].x,m=H[0].y,v=H[1].x,y=H[1].y,d>v){var K=d;d=v,v=K}if(m>y){var Q=m;m=y,y=Q}Ra(l,d-M,m-M,v+M,y+M)}}else if(B==="bezier"||B==="unbundled-bezier"||Ys(B,"segments")||Ys(B,"taxi")){var V;switch(B){case"bezier":case"unbundled-bezier":V=w.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":V=w.linePts;break}if(V!=null)for(var q=0;q<V.length;q++){var X=V[q];d=X.x-M,v=X.x+M,m=X.y-M,y=X.y+M,Ra(l,d,m,v,y)}}}else{var U=t.source(),te=U.position(),ie=t.target(),oe=ie.position();if(d=te.x,v=oe.x,m=te.y,y=oe.y,d>v){var ae=d;d=v,v=ae}if(m>y){var we=m;m=y,y=we}d-=M,v+=M,m-=M,y+=M,Ra(l,d,m,v,y)}if(a&&n.includeEdges&&c&&(fv(l,t,"mid-source"),fv(l,t,"mid-target"),fv(l,t,"source"),fv(l,t,"target")),a){var fe=t.pstyle("ghost").value==="yes";if(fe){var J=t.pstyle("ghost-offset-x").pfValue,ne=t.pstyle("ghost-offset-y").pfValue;Ra(l,l.x1+J,l.y1+ne,l.x2+J,l.y2+ne)}}var re=o.bodyBounds=o.bodyBounds||{};GN(re,l),Rv(re,b),Av(re,1),a&&(d=l.x1,v=l.x2,m=l.y1,y=l.y2,Ra(l,d-L,m-L,v+L,y+L));var ge=o.overlayBounds=o.overlayBounds||{};GN(ge,l),Rv(ge,b),Av(ge,1);var Ne=o.labelBounds=o.labelBounds||{};Ne.all!=null?$K(Ne.all):Ne.all=Tr(),a&&n.includeLabels&&(n.includeMainLabels&&x0(l,t,null),c&&(n.includeSourceLabels&&x0(l,t,"source"),n.includeTargetLabels&&x0(l,t,"target")))}return l.x1=xa(l.x1),l.y1=xa(l.y1),l.x2=xa(l.x2),l.y2=xa(l.y2),l.w=xa(l.x2-l.x1),l.h=xa(l.y2-l.y1),l.w>0&&l.h>0&&T&&(Rv(l,b),Av(l,1)),l},CL=function(t){var n=0,r=function(l){return(l?1:0)<<n++},a=0;return a+=r(t.incudeNodes),a+=r(t.includeEdges),a+=r(t.includeLabels),a+=r(t.includeMainLabels),a+=r(t.includeSourceLabels),a+=r(t.includeTargetLabels),a+=r(t.includeOverlays),a+=r(t.includeOutlines),a},TL=function(t){var n=function(o){return Math.round(o)};if(t.isEdge()){var r=t.source().position(),a=t.target().position();return IN([n(r.x),n(r.y),n(a.x),n(a.y)])}else{var i=t.position();return IN([n(i.x),n(i.y)])}},lA=function(t,n){var r=t._private,a,i=t.isEdge(),l=n==null?oA:CL(n),o=l===oA;if(r.bbCache==null?(a=fW(t,Zf),r.bbCache=a,r.bbCachePosKey=TL(t)):a=r.bbCache,!o){var f=t.isNode();a=Tr(),(n.includeNodes&&f||n.includeEdges&&!f)&&(n.includeOverlays?Ps(a,r.overlayBounds):Ps(a,r.bodyBounds)),n.includeLabels&&(n.includeMainLabels&&(!i||n.includeSourceLabels&&n.includeTargetLabels)?Ps(a,r.labelBounds.all):(n.includeMainLabels&&Ps(a,r.labelBounds.mainRot),n.includeSourceLabels&&Ps(a,r.labelBounds.sourceRot),n.includeTargetLabels&&Ps(a,r.labelBounds.targetRot))),a.w=a.x2-a.x1,a.h=a.y2-a.y1}return a},Zf={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},oA=CL(Zf),uA=lr(Zf);bl.boundingBox=function(e){var t,n=e===void 0||e.useCache===void 0||e.useCache===!0,r=Qu(function(d){var v=d._private;return v.bbCache==null||v.styleDirty||v.bbCachePosKey!==TL(d)},function(d){return d.id()});if(n&&this.length===1&&!r(this[0]))e===void 0?e=Zf:e=uA(e),t=lA(this[0],e);else{t=Tr(),e=e||Zf;var a=uA(e),i=this,l=i.cy(),o=l.styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),o&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var f=0;f<i.length;f++){var c=i[f];r(c)&&c.dirtyBoundingBoxCache(),Ps(t,lA(c,a))}}return t.x1=xa(t.x1),t.y1=xa(t.y1),t.x2=xa(t.x2),t.y2=xa(t.y2),t.w=xa(t.x2-t.x1),t.h=xa(t.y2-t.y1),t};bl.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};bl.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),a=n.collection();if(r&&(a=t.filter(function(c){return c.isParent()}),t=t.not(a)),Dt(e)){var i=e;e=function(){return i}}var l=function(d,v){return d._private.bbAtOldPos=e(d,v)},o=function(d){return d._private.bbAtOldPos};n.startBatch(),t.forEach(l).silentPositions(e),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var f=GK(this.boundingBox({useCache:!1}));return t.silentPositions(o),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),n.endBatch(),f};Lu.boundingbox=Lu.bb=Lu.boundingBox;Lu.renderedBoundingbox=Lu.renderedBoundingBox;var dW=bl,Rf,Nd;Rf=Nd={};var NL=function(t){t.uppercaseName=CN(t.name),t.autoName="auto"+t.uppercaseName,t.labelName="label"+t.uppercaseName,t.outerName="outer"+t.uppercaseName,t.uppercaseOuterName=CN(t.outerName),Rf[t.name]=function(){var r=this[0],a=r._private,i=a.cy,l=i._private.styleEnabled;if(r)if(l){if(r.isParent())return r.updateCompoundBounds(),a[t.autoName]||0;var o=r.pstyle(t.name);switch(o.strValue){case"label":return r.recalculateRenderedStyle(),a.rstyle[t.labelName]||0;default:return o.pfValue}}else return 1},Rf["outer"+t.uppercaseName]=function(){var r=this[0],a=r._private,i=a.cy,l=i._private.styleEnabled;if(r)if(l){var o=r[t.name](),f=r.pstyle("border-position").value,c;f==="center"?c=r.pstyle("border-width").pfValue:f==="outside"?c=2*r.pstyle("border-width").pfValue:c=0;var d=2*r.padding();return o+c+d}else return 1},Rf["rendered"+t.uppercaseName]=function(){var r=this[0];if(r){var a=r[t.name]();return a*this.cy().zoom()}},Rf["rendered"+t.uppercaseOuterName]=function(){var r=this[0];if(r){var a=r[t.outerName]();return a*this.cy().zoom()}}};NL({name:"width"});NL({name:"height"});Nd.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),t.autoPadding!==void 0?t.autoPadding:e.pstyle("padding").pfValue):e.pstyle("padding").pfValue};Nd.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()};Nd.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var hW=Nd,vW=function(t,n){if(t.isEdge()&&t.takesUpSpace())return n(t)},pW=function(t,n){if(t.isEdge()&&t.takesUpSpace()){var r=t.cy();return Gp(n(t),r.zoom(),r.pan())}},mW=function(t,n){if(t.isEdge()&&t.takesUpSpace()){var r=t.cy(),a=r.pan(),i=r.zoom();return n(t).map(function(l){return Gp(l,i,a)})}},gW=function(t){return t.renderer().getControlPoints(t)},yW=function(t){return t.renderer().getSegmentPoints(t)},xW=function(t){return t.renderer().getSourceEndpoint(t)},bW=function(t){return t.renderer().getTargetEndpoint(t)},wW=function(t){return t.renderer().getEdgeMidpoint(t)},cA={controlPoints:{get:gW,mult:!0},segmentPoints:{get:yW,mult:!0},sourceEndpoint:{get:xW},targetEndpoint:{get:bW},midpoint:{get:wW}},SW=function(t){return"rendered"+t[0].toUpperCase()+t.substr(1)},EW=Object.keys(cA).reduce(function(e,t){var n=cA[t],r=SW(t);return e[t]=function(){return vW(this,n.get)},n.mult?e[r]=function(){return mW(this,n.get)}:e[r]=function(){return pW(this,n.get)},e},{}),CW=nt({},uW,dW,hW,EW);/*!
415
+ Event object based on jQuery events, MIT license
416
+
417
+ https://jquery.org/license/
418
+ https://tldrlegal.com/license/mit-license
419
+ https://github.com/jquery/jquery/blob/master/src/event.js
420
+ */var kL=function(t,n){this.recycle(t,n)};function bf(){return!1}function dv(){return!0}kL.prototype={instanceString:function(){return"event"},recycle:function(t,n){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=bf,t!=null&&t.preventDefault?(this.type=t.type,this.isDefaultPrevented=t.defaultPrevented?dv:bf):t!=null&&t.type?n=t:this.type=t,n!=null&&(this.originalEvent=n.originalEvent,this.type=n.type!=null?n.type:this.type,this.cy=n.cy,this.target=n.target,this.position=n.position,this.renderedPosition=n.renderedPosition,this.namespace=n.namespace,this.layout=n.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var r=this.position,a=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:r.x*a+i.x,y:r.y*a+i.y}}this.timeStamp=t&&t.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=dv;var t=this.originalEvent;t&&t.preventDefault&&t.preventDefault()},stopPropagation:function(){this.isPropagationStopped=dv;var t=this.originalEvent;t&&t.stopPropagation&&t.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=dv,this.stopPropagation()},isDefaultPrevented:bf,isPropagationStopped:bf,isImmediatePropagationStopped:bf};var AL=/^([^.]+)(\.(?:[^.]+))?$/,TW=".*",RL={qualifierCompare:function(t,n){return t===n},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(t){return t},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},fA=Object.keys(RL),NW={};function Zp(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:NW,t=arguments.length>1?arguments[1]:void 0,n=0;n<fA.length;n++){var r=fA[n];this[r]=e[r]||RL[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var dl=Zp.prototype,DL=function(t,n,r,a,i,l,o){fn(a)&&(i=a,a=null),o&&(l==null?l=o:l=nt({},l,o));for(var f=$t(r)?r:r.split(/\s+/),c=0;c<f.length;c++){var d=f[c];if(!ll(d)){var v=d.match(AL);if(v){var m=v[1],y=v[2]?v[2]:null,x=n(t,d,m,y,a,i,l);if(x===!1)break}}}},dA=function(t,n){return t.addEventFields(t.context,n),new kL(n.type,n)},kW=function(t,n,r){if(OY(r)){n(t,r);return}else if(Dt(r)){n(t,dA(t,r));return}for(var a=$t(r)?r:r.split(/\s+/),i=0;i<a.length;i++){var l=a[i];if(!ll(l)){var o=l.match(AL);if(o){var f=o[1],c=o[2]?o[2]:null,d=dA(t,{type:f,namespace:c,target:t.context});n(t,d)}}}};dl.on=dl.addListener=function(e,t,n,r,a){return DL(this,function(i,l,o,f,c,d,v){fn(d)&&i.listeners.push({event:l,callback:d,type:o,namespace:f,qualifier:c,conf:v})},e,t,n,r,a),this};dl.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})};dl.removeListener=dl.off=function(e,t,n,r){var a=this;this.emitting!==0&&(this.listeners=pK(this.listeners));for(var i=this.listeners,l=function(c){var d=i[c];DL(a,function(v,m,y,x,S,w){if((d.type===y||e==="*")&&(!x&&d.namespace!==".*"||d.namespace===x)&&(!S||v.qualifierCompare(d.qualifier,S))&&(!w||d.callback===w))return i.splice(c,1),!1},e,t,n,r)},o=i.length-1;o>=0;o--)l(o);return this};dl.removeAllListeners=function(){return this.removeListener("*")};dl.emit=dl.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,$t(t)||(t=[t]),kW(this,function(i,l){n!=null&&(r=[{event:l.event,type:l.type,namespace:l.namespace,callback:n}],a=r.length);for(var o=function(){var d=r[f];if(d.type===l.type&&(!d.namespace||d.namespace===l.namespace||d.namespace===TW)&&i.eventMatches(i.context,d,l)){var v=[l];t!=null&&gK(v,t),i.beforeEmit(i.context,d,l),d.conf&&d.conf.one&&(i.listeners=i.listeners.filter(function(x){return x!==d}));var m=i.callbackContext(i.context,d,l),y=d.callback.apply(m,v);i.afterEmit(i.context,d,l),y===!1&&(l.stopPropagation(),l.preventDefault())}},f=0;f<a;f++)o();i.bubble(i.context)&&!l.isPropagationStopped()&&i.parent(i.context).emit(l,t)},e),this.emitting--,this};var AW={qualifierCompare:function(t,n){return t==null||n==null?t==null&&n==null:t.sameText(n)},eventMatches:function(t,n,r){var a=n.qualifier;return a!=null?t!==r.target&&bd(r.target)&&a.matches(r.target):!0},addEventFields:function(t,n){n.cy=t.cy(),n.target=t},callbackContext:function(t,n,r){return n.qualifier!=null?r.target:t},beforeEmit:function(t,n){n.conf&&n.conf.once&&n.conf.onceCollection.removeListener(n.event,n.qualifier,n.callback)},bubble:function(){return!0},parent:function(t){return t.isChild()?t.parent():t.cy()}},hv=function(t){return Ze(t)?new cl(t):t},jL={createEmitter:function(){for(var t=0;t<this.length;t++){var n=this[t],r=n._private;r.emitter||(r.emitter=new Zp(AW,n))}return this},emitter:function(){return this._private.emitter},on:function(t,n,r){for(var a=hv(n),i=0;i<this.length;i++){var l=this[i];l.emitter().on(t,a,r)}return this},removeListener:function(t,n,r){for(var a=hv(n),i=0;i<this.length;i++){var l=this[i];l.emitter().removeListener(t,a,r)}return this},removeAllListeners:function(){for(var t=0;t<this.length;t++){var n=this[t];n.emitter().removeAllListeners()}return this},one:function(t,n,r){for(var a=hv(n),i=0;i<this.length;i++){var l=this[i];l.emitter().one(t,a,r)}return this},once:function(t,n,r){for(var a=hv(n),i=0;i<this.length;i++){var l=this[i];l.emitter().on(t,a,r,{once:!0,onceCollection:this})}},emit:function(t,n){for(var r=0;r<this.length;r++){var a=this[r];a.emitter().emit(t,n)}return this},emitAndNotify:function(t,n){if(this.length!==0)return this.cy().notify(t,this),this.emit(t,n),this}};_t.eventAliasesOn(jL);var ML={nodes:function(t){return this.filter(function(n){return n.isNode()}).filter(t)},edges:function(t){return this.filter(function(n){return n.isEdge()}).filter(t)},byGroup:function(){for(var t=this.spawn(),n=this.spawn(),r=0;r<this.length;r++){var a=this[r];a.isNode()?t.push(a):n.push(a)}return{nodes:t,edges:n}},filter:function(t,n){if(t===void 0)return this;if(Ze(t)||ta(t))return new cl(t).filter(this);if(fn(t)){for(var r=this.spawn(),a=this,i=0;i<a.length;i++){var l=a[i],o=n?t.apply(n,[l,i,a]):t(l,i,a);o&&r.push(l)}return r}return this.spawn()},not:function(t){if(t){Ze(t)&&(t=this.filter(t));for(var n=this.spawn(),r=0;r<this.length;r++){var a=this[r],i=t.has(a);i||n.push(a)}return n}else return this},absoluteComplement:function(){var t=this.cy();return t.mutableElements().not(this)},intersect:function(t){if(Ze(t)){var n=t;return this.filter(n)}for(var r=this.spawn(),a=this,i=t,l=this.length<t.length,o=l?a:i,f=l?i:a,c=0;c<o.length;c++){var d=o[c];f.has(d)&&r.push(d)}return r},xor:function(t){var n=this._private.cy;Ze(t)&&(t=n.$(t));var r=this.spawn(),a=this,i=t,l=function(f,c){for(var d=0;d<f.length;d++){var v=f[d],m=v._private.data.id,y=c.hasElementWithId(m);y||r.push(v)}};return l(a,i),l(i,a),r},diff:function(t){var n=this._private.cy;Ze(t)&&(t=n.$(t));var r=this.spawn(),a=this.spawn(),i=this.spawn(),l=this,o=t,f=function(d,v,m){for(var y=0;y<d.length;y++){var x=d[y],S=x._private.data.id,w=v.hasElementWithId(S);w?i.merge(x):m.push(x)}};return f(l,o,r),f(o,l,a),{left:r,right:a,both:i}},add:function(t){var n=this._private.cy;if(!t)return this;if(Ze(t)){var r=t;t=n.mutableElements().filter(r)}for(var a=this.spawnSelf(),i=0;i<t.length;i++){var l=t[i],o=!this.has(l);o&&a.push(l)}return a},merge:function(t){var n=this._private,r=n.cy;if(!t)return this;if(t&&Ze(t)){var a=t;t=r.mutableElements().filter(a)}for(var i=n.map,l=0;l<t.length;l++){var o=t[l],f=o._private.data.id,c=!i.has(f);if(c){var d=this.length++;this[d]=o,i.set(f,{ele:o,index:d})}}return this},unmergeAt:function(t){var n=this[t],r=n.id(),a=this._private,i=a.map;this[t]=void 0,i.delete(r);var l=t===this.length-1;if(this.length>1&&!l){var o=this.length-1,f=this[o],c=f._private.data.id;this[o]=void 0,this[t]=f,i.set(c,{ele:f,index:t})}return this.length--,this},unmergeOne:function(t){t=t[0];var n=this._private,r=t._private.data.id,a=n.map,i=a.get(r);if(!i)return this;var l=i.index;return this.unmergeAt(l),this},unmerge:function(t){var n=this._private.cy;if(!t)return this;if(t&&Ze(t)){var r=t;t=n.mutableElements().filter(r)}for(var a=0;a<t.length;a++)this.unmergeOne(t[a]);return this},unmergeBy:function(t){for(var n=this.length-1;n>=0;n--){var r=this[n];t(r)&&this.unmergeAt(n)}return this},map:function(t,n){for(var r=[],a=this,i=0;i<a.length;i++){var l=a[i],o=n?t.apply(n,[l,i,a]):t(l,i,a);r.push(o)}return r},reduce:function(t,n){for(var r=n,a=this,i=0;i<a.length;i++)r=t(r,a[i],i,a);return r},max:function(t,n){for(var r=-1/0,a,i=this,l=0;l<i.length;l++){var o=i[l],f=n?t.apply(n,[o,l,i]):t(o,l,i);f>r&&(r=f,a=o)}return{value:r,ele:a}},min:function(t,n){for(var r=1/0,a,i=this,l=0;l<i.length;l++){var o=i[l],f=n?t.apply(n,[o,l,i]):t(o,l,i);f<r&&(r=f,a=o)}return{value:r,ele:a}}},Ot=ML;Ot.u=Ot["|"]=Ot["+"]=Ot.union=Ot.or=Ot.add;Ot["\\"]=Ot["!"]=Ot["-"]=Ot.difference=Ot.relativeComplement=Ot.subtract=Ot.not;Ot.n=Ot["&"]=Ot["."]=Ot.and=Ot.intersection=Ot.intersect;Ot["^"]=Ot["(+)"]=Ot["(-)"]=Ot.symmetricDifference=Ot.symdiff=Ot.xor;Ot.fnFilter=Ot.filterFn=Ot.stdFilter=Ot.filter;Ot.complement=Ot.abscomp=Ot.absoluteComplement;var RW={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var t=this[0];if(t)return t._private.group}},OL=function(t,n){var r=t.cy(),a=r.hasCompoundNodes();function i(d){var v=d.pstyle("z-compound-depth");return v.value==="auto"?a?d.zDepth():0:v.value==="bottom"?-1:v.value==="top"?fw:0}var l=i(t)-i(n);if(l!==0)return l;function o(d){var v=d.pstyle("z-index-compare");return v.value==="auto"&&d.isNode()?1:0}var f=o(t)-o(n);if(f!==0)return f;var c=t.pstyle("z-index").value-n.pstyle("z-index").value;return c!==0?c:t.poolIndex()-n.poolIndex()},lp={forEach:function(t,n){if(fn(t))for(var r=this.length,a=0;a<r;a++){var i=this[a],l=n?t.apply(n,[i,a,this]):t(i,a,this);if(l===!1)break}return this},toArray:function(){for(var t=[],n=0;n<this.length;n++)t.push(this[n]);return t},slice:function(t,n){var r=[],a=this.length;n==null&&(n=a),t==null&&(t=0),t<0&&(t=a+t),n<0&&(n=a+n);for(var i=t;i>=0&&i<n&&i<a;i++)r.push(this[i]);return this.spawn(r)},size:function(){return this.length},eq:function(t){return this[t]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(t){if(!fn(t))return this;var n=this.toArray().sort(t);return this.spawn(n)},sortByZIndex:function(){return this.sort(OL)},zDepth:function(){var t=this[0];if(t){var n=t._private,r=n.group;if(r==="nodes"){var a=n.data.parent?t.parents().size():0;return t.isParent()?a:fw-1}else{var i=n.source,l=n.target,o=i.zDepth(),f=l.zDepth();return Math.max(o,f,0)}}}};lp.each=lp.forEach;var DW=function(){var t="undefined",n=(typeof Symbol>"u"?"undefined":In(Symbol))!=t&&In(Symbol.iterator)!=t;n&&(lp[Symbol.iterator]=function(){var r=this,a={value:void 0,done:!1},i=0,l=this.length;return jO({next:function(){return i<l?a.value=r[i++]:(a.value=void 0,a.done=!0),a}},Symbol.iterator,function(){return this})})};DW();var jW=lr({nodeDimensionsIncludeLabels:!1}),jv={layoutDimensions:function(t){t=jW(t);var n;if(!this.takesUpSpace())n={w:0,h:0};else if(t.nodeDimensionsIncludeLabels){var r=this.boundingBox();n={w:r.w,h:r.h}}else n={w:this.outerWidth(),h:this.outerHeight()};return(n.w===0||n.h===0)&&(n.w=n.h=1),n},layoutPositions:function(t,n,r){var a=this.nodes().filter(function(D){return!D.isParent()}),i=this.cy(),l=n.eles,o=function(A){return A.id()},f=Qu(r,o);t.emit({type:"layoutstart",layout:t}),t.animations=[];var c=function(A,j,L){var _={x:j.x1+j.w/2,y:j.y1+j.h/2},M={x:(L.x-_.x)*A,y:(L.y-_.y)*A};return{x:_.x+M.x,y:_.y+M.y}},d=n.spacingFactor&&n.spacingFactor!==1,v=function(){if(!d)return null;for(var A=Tr(),j=0;j<a.length;j++){var L=a[j],_=f(L,j);WO(A,_.x,_.y)}return A},m=v(),y=Qu(function(D,A){var j=f(D,A);if(d){var L=Math.abs(n.spacingFactor);j=c(L,m,j)}return n.transform!=null&&(j=n.transform(D,j)),j},o);if(n.animate){for(var x=0;x<a.length;x++){var S=a[x],w=y(S,x),b=n.animateFilter==null||n.animateFilter(S,x);if(b){var C=S.animation({position:w,duration:n.animationDuration,easing:n.animationEasing});t.animations.push(C)}else S.position(w)}if(n.fit){var T=i.animation({fit:{boundingBox:l.boundingBoxAt(y),padding:n.padding},duration:n.animationDuration,easing:n.animationEasing});t.animations.push(T)}else if(n.zoom!==void 0&&n.pan!==void 0){var k=i.animation({zoom:n.zoom,pan:n.pan,duration:n.animationDuration,easing:n.animationEasing});t.animations.push(k)}t.animations.forEach(function(D){return D.play()}),t.one("layoutready",n.ready),t.emit({type:"layoutready",layout:t}),dc.all(t.animations.map(function(D){return D.promise()})).then(function(){t.one("layoutstop",n.stop),t.emit({type:"layoutstop",layout:t})})}else a.positions(y),n.fit&&i.fit(n.eles,n.padding),n.zoom!=null&&i.zoom(n.zoom),n.pan&&i.pan(n.pan),t.one("layoutready",n.ready),t.emit({type:"layoutready",layout:t}),t.one("layoutstop",n.stop),t.emit({type:"layoutstop",layout:t});return this},layout:function(t){var n=this.cy();return n.makeLayout(nt({},t,{eles:this}))}};jv.createLayout=jv.makeLayout=jv.layout;function LL(e,t,n){var r=n._private,a=r.styleCache=r.styleCache||[],i;return(i=a[e])!=null||(i=a[e]=t(n)),i}function Jp(e,t){return e=mo(e),function(r){return LL(e,t,r)}}function em(e,t){e=mo(e);var n=function(a){return t.call(a)};return function(){var a=this[0];if(a)return LL(e,n,a)}}var ar={recalculateRenderedStyle:function(t){var n=this.cy(),r=n.renderer(),a=n.styleEnabled();return r&&a&&r.recalculateRenderedStyle(this,t),this},dirtyStyleCache:function(){var t=this.cy(),n=function(i){return i._private.styleCache=null};if(t.hasCompoundNodes()){var r;r=this.spawnSelf().merge(this.descendants()).merge(this.parents()),r.merge(r.connectedEdges()),r.forEach(n)}else this.forEach(function(a){n(a),a.connectedEdges().forEach(n)});return this},updateStyle:function(t){var n=this._private.cy;if(!n.styleEnabled())return this;if(n.batching()){var r=n._private.batchStyleEles;return r.merge(this),this}var a=n.hasCompoundNodes(),i=this;t=!!(t||t===void 0),a&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var l=i;return t?l.emitAndNotify("style"):l.emit("style"),i.forEach(function(o){return o._private.styleDirty=!0}),this},cleanStyle:function(){var t=this.cy();if(t.styleEnabled())for(var n=0;n<this.length;n++){var r=this[n];r._private.styleDirty&&(r._private.styleDirty=!1,t.style().apply(r))}},parsedStyle:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this[0],a=r.cy();if(a.styleEnabled()&&r){r._private.styleDirty&&(r._private.styleDirty=!1,a.style().apply(r));var i=r._private.style[t];return i??(n?a.style().getDefaultProperty(t):null)}},numericStyle:function(t){var n=this[0];if(n.cy().styleEnabled()&&n){var r=n.pstyle(t);return r.pfValue!==void 0?r.pfValue:r.value}},numericStyleUnits:function(t){var n=this[0];if(n.cy().styleEnabled()&&n)return n.pstyle(t).units},renderedStyle:function(t){var n=this.cy();if(!n.styleEnabled())return this;var r=this[0];if(r)return n.style().getRenderedStyle(r,t)},style:function(t,n){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,i=r.style();if(Dt(t)){var l=t;i.applyBypass(this,l,a),this.emitAndNotify("style")}else if(Ze(t))if(n===void 0){var o=this[0];return o?i.getStylePropertyValue(o,t):void 0}else i.applyBypass(this,t,n,a),this.emitAndNotify("style");else if(t===void 0){var f=this[0];return f?i.getRawStyle(f):void 0}return this},removeStyle:function(t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style(),i=this;if(t===void 0)for(var l=0;l<i.length;l++){var o=i[l];a.removeAllBypasses(o,r)}else{t=t.split(/\s+/);for(var f=0;f<i.length;f++){var c=i[f];a.removeBypasses(c,t,r)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var t=this.cy();if(!t.styleEnabled())return 1;var n=t.hasCompoundNodes(),r=this[0];if(r){var a=r._private,i=r.pstyle("opacity").value;if(!n)return i;var l=a.data.parent?r.parents():null;if(l)for(var o=0;o<l.length;o++){var f=l[o],c=f.pstyle("opacity").value;i=c*i}return i}},transparent:function(){var t=this.cy();if(!t.styleEnabled())return!1;var n=this[0],r=n.cy().hasCompoundNodes();if(n)return r?n.effectiveOpacity()===0:n.pstyle("opacity").value===0},backgrounding:function(){var t=this.cy();if(!t.styleEnabled())return!1;var n=this[0];return!!n._private.backgrounding}};function b0(e,t){var n=e._private,r=n.data.parent?e.parents():null;if(r)for(var a=0;a<r.length;a++){var i=r[a];if(!t(i))return!1}return!0}function Ew(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var a=this.cy();if(!a.styleEnabled())return!0;var i=this[0],l=a.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!l||b0(i,r);var f=o.source,c=o.target;return n(f)&&(!l||b0(f,n))&&(f===c||n(c)&&(!l||b0(c,n)))}}}var hc=Jp("eleTakesUpSpace",function(e){return e.pstyle("display").value==="element"&&e.width()!==0&&(e.isNode()?e.height()!==0:!0)});ar.takesUpSpace=em("takesUpSpace",Ew({ok:hc}));var MW=Jp("eleInteractive",function(e){return e.pstyle("events").value==="yes"&&e.pstyle("visibility").value==="visible"&&hc(e)}),OW=Jp("parentInteractive",function(e){return e.pstyle("visibility").value==="visible"&&hc(e)});ar.interactive=em("interactive",Ew({ok:MW,parentOk:OW,edgeOkViaNode:hc}));ar.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var LW=Jp("eleVisible",function(e){return e.pstyle("visibility").value==="visible"&&e.pstyle("opacity").pfValue!==0&&hc(e)}),_W=hc;ar.visible=em("visible",Ew({ok:LW,edgeOkViaNode:_W}));ar.hidden=function(){var e=this[0];if(e)return!e.visible()};ar.isBundledBezier=em("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});ar.bypass=ar.css=ar.style;ar.renderedCss=ar.renderedStyle;ar.removeBypass=ar.removeCss=ar.removeStyle;ar.pstyle=ar.parsedStyle;var rl={};function hA(e){return function(){var t=arguments,n=[];if(t.length===2){var r=t[0],a=t[1];this.on(e.event,r,a)}else if(t.length===1&&fn(t[0])){var i=t[0];this.on(e.event,i)}else if(t.length===0||t.length===1&&$t(t[0])){for(var l=t.length===1?t[0]:null,o=0;o<this.length;o++){var f=this[o],c=!e.ableField||f._private[e.ableField],d=f._private[e.field]!=e.value;if(e.overrideAble){var v=e.overrideAble(f);if(v!==void 0&&(c=v,!v))return this}c&&(f._private[e.field]=e.value,d&&n.push(f))}var m=this.spawn(n);m.updateStyle(),m.emit(e.event),l&&m.emit(l)}return this}}function vc(e){rl[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(n!==void 0)return n}return t._private[e.field]}},rl[e.on]=hA({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),rl[e.off]=hA({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}vc({field:"locked",overrideField:function(t){return t.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});vc({field:"grabbable",overrideField:function(t){return t.cy().autoungrabify()||t.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});vc({field:"selected",ableField:"selectable",overrideAble:function(t){return t.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});vc({field:"selectable",overrideField:function(t){return t.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});rl.deselect=rl.unselect;rl.grabbed=function(){var e=this[0];if(e)return e._private.grabbed};vc({field:"active",on:"activate",off:"unactivate"});vc({field:"pannable",on:"panify",off:"unpanify"});rl.inactive=function(){var e=this[0];if(e)return!e._private.active};var pr={},vA=function(t){return function(r){for(var a=this,i=[],l=0;l<a.length;l++){var o=a[l];if(o.isNode()){for(var f=!1,c=o.connectedEdges(),d=0;d<c.length;d++){var v=c[d],m=v.source(),y=v.target();if(t.noIncomingEdges&&y===o&&m!==o||t.noOutgoingEdges&&m===o&&y!==o){f=!0;break}}f||i.push(o)}}return this.spawn(i,!0).filter(r)}},pA=function(t){return function(n){for(var r=this,a=[],i=0;i<r.length;i++){var l=r[i];if(l.isNode())for(var o=l.connectedEdges(),f=0;f<o.length;f++){var c=o[f],d=c.source(),v=c.target();t.outgoing&&d===l?(a.push(c),a.push(v)):t.incoming&&v===l&&(a.push(c),a.push(d))}}return this.spawn(a,!0).filter(n)}},mA=function(t){return function(n){for(var r=this,a=[],i={};;){var l=t.outgoing?r.outgoers():r.incomers();if(l.length===0)break;for(var o=!1,f=0;f<l.length;f++){var c=l[f],d=c.id();i[d]||(i[d]=!0,a.push(c),o=!0)}if(!o)break;r=l}return this.spawn(a,!0).filter(n)}};pr.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null};nt(pr,{roots:vA({noIncomingEdges:!0}),leaves:vA({noOutgoingEdges:!0}),outgoers:ba(pA({outgoing:!0}),"outgoers"),successors:mA({outgoing:!0}),incomers:ba(pA({incoming:!0}),"incomers"),predecessors:mA({})});nt(pr,{neighborhood:ba(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var a=n[r],i=a.connectedEdges(),l=0;l<i.length;l++){var o=i[l],f=o.source(),c=o.target(),d=a===f?c:f;d.length>0&&t.push(d[0]),t.push(o[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(t){return this.neighborhood().add(this).filter(t)},openNeighborhood:function(t){return this.neighborhood(t)}});pr.neighbourhood=pr.neighborhood;pr.closedNeighbourhood=pr.closedNeighborhood;pr.openNeighbourhood=pr.openNeighborhood;nt(pr,{source:ba(function(t){var n=this[0],r;return n&&(r=n._private.source||n.cy().collection()),r&&t?r.filter(t):r},"source"),target:ba(function(t){var n=this[0],r;return n&&(r=n._private.target||n.cy().collection()),r&&t?r.filter(t):r},"target"),sources:gA({attr:"source"}),targets:gA({attr:"target"})});function gA(e){return function(n){for(var r=[],a=0;a<this.length;a++){var i=this[a],l=i._private[e.attr];l&&r.push(l)}return this.spawn(r,!0).filter(n)}}nt(pr,{edgesWith:ba(yA(),"edgesWith"),edgesTo:ba(yA({thisIsSrc:!0}),"edgesTo")});function yA(e){return function(n){var r=[],a=this._private.cy,i=e||{};Ze(n)&&(n=a.$(n));for(var l=0;l<n.length;l++)for(var o=n[l]._private.edges,f=0;f<o.length;f++){var c=o[f],d=c._private.data,v=this.hasElementWithId(d.source)&&n.hasElementWithId(d.target),m=n.hasElementWithId(d.source)&&this.hasElementWithId(d.target),y=v||m;y&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!v||i.thisIsTgt&&!m)||r.push(c))}return this.spawn(r,!0)}}nt(pr,{connectedEdges:ba(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var a=n[r];if(a.isNode())for(var i=a._private.edges,l=0;l<i.length;l++){var o=i[l];t.push(o)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:ba(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var a=n[r];a.isEdge()&&(t.push(a.source()[0]),t.push(a.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:ba(xA(),"parallelEdges"),codirectedEdges:ba(xA({codirected:!0}),"codirectedEdges")});function xA(e){var t={codirected:!1};return e=nt({},t,e),function(r){for(var a=[],i=this.edges(),l=e,o=0;o<i.length;o++)for(var f=i[o],c=f._private,d=c.source,v=d._private.data.id,m=c.data.target,y=d._private.edges,x=0;x<y.length;x++){var S=y[x],w=S._private.data,b=w.target,C=w.source,T=b===m&&C===v,k=v===b&&m===C;(l.codirected&&T||!l.codirected&&(T||k))&&a.push(S)}return this.spawn(a,!0).filter(r)}}nt(pr,{components:function(t){var n=this,r=n.cy(),a=r.collection(),i=t==null?n.nodes():t.nodes(),l=[];t!=null&&i.empty()&&(i=t.sources());var o=function(d,v){a.merge(d),i.unmerge(d),v.merge(d)};if(i.empty())return n.spawn();var f=function(){var d=r.collection();l.push(d);var v=i[0];o(v,d),n.bfs({directed:!1,roots:v,visit:function(y){return o(y,d)}}),d.forEach(function(m){m.connectedEdges().forEach(function(y){n.has(y)&&d.has(y.source())&&d.has(y.target())&&d.merge(y)})})};do f();while(i.length>0);return l},component:function(){var t=this[0];return t.cy().mutableElements().components(t)[0]}});pr.componentsOf=pr.components;var ir=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t===void 0){sn("A collection must have a reference to the core");return}var i=new Ui,l=!1;if(!n)n=[];else if(n.length>0&&Dt(n[0])&&!bd(n[0])){l=!0;for(var o=[],f=new fc,c=0,d=n.length;c<d;c++){var v=n[c];v.data==null&&(v.data={});var m=v.data;if(m.id==null)m.id=KO();else if(t.hasElementWithId(m.id)||f.has(m.id))continue;var y=new Hp(t,v,!1);o.push(y),f.add(m.id)}n=o}this.length=0;for(var x=0,S=n.length;x<S;x++){var w=n[x][0];if(w!=null){var b=w._private.data.id;(!r||!i.has(b))&&(r&&i.set(b,{index:this.length,ele:w}),this[this.length]=w,this.length++)}}this._private={eles:this,cy:t,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(C){this.lazyMap=C},rebuildMap:function(){for(var T=this.lazyMap=new Ui,k=this.eles,D=0;D<k.length;D++){var A=k[D];T.set(A.id(),{index:D,ele:A})}}},r&&(this._private.map=i),l&&!a&&this.restore()},Zt=Hp.prototype=ir.prototype=Object.create(Array.prototype);Zt.instanceString=function(){return"collection"};Zt.spawn=function(e,t){return new ir(this.cy(),e,t)};Zt.spawnSelf=function(){return this.spawn(this)};Zt.cy=function(){return this._private.cy};Zt.renderer=function(){return this._private.cy.renderer()};Zt.element=function(){return this[0]};Zt.collection=function(){return LO(this)?this:new ir(this._private.cy,[this])};Zt.unique=function(){return new ir(this._private.cy,this,!0)};Zt.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)};Zt.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new ir(t)};Zt.$id=Zt.getElementById;Zt.poolIndex=function(){var e=this._private.cy,t=e._private.elements,n=this[0]._private.data.id;return t._private.map.get(n).index};Zt.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index};Zt.indexOfId=function(e){return e=""+e,this._private.map.get(e).index};Zt.json=function(e){var t=this.element(),n=this.cy();if(t==null&&e)return this;if(t!=null){var r=t._private;if(Dt(e)){if(n.startBatch(),e.data){t.data(e.data);var a=r.data;if(t.isEdge()){var i=!1,l={},o=e.data.source,f=e.data.target;o!=null&&o!=a.source&&(l.source=""+o,i=!0),f!=null&&f!=a.target&&(l.target=""+f,i=!0),i&&(t=t.move(l))}else{var c="parent"in e.data,d=e.data.parent;c&&(d!=null||a.parent!=null)&&d!=a.parent&&(d===void 0&&(d=null),d!=null&&(d=""+d),t=t.move({parent:d}))}}e.position&&t.position(e.position);var v=function(S,w,b){var C=e[S];C!=null&&C!==r[S]&&(C?t[w]():t[b]())};return v("removed","remove","restore"),v("selected","select","unselect"),v("selectable","selectify","unselectify"),v("locked","lock","unlock"),v("grabbable","grabify","ungrabify"),v("pannable","panify","unpanify"),e.classes!=null&&t.classes(e.classes),n.endBatch(),this}else if(e===void 0){var m={data:ti(r.data),position:ti(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};m.classes="";var y=0;return r.classes.forEach(function(x){return m.classes+=y++===0?x:" "+x}),m}}};Zt.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t],r=n.json();e.push(r)}return e};Zt.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n],a=r.json(),i=new Hp(e,a,!1);t.push(i)}return new ir(e,t)};Zt.copy=Zt.clone;Zt.restore=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=n.cy(),a=r._private,i=[],l=[],o,f=0,c=n.length;f<c;f++){var d=n[f];t&&!d.removed()||(d.isNode()?i.push(d):l.push(d))}o=i.concat(l);var v,m=function(){o.splice(v,1),v--};for(v=0;v<o.length;v++){var y=o[v],x=y._private,S=x.data;if(y.clearTraversalCache(),!(!t&&!x.removed)){if(S.id===void 0)S.id=KO();else if(Re(S.id))S.id=""+S.id;else if(ll(S.id)||!Ze(S.id)){sn("Can not create element with invalid string ID `"+S.id+"`"),m();continue}else if(r.hasElementWithId(S.id)){sn("Can not create second element with ID `"+S.id+"`"),m();continue}}var w=S.id;if(y.isNode()){var b=x.position;b.x==null&&(b.x=0),b.y==null&&(b.y=0)}if(y.isEdge()){for(var C=y,T=["source","target"],k=T.length,D=!1,A=0;A<k;A++){var j=T[A],L=S[j];Re(L)&&(L=S[j]=""+S[j]),L==null||L===""?(sn("Can not create edge `"+w+"` with unspecified "+j),D=!0):r.hasElementWithId(L)||(sn("Can not create edge `"+w+"` with nonexistant "+j+" `"+L+"`"),D=!0)}if(D){m();continue}var _=r.getElementById(S.source),M=r.getElementById(S.target);_.same(M)?_._private.edges.push(C):(_._private.edges.push(C),M._private.edges.push(C)),C._private.source=_,C._private.target=M}x.map=new Ui,x.map.set(w,{ele:y,index:0}),x.removed=!1,t&&r.addToPool(y)}for(var z=0;z<i.length;z++){var P=i[z],G=P._private.data;Re(G.parent)&&(G.parent=""+G.parent);var I=G.parent,F=I!=null;if(F||P._private.parent){var B=P._private.parent?r.collection().merge(P._private.parent):r.getElementById(I);if(B.empty())G.parent=void 0;else if(B[0].removed())Bt("Node added with missing parent, reference to parent removed"),G.parent=void 0,P._private.parent=null;else{for(var H=!1,K=B;!K.empty();){if(P.same(K)){H=!0,G.parent=void 0;break}K=K.parent()}H||(B[0]._private.children.push(P),P._private.parent=B[0],a.hasCompoundNodes=!0)}}}if(o.length>0){for(var Q=o.length===n.length?n:new ir(r,o),V=0;V<Q.length;V++){var q=Q[V];q.isNode()||(q.parallelEdges().clearTraversalCache(),q.source().clearTraversalCache(),q.target().clearTraversalCache())}var X;a.hasCompoundNodes?X=r.collection().merge(Q).merge(Q.connectedNodes()).merge(Q.parent()):X=Q,X.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?Q.emitAndNotify("add"):t&&Q.emit("add")}return n};Zt.removed=function(){var e=this[0];return e&&e._private.removed};Zt.inside=function(){var e=this[0];return e&&!e._private.removed};Zt.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=[],a={},i=n._private.cy;function l(I){for(var F=I._private.edges,B=0;B<F.length;B++)f(F[B])}function o(I){for(var F=I._private.children,B=0;B<F.length;B++)f(F[B])}function f(I){var F=a[I.id()];t&&I.removed()||F||(a[I.id()]=!0,I.isNode()?(r.push(I),l(I),o(I)):r.unshift(I))}for(var c=0,d=n.length;c<d;c++){var v=n[c];f(v)}function m(I,F){var B=I._private.edges;ol(B,F),I.clearTraversalCache()}function y(I){I.clearTraversalCache()}var x=[];x.ids={};function S(I,F){F=F[0],I=I[0];var B=I._private.children,H=I.id();ol(B,F),F._private.parent=null,x.ids[H]||(x.ids[H]=!0,x.push(I))}n.dirtyCompoundBoundsCache(),t&&i.removeFromPool(r);for(var w=0;w<r.length;w++){var b=r[w];if(b.isEdge()){var C=b.source()[0],T=b.target()[0];m(C,b),m(T,b);for(var k=b.parallelEdges(),D=0;D<k.length;D++){var A=k[D];y(A),A.isBundledBezier()&&A.dirtyBoundingBoxCache()}}else{var j=b.parent();j.length!==0&&S(j,b)}t&&(b._private.removed=!0)}var L=i._private.elements;i._private.hasCompoundNodes=!1;for(var _=0;_<L.length;_++){var M=L[_];if(M.isParent()){i._private.hasCompoundNodes=!0;break}}var z=new ir(this.cy(),r);z.size()>0&&(e?z.emitAndNotify("remove"):t&&z.emit("remove"));for(var P=0;P<x.length;P++){var G=x[P];(!t||!G.removed())&&G.updateStyle()}return z};Zt.move=function(e){var t=this._private.cy,n=this,r=!1,a=!1,i=function(x){return x==null?x:""+x};if(e.source!==void 0||e.target!==void 0){var l=i(e.source),o=i(e.target),f=l!=null&&t.hasElementWithId(l),c=o!=null&&t.hasElementWithId(o);(f||c)&&(t.batch(function(){n.remove(r,a),n.emitAndNotify("moveout");for(var y=0;y<n.length;y++){var x=n[y],S=x._private.data;x.isEdge()&&(f&&(S.source=l),c&&(S.target=o))}n.restore(r,a)}),n.emitAndNotify("move"))}else if(e.parent!==void 0){var d=i(e.parent),v=d===null||t.hasElementWithId(d);if(v){var m=d===null?void 0:d;t.batch(function(){var y=n.remove(r,a);y.emitAndNotify("moveout");for(var x=0;x<n.length;x++){var S=n[x],w=S._private.data;S.isNode()&&(w.parent=m)}y.restore(r,a)}),n.emitAndNotify("move")}}return this};[sL,$Q,Dv,nl,Zu,oW,Wp,CW,jL,ML,RW,lp,jv,ar,rl,pr].forEach(function(e){nt(Zt,e)});var BW={add:function(t){var n,r=this;if(ta(t)){var a=t;if(a._private.cy===r)n=a.restore();else{for(var i=[],l=0;l<a.length;l++){var o=a[l];i.push(o.json())}n=new ir(r,i)}}else if($t(t)){var f=t;n=new ir(r,f)}else if(Dt(t)&&($t(t.nodes)||$t(t.edges))){for(var c=t,d=[],v=["nodes","edges"],m=0,y=v.length;m<y;m++){var x=v[m],S=c[x];if($t(S))for(var w=0,b=S.length;w<b;w++){var C=nt({group:x},S[w]);d.push(C)}}n=new ir(r,d)}else{var T=t;n=new Hp(r,T).collection()}return n},remove:function(t){if(!ta(t)){if(Ze(t)){var n=t;t=this.$(n)}}return t.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function PW(e,t,n,r){var a=4,i=.001,l=1e-7,o=10,f=11,c=1/(f-1),d=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var v=0;v<4;++v)if(typeof arguments[v]!="number"||isNaN(arguments[v])||!isFinite(arguments[v]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var m=d?new Float32Array(f):new Array(f);function y(M,z){return 1-3*z+3*M}function x(M,z){return 3*z-6*M}function S(M){return 3*M}function w(M,z,P){return((y(z,P)*M+x(z,P))*M+S(z))*M}function b(M,z,P){return 3*y(z,P)*M*M+2*x(z,P)*M+S(z)}function C(M,z){for(var P=0;P<a;++P){var G=b(z,e,n);if(G===0)return z;var I=w(z,e,n)-M;z-=I/G}return z}function T(){for(var M=0;M<f;++M)m[M]=w(M*c,e,n)}function k(M,z,P){var G,I,F=0;do I=z+(P-z)/2,G=w(I,e,n)-M,G>0?P=I:z=I;while(Math.abs(G)>l&&++F<o);return I}function D(M){for(var z=0,P=1,G=f-1;P!==G&&m[P]<=M;++P)z+=c;--P;var I=(M-m[P])/(m[P+1]-m[P]),F=z+I*c,B=b(F,e,n);return B>=i?C(M,F):B===0?F:k(M,z,z+c)}var A=!1;function j(){A=!0,(e!==t||n!==r)&&T()}var L=function(z){return A||j(),e===t&&n===r?z:z===0?0:z===1?1:w(D(z),t,r)};L.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var _="generateBezier("+[e,t,n,r]+")";return L.toString=function(){return _},L}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var zW=(function(){function e(r){return-r.tension*r.x-r.friction*r.v}function t(r,a,i){var l={x:r.x+i.dx*a,v:r.v+i.dv*a,tension:r.tension,friction:r.friction};return{dx:l.v,dv:e(l)}}function n(r,a){var i={dx:r.v,dv:e(r)},l=t(r,a*.5,i),o=t(r,a*.5,l),f=t(r,a,o),c=1/6*(i.dx+2*(l.dx+o.dx)+f.dx),d=1/6*(i.dv+2*(l.dv+o.dv)+f.dv);return r.x=r.x+c*a,r.v=r.v+d*a,r}return function r(a,i,l){var o={x:-1,v:0,tension:null,friction:null},f=[0],c=0,d=1/1e4,v=16/1e3,m,y,x;for(a=parseFloat(a)||500,i=parseFloat(i)||20,l=l||null,o.tension=a,o.friction=i,m=l!==null,m?(c=r(a,i),y=c/l*v):y=v;x=n(x||o,y),f.push(1+x.x),c+=16,Math.abs(x.x)>d&&Math.abs(x.v)>d;);return m?function(S){return f[S*(f.length-1)|0]}:c}})(),Xt=function(t,n,r,a){var i=PW(t,n,r,a);return function(l,o,f){return l+(o-l)*i(f)}},Mv={linear:function(t,n,r){return t+(n-t)*r},ease:Xt(.25,.1,.25,1),"ease-in":Xt(.42,0,1,1),"ease-out":Xt(0,0,.58,1),"ease-in-out":Xt(.42,0,.58,1),"ease-in-sine":Xt(.47,0,.745,.715),"ease-out-sine":Xt(.39,.575,.565,1),"ease-in-out-sine":Xt(.445,.05,.55,.95),"ease-in-quad":Xt(.55,.085,.68,.53),"ease-out-quad":Xt(.25,.46,.45,.94),"ease-in-out-quad":Xt(.455,.03,.515,.955),"ease-in-cubic":Xt(.55,.055,.675,.19),"ease-out-cubic":Xt(.215,.61,.355,1),"ease-in-out-cubic":Xt(.645,.045,.355,1),"ease-in-quart":Xt(.895,.03,.685,.22),"ease-out-quart":Xt(.165,.84,.44,1),"ease-in-out-quart":Xt(.77,0,.175,1),"ease-in-quint":Xt(.755,.05,.855,.06),"ease-out-quint":Xt(.23,1,.32,1),"ease-in-out-quint":Xt(.86,0,.07,1),"ease-in-expo":Xt(.95,.05,.795,.035),"ease-out-expo":Xt(.19,1,.22,1),"ease-in-out-expo":Xt(1,0,0,1),"ease-in-circ":Xt(.6,.04,.98,.335),"ease-out-circ":Xt(.075,.82,.165,1),"ease-in-out-circ":Xt(.785,.135,.15,.86),spring:function(t,n,r){if(r===0)return Mv.linear;var a=zW(t,n,r);return function(i,l,o){return i+(l-i)*a(o)}},"cubic-bezier":Xt};function bA(e,t,n,r,a){if(r===1||t===n)return n;var i=a(t,n,r);return e==null||((e.roundValue||e.color)&&(i=Math.round(i)),e.min!==void 0&&(i=Math.max(i,e.min)),e.max!==void 0&&(i=Math.min(i,e.max))),i}function wA(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!=="%")?e.pfValue:e.value:e}function vu(e,t,n,r,a){var i=a!=null?a.type:null;n<0?n=0:n>1&&(n=1);var l=wA(e,a),o=wA(t,a);if(Re(l)&&Re(o))return bA(i,l,o,n,r);if($t(l)&&$t(o)){for(var f=[],c=0;c<o.length;c++){var d=l[c],v=o[c];if(d!=null&&v!=null){var m=bA(i,d,v,n,r);f.push(m)}else f.push(v)}return f}}function IW(e,t,n,r){var a=!r,i=e._private,l=t._private,o=l.easing,f=l.startTime,c=r?e:e.cy(),d=c.style();if(!l.easingImpl)if(o==null)l.easingImpl=Mv.linear;else{var v;if(Ze(o)){var m=d.parse("transition-timing-function",o);v=m.value}else v=o;var y,x;Ze(v)?(y=v,x=[]):(y=v[1],x=v.slice(2).map(function(Q){return+Q})),x.length>0?(y==="spring"&&x.push(l.duration),l.easingImpl=Mv[y].apply(null,x)):l.easingImpl=Mv[y]}var S=l.easingImpl,w;if(l.duration===0?w=1:w=(n-f)/l.duration,l.applying&&(w=l.progress),w<0?w=0:w>1&&(w=1),l.delay==null){var b=l.startPosition,C=l.position;if(C&&a&&!e.locked()){var T={};wf(b.x,C.x)&&(T.x=vu(b.x,C.x,w,S)),wf(b.y,C.y)&&(T.y=vu(b.y,C.y,w,S)),e.position(T)}var k=l.startPan,D=l.pan,A=i.pan,j=D!=null&&r;j&&(wf(k.x,D.x)&&(A.x=vu(k.x,D.x,w,S)),wf(k.y,D.y)&&(A.y=vu(k.y,D.y,w,S)),e.emit("pan"));var L=l.startZoom,_=l.zoom,M=_!=null&&r;M&&(wf(L,_)&&(i.zoom=Xf(i.minZoom,vu(L,_,w,S),i.maxZoom)),e.emit("zoom")),(j||M)&&e.emit("viewport");var z=l.style;if(z&&z.length>0&&a){for(var P=0;P<z.length;P++){var G=z[P],I=G.name,F=G,B=l.startStyle[I],H=d.properties[B.name],K=vu(B,F,w,S,H);d.overrideBypass(e,I,K)}e.emit("style")}}return l.progress=w,w}function wf(e,t){return e==null||t==null?!1:Re(e)&&Re(t)?!0:!!(e&&t)}function FW(e,t,n,r){var a=t._private;a.started=!0,a.startTime=n-a.progress*a.duration}function SA(e,t){var n=t._private.aniEles,r=[];function a(d,v){var m=d._private,y=m.animation.current,x=m.animation.queue,S=!1;if(y.length===0){var w=x.shift();w&&y.push(w)}for(var b=function(A){for(var j=A.length-1;j>=0;j--){var L=A[j];L()}A.splice(0,A.length)},C=y.length-1;C>=0;C--){var T=y[C],k=T._private;if(k.stopped){y.splice(C,1),k.hooked=!1,k.playing=!1,k.started=!1,b(k.frames);continue}!k.playing&&!k.applying||(k.playing&&k.applying&&(k.applying=!1),k.started||FW(d,T,e),IW(d,T,e,v),k.applying&&(k.applying=!1),b(k.frames),k.step!=null&&k.step(e),T.completed()&&(y.splice(C,1),k.hooked=!1,k.playing=!1,k.started=!1,b(k.completes)),S=!0)}return!v&&y.length===0&&x.length===0&&r.push(d),S}for(var i=!1,l=0;l<n.length;l++){var o=n[l],f=a(o);i=i||f}var c=a(t,!0);(i||c)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var qW={animate:_t.animate(),animation:_t.animation(),animated:_t.animated(),clearQueue:_t.clearQueue(),delay:_t.delay(),delayAnimation:_t.delayAnimation(),stop:_t.stop(),addToAnimationPool:function(t){var n=this;n.styleEnabled()&&n._private.aniEles.merge(t)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var t=this;if(t._private.animationsRunning=!0,!t.styleEnabled())return;function n(){t._private.animationsRunning&&np(function(i){SA(i,t),n()})}var r=t.renderer();r&&r.beforeRender?r.beforeRender(function(i,l){SA(l,t)},r.beforeRenderPriorities.animations):n()}},UW={qualifierCompare:function(t,n){return t==null||n==null?t==null&&n==null:t.sameText(n)},eventMatches:function(t,n,r){var a=n.qualifier;return a!=null?t!==r.target&&bd(r.target)&&a.matches(r.target):!0},addEventFields:function(t,n){n.cy=t,n.target=t},callbackContext:function(t,n,r){return n.qualifier!=null?r.target:t}},vv=function(t){return Ze(t)?new cl(t):t},_L={createEmitter:function(){var t=this._private;return t.emitter||(t.emitter=new Zp(UW,this)),this},emitter:function(){return this._private.emitter},on:function(t,n,r){return this.emitter().on(t,vv(n),r),this},removeListener:function(t,n,r){return this.emitter().removeListener(t,vv(n),r),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(t,n,r){return this.emitter().one(t,vv(n),r),this},once:function(t,n,r){return this.emitter().one(t,vv(n),r),this},emit:function(t,n){return this.emitter().emit(t,n),this},emitAndNotify:function(t,n){return this.emit(t),this.notify(t,n),this}};_t.eventAliasesOn(_L);var zb={png:function(t){var n=this._private.renderer;return t=t||{},n.png(t)},jpg:function(t){var n=this._private.renderer;return t=t||{},t.bg=t.bg||"#fff",n.jpg(t)}};zb.jpeg=zb.jpg;var Ov={layout:function(t){var n=this;if(t==null){sn("Layout options must be specified to make a layout");return}if(t.name==null){sn("A `name` must be specified to make a layout");return}var r=t.name,a=n.extension("layout",r);if(a==null){sn("No such layout `"+r+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;Ze(t.eles)?i=n.$(t.eles):i=t.eles!=null?t.eles:n.$();var l=new a(nt({},t,{cy:n,eles:i}));return l}};Ov.createLayout=Ov.makeLayout=Ov.layout;var VW={notify:function(t,n){var r=this._private;if(this.batching()){r.batchNotifications=r.batchNotifications||{};var a=r.batchNotifications[t]=r.batchNotifications[t]||this.collection();n!=null&&a.merge(n);return}if(r.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(t,n)}},notifications:function(t){var n=this._private;return t===void 0?n.notificationsEnabled:(n.notificationsEnabled=!!t,this)},noNotifications:function(t){this.notifications(!1),t(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var t=this._private;return t.batchCount==null&&(t.batchCount=0),t.batchCount===0&&(t.batchStyleEles=this.collection(),t.batchNotifications={}),t.batchCount++,this},endBatch:function(){var t=this._private;if(t.batchCount===0)return this;if(t.batchCount--,t.batchCount===0){t.batchStyleEles.updateStyle();var n=this.renderer();Object.keys(t.batchNotifications).forEach(function(r){var a=t.batchNotifications[r];a.empty()?n.notify(r):n.notify(r,a)})}return this},batch:function(t){return this.startBatch(),t(),this.endBatch(),this},batchData:function(t){var n=this;return this.batch(function(){for(var r=Object.keys(t),a=0;a<r.length;a++){var i=r[a],l=t[i],o=n.getElementById(i);o.data(l)}})}},HW=lr({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),Ib={renderTo:function(t,n,r,a){var i=this._private.renderer;return i.renderTo(t,n,r,a),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(t){var n=this,r=n.extension("renderer",t.name);if(r==null){sn("Can not initialise: No such renderer `".concat(t.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}t.wheelSensitivity!==void 0&&Bt("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var a=HW(t);a.cy=n,n._private.renderer=new r(a),this.notify("init")},destroyRenderer:function(){var t=this;t.notify("destroy");var n=t.container();if(n)for(n._cyreg=null;n.childNodes.length>0;)n.removeChild(n.childNodes[0]);t._private.renderer=null,t.mutableElements().forEach(function(r){var a=r._private;a.rscratch={},a.rstyle={},a.animation.current=[],a.animation.queue=[]})},onRender:function(t){return this.on("render",t)},offRender:function(t){return this.off("render",t)}};Ib.invalidateDimensions=Ib.resize;var Lv={collection:function(t,n){return Ze(t)?this.$(t):ta(t)?t.collection():$t(t)?(n||(n={}),new ir(this,t,n.unique,n.removed)):new ir(this)},nodes:function(t){var n=this.$(function(r){return r.isNode()});return t?n.filter(t):n},edges:function(t){var n=this.$(function(r){return r.isEdge()});return t?n.filter(t):n},$:function(t){var n=this._private.elements;return t?n.filter(t):n.spawnSelf()},mutableElements:function(){return this._private.elements}};Lv.elements=Lv.filter=Lv.$;var Wn={},_f="t",GW="f";Wn.apply=function(e){for(var t=this,n=t._private,r=n.cy,a=r.collection(),i=0;i<e.length;i++){var l=e[i],o=t.getContextMeta(l);if(!o.empty){var f=t.getContextStyle(o),c=t.applyContextStyle(o,f,l);l._private.appliedInitStyle?t.updateTransitions(l,c.diffProps):l._private.appliedInitStyle=!0;var d=t.updateStyleHints(l);d&&a.push(l)}}return a};Wn.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},a=e+"-"+t,i=r[a];if(i)return i;for(var l=[],o={},f=0;f<n.length;f++){var c=n[f],d=e[f]===_f,v=t[f]===_f,m=d!==v,y=c.mappedProperties.length>0;if(m||v&&y){var x=void 0;m&&y||m?x=c.properties:y&&(x=c.mappedProperties);for(var S=0;S<x.length;S++){for(var w=x[S],b=w.name,C=!1,T=f+1;T<n.length;T++){var k=n[T],D=t[T]===_f;if(D&&(C=k.properties[w.name]!=null,C))break}!o[b]&&!C&&(o[b]=!0,l.push(b))}}}return r[a]=l,l};Wn.getContextMeta=function(e){for(var t=this,n="",r,a=e._private.styleCxtKey||"",i=0;i<t.length;i++){var l=t[i],o=l.selector&&l.selector.matches(e);o?n+=_f:n+=GW}return r=t.getPropertiesDiff(a,n),e._private.styleCxtKey=n,{key:n,diffPropNames:r,empty:r.length===0}};Wn.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var a={_private:{key:t}},i=0;i<n.length;i++){var l=n[i],o=t[i]===_f;if(o)for(var f=0;f<l.properties.length;f++){var c=l.properties[f];a[c.name]=c}}return r[t]=a,a};Wn.applyContextStyle=function(e,t,n){for(var r=this,a=e.diffPropNames,i={},l=r.types,o=0;o<a.length;o++){var f=a[o],c=t[f],d=n.pstyle(f);if(!c)if(d)d.bypass?c={name:f,deleteBypassed:!0}:c={name:f,delete:!0};else continue;if(d!==c){if(c.mapped===l.fn&&d!=null&&d.mapping!=null&&d.mapping.value===c.value){var v=d.mapping,m=v.fnValue=c.value(n);if(m===v.prevFnValue)continue}var y=i[f]={prev:d};r.applyParsedProperty(n,c),y.next=n.pstyle(f),y.next&&y.next.bypass&&(y.next=y.next.bypassed)}}return{diffProps:i}};Wn.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,a=n.propertyGroupKeys,i=function(re,ge,Ne){return n.getPropertiesHash(re,ge,Ne)},l=t.styleKey;if(e.removed())return!1;var o=t.group==="nodes",f=e._private.style;r=Object.keys(f);for(var c=0;c<a.length;c++){var d=a[c];t.styleKeys[d]=[$l,wu]}for(var v=function(re,ge){return t.styleKeys[ge][0]=$f(re,t.styleKeys[ge][0])},m=function(re,ge){return t.styleKeys[ge][1]=Yf(re,t.styleKeys[ge][1])},y=function(re,ge){v(re,ge),m(re,ge)},x=function(re,ge){for(var Ne=0;Ne<re.length;Ne++){var Be=re.charCodeAt(Ne);v(Be,ge),m(Be,ge)}},S=2e9,w=function(re){return-128<re&&re<128&&Math.floor(re)!==re?S-(re*1024|0):re},b=0;b<r.length;b++){var C=r[b],T=f[C];if(T!=null){var k=this.properties[C],D=k.type,A=k.groupKey,j=void 0;k.hashOverride!=null?j=k.hashOverride(e,T):T.pfValue!=null&&(j=T.pfValue);var L=k.enums==null?T.value:null,_=j!=null,M=L!=null,z=_||M,P=T.units;if(D.number&&z&&!D.multiple){var G=_?j:L;y(w(G),A),!_&&P!=null&&x(P,A)}else x(T.strValue,A)}}for(var I=[$l,wu],F=0;F<a.length;F++){var B=a[F],H=t.styleKeys[B];I[0]=$f(H[0],I[0]),I[1]=Yf(H[1],I[1])}t.styleKey=lK(I[0],I[1]);var K=t.styleKeys;t.labelDimsKey=Ms(K.labelDimensions);var Q=i(e,["label"],K.labelDimensions);if(t.labelKey=Ms(Q),t.labelStyleKey=Ms(sv(K.commonLabel,Q)),!o){var V=i(e,["source-label"],K.labelDimensions);t.sourceLabelKey=Ms(V),t.sourceLabelStyleKey=Ms(sv(K.commonLabel,V));var q=i(e,["target-label"],K.labelDimensions);t.targetLabelKey=Ms(q),t.targetLabelStyleKey=Ms(sv(K.commonLabel,q))}if(o){var X=t.styleKeys,U=X.nodeBody,te=X.nodeBorder,ie=X.nodeOutline,oe=X.backgroundImage,ae=X.compound,we=X.pie,fe=X.stripe,J=[U,te,ie,oe,ae,we,fe].filter(function(ne){return ne!=null}).reduce(sv,[$l,wu]);t.nodeKey=Ms(J),t.hasPie=we!=null&&we[0]!==$l&&we[1]!==wu,t.hasStripe=fe!=null&&fe[0]!==$l&&fe[1]!==wu}return l!==t.styleKey};Wn.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null,t.hasStripe=null};Wn.applyParsedProperty=function(e,t){var n=this,r=t,a=e._private.style,i,l=n.types,o=n.properties[r.name].type,f=r.bypass,c=a[r.name],d=c&&c.bypass,v=e._private,m="mapping",y=function(U){return U==null?null:U.pfValue!=null?U.pfValue:U.value},x=function(){var U=y(c),te=y(r);n.checkTriggers(e,r.name,U,te)};if(t.name==="curve-style"&&e.isEdge()&&(t.value!=="bezier"&&e.isLoop()||t.value==="haystack"&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,"bezier",f)),r.delete)return a[r.name]=void 0,x(),!0;if(r.deleteBypassed)return c?c.bypass?(c.bypassed=void 0,x(),!0):!1:(x(),!0);if(r.deleteBypass)return c?c.bypass?(a[r.name]=c.bypassed,x(),!0):!1:(x(),!0);var S=function(){Bt("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case l.mapData:{for(var w=r.field.split("."),b=v.data,C=0;C<w.length&&b;C++){var T=w[C];b=b[T]}if(b==null)return S(),!1;var k;if(Re(b)){var D=r.fieldMax-r.fieldMin;D===0?k=0:k=(b-r.fieldMin)/D}else return Bt("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+": "+b+"` for `"+e.id()+"` is non-numeric)"),!1;if(k<0?k=0:k>1&&(k=1),o.color){var A=r.valueMin[0],j=r.valueMax[0],L=r.valueMin[1],_=r.valueMax[1],M=r.valueMin[2],z=r.valueMax[2],P=r.valueMin[3]==null?1:r.valueMin[3],G=r.valueMax[3]==null?1:r.valueMax[3],I=[Math.round(A+(j-A)*k),Math.round(L+(_-L)*k),Math.round(M+(z-M)*k),Math.round(P+(G-P)*k)];i={bypass:r.bypass,name:r.name,value:I,strValue:"rgb("+I[0]+", "+I[1]+", "+I[2]+")"}}else if(o.number){var F=r.valueMin+(r.valueMax-r.valueMin)*k;i=this.parse(r.name,F,r.bypass,m)}else return!1;if(!i)return S(),!1;i.mapping=r,r=i;break}case l.data:{for(var B=r.field.split("."),H=v.data,K=0;K<B.length&&H;K++){var Q=B[K];H=H[Q]}if(H!=null&&(i=this.parse(r.name,H,r.bypass,m)),!i)return S(),!1;i.mapping=r,r=i;break}case l.fn:{var V=r.value,q=r.fnValue!=null?r.fnValue:V(e);if(r.prevFnValue=q,q==null)return Bt("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(i=this.parse(r.name,q,r.bypass,m),!i)return Bt("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;i.mapping=ti(r),r=i;break}case void 0:break;default:return!1}return f?(d?r.bypassed=c.bypassed:r.bypassed=c,a[r.name]=r):d?c.bypassed=r:a[r.name]=r,x(),!0};Wn.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!t)r._private.style={};else for(var a=r._private.style,i=Object.keys(a),l=0;l<i.length;l++){var o=i[l],f=a[o];f!=null&&(f.bypass?f.bypassed=null:a[o]=null)}}};Wn.update=function(){var e=this._private.cy,t=e.mutableElements();t.updateStyle()};Wn.updateTransitions=function(e,t){var n=this,r=e._private,a=e.pstyle("transition-property").value,i=e.pstyle("transition-duration").pfValue,l=e.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var o={},f=!1,c=0;c<a.length;c++){var d=a[c],v=e.pstyle(d),m=t[d];if(m){var y=m.prev,x=y,S=m.next!=null?m.next:v,w=!1,b=void 0,C=1e-6;x&&(Re(x.pfValue)&&Re(S.pfValue)?(w=S.pfValue-x.pfValue,b=x.pfValue+C*w):Re(x.value)&&Re(S.value)?(w=S.value-x.value,b=x.value+C*w):$t(x.value)&&$t(S.value)&&(w=x.value[0]!==S.value[0]||x.value[1]!==S.value[1]||x.value[2]!==S.value[2],b=x.strValue),w&&(o[d]=S.strValue,this.applyBypass(e,d,b),f=!0))}}if(!f)return;r.transitioning=!0,new dc(function(T){l>0?e.delayAnimation(l).play().promise().then(T):T()}).then(function(){return e.animation({style:o,duration:i,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)};Wn.checkTrigger=function(e,t,n,r,a,i){var l=this.properties[t],o=a(l);e.removed()||o!=null&&o(n,r,e)&&i(l)};Wn.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,function(i){return i.triggersZOrder},function(){a._private.cy.notify("zorder",e)})};Wn.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBounds},function(a){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})};Wn.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBoundsOfConnectedEdges},function(a){e.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};Wn.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBoundsOfParallelEdges},function(a){e.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};Wn.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var kd={};kd.applyBypass=function(e,t,n,r){var a=this,i=[],l=!0;if(t==="*"||t==="**"){if(n!==void 0)for(var o=0;o<a.properties.length;o++){var f=a.properties[o],c=f.name,d=this.parse(c,n,!0);d&&i.push(d)}}else if(Ze(t)){var v=this.parse(t,n,!0);v&&i.push(v)}else if(Dt(t)){var m=t;r=n;for(var y=Object.keys(m),x=0;x<y.length;x++){var S=y[x],w=m[S];if(w===void 0&&(w=m[Up(S)]),w!==void 0){var b=this.parse(S,w,!0);b&&i.push(b)}}}else return!1;if(i.length===0)return!1;for(var C=!1,T=0;T<e.length;T++){for(var k=e[T],D={},A=void 0,j=0;j<i.length;j++){var L=i[j];if(r){var _=k.pstyle(L.name);A=D[L.name]={prev:_}}C=this.applyParsedProperty(k,ti(L))||C,r&&(A.next=k.pstyle(L.name))}C&&this.updateStyleHints(k),r&&this.updateTransitions(k,D,l)}return C};kd.overrideBypass=function(e,t,n){t=uw(t);for(var r=0;r<e.length;r++){var a=e[r],i=a._private.style[t],l=this.properties[t].type,o=l.color,f=l.mutiple,c=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(a,t,n):(i.value=n,i.pfValue!=null&&(i.pfValue=n),o?i.strValue="rgb("+n.join(",")+")":f?i.strValue=n.join(" "):i.strValue=""+n,this.updateStyleHints(a)),this.checkTriggers(a,t,c,n)}};kd.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)};kd.removeBypasses=function(e,t,n){for(var r=!0,a=0;a<e.length;a++){for(var i=e[a],l={},o=0;o<t.length;o++){var f=t[o],c=this.properties[f],d=i.pstyle(c.name);if(!(!d||!d.bypass)){var v="",m=this.parse(f,v,!0),y=l[c.name]={prev:d};this.applyParsedProperty(i,m),y.next=i.pstyle(c.name)}}this.updateStyleHints(i),n&&this.updateTransitions(i,l,r)}};var Cw={};Cw.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return e!=null?parseFloat(e):1};Cw.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var li={};li.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)};li.getRawStyle=function(e,t){var n=this;if(e=e[0],e){for(var r={},a=0;a<n.properties.length;a++){var i=n.properties[a],l=n.getStylePropertyValue(e,i.name,t);l!=null&&(r[i.name]=l,r[Up(i.name)]=l)}return r}};li.getIndexedStyle=function(e,t,n,r){var a=e.pstyle(t)[n][r];return a??e.cy().style().getDefaultProperty(t)[n][0]};li.getStylePropertyValue=function(e,t,n){var r=this;if(e=e[0],e){var a=r.properties[t];a.alias&&(a=a.pointsTo);var i=a.type,l=e.pstyle(a.name);if(l){var o=l.value,f=l.units,c=l.strValue;if(n&&i.number&&o!=null&&Re(o)){var d=e.cy().zoom(),v=function(w){return w*d},m=function(w,b){return v(w)+b},y=$t(o),x=y?f.every(function(S){return S!=null}):f!=null;return x?y?o.map(function(S,w){return m(S,f[w])}).join(" "):m(o,f):y?o.map(function(S){return Ze(S)?S:""+v(S)}).join(" "):""+v(o)}else if(c!=null)return c}return null}};li.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var a=t[r],i=a.name,l=e.pstyle(i);l!==void 0&&(Dt(l)?l=this.parse(i,l.strValue):l=this.parse(i,l)),l&&(n[i]=l)}return n};li.getPropsList=function(e){var t=this,n=[],r=e,a=t.properties;if(r)for(var i=Object.keys(r),l=0;l<i.length;l++){var o=i[l],f=r[o],c=a[o]||a[uw(o)],d=this.parse(c.name,f);d&&n.push(d)}return n};li.getNonDefaultPropertiesHash=function(e,t,n){var r=n.slice(),a,i,l,o,f,c;for(f=0;f<t.length;f++)if(a=t[f],i=e.pstyle(a,!1),i!=null)if(i.pfValue!=null)r[0]=$f(o,r[0]),r[1]=Yf(o,r[1]);else for(l=i.strValue,c=0;c<l.length;c++)o=l.charCodeAt(c),r[0]=$f(o,r[0]),r[1]=Yf(o,r[1]);return r};li.getPropertiesHash=li.getNonDefaultPropertiesHash;var tm={};tm.appendFromJson=function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],a=r.selector,i=r.style||r.css,l=Object.keys(i);t.selector(a);for(var o=0;o<l.length;o++){var f=l[o],c=i[f];t.css(f,c)}}return t};tm.fromJson=function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t};tm.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,a=n.properties,i={},l=0;l<a.length;l++){var o=a[l];i[o.name]=o.strValue}e.push({selector:r?r.toString():"core",style:i})}return e};var Tw={};Tw.appendFromString=function(e){var t=this,n=this,r=""+e,a,i,l;r=r.replace(/[/][*](\s|.)+?[*][/]/g,"");function o(){r.length>a.length?r=r.substr(a.length):r=""}function f(){i.length>l.length?i=i.substr(l.length):i=""}for(;;){var c=r.match(/^\s*$/);if(c)break;var d=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!d){Bt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+r);break}a=d[0];var v=d[1];if(v!=="core"){var m=new cl(v);if(m.invalid){Bt("Skipping parsing of block: Invalid selector found in string stylesheet: "+v),o();continue}}var y=d[2],x=!1;i=y;for(var S=[];;){var w=i.match(/^\s*$/);if(w)break;var b=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!b){Bt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+y),x=!0;break}l=b[0];var C=b[1],T=b[2],k=t.properties[C];if(!k){Bt("Skipping property: Invalid property name in: "+l),f();continue}var D=n.parse(C,T);if(!D){Bt("Skipping property: Invalid property definition in: "+l),f();continue}S.push({name:C,val:T}),f()}if(x){o();break}n.selector(v);for(var A=0;A<S.length;A++){var j=S[A];n.css(j.name,j.val)}o()}return n};Tw.fromString=function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t};var jn={};(function(){var e=zn,t=IY,n=qY,r=UY,a=VY,i=function(ne){return"^"+ne+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},l=function(ne){var re=e+"|\\w+|"+t+"|"+n+"|"+r+"|"+a;return"^"+ne+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+re+")\\s*\\,\\s*("+re+")\\)$"},o=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];jn.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:l("mapData")},mapLayoutData:{mapping:!0,regex:l("mapLayoutData")},mapScratch:{mapping:!0,regex:l("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:o,singleRegexMatchValue:!0},urls:{regexes:o,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(ne,re){switch(ne.length){case 2:return re[0]!=="deg"&&re[0]!=="rad"&&re[1]!=="deg"&&re[1]!=="rad";case 1:return Ze(ne[0])||re[0]==="deg"||re[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(ne){var re=ne.length;return re===1||re===2||re===4}}};var f={zeroNonZero:function(ne,re){return(ne==null||re==null)&&ne!==re||ne==0&&re!=0?!0:ne!=0&&re==0},any:function(ne,re){return ne!=re},emptyNonEmpty:function(ne,re){var ge=ll(ne),Ne=ll(re);return ge&&!Ne||!ge&&Ne}},c=jn.types,d=[{name:"label",type:c.text,triggersBounds:f.any,triggersZOrder:f.emptyNonEmpty},{name:"text-rotation",type:c.textRotation,triggersBounds:f.any},{name:"text-margin-x",type:c.bidirectionalSize,triggersBounds:f.any},{name:"text-margin-y",type:c.bidirectionalSize,triggersBounds:f.any}],v=[{name:"source-label",type:c.text,triggersBounds:f.any},{name:"source-text-rotation",type:c.textRotation,triggersBounds:f.any},{name:"source-text-margin-x",type:c.bidirectionalSize,triggersBounds:f.any},{name:"source-text-margin-y",type:c.bidirectionalSize,triggersBounds:f.any},{name:"source-text-offset",type:c.size,triggersBounds:f.any}],m=[{name:"target-label",type:c.text,triggersBounds:f.any},{name:"target-text-rotation",type:c.textRotation,triggersBounds:f.any},{name:"target-text-margin-x",type:c.bidirectionalSize,triggersBounds:f.any},{name:"target-text-margin-y",type:c.bidirectionalSize,triggersBounds:f.any},{name:"target-text-offset",type:c.size,triggersBounds:f.any}],y=[{name:"font-family",type:c.fontFamily,triggersBounds:f.any},{name:"font-style",type:c.fontStyle,triggersBounds:f.any},{name:"font-weight",type:c.fontWeight,triggersBounds:f.any},{name:"font-size",type:c.size,triggersBounds:f.any},{name:"text-transform",type:c.textTransform,triggersBounds:f.any},{name:"text-wrap",type:c.textWrap,triggersBounds:f.any},{name:"text-overflow-wrap",type:c.textOverflowWrap,triggersBounds:f.any},{name:"text-max-width",type:c.size,triggersBounds:f.any},{name:"text-outline-width",type:c.size,triggersBounds:f.any},{name:"line-height",type:c.positiveNumber,triggersBounds:f.any}],x=[{name:"text-valign",type:c.valign,triggersBounds:f.any},{name:"text-halign",type:c.halign,triggersBounds:f.any},{name:"color",type:c.color},{name:"text-outline-color",type:c.color},{name:"text-outline-opacity",type:c.zeroOneNumber},{name:"text-background-color",type:c.color},{name:"text-background-opacity",type:c.zeroOneNumber},{name:"text-background-padding",type:c.size,triggersBounds:f.any},{name:"text-border-opacity",type:c.zeroOneNumber},{name:"text-border-color",type:c.color},{name:"text-border-width",type:c.size,triggersBounds:f.any},{name:"text-border-style",type:c.borderStyle,triggersBounds:f.any},{name:"text-background-shape",type:c.textBackgroundShape,triggersBounds:f.any},{name:"text-justification",type:c.justification},{name:"box-select-labels",type:c.bool,triggersBounds:f.any}],S=[{name:"events",type:c.bool,triggersZOrder:f.any},{name:"text-events",type:c.bool,triggersZOrder:f.any},{name:"box-selection",type:c.boxSelection,triggersZOrder:f.any}],w=[{name:"display",type:c.display,triggersZOrder:f.any,triggersBounds:f.any,triggersBoundsOfConnectedEdges:f.any,triggersBoundsOfParallelEdges:function(ne,re,ge){return ne===re?!1:ge.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:c.visibility,triggersZOrder:f.any},{name:"opacity",type:c.zeroOneNumber,triggersZOrder:f.zeroNonZero},{name:"text-opacity",type:c.zeroOneNumber},{name:"min-zoomed-font-size",type:c.size},{name:"z-compound-depth",type:c.zCompoundDepth,triggersZOrder:f.any},{name:"z-index-compare",type:c.zIndexCompare,triggersZOrder:f.any},{name:"z-index",type:c.number,triggersZOrder:f.any}],b=[{name:"overlay-padding",type:c.size,triggersBounds:f.any},{name:"overlay-color",type:c.color},{name:"overlay-opacity",type:c.zeroOneNumber,triggersBounds:f.zeroNonZero},{name:"overlay-shape",type:c.overlayShape,triggersBounds:f.any},{name:"overlay-corner-radius",type:c.cornerRadius}],C=[{name:"underlay-padding",type:c.size,triggersBounds:f.any},{name:"underlay-color",type:c.color},{name:"underlay-opacity",type:c.zeroOneNumber,triggersBounds:f.zeroNonZero},{name:"underlay-shape",type:c.overlayShape,triggersBounds:f.any},{name:"underlay-corner-radius",type:c.cornerRadius}],T=[{name:"transition-property",type:c.propList},{name:"transition-duration",type:c.time},{name:"transition-delay",type:c.time},{name:"transition-timing-function",type:c.easing}],k=function(ne,re){return re.value==="label"?-ne.poolIndex():re.pfValue},D=[{name:"height",type:c.nodeSize,triggersBounds:f.any,hashOverride:k},{name:"width",type:c.nodeSize,triggersBounds:f.any,hashOverride:k},{name:"shape",type:c.nodeShape,triggersBounds:f.any},{name:"shape-polygon-points",type:c.polygonPointList,triggersBounds:f.any},{name:"corner-radius",type:c.cornerRadius},{name:"background-color",type:c.color},{name:"background-fill",type:c.fill},{name:"background-opacity",type:c.zeroOneNumber},{name:"background-blacken",type:c.nOneOneNumber},{name:"background-gradient-stop-colors",type:c.colors},{name:"background-gradient-stop-positions",type:c.percentages},{name:"background-gradient-direction",type:c.gradientDirection},{name:"padding",type:c.sizeMaybePercent,triggersBounds:f.any},{name:"padding-relative-to",type:c.paddingRelativeTo,triggersBounds:f.any},{name:"bounds-expansion",type:c.boundsExpansion,triggersBounds:f.any}],A=[{name:"border-color",type:c.color},{name:"border-opacity",type:c.zeroOneNumber},{name:"border-width",type:c.size,triggersBounds:f.any},{name:"border-style",type:c.borderStyle},{name:"border-cap",type:c.lineCap},{name:"border-join",type:c.lineJoin},{name:"border-dash-pattern",type:c.numbers},{name:"border-dash-offset",type:c.number},{name:"border-position",type:c.linePosition}],j=[{name:"outline-color",type:c.color},{name:"outline-opacity",type:c.zeroOneNumber},{name:"outline-width",type:c.size,triggersBounds:f.any},{name:"outline-style",type:c.borderStyle},{name:"outline-offset",type:c.size,triggersBounds:f.any}],L=[{name:"background-image",type:c.urls},{name:"background-image-crossorigin",type:c.bgCrossOrigin},{name:"background-image-opacity",type:c.zeroOneNumbers},{name:"background-image-containment",type:c.bgContainment},{name:"background-image-smoothing",type:c.bools},{name:"background-position-x",type:c.bgPos},{name:"background-position-y",type:c.bgPos},{name:"background-width-relative-to",type:c.bgRelativeTo},{name:"background-height-relative-to",type:c.bgRelativeTo},{name:"background-repeat",type:c.bgRepeat},{name:"background-fit",type:c.bgFit},{name:"background-clip",type:c.bgClip},{name:"background-width",type:c.bgWH},{name:"background-height",type:c.bgWH},{name:"background-offset-x",type:c.bgPos},{name:"background-offset-y",type:c.bgPos}],_=[{name:"position",type:c.position,triggersBounds:f.any},{name:"compound-sizing-wrt-labels",type:c.compoundIncludeLabels,triggersBounds:f.any},{name:"min-width",type:c.size,triggersBounds:f.any},{name:"min-width-bias-left",type:c.sizeMaybePercent,triggersBounds:f.any},{name:"min-width-bias-right",type:c.sizeMaybePercent,triggersBounds:f.any},{name:"min-height",type:c.size,triggersBounds:f.any},{name:"min-height-bias-top",type:c.sizeMaybePercent,triggersBounds:f.any},{name:"min-height-bias-bottom",type:c.sizeMaybePercent,triggersBounds:f.any}],M=[{name:"line-style",type:c.lineStyle},{name:"line-color",type:c.color},{name:"line-fill",type:c.fill},{name:"line-cap",type:c.lineCap},{name:"line-opacity",type:c.zeroOneNumber},{name:"line-dash-pattern",type:c.numbers},{name:"line-dash-offset",type:c.number},{name:"line-outline-width",type:c.size},{name:"line-outline-color",type:c.color},{name:"line-gradient-stop-colors",type:c.colors},{name:"line-gradient-stop-positions",type:c.percentages},{name:"curve-style",type:c.curveStyle,triggersBounds:f.any,triggersBoundsOfParallelEdges:function(ne,re){return ne===re?!1:ne==="bezier"||re==="bezier"}},{name:"haystack-radius",type:c.zeroOneNumber,triggersBounds:f.any},{name:"source-endpoint",type:c.edgeEndpoint,triggersBounds:f.any},{name:"target-endpoint",type:c.edgeEndpoint,triggersBounds:f.any},{name:"control-point-step-size",type:c.size,triggersBounds:f.any},{name:"control-point-distances",type:c.bidirectionalSizes,triggersBounds:f.any},{name:"control-point-weights",type:c.numbers,triggersBounds:f.any},{name:"segment-distances",type:c.bidirectionalSizes,triggersBounds:f.any},{name:"segment-weights",type:c.numbers,triggersBounds:f.any},{name:"segment-radii",type:c.numbers,triggersBounds:f.any},{name:"radius-type",type:c.radiusType,triggersBounds:f.any},{name:"taxi-turn",type:c.bidirectionalSizeMaybePercent,triggersBounds:f.any},{name:"taxi-turn-min-distance",type:c.size,triggersBounds:f.any},{name:"taxi-direction",type:c.axisDirection,triggersBounds:f.any},{name:"taxi-radius",type:c.number,triggersBounds:f.any},{name:"edge-distances",type:c.edgeDistances,triggersBounds:f.any},{name:"arrow-scale",type:c.positiveNumber,triggersBounds:f.any},{name:"loop-direction",type:c.angle,triggersBounds:f.any},{name:"loop-sweep",type:c.angle,triggersBounds:f.any},{name:"source-distance-from-node",type:c.size,triggersBounds:f.any},{name:"target-distance-from-node",type:c.size,triggersBounds:f.any}],z=[{name:"ghost",type:c.bool,triggersBounds:f.any},{name:"ghost-offset-x",type:c.bidirectionalSize,triggersBounds:f.any},{name:"ghost-offset-y",type:c.bidirectionalSize,triggersBounds:f.any},{name:"ghost-opacity",type:c.zeroOneNumber}],P=[{name:"selection-box-color",type:c.color},{name:"selection-box-opacity",type:c.zeroOneNumber},{name:"selection-box-border-color",type:c.color},{name:"selection-box-border-width",type:c.size},{name:"active-bg-color",type:c.color},{name:"active-bg-opacity",type:c.zeroOneNumber},{name:"active-bg-size",type:c.size},{name:"outside-texture-bg-color",type:c.color},{name:"outside-texture-bg-opacity",type:c.zeroOneNumber}],G=[];jn.pieBackgroundN=16,G.push({name:"pie-size",type:c.sizeMaybePercent}),G.push({name:"pie-hole",type:c.sizeMaybePercent}),G.push({name:"pie-start-angle",type:c.angle});for(var I=1;I<=jn.pieBackgroundN;I++)G.push({name:"pie-"+I+"-background-color",type:c.color}),G.push({name:"pie-"+I+"-background-size",type:c.percent}),G.push({name:"pie-"+I+"-background-opacity",type:c.zeroOneNumber});var F=[];jn.stripeBackgroundN=16,F.push({name:"stripe-size",type:c.sizeMaybePercent}),F.push({name:"stripe-direction",type:c.axisDirectionPrimary});for(var B=1;B<=jn.stripeBackgroundN;B++)F.push({name:"stripe-"+B+"-background-color",type:c.color}),F.push({name:"stripe-"+B+"-background-size",type:c.percent}),F.push({name:"stripe-"+B+"-background-opacity",type:c.zeroOneNumber});var H=[],K=jn.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:c.arrowShape,triggersBounds:f.any},{name:"arrow-color",type:c.color},{name:"arrow-fill",type:c.arrowFill},{name:"arrow-width",type:c.arrowWidth}].forEach(function(J){K.forEach(function(ne){var re=ne+"-"+J.name,ge=J.type,Ne=J.triggersBounds;H.push({name:re,type:ge,triggersBounds:Ne})})},{});var Q=jn.properties=[].concat(S,T,w,b,C,z,x,y,d,v,m,D,A,j,L,G,F,_,M,H,P),V=jn.propertyGroups={behavior:S,transition:T,visibility:w,overlay:b,underlay:C,ghost:z,commonLabel:x,labelDimensions:y,mainLabel:d,sourceLabel:v,targetLabel:m,nodeBody:D,nodeBorder:A,nodeOutline:j,backgroundImage:L,pie:G,stripe:F,compound:_,edgeLine:M,edgeArrow:H,core:P},q=jn.propertyGroupNames={},X=jn.propertyGroupKeys=Object.keys(V);X.forEach(function(J){q[J]=V[J].map(function(ne){return ne.name}),V[J].forEach(function(ne){return ne.groupKey=J})});var U=jn.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];jn.propertyNames=Q.map(function(J){return J.name});for(var te=0;te<Q.length;te++){var ie=Q[te];Q[ie.name]=ie}for(var oe=0;oe<U.length;oe++){var ae=U[oe],we=Q[ae.pointsTo],fe={name:ae.name,alias:!0,pointsTo:we};Q.push(fe),Q[ae.name]=fe}})();jn.getDefaultProperty=function(e){return this.getDefaultProperties()[e]};jn.getDefaultProperties=function(){var e=this._private;if(e.defaultProperties!=null)return e.defaultProperties;for(var t=nt({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(f,c){for(var d=1;d<=jn.pieBackgroundN;d++){var v=c.name.replace("{{i}}",d),m=c.value;f[v]=m}return f},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(f,c){for(var d=1;d<=jn.stripeBackgroundN;d++){var v=c.name.replace("{{i}}",d),m=c.value;f[v]=m}return f},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(f,c){return jn.arrowPrefixes.forEach(function(d){var v=d+"-"+c.name,m=c.value;f[v]=m}),f},{})),n={},r=0;r<this.properties.length;r++){var a=this.properties[r];if(!a.pointsTo){var i=a.name,l=t[i],o=this.parse(i,l);n[i]=o}}return e.defaultProperties=n,e.defaultProperties};jn.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var nm={};nm.parse=function(e,t,n,r){var a=this;if(fn(t))return a.parseImplWarn(e,t,n,r);var i=r==="mapping"||r===!0||r===!1||r==null?"dontcare":r,l=n?"t":"f",o=""+t,f=GO(e,o,l,i),c=a.propCache=a.propCache||[],d;return(d=c[f])||(d=c[f]=a.parseImplWarn(e,t,n,r)),(n||r==="mapping")&&(d=ti(d),d&&(d.value=ti(d.value))),d};nm.parseImplWarn=function(e,t,n,r){var a=this.parseImpl(e,t,n,r);return!a&&t!=null&&Bt("The style property `".concat(e,": ").concat(t,"` is invalid")),a&&(a.name==="width"||a.name==="height")&&t==="label"&&Bt("The style value of `label` is deprecated for `"+a.name+"`"),a};nm.parseImpl=function(e,t,n,r){var a=this;e=uw(e);var i=a.properties[e],l=t,o=a.types;if(!i||t===void 0)return null;i.alias&&(i=i.pointsTo,e=i.name);var f=Ze(t);f&&(t=t.trim());var c=i.type;if(!c)return null;if(n&&(t===""||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(fn(t))return{name:e,value:t,strValue:"fn",mapped:o.fn,bypass:n};var d,v;if(!(!f||r||t.length<7||t[1]!=="a")){if(t.length>=7&&t[0]==="d"&&(d=new RegExp(o.data.regex).exec(t))){if(n)return!1;var m=o.data;return{name:e,value:d,strValue:""+t,mapped:m,field:d[1],bypass:n}}else if(t.length>=10&&t[0]==="m"&&(v=new RegExp(o.mapData.regex).exec(t))){if(n||c.multiple)return!1;var y=o.mapData;if(!(c.color||c.number))return!1;var x=this.parse(e,v[4]);if(!x||x.mapped)return!1;var S=this.parse(e,v[5]);if(!S||S.mapped)return!1;if(x.pfValue===S.pfValue||x.strValue===S.strValue)return Bt("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+x.strValue+"`"),this.parse(e,x.strValue);if(c.color){var w=x.value,b=S.value,C=w[0]===b[0]&&w[1]===b[1]&&w[2]===b[2]&&(w[3]===b[3]||(w[3]==null||w[3]===1)&&(b[3]==null||b[3]===1));if(C)return!1}return{name:e,value:v,strValue:""+t,mapped:y,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:x.value,valueMax:S.value,bypass:n}}}if(c.multiple&&r!=="multiple"){var T;if(f?T=t.split(/\s+/):$t(t)?T=t:T=[t],c.evenMultiple&&T.length%2!==0)return null;for(var k=[],D=[],A=[],j="",L=!1,_=0;_<T.length;_++){var M=a.parse(e,T[_],n,"multiple");L=L||Ze(M.value),k.push(M.value),A.push(M.pfValue!=null?M.pfValue:M.value),D.push(M.units),j+=(_>0?" ":"")+M.strValue}return c.validate&&!c.validate(k,D)?null:c.singleEnum&&L?k.length===1&&Ze(k[0])?{name:e,value:k[0],strValue:k[0],bypass:n}:null:{name:e,value:k,pfValue:A,strValue:j,bypass:n,units:D}}var z=function(){for(var fe=0;fe<c.enums.length;fe++){var J=c.enums[fe];if(J===t)return{name:e,value:t,strValue:""+t,bypass:n}}return null};if(c.number){var P,G="px";if(c.units&&(P=c.units),c.implicitUnits&&(G=c.implicitUnits),!c.unitless)if(f){var I="px|em"+(c.allowPercent?"|\\%":"");P&&(I=P);var F=t.match("^("+zn+")("+I+")?$");F&&(t=F[1],P=F[2]||G)}else(!P||c.implicitUnits)&&(P=G);if(t=parseFloat(t),isNaN(t)&&c.enums===void 0)return null;if(isNaN(t)&&c.enums!==void 0)return t=l,z();if(c.integer&&!MY(t)||c.min!==void 0&&(t<c.min||c.strictMin&&t===c.min)||c.max!==void 0&&(t>c.max||c.strictMax&&t===c.max))return null;var B={name:e,value:t,strValue:""+t+(P||""),units:P,bypass:n};return c.unitless||P!=="px"&&P!=="em"?B.pfValue=t:B.pfValue=P==="px"||!P?t:this.getEmSizeInPixels()*t,(P==="ms"||P==="s")&&(B.pfValue=P==="ms"?t:1e3*t),(P==="deg"||P==="rad")&&(B.pfValue=P==="rad"?t:UK(t)),P==="%"&&(B.pfValue=t/100),B}else if(c.propList){var H=[],K=""+t;if(K!=="none"){for(var Q=K.split(/\s*,\s*|\s+/),V=0;V<Q.length;V++){var q=Q[V].trim();a.properties[q]?H.push(q):Bt("`"+q+"` is not a valid property name")}if(H.length===0)return null}return{name:e,value:H,strValue:H.length===0?"none":H.join(" "),bypass:n}}else if(c.color){var X=zO(t);return X?{name:e,value:X,pfValue:X,strValue:"rgb("+X[0]+","+X[1]+","+X[2]+")",bypass:n}:null}else if(c.regex||c.regexes){if(c.enums){var U=z();if(U)return U}for(var te=c.regexes?c.regexes:[c.regex],ie=0;ie<te.length;ie++){var oe=new RegExp(te[ie]),ae=oe.exec(t);if(ae)return{name:e,value:c.singleRegexMatchValue?ae[1]:ae,strValue:""+t,bypass:n}}return null}else return c.string?{name:e,value:""+t,strValue:""+t,bypass:n}:c.enums?z():null};var Qn=function(t){if(!(this instanceof Qn))return new Qn(t);if(!ow(t)){sn("A style must have a core reference");return}this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()},mr=Qn.prototype;mr.instanceString=function(){return"style"};mr.clear=function(){for(var e=this._private,t=e.cy,n=t.elements(),r=0;r<this.length;r++)this[r]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(n,!0),n.forEach(function(a){var i=a[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};mr.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};mr.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)};mr.selector=function(e){var t=e==="core"?null:new cl(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this};mr.css=function(){var e=this,t=arguments;if(t.length===1)for(var n=t[0],r=0;r<e.properties.length;r++){var a=e.properties[r],i=n[a.name];i===void 0&&(i=n[Up(a.name)]),i!==void 0&&this.cssRule(a.name,i)}else t.length===2&&this.cssRule(t[0],t[1]);return this};mr.style=mr.css;mr.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.name.match(/stripe-(\d+)-background-size/)&&n.value&&(this._private.hasStripe=!0),n.mapped&&this[r].mappedProperties.push(n);var a=!this[r].selector;a&&(this._private.coreStyle[n.name]=n)}return this};mr.append=function(e){return _O(e)?e.appendToStyle(this):$t(e)?this.appendFromJson(e):Ze(e)&&this.appendFromString(e),this};Qn.fromJson=function(e,t){var n=new Qn(e);return n.fromJson(t),n};Qn.fromString=function(e,t){return new Qn(e).fromString(t)};[Wn,kd,Cw,li,tm,Tw,jn,nm].forEach(function(e){nt(mr,e)});Qn.types=mr.types;Qn.properties=mr.properties;Qn.propertyGroups=mr.propertyGroups;Qn.propertyGroupNames=mr.propertyGroupNames;Qn.propertyGroupKeys=mr.propertyGroupKeys;var $W={style:function(t){if(t){var n=this.setStyle(t);n.update()}return this._private.style},setStyle:function(t){var n=this._private;return _O(t)?n.style=t.generateStyle(this):$t(t)?n.style=Qn.fromJson(this,t):Ze(t)?n.style=Qn.fromString(this,t):n.style=Qn(this),n.style},updateStyle:function(){this.mutableElements().updateStyle()}},YW="single",xo={autolock:function(t){if(t!==void 0)this._private.autolock=!!t;else return this._private.autolock;return this},autoungrabify:function(t){if(t!==void 0)this._private.autoungrabify=!!t;else return this._private.autoungrabify;return this},autounselectify:function(t){if(t!==void 0)this._private.autounselectify=!!t;else return this._private.autounselectify;return this},selectionType:function(t){var n=this._private;if(n.selectionType==null&&(n.selectionType=YW),t!==void 0)(t==="additive"||t==="single")&&(n.selectionType=t);else return n.selectionType;return this},panningEnabled:function(t){if(t!==void 0)this._private.panningEnabled=!!t;else return this._private.panningEnabled;return this},userPanningEnabled:function(t){if(t!==void 0)this._private.userPanningEnabled=!!t;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(t){if(t!==void 0)this._private.zoomingEnabled=!!t;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(t){if(t!==void 0)this._private.userZoomingEnabled=!!t;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(t){if(t!==void 0)this._private.boxSelectionEnabled=!!t;else return this._private.boxSelectionEnabled;return this},pan:function(){var t=arguments,n=this._private.pan,r,a,i,l,o;switch(t.length){case 0:return n;case 1:if(Ze(t[0]))return r=t[0],n[r];if(Dt(t[0])){if(!this._private.panningEnabled)return this;i=t[0],l=i.x,o=i.y,Re(l)&&(n.x=l),Re(o)&&(n.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;r=t[0],a=t[1],(r==="x"||r==="y")&&Re(a)&&(n[r]=a),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(t,n){var r=arguments,a=this._private.pan,i,l,o,f,c;if(!this._private.panningEnabled)return this;switch(r.length){case 1:Dt(t)&&(o=r[0],f=o.x,c=o.y,Re(f)&&(a.x+=f),Re(c)&&(a.y+=c),this.emit("pan viewport"));break;case 2:i=t,l=n,(i==="x"||i==="y")&&Re(l)&&(a[i]+=l),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(t,n){var r=this.getFitViewport(t,n);if(r){var a=this._private;a.zoom=r.zoom,a.pan=r.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(t,n){if(Re(t)&&n===void 0&&(n=t,t=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var r;if(Ze(t)){var a=t;t=this.$(a)}else if(_Y(t)){var i=t;r={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},r.w=r.x2-r.x1,r.h=r.y2-r.y1}else ta(t)||(t=this.mutableElements());if(!(ta(t)&&t.empty())){r=r||t.boundingBox();var l=this.width(),o=this.height(),f;if(n=Re(n)?n:0,!isNaN(l)&&!isNaN(o)&&l>0&&o>0&&!isNaN(r.w)&&!isNaN(r.h)&&r.w>0&&r.h>0){f=Math.min((l-2*n)/r.w,(o-2*n)/r.h),f=f>this._private.maxZoom?this._private.maxZoom:f,f=f<this._private.minZoom?this._private.minZoom:f;var c={x:(l-f*(r.x1+r.x2))/2,y:(o-f*(r.y1+r.y2))/2};return{zoom:f,pan:c}}}}},zoomRange:function(t,n){var r=this._private;if(n==null){var a=t;t=a.min,n=a.max}return Re(t)&&Re(n)&&t<=n?(r.minZoom=t,r.maxZoom=n):Re(t)&&n===void 0&&t<=r.maxZoom?r.minZoom=t:Re(n)&&t===void 0&&n>=r.minZoom&&(r.maxZoom=n),this},minZoom:function(t){return t===void 0?this._private.minZoom:this.zoomRange({min:t})},maxZoom:function(t){return t===void 0?this._private.maxZoom:this.zoomRange({max:t})},getZoomedViewport:function(t){var n=this._private,r=n.pan,a=n.zoom,i,l,o=!1;if(n.zoomingEnabled||(o=!0),Re(t)?l=t:Dt(t)&&(l=t.level,t.position!=null?i=Gp(t.position,a,r):t.renderedPosition!=null&&(i=t.renderedPosition),i!=null&&!n.panningEnabled&&(o=!0)),l=l>n.maxZoom?n.maxZoom:l,l=l<n.minZoom?n.minZoom:l,o||!Re(l)||l===a||i!=null&&(!Re(i.x)||!Re(i.y)))return null;if(i!=null){var f=r,c=a,d=l,v={x:-d/c*(i.x-f.x)+i.x,y:-d/c*(i.y-f.y)+i.y};return{zoomed:!0,panned:!0,zoom:d,pan:v}}else return{zoomed:!0,panned:!1,zoom:l,pan:r}},zoom:function(t){if(t===void 0)return this._private.zoom;var n=this.getZoomedViewport(t),r=this._private;return n==null||!n.zoomed?this:(r.zoom=n.zoom,n.panned&&(r.pan.x=n.pan.x,r.pan.y=n.pan.y),this.emit("zoom"+(n.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(t){var n=this._private,r=!0,a=!0,i=[],l=!1,o=!1;if(!t)return this;if(Re(t.zoom)||(r=!1),Dt(t.pan)||(a=!1),!r&&!a)return this;if(r){var f=t.zoom;f<n.minZoom||f>n.maxZoom||!n.zoomingEnabled?l=!0:(n.zoom=f,i.push("zoom"))}if(a&&(!l||!t.cancelOnFailedZoom)&&n.panningEnabled){var c=t.pan;Re(c.x)&&(n.pan.x=c.x,o=!1),Re(c.y)&&(n.pan.y=c.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(t){var n=this.getCenterPan(t);return n&&(this._private.pan=n,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(t,n){if(this._private.panningEnabled){if(Ze(t)){var r=t;t=this.mutableElements().filter(r)}else ta(t)||(t=this.mutableElements());if(t.length!==0){var a=t.boundingBox(),i=this.width(),l=this.height();n=n===void 0?this._private.zoom:n;var o={x:(i-n*(a.x1+a.x2))/2,y:(l-n*(a.y1+a.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var t=this._private,n=t.container,r=this;return t.sizeCache=t.sizeCache||(n?(function(){var a=r.window().getComputedStyle(n),i=function(o){return parseFloat(a.getPropertyValue(o))};return{width:n.clientWidth-i("padding-left")-i("padding-right"),height:n.clientHeight-i("padding-top")-i("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var t=this._private.pan,n=this._private.zoom,r=this.renderedExtent(),a={x1:(r.x1-t.x)/n,x2:(r.x2-t.x)/n,y1:(r.y1-t.y)/n,y2:(r.y2-t.y)/n};return a.w=a.x2-a.x1,a.h=a.y2-a.y1,a},renderedExtent:function(){var t=this.width(),n=this.height();return{x1:0,y1:0,x2:t,y2:n,w:t,h:n}},multiClickDebounceTime:function(t){if(t)this._private.multiClickDebounceTime=t;else return this._private.multiClickDebounceTime;return this}};xo.centre=xo.center;xo.autolockNodes=xo.autolock;xo.autoungrabifyNodes=xo.autoungrabify;var Jf={data:_t.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:_t.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:_t.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:_t.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Jf.attr=Jf.data;Jf.removeAttr=Jf.removeData;var ed=function(t){var n=this;t=nt({},t);var r=t.container;r&&!tp(r)&&tp(r[0])&&(r=r[0]);var a=r?r._cyreg:null;a=a||{},a&&a.cy&&(a.cy.destroy(),a={});var i=a.readies=a.readies||[];r&&(r._cyreg=a),a.cy=n;var l=_n!==void 0&&r!==void 0&&!t.headless,o=t;o.layout=nt({name:l?"grid":"null"},o.layout),o.renderer=nt({name:l?"canvas":"null"},o.renderer);var f=function(x,S,w){return S!==void 0?S:w!==void 0?w:x},c=this._private={container:r,ready:!1,options:o,elements:new ir(this),listeners:[],aniEles:new ir(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:f(!0,o.zoomingEnabled),userZoomingEnabled:f(!0,o.userZoomingEnabled),panningEnabled:f(!0,o.panningEnabled),userPanningEnabled:f(!0,o.userPanningEnabled),boxSelectionEnabled:f(!0,o.boxSelectionEnabled),autolock:f(!1,o.autolock,o.autolockNodes),autoungrabify:f(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:f(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?l:o.styleEnabled,zoom:Re(o.zoom)?o.zoom:1,pan:{x:Dt(o.pan)&&Re(o.pan.x)?o.pan.x:0,y:Dt(o.pan)&&Re(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:f(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var d=function(x,S){var w=x.some(BY);if(w)return dc.all(x).then(S);S(x)};c.styleEnabled&&n.setStyle([]);var v=nt({},o,o.renderer);n.initRenderer(v);var m=function(x,S,w){n.notifications(!1);var b=n.mutableElements();b.length>0&&b.remove(),x!=null&&(Dt(x)||$t(x))&&n.add(x),n.one("layoutready",function(T){n.notifications(!0),n.emit(T),n.one("load",S),n.emitAndNotify("load")}).one("layoutstop",function(){n.one("done",w),n.emit("done")});var C=nt({},n._private.options.layout);C.eles=n.elements(),n.layout(C).run()};d([o.style,o.elements],function(y){var x=y[0],S=y[1];c.styleEnabled&&n.style().append(x),m(S,function(){n.startAnimationLoop(),c.ready=!0,fn(o.ready)&&n.on("ready",o.ready);for(var w=0;w<i.length;w++){var b=i[w];n.on("ready",b)}a&&(a.readies=[]),n.emit("ready")},o.done)})},op=ed.prototype;nt(op,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(t){return this.isReady()?this.emitter().emit("ready",[],t):this.on("ready",t),this},destroy:function(){var t=this;if(!t.destroyed())return t.stopAnimationLoop(),t.destroyRenderer(),this.emit("destroy"),t._private.destroyed=!0,t},hasElementWithId:function(t){return this._private.elements.hasElementWithId(t)},getElementById:function(t){return this._private.elements.getElementById(t)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(t){return this._private.elements.merge(t),this},removeFromPool:function(t){return this._private.elements.unmerge(t),this},container:function(){return this._private.container||null},window:function(){var t=this._private.container;if(t==null)return _n;var n=this._private.container.ownerDocument;return n===void 0||n==null?_n:n.defaultView||_n},mount:function(t){if(t!=null){var n=this,r=n._private,a=r.options;return!tp(t)&&tp(t[0])&&(t=t[0]),n.stopAnimationLoop(),n.destroyRenderer(),r.container=t,r.styleEnabled=!0,n.invalidateSize(),n.initRenderer(nt({},a,a.renderer,{name:a.renderer.name==="null"?"canvas":a.renderer.name})),n.startAnimationLoop(),n.style(a.style),n.emit("mount"),n}},unmount:function(){var t=this;return t.stopAnimationLoop(),t.destroyRenderer(),t.initRenderer({name:"null"}),t.emit("unmount"),t},options:function(){return ti(this._private.options)},json:function(t){var n=this,r=n._private,a=n.mutableElements(),i=function(k){return n.getElementById(k.id())};if(Dt(t)){if(n.startBatch(),t.elements){var l={},o=function(k,D){for(var A=[],j=[],L=0;L<k.length;L++){var _=k[L];if(!_.data.id){Bt("cy.json() cannot handle elements without an ID attribute");continue}var M=""+_.data.id,z=n.getElementById(M);l[M]=!0,z.length!==0?j.push({ele:z,json:_}):(D&&(_.group=D),A.push(_))}n.add(A);for(var P=0;P<j.length;P++){var G=j[P],I=G.ele,F=G.json;I.json(F)}};if($t(t.elements))o(t.elements);else for(var f=["nodes","edges"],c=0;c<f.length;c++){var d=f[c],v=t.elements[d];$t(v)&&o(v,d)}var m=n.collection();a.filter(function(T){return!l[T.id()]}).forEach(function(T){T.isParent()?m.merge(T):T.remove()}),m.forEach(function(T){return T.children().move({parent:null})}),m.forEach(function(T){return i(T).remove()})}t.style&&n.style(t.style),t.zoom!=null&&t.zoom!==r.zoom&&n.zoom(t.zoom),t.pan&&(t.pan.x!==r.pan.x||t.pan.y!==r.pan.y)&&n.pan(t.pan),t.data&&n.data(t.data);for(var y=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],x=0;x<y.length;x++){var S=y[x];t[S]!=null&&n[S](t[S])}return n.endBatch(),this}else{var w=!!t,b={};w?b.elements=this.elements().map(function(T){return T.json()}):(b.elements={},a.forEach(function(T){var k=T.group();b.elements[k]||(b.elements[k]=[]),b.elements[k].push(T.json())})),this._private.styleEnabled&&(b.style=n.style().json()),b.data=ti(n.data());var C=r.options;return b.zoomingEnabled=r.zoomingEnabled,b.userZoomingEnabled=r.userZoomingEnabled,b.zoom=r.zoom,b.minZoom=r.minZoom,b.maxZoom=r.maxZoom,b.panningEnabled=r.panningEnabled,b.userPanningEnabled=r.userPanningEnabled,b.pan=ti(r.pan),b.boxSelectionEnabled=r.boxSelectionEnabled,b.renderer=ti(C.renderer),b.hideEdgesOnViewport=C.hideEdgesOnViewport,b.textureOnViewport=C.textureOnViewport,b.wheelSensitivity=C.wheelSensitivity,b.motionBlur=C.motionBlur,b.multiClickDebounceTime=C.multiClickDebounceTime,b}}});op.$id=op.getElementById;[BW,qW,_L,zb,Ov,VW,Ib,Lv,$W,xo,Jf].forEach(function(e){nt(op,e)});var KW={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}},XW={maximal:!1,acyclic:!1},pu=function(t){return t.scratch("breadthfirst")},EA=function(t,n){return t.scratch("breadthfirst",n)};function BL(e){this.options=nt({},KW,XW,e)}BL.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().filter(function(qe){return qe.isChildless()}),a=n,i=e.directed,l=e.acyclic||e.maximal||e.maximalAdjustments>0,o=!!e.boundingBox,f=Tr(o?e.boundingBox:structuredClone(t.extent())),c;if(ta(e.roots))c=e.roots;else if($t(e.roots)){for(var d=[],v=0;v<e.roots.length;v++){var m=e.roots[v],y=t.getElementById(m);d.push(y)}c=t.collection(d)}else if(Ze(e.roots))c=t.$(e.roots);else if(i)c=r.roots();else{var x=n.components();c=t.collection();for(var S=function(){var De=x[w],Ge=De.maxDegree(!1),Ye=De.filter(function(it){return it.degree(!1)===Ge});c=c.add(Ye)},w=0;w<x.length;w++)S()}var b=[],C={},T=function(De,Ge){b[Ge]==null&&(b[Ge]=[]);var Ye=b[Ge].length;b[Ge].push(De),EA(De,{index:Ye,depth:Ge})},k=function(De,Ge){var Ye=pu(De),it=Ye.depth,Pe=Ye.index;b[it][Pe]=null,De.isChildless()&&T(De,Ge)};a.bfs({roots:c,directed:e.directed,visit:function(De,Ge,Ye,it,Pe){var ct=De[0],he=ct.id();ct.isChildless()&&T(ct,Pe),C[he]=!0}});for(var D=[],A=0;A<r.length;A++){var j=r[A];C[j.id()]||D.push(j)}var L=function(De){for(var Ge=b[De],Ye=0;Ye<Ge.length;Ye++){var it=Ge[Ye];if(it==null){Ge.splice(Ye,1),Ye--;continue}EA(it,{depth:De,index:Ye})}},_=function(De,Ge){for(var Ye=pu(De),it=De.incomers().filter(function(Me){return Me.isNode()&&n.has(Me)}),Pe=-1,ct=De.id(),he=0;he<it.length;he++){var Ce=it[he],je=pu(Ce);Pe=Math.max(Pe,je.depth)}if(Ye.depth<=Pe){if(!e.acyclic&&Ge[ct])return null;var ze=Pe+1;return k(De,ze),Ge[ct]=ze,!0}return!1};if(i&&l){var M=[],z={},P=function(De){return M.push(De)},G=function(){return M.shift()};for(r.forEach(function(qe){return M.push(qe)});M.length>0;){var I=G(),F=_(I,z);if(F)I.outgoers().filter(function(qe){return qe.isNode()&&n.has(qe)}).forEach(P);else if(F===null){Bt("Detected double maximal shift for node `"+I.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var B=0;if(e.avoidOverlap)for(var H=0;H<r.length;H++){var K=r[H],Q=K.layoutDimensions(e),V=Q.w,q=Q.h;B=Math.max(B,V,q)}var X={},U=function(De){if(X[De.id()])return X[De.id()];for(var Ge=pu(De).depth,Ye=De.neighborhood(),it=0,Pe=0,ct=0;ct<Ye.length;ct++){var he=Ye[ct];if(!(he.isEdge()||he.isParent()||!r.has(he))){var Ce=pu(he);if(Ce!=null){var je=Ce.index,ze=Ce.depth;if(!(je==null||ze==null)){var Me=b[ze].length;ze<Ge&&(it+=je/Me,Pe++)}}}}return Pe=Math.max(1,Pe),it=it/Pe,Pe===0&&(it=0),X[De.id()]=it,it},te=function(De,Ge){var Ye=U(De),it=U(Ge),Pe=Ye-it;return Pe===0?PO(De.id(),Ge.id()):Pe};e.depthSort!==void 0&&(te=e.depthSort);for(var ie=b.length,oe=0;oe<ie;oe++)b[oe].sort(te),L(oe);for(var ae=[],we=0;we<D.length;we++)ae.push(D[we]);var fe=function(){for(var De=0;De<ie;De++)L(De)};ae.length&&(b.unshift(ae),ie=b.length,fe());for(var J=0,ne=0;ne<ie;ne++)J=Math.max(b[ne].length,J);var re={x:f.x1+f.w/2,y:f.y1+f.h/2},ge=r.reduce(function(qe,De){return(function(Ge){return{w:qe.w===-1?Ge.w:(qe.w+Ge.w)/2,h:qe.h===-1?Ge.h:(qe.h+Ge.h)/2}})(De.boundingBox({includeLabels:e.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),Ne=Math.max(ie===1?0:o?(f.h-e.padding*2-ge.h)/(ie-1):(f.h-e.padding*2-ge.h)/(ie+1),B),Be=b.reduce(function(qe,De){return Math.max(qe,De.length)},0),st=function(De){var Ge=pu(De),Ye=Ge.depth,it=Ge.index;if(e.circle){var Pe=Math.min(f.w/2/ie,f.h/2/ie);Pe=Math.max(Pe,B);var ct=Pe*Ye+Pe-(ie>0&&b[0].length<=3?Pe/2:0),he=2*Math.PI/b[Ye].length*it;return Ye===0&&b[0].length===1&&(ct=1),{x:re.x+ct*Math.cos(he),y:re.y+ct*Math.sin(he)}}else{var Ce=b[Ye].length,je=Math.max(Ce===1?0:o?(f.w-e.padding*2-ge.w)/((e.grid?Be:Ce)-1):(f.w-e.padding*2-ge.w)/((e.grid?Be:Ce)+1),B),ze={x:re.x+(it+1-(Ce+1)/2)*je,y:re.y+(Ye+1-(ie+1)/2)*Ne};return ze}},Qe={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(Qe).indexOf(e.direction)===-1&&sn("Invalid direction '".concat(e.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Qe).join(", ")));var Ke=function(De){return fK(st(De),f,Qe[e.direction])};return n.nodes().layoutPositions(this,e,Ke),this};var QW={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function PL(e){this.options=nt({},QW,e)}PL.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));for(var l=Tr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:l.x1+l.w/2,y:l.y1+l.h/2},f=t.sweep===void 0?2*Math.PI-2*Math.PI/i.length:t.sweep,c=f/Math.max(1,i.length-1),d,v=0,m=0;m<i.length;m++){var y=i[m],x=y.layoutDimensions(t),S=x.w,w=x.h;v=Math.max(v,S,w)}if(Re(t.radius)?d=t.radius:i.length<=1?d=0:d=Math.min(l.h,l.w)/2-v,i.length>1&&t.avoidOverlap){v*=1.75;var b=Math.cos(c)-Math.cos(0),C=Math.sin(c)-Math.sin(0),T=Math.sqrt(v*v/(b*b+C*C));d=Math.max(T,d)}var k=function(A,j){var L=t.startAngle+j*c*(a?1:-1),_=d*Math.cos(L),M=d*Math.sin(L),z={x:o.x+_,y:o.y+M};return z};return r.nodes().layoutPositions(this,t,k),this};var WW={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(t){return t.degree()},levelWidth:function(t){return t.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function zL(e){this.options=nt({},WW,e)}zL.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,i=a.nodes().not(":parent"),l=Tr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:l.x1+l.w/2,y:l.y1+l.h/2},f=[],c=0,d=0;d<i.length;d++){var v=i[d],m=void 0;m=t.concentric(v),f.push({value:m,node:v}),v._private.scratch.concentric=m}i.updateStyle();for(var y=0;y<i.length;y++){var x=i[y],S=x.layoutDimensions(t);c=Math.max(c,S.w,S.h)}f.sort(function(Ne,Be){return Be.value-Ne.value});for(var w=t.levelWidth(i),b=[[]],C=b[0],T=0;T<f.length;T++){var k=f[T];if(C.length>0){var D=Math.abs(C[0].value-k.value);D>=w&&(C=[],b.push(C))}C.push(k)}var A=c+t.minNodeSpacing;if(!t.avoidOverlap){var j=b.length>0&&b[0].length>1,L=Math.min(l.w,l.h)/2-A,_=L/(b.length+j?1:0);A=Math.min(A,_)}for(var M=0,z=0;z<b.length;z++){var P=b[z],G=t.sweep===void 0?2*Math.PI-2*Math.PI/P.length:t.sweep,I=P.dTheta=G/Math.max(1,P.length-1);if(P.length>1&&t.avoidOverlap){var F=Math.cos(I)-Math.cos(0),B=Math.sin(I)-Math.sin(0),H=Math.sqrt(A*A/(F*F+B*B));M=Math.max(H,M)}P.r=M,M+=A}if(t.equidistant){for(var K=0,Q=0,V=0;V<b.length;V++){var q=b[V],X=q.r-Q;K=Math.max(K,X)}Q=0;for(var U=0;U<b.length;U++){var te=b[U];U===0&&(Q=te.r),te.r=Q,Q+=K}}for(var ie={},oe=0;oe<b.length;oe++)for(var ae=b[oe],we=ae.dTheta,fe=ae.r,J=0;J<ae.length;J++){var ne=ae[J],re=t.startAngle+(n?1:-1)*we*J,ge={x:o.x+fe*Math.cos(re),y:o.y+fe*Math.sin(re)};ie[ne.node.id()]=ge}return a.nodes().layoutPositions(this,t,function(Ne){var Be=Ne.id();return ie[Be]}),this};var w0,ZW={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(t,n){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(t){return 2048},nodeOverlap:4,idealEdgeLength:function(t){return 32},edgeElasticity:function(t){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function rm(e){this.options=nt({},ZW,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges(),r=n.filter(function(a){var i=a.source().data("id"),l=a.target().data("id"),o=t.some(function(c){return c.data("id")===i}),f=t.some(function(c){return c.data("id")===l});return!o||!f});this.options.eles=this.options.eles.not(r)}rm.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(e.animate===!0||e.animate===!1)&&n.emit({type:"layoutstart",layout:n}),e.debug===!0?w0=!0:w0=!1;var r=JW(t,n,e);w0&&tZ(r),e.randomize&&nZ(r);var a=Yi(),i=function(){rZ(r,t,e),e.fit===!0&&t.fit(e.padding)},l=function(m){return!(n.stopped||m>=e.numIter||(aZ(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature<e.minTemp))},o=function(){if(e.animate===!0||e.animate===!1)i(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var m=e.eles.nodes(),y=FL(r,e,m);m.layoutPositions(n,e,y)}},f=0,c=!0;if(e.animate===!0){var d=function(){for(var m=0;c&&m<e.refresh;)c=l(f),f++,m++;if(!c)TA(r,e),o();else{var y=Yi();y-a>=e.animationThreshold&&i(),np(d)}};d()}else{for(;c;)c=l(f),f++;TA(r,e),o()}return this};rm.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};rm.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var JW=function(t,n,r){for(var a=r.eles.edges(),i=r.eles.nodes(),l=Tr(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),o={isCompound:t.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:a.size(),temperature:r.initialTemp,clientWidth:l.w,clientHeight:l.h,boundingBox:l},f=r.eles.components(),c={},d=0;d<f.length;d++)for(var v=f[d],m=0;m<v.length;m++){var y=v[m];c[y.id()]=d}for(var d=0;d<o.nodeSize;d++){var x=i[d],S=x.layoutDimensions(r),w={};w.isLocked=x.locked(),w.id=x.data("id"),w.parentId=x.data("parent"),w.cmptId=c[x.id()],w.children=[],w.positionX=x.position("x"),w.positionY=x.position("y"),w.offsetX=0,w.offsetY=0,w.height=S.w,w.width=S.h,w.maxX=w.positionX+w.width/2,w.minX=w.positionX-w.width/2,w.maxY=w.positionY+w.height/2,w.minY=w.positionY-w.height/2,w.padLeft=parseFloat(x.style("padding")),w.padRight=parseFloat(x.style("padding")),w.padTop=parseFloat(x.style("padding")),w.padBottom=parseFloat(x.style("padding")),w.nodeRepulsion=fn(r.nodeRepulsion)?r.nodeRepulsion(x):r.nodeRepulsion,o.layoutNodes.push(w),o.idToIndex[w.id]=d}for(var b=[],C=0,T=-1,k=[],d=0;d<o.nodeSize;d++){var x=o.layoutNodes[d],D=x.parentId;D!=null?o.layoutNodes[o.idToIndex[D]].children.push(x.id):(b[++T]=x.id,k.push(x.id))}for(o.graphSet.push(k);C<=T;){var A=b[C++],j=o.idToIndex[A],y=o.layoutNodes[j],L=y.children;if(L.length>0){o.graphSet.push(L);for(var d=0;d<L.length;d++)b[++T]=L[d]}}for(var d=0;d<o.graphSet.length;d++)for(var _=o.graphSet[d],m=0;m<_.length;m++){var M=o.idToIndex[_[m]];o.indexToGraph[M]=d}for(var d=0;d<o.edgeSize;d++){var z=a[d],P={};P.id=z.data("id"),P.sourceId=z.data("source"),P.targetId=z.data("target");var G=fn(r.idealEdgeLength)?r.idealEdgeLength(z):r.idealEdgeLength,I=fn(r.edgeElasticity)?r.edgeElasticity(z):r.edgeElasticity,F=o.idToIndex[P.sourceId],B=o.idToIndex[P.targetId],H=o.indexToGraph[F],K=o.indexToGraph[B];if(H!=K){for(var Q=eZ(P.sourceId,P.targetId,o),V=o.graphSet[Q],q=0,w=o.layoutNodes[F];V.indexOf(w.id)===-1;)w=o.layoutNodes[o.idToIndex[w.parentId]],q++;for(w=o.layoutNodes[B];V.indexOf(w.id)===-1;)w=o.layoutNodes[o.idToIndex[w.parentId]],q++;G*=q*r.nestingFactor}P.idealLength=G,P.elasticity=I,o.layoutEdges.push(P)}return o},eZ=function(t,n,r){var a=IL(t,n,0,r);return 2>a.count?0:a.graph},IL=function(t,n,r,a){var i=a.graphSet[r];if(-1<i.indexOf(t)&&-1<i.indexOf(n))return{count:2,graph:r};for(var l=0,o=0;o<i.length;o++){var f=i[o],c=a.idToIndex[f],d=a.layoutNodes[c].children;if(d.length!==0){var v=a.indexToGraph[a.idToIndex[d[0]]],m=IL(t,n,v,a);if(m.count!==0)if(m.count===1){if(l++,l===2)break}else return m}}return{count:l,graph:r}},tZ,nZ=function(t,n){for(var r=t.clientWidth,a=t.clientHeight,i=0;i<t.nodeSize;i++){var l=t.layoutNodes[i];l.children.length===0&&!l.isLocked&&(l.positionX=Math.random()*r,l.positionY=Math.random()*a)}},FL=function(t,n,r){var a=t.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return n.boundingBox&&(r.forEach(function(l){var o=t.layoutNodes[t.idToIndex[l.data("id")]];i.x1=Math.min(i.x1,o.positionX),i.x2=Math.max(i.x2,o.positionX),i.y1=Math.min(i.y1,o.positionY),i.y2=Math.max(i.y2,o.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(l,o){var f=t.layoutNodes[t.idToIndex[l.data("id")]];if(n.boundingBox){var c=i.w===0?.5:(f.positionX-i.x1)/i.w,d=i.h===0?.5:(f.positionY-i.y1)/i.h;return{x:a.x1+c*a.w,y:a.y1+d*a.h}}else return{x:f.positionX,y:f.positionY}}},rZ=function(t,n,r){var a=r.layout,i=r.eles.nodes(),l=FL(t,r,i);i.positions(l),t.ready!==!0&&(t.ready=!0,a.one("layoutready",r.ready),a.emit({type:"layoutready",layout:this}))},aZ=function(t,n,r){iZ(t,n),oZ(t),uZ(t,n),cZ(t),fZ(t)},iZ=function(t,n){for(var r=0;r<t.graphSet.length;r++)for(var a=t.graphSet[r],i=a.length,l=0;l<i;l++)for(var o=t.layoutNodes[t.idToIndex[a[l]]],f=l+1;f<i;f++){var c=t.layoutNodes[t.idToIndex[a[f]]];sZ(o,c,t,n)}},CA=function(t){return-1+2*t*Math.random()},sZ=function(t,n,r,a){var i=t.cmptId,l=n.cmptId;if(!(i!==l&&!r.isCompound)){var o=n.positionX-t.positionX,f=n.positionY-t.positionY,c=1;o===0&&f===0&&(o=CA(c),f=CA(c));var d=lZ(t,n,o,f);if(d>0)var v=a.nodeOverlap*d,m=Math.sqrt(o*o+f*f),y=v*o/m,x=v*f/m;else var S=up(t,o,f),w=up(n,-1*o,-1*f),b=w.x-S.x,C=w.y-S.y,T=b*b+C*C,m=Math.sqrt(T),v=(t.nodeRepulsion+n.nodeRepulsion)/T,y=v*b/m,x=v*C/m;t.isLocked||(t.offsetX-=y,t.offsetY-=x),n.isLocked||(n.offsetX+=y,n.offsetY+=x)}},lZ=function(t,n,r,a){if(r>0)var i=t.maxX-n.minX;else var i=n.maxX-t.minX;if(a>0)var l=t.maxY-n.minY;else var l=n.maxY-t.minY;return i>=0&&l>=0?Math.sqrt(i*i+l*l):0},up=function(t,n,r){var a=t.positionX,i=t.positionY,l=t.height||1,o=t.width||1,f=r/n,c=l/o,d={};return n===0&&0<r||n===0&&0>r?(d.x=a,d.y=i+l/2,d):0<n&&-1*c<=f&&f<=c?(d.x=a+o/2,d.y=i+o*r/2/n,d):0>n&&-1*c<=f&&f<=c?(d.x=a-o/2,d.y=i-o*r/2/n,d):0<r&&(f<=-1*c||f>=c)?(d.x=a+l*n/2/r,d.y=i+l/2,d):(0>r&&(f<=-1*c||f>=c)&&(d.x=a-l*n/2/r,d.y=i-l/2),d)},oZ=function(t,n){for(var r=0;r<t.edgeSize;r++){var a=t.layoutEdges[r],i=t.idToIndex[a.sourceId],l=t.layoutNodes[i],o=t.idToIndex[a.targetId],f=t.layoutNodes[o],c=f.positionX-l.positionX,d=f.positionY-l.positionY;if(!(c===0&&d===0)){var v=up(l,c,d),m=up(f,-1*c,-1*d),y=m.x-v.x,x=m.y-v.y,S=Math.sqrt(y*y+x*x),w=Math.pow(a.idealLength-S,2)/a.elasticity;if(S!==0)var b=w*y/S,C=w*x/S;else var b=0,C=0;l.isLocked||(l.offsetX+=b,l.offsetY+=C),f.isLocked||(f.offsetX-=b,f.offsetY-=C)}}},uZ=function(t,n){if(n.gravity!==0)for(var r=1,a=0;a<t.graphSet.length;a++){var i=t.graphSet[a],l=i.length;if(a===0)var o=t.clientHeight/2,f=t.clientWidth/2;else var c=t.layoutNodes[t.idToIndex[i[0]]],d=t.layoutNodes[t.idToIndex[c.parentId]],o=d.positionX,f=d.positionY;for(var v=0;v<l;v++){var m=t.layoutNodes[t.idToIndex[i[v]]];if(!m.isLocked){var y=o-m.positionX,x=f-m.positionY,S=Math.sqrt(y*y+x*x);if(S>r){var w=n.gravity*y/S,b=n.gravity*x/S;m.offsetX+=w,m.offsetY+=b}}}}},cZ=function(t,n){var r=[],a=0,i=-1;for(r.push.apply(r,t.graphSet[0]),i+=t.graphSet[0].length;a<=i;){var l=r[a++],o=t.idToIndex[l],f=t.layoutNodes[o],c=f.children;if(0<c.length&&!f.isLocked){for(var d=f.offsetX,v=f.offsetY,m=0;m<c.length;m++){var y=t.layoutNodes[t.idToIndex[c[m]]];y.offsetX+=d,y.offsetY+=v,r[++i]=c[m]}f.offsetX=0,f.offsetY=0}}},fZ=function(t,n){for(var r=0;r<t.nodeSize;r++){var a=t.layoutNodes[r];0<a.children.length&&(a.maxX=void 0,a.minX=void 0,a.maxY=void 0,a.minY=void 0)}for(var r=0;r<t.nodeSize;r++){var a=t.layoutNodes[r];if(!(0<a.children.length||a.isLocked)){var i=dZ(a.offsetX,a.offsetY,t.temperature);a.positionX+=i.x,a.positionY+=i.y,a.offsetX=0,a.offsetY=0,a.minX=a.positionX-a.width,a.maxX=a.positionX+a.width,a.minY=a.positionY-a.height,a.maxY=a.positionY+a.height,qL(a,t)}}for(var r=0;r<t.nodeSize;r++){var a=t.layoutNodes[r];0<a.children.length&&!a.isLocked&&(a.positionX=(a.maxX+a.minX)/2,a.positionY=(a.maxY+a.minY)/2,a.width=a.maxX-a.minX,a.height=a.maxY-a.minY)}},dZ=function(t,n,r){var a=Math.sqrt(t*t+n*n);if(a>r)var i={x:r*t/a,y:r*n/a};else var i={x:t,y:n};return i},qL=function(t,n){var r=t.parentId;if(r!=null){var a=n.layoutNodes[n.idToIndex[r]],i=!1;if((a.maxX==null||t.maxX+a.padRight>a.maxX)&&(a.maxX=t.maxX+a.padRight,i=!0),(a.minX==null||t.minX-a.padLeft<a.minX)&&(a.minX=t.minX-a.padLeft,i=!0),(a.maxY==null||t.maxY+a.padBottom>a.maxY)&&(a.maxY=t.maxY+a.padBottom,i=!0),(a.minY==null||t.minY-a.padTop<a.minY)&&(a.minY=t.minY-a.padTop,i=!0),i)return qL(a,n)}},TA=function(t,n){for(var r=t.layoutNodes,a=[],i=0;i<r.length;i++){var l=r[i],o=l.cmptId,f=a[o]=a[o]||[];f.push(l)}for(var c=0,i=0;i<a.length;i++){var d=a[i];if(d){d.x1=1/0,d.x2=-1/0,d.y1=1/0,d.y2=-1/0;for(var v=0;v<d.length;v++){var m=d[v];d.x1=Math.min(d.x1,m.positionX-m.width/2),d.x2=Math.max(d.x2,m.positionX+m.width/2),d.y1=Math.min(d.y1,m.positionY-m.height/2),d.y2=Math.max(d.y2,m.positionY+m.height/2)}d.w=d.x2-d.x1,d.h=d.y2-d.y1,c+=d.w*d.h}}a.sort(function(C,T){return T.w*T.h-C.w*C.h});for(var y=0,x=0,S=0,w=0,b=Math.sqrt(c)*t.clientWidth/t.clientHeight,i=0;i<a.length;i++){var d=a[i];if(d){for(var v=0;v<d.length;v++){var m=d[v];m.isLocked||(m.positionX+=y-d.x1,m.positionY+=x-d.y1)}y+=d.w+n.componentSpacing,S+=d.w+n.componentSpacing,w=Math.max(w,d.h),S>b&&(x+=w+n.componentSpacing,y=0,S=0,w=0)}}},hZ={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(t){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function UL(e){this.options=nt({},hZ,e)}UL.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var i=Tr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(i.h===0||i.w===0)r.nodes().layoutPositions(this,t,function(U){return{x:i.x1,y:i.y1}});else{var l=a.size(),o=Math.sqrt(l*i.h/i.w),f=Math.round(o),c=Math.round(i.w/i.h*o),d=function(te){if(te==null)return Math.min(f,c);var ie=Math.min(f,c);ie==f?f=te:c=te},v=function(te){if(te==null)return Math.max(f,c);var ie=Math.max(f,c);ie==f?f=te:c=te},m=t.rows,y=t.cols!=null?t.cols:t.columns;if(m!=null&&y!=null)f=m,c=y;else if(m!=null&&y==null)f=m,c=Math.ceil(l/f);else if(m==null&&y!=null)c=y,f=Math.ceil(l/c);else if(c*f>l){var x=d(),S=v();(x-1)*S>=l?d(x-1):(S-1)*x>=l&&v(S-1)}else for(;c*f<l;){var w=d(),b=v();(b+1)*w>=l?v(b+1):d(w+1)}var C=i.w/c,T=i.h/f;if(t.condense&&(C=0,T=0),t.avoidOverlap)for(var k=0;k<a.length;k++){var D=a[k],A=D._private.position;(A.x==null||A.y==null)&&(A.x=0,A.y=0);var j=D.layoutDimensions(t),L=t.avoidOverlapPadding,_=j.w+L,M=j.h+L;C=Math.max(C,_),T=Math.max(T,M)}for(var z={},P=function(te,ie){return!!z["c-"+te+"-"+ie]},G=function(te,ie){z["c-"+te+"-"+ie]=!0},I=0,F=0,B=function(){F++,F>=c&&(F=0,I++)},H={},K=0;K<a.length;K++){var Q=a[K],V=t.position(Q);if(V&&(V.row!==void 0||V.col!==void 0)){var q={row:V.row,col:V.col};if(q.col===void 0)for(q.col=0;P(q.row,q.col);)q.col++;else if(q.row===void 0)for(q.row=0;P(q.row,q.col);)q.row++;H[Q.id()]=q,G(q.row,q.col)}}var X=function(te,ie){var oe,ae;if(te.locked()||te.isParent())return!1;var we=H[te.id()];if(we)oe=we.col*C+C/2+i.x1,ae=we.row*T+T/2+i.y1;else{for(;P(I,F);)B();oe=F*C+C/2+i.x1,ae=I*T+T/2+i.y1,G(I,F),B()}return{x:oe,y:ae}};a.layoutPositions(this,t,X)}return this};var vZ={ready:function(){},stop:function(){}};function Nw(e){this.options=nt({},vZ,e)}Nw.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),n.one("layoutready",e.ready),n.emit("layoutready"),n.one("layoutstop",e.stop),n.emit("layoutstop"),this};Nw.prototype.stop=function(){return this};var pZ={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function VL(e){this.options=nt({},pZ,e)}VL.prototype.run=function(){var e=this.options,t=e.eles,n=t.nodes(),r=fn(e.positions);function a(i){if(e.positions==null)return PK(i.position());if(r)return e.positions(i);var l=e.positions[i._private.data.id];return l??null}return n.layoutPositions(this,e,function(i,l){var o=a(i);return i.locked()||o==null?!1:o}),this};var mZ={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function HL(e){this.options=nt({},mZ,e)}HL.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=Tr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),a=function(l,o){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}};return n.nodes().layoutPositions(this,e,a),this};var gZ=[{name:"breadthfirst",impl:BL},{name:"circle",impl:PL},{name:"concentric",impl:zL},{name:"cose",impl:rm},{name:"grid",impl:UL},{name:"null",impl:Nw},{name:"preset",impl:VL},{name:"random",impl:HL}];function GL(e){this.options=e,this.notifications=0}var NA=function(){},kA=function(){throw new Error("A headless instance can not render images")};GL.prototype={recalculateRenderedStyle:NA,notify:function(){this.notifications++},init:NA,isHeadless:function(){return!0},png:kA,jpg:kA};var kw={};kw.arrowShapeWidth=.3;kw.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(c,d,v,m,y,x,S){var w=y.x-v/2-S,b=y.x+v/2+S,C=y.y-v/2-S,T=y.y+v/2+S,k=w<=c&&c<=b&&C<=d&&d<=T;return k},r=function(c,d,v,m,y){var x=c*Math.cos(m)-d*Math.sin(m),S=c*Math.sin(m)+d*Math.cos(m),w=x*v,b=S*v,C=w+y.x,T=b+y.y;return{x:C,y:T}},a=function(c,d,v,m){for(var y=[],x=0;x<c.length;x+=2){var S=c[x],w=c[x+1];y.push(r(S,w,d,v,m))}return y},i=function(c){for(var d=[],v=0;v<c.length;v++){var m=c[v];d.push(m.x,m.y)}return d},l=function(c){return c.pstyle("width").pfValue*c.pstyle("arrow-scale").pfValue*2},o=function(c,d){Ze(d)&&(d=e[d]),e[c]=nt({name:c,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(m,y,x,S,w,b){var C=i(a(this.points,x+2*b,S,w)),T=Ir(m,y,C);return T},roughCollide:n,draw:function(m,y,x,S){var w=a(this.points,y,x,S);t.arrowShapeImpl("polygon")(m,w)},spacing:function(m){return 0},gap:l},d)};o("none",{collide:rp,roughCollide:rp,draw:dw,spacing:qN,gap:qN}),o("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),o("arrow","triangle"),o("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(c,d,v,m,y){var x=a(this.points,d,v,m),S=this.controlPoint,w=r(S[0],S[1],d,v,m);t.arrowShapeImpl(this.name)(c,x,w)},gap:function(c){return l(c)*.8}}),o("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(c,d,v,m,y,x,S){var w=i(a(this.points,v+2*S,m,y)),b=i(a(this.pointsTee,v+2*S,m,y)),C=Ir(c,d,w)||Ir(c,d,b);return C},draw:function(c,d,v,m,y){var x=a(this.points,d,v,m),S=a(this.pointsTee,d,v,m);t.arrowShapeImpl(this.name)(c,x,S)}}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(c,d,v,m,y,x,S){var w=y,b=Math.pow(w.x-c,2)+Math.pow(w.y-d,2)<=Math.pow((v+2*S)*this.radius,2),C=i(a(this.points,v+2*S,m,y));return Ir(c,d,C)||b},draw:function(c,d,v,m,y){var x=a(this.pointsTr,d,v,m);t.arrowShapeImpl(this.name)(c,x,m.x,m.y,this.radius*d)},spacing:function(c){return t.getArrowWidth(c.pstyle("width").pfValue,c.pstyle("arrow-scale").value)*this.radius}}),o("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(c,d){var v=this.baseCrossLinePts.slice(),m=d/c,y=3,x=5;return v[y]=v[y]-m,v[x]=v[x]-m,v},collide:function(c,d,v,m,y,x,S){var w=i(a(this.points,v+2*S,m,y)),b=i(a(this.crossLinePts(v,x),v+2*S,m,y)),C=Ir(c,d,w)||Ir(c,d,b);return C},draw:function(c,d,v,m,y){var x=a(this.points,d,v,m),S=a(this.crossLinePts(d,y),d,v,m);t.arrowShapeImpl(this.name)(c,x,S)}}),o("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(c){return l(c)*.525}}),o("circle",{radius:.15,collide:function(c,d,v,m,y,x,S){var w=y,b=Math.pow(w.x-c,2)+Math.pow(w.y-d,2)<=Math.pow((v+2*S)*this.radius,2);return b},draw:function(c,d,v,m,y){t.arrowShapeImpl(this.name)(c,m.x,m.y,this.radius*d)},spacing:function(c){return t.getArrowWidth(c.pstyle("width").pfValue,c.pstyle("arrow-scale").value)*this.radius}}),o("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(c){return 1},gap:function(c){return 1}}),o("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),o("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(c){return c.pstyle("width").pfValue*c.pstyle("arrow-scale").value}}),o("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(c){return .95*c.pstyle("width").pfValue*c.pstyle("arrow-scale").value}})};var Eo={};Eo.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),a=r[0],i=r[1],l=r[4],o=n.pan(),f=n.zoom(),c=((e-a)/l-o.x)/f,d=((t-i)/l-o.y)/f;return[c,d]};Eo.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(b){return parseFloat(n.getPropertyValue(b))},a={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},i={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},l=e.clientWidth,o=e.clientHeight,f=a.left+a.right,c=a.top+a.bottom,d=i.left+i.right,v=t.width/(l+d),m=l-f,y=o-c,x=t.left+a.left+i.left,S=t.top+a.top+i.top;return this.containerBB=[x,S,m,y,v]};Eo.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Eo.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]};Eo.findNearestElements=function(e,t,n,r){var a=this,i=this,l=i.getCachedZSortedEles(),o=[],f=i.cy.zoom(),c=i.cy.hasCompoundNodes(),d=(r?24:8)/f,v=(r?8:2)/f,m=(r?8:2)/f,y=1/0,x,S;n&&(l=l.interactive);function w(j,L){if(j.isNode()){if(S)return;S=j,o.push(j)}if(j.isEdge()&&(L==null||L<y))if(x){if(x.pstyle("z-compound-depth").value===j.pstyle("z-compound-depth").value&&x.pstyle("z-compound-depth").value===j.pstyle("z-compound-depth").value){for(var _=0;_<o.length;_++)if(o[_].isEdge()){o[_]=j,x=j,y=L??y;break}}}else o.push(j),x=j,y=L??y}function b(j){var L=j.outerWidth()+2*v,_=j.outerHeight()+2*v,M=L/2,z=_/2,P=j.position(),G=j.pstyle("corner-radius").value==="auto"?"auto":j.pstyle("corner-radius").pfValue,I=j._private.rscratch;if(P.x-M<=e&&e<=P.x+M&&P.y-z<=t&&t<=P.y+z){var F=i.nodeShapes[a.getNodeShape(j)];if(F.checkPoint(e,t,0,L,_,P.x,P.y,G,I))return w(j,0),!0}}function C(j){var L=j._private,_=L.rscratch,M=j.pstyle("width").pfValue,z=j.pstyle("arrow-scale").value,P=M/2+d,G=P*P,I=P*2,K=L.source,Q=L.target,F;if(_.edgeType==="segments"||_.edgeType==="straight"||_.edgeType==="haystack"){for(var B=_.allpts,H=0;H+3<B.length;H+=2)if(WK(e,t,B[H],B[H+1],B[H+2],B[H+3],I)&&G>(F=nX(e,t,B[H],B[H+1],B[H+2],B[H+3])))return w(j,F),!0}else if(_.edgeType==="bezier"||_.edgeType==="multibezier"||_.edgeType==="self"||_.edgeType==="compound"){for(var B=_.allpts,H=0;H+5<_.allpts.length;H+=4)if(ZK(e,t,B[H],B[H+1],B[H+2],B[H+3],B[H+4],B[H+5],I)&&G>(F=tX(e,t,B[H],B[H+1],B[H+2],B[H+3],B[H+4],B[H+5])))return w(j,F),!0}for(var K=K||L.source,Q=Q||L.target,V=a.getArrowWidth(M,z),q=[{name:"source",x:_.arrowStartX,y:_.arrowStartY,angle:_.srcArrowAngle},{name:"target",x:_.arrowEndX,y:_.arrowEndY,angle:_.tgtArrowAngle},{name:"mid-source",x:_.midX,y:_.midY,angle:_.midsrcArrowAngle},{name:"mid-target",x:_.midX,y:_.midY,angle:_.midtgtArrowAngle}],H=0;H<q.length;H++){var X=q[H],U=i.arrowShapes[j.pstyle(X.name+"-arrow-shape").value],te=j.pstyle("width").pfValue;if(U.roughCollide(e,t,V,X.angle,{x:X.x,y:X.y},te,d)&&U.collide(e,t,V,X.angle,{x:X.x,y:X.y},te,d))return w(j),!0}c&&o.length>0&&(b(K),b(Q))}function T(j,L,_){return zr(j,L,_)}function k(j,L){var _=j._private,M=m,z;L?z=L+"-":z="",j.boundingBox();var P=_.labelBounds[L||"main"],G=j.pstyle(z+"label").value,I=j.pstyle("text-events").strValue==="yes";if(!(!I||!G)){var F=T(_.rscratch,"labelX",L),B=T(_.rscratch,"labelY",L),H=T(_.rscratch,"labelAngle",L),K=j.pstyle(z+"text-margin-x").pfValue,Q=j.pstyle(z+"text-margin-y").pfValue,V=P.x1-M-K,q=P.x2+M-K,X=P.y1-M-Q,U=P.y2+M-Q;if(H){var te=Math.cos(H),ie=Math.sin(H),oe=function(ge,Ne){return ge=ge-F,Ne=Ne-B,{x:ge*te-Ne*ie+F,y:ge*ie+Ne*te+B}},ae=oe(V,X),we=oe(V,U),fe=oe(q,X),J=oe(q,U),ne=[ae.x+K,ae.y+Q,fe.x+K,fe.y+Q,J.x+K,J.y+Q,we.x+K,we.y+Q];if(Ir(e,t,ne))return w(j),!0}else if(Ks(P,e,t))return w(j),!0}}for(var D=l.length-1;D>=0;D--){var A=l[D];A.isNode()?b(A)||k(A):C(A)||k(A)||k(A,"source")||k(A,"target")}return o};Eo.getAllInBox=function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),l=2/i,o=[],f=Math.min(e,n),c=Math.max(e,n),d=Math.min(t,r),v=Math.max(t,r);e=f,n=c,t=d,r=v;var m=Tr({x1:e,y1:t,x2:n,y2:r}),y=[{x:m.x1,y:m.y1},{x:m.x2,y:m.y1},{x:m.x2,y:m.y2},{x:m.x1,y:m.y2}],x=[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]],[y[3],y[0]]];function S(ge,Ne,Be){return zr(ge,Ne,Be)}function w(ge,Ne){var Be=ge._private,st=l,Qe="";ge.boundingBox();var Ke=Be.labelBounds.main;if(!Ke)return null;var qe=S(Be.rscratch,"labelX",Ne),De=S(Be.rscratch,"labelY",Ne),Ge=S(Be.rscratch,"labelAngle",Ne),Ye=ge.pstyle(Qe+"text-margin-x").pfValue,it=ge.pstyle(Qe+"text-margin-y").pfValue,Pe=Ke.x1-st-Ye,ct=Ke.x2+st-Ye,he=Ke.y1-st-it,Ce=Ke.y2+st-it;if(Ge){var je=Math.cos(Ge),ze=Math.sin(Ge),Me=function(ye,Y){return ye=ye-qe,Y=Y-De,{x:ye*je-Y*ze+qe,y:ye*ze+Y*je+De}};return[Me(Pe,he),Me(ct,he),Me(ct,Ce),Me(Pe,Ce)]}else return[{x:Pe,y:he},{x:ct,y:he},{x:ct,y:Ce},{x:Pe,y:Ce}]}function b(ge,Ne,Be,st){function Qe(Ke,qe,De){return(De.y-Ke.y)*(qe.x-Ke.x)>(qe.y-Ke.y)*(De.x-Ke.x)}return Qe(ge,Be,st)!==Qe(Ne,Be,st)&&Qe(ge,Ne,Be)!==Qe(ge,Ne,st)}for(var C=0;C<a.length;C++){var T=a[C];if(T.isNode()){var k=T,D=k.pstyle("text-events").strValue==="yes",A=k.pstyle("box-selection").strValue,j=k.pstyle("box-select-labels").strValue==="yes";if(A==="none")continue;var L=(A==="overlap"||j)&&D,_=k.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:L});if(A==="contain"){var M=!1;if(j&&D){var z=w(k);z&&xx(z,y)&&(o.push(k),M=!0)}!M&&ZO(m,_)&&o.push(k)}else if(A==="overlap"&&mw(m,_)){var P=k.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),G=[{x:P.x1,y:P.y1},{x:P.x2,y:P.y1},{x:P.x2,y:P.y2},{x:P.x1,y:P.y2}];if(xx(G,y))o.push(k);else{var I=w(k);I&&xx(I,y)&&o.push(k)}}}else{var F=T,B=F._private,H=B.rscratch,K=F.pstyle("box-selection").strValue;if(K==="none")continue;if(K==="contain"){if(H.startX!=null&&H.startY!=null&&!Ks(m,H.startX,H.startY)||H.endX!=null&&H.endY!=null&&!Ks(m,H.endX,H.endY))continue;if(H.edgeType==="bezier"||H.edgeType==="multibezier"||H.edgeType==="self"||H.edgeType==="compound"||H.edgeType==="segments"||H.edgeType==="haystack"){for(var Q=B.rstyle.bezierPts||B.rstyle.linePts||B.rstyle.haystackPts,V=!0,q=0;q<Q.length;q++)if(!$N(m,Q[q])){V=!1;break}V&&o.push(F)}else H.edgeType==="straight"&&o.push(F)}else if(K==="overlap"){var X=!1;if(H.startX!=null&&H.startY!=null&&H.endX!=null&&H.endY!=null&&(Ks(m,H.startX,H.startY)||Ks(m,H.endX,H.endY)))o.push(F),X=!0;else if(!X&&H.edgeType==="haystack"){for(var U=B.rstyle.haystackPts,te=0;te<U.length;te++)if($N(m,U[te])){o.push(F),X=!0;break}}if(!X){var ie=B.rstyle.bezierPts||B.rstyle.linePts||B.rstyle.haystackPts;if((!ie||ie.length<2)&&H.edgeType==="straight"&&H.startX!=null&&H.startY!=null&&H.endX!=null&&H.endY!=null&&(ie=[{x:H.startX,y:H.startY},{x:H.endX,y:H.endY}]),!ie||ie.length<2)continue;for(var oe=0;oe<ie.length-1;oe++){for(var ae=ie[oe],we=ie[oe+1],fe=0;fe<x.length;fe++){var J=Mn(x[fe],2),ne=J[0],re=J[1];if(b(ae,we,ne,re)){o.push(F),X=!0;break}}if(X)break}}}}}return o};var cp={};cp.calculateArrowAngles=function(e){var t=e._private.rscratch,n=t.edgeType==="haystack",r=t.edgeType==="bezier",a=t.edgeType==="multibezier",i=t.edgeType==="segments",l=t.edgeType==="compound",o=t.edgeType==="self",f,c,d,v,m,y,b,C;if(n?(d=t.haystackPts[0],v=t.haystackPts[1],m=t.haystackPts[2],y=t.haystackPts[3]):(d=t.arrowStartX,v=t.arrowStartY,m=t.arrowEndX,y=t.arrowEndY),b=t.midX,C=t.midY,i)f=d-t.segpts[0],c=v-t.segpts[1];else if(a||l||o||r){var x=t.allpts,S=Kn(x[0],x[2],x[4],.1),w=Kn(x[1],x[3],x[5],.1);f=d-S,c=v-w}else f=d-b,c=v-C;t.srcArrowAngle=lv(f,c);var b=t.midX,C=t.midY;if(n&&(b=(d+m)/2,C=(v+y)/2),f=m-d,c=y-v,i){var x=t.allpts;if(x.length/2%2===0){var T=x.length/2,k=T-2;f=x[T]-x[k],c=x[T+1]-x[k+1]}else if(t.isRound)f=t.midVector[1],c=-t.midVector[0];else{var T=x.length/2-1,k=T-2;f=x[T]-x[k],c=x[T+1]-x[k+1]}}else if(a||l||o){var x=t.allpts,D=t.ctrlpts,A,j,L,_;if(D.length/2%2===0){var M=x.length/2-1,z=M+2,P=z+2;A=Kn(x[M],x[z],x[P],0),j=Kn(x[M+1],x[z+1],x[P+1],0),L=Kn(x[M],x[z],x[P],1e-4),_=Kn(x[M+1],x[z+1],x[P+1],1e-4)}else{var z=x.length/2-1,M=z-2,P=z+2;A=Kn(x[M],x[z],x[P],.4999),j=Kn(x[M+1],x[z+1],x[P+1],.4999),L=Kn(x[M],x[z],x[P],.5),_=Kn(x[M+1],x[z+1],x[P+1],.5)}f=L-A,c=_-j}if(t.midtgtArrowAngle=lv(f,c),t.midDispX=f,t.midDispY=c,f*=-1,c*=-1,i){var x=t.allpts;if(x.length/2%2!==0){if(!t.isRound){var T=x.length/2-1,G=T+2;f=-(x[G]-x[T]),c=-(x[G+1]-x[T+1])}}}if(t.midsrcArrowAngle=lv(f,c),i)f=m-t.segpts[t.segpts.length-2],c=y-t.segpts[t.segpts.length-1];else if(a||l||o||r){var x=t.allpts,I=x.length,S=Kn(x[I-6],x[I-4],x[I-2],.9),w=Kn(x[I-5],x[I-3],x[I-1],.9);f=m-S,c=y-w}else f=m-b,c=y-C;t.tgtArrowAngle=lv(f,c)};cp.getArrowWidth=cp.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(e*13.37,.9),29)*t,n[e+", "+t]=r,r)};var Fb,qb,Ya={},va={},AA,RA,Yl,_v,Mi,Ul,Gl,Va,mu,pv,$L,YL,Ub,Vb,DA,jA=function(t,n,r){r.x=n.x-t.x,r.y=n.y-t.y,r.len=Math.sqrt(r.x*r.x+r.y*r.y),r.nx=r.x/r.len,r.ny=r.y/r.len,r.ang=Math.atan2(r.ny,r.nx)},yZ=function(t,n){n.x=t.x*-1,n.y=t.y*-1,n.nx=t.nx*-1,n.ny=t.ny*-1,n.ang=t.ang>0?-(Math.PI-t.ang):Math.PI+t.ang},xZ=function(t,n,r,a,i){if(t!==DA?jA(n,t,Ya):yZ(va,Ya),jA(n,r,va),AA=Ya.nx*va.ny-Ya.ny*va.nx,RA=Ya.nx*va.nx-Ya.ny*-va.ny,Mi=Math.asin(Math.max(-1,Math.min(1,AA))),Math.abs(Mi)<1e-6){Fb=n.x,qb=n.y,Gl=mu=0;return}Yl=1,_v=!1,RA<0?Mi<0?Mi=Math.PI+Mi:(Mi=Math.PI-Mi,Yl=-1,_v=!0):Mi>0&&(Yl=-1,_v=!0),n.radius!==void 0?mu=n.radius:mu=a,Ul=Mi/2,pv=Math.min(Ya.len/2,va.len/2),i?(Va=Math.abs(Math.cos(Ul)*mu/Math.sin(Ul)),Va>pv?(Va=pv,Gl=Math.abs(Va*Math.sin(Ul)/Math.cos(Ul))):Gl=mu):(Va=Math.min(pv,mu),Gl=Math.abs(Va*Math.sin(Ul)/Math.cos(Ul))),Ub=n.x+va.nx*Va,Vb=n.y+va.ny*Va,Fb=Ub-va.ny*Gl*Yl,qb=Vb+va.nx*Gl*Yl,$L=n.x+Ya.nx*Va,YL=n.y+Ya.ny*Va,DA=n};function KL(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function Aw(e,t,n,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(xZ(e,t,n,r,a),{cx:Fb,cy:qb,radius:Gl,startX:$L,startY:YL,stopX:Ub,stopY:Vb,startAngle:Ya.ang+Math.PI/2*Yl,endAngle:va.ang-Math.PI/2*Yl,counterClockwise:_v})}var td=.01,bZ=Math.sqrt(2*td),yr={};yr.findMidptPtsEtc=function(e,t){var n=t.posPts,r=t.intersectionPts,a=t.vectorNormInverse,i,l=e.pstyle("source-endpoint"),o=e.pstyle("target-endpoint"),f=l.units!=null&&o.units!=null,c=function(D,A,j,L){var _=L-A,M=j-D,z=Math.sqrt(M*M+_*_);return{x:-_/z,y:M/z}},d=e.pstyle("edge-distances").value;switch(d){case"node-position":i=n;break;case"intersection":i=r;break;case"endpoints":{if(f){var v=this.manualEndptToPx(e.source()[0],l),m=Mn(v,2),y=m[0],x=m[1],S=this.manualEndptToPx(e.target()[0],o),w=Mn(S,2),b=w[0],C=w[1],T={x1:y,y1:x,x2:b,y2:C};a=c(y,x,b,C),i=T}else Bt("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=r;break}}return{midptPts:i,vectorNormInverse:a}};yr.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,a=r.rscratch;if(!a.haystack){var i=Math.random()*2*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var l=r.source,o=r.target,f=l.position(),c=o.position(),d=l.width(),v=o.width(),m=l.height(),y=o.height(),x=n.pstyle("haystack-radius").value,S=x/2;a.haystackPts=a.allpts=[a.source.x*d*S+f.x,a.source.y*m*S+f.y,a.target.x*v*S+c.x,a.target.y*y*S+c.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}};yr.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),a=e.pstyle("segment-distances"),i=e.pstyle("segment-radii"),l=e.pstyle("radius-type"),o=Math.min(r.pfValue.length,a.pfValue.length),f=i.pfValue[i.pfValue.length-1],c=l.pfValue[l.pfValue.length-1];n.edgeType="segments",n.segpts=[],n.radii=[],n.isArcRadius=[];for(var d=0;d<o;d++){var v=r.pfValue[d],m=a.pfValue[d],y=1-v,x=v,S=this.findMidptPtsEtc(e,t),w=S.midptPts,b=S.vectorNormInverse,C={x:w.x1*y+w.x2*x,y:w.y1*y+w.y2*x};n.segpts.push(C.x+b.x*m,C.y+b.y*m),n.radii.push(i.pfValue[d]!==void 0?i.pfValue[d]:f),n.isArcRadius.push((l.pfValue[d]!==void 0?l.pfValue[d]:c)==="arc-radius")}};yr.findLoopPoints=function(e,t,n,r){var a=e._private.rscratch,i=t.dirCounts,l=t.srcPos,o=e.pstyle("control-point-distances"),f=o?o.pfValue[0]:void 0,c=e.pstyle("loop-direction").pfValue,d=e.pstyle("loop-sweep").pfValue,v=e.pstyle("control-point-step-size").pfValue;a.edgeType="self";var m=n,y=v;r&&(m=0,y=f);var x=c-Math.PI/2,S=x-d/2,w=x+d/2,b=c+"_"+d;m=i[b]===void 0?i[b]=0:++i[b],a.ctrlpts=[l.x+Math.cos(S)*1.4*y*(m/3+1),l.y+Math.sin(S)*1.4*y*(m/3+1),l.x+Math.cos(w)*1.4*y*(m/3+1),l.y+Math.sin(w)*1.4*y*(m/3+1)]};yr.findCompoundLoopPoints=function(e,t,n,r){var a=e._private.rscratch;a.edgeType="compound";var i=t.srcPos,l=t.tgtPos,o=t.srcW,f=t.srcH,c=t.tgtW,d=t.tgtH,v=e.pstyle("control-point-step-size").pfValue,m=e.pstyle("control-point-distances"),y=m?m.pfValue[0]:void 0,x=n,S=v;r&&(x=0,S=y);var w=50,b={x:i.x-o/2,y:i.y-f/2},C={x:l.x-c/2,y:l.y-d/2},T={x:Math.min(b.x,C.x),y:Math.min(b.y,C.y)},k=.5,D=Math.max(k,Math.log(o*td)),A=Math.max(k,Math.log(c*td));a.ctrlpts=[T.x,T.y-(1+Math.pow(w,1.12)/100)*S*(x/3+1)*D,T.x-(1+Math.pow(w,1.12)/100)*S*(x/3+1)*A,T.y]};yr.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"};yr.findBezierPoints=function(e,t,n,r,a){var i=e._private.rscratch,l=e.pstyle("control-point-step-size").pfValue,o=e.pstyle("control-point-distances"),f=e.pstyle("control-point-weights"),c=o&&f?Math.min(o.value.length,f.value.length):1,d=o?o.pfValue[0]:void 0,v=f.value[0],m=r;i.edgeType=m?"multibezier":"bezier",i.ctrlpts=[];for(var y=0;y<c;y++){var x=(.5-t.eles.length/2+n)*l*(a?-1:1),S=void 0,w=pw(x);m&&(d=o?o.pfValue[y]:l,v=f.value[y]),r?S=d:S=d!==void 0?w*d:void 0;var b=S!==void 0?S:x,C=1-v,T=v,k=this.findMidptPtsEtc(e,t),D=k.midptPts,A=k.vectorNormInverse,j={x:D.x1*C+D.x2*T,y:D.y1*C+D.y2*T};i.ctrlpts.push(j.x+A.x*b,j.y+A.y*b)}};yr.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r="vertical",a="horizontal",i="leftward",l="rightward",o="downward",f="upward",c="auto",d=t.posPts,v=t.srcW,m=t.srcH,y=t.tgtW,x=t.tgtH,S=e.pstyle("edge-distances").value,w=S!=="node-position",b=e.pstyle("taxi-direction").value,C=b,T=e.pstyle("taxi-turn"),k=T.units==="%",D=T.pfValue,A=D<0,j=e.pstyle("taxi-turn-min-distance").pfValue,L=w?(v+y)/2:0,_=w?(m+x)/2:0,M=d.x2-d.x1,z=d.y2-d.y1,P=function(Y,le){return Y>0?Math.max(Y-le,0):Math.min(Y+le,0)},G=P(M,L),I=P(z,_),F=!1;C===c?b=Math.abs(G)>Math.abs(I)?a:r:C===f||C===o?(b=r,F=!0):(C===i||C===l)&&(b=a,F=!0);var B=b===r,H=B?I:G,K=B?z:M,Q=pw(K),V=!1;!(F&&(k||A))&&(C===o&&K<0||C===f&&K>0||C===i&&K>0||C===l&&K<0)&&(Q*=-1,H=Q*Math.abs(H),V=!0);var q;if(k){var X=D<0?1+D:D;q=X*H}else{var U=D<0?H:0;q=U+D*Q}var te=function(Y){return Math.abs(Y)<j||Math.abs(Y)>=Math.abs(H)},ie=te(q),oe=te(Math.abs(H)-Math.abs(q)),ae=ie||oe;if(ae&&!V)if(B){var we=Math.abs(K)<=m/2,fe=Math.abs(M)<=y/2;if(we){var J=(d.x1+d.x2)/2,ne=d.y1,re=d.y2;n.segpts=[J,ne,J,re]}else if(fe){var ge=(d.y1+d.y2)/2,Ne=d.x1,Be=d.x2;n.segpts=[Ne,ge,Be,ge]}else n.segpts=[d.x1,d.y2]}else{var st=Math.abs(K)<=v/2,Qe=Math.abs(z)<=x/2;if(st){var Ke=(d.y1+d.y2)/2,qe=d.x1,De=d.x2;n.segpts=[qe,Ke,De,Ke]}else if(Qe){var Ge=(d.x1+d.x2)/2,Ye=d.y1,it=d.y2;n.segpts=[Ge,Ye,Ge,it]}else n.segpts=[d.x2,d.y1]}else if(B){var Pe=d.y1+q+(w?m/2*Q:0),ct=d.x1,he=d.x2;n.segpts=[ct,Pe,he,Pe]}else{var Ce=d.x1+q+(w?v/2*Q:0),je=d.y1,ze=d.y2;n.segpts=[Ce,je,Ce,ze]}if(n.isRound){var Me=e.pstyle("taxi-radius").value,Oe=e.pstyle("radius-type").value[0]==="arc-radius";n.radii=new Array(n.segpts.length/2).fill(Me),n.isArcRadius=new Array(n.segpts.length/2).fill(Oe)}};yr.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType==="bezier"){var r=t.srcPos,a=t.tgtPos,i=t.srcW,l=t.srcH,o=t.tgtW,f=t.tgtH,c=t.srcShape,d=t.tgtShape,v=t.srcCornerRadius,m=t.tgtCornerRadius,y=t.srcRs,x=t.tgtRs,S=!Re(n.startX)||!Re(n.startY),w=!Re(n.arrowStartX)||!Re(n.arrowStartY),b=!Re(n.endX)||!Re(n.endY),C=!Re(n.arrowEndX)||!Re(n.arrowEndY),T=3,k=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,D=T*k,A=go({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),j=A<D,L=go({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),_=L<D,M=!1;if(S||w||j){M=!0;var z={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},P=Math.sqrt(z.x*z.x+z.y*z.y),G={x:z.x/P,y:z.y/P},I=Math.max(i,l),F={x:n.ctrlpts[0]+G.x*2*I,y:n.ctrlpts[1]+G.y*2*I},B=c.intersectLine(r.x,r.y,i,l,F.x,F.y,0,v,y);j?(n.ctrlpts[0]=n.ctrlpts[0]+G.x*(D-A),n.ctrlpts[1]=n.ctrlpts[1]+G.y*(D-A)):(n.ctrlpts[0]=B[0]+G.x*D,n.ctrlpts[1]=B[1]+G.y*D)}if(b||C||_){M=!0;var H={x:n.ctrlpts[0]-a.x,y:n.ctrlpts[1]-a.y},K=Math.sqrt(H.x*H.x+H.y*H.y),Q={x:H.x/K,y:H.y/K},V=Math.max(i,l),q={x:n.ctrlpts[0]+Q.x*2*V,y:n.ctrlpts[1]+Q.y*2*V},X=d.intersectLine(a.x,a.y,o,f,q.x,q.y,0,m,x);_?(n.ctrlpts[0]=n.ctrlpts[0]+Q.x*(D-L),n.ctrlpts[1]=n.ctrlpts[1]+Q.y*(D-L)):(n.ctrlpts[0]=X[0]+Q.x*D,n.ctrlpts[1]=X[1]+Q.y*D)}M&&this.findEndpoints(e)}};yr.storeAllpts=function(e){var t=e._private.rscratch;if(t.edgeType==="multibezier"||t.edgeType==="bezier"||t.edgeType==="self"||t.edgeType==="compound"){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);t.allpts.push(t.endX,t.endY);var r,a;t.ctrlpts.length/2%2===0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,a=.5,t.midX=Kn(t.allpts[r],t.allpts[r+2],t.allpts[r+4],a),t.midY=Kn(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],a))}else if(t.edgeType==="straight")t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if(t.edgeType==="segments"){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var i=2;i+3<t.allpts.length;i+=2){var l=t.radii[i/2-1],o=t.isArcRadius[i/2-1];t.roundCorners.push(Aw({x:t.allpts[i-2],y:t.allpts[i-1]},{x:t.allpts[i],y:t.allpts[i+1],radius:l},{x:t.allpts[i+2],y:t.allpts[i+3]},l,o))}}if(t.segpts.length%4===0){var f=t.segpts.length/2,c=f-2;t.midX=(t.segpts[c]+t.segpts[f])/2,t.midY=(t.segpts[c+1]+t.segpts[f+1])/2}else{var d=t.segpts.length/2-1;if(!t.isRound)t.midX=t.segpts[d],t.midY=t.segpts[d+1];else{var v={x:t.segpts[d],y:t.segpts[d+1]},m=t.roundCorners[d/2];if(m.radius===0){var y={x:t.segpts[d+2],y:t.segpts[d+3]};t.midX=v.x,t.midY=v.y,t.midVector=[v.y-y.y,y.x-v.x]}else{var x=[v.x-m.cx,v.y-m.cy],S=m.radius/Math.sqrt(Math.pow(x[0],2)+Math.pow(x[1],2));x=x.map(function(w){return w*S}),t.midX=m.cx+x[0],t.midY=m.cy+x[1],t.midVector=x}}}}};yr.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||Re(t.startX)&&Re(t.startY)&&Re(t.endX)&&Re(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,Bt("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};yr.findEdgeControlPoints=function(e){var t=this;if(!(!e||e.length===0)){for(var n=this,r=n.cy,a=r.hasCompoundNodes(),i=new Ui,l=function(_,M){return[].concat(ep(_),[M?1:0]).join("-")},o=[],f=[],c=0;c<e.length;c++){var d=e[c],v=d._private,m=d.pstyle("curve-style").value;if(!(d.removed()||!d.takesUpSpace())){if(m==="haystack"){f.push(d);continue}var y=m==="unbundled-bezier"||Ys(m,"segments")||m==="straight"||m==="straight-triangle"||Ys(m,"taxi"),x=m==="unbundled-bezier"||m==="bezier",S=v.source,w=v.target,b=S.poolIndex(),C=w.poolIndex(),T=[b,C].sort(),k=l(T,y),D=i.get(k);D==null&&(D={eles:[]},o.push({pairId:T,edgeIsUnbundled:y}),i.set(k,D)),D.eles.push(d),y&&(D.hasUnbundled=!0),x&&(D.hasBezier=!0)}}for(var A=function(){var _=o[j],M=_.pairId,z=_.edgeIsUnbundled,P=l(M,z),G=i.get(P),I;if(!G.hasUnbundled){var F=G.eles[0].parallelEdges().filter(function(Oe){return Oe.isBundledBezier()});hw(G.eles),F.forEach(function(Oe){return G.eles.push(Oe)}),G.eles.sort(function(Oe,ye){return Oe.poolIndex()-ye.poolIndex()})}var B=G.eles[0],H=B.source(),K=B.target();if(H.poolIndex()>K.poolIndex()){var Q=H;H=K,K=Q}var V=G.srcPos=H.position(),q=G.tgtPos=K.position(),X=G.srcW=H.outerWidth(),U=G.srcH=H.outerHeight(),te=G.tgtW=K.outerWidth(),ie=G.tgtH=K.outerHeight(),oe=G.srcShape=n.nodeShapes[t.getNodeShape(H)],ae=G.tgtShape=n.nodeShapes[t.getNodeShape(K)],we=G.srcCornerRadius=H.pstyle("corner-radius").value==="auto"?"auto":H.pstyle("corner-radius").pfValue,fe=G.tgtCornerRadius=K.pstyle("corner-radius").value==="auto"?"auto":K.pstyle("corner-radius").pfValue,J=G.tgtRs=K._private.rscratch,ne=G.srcRs=H._private.rscratch;G.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var re=0;re<G.eles.length;re++){var ge=G.eles[re],Ne=ge[0]._private.rscratch,Be=ge.pstyle("curve-style").value,st=Be==="unbundled-bezier"||Ys(Be,"segments")||Ys(Be,"taxi"),Qe=!H.same(ge.source());if(!G.calculatedIntersection&&H!==K&&(G.hasBezier||G.hasUnbundled)){G.calculatedIntersection=!0;var Ke=oe.intersectLine(V.x,V.y,X,U,q.x,q.y,0,we,ne),qe=G.srcIntn=Ke,De=ae.intersectLine(q.x,q.y,te,ie,V.x,V.y,0,fe,J),Ge=G.tgtIntn=De,Ye=G.intersectionPts={x1:Ke[0],x2:De[0],y1:Ke[1],y2:De[1]},it=G.posPts={x1:V.x,x2:q.x,y1:V.y,y2:q.y},Pe=De[1]-Ke[1],ct=De[0]-Ke[0],he=Math.sqrt(ct*ct+Pe*Pe);Re(he)&&he>=bZ||(he=Math.sqrt(Math.max(ct*ct,td)+Math.max(Pe*Pe,td)));var Ce=G.vector={x:ct,y:Pe},je=G.vectorNorm={x:Ce.x/he,y:Ce.y/he},ze={x:-je.y,y:je.x};G.nodesOverlap=!Re(he)||ae.checkPoint(Ke[0],Ke[1],0,te,ie,q.x,q.y,fe,J)||oe.checkPoint(De[0],De[1],0,X,U,V.x,V.y,we,ne),G.vectorNormInverse=ze,I={nodesOverlap:G.nodesOverlap,dirCounts:G.dirCounts,calculatedIntersection:!0,hasBezier:G.hasBezier,hasUnbundled:G.hasUnbundled,eles:G.eles,srcPos:q,srcRs:J,tgtPos:V,tgtRs:ne,srcW:te,srcH:ie,tgtW:X,tgtH:U,srcIntn:Ge,tgtIntn:qe,srcShape:ae,tgtShape:oe,posPts:{x1:it.x2,y1:it.y2,x2:it.x1,y2:it.y1},intersectionPts:{x1:Ye.x2,y1:Ye.y2,x2:Ye.x1,y2:Ye.y1},vector:{x:-Ce.x,y:-Ce.y},vectorNorm:{x:-je.x,y:-je.y},vectorNormInverse:{x:-ze.x,y:-ze.y}}}var Me=Qe?I:G;Ne.nodesOverlap=Me.nodesOverlap,Ne.srcIntn=Me.srcIntn,Ne.tgtIntn=Me.tgtIntn,Ne.isRound=Be.startsWith("round"),a&&(H.isParent()||H.isChild()||K.isParent()||K.isChild())&&(H.parents().anySame(K)||K.parents().anySame(H)||H.same(K)&&H.isParent())?t.findCompoundLoopPoints(ge,Me,re,st):H===K?t.findLoopPoints(ge,Me,re,st):Be.endsWith("segments")?t.findSegmentsPoints(ge,Me):Be.endsWith("taxi")?t.findTaxiPoints(ge,Me):Be==="straight"||!st&&G.eles.length%2===1&&re===Math.floor(G.eles.length/2)?t.findStraightEdgePoints(ge):t.findBezierPoints(ge,Me,re,st,Qe),t.findEndpoints(ge),t.tryToCorrectInvalidPoints(ge,Me),t.checkForInvalidEdgeWarning(ge),t.storeAllpts(ge),t.storeEdgeProjections(ge),t.calculateArrowAngles(ge),t.recalculateEdgeLabelProjections(ge),t.calculateLabelAngles(ge)}},j=0;j<o.length;j++)A();this.findHaystackPoints(f)}};function XL(e){var t=[];if(e!=null){for(var n=0;n<e.length;n+=2){var r=e[n],a=e[n+1];t.push({x:r,y:a})}return t}}yr.getSegmentPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n==="segments")return XL(t.segpts)};yr.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n==="bezier"||n==="multibezier"||n==="self"||n==="compound")return XL(t.ctrlpts)};yr.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var Ad={};Ad.manualEndptToPx=function(e,t){var n=this,r=e.position(),a=e.outerWidth(),i=e.outerHeight(),l=e._private.rscratch;if(t.value.length===2){var o=[t.pfValue[0],t.pfValue[1]];return t.units[0]==="%"&&(o[0]=o[0]*a),t.units[1]==="%"&&(o[1]=o[1]*i),o[0]+=r.x,o[1]+=r.y,o}else{var f=t.pfValue[0];f=-Math.PI/2+f;var c=2*Math.max(a,i),d=[r.x+Math.cos(f)*c,r.y+Math.sin(f)*c];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,a,i,d[0],d[1],0,e.pstyle("corner-radius").value==="auto"?"auto":e.pstyle("corner-radius").pfValue,l)}};Ad.findEndpoints=function(e){var t,n,r,a,i=this,l,o=e.source()[0],f=e.target()[0],c=o.position(),d=f.position(),v=e.pstyle("target-arrow-shape").value,m=e.pstyle("source-arrow-shape").value,y=e.pstyle("target-distance-from-node").pfValue,x=e.pstyle("source-distance-from-node").pfValue,S=o._private.rscratch,w=f._private.rscratch,b=e.pstyle("curve-style").value,C=e._private.rscratch,T=C.edgeType,k=Ys(b,"taxi"),D=T==="self"||T==="compound",A=T==="bezier"||T==="multibezier"||D,j=T!=="bezier",L=T==="straight"||T==="segments",_=T==="segments",M=A||j||L,z=D||k,P=e.pstyle("source-endpoint"),G=z?"outside-to-node":P.value,I=o.pstyle("corner-radius").value==="auto"?"auto":o.pstyle("corner-radius").pfValue,F=e.pstyle("target-endpoint"),B=z?"outside-to-node":F.value,H=f.pstyle("corner-radius").value==="auto"?"auto":f.pstyle("corner-radius").pfValue;C.srcManEndpt=P,C.tgtManEndpt=F;var K,Q,V,q,X=(t=(F==null||(n=F.pfValue)===null||n===void 0?void 0:n.length)===2?F.pfValue:null)!==null&&t!==void 0?t:[0,0],U=(r=(P==null||(a=P.pfValue)===null||a===void 0?void 0:a.length)===2?P.pfValue:null)!==null&&r!==void 0?r:[0,0];if(A){var te=[C.ctrlpts[0],C.ctrlpts[1]],ie=j?[C.ctrlpts[C.ctrlpts.length-2],C.ctrlpts[C.ctrlpts.length-1]]:te;K=ie,Q=te}else if(L){var oe=_?C.segpts.slice(0,2):[d.x+X[0],d.y+X[1]],ae=_?C.segpts.slice(C.segpts.length-2):[c.x+U[0],c.y+U[1]];K=ae,Q=oe}if(B==="inside-to-node")l=[d.x,d.y];else if(F.units)l=this.manualEndptToPx(f,F);else if(B==="outside-to-line")l=C.tgtIntn;else if(B==="outside-to-node"||B==="outside-to-node-or-label"?V=K:(B==="outside-to-line"||B==="outside-to-line-or-label")&&(V=[c.x,c.y]),l=i.nodeShapes[this.getNodeShape(f)].intersectLine(d.x,d.y,f.outerWidth(),f.outerHeight(),V[0],V[1],0,H,w),B==="outside-to-node-or-label"||B==="outside-to-line-or-label"){var we=f._private.rscratch,fe=we.labelWidth,J=we.labelHeight,ne=we.labelX,re=we.labelY,ge=fe/2,Ne=J/2,Be=f.pstyle("text-valign").value;Be==="top"?re-=Ne:Be==="bottom"&&(re+=Ne);var st=f.pstyle("text-halign").value;st==="left"?ne-=ge:st==="right"&&(ne+=ge);var Qe=Qf(V[0],V[1],[ne-ge,re-Ne,ne+ge,re-Ne,ne+ge,re+Ne,ne-ge,re+Ne],d.x,d.y);if(Qe.length>0){var Ke=c,qe=Hl(Ke,Eu(l)),De=Hl(Ke,Eu(Qe)),Ge=qe;if(De<qe&&(l=Qe,Ge=De),Qe.length>2){var Ye=Hl(Ke,{x:Qe[2],y:Qe[3]});Ye<Ge&&(l=[Qe[2],Qe[3]])}}}var it=ov(l,K,i.arrowShapes[v].spacing(e)+y),Pe=ov(l,K,i.arrowShapes[v].gap(e)+y);if(C.endX=Pe[0],C.endY=Pe[1],C.arrowEndX=it[0],C.arrowEndY=it[1],G==="inside-to-node")l=[c.x,c.y];else if(P.units)l=this.manualEndptToPx(o,P);else if(G==="outside-to-line")l=C.srcIntn;else if(G==="outside-to-node"||G==="outside-to-node-or-label"?q=Q:(G==="outside-to-line"||G==="outside-to-line-or-label")&&(q=[d.x,d.y]),l=i.nodeShapes[this.getNodeShape(o)].intersectLine(c.x,c.y,o.outerWidth(),o.outerHeight(),q[0],q[1],0,I,S),G==="outside-to-node-or-label"||G==="outside-to-line-or-label"){var ct=o._private.rscratch,he=ct.labelWidth,Ce=ct.labelHeight,je=ct.labelX,ze=ct.labelY,Me=he/2,Oe=Ce/2,ye=o.pstyle("text-valign").value;ye==="top"?ze-=Oe:ye==="bottom"&&(ze+=Oe);var Y=o.pstyle("text-halign").value;Y==="left"?je-=Me:Y==="right"&&(je+=Me);var le=Qf(q[0],q[1],[je-Me,ze-Oe,je+Me,ze-Oe,je+Me,ze+Oe,je-Me,ze+Oe],c.x,c.y);if(le.length>0){var pe=d,de=Hl(pe,Eu(l)),xe=Hl(pe,Eu(le)),Le=de;if(xe<de&&(l=[le[0],le[1]],Le=xe),le.length>2){var Te=Hl(pe,{x:le[2],y:le[3]});Te<Le&&(l=[le[2],le[3]])}}}var He=ov(l,Q,i.arrowShapes[m].spacing(e)+x),Ie=ov(l,Q,i.arrowShapes[m].gap(e)+x);C.startX=Ie[0],C.startY=Ie[1],C.arrowStartX=He[0],C.arrowStartY=He[1],M&&(!Re(C.startX)||!Re(C.startY)||!Re(C.endX)||!Re(C.endY)?C.badLine=!0:C.badLine=!1)};Ad.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}};Ad.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}};var Rw={};function wZ(e,t,n){for(var r=function(c,d,v,m){return Kn(c,d,v,m)},a=t._private,i=a.rstyle.bezierPts,l=0;l<e.bezierProjPcts.length;l++){var o=e.bezierProjPcts[l];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}Rw.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,r==="multibezier"||r==="bezier"||r==="self"||r==="compound"){t.rstyle.bezierPts=[];for(var a=0;a+5<n.allpts.length;a+=4)wZ(this,e,n.allpts.slice(a,a+6))}else if(r==="segments")for(var i=t.rstyle.linePts=[],a=0;a+1<n.allpts.length;a+=2)i.push({x:n.allpts[a],y:n.allpts[a+1]});else if(r==="haystack"){var l=n.haystackPts;t.rstyle.haystackPts=[{x:l[0],y:l[1]},{x:l[2],y:l[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth};Rw.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var di={};di.recalculateNodeLabelProjection=function(e){var t=e.pstyle("label").strValue;if(!ll(t)){var n,r,a=e._private,i=e.width(),l=e.height(),o=e.padding(),f=e.position(),c=e.pstyle("text-halign").strValue,d=e.pstyle("text-valign").strValue,v=a.rscratch,m=a.rstyle;switch(c){case"left":n=f.x-i/2-o;break;case"right":n=f.x+i/2+o;break;default:n=f.x}switch(d){case"top":r=f.y-l/2-o;break;case"bottom":r=f.y+l/2+o;break;default:r=f.y}v.labelX=n,v.labelY=r,m.labelX=n,m.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var QL=function(t,n){var r=Math.atan(n/t);return t===0&&r<0&&(r=r*-1),r},WL=function(t,n){var r=n.x-t.x,a=n.y-t.y;return QL(r,a)},SZ=function(t,n,r,a){var i=Xf(0,a-.001,1),l=Xf(0,a+.001,1),o=ju(t,n,r,i),f=ju(t,n,r,l);return WL(o,f)};di.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,a=this,i={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(i.mid||i.source||i.target){t={x:r.midX,y:r.midY};var l=function(v,m,y){Bi(n.rscratch,v,m,y),Bi(n.rstyle,v,m,y)};l("labelX",null,t.x),l("labelY",null,t.y);var o=QL(r.midDispX,r.midDispY);l("labelAutoAngle",null,o);var f=function(){if(f.cache)return f.cache;for(var v=[],m=0;m+5<r.allpts.length;m+=4){var y={x:r.allpts[m],y:r.allpts[m+1]},x={x:r.allpts[m+2],y:r.allpts[m+3]},S={x:r.allpts[m+4],y:r.allpts[m+5]};v.push({p0:y,p1:x,p2:S,startDist:0,length:0,segments:[]})}var w=n.rstyle.bezierPts,b=a.bezierProjPcts.length;function C(j,L,_,M,z){var P=go(L,_),G=j.segments[j.segments.length-1],I={p0:L,p1:_,t0:M,t1:z,startDist:G?G.startDist+G.length:0,length:P};j.segments.push(I),j.length+=P}for(var T=0;T<v.length;T++){var k=v[T],D=v[T-1];D&&(k.startDist=D.startDist+D.length),C(k,k.p0,w[T*b],0,a.bezierProjPcts[0]);for(var A=0;A<b-1;A++)C(k,w[T*b+A],w[T*b+A+1],a.bezierProjPcts[A],a.bezierProjPcts[A+1]);C(k,w[T*b+b-1],k.p2,a.bezierProjPcts[b-1],1)}return f.cache=v},c=function(v){var m,y=v==="source";if(i[v]){var x=e.pstyle(v+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var S=f(),w,b=0,C=0,T=0;T<S.length;T++){for(var k=S[y?T:S.length-1-T],D=0;D<k.segments.length;D++){var A=k.segments[y?D:k.segments.length-1-D],j=T===S.length-1&&D===k.segments.length-1;if(b=C,C+=A.length,C>=x||j){w={cp:k,segment:A};break}}if(w)break}var L=w.cp,_=w.segment,M=(x-b)/_.length,z=_.t1-_.t0,P=y?_.t0+z*M:_.t1-z*M;P=Xf(0,P,1),t=ju(L.p0,L.p1,L.p2,P),m=SZ(L.p0,L.p1,L.p2,P);break}case"straight":case"segments":case"haystack":{for(var G=0,I,F,B,H,K=r.allpts.length,Q=0;Q+3<K&&(y?(B={x:r.allpts[Q],y:r.allpts[Q+1]},H={x:r.allpts[Q+2],y:r.allpts[Q+3]}):(B={x:r.allpts[K-2-Q],y:r.allpts[K-1-Q]},H={x:r.allpts[K-4-Q],y:r.allpts[K-3-Q]}),I=go(B,H),F=G,G+=I,!(G>=x));Q+=2);var V=x-F,q=V/I;q=Xf(0,q,1),t=HK(B,H,q),m=WL(B,H);break}}l("labelX",v,t.x),l("labelY",v,t.y),l("labelAutoAngle",v,m)}};c("source"),c("target"),this.applyLabelDimensions(e)}};di.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))};di.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=mo(r,e._private.labelDimsKey);if(zr(n.rscratch,"prefixedLabelDimsKey",t)!==a){Bi(n.rscratch,"prefixedLabelDimsKey",t,a);var i=this.calculateLabelDimensions(e,r),l=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,f=zr(n.rscratch,"labelWrapCachedLines",t)||[],c=o!=="wrap"?1:Math.max(f.length,1),d=i.height/c,v=d*l,m=i.width,y=i.height+(c-1)*(l-1)*d;Bi(n.rstyle,"labelWidth",t,m),Bi(n.rscratch,"labelWidth",t,m),Bi(n.rstyle,"labelHeight",t,y),Bi(n.rscratch,"labelHeight",t,y),Bi(n.rscratch,"labelLineHeight",t,v)}};di.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",a=e.pstyle(r+"label").strValue,i=e.pstyle("text-transform").value,l=function(U,te){return te?(Bi(n.rscratch,U,t,te),te):zr(n.rscratch,U,t)};if(!a)return"";i=="none"||(i=="uppercase"?a=a.toUpperCase():i=="lowercase"&&(a=a.toLowerCase()));var o=e.pstyle("text-wrap").value;if(o==="wrap"){var f=l("labelKey");if(f!=null&&l("labelWrapKey")===f)return l("labelWrapCachedText");for(var c="​",d=a.split(`
421
+ `),v=e.pstyle("text-max-width").pfValue,m=e.pstyle("text-overflow-wrap").value,y=m==="anywhere",x=[],S=/[\s\u200b]+|$/g,w=0;w<d.length;w++){var b=d[w],C=this.calculateLabelDimensions(e,b),T=C.width;if(y){var k=b.split("").join(c);b=k}if(T>v){var D=b.matchAll(S),A="",j=0,L=Fr(D),_;try{for(L.s();!(_=L.n()).done;){var M=_.value,z=M[0],P=b.substring(j,M.index);j=M.index+z.length;var G=A.length===0?P:A+P+z,I=this.calculateLabelDimensions(e,G),F=I.width;F<=v?A+=P+z:(A&&x.push(A),A=P+z)}}catch(X){L.e(X)}finally{L.f()}A.match(/^[\s\u200b]+$/)||x.push(A)}else x.push(b)}l("labelWrapCachedLines",x),a=l("labelWrapCachedText",x.join(`
422
+ `)),l("labelWrapKey",f)}else if(o==="ellipsis"){var B=e.pstyle("text-max-width").pfValue,H="",K="…",Q=!1;if(this.calculateLabelDimensions(e,a).width<B)return a;for(var V=0;V<a.length;V++){var q=this.calculateLabelDimensions(e,H+a[V]+K).width;if(q>B)break;H+=a[V],V===a.length-1&&(Q=!0)}return Q||(H+=K),H}return a};di.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if(t==="auto")if(e.isNode())switch(n){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return t};di.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window(),a=r.document,i=0,l=e.pstyle("font-style").strValue,o=e.pstyle("font-size").pfValue,f=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,d=this.labelCalcCanvas,v=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=a.createElement("canvas"),v=this.labelCalcCanvasContext=d.getContext("2d");var m=d.style;m.position="absolute",m.left="-9999px",m.top="-9999px",m.zIndex="-1",m.visibility="hidden",m.pointerEvents="none"}v.font="".concat(l," ").concat(c," ").concat(o,"px ").concat(f);for(var y=0,x=0,S=t.split(`
423
+ `),w=0;w<S.length;w++){var b=S[w],C=v.measureText(b),T=Math.ceil(C.width),k=o;y=Math.max(T,y),x+=k}return y+=i,x+=i,{width:y,height:x}};di.calculateLabelAngle=function(e,t){var n=e._private,r=n.rscratch,a=e.isEdge(),i=t?t+"-":"",l=e.pstyle(i+"text-rotation"),o=l.strValue;return o==="none"?0:a&&o==="autorotate"?r.labelAutoAngle:o==="autorotate"?0:l.pfValue};di.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private,a=r.rscratch;a.labelAngle=t.calculateLabelAngle(e),n&&(a.sourceLabelAngle=t.calculateLabelAngle(e,"source"),a.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var ZL={},MA=28,OA=!1;ZL.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if(n==="cutrectangle"&&(e.width()<MA||e.height()<MA))return OA||(Bt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),OA=!0),"rectangle";if(e.isParent())return n==="rectangle"||n==="roundrectangle"||n==="round-rectangle"||n==="cutrectangle"||n==="cut-rectangle"||n==="barrel"?n:"rectangle";if(n==="polygon"){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n};var am={};am.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(l){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(l),o)for(var f=0;f<l.length;f++){var c=l[f],d=c._private,v=d.rstyle;v.clean=!1,v.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",function(l){var o=l.target;r(o)}).on("style.* background.*",function(l){var o=l.target;r(o,!1)});var a=function(l){if(l){var o=n.onUpdateEleCalcsFns;t.cleanStyle();for(var f=0;f<t.length;f++){var c=t[f],d=c._private.rstyle;c.isNode()&&!d.cleanConnected&&(r(c.connectedEdges()),d.cleanConnected=!0)}if(o)for(var v=0;v<o.length;v++){var m=o[v];m(l,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){a(!0)},n.beforeRender(a,n.beforeRenderPriorities.eleCalcs)};am.onUpdateEleCalcs=function(e){var t=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];t.push(e)};am.recalculateRenderedStyle=function(e,t){var n=function(k){return k._private.rstyle.cleanConnected};if(e.length!==0){var r=[],a=[];if(!this.destroyed){t===void 0&&(t=!0);for(var i=0;i<e.length;i++){var l=e[i],o=l._private,f=o.rstyle;l.isEdge()&&(!n(l.source())||!n(l.target()))&&(f.clean=!1),l.isEdge()&&l.isBundledBezier()&&l.parallelEdges().some(function(T){return!T._private.rstyle.clean&&T.isBundledBezier()})&&(f.clean=!1),!(t&&f.clean||l.removed())&&l.pstyle("display").value!=="none"&&(o.group==="nodes"?a.push(l):r.push(l),f.clean=!0)}for(var c=0;c<a.length;c++){var d=a[c],v=d._private,m=v.rstyle,y=d.position();this.recalculateNodeLabelProjection(d),m.nodeX=y.x,m.nodeY=y.y,m.nodeW=d.pstyle("width").pfValue,m.nodeH=d.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var x=0;x<r.length;x++){var S=r[x],w=S._private,b=w.rstyle,C=w.rscratch;b.srcX=C.arrowStartX,b.srcY=C.arrowStartY,b.tgtX=C.arrowEndX,b.tgtY=C.arrowEndY,b.midX=C.midX,b.midY=C.midY,b.labelAngle=C.labelAngle,b.sourceLabelAngle=C.sourceLabelAngle,b.targetLabelAngle=C.targetLabelAngle}}}};var im={};im.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],a=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):a.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}};im.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};im.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(OL),t.interactive=t.filter(function(n){return n.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var JL={};[Eo,cp,yr,Ad,Rw,di,ZL,am,im].forEach(function(e){nt(JL,e)});var e_={};e_.getCachedImage=function(e,t,n){var r=this,a=r.imageCache=r.imageCache||{},i=a[e];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;i=a[e]=a[e]||{};var l=i.image=new Image;l.addEventListener("load",n),l.addEventListener("error",function(){l.error=!0});var o="data:",f=e.substring(0,o.length).toLowerCase()===o;return f||(t=t==="null"?null:t,l.crossOrigin=t),l.src=e,l};var pc={};pc.registerBinding=function(e,t,n,r){var a=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var i=[],l=0;l<e.length;l++){var o=e[l];if(o!==void 0){var f=this.binder(o);i.push(f.on.apply(f,a))}}return i}var f=this.binder(e);return f.on.apply(f,a)};pc.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||LY(e);if(t.supportsPassiveEvents==null){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});n.addEventListener("test",null,i)}catch{}t.supportsPassiveEvents=a}var l=function(f,c,d){var v=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(v[2]={capture:d??!1,passive:!1,once:!1}),t.bindings.push({target:e,args:v}),(e.addEventListener||e.on).apply(e,v),this};return{on:l,addEventListener:l,addListener:l,bind:l}};pc.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()};pc.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()};pc.load=function(){var e=this,t=e.cy.window(),n=function(Y){return Y.selected()},r=function(Y){var le=Y.getRootNode();if(le&&le.nodeType===11&&le.host!==void 0)return le},a=function(Y,le,pe,de){Y==null&&(Y=e.cy);for(var xe=0;xe<le.length;xe++){var Le=le[xe];Y.emit({originalEvent:pe,type:Le,position:de})}},i=function(Y){return Y.shiftKey||Y.metaKey||Y.ctrlKey},l=function(Y,le){var pe=!0;if(e.cy.hasCompoundNodes()&&Y&&Y.pannable())for(var de=0;le&&de<le.length;de++){var Y=le[de];if(Y.isNode()&&Y.isParent()&&!Y.pannable()){pe=!1;break}}else pe=!0;return pe},o=function(Y){Y[0]._private.grabbed=!0},f=function(Y){Y[0]._private.grabbed=!1},c=function(Y){Y[0]._private.rscratch.inDragLayer=!0},d=function(Y){Y[0]._private.rscratch.inDragLayer=!1},v=function(Y){Y[0]._private.rscratch.isGrabTarget=!0},m=function(Y){Y[0]._private.rscratch.isGrabTarget=!1},y=function(Y,le){var pe=le.addToList,de=pe.has(Y);!de&&Y.grabbable()&&!Y.locked()&&(pe.merge(Y),o(Y))},x=function(Y,le){if(Y.cy().hasCompoundNodes()&&!(le.inDragLayer==null&&le.addToList==null)){var pe=Y.descendants();le.inDragLayer&&(pe.forEach(c),pe.connectedEdges().forEach(c)),le.addToList&&y(pe,le)}},S=function(Y,le){le=le||{};var pe=Y.cy().hasCompoundNodes();le.inDragLayer&&(Y.forEach(c),Y.neighborhood().stdFilter(function(de){return!pe||de.isEdge()}).forEach(c)),le.addToList&&Y.forEach(function(de){y(de,le)}),x(Y,le),C(Y,{inDragLayer:le.inDragLayer}),e.updateCachedGrabbedEles()},w=S,b=function(Y){Y&&(e.getCachedZSortedEles().forEach(function(le){f(le),d(le),m(le)}),e.updateCachedGrabbedEles())},C=function(Y,le){if(!(le.inDragLayer==null&&le.addToList==null)&&Y.cy().hasCompoundNodes()){var pe=Y.ancestors().orphans();if(!pe.same(Y)){var de=pe.descendants().spawnSelf().merge(pe).unmerge(Y).unmerge(Y.descendants()),xe=de.connectedEdges();le.inDragLayer&&(xe.forEach(c),de.forEach(c)),le.addToList&&de.forEach(function(Le){y(Le,le)})}}},T=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},k=typeof MutationObserver<"u",D=typeof ResizeObserver<"u";k?(e.removeObserver=new MutationObserver(function(ye){for(var Y=0;Y<ye.length;Y++){var le=ye[Y],pe=le.removedNodes;if(pe)for(var de=0;de<pe.length;de++){var xe=pe[de];if(xe===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",function(ye){e.destroy()});var A=Cd(function(){e.cy.resize()},100);k&&(e.styleObserver=new MutationObserver(A),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",A),D&&(e.resizeObserver=new ResizeObserver(A),e.resizeObserver.observe(e.container));var j=function(Y,le){for(;Y!=null;)le(Y),Y=Y.parentNode},L=function(){e.invalidateContainerClientCoordsCache()};j(e.container,function(ye){e.registerBinding(ye,"transitionend",L),e.registerBinding(ye,"animationend",L),e.registerBinding(ye,"scroll",L)}),e.registerBinding(e.container,"contextmenu",function(ye){ye.preventDefault()});var _=function(){return e.selection[4]!==0},M=function(Y){for(var le=e.findContainerClientCoords(),pe=le[0],de=le[1],xe=le[2],Le=le[3],Te=Y.touches?Y.touches:[Y],He=!1,Ie=0;Ie<Te.length;Ie++){var Xe=Te[Ie];if(pe<=Xe.clientX&&Xe.clientX<=pe+xe&&de<=Xe.clientY&&Xe.clientY<=de+Le){He=!0;break}}if(!He)return!1;for(var lt=e.container,ot=Y.target,Ue=ot.parentNode,yt=!1;Ue;){if(Ue===lt){yt=!0;break}Ue=Ue.parentNode}return!!yt};e.registerBinding(e.container,"mousedown",function(Y){if(M(Y)&&!(e.hoverData.which===1&&Y.which!==1)){Y.preventDefault(),T(),e.hoverData.capture=!0,e.hoverData.which=Y.which;var le=e.cy,pe=[Y.clientX,Y.clientY],de=e.projectIntoViewport(pe[0],pe[1]),xe=e.selection,Le=e.findNearestElements(de[0],de[1],!0,!1),Te=Le[0],He=e.dragData.possibleDragElements;e.hoverData.mdownPos=de,e.hoverData.mdownGPos=pe;var Ie=function(ht){return{originalEvent:Y,type:ht,position:{x:de[0],y:de[1]}}},Xe=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var ht=e.hoverData.down;ht?ht.emit(Ie("taphold")):le.emit(Ie("taphold"))}},e.tapholdDuration)};if(Y.which==3){e.hoverData.cxtStarted=!0;var lt={originalEvent:Y,type:"cxttapstart",position:{x:de[0],y:de[1]}};Te?(Te.activate(),Te.emit(lt),e.hoverData.down=Te):le.emit(lt),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(Y.which==1){Te&&Te.activate();{if(Te!=null&&e.nodeIsGrabbable(Te)){var ot=function(ht){ht.emit(Ie("grab"))};if(v(Te),!Te.selected())He=e.dragData.possibleDragElements=le.collection(),w(Te,{addToList:He}),Te.emit(Ie("grabon")).emit(Ie("grab"));else{He=e.dragData.possibleDragElements=le.collection();var Ue=le.$(function(yt){return yt.isNode()&&yt.selected()&&e.nodeIsGrabbable(yt)});S(Ue,{addToList:He}),Te.emit(Ie("grabon")),Ue.forEach(ot)}e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=Te,e.hoverData.downs=Le,e.hoverData.downTime=new Date().getTime()}a(Te,["mousedown","tapstart","vmousedown"],Y,{x:de[0],y:de[1]}),Te==null?(xe[4]=1,e.data.bgActivePosistion={x:de[0],y:de[1]},e.redrawHint("select",!0),e.redraw()):Te.pannable()&&(xe[4]=1),Xe()}xe[0]=xe[2]=de[0],xe[1]=xe[3]=de[1]}},!1);var z=r(e.container);e.registerBinding([t,z],"mousemove",function(Y){var le=e.hoverData.capture;if(!(!le&&!M(Y))){var pe=!1,de=e.cy,xe=de.zoom(),Le=[Y.clientX,Y.clientY],Te=e.projectIntoViewport(Le[0],Le[1]),He=e.hoverData.mdownPos,Ie=e.hoverData.mdownGPos,Xe=e.selection,lt=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(lt=e.findNearestElement(Te[0],Te[1],!0,!1));var ot=e.hoverData.last,Ue=e.hoverData.down,yt=[Te[0]-Xe[2],Te[1]-Xe[3]],ht=e.dragData.possibleDragElements,ln;if(Ie){var Ft=Le[0]-Ie[0],Zn=Ft*Ft,on=Le[1]-Ie[1],yn=on*on,dn=Zn+yn;e.hoverData.isOverThresholdDrag=ln=dn>=e.desktopTapThreshold2}var xn=i(Y);ln&&(e.hoverData.tapholdCancelled=!0);var na=function(){var Hn=e.hoverData.dragDelta=e.hoverData.dragDelta||[];Hn.length===0?(Hn.push(yt[0]),Hn.push(yt[1])):(Hn[0]+=yt[0],Hn[1]+=yt[1])};pe=!0,a(lt,["mousemove","vmousemove","tapdrag"],Y,{x:Te[0],y:Te[1]});var un=function(Hn){return{originalEvent:Y,type:Hn,position:{x:Te[0],y:Te[1]}}},ra=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||de.emit(un("boxstart")),Xe[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(ln){var qn=un("cxtdrag");Ue?Ue.emit(qn):de.emit(qn),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||lt!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(un("cxtdragout")),e.hoverData.cxtOver=lt,lt&&lt.emit(un("cxtdragover")))}}else if(e.hoverData.dragging){if(pe=!0,de.panningEnabled()&&de.userPanningEnabled()){var rn;if(e.hoverData.justStartedPan){var On=e.hoverData.mdownPos;rn={x:(Te[0]-On[0])*xe,y:(Te[1]-On[1])*xe},e.hoverData.justStartedPan=!1}else rn={x:yt[0]*xe,y:yt[1]*xe};de.panBy(rn),de.emit(un("dragpan")),e.hoverData.dragged=!0}Te=e.projectIntoViewport(Y.clientX,Y.clientY)}else if(Xe[4]==1&&(Ue==null||Ue.pannable())){if(ln){if(!e.hoverData.dragging&&de.boxSelectionEnabled()&&(xn||!de.panningEnabled()||!de.userPanningEnabled()))ra();else if(!e.hoverData.selecting&&de.panningEnabled()&&de.userPanningEnabled()){var kr=l(Ue,e.hoverData.downs);kr&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,Xe[4]=0,e.data.bgActivePosistion=Eu(He),e.redrawHint("select",!0),e.redraw())}Ue&&Ue.pannable()&&Ue.active()&&Ue.unactivate()}}else{if(Ue&&Ue.pannable()&&Ue.active()&&Ue.unactivate(),(!Ue||!Ue.grabbed())&&lt!=ot&&(ot&&a(ot,["mouseout","tapdragout"],Y,{x:Te[0],y:Te[1]}),lt&&a(lt,["mouseover","tapdragover"],Y,{x:Te[0],y:Te[1]}),e.hoverData.last=lt),Ue)if(ln){if(de.boxSelectionEnabled()&&xn)Ue&&Ue.grabbed()&&(b(ht),Ue.emit(un("freeon")),ht.emit(un("free")),e.dragData.didDrag&&(Ue.emit(un("dragfreeon")),ht.emit(un("dragfree")))),ra();else if(Ue&&Ue.grabbed()&&e.nodeIsDraggable(Ue)){var Un=!e.dragData.didDrag;Un&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||S(ht,{inDragLayer:!0});var Vn={x:0,y:0};if(Re(yt[0])&&Re(yt[1])&&(Vn.x+=yt[0],Vn.y+=yt[1],Un)){var ur=e.hoverData.dragDelta;ur&&Re(ur[0])&&Re(ur[1])&&(Vn.x+=ur[0],Vn.y+=ur[1])}e.hoverData.draggingEles=!0,ht.silentShift(Vn).emit(un("position")).emit(un("drag")),e.redrawHint("drag",!0),e.redraw()}}else na();pe=!0}if(Xe[2]=Te[0],Xe[3]=Te[1],pe)return Y.stopPropagation&&Y.stopPropagation(),Y.preventDefault&&Y.preventDefault(),!1}},!1);var P,G,I;e.registerBinding(t,"mouseup",function(Y){if(!(e.hoverData.which===1&&Y.which!==1&&e.hoverData.capture)){var le=e.hoverData.capture;if(le){e.hoverData.capture=!1;var pe=e.cy,de=e.projectIntoViewport(Y.clientX,Y.clientY),xe=e.selection,Le=e.findNearestElement(de[0],de[1],!0,!1),Te=e.dragData.possibleDragElements,He=e.hoverData.down,Ie=i(Y);e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,He&&He.unactivate();var Xe=function(Ft){return{originalEvent:Y,type:Ft,position:{x:de[0],y:de[1]}}};if(e.hoverData.which===3){var lt=Xe("cxttapend");if(He?He.emit(lt):pe.emit(lt),!e.hoverData.cxtDragged){var ot=Xe("cxttap");He?He.emit(ot):pe.emit(ot)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(a(Le,["mouseup","tapend","vmouseup"],Y,{x:de[0],y:de[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(a(He,["click","tap","vclick"],Y,{x:de[0],y:de[1]}),G=!1,Y.timeStamp-I<=pe.multiClickDebounceTime()?(P&&clearTimeout(P),G=!0,I=null,a(He,["dblclick","dbltap","vdblclick"],Y,{x:de[0],y:de[1]})):(P=setTimeout(function(){G||a(He,["oneclick","onetap","voneclick"],Y,{x:de[0],y:de[1]})},pe.multiClickDebounceTime()),I=Y.timeStamp)),He==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!i(Y)&&(pe.$(n).unselect(["tapunselect"]),Te.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=Te=pe.collection()),Le==He&&!e.dragData.didDrag&&!e.hoverData.selecting&&Le!=null&&Le._private.selectable&&(e.hoverData.dragging||(pe.selectionType()==="additive"||Ie?Le.selected()?Le.unselect(["tapunselect"]):Le.select(["tapselect"]):Ie||(pe.$(n).unmerge(Le).unselect(["tapunselect"]),Le.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var Ue=pe.collection(e.getAllInBox(xe[0],xe[1],xe[2],xe[3]));e.redrawHint("select",!0),Ue.length>0&&e.redrawHint("eles",!0),pe.emit(Xe("boxend"));var yt=function(Ft){return Ft.selectable()&&!Ft.selected()};pe.selectionType()==="additive"||Ie||pe.$(n).unmerge(Ue).unselect(),Ue.emit(Xe("box")).stdFilter(yt).select().emit(Xe("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!xe[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var ht=He&&He.grabbed();b(Te),ht&&(He.emit(Xe("freeon")),Te.emit(Xe("free")),e.dragData.didDrag&&(He.emit(Xe("dragfreeon")),Te.emit(Xe("dragfree"))))}}xe[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}},!1);var F=[],B=4,H,K=1e5,Q=function(Y,le){for(var pe=0;pe<Y.length;pe++)if(Y[pe]%le!==0)return!1;return!0},V=function(Y){for(var le=Math.abs(Y[0]),pe=1;pe<Y.length;pe++)if(Math.abs(Y[pe])!==le)return!1;return!0},q=function(Y){var le=!1,pe=Y.deltaY;if(pe==null&&(Y.wheelDeltaY!=null?pe=Y.wheelDeltaY/4:Y.wheelDelta!=null&&(pe=Y.wheelDelta/4)),pe!==0){if(H==null)if(F.length>=B){var de=F;if(H=Q(de,5),!H){var xe=Math.abs(de[0]);H=V(de)&&xe>5}if(H)for(var Le=0;Le<de.length;Le++)K=Math.min(Math.abs(de[Le]),K)}else F.push(pe),le=!0;else H&&(K=Math.min(Math.abs(pe),K));if(!e.scrollingPage){var Te=e.cy,He=Te.zoom(),Ie=Te.pan(),Xe=e.projectIntoViewport(Y.clientX,Y.clientY),lt=[Xe[0]*He+Ie.x,Xe[1]*He+Ie.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||_()){Y.preventDefault();return}if(Te.panningEnabled()&&Te.userPanningEnabled()&&Te.zoomingEnabled()&&Te.userZoomingEnabled()){Y.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()},150);var ot;le&&Math.abs(pe)>5&&(pe=pw(pe)*5),ot=pe/-250,H&&(ot/=K,ot*=3),ot=ot*e.wheelSensitivity;var Ue=Y.deltaMode===1;Ue&&(ot*=33);var yt=Te.zoom()*Math.pow(10,ot);Y.type==="gesturechange"&&(yt=e.gestureStartZoom*Y.scale),Te.zoom({level:yt,renderedPosition:{x:lt[0],y:lt[1]}}),Te.emit({type:Y.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:Y,position:{x:Xe[0],y:Xe[1]}})}}}};e.registerBinding(e.container,"wheel",q,!0),e.registerBinding(t,"scroll",function(Y){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(Y){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||Y.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(ye){e.hasTouchStarted||q(ye)},!0),e.registerBinding(e.container,"mouseout",function(Y){var le=e.projectIntoViewport(Y.clientX,Y.clientY);e.cy.emit({originalEvent:Y,type:"mouseout",position:{x:le[0],y:le[1]}})},!1),e.registerBinding(e.container,"mouseover",function(Y){var le=e.projectIntoViewport(Y.clientX,Y.clientY);e.cy.emit({originalEvent:Y,type:"mouseover",position:{x:le[0],y:le[1]}})},!1);var X,U,te,ie,oe,ae,we,fe,J,ne,re,ge,Ne,Be=function(Y,le,pe,de){return Math.sqrt((pe-Y)*(pe-Y)+(de-le)*(de-le))},st=function(Y,le,pe,de){return(pe-Y)*(pe-Y)+(de-le)*(de-le)},Qe;e.registerBinding(e.container,"touchstart",Qe=function(Y){if(e.hasTouchStarted=!0,!!M(Y)){T(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var le=e.cy,pe=e.touchData.now,de=e.touchData.earlier;if(Y.touches[0]){var xe=e.projectIntoViewport(Y.touches[0].clientX,Y.touches[0].clientY);pe[0]=xe[0],pe[1]=xe[1]}if(Y.touches[1]){var xe=e.projectIntoViewport(Y.touches[1].clientX,Y.touches[1].clientY);pe[2]=xe[0],pe[3]=xe[1]}if(Y.touches[2]){var xe=e.projectIntoViewport(Y.touches[2].clientX,Y.touches[2].clientY);pe[4]=xe[0],pe[5]=xe[1]}var Le=function(xn){return{originalEvent:Y,type:xn,position:{x:pe[0],y:pe[1]}}};if(Y.touches[1]){e.touchData.singleTouchMoved=!0,b(e.dragData.touchDragEles);var Te=e.findContainerClientCoords();J=Te[0],ne=Te[1],re=Te[2],ge=Te[3],X=Y.touches[0].clientX-J,U=Y.touches[0].clientY-ne,te=Y.touches[1].clientX-J,ie=Y.touches[1].clientY-ne,Ne=0<=X&&X<=re&&0<=te&&te<=re&&0<=U&&U<=ge&&0<=ie&&ie<=ge;var He=le.pan(),Ie=le.zoom();oe=Be(X,U,te,ie),ae=st(X,U,te,ie),we=[(X+te)/2,(U+ie)/2],fe=[(we[0]-He.x)/Ie,(we[1]-He.y)/Ie];var Xe=200,lt=Xe*Xe;if(ae<lt&&!Y.touches[2]){var ot=e.findNearestElement(pe[0],pe[1],!0,!0),Ue=e.findNearestElement(pe[2],pe[3],!0,!0);ot&&ot.isNode()?(ot.activate().emit(Le("cxttapstart")),e.touchData.start=ot):Ue&&Ue.isNode()?(Ue.activate().emit(Le("cxttapstart")),e.touchData.start=Ue):le.emit(Le("cxttapstart")),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,e.redraw();return}}if(Y.touches[2])le.boxSelectionEnabled()&&Y.preventDefault();else if(!Y.touches[1]){if(Y.touches[0]){var yt=e.findNearestElements(pe[0],pe[1],!0,!0),ht=yt[0];if(ht!=null&&(ht.activate(),e.touchData.start=ht,e.touchData.starts=yt,e.nodeIsGrabbable(ht))){var ln=e.dragData.touchDragEles=le.collection(),Ft=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),ht.selected()?(Ft=le.$(function(dn){return dn.selected()&&e.nodeIsGrabbable(dn)}),S(Ft,{addToList:ln})):w(ht,{addToList:ln}),v(ht),ht.emit(Le("grabon")),Ft?Ft.forEach(function(dn){dn.emit(Le("grab"))}):ht.emit(Le("grab"))}a(ht,["touchstart","tapstart","vmousedown"],Y,{x:pe[0],y:pe[1]}),ht==null&&(e.data.bgActivePosistion={x:xe[0],y:xe[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved===!1&&!e.pinching&&!e.touchData.selecting&&a(e.touchData.start,["taphold"],Y,{x:pe[0],y:pe[1]})},e.tapholdDuration)}}if(Y.touches.length>=1){for(var Zn=e.touchData.startPosition=[null,null,null,null,null,null],on=0;on<pe.length;on++)Zn[on]=de[on]=pe[on];var yn=Y.touches[0];e.touchData.startGPosition=[yn.clientX,yn.clientY]}}},!1);var Ke;e.registerBinding(t,"touchmove",Ke=function(Y){var le=e.touchData.capture;if(!(!le&&!M(Y))){var pe=e.selection,de=e.cy,xe=e.touchData.now,Le=e.touchData.earlier,Te=de.zoom();if(Y.touches[0]){var He=e.projectIntoViewport(Y.touches[0].clientX,Y.touches[0].clientY);xe[0]=He[0],xe[1]=He[1]}if(Y.touches[1]){var He=e.projectIntoViewport(Y.touches[1].clientX,Y.touches[1].clientY);xe[2]=He[0],xe[3]=He[1]}if(Y.touches[2]){var He=e.projectIntoViewport(Y.touches[2].clientX,Y.touches[2].clientY);xe[4]=He[0],xe[5]=He[1]}var Ie=function(Ld){return{originalEvent:Y,type:Ld,position:{x:xe[0],y:xe[1]}}},Xe=e.touchData.startGPosition,lt;if(le&&Y.touches[0]&&Xe){for(var ot=[],Ue=0;Ue<xe.length;Ue++)ot[Ue]=xe[Ue]-Le[Ue];var yt=Y.touches[0].clientX-Xe[0],ht=yt*yt,ln=Y.touches[0].clientY-Xe[1],Ft=ln*ln,Zn=ht+Ft;lt=Zn>=e.touchTapThreshold2}if(le&&e.touchData.cxt){Y.preventDefault();var on=Y.touches[0].clientX-J,yn=Y.touches[0].clientY-ne,dn=Y.touches[1].clientX-J,xn=Y.touches[1].clientY-ne,na=st(on,yn,dn,xn),un=na/ae,ra=150,qn=ra*ra,rn=1.5,On=rn*rn;if(un>=On||na>=qn){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var kr=Ie("cxttapend");e.touchData.start?(e.touchData.start.unactivate().emit(kr),e.touchData.start=null):de.emit(kr)}}if(le&&e.touchData.cxt){var kr=Ie("cxtdrag");e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(kr):de.emit(kr),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var Un=e.findNearestElement(xe[0],xe[1],!0,!0);(!e.touchData.cxtOver||Un!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit(Ie("cxtdragout")),e.touchData.cxtOver=Un,Un&&Un.emit(Ie("cxtdragover")))}else if(le&&Y.touches[2]&&de.boxSelectionEnabled())Y.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||de.emit(Ie("boxstart")),e.touchData.selecting=!0,e.touchData.didSelect=!0,pe[4]=1,!pe||pe.length===0||pe[0]===void 0?(pe[0]=(xe[0]+xe[2]+xe[4])/3,pe[1]=(xe[1]+xe[3]+xe[5])/3,pe[2]=(xe[0]+xe[2]+xe[4])/3+1,pe[3]=(xe[1]+xe[3]+xe[5])/3+1):(pe[2]=(xe[0]+xe[2]+xe[4])/3,pe[3]=(xe[1]+xe[3]+xe[5])/3),e.redrawHint("select",!0),e.redraw();else if(le&&Y.touches[1]&&!e.touchData.didSelect&&de.zoomingEnabled()&&de.panningEnabled()&&de.userZoomingEnabled()&&de.userPanningEnabled()){Y.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Vn=e.dragData.touchDragEles;if(Vn){e.redrawHint("drag",!0);for(var ur=0;ur<Vn.length;ur++){var ts=Vn[ur]._private;ts.grabbed=!1,ts.rscratch.inDragLayer=!1}}var Hn=e.touchData.start,on=Y.touches[0].clientX-J,yn=Y.touches[0].clientY-ne,dn=Y.touches[1].clientX-J,xn=Y.touches[1].clientY-ne,To=Be(on,yn,dn,xn),ns=To/oe;if(Ne){var rs=on-X,El=yn-U,as=dn-te,Tn=xn-ie,jd=(rs+as)/2,Md=(El+Tn)/2,Ur=de.zoom(),za=Ur*ns,No=de.pan(),gc=fe[0]*Ur+No.x,yc=fe[1]*Ur+No.y,sm={x:-za/Ur*(gc-No.x-jd)+gc,y:-za/Ur*(yc-No.y-Md)+yc};if(Hn&&Hn.active()){var Vn=e.dragData.touchDragEles;b(Vn),e.redrawHint("drag",!0),e.redrawHint("eles",!0),Hn.unactivate().emit(Ie("freeon")),Vn.emit(Ie("free")),e.dragData.didDrag&&(Hn.emit(Ie("dragfreeon")),Vn.emit(Ie("dragfree")))}de.viewport({zoom:za,pan:sm,cancelOnFailedZoom:!0}),de.emit(Ie("pinchzoom")),oe=To,X=on,U=yn,te=dn,ie=xn,e.pinching=!0}if(Y.touches[0]){var He=e.projectIntoViewport(Y.touches[0].clientX,Y.touches[0].clientY);xe[0]=He[0],xe[1]=He[1]}if(Y.touches[1]){var He=e.projectIntoViewport(Y.touches[1].clientX,Y.touches[1].clientY);xe[2]=He[0],xe[3]=He[1]}if(Y.touches[2]){var He=e.projectIntoViewport(Y.touches[2].clientX,Y.touches[2].clientY);xe[4]=He[0],xe[5]=He[1]}}else if(Y.touches[0]&&!e.touchData.didSelect){var cr=e.touchData.start,is=e.touchData.last,Un;if(!e.hoverData.draggingEles&&!e.swipePanning&&(Un=e.findNearestElement(xe[0],xe[1],!0,!0)),le&&cr!=null&&Y.preventDefault(),le&&cr!=null&&e.nodeIsDraggable(cr))if(lt){var Vn=e.dragData.touchDragEles,aa=!e.dragData.didDrag;aa&&S(Vn,{inDragLayer:!0}),e.dragData.didDrag=!0;var Gn={x:0,y:0};if(Re(ot[0])&&Re(ot[1])&&(Gn.x+=ot[0],Gn.y+=ot[1],aa)){e.redrawHint("eles",!0);var Ar=e.touchData.dragDelta;Ar&&Re(Ar[0])&&Re(Ar[1])&&(Gn.x+=Ar[0],Gn.y+=Ar[1])}e.hoverData.draggingEles=!0,Vn.silentShift(Gn).emit(Ie("position")).emit(Ie("drag")),e.redrawHint("drag",!0),e.touchData.startPosition[0]==Le[0]&&e.touchData.startPosition[1]==Le[1]&&e.redrawHint("eles",!0),e.redraw()}else{var Ar=e.touchData.dragDelta=e.touchData.dragDelta||[];Ar.length===0?(Ar.push(ot[0]),Ar.push(ot[1])):(Ar[0]+=ot[0],Ar[1]+=ot[1])}if(a(cr||Un,["touchmove","tapdrag","vmousemove"],Y,{x:xe[0],y:xe[1]}),(!cr||!cr.grabbed())&&Un!=is&&(is&&is.emit(Ie("tapdragout")),Un&&Un.emit(Ie("tapdragover"))),e.touchData.last=Un,le)for(var ur=0;ur<xe.length;ur++)xe[ur]&&e.touchData.startPosition[ur]&&lt&&(e.touchData.singleTouchMoved=!0);if(le&&(cr==null||cr.pannable())&&de.panningEnabled()&&de.userPanningEnabled()){var lm=l(cr,e.touchData.starts);lm&&(Y.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=Eu(e.touchData.startPosition)),e.swipePanning?(de.panBy({x:ot[0]*Te,y:ot[1]*Te}),de.emit(Ie("dragpan"))):lt&&(e.swipePanning=!0,de.panBy({x:yt*Te,y:ln*Te}),de.emit(Ie("dragpan")),cr&&(cr.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));var He=e.projectIntoViewport(Y.touches[0].clientX,Y.touches[0].clientY);xe[0]=He[0],xe[1]=He[1]}}for(var Ue=0;Ue<xe.length;Ue++)Le[Ue]=xe[Ue];le&&Y.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1);var qe;e.registerBinding(t,"touchcancel",qe=function(Y){var le=e.touchData.start;e.touchData.capture=!1,le&&le.unactivate()});var De,Ge,Ye,it;if(e.registerBinding(t,"touchend",De=function(Y){var le=e.touchData.start,pe=e.touchData.capture;if(pe)Y.touches.length===0&&(e.touchData.capture=!1),Y.preventDefault();else return;var de=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var xe=e.cy,Le=xe.zoom(),Te=e.touchData.now,He=e.touchData.earlier;if(Y.touches[0]){var Ie=e.projectIntoViewport(Y.touches[0].clientX,Y.touches[0].clientY);Te[0]=Ie[0],Te[1]=Ie[1]}if(Y.touches[1]){var Ie=e.projectIntoViewport(Y.touches[1].clientX,Y.touches[1].clientY);Te[2]=Ie[0],Te[3]=Ie[1]}if(Y.touches[2]){var Ie=e.projectIntoViewport(Y.touches[2].clientX,Y.touches[2].clientY);Te[4]=Ie[0],Te[5]=Ie[1]}var Xe=function(qn){return{originalEvent:Y,type:qn,position:{x:Te[0],y:Te[1]}}};le&&le.unactivate();var lt;if(e.touchData.cxt){if(lt=Xe("cxttapend"),le?le.emit(lt):xe.emit(lt),!e.touchData.cxtDragged){var ot=Xe("cxttap");le?le.emit(ot):xe.emit(ot)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!Y.touches[2]&&xe.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var Ue=xe.collection(e.getAllInBox(de[0],de[1],de[2],de[3]));de[0]=void 0,de[1]=void 0,de[2]=void 0,de[3]=void 0,de[4]=0,e.redrawHint("select",!0),xe.emit(Xe("boxend"));var yt=function(qn){return qn.selectable()&&!qn.selected()};Ue.emit(Xe("box")).stdFilter(yt).select().emit(Xe("boxselect")),Ue.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(le!=null&&le.unactivate(),Y.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!Y.touches[1]){if(!Y.touches[0]){if(!Y.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var ht=e.dragData.touchDragEles;if(le!=null){var ln=le._private.grabbed;b(ht),e.redrawHint("drag",!0),e.redrawHint("eles",!0),ln&&(le.emit(Xe("freeon")),ht.emit(Xe("free")),e.dragData.didDrag&&(le.emit(Xe("dragfreeon")),ht.emit(Xe("dragfree")))),a(le,["touchend","tapend","vmouseup","tapdragout"],Y,{x:Te[0],y:Te[1]}),le.unactivate(),e.touchData.start=null}else{var Ft=e.findNearestElement(Te[0],Te[1],!0,!0);a(Ft,["touchend","tapend","vmouseup","tapdragout"],Y,{x:Te[0],y:Te[1]})}var Zn=e.touchData.startPosition[0]-Te[0],on=Zn*Zn,yn=e.touchData.startPosition[1]-Te[1],dn=yn*yn,xn=on+dn,na=xn*Le*Le;e.touchData.singleTouchMoved||(le||xe.$(":selected").unselect(["tapunselect"]),a(le,["tap","vclick"],Y,{x:Te[0],y:Te[1]}),Ge=!1,Y.timeStamp-it<=xe.multiClickDebounceTime()?(Ye&&clearTimeout(Ye),Ge=!0,it=null,a(le,["dbltap","vdblclick"],Y,{x:Te[0],y:Te[1]})):(Ye=setTimeout(function(){Ge||a(le,["onetap","voneclick"],Y,{x:Te[0],y:Te[1]})},xe.multiClickDebounceTime()),it=Y.timeStamp)),le!=null&&!e.dragData.didDrag&&le._private.selectable&&na<e.touchTapThreshold2&&!e.pinching&&(xe.selectionType()==="single"?(xe.$(n).unmerge(le).unselect(["tapunselect"]),le.select(["tapselect"])):le.selected()?le.unselect(["tapunselect"]):le.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}}}for(var un=0;un<Te.length;un++)He[un]=Te[un];e.dragData.didDrag=!1,Y.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),Y.touches.length<2&&(Y.touches.length===1&&(e.touchData.startGPosition=[Y.touches[0].clientX,Y.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())},!1),typeof TouchEvent>"u"){var Pe=[],ct=function(Y){return{clientX:Y.clientX,clientY:Y.clientY,force:1,identifier:Y.pointerId,pageX:Y.pageX,pageY:Y.pageY,radiusX:Y.width/2,radiusY:Y.height/2,screenX:Y.screenX,screenY:Y.screenY,target:Y.target}},he=function(Y){return{event:Y,touch:ct(Y)}},Ce=function(Y){Pe.push(he(Y))},je=function(Y){for(var le=0;le<Pe.length;le++){var pe=Pe[le];if(pe.event.pointerId===Y.pointerId){Pe.splice(le,1);return}}},ze=function(Y){var le=Pe.filter(function(pe){return pe.event.pointerId===Y.pointerId})[0];le.event=Y,le.touch=ct(Y)},Me=function(Y){Y.touches=Pe.map(function(le){return le.touch})},Oe=function(Y){return Y.pointerType==="mouse"||Y.pointerType===4};e.registerBinding(e.container,"pointerdown",function(ye){Oe(ye)||(ye.preventDefault(),Ce(ye),Me(ye),Qe(ye))}),e.registerBinding(e.container,"pointerup",function(ye){Oe(ye)||(je(ye),Me(ye),De(ye))}),e.registerBinding(e.container,"pointercancel",function(ye){Oe(ye)||(je(ye),Me(ye),qe(ye))}),e.registerBinding(e.container,"pointermove",function(ye){Oe(ye)||(ye.preventDefault(),ze(ye),Me(ye),Ke(ye))})}};var Ji={};Ji.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(r,a,i,l,o,f){this.renderer.nodeShapeImpl("polygon",r,a,i,l,o,this.points)},intersectLine:function(r,a,i,l,o,f,c,d){return Qf(o,f,this.points,r,a,i/2,l/2,c)},checkPoint:function(r,a,i,l,o,f,c,d){return Ki(r,a,this.points,f,c,l,o,[0,-1],i)},hasMiterBounds:e!=="rectangle",miterBounds:function(r,a,i,l,o,f){return QK(this.points,r,a,i,l,o)}}};Ji.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(t,n,r,a,i,l){this.renderer.nodeShapeImpl(this.name,t,n,r,a,i)},intersectLine:function(t,n,r,a,i,l,o,f){return aX(i,l,t,n,r/2+o,a/2+o)},checkPoint:function(t,n,r,a,i,l,o,f){return Xl(t,n,a,i,l,o,r)}}};Ji.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(r,a,i,l,o,f,c){if(f[c]!==void 0&&f[c+"-cx"]===r&&f[c+"-cy"]===a)return f[c];f[c]=new Array(t.length/2),f[c+"-cx"]=r,f[c+"-cy"]=a;var d=i/2,v=l/2;o=o==="auto"?tL(i,l):o;for(var m=new Array(t.length/2),y=0;y<t.length/2;y++)m[y]={x:r+d*t[y*2],y:a+v*t[y*2+1]};var x,S,w,b,C=m.length;for(S=m[C-1],x=0;x<C;x++)w=m[x%C],b=m[(x+1)%C],f[c][x]=Aw(S,w,b,o),S=w,w=b;return f[c]},draw:function(r,a,i,l,o,f,c){this.renderer.nodeShapeImpl("round-polygon",r,a,i,l,o,this.points,this.getOrCreateCorners(a,i,l,o,f,c,"drawCorners"))},intersectLine:function(r,a,i,l,o,f,c,d,v){return sX(o,f,this.points,r,a,i,l,c,this.getOrCreateCorners(r,a,i,l,d,v,"corners"))},checkPoint:function(r,a,i,l,o,f,c,d,v){return rX(r,a,this.points,f,c,l,o,this.getOrCreateCorners(f,c,l,o,d,v,"corners"))}}};Ji.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:wr(4,0),draw:function(t,n,r,a,i,l){this.renderer.nodeShapeImpl(this.name,t,n,r,a,i,this.points,l)},intersectLine:function(t,n,r,a,i,l,o,f){return JO(i,l,t,n,r,a,o,f)},checkPoint:function(t,n,r,a,i,l,o,f){var c=a/2,d=i/2;f=f==="auto"?ul(a,i):f,f=Math.min(c,d,f);var v=f*2;return!!(Ki(t,n,this.points,l,o,a,i-v,[0,-1],r)||Ki(t,n,this.points,l,o,a-v,i,[0,-1],r)||Xl(t,n,v,v,l-c+f,o-d+f,r)||Xl(t,n,v,v,l+c-f,o-d+f,r)||Xl(t,n,v,v,l+c-f,o+d-f,r)||Xl(t,n,v,v,l-c+f,o+d-f,r))}}};Ji.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:gw(),points:wr(4,0),draw:function(t,n,r,a,i,l){this.renderer.nodeShapeImpl(this.name,t,n,r,a,i,null,l)},generateCutTrianglePts:function(t,n,r,a,i){var l=i==="auto"?this.cornerLength:i,o=n/2,f=t/2,c=r-f,d=r+f,v=a-o,m=a+o;return{topLeft:[c,v+l,c+l,v,c+l,v+l],topRight:[d-l,v,d,v+l,d-l,v+l],bottomRight:[d,m-l,d-l,m,d-l,m-l],bottomLeft:[c+l,m,c,m-l,c+l,m-l]}},intersectLine:function(t,n,r,a,i,l,o,f){var c=this.generateCutTrianglePts(r+2*o,a+2*o,t,n,f),d=[].concat.apply([],[c.topLeft.splice(0,4),c.topRight.splice(0,4),c.bottomRight.splice(0,4),c.bottomLeft.splice(0,4)]);return Qf(i,l,d,t,n)},checkPoint:function(t,n,r,a,i,l,o,f){var c=f==="auto"?this.cornerLength:f;if(Ki(t,n,this.points,l,o,a,i-2*c,[0,-1],r)||Ki(t,n,this.points,l,o,a-2*c,i,[0,-1],r))return!0;var d=this.generateCutTrianglePts(a,i,l,o);return Ir(t,n,d.topLeft)||Ir(t,n,d.topRight)||Ir(t,n,d.bottomRight)||Ir(t,n,d.bottomLeft)}}};Ji.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:wr(4,0),draw:function(t,n,r,a,i,l){this.renderer.nodeShapeImpl(this.name,t,n,r,a,i)},intersectLine:function(t,n,r,a,i,l,o,f){var c=.15,d=.5,v=.85,m=this.generateBarrelBezierPts(r+2*o,a+2*o,t,n),y=function(w){var b=ju({x:w[0],y:w[1]},{x:w[2],y:w[3]},{x:w[4],y:w[5]},c),C=ju({x:w[0],y:w[1]},{x:w[2],y:w[3]},{x:w[4],y:w[5]},d),T=ju({x:w[0],y:w[1]},{x:w[2],y:w[3]},{x:w[4],y:w[5]},v);return[w[0],w[1],b.x,b.y,C.x,C.y,T.x,T.y,w[4],w[5]]},x=[].concat(y(m.topLeft),y(m.topRight),y(m.bottomRight),y(m.bottomLeft));return Qf(i,l,x,t,n)},generateBarrelBezierPts:function(t,n,r,a){var i=n/2,l=t/2,o=r-l,f=r+l,c=a-i,d=a+i,v=jb(t,n),m=v.heightOffset,y=v.widthOffset,x=v.ctrlPtOffsetPct*t,S={topLeft:[o,c+m,o+x,c,o+y,c],topRight:[f-y,c,f-x,c,f,c+m],bottomRight:[f,d-m,f-x,d,f-y,d],bottomLeft:[o+y,d,o+x,d,o,d-m]};return S.topLeft.isTop=!0,S.topRight.isTop=!0,S.bottomLeft.isBottom=!0,S.bottomRight.isBottom=!0,S},checkPoint:function(t,n,r,a,i,l,o,f){var c=jb(a,i),d=c.heightOffset,v=c.widthOffset;if(Ki(t,n,this.points,l,o,a,i-2*d,[0,-1],r)||Ki(t,n,this.points,l,o,a-2*v,i,[0,-1],r))return!0;for(var m=this.generateBarrelBezierPts(a,i,l,o),y=function(L,_,M){var z=M[4],P=M[2],G=M[0],I=M[5],F=M[1],B=Math.min(z,G),H=Math.max(z,G),K=Math.min(I,F),Q=Math.max(I,F);if(B<=L&&L<=H&&K<=_&&_<=Q){var V=lX(z,P,G),q=JK(V[0],V[1],V[2],L),X=q.filter(function(U){return 0<=U&&U<=1});if(X.length>0)return X[0]}return null},x=Object.keys(m),S=0;S<x.length;S++){var w=x[S],b=m[w],C=y(t,n,b);if(C!=null){var T=b[5],k=b[3],D=b[1],A=Kn(T,k,D,C);if(b.isTop&&A<=n||b.isBottom&&n<=A)return!0}}return!1}}};Ji.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:wr(4,0),draw:function(t,n,r,a,i,l){this.renderer.nodeShapeImpl(this.name,t,n,r,a,i,this.points,l)},intersectLine:function(t,n,r,a,i,l,o,f){var c=t-(r/2+o),d=n-(a/2+o),v=d,m=t+(r/2+o),y=Xs(i,l,t,n,c,d,m,v,!1);return y.length>0?y:JO(i,l,t,n,r,a,o,f)},checkPoint:function(t,n,r,a,i,l,o,f){f=f==="auto"?ul(a,i):f;var c=2*f;if(Ki(t,n,this.points,l,o,a,i-c,[0,-1],r)||Ki(t,n,this.points,l,o,a-c,i,[0,-1],r))return!0;var d=a/2+2*r,v=i/2+2*r,m=[l-d,o-v,l-d,o,l+d,o,l+d,o-v];return!!(Ir(t,n,m)||Xl(t,n,c,c,l+a/2-f,o+i/2-f,r)||Xl(t,n,c,c,l-a/2+f,o+i/2-f,r))}}};Ji.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",wr(3,0)),this.generateRoundPolygon("round-triangle",wr(3,0)),this.generatePolygon("rectangle",wr(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n)}this.generatePolygon("pentagon",wr(5,0)),this.generateRoundPolygon("round-pentagon",wr(5,0)),this.generatePolygon("hexagon",wr(6,0)),this.generateRoundPolygon("round-hexagon",wr(6,0)),this.generatePolygon("heptagon",wr(7,0)),this.generateRoundPolygon("round-heptagon",wr(7,0)),this.generatePolygon("octagon",wr(8,0)),this.generateRoundPolygon("round-octagon",wr(8,0));var r=new Array(20);{var a=Db(5,0),i=Db(5,Math.PI/5),l=.5*(3-Math.sqrt(5));l*=1.57;for(var o=0;o<i.length/2;o++)i[o*2]*=l,i[o*2+1]*=l;for(var o=0;o<20/4;o++)r[o*4]=a[o*2],r[o*4+1]=a[o*2+1],r[o*4+2]=i[o*2],r[o*4+3]=i[o*2+1]}r=eL(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var f=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",f),this.generateRoundPolygon("round-tag",f)}e.makePolygon=function(c){var d=c.join("$"),v="polygon-"+d,m;return(m=this[v])?m:t.generatePolygon(v,c)}};var Rd={};Rd.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Rd.redraw=function(e){e=e||XO();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e};Rd.beforeRender=function(e,t){if(!this.destroyed){t==null&&sn("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(r,a){return a.priority-r.priority})}};var LA=function(t,n,r){for(var a=t.beforeRenderCallbacks,i=0;i<a.length;i++)a[i].fn(n,r)};Rd.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function(a){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){LA(e,!0,a);var i=Yi();e.render(e.renderOptions);var l=e.lastDrawTime=Yi();e.averageRedrawTime===void 0&&(e.averageRedrawTime=l-i),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var o=l-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else LA(e,!1,a);e.skipFrame=!1,np(n)}};np(n)}};var EZ=function(t){this.init(t)},t_=EZ,mc=t_.prototype;mc.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];mc.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var a=r.document,i=a.head,l="__________cytoscape_stylesheet",o="__________cytoscape_container",f=a.getElementById(l)!=null;if(n.className.indexOf(o)<0&&(n.className=(n.className||"")+" "+o),!f){var c=a.createElement("style");c.id=l,c.textContent="."+o+" { position: relative; }",i.insertBefore(c,i.children[0])}var d=r.getComputedStyle(n),v=d.getPropertyValue("position");v==="static"&&Bt("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.webgl=e.webgl,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=Re(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()};mc.notify=function(e,t){var n=this,r=n.cy;if(!this.destroyed){if(e==="init"){n.load();return}if(e==="destroy"){n.destroy();return}(e==="add"||e==="remove"||e==="move"&&r.hasCompoundNodes()||e==="load"||e==="zorder"||e==="mount")&&n.invalidateCachedZSortedEles(),e==="viewport"&&n.redrawHint("select",!0),e==="gc"&&n.redrawHint("gc",!0),(e==="load"||e==="resize"||e==="mount")&&(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};mc.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n,a=r.target;(a.off||a.removeEventListener).apply(a,r.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch{}};mc.isHeadless=function(){return!1};[kw,JL,e_,pc,Ji,Rd].forEach(function(e){nt(mc,e)});var S0=1e3/60,n_={setupDequeueing:function(t){return function(){var r=this,a=this.renderer;if(!r.dequeueingSetup){r.dequeueingSetup=!0;var i=Cd(function(){a.redrawHint("eles",!0),a.redrawHint("drag",!0),a.redraw()},t.deqRedrawThreshold),l=function(c,d){var v=Yi(),m=a.averageRedrawTime,y=a.lastRedrawTime,x=[],S=a.cy.extent(),w=a.getPixelRatio();for(c||a.flushRenderedStyleQueue();;){var b=Yi(),C=b-v,T=b-d;if(y<S0){var k=S0-(c?m:0);if(T>=t.deqFastCost*k)break}else if(c){if(C>=t.deqCost*y||C>=t.deqAvgCost*m)break}else if(T>=t.deqNoDrawCost*S0)break;var D=t.deq(r,w,S);if(D.length>0)for(var A=0;A<D.length;A++)x.push(D[A]);else break}x.length>0&&(t.onDeqd(r,x),!c&&t.shouldRedraw(r,x,w,S)&&i())},o=t.priority||dw;a.beforeRender(l,o(r))}}}},CZ=(function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:rp;yl(this,e),this.idsByKey=new Ui,this.keyForId=new Ui,this.cachesByLvl=new Ui,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return xl(e,[{key:"getIdsFor",value:function(n){n==null&&sn("Can not get id list for null key");var r=this.idsByKey,a=this.idsByKey.get(n);return a||(a=new fc,r.set(n,a)),a}},{key:"addIdForKey",value:function(n,r){n!=null&&this.getIdsFor(n).add(r)}},{key:"deleteIdForKey",value:function(n,r){n!=null&&this.getIdsFor(n).delete(r)}},{key:"getNumberOfIdsForKey",value:function(n){return n==null?0:this.getIdsFor(n).size}},{key:"updateKeyMappingFor",value:function(n){var r=n.id(),a=this.keyForId.get(r),i=this.getKey(n);this.deleteIdForKey(a,r),this.addIdForKey(i,r),this.keyForId.set(r,i)}},{key:"deleteKeyMappingFor",value:function(n){var r=n.id(),a=this.keyForId.get(r);this.deleteIdForKey(a,r),this.keyForId.delete(r)}},{key:"keyHasChangedFor",value:function(n){var r=n.id(),a=this.keyForId.get(r),i=this.getKey(n);return a!==i}},{key:"isInvalid",value:function(n){return this.keyHasChangedFor(n)||this.doesEleInvalidateKey(n)}},{key:"getCachesAt",value:function(n){var r=this.cachesByLvl,a=this.lvls,i=r.get(n);return i||(i=new Ui,r.set(n,i),a.push(n)),i}},{key:"getCache",value:function(n,r){return this.getCachesAt(r).get(n)}},{key:"get",value:function(n,r){var a=this.getKey(n),i=this.getCache(a,r);return i!=null&&this.updateKeyMappingFor(n),i}},{key:"getForCachedKey",value:function(n,r){var a=this.keyForId.get(n.id()),i=this.getCache(a,r);return i}},{key:"hasCache",value:function(n,r){return this.getCachesAt(r).has(n)}},{key:"has",value:function(n,r){var a=this.getKey(n);return this.hasCache(a,r)}},{key:"setCache",value:function(n,r,a){a.key=n,this.getCachesAt(r).set(n,a)}},{key:"set",value:function(n,r,a){var i=this.getKey(n);this.setCache(i,r,a),this.updateKeyMappingFor(n)}},{key:"deleteCache",value:function(n,r){this.getCachesAt(r).delete(n)}},{key:"delete",value:function(n,r){var a=this.getKey(n);this.deleteCache(a,r)}},{key:"invalidateKey",value:function(n){var r=this;this.lvls.forEach(function(a){return r.deleteCache(n,a)})}},{key:"invalidate",value:function(n){var r=n.id(),a=this.keyForId.get(r);this.deleteKeyMappingFor(n);var i=this.doesEleInvalidateKey(n);return i&&this.invalidateKey(a),i||this.getNumberOfIdsForKey(a)===0}}])})(),_A=25,mv=50,Bv=-4,Hb=3,r_=7.99,TZ=8,NZ=1024,kZ=1024,AZ=1024,RZ=.2,DZ=.8,jZ=10,MZ=.15,OZ=.1,LZ=.9,_Z=.9,BZ=100,PZ=1,Tu={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},zZ=lr({getKey:null,doesEleInvalidateKey:rp,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:$O,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Df=function(t,n){var r=this;r.renderer=t,r.onDequeues=[];var a=zZ(n);nt(r,a),r.lookup=new CZ(a.getKey,a.doesEleInvalidateKey),r.setupDequeueing()},Fn=Df.prototype;Fn.reasons=Tu;Fn.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]};Fn.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{},r=n[e]=n[e]||[];return r};Fn.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new Td(function(n,r){return r.reqs-n.reqs});return t};Fn.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t};Fn.getElement=function(e,t,n,r,a){var i=this,l=this.renderer,o=l.cy.zoom(),f=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!i.allowEdgeTxrCaching&&e.isEdge()||!i.allowParentTxrCaching&&e.isParent())return null;if(r==null&&(r=Math.ceil(vw(o*n))),r<Bv)r=Bv;else if(o>=r_||r>Hb)return null;var c=Math.pow(2,r),d=t.h*c,v=t.w*c,m=l.eleTextBiggerThanMin(e,c);if(!this.isVisible(e,m))return null;var y=f.get(e,r);if(y&&y.invalidated&&(y.invalidated=!1,y.texture.invalidatedWidth-=y.width),y)return y;var x;if(d<=_A?x=_A:d<=mv?x=mv:x=Math.ceil(d/mv)*mv,d>AZ||v>kZ)return null;var S=i.getTextureQueue(x),w=S[S.length-2],b=function(){return i.recycleTexture(x,v)||i.addTexture(x,v)};w||(w=S[S.length-1]),w||(w=b()),w.width-w.usedWidth<v&&(w=b());for(var C=function(B){return B&&B.scaledLabelShown===m},T=a&&a===Tu.dequeue,k=a&&a===Tu.highQuality,D=a&&a===Tu.downscale,A,j=r+1;j<=Hb;j++){var L=f.get(e,j);if(L){A=L;break}}var _=A&&A.level===r+1?A:null,M=function(){w.context.drawImage(_.texture.canvas,_.x,0,_.width,_.height,w.usedWidth,0,v,d)};if(w.context.setTransform(1,0,0,1,0,0),w.context.clearRect(w.usedWidth,0,v,x),C(_))M();else if(C(A))if(k){for(var z=A.level;z>r;z--)_=i.getElement(e,t,n,z,Tu.downscale);M()}else return i.queueElement(e,A.level-1),A;else{var P;if(!T&&!k&&!D)for(var G=r-1;G>=Bv;G--){var I=f.get(e,G);if(I){P=I;break}}if(C(P))return i.queueElement(e,r),P;w.context.translate(w.usedWidth,0),w.context.scale(c,c),this.drawElement(w.context,e,t,m,!1),w.context.scale(1/c,1/c),w.context.translate(-w.usedWidth,0)}return y={x:w.usedWidth,texture:w,level:r,scale:c,width:v,height:d,scaledLabelShown:m},w.usedWidth+=Math.ceil(v+TZ),w.eleCaches.push(y),f.set(e,r,y),i.checkTextureFullness(w),y};Fn.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])};Fn.invalidateElement=function(e){var t=this,n=t.lookup,r=[],a=n.isInvalid(e);if(a){for(var i=Bv;i<=Hb;i++){var l=n.getForCachedKey(e,i);l&&r.push(l)}var o=n.invalidate(e);if(o)for(var f=0;f<r.length;f++){var c=r[f],d=c.texture;d.invalidatedWidth+=c.width,c.invalidated=!0,t.checkTextureUtility(d)}t.removeFromQueue(e)}};Fn.checkTextureUtility=function(e){e.invalidatedWidth>=RZ*e.width&&this.retireTexture(e)};Fn.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>DZ&&e.fullnessChecks>=jZ?ol(n,e):e.fullnessChecks++};Fn.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),a=this.lookup;ol(r,e),e.retired=!0;for(var i=e.eleCaches,l=0;l<i.length;l++){var o=i[l];a.deleteCache(o.key,o.level)}hw(i);var f=t.getRetiredTextureQueue(n);f.push(e)};Fn.addTexture=function(e,t){var n=this,r=n.getTextureQueue(e),a={};return r.push(a),a.eleCaches=[],a.height=e,a.width=Math.max(NZ,t),a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,a.canvas=n.renderer.makeOffscreenCanvas(a.width,a.height),a.context=a.canvas.getContext("2d"),a};Fn.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),a=n.getRetiredTextureQueue(e),i=0;i<a.length;i++){var l=a[i];if(l.width>=t)return l.retired=!1,l.usedWidth=0,l.invalidatedWidth=0,l.fullnessChecks=0,hw(l.eleCaches),l.context.setTransform(1,0,0,1,0,0),l.context.clearRect(0,0,l.width,l.height),ol(a,l),r.push(l),l}};Fn.queueElement=function(e,t){var n=this,r=n.getElementQueue(),a=n.getElementKeyToQueue(),i=this.getKey(e),l=a[i];if(l)l.level=Math.max(l.level,t),l.eles.merge(e),l.reqs++,r.updateItem(l);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};r.push(o),a[i]=o}};Fn.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],i=t.lookup,l=0;l<PZ&&n.size()>0;l++){var o=n.pop(),f=o.key,c=o.eles[0],d=i.hasCache(c,o.level);if(r[f]=null,d)continue;a.push(o);var v=t.getBoundingBox(c);t.getElement(c,v,e,o.level,Tu.dequeue)}return a};Fn.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=this.getKey(e),i=r[a];i!=null&&(i.eles.length===1?(i.reqs=fw,n.updateItem(i),n.pop(),r[a]=null):i.eles.unmerge(e))};Fn.onDequeue=function(e){this.onDequeues.push(e)};Fn.offDequeue=function(e){ol(this.onDequeues,e)};Fn.setupDequeueing=n_.setupDequeueing({deqRedrawThreshold:BZ,deqCost:MZ,deqAvgCost:OZ,deqNoDrawCost:LZ,deqFastCost:_Z,deq:function(t,n,r){return t.dequeue(n,r)},onDeqd:function(t,n){for(var r=0;r<t.onDequeues.length;r++){var a=t.onDequeues[r];a(n)}},shouldRedraw:function(t,n,r,a){for(var i=0;i<n.length;i++)for(var l=n[i].eles,o=0;o<l.length;o++){var f=l[o].boundingBox();if(mw(f,a))return!0}return!1},priority:function(t){return t.renderer.beforeRenderPriorities.eleTxrDeq}});var IZ=1,Bf=-4,fp=2,FZ=3.99,qZ=50,UZ=50,VZ=.15,HZ=.1,GZ=.9,$Z=.9,YZ=1,BA=250,KZ=4e3*4e3,PA=32767,XZ=!0,a_=function(t){var n=this,r=n.renderer=t,a=r.cy;n.layersByLevel={},n.firstGet=!0,n.lastInvalidationTime=Yi()-2*BA,n.skipping=!1,n.eleTxrDeqs=a.collection(),n.scheduleElementRefinement=Cd(function(){n.refineElementTextures(n.eleTxrDeqs),n.eleTxrDeqs.unmerge(n.eleTxrDeqs)},UZ),r.beforeRender(function(l,o){o-n.lastInvalidationTime<=BA?n.skipping=!0:n.skipping=!1},r.beforeRenderPriorities.lyrTxrSkip);var i=function(o,f){return f.reqs-o.reqs};n.layersQueue=new Td(i),n.setupDequeueing()},or=a_.prototype,zA=0,QZ=Math.pow(2,53)-1;or.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),a=Math.ceil(e.h*n),i=this.renderer.makeOffscreenCanvas(r,a),l={id:zA=++zA%QZ,bb:e,level:t,width:r,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=l.context,f=-l.bb.x1,c=-l.bb.y1;return o.scale(n,n),o.translate(f,c),l};or.getLayers=function(e,t,n){var r=this,a=r.renderer,i=a.cy,l=i.zoom(),o=r.firstGet;if(r.firstGet=!1,n==null){if(n=Math.ceil(vw(l*t)),n<Bf)n=Bf;else if(l>=FZ||n>fp)return null}r.validateLayersElesOrdering(n,e);var f=r.layersByLevel,c=Math.pow(2,n),d=f[n]=f[n]||[],v,m=r.levelIsComplete(n,e),y,x=function(){var M=function(F){if(r.validateLayersElesOrdering(F,e),r.levelIsComplete(F,e))return y=f[F],!0},z=function(F){if(!y)for(var B=n+F;Bf<=B&&B<=fp&&!M(B);B+=F);};z(1),z(-1);for(var P=d.length-1;P>=0;P--){var G=d[P];G.invalid&&ol(d,G)}};if(!m)x();else return d;var S=function(){if(!v){v=Tr();for(var M=0;M<e.length;M++)YK(v,e[M].boundingBox())}return v},w=function(M){M=M||{};var z=M.after;S();var P=Math.ceil(v.w*c),G=Math.ceil(v.h*c);if(P>PA||G>PA)return null;var I=P*G;if(I>KZ)return null;var F=r.makeLayer(v,n);if(z!=null){var B=d.indexOf(z)+1;d.splice(B,0,F)}else(M.insert===void 0||M.insert)&&d.unshift(F);return F};if(r.skipping&&!o)return null;for(var b=null,C=e.length/IZ,T=!o,k=0;k<e.length;k++){var D=e[k],A=D._private.rscratch,j=A.imgLayerCaches=A.imgLayerCaches||{},L=j[n];if(L){b=L;continue}if((!b||b.eles.length>=C||!ZO(b.bb,D.boundingBox()))&&(b=w({insert:!0,after:b}),!b))return null;y||T?r.queueLayer(b,D):r.drawEleInLayer(b,D,n,t),b.eles.push(D),j[n]=b}return y||(T?null:d)};or.getEleLevelForLayerLevel=function(e,t){return e};or.drawEleInLayer=function(e,t,n,r){var a=this,i=this.renderer,l=e.context,o=t.boundingBox();o.w===0||o.h===0||!t.visible()||(n=a.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(l,!1),i.drawCachedElement(l,t,null,null,n,XZ),i.setImgSmoothing(l,!0))};or.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||r.length===0)return!1;for(var a=0,i=0;i<r.length;i++){var l=r[i];if(l.reqs>0||l.invalid)return!1;a+=l.eles.length}return a===t.length};or.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var a=n[r],i=-1,l=0;l<t.length;l++)if(a.eles[0]===t[l]){i=l;break}if(i<0){this.invalidateLayer(a);continue}for(var o=i,l=0;l<a.eles.length;l++)if(a.eles[l]!==t[o+l]){this.invalidateLayer(a);break}}};or.updateElementsInLayers=function(e,t){for(var n=this,r=bd(e[0]),a=0;a<e.length;a++)for(var i=r?null:e[a],l=r?e[a]:e[a].ele,o=l._private.rscratch,f=o.imgLayerCaches=o.imgLayerCaches||{},c=Bf;c<=fp;c++){var d=f[c];d&&(i&&n.getEleLevelForLayerLevel(d.level)!==i.level||t(d,l,i))}};or.haveLayers=function(){for(var e=this,t=!1,n=Bf;n<=fp;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t};or.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=Yi(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(r,a,i){t.invalidateLayer(r)}))};or.invalidateLayer=function(e){if(this.lastInvalidationTime=Yi(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];ol(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a<n.length;a++){var i=n[a]._private.rscratch.imgLayerCaches;i&&(i[t]=null)}}};or.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(r,a,i){var l=r.replacement;if(l||(l=r.replacement=t.makeLayer(r.bb,r.level),l.replaces=r,l.eles=r.eles),!l.reqs)for(var o=0;o<l.eles.length;o++)t.queueLayer(l,l.eles[o])})};or.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()};or.queueLayer=function(e,t){var n=this,r=n.layersQueue,a=e.elesQueue,i=a.hasId=a.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;a.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,r.updateItem(e)):(e.reqs=1,r.push(e))}};or.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],a=0;a<YZ&&n.size()!==0;){var i=n.peek();if(i.replacement){n.pop();continue}if(i.replaces&&i!==i.replaces.replacement){n.pop();continue}if(i.invalid){n.pop();continue}var l=i.elesQueue.shift();l&&(t.drawEleInLayer(i,l,i.level,e),a++),r.length===0&&r.push(!0),i.elesQueue.length===0&&(n.pop(),i.reqs=0,i.replaces&&t.applyLayerReplacement(i),t.requestRedraw())}return r};or.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,a=n.indexOf(r);if(!(a<0||r.invalid)){n[a]=e;for(var i=0;i<e.eles.length;i++){var l=e.eles[i]._private,o=l.imgLayerCaches=l.imgLayerCaches||{};o&&(o[e.level]=e)}t.requestRedraw()}};or.requestRedraw=Cd(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100);or.setupDequeueing=n_.setupDequeueing({deqRedrawThreshold:qZ,deqCost:VZ,deqAvgCost:HZ,deqNoDrawCost:GZ,deqFastCost:$Z,deq:function(t,n){return t.dequeue(n)},onDeqd:dw,shouldRedraw:$O,priority:function(t){return t.renderer.beforeRenderPriorities.lyrTxrDeq}});var i_={},IA;function WZ(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function ZZ(e,t,n){for(var r,a=0;a<t.length;a++){var i=t[a];a===0&&(r=i),e.lineTo(i.x,i.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function FA(e,t,n){e.beginPath&&e.beginPath();for(var r=t,a=0;a<r.length;a++){var i=r[a];e.lineTo(i.x,i.y)}var l=n,o=n[0];e.moveTo(o.x,o.y);for(var a=1;a<l.length;a++){var i=l[a];e.lineTo(i.x,i.y)}e.closePath&&e.closePath()}function JZ(e,t,n,r,a){e.beginPath&&e.beginPath(),e.arc(n,r,a,0,Math.PI*2,!1);var i=t,l=i[0];e.moveTo(l.x,l.y);for(var o=0;o<i.length;o++){var f=i[o];e.lineTo(f.x,f.y)}e.closePath&&e.closePath()}function eJ(e,t,n,r){e.arc(t,n,r,0,Math.PI*2,!1)}i_.arrowShapeImpl=function(e){return(IA||(IA={polygon:WZ,"triangle-backcurve":ZZ,"triangle-tee":FA,"circle-triangle":JZ,"triangle-cross":FA,circle:eJ}))[e]};var hi={};hi.drawElement=function(e,t,n,r,a,i){var l=this;t.isNode()?l.drawNode(e,t,n,r,a,i):l.drawEdge(e,t,n,r,a,i)};hi.drawElementOverlay=function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)};hi.drawElementUnderlay=function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)};hi.drawCachedElementPortion=function(e,t,n,r,a,i,l,o){var f=this,c=n.getBoundingBox(t);if(!(c.w===0||c.h===0)){var d=n.getElement(t,c,r,a,i);if(d!=null){var v=o(f,t);if(v===0)return;var m=l(f,t),y=c.x1,x=c.y1,S=c.w,w=c.h,b,C,T,k,D;if(m!==0){var A=n.getRotationPoint(t);T=A.x,k=A.y,e.translate(T,k),e.rotate(m),D=f.getImgSmoothing(e),D||f.setImgSmoothing(e,!0);var j=n.getRotationOffset(t);b=j.x,C=j.y}else b=y,C=x;var L;v!==1&&(L=e.globalAlpha,e.globalAlpha=L*v),e.drawImage(d.texture.canvas,d.x,0,d.width,d.height,b,C,S,w),v!==1&&(e.globalAlpha=L),m!==0&&(e.rotate(-m),e.translate(-T,-k),D||f.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var tJ=function(){return 0},nJ=function(t,n){return t.getTextAngle(n,null)},rJ=function(t,n){return t.getTextAngle(n,"source")},aJ=function(t,n){return t.getTextAngle(n,"target")},iJ=function(t,n){return n.effectiveOpacity()},E0=function(t,n){return n.pstyle("text-opacity").pfValue*n.effectiveOpacity()};hi.drawCachedElement=function(e,t,n,r,a,i){var l=this,o=l.data,f=o.eleTxrCache,c=o.lblTxrCache,d=o.slbTxrCache,v=o.tlbTxrCache,m=t.boundingBox(),y=i===!0?f.reasons.highQuality:null;if(!(m.w===0||m.h===0||!t.visible())&&(!r||mw(m,r))){var x=t.isEdge(),S=t.element()._private.rscratch.badLine;l.drawElementUnderlay(e,t),l.drawCachedElementPortion(e,t,f,n,a,y,tJ,iJ),(!x||!S)&&l.drawCachedElementPortion(e,t,c,n,a,y,nJ,E0),x&&!S&&(l.drawCachedElementPortion(e,t,d,n,a,y,rJ,E0),l.drawCachedElementPortion(e,t,v,n,a,y,aJ,E0)),l.drawElementOverlay(e,t)}};hi.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var a=t[r];n.drawElement(e,a)}};hi.drawCachedElements=function(e,t,n,r){for(var a=this,i=0;i<t.length;i++){var l=t[i];a.drawCachedElement(e,l,n,r)}};hi.drawCachedNodes=function(e,t,n,r){for(var a=this,i=0;i<t.length;i++){var l=t[i];l.isNode()&&a.drawCachedElement(e,l,n,r)}};hi.drawLayeredElements=function(e,t,n,r){var a=this,i=a.data.lyrTxrCache.getLayers(t,n);if(i)for(var l=0;l<i.length;l++){var o=i[l],f=o.bb;f.w===0||f.h===0||e.drawImage(o.canvas,f.x1,f.y1,f.w,f.h)}else a.drawCachedElements(e,t,n,r)};var es={};es.drawEdge=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,l=this,o=t._private.rscratch;if(!(i&&!t.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var f;n&&(f=n,e.translate(-f.x1,-f.y1));var c=i?t.pstyle("opacity").value:1,d=i?t.pstyle("line-opacity").value:1,v=t.pstyle("curve-style").value,m=t.pstyle("line-style").value,y=t.pstyle("width").pfValue,x=t.pstyle("line-cap").value,S=t.pstyle("line-outline-width").value,w=t.pstyle("line-outline-color").value,b=c*d,C=c*d,T=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;v==="straight-triangle"?(l.eleStrokeStyle(e,t,F),l.drawEdgeTrianglePath(t,e,o.allpts)):(e.lineWidth=y,e.lineCap=x,l.eleStrokeStyle(e,t,F),l.drawEdgePath(t,e,o.allpts,m),e.lineCap="butt")},k=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;if(e.lineWidth=y+S,e.lineCap=x,S>0)l.colorStrokeStyle(e,w[0],w[1],w[2],F);else{e.lineCap="butt";return}v==="straight-triangle"?l.drawEdgeTrianglePath(t,e,o.allpts):(l.drawEdgePath(t,e,o.allpts,m),e.lineCap="butt")},D=function(){a&&l.drawEdgeOverlay(e,t)},A=function(){a&&l.drawEdgeUnderlay(e,t)},j=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:C;l.drawArrowheads(e,t,F)},L=function(){l.drawElementText(e,t,null,r)};e.lineJoin="round";var _=t.pstyle("ghost").value==="yes";if(_){var M=t.pstyle("ghost-offset-x").pfValue,z=t.pstyle("ghost-offset-y").pfValue,P=t.pstyle("ghost-opacity").value,G=b*P;e.translate(M,z),T(G),j(G),e.translate(-M,-z)}else k();A(),T(),j(),D(),L(),n&&e.translate(f.x1,f.y1)}};var s_=function(t){if(!["overlay","underlay"].includes(t))throw new Error("Invalid state");return function(n,r){if(r.visible()){var a=r.pstyle("".concat(t,"-opacity")).value;if(a!==0){var i=this,l=i.usePaths(),o=r._private.rscratch,f=r.pstyle("".concat(t,"-padding")).pfValue,c=2*f,d=r.pstyle("".concat(t,"-color")).value;n.lineWidth=c,o.edgeType==="self"&&!l?n.lineCap="butt":n.lineCap="round",i.colorStrokeStyle(n,d[0],d[1],d[2],a),i.drawEdgePath(r,n,o.allpts,"solid")}}}};es.drawEdgeOverlay=s_("overlay");es.drawEdgeUnderlay=s_("underlay");es.drawEdgePath=function(e,t,n,r){var a=e._private.rscratch,i=t,l,o=!1,f=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(f){var v=n.join("$"),m=a.pathCacheKey&&a.pathCacheKey===v;m?(l=t=a.pathCache,o=!0):(l=t=new Path2D,a.pathCacheKey=v,a.pathCache=l)}if(i.setLineDash)switch(r){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(c),i.lineDashOffset=d;break;case"solid":i.setLineDash([]);break}if(!o&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var y=2;y+3<n.length;y+=4)t.quadraticCurveTo(n[y],n[y+1],n[y+2],n[y+3]);break;case"straight":case"haystack":for(var x=2;x+1<n.length;x+=2)t.lineTo(n[x],n[x+1]);break;case"segments":if(a.isRound){var S=Fr(a.roundCorners),w;try{for(S.s();!(w=S.n()).done;){var b=w.value;KL(t,b)}}catch(T){S.e(T)}finally{S.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var C=2;C+1<n.length;C+=2)t.lineTo(n[C],n[C+1]);break}t=i,f?t.stroke(l):t.stroke(),t.setLineDash&&t.setLineDash([])};es.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,a=0;a+1<n.length;a+=2){var i=[n[a+2]-n[a],n[a+3]-n[a+1]],l=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=[i[1]/l,-i[0]/l],f=[o[0]*r/2,o[1]*r/2];t.beginPath(),t.moveTo(n[a]-f[0],n[a+1]-f[1]),t.lineTo(n[a]+f[0],n[a+1]+f[1]),t.lineTo(n[a+2],n[a+3]),t.closePath(),t.fill()}};es.drawArrowheads=function(e,t,n){var r=t._private.rscratch,a=r.edgeType==="haystack";a||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),a||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)};es.drawArrowhead=function(e,t,n,r,a,i,l){if(!(isNaN(r)||r==null||isNaN(a)||a==null||isNaN(i)||i==null)){var o=this,f=t.pstyle(n+"-arrow-shape").value;if(f!=="none"){var c=t.pstyle(n+"-arrow-fill").value==="hollow"?"both":"filled",d=t.pstyle(n+"-arrow-fill").value,v=t.pstyle("width").pfValue,m=t.pstyle(n+"-arrow-width"),y=m.value==="match-line"?v:m.pfValue;m.units==="%"&&(y*=v);var x=t.pstyle("opacity").value;l===void 0&&(l=x);var S=e.globalCompositeOperation;(l!==1||d==="hollow")&&(e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,1),o.colorStrokeStyle(e,255,255,255,1),o.drawArrowShape(t,e,c,v,f,y,r,a,i),e.globalCompositeOperation=S);var w=t.pstyle(n+"-arrow-color").value;o.colorFillStyle(e,w[0],w[1],w[2],l),o.colorStrokeStyle(e,w[0],w[1],w[2],l),o.drawArrowShape(t,e,d,v,f,y,r,a,i)}}};es.drawArrowShape=function(e,t,n,r,a,i,l,o,f){var c=this,d=this.usePaths()&&a!=="triangle-cross",v=!1,m,y=t,x={x:l,y:o},S=e.pstyle("arrow-scale").value,w=this.getArrowWidth(r,S),b=c.arrowShapes[a];if(d){var C=c.arrowPathCache=c.arrowPathCache||[],T=mo(a),k=C[T];k!=null?(m=t=k,v=!0):(m=t=new Path2D,C[T]=m)}v||(t.beginPath&&t.beginPath(),d?b.draw(t,1,0,{x:0,y:0},1):b.draw(t,w,f,x,r),t.closePath&&t.closePath()),t=y,d&&(t.translate(l,o),t.rotate(f),t.scale(w,w)),(n==="filled"||n==="both")&&(d?t.fill(m):t.fill()),(n==="hollow"||n==="both")&&(t.lineWidth=i/(d?w:1),t.lineJoin="miter",d?t.stroke(m):t.stroke()),d&&(t.scale(1/w,1/w),t.rotate(-f),t.translate(-l,-o))};var Dw={};Dw.safeDrawImage=function(e,t,n,r,a,i,l,o,f,c){if(!(a<=0||i<=0||f<=0||c<=0))try{e.drawImage(t,n,r,a,i,l,o,f,c)}catch(d){Bt(d)}};Dw.drawInscribedImage=function(e,t,n,r,a){var i=this,l=n.position(),o=l.x,f=l.y,c=n.cy().style(),d=c.getIndexedStyle.bind(c),v=d(n,"background-fit","value",r),m=d(n,"background-repeat","value",r),y=n.width(),x=n.height(),S=n.padding()*2,w=y+(d(n,"background-width-relative-to","value",r)==="inner"?0:S),b=x+(d(n,"background-height-relative-to","value",r)==="inner"?0:S),C=n._private.rscratch,T=d(n,"background-clip","value",r),k=T==="node",D=d(n,"background-image-opacity","value",r)*a,A=d(n,"background-image-smoothing","value",r),j=n.pstyle("corner-radius").value;j!=="auto"&&(j=n.pstyle("corner-radius").pfValue);var L=t.width||t.cachedW,_=t.height||t.cachedH;(L==null||_==null)&&(document.body.appendChild(t),L=t.cachedW=t.width||t.offsetWidth,_=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var M=L,z=_;if(d(n,"background-width","value",r)!=="auto"&&(d(n,"background-width","units",r)==="%"?M=d(n,"background-width","pfValue",r)*w:M=d(n,"background-width","pfValue",r)),d(n,"background-height","value",r)!=="auto"&&(d(n,"background-height","units",r)==="%"?z=d(n,"background-height","pfValue",r)*b:z=d(n,"background-height","pfValue",r)),!(M===0||z===0)){if(v==="contain"){var P=Math.min(w/M,b/z);M*=P,z*=P}else if(v==="cover"){var P=Math.max(w/M,b/z);M*=P,z*=P}var G=o-w/2,I=d(n,"background-position-x","units",r),F=d(n,"background-position-x","pfValue",r);I==="%"?G+=(w-M)*F:G+=F;var B=d(n,"background-offset-x","units",r),H=d(n,"background-offset-x","pfValue",r);B==="%"?G+=(w-M)*H:G+=H;var K=f-b/2,Q=d(n,"background-position-y","units",r),V=d(n,"background-position-y","pfValue",r);Q==="%"?K+=(b-z)*V:K+=V;var q=d(n,"background-offset-y","units",r),X=d(n,"background-offset-y","pfValue",r);q==="%"?K+=(b-z)*X:K+=X,C.pathCache&&(G-=o,K-=f,o=0,f=0);var U=e.globalAlpha;e.globalAlpha=D;var te=i.getImgSmoothing(e),ie=!1;if(A==="no"&&te?(i.setImgSmoothing(e,!1),ie=!0):A==="yes"&&!te&&(i.setImgSmoothing(e,!0),ie=!0),m==="no-repeat")k&&(e.save(),C.pathCache?e.clip(C.pathCache):(i.nodeShapes[i.getNodeShape(n)].draw(e,o,f,w,b,j,C),e.clip())),i.safeDrawImage(e,t,0,0,L,_,G,K,M,z),k&&e.restore();else{var oe=e.createPattern(t,m);e.fillStyle=oe,i.nodeShapes[i.getNodeShape(n)].draw(e,o,f,w,b,j,C),e.translate(G,K),e.fill(),e.translate(-G,-K)}e.globalAlpha=U,ie&&i.setImgSmoothing(e,te)}};var Co={};Co.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(vw(n*r));t=Math.pow(2,a)}var i=e.pstyle("font-size").pfValue*t,l=e.pstyle("min-zoomed-font-size").pfValue;return!(i<l)};Co.drawElementText=function(e,t,n,r,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,l=this;if(r==null){if(i&&!l.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var o=t.pstyle("label");if(!o||!o.value)return;var f=l.getLabelJustification(t);e.textAlign=f,e.textBaseline="bottom"}else{var c=t.element()._private.rscratch.badLine,d=t.pstyle("label"),v=t.pstyle("source-label"),m=t.pstyle("target-label");if(c||(!d||!d.value)&&(!v||!v.value)&&(!m||!m.value))return;e.textAlign="center",e.textBaseline="bottom"}var y=!n,x;n&&(x=n,e.translate(-x.x1,-x.y1)),a==null?(l.drawText(e,t,null,y,i),t.isEdge()&&(l.drawText(e,t,"source",y,i),l.drawText(e,t,"target",y,i))):l.drawText(e,t,a,y,i),n&&e.translate(x.x1,x.y1)};Co.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(t=this.fontCaches[n],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t};Co.setupTextStyle=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",i=t.pstyle("font-family").strValue,l=t.pstyle("font-weight").strValue,o=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,f=t.pstyle("text-outline-opacity").value*o,c=t.pstyle("color").value,d=t.pstyle("text-outline-color").value;e.font=r+" "+l+" "+a+" "+i,e.lineJoin="round",this.colorFillStyle(e,c[0],c[1],c[2],o),this.colorStrokeStyle(e,d[0],d[1],d[2],f)};function sJ(e,t,n,r,a){var i=Math.min(r,a),l=i/2,o=t+r/2,f=n+a/2;e.beginPath(),e.arc(o,f,l,0,Math.PI*2),e.closePath()}function qA(e,t,n,r,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,l=Math.min(i,r/2,a/2);e.beginPath(),e.moveTo(t+l,n),e.lineTo(t+r-l,n),e.quadraticCurveTo(t+r,n,t+r,n+l),e.lineTo(t+r,n+a-l),e.quadraticCurveTo(t+r,n+a,t+r-l,n+a),e.lineTo(t+l,n+a),e.quadraticCurveTo(t,n+a,t,n+a-l),e.lineTo(t,n+l),e.quadraticCurveTo(t,n,t+l,n),e.closePath()}Co.getTextAngle=function(e,t){var n,r=e._private,a=r.rscratch,i=t?t+"-":"",l=e.pstyle(i+"text-rotation");if(l.strValue==="autorotate"){var o=zr(a,"labelAngle",t);n=e.isEdge()?o:0}else l.strValue==="none"?n=0:n=l.pfValue;return n};Co.drawText=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=t._private,l=i.rscratch,o=a?t.effectiveOpacity():1;if(!(a&&(o===0||t.pstyle("text-opacity").value===0))){n==="main"&&(n=null);var f=zr(l,"labelX",n),c=zr(l,"labelY",n),d,v,m=this.getLabelText(t,n);if(m!=null&&m!==""&&!isNaN(f)&&!isNaN(c)){this.setupTextStyle(e,t,a);var y=n?n+"-":"",x=zr(l,"labelWidth",n),S=zr(l,"labelHeight",n),w=t.pstyle(y+"text-margin-x").pfValue,b=t.pstyle(y+"text-margin-y").pfValue,C=t.isEdge(),T=t.pstyle("text-halign").value,k=t.pstyle("text-valign").value;C&&(T="center",k="center"),f+=w,c+=b;var D;switch(r?D=this.getTextAngle(t,n):D=0,D!==0&&(d=f,v=c,e.translate(d,v),e.rotate(D),f=0,c=0),k){case"top":break;case"center":c+=S/2;break;case"bottom":c+=S;break}var A=t.pstyle("text-background-opacity").value,j=t.pstyle("text-border-opacity").value,L=t.pstyle("text-border-width").pfValue,_=t.pstyle("text-background-padding").pfValue,M=t.pstyle("text-background-shape").strValue,z=M==="round-rectangle"||M==="roundrectangle",P=M==="circle",G=2;if(A>0||L>0&&j>0){var I=e.fillStyle,F=e.strokeStyle,B=e.lineWidth,H=t.pstyle("text-background-color").value,K=t.pstyle("text-border-color").value,Q=t.pstyle("text-border-style").value,V=A>0,q=L>0&&j>0,X=f-_;switch(T){case"left":X-=x;break;case"center":X-=x/2;break}var U=c-S-_,te=x+2*_,ie=S+2*_;if(V&&(e.fillStyle="rgba(".concat(H[0],",").concat(H[1],",").concat(H[2],",").concat(A*o,")")),q&&(e.strokeStyle="rgba(".concat(K[0],",").concat(K[1],",").concat(K[2],",").concat(j*o,")"),e.lineWidth=L,e.setLineDash))switch(Q){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=L/4,e.setLineDash([]);break;case"solid":default:e.setLineDash([]);break}if(z?(e.beginPath(),qA(e,X,U,te,ie,G)):P?(e.beginPath(),sJ(e,X,U,te,ie)):(e.beginPath(),e.rect(X,U,te,ie)),V&&e.fill(),q&&e.stroke(),q&&Q==="double"){var oe=L/2;e.beginPath(),z?qA(e,X+oe,U+oe,te-2*oe,ie-2*oe,G):e.rect(X+oe,U+oe,te-2*oe,ie-2*oe),e.stroke()}e.fillStyle=I,e.strokeStyle=F,e.lineWidth=B,e.setLineDash&&e.setLineDash([])}var ae=2*t.pstyle("text-outline-width").pfValue;if(ae>0&&(e.lineWidth=ae),t.pstyle("text-wrap").value==="wrap"){var we=zr(l,"labelWrapCachedLines",n),fe=zr(l,"labelLineHeight",n),J=x/2,ne=this.getLabelJustification(t);switch(ne==="auto"||(T==="left"?ne==="left"?f+=-x:ne==="center"&&(f+=-J):T==="center"?ne==="left"?f+=-J:ne==="right"&&(f+=J):T==="right"&&(ne==="center"?f+=J:ne==="right"&&(f+=x))),k){case"top":c-=(we.length-1)*fe;break;case"center":case"bottom":c-=(we.length-1)*fe;break}for(var re=0;re<we.length;re++)ae>0&&e.strokeText(we[re],f,c),e.fillText(we[re],f,c),c+=fe}else ae>0&&e.strokeText(m,f,c),e.fillText(m,f,c);D!==0&&(e.rotate(-D),e.translate(-d,-v))}}};var wl={};wl.drawNode=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,l=this,o,f,c=t._private,d=c.rscratch,v=t.position();if(!(!Re(v.x)||!Re(v.y))&&!(i&&!t.visible())){var m=i?t.effectiveOpacity():1,y=l.usePaths(),x,S=!1,w=t.padding();o=t.width()+2*w,f=t.height()+2*w;var b;n&&(b=n,e.translate(-b.x1,-b.y1));for(var C=t.pstyle("background-image"),T=C.value,k=new Array(T.length),D=new Array(T.length),A=0,j=0;j<T.length;j++){var L=T[j],_=k[j]=L!=null&&L!=="none";if(_){var M=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",j);A++,D[j]=l.getCachedImage(L,M,function(){c.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var z=t.pstyle("background-blacken").value,P=t.pstyle("border-width").pfValue,G=t.pstyle("background-opacity").value*m,I=t.pstyle("border-color").value,F=t.pstyle("border-style").value,B=t.pstyle("border-join").value,H=t.pstyle("border-cap").value,K=t.pstyle("border-position").value,Q=t.pstyle("border-dash-pattern").pfValue,V=t.pstyle("border-dash-offset").pfValue,q=t.pstyle("border-opacity").value*m,X=t.pstyle("outline-width").pfValue,U=t.pstyle("outline-color").value,te=t.pstyle("outline-style").value,ie=t.pstyle("outline-opacity").value*m,oe=t.pstyle("outline-offset").value,ae=t.pstyle("corner-radius").value;ae!=="auto"&&(ae=t.pstyle("corner-radius").pfValue);var we=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:G;l.eleFillStyle(e,t,Oe)},fe=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:q;l.colorStrokeStyle(e,I[0],I[1],I[2],Oe)},J=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ie;l.colorStrokeStyle(e,U[0],U[1],U[2],Oe)},ne=function(Oe,ye,Y,le){var pe=l.nodePathCache=l.nodePathCache||[],de=GO(Y==="polygon"?Y+","+le.join(","):Y,""+ye,""+Oe,""+ae),xe=pe[de],Le,Te=!1;return xe!=null?(Le=xe,Te=!0,d.pathCache=Le):(Le=new Path2D,pe[de]=d.pathCache=Le),{path:Le,cacheHit:Te}},re=t.pstyle("shape").strValue,ge=t.pstyle("shape-polygon-points").pfValue;if(y){e.translate(v.x,v.y);var Ne=ne(o,f,re,ge);x=Ne.path,S=Ne.cacheHit}var Be=function(){if(!S){var Oe=v;y&&(Oe={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(x||e,Oe.x,Oe.y,o,f,ae,d)}y?e.fill(x):e.fill()},st=function(){for(var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m,ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,Y=c.backgrounding,le=0,pe=0;pe<D.length;pe++){var de=t.cy().style().getIndexedStyle(t,"background-image-containment","value",pe);if(ye&&de==="over"||!ye&&de==="inside"){le++;continue}k[pe]&&D[pe].complete&&!D[pe].error&&(le++,l.drawInscribedImage(e,D[pe],t,pe,Oe))}c.backgrounding=le!==A,Y!==c.backgrounding&&t.updateStyle(!1)},Qe=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m;l.hasPie(t)&&(l.drawPie(e,t,ye),Oe&&(y||l.nodeShapes[l.getNodeShape(t)].draw(e,v.x,v.y,o,f,ae,d)))},Ke=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m;l.hasStripe(t)&&(e.save(),y?e.clip(d.pathCache):(l.nodeShapes[l.getNodeShape(t)].draw(e,v.x,v.y,o,f,ae,d),e.clip()),l.drawStripe(e,t,ye),e.restore(),Oe&&(y||l.nodeShapes[l.getNodeShape(t)].draw(e,v.x,v.y,o,f,ae,d)))},qe=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m,ye=(z>0?z:-z)*Oe,Y=z>0?0:255;z!==0&&(l.colorFillStyle(e,Y,Y,Y,ye),y?e.fill(x):e.fill())},De=function(){if(P>0){if(e.lineWidth=P,e.lineCap=H,e.lineJoin=B,e.setLineDash)switch(F){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(Q),e.lineDashOffset=V;break;case"solid":case"double":e.setLineDash([]);break}if(K!=="center"){if(e.save(),e.lineWidth*=2,K==="inside")y?e.clip(x):e.clip();else{var Oe=new Path2D;Oe.rect(-o/2-P,-f/2-P,o+2*P,f+2*P),Oe.addPath(x),e.clip(Oe,"evenodd")}y?e.stroke(x):e.stroke(),e.restore()}else y?e.stroke(x):e.stroke();if(F==="double"){e.lineWidth=P/3;var ye=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",y?e.stroke(x):e.stroke(),e.globalCompositeOperation=ye}e.setLineDash&&e.setLineDash([])}},Ge=function(){if(X>0){if(e.lineWidth=X,e.lineCap="butt",e.setLineDash)switch(te){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var Oe=v;y&&(Oe={x:0,y:0});var ye=l.getNodeShape(t),Y=P;K==="inside"&&(Y=0),K==="outside"&&(Y*=2);var le=(o+Y+(X+oe))/o,pe=(f+Y+(X+oe))/f,de=o*le,xe=f*pe,Le=l.nodeShapes[ye].points,Te;if(y){var He=ne(de,xe,ye,Le);Te=He.path}if(ye==="ellipse")l.drawEllipsePath(Te||e,Oe.x,Oe.y,de,xe);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(ye)){var Ie=0,Xe=0,lt=0;ye==="round-diamond"?Ie=(Y+oe+X)*1.4:ye==="round-heptagon"?(Ie=(Y+oe+X)*1.075,lt=-(Y/2+oe+X)/35):ye==="round-hexagon"?Ie=(Y+oe+X)*1.12:ye==="round-pentagon"?(Ie=(Y+oe+X)*1.13,lt=-(Y/2+oe+X)/15):ye==="round-tag"?(Ie=(Y+oe+X)*1.12,Xe=(Y/2+X+oe)*.07):ye==="round-triangle"&&(Ie=(Y+oe+X)*(Math.PI/2),lt=-(Y+oe/2+X)/Math.PI),Ie!==0&&(le=(o+Ie)/o,de=o*le,["round-hexagon","round-tag"].includes(ye)||(pe=(f+Ie)/f,xe=f*pe)),ae=ae==="auto"?tL(de,xe):ae;for(var ot=de/2,Ue=xe/2,yt=ae+(Y+X+oe)/2,ht=new Array(Le.length/2),ln=new Array(Le.length/2),Ft=0;Ft<Le.length/2;Ft++)ht[Ft]={x:Oe.x+Xe+ot*Le[Ft*2],y:Oe.y+lt+Ue*Le[Ft*2+1]};var Zn,on,yn,dn,xn=ht.length;for(on=ht[xn-1],Zn=0;Zn<xn;Zn++)yn=ht[Zn%xn],dn=ht[(Zn+1)%xn],ln[Zn]=Aw(on,yn,dn,yt),on=yn,yn=dn;l.drawRoundPolygonPath(Te||e,Oe.x+Xe,Oe.y+lt,o*le,f*pe,Le,ln)}else if(["roundrectangle","round-rectangle"].includes(ye))ae=ae==="auto"?ul(de,xe):ae,l.drawRoundRectanglePath(Te||e,Oe.x,Oe.y,de,xe,ae+(Y+X+oe)/2);else if(["cutrectangle","cut-rectangle"].includes(ye))ae=ae==="auto"?gw():ae,l.drawCutRectanglePath(Te||e,Oe.x,Oe.y,de,xe,null,ae+(Y+X+oe)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(ye))ae=ae==="auto"?ul(de,xe):ae,l.drawBottomRoundRectanglePath(Te||e,Oe.x,Oe.y,de,xe,ae+(Y+X+oe)/2);else if(ye==="barrel")l.drawBarrelPath(Te||e,Oe.x,Oe.y,de,xe);else if(ye.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(ye)){var na=(Y+X+oe)/o;Le=ap(ip(Le,na)),l.drawPolygonPath(Te||e,Oe.x,Oe.y,o,f,Le)}else{var un=(Y+X+oe)/o;Le=ap(ip(Le,-un)),l.drawPolygonPath(Te||e,Oe.x,Oe.y,o,f,Le)}if(y?e.stroke(Te):e.stroke(),te==="double"){e.lineWidth=Y/3;var ra=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",y?e.stroke(Te):e.stroke(),e.globalCompositeOperation=ra}e.setLineDash&&e.setLineDash([])}},Ye=function(){a&&l.drawNodeOverlay(e,t,v,o,f)},it=function(){a&&l.drawNodeUnderlay(e,t,v,o,f)},Pe=function(){l.drawElementText(e,t,null,r)},ct=t.pstyle("ghost").value==="yes";if(ct){var he=t.pstyle("ghost-offset-x").pfValue,Ce=t.pstyle("ghost-offset-y").pfValue,je=t.pstyle("ghost-opacity").value,ze=je*m;e.translate(he,Ce),J(),Ge(),we(je*G),Be(),st(ze,!0),fe(je*q),De(),Qe(z!==0||P!==0),Ke(z!==0||P!==0),st(ze,!1),qe(ze),e.translate(-he,-Ce)}y&&e.translate(-v.x,-v.y),it(),y&&e.translate(v.x,v.y),J(),Ge(),we(),Be(),st(m,!0),fe(),De(),Qe(z!==0||P!==0),Ke(z!==0||P!==0),st(m,!1),qe(),y&&e.translate(-v.x,-v.y),Pe(),Ye(),n&&e.translate(b.x1,b.y1)}};var l_=function(t){if(!["overlay","underlay"].includes(t))throw new Error("Invalid state");return function(n,r,a,i,l){var o=this;if(r.visible()){var f=r.pstyle("".concat(t,"-padding")).pfValue,c=r.pstyle("".concat(t,"-opacity")).value,d=r.pstyle("".concat(t,"-color")).value,v=r.pstyle("".concat(t,"-shape")).value,m=r.pstyle("".concat(t,"-corner-radius")).value;if(c>0){if(a=a||r.position(),i==null||l==null){var y=r.padding();i=r.width()+2*y,l=r.height()+2*y}o.colorFillStyle(n,d[0],d[1],d[2],c),o.nodeShapes[v].draw(n,a.x,a.y,i+f*2,l+f*2,m),n.fill()}}}};wl.drawNodeOverlay=l_("overlay");wl.drawNodeUnderlay=l_("underlay");wl.hasPie=function(e){return e=e[0],e._private.hasPie};wl.hasStripe=function(e){return e=e[0],e._private.hasStripe};wl.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=t.pstyle("pie-size"),l=t.pstyle("pie-hole"),o=t.pstyle("pie-start-angle").pfValue,f=r.x,c=r.y,d=t.width(),v=t.height(),m=Math.min(d,v)/2,y,x=0,S=this.usePaths();if(S&&(f=0,c=0),i.units==="%"?m=m*i.pfValue:i.pfValue!==void 0&&(m=i.pfValue/2),l.units==="%"?y=m*l.pfValue:l.pfValue!==void 0&&(y=l.pfValue/2),!(y>=m))for(var w=1;w<=a.pieBackgroundN;w++){var b=t.pstyle("pie-"+w+"-background-size").value,C=t.pstyle("pie-"+w+"-background-color").value,T=t.pstyle("pie-"+w+"-background-opacity").value*n,k=b/100;k+x>1&&(k=1-x);var D=1.5*Math.PI+2*Math.PI*x;D+=o;var A=2*Math.PI*k,j=D+A;b===0||x>=1||x+k>1||(y===0?(e.beginPath(),e.moveTo(f,c),e.arc(f,c,m,D,j),e.closePath()):(e.beginPath(),e.arc(f,c,m,D,j),e.arc(f,c,y,j,D,!0),e.closePath()),this.colorFillStyle(e,C[0],C[1],C[2],T),e.fill(),x+=k)}};wl.drawStripe=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=r.x,l=r.y,o=t.width(),f=t.height(),c=0,d=this.usePaths();e.save();var v=t.pstyle("stripe-direction").value,m=t.pstyle("stripe-size");switch(v){case"vertical":break;case"righward":e.rotate(-Math.PI/2);break}var y=o,x=f;m.units==="%"?(y=y*m.pfValue,x=x*m.pfValue):m.pfValue!==void 0&&(y=m.pfValue,x=m.pfValue),d&&(i=0,l=0),l-=y/2,i-=x/2;for(var S=1;S<=a.stripeBackgroundN;S++){var w=t.pstyle("stripe-"+S+"-background-size").value,b=t.pstyle("stripe-"+S+"-background-color").value,C=t.pstyle("stripe-"+S+"-background-opacity").value*n,T=w/100;T+c>1&&(T=1-c),!(w===0||c>=1||c+T>1)&&(e.beginPath(),e.rect(i,l+x*c,y,x*T),e.closePath(),this.colorFillStyle(e,b[0],b[1],b[2],C),e.fill(),c+=T)}e.restore()};var Nr={},lJ=100;Nr.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n};Nr.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],n=!0,r,a=0;a<t.length;a++)if(r=t[a],r.context===e){n=!1;break}return n&&(r={context:e},t.push(r)),r};Nr.createGradientStyleFor=function(e,t,n,r,a){var i,l=this.usePaths(),o=n.pstyle(t+"-gradient-stop-colors").value,f=n.pstyle(t+"-gradient-stop-positions").pfValue;if(r==="radial-gradient")if(n.isEdge()){var c=n.sourceEndpoint(),d=n.targetEndpoint(),v=n.midpoint(),m=go(c,v),y=go(d,v);i=e.createRadialGradient(v.x,v.y,0,v.x,v.y,Math.max(m,y))}else{var x=l?{x:0,y:0}:n.position(),S=n.paddedWidth(),w=n.paddedHeight();i=e.createRadialGradient(x.x,x.y,0,x.x,x.y,Math.max(S,w))}else if(n.isEdge()){var b=n.sourceEndpoint(),C=n.targetEndpoint();i=e.createLinearGradient(b.x,b.y,C.x,C.y)}else{var T=l?{x:0,y:0}:n.position(),k=n.paddedWidth(),D=n.paddedHeight(),A=k/2,j=D/2,L=n.pstyle("background-gradient-direction").value;switch(L){case"to-bottom":i=e.createLinearGradient(T.x,T.y-j,T.x,T.y+j);break;case"to-top":i=e.createLinearGradient(T.x,T.y+j,T.x,T.y-j);break;case"to-left":i=e.createLinearGradient(T.x+A,T.y,T.x-A,T.y);break;case"to-right":i=e.createLinearGradient(T.x-A,T.y,T.x+A,T.y);break;case"to-bottom-right":case"to-right-bottom":i=e.createLinearGradient(T.x-A,T.y-j,T.x+A,T.y+j);break;case"to-top-right":case"to-right-top":i=e.createLinearGradient(T.x-A,T.y+j,T.x+A,T.y-j);break;case"to-bottom-left":case"to-left-bottom":i=e.createLinearGradient(T.x+A,T.y-j,T.x-A,T.y+j);break;case"to-top-left":case"to-left-top":i=e.createLinearGradient(T.x+A,T.y+j,T.x-A,T.y-j);break}}if(!i)return null;for(var _=f.length===o.length,M=o.length,z=0;z<M;z++)i.addColorStop(_?f[z]:z/(M-1),"rgba("+o[z][0]+","+o[z][1]+","+o[z][2]+","+a+")");return i};Nr.gradientFillStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"background",t,n,r);if(!a)return null;e.fillStyle=a};Nr.colorFillStyle=function(e,t,n,r,a){e.fillStyle="rgba("+t+","+n+","+r+","+a+")"};Nr.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientFillStyle(e,t,r,n);else{var a=t.pstyle("background-color").value;this.colorFillStyle(e,a[0],a[1],a[2],n)}};Nr.gradientStrokeStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"line",t,n,r);if(!a)return null;e.strokeStyle=a};Nr.colorStrokeStyle=function(e,t,n,r,a){e.strokeStyle="rgba("+t+","+n+","+r+","+a+")"};Nr.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientStrokeStyle(e,t,r,n);else{var a=t.pstyle("line-color").value;this.colorStrokeStyle(e,a[0],a[1],a[2],n)}};Nr.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),a=r[2],i=r[3],l=t.getPixelRatio(),o=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(l=o);var f=a*l,c=i*l,d;if(!(f===t.canvasWidth&&c===t.canvasHeight)){t.fontCaches=null;var v=n.canvasContainer;v.style.width=a+"px",v.style.height=i+"px";for(var m=0;m<t.CANVAS_LAYERS;m++)d=n.canvases[m],d.width=f,d.height=c,d.style.width=a+"px",d.style.height=i+"px";for(var m=0;m<t.BUFFER_COUNT;m++)d=n.bufferCanvases[m],d.width=f,d.height=c,d.style.width=a+"px",d.style.height=i+"px";t.textureMult=1,l<=1&&(d=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,d.width=f*t.textureMult,d.height=c*t.textureMult),t.canvasWidth=f,t.canvasHeight=c,t.pixelRatio=l}};Nr.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})};Nr.clearCanvas=function(){var e=this,t=e.data;function n(r){r.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])};Nr.render=function(e){var t=this;e=e||XO();var n=t.cy,r=e.forcedContext,a=e.drawAllLayers,i=e.drawOnlyNodeLayer,l=e.forcedZoom,o=e.forcedPan,f=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,c=t.data,d=c.canvasNeedsRedraw,v=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),m=e.motionBlur!==void 0?e.motionBlur:t.motionBlur,y=t.motionBlurPxRatio,x=n.hasCompoundNodes(),S=t.hoverData.draggingEles,w=!!(t.hoverData.selecting||t.touchData.selecting);m=m&&!r&&t.motionBlurEnabled&&!w;var b=m;r||(t.prevPxRatio!==f&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint("eles",!0),t.redrawHint("drag",!0)),t.prevPxRatio=f),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),m&&(t.mbFrames==null&&(t.mbFrames=0),t.mbFrames++,t.mbFrames<3&&(b=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!v&&(d[t.NODE]=!0,d[t.SELECT_BOX]=!0);var C=n.style(),T=n.zoom(),k=l!==void 0?l:T,D=n.pan(),A={x:D.x,y:D.y},j={zoom:T,pan:{x:D.x,y:D.y}},L=t.prevViewport,_=L===void 0||j.zoom!==L.zoom||j.pan.x!==L.pan.x||j.pan.y!==L.pan.y;!_&&!(S&&!x)&&(t.motionBlurPxRatio=1),o&&(A=o),k*=f,A.x*=f,A.y*=f;var M=t.getCachedZSortedEles();function z(fe,J,ne,re,ge){var Ne=fe.globalCompositeOperation;fe.globalCompositeOperation="destination-out",t.colorFillStyle(fe,255,255,255,t.motionBlurTransparency),fe.fillRect(J,ne,re,ge),fe.globalCompositeOperation=Ne}function P(fe,J){var ne,re,ge,Ne;!t.clearingMotionBlur&&(fe===c.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]||fe===c.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG])?(ne={x:D.x*y,y:D.y*y},re=T*y,ge=t.canvasWidth*y,Ne=t.canvasHeight*y):(ne=A,re=k,ge=t.canvasWidth,Ne=t.canvasHeight),fe.setTransform(1,0,0,1,0,0),J==="motionBlur"?z(fe,0,0,ge,Ne):!r&&(J===void 0||J)&&fe.clearRect(0,0,ge,Ne),a||(fe.translate(ne.x,ne.y),fe.scale(re,re)),o&&fe.translate(o.x,o.y),l&&fe.scale(l,l)}if(v||(t.textureDrawLastFrame=!1),v){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var G=t.data.bufferContexts[t.TEXTURE_BUFFER];G.setTransform(1,0,0,1,0,0),G.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:G,drawOnlyNodeLayer:!0,forcedPxRatio:f*t.textureMult});var j=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};j.mpan={x:(0-j.pan.x)/j.zoom,y:(0-j.pan.y)/j.zoom}}d[t.DRAG]=!1,d[t.NODE]=!1;var I=c.contexts[t.NODE],F=t.textureCache.texture,j=t.textureCache.viewport;I.setTransform(1,0,0,1,0,0),m?z(I,0,0,j.width,j.height):I.clearRect(0,0,j.width,j.height);var B=C.core("outside-texture-bg-color").value,H=C.core("outside-texture-bg-opacity").value;t.colorFillStyle(I,B[0],B[1],B[2],H),I.fillRect(0,0,j.width,j.height);var T=n.zoom();P(I,!1),I.clearRect(j.mpan.x,j.mpan.y,j.width/j.zoom/f,j.height/j.zoom/f),I.drawImage(F,j.mpan.x,j.mpan.y,j.width/j.zoom/f,j.height/j.zoom/f)}else t.textureOnViewport&&!r&&(t.textureCache=null);var K=n.extent(),Q=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),V=t.hideEdgesOnViewport&&Q,q=[];if(q[t.NODE]=!d[t.NODE]&&m&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,q[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),q[t.DRAG]=!d[t.DRAG]&&m&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,q[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),d[t.NODE]||a||i||q[t.NODE]){var X=m&&!q[t.NODE]&&y!==1,I=r||(X?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:c.contexts[t.NODE]),U=m&&!X?"motionBlur":void 0;P(I,U),V?t.drawCachedNodes(I,M.nondrag,f,K):t.drawLayeredElements(I,M.nondrag,f,K),t.debug&&t.drawDebugPoints(I,M.nondrag),!a&&!m&&(d[t.NODE]=!1)}if(!i&&(d[t.DRAG]||a||q[t.DRAG])){var X=m&&!q[t.DRAG]&&y!==1,I=r||(X?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:c.contexts[t.DRAG]);P(I,m&&!X?"motionBlur":void 0),V?t.drawCachedNodes(I,M.drag,f,K):t.drawCachedElements(I,M.drag,f,K),t.debug&&t.drawDebugPoints(I,M.drag),!a&&!m&&(d[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,P),m&&y!==1){var te=c.contexts[t.NODE],ie=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],oe=c.contexts[t.DRAG],ae=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],we=function(J,ne,re){J.setTransform(1,0,0,1,0,0),re||!b?J.clearRect(0,0,t.canvasWidth,t.canvasHeight):z(J,0,0,t.canvasWidth,t.canvasHeight);var ge=y;J.drawImage(ne,0,0,t.canvasWidth*ge,t.canvasHeight*ge,0,0,t.canvasWidth,t.canvasHeight)};(d[t.NODE]||q[t.NODE])&&(we(te,ie,q[t.NODE]),d[t.NODE]=!1),(d[t.DRAG]||q[t.DRAG])&&(we(oe,ae,q[t.DRAG]),d[t.DRAG]=!1)}t.prevViewport=j,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),m&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!v,t.mbFrames=0,d[t.NODE]=!0,d[t.DRAG]=!0,t.redraw()},lJ)),r||n.emit("render")};var Sf;Nr.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,a=n.data,i=r.style(),l=e.drawOnlyNodeLayer,o=e.drawAllLayers,f=a.canvasNeedsRedraw,c=e.forcedContext;if(n.showFps||!l&&f[n.SELECT_BOX]&&!o){var d=c||a.contexts[n.SELECT_BOX];if(t(d),n.selection[4]==1&&(n.hoverData.selecting||n.touchData.selecting)){var v=n.cy.zoom(),m=i.core("selection-box-border-width").value/v;d.lineWidth=m,d.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",d.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),m>0&&(d.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",d.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(a.bgActivePosistion&&!n.hoverData.selecting){var v=n.cy.zoom(),y=a.bgActivePosistion;d.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",d.beginPath(),d.arc(y.x,y.y,i.core("active-bg-size").pfValue/v,0,2*Math.PI),d.fill()}var x=n.lastRedrawTime;if(n.showFps&&x){x=Math.round(x);var S=Math.round(1e3/x),w="1 frame = "+x+" ms = "+S+" fps";if(d.setTransform(1,0,0,1,0,0),d.fillStyle="rgba(255, 0, 0, 0.75)",d.strokeStyle="rgba(255, 0, 0, 0.75)",d.font="30px Arial",!Sf){var b=d.measureText(w);Sf=b.actualBoundingBoxAscent}d.fillText(w,0,Sf);var C=60;d.strokeRect(0,Sf+10,250,20),d.fillRect(0,Sf+10,250*Math.min(S/C,1),20)}o||(f[n.SELECT_BOX]=!1)}};function UA(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r));return r}function oJ(e,t,n){var r=UA(e,e.VERTEX_SHADER,t),a=UA(e,e.FRAGMENT_SHADER,n),i=e.createProgram();if(e.attachShader(i,r),e.attachShader(i,a),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function uJ(e,t,n){n===void 0&&(n=t);var r=e.makeOffscreenCanvas(t,n),a=r.context=r.getContext("2d");return r.clear=function(){return a.clearRect(0,0,r.width,r.height)},r.clear(),r}function jw(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function cJ(e){var t=e.pixelRatio,n=e.cy.zoom();return n*t}function fJ(e,t,n,r,a){var i=r*n+t.x,l=a*n+t.y;return l=Math.round(e.canvasHeight-l),[i,l]}function dJ(e){return e.pstyle("background-fill").value!=="solid"||e.pstyle("background-image").strValue!=="none"?!1:e.pstyle("border-width").value===0||e.pstyle("border-opacity").value===0?!0:e.pstyle("border-style").value==="solid"}function hJ(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Vl(e,t,n){var r=e[0]/255,a=e[1]/255,i=e[2]/255,l=t,o=n||new Array(4);return o[0]=r*l,o[1]=a*l,o[2]=i*l,o[3]=l,o}function gu(e,t){var n=t||new Array(4);return n[0]=(e>>0&255)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function vJ(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function pJ(e,t){var n=e.createTexture();return n.buffer=function(r){e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},n.deleteTexture=function(){e.deleteTexture(n)},n}function o_(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function u_(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function mJ(e,t,n,r,a,i){switch(t){case e.FLOAT:return new Float32Array(n.buffer,i*r,a);case e.INT:return new Int32Array(n.buffer,i*r,a)}}function gJ(e,t,n,r){var a=o_(e,t),i=Mn(a,2),l=i[0],o=i[1],f=u_(e,o,r),c=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,f,e.STATIC_DRAW),o===e.FLOAT?e.vertexAttribPointer(n,l,o,!1,0,0):o===e.INT&&e.vertexAttribIPointer(n,l,o,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,null),c}function Ha(e,t,n,r){var a=o_(e,n),i=Mn(a,3),l=i[0],o=i[1],f=i[2],c=u_(e,o,t*l),d=l*f,v=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,v),e.bufferData(e.ARRAY_BUFFER,t*d,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,l,o,!1,d,0):o===e.INT&&e.vertexAttribIPointer(r,l,o,d,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var m=new Array(t),y=0;y<t;y++)m[y]=mJ(e,o,c,d,l,y);return v.dataArray=c,v.stride=d,v.size=l,v.getView=function(x){return m[x]},v.setPoint=function(x,S,w){var b=m[x];b[0]=S,b[1]=w},v.bufferSubData=function(x){e.bindBuffer(e.ARRAY_BUFFER,v),x?e.bufferSubData(e.ARRAY_BUFFER,0,c,0,x*l):e.bufferSubData(e.ARRAY_BUFFER,0,c)},v}function yJ(e,t,n){for(var r=9,a=new Float32Array(t*r),i=new Array(t),l=0;l<t;l++){var o=l*r*4;i[l]=new Float32Array(a.buffer,o,r)}var f=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,f),e.bufferData(e.ARRAY_BUFFER,a.byteLength,e.DYNAMIC_DRAW);for(var c=0;c<3;c++){var d=n+c;e.enableVertexAttribArray(d),e.vertexAttribPointer(d,3,e.FLOAT,!1,36,c*12),e.vertexAttribDivisor(d,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),f.getMatrixView=function(v){return i[v]},f.setData=function(v,m){i[m].set(v,0)},f.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,f),e.bufferSubData(e.ARRAY_BUFFER,0,a)},f}function xJ(e){var t=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,t);var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.bindFramebuffer(e.FRAMEBUFFER,null),t.setFramebufferAttachmentSizes=function(r,a){e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,r,a,0,e.RGBA,e.UNSIGNED_BYTE,null)},t}var VA=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function C0(){var e=new VA(9);return VA!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function HA(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function bJ(e,t,n){var r=t[0],a=t[1],i=t[2],l=t[3],o=t[4],f=t[5],c=t[6],d=t[7],v=t[8],m=n[0],y=n[1],x=n[2],S=n[3],w=n[4],b=n[5],C=n[6],T=n[7],k=n[8];return e[0]=m*r+y*l+x*c,e[1]=m*a+y*o+x*d,e[2]=m*i+y*f+x*v,e[3]=S*r+w*l+b*c,e[4]=S*a+w*o+b*d,e[5]=S*i+w*f+b*v,e[6]=C*r+T*l+k*c,e[7]=C*a+T*o+k*d,e[8]=C*i+T*f+k*v,e}function Pv(e,t,n){var r=t[0],a=t[1],i=t[2],l=t[3],o=t[4],f=t[5],c=t[6],d=t[7],v=t[8],m=n[0],y=n[1];return e[0]=r,e[1]=a,e[2]=i,e[3]=l,e[4]=o,e[5]=f,e[6]=m*r+y*l+c,e[7]=m*a+y*o+d,e[8]=m*i+y*f+v,e}function GA(e,t,n){var r=t[0],a=t[1],i=t[2],l=t[3],o=t[4],f=t[5],c=t[6],d=t[7],v=t[8],m=Math.sin(n),y=Math.cos(n);return e[0]=y*r+m*l,e[1]=y*a+m*o,e[2]=y*i+m*f,e[3]=y*l-m*r,e[4]=y*o-m*a,e[5]=y*f-m*i,e[6]=c,e[7]=d,e[8]=v,e}function Gb(e,t,n){var r=n[0],a=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function wJ(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}var SJ=(function(){function e(t,n,r,a){yl(this,e),this.debugID=Math.floor(Math.random()*1e4),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=a(t,n,n),this.scratch=a(t,n,this.texHeight,"scratch")}return xl(e,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(n){var r=n.w,a=n.h,i=this.texHeight,l=this.texSize,o=i/a,f=r*o,c=a*o;return f>l&&(o=l/r,f=r*o,c=a*o),{scale:o,texW:f,texH:c}}},{key:"draw",value:function(n,r,a){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var l=this.texSize,o=this.texRows,f=this.texHeight,c=this.getScale(r),d=c.scale,v=c.texW,m=c.texH,y=function(T,k){if(a&&k){var D=k.context,A=T.x,j=T.row,L=A,_=f*j;D.save(),D.translate(L,_),D.scale(d,d),a(D,r),D.restore()}},x=[null,null],S=function(){y(i.freePointer,i.canvas),x[0]={x:i.freePointer.x,y:i.freePointer.row*f,w:v,h:m},x[1]={x:i.freePointer.x+v,y:i.freePointer.row*f,w:0,h:m},i.freePointer.x+=v,i.freePointer.x==l&&(i.freePointer.x=0,i.freePointer.row++)},w=function(){var T=i.scratch,k=i.canvas;T.clear(),y({x:0,row:0},T);var D=l-i.freePointer.x,A=v-D,j=f;{var L=i.freePointer.x,_=i.freePointer.row*f,M=D;k.context.drawImage(T,0,0,M,j,L,_,M,j),x[0]={x:L,y:_,w:M,h:m}}{var z=D,P=(i.freePointer.row+1)*f,G=A;k&&k.context.drawImage(T,z,0,G,j,0,P,G,j),x[1]={x:0,y:P,w:G,h:m}}i.freePointer.x=A,i.freePointer.row++},b=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+v<=l)S();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===l?(b(),S()):this.enableWrapping?w():(b(),S())}return this.keyToLocation.set(n,x),this.needsBuffer=!0,x}},{key:"getOffsets",value:function(n){return this.keyToLocation.get(n)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(n){if(this.locked)return!1;var r=this.texSize,a=this.texRows,i=this.getScale(n),l=i.texW;return this.freePointer.x+l>r?this.freePointer.row<a-1:!0}},{key:"bufferIfNeeded",value:function(n){this.texture||(this.texture=pJ(n,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])})(),EJ=(function(){function e(t,n,r,a){yl(this,e),this.r=t,this.texSize=n,this.texRows=r,this.createTextureCanvas=a,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return xl(e,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var n=this.r,r=this.texSize,a=this.texRows,i=this.createTextureCanvas;return new SJ(n,r,a,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var n=this.r,r=this.texSize,a=this.texRows,i=this.createTextureCanvas,l=Math.floor(r/a);this.scratch=i(n,r,l,"scratch")}return this.scratch}},{key:"draw",value:function(n,r,a){var i=this.styleKeyToAtlas.get(n);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(r))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(n,r,a),this.styleKeyToAtlas.set(n,i)),i}},{key:"getAtlas",value:function(n){return this.styleKeyToAtlas.get(n)}},{key:"hasAtlas",value:function(n){return this.styleKeyToAtlas.has(n)}},{key:"markKeyForGC",value:function(n){this.markedKeys.add(n)}},{key:"gc",value:function(){var n=this,r=this.markedKeys;if(r.size===0){console.log("nothing to garbage collect");return}var a=[],i=new Map,l=null,o=Fr(this.atlases),f;try{var c=function(){var v=f.value,m=v.getKeys(),y=CJ(r,m);if(y.size===0)return a.push(v),m.forEach(function(D){return i.set(D,v)}),1;l||(l=n._createAtlas(),a.push(l));var x=Fr(m),S;try{for(x.s();!(S=x.n()).done;){var w=S.value;if(!y.has(w)){var b=v.getOffsets(w),C=Mn(b,2),T=C[0],k=C[1];l.canFit({w:T.w+k.w,h:T.h})||(l.lock(),l=n._createAtlas(),a.push(l)),v.canvas&&(n._copyTextureToNewAtlas(w,v,l),i.set(w,l))}}}catch(D){x.e(D)}finally{x.f()}v.dispose()};for(o.s();!(f=o.n()).done;)c()}catch(d){o.e(d)}finally{o.f()}this.atlases=a,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(n,r,a){var i=r.getOffsets(n),l=Mn(i,2),o=l[0],f=l[1];if(f.w===0)a.draw(n,o,function(m){m.drawImage(r.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h)});else{var c=this._getScratchCanvas();c.clear(),c.context.drawImage(r.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h),c.context.drawImage(r.canvas,f.x,f.y,f.w,f.h,o.w,0,f.w,f.h);var d=o.w+f.w,v=o.h;a.draw(n,{w:d,h:v},function(m){m.drawImage(c,0,0,d,v,0,0,d,v)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function CJ(e,t){return e.intersection?e.intersection(t):new Set(ep(e).filter(function(n){return t.has(n)}))}var TJ=(function(){function e(t,n){yl(this,e),this.r=t,this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return xl(e,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(n,r){var a=this.globalOptions,i=a.webglTexSize,l=a.createTextureCanvas,o=r.texRows,f=this._cacheScratchCanvas(l),c=new EJ(this.r,i,o,f);this.collections.set(n,c)}},{key:"addRenderType",value:function(n,r){var a=r.collection;if(!this.collections.has(a))throw new Error("invalid atlas collection name '".concat(a,"'"));var i=this.collections.get(a),l=nt({type:n,atlasCollection:i},r);this.renderTypes.set(n,l)}},{key:"getRenderTypeOpts",value:function(n){return this.renderTypes.get(n)}},{key:"getAtlasCollection",value:function(n){return this.collections.get(n)}},{key:"_cacheScratchCanvas",value:function(n){var r=-1,a=-1,i=null;return function(l,o,f,c){return c?((!i||o!=r||f!=a)&&(r=o,a=f,i=n(l,o,f)),i):n(l,o,f)}}},{key:"_key",value:function(n,r){return"".concat(n,"-").concat(r)}},{key:"invalidate",value:function(n){var r=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=a.forceRedraw,l=i===void 0?!1:i,o=a.filterEle,f=o===void 0?function(){return!0}:o,c=a.filterType,d=c===void 0?function(){return!0}:c,v=!1,m=!1,y=Fr(n),x;try{for(y.s();!(x=y.n()).done;){var S=x.value;if(f(S)){var w=Fr(this.renderTypes.values()),b;try{var C=function(){var k=b.value,D=k.type;if(d(D)){var A=r.collections.get(k.collection),j=k.getKey(S),L=Array.isArray(j)?j:[j];if(l)L.forEach(function(P){return A.markKeyForGC(P)}),m=!0;else{var _=k.getID?k.getID(S):S.id(),M=r._key(D,_),z=r.typeAndIdToKey.get(M);z!==void 0&&!hJ(L,z)&&(v=!0,r.typeAndIdToKey.delete(M),z.forEach(function(P){return A.markKeyForGC(P)}))}}};for(w.s();!(b=w.n()).done;)C()}catch(T){w.e(T)}finally{w.f()}}}}catch(T){y.e(T)}finally{y.f()}return m&&(this.gc(),v=!1),v}},{key:"gc",value:function(){var n=Fr(this.collections.values()),r;try{for(n.s();!(r=n.n()).done;){var a=r.value;a.gc()}}catch(i){n.e(i)}finally{n.f()}}},{key:"getOrCreateAtlas",value:function(n,r,a,i){var l=this.renderTypes.get(r),o=this.collections.get(l.collection),f=!1,c=o.draw(i,a,function(m){l.drawClipped?(m.save(),m.beginPath(),m.rect(0,0,a.w,a.h),m.clip(),l.drawElement(m,n,a,!0,!0),m.restore()):l.drawElement(m,n,a,!0,!0),f=!0});if(f){var d=l.getID?l.getID(n):n.id(),v=this._key(r,d);this.typeAndIdToKey.has(v)?this.typeAndIdToKey.get(v).push(i):this.typeAndIdToKey.set(v,[i])}return c}},{key:"getAtlasInfo",value:function(n,r){var a=this,i=this.renderTypes.get(r),l=i.getKey(n),o=Array.isArray(l)?l:[l];return o.map(function(f){var c=i.getBoundingBox(n,f),d=a.getOrCreateAtlas(n,r,c,f),v=d.getOffsets(f),m=Mn(v,2),y=m[0],x=m[1];return{atlas:d,tex:y,tex1:y,tex2:x,bb:c}})}},{key:"getDebugInfo",value:function(){var n=[],r=Fr(this.collections),a;try{for(r.s();!(a=r.n()).done;){var i=Mn(a.value,2),l=i[0],o=i[1],f=o.getCounts(),c=f.keyCount,d=f.atlasCount;n.push({type:l,keyCount:c,atlasCount:d})}}catch(v){r.e(v)}finally{r.f()}return n}}])})(),NJ=(function(){function e(t){yl(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]}return xl(e,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(n,r){return r})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(n){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(n):!0}},{key:"getAtlasIndexForBatch",value:function(n){var r=this.batchAtlases.indexOf(n);if(r<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(n),r=this.batchAtlases.length-1}return r}}])})(),kJ=`
424
+ float circleSD(vec2 p, float r) {
425
+ return distance(vec2(0), p) - r; // signed distance
426
+ }
427
+ `,AJ=`
428
+ float rectangleSD(vec2 p, vec2 b) {
429
+ vec2 d = abs(p)-b;
430
+ return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
431
+ }
432
+ `,RJ=`
433
+ float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
434
+ cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
435
+ cr.x = (p.y > 0.0) ? cr.x : cr.y;
436
+ vec2 q = abs(p) - b + cr.x;
437
+ return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
438
+ }
439
+ `,DJ=`
440
+ float ellipseSD(vec2 p, vec2 ab) {
441
+ p = abs( p ); // symmetry
442
+
443
+ // find root with Newton solver
444
+ vec2 q = ab*(p-ab);
445
+ float w = (q.x<q.y)? 1.570796327 : 0.0;
446
+ for( int i=0; i<5; i++ ) {
447
+ vec2 cs = vec2(cos(w),sin(w));
448
+ vec2 u = ab*vec2( cs.x,cs.y);
449
+ vec2 v = ab*vec2(-cs.y,cs.x);
450
+ w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
451
+ }
452
+
453
+ // compute final point and distance
454
+ float d = length(p-ab*vec2(cos(w),sin(w)));
455
+
456
+ // return signed distance
457
+ return (dot(p/ab,p/ab)>1.0) ? d : -d;
458
+ }
459
+ `,Pf={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},dp={IGNORE:1,USE_BB:2},T0=0,$A=1,YA=2,N0=3,yu=4,gv=5,Ef=6,Cf=7,jJ=(function(){function e(t,n,r){yl(this,e),this.r=t,this.gl=n,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=uJ,this.atlasManager=new TJ(t,r),this.batchManager=new NJ(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Pf.SCREEN),this.pickingProgram=this._createShaderProgram(Pf.PICKING),this.vao=this._createVAO()}return xl(e,[{key:"addAtlasCollection",value:function(n,r){this.atlasManager.addAtlasCollection(n,r)}},{key:"addTextureAtlasRenderType",value:function(n,r){this.atlasManager.addRenderType(n,r)}},{key:"addSimpleShapeRenderType",value:function(n,r){this.simpleShapeOptions.set(n,r)}},{key:"invalidate",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=r.type,i=this.atlasManager;return a?i.invalidate(n,{filterType:function(o){return o===a},forceRedraw:!0}):i.invalidate(n)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(n){var r=this.gl,a=`#version 300 es
460
+ precision highp float;
461
+
462
+ uniform mat3 uPanZoomMatrix;
463
+ uniform int uAtlasSize;
464
+
465
+ // instanced
466
+ in vec2 aPosition; // a vertex from the unit square
467
+
468
+ in mat3 aTransform; // used to transform verticies, eg into a bounding box
469
+ in int aVertType; // the type of thing we are rendering
470
+
471
+ // the z-index that is output when using picking mode
472
+ in vec4 aIndex;
473
+
474
+ // For textures
475
+ in int aAtlasId; // which shader unit/atlas to use
476
+ in vec4 aTex; // x/y/w/h of texture in atlas
477
+
478
+ // for edges
479
+ in vec4 aPointAPointB;
480
+ in vec4 aPointCPointD;
481
+ in vec2 aLineWidth; // also used for node border width
482
+
483
+ // simple shapes
484
+ in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
485
+ in vec4 aColor; // also used for edges
486
+ in vec4 aBorderColor; // aLineWidth is used for border width
487
+
488
+ // output values passed to the fragment shader
489
+ out vec2 vTexCoord;
490
+ out vec4 vColor;
491
+ out vec2 vPosition;
492
+ // flat values are not interpolated
493
+ flat out int vAtlasId;
494
+ flat out int vVertType;
495
+ flat out vec2 vTopRight;
496
+ flat out vec2 vBotLeft;
497
+ flat out vec4 vCornerRadius;
498
+ flat out vec4 vBorderColor;
499
+ flat out vec2 vBorderWidth;
500
+ flat out vec4 vIndex;
501
+
502
+ void main(void) {
503
+ int vid = gl_VertexID;
504
+ vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
505
+
506
+ if(aVertType == `.concat(T0,`) {
507
+ float texX = aTex.x; // texture coordinates
508
+ float texY = aTex.y;
509
+ float texW = aTex.z;
510
+ float texH = aTex.w;
511
+
512
+ if(vid == 1 || vid == 2 || vid == 4) {
513
+ texX += texW;
514
+ }
515
+ if(vid == 2 || vid == 4 || vid == 5) {
516
+ texY += texH;
517
+ }
518
+
519
+ float d = float(uAtlasSize);
520
+ vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
521
+
522
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
523
+ }
524
+ else if(aVertType == `).concat(yu," || aVertType == ").concat(Cf,`
525
+ || aVertType == `).concat(gv," || aVertType == ").concat(Ef,`) { // simple shapes
526
+
527
+ // the bounding box is needed by the fragment shader
528
+ vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
529
+ vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
530
+ vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
531
+
532
+ // calculations are done in the fragment shader, just pass these along
533
+ vColor = aColor;
534
+ vCornerRadius = aCornerRadius;
535
+ vBorderColor = aBorderColor;
536
+ vBorderWidth = aLineWidth;
537
+
538
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
539
+ }
540
+ else if(aVertType == `).concat($A,`) {
541
+ vec2 source = aPointAPointB.xy;
542
+ vec2 target = aPointAPointB.zw;
543
+
544
+ // adjust the geometry so that the line is centered on the edge
545
+ position.y = position.y - 0.5;
546
+
547
+ // stretch the unit square into a long skinny rectangle
548
+ vec2 xBasis = target - source;
549
+ vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
550
+ vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
551
+
552
+ gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
553
+ vColor = aColor;
554
+ }
555
+ else if(aVertType == `).concat(YA,`) {
556
+ vec2 pointA = aPointAPointB.xy;
557
+ vec2 pointB = aPointAPointB.zw;
558
+ vec2 pointC = aPointCPointD.xy;
559
+ vec2 pointD = aPointCPointD.zw;
560
+
561
+ // adjust the geometry so that the line is centered on the edge
562
+ position.y = position.y - 0.5;
563
+
564
+ vec2 p0, p1, p2, pos;
565
+ if(position.x == 0.0) { // The left side of the unit square
566
+ p0 = pointA;
567
+ p1 = pointB;
568
+ p2 = pointC;
569
+ pos = position;
570
+ } else { // The right side of the unit square, use same approach but flip the geometry upside down
571
+ p0 = pointD;
572
+ p1 = pointC;
573
+ p2 = pointB;
574
+ pos = vec2(0.0, -position.y);
575
+ }
576
+
577
+ vec2 p01 = p1 - p0;
578
+ vec2 p12 = p2 - p1;
579
+ vec2 p21 = p1 - p2;
580
+
581
+ // Find the normal vector.
582
+ vec2 tangent = normalize(normalize(p12) + normalize(p01));
583
+ vec2 normal = vec2(-tangent.y, tangent.x);
584
+
585
+ // Find the vector perpendicular to p0 -> p1.
586
+ vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
587
+
588
+ // Determine the bend direction.
589
+ float sigma = sign(dot(p01 + p21, normal));
590
+ float width = aLineWidth[0];
591
+
592
+ if(sign(pos.y) == -sigma) {
593
+ // This is an intersecting vertex. Adjust the position so that there's no overlap.
594
+ vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
595
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
596
+ } else {
597
+ // This is a non-intersecting vertex. Treat it like a mitre join.
598
+ vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
599
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
600
+ }
601
+
602
+ vColor = aColor;
603
+ }
604
+ else if(aVertType == `).concat(N0,` && vid < 3) {
605
+ // massage the first triangle into an edge arrow
606
+ if(vid == 0)
607
+ position = vec2(-0.15, -0.3);
608
+ if(vid == 1)
609
+ position = vec2( 0.0, 0.0);
610
+ if(vid == 2)
611
+ position = vec2( 0.15, -0.3);
612
+
613
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
614
+ vColor = aColor;
615
+ }
616
+ else {
617
+ gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
618
+ }
619
+
620
+ vAtlasId = aAtlasId;
621
+ vVertType = aVertType;
622
+ vIndex = aIndex;
623
+ }
624
+ `),i=this.batchManager.getIndexArray(),l=`#version 300 es
625
+ precision highp float;
626
+
627
+ // declare texture unit for each texture atlas in the batch
628
+ `.concat(i.map(function(c){return"uniform sampler2D uTexture".concat(c,";")}).join(`
629
+ `),`
630
+
631
+ uniform vec4 uBGColor;
632
+ uniform float uZoom;
633
+
634
+ in vec2 vTexCoord;
635
+ in vec4 vColor;
636
+ in vec2 vPosition; // model coordinates
637
+
638
+ flat in int vAtlasId;
639
+ flat in vec4 vIndex;
640
+ flat in int vVertType;
641
+ flat in vec2 vTopRight;
642
+ flat in vec2 vBotLeft;
643
+ flat in vec4 vCornerRadius;
644
+ flat in vec4 vBorderColor;
645
+ flat in vec2 vBorderWidth;
646
+
647
+ out vec4 outColor;
648
+
649
+ `).concat(kJ,`
650
+ `).concat(AJ,`
651
+ `).concat(RJ,`
652
+ `).concat(DJ,`
653
+
654
+ vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
655
+ return vec4(
656
+ top.rgb + (bot.rgb * (1.0 - top.a)),
657
+ top.a + (bot.a * (1.0 - top.a))
658
+ );
659
+ }
660
+
661
+ vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
662
+ // scale to the zoom level so that borders don't look blurry when zoomed in
663
+ // note 1.5 is an aribitrary value chosen because it looks good
664
+ return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
665
+ }
666
+
667
+ void main(void) {
668
+ if(vVertType == `).concat(T0,`) {
669
+ // look up the texel from the texture unit
670
+ `).concat(i.map(function(c){return"if(vAtlasId == ".concat(c,") outColor = texture(uTexture").concat(c,", vTexCoord);")}).join(`
671
+ else `),`
672
+ }
673
+ else if(vVertType == `).concat(N0,`) {
674
+ // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
675
+ outColor = blend(vColor, uBGColor);
676
+ outColor.a = 1.0; // make opaque, masks out line under arrow
677
+ }
678
+ else if(vVertType == `).concat(yu,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
679
+ outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
680
+ }
681
+ else if(vVertType == `).concat(yu," || vVertType == ").concat(Cf,`
682
+ || vVertType == `).concat(gv," || vVertType == ").concat(Ef,`) { // use SDF
683
+
684
+ float outerBorder = vBorderWidth[0];
685
+ float innerBorder = vBorderWidth[1];
686
+ float borderPadding = outerBorder * 2.0;
687
+ float w = vTopRight.x - vBotLeft.x - borderPadding;
688
+ float h = vTopRight.y - vBotLeft.y - borderPadding;
689
+ vec2 b = vec2(w/2.0, h/2.0); // half width, half height
690
+ vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
691
+
692
+ float d; // signed distance
693
+ if(vVertType == `).concat(yu,`) {
694
+ d = rectangleSD(p, b);
695
+ } else if(vVertType == `).concat(Cf,` && w == h) {
696
+ d = circleSD(p, b.x); // faster than ellipse
697
+ } else if(vVertType == `).concat(Cf,`) {
698
+ d = ellipseSD(p, b);
699
+ } else {
700
+ d = roundRectangleSD(p, b, vCornerRadius.wzyx);
701
+ }
702
+
703
+ // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
704
+ // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
705
+ if(d > 0.0) {
706
+ if(d > outerBorder) {
707
+ discard;
708
+ } else {
709
+ outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
710
+ }
711
+ } else {
712
+ if(d > innerBorder) {
713
+ vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
714
+ vec4 innerBorderColor = blend(vBorderColor, vColor);
715
+ outColor = distInterp(innerBorderColor, outerColor, d);
716
+ }
717
+ else {
718
+ vec4 outerColor;
719
+ if(innerBorder == 0.0 && outerBorder == 0.0) {
720
+ outerColor = vec4(0);
721
+ } else if(innerBorder == 0.0) {
722
+ outerColor = vBorderColor;
723
+ } else {
724
+ outerColor = blend(vBorderColor, vColor);
725
+ }
726
+ outColor = distInterp(vColor, outerColor, d - innerBorder);
727
+ }
728
+ }
729
+ }
730
+ else {
731
+ outColor = vColor;
732
+ }
733
+
734
+ `).concat(n.picking?`if(outColor.a == 0.0) discard;
735
+ else outColor = vIndex;`:"",`
736
+ }
737
+ `),o=oJ(r,a,l);o.aPosition=r.getAttribLocation(o,"aPosition"),o.aIndex=r.getAttribLocation(o,"aIndex"),o.aVertType=r.getAttribLocation(o,"aVertType"),o.aTransform=r.getAttribLocation(o,"aTransform"),o.aAtlasId=r.getAttribLocation(o,"aAtlasId"),o.aTex=r.getAttribLocation(o,"aTex"),o.aPointAPointB=r.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=r.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=r.getAttribLocation(o,"aLineWidth"),o.aColor=r.getAttribLocation(o,"aColor"),o.aCornerRadius=r.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=r.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=r.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=r.getUniformLocation(o,"uAtlasSize"),o.uBGColor=r.getUniformLocation(o,"uBGColor"),o.uZoom=r.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var f=0;f<this.batchManager.getMaxAtlasesPerBatch();f++)o.uTextures.push(r.getUniformLocation(o,"uTexture".concat(f)));return o}},{key:"_createVAO",value:function(){var n=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=n.length/2;var r=this.maxInstances,a=this.gl,i=this.program,l=a.createVertexArray();return a.bindVertexArray(l),gJ(a,"vec2",i.aPosition,n),this.transformBuffer=yJ(a,r,i.aTransform),this.indexBuffer=Ha(a,r,"vec4",i.aIndex),this.vertTypeBuffer=Ha(a,r,"int",i.aVertType),this.atlasIdBuffer=Ha(a,r,"int",i.aAtlasId),this.texBuffer=Ha(a,r,"vec4",i.aTex),this.pointAPointBBuffer=Ha(a,r,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Ha(a,r,"vec4",i.aPointCPointD),this.lineWidthBuffer=Ha(a,r,"vec2",i.aLineWidth),this.colorBuffer=Ha(a,r,"vec4",i.aColor),this.cornerRadiusBuffer=Ha(a,r,"vec4",i.aCornerRadius),this.borderColorBuffer=Ha(a,r,"vec4",i.aBorderColor),a.bindVertexArray(null),l}},{key:"buffers",get:function(){var n=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(r){return Ys(r,"Buffer")}).map(function(r){return n[r]})),this._buffers}},{key:"startFrame",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Pf.SCREEN;this.panZoomMatrix=n,this.renderTarget=r,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(n,r){return n.visible()?r&&r.isVisible?r.isVisible(n):!0:!1}},{key:"drawTexture",value:function(n,r,a){var i=this.atlasManager,l=this.batchManager,o=i.getRenderTypeOpts(a);if(this._isVisible(n,o)&&!(n.isEdge()&&!this._isValidEdge(n))){if(this.renderTarget.picking&&o.getTexPickingMode){var f=o.getTexPickingMode(n);if(f===dp.IGNORE)return;if(f==dp.USE_BB){this.drawPickingRectangle(n,r,a);return}}var c=i.getAtlasInfo(n,a),d=Fr(c),v;try{for(d.s();!(v=d.n()).done;){var m=v.value,y=m.atlas,x=m.tex1,S=m.tex2;l.canAddToCurrentBatch(y)||this.endBatch();for(var w=l.getAtlasIndexForBatch(y),b=0,C=[[x,!0],[S,!1]];b<C.length;b++){var T=Mn(C[b],2),k=T[0],D=T[1];if(k.w!=0){var A=this.instanceCount;this.vertTypeBuffer.getView(A)[0]=T0;var j=this.indexBuffer.getView(A);gu(r,j);var L=this.atlasIdBuffer.getView(A);L[0]=w;var _=this.texBuffer.getView(A);_[0]=k.x,_[1]=k.y,_[2]=k.w,_[3]=k.h;var M=this.transformBuffer.getMatrixView(A);this.setTransformMatrix(n,M,o,m,D),this.instanceCount++,D||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(z){d.e(z)}finally{d.f()}}}},{key:"setTransformMatrix",value:function(n,r,a,i){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;if(a.shapeProps&&a.shapeProps.padding&&(o=n.pstyle(a.shapeProps.padding).pfValue),i){var f=i.bb,c=i.tex1,d=i.tex2,v=c.w/(c.w+d.w);l||(v=1-v);var m=this._getAdjustedBB(f,o,l,v);this._applyTransformMatrix(r,m,a,n)}else{var y=a.getBoundingBox(n),x=this._getAdjustedBB(y,o,!0,1);this._applyTransformMatrix(r,x,a,n)}}},{key:"_applyTransformMatrix",value:function(n,r,a,i){var l,o;HA(n);var f=a.getRotation?a.getRotation(i):0;if(f!==0){var c=a.getRotationPoint(i),d=c.x,v=c.y;Pv(n,n,[d,v]),GA(n,n,f);var m=a.getRotationOffset(i);l=m.x+(r.xOffset||0),o=m.y+(r.yOffset||0)}else l=r.x1,o=r.y1;Pv(n,n,[l,o]),Gb(n,n,[r.w,r.h])}},{key:"_getAdjustedBB",value:function(n,r,a,i){var l=n.x1,o=n.y1,f=n.w,c=n.h,d=n.yOffset;r&&(l-=r,o-=r,f+=2*r,c+=2*r);var v=0,m=f*i;return a&&i<1?f=m:!a&&i<1&&(v=f-m,l+=v,f=m),{x1:l,y1:o,w:f,h:c,xOffset:v,yOffset:d}}},{key:"drawPickingRectangle",value:function(n,r,a){var i=this.atlasManager.getRenderTypeOpts(a),l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=yu;var o=this.indexBuffer.getView(l);gu(r,o);var f=this.colorBuffer.getView(l);Vl([0,0,0],1,f);var c=this.transformBuffer.getMatrixView(l);this.setTransformMatrix(n,c,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(n,r,a){var i=this.simpleShapeOptions.get(a);if(this._isVisible(n,i)){var l=i.shapeProps,o=this._getVertTypeForShape(n,l.shape);if(o===void 0||i.isSimple&&!i.isSimple(n)){this.drawTexture(n,r,a);return}var f=this.instanceCount;if(this.vertTypeBuffer.getView(f)[0]=o,o===gv||o===Ef){var c=i.getBoundingBox(n),d=this._getCornerRadius(n,l.radius,c),v=this.cornerRadiusBuffer.getView(f);v[0]=d,v[1]=d,v[2]=d,v[3]=d,o===Ef&&(v[0]=0,v[2]=0)}var m=this.indexBuffer.getView(f);gu(r,m);var y=n.pstyle(l.color).value,x=n.pstyle(l.opacity).value,S=this.colorBuffer.getView(f);Vl(y,x,S);var w=this.lineWidthBuffer.getView(f);if(w[0]=0,w[1]=0,l.border){var b=n.pstyle("border-width").value;if(b>0){var C=n.pstyle("border-color").value,T=n.pstyle("border-opacity").value,k=this.borderColorBuffer.getView(f);Vl(C,T,k);var D=n.pstyle("border-position").value;if(D==="inside")w[0]=0,w[1]=-b;else if(D==="outside")w[0]=b,w[1]=0;else{var A=b/2;w[0]=A,w[1]=-A}}}var j=this.transformBuffer.getMatrixView(f);this.setTransformMatrix(n,j,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(n,r){var a=n.pstyle(r).value;switch(a){case"rectangle":return yu;case"ellipse":return Cf;case"roundrectangle":case"round-rectangle":return gv;case"bottom-round-rectangle":return Ef;default:return}}},{key:"_getCornerRadius",value:function(n,r,a){var i=a.w,l=a.h;if(n.pstyle(r).value==="auto")return ul(i,l);var o=n.pstyle(r).pfValue,f=i/2,c=l/2;return Math.min(o,c,f)}},{key:"drawEdgeArrow",value:function(n,r,a){if(n.visible()){var i=n._private.rscratch,l,o,f;if(a==="source"?(l=i.arrowStartX,o=i.arrowStartY,f=i.srcArrowAngle):(l=i.arrowEndX,o=i.arrowEndY,f=i.tgtArrowAngle),!(isNaN(l)||l==null||isNaN(o)||o==null||isNaN(f)||f==null)){var c=n.pstyle(a+"-arrow-shape").value;if(c!=="none"){var d=n.pstyle(a+"-arrow-color").value,v=n.pstyle("opacity").value,m=n.pstyle("line-opacity").value,y=v*m,x=n.pstyle("width").pfValue,S=n.pstyle("arrow-scale").value,w=this.r.getArrowWidth(x,S),b=this.instanceCount,C=this.transformBuffer.getMatrixView(b);HA(C),Pv(C,C,[l,o]),Gb(C,C,[w,w]),GA(C,C,f),this.vertTypeBuffer.getView(b)[0]=N0;var T=this.indexBuffer.getView(b);gu(r,T);var k=this.colorBuffer.getView(b);Vl(d,y,k),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(n,r){if(n.visible()){var a=this._getEdgePoints(n);if(a){var i=n.pstyle("opacity").value,l=n.pstyle("line-opacity").value,o=n.pstyle("width").pfValue,f=n.pstyle("line-color").value,c=i*l;if(a.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),a.length==4){var d=this.instanceCount;this.vertTypeBuffer.getView(d)[0]=$A;var v=this.indexBuffer.getView(d);gu(r,v);var m=this.colorBuffer.getView(d);Vl(f,c,m);var y=this.lineWidthBuffer.getView(d);y[0]=o;var x=this.pointAPointBBuffer.getView(d);x[0]=a[0],x[1]=a[1],x[2]=a[2],x[3]=a[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var S=0;S<a.length-2;S+=2){var w=this.instanceCount;this.vertTypeBuffer.getView(w)[0]=YA;var b=this.indexBuffer.getView(w);gu(r,b);var C=this.colorBuffer.getView(w);Vl(f,c,C);var T=this.lineWidthBuffer.getView(w);T[0]=o;var k=a[S-2],D=a[S-1],A=a[S],j=a[S+1],L=a[S+2],_=a[S+3],M=a[S+4],z=a[S+5];S==0&&(k=2*A-L+.001,D=2*j-_+.001),S==a.length-4&&(M=2*L-A+.001,z=2*_-j+.001);var P=this.pointAPointBBuffer.getView(w);P[0]=k,P[1]=D,P[2]=A,P[3]=j;var G=this.pointCPointDBuffer.getView(w);G[0]=L,G[1]=_,G[2]=M,G[3]=z,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(n){var r=n._private.rscratch;return!(r.badLine||r.allpts==null||isNaN(r.allpts[0]))}},{key:"_getEdgePoints",value:function(n){var r=n._private.rscratch;if(this._isValidEdge(n)){var a=r.allpts;if(a.length==4)return a;var i=this._getNumSegments(n);return this._getCurveSegmentPoints(a,i)}}},{key:"_getNumSegments",value:function(n){var r=15;return Math.min(Math.max(r,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(n,r){if(n.length==4)return n;for(var a=Array((r+1)*2),i=0;i<=r;i++)if(i==0)a[0]=n[0],a[1]=n[1];else if(i==r)a[i*2]=n[n.length-2],a[i*2+1]=n[n.length-1];else{var l=i/r;this._setCurvePoint(n,l,a,i*2)}return a}},{key:"_setCurvePoint",value:function(n,r,a,i){if(n.length<=2)a[i]=n[0],a[i+1]=n[1];else{for(var l=Array(n.length-2),o=0;o<l.length;o+=2){var f=(1-r)*n[o]+r*n[o+2],c=(1-r)*n[o+1]+r*n[o+3];l[o]=f,l[o+1]=c}return this._setCurvePoint(l,r,a,i)}}},{key:"endBatch",value:function(){var n=this.gl,r=this.vao,a=this.vertexCount,i=this.instanceCount;if(i!==0){var l=this.renderTarget.picking?this.pickingProgram:this.program;n.useProgram(l),n.bindVertexArray(r);var o=Fr(this.buffers),f;try{for(o.s();!(f=o.n()).done;){var c=f.value;c.bufferSubData(i)}}catch(x){o.e(x)}finally{o.f()}for(var d=this.batchManager.getAtlases(),v=0;v<d.length;v++)d[v].bufferIfNeeded(n);for(var m=0;m<d.length;m++)n.activeTexture(n.TEXTURE0+m),n.bindTexture(n.TEXTURE_2D,d[m].texture),n.uniform1i(l.uTextures[m],m);n.uniform1f(l.uZoom,cJ(this.r)),n.uniformMatrix3fv(l.uPanZoomMatrix,!1,this.panZoomMatrix),n.uniform1i(l.uAtlasSize,this.batchManager.getAtlasSize());var y=Vl(this.bgColor,1);n.uniform4fv(l.uBGColor,y),n.drawArraysInstanced(n.TRIANGLES,0,a,i),n.bindVertexArray(null),n.bindTexture(n.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:d.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var n=this.atlasManager.getDebugInfo(),r=n.reduce(function(l,o){return l+o.atlasCount},0),a=this.batchDebugInfo,i=a.reduce(function(l,o){return l+o.count},0);return{atlasInfo:n,totalAtlases:r,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:a.length,batchInfo:a,totalInstances:i}}}])})(),c_={};c_.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL];e.bgColor=MJ(n),e.webglTexSize=Math.min(e.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=e.webglDebug,n.webglDebugShowAtlases=e.webglDebugShowAtlases,n.pickingFrameBuffer=xJ(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new jJ(n,r,e);var a=function(v){return function(m){return n.getTextAngle(m,v)}},i=function(v){return function(m){var y=m.pstyle(v);return y&&y.value}},l=function(v){return function(m){return m.pstyle("".concat(v,"-opacity")).value>0}},o=function(v){var m=v.pstyle("text-events").strValue==="yes";return m?dp.USE_BB:dp.IGNORE},f=function(v){var m=v.position(),y=m.x,x=m.y,S=v.outerWidth(),w=v.outerHeight();return{w:S,h:w,x1:y-S/2,y1:x-w/2}};n.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:f,isSimple:dJ,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),n.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:f,isVisible:l("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),n.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:f,isVisible:l("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),n.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:o,getKey:k0(t.getLabelKey,null),getBoundingBox:A0(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:a(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:i("label")}),n.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:o,getKey:k0(t.getSourceLabelKey,"source"),getBoundingBox:A0(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:a("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:i("source-label")}),n.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:o,getKey:k0(t.getTargetLabelKey,"target"),getBoundingBox:A0(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:a("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:i("target-label")});var c=Cd(function(){console.log("garbage collect flag set"),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(d,v){var m=!1;v&&v.length>0&&(m|=n.drawing.invalidate(v)),m&&c()}),OJ(n)};function MJ(e){var t=e.cy.container(),n=t&&t.style&&t.style.backgroundColor||"white";return zO(n)}function f_(e,t){var n=e._private.rscratch;return zr(n,"labelWrapCachedLines",t)||[]}var k0=function(t,n){return function(r){var a=t(r),i=f_(r,n);return i.length>1?i.map(function(l,o){return"".concat(a,"_").concat(o)}):a}},A0=function(t,n){return function(r,a){var i=t(r);if(typeof a=="string"){var l=a.indexOf("_");if(l>0){var o=Number(a.substring(l+1)),f=f_(r,n),c=i.h/f.length,d=c*o,v=i.y1+d;return{x1:i.x1,w:i.w,y1:v,h:c,yOffset:d}}}return i}};function OJ(e){{var t=e.render;e.render=function(i){i=i||{};var l=e.cy;e.webgl&&(l.zoom()>r_?(LJ(e),t.call(e,i)):(_J(e),h_(e,i,Pf.SCREEN)))}}{var n=e.matchCanvasSize;e.matchCanvasSize=function(i){n.call(e,i),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0}}e.findNearestElements=function(i,l,o,f){return qJ(e,i,l)};{var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0}}{var a=e.notify;e.notify=function(i,l){a.call(e,i,l),i==="viewport"||i==="bounds"?e.pickingFrameBuffer.needsDraw=!0:i==="background"&&e.drawing.invalidate(l,{type:"node-body"})}}}function LJ(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function _J(e){var t=function(r){r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,e.canvasWidth,e.canvasHeight),r.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function BJ(e){var t=e.canvasWidth,n=e.canvasHeight,r=jw(e),a=r.pan,i=r.zoom,l=C0();Pv(l,l,[a.x,a.y]),Gb(l,l,[i,i]);var o=C0();wJ(o,t,n);var f=C0();return bJ(f,o,l),f}function d_(e,t){var n=e.canvasWidth,r=e.canvasHeight,a=jw(e),i=a.pan,l=a.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(i.x,i.y),t.scale(l,l)}function PJ(e,t){e.drawSelectionRectangle(t,function(n){return d_(e,n)})}function zJ(e){var t=e.data.contexts[e.NODE];t.save(),d_(e,t),t.strokeStyle="rgba(0, 0, 0, 0.3)",t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function IJ(e){var t=function(a,i,l){for(var o=a.atlasManager.getAtlasCollection(i),f=e.data.contexts[e.NODE],c=o.atlases,d=0;d<c.length;d++){var v=c[d],m=v.canvas;if(m){var y=m.width,x=m.height,S=y*d,w=m.height*l,b=.4;f.save(),f.scale(b,b),f.drawImage(m,S,w),f.strokeStyle="black",f.rect(S,w,y,x),f.stroke(),f.restore()}}},n=0;t(e.drawing,"node",n++),t(e.drawing,"label",n++)}function FJ(e,t,n,r,a){var i,l,o,f,c=jw(e),d=c.pan,v=c.zoom;{var m=fJ(e,d,v,t,n),y=Mn(m,2),x=y[0],S=y[1],w=6;i=x-w/2,l=S-w/2,o=w,f=w}if(o===0||f===0)return[];var b=e.data.contexts[e.WEBGL];b.bindFramebuffer(b.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(b.viewport(0,0,b.canvas.width,b.canvas.height),h_(e,null,Pf.PICKING),e.pickingFrameBuffer.needsDraw=!1);var C=o*f,T=new Uint8Array(C*4);b.readPixels(i,l,o,f,b.RGBA,b.UNSIGNED_BYTE,T),b.bindFramebuffer(b.FRAMEBUFFER,null);for(var k=new Set,D=0;D<C;D++){var A=T.slice(D*4,D*4+4),j=vJ(A)-1;j>=0&&k.add(j)}return k}function qJ(e,t,n){var r=FJ(e,t,n),a=e.getCachedZSortedEles(),i,l,o=Fr(r),f;try{for(o.s();!(f=o.n()).done;){var c=f.value,d=a[c];if(!i&&d.isNode()&&(i=d),!l&&d.isEdge()&&(l=d),i&&l)break}}catch(v){o.e(v)}finally{o.f()}return[i,l].filter(Boolean)}function R0(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,"node-underlay"),r.drawNode(n,t,"node-body"),r.drawTexture(n,t,"label"),r.drawNode(n,t,"node-overlay")):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,"source"),r.drawEdgeArrow(n,t,"target"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"edge-source-label"),r.drawTexture(n,t,"edge-target-label"))}function h_(e,t,n){var r;e.webglDebug&&(r=performance.now());var a=e.drawing,i=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&PJ(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var l=e.data.contexts[e.WEBGL];n.screen?(l.clearColor(0,0,0,0),l.enable(l.BLEND),l.blendFunc(l.ONE,l.ONE_MINUS_SRC_ALPHA)):l.disable(l.BLEND),l.clear(l.COLOR_BUFFER_BIT|l.DEPTH_BUFFER_BIT),l.viewport(0,0,l.canvas.width,l.canvas.height);var o=BJ(e),f=e.getCachedZSortedEles();if(i=f.length,a.startFrame(o,n),n.screen){for(var c=0;c<f.nondrag.length;c++)R0(e,c,f.nondrag[c]);for(var d=0;d<f.drag.length;d++)R0(e,d,f.drag[d])}else if(n.picking)for(var v=0;v<f.length;v++)R0(e,v,f[v]);a.endFrame(),n.screen&&e.webglDebugShowAtlases&&(zJ(e),IJ(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var m=performance.now(),y=!1,x=Math.ceil(m-r),S=a.getDebugInfo(),w=["".concat(i," elements"),"".concat(S.totalInstances," instances"),"".concat(S.batchCount," batches"),"".concat(S.totalAtlases," atlases"),"".concat(S.wrappedCount," wrapped textures"),"".concat(S.simpleCount," simple shapes")].join(", ");if(y)console.log("WebGL (".concat(n.name,") - time ").concat(x,"ms, ").concat(w));else{console.log("WebGL (".concat(n.name,") - frame time ").concat(x,"ms")),console.log("Totals:"),console.log(" ".concat(w)),console.log("Texture Atlases Used:");var b=S.atlasInfo,C=Fr(b),T;try{for(C.s();!(T=C.n()).done;){var k=T.value;console.log(" ".concat(k.type,": ").concat(k.keyCount," keys, ").concat(k.atlasCount," atlases"))}}catch(D){C.e(D)}finally{C.f()}console.log("")}}e.data.gc&&(console.log("Garbage Collect!"),e.data.gc=!1,a.gc())}var Sl={};Sl.drawPolygonPath=function(e,t,n,r,a,i){var l=r/2,o=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+l*i[0],n+o*i[1]);for(var f=1;f<i.length/2;f++)e.lineTo(t+l*i[f*2],n+o*i[f*2+1]);e.closePath()};Sl.drawRoundPolygonPath=function(e,t,n,r,a,i,l){l.forEach(function(o){return KL(e,o)}),e.closePath()};Sl.drawRoundRectanglePath=function(e,t,n,r,a,i){var l=r/2,o=a/2,f=i==="auto"?ul(r,a):Math.min(i,o,l);e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.arcTo(t+l,n-o,t+l,n,f),e.arcTo(t+l,n+o,t,n+o,f),e.arcTo(t-l,n+o,t-l,n,f),e.arcTo(t-l,n-o,t,n-o,f),e.lineTo(t,n-o),e.closePath()};Sl.drawBottomRoundRectanglePath=function(e,t,n,r,a,i){var l=r/2,o=a/2,f=i==="auto"?ul(r,a):i;e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.lineTo(t+l,n-o),e.lineTo(t+l,n),e.arcTo(t+l,n+o,t,n+o,f),e.arcTo(t-l,n+o,t-l,n,f),e.lineTo(t-l,n-o),e.lineTo(t,n-o),e.closePath()};Sl.drawCutRectanglePath=function(e,t,n,r,a,i,l){var o=r/2,f=a/2,c=l==="auto"?gw():l;e.beginPath&&e.beginPath(),e.moveTo(t-o+c,n-f),e.lineTo(t+o-c,n-f),e.lineTo(t+o,n-f+c),e.lineTo(t+o,n+f-c),e.lineTo(t+o-c,n+f),e.lineTo(t-o+c,n+f),e.lineTo(t-o,n+f-c),e.lineTo(t-o,n-f+c),e.closePath()};Sl.drawBarrelPath=function(e,t,n,r,a){var i=r/2,l=a/2,o=t-i,f=t+i,c=n-l,d=n+l,v=jb(r,a),m=v.widthOffset,y=v.heightOffset,x=v.ctrlPtOffsetPct*m;e.beginPath&&e.beginPath(),e.moveTo(o,c+y),e.lineTo(o,d-y),e.quadraticCurveTo(o+x,d,o+m,d),e.lineTo(f-m,d),e.quadraticCurveTo(f-x,d,f,d-y),e.lineTo(f,c+y),e.quadraticCurveTo(f-x,c,f-m,c),e.lineTo(o+m,c),e.quadraticCurveTo(o+x,c,o,c+y),e.closePath()};var KA=Math.sin(0),XA=Math.cos(0),$b={},Yb={},v_=Math.PI/40;for(var xu=0*Math.PI;xu<2*Math.PI;xu+=v_)$b[xu]=Math.sin(xu),Yb[xu]=Math.cos(xu);Sl.drawEllipsePath=function(e,t,n,r,a){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,a/2,0,0,2*Math.PI);else for(var i,l,o=r/2,f=a/2,c=0*Math.PI;c<2*Math.PI;c+=v_)i=t-o*$b[c]*KA+o*Yb[c]*XA,l=n+f*Yb[c]*KA+f*$b[c]*XA,c===0?e.moveTo(i,l):e.lineTo(i,l);e.closePath()};var Dd={};Dd.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]};Dd.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements(),r=n.boundingBox(),a=this.findContainerClientCoords(),i=e.full?Math.ceil(r.w):a[2],l=e.full?Math.ceil(r.h):a[3],o=Re(e.maxWidth)||Re(e.maxHeight),f=this.getPixelRatio(),c=1;if(e.scale!==void 0)i*=e.scale,l*=e.scale,c=e.scale;else if(o){var d=1/0,v=1/0;Re(e.maxWidth)&&(d=c*e.maxWidth/i),Re(e.maxHeight)&&(v=c*e.maxHeight/l),c=Math.min(d,v),i*=c,l*=c}o||(i*=f,l*=f,c*=f);var m=document.createElement("canvas");m.width=i,m.height=l,m.style.width=i+"px",m.style.height=l+"px";var y=m.getContext("2d");if(i>0&&l>0){y.clearRect(0,0,i,l),y.globalCompositeOperation="source-over";var x=this.getCachedZSortedEles();if(e.full)y.translate(-r.x1*c,-r.y1*c),y.scale(c,c),this.drawElements(y,x),y.scale(1/c,1/c),y.translate(r.x1*c,r.y1*c);else{var S=t.pan(),w={x:S.x*c,y:S.y*c};c*=t.zoom(),y.translate(w.x,w.y),y.scale(c,c),this.drawElements(y,x),y.scale(1/c,1/c),y.translate(-w.x,-w.y)}e.bg&&(y.globalCompositeOperation="destination-over",y.fillStyle=e.bg,y.rect(0,0,i,l),y.fill())}return m};function UJ(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return new Blob([r],{type:t})}function QA(e){var t=e.indexOf(",");return e.substr(t+1)}function p_(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new dc(function(a,i){try{t.toBlob(function(l){l!=null?a(l):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(l){i(l)}});case"blob":return UJ(QA(r()),n);case"base64":return QA(r());case"base64uri":default:return r()}}Dd.png=function(e){return p_(e,this.bufferCanvasImage(e),"image/png")};Dd.jpg=function(e){return p_(e,this.bufferCanvasImage(e),"image/jpeg")};var m_={};m_.nodeShapeImpl=function(e,t,n,r,a,i,l,o){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,a,i);case"polygon":return this.drawPolygonPath(t,n,r,a,i,l);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,a,i,l,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,a,i,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,a,i,l,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,a,i,o);case"barrel":return this.drawBarrelPath(t,n,r,a,i)}};var VJ=g_,xt=g_.prototype;xt.CANVAS_LAYERS=3;xt.SELECT_BOX=0;xt.DRAG=1;xt.NODE=2;xt.WEBGL=3;xt.CANVAS_TYPES=["2d","2d","2d","webgl2"];xt.BUFFER_COUNT=3;xt.TEXTURE_BUFFER=0;xt.MOTIONBLUR_BUFFER_NODE=1;xt.MOTIONBLUR_BUFFER_DRAG=2;function g_(e){var t=this,n=t.cy.window(),r=n.document;e.webgl&&(xt.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:new Array(xt.CANVAS_LAYERS),contexts:new Array(xt.CANVAS_LAYERS),canvasNeedsRedraw:new Array(xt.CANVAS_LAYERS),bufferCanvases:new Array(xt.BUFFER_COUNT),bufferContexts:new Array(xt.CANVAS_LAYERS)};var a="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";t.data.canvasContainer=r.createElement("div");var l=t.data.canvasContainer.style;t.data.canvasContainer.style[a]=i,l.position="relative",l.zIndex="0",l.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[a]=i;var f={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};PY()&&(f["-ms-touch-action"]="none",f["touch-action"]="none");for(var c=0;c<xt.CANVAS_LAYERS;c++){var d=t.data.canvases[c]=r.createElement("canvas"),v=xt.CANVAS_TYPES[c];t.data.contexts[c]=d.getContext(v),t.data.contexts[c]||sn("Could not create canvas of type "+v),Object.keys(f).forEach(function(fe){d.style[fe]=f[fe]}),d.style.position="absolute",d.setAttribute("data-id","layer"+c),d.style.zIndex=String(xt.CANVAS_LAYERS-c),t.data.canvasContainer.appendChild(d),t.data.canvasNeedsRedraw[c]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[xt.NODE].setAttribute("data-id","layer"+xt.NODE+"-node"),t.data.canvases[xt.SELECT_BOX].setAttribute("data-id","layer"+xt.SELECT_BOX+"-selectbox"),t.data.canvases[xt.DRAG].setAttribute("data-id","layer"+xt.DRAG+"-drag"),t.data.canvases[xt.WEBGL]&&t.data.canvases[xt.WEBGL].setAttribute("data-id","layer"+xt.WEBGL+"-webgl");for(var c=0;c<xt.BUFFER_COUNT;c++)t.data.bufferCanvases[c]=r.createElement("canvas"),t.data.bufferContexts[c]=t.data.bufferCanvases[c].getContext("2d"),t.data.bufferCanvases[c].style.position="absolute",t.data.bufferCanvases[c].setAttribute("data-id","buffer"+c),t.data.bufferCanvases[c].style.zIndex=String(-c-1),t.data.bufferCanvases[c].style.visibility="hidden";t.pathsEnabled=!0;var m=Tr(),y=function(J){return{x:(J.x1+J.x2)/2,y:(J.y1+J.y2)/2}},x=function(J){return{x:-J.w/2,y:-J.h/2}},S=function(J){var ne=J[0]._private,re=ne.oldBackgroundTimestamp===ne.backgroundTimestamp;return!re},w=function(J){return J[0]._private.nodeKey},b=function(J){return J[0]._private.labelStyleKey},C=function(J){return J[0]._private.sourceLabelStyleKey},T=function(J){return J[0]._private.targetLabelStyleKey},k=function(J,ne,re,ge,Ne){return t.drawElement(J,ne,re,!1,!1,Ne)},D=function(J,ne,re,ge,Ne){return t.drawElementText(J,ne,re,ge,"main",Ne)},A=function(J,ne,re,ge,Ne){return t.drawElementText(J,ne,re,ge,"source",Ne)},j=function(J,ne,re,ge,Ne){return t.drawElementText(J,ne,re,ge,"target",Ne)},L=function(J){return J.boundingBox(),J[0]._private.bodyBounds},_=function(J){return J.boundingBox(),J[0]._private.labelBounds.main||m},M=function(J){return J.boundingBox(),J[0]._private.labelBounds.source||m},z=function(J){return J.boundingBox(),J[0]._private.labelBounds.target||m},P=function(J,ne){return ne},G=function(J){return y(L(J))},I=function(J,ne,re){var ge=J?J+"-":"";return{x:ne.x+re.pstyle(ge+"text-margin-x").pfValue,y:ne.y+re.pstyle(ge+"text-margin-y").pfValue}},F=function(J,ne,re){var ge=J[0]._private.rscratch;return{x:ge[ne],y:ge[re]}},B=function(J){return I("",F(J,"labelX","labelY"),J)},H=function(J){return I("source",F(J,"sourceLabelX","sourceLabelY"),J)},K=function(J){return I("target",F(J,"targetLabelX","targetLabelY"),J)},Q=function(J){return x(L(J))},V=function(J){return x(M(J))},q=function(J){return x(z(J))},X=function(J){var ne=_(J),re=x(_(J));if(J.isNode()){switch(J.pstyle("text-halign").value){case"left":re.x=-ne.w-(ne.leftPad||0);break;case"right":re.x=-(ne.rightPad||0);break}switch(J.pstyle("text-valign").value){case"top":re.y=-ne.h-(ne.topPad||0);break;case"bottom":re.y=-(ne.botPad||0);break}}return re},U=t.data.eleTxrCache=new Df(t,{getKey:w,doesEleInvalidateKey:S,drawElement:k,getBoundingBox:L,getRotationPoint:G,getRotationOffset:Q,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),te=t.data.lblTxrCache=new Df(t,{getKey:b,drawElement:D,getBoundingBox:_,getRotationPoint:B,getRotationOffset:X,isVisible:P}),ie=t.data.slbTxrCache=new Df(t,{getKey:C,drawElement:A,getBoundingBox:M,getRotationPoint:H,getRotationOffset:V,isVisible:P}),oe=t.data.tlbTxrCache=new Df(t,{getKey:T,drawElement:j,getBoundingBox:z,getRotationPoint:K,getRotationOffset:q,isVisible:P}),ae=t.data.lyrTxrCache=new a_(t);t.onUpdateEleCalcs(function(J,ne){U.invalidateElements(ne),te.invalidateElements(ne),ie.invalidateElements(ne),oe.invalidateElements(ne),ae.invalidateElements(ne);for(var re=0;re<ne.length;re++){var ge=ne[re]._private;ge.oldBackgroundTimestamp=ge.backgroundTimestamp}});var we=function(J){for(var ne=0;ne<J.length;ne++)ae.enqueueElementRefinement(J[ne].ele)};U.onDequeue(we),te.onDequeue(we),ie.onDequeue(we),oe.onDequeue(we),e.webgl&&t.initWebgl(e,{getStyleKey:w,getLabelKey:b,getSourceLabelKey:C,getTargetLabelKey:T,drawElement:k,drawLabel:D,drawSourceLabel:A,drawTargetLabel:j,getElementBox:L,getLabelBox:_,getSourceLabelBox:M,getTargetLabelBox:z,getElementRotationPoint:G,getElementRotationOffset:Q,getLabelRotationPoint:B,getSourceLabelRotationPoint:H,getTargetLabelRotationPoint:K,getLabelRotationOffset:X,getSourceLabelRotationOffset:V,getTargetLabelRotationOffset:q})}xt.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[xt.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[xt.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[xt.SELECT_BOX]=t;break;case"gc":n.data.gc=!0;break}};var HJ=typeof Path2D<"u";xt.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e};xt.usePaths=function(){return HJ&&this.pathsEnabled};xt.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)};xt.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled};xt.makeOffscreenCanvas=function(e,t){var n;if((typeof OffscreenCanvas>"u"?"undefined":In(OffscreenCanvas))!=="undefined")n=new OffscreenCanvas(e,t);else{var r=this.cy.window(),a=r.document;n=a.createElement("canvas"),n.width=e,n.height=t}return n};[i_,hi,es,Dw,Co,wl,Nr,c_,Sl,Dd,m_].forEach(function(e){nt(xt,e)});var GJ=[{name:"null",impl:GL},{name:"base",impl:t_},{name:"canvas",impl:VJ}],$J=[{type:"layout",extensions:gZ},{type:"renderer",extensions:GJ}],y_={},x_={};function b_(e,t,n){var r=n,a=function(L){Bt("Can not register `"+t+"` for `"+e+"` since `"+L+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(ed.prototype[t])return a(t);ed.prototype[t]=n}else if(e==="collection"){if(ir.prototype[t])return a(t);ir.prototype[t]=n}else if(e==="layout"){for(var i=function(L){this.options=L,n.call(this,L),Dt(this._private)||(this._private={}),this._private.cy=L.cy,this._private.listeners=[],this.createEmitter()},l=i.prototype=Object.create(n.prototype),o=[],f=0;f<o.length;f++){var c=o[f];l[c]=l[c]||function(){return this}}l.start&&!l.run?l.run=function(){return this.start(),this}:!l.start&&l.run&&(l.start=function(){return this.run(),this});var d=n.prototype.stop;l.stop=function(){var j=this.options;if(j&&j.animate){var L=this.animations;if(L)for(var _=0;_<L.length;_++)L[_].stop()}return d?d.call(this):this.emit("layoutstop"),this},l.destroy||(l.destroy=function(){return this}),l.cy=function(){return this._private.cy};var v=function(L){return L._private.cy},m={addEventFields:function(L,_){_.layout=L,_.cy=v(L),_.target=L},bubble:function(){return!0},parent:function(L){return v(L)}};nt(l,{createEmitter:function(){return this._private.emitter=new Zp(m,this),this},emitter:function(){return this._private.emitter},on:function(L,_){return this.emitter().on(L,_),this},one:function(L,_){return this.emitter().one(L,_),this},once:function(L,_){return this.emitter().one(L,_),this},removeListener:function(L,_){return this.emitter().removeListener(L,_),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(L,_){return this.emitter().emit(L,_),this}}),_t.eventAliasesOn(l),r=i}else if(e==="renderer"&&t!=="null"&&t!=="base"){var y=w_("renderer","base"),x=y.prototype,S=n,w=n.prototype,b=function(){y.apply(this,arguments),S.apply(this,arguments)},C=b.prototype;for(var T in x){var k=x[T],D=w[T]!=null;if(D)return a(T);C[T]=k}for(var A in w)C[A]=w[A];x.clientFunctions.forEach(function(j){C[j]=C[j]||function(){sn("Renderer does not implement `renderer."+j+"()` on its prototype")}}),r=b}else if(e==="__proto__"||e==="constructor"||e==="prototype")return sn(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return IO({map:y_,keys:[e,t],value:r})}function w_(e,t){return FO({map:y_,keys:[e,t]})}function YJ(e,t,n,r,a){return IO({map:x_,keys:[e,t,n,r],value:a})}function KJ(e,t,n,r){return FO({map:x_,keys:[e,t,n,r]})}var Kb=function(){if(arguments.length===2)return w_.apply(null,arguments);if(arguments.length===3)return b_.apply(null,arguments);if(arguments.length===4)return KJ.apply(null,arguments);if(arguments.length===5)return YJ.apply(null,arguments);sn("Invalid extension access syntax")};ed.prototype.extension=Kb;$J.forEach(function(e){e.extensions.forEach(function(t){b_(e.type,t.name,t.impl)})});var hp=function(){if(!(this instanceof hp))return new hp;this.length=0},bo=hp.prototype;bo.instanceString=function(){return"stylesheet"};bo.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this};bo.css=function(e,t){var n=this.length-1;if(Ze(e))this[n].properties.push({name:e,value:t});else if(Dt(e))for(var r=e,a=Object.keys(r),i=0;i<a.length;i++){var l=a[i],o=r[l];if(o!=null){var f=Qn.properties[l]||Qn.properties[Up(l)];if(f!=null){var c=f.name,d=o;this[n].properties.push({name:c,value:d})}}}return this};bo.style=bo.css;bo.generateStyle=function(e){var t=new Qn(e);return this.appendToStyle(t)};bo.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,a=n.properties;e.selector(r);for(var i=0;i<a.length;i++){var l=a[i];e.css(l.name,l.value)}}return e};var XJ="3.33.1",wo=function(t){if(t===void 0&&(t={}),Dt(t))return new ed(t);if(Ze(t))return Kb.apply(Kb,arguments)};wo.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(wo),e.apply(null,t),this};wo.warnings=function(e){return YO(e)};wo.version=XJ;wo.stylesheet=wo.Stylesheet=hp;const rr={sage:"#abcfb8",ochre:"#edbf7f",terracotta:"#ffb4a1",neutral:"#8b928c",dimNeutral:"#6e7370",onSurface:"#e5e2e1",surface:"#111111"},QJ={concept:rr.sage,component:rr.ochre,bug:rr.terracotta,tool:rr.neutral,file:rr.neutral,spore:rr.sage,session:rr.ochre,other:rr.dimNeutral},WJ=rr.dimNeutral,WA=24,ZJ=60,JJ=12,eee=10,tee=8,D0=1.5,yv=.25,j0=.7,nee=9,ree=.7,aee=4,iee=.6,see=1e4,lee=120,oee=.2,uee=600,M0=50,ZA=20,JA={concept:"Concept",component:"Component",bug:"Bug",tool:"Tool",file:"File",spore:"Spore",session:"Session",other:"Other"};function cee(e){const t=Math.min(e/JJ,1);return WA+t*(ZJ-WA)}function fee(e){return e.length<=ZA?e:e.slice(0,ZA-1)+"…"}function eR(e){return QJ[e==null?void 0:e.toLowerCase()]??WJ}function dee({nodes:e,edges:t,onNodeSelect:n}){const r=R.useRef(null),a=R.useRef(null),i=R.useRef(n);i.current=n,R.useEffect(()=>{if(!r.current||e.length===0)return;const o=new Map(e.map(y=>[y.id,y])),f=new Map;for(const y of e)f.set(y.id,0);for(const y of t)f.set(y.source_id,(f.get(y.source_id)??0)+1),f.set(y.target_id,(f.get(y.target_id)??0)+1);const c=[...e.map(y=>{var S;const x=JA[(S=y.type)==null?void 0:S.toLowerCase()]??JA.other;return{data:{id:y.id,label:`${fee(y.name)}
738
+ ${x}`,fullLabel:y.name,type:y.type,degree:f.get(y.id)??0,nodeSize:cee(f.get(y.id)??0)}}}),...t.map((y,x)=>({data:{id:`edge-${x}`,source:y.source_id,target:y.target_id,label:y.label??"",weight:y.weight??1}}))],d=r.current.getBoundingClientRect();if(d.width===0||d.height===0)return;const v=wo({container:r.current,elements:c,style:[{selector:"node",style:{label:"data(label)","background-color":y=>eR(y.data("type")),"background-opacity":.9,color:rr.onSurface,"font-size":eee,"font-family":"Inter, system-ui, sans-serif","text-valign":"bottom","text-margin-y":tee,"text-outline-color":rr.surface,"text-outline-width":2,"text-outline-opacity":.8,"text-wrap":"wrap","text-max-width":"120px",width:"data(nodeSize)",height:"data(nodeSize)","border-width":0,"border-color":rr.sage,"border-opacity":0,"overlay-opacity":0}},{selector:"node:active",style:{"overlay-opacity":.08,"overlay-color":rr.sage}},{selector:"node:selected",style:{"border-width":aee,"border-color":y=>eR(y.data("type")),"border-opacity":iee,"background-opacity":1}},{selector:"edge",style:{width:D0,"line-color":rr.neutral,"line-opacity":yv,"curve-style":"unbundled-bezier","control-point-distances":[40],"control-point-weights":[.5],"target-arrow-shape":"triangle","target-arrow-color":rr.neutral,"arrow-scale":ree,label:"data(label)","font-size":nee,"font-family":"Inter, system-ui, sans-serif",color:rr.neutral,"text-opacity":0,"text-rotation":"autorotate","text-margin-y":-8,"text-outline-color":rr.surface,"text-outline-width":2,"text-outline-opacity":.7}},{selector:"edge:active",style:{"text-opacity":1,"line-opacity":j0}},{selector:"node.faded",style:{opacity:.3}},{selector:"edge.faded",style:{opacity:.1}}],layout:{name:"preset"},userZoomingEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,minZoom:.3,maxZoom:3}),m=v.layout({name:"cose",animate:!0,animationDuration:uee,nodeRepulsion:()=>see,idealEdgeLength:()=>lee,gravity:oee,nodeDimensionsIncludeLabels:!0,fit:!0,padding:M0});return m.on("layoutstop",()=>{v.fit(void 0,M0)}),m.run(),v.on("tap","node",y=>{var C;const x=y.target,S=x.data();v.elements().removeClass("faded");const w=x.closedNeighborhood();v.elements().not(w).addClass("faded"),x.connectedEdges().style({"line-opacity":j0,"text-opacity":.9,width:2});const b=o.get(S.id);(C=i.current)==null||C.call(i,b??{id:S.id,name:S.fullLabel??S.label,type:S.type})}),v.on("tap",y=>{var x;y.target===v&&(v.elements().removeClass("faded"),v.edges().style({"line-opacity":yv,"text-opacity":0,width:D0}),(x=i.current)==null||x.call(i,null))}),v.on("mouseover","edge",y=>{y.target.style("text-opacity",1),y.target.style("line-opacity",j0)}),v.on("mouseout","edge",y=>{const x=v.$("node:selected");x.length>0&&x.connectedEdges().contains(y.target)||(y.target.style("text-opacity",0),y.target.style("line-opacity",yv))}),a.current=v,()=>{v.destroy(),a.current=null}},[e,t]);const l=R.useCallback(()=>{const o=a.current;o&&(o.elements().removeClass("faded"),o.edges().style({"line-opacity":yv,"text-opacity":0,width:D0}),o.fit(void 0,M0))},[]);return{containerRef:r,resetView:l}}function hee({nodes:e,edges:t,onNodeSelect:n}){const{containerRef:r,resetView:a}=dee({nodes:e,edges:t,onNodeSelect:n});return p.jsxs("div",{className:"absolute inset-0",children:[p.jsx("div",{className:"absolute inset-0 rounded-md bg-surface-container-lowest",style:{backgroundImage:"radial-gradient(circle at 2px 2px, rgba(139, 146, 140, 0.05) 1px, transparent 0)",backgroundSize:"40px 40px"}}),p.jsx("div",{ref:r,className:"absolute inset-0 rounded-md"}),p.jsx("div",{className:"absolute top-3 right-3 z-10 flex items-center gap-2",children:p.jsxs(et,{variant:"ghost",size:"sm",onClick:a,className:"gap-1.5",children:[p.jsx(c1,{className:"h-3.5 w-3.5"}),"Reset"]})}),e.length>0&&p.jsxs("div",{className:"absolute bottom-3 left-3 z-10 flex items-center gap-3 font-mono text-[10px] text-on-surface-variant/60",children:[p.jsxs("span",{children:[e.length," nodes"]}),p.jsxs("span",{children:[t.length," edges"]})]}),e.length===0&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:p.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:"No nodes to display"})})]})}const tR=[{type:"concept",label:"Concept",dotColor:"bg-primary"},{type:"component",label:"Component",dotColor:"bg-secondary"},{type:"bug",label:"Bug",dotColor:"bg-tertiary"},{type:"tool",label:"Tool",dotColor:"bg-outline"},{type:"file",label:"File",dotColor:"bg-outline"},{type:"spore",label:"Spore",dotColor:"bg-primary"},{type:"session",label:"Session",dotColor:"bg-secondary"},{type:"other",label:"Other",dotColor:"bg-on-surface-variant"}],vee=[{type:"RELATES_TO",label:"Relates To"},{type:"DERIVES_FROM",label:"Derives From"},{type:"REFERENCES",label:"References"},{type:"DEPENDS_ON",label:"Depends On"},{type:"AFFECTS",label:"Affects"}];function pee({entityCounts:e={},enabledTypes:t,onToggleType:n,searchQuery:r,onSearchChange:a,enabledEdgeTypes:i,onToggleEdgeType:l}){const[o,f]=R.useState(!1),c=Object.values(e).reduce((v,m)=>v+m,0),d=tR.length-t.size;return p.jsxs("div",{className:"absolute top-3 left-3 z-10",children:[!o&&p.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex items-center gap-2 rounded-md bg-surface-container/90 backdrop-blur-sm px-3 py-2 text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high/90 transition-colors shadow-sm","aria-label":"Open graph filters",children:[p.jsx(zP,{className:"h-3.5 w-3.5"}),p.jsx("span",{className:"font-sans text-xs font-medium",children:"Filters"}),d>0&&p.jsx("span",{className:"font-mono text-[10px] bg-primary/20 text-primary rounded-full px-1.5 py-0.5 leading-none",children:d}),p.jsx("span",{className:"font-mono text-[10px] text-on-surface-variant/50",children:c})]}),o&&p.jsxs("div",{className:"w-52 rounded-md bg-surface-container/95 backdrop-blur-md shadow-lg border border-outline-variant/20 overflow-hidden",children:[p.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-outline-variant/10",children:[p.jsx("span",{className:"font-sans text-xs font-medium uppercase tracking-widest text-on-surface-variant",children:"Filters"}),p.jsx("button",{type:"button",onClick:()=>f(!1),className:"rounded p-0.5 text-on-surface-variant hover:text-on-surface transition-colors","aria-label":"Close filters",children:p.jsx(rc,{className:"h-3.5 w-3.5"})})]}),p.jsxs("div",{className:"p-3 space-y-4",children:[p.jsxs("div",{className:"relative",children:[p.jsx(nc,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-on-surface-variant/50"}),p.jsx(Sn,{placeholder:"Search nodes...",value:r,onChange:v=>a(v.target.value),className:"text-xs pl-7 h-7"})]}),p.jsx("div",{className:"space-y-1",children:tR.map(v=>{const m=e[v.type]??0,y=t.has(v.type);return p.jsxs("label",{className:"flex items-center gap-2 py-1 cursor-pointer group",children:[p.jsx("input",{type:"checkbox",checked:y,onChange:()=>n(v.type),className:"sr-only"}),p.jsx("div",{className:Ae("h-3 w-3 rounded-sm flex items-center justify-center transition-colors",y?"bg-surface-container-high":"bg-surface-container-lowest"),children:y&&p.jsx("div",{className:Ae("h-1.5 w-1.5 rounded-full",v.dotColor)})}),p.jsx("span",{className:Ae("font-sans text-xs transition-colors",y?"text-on-surface":"text-on-surface-variant/50"),children:v.label}),p.jsx("span",{className:"ml-auto font-mono text-[10px] text-on-surface-variant/50",children:m})]},v.type)})}),i&&l&&p.jsxs("div",{className:"space-y-1 pt-1 border-t border-outline-variant/10",children:[p.jsx("div",{className:"font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant/60 pt-1",children:"Edges"}),vee.map(v=>{const m=i.has(v.type);return p.jsxs("label",{className:"flex items-center gap-2 py-0.5 cursor-pointer",children:[p.jsx("input",{type:"checkbox",checked:m,onChange:()=>l(v.type),className:"sr-only"}),p.jsx("div",{className:Ae("h-2.5 w-2.5 rounded-sm flex items-center justify-center transition-colors",m?"bg-surface-container-high":"bg-surface-container-lowest"),children:m&&p.jsx("div",{className:"h-1 w-1 rounded-full bg-outline"})}),p.jsx("span",{className:Ae("font-sans text-[11px] transition-colors",m?"text-on-surface-variant":"text-on-surface-variant/40"),children:v.label})]},v.type)})]})]})]})]})}const nR=400,mee={concept:"default",component:"warning",bug:"destructive",tool:"secondary",file:"secondary",spore:"default",session:"warning"},rR={concept:"bg-primary",component:"bg-secondary",bug:"bg-tertiary",tool:"bg-outline",file:"bg-outline",spore:"bg-primary",session:"bg-secondary"};function Ls({label:e,value:t}){return p.jsxs("div",{className:"flex justify-between items-baseline py-1",children:[p.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:e}),p.jsx("span",{className:"font-mono text-xs text-on-surface text-right max-w-[160px] truncate",children:t})]})}function gee({node:e,edges:t,nodes:n,metadata:r,markdownPreview:a,connectedSpores:i,onClose:l,onNodeSelect:o}){if(!e)return null;const f=e.type.toLowerCase(),c=mee[f]??"secondary",d=rR[f]??"bg-outline",v=new Map((n??[]).map(w=>[w.id,w])),m=[];for(const w of t??[])if(w.source_id===e.id){const b=v.get(w.target_id);b&&m.push({nodeId:b.id,nodeName:b.name,nodeType:b.type,edgeLabel:w.label??"connected",direction:"outgoing"})}else if(w.target_id===e.id){const b=v.get(w.source_id);b&&m.push({nodeId:b.id,nodeName:b.name,nodeType:b.type,edgeLabel:w.label??"connected",direction:"incoming"})}const y=a??e.content,x=y&&y.length>nR?y.slice(0,nR)+"…":y,S=e.type==="spore"?"Observation":e.type==="session"?"Summary":"Notes";return p.jsxs(dt,{glass:!0,className:"absolute top-0 right-0 z-20 w-[320px] max-h-full overflow-y-auto flex flex-col shadow-lg border border-outline-variant/15 rounded-md",children:[p.jsx("div",{className:"p-4 pb-3",children:p.jsxs("div",{className:"flex items-start justify-between gap-2",children:[p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[p.jsx("div",{className:`h-2 w-2 rounded-full ${d} shrink-0`}),p.jsx(sr,{variant:c,className:"text-[10px] uppercase",children:e.observation_type??e.type})]}),p.jsx("h2",{className:"font-serif text-lg text-on-surface leading-tight break-words",children:e.name})]}),l&&p.jsx("button",{onClick:l,className:"shrink-0 rounded-md p-1 text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high transition-colors",children:p.jsx(rc,{className:"h-4 w-4"})})]})}),p.jsx("div",{className:"h-px bg-surface-container-high/50"}),p.jsxs("div",{className:"px-4 py-3 space-y-0.5",children:[p.jsx(Pn,{children:"Metadata"}),p.jsxs("div",{className:"mt-1.5",children:[p.jsx(Ls,{label:"Type",value:e.observation_type??e.type}),p.jsx(Ls,{label:"ID",value:e.id.slice(0,12)+"…"}),e.status&&p.jsx(Ls,{label:"Status",value:e.status}),e.created_at!=null&&p.jsx(Ls,{label:"Created",value:new Date(e.created_at).toLocaleDateString()}),e.mention_count!=null&&e.mention_count>0&&p.jsx(Ls,{label:"Mentions",value:String(e.mention_count)}),p.jsx(Ls,{label:"Connections",value:String(m.length)}),e.depth!==void 0&&p.jsx(Ls,{label:"Depth",value:String(e.depth)}),r&&Object.entries(r).map(([w,b])=>p.jsx(Ls,{label:w,value:b},w))]})]}),x&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"h-px bg-surface-container-high/50"}),p.jsxs("div",{className:"px-4 py-3 space-y-1.5",children:[p.jsx(Pn,{children:S}),p.jsx(dt,{level:"lowest",className:"p-3 font-sans text-xs text-on-surface-variant whitespace-pre-wrap leading-relaxed",children:x})]})]}),m.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"h-px bg-surface-container-high/50"}),p.jsxs("div",{className:"px-4 py-3 space-y-2",children:[p.jsxs(Pn,{children:["Connections (",m.length,")"]}),p.jsx("div",{className:"space-y-1",children:m.map((w,b)=>{const C=w.nodeType.toLowerCase(),T=rR[C]??"bg-outline",k=v.get(w.nodeId);return p.jsxs("button",{className:"w-full flex items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-surface-container-high/50 transition-colors group",onClick:()=>k&&(o==null?void 0:o(k)),children:[p.jsx("div",{className:`h-2 w-2 rounded-full ${T} shrink-0`}),p.jsx("span",{className:"font-sans text-xs text-on-surface truncate flex-1 group-hover:text-primary transition-colors",children:w.nodeName}),p.jsx(J0,{className:`h-3 w-3 shrink-0 ${w.direction==="incoming"?"rotate-180":""} text-on-surface-variant/50`}),p.jsx("span",{className:"font-mono text-[9px] text-on-surface-variant/60 shrink-0 max-w-[80px] truncate",children:w.edgeLabel})]},`${w.nodeId}-${w.edgeLabel}-${b}`)})})]})]}),i&&i.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"h-px bg-surface-container-high/50"}),p.jsxs("div",{className:"px-4 py-3 space-y-1.5",children:[p.jsx(Pn,{children:"Connected Spores"}),p.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(w=>p.jsx(sr,{variant:"secondary",className:"cursor-pointer text-[10px] hover:bg-surface-container-highest transition-colors",children:w.name},w.id))})]})]})]})}const yee=15e3,xee=3e4,bee=3e4,wee=3e4,See=6e4;function Eee(e){const t=new URLSearchParams;e!=null&&e.type&&t.set("type",e.type),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.search&&t.set("search",e.search),(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),(e==null?void 0:e.offset)!==void 0&&t.set("offset",String(e.offset));const n=t.toString(),r=n?`/spores?${n}`:"/spores";return mn({queryKey:["spores",e],queryFn:({signal:a})=>Et(r,{signal:a}),staleTime:yee})}function Cee(e){return mn({queryKey:["spore",e],queryFn:({signal:t})=>Et(`/spores/${e}`,{signal:t}),enabled:e!==void 0,staleTime:xee})}function Tee(e){const n=new URLSearchParams().toString(),r=n?`/entities?${n}`:"/entities";return mn({queryKey:["entities",e],queryFn:({signal:a})=>Et(r,{signal:a}),staleTime:bee})}function Nee(e,t=1){return mn({queryKey:["graph",e,t],queryFn:({signal:n})=>Et(`/graph/${e}?depth=${t}`,{signal:n}),enabled:e!==void 0,staleTime:wee})}function kee(e){const t=e?`/digest?agent_id=${encodeURIComponent(e)}`:"/digest";return mn({queryKey:["digest",e],queryFn:({signal:n})=>Et(t,{signal:n}),staleTime:See})}function S_(e){switch(e){case"wisdom":return"bg-primary/15 text-primary";case"discovery":return"bg-primary/15 text-primary";case"decision":return"bg-secondary/15 text-secondary";case"trade_off":return"bg-secondary/15 text-secondary";case"gotcha":return"bg-tertiary/15 text-tertiary";case"bug_fix":return"bg-tertiary/15 text-tertiary";default:return"bg-surface-container text-on-surface-variant"}}function E_(e){switch(e){case"active":return"bg-primary/15 text-primary";case"consolidated":return"bg-surface-container-high text-on-surface-variant";case"superseded":return"bg-tertiary/10 text-tertiary/70";default:return"bg-surface-container text-on-surface-variant"}}function lo(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}const aR=120,Aee=1e3,Ree=8,Dee=[Cr,"gotcha","decision","discovery","trade_off","bug_fix"],jee=[Cr,"active","superseded","consolidated"],Mee=[{key:"type",label:"Type",options:Dee.map(e=>({value:e,label:e===Cr?"All types":lo(e)}))},{key:"status",label:"Status",options:jee.map(e=>({value:e,label:e===Cr?"All statuses":lo(e)}))}];function Oee(e){return new Date(e*Aee).toLocaleDateString()}function Lee({spore:e,onClick:t,isSelected:n}){return p.jsx(dt,{level:n?"high":"low",className:Ae("p-4 cursor-pointer transition-all duration-150 hover:bg-surface-container-high hover:shadow-[inset_3px_0_0_var(--primary)] rounded-lg","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",n&&"ring-1 ring-primary/30"),onClick:t,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),t())},tabIndex:0,role:"button","aria-label":`${lo(e.observation_type)} spore: ${lb(e.content,aR)}`,"aria-pressed":n,children:p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[p.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[p.jsx("span",{className:Ae("inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold",S_(e.observation_type)),children:lo(e.observation_type)}),p.jsx("span",{className:Ae("inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold",E_(e.status)),children:lo(e.status)}),e.importance!==null&&p.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.importance.toFixed(1)})]}),p.jsx("p",{className:"font-sans text-sm text-on-surface",children:lb(e.content,aR)})]}),p.jsxs("div",{className:"shrink-0 text-right space-y-1",children:[e.session_id&&p.jsx("div",{className:"font-mono text-xs text-on-surface-variant",children:e.session_id.slice(0,Ree)}),p.jsx("div",{className:"font-sans text-xs text-on-surface-variant",children:Oee(e.created_at)})]})]})})}function _ee(){return p.jsx(dt,{level:"low",className:"p-4 rounded-lg",children:p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsxs("div",{className:"flex-1 space-y-2",children:[p.jsxs("div",{className:"flex gap-2",children:[p.jsx("div",{className:"h-5 w-16 animate-pulse rounded bg-surface-container"}),p.jsx("div",{className:"h-5 w-14 animate-pulse rounded bg-surface-container"})]}),p.jsx("div",{className:"h-4 w-3/4 animate-pulse rounded bg-surface-container"})]}),p.jsxs("div",{className:"shrink-0 space-y-1",children:[p.jsx("div",{className:"h-3 w-14 animate-pulse rounded bg-surface-container"}),p.jsx("div",{className:"h-3 w-16 animate-pulse rounded bg-surface-container"})]})]})})}function Bee({onSelectSpore:e,selectedSporeId:t}){const{searchInput:n,debouncedSearch:r,filterValues:a,offset:i,setOffset:l,handleSearchChange:o,handleFilterChange:f,activeFilter:c}=U1({initialFilters:{type:Cr,status:Cr}}),d=c("type"),v=c("status"),{data:m,isLoading:y,isError:x,error:S}=Eee({type:d,status:v,search:r,limit:Ja,offset:i}),w=(m==null?void 0:m.spores)??[],b=(m==null?void 0:m.total)??0;return p.jsxs("div",{className:"space-y-3",children:[p.jsx(q1,{searchPlaceholder:"Search spores...",searchValue:n,onSearchChange:o,filters:Mee,filterValues:a,onFilterChange:f}),x?p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-destructive",children:[p.jsx(Qi,{className:"h-5 w-5"}),p.jsx("span",{className:"font-sans text-sm",children:"Failed to load spores"}),p.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:S instanceof Error?S.message:"Unknown error"})]}):p.jsx("div",{className:"space-y-2",children:y?[1,2,3,4,5].map(C=>p.jsx(_ee,{},C)):w.length===0?p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant",children:[p.jsx(ZP,{className:"h-8 w-8 opacity-30"}),p.jsx("span",{className:"font-sans text-sm",children:b===0&&!r&&!d&&!v?"No spores yet":"No matching spores"}),b===0&&!r&&!d&&!v&&p.jsx("span",{className:"font-sans text-xs",children:"Spores are extracted from session activity by the agent"})]}):w.map(C=>p.jsx(Lee,{spore:C,onClick:()=>e(C),isSelected:C.id===t},C.id))}),p.jsx(Bp,{total:b,offset:i,limit:Ja,onPageChange:l})]})}const Pee=12,iR=8;function zee({type:e}){return p.jsx("span",{className:Ae("inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold",S_(e)),children:lo(e)})}function Iee({status:e}){return p.jsx("span",{className:Ae("inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold",E_(e)),children:lo(e)})}function Tf({label:e,value:t,children:n}){return p.jsxs("div",{className:"flex items-start justify-between gap-3 py-1.5",children:[p.jsx("span",{className:"shrink-0 font-sans text-xs text-on-surface-variant",children:e}),n??p.jsx("span",{className:"font-mono text-xs text-on-surface text-right break-all",children:t})]})}function Fee({id:e,onBack:t,onNavigateToSpore:n,onNavigateToGraph:r}){const a=vl(),{data:i,isLoading:l,isError:o,error:f}=Cee(e);if(l)return p.jsxs("div",{className:"flex h-64 items-center justify-center gap-2 text-on-surface-variant",children:[p.jsx(Xn,{className:"h-5 w-5 animate-spin"}),p.jsx("span",{className:"font-sans",children:"Loading spore..."})]});if(o||!i)return p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-destructive",children:[p.jsx(Qi,{className:"h-5 w-5"}),p.jsx("span",{className:"font-sans text-sm",children:"Spore not found"}),p.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:f instanceof Error?f.message:"Unknown error"})]});const c=(()=>{if(!i.tags)return[];if(i.tags.startsWith("["))try{return JSON.parse(i.tags)}catch{}return i.tags.split(",").map(d=>d.trim()).filter(Boolean)})();return p.jsxs("div",{className:"space-y-6",children:[p.jsxs(et,{variant:"ghost",size:"sm",onClick:t,className:"gap-2 text-on-surface-variant",children:[p.jsx(Ws,{className:"h-4 w-4"}),"Spores"]}),p.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[p.jsx(zee,{type:i.observation_type}),p.jsx(Iee,{status:i.status}),i.importance!==null&&p.jsxs("span",{className:"font-sans text-xs text-on-surface-variant",children:["Importance: ",p.jsx("span",{className:"text-on-surface font-medium",children:i.importance.toFixed(1)})]}),p.jsx("span",{className:"font-sans text-xs text-on-surface-variant ml-auto",children:ii(i.created_at)})]}),p.jsxs(dt,{level:"low",className:"p-5",children:[p.jsx(Pn,{className:"mb-2",children:"Observation"}),p.jsx(si,{content:i.content})]}),i.context&&p.jsxs(dt,{level:"low",className:"p-5",children:[p.jsx(Pn,{className:"mb-2",children:"Context"}),p.jsx(si,{content:i.context})]}),c.length>0&&p.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.map(d=>p.jsx("span",{className:"inline-flex items-center rounded-full bg-surface-container px-2.5 py-0.5 font-sans text-xs text-on-surface-variant",children:d},d))}),(i.predecessor_id||i.successor_id)&&p.jsxs(dt,{level:"low",className:"p-5 space-y-2",children:[p.jsx(Pn,{children:"Resolution History"}),i.predecessor_id&&p.jsxs("div",{className:"flex items-center gap-2 font-sans text-xs text-on-surface-variant",children:[p.jsx("span",{children:"Supersedes"}),p.jsxs("button",{className:"font-mono text-primary hover:underline flex items-center gap-1",onClick:()=>n==null?void 0:n(i.predecessor_id),children:[i.predecessor_id.slice(0,iR),p.jsx(J0,{className:"h-3 w-3"})]})]}),i.successor_id&&p.jsxs("div",{className:"flex items-center gap-2 font-sans text-xs text-on-surface-variant",children:[p.jsx("span",{children:"Superseded by"}),p.jsxs("button",{className:"font-mono text-primary hover:underline flex items-center gap-1",onClick:()=>n==null?void 0:n(i.successor_id),children:[i.successor_id.slice(0,iR),p.jsx(J0,{className:"h-3 w-3"})]})]})]}),p.jsxs(dt,{glass:!0,className:"p-5",children:[p.jsx(Pn,{className:"mb-2",children:"Metadata"}),p.jsxs("div",{className:"text-sm",children:[p.jsx(Tf,{label:"ID",value:i.id}),p.jsx(Tf,{label:"Created",value:sb(i.created_at)}),p.jsx(Tf,{label:"Updated",value:sb(i.updated_at)}),i.session_id&&p.jsx(Tf,{label:"Session",children:p.jsxs("button",{className:"font-mono text-xs text-primary hover:underline flex items-center gap-1",onClick:()=>a(`/sessions/${i.session_id}`),children:[i.session_id.slice(0,Pee),p.jsx(mD,{className:"h-3 w-3"})]})}),i.agent_id&&p.jsx(Tf,{label:"Agent",value:i.agent_id})]})]})]})}const O0=200,qee={1500:"T1500 — Compact",5e3:"T5000 — Standard",1e4:"T10000 — Full"};function Uee(e){return qee[e]??`T${e}`}function Vee({tier:e}){const[t,n]=R.useState(!1),r=e.content.length>O0,a=r&&!t?e.content.slice(0,O0)+"…":e.content;return p.jsxs(dt,{level:"low",className:"p-5 space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[p.jsx("span",{className:"font-mono text-sm text-on-surface font-medium",children:Uee(e.tier)}),p.jsxs("span",{className:"font-sans text-xs text-on-surface-variant",children:["Generated ",ii(e.generated_at)]})]}),p.jsx(si,{content:a}),r&&p.jsx(et,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-xs text-on-surface-variant",onClick:()=>n(!t),children:t?p.jsxs(p.Fragment,{children:[p.jsx(OP,{className:"h-3 w-3"}),"Show less"]}):p.jsxs(p.Fragment,{children:[p.jsx(Ma,{className:"h-3 w-3"}),"Show more (",e.content.length-O0," more chars)"]})})]})}function Hee(){return p.jsxs(dt,{level:"low",className:"p-5",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-surface-container"}),p.jsx("div",{className:"h-3 w-20 animate-pulse rounded bg-surface-container"})]}),p.jsxs("div",{className:"space-y-2 mt-3",children:[p.jsx("div",{className:"h-3 animate-pulse rounded bg-surface-container"}),p.jsx("div",{className:"h-3 w-4/5 animate-pulse rounded bg-surface-container"}),p.jsx("div",{className:"h-3 w-3/5 animate-pulse rounded bg-surface-container"})]})]})}function Gee({agentId:e}){const{data:t,isLoading:n,isError:r,error:a}=kee(e),i=(t==null?void 0:t.tiers)??[];return n?p.jsx("div",{className:"space-y-4",children:[1,2,3].map(l=>p.jsx(Hee,{},l))}):r?p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-destructive",children:[p.jsx(Qi,{className:"h-5 w-5"}),p.jsx("span",{className:"font-sans text-sm",children:"Failed to load digest"}),p.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:a instanceof Error?a.message:"Unknown error"})]}):i.length===0?p.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-on-surface-variant",children:[p.jsx(IP,{className:"h-8 w-8 opacity-30"}),p.jsx("span",{className:"font-sans text-sm",children:"No digest generated yet"}),p.jsx("span",{className:"font-sans text-xs text-center max-w-xs",children:"Run the agent with the digest-only task to synthesize your vault knowledge into context extracts."})]}):p.jsxs("div",{className:"space-y-4",children:[p.jsxs("p",{className:"font-sans text-sm text-on-surface-variant",children:[i.length," tier",i.length!==1?"s":""," — pre-computed context extracts at different token budgets."]}),i.map(l=>p.jsx(Vee,{tier:l},l.tier))]})}const L0=new Set(["concept","component","bug","tool","file","spore","session","other"]),$ee=2,Yee=[{id:"graph",label:"Graph"},{id:"spores",label:"Spores"},{id:"digest",label:"Digest"}],C_="tab",T_="spore",Kee=new Set(["graph","spores","digest"]);function Xee(){const e=new URLSearchParams(window.location.search),t=e.get(C_);return{tab:t&&Kee.has(t)?t:"graph",sporeId:e.get(T_)??void 0}}function Qee(e,t){const n=new URLSearchParams;e!=="graph"&&n.set(C_,e),t&&n.set(T_,t);const r=n.toString(),a=r?`${window.location.pathname}?${r}`:window.location.pathname;window.history.replaceState(null,"",a)}function Wee(){var w;const[e,t]=R.useState(new Set(L0)),[n,r]=R.useState(""),[a,i]=R.useState(null),{data:l}=Tee(),o=(l==null?void 0:l.entities)??[],f=o.length>0?(w=o[0])==null?void 0:w.id:void 0,{data:c}=Nee(f,$ee),d=R.useMemo(()=>{const b=[...(c==null?void 0:c.nodes)??[]];return c!=null&&c.center&&b.unshift(c.center),b},[c==null?void 0:c.center,c==null?void 0:c.nodes]),v=R.useMemo(()=>{const b={};for(const C of d){const T=C.type.toLowerCase(),k=L0.has(T)?T:"other";b[k]=(b[k]??0)+1}return b},[d]),m=R.useMemo(()=>{const b=n.toLowerCase();return d.filter(C=>{const T=C.type.toLowerCase(),k=L0.has(T)?T:"other";return!(!e.has(k)||b&&!C.name.toLowerCase().includes(b))})},[d,e,n]),y=R.useMemo(()=>{const b=(c==null?void 0:c.edges)??[],C=new Set(m.map(T=>T.id));return b.filter(T=>C.has(T.source_id)&&C.has(T.target_id))},[c==null?void 0:c.edges,m]),x=R.useCallback(b=>{t(C=>{const T=new Set(C);return T.has(b)?T.delete(b):T.add(b),T})},[]),S=R.useCallback(b=>{i(b)},[]);return p.jsxs("div",{className:"relative h-[calc(100vh-180px)]",children:[p.jsx(hee,{nodes:m,edges:y,onNodeSelect:S,selectedNode:a}),p.jsx(pee,{entityCounts:v,enabledTypes:e,onToggleType:x,searchQuery:n,onSearchChange:r}),p.jsx(gee,{node:a,edges:y,nodes:m,onClose:()=>i(null),onNodeSelect:b=>i(b)})]})}function Zee(){const e=Xee(),[t,n]=R.useState(e.tab),[r,a]=R.useState(e.sporeId?{id:e.sporeId}:null);R.useEffect(()=>{Qee(t,r==null?void 0:r.id)},[t,r==null?void 0:r.id]);function i(c){a(c)}function l(){a(null)}function o(c){a({id:c})}function f(c){n(c),c!=="spores"&&a(null)}return p.jsxs("div",{className:"p-6 space-y-4",children:[p.jsx(al,{title:"Mycelium",subtitle:"Derived intelligence — spores, entity graph, and synthesized context.",tabs:Yee,activeTab:t,onTabChange:c=>f(c)}),t==="graph"&&p.jsx(Wee,{}),t==="spores"&&(r?p.jsx(Fee,{id:r.id,onBack:l,onNavigateToSpore:o}):p.jsx(Bee,{onSelectSpore:i})),t==="digest"&&p.jsx(Gee,{})]})}const Jee=[{value:Cr,label:"All statuses"},{value:"running",label:"Running"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"},{value:"cancelled",label:"Cancelled"}];function ete({status:e}){const t=Sj(e);return p.jsx("span",{className:Ae("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-semibold",t==="default"?"bg-primary-container/20 text-primary":t==="destructive"?"bg-tertiary-container/20 text-tertiary":t==="warning"?"bg-secondary-container/20 text-secondary":"bg-surface-container-high text-on-surface-variant"),children:N1(e)})}function tte(){return p.jsx("tr",{className:"border-b border-outline-variant/20",children:[200,80,100,80,80].map((e,t)=>p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:Ae("h-4 animate-pulse rounded bg-surface-container"),style:{width:e}})},t))})}function nte({run:e,onClick:t,taskNameMap:n}){const r=e.task?n.get(e.task)??e.task:Cj;return p.jsxs("tr",{className:"border-b border-outline-variant/20 last:border-0 hover:bg-surface-container-high/50 cursor-pointer transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40 hover:shadow-[inset_3px_0_0_var(--primary)]",onClick:t,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())},tabIndex:0,role:"row","aria-label":`Agent run: ${r}, status ${e.status}`,children:[p.jsx("td",{className:"px-4 py-3",children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(dd,{className:"h-3.5 w-3.5 shrink-0 text-on-surface-variant"}),p.jsx("span",{className:"text-sm font-medium text-on-surface truncate max-w-xs",children:r})]})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx(ete,{status:e.status})}),p.jsx("td",{className:"px-4 py-3 text-xs text-on-surface-variant font-mono",children:xj(e.started_at)}),p.jsx("td",{className:"px-4 py-3 text-xs text-on-surface-variant font-mono",children:Ap(e.started_at,e.completed_at)}),p.jsx("td",{className:"px-4 py-3 text-xs text-on-surface-variant font-mono",children:j1(e.tokens_used)}),p.jsx("td",{className:"px-4 py-3 text-xs text-on-surface-variant font-mono",children:D1(e.cost_usd)})]})}function rte({onSelectRun:e,onTriggerRun:t}){const{searchInput:n,debouncedSearch:r,filterValues:a,offset:i,setOffset:l,handleSearchChange:o,handleFilterChange:f,activeFilter:c}=U1({initialFilters:{status:Cr,task:Cr}}),{data:d}=ic(),v=R.useMemo(()=>{const L=new Map;for(const _ of(d==null?void 0:d.tasks)??[])L.set(_.name,_.displayName);return L},[d]),m=R.useMemo(()=>{const L=[{value:Cr,label:"All tasks"}];for(const _ of(d==null?void 0:d.tasks)??[])L.push({value:_.name,label:_.displayName});return L},[d]),y=R.useMemo(()=>[{key:"status",label:"Status",options:Jee},{key:"task",label:"Task",options:m}],[m]),x=c("status"),S=c("task"),{data:w,isLoading:b,isError:C,error:T}=wj({limit:Ja,offset:i,search:r,status:x,task:S}),k=(w==null?void 0:w.runs)??[],D=(w==null?void 0:w.total)??0,A=p.jsx(q1,{searchPlaceholder:"Search runs...",searchValue:n,onSearchChange:o,filters:y,filterValues:a,onFilterChange:f}),j=p.jsx("thead",{children:p.jsxs("tr",{className:"border-b border-outline-variant/20 bg-surface-container/50",children:[p.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-on-surface-variant uppercase tracking-widest font-sans",children:"Task"}),p.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-on-surface-variant uppercase tracking-widest font-sans",children:"Status"}),p.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-on-surface-variant uppercase tracking-widest font-sans",children:"Started"}),p.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-on-surface-variant uppercase tracking-widest font-sans",children:"Duration"}),p.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-on-surface-variant uppercase tracking-widest font-sans",children:"Tokens"}),p.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-on-surface-variant uppercase tracking-widest font-sans",children:"Cost"})]})});return C?p.jsxs("div",{className:"space-y-4",children:[A,p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary",children:[p.jsx(Qi,{className:"h-5 w-5"}),p.jsx("span",{className:"font-sans text-sm",children:"Failed to load runs"}),p.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:T instanceof Error?T.message:"Unknown error"})]})]}):p.jsxs("div",{className:"space-y-4",children:[A,b?p.jsx("div",{className:"rounded-md bg-surface-container-low overflow-hidden",children:p.jsxs("table",{className:"w-full",children:[j,p.jsx("tbody",{children:[1,2,3].map(L=>p.jsx(tte,{},L))})]})}):k.length===0?p.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-3 rounded-md bg-surface-container-low text-on-surface-variant",children:[p.jsx(dd,{className:"h-10 w-10 opacity-30"}),p.jsxs("div",{className:"text-center font-sans",children:[p.jsx("p",{className:"text-sm",children:D===0&&!r&&!x&&!S?"No agent runs yet":"No matching runs"}),D===0&&!r&&!x&&!S&&p.jsx("p",{className:"text-xs mt-1",children:"Trigger the first run to see the agent at work"})]}),D===0&&!r&&!x&&!S&&p.jsxs(et,{variant:"outline",size:"sm",className:"gap-2 mt-2",onClick:t,children:[p.jsx(Yu,{className:"h-3.5 w-3.5"}),"Run Now"]})]}):p.jsx("div",{className:"rounded-md bg-surface-container-low overflow-hidden",children:p.jsxs("table",{className:"w-full","aria-label":"Agent runs",children:[j,p.jsx("tbody",{children:k.map(L=>p.jsx(nte,{run:L,taskNameMap:v,onClick:()=>e(L.id)},L.id))})]})}),p.jsx(Bp,{total:D,offset:i,limit:Ja,onPageChange:l})]})}function ate({text:e}){const[t,n]=R.useState(!1),r=e.length>200||e.includes(`
739
+ `);return p.jsxs("div",{className:"mt-1",children:[p.jsx("div",{className:!t&&r?"line-clamp-2":void 0,children:p.jsx(si,{content:e,className:"text-on-surface-variant [&>*]:text-on-surface-variant"})}),r&&p.jsx("button",{className:"flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors mt-1",onClick:()=>n(!t),children:t?p.jsxs(p.Fragment,{children:[p.jsx(Ma,{className:"h-3 w-3"})," Show less"]}):p.jsxs(p.Fragment,{children:[p.jsx(wa,{className:"h-3 w-3"})," Show more"]})})]})}function ite({phases:e}){return p.jsxs("div",{className:"space-y-3",children:[p.jsx("h3",{className:"font-sans text-sm font-medium text-on-surface",children:"Phase Execution"}),e.map((t,n)=>p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-surface-container-high font-mono text-sm font-medium text-on-surface-variant shrink-0",children:n+1}),p.jsxs(dt,{level:"default",className:"flex-1 p-3",children:[p.jsxs("div",{className:"flex justify-between items-center",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"font-sans text-sm font-medium text-on-surface",children:t.name}),p.jsx(sr,{variant:Sj(t.status),children:t.status})]}),p.jsxs("div",{className:"flex gap-3 font-mono text-xs text-on-surface-variant",children:[p.jsxs("span",{children:[t.turnsUsed," turns"]}),p.jsx("span",{children:j1(t.tokensUsed)}),p.jsx("span",{children:D1(t.costUsd)})]})]}),t.summary&&p.jsx(ate,{text:t.summary})]})]},t.name))]})}const sR=80,ste=1e3;function lte(e){const t=e.toLowerCase();return t.includes("extract")||t.includes("create")||t.includes("supersed")||t.includes("update")?"default":t.includes("skip")||t.includes("no-op")?"secondary":t.includes("error")||t.includes("fail")?"destructive":"default"}function ote(e){return e===null?"—":new Date(e*ste).toLocaleTimeString()}function ute(e,t){return e&&lb(e,t)||"—"}function cte({report:e}){const[t,n]=R.useState(!1),[r,a]=R.useState(!1),i=e.details!==null&&e.details.length>0,l=e.summary.length>200||e.summary.includes(`
740
+ `);let o=null;if(i)try{o=JSON.parse(e.details)}catch{o=e.details}return p.jsxs(dt,{level:"low",className:"p-4 space-y-2",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx(sr,{variant:lte(e.action),children:e.action}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:!r&&l?"line-clamp-3":void 0,children:p.jsx(si,{content:e.summary})}),l&&p.jsx("button",{className:"flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors mt-1",onClick:()=>a(!r),children:r?p.jsxs(p.Fragment,{children:[p.jsx(Ma,{className:"h-3 w-3"})," Show less"]}):p.jsxs(p.Fragment,{children:[p.jsx(wa,{className:"h-3 w-3"})," Show more"]})})]}),p.jsx("span",{className:"font-mono text-xs text-on-surface-variant shrink-0",children:ote(e.created_at)})]}),i&&p.jsxs("div",{children:[p.jsxs("button",{className:"flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors",onClick:()=>n(!t),children:[t?p.jsx(Ma,{className:"h-3.5 w-3.5"}):p.jsx(wa,{className:"h-3.5 w-3.5"}),t?"Hide details":"Show details"]}),t&&p.jsx("pre",{className:"mt-2 rounded-md bg-surface-container-lowest p-3 font-mono text-xs overflow-auto max-h-48 text-on-surface-variant",children:typeof o=="string"?o:JSON.stringify(o,null,2)})]})]})}function fte({turn:e}){const[t,n]=R.useState(!1);let r=null;if(e.tool_input)try{r=JSON.parse(e.tool_input)}catch{r=e.tool_input}const a=e.tool_input?ute(e.tool_input,sR):"—",i=e.tool_input!==null&&e.tool_input.length>sR;return p.jsx("div",{className:"px-4 py-2.5 hover:bg-surface-container-high/30 transition-colors border-b border-outline-variant/10 last:border-b-0",children:p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("span",{className:"font-mono text-xs text-on-surface-variant w-5 shrink-0 pt-0.5 text-right",children:e.turn_number}),p.jsx("span",{className:"font-mono text-xs font-medium text-on-surface shrink-0 pt-0.5 min-w-[140px]",children:e.tool_name}),p.jsxs("div",{className:"flex-1 min-w-0",children:[i?p.jsxs("button",{className:"flex items-start gap-1 text-left font-mono text-xs text-on-surface-variant hover:text-on-surface transition-colors w-full",onClick:()=>n(!t),children:[t?p.jsx(Ma,{className:"h-3 w-3 mt-0.5 shrink-0"}):p.jsx(wa,{className:"h-3 w-3 mt-0.5 shrink-0"}),p.jsx("span",{className:t?void 0:"truncate",children:a})]}):p.jsx("span",{className:"font-mono text-xs text-on-surface-variant truncate block",children:a}),t&&r!==null&&p.jsx("pre",{className:"mt-1.5 ml-4 rounded-md bg-surface-container-lowest p-2.5 font-mono text-xs overflow-auto max-h-48 text-on-surface-variant",children:typeof r=="string"?r:JSON.stringify(r,null,2)})]})]})})}function dte({runId:e,onBack:t}){var k;const[n,r]=R.useState(!1),{data:a,isLoading:i,isError:l}=R6(e),o=(k=a==null?void 0:a.run)==null?void 0:k.status,{data:f,isLoading:c}=D6(e,o),{data:d,isLoading:v}=j6(n?e:void 0,o),{data:m}=ic(),y=R.useMemo(()=>(m==null?void 0:m.tasks)??[],[m]);if(i)return p.jsxs("div",{className:"flex h-64 items-center justify-center gap-2 text-on-surface-variant",children:[p.jsx(Xn,{className:"h-5 w-5 animate-spin"}),p.jsx("span",{className:"font-sans",children:"Loading run..."})]});if(l||!(a!=null&&a.run))return p.jsxs("div",{className:"space-y-4",children:[p.jsxs(et,{variant:"ghost",size:"sm",onClick:t,className:"gap-2 text-on-surface-variant",children:[p.jsx(Ws,{className:"h-4 w-4"}),"Runs"]}),p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary",children:[p.jsx(Qi,{className:"h-5 w-5"}),p.jsx("span",{className:"font-sans text-sm",children:"Run not found"})]})]});const x=a.run,S=(f==null?void 0:f.reports)??[],w=d??[];let b=null,C,T;if(x.actions_taken)try{const D=JSON.parse(x.actions_taken);D!=null&&D.phases&&Array.isArray(D.phases)&&(b=D.phases),typeof(D==null?void 0:D.model)=="string"&&(C=D.model),typeof(D==null?void 0:D.provider)=="string"&&(T=D.provider)}catch{}return p.jsxs("div",{className:"space-y-6",children:[p.jsxs(et,{variant:"ghost",size:"sm",onClick:t,className:"gap-2 text-on-surface-variant",children:[p.jsx(Ws,{className:"h-4 w-4"}),"Runs"]}),p.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4",children:[p.jsx(En,{label:"Status",value:N1(x.status),accent:"sage"}),p.jsx(En,{label:"Task",value:Tj(x.task,y),accent:"outline"}),p.jsx(En,{label:"Started",value:xj(x.started_at),accent:"outline"}),p.jsx(En,{label:"Duration",value:Ap(x.started_at,x.completed_at),accent:"outline"}),p.jsx(En,{label:"Tokens",value:j1(x.tokens_used),accent:"ochre"}),p.jsx(En,{label:"Cost",value:D1(x.cost_usd),accent:"ochre"})]}),(C||T)&&p.jsxs("div",{className:"flex items-center gap-4 px-1",children:[T&&p.jsxs("span",{className:"font-sans text-xs text-on-surface-variant",children:["Provider: ",p.jsx("span",{className:"font-mono text-on-surface",children:T})]}),C&&p.jsxs("span",{className:"font-sans text-xs text-on-surface-variant",children:["Model: ",p.jsx("span",{className:"font-mono text-on-surface",children:C})]})]}),x.error&&p.jsx("div",{className:"rounded-md bg-tertiary/10 px-3 py-2",children:p.jsx("p",{className:"font-mono text-xs text-tertiary",children:x.error})}),b&&b.length>0&&p.jsx(dt,{level:"low",className:"p-4",children:p.jsx(ite,{phases:b})}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("h2",{className:"font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide",children:["Decisions",S.length>0&&p.jsxs("span",{className:"ml-2 text-on-surface normal-case font-normal",children:[S.length," ",S.length===1?"action":"actions"]})]}),c?p.jsxs("div",{className:"flex items-center gap-2 text-on-surface-variant py-4",children:[p.jsx(Xn,{className:"h-4 w-4 animate-spin"}),p.jsx("span",{className:"font-sans text-sm",children:"Loading decisions..."})]}):S.length===0?p.jsx(dt,{level:"low",className:"flex h-24 items-center justify-center",children:p.jsx("span",{className:"font-sans text-sm text-on-surface-variant",children:"No decisions recorded for this run"})}):p.jsx("div",{className:"space-y-2",children:S.map(D=>p.jsx(cte,{report:D},D.id))})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("button",{className:"flex items-center gap-2 font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide hover:text-on-surface transition-colors",onClick:()=>r(!n),children:[n?p.jsx(Ma,{className:"h-4 w-4"}):p.jsx(wa,{className:"h-4 w-4"}),"Audit Trail",p.jsx("span",{className:"normal-case font-normal text-xs",children:"(diagnostics)"})]}),n&&p.jsxs(dt,{level:"low",className:Ae("overflow-hidden"),children:[p.jsx("div",{className:"p-4 pb-2",children:p.jsx("h3",{className:"font-sans text-sm font-medium text-on-surface",children:"Turn-by-turn trace"})}),p.jsx("div",{className:"p-0",children:v?p.jsxs("div",{className:"flex items-center gap-2 text-on-surface-variant p-4",children:[p.jsx(Xn,{className:"h-4 w-4 animate-spin"}),p.jsx("span",{className:"font-sans text-sm",children:"Loading turns..."})]}):w.length===0?p.jsx("p",{className:"font-sans text-sm text-on-surface-variant p-4",children:"No turns recorded."}):p.jsx("div",{children:w.map(D=>p.jsx(fte,{turn:D},D.id))})})]})]})]})}function hte(e){return e.displayName??e.name}function vte({open:e,onOpenChange:t,onTriggered:n}){var w;const[r,a]=R.useState(void 0),[i,l]=R.useState(""),{data:o,isLoading:f}=ic(),{mutate:c,isPending:d,error:v}=R1(),m=(o==null?void 0:o.tasks)??[],y=m.find(b=>b.isDefault),x=r??(y==null?void 0:y.name)??((w=m[0])==null?void 0:w.name)??"";function S(){const b={task:x||void 0,instruction:i.trim()||void 0};c(b,{onSuccess:()=>{t(!1),a(void 0),l(""),n==null||n()}})}return p.jsx(Tp,{open:e,onOpenChange:t,children:p.jsxs(hd,{className:"sm:max-w-md",children:[p.jsxs(Np,{children:[p.jsx(vd,{children:"Trigger Agent Run"}),p.jsx(E1,{children:"Run the Myco agent now. It will process unprocessed sessions and update the vault."})]}),p.jsxs("div",{className:"space-y-4 py-2",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsx("label",{className:"font-sans text-sm font-medium text-on-surface",children:"Task"}),f?p.jsxs("div",{className:"flex h-9 items-center gap-2 text-on-surface-variant font-sans text-sm",children:[p.jsx(Xn,{className:"h-4 w-4 animate-spin"}),"Loading tasks..."]}):p.jsxs(io,{value:x,onValueChange:a,children:[p.jsx(Js,{children:p.jsx(so,{})}),p.jsx(el,{children:m.map(b=>p.jsxs(tl,{value:b.name,children:[hte(b),b.isDefault&&p.jsx("span",{className:"ml-1 font-sans text-xs text-on-surface-variant",children:"(default)"})]},b.name))})]})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs("label",{className:"font-sans text-sm font-medium text-on-surface",children:["Instruction",p.jsx("span",{className:"ml-1 font-sans text-xs text-on-surface-variant font-normal",children:"(optional)"})]}),p.jsx("textarea",{className:"w-full rounded-md bg-surface-container-lowest px-3 py-2 font-sans text-sm text-on-surface placeholder:text-on-surface-variant/50 focus:outline-none focus:ring-2 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 resize-none",rows:3,placeholder:"E.g. Focus on gotchas from yesterday's sessions...",value:i,onChange:b=>l(b.target.value),disabled:d})]}),v&&p.jsx("p",{className:"font-sans text-xs text-tertiary",children:v instanceof Error?v.message:"Failed to trigger run"})]}),p.jsxs(kp,{children:[p.jsx(et,{variant:"ghost",size:"sm",onClick:()=>t(!1),disabled:d,children:"Cancel"}),p.jsx(et,{size:"sm",className:"gap-2",onClick:S,disabled:d,children:d?p.jsxs(p.Fragment,{children:[p.jsx(Xn,{className:"h-3.5 w-3.5 animate-spin"}),"Starting..."]}):p.jsxs(p.Fragment,{children:[p.jsx(Yu,{className:"h-3.5 w-3.5"}),"Run Now"]})})]})]})})}function pte(e){return!e.phases||e.phases.length===0?"Single query":`${e.phases.length} phases`}function mte(e){return e===d1?"User":"Built-in"}function gte({task:e,onClick:t}){return p.jsxs(dt,{level:"low",interactive:!0,className:Ae("p-4 space-y-2 transition-all",e.isDefault&&"ring-1 ring-primary/20 shadow-[inset_0_0_12px_rgba(171,207,184,0.08)]"),onClick:t,children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"font-sans text-sm font-medium text-on-surface truncate",children:e.displayName}),e.isDefault&&p.jsx(JP,{className:"h-3.5 w-3.5 text-primary shrink-0 fill-primary/30"})]}),e.description&&p.jsx("p",{className:"font-sans text-xs text-on-surface-variant mt-1 line-clamp-2",children:e.description})]}),p.jsx("div",{className:"flex items-center gap-2 shrink-0",children:p.jsx(sr,{variant:Ej(e.source),children:mte(e.source)})})]}),p.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[p.jsxs("div",{className:"flex items-center gap-1.5 text-on-surface-variant",children:[p.jsx(FP,{className:"h-3 w-3"}),p.jsx("span",{className:"font-mono text-xs",children:pte(e)})]}),e.model&&p.jsx("span",{className:"font-mono text-xs text-on-surface-variant/70 truncate max-w-[160px]",children:e.model}),e.maxTurns!==void 0&&p.jsxs("span",{className:"font-mono text-xs text-on-surface-variant/70",children:["max ",e.maxTurns," turns"]})]})]})}function yte({onSelect:e}){const{data:t,isLoading:n}=ic(),r=(t==null?void 0:t.tasks)??[];return n?p.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:Array.from({length:3}).map((a,i)=>p.jsx("div",{className:"h-28 rounded-md animate-pulse bg-surface-container-low"},i))}):r.length===0?p.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:"No tasks found."}):p.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:r.map(a=>p.jsx(gte,{task:a,onClick:()=>e(a.name)},a.name))})}const xte=new Set(["instruction"]),bte={session_id:"Session ID"},wte={session_id:"e.g. 36858a44-4ef7-4448-96e8-382e992e8ba4"};function Ste(e){const t=e.matchAll(/\{\{(\w+)\}\}/g),n=new Set;for(const r of t){const a=r[1];xte.has(a)||n.add(a)}return[...n]}function lR(e){return bte[e]??e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function Ete({task:e,onRunTriggered:t,onDeleted:n,onCustomized:r}){const a=R1(),i=O6(),l=L6(),[o,f]=R.useState(!1),[c,d]=R.useState({}),[v,m]=R.useState(""),y=R.useMemo(()=>Ste(e.prompt??""),[e.prompt]),x=y.length>0;function S(){var k;const b=[];for(const D of y){const A=(k=c[D])==null?void 0:k.trim();A&&b.push(`${D}: ${A}`)}const C=v.trim();C&&b.push(C);const T=b.length>0?b.join(`
741
+ `):void 0;a.mutate({task:e.name,instruction:T},{onSuccess:D=>{f(!1),d({}),m(""),t==null||t(D.runId)}})}function w(b,C){d(T=>({...T,[b]:C}))}return p.jsxs("div",{className:"flex gap-2",children:[p.jsx(et,{size:"sm",onClick:()=>{f(!0)},children:"Run Now"}),e.source===fz&&p.jsx(et,{variant:"outline",size:"sm",onClick:()=>i.mutate({taskId:e.name},{onSuccess:b=>{var T;const C=(T=b==null?void 0:b.task)==null?void 0:T.name;C&&r&&r(C)}}),children:"Customize"}),e.source===d1&&p.jsx(et,{variant:"destructive",size:"sm",onClick:()=>{l.mutate(e.name,{onSuccess:()=>n==null?void 0:n()})},children:"Delete"}),p.jsx(Tp,{open:o,onOpenChange:f,children:p.jsxs(hd,{className:"sm:max-w-md",children:[p.jsx(Np,{children:p.jsxs(vd,{children:["Run ",e.displayName]})}),p.jsxs("div",{className:"space-y-4 py-2",children:[y.map(b=>p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"font-sans text-sm font-medium text-on-surface",children:lR(b)}),p.jsx(Sn,{value:c[b]??"",onChange:C=>w(b,C.target.value),placeholder:wte[b]??`Enter ${lR(b).toLowerCase()}`,className:"font-mono",autoFocus:y.indexOf(b)===0})]},b)),p.jsxs("div",{className:"space-y-1",children:[p.jsxs("label",{className:"font-sans text-sm font-medium text-on-surface",children:["Instruction",p.jsx("span",{className:"ml-1 font-sans text-xs text-on-surface-variant font-normal",children:"(optional)"})]}),p.jsx("textarea",{className:"w-full rounded-md bg-surface-container-lowest border border-[var(--ghost-border)] px-3 py-2 font-sans text-sm text-on-surface placeholder:text-on-surface-variant/50 focus:outline-none focus:border-primary/40 resize-none",rows:2,placeholder:"Additional instructions for this run...",value:v,onChange:b=>m(b.target.value),disabled:a.isPending})]})]}),p.jsxs(kp,{children:[p.jsx(et,{variant:"ghost",size:"sm",onClick:()=>f(!1),children:"Cancel"}),p.jsxs(et,{size:"sm",disabled:a.isPending,onClick:S,className:"gap-2",children:[a.isPending?p.jsx(Xn,{className:"h-3.5 w-3.5 animate-spin"}):p.jsx(Yu,{className:"h-3.5 w-3.5"}),"Run"]})]})]})})]})}const Cte=20;function Tte({taskId:e,onSaved:t}){const{data:n,isLoading:r,isError:a}=_6(e),i=B6(),[l,o]=R.useState(""),[f,c]=R.useState(!1);R.useEffect(()=>{n!=null&&n.yaml&&(o(n.yaml),c(!1))},[n==null?void 0:n.yaml]);function d(x){o(x),c(!0)}function v(){i.mutate({taskId:e,yaml:l},{onSuccess:()=>{c(!1),t==null||t()}})}function m(){n!=null&&n.yaml&&(o(n.yaml),c(!1))}if(r)return p.jsx("div",{className:"h-64 animate-pulse rounded-md bg-surface-container-low"});if(a)return p.jsx("div",{className:"rounded-md bg-tertiary-container/20 p-4 font-sans text-sm text-tertiary",children:"Failed to load task YAML."});const y=(n==null?void 0:n.source)!=="user";return p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("h2",{className:"font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide",children:["Task Definition ",y&&"(read-only)"]}),!y&&p.jsxs("div",{className:"flex gap-2",children:[p.jsx(et,{variant:"ghost",size:"sm",onClick:m,disabled:!f,children:"Reset"}),p.jsx(et,{size:"sm",onClick:v,disabled:!f||i.isPending,children:i.isPending?"Saving...":"Save"})]})]}),p.jsx("textarea",{value:l,onChange:x=>d(x.target.value),readOnly:y,rows:Cte,spellCheck:!1,className:`w-full rounded-md bg-surface-container-lowest p-4 font-mono text-sm text-on-surface leading-relaxed resize-y focus:outline-none focus:ring-2 focus:ring-primary/40 ${y?"opacity-75 cursor-not-allowed":""}`}),i.isError&&p.jsx("div",{className:"rounded-md bg-tertiary-container/20 p-3 font-sans text-sm text-tertiary",children:i.error.message}),i.isSuccess&&!f&&p.jsx("div",{className:"rounded-md bg-primary-container/20 p-3 font-sans text-sm text-primary",children:"Task saved successfully."})]})}const N_=3e4;function Nte(e){return mn({queryKey:["task-config",e],queryFn:({signal:t})=>Et(`/agent/tasks/${e}/config`,{signal:t}),enabled:e!==void 0,staleTime:N_})}function kte(){return mn({queryKey:["providers"],queryFn:({signal:e})=>Et("/providers",{signal:e}),staleTime:N_})}function Ate(){return hl({mutationFn:e=>qi("/providers/test",e)})}function Rte(){const e=oi();return hl({mutationFn:({taskId:t,config:n})=>f1(`/agent/tasks/${t}/config`,n),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["task-config",n.taskId]})}})}const Dte={cloud:"Anthropic Cloud",ollama:"Ollama",lmstudio:"LM Studio"},jte={cloud:BP,ollama:XP,lmstudio:u1};function k_({providerType:e,model:t,baseUrl:n,contextLength:r,modelPlaceholder:a,providers:i,isLoadingProviders:l,onProviderChange:o,onModelChange:f,onBaseUrlChange:c,onContextLengthChange:d}){const v=i.find(x=>x.type===e),m=e==="ollama"||e==="lmstudio",y=(v==null?void 0:v.models)??[];return p.jsxs("div",{className:"space-y-3",children:[p.jsx("div",{className:"grid grid-cols-3 gap-2",children:["cloud","ollama","lmstudio"].map(x=>{const S=jte[x],w=i.find(C=>C.type===x),b=e===x;return p.jsxs("button",{onClick:()=>o(x),className:`
742
+ flex flex-col items-center gap-1.5 rounded-md border px-3 py-2.5 transition-colors
743
+ ${b?"border-primary/40 bg-primary/5 text-on-surface":"border-[var(--ghost-border)] bg-surface-container-lowest text-on-surface-variant hover:border-primary/20"}
744
+ `,children:[p.jsx(S,{className:"h-4 w-4"}),p.jsx("span",{className:"font-sans text-xs font-medium",children:Dte[x]}),!l&&p.jsx(sr,{variant:w!=null&&w.available?"secondary":"destructive",className:"text-[10px] px-1.5 py-0",children:w!=null&&w.available?"online":"offline"})]},x)})}),m&&p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Base URL"}),p.jsx(Sn,{value:n,onChange:x=>c(x.target.value),placeholder:(v==null?void 0:v.baseUrl)??""})]}),m&&p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Context Length"}),p.jsx(Sn,{type:"number",value:r,onChange:x=>d(x.target.value),placeholder:"32768"})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Model"}),y.length>0?p.jsxs(io,{value:t,onValueChange:f,children:[p.jsx(Js,{children:p.jsx(so,{placeholder:a??"Select a model"})}),p.jsx(el,{children:y.map(x=>p.jsx(tl,{value:x,children:p.jsx("span",{className:"font-mono text-sm",children:x})},x))})]}):p.jsx(Sn,{value:t,onChange:x=>f(x.target.value),placeholder:(v==null?void 0:v.available)===!1?"Provider offline":"Enter model name",disabled:(v==null?void 0:v.available)===!1})]})]})}function Mte({phase:e,override:t,taskModel:n,providers:r,isLoadingProviders:a,onChange:i}){var c,d,v,m;const[l,o]=R.useState(!1),f=t.provider!==void 0||t.model!==void 0||t.maxTurns!==void 0;return p.jsxs("div",{className:"border border-[var(--ghost-border)] rounded-md",children:[p.jsxs("button",{onClick:()=>o(!l),className:"flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-surface-container-low/50 transition-colors rounded-md",children:[l?p.jsx(Ma,{className:"h-3.5 w-3.5 text-on-surface-variant"}):p.jsx(wa,{className:"h-3.5 w-3.5 text-on-surface-variant"}),p.jsx("span",{className:"font-sans text-sm text-on-surface",children:e.name}),p.jsxs("span",{className:"font-mono text-xs text-on-surface-variant",children:["max ",t.maxTurns??e.maxTurns," turns"]}),f&&p.jsx(sr,{variant:"secondary",className:"text-[10px] ml-auto",children:"override"})]}),l&&p.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-[var(--ghost-border)]",children:[p.jsx("div",{className:"pt-3",children:p.jsx(k_,{providerType:((c=t.provider)==null?void 0:c.type)??"cloud",model:((d=t.provider)==null?void 0:d.model)??t.model??"",baseUrl:((v=t.provider)==null?void 0:v.base_url)??"",contextLength:((m=t.provider)==null?void 0:m.context_length)!=null?String(t.provider.context_length):"",modelPlaceholder:e.model??n,providers:r,isLoadingProviders:a,onProviderChange:y=>{var S;const x=(S=r.find(w=>w.type===y))==null?void 0:S.baseUrl;i({...t,provider:{type:y,base_url:x},model:void 0})},onModelChange:y=>i({...t,provider:t.provider?{...t.provider,model:y}:void 0,model:t.provider?void 0:y}),onBaseUrlChange:y=>i({...t,provider:t.provider?{...t.provider,base_url:y}:void 0}),onContextLengthChange:y=>i({...t,provider:t.provider?{...t.provider,context_length:y?Number(y):void 0}:void 0})})}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Max Turns"}),p.jsx(Sn,{type:"number",value:t.maxTurns??"",onChange:y=>i({...t,maxTurns:y.target.value?Number(y.target.value):void 0}),placeholder:String(e.maxTurns)})]}),f&&p.jsx(et,{variant:"ghost",size:"sm",onClick:()=>i(null),className:"text-xs text-on-surface-variant",children:"Clear Phase Override"})]})]})}function Ote({taskId:e,phases:t,defaults:n}){const{data:r,isPending:a}=kte(),{data:i}=Nte(e),l=Ate(),o=Rte(),f=i==null?void 0:i.config,[c,d]=R.useState("cloud"),[v,m]=R.useState(""),[y,x]=R.useState(""),[S,w]=R.useState(""),[b,C]=R.useState(""),[T,k]=R.useState(""),[D,A]=R.useState({}),[j,L]=R.useState(!1);R.useEffect(()=>{var F,B,H,K;f&&(d(((F=f.provider)==null?void 0:F.type)??"cloud"),m(((B=f.provider)==null?void 0:B.model)??f.model??""),x(((H=f.provider)==null?void 0:H.base_url)??""),w(((K=f.provider)==null?void 0:K.context_length)!=null?String(f.provider.context_length):""),C(f.maxTurns!=null?String(f.maxTurns):""),k(f.timeoutSeconds!=null?String(f.timeoutSeconds):""),A(f.phases??{}),L(!1))},[f]);const _=(r==null?void 0:r.providers)??[];function M(F){var B;d(F),m(""),x(((B=_.find(H=>H.type===F))==null?void 0:B.baseUrl)??""),w(""),L(!0),l.reset()}function z(F,B){A(H=>{const K={...H};return B===null?delete K[F]:K[F]=B,K}),L(!0)}function P(){const F=c==="ollama"||c==="lmstudio",B={type:c,...v?{model:v}:{},...F&&y?{base_url:y}:{},...F&&S?{context_length:Number(S)}:{}};o.mutate({taskId:e,config:{provider:B,...b?{maxTurns:Number(b)}:{maxTurns:null},...T?{timeoutSeconds:Number(T)}:{timeoutSeconds:null},...Object.keys(D).length>0?{phases:D}:{phases:null}}},{onSuccess:()=>L(!1)})}function G(){o.mutate({taskId:e,config:{provider:null,model:null,maxTurns:null,timeoutSeconds:null,phases:null}},{onSuccess:()=>{d("cloud"),m(""),x(""),w(""),C(""),k(""),A({}),L(!1)}})}function I(){const B={type:c,...(c==="ollama"||c==="lmstudio")&&y?{base_url:y}:{}};l.mutate(B)}return p.jsxs(dt,{level:"low",className:"p-4 space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h2",{className:"font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide",children:"Task Config"}),f&&p.jsx(et,{variant:"ghost",size:"sm",onClick:G,className:"text-xs text-on-surface-variant",children:"Clear All Overrides"})]}),p.jsx(k_,{providerType:c,model:v,baseUrl:y,contextLength:S,modelPlaceholder:n==null?void 0:n.model,providers:_,isLoadingProviders:a,onProviderChange:M,onModelChange:F=>{m(F),L(!0)},onBaseUrlChange:F=>{x(F),L(!0)},onContextLengthChange:F=>{w(F),L(!0)}}),p.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Max Turns"}),p.jsx(Sn,{type:"number",value:b,onChange:F=>{C(F.target.value),L(!0)},placeholder:(n==null?void 0:n.maxTurns)!=null?String(n.maxTurns):"—"})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"font-sans text-xs text-on-surface-variant",children:"Timeout (seconds)"}),p.jsx(Sn,{type:"number",value:T,onChange:F=>{k(F.target.value),L(!0)},placeholder:(n==null?void 0:n.timeoutSeconds)!=null?String(n.timeoutSeconds):"—"})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(et,{variant:"ghost",size:"sm",onClick:I,disabled:l.isPending,className:"gap-1.5 text-on-surface-variant",children:[l.isPending?p.jsx(Xn,{className:"h-3.5 w-3.5 animate-spin"}):p.jsx(rz,{className:"h-3.5 w-3.5"}),"Test"]}),l.isSuccess&&p.jsx("span",{className:"flex items-center gap-1 text-xs",children:l.data.ok?p.jsxs(p.Fragment,{children:[p.jsx(pD,{className:"h-3.5 w-3.5 text-green-500"}),p.jsxs("span",{className:"text-green-500 font-mono",children:[l.data.latency_ms,"ms"]})]}):p.jsxs(p.Fragment,{children:[p.jsx(gp,{className:"h-3.5 w-3.5 text-red-400"}),p.jsx("span",{className:"text-red-400",children:l.data.error})]})}),p.jsx("div",{className:"flex-1"}),p.jsxs(et,{size:"sm",onClick:P,disabled:!j||o.isPending,className:"gap-1.5",children:[o.isPending&&p.jsx(Xn,{className:"h-3.5 w-3.5 animate-spin"}),"Save"]})]}),t&&t.length>0&&p.jsxs("div",{className:"space-y-2 pt-2 border-t border-[var(--ghost-border)]",children:[p.jsx("h3",{className:"font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide",children:"Per-Phase Overrides"}),t.map(F=>p.jsx(Mte,{phase:F,override:D[F.name]??{},taskModel:v||"claude-sonnet-4-6",providers:_,isLoadingProviders:a,onChange:B=>z(F.name,B)},F.name))]})]})}const Lte=3;function _te(e){var t,n,r;return{model:((t=e.execution)==null?void 0:t.model)??e.model,maxTurns:((n=e.execution)==null?void 0:n.maxTurns)??e.maxTurns,timeoutSeconds:((r=e.execution)==null?void 0:r.timeoutSeconds)??e.timeoutSeconds}}function Bte(){return p.jsxs("div",{className:"space-y-6",children:[p.jsx("div",{className:"h-8 w-24 animate-pulse rounded bg-surface-container-high"}),p.jsxs("div",{className:"rounded-md bg-surface-container-low p-4 space-y-3",children:[p.jsx("div",{className:"h-6 w-48 animate-pulse rounded bg-surface-container-high"}),p.jsx("div",{className:"h-4 w-64 animate-pulse rounded bg-surface-container-high"}),p.jsx("div",{className:"h-8 w-32 animate-pulse rounded bg-surface-container-high"})]}),p.jsx("div",{className:"rounded-md bg-surface-container-low p-4 space-y-2",children:Array.from({length:Lte}).map((e,t)=>p.jsx("div",{className:"h-5 animate-pulse rounded bg-surface-container-high"},t))})]})}function Pte({phase:e,index:t}){return p.jsxs(dt,{level:"low",className:"p-4 space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-surface-container-high font-mono text-xs font-semibold text-on-surface-variant shrink-0",children:t+1}),p.jsx("span",{className:"font-sans text-sm font-medium text-on-surface",children:e.name}),!e.required&&p.jsx(sr,{variant:"secondary",children:"optional"})]}),p.jsxs("span",{className:"font-mono text-xs text-on-surface-variant shrink-0",children:["max ",e.maxTurns," turns"]})]}),e.tools.length>0&&p.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(n=>p.jsx("span",{className:"font-mono text-xs px-1.5 py-0.5 rounded-sm bg-surface-container-high text-on-surface-variant",children:n},n))}),p.jsx(dt,{level:"lowest",className:"p-3 overflow-auto max-h-40",children:p.jsx(si,{content:e.prompt})})]})}function zte({taskId:e,onBack:t,onNavigate:n,onRunTriggered:r}){const{data:a,isPending:i,isError:l}=M6(e);if(i)return p.jsx(Bte,{});if(l||!(a!=null&&a.task))return p.jsxs("div",{className:"space-y-4",children:[p.jsxs(et,{variant:"ghost",size:"sm",onClick:t,className:"gap-2 text-on-surface-variant",children:[p.jsx(Ws,{className:"h-4 w-4"}),"Tasks"]}),p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary",children:[p.jsx(Qi,{className:"h-5 w-5"}),p.jsx("span",{className:"font-sans text-sm",children:"Task not found"})]})]});const o=a.task,f=o.phases??[],c=_te(o);return p.jsxs("div",{className:"space-y-6",children:[p.jsxs(et,{variant:"ghost",size:"sm",onClick:t,className:"gap-2 text-on-surface-variant",children:[p.jsx(Ws,{className:"h-4 w-4"}),"Tasks"]}),p.jsxs(dt,{level:"low",className:"p-4 space-y-4",children:[p.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[p.jsxs("div",{className:"flex-1 space-y-1 min-w-0",children:[p.jsx("h1",{className:"font-serif text-lg text-on-surface",children:o.displayName}),o.description&&p.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:o.description})]}),p.jsx(sr,{variant:Ej(o.source),className:"shrink-0",children:N1(o.source??"built-in")})]}),p.jsx(Ete,{task:o,onDeleted:t,onCustomized:d=>n==null?void 0:n(d),onRunTriggered:r})]}),p.jsx(Ote,{taskId:e,phases:f,defaults:{model:c.model,maxTurns:c.maxTurns,timeoutSeconds:c.timeoutSeconds}}),(c.model!==void 0||c.maxTurns!==void 0||c.timeoutSeconds!==void 0)&&p.jsxs(dt,{level:"low",className:"p-4 space-y-3",children:[p.jsx("h2",{className:"font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide",children:"Execution Config"}),p.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[c.model!==void 0&&p.jsxs("div",{children:[p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Model"}),p.jsx("p",{className:"font-mono text-sm text-on-surface mt-0.5",children:c.model})]}),c.maxTurns!==void 0&&p.jsxs("div",{children:[p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Max Turns"}),p.jsx("p",{className:"font-mono text-sm text-on-surface mt-0.5",children:c.maxTurns})]}),c.timeoutSeconds!==void 0&&p.jsxs("div",{children:[p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Timeout"}),p.jsxs("p",{className:"font-mono text-sm text-on-surface mt-0.5",children:[c.timeoutSeconds,"s"]})]})]})]}),f.length>0?p.jsxs("div",{className:"space-y-3",children:[p.jsxs("h2",{className:"font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide",children:["Phases",p.jsxs("span",{className:"ml-2 text-on-surface normal-case font-normal",children:[f.length," ",f.length===1?"phase":"phases"]})]}),f.map((d,v)=>p.jsx(Pte,{phase:d,index:v},d.name))]}):p.jsxs("div",{className:"space-y-3",children:[p.jsx("h2",{className:"font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide",children:"Prompt"}),p.jsx(dt,{level:"lowest",className:"p-4 overflow-auto max-h-96",children:p.jsx(si,{content:o.prompt??""})})]}),p.jsx(Tte,{taskId:e})]})}function A_(){const e=oi(),t=mn({queryKey:["config"],queryFn:({signal:r})=>Et("/config",{signal:r})}),n=hl({mutationFn:r=>f1("/config",r),onSuccess:()=>e.invalidateQueries({queryKey:["config"]})});return{config:t.data,isLoading:t.isLoading,error:t.error,saveConfig:n.mutateAsync,isSaving:n.isPending,saveError:n.error}}function R_({checked:e,onCheckedChange:t}){return p.jsx("button",{type:"button",role:"switch","aria-checked":e,onClick:()=>t(!e),className:`relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 ${e?"bg-primary":"bg-surface-container-high"}`,children:p.jsx("span",{className:`pointer-events-none block h-5 w-5 rounded-full bg-on-surface shadow-lg ring-0 transition-transform ${e?"translate-x-5":"translate-x-0"}`})})}const _0=30;function D_(e,t){var n,r,a;return{autoRun:((n=e.agent)==null?void 0:n.auto_run)??!0,intervalSeconds:String(((r=e.agent)==null?void 0:r.interval_seconds)??eb),summaryBatchInterval:String(((a=e.agent)==null?void 0:a.summary_batch_interval)??tb),defaultTask:t??""}}function Ite(e,t,n){const r=D_(t,n);return e.autoRun!==r.autoRun||e.intervalSeconds!==r.intervalSeconds||e.summaryBatchInterval!==r.summaryBatchInterval||e.defaultTask!==r.defaultTask}function Fte(e){const t=Number(e);if(isNaN(t)||t<=0)return"";const n=t/60;return n<1?`${t}s`:Number.isInteger(n)?`${n} min`:`${n.toFixed(1)} min`}function oR({label:e,value:t,max:n,color:r}){const a=n>0?Math.round(t/n*100):0,i=2*Math.PI*36,l=i-a/100*i;return p.jsxs("div",{className:"flex flex-col items-center gap-2",children:[p.jsxs("div",{className:"relative h-20 w-20",children:[p.jsxs("svg",{className:"h-20 w-20 -rotate-90",viewBox:"0 0 80 80",children:[p.jsx("circle",{cx:"40",cy:"40",r:"36",fill:"none",stroke:"currentColor",className:"text-surface-container/30",strokeWidth:"6"}),p.jsx("circle",{cx:"40",cy:"40",r:"36",fill:"none",stroke:r,strokeWidth:"6",strokeLinecap:"round",strokeDasharray:i,strokeDashoffset:l,className:"transition-all duration-700"})]}),p.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:p.jsxs("span",{className:"text-sm font-semibold font-mono text-on-surface",children:[a,"%"]})})]}),p.jsx("span",{className:"text-xs text-on-surface-variant text-center font-sans",children:e})]})}function Oi({label:e,value:t}){return p.jsxs("div",{className:"flex items-center justify-between py-1",children:[p.jsx("span",{className:"text-xs text-on-surface-variant font-sans",children:e}),p.jsx("span",{className:"text-xs font-mono text-on-surface",children:t})]})}function qte({stats:e}){const t=e.embedding.total_embeddable>0?e.embedding.embedded_count:0,n=e.embedding.total_embeddable;return p.jsxs("div",{className:"space-y-4",children:[p.jsxs("h2",{className:"text-xs font-semibold text-on-surface-variant uppercase tracking-widest flex items-center gap-2 font-sans",children:[p.jsx(Z0,{className:"h-3.5 w-3.5"}),"System Health"]}),p.jsxs("div",{className:"flex justify-center gap-8 py-2",children:[p.jsx(oR,{label:"Embedding Coverage",value:t,max:n,color:"#abcfb8"}),p.jsx(oR,{label:"Queue Health",value:Math.max(0,n-e.embedding.queue_depth),max:n,color:"#edbf7f"})]}),p.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-0",children:[p.jsx(Oi,{label:"Sessions",value:String(e.vault.session_count)}),p.jsx(Oi,{label:"Spores",value:String(e.vault.spore_count)}),p.jsx(Oi,{label:"Entities",value:String(e.vault.entity_count)}),p.jsx(Oi,{label:"Graph edges",value:String(e.vault.edge_count)}),p.jsx(Oi,{label:"Uptime",value:C1(e.daemon.uptime_seconds)}),p.jsx(Oi,{label:"Daemon",value:`v${e.daemon.version} :${e.daemon.port}`}),e.agent.last_run_at!==null&&p.jsxs(p.Fragment,{children:[p.jsx(Oi,{label:"Last run",value:ii(e.agent.last_run_at)}),p.jsx(Oi,{label:"Total runs",value:String(e.agent.total_runs)})]}),e.digest.freshest_tier!==null&&p.jsx(Oi,{label:"Digest tier",value:`T${e.digest.freshest_tier}`})]})]})}function Ute(){var L;const{config:e,isLoading:t,saveConfig:n,isSaving:r}=A_(),{data:a,isLoading:i}=xp(),{data:l,isLoading:o}=ic(),{restart:f}=v1(),[c,d]=R.useState(null),[v,m]=R.useState(null),[y,x]=R.useState("idle"),[S,w]=R.useState(""),b=(l==null?void 0:l.tasks)??[],C=((L=b.find(_=>_.isDefault))==null?void 0:L.name)??"",T=R.useRef(!1);e&&!o&&!T.current&&(T.current=!0,c===null&&d(D_(e,C)));const k=c&&e?Ite(c,e,C):!1,D=R.useCallback((_,M)=>{d(z=>z&&{...z,[_]:M}),m(null)},[]),A=async()=>{if(!(!c||!e)){m(null);try{const _={...e,agent:{...e.agent,auto_run:c.autoRun,interval_seconds:Math.max(_0,Hv(c.intervalSeconds,eb)),summary_batch_interval:Hv(c.summaryBatchInterval,tb)}};await n(_),m({type:"success",text:"Agent settings saved. Restarting daemon..."});try{await f()}catch{m({type:"success",text:"Settings saved. Daemon restart may require manual action."})}}catch{m({type:"error",text:"Failed to save settings."})}}},j=async()=>{if(e){x("testing"),w("");try{const _=new URLSearchParams({provider:e.embedding.provider,type:"embedding"});e.embedding.base_url&&_.set("base_url",e.embedding.base_url);const z=(await Et(`/models?${_.toString()}`)).models.length;x("success"),w(`Connected -- ${z} model${z!==1?"s":""} available.`)}catch(_){x("error"),w(_ instanceof Error?_.message:"Connection failed.")}}};return t||!e||!c?p.jsx("div",{className:"space-y-4",children:[1,2,3].map(_=>p.jsx("div",{className:"h-32 rounded-md animate-pulse bg-surface-container-low"},_))}):p.jsxs("div",{className:"space-y-6",children:[p.jsxs(dt,{level:"low",className:"p-6 space-y-5 border-t-2 border-t-sage",children:[p.jsx(Pn,{children:p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(QP,{className:"h-4 w-4 text-primary"}),"Agent Operations"]})}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"space-y-0.5",children:[p.jsx("label",{className:"font-sans text-sm font-medium text-on-surface",children:"Auto Run"}),p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Automatically process unprocessed batches on a timer."})]}),p.jsx(R_,{checked:c.autoRun,onCheckedChange:_=>D("autoRun",_)})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"font-sans text-sm font-medium text-on-surface",children:"Run Interval"}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(Sn,{type:"number",min:_0,placeholder:String(eb),value:c.intervalSeconds,onChange:_=>D("intervalSeconds",_.target.value),className:"w-32 font-mono"}),p.jsxs("span",{className:"font-sans text-xs text-on-surface-variant",children:["seconds",c.intervalSeconds&&p.jsxs("span",{className:"ml-1 text-on-surface",children:["(",Fte(c.intervalSeconds),")"]})]})]}),p.jsxs("p",{className:"font-sans text-xs text-on-surface-variant",children:["How often the agent checks for unprocessed work. Minimum ",_0,"s."]})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"font-sans text-sm font-medium text-on-surface",children:"Summary Batch Interval"}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(Sn,{type:"number",min:0,placeholder:String(tb),value:c.summaryBatchInterval,onChange:_=>D("summaryBatchInterval",_.target.value),className:"w-32 font-mono"}),p.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:"batches"})]}),p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Trigger a session summary every N batches. Set to 0 to disable."})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"font-sans text-sm font-medium text-on-surface",children:"Default Task"}),o?p.jsxs("div",{className:"flex h-9 items-center gap-2 text-on-surface-variant font-sans text-sm",children:[p.jsx(Xn,{className:"h-4 w-4 animate-spin"}),"Loading tasks..."]}):p.jsxs(io,{value:c.defaultTask,onValueChange:_=>D("defaultTask",_),children:[p.jsx(Js,{children:p.jsx(so,{placeholder:"Select default task"})}),p.jsx(el,{children:b.map(_=>p.jsx(tl,{value:_.name,children:_.displayName},_.name))})]}),p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"The task used when auto-run triggers or no task is specified."})]}),p.jsxs("div",{className:"flex items-center gap-3 pt-2 border-t border-outline-variant/20",children:[p.jsxs(et,{onClick:A,disabled:!k||r,size:"sm",children:[r?p.jsx(Xn,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):null,"Save Changes"]}),v&&p.jsx("span",{className:v.type==="success"?"font-sans text-xs text-primary":"font-sans text-xs text-tertiary",children:v.text})]})]}),p.jsxs(dt,{level:"low",className:"p-6 space-y-4 border-t-2 border-t-ochre",children:[p.jsx(Pn,{children:p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(u1,{className:"h-4 w-4 text-secondary"}),"Embedding Configuration"]})}),p.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-2",children:[p.jsxs("div",{children:[p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Provider"}),p.jsx("p",{className:"text-sm font-mono text-on-surface mt-0.5",children:e.embedding.provider})]}),p.jsxs("div",{children:[p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Model"}),p.jsx("p",{className:"text-sm font-mono text-on-surface mt-0.5 truncate",title:e.embedding.model,children:e.embedding.model})]}),e.embedding.base_url&&p.jsxs("div",{className:"col-span-2",children:[p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Base URL"}),p.jsx("p",{className:"text-sm font-mono text-on-surface mt-0.5 truncate",title:e.embedding.base_url,children:e.embedding.base_url})]})]}),p.jsxs("div",{className:"flex items-center gap-3 pt-2 border-t border-outline-variant/20",children:[p.jsxs(et,{type:"button",variant:"ghost",size:"sm",onClick:j,disabled:y==="testing",children:[y==="testing"?p.jsx(Xn,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):null,"Test Connection"]}),p.jsxs("a",{href:"/settings",className:"flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors",children:[p.jsx(mD,{className:"h-3 w-3"}),"Edit in Settings"]}),y==="success"&&p.jsxs("span",{className:"flex items-center gap-1 font-sans text-xs text-primary",children:[p.jsx(vD,{className:"h-3.5 w-3.5"}),S]}),y==="error"&&p.jsxs("span",{className:"flex items-center gap-1 font-sans text-xs text-tertiary",children:[p.jsx(gp,{className:"h-3.5 w-3.5"}),S]})]})]}),i?p.jsx(dt,{level:"low",className:"p-6",children:p.jsx("div",{className:"h-32 animate-pulse rounded-md bg-surface-container"})}):a?p.jsx(dt,{level:"low",className:"p-6",children:p.jsx(qte,{stats:a})}):null]})}const j_="tab",M_="run",O_="task",Vte=new Set(["runs","tasks","config"]);function Hte(){const e=new URLSearchParams(window.location.search),t=e.get(j_);return{tab:t&&Vte.has(t)?t:"runs",runId:e.get(M_)??void 0,taskId:e.get(O_)??void 0}}function Gte(e,t,n){const r=new URLSearchParams;e!=="runs"&&r.set(j_,e),t&&r.set(M_,t),n&&r.set(O_,n);const a=r.toString(),i=a?`${window.location.pathname}?${a}`:window.location.pathname;window.history.replaceState(null,"",i)}const $te=[{id:"runs",label:"Runs"},{id:"tasks",label:"Tasks"},{id:"config",label:"Config"}];function Yte(){const e=Hte(),[t,n]=R.useState(e.tab),[r,a]=R.useState(e.runId),[i,l]=R.useState(e.taskId),[o,f]=R.useState(!1);R.useEffect(()=>{Gte(t,r,i)},[t,r,i]);const c=R.useCallback(d=>{const v=d;n(v),v!=="runs"&&a(void 0),v!=="tasks"&&l(void 0)},[]);return p.jsxs("div",{className:"p-6 space-y-4",children:[p.jsx(al,{title:"Agent",subtitle:"Intelligence runs, task configuration, and operational settings",tabs:$te,activeTab:t,onTabChange:c,actions:t==="runs"?p.jsxs(et,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>f(!0),children:[p.jsx(Yu,{className:"h-3.5 w-3.5"}),"Run Now"]}):void 0}),t==="runs"&&(r?p.jsx(dte,{runId:r,onBack:()=>a(void 0)}):p.jsx(rte,{onSelectRun:a,onTriggerRun:()=>f(!0)})),t==="tasks"&&(i?p.jsx(zte,{taskId:i,onBack:()=>l(void 0),onNavigate:l,onRunTriggered:d=>{l(void 0),n("runs"),d&&a(d)}}):p.jsx(yte,{onSelect:l})),t==="config"&&p.jsx(Ute,{}),p.jsx(vte,{open:o,onOpenChange:f,onTriggered:()=>a(void 0)})]})}function Kte(){const[e,t]=R.useState({}),[n,r]=R.useState([]),[a,i]=R.useState([]),[l,o]=R.useState(""),[f,c]=R.useState(!1),[d,v]=R.useState(null),[m,y]=R.useState(!0);R.useEffect(()=>{Et("/config/plan-dirs").then(k=>{t(k.symbiont),r(k.custom),i(k.custom)}).catch(()=>{}).finally(()=>y(!1))},[]);const x=n.length!==a.length||n.some((k,D)=>k!==a[D]),S=R.useCallback(()=>{const k=l.trim();!k||n.includes(k)||(r(D=>[...D,k]),o(""),v(null))},[l,n]),w=R.useCallback(k=>{r(D=>D.filter(A=>A!==k)),v(null)},[]),b=R.useCallback(async()=>{c(!0),v(null);try{const k=await qi("/config/plan-dirs",{plan_dirs:n});i(k.custom),r(k.custom),v({type:"success",text:"Plan directories saved."})}catch{v({type:"error",text:"Failed to save plan directories."})}finally{c(!1)}},[n]),C=R.useCallback(k=>{k.key==="Enter"&&S()},[S]),T=Object.entries(e);return p.jsxs(dt,{level:"low",className:"p-6 space-y-5 border-t-2 border-t-amber-500",children:[p.jsx(Pn,{children:"Plan Capture"}),m?p.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:"Loading..."}):p.jsxs("div",{className:"space-y-5",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{className:"font-sans text-sm font-medium text-on-surface",children:"Agent Directories"}),p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Directories monitored by connected agents. Managed by symbiont manifests."}),T.length===0?p.jsx("p",{className:"font-sans text-xs text-on-surface-variant italic",children:"No agent directories configured."}):p.jsx("div",{className:"space-y-3",children:T.map(([k,D])=>p.jsxs("div",{className:"space-y-1",children:[p.jsx("p",{className:"font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide",children:k}),p.jsx("div",{className:"space-y-1",children:D.map(A=>p.jsx("div",{className:"rounded bg-surface-container px-3 py-1.5 font-mono text-xs text-on-surface-variant",children:A},A))})]},k))})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{className:"font-sans text-sm font-medium text-on-surface",children:"Custom Directories"}),p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"Additional directories to watch for plan files."}),n.length>0&&p.jsx("div",{className:"space-y-1",children:n.map(k=>p.jsxs("div",{className:"flex items-center gap-2 rounded bg-surface-container px-3 py-1.5",children:[p.jsx("span",{className:"flex-1 font-mono text-xs text-on-surface",children:k}),p.jsx("button",{type:"button",onClick:()=>w(k),className:"font-sans text-xs text-on-surface-variant hover:text-tertiary transition-colors leading-none","aria-label":`Remove ${k}`,children:"x"})]},k))}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx(Sn,{placeholder:"/path/to/plans",value:l,onChange:k=>o(k.target.value),onKeyDown:C,className:"flex-1 font-mono text-xs"}),p.jsx(et,{type:"button",size:"sm",onClick:S,disabled:!l.trim(),children:"Add"})]})]}),x&&p.jsxs("div",{className:"flex items-center gap-4 pt-1",children:[p.jsx(et,{onClick:b,disabled:f,size:"sm",children:f?"Saving...":"Save"}),d&&p.jsx("span",{className:d.type==="success"?"font-sans text-sm text-primary":"font-sans text-sm text-tertiary",children:d.text})]}),!x&&(d==null?void 0:d.type)==="success"&&p.jsx("p",{className:"font-sans text-sm text-primary",children:d.text})]})]})}const Xte=["debug","info","warn","error"],Qte=[{value:"ollama",label:"Ollama"},{value:"openai-compatible",label:"OpenAI-compatible"}],Wte=[{value:"1500",label:"1.5K — Executive briefing"},{value:"5000",label:"5K — Deep onboarding"},{value:"10000",label:"10K — Full institutional"}];function L_(e){var t,n,r;return{daemonPort:e.daemon.port!=null?String(e.daemon.port):"",logLevel:e.daemon.log_level,logRetentionDays:String(e.daemon.log_retention_days),embeddingProvider:e.embedding.provider,embeddingModel:e.embedding.model,embeddingBaseUrl:e.embedding.base_url??"",contextDigestTier:String(((t=e.context)==null?void 0:t.digest_tier)??SD),contextPromptSearch:((n=e.context)==null?void 0:n.prompt_search)??!0,contextMaxSpores:String(((r=e.context)==null?void 0:r.prompt_max_spores)??ED)}}function Zte(e,t){return{...t,daemon:{...t.daemon,port:e.daemonPort!==""?Number(e.daemonPort):null,log_level:e.logLevel,log_retention_days:Number(e.logRetentionDays)},embedding:{...t.embedding,provider:e.embeddingProvider,model:e.embeddingModel,base_url:e.embeddingBaseUrl!==""?e.embeddingBaseUrl:void 0},agent:t.agent,context:{...t.context,digest_tier:Hv(e.contextDigestTier,SD),prompt_search:e.contextPromptSearch,prompt_max_spores:Hv(e.contextMaxSpores,ED)}}}function Jte(e,t){const n=L_(t);return e.daemonPort!==n.daemonPort||e.logLevel!==n.logLevel||e.logRetentionDays!==n.logRetentionDays||e.embeddingProvider!==n.embeddingProvider||e.embeddingModel!==n.embeddingModel||e.embeddingBaseUrl!==n.embeddingBaseUrl||e.contextDigestTier!==n.contextDigestTier||e.contextPromptSearch!==n.contextPromptSearch||e.contextMaxSpores!==n.contextMaxSpores}function Ga({children:e,hint:t}){return p.jsxs("label",{className:"font-sans text-sm font-medium text-on-surface",children:[e,t&&p.jsxs("span",{className:"ml-1 font-sans text-xs text-on-surface-variant font-normal",children:["(",t,")"]})]})}function xv({children:e}){return p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:e})}function ene(){const{config:e,isLoading:t,saveConfig:n,isSaving:r}=A_(),{data:a}=xp(),{restart:i}=v1(),l=R.useRef(!1),[o,f]=R.useState(null);e&&!l.current&&(l.current=!0,o===null&&f(L_(e)));const[c,d]=R.useState(null),[v,m]=R.useState("idle"),[y,x]=R.useState(""),S=o&&e?Jte(o,e):!1,w=R.useCallback((k,D)=>{f(A=>A&&{...A,[k]:D}),d(null)},[]),b=R.useCallback(async()=>{if(!(!o||!e)){d(null);try{await n(Zte(o,e)),d({type:"success",text:"Settings saved. Restarting daemon..."});try{await i()}catch{d({type:"success",text:"Settings saved. Daemon restart may require manual action."})}}catch{d({type:"error",text:"Failed to save settings."})}}},[o,e,n,i]),C=R.useCallback(async()=>{if(o){m("testing"),x("");try{const k=new URLSearchParams({provider:o.embeddingProvider,type:"embedding"});o.embeddingBaseUrl&&k.set("base_url",o.embeddingBaseUrl);const A=(await Et(`/models?${k.toString()}`)).models.length;m("success"),x(`Connected -- ${A} model${A!==1?"s":""} available.`)}catch(k){m("error"),x(k instanceof Error?k.message:"Connection failed.")}}},[o]);if(t||!o||!e)return p.jsxs("div",{className:"p-6",children:[p.jsx(al,{title:"Settings"}),p.jsx("p",{className:"font-sans text-sm text-on-surface-variant mt-2",children:"Loading..."})]});const T=(a==null?void 0:a.vault.name)??e.embedding.provider;return p.jsxs("div",{className:"p-6",children:[p.jsx(al,{title:"Settings",subtitle:"Vault configuration and daemon settings"}),p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[p.jsxs(dt,{level:"low",className:"p-6 space-y-5 border-t-2 border-t-sage",children:[p.jsx(Pn,{children:"Project"}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(Ga,{children:"Vault Name"}),p.jsx(Sn,{value:T,readOnly:!0,disabled:!0,className:"text-on-surface-variant bg-surface-container-lowest"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(Ga,{children:"Daemon Port"}),p.jsx(Sn,{type:"number",placeholder:"Auto",value:o.daemonPort,onChange:k=>w("daemonPort",k.target.value)}),p.jsx(xv,{children:"Leave blank to use a random available port."})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(Ga,{children:"Log Level"}),p.jsxs(io,{value:o.logLevel,onValueChange:k=>w("logLevel",k),children:[p.jsx(Js,{children:p.jsx(so,{})}),p.jsx(el,{children:Xte.map(k=>p.jsx(tl,{value:k,children:k},k))})]})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(Ga,{children:"Log Retention (days)"}),p.jsx(Sn,{type:"number",min:1,max:365,className:"w-24",value:o.logRetentionDays,onChange:k=>w("logRetentionDays",k.target.value)})]})]})]}),p.jsxs(dt,{level:"low",className:"p-6 space-y-5 border-t-2 border-t-ochre h-fit",children:[p.jsx(Pn,{children:"Embedding"}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(Ga,{children:"Provider"}),p.jsxs(io,{value:o.embeddingProvider,onValueChange:k=>{w("embeddingProvider",k),m("idle"),x("")},children:[p.jsx(Js,{children:p.jsx(so,{})}),p.jsx(el,{children:Qte.map(k=>p.jsx(tl,{value:k.value,children:k.label},k.value))})]})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(Ga,{children:"Model"}),p.jsx(Sn,{placeholder:"bge-m3",value:o.embeddingModel,onChange:k=>w("embeddingModel",k.target.value)})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(Ga,{hint:"optional",children:"Base URL"}),p.jsx(Sn,{type:"url",placeholder:"http://localhost:11434",value:o.embeddingBaseUrl,onChange:k=>{w("embeddingBaseUrl",k.target.value),m("idle"),x("")}})]}),p.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[p.jsxs(et,{type:"button",variant:"ghost",size:"sm",onClick:C,disabled:v==="testing",children:[v==="testing"?p.jsx(Xn,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Test Connection"]}),v==="success"&&p.jsxs("span",{className:"flex items-center gap-1 font-sans text-sm text-primary",children:[p.jsx(vD,{className:"h-4 w-4"}),y]}),v==="error"&&p.jsxs("span",{className:"flex items-center gap-1 font-sans text-sm text-tertiary",children:[p.jsx(gp,{className:"h-4 w-4"}),y]})]})]})]})]}),p.jsxs(dt,{level:"low",className:"p-6 space-y-5 border-t-2 border-t-ochre",children:[p.jsx(Pn,{children:"Context Injection"}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(Ga,{children:"Digest Tier"}),p.jsxs(io,{value:o.contextDigestTier,onValueChange:k=>w("contextDigestTier",k),children:[p.jsx(Js,{children:p.jsx(so,{})}),p.jsx(el,{children:Wte.map(k=>p.jsx(tl,{value:k.value,children:k.label},k.value))})]}),p.jsx(xv,{children:"Token budget for digest context injected at session start."})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"space-y-0.5",children:[p.jsx(Ga,{children:"Prompt Search"}),p.jsx(xv,{children:"Search vault for relevant observations on each prompt."})]}),p.jsx(R_,{checked:o.contextPromptSearch,onCheckedChange:k=>w("contextPromptSearch",k)})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(Ga,{children:"Max Spores per Prompt"}),p.jsx(Sn,{type:"number",min:"0",max:"10",placeholder:"3",value:o.contextMaxSpores,onChange:k=>w("contextMaxSpores",k.target.value)}),p.jsx(xv,{children:"Maximum observations injected per prompt. Lower = leaner context."})]})]})]}),p.jsx(Kte,{}),p.jsxs(dt,{level:"low",className:"p-4 flex items-center gap-4 border-t-2 border-t-sage",children:[p.jsxs(et,{onClick:b,disabled:!S||r,children:[r?p.jsx(Xn,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save Settings"]}),c&&p.jsx("span",{className:c.type==="success"?"font-sans text-sm text-primary":"font-sans text-sm text-tertiary",children:c.text})]})]})]})}function tne(){return ui({queryKey:["embedding-details"],queryFn:({signal:e})=>Et("/embedding/details",{signal:e}),refetchInterval:Ea.STATS,pollCategory:"standard"})}const nne=["sessions","spores","plans","artifacts"],uR="embedding",rne=100,cR=2e3,ane=40,fR=20;function ine(e){return e.provider.available?Object.values(e.pending).some(n=>n>0)?"processing":"idle":"unavailable"}function sne(e){return e.provider.available?Object.values(e.pending).some(n=>n>0)?"bg-secondary":"bg-primary":"bg-tertiary"}function lne(e){const t=new Date(e),n=String(t.getHours()).padStart(2,"0"),r=String(t.getMinutes()).padStart(2,"0"),a=String(t.getSeconds()).padStart(2,"0");return`${n}:${r}:${a}`}function one(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=ane}function une({data:e}){return p.jsx("div",{className:"overflow-x-auto",children:p.jsxs("table",{className:"w-full font-mono text-sm","aria-label":"Embedding namespace breakdown",children:[p.jsx("thead",{children:p.jsxs("tr",{className:"text-left text-on-surface-variant",children:[p.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest",scope:"col",children:"Namespace"}),p.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right",scope:"col",children:"Embedded"}),p.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right",scope:"col",children:"Pending"}),p.jsx("th",{className:"pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right",scope:"col",children:"Stale"}),p.jsx("th",{className:"pb-2 font-sans font-medium text-xs uppercase tracking-widest text-right",scope:"col",children:"Total"})]})}),p.jsx("tbody",{children:nne.map((t,n)=>{const r=e.by_namespace[t],a=(r==null?void 0:r.embedded)??0,i=(r==null?void 0:r.stale)??0,l=e.pending[t]??0,o=a+l;return p.jsxs("tr",{className:Ae("transition-colors hover:bg-surface-container-high/50",n%2===1?"bg-surface-container-low/30":""),children:[p.jsx("td",{className:"py-2.5 pr-4",children:t}),p.jsx("td",{className:"py-2.5 pr-4 text-right",children:a}),p.jsx("td",{className:"py-2.5 pr-4 text-right",children:l>0?p.jsx("span",{className:"text-secondary",children:l}):l}),p.jsx("td",{className:"py-2.5 pr-4 text-right",children:i>0?p.jsx("span",{className:"text-tertiary",children:i}):i}),p.jsx("td",{className:"py-2.5 text-right",children:o})]},t)})})]})})}function cne({entry:e}){return p.jsxs("tr",{className:"hover:bg-surface-container-high/30 transition-colors",children:[p.jsx("td",{className:"whitespace-nowrap py-1.5 pl-4 pr-3 text-on-surface-variant/60 align-top w-[68px]",children:lne(e.timestamp)}),p.jsx("td",{className:"whitespace-nowrap py-1.5 pr-3 align-top w-[20px]",children:p.jsx("div",{className:Ae("h-2 w-2 rounded-full mt-1",h1(e.level))})}),p.jsx("td",{className:"whitespace-nowrap py-1.5 pr-3 align-top w-[54px]",children:p.jsx(sr,{variant:CD(e.level),className:"px-1.5 py-0 text-[10px] uppercase",children:e.level})}),p.jsx("td",{className:"py-1.5 pr-4 text-on-surface align-top break-words",children:e.message})]})}function fne(){const{data:e,isLoading:t,isError:n,error:r}=tne(),a=oi(),[i,l]=R.useState(null),[o,f]=R.useState([]);R.useEffect(()=>{e&&f(I=>{const F=[...I,e.total];return F.length>fR?F.slice(-fR):F})},[e]);const[c,d]=R.useState([]),[v,m]=R.useState(void 0),[y,x]=R.useState(!0),[S,w]=R.useState(!1),b=R.useRef(null),C=R.useRef(y);C.current=y;const T=R.useRef(v);T.current=v;const{data:k}=ui({queryKey:["embedding-logs"],queryFn:({signal:I})=>{const F=new URLSearchParams({limit:String(rne),category:uR});return T.current&&F.set("since",T.current),Et(`/logs?${F.toString()}`,{signal:I})},refetchInterval:Ea.LOGS,pollCategory:"standard"});R.useEffect(()=>{k!=null&&k.entries.length&&(d(I=>{let F;if(k.cursor_reset){const B=new Set(I.map(K=>`${K.timestamp}|${K.message}`)),H=k.entries.filter(K=>!B.has(`${K.timestamp}|${K.message}`));F=H.length?[...I,...H]:I}else F=[...I,...k.entries];return F.length>cR?F.slice(-cR):F}),m(k.cursor),C.current||w(!0))},[k]),R.useEffect(()=>{!y||!b.current||(b.current.scrollTop=b.current.scrollHeight,w(!1))},[c,y]);const D=R.useCallback(()=>{const I=b.current;I&&(one(I)?(x(!0),w(!1)):x(!1))},[]),A=R.useCallback(()=>{b.current&&(b.current.scrollTop=b.current.scrollHeight,x(!0),w(!1))},[]),j=R.useMemo(()=>{const I=qv.debug;return c.filter(F=>!(qv[F.level]<I||F.category!==uR))},[c]);async function L(){l(null);try{const I=await qi("/embedding/reembed-stale");l({type:"success",text:`Re-embedded ${I.reembedded} stale vectors`}),a.invalidateQueries({queryKey:["embedding-details"]})}catch(I){l({type:"error",text:`Error: ${I.message}`})}}async function _(){if(confirm("This will re-embed all vectors. Continue?")){l(null);try{const I=await qi("/embedding/rebuild");l({type:"success",text:`Rebuild queued: ${I.queued} vectors to re-embed`}),a.invalidateQueries({queryKey:["embedding-details"]})}catch(I){l({type:"error",text:`Error: ${I.message}`})}}}async function M(){l(null);try{const I=await qi("/embedding/clean-orphans");l({type:"success",text:`Cleaned ${I.orphans_cleaned} orphan vectors`}),a.invalidateQueries({queryKey:["embedding-details"]})}catch(I){l({type:"error",text:`Error: ${I.message}`})}}async function z(){l(null);try{const I=await qi("/embedding/reconcile");l({type:"success",text:`Reconcile complete: ${I.embedded} embedded, ${I.orphans_cleaned} orphans cleaned (${I.duration_ms}ms)`}),a.invalidateQueries({queryKey:["embedding-details"]})}catch(I){l({type:"error",text:`Error: ${I.message}`})}}const P=e?Object.values(e.pending).reduce((I,F)=>I+F,0):0,G=e?Object.values(e.by_namespace).reduce((I,F)=>I+F.stale,0):0;return p.jsx(yj,{isLoading:t,error:n?r instanceof Error?r:new Error("Unable to reach daemon"):null,loadingText:"Loading embedding details...",children:e&&p.jsxs("div",{className:"flex h-full flex-col",children:[p.jsx("div",{className:"px-6 pt-6",children:p.jsx(al,{title:"Operations",subtitle:"Embedding health, maintenance actions, and activity log"})}),p.jsx("div",{className:"flex-1 overflow-auto",children:p.jsxs("div",{className:"space-y-6 px-6 pb-6",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-4 font-sans text-sm",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(u1,{className:"h-4 w-4 text-primary"}),p.jsx("span",{className:"text-on-surface-variant",children:"Provider"}),p.jsx("span",{className:"font-mono text-on-surface",children:e.provider.name})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"text-on-surface-variant",children:"Model"}),p.jsx("span",{className:"font-mono text-xs text-on-surface truncate max-w-[200px]",title:e.provider.model,children:e.provider.model})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:Ae("h-2 w-2 rounded-full",sne(e))}),p.jsx("span",{className:"text-on-surface-variant capitalize",children:ine(e)})]})]}),p.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[p.jsx(En,{label:"Total Vectors",value:String(e.total),sparklineData:o,accent:"sage"}),p.jsx(En,{label:"Pending",value:String(P),accent:P>0?"ochre":"outline"}),p.jsx(En,{label:"Stale",value:String(G),accent:G>0?"terracotta":"outline"})]}),p.jsxs(dt,{level:"low",className:"p-6 space-y-4",children:[p.jsx(Pn,{children:"Namespace Breakdown"}),p.jsx(une,{data:e})]}),p.jsxs(dt,{level:"low",className:"p-6 space-y-3",children:[p.jsx(Pn,{children:"Actions"}),p.jsxs("div",{className:"flex flex-wrap gap-2",children:[p.jsxs(et,{variant:"ghost",size:"sm",onClick:L,children:[p.jsx(KP,{className:"mr-2 h-4 w-4"}),"Re-embed stale"]}),p.jsxs(et,{variant:"ghost",size:"sm",onClick:M,children:[p.jsx(qf,{className:"mr-2 h-4 w-4"}),"Clean orphans"]}),p.jsxs(et,{variant:"secondary",size:"sm",onClick:z,children:[p.jsx(Yu,{className:"mr-2 h-4 w-4"}),"Force reconcile"]}),p.jsxs(et,{variant:"destructive",size:"sm",onClick:_,children:[p.jsx(c1,{className:"mr-2 h-4 w-4"}),"Rebuild all"]})]}),i&&p.jsx("p",{className:Ae("font-sans text-sm",i.type==="success"?"text-primary":"text-tertiary"),children:i.text})]}),p.jsxs(dt,{level:"low",className:"flex flex-col overflow-hidden",children:[p.jsxs("div",{className:"flex items-center justify-between px-6 py-4",children:[p.jsx(Pn,{children:"Activity Log"}),p.jsxs(et,{size:"sm",variant:y?"default":"ghost",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>{y?x(!1):A()},title:y?"Pause auto-scroll":"Resume auto-scroll",children:[y?p.jsx($P,{className:"h-3 w-3"}):p.jsx(Yu,{className:"h-3 w-3"}),y?"Pause":"Resume"]})]}),p.jsxs("div",{className:"relative flex-1 p-0",children:[p.jsx("div",{ref:b,onScroll:D,className:"h-64 overflow-y-auto font-mono text-xs bg-surface-container-lowest",children:j.length===0?p.jsx("div",{className:"flex h-32 items-center justify-center font-sans text-on-surface-variant",children:"No embedding log entries"}):p.jsx("table",{className:"w-full border-collapse","aria-label":"Embedding activity log",children:p.jsx("tbody",{children:j.map((I,F)=>p.jsx(cne,{entry:I},`${I.timestamp}-${F}`))})})}),S&&!y&&p.jsxs("button",{type:"button",onClick:A,className:Ae("absolute bottom-4 left-1/2 -translate-x-1/2","flex items-center gap-1.5 rounded-full","bg-surface-container-high px-3 py-1.5 text-xs font-medium shadow-ambient","text-on-surface-variant transition-colors hover:text-on-surface"),children:[p.jsx(MP,{className:"h-3 w-3"}),"New entries below"]})]})]})]})})]})})}const dne=[{value:"15m",label:"15m"},{value:"1h",label:"1h"},{value:"6h",label:"6h"},{value:"24h",label:"24h"},{value:"7d",label:"7d"},{value:"30d",label:"30d"}];function hne({mode:e,onModeChange:t,searchValue:n,onSearchChange:r,onSearchSubmit:a,activeLevel:i,onLevelChange:l,components:o,activeComponents:f,onComponentToggle:c,onComponentsClear:d,timeRange:v,onTimeRangeChange:m,totalResults:y}){return p.jsxs(dt,{level:"default",className:"rounded-md p-3 space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("div",{className:"flex items-center rounded-md bg-surface-container-low",children:[p.jsxs(et,{size:"sm",variant:e==="live"?"default":"ghost",className:"h-7 gap-1.5 px-2.5 text-xs rounded-r-none",onClick:()=>t("live"),children:[p.jsx(yD,{className:"h-3 w-3"}),"Live"]}),p.jsxs(et,{size:"sm",variant:e==="search"?"default":"ghost",className:"h-7 gap-1.5 px-2.5 text-xs rounded-l-none",onClick:()=>t("search"),children:[p.jsx(nc,{className:"h-3 w-3"}),"Search"]})]}),e==="search"&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"h-5 w-px bg-outline-variant/30"}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(_P,{className:"h-3 w-3 text-on-surface-variant/50"}),dne.map(x=>p.jsx(et,{size:"sm",variant:v===x.value?"default":"ghost",className:"h-6 px-1.5 text-[10px]",onClick:()=>m(x.value),children:x.label},x.value))]})]}),p.jsx("form",{className:"ml-auto flex items-center gap-1.5",onSubmit:x=>{x.preventDefault(),a()},children:p.jsx(Sn,{className:"h-7 w-56 text-xs",placeholder:e==="search"?"Search logs...":"Filter messages...",value:n,onChange:x=>r(x.target.value),"aria-label":"Search log messages"})}),e==="search"&&y!==void 0&&p.jsxs("span",{className:"text-[10px] font-mono text-on-surface-variant/50 tabular-nums whitespace-nowrap",children:[y.toLocaleString()," results"]})]}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"flex items-center gap-1",children:cz.map(x=>p.jsxs(et,{size:"sm",variant:i===x?"default":"ghost",className:"h-6 px-2 text-[10px] capitalize gap-1.5",onClick:()=>l(x),children:[p.jsx("div",{className:Ae("h-1.5 w-1.5 rounded-full",h1(x))}),x]},x))}),o.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"h-4 w-px bg-outline-variant/20"}),p.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[o.map(x=>p.jsx(et,{size:"sm",variant:f.has(x)?"default":"ghost",className:"h-5 px-1.5 text-[10px]",onClick:()=>c(x),children:x},x)),f.size>0&&p.jsx(et,{size:"sm",variant:"ghost",className:"h-5 px-1.5 text-[10px] text-on-surface-variant",onClick:d,children:"clear"})]})]})]})]})}const vne={debug:"border-l-outline/30",info:"border-l-primary/50",warn:"border-l-secondary/70",error:"border-l-tertiary/80"},pne={context:"text-primary/70",hooks:"text-on-surface-variant/70",agent:"text-secondary/80",daemon:"text-on-surface-variant/60",capture:"text-primary/60",processor:"text-on-surface-variant/70",lifecycle:"text-primary/50",embedding:"text-on-surface-variant/60",power:"text-on-surface-variant/50",server:"text-on-surface-variant/60"};function mne(e,t){if(t)return T1(e);const n=new Date(e),r=String(n.getHours()).padStart(2,"0"),a=String(n.getMinutes()).padStart(2,"0"),i=String(n.getSeconds()).padStart(2,"0");return`${r}:${a}:${i}`}function gne({entries:e,selectedId:t,onSelect:n,autoScroll:r=!1,relativeTime:a=!1,compact:i=!0}){const l=R.useRef(null);return R.useEffect(()=>{!r||!l.current||(l.current.scrollTop=l.current.scrollHeight)},[e,r]),p.jsx("div",{ref:l,className:"flex-1 overflow-y-auto bg-surface-container-lowest font-mono text-xs",children:e.length===0?p.jsx("div",{className:"flex h-full min-h-[200px] items-center justify-center text-on-surface-variant/50 font-sans text-sm",children:"No log entries"}):p.jsx("table",{className:"w-full border-collapse","aria-label":"Log entries",children:p.jsx("tbody",{children:e.map(o=>p.jsx(yne,{entry:o,selected:o.id===t,onSelect:n,relativeTime:a,compact:i},o.id))})})})}const yne=R.memo(function({entry:t,selected:n,onSelect:r,relativeTime:a,compact:i}){const l=i?"py-0.5":"py-1.5";return p.jsxs("tr",{className:Ae("cursor-pointer transition-colors border-l-2",vne[t.level],n?"bg-primary/10":"hover:bg-surface-container-high/30"),onClick:()=>r(t),children:[p.jsx("td",{className:Ae("whitespace-nowrap pl-3 pr-2 text-on-surface-variant/50 align-top w-[68px] tabular-nums",l),children:mne(t.timestamp,a)}),p.jsx("td",{className:Ae("whitespace-nowrap pr-1 align-top w-[12px]",l),children:p.jsx("div",{className:Ae("h-1.5 w-1.5 rounded-full mt-1",h1(t.level))})}),p.jsx("td",{className:Ae("whitespace-nowrap pr-2 align-top w-[48px]",l),children:p.jsx(sr,{variant:CD(t.level),className:"px-1 py-0 text-[9px] uppercase",children:t.level})}),p.jsx("td",{className:Ae("whitespace-nowrap pr-2 align-top w-[90px] truncate max-w-[90px]",l,pne[t.component]??"text-on-surface-variant/60"),children:t.component}),p.jsx("td",{className:Ae("pr-3 text-on-surface align-top break-words",l),children:t.message})]})});function xne({value:e}){const t=String(e),n=t.slice(0,8);return p.jsxs(mp,{to:`/sessions/${t}`,className:"font-mono text-primary hover:underline",children:[n,"..."]})}function bne({value:e}){return Array.isArray(e)?p.jsx("span",{className:"flex flex-wrap gap-1",children:e.map((t,n)=>p.jsx(sr,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:String(t)},n))}):p.jsx("span",{children:String(e)})}function wne({value:e}){return Array.isArray(e)?p.jsx("span",{className:"flex gap-1",children:e.map((t,n)=>p.jsx(sr,{variant:"outline",className:"text-[10px] px-1.5 py-0 tabular-nums",children:String(t)},n))}):p.jsx("span",{children:String(e)})}function Sne({value:e}){return p.jsx("span",{className:"rounded bg-tertiary/10 px-2 py-0.5 text-tertiary font-mono text-[11px]",children:String(e)})}function dR({value:e}){return p.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-surface-container-lowest px-2 py-1 text-[11px] font-mono text-on-surface-variant whitespace-pre-wrap",children:String(e)})}function Ene({value:e}){const t=new Date(String(e)),r=new Date().getTime()-t.getTime(),a=Math.floor(r/6e4),i=Math.floor(a/60),l=Math.floor(i/24);let o;return a<1?o="just now":a<60?o=`${a}m ago`:i<24?o=`${i}h ago`:o=`${l}d ago`,p.jsx("span",{className:"tabular-nums",title:t.toISOString(),children:o})}function Cne({value:e}){return typeof e=="object"&&e!==null?p.jsx("pre",{className:"text-[11px] font-mono text-on-surface-variant whitespace-pre-wrap",children:JSON.stringify(e,null,2)}):p.jsx("span",{children:String(e)})}const Tne={session_id:xne,spore_titles:bne,scores:wne,error:Sne,preview:dR,generated_at:Ene,text:dR},Nne=new Set(["id","timestamp","level","kind","component","message"]);function hR(e,t){const n=Tne[e]??Cne;return p.jsx(n,{value:t})}function kne(e){return Nne.has(e)}function Ane(e){return e?Object.entries(e).filter(([t])=>!kne(t)):[]}const Rne={debug:"text-on-surface-variant/60",info:"text-primary",warn:"text-secondary",error:"text-tertiary"};function Dne({entry:e,resolved:t,onClose:n}){const r=Ane(e.data);return p.jsxs("div",{className:"flex h-full flex-col bg-surface-container-low",children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-outline-variant/10",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(sr,{variant:"outline",className:"text-[10px] px-1.5 py-0 font-mono",children:e.kind}),p.jsx("span",{className:Ae("text-xs font-medium",Rne[e.level]),children:e.level.toUpperCase()})]}),p.jsx(et,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:n,"aria-label":"Close detail panel",children:p.jsx(rc,{className:"h-3.5 w-3.5"})})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-4",children:[p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5",children:"Timestamp"}),p.jsx("div",{className:"font-mono text-xs tabular-nums",children:new Date(e.timestamp).toLocaleString()})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5",children:"Message"}),p.jsx("div",{className:"text-sm text-on-surface leading-relaxed",children:e.message})]}),e.session_id&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5",children:"Session"}),p.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[hR("session_id",e.session_id),(t==null?void 0:t.session_title)&&p.jsx("span",{className:"text-on-surface-variant/70",children:String(t.session_title)})]})]}),r.length>0&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-1.5",children:"Metadata"}),p.jsx("div",{className:"space-y-2",children:r.map(([a,i])=>p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] text-on-surface-variant/40 mb-0.5",children:a}),p.jsx("div",{className:"text-xs",children:hR(a,i)})]},a))})]})]}),p.jsx("div",{className:"px-4 py-2 border-t border-outline-variant/10",children:p.jsxs("span",{className:"font-mono text-[10px] text-on-surface-variant/40 tabular-nums",children:["id: ",e.id]})})]})}const vR=5e3;function jne(){const[e,t]=R.useState([]),n=R.useRef(0),{data:r}=mn({queryKey:["logs-stream"],queryFn:({signal:i})=>Et(`/logs/stream?since=${n.current}`,{signal:i}),refetchInterval:Ea.LOGS});R.useEffect(()=>{r!=null&&r.entries.length&&(n.current=r.cursor,t(i=>{const l=[...i,...r.entries];return l.length>vR?l.slice(-vR):l}))},[r]);const a=R.useCallback(()=>{t([])},[]);return{entries:e,clear:a}}function Mne(e,t){const n=new URLSearchParams;return e.q&&n.set("q",e.q),e.level&&n.set("level",e.level),e.component&&n.set("component",e.component),e.kind&&n.set("kind",e.kind),e.session_id&&n.set("session_id",e.session_id),e.from&&n.set("from",e.from),e.to&&n.set("to",e.to),e.page&&n.set("page",String(e.page)),e.page_size&&n.set("page_size",String(e.page_size)),mn({queryKey:["logs-search",Object.fromEntries(n)],queryFn:({signal:r})=>Et(`/logs/search?${n.toString()}`,{signal:r}),enabled:t})}function One(e){return mn({queryKey:["log-detail",e],queryFn:({signal:t})=>Et(`/logs/${e}`,{signal:t}),enabled:e!==null})}function Lne(e){const t=Date.now(),n={"15m":15*6e4,"1h":60*6e4,"6h":360*6e4,"24h":1440*6e4,"7d":10080*6e4,"30d":720*60*6e4};return new Date(t-(n[e]??n["24h"])).toISOString()}function _ne(){const[e,t]=R.useState("live"),[n,r]=R.useState(""),[a,i]=R.useState(""),[l,o]=R.useState("debug"),[f,c]=R.useState(new Set),[d,v]=R.useState("24h"),[m,y]=R.useState(1),[x,S]=R.useState(null),{entries:w}=jne(),b=R.useMemo(()=>({q:a||void 0,level:l!=="debug"?l:void 0,component:f.size>0?Array.from(f).join(","):void 0,from:Lne(d),page:m,page_size:Ja}),[a,l,f,d,m]),{data:C}=Mne(b,e==="search"),{data:T}=One((x==null?void 0:x.id)??null),[k,D]=R.useState([]);R.useEffect(()=>{const I=e==="live"?w:(C==null?void 0:C.entries)??[];D(F=>{const B=new Set(F);let H=!1;for(const K of I)B.has(K.component)||(B.add(K.component),H=!0);return H?Array.from(B).sort():F})},[w,C,e]);const A=R.useMemo(()=>{const I=qv[l]??0,F=n.trim().toLowerCase();return w.filter(B=>!((qv[B.level]??0)<I||f.size>0&&!f.has(B.component)||F&&!B.message.toLowerCase().includes(F)))},[w,l,f,n]),j=e==="live"?A:(C==null?void 0:C.entries)??[],L=R.useCallback(I=>{t(I),S(null)},[]),_=R.useCallback(()=>{i(n),y(1)},[n]),M=R.useCallback(I=>{S(F=>(F==null?void 0:F.id)===I.id?null:I)},[]),z=R.useCallback(I=>{c(F=>{const B=new Set(F);return B.has(I)?B.delete(I):B.add(I),B}),y(1)},[]),P=R.useCallback(I=>{o(I),y(1)},[]),G=x!==null;return p.jsxs("div",{className:"flex h-full flex-col",children:[p.jsx("div",{className:"px-6 pt-6",children:p.jsx(al,{title:"Logs",subtitle:"Daemon log explorer"})}),p.jsx("div",{className:"px-6 mb-3",children:p.jsx(hne,{mode:e,onModeChange:L,searchValue:n,onSearchChange:r,onSearchSubmit:_,activeLevel:l,onLevelChange:P,components:k,activeComponents:f,onComponentToggle:z,onComponentsClear:()=>{c(new Set),y(1)},timeRange:d,onTimeRangeChange:I=>{v(I),y(1)},totalResults:e==="search"?C==null?void 0:C.total:void 0})}),p.jsxs("div",{className:"flex flex-1 overflow-hidden mx-6 mb-6 rounded-lg border border-outline-variant/10",children:[p.jsxs("div",{className:Ae("flex flex-col",G?"w-3/5":"w-full"),children:[p.jsx(gne,{entries:j,selectedId:(x==null?void 0:x.id)??null,onSelect:M,autoScroll:e==="live",relativeTime:e==="live",compact:!0}),e==="search"&&C&&p.jsx("div",{className:"border-t border-outline-variant/10 px-3 py-2 bg-surface-container-low",children:p.jsx(Bp,{total:C.total,offset:(m-1)*Ja,limit:Ja,onPageChange:I=>y(Math.floor(I/Ja)+1)})})]}),G&&x&&p.jsx("div",{className:"w-2/5 border-l border-outline-variant/10",children:p.jsx(Dne,{entry:x,resolved:T==null?void 0:T.resolved,onClose:()=>S(null)})})]})]})}function Bne(){return p.jsx(_4,{children:p.jsxs($a,{element:p.jsx(t6,{}),children:[p.jsx($a,{path:"/",element:p.jsx(W6,{})}),p.jsx($a,{path:"/sessions",element:p.jsx(SN,{})}),p.jsx($a,{path:"/sessions/:id",element:p.jsx(SN,{})}),p.jsx($a,{path:"/mycelium",element:p.jsx(Zee,{})}),p.jsx($a,{path:"/agent",element:p.jsx(Yte,{})}),p.jsx($a,{path:"/settings",element:p.jsx(ene,{})}),p.jsx($a,{path:"/operations",element:p.jsx(fne,{})}),p.jsx($a,{path:"/logs",element:p.jsx(_ne,{})})]})})}const Pne=new SB({defaultOptions:{queries:{staleTime:uz}}});W3.createRoot(document.getElementById("root")).render(p.jsx(_i.StrictMode,{children:p.jsx(gP,{children:p.jsx(EP,{children:p.jsx(kP,{children:p.jsx(EB,{client:Pne,children:p.jsx(iP,{children:p.jsx(Bne,{})})})})})})}));