graview 0.1.60 → 0.1.62

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 (228) hide show
  1. package/dist/index.d.ts.map +1 -1
  2. package/dist/index.js +5 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/preview/{chunk.QDSEVPF3.js → chunk.22BZU7ME.js} +1 -1
  5. package/dist/preview/chunk.2AT3GRXM.js +1 -0
  6. package/dist/preview/chunk.2B6P4GPS.js +1 -0
  7. package/dist/preview/chunk.2GEJNG2U.js +1 -0
  8. package/dist/preview/{chunk.7N32AVIJ.js → chunk.2N4Z5K5S.js} +1 -1
  9. package/dist/preview/{chunk.NHUQ2N6J.js → chunk.3FON2Y72.js} +1 -1
  10. package/dist/preview/chunk.3L37FY3G.js +4 -0
  11. package/dist/preview/{chunk.ZYM2SSGW.js → chunk.4HEFUOLV.js} +1 -1
  12. package/dist/preview/chunk.4HRYB7HF.js +1 -0
  13. package/dist/preview/{chunk.YZ7FUKAL.js → chunk.4TX6VCBT.js} +1 -1
  14. package/dist/preview/{chunk.IGJZ4UH3.js → chunk.5HGD6OWL.js} +2 -2
  15. package/dist/preview/{chunk.2USDHXB4.js → chunk.5J3O2FVG.js} +1 -1
  16. package/dist/preview/{chunk.H45Q3O4F.js → chunk.5MZYCELA.js} +1 -1
  17. package/dist/preview/{chunk.SRVQJZRT.js → chunk.5ODHHH35.js} +1 -1
  18. package/dist/preview/{chunk.HDUO2USQ.js → chunk.5STU3KYG.js} +1 -1
  19. package/dist/preview/{chunk.TFWIG6LL.js → chunk.5YAOKOGV.js} +1 -1
  20. package/dist/preview/{chunk.BQIHNT7C.js → chunk.66P5IDTH.js} +1 -1
  21. package/dist/preview/{chunk.M4UD4ARP.js → chunk.6AKW7TXM.js} +1 -1
  22. package/dist/preview/{chunk.URWAFZHF.js → chunk.6JO5HQDR.js} +1 -1
  23. package/dist/preview/{chunk.HUJ6YTWE.js → chunk.75GVFX7L.js} +1 -1
  24. package/dist/preview/{chunk.A3ZXDG6V.js → chunk.7KVUUEZA.js} +1 -1
  25. package/dist/preview/{chunk.FFTYMBBT.js → chunk.7M4HNKDR.js} +1 -1
  26. package/dist/preview/chunk.7OBIBPYH.js +1 -0
  27. package/dist/preview/chunk.7V56P2A7.js +1 -0
  28. package/dist/preview/chunk.7XLS6XTY.js +1 -0
  29. package/dist/preview/chunk.7YOAW7ED.js +1 -0
  30. package/dist/preview/{chunk.FBJARKDT.js → chunk.A3OL2BI2.js} +1 -1
  31. package/dist/preview/{chunk.NGTRL5U4.js → chunk.A3ZC2JBO.js} +1 -1
  32. package/dist/preview/{chunk.A5PDXNY6.js → chunk.ACTXR2MI.js} +1 -1
  33. package/dist/preview/chunk.AFNSAQEQ.js +1 -0
  34. package/dist/preview/chunk.AI34V6WV.js +74 -0
  35. package/dist/preview/{chunk.3XGA65Y3.js → chunk.AJSUHPBE.js} +1 -1
  36. package/dist/preview/chunk.AQRB7LDA.js +1 -0
  37. package/dist/preview/{chunk.GNBIVVL3.js → chunk.B23WZQXQ.js} +1 -1
  38. package/dist/preview/chunk.BIDL7GQD.js +0 -0
  39. package/dist/preview/chunk.BLUKSGI4.js +1 -0
  40. package/dist/preview/chunk.BZMQDEIY.js +1 -0
  41. package/dist/preview/chunk.CAKFNKN5.js +1 -0
  42. package/dist/preview/chunk.CGALLZ54.js +1 -0
  43. package/dist/preview/{chunk.LSY256J4.js → chunk.CHHYIMB7.js} +1 -1
  44. package/dist/preview/chunk.CXDGE5ZS.js +1 -0
  45. package/dist/preview/{chunk.CC5BJH5A.js → chunk.CY3ELWCM.js} +1 -1
  46. package/dist/preview/chunk.DC35FJAB.js +1 -0
  47. package/dist/preview/{chunk.AVBTPSQF.js → chunk.DD2NKFDX.js} +1 -1
  48. package/dist/preview/{chunk.6HF6POIX.js → chunk.DDO3GLEJ.js} +1 -1
  49. package/dist/preview/{chunk.TLJOZSDD.js → chunk.DDUCIUVW.js} +1 -1
  50. package/dist/preview/chunk.DEAP3H2L.js +1 -0
  51. package/dist/preview/chunk.DHJ3FQTR.js +1 -0
  52. package/dist/preview/{chunk.P6RORYOT.js → chunk.DNVWSWL2.js} +1 -1
  53. package/dist/preview/chunk.DPEIT3TW.js +1 -0
  54. package/dist/preview/chunk.DVSTLVIH.js +15 -0
  55. package/dist/preview/chunk.DZZL5IDD.js +5 -0
  56. package/dist/preview/{chunk.IGVASEZU.js → chunk.ELOFPE25.js} +1 -1
  57. package/dist/preview/{chunk.MVWC3VR3.js → chunk.ELTV44HU.js} +2 -2
  58. package/dist/preview/chunk.EVBCEEQ4.js +1 -0
  59. package/dist/preview/{chunk.TKVLNBRD.js → chunk.F7YXLYLX.js} +1 -1
  60. package/dist/preview/{chunk.DCHQHKSA.js → chunk.FULEUL34.js} +1 -1
  61. package/dist/preview/{chunk.VNDKKTED.js → chunk.G4ULQK64.js} +14 -14
  62. package/dist/preview/{chunk.Y7G3OGDE.js → chunk.GX4G4BX3.js} +1 -1
  63. package/dist/preview/chunk.H24OC6OE.js +1 -0
  64. package/dist/preview/chunk.H5S7OL2U.js +1 -0
  65. package/dist/preview/chunk.H73ZPYUX.js +1 -0
  66. package/dist/preview/{chunk.GTKJJYQH.js → chunk.H7N7WN4U.js} +1 -1
  67. package/dist/preview/chunk.HANJZ6FA.js +1 -0
  68. package/dist/preview/chunk.HIMQ65QT.js +1 -0
  69. package/dist/preview/chunk.I77ZGIFE.js +1 -0
  70. package/dist/preview/{chunk.MJVYWLQQ.js → chunk.ILIIBSGA.js} +1 -1
  71. package/dist/preview/chunk.IQ3PRWGO.js +104 -0
  72. package/dist/preview/{chunk.NC7FXY2H.js → chunk.IQMD7DG3.js} +1 -1
  73. package/dist/preview/chunk.IQPILSV3.js +18 -0
  74. package/dist/preview/chunk.IYBEXENQ.js +1 -0
  75. package/dist/preview/{chunk.ULL6ZIJJ.js → chunk.J7Q2WAF4.js} +1 -1
  76. package/dist/preview/{chunk.TLWT67ON.js → chunk.JT3MFPRD.js} +1 -1
  77. package/dist/preview/chunk.JYFZCJ4N.js +2 -0
  78. package/dist/preview/chunk.K2HDEL7I.js +1 -0
  79. package/dist/preview/chunk.KDXU5DT3.js +1 -0
  80. package/dist/preview/chunk.KL7E4YHJ.js +1 -0
  81. package/dist/preview/{chunk.FRYBMS3W.js → chunk.KMV6PJFL.js} +1 -1
  82. package/dist/preview/{chunk.RXYNW5QB.js → chunk.L3WTKQQL.js} +1 -1
  83. package/dist/preview/chunk.LAYQ5PFS.js +1 -0
  84. package/dist/preview/{chunk.KBVTLNS5.js → chunk.LGRLVJGS.js} +3 -3
  85. package/dist/preview/chunk.LTZUF5VG.js +1 -0
  86. package/dist/preview/{chunk.OLFJH4RK.js → chunk.M4AYA2PL.js} +1 -1
  87. package/dist/preview/chunk.M7RESZB6.js +25 -0
  88. package/dist/preview/{chunk.WXUFATY5.js → chunk.MAKODQO3.js} +1 -1
  89. package/dist/preview/{chunk.F6V7RWDK.js → chunk.MDEX6ZVE.js} +1 -1
  90. package/dist/preview/chunk.MGALQLRW.js +1 -0
  91. package/dist/preview/{chunk.7OPM55I2.js → chunk.MYNMBOLD.js} +1 -1
  92. package/dist/preview/chunk.N6EJXXQK.js +2 -0
  93. package/dist/preview/chunk.NAD7ZXYP.js +1 -0
  94. package/dist/preview/chunk.NHTGAP3G.js +3 -0
  95. package/dist/preview/{chunk.5IEFTFKQ.js → chunk.NJSK3UO2.js} +1 -1
  96. package/dist/preview/{chunk.VFOON3Z3.js → chunk.NOGGSLVG.js} +1 -1
  97. package/dist/preview/chunk.NUWDMH47.js +1 -0
  98. package/dist/preview/chunk.NUYA4BWI.js +1 -0
  99. package/dist/preview/{chunk.VUBNBTJP.js → chunk.O2BHPYA4.js} +2 -2
  100. package/dist/preview/chunk.O75HWF3F.js +1 -0
  101. package/dist/preview/chunk.OFWNMTGB.js +21 -0
  102. package/dist/preview/chunk.OKZT2QBM.js +2 -0
  103. package/dist/preview/{chunk.EL5ICOOM.js → chunk.OUDATENL.js} +1 -1
  104. package/dist/preview/chunk.OUPURRDE.js +1 -0
  105. package/dist/preview/{chunk.Y5C4RXG7.js → chunk.OWOOKLIU.js} +2 -1
  106. package/dist/preview/{chunk.PI44XMY2.js → chunk.OWT3VVOT.js} +1 -1
  107. package/dist/preview/{chunk.VDMDPZ6U.js → chunk.PCDUV3WP.js} +1 -1
  108. package/dist/preview/chunk.PD2DECOP.js +1 -0
  109. package/dist/preview/{chunk.ZXOT3IXJ.js → chunk.PKWQKFPE.js} +1 -1
  110. package/dist/preview/{chunk.ENL2JJ47.js → chunk.PLTH2LW5.js} +1 -1
  111. package/dist/preview/{chunk.ZP5RT2EK.js → chunk.PZQNR4KZ.js} +1 -1
  112. package/dist/preview/chunk.Q5WEOX3Q.js +1 -0
  113. package/dist/preview/chunk.QDWSU47A.js +1 -0
  114. package/dist/preview/{chunk.VADQ7ZGA.js → chunk.QGU5QTR6.js} +1 -1
  115. package/dist/preview/chunk.QHY5NVYH.js +1 -0
  116. package/dist/preview/{chunk.6ZQAR5ZA.js → chunk.QIPASE42.js} +1 -1
  117. package/dist/preview/{chunk.7MHCGVGM.js → chunk.RD2X25XB.js} +1 -1
  118. package/dist/preview/chunk.RMR24LFJ.js +4 -0
  119. package/dist/preview/chunk.ROZTJ6IY.js +6 -0
  120. package/dist/preview/{chunk.RQOX5YDW.js → chunk.RPDH32XV.js} +1 -1
  121. package/dist/preview/chunk.RRKI24WY.js +1 -0
  122. package/dist/preview/{chunk.HDP3PS7N.js → chunk.RYRQ66JN.js} +1 -1
  123. package/dist/preview/chunk.SEHRPTNA.js +7 -0
  124. package/dist/preview/chunk.SGCW2XRC.js +1 -0
  125. package/dist/preview/{chunk.JPONLMU7.js → chunk.SS7234R6.js} +1 -1
  126. package/dist/preview/{chunk.BXDM3UMN.js → chunk.SVPKUWZU.js} +1 -1
  127. package/dist/preview/{chunk.LQVAABPS.js → chunk.SWMDFXUX.js} +1 -1
  128. package/dist/preview/{chunk.6WHAWOO7.js → chunk.T3UQ7ZQK.js} +1 -1
  129. package/dist/preview/chunk.T6PU3NKP.js +1 -0
  130. package/dist/preview/{chunk.6C2MHWSX.js → chunk.T6WHGKWR.js} +1 -1
  131. package/dist/preview/{chunk.QBLKTFF4.js → chunk.THVC2BEC.js} +1 -1
  132. package/dist/preview/{chunk.KDRLUBVF.js → chunk.TIALD6SC.js} +1 -1
  133. package/dist/preview/{chunk.Z2ERZ4S6.js → chunk.TM4EPUNO.js} +1 -1
  134. package/dist/preview/chunk.U5P23GO7.js +1 -0
  135. package/dist/preview/chunk.U6ZRJKVM.js +1 -0
  136. package/dist/preview/chunk.UFDJXQQQ.js +32 -0
  137. package/dist/preview/{chunk.IOK4GVJC.js → chunk.UKQUUPKE.js} +1 -1
  138. package/dist/preview/{chunk.TAT2IQUR.js → chunk.UQQKDBIH.js} +1 -1
  139. package/dist/preview/{chunk.QHDCTAD7.js → chunk.UVA7AALY.js} +1 -1
  140. package/dist/preview/chunk.UXMPFPFH.js +20 -0
  141. package/dist/preview/chunk.VACKSKGJ.js +1 -0
  142. package/dist/preview/{chunk.3UOKUF5Z.js → chunk.VC3V7HLL.js} +1 -1
  143. package/dist/preview/chunk.VIH5AX7S.js +5 -0
  144. package/dist/preview/{chunk.4LR64TPU.js → chunk.VJBBVLGZ.js} +1 -1
  145. package/dist/preview/chunk.VN23AGIY.js +1 -0
  146. package/dist/preview/{chunk.VZJWJ5XM.js → chunk.W4BKYSZX.js} +1 -1
  147. package/dist/preview/{chunk.CQT3W2SF.js → chunk.WEOVK2T4.js} +1 -1
  148. package/dist/preview/chunk.WKI5INH7.js +1 -0
  149. package/dist/preview/chunk.WPXPVD33.js +88 -0
  150. package/dist/preview/chunk.X6KYRBL6.js +1 -0
  151. package/dist/preview/chunk.Y2YYH3JN.js +1 -0
  152. package/dist/preview/chunk.Y4FZKUOK.js +1 -0
  153. package/dist/preview/chunk.Y4S7CDRB.js +1 -0
  154. package/dist/preview/{chunk.YFSBVZTG.js → chunk.YP2QSPXU.js} +1 -1
  155. package/dist/preview/{chunk.VWJGQDCE.js → chunk.Z2TDZSMN.js} +1 -1
  156. package/dist/preview/chunk.ZN3PUM2I.js +1 -0
  157. package/dist/preview/index.html +53 -51
  158. package/dist/preview/page.js +2 -2
  159. package/dist/preview/splash.js +57 -0
  160. package/package.json +6 -6
  161. package/dist/preview/chunk.2K4TT2BV.js +0 -1
  162. package/dist/preview/chunk.37TVS7CA.js +0 -1
  163. package/dist/preview/chunk.3IZ3ABII.js +0 -1
  164. package/dist/preview/chunk.3MOJF7BA.js +0 -1
  165. package/dist/preview/chunk.3V4WP7RY.js +0 -18
  166. package/dist/preview/chunk.3ZT5WQYL.js +0 -1
  167. package/dist/preview/chunk.4MP72LPR.js +0 -25
  168. package/dist/preview/chunk.4TCKEG6I.js +0 -1
  169. package/dist/preview/chunk.5DD62IOW.js +0 -21
  170. package/dist/preview/chunk.5YOLUDVO.js +0 -1
  171. package/dist/preview/chunk.644FUGSX.js +0 -1
  172. package/dist/preview/chunk.67U6M7OV.js +0 -1
  173. package/dist/preview/chunk.7TFLRR7D.js +0 -1
  174. package/dist/preview/chunk.7VKSXGTX.js +0 -1
  175. package/dist/preview/chunk.BF6S5UE4.js +0 -1
  176. package/dist/preview/chunk.BLPYNNR4.js +0 -1
  177. package/dist/preview/chunk.BRT27WON.js +0 -1
  178. package/dist/preview/chunk.BYKD5RLA.js +0 -1
  179. package/dist/preview/chunk.C7OLSEWK.js +0 -1
  180. package/dist/preview/chunk.CFKZXLXS.js +0 -1
  181. package/dist/preview/chunk.CMN6BBAD.js +0 -1
  182. package/dist/preview/chunk.D7YSL3NK.js +0 -2
  183. package/dist/preview/chunk.EQXB7LKI.js +0 -1
  184. package/dist/preview/chunk.ERFT54HT.js +0 -1
  185. package/dist/preview/chunk.FLUK3UXF.js +0 -1
  186. package/dist/preview/chunk.G3R4BTI7.js +0 -1
  187. package/dist/preview/chunk.G4YJPKRG.js +0 -5
  188. package/dist/preview/chunk.GLWSVSQL.js +0 -1
  189. package/dist/preview/chunk.I4XQBQRC.js +0 -1
  190. package/dist/preview/chunk.IBOKXVWN.js +0 -1
  191. package/dist/preview/chunk.IHBUBZQT.js +0 -2
  192. package/dist/preview/chunk.JEYQBH33.js +0 -32
  193. package/dist/preview/chunk.JJGCTGWA.js +0 -1
  194. package/dist/preview/chunk.KGW75Z5L.js +0 -3
  195. package/dist/preview/chunk.KI37ZEV3.js +0 -1
  196. package/dist/preview/chunk.KNYLY7MH.js +0 -1
  197. package/dist/preview/chunk.L6AWE76F.js +0 -1
  198. package/dist/preview/chunk.LGEA5257.js +0 -6
  199. package/dist/preview/chunk.LLYRFVIN.js +0 -104
  200. package/dist/preview/chunk.LZIBQ3VX.js +0 -1
  201. package/dist/preview/chunk.MDJWK5W2.js +0 -1
  202. package/dist/preview/chunk.MSWWWLEA.js +0 -1
  203. package/dist/preview/chunk.PFSYXD6Q.js +0 -1
  204. package/dist/preview/chunk.PHC2MI4C.js +0 -1
  205. package/dist/preview/chunk.PHJ6WPWH.js +0 -1
  206. package/dist/preview/chunk.PNW5K7BW.js +0 -1
  207. package/dist/preview/chunk.PXQVXBNG.js +0 -1
  208. package/dist/preview/chunk.QFUMFQJU.js +0 -1
  209. package/dist/preview/chunk.QI4SLPQ4.js +0 -4
  210. package/dist/preview/chunk.QUJS63OJ.js +0 -13
  211. package/dist/preview/chunk.SB2PZKN5.js +0 -88
  212. package/dist/preview/chunk.T7LQD67N.js +0 -20
  213. package/dist/preview/chunk.TY4GQJKC.js +0 -1
  214. package/dist/preview/chunk.UDCDK7XJ.js +0 -4
  215. package/dist/preview/chunk.UITT6JWW.js +0 -2
  216. package/dist/preview/chunk.UJTE7UAP.js +0 -1
  217. package/dist/preview/chunk.UQWTZJBV.js +0 -1
  218. package/dist/preview/chunk.VMV464JK.js +0 -1
  219. package/dist/preview/chunk.VSCIXAHN.js +0 -5
  220. package/dist/preview/chunk.W3W54DSX.js +0 -1
  221. package/dist/preview/chunk.WC3DENU4.js +0 -67
  222. package/dist/preview/chunk.WQ6RCEUQ.js +0 -1
  223. package/dist/preview/chunk.X6A4VSSD.js +0 -1
  224. package/dist/preview/chunk.XGASJAV2.js +0 -7
  225. package/dist/preview/chunk.XR6YR6RV.js +0 -1
  226. package/dist/preview/chunk.XZPKBHJT.js +0 -1
  227. package/dist/preview/chunk.YEBGI6ED.js +0 -1
  228. package/dist/preview/chunk.YH63KQ2G.js +0 -1
@@ -1 +0,0 @@
1
- import"./chunk.AJZBJBMO.js";var e='"use strict";\n/*! @remote-dom/core and @remote-dom/polyfill \u2014 Copyright 2020-present, Shopify Inc. \u2014 MIT License.\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n * @graview/guest\'s worker runtime \u2014 Elastic License 2.0. */\n"use strict";(()=>{var Ae=globalThis,no=Ae.addEventListener,ro=Ae.removeEventListener,oo=Ae.postMessage,io=globalThis.queueMicrotask,mn=globalThis.performance,so=mn?mn.now.bind(mn):Date.now,_e={listen:t=>no.call(Ae,"message",t),unlisten:t=>ro.call(Ae,"message",t),post:t=>oo.call(Ae,t),microtask:t=>io.call(globalThis,t),now:()=>so()};var v=Symbol("name"),me=Symbol("prefix"),fe=Symbol("value"),S=Symbol("ns"),q=Symbol("owner"),I=Symbol("owner_document"),re=Symbol("attributes"),M=Symbol("prev"),p=Symbol("next"),R=Symbol("child"),Y=Symbol("parent"),pe=Symbol("host"),K=Symbol("data"),Te=Symbol("listeners"),fn=Symbol("isTrusted"),ke=Symbol("path"),Pe=Symbol("stop_immediate_propagation"),Ce=Symbol("dispatching"),se=Symbol("content"),D=Symbol("hooks"),ft=Symbol("extensions"),we=Symbol("hooks_dispatch"),U=Symbol("is_connected"),Ie=Symbol("create_element"),$n=0,X=1,Me=2,De=3,Le=8,xe=9,Kn=10,he=11,A="http://www.w3.org/1999/xhtml",Z="http://www.w3.org/2000/svg",Zn="http://www.w3.org/XML/1998/namespace",$e="http://www.w3.org/2000/xmlns/";function pt(t){return t.split(/[\\t\\n\\f\\r ]+/).filter(Boolean)}function G(t){return t.replace(/[A-Z]/g,e=>String.fromCharCode(e.charCodeAt(0)+32))}function Qn(t){return t.replace(/[a-z]/g,e=>String.fromCharCode(e.charCodeAt(0)-32))}function P(t,e){let n=globalThis.DOMException;if(typeof n=="function")return new n(t,e);let r=new Error(t);return r.name=e,r}var Jn=/^(?:[A-Za-z][^\\0\\t\\n\\f\\r\\u0020/>]*|[:_\\u0080-\\u{10FFFF}][A-Za-z0-9-.:_\\u0080-\\u{10FFFF}]*)$/u,er=/[\\0\\t\\n\\f\\r />=]/u,ao=/[\\0\\t\\n\\f\\r />]/u;function ae(t){if(t==null)return null;let e=String(t);return e===""?null:e}function tr(t){Jn.test(t)||hn(t)}function pn(t){(t===""||er.test(t))&&hn(t)}function ht(t,e,n){let r=ae(t),o=String(e),i=o.indexOf(":"),s=i<0?null:o.slice(0,i),a=i<0?o:o.slice(i+1);if((s!=null&&(s===""||ao.test(s))||(n==="element"?!Jn.test(a):a===""||er.test(a)))&&hn(o),s!=null&&r==null)throw P(`A namespace is required for the prefix in "${o}"`,"NamespaceError");if(s==="xml"&&r!==Zn)throw P("The xml prefix requires the XML namespace","NamespaceError");if((o==="xmlns"||s==="xmlns")&&r!==$e)throw P("The xmlns name requires the XMLNS namespace","NamespaceError");if(r===$e&&o!=="xmlns"&&s!=="xmlns")throw P("The XMLNS namespace requires the xmlns name or prefix","NamespaceError");return{namespace:r,qualifiedName:o,prefix:s,localName:a}}function hn(t){throw P(`Invalid name: "${t}"`,"InvalidCharacterError")}var gt=0,yt=1,nr=2,gn=3,lo=typeof performance>"u"?Date.now:performance.now.bind(performance),B=class{static NONE=gt;static CAPTURING_PHASE=yt;static AT_TARGET=nr;static BUBBLING_PHASE=gn;timeStamp=lo();target=null;currentTarget=null;srcElement=null;bubbles=!1;cancelable=!1;composed=!1;defaultPrevented=!1;cancelBubble=!1;eventPhase=gt;[ke]=[];[Pe]=!1;[Ce]=!1;constructor(e,n){this.type=e,Object.defineProperty(this,fn,{writable:!0,value:!1}),n&&(n.bubbles&&(this.bubbles=n.bubbles),n.cancelable&&(this.cancelable=n.cancelable),n.composed&&(this.composed=n.composed))}get isTrusted(){return this[fn]}composedPath(){return[...this[ke]]}stopPropagation(){this.cancelBubble=!0}stopImmediatePropagation(){this[Pe]=!0,this.cancelBubble=!0}preventDefault(){this.cancelable&&(this.defaultPrevented=!0)}set returnValue(e){e||this.preventDefault()}get returnValue(){return!this.defaultPrevented}initEvent(e,n,r){this.type=e,this.bubbles=!!n,this.cancelable=!!r}};function yn(t,e,n){if(t.cancelBubble)return;let o=e[Te]?.get(t.type)?.[n===yt?"capture":"bubble"];if(o)for(let i of[...o]){if(!o.has(i)||i.signal?.aborted)continue;t.eventPhase=t.target===e?nr:n,t.currentTarget=e;let s=i.normalizedListener;try{typeof s=="object"?s.handleEvent(t):s.call(e,t)}catch(a){setTimeout(co,0,a)}if(t[Pe])break}}function co(t){throw t}var Ke=[],bt=new WeakMap;function Et(t,e){let n=bt.get(t);n?n.push(e):bt.set(t,[e]),Ke[Ke.length-1].push(t)}function V(t){let e=[];Ke.push(e);let n;try{n=t()}catch(r){Ke.pop();try{rr(e)}catch{}throw r}return Ke.pop(),rr(e),n}function rr(t){let e,n=!1;for(let r of t){let o=bt.get(r);if(o){for(;o.length>0;){let i=o.shift();try{i()}catch(s){n||(e=s,n=!0)}}bt.delete(r)}}if(n)throw e}var Nt=[],Ze=[],bn=!1;function ve(t){for(let e of t)Nt.push(e),e[1]&&Ze.push(e[1]);if(!bn){bn=!0;try{let e,n=!1;for(let r=0;r<Nt.length;r++){let[o,i]=Nt[r];i&&Ze.splice(Ze.indexOf(i),1);try{o()}catch(s){n||(e=s,n=!0)}}if(n)throw e}finally{Nt.length=0,Ze.length=0,bn=!1}}}function Qe(t){let e=t;for(;e;){if(Ze.includes(e))return!0;e=e[Y]??e[pe]}return!1}var Je=Symbol("listenerRegistrations"),ge=class{[Te]=void 0;[Je]=void 0;[I]=void 0;addEventListener(e,n,r){if(n==null)return;let o=r===!0||typeof r=="object"&&r.capture===!0,i=typeof r=="object"&&r.once===!0,s=typeof r=="object"?r.signal:void 0;if(s?.aborted)return;let a=En(o),c=this[Je];c||(c=new Map,this[Je]=c);let u=c.get(e);u||(u={},c.set(e,u));let m=u[a];if(m||(m=new Map,u[a]=m),m.has(n))return;let h=this,g={type:e,listener:n,capture:o,once:i,normalizedListener:n,signal:s};(i||s)&&(g.normalizedListener=function(...C){if(g.signal?.aborted){Tt(h,g);return}return g.once&&Tt(h,g),typeof g.listener=="object"?g.listener.handleEvent(...C):g.listener.call(this,...C)});let y=this[Te];y||(y=new Map,this[Te]=y);let O=y.get(e);O||(O={},y.set(e,O));let E=O[a];if(E||(E=new Set,O[a]=E),m.set(n,g),E.add(g),s){let N=()=>{Tt(h,g)};g.abortListener=N,s.addEventListener("abort",N,{once:!0})}this[I]?.defaultView[we].addEventListener?.(this,e,n,r)}removeEventListener(e,n,r){return uo.call(this,e,n,r)}dispatchEvent(e){if(e[Ce])throw P("Failed to execute \'dispatchEvent\' on \'EventTarget\': The event is already being dispatched.","InvalidStateError");e[Ce]=!0;try{let n=[],r=this;for(;r!=null;)n.push(r),r=r.parentNode;e.target=this,e.srcElement=this,e[ke]=n;for(let i=n.length;i--;)if(yn(e,n[i],yt),e.cancelBubble)return!e.defaultPrevented;let o=e.bubbles?n:n.slice(0,1);for(let i=0;i<o.length;i++)if(yn(e,o[i],gn),e.cancelBubble)return!e.defaultPrevented;return!e.defaultPrevented}finally{e[Ce]=!1,e.cancelBubble=!1,e[Pe]=!1,e.eventPhase=gt,e.currentTarget=null,e[ke]=[]}}};function uo(t,e,n){if(e==null)return;let r=n===!0||n&&n.capture===!0,o=En(!!r),i=this[Je]?.get(t)?.[o]?.get(e);i&&Tt(this,i)}function En(t){return t?"capture":"bubble"}function Tt(t,e){let n=En(e.capture),r=t[Je],o=r?.get(e.type);if(!o)return;let i=o[n];if(!i||i.get(e.listener)!==e)return;i.delete(e.listener),i.size===0&&delete o[n],!o.bubble&&!o.capture&&r?.delete(e.type),e.signal&&e.abortListener&&e.signal.removeEventListener("abort",e.abortListener);let s=t[Te],a=s?.get(e.type);if(!a)return;let c=a[n];c?.delete(e)&&(c.size===0&&delete a[n],!a.bubble&&!a.capture&&s?.delete(e.type),t[I]?.defaultView[we].removeEventListener?.(t,e.type,e.listener,e.capture))}var Q=class extends Array{item(e){return this[e]??null}};var tt=0,or=1,wn=2,xn=3,nt=4,ir=0,sr=1,vt=2,St=3,ar=4,Tn=5,lr=6,cr=7,wt=/^(?:--|-?[A-Za-z_\\u0080-\\u{10FFFF}])[A-Za-z0-9_\\u0080-\\u{10FFFF}-]*$/u;function mo(t,e){let n=1,r=null;for(let o=e;o<t.length;o++){let i=t[o];if(r){i==="\\\\"?o++:i===r&&(r=null);continue}if(i===\'"\'||i==="\'")r=i;else if(i==="(")n++;else if(i===")"&&--n===0)return[t.slice(e,o),o+1]}return[t.slice(e),t.length]}function W(t){throw P(`Invalid or unsupported selector: "${t}"`,"SyntaxError")}function Ot(t,e){let n=typeof e=="string"?rt(e):[{combinator:nt,matchers:e}],r=null,o=t[R];return o&&n[0].matchers.length&&vn(o,n,i=>(r=i,!1)),r}function Rt(t,e){let n=typeof e=="string"?rt(e):[{combinator:nt,matchers:e}],r=new Q,o=t[R];return o&&n[0].matchers.length&&vn(o,n,i=>{r.push(i)}),r}function rt(t,e=!1,n=!1){let r={combinator:nt,matchers:[]},o=[r],i=/[\\t\\n\\f\\r ]*?([>\\t\\n\\f\\r +~]?)[\\t\\n\\f\\r ]*?(?:(?:\\[[\\t\\n\\f\\r ]*([^\\]=\\t\\n\\f\\r ]+)[\\t\\n\\f\\r ]*(?:=[\\t\\n\\f\\r ]*(?:([\'"])(.*?)\\3|([^\\]\\t\\n\\f\\r ]+)))?[\\t\\n\\f\\r ]*(?:\\]|$))|([#.]?)([^\\t\\n\\f\\r #.[>:+~()]+)|:(\\w+)(\\()?)/gi,s=t.replace(/^[\\t\\n\\f\\r ]+|[\\t\\n\\f\\r ]+$/g,"");s===""&&W(t);let a=0,c;for(;c=i.exec(s);){c.index!==a&&W(t),c[1]&&(r.matchers.length===0&&!(n&&o.length===1)&&W(t),c[1]===">"?r.combinator=or:c[1]==="+"?r.combinator=xn:c[1]==="~"?r.combinator=wn:r.combinator=tt,r={combinator:nt,matchers:[]},o.push(r));let u=c[8]?G(c[8]):c[2]||c[7];c[7]!=null&&!c[6]&&r.matchers.length>0&&W(t);let h,g=c[4]??c[5]??c[7];if(c[2]){wt.test(u)||W(t);let y=c[5],O=y?.[0];if(c[3]==null&&(O===\'"\'||O==="\'")){let E=c[0].lastIndexOf(y);g=s.slice(c.index+E+1),i.lastIndex=s.length}else y!=null&&!wt.test(y)&&W(t);h=ar}else c[6]?(wt.test(u)||W(t),h=c[6]==="#"?vt:St):c[8]?h=c[9]==null?Tn:lr:c[7]==="*"?h=ir:c[7]&&wt.test(c[7])?h=sr:W(t);c[9]?([g,i.lastIndex]=mo(s,i.lastIndex),u!=="has"&&u!=="not"&&W(t),u==="has"&&e&&W(t),rt(g,e||u==="has",u==="has")):h===Tn&&W(t),r.matchers.push({type:h,name:u,value:g}),a=i.lastIndex}return(a!==s.length||r.matchers.length===0)&&W(t),o}function fo(t,e){let n=rt(e);return n[0]?.matchers.length?et(t,n):!1}function po(t,e){let n=rt(e,!0,!0),r=n[0];if(n.length===1&&r.matchers.length===0)return!1;let o=tt,i={type:cr,name:":scope"};if(r.matchers.length===0?(o=r.combinator,r.matchers.push(i)):n.unshift({combinator:tt,matchers:[i]}),n.some(({matchers:c})=>c.length===0))return!1;let s=o===xn||o===wn?t[p]:t[R];if(!s)return!1;let a=!1;return vn(s,n,()=>(a=!0,!1),t),a}function vn(t,e,n,r){let o=[],i=t;for(;i;){if(F(i)){if(et(i,e,r)&&n(i)===!1)return!1;let s=i[R];if(s){let a=i[p];a&&o.push(a),i=s;continue}}i=i[p]??o.pop()??null}return!0}function et(t,e,n){let{combinator:r,matchers:o}=e[e.length-1];if(r===nt){if(!xt(t,o,n))return!1;let a=e.slice(0,-1);return a.length===0||et(t,a,n)}let i=r===or||r===tt?Y:M,s=t[i];if(!s)return!1;if(r===tt||r===wn){for(;s;){if(F(s)&&xt(s,o,n)){let a=e.slice(0,-1);if(a.length===0||et(s,a,n))return!0}s=s[i]}return!1}else{if(r===xn&&!F(s)){for(;s&&!F(s);)s=s[i];if(!s)return!1}if(!F(s)||!xt(s,o,n))return!1;let a=e.slice(0,-1);return a.length===0||et(s,a,n)}}function Nn(t,e){return t.getAttributeNS(null,t.namespaceURI===A?G(e):e)}function xt(t,e,n){if(!t)return!1;if(Array.isArray(e)){for(let s of e)if(xt(t,s,n)===!1)return!1;return!0}let{type:r,name:o,value:i}=e;switch(r){case ir:return o==="*";case sr:return t.namespaceURI===A?t.localName===G(o):t.localName===o;case vt:return Nn(t,"id")===o;case St:let s=Nn(t,"class");return s?pt(s).includes(o):!1;case ar:let a=Nn(t,o);return i==null?a!=null:a===i;case cr:return t===n;case Tn:W(`:${o}`);case lr:switch(o){case"has":return po(t,i||"");case"not":return!fo(t,i||"");default:W(`:${o}(${i})`)}}return!1}function ho(t){return t.nodeType===Me}function ot(t){return K in t}function On(t){return t.nodeType===De}function go(t){return t.nodeType===Le}function F(t){return t.nodeType===X}function Sn(t){return t.nodeType===he}function fr(t){return"appendChild"in t}function At(t){let e=[],n=[t],r=new Set(n),o=new Set,i;for(;n.length>0;){let s=n.pop();if(r.delete(s),o.has(s))continue;let a=[];for(let c of st(s)){if(o.has(c)||(o.add(c),e.push(c),a.push(c),!F(c)))continue;let u=c[re];if(u)for(let h of u)o.has(h)||(o.add(h),e.push(h));let m=c[se];m&&!o.has(m)&&!r.has(m)&&(r.add(m),n.push(m))}i??=a}return{nodes:e,treeNodes:i}}function it(t,e){for(let n of t)n[I]=e}function ur(t,e){let n=t.constructor,r=new n(t.name,t.value,t.namespaceURI);return r[I]=e,r}function dr(t,e){if(On(t))return e.createTextNode(t.data);if(go(t))return e.createComment(t.data);if(ho(t))return ur(t,e);if(F(t)){let n=e[Ie](t[v],t.namespaceURI,t[me],t.localName);if(t[re])for(let r=0;r<t[re].length;r++){let o=t[re].item(r);n.attributes.setNamedItem(ur(o,e))}return n}else{if(Sn(t))return e.createDocumentFragment();{let n=new t.constructor;return n[I]=e,n}}}function _t(t,e,n=t.ownerDocument){if(t.nodeType===xe)throw P("Cannot clone a document node","NotSupportedError");let r=dr(t,n);if(!e||!F(t)&&!Sn(t))return r;let o=new Set([t]),i=[{source:t,destination:r,childIndex:0,cloningContent:!1}];for(;i.length>0;){let s=i[i.length-1],a,c;if(s.cloningContent)if(s.contentSource&&s.contentDestination)a=s.contentSource.childNodes[s.childIndex++],c=s.contentDestination;else{i.pop(),s.appendTo&&s.appendTo.appendChild(s.destination);continue}else if(a=s.source.childNodes[s.childIndex++],c=s.destination,!a){if(s.cloningContent=!0,s.childIndex=0,F(s.source)&&s.source.namespaceURI===A&&s.source.localName==="template"){let m=s.source[se];m&&(o.has(m)&&mr(),o.add(m),s.contentSource=m,s.contentDestination=s.destination.content)}continue}if(!a){i.pop(),s.appendTo&&s.appendTo.appendChild(s.destination);continue}o.has(a)&&mr(),o.add(a);let u=dr(a,n);F(a)||Sn(a)?i.push({source:a,destination:u,appendTo:c,childIndex:0,cloningContent:!1}):c.appendChild(u)}return r}function mr(){throw new Error("Cannot clone a cyclic or repeated node graph")}function kt(t,e){let n=String(e);return n===""?null:Ot(t,[{type:vt,name:n}])}function Pt(t,e){let n=[...new Set(pt(String(e)))];return Rt(t,n.map(r=>({type:St,name:r})))}function Ct(t,e){let n=String(e),r=G(n),o=[];for(let i of It(t))F(i)&&(n==="*"||(i.namespaceURI===A?i[v]===r:i[v]===n))&&o.push(i);return o}function It(t){let e=[],n=[],r=t[R];for(;r;){e.push(r);let o=r[R],i=r[p];o?(i&&n.push(i),r=o):r=i??n.pop()??null}return e}function st(t){let e=It(t);return e.unshift(t),e}var J=class extends ge{nodeType=$n;[v]="";[Y]=null;[pe]=null;[R]=null;[M]=null;[p]=null;[U]=!1;get[D](){return this[I].defaultView[we]}get localName(){return this[v]}get nodeName(){return this[v]}get ownerDocument(){return this[I]}get isConnected(){return this[U]}isDefaultNamespace(e){let n=ae(e);return yo(this)===n}get parentNode(){return this[Y]}set parentNode(e){}get parentElement(){let e=this[Y];return!e||e.nodeType!==1?null:e}set parentElement(e){}get previousSibling(){return this[M]}set previousSibling(e){}get nextSibling(){return this[p]}set nextSibling(e){}get previousElementSibling(){let e=this[M];for(;e&&e.nodeType!==1;)e=e[M];return e}set previousElementSibling(e){}get nextElementSibling(){let e=this[p];for(;e&&e.nodeType!==1;)e=e[p];return e}set nextElementSibling(e){}get firstChild(){return this[R]}set firstChild(e){}get lastChild(){let e=this[R];for(;e;){let n=e[p];if(n==null)break;e=n}return e}set lastChild(e){}get nodeValue(){return ot(this)?this.data:null}set nodeValue(e){ot(this)&&(this.data=e)}get textContent(){if(ot(this))return this.data;let e="";for(let n of It(this))On(n)&&(e+=n.data);return e}set textContent(e){if(ot(this))this.data=e;else if(fr(this)){let n=e==null?"":String(e);n===""?this.replaceChildren():this.replaceChildren(n)}}cloneNode(e){return _t(this,e)}contains(e){let n=e;for(;n!=null;){if(n===this)return!0;n=n.parentNode}return!1}};function yo(t){let e=t;for(;e;)switch(e.nodeType){case X:{let n=e;if(n.prefix==null&&n.namespaceURI!=null)return n.namespaceURI;let r=n.attributes.getNamedItemNS($e,"xmlns");if(r!=null&&r.prefix==null)return ae(r.value);e=n.parentElement;break}case xe:e=e.documentElement;break;case Kn:case he:return null;case Me:e=e.ownerElement;break;default:e=e.parentElement}return null}var ee=Symbol("insertNode"),_n=Symbol("preflightInsertions"),Mt=Symbol("replaceNode"),ye=class extends J{remove(){let e=this.parentNode;e&&e.removeChild(this)}replaceWith(...e){let n=Se(e),r=this.parentNode;if(r)return Rn(o=>{le(r,n);let i=this[p];for(;i&&n.includes(i);)i=i[p];let s=An(r,n,o);this.parentNode===r?r[Mt](s,this,o):r[ee](s,i,o)})}before(...e){let n=Se(e),r=this.parentNode;if(r)return Rn(o=>{le(r,n);let i=this[M];for(;i&&n.includes(i);)i=i[M];let s=An(r,n,o);r[ee](s,i?i[p]:r.firstChild,o)})}after(...e){let n=Se(e),r=this.parentNode;if(r)return Rn(o=>{le(r,n);let i=this[p];for(;i&&n.includes(i);)i=i[p];let s=An(r,n,o);r[ee](s,i,o)})}};function Rn(t){return V(()=>{let e=[];try{t(e)}catch(n){try{ve(e)}catch{}throw n}ve(e)})}function Se(t){return t.map(e=>e instanceof J?e:String(e))}function at(t,e){return e instanceof J?e:t.ownerDocument.createTextNode(String(e))}function le(t,e){for(let n of e){if(!(n instanceof J))continue;let r=t;for(;r;){if(r===n)throw P("Cannot insert a node into itself or one of its descendants","HierarchyRequestError");r=r[Y]??r[pe]}}}function An(t,e,n){let r=[];for(let i of e)r.push(at(t,i));if(r.length===1)return r[0];let o=t.ownerDocument.createDocumentFragment();o[_n](r);for(let i of r)o[ee](i,null,n);return o}var Dt,kn=0,pr=0,hr=0,gr=0,Ge=!1,Cn=!1,lt=!1,Lt=class{#t;#n=[];#e=new Set;#r=!1;constructor(e){if(typeof e!="function")throw new TypeError("MutationObserver callback must be a function");this.#t=e}observe(e,n={}){let r=bo(n),o=Dt??=new WeakMap,i=o.get(e);i==null&&(i=new Map,o.set(e,i));let s=i.get(this);s==null?kn++:Pn(s,-1),i.set(this,r),Pn(r,1),this.#e.add(e)}disconnect(){let e=Dt;if(e!=null){for(let n of this.#e){let r=e.get(n),o=r?.get(this);o!=null&&(r.delete(this),kn--,Pn(o,-1)),r?.size===0&&e.delete(n)}this.#e.clear(),this.#n.length=0,kn===0&&(Dt=void 0)}}takeRecords(){return this.#n.splice(0)}enqueue(e){this.#n.push(e),!this.#r&&(this.#r=!0,queueMicrotask(()=>{this.#r=!1;let n=this.takeRecords();n.length>0&&this.#t.call(this,n,this)}))}};function te(t){let e=Dt;if(e==null)return;let n=new Map,r=t.target;for(;r;){let o=e.get(r);if(o)for(let[i,s]of o){if(r!==t.target&&!s.subtree)continue;let a=!1;if(t.type==="attributes"){if(!s.attributes||s.attributeFilter&&!s.attributeFilter.has(t.attributeName??""))continue;a=s.attributeOldValue}else if(t.type==="characterData"){if(!s.characterData)continue;a=s.characterDataOldValue}else if(!s.childList)continue;n.set(i,n.get(i)===!0||a)}r=r.parentNode}for(let[o,i]of n)o.enqueue({addedNodes:t.addedNodes??new Q,attributeName:t.attributeName??null,attributeNamespace:t.attributeNamespace??null,nextSibling:t.nextSibling??null,oldValue:i?t.oldValue??null:null,previousSibling:t.previousSibling??null,removedNodes:t.removedNodes??new Q,target:t.target,type:t.type})}function Gt(...t){let e=new Q;return e.push(...t),e}function bo(t){if(t.attributes===!1&&(t.attributeOldValue||t.attributeFilter!=null))throw new TypeError("attributeOldValue and attributeFilter require attributes to be enabled");if(t.characterData===!1&&t.characterDataOldValue)throw new TypeError("characterDataOldValue requires characterData to be enabled");let e=t.attributes??(t.attributeOldValue===!0||t.attributeFilter!=null),n=t.characterData??t.characterDataOldValue===!0,r=t.childList===!0;if(!e&&!n&&!r)throw new TypeError("MutationObserver options must enable childList, attributes, or characterData");return{attributes:e,attributeFilter:t.attributeFilter==null?void 0:new Set(t.attributeFilter.map(String)),attributeOldValue:t.attributeOldValue===!0,characterData:n,characterDataOldValue:t.characterDataOldValue===!0,childList:r,subtree:t.subtree===!0}}function Pn(t,e){t.attributes&&(pr+=e),t.characterData&&(hr+=e),t.childList&&(gr+=e),Ge=pr>0,Cn=hr>0,lt=gr>0}var oe=class extends ye{childNodes=new Q;children=new Q;appendChild(e){return V(()=>this[ee](e,null))}insertBefore(e,n){return V(()=>this[ee](e,n||null))}append(...e){return V(()=>{let n=Se(e.filter(r=>r!=null));n.length>1&&le(this,n);for(let r of n)this[ee](at(this,r),null)})}prepend(...e){return V(()=>{let n=Se(e.filter(o=>o!=null));n.length>1&&le(this,n);let r=this.firstChild;for(let o of n)this[ee](at(this,o),r)})}replaceChildren(...e){return V(()=>{let n=Se(e.filter(o=>o!=null));le(this,n);let r;for(;r=this.firstChild;)this.removeChildImmediately(r);for(let o of n)this[ee](at(this,o),null)})}removeChild(e){return V(()=>(this.removeChildImmediately(e),e))}removeChildImmediately(e){if(e.parentNode!==this)throw P("The node is not a child of this node","NotFoundError");let n=this[U]?st(e):void 0,r=e[M],o=e[p],i=Ht(this,e);if(n)for(let s of n)s[U]=!1;this.queueRemovalMutationRecord(this,e,r,o),n&&this.enqueueTreeReactions(n,"disconnectedCallback"),ve(this.collectRemovalHookEffects(e,i))}replaceChild(e,n){return V(()=>this[Mt](e,n))}[Mt](e,n,r){if(le(this,[e]),n.parentNode!==this)throw P("The reference node is not a child of this parent","NotFoundError");let o=n[M],i=n[p],s=this.prepareInsertion(e),a=this[U]?st(n):void 0,c=new Set(s.map(({node:g})=>g)),u=i;for(;u&&c.has(u);)u=u[p];let m=Ht(this,n);if(a){for(let y of a)y[U]=!1;let g=new Set(a);for(let y of s)g.has(y.node)&&(y.shouldDisconnect=!1)}this.commitInsertion(s,u);let h=this[U];return this.queueRemovalMutationRecord(this,n,o,i),this.queueInsertionMutationRecords(s),a&&this.enqueueTreeReactions(a,"disconnectedCallback"),this.enqueueInsertionReactions(s,h),this.performOrCollectHookEffects([...this.collectRemovalHookEffects(n,m),...this.collectInsertionHookEffects(s)],r),n}querySelectorAll(e){return Rt(this,e)}querySelector(e){return Ot(this,e)}[ee](e,n,r){return this.validateInsertion(e,n),this.insertIntoValidated(e,n,r),e}[_n](e){for(let n of e)this.validateInsertion(n,null),this.prepareInsertion(n)}validateInsertion(e,n){if(le(this,[e]),n&&n.parentNode!==this)throw P("The reference node is not a child of this parent","NotFoundError")}insertIntoValidated(e,n,r){e===n&&(n=e[p]);let o=this.prepareInsertion(e);this.commitInsertion(o,n);let i=this[U];this.queueInsertionMutationRecords(o),this.enqueueInsertionReactions(o,i),this.performOrCollectHookEffects(this.collectInsertionHookEffects(o),r)}performOrCollectHookEffects(e,n){n?n.push(...e):ve(e)}prepareInsertion(e){let n=[];if(e.nodeType===he){let s=e[R];for(;s;)n.push(s),s=s[p]}else n.push(e);let r=this[U],o=this[I],i=[];for(let s of n){let a=s[U],c=a||r,u,m;if(s[I]===o)c&&(u=st(s));else{let h=At(s);m=h.nodes,c&&(u=h.treeNodes)}i.push({node:s,nodes:u,adoption:m,shouldDisconnect:a})}return i}commitInsertion(e,n){for(let i of e){let s=i.node[Y];if(s){let a=i.node[M],c=i.node[p];i.source={parent:s,index:Ht(s,i.node),previousSibling:a,nextSibling:c}}}for(let i of e){let s=this.attachChild(i.node,n);i.insertIndex=s.index,i.previousSibling=s.previousSibling,i.nextSibling=s.nextSibling}let r=this[I];for(let{adoption:i}of e)i&&it(i,r);let o=this[U];for(let{nodes:i}of e)if(i)for(let s of i)s[U]=o}attachChild(e,n){if(n){let i=n[M];e[p]=n,e[M]=i,i?i[p]=e:this[R]=e,n[M]=e}else{e[p]=null;let i=this[R];if(i){let s;for(;s=i[p];)i=s;i[p]=e,e[M]=i}else this[R]=e,e[M]=null}let r=F(e);e[Y]=this;let o;if(n){if(o=this.childNodes.indexOf(n),this.childNodes.splice(o,0,e),r){let i=n;for(;i&&!F(i);)i=i[p];i?this.children.splice(this.children.indexOf(i),0,e):this.children.push(e)}}else o=this.childNodes.length,this.childNodes.push(e),r&&this.children.push(e);return{index:o,previousSibling:e[M],nextSibling:e[p]}}queueRemovalMutationRecord(e,n,r,o){lt&&te({type:"childList",target:e,removedNodes:Gt(n),previousSibling:r,nextSibling:o})}queueInsertionMutationRecords(e){if(lt)for(let n of e){let{node:r,source:o}=n;o&&this.queueRemovalMutationRecord(o.parent,r,o.previousSibling,o.nextSibling),te({type:"childList",target:this,addedNodes:Gt(r),previousSibling:n.previousSibling,nextSibling:n.nextSibling})}}collectRemovalHookEffects(e,n){return this.nodeType!==X||Qe(this)?[]:[[()=>this[D].removeChild?.(this,e,n)]]}collectInsertionHookEffects(e){let n=[];for(let r of e){let{node:o,source:i}=r;i?.parent.nodeType===X&&!Qe(i.parent)&&n.push([()=>i.parent[D].removeChild?.(i.parent,o,i.index)]),this.nodeType===X&&!Qe(this)&&n.push([()=>this[D].insertChild?.(this,o,r.insertIndex),o])}return n}enqueueInsertionReactions(e,n){for(let r of e){let{nodes:o}=r;o&&(r.shouldDisconnect&&this.enqueueTreeReactions(o,"disconnectedCallback"),n&&this.enqueueTreeReactions(o,"connectedCallback"))}}enqueueTreeReactions(e,n){br(e,n)}};function yr(t,e,n,r){if(e.parentNode!==t)throw Error("not a child of this node");let o=t[U]?n.treeNodes:void 0,i=e[M],s=e[p],a=Ht(t,e);if(o)for(let u of o)u[U]=!1;it(n.nodes,r),lt&&te({type:"childList",target:t,removedNodes:Gt(e),previousSibling:i,nextSibling:s}),o&&br(o,"disconnectedCallback");let c=[];t.nodeType===X&&!Qe(t)&&c.push([()=>t[D].removeChild?.(t,e,a)]),ve(c)}function Ht(t,e){let n=e[M],r=e[p];n?n[p]=r:t[R]=r,r&&(r[M]=n);let o=t.childNodes.indexOf(e);return t.childNodes.splice(o,1),F(e)&&t.children.splice(t.children.indexOf(e),1),e[Y]=null,e[p]=null,e[M]=null,o}function br(t,e){for(let n of t){let r=n[e];typeof r=="function"&&Et(n,()=>r.call(n))}}function ct(t,e,n,r,o){let{observedAttributes:i}=t.constructor,{attributeChangedCallback:s}=t;s==null||i==null||!i.includes(e)||Et(t,()=>s.call(t,e,n,r,o))}var Ut=class{[R]=null;constructor(e){this[q]=e}getNamedItem(e){let n=String(e),r=this[q][S]===A?G(n):n,o=this[R];for(;o;){if(o.name===r)return o;o=o[p]}return null}getNamedItemNS(e,n){let r=ae(e),o=String(n),i=this[R];for(;i;){if(i.localName===o&&i[S]===r)return i;i=i[p]}return null}item(e){let n=this[R],r=0;for(;n;){if(r++===e)return n;n=n[p]}return null}get length(){let e=0,n=this[R];for(;n;)e++,n=n[p];return e}removeNamedItem(e){let n=String(e),r=this[q][S]===A?G(n):n;return V(()=>this.removeNamedItemImmediately(o=>o.name===r))}removeNamedItemNS(e,n){let r=ae(e),o=String(n);return V(()=>this.removeNamedItemImmediately(i=>i.localName===o&&i[S]===r))}removeNamedItemImmediately(e){let n=this[q],r=this[R],o=null;for(;r!=null;){if(e(r)){o&&(o[p]=r[p]),this[R]===r&&(this[R]=r[p]);let i=r.value;return r[p]=null,r[q]=null,Ge&&te({type:"attributes",target:n,attributeName:r.name,attributeNamespace:r[S],oldValue:i}),n[D].removeAttribute?.(n,r.name,r[S]),ct(n,r.localName,i,null,r[S]),r}o=r,r=r[p]}return null}setNamedItem(e){return V(()=>this.setNamedItemImmediately(e))}setNamedItemImmediately(e){let n=this[q],r=e[q];if(r!=null&&r!==n)throw P("The attribute is already in use by another element.","InUseAttributeError");let o=null,i=this[R],s=null;for(;i;){if(i.localName===e.localName&&i[S]===e[S]){if(i===e)return i;s?s[p]=e:this[R]=e,e[p]=i[p],i[p]=null,o=i;break}s=i,i=i[p]}o==null&&(s?s[p]=e:this[R]=e),e[q]=n,e[I]=n[I],o&&(o[q]=null);let a=o==null||o.value!==e.value,c=o!=null&&o.name!==e.name;return a&&Ge&&te({type:"attributes",target:n,attributeName:e.name,attributeNamespace:e[S],oldValue:o?.value??null}),c&&n[D].removeAttribute?.(n,o.name,o[S]),(a||c)&&n[D].setAttribute?.(n,e.name,e.value,e[S]),a&&ct(n,e.localName,o?.value??null,e.value,e[S]),o}setNamedItemNS(e){return this.setNamedItem(e)}*[Symbol.iterator](){let e=this[R];for(;e;)yield e,e=e[p]}};var Oe=class extends J{nodeType=Me;[S]=null;[p]=null;[q]=null;constructor(e,n,r){super(),this[v]=e,this[fe]=n,r&&(this[S]=r)}get nodeName(){return this[v]}set nodeName(e){}get name(){return this[v]}set name(e){}get localName(){if(this[S]==null)return this[v];let e=this[v].indexOf(":");return e<0?this[v]:this[v].slice(e+1)}get prefix(){if(this[S]==null)return null;let e=this[v].indexOf(":");return e<0?null:this[v].slice(0,e)}get value(){return this[fe]}set value(e){let n=String(e),r=this[q];if(!r){this[fe]=n;return}V(()=>{let o=this[fe];this[fe]=n,Ge&&o!==n&&te({type:"attributes",target:r,attributeName:this[v],attributeNamespace:this[S],oldValue:o}),this[D].setAttribute?.(r,this[v],n,this[S]),ct(r,this.localName,o,n,this[S])})}get nodeValue(){return this.value}set nodeValue(e){this.value=e}get ownerElement(){return this[q]}get namespaceURI(){return this[S]}get specified(){return!0}};var Eo={amp:"&",AMP:"&",apos:"\'",gt:">",GT:">",lt:"<",LT:"<",quot:\'"\',QUOT:\'"\'},No=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),To=/(?:<([a-z][a-z0-9-:]*)((?:[\\s]+[^<>\'"=/\\s]+(?:=([\'"])[^]*?\\3|=[^>\'"\\s]*|))*)[\\s]*(\\/?)\\s*>|<\\/([a-z][a-z0-9-:]*)>|<!--(.*?)-->|([^<>]+))/gi,Tr=/\\s([^<>\'"=/\\n\\s]+)(?:=(["\'])([\\s\\S]*?)\\2|=([^>\'"\\n\\s]*)|)/g,wo="|b|big|blockquote|body|br|center|code|dd|div|dl|dt|em|embed|h1|h2|h3|h4|h5|h6|head|hr|i|img|li|listing|menu|meta|nobr|ol|p|pre|ruby|s|small|span|strong|strike|sub|sup|table|tt|u|ul|var|",xo=/^(?:color|face|size)$/i;function Er(t){return t.replace(/&(?:(amp|AMP|apos|gt|GT|lt|LT|quot|QUOT)|#(\\d+)|#[xX]([\\da-fA-F]+));/g,(e,n,r,o)=>{if(n)return Eo[n];let i=Number.parseInt(r??o,r?10:16);try{return String.fromCodePoint(i)}catch{return e}})}function wr(t){return t.namespaceURI===A&&No.has(t.localName)}function Nr(t){let e=t.localName;return t[S]===Z&&(e==="foreignObject"||e==="desc"||e==="title")}function vo(t,e){if(wo.includes(`|${t}|`))return!0;if(t!=="font")return!1;for(let n of e.matchAll(Tr))if(xo.test(n[1]))return!0;return!1}function Bt(t,e){let n=e.ownerDocument,r=n.createDocumentFragment(),o=[],i=r;for(let s of t.matchAll(To)){let a=s[1];if(a){let c=s[2],u=G(a),m=o[o.length-1]?.element??e,h=m[S]===Z?Z:A;if(u==="svg")h=Z;else if(h===Z){if(Nr(m))h=A;else if(vo(u,c)){for(;o.length>0;){let O=o[o.length-1];if(O.element[S]!==Z||Nr(O.element))break;o.pop(),i=O.target}h=A}}let g=h===A?u:a,y=n[Ie](g,h,null,g);for(let O of c.matchAll(Tr))y.setAttribute(O[1],Er(O[3]||O[4]||""));if(i.append(y),wr(y)||h!==A&&s[4])continue;o.push({element:y,target:i}),i=h===A&&u==="template"?y.content:y}else if(s[5]){let c=G(s[5]);for(let u=o.length-1;u>=0;u--){let m=o[u],h=G(m.element[v]);if(h===c){i=m.target,o.length=u;break}if(m.element[S]===A&&h==="template")break}}else s[6]?i.append(n.createComment(s[6])):i.append(Er(s[7]))}return r}function Vt(t){return vr([{type:"content",child:t[R]}])}function xr(t){return vr([{type:"opening",node:t}])}function vr(t){let e=[],n;for(;n=t.pop();)switch(n.type){case"opening":{let r=n.node;switch(r.nodeType){case X:{let o=r;e.push(`<${o[v]}`);let i=o[re]?.[R];for(;i;){e.push(` ${i[v]}`);let a=i[fe];a!==""&&(a=String(a).replace(/&/g,"&amp;").replace(/"/g,"&quot;"),e.push(`="${a}"`)),i=i[p]}if(e.push(">"),wr(o))break;let s=o.namespaceURI===A&&o.localName==="template"?o[se]:o;t.push({type:"closing",name:o[v]}),t.push({type:"content",child:s?.[R]??null});break}case De:{let o=r;e.push(o[K].replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"));break}case Le:{let o=r;e.push(`<!--${o[K]}-->`);break}}break}case"content":{let r=n.child;r&&(t.push({type:"content",child:r[p]}),t.push({type:"opening",node:r}));break}case"closing":e.push(`</${n.name}>`);break}return e.join("")}var H=class extends oe{nodeType=X;[S]=A;[me]=null;get namespaceURI(){return this[S]}get prefix(){return this[me]}get localName(){let e=this[me];return e==null?this[v]:this[v].slice(e.length+1)}get nodeName(){return this[S]===A?Qn(this[v]):this[v]}get tagName(){return this.nodeName}get id(){return this.getAttributeNS(null,"id")??""}set id(e){this.setAttribute("id",String(e))}get slot(){return this.getAttributeNS(null,"slot")??""}set slot(e){let n=String(e);this.getAttributeNS(null,"slot")!==n&&this.attributes.setNamedItem(new Oe("slot",n))}get attributes(){let e=this[re];return e||(e=new Ut(this),this[re]=e),e}getAttributeNames(){return[...this.attributes].map(e=>e.name)}getElementsByTagName(e){return Ct(this,e)}get firstElementChild(){return this.children[0]??null}getElementsByClassName(e){return Pt(this,e)}get lastElementChild(){return this.children[this.children.length-1]??null}get nextElementSibling(){let e=this.nextSibling;for(;e&&e.nodeType!==1;)e=e.nextSibling;return e}get previousElementSibling(){let e=this.previousSibling;for(;e&&e.nodeType!==1;)e=e.previousSibling;return e}setAttribute(e,n){let r=String(e),o=String(n);pn(r);let i=this[S]===A?G(r):r,s=this.attributes.getNamedItemNS(null,i);s?s.value=o:this.attributes.setNamedItem(new Oe(i,o))}setAttributeNS(e,n,r){let o=ae(e),i=String(n),s=String(r),a=ht(o,i,"attribute"),c=this.attributes.getNamedItemNS(a.namespace,a.localName);c?c.value=s:this.attributes.setNamedItemNS(new Oe(a.qualifiedName,s,a.namespace))}toggleAttribute(e,n){let r=String(e);pn(r);let o=this[S]===A?G(r):r,i=this.attributes.getNamedItemNS(null,o),s=n===void 0?void 0:!!n;return i==null?s===!1?!1:(this.attributes.setNamedItem(new Oe(o,"")),!0):s===!0?!0:(this.attributes.removeNamedItemNS(null,o),!1)}getAttribute(e){let n=this.attributes.getNamedItem(e);return n&&n.value}getAttributeNS(e,n){let r=this.attributes.getNamedItemNS(e,n);return r&&r.value}hasAttribute(e){return this.attributes.getNamedItem(e)!=null}hasAttributeNS(e,n){return this.attributes.getNamedItemNS(e,n)!=null}removeAttribute(e){let n=String(e),r=this[S]===A?G(n):n;this.attributes.removeNamedItemNS(null,r)}removeAttributeNS(e,n){this.attributes.removeNamedItemNS(e,n)}get outerHTML(){return xr(this)}get innerHTML(){return Vt(this)}set innerHTML(e){if(e==null||e==="")this.replaceChildren();else{let n=Bt(String(e),this);this.replaceChildren(n)}}};var He=class t extends H{[S]=Z;get ownerSVGElement(){let e=null,n=this.parentNode;for(;n instanceof t;)e=n,n=n.parentNode;return e}};var be=class extends ye{[K]="";constructor(e){super(),this[K]=e==null?"":String(e)}setData(e){let n=Cn,r=n?this[K]:null,o="";e!=null&&(o=typeof e=="string"?e:String(e)),this[K]=o,n&&r!==o&&te({type:"characterData",target:this,oldValue:r}),this[D].setText?.(this,o)}get data(){return this[K]}set data(e){this.setData(e)}};var Ue=class extends be{nodeType=De;[v]="#text"};var Be=class extends be{nodeType=Le;[v]="#comment"};var Ve=class extends oe{nodeType=he;[v]="#document-fragment";[I]=typeof window<"u"?window.document:null;getElementById(e){return kt(this,e)}};var ze=class extends H{get content(){let e=this[se];return e||(e=this.ownerDocument.createDocumentFragment(),e[pe]=this,this[se]=e),e}set content(e){}set innerHTML(e){this.content.replaceChildren(Bt(String(e),this))}get innerHTML(){let e=this[se];return e?Vt(e):""}};var zt=class extends H{};var Ft=class extends H{};var jt=class extends H{};var ut=class extends oe{nodeType=xe;[v]="#document";[U]=!0;constructor(e){super(),this.defaultView=e,this[I]=this,this.documentElement=Yt(new jt,this,"html"),this.body=Yt(new zt,this,"body"),this.head=Yt(new Ft,this,"head"),this.appendChild(this.documentElement),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body)}get textContent(){return null}set textContent(e){}getElementsByClassName(e){return Pt(this,e)}createElement(e){let n=String(e);return tr(n),In(this,G(n))}createElementNS(e,n){let r=ht(e,n,"element");return In(this,r.qualifiedName,r.namespace,r.prefix,r.localName)}[Ie](e,n,r,o){return In(this,e,n,r,o)}createTextNode(e){let n=qt(new Ue(e),this);return this[D].createText?.(n,n.data),n}createComment(e){return qt(new Be(e),this)}createDocumentFragment(){return qt(new Ve,this)}createEvent(){return new B("")}getElementById(e){return kt(this,e)}getElementsByTagName(e){return Ct(this,e)}importNode(e,n){if(e.nodeType===xe)throw P("Cannot import a document node","NotSupportedError");return _t(e,n,this)}adoptNode(e){if(e[I]===this)return e;let n=At(e);return V(()=>{let r=e.parentNode;return r?yr(r,e,n,this):it(n.nodes,this),e})}};function qt(t,e){return Object.defineProperty(t,I,{value:e,writable:!0,enumerable:!1}),t}function In(t,e,n=A,r=null,o=e){let i;if(n===Z)i=new He;else if(n===A&&o==="template")i=new ze;else if(n===A){let s=t.defaultView.customElements.get(o);i=s?new s:new H}else i=new H;return Yt(i,t,e,n,r)}function Yt(t,e,n,r=A,o=null){return qt(t,e),Object.defineProperties(t,{[v]:{value:n},[S]:{value:r},[me]:{value:o}}),e[D].createElement?.(t,r),t}var Wt=class extends B{constructor(e,n){super(e,n),this.detail=n?.detail??null}initCustomEvent(e,n,r,o){super.initEvent(e,n,r),this.detail=o??null}};var Xt=class extends B{constructor(e,n){super(e,n),this.message=n.message,this.filename=n.filename,this.lineno=n.lineno,this.colno=n.colno,this.error=n.error}};var $t=class extends B{constructor(e,n){super(e,n),this.promise=n.promise,this.reason=n.reason}};var Kt=class extends B{constructor(e,n){super(e,n),this.oldState=n.oldState,this.newState=n.newState}};var Zt=class extends B{constructor(e,n={}){super(e,n),this.relatedTarget=n.relatedTarget??null}};var Qt=class extends B{constructor(e,n={}){super(e,n),this.clipboardData=n.clipboardData??null}};var Jt=class extends H{};var So=/^[a-z][^A-Z\\u0000\\t\\n\\f\\r />]*-[^A-Z\\u0000\\t\\n\\f\\r />]*$/u,Oo=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function Sr(t){return So.test(t)&&!Oo.has(t)}function Or(t){return P(`Invalid custom element name: "${t}"`,"SyntaxError")}var en=class{registry=new Map;listenersByName=new Map;define(e,n,r){if(!Sr(e))throw Or(e);if(this.registry.has(e))throw P(`A custom element named "${e}" has already been defined`,"NotSupportedError");if(this.getName(n)!=null)throw P("This constructor has already been registered in this custom element registry","NotSupportedError");this.registry.set(e,n);let o=this.listenersByName.get(e);if(o!=null){this.listenersByName.delete(e);for(let i of o)i(n)}}get(e){return this.registry.get(e)}getName(e){for(let[n,r]of this.registry)if(r===e)return n;return null}whenDefined(e){if(!Sr(e))return Promise.reject(Or(e));let n=this.registry.get(e);if(n!=null)return Promise.resolve(n);let r=this.listenersByName.get(e);return r==null&&(r=[],this.listenersByName.set(e,r)),new Promise(o=>{r.push(o)})}upgrade(e){}initialize(e){}};var Ro=["onerror","onunhandledrejection"],Ar=Symbol.for("@remote-dom/polyfill/global-property");function _r(t){return Object.getOwnPropertyDescriptors(t)}function kr(t){let e={};for(let[n,r]of Object.entries(Object.getOwnPropertyDescriptors(ge.prototype)))n!=="constructor"&&typeof r.value=="function"&&(r.value=Mn(r.value.bind(t)),e[n]=r);return e}function Pr(t){let e={};for(let n of Ro)e[n]={configurable:!0,enumerable:!0,get:Mn(()=>t[n]),set:Mn(r=>{t[n]=r})};return e}function Ao(t){return Object.assign(_r(t),kr(t),Pr(t))}function Mn(t){return Object.defineProperty(t,Ar,{value:!0}),t}function Rr(t,e){for(let n of Reflect.ownKeys(e)){let r=_o(t,n);(r==null||ko(r))&&Object.defineProperty(t,n,e[n])}}function _o(t,e){let n=t;for(;n;){let r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function ko(t){return[t.value,t.get,t.set].some(e=>typeof e=="function"&&e[Ar]===!0)}var Re=class extends ge{[D]={};[ft]=[];[we]=Co(this);name="";window=this;parent=this;self=this;top=this;document=new ut(this);customElements=new en;location=globalThis.location;navigator=globalThis.navigator;Event=B;ErrorEvent=Xt;PromiseRejectionEvent=$t;ToggleEvent=Kt;FocusEvent=Zt;ClipboardEvent=Qt;EventTarget=ge;CustomEvent=Wt;Node=J;ParentNode=oe;ChildNode=ye;DocumentFragment=Ve;Document=ut;CharacterData=be;Comment=Be;Text=Ue;Element=H;HTMLElement=Jt;SVGElement=He;HTMLTemplateElement=ze;MutationObserver=Lt;#t=null;#n=null;#e=null;static with(...e){let n=this;return class extends n{constructor(){super();for(let o of e)Po(this,o)}}}get onerror(){return this.#n}set onerror(e){this.#t&&this.removeEventListener("error",this.#t),e&&typeof e=="function"?(this.#n=e,this.#t=n=>{e(n.message??"Error",n.filename,n.lineno,n.colno,n.error)},this.addEventListener("error",this.#t)):(this.#t=null,this.#n=null)}get onunhandledrejection(){return this.#e}set onunhandledrejection(e){this.#e&&this.removeEventListener("unhandledrejection",this.#e),e&&typeof e=="function"?(this.#e=e,this.addEventListener("unhandledrejection",this.#e)):this.#e=null}static setGlobal(e){let n=globalThis.self,r=globalThis.window,o=_r(e),i=Object.assign(kr(e),Pr(e));delete o.self,Object.defineProperties(globalThis,o),Rr(globalThis,i),typeof n>"u"||n===r&&n!==globalThis?Object.defineProperty(globalThis,"self",{value:e,configurable:!0,writable:!0,enumerable:!0}):n!==globalThis&&(Object.defineProperties(n,o),Rr(n,i))}static setGlobalThis(e){for(let n in e)e[n]===e&&(e[n]=globalThis);Object.defineProperties(globalThis,Ao(e))}};function Po(t,e){t[ft].push(e(t)??{})}function Co(t){return{createElement:ce.bind(null,t,"createElement"),setAttribute:ce.bind(null,t,"setAttribute"),removeAttribute:ce.bind(null,t,"removeAttribute"),createText:ce.bind(null,t,"createText"),setText:ce.bind(null,t,"setText"),insertChild:ce.bind(null,t,"insertChild"),removeChild:ce.bind(null,t,"removeChild"),addEventListener:ce.bind(null,t,"addEventListener"),removeEventListener:ce.bind(null,t,"removeEventListener")}}function ce(t,e,...n){for(let i of t[ft])i[e]?.apply(i,n);let r=t[D];r[e]?.apply(r,n)}var tn=new Re;var Dn="~";var Ee=new WeakMap;function Fe(t){return Ee.get(t)}var Un=new WeakMap,Mo=0;function $(t){let e=Un.get(t);return e==null&&(e=String(Mo++),nn(t,e)),e}function nn(t,e){Un.set(t,e)}var Gn=new WeakMap;function Do(t){return Gn.get(t)}var Hn=new WeakMap;function Lo(t){let e=Hn.get(t);if(e!=null)return e;if(!(!(t instanceof Element)||t.tagName.includes("-"))){e={};for(let{name:n,value:r}of t.attributes)e[n]=r;return e}}var Go=new WeakMap;function Ho(t){return Go.get(t)}function Bn(t,e,n){let r=Gn.get(t);if(r==null&&(r={},Gn.set(t,r)),r[e]===n)return;r[e]=n;let o=Ee.get(t);o?.mutate([[3,$(t),e,n,1]])}function Ne(t,e,n){let r=Hn.get(t);if(r==null&&(r={},Hn.set(t,r)),r[e]===n)return;n==null?delete r[e]:r[e]=String(n);let o=Ee.get(t);o?.mutate([[3,$(t),e,n,2]])}function je(t,e){if(Ee.get(t)!==e&&(Ee.set(t,e),t.childNodes))for(let r=0;r<t.childNodes.length;r++)je(t.childNodes[r],e)}function rn(t){if(Ee.get(t)!=null&&(Ee.delete(t),t.childNodes))for(let n=0;n<t.childNodes.length;n++)rn(t.childNodes[n])}function qe(t){let{nodeType:e}=t;switch(e){case 1:return{id:$(t),type:e,element:t.localName,properties:Ln(Do(t)),attributes:Ln(Lo(t)),eventListeners:Ln(Ho(t)),children:Array.from(t.childNodes).map(qe)};case 3:case 8:return{id:$(t),type:e,data:t.data};default:throw new Error(`Cannot serialize node of type ${t.nodeType} (${typeof t.nodeType})`)}}function Ln(t){return t?{...t}:void 0}function Vn(t,e,...n){let r=Un.get(t),o=Ee.get(t);if(r==null||o==null)throw new Error(`Cannot call method ${e} on an unconnected node`);return o.call(r,e,...n)}var Ye=tn[D];Ye.insertChild=(t,e,n)=>{let r=Fe(t);r!=null&&(je(e,r),r.mutate([[0,$(t),qe(e),n]]))};Ye.removeChild=(t,e,n)=>{let r=Fe(t);r!=null&&(rn(e),r.mutate([[1,$(t),n]]))};Ye.setText=(t,e)=>{let n=Fe(t);n?.mutate([[2,$(t),e]])};Ye.setAttribute=(t,e,n)=>{t.tagName.includes("-")||Ne(t,e,n)};Ye.removeAttribute=(t,e)=>{t.tagName.includes("-")||Ne(t,e)};Re.setGlobal(tn);function on(t){if(typeof t=="string")return{type:"navigate",to:t};let{place:e,record:n,where:r,section:o}=t??{},i={...r===void 0?{}:{where:r},...o===void 0?{}:{section:String(o)}};return typeof e=="string"?{type:"navigate",place:e,...i}:typeof n=="string"?{type:"navigate",to:n,...i}:void 0}var Ir=["wheel","drag","pinch"];function Mr(t){let e=t;return typeof t=="object"&&t!==null&&e.graview==="host-hello"&&typeof e.nonce=="string"}function Lr(t,e={}){let n,r="",o,i=0,s=new Set,a=new Map,c=[],u=E=>{n?n.postMessage({...E,nonce:r}):c.push(E)},m=E=>{let N=E.data;if(!(!N||typeof N!="object")){if(N.type==="props"){o=N.props;for(let C of s)C(N.props)}else N.type==="answer"?(a.get(N.id)?.(N),a.delete(N.id)):N.type==="event"&&typeof N.listener=="number"?e.onEvent?.(N):N.type==="heartbeat"&&typeof N.beat=="number"&&u({type:"heartbeat",beat:N.beat});e.onMessage?.(N)}},h=()=>{},g=E=>{if(n||!t.fromHost(E)||!Mr(E.data)||E.data.protocol!==1)return;let N=E.ports[0];if(N){n=N,r=E.data.nonce,n.onmessage=m,n.start?.(),h();for(let C of c.splice(0))u(C)}};h=t.listen(g),t.ready({graview:"guest-ready",protocol:1});let y,O={get props(){return o},subscribe(E){return s.add(E),()=>s.delete(E)},act(E,N={}){let C=i+=1;return new Promise(L=>{a.set(C,L),u({type:"act",id:C,name:E,args:N})})},navigate(E){let N=on(E);N&&u(N)},size(E){u({type:"size",height:E})},autoSize(E){let N=E??globalThis.document?.documentElement,C=globalThis.ResizeObserver;if(!N||!C||typeof N.getBoundingClientRect!="function")return()=>{};y?.disconnect();let L=new C(()=>O.size(Math.ceil(N.getBoundingClientRect().height)));return L.observe(N),y=L,()=>L.disconnect()},close(){y?.disconnect(),h(),n?.close(),s.clear()}};return{guest:O,send:u}}var Hr=["globalThis","Infinity","NaN","undefined","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape","Object","Function","Array","Number","Boolean","String","Symbol","BigInt","Date","Promise","RegExp","Math","JSON","Reflect","Proxy","Intl","Error","AggregateError","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","SuppressedError","Map","Set","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Iterator","AsyncIterator","DisposableStack","AsyncDisposableStack","ArrayBuffer","SharedArrayBuffer","DataView","Atomics","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float16Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],Ur=["window","parent","top","document","customElements","Event","ErrorEvent","PromiseRejectionEvent","ToggleEvent","FocusEvent","ClipboardEvent","CustomEvent","EventTarget","Node","ParentNode","ChildNode","DocumentFragment","Document","CharacterData","Comment","Text","Element","HTMLElement","SVGElement","HTMLTemplateElement","MutationObserver"],Br=["self","postMessage","setTimeout","clearTimeout","setInterval","clearInterval","queueMicrotask","structuredClone","crypto","console","DOMException"],Vr=["TEMPORARY","PERSISTENT"],gl=Object.freeze([...Hr,...Ur,...Br,...Vr]),yl=Object.freeze(["constructor","__defineGetter__","__defineSetter__","hasOwnProperty","__lookupGetter__","__lookupSetter__","isPrototypeOf","propertyIsEnumerable","toString","valueOf","__proto__","toLocaleString"]),Gr=t=>typeof t=="symbol"?`[${t.description??"symbol"}]`:t;function zr(t=globalThis,e=[],n={}){let r=[],o=[],i=new Set([...Hr,...Ur,...Br,...e,"constructor",Symbol.toStringTag]),s=(x,k)=>{let j=Reflect.getOwnPropertyDescriptor(x,k);return j===void 0||!("value"in j)||j.writable||j.configurable?!1:n.primitivesStay&&typeof k=="symbol"&&(typeof j.value!="object"||j.value===null)&&typeof j.value!="function"?!0:Vr.includes(k)&&typeof j.value=="number"},a=t,c=a.setTimeout,u=a.setInterval,m=a.crypto,h=(x,k)=>function(j,We,...mt){if(typeof j!="function")throw new TypeError(`${k} takes a function: a guest view cannot run code from text`);return x.call(t,j,We,...mt)},g=m?Object.freeze({getRandomValues:x=>m.getRandomValues(x)}):void 0,y=a.document?.defaultView;if(y&&y!==a)for(let x of Reflect.ownKeys(y))typeof x=="symbol"||i.has(x)||Reflect.deleteProperty(y,x)||o.push(`window.${x}`);let O=[];for(let x=t;x&&x!==Object.prototype;x=Object.getPrototypeOf(x))O.push(x);for(let x of O)for(let k of Reflect.ownKeys(x))i.has(k)||(Reflect.deleteProperty(x,k)?r.push(Gr(k)):s(x,k)||o.push(Gr(k)));let E=()=>function(){throw new EvalError("A guest view cannot make code from text.")},N=[Function.prototype,Object.getPrototypeOf(async function(){}),Object.getPrototypeOf(function*(){}),Object.getPrototypeOf(async function*(){})];for(let x of N){let k=E();Object.defineProperty(k,"prototype",{value:x,writable:!1,enumerable:!1,configurable:!1}),Reflect.defineProperty(x,"constructor",{value:k,writable:!1,enumerable:!1,configurable:!1})||o.push("Function.prototype.constructor"),x===Function.prototype&&Reflect.defineProperty(t,"Function",{value:k,writable:!0,enumerable:!1,configurable:!0})}let C=(x,k)=>{Reflect.defineProperty(t,x,{value:k,writable:!0,enumerable:!0,configurable:!0})||o.push(x)};C("setTimeout",h(c,"setTimeout")),C("setInterval",h(u,"setInterval")),g&&C("crypto",g);for(let x of O.slice(1))Object.freeze(x);for(let x of Reflect.ownKeys(t)){let k=Reflect.getOwnPropertyDescriptor(t,x);Reflect.defineProperty(t,x,"value"in k?{...k,writable:!1,configurable:!1}:{...k,configurable:!1})}let L;try{L=Reflect.preventExtensions(t)}catch{L=!1}return{removed:r,stuck:o,sealed:L}}var dt=class extends HTMLElement{constructor(){super(),nn(this,Dn)}connect(e){if(Fe(this)===e||(je(this,e),this.childNodes.length===0))return;let n=[];for(let r=0;r<this.childNodes.length;r++){let o=this.childNodes[r];n.push([0,Dn,qe(o),r])}e.mutate(n)}updateRemoteProperty(e,n){Bn(this,e,n)}callRemoteMethod(e,...n){return Vn(this,e,...n)}};var d={},sn={empty:!0},Uo={id:"text",class:"text",title:"text",lang:"text",dir:{oneOf:["ltr","rtl","auto"]},hidden:"text",tabindex:{oneOf:["-1","0"]},role:"text",style:"style",translate:{oneOf:["yes","no"]},spellcheck:{oneOf:["true","false"]},draggable:{oneOf:["true","false"]},inert:"boolean"},zn={div:d,section:d,article:d,aside:d,header:d,footer:d,nav:d,hgroup:d,search:d,address:d,figure:d,figcaption:d,blockquote:d,p:d,pre:d,hr:sn,br:sn,wbr:sn,h1:d,h2:d,h3:d,h4:d,h5:d,h6:d,span:d,strong:d,em:d,b:d,i:d,u:d,s:d,small:d,mark:d,abbr:d,cite:d,q:d,code:d,kbd:d,samp:d,var:d,sub:d,sup:d,dfn:d,bdi:d,bdo:d,ruby:d,rt:d,rp:d,time:{attributes:{datetime:"text"}},data:{attributes:{value:"text"}},del:{attributes:{datetime:"text"}},ins:{attributes:{datetime:"text"}},a:{attributes:{href:"link"}},ul:d,menu:d,dl:d,dt:d,dd:d,ol:{attributes:{start:"number",reversed:"boolean",type:{oneOf:["1","a","A","i","I"]}}},li:{attributes:{value:"number"}},table:d,caption:d,thead:d,tbody:d,tfoot:d,tr:d,colgroup:{attributes:{span:"number"}},col:{attributes:{span:"number"},empty:!0},th:{attributes:{colspan:"number",rowspan:"number",headers:"text",scope:{oneOf:["row","col","rowgroup","colgroup"]},abbr:"text"}},td:{attributes:{colspan:"number",rowspan:"number",headers:"text"}},details:{attributes:{open:"boolean",name:"text"}},summary:d,button:{attributes:{type:{oneOf:["button"]},disabled:"boolean",name:"text",value:"text"}},input:{empty:!0,attributes:{type:{oneOf:["text","search","number","range","checkbox","radio","date","time","datetime-local","month","week","color","email","tel","url"]},name:"text",value:"text",placeholder:"text",min:"text",max:"text",step:"text",checked:"boolean",disabled:"boolean",readonly:"boolean",required:"boolean",maxlength:"number",minlength:"number",size:"number",pattern:"text",multiple:"boolean",inputmode:"text",enterkeyhint:"text"}},select:{attributes:{name:"text",disabled:"boolean",multiple:"boolean",required:"boolean",size:"number"}},option:{attributes:{value:"text",selected:"boolean",disabled:"boolean",label:"text"}},optgroup:{attributes:{label:"text",disabled:"boolean"}},textarea:{attributes:{name:"text",placeholder:"text",rows:"number",cols:"number",disabled:"boolean",readonly:"boolean",required:"boolean",maxlength:"number",minlength:"number",wrap:{oneOf:["soft","hard","off"]}}},label:{attributes:{for:"text"}},fieldset:{attributes:{disabled:"boolean",name:"text"}},legend:d,output:d,meter:{attributes:{value:"number",min:"number",max:"number",low:"number",high:"number",optimum:"number"}},progress:{attributes:{value:"number",max:"number"}},img:{empty:!0,attributes:{src:"image",alt:"text",width:"number",height:"number",decoding:{oneOf:["async","sync","auto"]}}},"graview-video":sn},Bo=["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","stroke-opacity","stroke-miterlimit","opacity","color","display","visibility","transform-origin","clip-path","clip-rule","marker-start","marker-mid","marker-end","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","alignment-baseline","letter-spacing","text-decoration","paint-order","vector-effect","shape-rendering","pointer-events","stop-color","stop-opacity","overflow","mask","filter","flood-color","flood-opacity","lighting-color","color-interpolation-filters"],Vo={id:"text",class:"text",style:"style",lang:"text",role:"text",tabindex:{oneOf:["-1","0"]},transform:"geometry",...Object.fromEntries(Bo.map(t=>[t,"css"]))},ue={x:"geometry",y:"geometry",width:"geometry",height:"geometry"},an={viewBox:"geometry",preserveAspectRatio:"geometry"},Fr={oneOf:["userSpaceOnUse","objectBoundingBox"]},jr={oneOf:["R","G","B","A"]},ne={...ue,in:"text",result:"text"},qr={gradientUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},gradientTransform:"geometry",spreadMethod:{oneOf:["pad","reflect","repeat"]},href:"fragment"},Yr={svg:{attributes:{...ue,...an}},g:d,defs:d,symbol:{attributes:{...ue,...an,refX:"geometry",refY:"geometry"}},use:{attributes:{...ue,href:"fragment"}},title:d,desc:d,path:{attributes:{d:"geometry",pathLength:"number"}},rect:{attributes:{...ue,rx:"geometry",ry:"geometry",pathLength:"number"}},circle:{attributes:{cx:"geometry",cy:"geometry",r:"geometry",pathLength:"number"}},ellipse:{attributes:{cx:"geometry",cy:"geometry",rx:"geometry",ry:"geometry",pathLength:"number"}},line:{attributes:{x1:"geometry",y1:"geometry",x2:"geometry",y2:"geometry",pathLength:"number"}},polyline:{attributes:{points:"geometry",pathLength:"number"}},polygon:{attributes:{points:"geometry",pathLength:"number"}},text:{attributes:{x:"geometry",y:"geometry",dx:"geometry",dy:"geometry",rotate:"geometry",textLength:"geometry",lengthAdjust:{oneOf:["spacing","spacingAndGlyphs"]}}},tspan:{attributes:{x:"geometry",y:"geometry",dx:"geometry",dy:"geometry",rotate:"geometry",textLength:"geometry"}},textPath:{attributes:{href:"fragment",startOffset:"geometry",method:{oneOf:["align","stretch"]},spacing:{oneOf:["auto","exact"]},side:{oneOf:["left","right"]}}},linearGradient:{attributes:{x1:"geometry",y1:"geometry",x2:"geometry",y2:"geometry",...qr}},radialGradient:{attributes:{cx:"geometry",cy:"geometry",r:"geometry",fx:"geometry",fy:"geometry",fr:"geometry",...qr}},stop:{attributes:{offset:"geometry"}},clipPath:{attributes:{clipPathUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]}}},mask:{attributes:{...ue,maskUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},maskContentUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]}}},pattern:{attributes:{...ue,...an,patternUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},patternContentUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},patternTransform:"geometry",href:"fragment"}},marker:{attributes:{...an,markerWidth:"geometry",markerHeight:"geometry",refX:"geometry",refY:"geometry",orient:"geometry",markerUnits:{oneOf:["strokeWidth","userSpaceOnUse"]}}},a:d,filter:{attributes:{...ue,filterUnits:Fr,primitiveUnits:Fr}},feBlend:{attributes:{...ne,in2:"text",mode:"text"}},feColorMatrix:{attributes:{...ne,type:{oneOf:["matrix","saturate","hueRotate","luminanceToAlpha"]},values:"geometry"}},feComponentTransfer:{attributes:ne},...Object.fromEntries(["feFuncR","feFuncG","feFuncB","feFuncA"].map(t=>[t,{attributes:{type:{oneOf:["identity","table","discrete","linear","gamma"]},tableValues:"geometry",slope:"number",intercept:"number",amplitude:"number",exponent:"number",offset:"number"}}])),feComposite:{attributes:{...ne,in2:"text",operator:{oneOf:["over","in","out","atop","xor","lighter","arithmetic"]},k1:"number",k2:"number",k3:"number",k4:"number"}},feDisplacementMap:{attributes:{...ne,in2:"text",scale:"number",xChannelSelector:jr,yChannelSelector:jr}},feDropShadow:{attributes:{...ne,dx:"number",dy:"number",stdDeviation:"geometry"}},feFlood:{attributes:ne},feGaussianBlur:{attributes:{...ne,stdDeviation:"geometry",edgeMode:{oneOf:["duplicate","wrap","none"]}}},feMerge:{attributes:ne},feMergeNode:{attributes:{in:"text"}},feMorphology:{attributes:{...ne,operator:{oneOf:["erode","dilate"]},radius:"geometry"}},feOffset:{attributes:{...ne,dx:"number",dy:"number"}},feTurbulence:{attributes:{...ue,result:"text",type:{oneOf:["fractalNoise","turbulence"]},baseFrequency:"geometry",numOctaves:"number",seed:"number",stitchTiles:{oneOf:["stitch","noStitch"]}}}};var Wr={section:["aria-label","title"]};function zo(t){return/^aria-[a-z]+$/.test(t)}function Fo(t){return/^data-[a-z0-9][a-z0-9_.-]*$/.test(t)}var jo=new Map(Object.keys(Yr).map(t=>[t.toLowerCase(),t]));function Xr(t){return jo.get(t.toLowerCase())}function $r(t,e,n){let r=n.toLowerCase(),o=t==="html"?[zn[e]?.attributes,Uo]:[Yr[e]?.attributes,Vo],i=t==="svg"&&r==="xlink:href"?"href":r;for(let s of o)if(s){for(let[a,c]of Object.entries(s))if(a.toLowerCase()===i)return{name:a,kind:c}}if(zo(r)||Fo(r))return{name:r,kind:"text"}}var Kr="~",ln=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ie=(t,e=0)=>{if(t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===void 0)return t;if(!(e>64||typeof t!="object"))return Array.isArray(t)?t.map(n=>ie(n,e+1)):Object.fromEntries(Object.entries(t).map(([n,r])=>[n,ie(r,e+1)]))};function Zr(){let t=new Map,e=new Map,n=new Map([[Kr,{children:[],listeners:new Map}]]),r=0,o=u=>{let m=e.get(u);return m===void 0&&(m=r+=1,e.set(u,m),t.set(m,{listener:u,count:0})),t.get(m).count+=1,m},i=u=>{let m=t.get(u);m&&(m.count-=1,!(m.count>0)&&(t.delete(u),e.delete(m.listener)))},s=u=>{let m=n.get(u);if(m){n.delete(u);for(let h of m.listeners.values())i(h);for(let h of m.children)s(h)}},a=(u,m,h=0)=>{if(!ln(u)||h>64)return ie(u);let g=typeof u.id=="string"?u.id:void 0,y=m&&g!==void 0&&g!==Kr;y&&s(g);let O={children:[],listeners:new Map};y&&n.set(g,O);let E={};for(let[N,C]of Object.entries(u))N==="children"&&Array.isArray(C)?E[N]=C.map(L=>{let x=a(L,y,h+1);return y&&ln(L)&&typeof L.id=="string"&&O.children.push(L.id),x}):N==="eventListeners"&&ln(C)?E[N]=Object.fromEntries(Object.entries(C).map(([L,x])=>{if(typeof x!="function"||!y)return[L,void 0];let k=o(x);return O.listeners.set(L,k),[L,{listener:k}]})):E[N]=ie(C,h+1);return E},c=u=>{if(!Array.isArray(u))return ie(u);let[m,h]=u,g=typeof h=="string"?n.get(h):void 0;if(m===0){let y=a(u[2],g!==void 0),O=ln(u[2])?u[2].id:void 0;if(g&&typeof O=="string"&&n.has(O)){let E=Number(u[3]);g.children.splice(Number.isInteger(E)&&E>=0&&E<=g.children.length?E:g.children.length,0,O)}return[m,ie(h),y,ie(u[3])]}if(m===1){let y=Number(u[2]);return g&&Number.isInteger(y)&&y>=0&&y<g.children.length&&s(g.children.splice(y,1)[0]),ie(u)}if(m===3&&u[4]===3){let y=String(u[2]),O=u[3],E=g&&typeof O=="function"?o(O):void 0,N=g?.listeners.get(y);return N!==void 0&&i(N),E===void 0?g?.listeners.delete(y):g.listeners.set(y,E),[m,ie(h),y,E===void 0?void 0:{listener:E},3]}return ie(u)};return{encode:u=>u.map(c),listener:u=>t.get(u)?.listener,get listening(){return t.size},get nodes(){return n.size-1}}}var cn="graview-view-root",qo=["value","checked","key","pressed","files","refused","x","y","width","height","deltaX","deltaY","deltaMode","ctrlKey","metaKey","phase","pointerId","button","pressure","dx","dy","scale","rotation"],Yo=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/\'/g,"&#39;"),Wo=t=>Object.freeze({html:t,toString:()=>t}),Qr=t=>typeof t=="object"&&t!==null&&typeof t.html=="string"&&Object.isFrozen(t),Jr=t=>t==null||t===!1?"":Array.isArray(t)?t.map(Jr).join(""):Qr(t)?t.html:Yo(String(t));function eo(t){customElements.get(cn)||customElements.define(cn,dt);let e=Event,n=Zr(),r=new Set,o=new Set,i,s=[],a=new Set;for(let l of["closest","matches","dataset"]){let f=()=>{throw new TypeError(`A view\'s element has no ${l}: graview.on hands event.element, the element its selector matched; read event.element.getAttribute("data-\\u2026").`)};l in Element.prototype||Object.defineProperty(Element.prototype,l,l==="dataset"?{get:f}:{value:f})}let c=document.createElement(cn),u=l=>{let f=b=>{for(let w of Array.from(b.childNodes)){if(w.nodeType!==1)continue;if($(w)===l)return w;let T=f(w);if(T)return T}};return f(c)},m=l=>{let f=u(l.target);if(!f)return;let b=new e(l.event,{bubbles:!0}),w={};for(let T of qo)l[T]!==void 0&&(w[T]=l[T]);for(let T of Object.keys(w))Object.defineProperty(b,T,{value:w[T],enumerable:!0});f.dispatchEvent(b);for(let T of o){if(T.type!==l.event)continue;let _;try{_=new Set(Array.from(c.querySelectorAll(T.selector)))}catch{continue}for(let z=f;z&&z!==c;z=z.parentNode)if(_.has(z)){T.listener(Object.freeze({type:l.event,target:f,element:z,...w}));break}}},h=l=>{if(l.type==="dom-event"&&typeof l.target=="string")return m(l);if(l.type==="notice")return t.warn(l.text);if(l.type!=="props")return;i=l.props;let f=t.now();for(let T of r)try{T(l.props)}catch(_){t.threw(_)}let b=t.now()-f,w=l.push;typeof w=="number"&&t.microtask(()=>t.microtask(()=>t.send({type:"pushed",push:w,ms:b})))},g;c.connect({mutate(l){g||(g=[],t.microtask(()=>{let f=g??[];g=void 0,t.send({type:"render",records:n.encode(f)})})),g.push(...l)},call:()=>{}});let y=l=>l.nodeType===1?l.getAttribute("data-key")??l.getAttribute("id"):null,O=(l,f)=>l.nodeType===f.nodeType&&(l.nodeType!==1||l.localName===f.localName&&l.namespaceURI===f.namespaceURI&&y(l)===y(f));function E(l,f){let b=Array.from(f.childNodes),w=0;for(let T of b){let _=l.childNodes[w]??null;if(_&&O(_,T)){N(_,T),w+=1;continue}if(y(T)!==null){let de=Array.from(l.childNodes).slice(w+1).find(Xe=>O(Xe,T));if(de){l.insertBefore(de,_),N(de,T),w+=1;continue}}l.insertBefore(T,_),w+=1}for(;l.childNodes.length>w;)l.removeChild(l.lastChild)}function N(l,f){if(l.nodeType!==1){l.data!==f.data&&(l.data=f.data);return}let b=l,w=f,T=C(b);for(let _ of b.getAttributeNames())w.hasAttribute(_)||(b.removeAttribute(_),T&&Ne(b,_,void 0));for(let _ of w.getAttributeNames()){let z=w.getAttribute(_);b.getAttribute(_)!==z&&b.setAttribute(_,z),T&&Ne(b,_,z)}E(b,w)}let C=l=>l.localName.includes("-");function L(l){for(let f of Array.from(l.childNodes)){if(f.nodeType!==1)continue;let b=f;if(C(b))for(let w of b.getAttributeNames())Ne(b,w,b.getAttribute(w)??void 0);L(b)}}function x(l,f,b){for(let w of Array.from(l.childNodes)){if(w.nodeType!==1)continue;let T=w,_=T.localName,z=f||_.toLowerCase()==="svg",de=z?Xr(_):Object.prototype.hasOwnProperty.call(zn,_.toLowerCase())?_.toLowerCase():void 0;if(!de){b.add(`<${_}>`);continue}for(let Xe of T.getAttributeNames())(!$r(z?"svg":"html",de,Xe)||!z&&Wr[de]?.includes(Xe.toLowerCase()))&&b.add(`${de} ${Xe}`);x(T,z,b)}}function k(l){let f=document.createElement("div"),b=Array.isArray(l)?l:[l];for(let T of b)if(T!=null)if(typeof T=="string"||Qr(T)){let _=document.createElement("div");_.innerHTML=typeof T=="string"?T:T.html,f.append(...Array.from(_.childNodes))}else f.append(T);let w=new Set;x(f,!1,w),s=[...w],s.length>0&&t.warn(`The host will not draw: ${s.join(", ")}`),L(f),E(c,f)}let j=[],We=new Set(Ir),mt="[]",un=!1,Yn=()=>{un||(un=!0,t.microtask(()=>{un=!1;let l=[...new Map([...o].filter(b=>We.has(b.type)).map(b=>[`${b.type} ${b.selector}`,{event:b.type,selector:b.selector}])).entries()].sort(([b],[w])=>b<w?-1:b>w?1:0).map(([,b])=>b),f=JSON.stringify(l);f!==mt&&(mt=f,t.send({type:"gestures",bound:l}))}))},Wn="[]",dn=!1,Xn=()=>{dn||(dn=!0,t.microtask(()=>{dn=!1;let l=[...new Set([...o].filter(b=>b.type==="click"&&typeof b.selector=="string").map(b=>b.selector))].sort().slice(0,200),f=JSON.stringify(l);f!==Wn&&(Wn=f,t.send({type:"clicks",selectors:l}))}))};return{view:Object.freeze({get props(){return i},onProps(l){return r.add(l),i&&l(i),()=>void r.delete(l)},render:k,style(l){typeof l!="string"||j.includes(l)||(j.push(l),t.send({type:"style",sheets:[...j]}))},on(l,f,b){let w={type:l,selector:f,listener:b};return o.add(w),typeof l=="string"&&!a.has(l)&&(a.add(l),t.send({type:"hears",events:[l]})),We.has(l)&&Yn(),l==="click"&&Xn(),()=>{o.delete(w),We.has(l)&&Yn(),l==="click"&&Xn()}},act:(l,f={})=>t.act(l,f),navigate(l){if(typeof l=="string")return t.navigate(l);let f=on(l);f&&t.send(f)},html(l,...f){return Wo(l.reduce((b,w,T)=>b+w+(T<f.length?Jr(f[T]):""),""))},get refused(){return s},get hardening(){return t.hardening()}}),hear:h,find:l=>{try{let f=c.querySelectorAll(l)[0];return f?$(f):void 0}catch{return}},listened:l=>{let f=new Set;for(let b of o)if(b.type===l)try{for(let w of Array.from(c.querySelectorAll(b.selector))){let T=$(w);T&&f.add(T)}}catch{}return[...f]}}}var qn={removed:[],stuck:[],sealed:!1,worker:!1},Fn=Lr({listen(t){return _e.listen(t),()=>_e.unlisten(t)},fromHost:()=>!0,ready:t=>_e.post(t)},{onMessage:t=>to.hear(t)}),to=eo({send:t=>Fn.send(t),act:(t,e)=>Fn.guest.act(t,e),navigate:t=>Fn.guest.navigate(t),microtask:_e.microtask,now:_e.now,threw:t=>console.error(t),warn:t=>console.warn(t),hardening:()=>qn}),Xo=to.view;Object.defineProperty(globalThis,"graview",{value:Xo,enumerable:!0,configurable:!0,writable:!1});var jn="WorkerGlobalScope"in globalThis?zr(globalThis,["graview"]):qn;qn=jn;if(jn.stuck.length>0)throw new Error(`The view\'s worker could not be hardened: ${jn.stuck.join(", ")} would not go.`);})();\n';export{e as VIEW_RUNTIME};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk.IHBUBZQT.js";import"./chunk.67U6M7OV.js";import"./chunk.GLWSVSQL.js";import"./chunk.7VKSXGTX.js";import"./chunk.TY4GQJKC.js";import"./chunk.6ZQAR5ZA.js";import"./chunk.W3W54DSX.js";import"./chunk.PI44XMY2.js";import"./chunk.KGW75Z5L.js";import"./chunk.UITT6JWW.js";import"./chunk.A5PDXNY6.js";import"./chunk.VSCIXAHN.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{g as columnActs,d as columnChoices,c as columnMoves,b as columnOf,e as columnReach,f as columnSteps,j as describePlace,k as placeText,h as resolveFor,i as shadowedPageSlots,a as statusColumns};
@@ -1 +0,0 @@
1
- import{K as k,O as I,R as M,V as A,Y as R,hb as j,ib as f,ma as P,mc as T,pc as N,vb as B,vc as K,yc as b}from"./chunk.VSCIXAHN.js";import{j as h}from"./chunk.FQLNBIQ5.js";var O=(e,i)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(i),L=(e,i,n)=>(e??[]).some(t=>t.suggestion===i&&(t.until===void 0||Date.parse(t.until)>Date.parse(n)));function $(e,i=()=>!0,n={}){let t=T(e),o=new Set(e.map(r=>r.lineage?.suggestion)),s=n.now??new Date().toISOString();return e.filter(r=>r.suggests&&!r.withheld&&!t.has(r.id)&&!o.has(r.id)&&!O(r,s)&&!L(n.dismissed,r.id,s)).map(({id:r,batch:g,suggests:p,intent:c,author:a,lineage:d,at:l,expiresAt:y})=>{let u=new Set;return JSON.stringify(p.map(D=>D.args),(D,x)=>(typeof x=="string"&&i(x)&&u.add(x),x)),{id:r,batch:g,calls:p,intent:c,author:a,...d?{lineage:d}:{},at:l,expiresAt:y,about:[...u]}})}function W(e,i){return e.ops.length>0&&e.ops.every(n=>n.suggests!==void 0||n.undoes!==void 0&&i(n.undoes)?.suggests!==void 0)}var v=e=>[...e].length;function F(e){let i,n=0,t=0;for(let o of e.ops){let s=o.mutation?.name===B&&o.withheld!==!0&&o.undoes===void 0?o.mutation.args:void 0;if(typeof s?.node!="string"||typeof s.field!="string"||i&&(i.node!==s.node||i.field!==s.field))return;i={node:s.node,field:s.field};for(let r of o.primitives)r.op==="splice-text"?(n+=v(r.inserted),t+=v(r.removed)):r.op==="patch-node"&&typeof r.after[s.field]=="string"&&(n+=v(r.after[s.field]))}return i&&{...i,inserted:n,removed:t}}function V(e,i,n){let t=n.getNode(e.node)?.kind,o=[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]];return`Wrote in ${P(t?i.tryDefinition(t):void 0,e.field)} (${o.join(" ")})`}var m=e=>JSON.stringify([e.kind,e.id??"",e.name??""]),_=e=>e.ops.find(i=>i.lineage?.run!==void 0)?.lineage?.run;function J(e,i=()=>{}){let n=[];for(let t of e){if(W(t,i))continue;if(!K(t.author)){let a=F(t),d=n.at(-1),l=a&&d&&"batch"in d&&m(d.batch.author)===m(t.author)&&d.typed?.node===a.node&&d.typed.field===a.field?d.typed:void 0;l?n[n.length-1]={batch:t,typed:{...l,batches:[...l.batches,t],inserted:l.inserted+a.inserted,removed:l.removed+a.removed}}:n.push(a?{batch:t,typed:{batches:[t],...a}}:{batch:t});continue}let o=_(t),s=m(t.author),r=o!==void 0?n.findIndex(a=>"digest"in a&&a.digest.run===o&&m(a.digest.author)===s):n.length-1,g=n[r],p=g!==void 0&&"digest"in g&&m(g.digest.author)===s&&g.digest.run===o?g.digest:void 0,c=[...p?.batches??[],t];p&&n.splice(r,1),n.push({digest:{author:t.author,batches:c,things:Y(c),at:t.at,...o!==void 0?{run:o}:{}}})}return n}var Y=e=>e.reduce((i,n)=>i+(n.undone?0:n.ops.length),0),q=e=>{let i=Date.parse(e);if(Number.isNaN(i))return!1;let{minutes:n}=M(i,I());return n<6*60||n>=21*60};function z(e,i=A(new Date().toISOString())??k()){let n=A(e.at)??e.at.slice(0,10),o=e.run!==void 0&&n===i&&[e.at,...(e.batches??[]).map(s=>s.at)].every(q)?"overnight":n===i?"today":`on ${R(n)}`;return`Tidied ${e.things===1?"one thing":`${e.things} things`} ${o}`}var S=e=>e,w=(e,i)=>i===void 0?{}:{[e]:i};function de(e,i,n){let t=h(e)?.store??e,o=S(t),s=N(n.lineage);if(s===void 0)throw new f("A suggestion says what it is based on: { basis, confidence? }");let r=n.author??o.by;if(n.expiresAt!==void 0&&Number.isNaN(Date.parse(n.expiresAt)))throw new f(`A suggestion expires at a time: "${n.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let g=o.actMeanings(),p=b(i,g),c=C(t).find(u=>b(u.calls,g)===p);if(c)return t.log.get(c.id);o.refuseDeclined(i,r);let a=o.rehearsal();a.suggesting=!0;let d=a.applying(i,{author:r,lineage:s,...w("via",n.via)});if(d.ops.length===0)return;let l=[...new Set(d.ops.flatMap(u=>u.described??[]))],y={id:o.nextId(),seq:t.log.length,batch:o.mintBatch("batch"),author:r,intent:d.ops.map(u=>u.intent).join("; "),...w("batchIntent",n.intent),mutation:null,primitives:[],reads:[],writes:[],...l.length>0?{described:l}:{},at:o.now(),...w("via",n.via),lineage:s,suggests:i,...w("expiresAt",n.expiresAt)};return t.log.append(y),t.notify(j,[y]),y}function C(e,i,n={}){let t=h(e),o=t?.store??e,s=i??t?.principal,r=(s!==void 0?o.seenBy(s):o).log.all();return $(r,g=>o.graph.has(g),{now:S(o).now(),dismissed:n.dismissed})}function E(e,i,n){let t=C(e,n).find(s=>s.id===i),o=t?void 0:e.log.get(i);if(o?.suggests&&O(o,S(e).now()))throw new f(`That suggestion expired on ${o.expiresAt.slice(0,10)}.`);if(!t)throw new f("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return t}function ge(e,i,n={}){let t=h(e)?.store??e,o=n.author??S(t).by,s=E(t,i,o);return t.applyAll(s.calls,{...n,author:o,lineage:{...s.lineage,suggestion:i}})}function le(e,i,n={}){let t=h(e)?.store??e,o=n.author??S(t).by,s=E(t,i,o);return t.undo(s.batch,{...n,author:o})}export{V as a,J as b,z as c,de as d,C as e,ge as f,le as g};
@@ -1 +0,0 @@
1
- function o(e){return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-|-$/g,"")}function a(e,t={}){let[s="/",c=""]=e.split("#")[0].split("?"),n=new URLSearchParams(c);t.filter&&n.set("filter",t.filter);let r=n.toString(),i=t.section?o(t.section):"";return`${s}${r?`?${r}`:""}${i?`#${i}`:""}`}export{o as a,a as b};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk.LGEA5257.js";import"./chunk.G4JJXA63.js";import"./chunk.OLFJH4RK.js";import"./chunk.67U6M7OV.js";import"./chunk.6C2MHWSX.js";import"./chunk.XOZU4OFA.js";import"./chunk.GLWSVSQL.js";import"./chunk.VFOON3Z3.js";import"./chunk.WVUJXDXZ.js";import"./chunk.7VKSXGTX.js";import"./chunk.TY4GQJKC.js";import"./chunk.6ZQAR5ZA.js";import"./chunk.W3W54DSX.js";import"./chunk.PI44XMY2.js";import"./chunk.KGW75Z5L.js";import"./chunk.MSWWWLEA.js";import"./chunk.UITT6JWW.js";import"./chunk.A5PDXNY6.js";import"./chunk.VSCIXAHN.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{i as draftAnswer,h as draftFromLens,b as draftSight,l as draftView,a as isDraftFailure,c as judgeLens,d as lensEditOf,f as lensFromSpec,j as recipeDraft,g as recipeOfLens,m as refineDraft,o as runDraftTool,e as takeBackEditOf,k as templateDraft,n as withReaderLenses};
@@ -1,4 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ht,f as ht,g as vn}from"./chunk.FRYBMS3W.js";import{h as fi}from"./chunk.3MOJF7BA.js";import{e as ui,q as Un,r as hi}from"./chunk.LZIBQ3VX.js";import{b as kn}from"./chunk.QDSEVPF3.js";import{a as Be,b as jr,c as nn,d as mi,e as Vr}from"./chunk.7N32AVIJ.js";import{a as ci}from"./chunk.OLFJH4RK.js";import{a as si,b as di,c as li}from"./chunk.ZP5RT2EK.js";import{b as Jo,d as ei}from"./chunk.VZJWJ5XM.js";import{a as ti,b as Hr,c as Dr,f as $r,g as Fr,h as Wr,i as ni,j as Jt,k as en,o as Bt,p as tn,q as ii,r as ai}from"./chunk.IOK4GVJC.js";import{A as Qo,f as jo,g as Qt,h as Vo,i as Go,j as zo,k as Yo,m as Kn,n as xn,o as bn,p as Zt,q as Br,v as _o,w as Ko,x as Uo,y as Xo,z as qo}from"./chunk.OJGHDWI6.js";import{a as ri,b as oi}from"./chunk.TLJOZSDD.js";import{c as Zo}from"./chunk.A5PDXNY6.js";import{$ as _n,A as ut,B as Ar,C as gn,G as Oe,Ga as wn,Ja as Fo,K as xt,Ka as Wo,Na as Cr,Oa as Tr,Pa as Nt,Ra as Ir,T as Se,V as Yn,Va as Nr,W as Lr,_ as Pr,a as kr,aa as Tt,b as Sr,ba as pe,c as Mr,d as No,da as It,e as Bo,f as Gn,h as Pt,j as gt,k as Er,ka as qt,l as zn,m as pn,ma as Do,p as Rr,r as ke,s as Pe,sa as $o,t as Ho,u as yn,v as Ce,w as Ct,x as wt,y as Or}from"./chunk.4MP72LPR.js";import{a as Xt}from"./chunk.SDO3U72B.js";import{Ac as mn,Cd as vr,Ed as Po,Td as Co,Wd as To,_c as Fe,be as Io,da as jn,fa as Ao,ga as Kt,ia as Ut,ja as Lt,ka as Vn,oa as Lo}from"./chunk.VSCIXAHN.js";import{b as re}from"./chunk.AJZBJBMO.js";var Xn=re(Oe(),1);var pi=re(Se(),1);function qn(e){let t=(0,Xn.useRef)(e);t.current=e;let n=(0,Xn.useRef)(null),o=(0,Xn.useRef)(new Map),r=n.current;if(r&&(r.outer===e||as(r.outer,e)))return r.outer=e,r.inner;let a=ht(e.view,null),i=(u,d,s)=>{let c=o.current.get(u);return c&&c.made===d?c.call:(o.current.set(u,{made:d,call:s}),s)},l=Object.fromEntries(Object.entries(e).map(([u,d])=>[u,u==="view"?a:u==="setView"?i(u,d,is(t)):typeof d=="function"?i(u,d,(...s)=>t.current[u](...s)):d]));return n.current={outer:e,inner:l},l}function is(e){return t=>e.current.setView(typeof t=="function"?t:n=>t.pan===void 0&&n.pan?{...t,pan:n.pan}:t)}function as(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let o of n){if(o==="view"||o==="movedByHand")continue;let r=e[o],a=t[o];if(r!==a&&!(typeof r=="function"&&typeof a=="function"))return!1}return Gr(e.view,t.view)}function Gr(e,t){if(e===t)return!0;let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let o of n)if(o!=="pan"&&e[o]!==t[o])return!1;return!0}function ss({children:e}){let t=qn(pe());return(0,pi.jsx)(Yn.Provider,{value:t,children:e})}var yi={width:1200,height:760,focusSize:{width:1200,height:420},relationSize:{width:240,height:140},contextSize:{width:300,height:104},gap:16,unit:16};var gi=(e,t)=>e?`${e.edgeKind}|${e.direction}`:`raised|${t}`,Dt=(e,t,n)=>`${Ar}${e}|${t}|${n}`;function Qn(e,t){let n=e.map(()=>0),o=e.map((i,l)=>({size:i,index:l})).sort((i,l)=>i.size-l.size||i.index-l.index),r=Math.max(t,e.length),a=e.length;for(let{size:i,index:l}of o){let u=Math.max(1,Math.floor(r/a));n[l]=Math.min(i,u),r-=n[l],a-=1}return n}function Yr(e){return gi(e.via,e.node.kind)}function rn(e,t,n=[]){let o=[],r=0;return e.forEach((a,i)=>{if(a<=0)return;let l=Math.min(t,Math.max(1,n[i]??1)),u=Math.max(a,l);if(o.length>0&&a<=t&&u<=r){o[o.length-1].push({run:i,cards:a,slots:u}),r-=u;return}let d=a,s=!0;for(;d>0;){let c=Math.min(t,d),h=s?Math.max(c,l):c;o.push([{run:i,cards:c,slots:h}]),d-=c,r=t-h,s=!1}}),o}function _r(e,t,n,o=[]){let r=Qn(e,t*n);for(;rn(r,t,o).length>n;){let a=-1;if(r.forEach((i,l)=>{i>1&&(a<0||i>r[a])&&(a=l)}),a<0)break;r[a]=r[a]-1}return r}function ds(e,t,n){let o=r=>[t.chosen?.has(r.id)?0:1,t.hits?.has(r.id)?0:1,t.flagged?.has(r.id)?0:1,-(t.touched?.get(r.id)??0),-n.neighbors(r.id).length];return e.map((r,a)=>({node:r,index:a,key:o(r)})).sort((r,a)=>{for(let i=0;i<r.key.length;i++)if(r.key[i]!==a.key[i])return r.key[i]-a.key[i];return r.index-a.index}).map(r=>r.node)}var ls=5,cs=(e,t)=>{for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n];return!1};function wi(e,t,n){if(e.length===0||t<2)return;let o=e[0].kind,r={schema:n.schema,graph:n.graph,...n.today?{today:n.today}:{}},a=[];for(let l of ui(n.schema,o).groups)if(l.key!==n.exclude)if(l.buckets)for(let u of["decade","year","month"])a.push({by:l.key,bucket:u});else a.push({by:l.key});let i;return a.forEach((l,u)=>{let s=fi(e,{group:l},r).groups;if(s.length<2||s.length>t)return;let h=s.filter(x=>x.key!=="").reduce((x,f)=>x+f.nodes.length,0)/e.length;if(h<.5||s.some(x=>x.nodes.length>e.length*.75))return;let p=[-Math.round(h*100),Math.abs(s.length-ls),u];(!i||cs(p,i.score))&&(i={grouping:{by:l.by,...l.bucket?{bucket:l.bucket}:{},groups:s},score:p})}),i?.grouping}function Kr(e,t){let n=f=>({id:f.node.id,kind:f.node.kind,node:f.node,...f.via?{via:f.via}:{}});if(e.length<=t.budget)return e.map(n);let o={...t.relevance,chosen:new Set([...t.relevance?.chosen??[],...t.selection??[]])},r=new Map;for(let f of e){let y=gi(f.via,f.node.kind),v=r.get(y);v?v.push(f):r.set(y,[f])}let a=[...r.entries()].map(([f,y])=>({key:f,run:y,via:y[0].via,kinds:[...new Set(y.map(v=>v.node.kind))],members:[],whole:!1,extra:0})),i=Qn(a.map(f=>f.run.length),t.budget);a.forEach((f,y)=>f.whole=f.run.length<=i[y]);let l=a.filter(f=>!f.whole),u=a.filter(f=>f.whole).reduce((f,y)=>f+y.run.length,0),d=Math.max(l.length,t.budget-u);for(let f of l){f.members=ds(f.run.map(v=>v.node),o,t.graph);let y=d-(l.length-1);f.kinds.length>1&&f.kinds.length<=y?f.byKind=!0:f.kinds.length===1&&(f.grouping=wi(f.members,y,{schema:t.schema,graph:t.graph,...f.via?{exclude:f.via.edgeKind}:{},...t.today?{today:t.today}:{}}))}let s=f=>f.byKind?f.kinds.length:f.grouping?f.grouping.groups.length:1;for(;l.reduce((f,y)=>f+s(y),0)>d;){let f=[...l].filter(y=>s(y)>1).sort((y,v)=>s(v)-s(y))[0];if(!f)break;f.grouping=void 0,f.byKind=!1}d-=l.reduce((f,y)=>f+s(y),0);let c=f=>f.byKind?f.kinds.some(y=>t.expanded.has(Dt(y,f.key,"kind"))):f.grouping?.groups.some(y=>t.expanded.has(Dt(f.kinds[0],f.key,zr(f.grouping,y.key)))),h=l.filter(f=>!f.grouping&&!f.byKind?!0:c(f)),p=Qn(h.map(f=>f.members.length),Math.max(0,d));h.forEach((f,y)=>f.extra=d>0?p[y]:0);let x=[];for(let f of a){let{key:y,via:v}=f;if(f.whole){x.push(...f.run.map(n));continue}let k=g=>({id:g.id,kind:g.kind,node:g,...v?{via:v}:{}}),w=new Map(f.run.map((g,R)=>[g.node.id,R])),O=(g,R,P)=>{let A=[...g.slice(0,R)].sort((te,I)=>w.get(te.id)-w.get(I.id));x.push(...A.map(k));let j=g.slice(R);if(j.length===0)return;let K=j[0].kind;x.push({id:Dt(K,y,P?`more:${P}`:"more"),kind:K,...v?{via:v}:{},aggregate:{kind:K,memberIds:j.map(te=>te.id),label:R>0?`${j.length} more ${t.plural(K).toLowerCase()}`:`${j.length} ${t.plural(K).toLowerCase()}`,opens:{in:"picture",focus:Ce(K),within:P?{filter:P}:{}}}})},G=v&&t.focusId?`${v.edgeKind}:${t.focusId}`:void 0;if(f.byKind){let g=f.kinds.find(R=>t.expanded.has(Dt(R,y,"kind")));for(let R of f.kinds){let P=f.members.filter(A=>A.kind===R);if(R===g){let A=f.extra+1;P.length<=A?x.push(...P.map(k)):O(P,A-1,G);continue}x.push({id:Dt(R,y,"kind"),kind:R,...v?{via:v}:{},aggregate:{kind:R,memberIds:P.map(A=>A.id),label:t.plural(R),opens:{in:"place"}}})}continue}let $=f.grouping;if(!$){O(f.members,f.extra,G);continue}let X=f.kinds[0],T=$.groups.find(g=>t.expanded.has(Dt(X,y,zr($,g.key))));for(let g of $.groups){if(g===T){let R=f.members.filter(A=>g.nodes.includes(A)),P=f.extra+1;if(R.length<=P)x.push(...R.map(k));else{let A=g.key!==""&&!g.key.includes(",")&&!$.bucket,j=[G,A?`${$.by}:${g.key}`:void 0].filter(Boolean).join(",")||void 0;O(R,P-1,j)}continue}x.push({id:Dt(X,y,zr($,g.key)),kind:X,...v?{via:v}:{},aggregate:{kind:X,memberIds:f.members.filter(R=>g.nodes.includes(R)).map(R=>R.id),label:g.label.charAt(0).toUpperCase()+g.label.slice(1),opens:{in:"place"}}})}}return x}var zr=(e,t)=>`${e.by}${e.bucket?`:${e.bucket}`:""}=${t||"none"}`;var Zn=300,xi=12,on=8,Ur=19;var Jn=(e,t=1)=>(e.length*8.4+16)*t;function Sn(e){return e.description??`${e.direction==="in"?"\u2190":"\u2192"} ${jn(e.edgeKind).toLowerCase()}`}function Xr(e,t,n=1){let o=l=>Jn(l,n),r=new Map;for(let l of e){let u=r.get(l.key);u?u.push(l):r.set(l.key,[l])}let a=[...r.values()].map(l=>{let u=Math.min(...l.map(s=>s.top)),d=l.filter(s=>s.top-u<=xi);return{key:l[0].key,text:l[0].text,left:Math.min(...d.map(s=>s.left)),right:Math.max(...d.map(s=>s.right)),top:u}});a.sort((l,u)=>l.top-u.top||l.left-u.left);let i=a.map(l=>{let u=Math.max(l.right-l.left,Math.min(Zn,o(l.text))),d=(l.left+l.right)/2;return{left:d-u/2,right:d+u/2}});return a.map((l,u)=>{let d=a.map((w,O)=>({other:w,at:O})).filter(({other:w})=>w!==l&&Math.abs(w.top-l.top)<=xi),s=d.filter(({other:w})=>w.right<=l.left).map(({other:w,at:O})=>i[O].right+on<=(w.right+l.left)/2?i[O].right+on:(w.right+l.left+on)/2),c=d.filter(({other:w})=>w.left>=l.right).map(({other:w,at:O})=>i[O].left-on>=(l.right+w.left)/2?i[O].left-on:(l.right+w.left-on)/2),h=Math.max(t.left,...s),p=Math.min(t.right,...c),x=l.right-l.left,f=i[u].right-i[u].left,y=Math.max(x,Math.min(f,p-h)),v=(l.left+l.right)/2,k=x>=y?l.left:Math.max(h,Math.min(v-y/2,p-y));return{key:l.key,text:l.text,left:k,width:y,top:l.top}})}function vi(e,t,n,o,r=1){let a=l=>String(l).length*7.4,i=e.length*8.6+6+a(t)+14+(n>0?22+a(n):0);return{width:Math.max(i,o?184:0)*r,height:(o?38:22)*r,short:{width:i*r,height:22*r}}}function $t(e,t,n=6){return e.x<t.x+t.width+n&&t.x<e.x+e.width+n&&e.y<t.y+t.height+n&&t.y<e.y+e.height+n}var qr=(e,t,n,o)=>{let r=Math.max(e.x,Math.min(t.x,e.x+e.width)),a=Math.max(e.y,Math.min(t.y,e.y+e.height));return Math.abs(r-t.x)/n+Math.abs(a-t.y)/o<.92},Mn=4,bi=.45;function Qr(e,t,n,o={},r={}){let a={};for(let b of e)a[b.kind]=b.count;let i={x:(o.left??0)+8,y:(o.top??0)+8,width:n.width-(o.left??0)-(o.right??0)-16,height:n.height-(o.top??0)-(o.bottom??0)-16},l=r.avoid??[],u=r.tilt??.5,d=b=>b.nameplate??{width:120,height:34,short:{width:90,height:20}},s=b=>e.map(M=>{let C=b.get(M.kind);return{card:M,plot:C,center:nn(C.col+C.side/2,C.row+C.side/2,1,u)}}),c=(b,M)=>{let C=1/0,S=-1/0,B=1/0,L=-1/0;for(let{card:W,plot:Z,center:_}of b){let z=_.x*M,ee=_.y*M,q=Z.side*M/2,he=W.opened>0?d(W).width:d(W).short.width;C=Math.min(C,z-Math.max(q+(W.count>12?30:0),he/2)),S=Math.max(S,z+Math.max(q,he/2)),B=Math.min(B,ee-q*u-M*bi),L=Math.max(L,ee+q*u+Mn+d(W).short.height)}return{minX:C,maxX:S,minY:B,maxY:L}},h=b=>{let M=4,C=160;for(let S=0;S<24;S++){let B=(M+C)/2,L=c(b,B);L.maxX-L.minX<=i.width&&L.maxY-L.minY<=i.height?M=B:C=B}return M},p=b=>{let M={...r.order?{order:r.order}:{},counts:a,...r.plots?{plots:r.plots}:{},pitch:b},C=jr(t,M),S=jr(t,{...M,upright:!0}),B=h(s(C)),L=h(s(S)),W=n.height>n.width&&L>=B?S:C;return{map:W,fitted:W===S?L:B}},x=[],f=new Map,y=0,v=(b,M={x:0,y:0})=>{let C=c(x,b),S=i.x+i.width/2-(C.minX+C.maxX)/2+M.x,B=i.y+i.height/2-(C.minY+C.maxY)/2+M.y;return{originX:S,originY:B,cell:b}},k=b=>{let{originX:M,originY:C,cell:S}=b,B=x.map(({center:Z})=>Z.y),L=Math.max(...B),W=Math.min(...B);return x.map(({card:Z,plot:_,center:z})=>{let ee=M+z.x*S,q=C+z.y*S,he=_.side*S/2,ce=he*u,He=L===W?.5:(z.y-W)/(L-W);return{card:Z,plot:_,x:ee,y:q,halfW:he,halfH:ce,depth:1-He*.65}})},w=(b,M=!0)=>{let C=[];return[...b].sort((B,L)=>(L.card.weight??L.card.count)-(B.card.weight??B.card.count)||e.indexOf(B.card)-e.indexOf(L.card)).filter(B=>[d(B.card),d(B.card).short].some(L=>{let W=$(B,L),Z=(!M||W.x>=0&&W.y>=0&&W.x+W.width<=n.width&&W.y+W.height<=n.height)&&!C.some(_=>$t(W,_,4))&&!b.some(_=>_!==B&&qr(W,_,_.halfW,_.halfH))&&!l.some(_=>$t(W,_,0));return Z&&C.push(W),Z})).length},O=b=>b.card.marquee?{x:b.x-b.card.marquee.width/2,y:b.y+b.halfH+Mn+d(b.card).height,width:b.card.marquee.width,height:b.card.marquee.height}:null,G=(b,M,C)=>C.some(S=>{if(S===M)return!1;let B=O(S);return B!==null&&$t(b,B,4)}),$=(b,M,C="under")=>C==="aside"?{x:b.x+b.halfW+Mn,y:b.y-M.height/2,width:M.width,height:M.height}:C==="above"?{x:b.x-M.width/2,y:b.y-b.halfH-Mn-bi*R.cell-M.height,width:M.width,height:M.height}:{x:b.x-M.width/2,y:b.y+b.halfH+Mn,width:M.width,height:M.height},X=b=>b.some(M=>l.some(C=>qr(C,M,M.halfW,M.halfH)||$t(C,$(M,d(M.card).short),0))),T=b=>b.every(M=>{let C=$(M,d(M.card).short);return M.x-M.halfW>=0&&M.x+M.halfW<=n.width&&M.y-M.halfH>=0&&C.x>=0&&C.x+C.width<=n.width&&C.y+C.height<=n.height}),g={pitch:Be,said:-1};for(let b of[Be,Be+1,Be+2,Be+3,Be+5,Be+7]){({map:f,fitted:y}=p(b)),x=s(f);let M=w(k(v(y)));if(M>g.said&&(g={pitch:b,said:M}),M===e.length)break}(g.pitch!==Be+7||g.said!==e.length)&&({map:f,fitted:y}=p(g.pitch),x=s(f));let R=v(y);if(l.length>0&&X(k(R))){let b;for(let M=1;M>=.3&&!b;M-=.05){let C=y*M,S=Math.max(...l.map(L=>L.width))/2+C,B=Math.max(...l.map(L=>L.height))/2+C/2;for(let L of[0,.5,.75,1,1.25]){for(let[W,Z]of[[1,0],[-1,0],[0,1],[0,-1],[1,1],[-1,1],[1,-1],[-1,-1]]){let _=v(C,{x:W*S*L,y:Z*B*L}),z=k(_);if(!X(z)&&T(z)){b=_;break}if(L===0)break}if(b)break}}b&&(R=b)}let P=(b,M)=>{let C={x:n.width/2,y:n.height/2};return{cell:b.cell*M,originX:C.x+(b.originX-C.x)*M,originY:C.y+(b.originY-C.y)*M}},A=1;if(w(k(R))<e.length){let b={said:w(k(R),!1),area:1/0,pitch:-1,by:1},M={map:f,shape:x,fitted:y,where:R};for(let S of[Be,Be+1,Be+2,Be+3,Be+5,Be+7]){({map:f,fitted:y}=p(S)),x=s(f);let B=v(y);for(let L=1;L<=3.001;L+=.1){let W=w(k(P(B,L)),!1),Z=c(x,y*L),_=(Z.maxX-Z.minX)*(Z.maxY-Z.minY);if((W>b.said||W===b.said&&_<b.area)&&(b={said:W,area:_,pitch:S,by:L}),W===e.length)break}}b.pitch<0?{map:f,shape:x,fitted:y,where:R}=M:({map:f,fitted:y}=p(b.pitch),x=s(f),A=b.by,R=P(v(y),A));let C=k(R).filter(S=>r.keep?.includes(S.card.kind));if(C.length>0){let S=C.flatMap(z=>[{x:z.x-z.halfW,y:z.y-z.halfH,width:z.halfW*2,height:z.halfH*2},$(z,d(z.card))]),B=Math.min(...S.map(z=>z.x)),L=Math.max(...S.map(z=>z.x+z.width)),W=Math.min(...S.map(z=>z.y)),Z=Math.max(...S.map(z=>z.y+z.height)),_=(z,ee,q)=>ee-z>q-16?q/2-(z+ee)/2:z<8?8-z:ee>q-8?q-8-ee:0;R={...R,originX:R.originX+_(B,L,n.width),originY:R.originY+_(W,Z,n.height)}}}let j=r.zoom&&r.zoom!==1?r.zoom:1;j!==1&&(R=P(R,j));let K=k(R),te=[],I=new Map,H=new Map,N=[...K].sort((b,M)=>(M.card.weight??M.card.count)-(b.card.weight??b.card.count)||e.indexOf(b.card)-e.indexOf(M.card));for(let b of N){let M=[["full",d(b.card),"under"],["short",d(b.card).short,"under"]],C="none",S=b===N[0],B=(W,Z)=>M.filter(([_])=>_.startsWith(Z)).map(([_,z,ee])=>[_,z,ee,W]),L=S?[...B(!1,"full"),...B(!1,"short"),...B(!0,"full"),...B(!0,"short")]:M.map(([W,Z,_])=>[W,Z,_,!1]);for(let[W,Z,_,z]of L){let ee=$(b,Z,_);if((j!==1||A!==1||ee.x>=0&&ee.y>=0&&ee.x+ee.width<=n.width&&ee.y+ee.height<=n.height)&&!te.some(ce=>$t(ee,ce,4))&&(z||!K.some(ce=>ce!==b&&qr(ee,ce,ce.halfW,ce.halfH)))&&!G(ee,b,K)&&!l.some(ce=>$t(ee,ce,0))){C=W,te.push(ee),H.set(b.card.id,ee);break}}I.set(b.card.id,C)}let Q=K.map(b=>({id:b.card.id,x:b.x-b.halfW,y:b.y-b.halfH,width:b.halfW*2,height:b.halfH*2+(b.card.opened>0?Math.max(b.card.openedMin??0,b.card.opened):0),depth:b.depth,plot:b.plot,nameplate:I.get(b.card.id)??"none"})),E=c(x,R.cell),F={cell:R.cell,originX:R.originX,originY:R.originY,pan:r.pan??{x:0,y:0},extent:{x:R.originX+E.minX,y:R.originY+E.minY,width:E.maxX-E.minX,height:E.maxY-E.minY},openedShare:1,...u!==.5?{tilt:u}:{},...H.size>0?{nameplates:K.flatMap(b=>{let M=H.get(b.card.id);return M?[{id:b.card.id,x:M.x-(b.x-b.halfW),y:M.y-(b.y-b.halfH),width:M.width,height:M.height}]:[]})}:{},...K.some(b=>b.card.marquee)?{showings:K.flatMap(b=>{let M=O(b);return M?[{id:b.card.id,x:M.x-(b.x-b.halfW),y:M.y-(b.y-b.halfH),width:M.width,height:M.height}]:[]})}:{}};return{placed:Q,frame:F,map:f}}function bt(e){let{width:t,height:n}=e.visible??e,o={x:t*.45,y:n*.45};if(!e.city)return o;let{extent:r}=e.city,a=24;return{x:Math.max(o.x,r.x+r.width-t+a,-r.x+a),y:Math.max(o.y,r.y+r.height-n+a,-r.y+a)}}var er=48;function Zr(e){if(!e.city)return[];let{width:t,height:n}=e.visible??e,o=[];for(let r of e.nodes){if(!r.id.startsWith("kind:")||Math.round(r.plane)!==2)continue;let a=r.x+r.width/2,i=r.y+r.height/2,l=a<0?"left":a>t?"right":i<0?"top":i>n?"bottom":null;if(!l)continue;let u=l==="left"||l==="right",d=u?Math.max(0,Math.min(n,i)):Math.max(0,Math.min(t,a)),s=(p,x)=>p<x/4?x/4-p:p>x*3/4?x*3/4-p:0,c=(p,x)=>p<er?er-p:p>x-er?x-er-p:0,h=u?{x:s(a,t),y:c(i,n)}:{x:c(a,t),y:s(i,n)};o.push({id:r.id,kind:r.id.slice(5),side:l,along:d,by:h})}return o}function Jr(e,t,n,o,r){return{x:e.x+(n.x-e.x-t.x-o.x)*(1-r),y:e.y+(n.y-e.y-t.y-o.y)*(1-r)}}var us={rankOf:()=>{},parentOf:()=>{}};function ki(e,t){if(t.size===0)return us;let n=e.kinds,o=new Map,r=(d,s)=>{d!==s&&((o.get(d)??o.set(d,new Set).get(d)).add(s),(o.get(s)??o.set(s,new Set).get(s)).add(d))};for(let d of n){let s=e.tryDefinition(d);if(s)for(let c of Object.values(s.edges??{})){let h=c.to==="*"?n:c.to;for(let p of h)r(d,p)}}let a=new Map,i=new Map,l=[...t].filter(d=>n.includes(d));for(let d of l)a.set(d,0);let u=0;for(;l.length>0;){u+=1;let d=[];for(let s of[...l].sort((c,h)=>n.indexOf(c)-n.indexOf(h)))for(let c of[...o.get(s)??[]].sort((h,p)=>n.indexOf(h)-n.indexOf(p)))a.has(c)||(a.set(c,u),u===2&&i.set(c,s),d.push(c));l=d}return{rankOf:d=>{let s=a.get(d);if(s!==0)return s===1?"primary":"secondary"},parentOf:d=>i.get(d)}}function Si(e,t,n,o,r={}){if(n){let a=new Map;for(let i of e.allEdges()){if(o&&i.kind!==o)continue;let l=i.from===n.id?i.to:i.to===n.id?i.from:null;if(l===null||l===n.id)continue;let u=e.getNode(l);if(!u||a.has(l))continue;let d=i.from===n.id?"out":"in",s=d==="out"?n.kind:u.kind,c=hs(t,s,i.kind,d);a.set(l,{node:u,via:{edgeKind:i.kind,direction:d,...c?{description:c}:{}}})}if(a.size>0){let i=l=>`${l.via.edgeKind}|${l.via.description??""}`;return[...a.values()].sort((l,u)=>(i(l)<i(u)?-1:i(l)>i(u)?1:0)||ut(l.node,u.node))}}if(n){let a=r[n.id]??[],i=new Set,l=[];for(let u of a){if(u===n.id||i.has(u))continue;let d=e.getNode(u);d&&(o&&o!=="judges"&&d.kind!==o||(i.add(u),l.push({node:d,via:{edgeKind:"judges",direction:"out",description:"what it finds wrong"}})))}if(l.length>0)return l.sort((u,d)=>ut(u.node,d.node))}return o?e.allNodes().filter(a=>a.kind===o).sort(ut).map(a=>({node:a})):[]}function hs(e,t,n,o){let a=e.tryDefinition(t)?.edges?.[n];return o==="out"?a?.description:a?.inverse}function Mi(e,t,n){let o=new Map,r=[...t.values()].sort((d,s)=>d.plane-s.plane);for(let d of r)for(let s of d.aggregate?.memberIds??[])!t.has(s)&&!o.has(s)&&o.set(s,d.id);let a=d=>t.get(d)??t.get(o.get(d)??""),i=new Map,l=new Map,u=new Map;for(let d of e.allEdges()){let s=a(d.from),c=a(d.to);if(!s||!c||s.id===c.id&&!(n.overview&&s.aggregate&&s.plane===2))continue;let h=`${d.kind}:${s.id}:${c.id}`,p=i.get(h);if(p){let x=`${d.from}
2
- ${d.to}`,f=l.get(h);if(f.has(x))continue;if(f.add(x),u.get(h).push({from:d.from,to:d.to}),p.single){let{single:y,...v}=p;i.set(h,v)}continue}l.set(h,new Set([`${d.from}
3
- ${d.to}`])),u.set(h,[{from:d.from,to:d.to}]),i.set(h,{id:h,kind:d.kind,from:s.id,to:c.id,edges:[{from:d.from,to:d.to}],single:{from:d.from,to:d.to},...s.id===c.id?{loop:!0}:{},x1:s.x+s.width/2,y1:s.y+s.height/2,x2:c.x+c.width/2,y2:c.y+c.height/2})}return[...i.values()].map(d=>({...d,edges:u.get(d.id)})).sort(ut)}var Ri=.85,Ei=60,eo=160;function fs(e,t,n,o,r,a=Ri){let i=e*t.width+Math.max(0,e-1)*n,l=Math.max(n,(o-i)/2);return Array.from({length:e},(u,d)=>({x:l+d*(t.width+n),y:r,depth:a}))}function tr(e,t,n,o={}){let r={...yi,...o},a=Math.max(8,r.unit??16)/16,i=r.inset?.left??0,l=n.overview?Math.max(0,r.dock?.right??0):0,u=n.overview?Math.max(0,r.dock?.bottom??0):0,d=r.width-l-i-(r.inset?.right??0),s=[],c=new Map,h=m=>n.past===!0||Ao(t.tryDefinition(m.kind),m,r.today),p=new Set(o.hiddenKinds??[]),x=m=>!p.has(m.kind),f=n.focusId?wt(n.focusId).filter(m=>t.tryDefinition(m)!==void 0).filter(m=>!p.has(m)):[];n.focusId&&wt(n.focusId).length>0&&f.length===0&&(n={...n,focusId:null});let y=n.focusId?e.getNode(n.focusId):void 0;y&&!x(y)&&(n={...n,focusId:null},f=[]);let v=f.length>0?[...e.allNodes()].filter(m=>f.includes(m.kind)).sort(ut):[],k=v.filter(x).filter(h),w=v.length-k.length,O=n.focusId&&f.length===0?e.getNode(n.focusId):void 0,G=n.zoom===!0&&!n.overview&&n.focusId!==null,$=Math.max(56,r.height*.062),X=Math.min(r.height*.895,r.height-$),T=G?O!==void 0?{focusY:r.height*.03,focusH:r.height*.58,relationY:r.height*.645,relationH:r.height*.2,contextY:X,contextH:$}:{focusY:r.height*.03,focusH:r.height*.71,relationY:r.height*.765,relationH:r.height*.1,contextY:X,contextH:$}:O===void 0?{focusY:r.height*.045,focusH:r.height*.62,relationY:r.height*.68,relationH:r.height*.2,contextY:r.height*.918,contextH:r.height*.082}:(()=>{let m=r.height,V=m*.04,Y=Math.max(m*.42,Math.min(m*.56,300)),oe=V+Y+m*.06;return{focusY:V,focusH:Y,relationY:oe,relationH:Math.max(m*.12,m*.878-m*.068-oe),contextY:m*.878,contextH:m*.092}})(),g=Math.min(r.headroom??0,T.focusY+T.focusH*.2),R=g>T.focusY?{...T,focusY:g,focusH:T.focusH-(g-T.focusY)}:T,P=m=>Math.min(r.gap*m,Math.round(d*.1)),A=G?Math.min(880,d-P(5)):Math.min(700,d-P(6)),j=G?d-P(5):Math.min(r.focusSize.width,d-P(6)),K=(m,V,Y)=>({width:m===0?V:Math.min(V,(d-r.gap*(m+1))/m),height:Y}),te=(m,V,Y)=>{let oe=K(m,V,Y),ve=Math.min(V,eo*a,d-r.gap*2);return oe.width>=ve?oe:{width:ve,height:Y}},I=m=>Math.max(1,Math.floor((d-r.gap)/(Math.min(m,eo*a,d-r.gap*2)+r.gap))),H=new Set(n.expanded),N=n.overview?[]:Si(e,t,O,n.relation,r.judged).filter(m=>x(m.node)).filter(m=>h(m.node)),Q=n.overview?0:Math.max(0,Ei*a-R.contextH),E=N.length>0?R.focusH:R.contextY-R.focusY-r.gap*2-Q,F=j,b=r.height,M=Math.min(d*.5/F,r.height*.48/b),C=F*M,S=b*M,B=new Set(o.plainGroups??[]),L=n.overview&&!O&&f.length>0&&n.focusId!==null,W=L&&f.length>0&&f.every(m=>B.has(m));if(L)for(let m of f)W&&o.besideTheMap!==!0?H.add(ke(m)):H.delete(ke(m));let Z=L&&!W&&f.length===1?f[0]:void 0,_=Z!==void 0&&(o.screens?.[Z]?.length??0)>0,z,ee=n.overview===!0&&O!==void 0&&o.besideTheMap===!0;n.overview&&(O||f.length>0)&&n.focusId&&!W&&!_&&!(L&&o.besideTheMap===!0)&&!ee?(z={x:i+(d-C)/2,y:r.height*.53-S/2,width:C,height:S},fn({id:n.focusId,kind:O?O.kind:f[0],plane:0,x:z.x,y:z.y,width:C,height:S,natural:{width:F,height:b},...O?{}:{aggregate:{kind:f.join("+"),memberIds:k.map(m=>m.id),label:o.plurals?.[n.focusId]??f.map(m=>Lt(t,m)).join(" and "),...w>0?{retired:w}:{}}}})):n.overview||(O?fn({id:O.id,kind:O.kind,plane:0,x:i+(d-A)/2,y:R.focusY,width:A,height:E}):f.length>0&&n.focusId&&fn({id:n.focusId,kind:f[0],plane:0,x:i+(d-j)/2,y:R.focusY,width:j,height:E,aggregate:{kind:f.join("+"),memberIds:k.map(m=>m.id),label:o.plurals?.[n.focusId]??f.map(m=>Lt(t,m)).join(" and "),...w>0?{retired:w}:{}}}));let q=26,he=52,ce=22,He=Math.round(r.relationSize.width*.75),Me=Math.max(1,Math.floor((d-r.gap)/(He+r.gap))),Ae=r.unit/16,De=new Map;for(let m of N){let V=Yr(m),Y=De.get(V);Y?Y.push(m):De.set(V,[m])}let Te=[...De.values()],ie=Te.length>1,xe=Math.max(r.gap,ce*Ae),qe=ie?xe:r.gap,Et=Math.max(2,Math.floor((R.relationH+qe)/(q*Ae+qe))),ne=Math.min(r.relationSize.width,(d-r.gap*(Me+1))/Me)+r.gap,rt=Te.map(m=>{let V=m[0].via;return!ie||!V?1:Math.ceil((Math.min(Zn*Ae,Jn(Sn(V),Ae))+r.gap)/ne)}),$e=Te.map(m=>m.length),Rt=rn($e,Me,rt),Ve=N.length>Me*Et||Rt.length>Et,Ot={schema:t,graph:e,focusId:O?.id,expanded:H,...r.relevance?{relevance:r.relevance}:{},...n.selection?{selection:n.selection}:{},plural:m=>Lt(t,m),...r.today?{today:r.today}:{}},Ke=Ve||ie?xe:r.gap,Qe,Le;if(!Ve)Qe=Te.flat().map(m=>({id:m.node.id,kind:m.node.kind,node:m.node,...m.via?{via:m.via}:{}})),Le=Rt;else{let m=Math.max(1,Math.floor((R.relationH+Ke)/(he*Ae+Ke))),Y=rn($e.map(()=>1),Me,rt).length<=m?rt:[],oe=_r($e,Me,m,Y),ve=Te.map((me,Re)=>Kr(me,{...Ot,budget:oe[Re]}));Qe=ve.flat(),Le=rn(ve.map(me=>me.length),Me,Y)}let Ie=Le.length,mt=Ie===1?R.relationH:(R.relationH-Ke*(Ie-1))/Ie,Ue=K(Math.max(...Le.map(m=>m.reduce((V,Y)=>V+Y.slots,0)),1),Qe.length<=2?Math.round(r.relationSize.width*1.35):r.relationSize.width,mt),pt=[];{let m=Ue.width+r.gap,V=[],Y=0,oe=new Map;for(let me of Le.flat())oe.set(me.run,(oe.get(me.run)??0)+me.cards);for(let me=0;me<Te.length;me++)V[me]=Y,Y+=oe.get(me)??0;let ve=Te.map(()=>0);Le.forEach((me,Re)=>{let ct=me.reduce((yt,xr)=>yt+xr.slots,0),Fn=ct*Ue.width+Math.max(0,ct-1)*r.gap,Wn=i+Math.max(r.gap,(d-Fn)/2),ns=R.relationY+Re*(mt+Ke);for(let yt of me){let xr=yt.slots*m-r.gap,rs=yt.cards*m-r.gap,os=Wn+(xr-rs)/2;for(let br=0;br<yt.cards;br++)pt[V[yt.run]+ve[yt.run]++]={x:os+br*m,y:ns};Wn+=yt.slots*m}})}Qe.forEach((m,V)=>{let Y=pt[V];fn({id:m.id,kind:m.kind,plane:1,x:Y.x,y:Y.y,width:Ue.width,height:Ue.height,...m.via?{via:m.via}:{},...m.aggregate?{aggregate:m.aggregate}:{},...Ve&&!m.aggregate?{compact:!0}:{}})});let cn=new Set(c.keys());for(let m of k)cn.add(m.id);let dt=new Map;for(let m of e.allNodes()){let V=dt.get(m.kind);V?V.push(m):dt.set(m.kind,[m])}let ae=new Set(f.length>0?f:O?[O.kind]:[]),we=[];for(let m of t.kinds){if(p.has(m))continue;let V=dt.get(m)??[],Y=V.filter(h);we.push({id:ke(m),kind:m,members:Y.sort(ut),retired:V.length-Y.length,...ae.has(m)?{focused:!0}:{}})}for(let m of we)m.kind===n.relation&&(m.raised=!0);we.sort(ut);let ot=ki(t,ae),At=!n.overview&&t.kinds.some(m=>ot.rankOf(m)==="primary"),Ge=[];for(let m of we)if(!n.overview&&H.has(m.id)&&m.members.length>0)for(let V of m.members)Ge.push({id:V.id,kind:V.kind});else{let V=At?ot.rankOf(m.kind):void 0,Y=V==="secondary"?ot.parentOf(m.kind):void 0;Ge.push({id:m.id,kind:m.kind,...m.raised?{raised:!0}:{},...m.focused?{focused:!0}:{},...n.overview&&H.has(m.id)?{opened:!0}:{},...V?{rank:V}:{},...Y&&!H.has(ke(Y))?{nestedUnder:ke(Y)}:{},aggregate:{kind:m.kind,memberIds:m.members.map(oe=>oe.id),label:o.plurals?.[m.kind]??Lt(t,m.kind),...m.retired>0?{retired:m.retired}:{}}})}let jt=2;if(Ge.length<=I((G?240:r.contextSize.width)*a))for(let m of Ge)delete m.nestedUnder;let un=new Map;for(let m of Ge){if(m.nestedUnder===void 0)continue;let V=un.get(m.nestedUnder)??0;V>=jt?delete m.nestedUnder:un.set(m.nestedUnder,V+1)}let Ze=Ge.filter(m=>m.nestedUnder!==void 0),lt=Ge.filter(m=>m.nestedUnder===void 0),hn=I((G?240:r.contextSize.width)*a),Tn=!n.overview&&lt.length>hn,pr=Math.max(0,hn-1),Gt=m=>m.focused?0:m.raised?1:2,zt=new Set([...lt].map((m,V)=>({item:m,at:V})).sort((m,V)=>Gt(m.item)-Gt(V.item)||m.at-V.at).slice(0,pr).map(({item:m})=>m.id)),D=new Set(Tn?lt.filter(m=>!zt.has(m.id)).map(m=>m.id):[]),fe=Ze.filter(m=>!D.has(m.nestedUnder)),Ee=Ze.filter(m=>D.has(m.nestedUnder)),be=Tn?[...lt.filter(m=>zt.has(m.id)),{id:Ho,kind:"",beyond:[...lt.filter(m=>D.has(m.id)),...Ee].map(m=>m.kind)}]:lt,Ne=n.overview?{width:Math.min(220,d/6.5),height:Math.min(92,r.height*.125)}:te(be.length,(G?240:r.contextSize.width)*a,R.contextH),Yt=r.relevance?.flagged,In=(m,V)=>{let Y=Vr(t,m);if(!Y)return{};let oe=Y.values.map(()=>0),ve=0;for(let me of V){let Re=Y.values.indexOf(e.getNode(me)?.[Y.field]);Re<0?ve++:oe[Re]++}return{states:{field:Y.field,values:[...Y.values.map((me,Re)=>({value:me,tier:Y.tiers[Re],count:oe[Re]})),...ve>0?[{value:null,tier:"waiting",count:ve}]:[]]}}},ze=n.overview?Qr(be.map(m=>{let V=m.aggregate?.memberIds??[],Y=Yt?V.filter(oe=>Yt.has(oe)).length:0;return{id:m.id,kind:m.kind,count:V.length,opened:H.has(m.id)?en(Jt(V.length))*a:0,openedMin:H.has(m.id)?en(Math.min(Wr,Jt(V.length)))*a:0,nameplate:vi(m.aggregate?.label??Lt(t,m.kind),V.length,Y,Vr(t,m.kind)!==void 0,a),weight:Y*1e3+V.length,...f.includes(m.kind)&&(o.screens?.[m.kind]?.length??0)>0?{marquee:{width:Dr+12,height:$r(o.screens[m.kind].map(oe=>oe.title),Dr,o.nameWidth)+8}}:{}}}),t,{width:r.width-l,height:r.height-u},r.chrome?{...r.inset,right:Math.min(r.inset?.right??0,8)}:r.inset??{},{...r.cityOrder?{order:r.cityOrder}:{},...r.plots?{plots:r.plots}:{},...o.cityZoom&&o.cityZoom!==1?{zoom:o.cityZoom}:{},keep:[...n.selection??[],...n.focusId?[n.focusId]:[]].flatMap(m=>m.startsWith("kind:")?[m.slice(5)]:m.startsWith("aggregate:")&&!m.includes("|")?[m.slice(10)]:ee&&m===O?.id?[O.kind]:[]),...o.tilt!==void 0?{tilt:o.tilt}:{},pan:{x:n.pan?.x??0,y:n.pan?.y??0},...z||r.chrome?.length?{avoid:[...z?[z]:[],...r.chrome??[]]}:{}}):null,Nn=new Map(ze?.placed.map(m=>[m.id,m.plot])??[]),Bn=new Map(ze?.placed.map(m=>[m.id,m.nameplate])??[]),_t=ze?ze.placed.map(({x:m,y:V,depth:Y,width:oe,height:ve})=>({x:m,y:V,depth:Y,width:oe,height:ve})):fs(be.length,Ne,r.gap,d,R.contextY,G?.97:Ri).map(m=>({...m,x:m.x+i})),Ja=.74,Hn=.8,es=52*a,ts=86*a,yr=(m,V)=>Math.min(1,m+(1-m)*V),gr=new Map;be.forEach((m,V)=>{let Y=_t[V],oe=Y.width??Ne.width,ve=Y.height??Ne.height,me=m.rank==="secondary"?Ja:1,Re=ze?oe:Math.max(Math.min(oe,eo*a),oe*me),ct=ze?ve:Math.max(Ei*a,ve*me);gr.set(m.id,{x:Y.x+(oe-Re)/2,y:Y.y+(ve-ct),depth:m.rank==="secondary"?yr(Y.depth,.5):Y.depth,width:Re,height:ct})});let Dn=[],$n=_t[_t.length-1],wr=new Map;for(let m of fe)wr.set(m.nestedUnder,(wr.get(m.nestedUnder)??0)+1);let Oo=new Map;for(let m of fe){let V=gr.get(m.nestedUnder);if(V){let Y=wr.get(m.nestedUnder)??1,oe=Oo.get(m.nestedUnder)??0;Oo.set(m.nestedUnder,oe+1);let ve=.98,me=Ne.width*Hn,Re=Math.max(ts,Math.min(me,V.width/(ve*(Y-1)+1))),ct=Math.max(es,Ne.height*Hn*(Re/me)),Fn=Re*ve,Wn=(Y-1)*Fn+Re;Dn.push({...m,x:V.x+(V.width-Wn)/2+oe*Fn,y:Math.max(0,V.y-ct+Math.min(ct*.5,16)),width:Re,height:ct,depth:yr(V.depth,.8)})}else if($n){let Y=Ne.width*Hn,oe=Ne.height*Hn;Dn.push({...m,x:$n.x,y:$n.y,width:Y,height:oe,depth:yr($n.depth??1,.8)})}}for(let m of be)Dn.push({...m,...gr.get(m.id)});return Dn.forEach(m=>{fn({id:m.id,kind:m.kind,plane:2,x:m.x,y:m.y,width:m.width,height:m.height,...m.aggregate?{aggregate:m.aggregate}:{},...m.raised?{raised:!0}:{},...m.focused?{focused:!0}:{},...m.opened?{opened:!0}:{},...m.opened?{openedRows:Math.max(1,Math.floor((Math.max(en(Math.min(Wr,Jt(m.aggregate?.memberIds.length??0))),en(Jt(m.aggregate?.memberIds.length??0))*(ze?.frame.openedShare??1))-ni)/Fr))}:{},...m.rank?{rank:m.rank}:{},...m.nestedUnder?{nestedUnder:m.nestedUnder}:{},...m.beyond?{beyond:m.beyond}:{},...Nn.has(m.id)?{plot:Nn.get(m.id)}:{},...Bn.has(m.id)?{nameplate:Bn.get(m.id)}:{},...ze&&m.aggregate?In(m.kind,m.aggregate.memberIds):{},depth:m.depth})}),{nodes:s,connectors:Mi(e,c,n),width:r.width,height:r.height,...ze?{city:ze.frame}:{},...n.pan&&(n.pan.x!==0||n.pan.y!==0)?{pan:{x:n.pan.x,y:n.pan.y}}:{},...l>0||u>0?{visible:{width:r.width-l,height:r.height-u}}:{}};function fn(m){let V=n.overview&&Pe(m.id)!==null?void 0:n.pins[m.id],Y=V?{...m,x:V.x,y:V.y,pinned:!0}:{...m,pinned:!1},oe=n.pan?{...Y,x:Y.x+n.pan.x,y:Y.y+n.pan.y}:Y;s.push(oe),c.set(oe.id,oe)}}function to(e,t,n){let o=e.nodes.find(l=>l.id===t);if(!o||o.screenOf!==void 0)return null;let r={...o,x:n.x,y:n.y,pinned:!0},a=r.x+r.width/2,i=r.y+r.height/2;return{...e,nodes:e.nodes.map(l=>l.id===t?r:l),connectors:e.connectors.map(l=>l.from===t?{...l,x1:a,y1:i}:l.to===t?{...l,x2:a,y2:i}:l)}}function no(e,t){return t.x===0&&t.y===0?e:{...e,nodes:e.nodes.map(n=>({...n,x:n.x+t.x,y:n.y+t.y})),connectors:e.connectors.map(n=>({...n,x1:n.x1+t.x,y1:n.y1+t.y,x2:n.x2+t.x,y2:n.y2+t.y})),...e.city?{city:{...e.city,pan:{x:t.x,y:t.y}}}:{},pan:{x:t.x,y:t.y}}}var ye=(e,t,n)=>e+(t-e)*n;function Oi(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}var Ai=new WeakMap;function ms(e){let t=Ai.get(e);if(t)return t;let n=new Map,o=new Map;for(let r of e.nodes){n.set(r.id,r);for(let a of r.aggregate?.memberIds??[]){let i=o.get(a);i?i.push(r):o.set(a,[r])}}return t={byId:n,groupsOf:o},Ai.set(e,t),t}var Li=new WeakMap;function Pi(e,t){let n=Li.get(t);if(n||Li.set(t,n=new WeakMap),n.has(e))return n.get(e);let o=ps(e,t);return n.set(e,o),o}function ps(e,t){let{byId:n,groupsOf:o}=ms(t);if(e.screenOf!==void 0){let i=n.get(ke(e.screenOf));if(i)return{...e,x:i.x,y:i.y,width:i.width,height:i.height}}if(Ct(e.id)||Pe(e.id)!==null){let i=(e.aggregate?.memberIds??[]).map(s=>n.get(s)).filter(s=>s!==void 0);if(i.length===0)return null;let l=i.map(Oi),u=l.reduce((s,c)=>s+c.x,0)/l.length,d=l.reduce((s,c)=>s+c.y,0)/l.length;return{...e,x:u-e.width/2,y:d-e.height/2}}let r=o.get(e.id)?.find(i=>i.id===ke(e.kind)||i.id===Ce(e.kind));if(!r)return null;let a=Oi(r);return{...e,x:a.x-e.width/2,y:a.y-e.height/2}}function it(e,t,n){let o=Math.max(0,Math.min(1,n)),r=new Map(e.nodes.map(s=>[s.id,s])),a=new Map(t.nodes.map(s=>[s.id,s])),i=[];for(let[s,c]of r){let h=a.get(s);if(h){i.push(ro(c,h,o,1));continue}let p=Pi(c,t)??c;i.push(ro(c,p,o,1-o))}for(let[s,c]of a){if(r.has(s))continue;let h=Pi(c,e)??c;i.push(ro(h,c,o,o))}let l=new Map(e.connectors.map(s=>[s.id,s])),u=new Map(t.connectors.map(s=>[s.id,s])),d=[];for(let[s,c]of l){let h=u.get(s);d.push(h?{...ys(c,h,o),opacity:1}:{...c,opacity:1-o})}for(let[s,c]of u)l.has(s)||d.push({...c,opacity:o});return{nodes:i.filter(s=>s.opacity>0).sort((s,c)=>s.id<c.id?-1:s.id>c.id?1:0),connectors:d.filter(s=>s.opacity>0).sort((s,c)=>s.id<c.id?-1:s.id>c.id?1:0),width:ye(e.width,t.width,o),height:ye(e.height,t.height,o),t:o,...Ci(e.city,t.city,o)?{city:Ci(e.city,t.city,o)}:{},...e.pan||t.pan?{pan:{x:ye(e.pan?.x??0,t.pan?.x??0,o),y:ye(e.pan?.y??0,t.pan?.y??0,o)}}:{}}}function Ci(e,t,n){return e?t?{cell:ye(e.cell,t.cell,n),...e.tilt!==void 0||t.tilt!==void 0?{tilt:ye(e.tilt??.5,t.tilt??.5,n)}:{},originX:ye(e.originX,t.originX,n),originY:ye(e.originY,t.originY,n),pan:{x:ye(e.pan.x,t.pan.x,n),y:ye(e.pan.y,t.pan.y,n)},extent:{x:ye(e.extent.x,t.extent.x,n),y:ye(e.extent.y,t.extent.y,n),width:ye(e.extent.width,t.extent.width,n),height:ye(e.extent.height,t.extent.height,n)}}:e:t}function ro(e,t,n,o){return{id:t.id,kind:t.kind,plane:ye(e.plane,t.plane,n),x:ye(e.x,t.x,n),y:ye(e.y,t.y,n),width:ye(e.width,t.width,n),height:ye(e.height,t.height,n),pinned:t.pinned,opacity:o,...t.aggregate?{aggregate:t.aggregate}:{},...t.via?{via:t.via}:{},...t.raised?{raised:!0}:{},...t.focused?{focused:!0}:{},...t.opened?{opened:!0}:{},...t.openedRows!==void 0?{openedRows:t.openedRows}:{},...t.compact?{compact:!0}:{},...t.rank?{rank:t.rank}:{},...t.nestedUnder?{nestedUnder:t.nestedUnder}:{},...t.beyond?{beyond:t.beyond}:{},...t.plot?{plot:t.plot}:{},...t.nameplate?{nameplate:t.nameplate}:{},...t.states?{states:t.states}:{},...t.screenOf?{screenOf:t.screenOf}:{},...t.depth===void 0?{}:{depth:ye(e.depth??1,t.depth,n)},...t.natural?{natural:t.natural}:{}}}function ys(e,t,n){return{...t,x1:ye(e.x1,t.x1,n),y1:ye(e.y1,t.y1,n),x2:ye(e.x2,t.x2,n),y2:ye(e.y2,t.y2,n)}}function nr(e){let t=Math.max(0,Math.min(1,e));return t<.5?4*t*t*t:1-(-2*t+2)**3/2}function gs(e,t){let n=[];for(let r=0;r<e.length;r+=1){let a=e[r],i=e[(r+1)%e.length];if(a.y===i.y)continue;let l=Math.min(a.y,i.y),u=Math.max(a.y,i.y);t<l||t>=u||n.push(a.x+(t-a.y)/(i.y-a.y)*(i.x-a.x))}n.sort((r,a)=>r-a);let o={x0:0,x1:0};for(let r=0;r+1<n.length;r+=2){let a={x0:n[r],x1:n[r+1]};a.x1-a.x0>o.x1-o.x0&&(o=a)}return o}function ws(e){let t=1/0,n=-1/0;for(let o of e)o.y<t&&(t=o.y),o.y>n&&(n=o.y);return{top:t,bottom:n}}function xs(e){let t=0;for(let n=0;n<e.length;n+=1){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2}function bs(e){let t=0,n=0,o=0;for(let r=0;r<e.length;r+=1){let a=e[r],i=e[(r+1)%e.length],l=a.x*i.y-i.x*a.y;t+=l,n+=(a.x+i.x)*l,o+=(a.y+i.y)*l}if(Math.abs(t)<1e-9){let r=e.reduce((a,i)=>({x:a.x+i.x,y:a.y+i.y}),{x:0,y:0});return{x:r.x/e.length,y:r.y/e.length}}return{x:n/(3*t),y:o/(3*t)}}function vs(e,t){let{room:n,height:o,size:r,floor:a,measure:i=Hr,lines:l=2}=t,u=(f,y)=>f.every(v=>i(v,y)<=n)&&f.length*y*1.15<=o;if(u([e],r))return{lines:[e],fontSize:r,whole:!0};let d=e.split(/\s+/);if(l>1&&d.length>1){let f=1,y=1/0,v=0;for(let w=0;w<d.length-1;w+=1){v+=d[w].length+1;let O=Math.abs(v-e.length/2);O<y&&(y=O,f=w+1)}let k=[d.slice(0,f).join(" "),d.slice(f).join(" ")];if(u(k,r))return{lines:k,fontSize:r,whole:!0};for(let w=r;w>=a;w-=r*.06)if(u(k,w))return{lines:k,fontSize:w,whole:!0}}for(let f=r;f>=a;f-=r*.06)if(u([e],f))return{lines:[e],fontSize:f,whole:!0};let s=i(e,a)/Math.max(1,e.length),c=Math.floor(n/s)-1;if(c<4||a*1.15>o)return null;let h=e.slice(0,c),p=h.lastIndexOf(" ");return{lines:[`${p>3?h.slice(0,p):h}\u2026`],fontSize:a,whole:!1}}var ks=(e,t)=>e.x0<t.x1&&t.x0<e.x1&&e.y0<t.y1&&t.y0<e.y1;var U=re(Oe(),1);var vt=re(Oe(),1);function Ti(e){let[t,n]=(0,vt.useState)(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(e).matches);return(0,vt.useEffect)(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia(e),r=()=>n(o.matches);return r(),o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),t}function Ss(){let e=()=>typeof document>"u"?null:document.documentElement.getAttribute("data-graview-motion"),[t,n]=(0,vt.useState)(e);return(0,vt.useEffect)(()=>{if(typeof document>"u"||typeof MutationObserver>"u")return;let o=new MutationObserver(()=>n(e()));return o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-graview-motion"]}),n(e()),()=>o.disconnect()},[]),t}function Ii(e){let t=Ti("(prefers-reduced-motion: reduce)"),n=Ti("(prefers-reduced-transparency: reduce)"),o=Ss();return qo({off:!e,reducedMotion:o==="reduce"||o!=="full"&&t,reducedTransparency:n})}var Ms=_o*1.5,Es=30;function Ni(e,t){let[n,o]=(0,vt.useState)(!1),r=e&&!n;return(0,vt.useEffect)(()=>{if(!r||!t||typeof requestAnimationFrame>"u")return;let a=[],i=0,l=0,u=d=>{if(i>0&&a.push(d-i),i=d,a.length>=Es){if(!Qo(a,Ms)){o(!0);return}a.length=0}l=requestAnimationFrame(u)};return l=requestAnimationFrame(u),()=>cancelAnimationFrame(l)},[r,t]),r}var We=re(Oe(),1);var Rs=520;function Os(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Bi(e,t={}){let n=t.duration??Rs,o=(t.enabled??!0)&&!Os(),r=t.settle??!0,a=(0,We.useRef)(e),[,i]=(0,We.useState)(()=>it(e,e,1)),l=(0,We.useRef)(null);l.current??=it(e,e,1);let u=(0,We.useRef)(null),d=(0,We.useRef)(null);!o&&d.current!==e&&(d.current=e,l.current=it(e,e,1)),o&&(d.current=null);let s=(0,We.useRef)(null);return(0,We.useEffect)(()=>{if(!o||typeof requestAnimationFrame>"u"){if(a.current=e,d.current!==e){let k=it(e,e,1);l.current=k,i(k)}if(typeof requestAnimationFrame>"u"||!r)return;let v=requestAnimationFrame(()=>{let k=it(e,e,1);l.current=k,i(k)});return()=>cancelAnimationFrame(v)}if(a.current===e&&l.current.t>=1){if(!r)return;let v=requestAnimationFrame(()=>{let k=it(e,e,1);l.current=k,i(k)});return()=>cancelAnimationFrame(v)}let c=performance.now(),p=s.current!==null&&l.current.t<1&&c-s.current<n?s.current:c;s.current=p;let x=nr(Math.min(1,(c-p)/n)),f=a.current,y=v=>{let k=Math.min(1,(v-p)/n),w=x>=1?1:(nr(k)-x)/(1-x),O=it(f,e,Math.max(0,w));l.current=O,i(O),k<1?u.current=requestAnimationFrame(y):(s.current=null,a.current=e,u.current=requestAnimationFrame(()=>{let G=it(e,e,1);l.current=G,i(G),u.current=null}))};return u.current=requestAnimationFrame(y),()=>{u.current!==null&&cancelAnimationFrame(u.current);let v=l.current;a.current={...e,...v.city?{city:v.city}:{},pan:v.pan??{x:0,y:0},nodes:v.nodes.map(k=>({...k,plane:Math.round(k.plane)})),connectors:v.connectors}}},[e,n,o,r]),l.current}function Hi(e=1100){let{store:t}=pe(),[n,o]=(0,We.useState)(()=>new Set);return(0,We.useEffect)(()=>{let r=null,a=t.subscribe(i=>{o(new Set(i.touched)),r&&clearTimeout(r),r=setTimeout(()=>o(new Set),e)});return()=>{a(),r&&clearTimeout(r)}},[t,e]),n}var As={marks:new Map,acts:[]};function Di(e=4e3){let{store:t}=pe(),[n,o]=(0,We.useState)(As);return(0,We.useEffect)(()=>{let r=null,a=t.subscribe((i,l)=>{o(u=>{let d=new Map(u.marks),s=[...u.acts];for(let c of l){if(c.undoes!==void 0){let x=s.find(y=>y.batch===c.undoes||y.wrote.length>0),f=s.filter(y=>c.writes.some(v=>y.wrote.includes(v)));for(let y of f.length>0?f:x?[x]:[]){for(let v of y.wrote)d.delete(v);s=s.filter(v=>v.batch!==y.batch)}continue}if(c.author.kind!=="agent")continue;let h=c.author.id??"the seat";for(let x of c.writes)d.set(x,h);s.find(x=>x.batch===c.batch)?s=s.map(x=>x.batch===c.batch?{...x,wrote:[...new Set([...x.wrote,...c.writes])]}:x):s=[{batch:c.batch,who:h,intent:c.batchIntent??c.intent,at:c.at,wrote:[...c.writes]},...s].slice(0,12)}return d.size===u.marks.size&&s===u.acts&&d.size===0?u:{marks:d,acts:s}}),r&&clearTimeout(r),r=setTimeout(()=>o(u=>u.marks.size===0?u:{...u,marks:new Map}),e)});return()=>{a(),r&&clearTimeout(r)}},[t,e]),n}var Ft=re(Se(),1),Je=16;function $i({marks:e,questions:t=[],whereIs:n,stageRef:o,width:r,height:a}){if(e.size===0&&t.length===0)return null;let i=o.current,l=i?.getBoundingClientRect()??null,u=[];for(let[s,c]of e){let h=null;if(i&&l&&typeof CSS<"u"){let y=i.querySelector(`[data-graview-pick="${CSS.escape(s)}"]`)?.getBoundingClientRect();y&&y.width>0&&y.height>0&&(h={x:y.left-l.left,y:y.top-l.top,width:y.width,height:y.height})}if(h??=n(s),!h)continue;let p=Math.min(Math.max(h.x+h.width-Je/2,Je/2),r-Je/2),x=Math.min(Math.max(h.y-Je/4,Je/2),a-Je/2);u.push({id:s,who:c,x:p,y:x})}let d=[];for(let s of t){let c=n(s.id);c&&d.push({...s,x:Math.min(Math.max(c.x+c.width/2,Je),r-Je),y:Math.min(Math.max(c.y-Je/2,Je),a-Je)})}return u.length===0&&d.length===0?null:(0,Ft.jsxs)("div",{className:"graview-seat-marks","data-testid":"seat-marks","data-graview-seat-marks":u.length,children:[u.map(({id:s,who:c,x:h,y:p})=>(0,Ft.jsx)("span",{className:"graview-seat-mark","data-testid":"seat-mark","data-graview-seat-mark":s,"data-graview-seat-who":c,title:`${c} just changed this`,"aria-hidden":"true",style:{left:h,top:p,"--graview-hue":mn(c)},children:"\u25C6"},s)),d.map(s=>(0,Ft.jsxs)("span",{className:"graview-seat-asking","data-testid":"seat-question","data-graview-seat-asking":s.id,title:s.asks,style:{left:s.x,top:s.y},children:[(0,Ft.jsx)("span",{"aria-hidden":"true",children:"?"}),(0,Ft.jsx)("span",{className:"graview-seat-asking-said",children:s.asks})]},`asking:${s.id}`))]})}var J=re(Se(),1);function Ls({hue:e,mode:t}){let n=t==="docked";return(0,J.jsxs)("svg",{viewBox:"0 0 32 38","aria-hidden":"true",children:[(0,J.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",strokeLinecap:"round",children:[(0,J.jsx)("line",{x1:"16",y1:"3.5",x2:"16",y2:"7"}),(0,J.jsx)("circle",{cx:"16",cy:"2.6",r:"1.5",fill:"none"}),(0,J.jsx)("path",{d:"M8 16 V12.5 C8 8.5 11.5 7 16 7 C20.5 7 24 8.5 24 12.5 V16 Z",fill:"currentColor",fillOpacity:"0.1"}),t==="refused"?(0,J.jsx)("line",{x1:"11",y1:"12.5",x2:"21",y2:"12.5",strokeWidth:"2"}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("rect",{x:"10.2",y:"10.2",width:"11.6",height:"4.6",rx:"2.3",fill:"currentColor",fillOpacity:"0.14",strokeWidth:"1"}),(0,J.jsx)("circle",{cx:"13.4",cy:"12.5",r:"1.25",fill:"currentColor",stroke:"none",opacity:n?.45:1}),(0,J.jsx)("circle",{cx:"18.6",cy:"12.5",r:"1.25",fill:"currentColor",stroke:"none",opacity:n?.45:1}),t==="reading"?(0,J.jsx)("line",{x1:"10.2",y1:"12.5",x2:"21.8",y2:"12.5",strokeWidth:"0.8",opacity:"0.7"}):null]}),(0,J.jsx)("line",{x1:"16",y1:"16",x2:"16",y2:"18.5"}),(0,J.jsx)("polygon",{points:"16,18.5 24,22.5 16,26.5 8,22.5",fill:"currentColor",fillOpacity:"0.22"}),(0,J.jsx)("polygon",{points:"8,22.5 16,26.5 16,33.5 8,29.5",fill:"currentColor",fillOpacity:"0.08"}),(0,J.jsx)("polygon",{points:"24,22.5 16,26.5 16,33.5 24,29.5",fill:"currentColor",fillOpacity:"0.3"}),t==="writing"?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("polyline",{points:"24,24 28.5,20.5"}),(0,J.jsx)("line",{x1:"27.5",y1:"19",x2:"30",y2:"21.5",strokeWidth:"1.8"})]}):(0,J.jsx)("line",{x1:"24",y1:"24",x2:"26.5",y2:"29"}),(0,J.jsx)("line",{x1:"8",y1:"24",x2:"5.5",y2:"29"}),(0,J.jsx)("path",{d:"M9.5 33.5 v2.2 h4"}),(0,J.jsx)("path",{d:"M22.5 33.5 v2.2 h-4"})]}),(0,J.jsx)("title",{children:`robot, ${t}`})]})}function Ps({hue:e}){return(0,J.jsxs)("svg",{viewBox:"0 0 22 24","aria-hidden":"true",style:{color:`hsl(${Math.round(e)} 50% 48%)`},children:[(0,J.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",strokeLinecap:"round",children:[(0,J.jsx)("circle",{cx:"11",cy:"6",r:"4.2"}),(0,J.jsx)("path",{d:"M3 23 C3 15.5 6 13 11 13 C16 13 19 15.5 19 23"})]}),(0,J.jsx)("title",{children:"somebody"})]})}function Fi({width:e,whereIs:t}){let{who:n,following:o,follow:r}=pe(),a=ii([...n.values()],t,e);return a.length===0?null:(0,J.jsx)("div",{className:"graview-occupants","data-testid":"occupants","data-graview-occupants":a.length,children:a.map((i,l)=>{if(i.kind==="over")return(0,J.jsx)("div",{className:"graview-presence-over","data-testid":"presence-over","data-graview-over-by":i.presence.participant,style:{left:i.box.x-3,top:i.box.y-3,width:i.box.width+6,height:i.box.height+6,"--graview-hue":i.presence.hue}},`over:${i.presence.participant}`);if(i.kind==="count")return(0,J.jsxs)("span",{className:"graview-figure-count","data-testid":"presence-count","data-graview-at":i.at,style:{left:i.point.x,top:i.point.y},title:`${i.n} more here`,children:["+",i.n]},`count:${i.at}:${l}`);let u=i.presence.hue,d=Io(i.presence)||"somebody";if(i.kind==="edge")return(0,J.jsxs)("button",{type:"button",className:"graview-figure-edge","data-testid":"presence-edge","data-graview-person":i.presence.participant,style:{right:`calc(${Math.max(8,e-i.point.x)}px + var(--graview-dock, 0px))`,top:i.point.y},onClick:()=>r(i.presence.participant),"aria-label":`${d} is somewhere else \u2014 press to go where they are`,children:["\u2192 ",d]},`edge:${i.presence.participant}`);if(i.kind==="robot")return(0,J.jsxs)("div",{className:"graview-figure","data-graview-figure":`theirs:${i.presence.participant}`,"data-graview-theirs":"","data-graview-mode":i.mode,"data-graview-at":i.presence.robot?.at??"",style:{transform:`translate(${i.point.x.toFixed(1)}px, ${i.point.y.toFixed(1)}px)`,"--graview-hue":u},children:[(0,J.jsx)("span",{className:"graview-figure-body",role:"img","aria-label":`${d}'s agent \u2014 ${i.mode}`,style:{cursor:"default"},children:(0,J.jsx)(Ls,{hue:u,mode:i.mode})}),(0,J.jsxs)("span",{className:"graview-figure-name",children:[d,"'s agent"]})]},`robot:${i.presence.participant}`);let s=o?.participant===i.presence.participant;return(0,J.jsxs)("div",{className:"graview-figure","data-graview-figure":i.presence.participant,"data-graview-person":"","data-graview-at":i.at,"data-graview-audience":i.audience?"":void 0,"data-graview-followed":s?"":void 0,style:{transform:`translate(${i.point.x.toFixed(1)}px, ${i.point.y.toFixed(1)}px)`,"--graview-hue":u},children:[(0,J.jsx)("button",{type:"button",className:"graview-figure-body","aria-label":`${d} is here${s?". Press to stop following":". Press to go where they go"}`,"aria-pressed":s,onClick:c=>{c.stopPropagation(),r(s?null:i.presence.participant)},onPointerDown:c=>c.stopPropagation(),children:(0,J.jsx)(Ps,{hue:u})}),(0,J.jsx)("span",{className:"graview-figure-name",children:d})]},`person:${i.presence.participant}`)})})}var or=re(Oe(),1),On=re(Se(),1),Wi={left:"\u2190",right:"\u2192",top:"\u2191",bottom:"\u2193"},oo=36,Rn=56;function ji({result:e,schema:t,chrome:n=[],onGo:o}){let r=Zr(e);if(r.length===0)return null;let a=s=>(s??[]).flatMap(c=>{let h=e.nodes.find(p=>p.id===c.id);return h?[{left:h.x+c.x,top:h.y+c.y,right:h.x+c.x+c.width,bottom:h.y+c.y+c.height}]:[]}),i=a(e.city?.showings),l=a(e.city?.nameplates),u=[...i,...l,...n.map(s=>({left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height}))],d=[];for(let s of["left","right","top","bottom"]){let c=e.visible??e,h=s==="left"||s==="right"?c.height:c.width,p=s==="left"||s==="right",x=s==="bottom"?Is:s==="top"?Rn:Ns+Rn/2,f=-1/0,y=[],v=r.filter(k=>k.side===s).sort((k,w)=>k.along-w.along);for(let k of v){let w=Vn(t,k.kind),O=Cs(w),G=p?rr:O/2,$=h-x-(p?0:G),X=Math.max(Rn,k.along,f+G+Ts);if(X>$)continue;let{at:T,inset:g}=Bs([...u,...y],s,X,O,c,h);if(T>$+.5)continue;f=T+G,y.push(Vi(s,T,O,c,g));let R=s==="left"?{left:g,top:T,transform:"translateY(-50%)"}:s==="right"?{right:`calc(${g}px + var(--graview-dock, 0px))`,top:T,transform:"translateY(-50%)"}:s==="top"?{top:g,left:T,transform:"translateX(-50%)"}:{bottom:`calc(${g}px + var(--graview-scene-foot, var(--graview-sheet, 0px)))`,left:T,transform:"translateX(-50%)"};d.push((0,On.jsx)("button",{type:"button",className:"graview-edge-sign","data-graview-past-edge":k.id,"aria-label":`${w}, past the ${s} edge \u2014 bring it into view`,title:`${w} is past the ${s} edge`,tabIndex:-1,onPointerDown:P=>P.stopPropagation(),onClick:P=>{P.stopPropagation(),o(k.by)},style:{...Hs,...R},children:s==="right"||s==="bottom"?`${w} ${Wi[s]}`:`${Wi[s]} ${w}`},k.id))}}return(0,On.jsx)(On.Fragment,{children:d})}var Cs=e=>(e.length+2)*7.4+22,rr=oo/2,En=6,Ts=6,Is=236,Ns=56;function Vi(e,t,n,o,r=En){return e==="left"||e==="right"?{left:e==="left"?r:o.width-r-n,right:e==="left"?r+n:o.width-r,top:t-rr,bottom:t+rr}:{left:t-n/2,right:t+n/2,top:e==="top"?r:o.height-r-oo,bottom:e==="top"?r+oo:o.height-r}}function Bs(e,t,n,o,r,a){let i=t==="left"||t==="right",l=f=>Vi(t,f,o,r),u=f=>e.find(y=>{let v=l(f);return v.left<y.right&&y.left<v.right&&v.top<y.bottom&&y.top<v.bottom}),d=u(n);if(!d)return{at:n,inset:En};let s=i?rr:o/2,c=f=>{let y=n;for(let v=0;v<12;v++){let k=u(y);if(!k)return y;if(y=f>0?(i?k.bottom:k.right)+s+4:(i?k.top:k.left)-s-4,y>a-Rn||y<Rn)return null}return null},h=c(1);if(h!==null)return{at:h,inset:En};let p=c(-1);if(p!==null)return{at:p,inset:En};let x=t==="left"?d.right:t==="right"?r.width-d.left:t==="top"?d.bottom:r.height-d.top;return{at:n,inset:Math.max(En,x+4)}}var Hs={position:"absolute",zIndex:Fe.lines,minHeight:28,maxWidth:"40%",padding:"3px 10px",font:"inherit",fontSize:"0.75rem",letterSpacing:"0.04em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:6,boxShadow:"0 2px 8px rgb(0 0 0 / 0.12)",cursor:"pointer"};function Gi(e){let[t,n]=(0,or.useState)(null);return(0,or.useLayoutEffect)(()=>{let o=e.current,r=null;for(let l=o?.parentElement??null,u=0;l&&!r&&u<4;l=l.parentElement,u++)r=l.querySelector(":scope > [data-graview-scene-trail]");if(!o||!r)return;let a=()=>{let l=o.getBoundingClientRect(),u=r.getBoundingClientRect(),d=u.width>0&&u.height>0?{x:u.left-l.left,y:u.top-l.top,width:u.width,height:u.height}:null;n(s=>s===d||s&&d&&s.x===d.x&&s.y===d.y&&s.width===d.width&&s.height===d.height?s:d)};if(a(),typeof ResizeObserver>"u")return;let i=new ResizeObserver(a);return i.observe(r),()=>i.disconnect()},[e]),t}var kt=re(Oe(),1),Ds=180;function zi({view:e,result:t,frame:n,panned:o,closer:r,screenId:a,setCamera:i}){let l=(0,kt.useRef)(new Map),u=Math.round((t.nodes.find(c=>c.id===a)?.height??0)/16),d=(0,kt.useRef)(e.overview??!1),s=(0,kt.useRef)(null);if((0,kt.useEffect)(()=>{if(!e.overview||!a||!t.city){if(d.current&&!e.overview)return;i($=>$.x===0&&$.y===0?$:{x:0,y:0});return}let c=t.nodes.find($=>$.id===a);if(!c)return;let h=r>1&&c.screenOf?t.nodes.find($=>$.id===ke(c.screenOf)):void 0,p=h?{x:Math.min(c.x,h.x),y:Math.min(c.y,h.y),width:Math.max(c.x+c.width,h.x+h.width)-Math.min(c.x,h.x),height:Math.max(c.y+c.height,h.y+h.height)-Math.min(c.y,h.y)}:c;if(p.x>=0&&p.y>=0&&p.x+p.width<=t.width&&p.y+p.height<=t.height&&!h)return;let f=24,y=($,X,T)=>$<f?f-$:$+X>T-f?T-f-($+X):0,v=bt(t),k=e.pan??{x:0,y:0},w=h?o.x+(t.width/2-(p.x+p.width/2)):o.x+y(p.x,p.width,t.width),O=t.height/2-(p.y+p.height/2),G=h?o.y+(c.y+O<f?f-c.y:O):o.y+y(p.y,p.height,t.height);i({x:(h?w:Math.max(-v.x,Math.min(v.x,w)))-k.x,y:(h?G:Math.max(-v.y,Math.min(v.y,G)))-k.y})},[a,e.overview,r,e.within?.view,u]),n.city){let c=new Map;for(let h of n.nodes){if(!h.plot||Math.round(h.plane)!==2)continue;let p=nn(h.plot.col+h.plot.side/2,h.plot.row+h.plot.side/2,n.city.cell,n.city.tilt);c.set(h.id,{x:n.city.originX+o.x+p.x,y:n.city.originY+o.y+p.y})}l.current=c}return(0,kt.useEffect)(()=>{let c=e.overview??!1,h=d.current&&!c;if(d.current=c,c&&s.current&&(clearTimeout(s.current),s.current=null),!h)return;let p=e.focusId?wt(e.focusId)[0]:void 0,x=p?l.current.get(ke(p)):void 0,f=t.nodes.find(y=>y.id===e.focusId);if(!x||!f){i({x:0,y:0});return}i({x:x.x-(f.x+f.width/2),y:x.y-(f.y+f.height/2)}),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{s.current=null,i({x:0,y:0})},Ds)},[e.overview]),(0,kt.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),{gliding:()=>s.current!==null}}var ar=re(Oe(),1),ir="[data-graview-view]";function $s(e,t){let n=null;for(let o=e?.closest(ir)??null;o&&t.contains(o);o=o.parentElement?.closest(ir)??null)n=o;return n}function Yi(e,t){let n=e.getBoundingClientRect();return{left:n.left,top:n.top,right:n.right-t.right,bottom:n.bottom-t.bottom,box:n}}function _i(e,t,n){let o=(0,ar.useRef)({dock:t,reveal:n});o.current={dock:t,reveal:n},(0,ar.useEffect)(()=>{let r=e.current;if(!r)return;let a=u=>{let{dock:d}=o.current;if(u.key!=="Tab"||u.defaultPrevented||d.right<=0&&d.bottom<=0)return;let s=Yi(r,d),c=[];for(let h of r.querySelectorAll(ir)){if(h.parentElement?.closest(ir)||h.inert||h.contains(document.activeElement))continue;let p=h.getBoundingClientRect(),x=Math.max(p.left,s.box.left),f=Math.min(p.right,s.box.right),y=Math.max(p.top,s.box.top),v=Math.min(p.bottom,s.box.bottom);f<=x||v<=y||!(d.right>0&&x>=s.right-1||d.bottom>0&&y>=s.bottom-1)||(h.inert=!0,c.push(h))}c.length!==0&&setTimeout(()=>{for(let h of c)h.inert=!1},0)},i=u=>{let d=u.target,s=$s(d,r);if(!s)return;let c=!0;try{c=d?.matches(":focus-visible")??!0}catch{}requestAnimationFrame(()=>{for(let h=s.parentElement;h;h=h===r?null:h.parentElement)h.scrollTop!==0&&(h.scrollTop=0),h.scrollLeft!==0&&(h.scrollLeft=0);c&&s.isConnected&&l(s)})},l=u=>{let d=Yi(r,o.current.dock),s=u.getBoundingClientRect(),c=12,h=(f,y,v,k)=>k-v>y-f-2*c||v<f+c?f+c-v:k>y-c?y-c-k:0,p=h(d.left,d.right,s.left,s.right),x=h(d.top,d.bottom,s.top,s.bottom);(Math.abs(p)>=1||Math.abs(x)>=1)&&o.current.reveal(Math.round(p),Math.round(x))};return document.addEventListener("keydown",a,!0),r.addEventListener("focusin",i),()=>{document.removeEventListener("keydown",a,!0),r.removeEventListener("focusin",i)}},[e])}var de=re(Oe(),1);function Ui(){let e=(0,de.useRef)(null),[t,n]=(0,de.useState)({right:0,bottom:0});return(0,de.useLayoutEffect)(()=>{let o=e.current;if(!o)return;let r=()=>{let i=o.getBoundingClientRect(),l={right:Math.round(i.width),bottom:Math.round(i.height)};n(u=>u.right===l.right&&u.bottom===l.bottom?u:l)};if(r(),typeof ResizeObserver>"u")return;let a=new ResizeObserver(r);return a.observe(o),()=>a.disconnect()},[]),{probe:e,dock:t}}function Xi(){let[e,t]=(0,de.useState)(null),n=(0,de.useRef)(null),o=(0,de.useRef)(0),r=(0,de.useCallback)(i=>{n.current=i,o.current===0&&(o.current=requestAnimationFrame(()=>{o.current=0,t(n.current)}))},[]),a=(0,de.useCallback)(()=>{o.current!==0&&cancelAnimationFrame(o.current),o.current=0;let i=n.current;return n.current=null,i&&t(null),i},[]);return{held:e,place:r,release:a}}function qi({stage:e,pan:t,setView:n,settled:o}){let r=(0,de.useRef)({x:0,y:0}),a=(0,de.useRef)(0),i=(0,de.useRef)(!1),l=(0,de.useRef)(o);l.current=o;let u=(0,de.useCallback)(()=>[...e.current?.querySelectorAll("[data-graview-world]")??[]],[e]),d=(0,de.useCallback)(({x:f,y})=>{let v=f===0&&y===0?"":`translate3d(${f}px, ${y}px, 0)`;for(let k of u())k.style.transform=v;Ki(e.current,f,y)},[u,e]),s=(0,de.useCallback)(()=>{a.current===0&&(a.current=requestAnimationFrame(()=>{a.current=0,d(r.current)}))},[d]),c=(0,de.useCallback)(()=>{i.current=!1;for(let f of u())f.style.transform="";Ki(e.current,0,0),l.current()},[u,e]),h=(0,de.useCallback)((f,y)=>{r.current={x:f.x-y.x,y:f.y-y.y},s()},[s]),p=(0,de.useCallback)(()=>{let{x:f,y}=r.current;return f===0&&y===0?!1:(a.current!==0&&cancelAnimationFrame(a.current),a.current=0,d({x:f,y}),r.current={x:0,y:0},i.current=!0,n(v=>{let k=v.pan??{x:0,y:0};return ht(v,{x:k.x+f,y:k.y+y})}),window.setTimeout(()=>{i.current&&c()},300),!0)},[n,c,d]);(0,de.useLayoutEffect)(()=>{i.current&&c()},[t,c]);let x=(0,de.useCallback)(()=>r.current,[]);return{shiftTo:h,settle:p,settling:i,offset:x}}function Ki(e,t,n){for(let o of e?.querySelectorAll(":scope > .graview-lattice, :scope > .graview-measure")??[]){if(t===0&&n===0){o.style.removeProperty("--graview-hand-x"),o.style.removeProperty("--graview-hand-y");continue}o.style.setProperty("--graview-hand-x",`${t}px`),o.style.setProperty("--graview-hand-y",`${n}px`)}}var Fs=4;function Qi({view:e,panned:t,limit:n,panWithin:o,moveByTransform:r,setView:a,setDragging:i,noteMoved:l,shift:u,district:d}){let s=(0,de.useRef)(!1),c=(0,de.useRef)(null),h=v=>{let k=e.pan??{x:0,y:0};c.current={kind:"pan",fromX:v.clientX,fromY:v.clientY,baseX:k.x,baseY:k.y,moved:!1}};return{onGroundDown:v=>{v.button===0&&(v.target.closest("[data-graview-view]")||h(v))},onCardDown:(v,k)=>{if(k.button===0){if(v.screenOf!==void 0&&!k.target.closest("[data-graview-grip]")){h(k);return}if(e.overview&&Pe(v.id)!==null){h(k);return}c.current={kind:"card",id:v.id,fromX:k.clientX,fromY:k.clientY,baseX:v.x-t.x,baseY:v.y-t.y,moved:!1}}},onDragMove:v=>{let k=c.current;if(!k)return;let w=v.clientX-k.fromX,O=v.clientY-k.fromY;if(!k.moved){if(Math.hypot(w,O)<Fs)return;k.moved=!0,i(!0),v.currentTarget.setPointerCapture(v.pointerId)}if(k.kind==="pan"){let G=o(n(),{x:k.baseX+w,y:k.baseY+O});r?u.shiftTo(G,e.pan??{x:0,y:0}):a($=>ht($,G))}else k.id&&d.place({id:k.id,x:k.baseX+w,y:k.baseY+O})},onDragUp:()=>{u.settle();let v=d.release();v&&a(k=>vn(k,v.id,{x:v.x,y:v.y})),c.current?.moved&&(s.current=!0,setTimeout(()=>s.current=!1,0),l()),c.current=null,!u.settling.current&&i(!1)},swallow:s}}function Zi({stage:e,view:t,setView:n}){let o=(0,de.useRef)({view:t,charge:0,coolUntil:0,lastScale:1});o.current.view=t;let r=(0,de.useRef)(()=>{}),a=(0,de.useRef)(()=>{});return(0,de.useEffect)(()=>{let i=e.current;if(!i)return;let l=(c,h)=>{let p=o.current;if(h<p.coolUntil)return;let x=p.view.overview??!1;c!==x&&(p.coolUntil=h+600,p.charge=0,n(pn(p.view,c)))},u=c=>{let h=o.current,p=h.view.overview??!1;if(c.ctrlKey){if(c.preventDefault(),!p){if(h.charge+=c.deltaY,Math.abs(h.charge)<60)return;h.charge>0?l(!0,performance.now()):h.charge=0;return}r.current(Math.exp(-c.deltaY*.004),c.clientX,c.clientY);return}!p||c.target?.closest("[data-graview-view], .graview-scroll, [data-graview-overlay], .graview-zoom")||(c.preventDefault(),a.current(-c.deltaX,-c.deltaY))},d=c=>{c.preventDefault(),o.current.lastScale=1},s=c=>{c.preventDefault();let h=o.current,p=c.scale??1;if(!(h.view.overview??!1)){p<.72&&l(!0,performance.now());return}let x=p/(h.lastScale||1);h.lastScale=p;let f=c;r.current(x,f.clientX,f.clientY)};return i.addEventListener("wheel",u,{passive:!1}),i.addEventListener("gesturestart",d),i.addEventListener("gesturechange",s),()=>{i.removeEventListener("wheel",u),i.removeEventListener("gesturestart",d),i.removeEventListener("gesturechange",s)}},[n,e]),{zoomAbout:r,panBy:a}}var Ji={directed:"You",autonomous:"An agent","co-edited":"You and an agent",rule:"A rule"};function io(e,t){let n=new Set(e.map(r=>r.id)),o=new Set;for(let r of t){if(n.has(r)){o.add(r);continue}let a=e.find(i=>i.aggregate?.memberIds.includes(r));a&&o.add(a.id)}return o}function ao(e){return e.emphasized?e.stressed?.95:.08:e.anyChosen?e.mine?.9:.12:e.touches?Math.max(.34,.9-.09*Math.max(0,(e.siblings??1)-1)):.12}function so(e){return e.edgeChosen?.9:e.lit?.78:e.own*(e.anyLit?e.kit.dim:e.kit.rest)}function at(e,t){if(!e)return null;let n=Math.max(0,Math.min(2,Math.floor(e.plane))),o=Math.max(0,Math.min(2,Math.ceil(e.plane))),{scale:r}=n===o?Qt(n,t):Vo(Qt(n,t),Qt(o,t),e.plane-n);return{x:e.x,y:e.y,width:e.width*r,height:e.height*r}}function an(e,t){if(typeof getComputedStyle>"u"||getComputedStyle(e).visibility==="hidden")return null;let n=-1/0,o=-1/0,r=1/0,a=1/0,i=e.getBoundingClientRect();n=Math.max(n,i.left),o=Math.max(o,i.top),r=Math.min(r,i.right),a=Math.min(a,i.bottom);let l=e.parentElement;for(;l&&l!==t;){let d=getComputedStyle(l);if(d.overflowX!=="visible"||d.overflowY!=="visible"){let s=l.getBoundingClientRect();d.overflowX!=="visible"&&(n=Math.max(n,s.left),r=Math.min(r,s.right)),d.overflowY!=="visible"&&(o=Math.max(o,s.top),a=Math.min(a,s.bottom))}l=l.parentElement}if(r-n<=2||a-o<=2)return null;let u=t.getBoundingClientRect();return{x:n-u.left,y:o-u.top,width:r-n,height:a-o}}function je(e,t,n,o=!1){if(!e||typeof document>"u")return null;let r=e.querySelector(`[data-graview-view="${CSS.escape(t)}"]`);return r?an(lo(r,n,o),e):null}function lo(e,t=!1,n=!1){return(t?e.querySelector(".graview-kind-block"):null)??e.querySelector('[data-graview-primitive="panel"], .graview-kind-face, .graview-kind-card')??(n?null:e.querySelector(':scope > [data-graview-primitive="chip"]'))??e}function sr(e,t,n,o,r){let a=d=>e.nodes.find(s=>s.id===d);if(r.startsWith("screen:")){let d=e.nodes.find(s=>s.id===ke(r.slice(7)));return d?je(t,d.id,!0)??at(d,n):null}let i=a(r),l=Pe(r);if(!i&&l!==null&&(i=a(Ce(l))),!i&&Ct(r)){let[d]=wt(r);d&&(i=a(ke(d)))}if(!i){let d=o.places().find(s=>s.as===r);d&&(i=a(Ce(d.kind))??a(ke(d.kind)))}if(i||(i=[...e.nodes].filter(d=>d.aggregate?.memberIds.includes(r)).sort((d,s)=>d.plane-s.plane)[0]),!i)return null;let u=e.city!==void 0;return je(t,i.id,u&&i.aggregate!==void 0&&Math.round(i.plane)===2)??at(i,n)}var st=re(Oe(),1);var Ye=re(Oe(),1);var et=re(Se(),1);function ta({title:e,name:t,path:n,maxHeight:o,children:r}){let a=(0,Ye.useContext)(Wo),[i,l]=(0,Ye.useState)(void 0),[u,d]=(0,Ye.useState)(void 0),[s,c]=(0,Ye.useState)(void 0),[h,p]=(0,Ye.useState)(!1),[x,f]=(0,Ye.useState)(!1),y=(0,Ye.useRef)(null),v=(0,Ye.useRef)(null);(0,Ye.useLayoutEffect)(()=>{let T=y.current,g=v.current;if(!T||!g||typeof ResizeObserver>"u")return;let R=()=>{c(T.clientHeight),d(g.offsetHeight||void 0)};R();let P=new ResizeObserver(R);return P.observe(T),P.observe(g),()=>P.disconnect()},[]);let k=Math.max(i??0,u??0)||void 0,w=!h&&k!==void 0&&s!==void 0&&k>s+1,O=a&&n?n:void 0,G=O&&a?.href?a.href(O):void 0,$=T=>T.stopPropagation(),X={onPointerDown:$,onDoubleClick:$,onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||($(T),T.key==="Enter"&&T.currentTarget.tagName==="A"&&!T.currentTarget.hasAttribute("href")&&(T.preventDefault(),T.currentTarget.click()))}};return(0,et.jsxs)("section",{"data-graview-preview":t,"aria-label":e,...h?{"data-graview-expanded":"","data-graview-overlay":""}:{},onKeyDown:h?T=>{T.key==="Escape"&&(T.stopPropagation(),p(!1))}:void 0,style:{...Ws,...h?js:{}},children:[(0,et.jsxs)("div",{style:Vs,children:[(0,et.jsx)("strong",{style:Gs,children:e}),O?(0,et.jsx)("a",{"data-graview-preview-open":"",...G?{href:G}:{role:"link",tabIndex:0},"aria-label":`Open ${e}`,style:ea,...X,onClick:T=>{$(T),!(G&&(T.metaKey||T.ctrlKey||T.shiftKey||T.button!==0))&&(T.preventDefault(),a?.open(O))},children:"Open"}):w||h?(0,et.jsx)("button",{type:"button","data-graview-preview-expand":"","aria-expanded":h,"aria-label":`${h?"Collapse":"Expand"} ${e}`,style:{...ea,...zs},...X,onClick:T=>{$(T),p(g=>!g)},children:h?"Collapse":"Expand"}):null]}),(0,et.jsxs)("div",{ref:y,"data-graview-preview-body":"",...i!==void 0?{"data-graview-content-height":i}:{},...w?{"data-graview-more":""}:{},onFocus:()=>f(!0),onBlur:()=>f(!1),style:{...Ys,...o!==void 0&&!h?{maxHeight:o}:{},...x?{overflowClipMargin:4}:{}},children:[(0,et.jsx)("div",{ref:v,"data-graview-preview-drawn":"",style:_s,children:(0,et.jsx)(Fo.Provider,{value:l,children:r})}),w?(0,et.jsx)("div",{"aria-hidden":"true","data-graview-preview-fade":"",style:Ks}):null]})]})}var Ws={display:"flex",flexDirection:"column",gap:"var(--graview-gap, 7px)",width:"100%",maxHeight:"100%",minHeight:0,padding:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge, #e4e0d8)",boxShadow:"var(--graview-lift-low)",background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)",overflow:"hidden"},js={maxHeight:"none",position:"absolute",top:0,left:0,right:0,width:"auto"},Vs={display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0,flex:"0 0 auto"},Gs={fontFamily:"var(--graview-font-display, inherit)",fontSize:"0.9375rem",lineHeight:1.25,fontWeight:560,letterSpacing:"0.005em",minWidth:0,overflowWrap:"anywhere"},ea={marginLeft:"auto",fontSize:"0.8125rem",fontWeight:560,color:"var(--graview-accent, #2f6f5e)",textDecoration:"none",textUnderlineOffset:"0.2em"},zs={font:"inherit",fontSize:"0.8125rem",fontWeight:560,background:"none",border:0,padding:0,cursor:"pointer"},Ys={position:"relative",flex:"0 1 auto",minHeight:0,overflowX:"visible",overflowY:"clip",minWidth:0},_s={display:"flow-root",minWidth:0},Ks={position:"absolute",left:0,right:0,bottom:0,height:48,pointerEvents:"none",background:"linear-gradient(to bottom, transparent, var(--graview-panel, #ffffff))"};var se=re(Se(),1),ra=(0,st.memo)(function({kinds:t}){let{store:n}=pe(),{view:o,go:r}=Tr(),a=(0,st.useRef)(null),i=Nr("districts",{align:"start"}),l=i.open,u=p=>Vn(n.schema,p),d=p=>n.graph.allNodes().filter(x=>x.kind===p).length,s=p=>!o.overview&&o.focusId===Ce(p),c=t.filter(p=>!s(p)),h=p=>{i.setOpen(!1);let x=a.current?.querySelector(".graview-beyond-more")??null;s(p)||r(gt(o,Ce(p))),x?.focus({preventScroll:!0});let f=`[data-graview-view="${Ce(p)}"][tabindex], [data-graview-view="${ke(p)}"][tabindex]`,y=40,v=()=>{let k=document.querySelector(f);k?k.focus({preventScroll:!0}):--y>0&&requestAnimationFrame(v)};requestAnimationFrame(v)};return(0,se.jsxs)("div",{ref:a,className:"graview-beyond","data-graview-beyond":t.length,"data-graview-beyond-open":l?"":void 0,children:[(0,se.jsxs)("button",{type:"button",className:"graview-beyond-more","data-testid":"beyond-more",...i.trigger,"aria-haspopup":"menu",title:`${c.length} more district${c.length===1?"":"s"} \u2014 press to see them`,onPointerDown:p=>p.stopPropagation(),onClick:p=>{p.stopPropagation(),i.toggle()},children:[(0,se.jsxs)("span",{className:"graview-beyond-count",children:["+",c.length]}),(0,se.jsx)("span",{className:"graview-beyond-word",children:"more"}),(0,se.jsx)("span",{className:"graview-beyond-chevron","aria-hidden":"true",children:l?"\u25BE":"\u25B4"})]}),l?(0,se.jsx)("ul",{...i.pane,className:"graview-beyond-list",role:"menu","aria-label":"The other districts","data-testid":"beyond-list",style:Ir,onPointerDown:p=>p.stopPropagation(),children:t.map(p=>(0,se.jsx)("li",{role:"none",children:(0,se.jsxs)("button",{type:"button",role:"menuitem","data-graview-pick":ke(p),"aria-current":s(p)?"location":void 0,title:s(p)?`${u(p)} \u2014 where you are`:`Go to ${u(p)}`,onPointerDown:x=>x.stopPropagation(),onClick:x=>{x.stopPropagation(),h(p)},children:[(0,se.jsx)("span",{className:"graview-beyond-name",children:u(p)}),(0,se.jsx)("span",{className:"graview-beyond-tally",children:s(p)?"here":d(p)})]})},p))}):null]})},(e,t)=>e.kinds.length===t.kinds.length&&e.kinds.every((n,o)=>n===t.kinds[o]));function oa(e,t){if(e===t)return!0;let n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(o=>o==="x"||o==="y"||uo(e[o],t[o]))}function uo(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)!==Array.isArray(t)||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==Array.prototype)return!1;if(Array.isArray(e)){let r=t;if(e.length!==r.length)return!1;for(let a=0;a<e.length;a++)if(!uo(e[a],r[a]))return!1;return!0}let o=Object.keys(e);return o.length!==Object.keys(t).length?!1:o.every(r=>uo(e[r],t[r]))}var ia=(0,st.memo)(aa,(e,t)=>e.mode===t.mode&&e.selected===t.selected&&e.fidelity===t.fidelity&&oa(e.node,t.node));function aa({node:e,mode:t,selected:n,fidelity:o}){let{store:r,views:a,view:i}=pe(),l=It(),u=oi(),d=ri(),s=e.aggregate||Ct(e.id)||Pe(e.id)!==null?"many":"one",c={cardinality:s,fidelity:o??jo[Xs(e.plane)].fidelity},h=s==="many"&&e.id===i.focusId?i.within?.view:void 0,p=a.resolve(e.kind,c,h),x=p?.view,f=a.resolve(e.kind,{cardinality:"many",fidelity:"full"})?.view,y=f!==void 0&&f.generic!==!0,v=e.aggregate?.memberIds,k=(0,st.useMemo)(()=>(v??[]).map(T=>r.graph.getNode(T)).filter(T=>T!==void 0),[v,r,l]),w={...e.aggregate?{nodes:k,label:p?.title??e.aggregate.label}:{node:r.graph.getNode(e.id)},fidelity:c.fidelity,cardinality:c.cardinality,mode:t,selected:n,implicated:u,flagged:d,...e.raised?{raised:!0}:{},...e.focused?{focused:!0}:{},...e.opened?{opened:!0}:{},...e.openedRows!==void 0?{openedRows:e.openedRows}:{},...e.plot?{plot:e.plot}:{},...e.nameplate?{nameplate:e.nameplate}:{},...e.states?{states:e.states}:{},...e.aggregate?.retired?{retired:e.aggregate.retired}:{},...e.rank?{rank:e.rank}:{},...e.nestedUnder?{nestedUnder:e.nestedUnder}:{},...y?{hasOwnView:!0}:{}};if(!x)return(0,se.jsx)(qs,{node:e,props:w});let O=$o(x),G=!e.aggregate&&w.node?w.node:void 0,$=O?G?{title:Kt(r.schema.tryDefinition(G.kind),G),name:G.id,path:Po(r.schema,G.kind,G.id)}:{title:w.label??e.kind,name:p?.title?vr(p.title):"",path:p?.title?`/places/${vr(p.title)}`:void 0}:void 0,X=[e.id,p?.title??"",c.fidelity,c.cardinality,t,n,e.raised??!1,e.focused??!1,e.opened??!1,e.openedRows??"",e.rank??"",e.nestedUnder??"",e.plot?`${e.plot.col},${e.plot.row},${e.plot.side}`:"",e.nameplate??"",e.states?e.states.values.map(T=>T.count).join(","):"",e.aggregate?co(e.aggregate.memberIds):"",e.aggregate?.retired??"",u?co(u):"",d?co(d):"",y].join("|");return(0,se.jsx)(Lr,{mode:t,children:(0,se.jsx)(ai,{kind:w.label??e.kind,...p?.title?{view:p.title}:{},children:(0,se.jsx)(Us,{signature:X,graph:l,draw:()=>O&&$?(0,se.jsx)(ta,{...$,maxHeight:O.maxHeight,children:(0,se.jsx)(x,{...w})}):(0,se.jsx)(x,{...w})})},`${e.id}|${p?.title??""}`)})}var Us=(0,st.memo)(function({draw:t}){return(0,se.jsx)(se.Fragment,{children:t()})},(e,t)=>e.signature===t.signature&&e.graph===t.graph);function Xs(e){return Math.max(0,Math.min(2,Math.round(e)))}function qs({node:e,props:t}){return(0,se.jsxs)("div",{style:{padding:8,font:"13px/1.4 system-ui",overflow:"hidden"},children:[(0,se.jsx)("strong",{children:t.label??e.kind}),t.nodes?(0,se.jsxs)("div",{children:[t.nodes.length," items"]}):(0,se.jsx)("div",{children:e.id})]})}var sa=(0,st.memo)(function({node:t}){let{store:n}=pe(),o=Tt(),r=t.aggregate,a=r.opens,i=r.memberIds.length,l=Ut(n.schema,r.kind,i),u=r.memberIds.slice(0,3).map(h=>{let p=n.graph.getNode(h),x=p?n.schema.tryDefinition(p.kind):void 0;return p?x?.label?x.label(p):String(p.label??h):h}),d=r.memberIds,s=(0,st.useMemo)(()=>{let h=o?_n(o):null;return h?d.filter(p=>h.has(p)).length:0},[o,d]),c=a.in==="picture";return(0,se.jsxs)("div",{className:"graview-band-group","data-graview-band":a.in,"data-graview-band-count":i,"data-graview-emphasis":o?s>0?"lit":"dimmed":void 0,title:c?`${r.label} \u2014 press twice to see them all, arranged`:`${r.label}: ${l} \u2014 press twice to open`,children:[(0,se.jsxs)("span",{className:"graview-band-group-head",children:[(0,se.jsx)("span",{className:"graview-band-group-name",children:r.label}),(0,se.jsx)("span",{className:"graview-band-group-open","aria-hidden":"true",children:c?"\u2197":"\u25BE"})]}),(0,se.jsxs)("span",{className:"graview-band-group-names",children:[c?null:(0,se.jsxs)("span",{className:"graview-band-group-count",children:[l,s>0?` \xB7 ${s} match`:""," \xB7 "]}),u.join(" \xB7 "),i>u.length?" \u2026":""]})]})},(e,t)=>oa(e.node,t.node)),na=new WeakMap;function co(e){let t=na.get(e);if(t!==void 0)return t;let n=2166136261;for(let r of e){for(let a=0;a<r.length;a++)n=Math.imul(n^r.charCodeAt(a),16777619);n=Math.imul(n^44,16777619)}let o=`${e.length}:${(n>>>0).toString(36)}`;return na.set(e,o),o}var St=re(Oe(),1);function ho(e,t,n){let o=e.aggregate?[...e.aggregate.memberIds]:[e.id];return n?o.every(a=>t.includes(a))?t.filter(a=>!o.includes(a)):[...t,...o.filter(a=>!t.includes(a))]:o}function da(){let[e,t]=(0,St.useState)(16);return(0,St.useEffect)(()=>{if(typeof window>"u")return;let n=document.documentElement,o=()=>{let a=parseFloat(getComputedStyle(n).fontSize);Number.isFinite(a)&&t(i=>Math.abs(i-a)<.5?i:a)};o();let r=new MutationObserver(o);return r.observe(n,{attributes:!0,attributeFilter:["style"]}),window.addEventListener("resize",o),()=>{r.disconnect(),window.removeEventListener("resize",o)}},[]),e}function la(e){let[t,n]=(0,St.useState)(null);return(0,St.useLayoutEffect)(()=>{let o=e.current?.getBoundingClientRect();!o||o.width===0||o.height===0||n(r=>r??{width:Math.round(o.width),height:Math.round(o.height)})},[e]),(0,St.useEffect)(()=>{let o=e.current;if(!o||typeof ResizeObserver>"u")return;let r=l=>{!l||l.width===0||l.height===0||n(u=>{let d={width:Math.round(l.width),height:Math.round(l.height)};return u&&u.width===d.width&&u.height===d.height?u:d})},a=new ResizeObserver(l=>r(l[0]?.contentRect)),i=()=>r(o.getBoundingClientRect());return a.observe(o),addEventListener("resize",i),()=>{a.disconnect(),removeEventListener("resize",i)}},[e]),t}function fo(e,t){if(t==="dark")return`0 ${(10*e).toFixed(1)}px ${(34*e).toFixed(1)}px rgba(0,0,0,${(e+.12).toFixed(2)})`;let n=`0 ${(1+2*e).toFixed(1)}px ${(2+5*e).toFixed(1)}px rgba(20,30,32,${(.03+.06*e).toFixed(3)})`,o=`0 ${(6+26*e).toFixed(1)}px ${(18+60*e).toFixed(1)}px -${(10+10*e).toFixed(1)}px rgba(20,30,32,${(.1+.3*e).toFixed(3)})`;return`${n}, ${o}`}function ca(e){return`matrix3d(${e.join(",")})`}var ue=re(Oe(),1);var mo=(e,t)=>t.some(n=>e.x>n.x&&e.x<n.x+n.width&&e.y>n.y&&e.y<n.y+n.height);function po(e,t){let n=[],o=[];for(let a=0;a<e.length-1;a++){let i=e[a],l=e[a+1],u=!mo(i,t);u&&o.length===0&&o.push(i);for(let d=1;d<=48;d++){let s=d/48,c={x:i.x+(l.x-i.x)*s,y:i.y+(l.y-i.y)*s},h=!mo(c,t);if(h===u)continue;let p=(d-1)/48,x=s;for(let v=0;v<10;v++){let k=(p+x)/2,w={x:i.x+(l.x-i.x)*k,y:i.y+(l.y-i.y)*k};!mo(w,t)===u?p=k:x=k}let f=(p+x)/2,y={x:i.x+(l.x-i.x)*f,y:i.y+(l.y-i.y)*f};h?o=[y]:(o.push(y),o.length>=2&&n.push(o),o=[]),u=h}u&&o.push(l)}return o.length>=2&&n.push(o),n}function An(e,t){let n=Math.abs(t.x-e.x);if(Math.abs(t.y-e.y)>n){if(n<2)return[e,t];let a=(e.y+t.y)/2;return[e,{x:e.x,y:a},{x:t.x,y:a},t]}let r=(e.x+t.x)/2;return Math.abs(t.x-e.x)<2?[e,t]:[e,{x:r,y:e.y},{x:r,y:t.y},t]}var Xe=e=>Math.round(e*100)/100,Mt=e=>e.map(t=>t.map((n,o)=>`${o===0?"M":"L"} ${Xe(n.x)} ${Xe(n.y)}`).join(" ")).join(" ");function yo(e,t){if(e.length<3)return Mt([e]);let n=[`M ${Xe(e[0].x)} ${Xe(e[0].y)}`];for(let r=1;r<e.length-1;r++){let a=e[r-1],i=e[r],l=e[r+1],u=Math.hypot(i.x-a.x,i.y-a.y),d=Math.hypot(l.x-i.x,l.y-i.y),s=Math.min(t,u/2,d/2),c={x:i.x+(a.x-i.x)/(u||1)*s,y:i.y+(a.y-i.y)/(u||1)*s},h={x:i.x+(l.x-i.x)/(d||1)*s,y:i.y+(l.y-i.y)/(d||1)*s};n.push(`L ${Xe(c.x)} ${Xe(c.y)} Q ${Xe(i.x)} ${Xe(i.y)} ${Xe(h.x)} ${Xe(h.y)}`)}let o=e[e.length-1];return n.push(`L ${Xe(o.x)} ${Xe(o.y)}`),n.join(" ")}function ua(e,t){return t==="orthogonal"?Mt([e]):yo(e,10)}function ha(e,t,n){if(e==="orthogonal"){let l=An(t.p0,t.p1),u=l.slice(1).map((c,h)=>Math.hypot(c.x-l[h].x,c.y-l[h].y)),d=u.reduce((c,h)=>c+h,0)||1,s=n*d;for(let c=0;c<u.length;c++){let h=u[c];if(s<=h||c===u.length-1){let p=h===0?0:Math.min(1,s/h),x=l[c],f=l[c+1];return{x:x.x+(f.x-x.x)*p,y:x.y+(f.y-x.y)*p}}s-=h}return t.p1}let o=e==="straight"?{x:(t.p0.x+t.p1.x)/2,y:(t.p0.y+t.p1.y)/2}:t.c,r=(1-n)*(1-n),a=2*(1-n)*n,i=n*n;return{x:r*t.p0.x+a*o.x+i*t.p1.x,y:r*t.p0.y+a*o.y+i*t.p1.y}}function dr(e,t){return e!=="straight"?t:{...t,c:{x:(t.p0.x+t.p1.x)/2,y:(t.p0.y+t.p1.y)/2}}}function fa(e,t){let n=t.x-e.x,o=t.y-e.y,r=(n/2+o)/2,a=(o-n/2)/2;if(Math.abs(r)<1||Math.abs(a)<1)return[e,t];let i={x:e.x+2*r,y:e.y+r};return[e,i,t]}function ma(e){let t=[...e].sort((o,r)=>o.y-r.y||o.x-r.x),n=[];for(let o of t){let r=n.find(a=>o.y<a.bottom+3&&o.y+o.height>a.top-3);r?(r.boxes.push(o),r.top=Math.min(r.top,o.y),r.bottom=Math.max(r.bottom,o.y+o.height)):n.push({top:o.y,bottom:o.y+o.height,boxes:[o]})}for(let o of n)o.boxes.sort((r,a)=>r.x-a.x);return n.sort((o,r)=>o.top-r.top)}var Ln=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,wo=(e,t)=>e.findIndex(n=>n.boxes.some(o=>Ln(o,t)));function pa(e,t,n){return t<0?e[0].top-12*2:n>=e.length?e[e.length-1].bottom+12*2:(e[t].bottom+e[n].top)/2}function bo(e,t){let n=[{from:-1/0,to:1/0}];for(let a of e){let i=[],l=-1/0;for(let d of a.boxes)i.push({from:l,to:d.x-12}),l=Math.max(l,d.x+d.width+12);i.push({from:l,to:1/0});let u=[];for(let d of n)for(let s of i){let c=Math.max(d.from,s.from),h=Math.min(d.to,s.to);h-c>=0&&u.push({from:c,to:h})}n=u}let o=t,r=1/0;for(let a of n){let i=Math.min(Math.max(t,a.from),a.to),l=a.from===-1/0||a.to===1/0,u=Math.abs(i-t)+(l?60:0);u<r&&(r=u,o=i)}return o}var tt=e=>({x:e.x,y:-(e.y+e.height),width:e.width,height:e.height}),lr=e=>e.map(t=>({x:t.x,y:-t.y}));function xo(e){let t=(o,r)=>Math.abs(o-r)<.5,n=e.filter((o,r)=>r===0||!(t(o.x,e[r-1].x)&&t(o.y,e[r-1].y)));return n.filter((o,r)=>{let a=n[r-1],i=n[r+1];return!a||!i||!(t(a.x,o.x)&&t(o.x,i.x)||t(a.y,o.y)&&t(o.y,i.y))})}function vo(e,t,n){let o=e.boxes.filter(d=>!Ln(d,t)&&d.y+d.height<=t.y+1&&d.x<t.x+t.width&&d.x+d.width>t.x),r=[{from:t.x+6,to:t.x+t.width-6}];for(let d of o)r=r.flatMap(s=>[{from:s.from,to:Math.min(s.to,d.x-12/2)},{from:Math.max(s.from,d.x+d.width+12/2),to:s.to}]).filter(s=>s.to>=s.from);let a=null;for(let d of r){let s=Math.min(Math.max(n,d.from),d.to);(a===null||Math.abs(s-n)<Math.abs(a-n))&&(a=s)}if(a!==null)return{x:a,tail:[{x:a,y:t.y}]};let i=n<t.x+t.width/2,l=bo([e],i?t.x-12:t.x+t.width+12),u=t.y+t.height/2;return{x:l,tail:[{x:l,y:u},{x:l<t.x?t.x:t.x+t.width,y:u}]}}function go(e,t,n){let o=vo({top:-e.bottom,bottom:-e.top,boxes:e.boxes.map(tt)},tt(t),n);return{x:o.x,head:lr(o.tail).reverse()}}function ya(e,t,n,o){let r=t;for(;r>o&&!e[r-1].boxes.some(a=>n>a.x-12/2&&n<a.x+a.width+12/2);)r--;return r}var ga=(e,t)=>(e%3-1)*Math.max(0,Math.min(4,t/2-3));function wa(e,t,n,o,r,a,i,l){let u=f=>f<0?e[0].top-n:e[f+1].top-e[f].bottom,d=f=>(f<0?(n+e[0].top)/2:pa(e,f,f+1))+ga(l,u(f)),s=vo(e[a],r,i),c=ya(e,a,s.x,t+1),h=d(t);if(c===t+1)return xo([...o.head,{x:o.x,y:h},{x:s.x,y:h},...s.tail]);let p=bo(e.slice(t+1,c),s.x),x=d(c-1);return xo([...o.head,{x:o.x,y:h},{x:p,y:h},{x:p,y:x},{x:s.x,y:x},...s.tail])}function sn(e,t,n,o=0){let r=ma(n.some(s=>Ln(s,e))&&n.some(s=>Ln(s,t))?n:[...n,e,t]),a=wo(r,e),i=wo(r,t),l=e.x+e.width/2,u=t.x+t.width/2;if(a===i){if(!(a<r.length-1||r.length===1))return lr(sn(tt(e),tt(t),n.map(tt),o));let c=pa(r,a,a+1)+ga(o,a<r.length-1?r[a+1].top-r[a].bottom:2*12),h=go(r[a],e,u),p=go(r[a],t,l);return xo([...h.head,{x:h.x,y:c},{x:p.x,y:c},...[...p.head].reverse()])}if(i<a)return lr(sn(tt(e),tt(t),n.map(tt),o));let d=go(r[a],e,u);return wa(r,a,r[a].bottom,d,t,i,l,o)}function ko(e,t,n,o=0){if(t.y+t.height<=e.y){let p=ko(tt(e),tt(t),n.map(tt),o);return p?lr(p):null}let r=e.y+e.height;if(t.y<r)return null;let a=ma([...n.filter(p=>p.y>=r&&!Ln(p,t)),t]),i=wo(a,t),l=t.x+t.width/2,u=vo(a[i],t,l),d=ya(a,i,u.x,0),s=d===0?u.x:bo(a.slice(0,d),u.x),c=Math.min(12,e.width/2),h=Math.min(Math.max(s,e.x+c),e.x+e.width-c);return wa(a,-1,r,{x:h,head:[{x:h,y:r}]},t,i,l,o)}function xa(e,t=16){let n=new Map;for(let r of e){let a=r.a<r.b?`${r.a}\0${r.b}`:`${r.b}\0${r.a}`,i=n.get(a);i?i.push(r.key):n.set(a,[r.key])}let o=new Map;for(let r of n.values())r.forEach((a,i)=>o.set(a,(i-(r.length-1)/2)*t));return o}var _e=re(Se(),1);function Mo(e,t,n,o){let r=[];for(let a of e.querySelectorAll("[data-graview-relation] > span")){let i=a.getBoundingClientRect();if(i.width<=0||i.height<=0)continue;let l=i.top-t.top,u=a.parentElement?.getAttribute("data-graview-relation"),d=1/0;for(let s of n){if(Math.round(s.plane)!==1||!s.via||`${s.via.edgeKind}|${s.via.direction}`!==u)continue;let c=o(s.id);c&&c.y>=l+i.height-1&&(d=Math.min(d,c.y))}r.push({x:i.left-t.left,y:l,width:i.width,height:d-l<=i.height*4?d-l:i.height})}return r}function ur(e,t){let n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),o=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n>0&&o>0)return null;let r=n>.5*Math.min(e.width,t.width),a=!r&&o>.5*Math.min(e.height,t.height);if(r){let x={x:e.x+e.width,y:e.y+e.height/2},f={x:t.x+t.width,y:t.y+t.height/2};return{from:x,to:f,control:{x:Math.max(x.x,f.x)+18,y:(x.y+f.y)/2},mode:"stacked"}}if(a){let x={x:e.x+e.width/2,y:e.y},f={x:t.x+t.width/2,y:t.y};return{from:x,to:f,control:{x:(x.x+f.x)/2,y:Math.min(x.y,f.y)-18},mode:"abreast"}}let i={x:t.x+t.width/2,y:t.y+t.height/2},l={x:e.x+e.width/2,y:e.y+e.height/2},u=cr(e,i),d=cr(t,l),s=Math.hypot(d.x-u.x,d.y-u.y);if(s<8)return null;let c=Math.min(36,s*.12),h=-(d.y-u.y)/s,p=(d.x-u.x)/s;return{from:u,to:d,control:{x:(u.x+d.x)/2+h*c,y:(u.y+d.y)/2+p*c},mode:"direct"}}function cr(e,t){let n=e.x+e.width/2,o=e.y+e.height/2,r=t.x-n,a=t.y-o;if(r===0&&a===0)return{x:n,y:o};let i=r===0?1/0:e.width/2/Math.abs(r),l=a===0?1/0:e.height/2/Math.abs(a),u=Math.min(i,l),d=Math.max(0,u*.98);return{x:n+r*d,y:o+a*d}}function Qs(e,t,n){let o=t.get(e.from),r=t.get(e.to);if(!o||!r)return!1;if(n)return!0;let a=Math.round(o.plane)===1||Math.round(r.plane)===1,i=l=>!!l.aggregate&&Math.round(l.plane)===2;return a&&!i(o)&&!i(r)}var va=e=>({clips:new Map,members:new Map,marks:new Map,...e?{owed:e}:{}});function ka(e,t){let n=va();for(let[o,r]of t){let a=e.querySelector(`[data-graview-view="${CSS.escape(o)}"]`);if(a!==null){for(let i of r)if(dn(e,a,i,n).length>0)return!0}}return!1}function Sa(e,t){let n=t.marks.get(e);if(n)return n;n=new Map;for(let o of e.querySelectorAll("[data-graview-pick], [data-graview-slot]"))for(let r of new Set([o.getAttribute("data-graview-pick"),o.getAttribute("data-graview-slot")])){if(r===null)continue;let a=n.get(r);a?a.push(o):n.set(r,[o])}return t.marks.set(e,n),n}function Zs(e,t){let n=t.clips.get(e);if(n===void 0){let o=getComputedStyle(e);n=o.overflow!=="visible"||o.overflowX!=="visible"||o.overflowY!=="visible"?e.getBoundingClientRect():null,t.clips.set(e,n)}return n}function Js(e,t,n){let o=e.parentElement;for(;o!==null;){let r=Zs(o,n);if(r&&!(t.right>r.left+1&&t.left<r.right-1&&t.bottom>r.top+1&&t.top<r.bottom-1))return!1;if(o.hasAttribute("data-graview-view"))break;o=o.parentElement}return!0}function dn(e,t,n,o){if(!e||!t||typeof document>"u")return[];let r=o.members.get(t);r||o.members.set(t,r=new Map);let a=r.get(n);if(a)return a;let i=e.getBoundingClientRect(),l=[];for(let d of Sa(t,o).get(n)??[]){if(d.closest("[data-graview-offstage]"))continue;let s=d.getBoundingClientRect();s.width<=2||s.height<=2||Js(d,s,o)&&l.push({x:s.left-i.left,y:s.top-i.top,width:s.width,height:s.height})}l.sort((d,s)=>d.width*d.height-s.width*s.height),r.set(n,l);let u=t.getAttribute("data-graview-view");return l.length===0&&o.owed&&u!==null&&o.owed.set(u,(o.owed.get(u)??new Set).add(n)),l}function hr(e,t,n,o,r,a){let i=new Map(e.map(w=>[w.id,w])),l=va(a),u=new Map,d=w=>{if(!n||typeof document>"u")return null;let O=u.get(w);return O===void 0&&(O=n.querySelector(`[data-graview-view="${CSS.escape(w)}"]`),u.set(w,O)),O},s=new Map;for(let w of e){let O=je(n,w.id,o)??at(w,r);O&&s.set(w.id,O)}let c=new Map;if(n&&typeof document<"u"){let w=n.getBoundingClientRect();for(let O of n.querySelectorAll("[data-graview-pick], [data-graview-slot]")){if(O.closest("[data-graview-offstage]"))continue;let G=O.getAttribute("data-graview-pick")??O.getAttribute("data-graview-slot");if(G===null)continue;let $=O.getBoundingClientRect();if($.width<=2||$.height<=2||$.width>w.width*.6&&$.height>w.height*.6)continue;let X=c.get(G),T={x:$.left-w.left,y:$.top-w.top,width:$.width,height:$.height};X?X.push(T):c.set(G,[T])}}let h=(w,O)=>{let G=[];for(let[$,X]of s)$!==w&&$!==O&&G.push(X);for(let[$,X]of c)$!==w&&$!==O&&G.push(...X);return G},p=w=>Math.round(i.get(w)?.plane??-1)===1,x=[];for(let w of e){let O=s.get(w.id);O&&Math.round(w.plane)===1&&x.push(O)}if(!o&&n&&typeof document<"u"){let w=n.getBoundingClientRect();x.push(...Mo(n,w,e,O=>s.get(O)))}let f=(w,O)=>!o&&p(w)&&p(O)?x:void 0,y=o?void 0:e.find(w=>Math.round(w.plane)===0&&!w.aggregate),v=(w,O,G,$)=>{if(!y)return{};let X=w.to===y.id&&G===y.id;if(!X&&!(w.from===y.id&&O===y.id))return{};let T=X?w.from:w.to,g=s.get(y.id),R=s.get(T);if(T===y.id||!p(T)||!g||!R)return{};let P=d(y.id),A=te=>P!==null&&Sa(P,l).get(te)?.some(I=>!I.closest("[data-graview-offstage]"))===!0,j=$.map(te=>te.from===y.id?te.to:te.from),K=j.length>0&&j.every(A);return{band:x,tie:{card:g,chip:R,cardIsTo:X,toward:T,holds:i.get(T)?.aggregate?.memberIds??[T]},...K?{said:j}:{}}},k=[];for(let w of t){if(!Qs(w,i,o))continue;let O=s.get(w.from),G=s.get(w.to);if(!O||!G)continue;let $=h(w.from,w.to),X=w.edges,T=o&&X.some(P=>P.from!==w.from&&dn(n,d(w.from),P.from,l).length>0||P.to!==w.to&&dn(n,d(w.to),P.to,l).length>0),g=f(w.from,w.to);if(o&&!T||w.loop||X.length===0){k.push({key:w.id,connector:w,edges:X,fromBox:O,toBox:G,fromAnchor:w.from,toAnchor:w.to,obstacles:$,hosts:[],...g?{band:g}:{},...v(w,w.from,w.to,X)});continue}let R=new Map;for(let P of X){let A=P.from===w.from?[]:dn(n,d(w.from),P.from,l),j=P.to===w.to?[]:dn(n,d(w.to),P.to,l),K=[w.from,w.to].find(S=>Math.round(i.get(S)?.plane??-1)===0);if(!o&&K!==void 0&&(K===w.from?P.from!==w.from:P.to!==w.to)&&dn(n,d(K),K===w.from?P.to:P.from,l).length>0)continue;let te=K!==void 0?i.get(K):void 0;if(!o&&te?.aggregate&&n&&(K===w.from?P.from!==w.from&&A.length===0:P.to!==w.to&&j.length===0))continue;let I=A.length>0?P.from:w.from,H=j.length>0?P.to:w.to,N=`${w.id}|${I}|${H}`,Q=R.get(N);if(Q){Q.edges.push(P);continue}let E=A.length>0?A:[O],F=j.length>0?j:[G],b=E[0],M=F[0],C=1/0;for(let S of E)for(let B of F){let L=Math.hypot(S.x+S.width/2-(B.x+B.width/2),S.y+S.height/2-(B.y+B.height/2));L<C&&(C=L,b=S,M=B)}R.set(N,{edges:[P],fromBox:b,toBox:M,fromAnchor:I,toAnchor:H})}for(let[P,A]of R)k.push({key:P,connector:w,obstacles:$,hosts:[...A.fromAnchor!==w.from?[O]:[],...A.toAnchor!==w.to?[G]:[]],...g?{band:g}:{},...A,...v(w,A.fromAnchor,A.toAnchor,A.edges)})}return k}function Ma(e,t,n){let o=new Map(t.map(i=>[i.id,i])),r=new Map;for(let i of n){let l=o.get(i.id);l&&(l.x!==i.x||l.y!==i.y)&&r.set(i.id,{x:i.x-l.x,y:i.y-l.y})}if(r.size===0)return[...e];let a=(i,l)=>{let u=r.get(l);return u?{...i,x:i.x+u.x,y:i.y+u.y}:i};return e.map(i=>{let{from:l,to:u}=i.connector;if(!r.has(l)&&!r.has(u))return i;let d=a(i.fromBox,l),s=a(i.toBox,u),c=i.tie&&{...i.tie,card:a(i.tie.card,i.tie.cardIsTo?u:l),chip:a(i.tie.chip,i.tie.toward)},h=p=>p===i.fromBox?d:p===i.toBox?s:i.tie&&p===i.tie.chip?c.chip:p;return{...i,fromBox:d,toBox:s,...c?{tie:c}:{},...i.band?{band:i.band.map(h)}:{}}})}function So(e,t){let n=(1-t)*(1-t),o=2*(1-t)*t,r=t*t;return{x:n*e.p0.x+o*e.c.x+r*e.p1.x,y:n*e.p0.y+o*e.c.y+r*e.p1.y}}function ba(e,t,n){let o=(1-t)*(1-n),r=(1-t)*n+t*(1-n),a=t*n;return{p0:So(e,t),c:{x:o*e.p0.x+r*e.c.x+a*e.p1.x,y:o*e.p0.y+r*e.c.y+a*e.p1.y},p1:So(e,n)}}function Pn(e,t){let n=d=>t.some(s=>d.x>s.x&&d.x<s.x+s.width&&d.y>s.y&&d.y<s.y+s.height),o=d=>!n(So(e,d)),a=(d,s,c)=>{for(let h=0;h<10;h++){let p=(d+s)/2;o(p)===c?d=p:s=p}return(d+s)/2},i=[],l=null,u=o(0);u&&(l=0);for(let d=1;d<=64;d++){let s=d/64,c=o(s);if(c===u)continue;let h=a((d-1)/64,s,u);c?l=h:l!==null&&(h-l>.001&&i.push(ba(e,l,h)),l=null),u=c}return l!==null&&1-l>.001&&i.push(ba(e,l,1)),i}function Ea({strands:e,result:t,scheme:n,overview:o,selection:r,emphasis:a,stageRef:i,liveOf:l,onPickEdge:u,provisional:d,pointed:s=null}){let c=Bt(),h=new Set(t.nodes.filter(g=>g.plot!==void 0&&Math.round(g.plane)===2).map(g=>g.id)),p=g=>o&&t.city!==void 0&&h.has(g.from)&&h.has(g.to),x=io(t.nodes,r),f=g=>x.size===0||x.has(g.from)||x.has(g.to),y=new Set(r.filter(g=>Pt(g)===null)),v=o?t.nodes.find(g=>Math.round(g.plane)===0):void 0,k=v?je(i.current,v.id,!1)??at(v,n):null;if(e.length===0)return null;let w=g=>g.edges.some(R=>y.has(R.from)||y.has(R.to)),O=y.size>0&&e.some(w),G=new Map;for(let g of e)G.set(g.connector.id,(G.get(g.connector.id)??0)+1);let $=xa(e.map(g=>({key:g.key,a:g.fromAnchor,b:g.toAnchor}))),X=new Set,T=e.map((g,R)=>{let{connector:P,fromBox:A,toBox:j}=g,K={x:A.x+A.width/2,y:A.y+A.height/2},te={x:j.x+j.width/2,y:j.y+j.height/2},I=o?cr(A,te):K,H=o?cr(j,K):te,N=P.loop===!0,{connector:Q,style:E}=tn(c,P.kind);if(!Q.visible)return null;let F=N?Math.max(22,Math.min(A.width,A.height)*.3):0,b=N?{x:K.x+A.width*.22,y:K.y-A.height/2-F+7}:I,M=(I.x+H.x)/2,C=(I.y+H.y)/2,S=Math.hypot(H.x-I.x,H.y-I.y),B=Math.min(o?40:90,S*(o?.09:.16)),L=0,W=0;if(S>0){L=-(H.y-I.y)/S,W=(H.x-I.x)/S;let ae=M-t.width/2,we=C-t.height/2;if(k&&!N){let ot=k.x+k.width/2,At=k.y+k.height/2;ae=M-ot,we=C-At;let Ge=Math.abs(L*(ot-I.x)+W*(At-I.y)),jt=Math.hypot(k.width/2,k.height/2)*.85+24,Vt=((ot-I.x)*(H.x-I.x)+(At-I.y)*(H.y-I.y))/(S*S);Ge<jt&&Vt>.1&&Vt<.9&&(B=Math.min(180,Math.max(B,(jt-Ge)*2)))}L*ae+W*we<0&&(L=-L,W=-W)}B+=2*($.get(g.key)??0);let Z=dr(Q.route,{p0:I,c:{x:M+L*B,y:C+W*B},p1:H}),_=p(P),z=Q.route==="orthogonal"||_,ee=(ae,we)=>_?fa(ae,we):An(ae,we),q=!N&&g.tie?ko(g.tie.card,g.tie.chip,g.band??[],R):null,he=q?g.tie.cardIsTo?q.reverse():q:!N&&g.band?sn(A,j,g.band,R):null,ce=N||z||he?[]:Pn(Z,[A,j,...g.obstacles]),He=he?[he]:!N&&z?po(ee(I,H),[A,j,...g.obstacles]):[];if(!N&&ce.length===0&&He.length===0)return null;let Me=He[He.length-1],Ae=z||he?He[0]?.[0]:ce[0]?.p0,De=z||he?Me?.[Me.length-1]:ce[ce.length-1]?.p1,Te=ae=>ae.map(we=>`M ${we.p0.x} ${we.p0.y} Q ${we.c.x} ${we.c.y} ${we.p1.x} ${we.p1.y}`).join(" "),ie=`M ${b.x-F} ${b.y} A ${F} ${F} 0 1 1 ${b.x+F} ${b.y} A ${F} ${F} 0 0 1 ${b.x-F} ${b.y}`,xe=N?ie:he?ua(he,Q.route):z?Mt(He):Te(ce),qe=ae=>({x:ae.x-8,y:ae.y-8,width:ae.width+16,height:ae.height+16}),Et=[A,j,...g.hosts,...g.obstacles].map(qe),ne=N?ie:he?Mt(He):z?Mt(po(ee(I,H),Et)):Te(Pn(Z,Et)),rt=g.edges.length===1?g.edges[0]:null,$e=rt?Ht(P.kind,rt.from,rt.to):null,Rt=$e!==null&&r.includes($e),Ve=$e!==null?d?.get($e):void 0,Ot=g.edges.some(ae=>y.has(ae.from)||y.has(ae.to)),Ke=g.tie?.toward??"",Qe=g.tie!==void 0&&(s!==null&&(Ke===s||g.tie.holds.includes(s)||g.said?.includes(s)===!0)||y.has(Ke))&&!X.has(Ke);Qe&&X.add(Ke);let Le=!o&&y.size>0&&Ot||Qe,Ie=a!==null&&P.kind===a||Rt,mt=l?.(P)!==void 0;if(o&&!mt||!o&&!mt&&y.size>0&&!Ot&&!Ie&&!Qe||g.said!==void 0&&!Qe&&!g.said.some(ae=>y.has(ae))&&!Ie)return null;let Ue=o?ao({emphasized:a!==null,stressed:Ie,anyChosen:O,mine:Ot,touches:f(P),siblings:G.get(P.id)??1}):so({edgeChosen:Rt,lit:Le,anyLit:O||a!==null,own:E.opacity,kit:c.emphasis}),pt=Le&&Ae&&De?g.tie?g.tie.cardIsTo?Ae:De:g.edges.some(ae=>y.has(ae.from))?De:Ae:null,cn=(0,_e.jsxs)("g",{children:[(0,_e.jsx)("path",{"data-graview-connector":P.kind,"data-graview-edges":g.edges.length,"data-graview-from":g.fromAnchor,"data-graview-to":g.toAnchor,"data-graview-lit":Le||void 0,"data-graview-activity":l?.(P)?.manner,"data-graview-provisional":Ve!==void 0||void 0,opacity:Ue*(P.opacity??1)*(Ve!==void 0?bn:1),d:xe,fill:"none",stroke:Zt(E),strokeWidth:(Le?Math.max(1.6,Br(E,o)):Br(E,o))+(Ie?.6:0),strokeDasharray:Ve!==void 0?xn:Kn[E.pattern],strokeLinecap:"round"}),pt?(0,_e.jsx)("circle",{cx:pt.x,cy:pt.y,r:2.6,fill:Zt(E),opacity:Ue}):null,N&&o?(0,_e.jsx)("text",{x:b.x,y:b.y-F-5,textAnchor:"middle",opacity:Ue,style:{font:"9px var(--graview-font-body, system-ui)",letterSpacing:"0.09em",textTransform:"uppercase",fill:"var(--graview-ink-faint)"},children:jn(P.kind).toLowerCase()}):null]},g.key),dt=null;return $e&&u&&!N&&Ue>=.2&&(dt=(0,_e.jsx)("path",{"data-graview-edge":$e,className:"graview-edge-hit",d:ne,fill:"none",pathLength:1,strokeDasharray:"0.86",strokeDashoffset:-.07,stroke:"transparent",strokeWidth:14,style:{pointerEvents:"stroke",cursor:"pointer"},onClick:ae=>{ae.stopPropagation(),u($e,{x:ae.clientX,y:ae.clientY})},onContextMenu:ae=>{ae.preventDefault(),ae.stopPropagation(),u($e,{x:ae.clientX,y:ae.clientY})},children:Ve!==void 0?(0,_e.jsx)("title",{children:Ve}):null},`hit:${g.key}`)),{key:g.key,line:cn,hit:dt}});return(0,_e.jsxs)(_e.Fragment,{children:[(0,_e.jsx)("svg",{"aria-hidden":"true","data-graview-world":"",width:t.width,height:t.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:Fe.ties},children:T.map(g=>g?.line)}),T.some(g=>g?.hit)?(0,_e.jsx)("svg",{"data-graview-world":"",width:t.width,height:t.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:Fe.tieLabels},children:T.map(g=>g?.hit)}):null]})}function Ra(e,t,n){if(t.size===0||typeof MutationObserver>"u")return()=>{};let o=0,r=()=>{o=0,ka(e,t)&&n()},a=()=>{o===0&&(o=requestAnimationFrame(r))},i=({target:u})=>{for(let d=u instanceof Element?u:u.parentElement;d&&d!==e;d=d.parentElement)if(t.has(d.getAttribute("data-graview-view")??""))return!0;return!1},l=new MutationObserver(u=>{u.some(i)&&a()});return l.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-graview-pick","data-graview-slot","data-graview-offstage"]}),a(),()=>{l.disconnect(),cancelAnimationFrame(o)}}function fr(e){return e<640?{left:8,right:56}:{left:8,right:Math.round(Math.min(128,e*.107))}}function ed(e){return Math.min(260,16+e.length*6.6)}var Cn=(e,t)=>Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));function Aa(e,t,n){let o=new Map;for(let i of e){let l=o.get(i.said);l?l.push(i):o.set(i.said,[i])}let r=[],a=[];for(let[i,l]of o){let u=l[0],d=ed(i),{end:s,far:c}=u,h=y=>Math.max(0,Math.min(n.width-d,y)),p=[{x:h(s.x-d/2),y:c.y-22-6,width:d,height:22},{x:h(s.x-d/2),y:c.y+c.height+6,width:d,height:22},{x:c.x+c.width+6,y:s.y-22/2,width:d,height:22},{x:c.x-d-6,y:s.y-22/2,width:d,height:22}],x=p[0],f=1/0;for(let y of p){let k=y.x<0||y.y<0||y.x+y.width>n.width||y.y+y.height>n.height?1e9:0;for(let w of t)k+=Cn(y,w.title)*100+Cn(y,w.box);for(let w of r)k+=Cn(y,w)*100;if(k<f&&(f=k,x=y),k===0)break}r.push(x),a.push({said:i,keys:l.map(y=>y.key),...x})}return a}var Oa=(e,t,n=2)=>t.x>=e.x-n&&t.x<=e.x+e.width+n&&t.y>=e.y-n&&t.y<=e.y+e.height+n;function Eo(e,t){let n=new Set;for(let o of e)(t.edgeId&&o.edgeId===t.edgeId||t.point&&(Oa(o.fromBox,t.point)||Oa(o.toBox,t.point))||t.ids?.some(r=>o.ids.includes(r))||t.box&&(Cn(t.box,o.fromBox)>0||Cn(t.box,o.toBox)>0))&&n.add(o.key);return n}var ge=re(Se(),1);function Ca(e){let t=ei(e);return t.length>0?new Map(t.map(n=>[Ht(n.edge.kind,n.edge.from,n.edge.to),Jo(n)])):void 0}function Ta({frame:e,width:t,height:n,scheme:o,overview:r,selection:a,emphasis:i,stageRef:l,store:u,graphNodes:d,onPickEdge:s,liveOf:c,holding:h=!1,provisional:p,focusId:x=null,beside:f=!1}){let[y,v]=(0,ue.useState)(0),[k,w]=(0,ue.useState)(null),O=e.t<1,G=(0,ue.useRef)(""),$=(0,ue.useRef)([]),X=(0,ue.useRef)(new Map),T=()=>[...l.current?.querySelectorAll("[data-graview-relation] > span")??[]].map(I=>{let H=I.getBoundingClientRect();return`${Math.round(H.left)},${Math.round(H.top)},${Math.round(H.width)}`}).join(" ");(0,ue.useLayoutEffect)(()=>{if(O||h)return;G.current=T(),$.current=e.nodes;let I=new Map;w(hr(e.nodes,e.connectors,l.current,r,o,I)),X.current=I},[e,O,h,a,r,d,o,y,l]),(0,ue.useEffect)(()=>{let I=l.current;if(!(O||h||I===null))return Ra(I,X.current,()=>v(H=>H+1))},[k,O,h,l]),(0,ue.useEffect)(()=>{if(O||h||r||typeof requestAnimationFrame>"u")return;let I=requestAnimationFrame(()=>{T()!==G.current&&v(H=>H+1)});return()=>cancelAnimationFrame(I)},[k]);let g=e.nodes.map(I=>I.id).join(`
4
- `);(0,ue.useLayoutEffect)(()=>{let I=l.current;if(I===null||typeof window>"u")return;let H=0,N=()=>{H===0&&(H=requestAnimationFrame(()=>{H=0,v(E=>E+1)}))};I.addEventListener("scroll",N,{capture:!0,passive:!0}),window.addEventListener("resize",N,{passive:!0});let Q=typeof ResizeObserver>"u"?null:new ResizeObserver(N);if(Q){Q.observe(I);for(let E of I.querySelectorAll("[data-graview-view]"))Q.observe(E)}return()=>{H!==0&&cancelAnimationFrame(H),I.removeEventListener("scroll",N,{capture:!0}),window.removeEventListener("resize",N),Q?.disconnect()}},[l,g]);let R=(0,ue.useRef)(new WeakMap);(0,ue.useEffect)(()=>{let I=l.current;if(O||h||I===null||typeof ResizeObserver>"u")return;let H=0,N=new ResizeObserver(Q=>{let E=!1;for(let{target:F,contentRect:b}of Q){let M=`${Math.round(b.width)}x${Math.round(b.height)}`;R.current.has(F)&&R.current.get(F)!==M&&(E=!0),R.current.set(F,M)}E&&H===0&&(H=requestAnimationFrame(()=>{H=0,v(F=>F+1)}))});for(let Q of I.querySelectorAll("[data-graview-view]")){let E=lo(Q);E!==Q&&N.observe(E)}return()=>{H!==0&&cancelAnimationFrame(H),N.disconnect()}},[k,O,h,l]);let[P,A]=(0,ue.useState)(null),j=(k??[]).some(I=>I.tie!==void 0);if((0,ue.useEffect)(()=>{let I=l.current;if(!j||I===null)return;let H=Q=>{let E=Q.target?.closest?.("[data-graview-pick], [data-graview-view]");A(E?.getAttribute("data-graview-pick")??E?.getAttribute("data-graview-view")??null)},N=()=>A(null);return I.addEventListener("pointerover",H),I.addEventListener("focusin",H),I.addEventListener("pointerleave",N),I.addEventListener("focusout",N),()=>{I.removeEventListener("pointerover",H),I.removeEventListener("focusin",H),I.removeEventListener("pointerleave",N),I.removeEventListener("focusout",N)}},[j,l]),O)return null;let K=(k&&h?Ma(k,$.current,e.nodes):k)??hr(e.nodes,e.connectors,null,r,o),te=new Set;for(let I of K){if(I.edges.length===1){let H=I.edges[0];te.add(`${I.connector.kind}|${H.from}|${H.to}`);continue}for(let H of I.edges)(I.connector.from===H.from||I.connector.to===H.to)&&te.add(`${I.connector.kind}|${H.from}|${H.to}`)}return(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(Ea,{strands:K,result:e,scheme:o,overview:r,selection:a,emphasis:i,stageRef:l,onPickEdge:s,liveOf:c,pointed:P,...p?{provisional:p}:{}}),r&&kn(a,{overview:r,focusId:x,beside:f},I=>u.graph.getNode(I)?.kind).records.length>0?(0,ge.jsx)(ue.Suspense,{fallback:null,children:(0,ge.jsx)(nd,{frame:e,width:t,height:n,stageRef:l,tick:y,store:u,graphVersion:d,selection:a,view:{overview:r,focusId:x,beside:f},rulers:p?{...La,unsureOf:(I,H,N)=>p.get(Ht(I,H,N))}:La})}):null,r?null:(0,ge.jsx)(od,{...p?{provisional:p}:{},stageRef:l,nodes:e.nodes,scheme:o,selection:a,store:u,graphNodes:d,overview:r,width:t,height:n,onPickEdge:s,alreadyDrawn:te,tick:y})]})}var La={visibleRect:an,clipQuadratic:Pn,unsureDash:xn,unsureOpacity:bn},td=wn(Xt(()=>(__graviewPreload(import.meta.url,["./chunk.QDSEVPF3.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.7OPM55I2.js")))),nd=td.part((e,t)=>(0,ge.jsx)(e.RecordLinks,{...t}),{what:"The links",quiet:!0}),rd=44;function od({stageRef:e,nodes:t,scheme:n,selection:o,store:r,graphNodes:a,overview:i,width:l,height:u,onPickEdge:d,alreadyDrawn:s,tick:c,provisional:h}){let p=Bt(),x=(0,ue.useMemo)(()=>{if(o.length===0||o.length>4)return[];let g=new Set(o),R=[];for(let A of o){let j=Pt(A);j&&R.push({kind:j.kind,self:j.from,other:j.to})}for(let A of r.graph.allEdges()){let j=g.has(A.from)?A.from:g.has(A.to)?A.to:null;if(!j)continue;let K=j===A.from?A.to:A.from;g.has(K)||R.push({kind:A.kind,self:j,other:K})}if(R.length<=14)return R;let P=new Set(t.map(A=>A.id));return R.map((A,j)=>({tie:A,index:j,real:P.has(A.other)?0:1})).sort((A,j)=>A.real-j.real||A.index-j.index).slice(0,14).map(({tie:A})=>A)},[r,o,a,t]),f=()=>{if(x.length===0||typeof document>"u")return[];let g=e.current?.getBoundingClientRect();if(!g)return[];let R=[...e.current?.querySelectorAll("[data-graview-joins]")??[]].find(E=>{if(E.closest("[data-graview-offstage]"))return!1;try{let F=JSON.parse(E.getAttribute("data-graview-joins")??"[]");return F.length===o.length&&F.every(b=>o.includes(b))}catch{return!1}});if(R){let E=an(R,e.current);if(!E)return[];let F=[];for(let b of o){let M=t.find(L=>L.id===b);if(!M)continue;let C=je(e.current,M.id,i)??at(M,n),S=C?ur(E,C):null;if(!C||!S)continue;let B=[...r.graph.allEdges()].find(L=>L.from===b&&o.includes(L.to)||L.to===b&&o.includes(L.from));F.push({key:`join:${b}`,self:b,other:"",others:1,kind:B?.kind??"",endX:S.to.x,endY:S.to.y,...S,fromBox:E,toBox:C,proxy:!1,edgeId:B?Ht(B.kind,B.from,B.to):null})}return F}let P=(E,F)=>{let b=e.current?.querySelectorAll(`[data-graview-pick="${CSS.escape(E)}"], [data-graview-slot="${CSS.escape(E)}"]`),M=[];for(let C of b??[]){if(C.closest("[data-graview-offstage]")||F(C)||C.closest("[data-graview-mark]"))continue;let S=an(C,e.current);S&&M.push(S)}return M.sort((C,S)=>C.width*C.height-S.width*S.height)},A=E=>t.find(F=>F.id===E)??t.find(F=>F.aggregate?.memberIds.includes(E)),j=E=>`[data-graview-pick="${CSS.escape(E)}"], [data-graview-slot="${CSS.escape(E)}"]`,K=(E,F)=>{let b=e.current;if(!b)return!1;for(let M of b.querySelectorAll("[data-graview-view]")){let C=M.querySelector(j(E));if(C===null||C.closest("[data-graview-offstage]"))continue;let S=M.querySelector(j(F));if(S!==null&&!S.closest("[data-graview-offstage]"))return!0}return!1},te=[];if(!i&&e.current){for(let F of t){if(Math.round(F.plane)!==1)continue;let b=je(e.current,F.id,!1);b&&te.push(b)}let E=e.current;te.push(...Mo(E,g,t,F=>je(E,F,!1)))}let I=new Map,H=[];for(let E of x){if(K(E.self,E.other))continue;let F=A(E.self),b=F?e.current?.querySelector(`[data-graview-view="${CSS.escape(F.id)}"]`):null,M=!i&&F?.id===E.self&&Math.round(F.plane)===1?je(e.current,F.id,!1):null,C=M?[M]:P(E.self,()=>!1);if(!(C.length>0)&&F){let ie=je(e.current,F.id,!1)??at(F,n);ie&&C.push(ie)}let B=t.find(ie=>ie.id===E.other),L=[],W=!1;if(B){let ie=je(e.current,B.id,i)??at(B,n);ie&&L.push(ie)}else if(L.push(...P(E.other,ie=>b?b.contains(ie):!1)),L.length===0){let ie=A(E.other);if(ie&&(!F||ie.id!==F.id)){let xe=je(e.current,ie.id,i)??at(ie,n);xe&&(L.push(xe),W=!0)}}if(C.length===0||L.length===0||W&&i)continue;let Z=C[0],_=L[0],z=1/0;for(let ie of C)for(let xe of L){let qe=Math.hypot(ie.x+ie.width/2-(xe.x+xe.width/2),ie.y+ie.height/2-(xe.y+xe.height/2));qe<z&&(z=qe,Z=ie,_=xe)}if(s?.has(`${E.kind}|${E.self}|${E.other}`)||s?.has(`${E.kind}|${E.other}|${E.self}`))continue;let ee=`${E.kind}:${Math.round(Z.x)},${Math.round(Z.y)}:${Math.round(_.x)},${Math.round(_.y)}`,q=I.get(ee);if(q){q.others+=1;continue}let he=ur(Z,_);if(!he)continue;let{from:ce,control:He}=he,Me=M&&Z===M?sn(Z,_,te,H.length):void 0,Ae=Me?Me[Me.length-1]:he.to,De=[...r.graph.allEdges()].find(ie=>ie.kind===E.kind&&(ie.from===E.self&&ie.to===E.other||ie.from===E.other&&ie.to===E.self)),Te={key:`${E.kind}:${E.self}:${E.other}`,self:E.self,other:E.other,others:1,kind:E.kind,endX:Ae.x,endY:Ae.y,from:ce,to:Ae,control:He,fromBox:Z,toBox:_,...Me?{points:Me}:{},proxy:W,edgeId:De?Ht(De.kind,De.from,De.to):null};I.set(ee,Te),H.push(Te)}let N=i?void 0:t.find(E=>Math.round(E.plane)===0&&!E.aggregate),Q=E=>{let F=t.find(b=>b.id===E.other)??t.find(b=>b.aggregate?.memberIds.includes(E.other));return F!==void 0&&Math.round(F.plane)===1&&F.via?.edgeKind===E.kind};for(let E of H){if(N&&(E.self!==N.id||Q(E)))continue;let F=[...r.graph.allEdges()].find(L=>L.kind===E.kind&&(L.from===E.self&&L.to===E.other||L.from===E.other&&L.to===E.self)),b=r.graph.getNode(E.self),M=r.graph.getNode(E.other);if(!F||!b||!M)continue;let C=F.from===E.self?"out":"in",S=Zo(r.schema,C==="out"?b.kind:M.kind,E.kind,C),B=E.proxy?(C==="out"?r.graph.out(E.self,E.kind):r.graph.in(E.self,E.kind)).filter(L=>L.kind===M.kind).length:1;E.said=E.proxy?`${S}: ${Ut(r.schema,M.kind,Math.max(B,E.others))}`:`${S}: ${Kt(r.schema.tryDefinition(M.kind),M)}`}return H},[y,v]=(0,ue.useState)([]),[k,w]=(0,ue.useState)([]);(0,ue.useLayoutEffect)(()=>{let g=f();v(g),w(g.some(R=>R.said)?O(g):[])},[x,t,i,n,l,u,s,c,e]);let O=g=>{let R=e.current;if(!R)return[];let P=[];for(let A of R.querySelectorAll("[data-graview-view]")){let j=[...A.children].find(te=>!te.classList.contains("graview-kind-tag")),K=j?an(j,R):null;K&&P.push({box:K,title:{...K,height:Math.min(K.height,rd)}})}return Aa(g.flatMap(A=>A.said?[{key:A.key,said:A.said,end:{x:A.endX,y:A.endY},far:A.toBox}]:[]),P,{width:l,height:u})},[G,$]=(0,ue.useState)(()=>new Set),X=(0,ue.useRef)([]);X.current=y.map(g=>({key:g.key,fromBox:g.fromBox,toBox:g.toBox,ids:[g.self,g.other],edgeId:g.edgeId}));let T=k.length>0;return(0,ue.useEffect)(()=>{let g=e.current;if(!g||!T)return;let R=N=>$(Q=>Q.size===N.size&&[...N].every(E=>Q.has(E))?Q:N),P=0,A=null,j=()=>{if(P=0,!A)return;let N=g.getBoundingClientRect(),Q=A.target instanceof Element?A.target:null;R(Eo(X.current,{point:{x:A.clientX-N.left,y:A.clientY-N.top},edgeId:Q?.closest("[data-graview-edge]")?.getAttribute("data-graview-edge")??null}))},K=N=>{A=N,P||(P=requestAnimationFrame(j))},te=()=>{A=null,R(new Set)},I=N=>{let Q=N.target instanceof Element?N.target:null;if(!Q)return;let E=g.getBoundingClientRect(),F=Q.getBoundingClientRect(),b=Q.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??Q.closest("[data-graview-view]")?.getAttribute("data-graview-view");R(Eo(X.current,{...b?{ids:[b]}:{},box:{x:F.left-E.left,y:F.top-E.top,width:F.width,height:F.height}}))},H=N=>{N.relatedTarget instanceof Node&&g.contains(N.relatedTarget)||R(new Set)};return g.addEventListener("pointermove",K,{passive:!0}),g.addEventListener("pointerleave",te),g.addEventListener("focusin",I),g.addEventListener("focusout",H),()=>{P&&cancelAnimationFrame(P),g.removeEventListener("pointermove",K),g.removeEventListener("pointerleave",te),g.removeEventListener("focusin",I),g.removeEventListener("focusout",H)}},[e,T]),y.length===0?null:(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)("svg",{"aria-hidden":y.some(g=>g.edgeId)?void 0:!0,"data-graview-ties":y.length,"data-graview-world":"",width:l,height:u,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:Fe.lines},children:y.map(g=>{let{connector:R,style:P}=tn(p,g.kind);if(!R.visible)return null;let A=g.edgeId?h?.get(g.edgeId):void 0,j={p0:g.from,c:g.control,p1:g.to},K=g.points?yo(g.points,10):R.route==="orthogonal"?Mt([An(g.from,g.to)]):(({p0:I,c:H,p1:N})=>`M ${I.x} ${I.y} Q ${H.x} ${H.y} ${N.x} ${N.y}`)(dr(R.route,j)),te=null;if(g.edgeId&&d&&!g.proxy){let I=(N,Q)=>Q.x>=N.x&&Q.x<=N.x+N.width&&Q.y>=N.y&&Q.y<=N.y+N.height,H=g.points?[...g.points]:[];for(let N=0;N<=(g.points?-1:40);N++){let Q=ha(R.route,j,N/40);I(g.fromBox,Q)||I(g.toBox,Q)||H.push(Q)}H.length>=2&&(te=(0,ge.jsx)("path",{"data-graview-edge":g.edgeId,className:"graview-edge-hit",d:`M ${H[0].x} ${H[0].y} ${H.slice(1).map(N=>`L ${N.x} ${N.y}`).join(" ")}`,fill:"none",pathLength:1,strokeDasharray:"0.86",strokeDashoffset:-.07,stroke:"transparent",strokeWidth:14,style:{pointerEvents:"stroke",cursor:"pointer"},onClick:N=>{N.stopPropagation(),d(g.edgeId,{x:N.clientX,y:N.clientY})},onContextMenu:N=>{N.preventDefault(),N.stopPropagation(),d(g.edgeId,{x:N.clientX,y:N.clientY})},children:A!==void 0?(0,ge.jsx)("title",{children:A}):null}))}return(0,ge.jsxs)("g",{opacity:(g.proxy?.32:.72)*(A!==void 0?bn:1),children:[(0,ge.jsx)("path",{"data-graview-tie":g.kind,"data-graview-tie-proxy":g.proxy||void 0,"data-graview-provisional":A!==void 0||void 0,d:K,fill:"none",stroke:Zt(P),strokeWidth:g.proxy?1.1:1.6,strokeDasharray:A!==void 0?xn:Kn[P.pattern],strokeLinecap:"round"}),(0,ge.jsx)("circle",{cx:g.endX,cy:g.endY,r:g.proxy?2:2.6,fill:Zt(P)}),te]},g.key)})}),(0,ge.jsx)("div",{"aria-hidden":"true","data-graview-world":"",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:Fe.tieLabels},children:k.map(g=>{let R=y.find(P=>P.key===g.keys[0]);return(0,ge.jsx)("span",{className:"graview-record-link-said","data-graview-link-said":R?.kind,"data-graview-lands":R?.proxy?"district":"record","data-graview-said-for":g.keys.length,"data-graview-tie-said":g.keys.some(P=>G.has(P))?"shown":"waiting",style:{position:"absolute",left:g.x,top:g.y,transform:`translateX(min(0px, calc(${Math.round(l-g.x-8)}px - 100%)))`},children:g.said},g.said)})})]})}function Pa(){return typeof document>"u"?1:parseFloat(getComputedStyle(document.documentElement).fontSize)/16||1}function Ia({nodes:e,scheme:t,width:n,stageRef:o,moving:r=!1,holding:a=!1}){let i=Bt(),[l,u]=(0,ue.useState)([]);(0,ue.useLayoutEffect)(()=>{r||a||u(d())},[e,r,a,t,n,o]);function d(){let c=[],h=[];for(let y of e){if(!y.via||Math.round(y.plane)!==1)continue;let v=je(o.current,y.id,!1,!0),{scale:k}=Qt(1,t);c.push({key:`${y.via.edgeKind}|${y.via.direction}`,text:Sn(y.via),left:v?.x??y.x,right:v?v.x+v.width:y.x+y.width*k,top:v?.y??y.y}),h.push(Math.round(y.y))}let p=new Map;c.forEach((y,v)=>p.set(h[v],Math.min(p.get(h[v])??1/0,y.top)));let x=c.map((y,v)=>({...y,top:p.get(h[v])??y.top})),f=fr(n);return Xr(x,{left:f.left,right:n-f.right},Pa())}if(l.length===0||!i.captions.visible||r)return null;let s=Ur*Pa();return(0,ge.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:Fe.lines},children:l.map(c=>{let{left:h,width:p}=c;return(0,ge.jsx)("div",{"data-graview-relation":c.key,title:c.text,style:{position:"absolute",left:h,width:p,textAlign:"center",top:Math.max(0,c.top-s),fontSize:"0.75rem",letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,ge.jsx)("span",{style:{background:"var(--graview-ground)",padding:"1px 7px",borderRadius:4},children:c.text})},c.key)})})}var Wt=re(Oe(),1);var ad=new Set;function Ba(e,t,n,o,r,a,i=0,l=0){let{store:u,views:d,hiddenKinds:s}=pe(),c=Tt(),h=(0,Wt.useContext)(qt),p=Cr(),x=(0,Wt.useMemo)(()=>{let v={};for(let k of p){if(k.subjectId===void 0)continue;let w=v[k.subjectId]??=[];for(let O of k.nodeIds)O!==k.subjectId&&!w.includes(O)&&w.push(O)}return v},[p]),f=(0,Wt.useMemo)(()=>({flagged:new Set(p.flatMap(v=>v.nodeIds)),touched:Un(u.log.all())}),[p,u,a]),y=(0,Wt.useMemo)(()=>({hits:c?_n(c):ad,...f}),[c,f]);return(0,Wt.useMemo)(()=>({...e,cityZoom:o,...h?{besideTheMap:!0}:{},...s.size>0?{hiddenKinds:[...s].sort()}:{},...Object.keys(x).length>0?{judged:x}:{},relevance:y,inset:{...fr((t?.width??1200)-r.right),top:8,bottom:0},chrome:[{x:(t?.width??1200)-r.right-176,y:0,width:176,height:100},sd(t,r)],...r.right>0||r.bottom>0?{dock:r}:{},...i>0?{headroom:i}:{},unit:n,plainGroups:u.schema.kinds.filter(v=>Do(d.lookup(v,{cardinality:"many",fidelity:"full"}))),cityOrder:To(ci({name:"scene",schema:u.schema,mutations:u.allMutations().filter(v=>!v.derived)}).order.map(v=>v.kind),d.arrangement?.()?.order),screens:d.places().reduce((v,k)=>((v[k.kind]??=[]).push({as:k.as,title:k.title,...k.across?{across:k.across}:{}}),v),{}),...t?{width:t.width,height:Math.max(0,t.height-Math.max(64,l))}:{}}),[e,t,n,u,d,s,x,y,o,h,r.right,r.bottom,i,l])}var Na=224;function sd(e,t){let n=e?.width??1200,o=e?.height??800,r=58;return{x:n-t.right-Na,y:o-t.bottom-r,width:Na,height:r}}var ft=re(Oe(),1);var Ha=re(Oe(),1);function mr(e){let t=e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-joins");if(!t)return null;try{let n=JSON.parse(t);return Array.isArray(n)&&n.length>0&&n.every(o=>typeof o=="string")?n:null}catch{return null}}function Da(e){(0,Ha.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{for(let a of t.querySelectorAll("[data-graview-pick]"))a.getAttribute("tabindex")===null&&a.setAttribute("tabindex","0"),a.getAttribute("role")===null&&ld(a)&&a.setAttribute("role","button")};if(n(),typeof MutationObserver>"u")return;let o=0,r=new MutationObserver(()=>{o===0&&(o=typeof requestAnimationFrame>"u"?0:requestAnimationFrame(()=>{o=0,n()}),o===0&&n())});return r.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-graview-pick"]}),()=>{r.disconnect(),o!==0&&cancelAnimationFrame(o)}},[e])}var dd=new Set(["div","span","p","figure","img","td","output","b","i","em","strong","small","canvas","g","polygon","circle","rect","path","ellipse","polyline","line","use"]);function ld(e){return dd.has(e.localName.toLowerCase())}var ln=re(Se(),1);function $a({node:e,useDom:t,blur:n,touched:o,frontY:r,centerY:a,screen:i,onDrawnHeight:l,crowded:u,activity:d,scheme:s,canvasWidth:c,canvasHeight:h,selected:p,onSelect:x,onPick:f,onTravel:y,onMenu:v,selection:k,onJackIn:w,onDragStart:O,onDragMove:G,onDragEnd:$,swallowClick:X,children:T}){let{brand:g,store:R,actsDoor:P}=pe(),A=e.beyond?`${e.beyond.length} more district${e.beyond.length===1?"":"s"}`:e.aggregate?.opens?.in==="place"?`${e.aggregate.label}, ${Ut(R.schema,e.aggregate.kind,e.aggregate.memberIds.length)}`:e.aggregate?e.aggregate.label:(()=>{let S=R.graph.getNode(e.id);return S?Kt(R.schema.tryDefinition(e.kind),S):e.id})(),[j,K]=(0,ft.useState)(null),te=Math.round(e.plane)===0&&!e.aggregate;(0,ft.useLayoutEffect)(()=>{if(!te)return;let S=E.current;if(!S)return;let B=()=>{let W=[...S.children].find(q=>q.dataset.graviewKindtag===void 0);if(!W)return;let Z=S.getBoundingClientRect(),_=W.getBoundingClientRect(),z=S.offsetWidth>0?Z.width/S.offsetWidth:1,ee={top:Math.round((_.top-Z.top)/z)-9,right:Math.round((Z.right-_.right)/z)+14};K(q=>q&&q.top===ee.top&&q.right===ee.right?q:ee)};if(typeof ResizeObserver>"u"){B();return}let L=new ResizeObserver(B);L.observe(S);for(let W of S.children)L.observe(W);return()=>L.disconnect()},[te,e.id]);let I=zo({plane:e.plane,...e.depth!==void 0?{depth:e.depth}:{},onPlot:r!==void 0},s),H=I.style,N=Go(H,e.x,e.y,c,h),Q=n?I.blur:0,E=(0,ft.useRef)(null);Da(E);let F=e.natural,b=F?Math.min(e.width/F.width,e.height/F.height):1,M=(0,ft.useRef)(null);(0,ft.useEffect)(()=>{if(!i||!l)return;let S=M.current;if(!S||typeof ResizeObserver>"u")return;let B=()=>{let z=0,ee=0;for(let q of S.children)if(!(!(q instanceof HTMLElement)||q.classList.contains("graview-screen-fullscreen"))){z=Math.max(z,q.offsetTop+q.offsetHeight);for(let he of[q,...q.querySelectorAll("*")]){let ce=getComputedStyle(he).overflowY;(ce==="auto"||ce==="scroll")&&(ee+=he.scrollHeight-he.clientHeight)}}l(z+ee)},L=0,W=()=>{L||(L=requestAnimationFrame(()=>{L=0,B()}))};B();let Z=new ResizeObserver(W);Z.observe(S);for(let z of S.children)Z.observe(z);let _=new MutationObserver(W);return _.observe(S,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>{L&&cancelAnimationFrame(L),Z.disconnect(),_.disconnect(),l(void 0)}},[i,l,e.id]);let C=t?{transform:ca(N),transformOrigin:"0 0",filter:Q>0?`blur(${Q}px)`:void 0,opacity:Yo(H)*(e.opacity??1),"--graview-lift-low":fo(H.shadow,s),...r!==void 0?{"--graview-front-y":`${r.toFixed(1)}px`}:{},...a!==void 0?{"--graview-center-y":`${a.toFixed(1)}px`}:{}}:{"--graview-lift-low":fo(H.shadow,s)};return(0,ln.jsxs)("div",{ref:E,"data-graview-view":e.id,...t?{}:{drawable:""},"data-graview-plane":Math.round(e.plane),"data-graview-selected":p||void 0,"data-graview-touched":o||void 0,"data-graview-plot":r!==void 0?"":void 0,"data-graview-screen":i?"":void 0,"data-graview-record-focus":Math.round(e.plane)===0&&!e.aggregate&&!F&&!i?"":void 0,"data-graview-nested":e.nestedUnder??void 0,"data-graview-crowded":u||void 0,"data-graview-pinned":e.pinned||void 0,"data-graview-activity":d?d.manner:void 0,"data-graview-wrote":d?.wrote||void 0,"data-graview-read":d&&!d.wrote?!0:void 0,"data-graview-broke":d?.broke||void 0,title:d?`${Ji[d.manner]} ${d.wrote?"changed this":"read this"}: ${d.intent}`:e.aggregate&&Math.round(e.plane)!==0?`Open ${e.aggregate.label}`:void 0,role:"group","aria-label":A,"aria-keyshortcuts":P&&!e.beyond?P.key:void 0,tabIndex:0,onPointerDown:O,onPointerMove:G,onPointerUp:$,onPointerCancel:$,onClick:S=>{if(X.current)return;let B=S.target?.closest("input, textarea, select, button, a[href], [contenteditable='true']");if(B&&!B.hasAttribute("data-graview-pick"))return;let L=S.metaKey||S.shiftKey,W=xt(S.target);if(W&&W!==e.id){S.stopPropagation(),f(W,L,mr(S.target)??void 0);return}x(L)},onKeyDown:S=>{if(P&&!e.beyond&&S.key.toLowerCase()===P.key.toLowerCase()&&!S.metaKey&&!S.ctrlKey&&!S.altKey&&!S.target?.closest("input, textarea, select, [contenteditable='true']")){S.preventDefault(),S.stopPropagation();let _=xt(S.target)??e.id;k.includes(_)||f(_,!1),P.open(S.target instanceof HTMLElement?S.target:S.currentTarget);return}if(S.key!=="Enter"&&S.key!==" "||S.target?.closest("input, textarea, select, button, [contenteditable='true']"))return;let L=xt(S.target);if(S.preventDefault(),S.stopPropagation(),!L||L===e.id){k.length===1&&k[0]===e.id&&!S.metaKey&&!S.shiftKey?w():x(S.metaKey||S.shiftKey);return}let W=mr(S.target);(W?k.length===W.length&&W.every(_=>k.includes(_)):k.length===1&&k[0]===L)&&!S.metaKey&&!S.shiftKey?y(L):f(L,S.metaKey||S.shiftKey,W??void 0)},onContextMenu:S=>{let B=xt(S.target);S.preventDefault(),S.stopPropagation();let L=B&&B!==e.id?B:e.id;f(L,!1,(L===B?mr(S.target):null)??void 0),v({x:S.clientX,y:S.clientY,on:L})},onDoubleClick:S=>{let B=xt(S.target);if(B&&B!==e.id){S.stopPropagation(),y(B);return}w()},style:{position:"absolute",...t?{}:{pointerEvents:"none"},zIndex:e.opened?Fe.opened:Fe.card-Math.round(e.plane),left:t?0:Math.round(e.x),top:t?0:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height),boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",...C},children:[F?(0,ln.jsx)("div",{ref:M,"data-graview-natural":`${Math.round(F.width)}x${Math.round(F.height)}`,style:{position:"absolute",left:"50%",top:"50%",width:F.width,height:F.height,transform:`translate(-50%, -50%) scale(${b})`,transformOrigin:"50% 50%",display:"flex",flexDirection:"column"},children:T}):T,Math.round(e.plane)===0&&!e.aggregate?(0,ln.jsxs)("span",{"data-graview-kindtag":"",className:"graview-kind-tag","aria-hidden":"true",style:{...j??{},"--graview-hue":Math.round(mn(e.kind,g?.accents))},children:[(0,ln.jsx)("span",{style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",background:`hsl(${Math.round(mn(e.kind,g?.accents))} 55% var(--graview-tint-lightness) / 0.9)`}}),Lo(R.schema.tryDefinition(e.kind),e.kind)]}):null]})}var le=re(Se(),1);Pr({search:hi,touchWeights:Un});var cd=e=>e?{activity:e}:{},ud=e=>`${Math.round(e.x)} ${Math.round(e.y)}`,Fa=e=>e.stopPropagation(),Ga=.6,za=3,hd=80,Wa=e=>Math.round(e.plane)===1&&(e.compact===!0||e.width<175||e.height<hd);function fd(e){let[t,n]=(0,U.useState)(1),o=(0,U.useRef)(1);return(0,U.useEffect)(()=>{e||(o.current=1,n(1))},[e]),[t,o,n]}function md(e){let[t,n]=(0,U.useState)({x:0,y:0}),o=(0,U.useMemo)(()=>({x:(e.pan?.x??0)+t.x,y:(e.pan?.y??0)+t.y}),[e.pan,t]),r=(0,U.useMemo)(()=>t.x===0&&t.y===0?e:ht(e,o),[e,t,o]),a=(0,U.useRef)(t);a.current=t;let i=(0,U.useCallback)((l,u)=>{let d=a.current,s=(c,h,p)=>Math.max(Math.min(-c,h),Math.min(Math.max(c,h),p+h))-h;return{x:s(l.x,d.x,u.x),y:s(l.y,d.y,u.y)}},[]);return[o,r,i,a,n]}function pd(e,t,n,o,r,a){let i=n!==null&&!t.overview,l=i?null:n,u=(0,U.useRef)(t);Gr(u.current,t)||(u.current=t);let d=u.current,s=(0,U.useMemo)(()=>{let x=d.pan?{...d,pan:void 0}:d;return l?vn(x,l.id,{x:l.x,y:l.y}):x},[d,l]),c=(0,U.useMemo)(()=>tr(e.graph,e.schema,s,o),[e,s,o,r]),h=(0,U.useMemo)(()=>n&&i?to(c,n.id,{x:n.x,y:n.y})??tr(e.graph,e.schema,vn(s,n.id,{x:n.x,y:n.y}),o):c,[c,n,i,e,s,o]);return[(0,U.useMemo)(()=>no(h,a??{x:0,y:0}),[h,a]),i]}function yd(e,t){let n=(0,U.useRef)(!1),o=(0,U.useRef)(!1),r=(0,U.useRef)(null),a=(0,U.useRef)(!1),i=(0,U.useCallback)(()=>{gd(e.current,{dragging:n.current,steering:o.current}),t.set(n.current||o.current||a.current)},[e,t]),l=(0,U.useCallback)(c=>{n.current!==c&&(n.current=c,i())},[i]),u=(0,U.useRef)(()=>!1),d=(0,U.useCallback)(()=>{o.current||(o.current=!0,i()),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,!u.current()&&(o.current=!1,i())},160)},[i]),s=(0,U.useCallback)(()=>{n.current=!1,o.current=!1,i()},[i]);return{dragging:n,steering:o,tweening:a,setDragging:l,steer:d,settleLive:u,settled:s}}function gd(e,{dragging:t,steering:n}){e&&(t||n?e.setAttribute("data-graview-hand",t?"drag":"wheel"):e.removeAttribute("data-graview-hand"),e.style.cursor=t?"grabbing":"grab",e.style.userSelect=t?"none":"")}function wd(e){let t=(0,U.useRef)(!1),n=e!==null&&!t.current;return(0,U.useEffect)(()=>{e!==null&&(t.current=!0)},[e]),n}function xd({registerScene:e,scheme:t,views:n},o,r){let a=(0,U.useRef)(o);a.current=o,(0,U.useEffect)(()=>(e({whereIs:i=>sr(a.current,r.current,t,n,i)}),()=>e(null)),[e,t,n])}function bd(e,t){(0,U.useEffect)(()=>{let n;return e.onActive(o=>{let r=t.current;if(!r)return;let a=u=>{let d=r.getBoundingClientRect();e.set({x:u.clientX-d.left,y:u.clientY-d.top})},i=u=>{u.buttons===0&&a(u)},l=()=>e.set(null);o?(r.addEventListener("pointermove",i),r.addEventListener("pointerup",a),r.addEventListener("pointerleave",l),n=()=>{r.removeEventListener("pointermove",i),r.removeEventListener("pointerup",a),r.removeEventListener("pointerleave",l)}):(n?.(),n=void 0)})},[e])}function vd(e,t,n,o,r,a,i,l){(0,U.useEffect)(()=>{let u=t.current;if(!u||!e)return;let d=new Set;for(let c of n.nodes)(o.has(c.id)||c.aggregate?.memberIds.some(h=>o.has(h)))&&d.add(c.id);let s=e({canvas:u,layout:n,dirty:d,hostOf:c=>(u.parentElement??u).querySelector(`[data-graview-view="${CSS.escape(c)}"]`),drawOnDom:r,blur:a,scheme:i,fallBack:l});return()=>{s?.()}},[e,n,o,r,a,i,l])}var kd=Xt(()=>(__graviewPreload(import.meta.url,["./chunk.OJGHDWI6.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.P6RORYOT.js")));function Sd(e,t){let[n]=(0,U.useState)(()=>{let s=Ko();return t?e==="dom"||e==="auto"&&s==="dom"?"dom":"gpu":Xo(e,{operator:s,present:Uo()})}),[o,r]=(0,U.useState)(!1),a=(0,U.useCallback)(()=>r(!0),[]),[i,l]=(0,U.useState)(null),u=n==="gpu"&&!t&&!o&&i===null;return(0,U.useEffect)(()=>{if(!u)return;let s=!0;return kd().then(c=>{s&&l(()=>c.attachGpu())},()=>{s&&r(!0)}),()=>{s=!1}},[u]),{attach:(n==="gpu"&&!o?t??i:null)??null,fallBack:a}}function Md(){let[e,t]=(0,U.useState)(()=>new Set),n=(0,U.useCallback)(o=>{t(r=>r.size===o.size&&[...o].every(a=>r.has(a))?r:new Set(o))},[]);return[e,n]}function Ed(){let e=ti();return t=>{let n=t?e.get(t.id):void 0,o=t?.aggregate?.memberIds??[];if(!n&&o.length===0)return;let r=n,a=n?.wrote??!1,i=n?.read??!1,l=n?.broke??!1;for(let u of o){let d=e.get(u);d&&(a||=d.wrote,i||=d.read,l||=d.broke,(!r||d.at>r.at||d.at===r.at&&d.wrote&&!r.wrote)&&(r=d))}return r?{...r,wrote:a,read:i,broke:l}:void 0}}var ja=(e,t)=>e.includes(t)?e.filter(n=>n!==t):[...e,t];function Rd(){let{views:e,view:t,setView:n,setSelection:o}=pe(),r=Tt(),a=(0,U.useContext)(qt),i=l=>{if(Pe(l.id)===null&&!l.aggregate)return!1;let u=e.resolve(l.kind,{cardinality:"many",fidelity:"full"})?.view;return u!==void 0&&u.generic!==!0};return l=>({onSelect:u=>{if(gn(l.id)){o(s=>u?ja(s,l.id):[l.id]);return}let d=l.aggregate?yn(l.id):[];if(t.overview){o(s=>u?[...new Set([...s,l.id])]:[l.id]);return}if(d.length===1&&!u&&Math.round(l.plane)!==0){let s=d[0];n(c=>Er(c,c.relation===s?null:s));return}o(s=>ho(l,s,u))},onPick:(u,d,s)=>o(c=>s?d?[...new Set([...c,...s])]:[...s]:d?ja(c,u):[u]),onTravel:u=>{n(d=>({...gt(d,u),relation:null})),o([u])},onJackIn:()=>{let u=l.aggregate?.opens;if(u){u.in==="place"?n(c=>Rr(c,l.id)):n(c=>Object.entries(u.within).reduce((h,[p,x])=>zn(h,p,x),gt(pn(c,!1),u.focus))),o([]);return}let d=Pe(l.id),s=d!==null&&(r?.byKind[d]??0)>0;if(a&&d!==null&&t.overview&&!i(l)&&!(s&&t.q)){n(c=>zn({...gt(c,`aggregate:${d}`),relation:null},"view",null)),o([]);return}n(c=>Or(c,l.id,{ownPicture:i(l),...s&&c.q?{carry:c.q}:{}})),o(l.aggregate?[]:[l.id])}})}var Od=wn(Xt(()=>(__graviewPreload(import.meta.url,["./chunk.HJCQ6I3S.js","./chunk.QDSEVPF3.js","./chunk.TKUNRFDE.js","./chunk.7N32AVIJ.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.LSY256J4.js")))),Ad=Od.part((e,t)=>(0,le.jsx)(e.Ribbons,{...t}),{what:"The relations",quiet:!0}),Va="graview:map-from-above";function Ld(){let[e,t]=(0,U.useState)(()=>{try{return globalThis.localStorage?.getItem(Va)==="1"}catch{return!1}}),n=(0,U.useCallback)(o=>{t(o);try{globalThis.localStorage?.setItem(Va,o?"1":"0")}catch{}},[]);return[e,n]}var Pd=wn(Xt(()=>(__graviewPreload(import.meta.url,["./chunk.TKUNRFDE.js","./chunk.7N32AVIJ.js","./chunk.TLJOZSDD.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ULL6ZIJJ.js")))),Cd=Pd.part((e,t)=>(0,le.jsx)(e.Plots,{...t}),{quiet:!0});function Td({zoom:e,zoomBy:t,above:n,setAbove:o}){let r=(a,i,l,u)=>(0,le.jsx)("button",{type:"button",className:"graview-zoom-button","data-testid":`zoom-${a}`,"aria-label":`Zoom ${a}`,title:`Zoom ${a} \u2014 or pinch, or ctrl+wheel`,disabled:u,onClick:()=>t(l),children:i});return(0,le.jsxs)("div",{className:"graview-zoom","data-graview-foot":"",role:"group","aria-label":"Zoom",onPointerDown:Fa,onClick:Fa,children:[r("out","\u2212",1/1.25,e<=Ga+1e-6),(0,le.jsxs)("span",{className:"graview-zoom-level","data-testid":"zoom-level","aria-live":"polite",children:[Math.round(e*100),"%"]}),r("in","+",1.25,e>=za-1e-6),(0,le.jsx)("button",{type:"button",className:"graview-zoom-button graview-zoom-above","data-testid":"from-above","aria-pressed":n,title:n?"See the city at an angle again":"See the city from straight above",onClick:()=>o(!n),children:"From above"})]})}function Id({options:e,renderer:t="auto",attachRenderer:n,blur:o=!0,className:r,style:a,animate:i=!0,children:l}){let u=pe(),{store:d,scheme:s,views:c,view:h,setView:p,selection:x,setSelection:f,setMenuAt:y,emphasis:v,brand:k,noteMoved:w,robots:O,motion:G}=u,$=(0,U.useContext)(qt),X=(0,U.useRef)(null),T=(0,U.useRef)(null),g=la(T),R=da(),{zoomAbout:P,panBy:A}=Zi({stage:T,view:h,setView:p}),j=It(),K=1,[te,I,H]=fd(h.overview),[N,Q]=Ld(),E=(0,U.useMemo)(()=>N?{...e,tilt:mi}:e,[e,N]),{probe:F,dock:b}=Ui(),M=!h.overview&&(h.zoom||h.past||h.relation)?Math.ceil(14+34*R/16+6):0,C=Ba(E,g,R,K*te,b,j,M,h.overview?0:b.bottom),S=Gi(T),[B,L,W,Z,_]=md(h),z=(0,U.useMemo)(()=>new Set(Object.keys(h.pins).filter(D=>Pe(D)===null)),[h.pins]),ee=Xi(),[q,he]=pd(d,h,ee.held,C,j,L.pan),ce=yd(T,G),{setDragging:He,steer:Me,settleLive:Ae,settled:De}=ce,Te=ce.dragging.current||ce.steering.current,ie=wd(g),xe=qi({stage:T,pan:h.pan,setView:p,settled:De}),qe=(0,U.useRef)(!1);xe.settling.current||(qe.current=!1);let Et=xe.settling.current&&!qe.current,ne=Bi(q,{enabled:i&&!Te&&g!==null&&!ie,settle:!Et});ce.tweening.current=ne.t<1,(0,U.useEffect)(()=>G.set(ce.dragging.current||ce.steering.current||ne.t<1),[G,ne]);let rt=Hi(),$e=Di(),Rt=zi({view:h,result:q,frame:ne,panned:B,closer:K,screenId:null,setCamera:_});xd(u,ne,T),bd(u.pointer,T);let[Ve,Ot]=Md(),{attach:Ke,fallBack:Qe}=Sd(t,n),Le=Ii(o);vd(Ke,X,ne,rt,Ot,Le,s,Qe);let Ie=Ke===null,mt=Ni(Le&&Ie,ne.t<1),Ue=Ed();Ae.current=xe.settle;let{onGroundDown:pt,onCardDown:cn,onDragMove:dt,onDragUp:ae,swallow:we}=Qi({view:h,panned:B,limit:()=>bt(q),panWithin:W,moveByTransform:!0,setView:p,setDragging:He,noteMoved:w,shift:xe,district:ee});P.current=(D,fe,Ee)=>{if(!h.overview)return;Ae.current();let be=I.current,Ne=Math.max(Ga,Math.min(za,be*D));if(Math.abs(Ne-be)<1e-4)return;I.current=Ne,qe.current=!0,Me(),H(Ne);let Yt=T.current?.getBoundingClientRect(),In=q.visible??q,ze={x:In.width/2,y:In.height/2},Nn=Yt&&fe!==void 0&&Ee!==void 0?{x:fe-Yt.left,y:Ee-Yt.top}:ze,Bn=Ne/be;p(_t=>ht(_t,Jr(_t.pan??{x:0,y:0},Z.current,Nn,ze,Bn))),w()};let ot=(D,fe,Ee=bt(q))=>p(be=>ht(be,W(Ee,{x:(be.pan?.x??0)+D,y:(be.pan?.y??0)+fe})));_i(T,b,(D,fe)=>ot(D,fe)),A.current=(D,fe)=>{Me();let Ee=bt(q),be=h.pan??{x:0,y:0},Ne=xe.offset();xe.shiftTo(W(Ee,{x:be.x+Ne.x+D,y:be.y+Ne.y+fe}),be),w()};let At=Rd(),Ge=Bt(),jt=(0,U.useCallback)(D=>tn(Ge,D).connector.visible,[Ge]),Vt=D=>Ue(ne.nodes.find(fe=>fe.id===D)),un=(D,fe,Ee,be)=>D.originY+B.y+nn(Ee.col+Ee.side/be,Ee.row+Ee.side/be,D.cell,D.tilt).y-fe.y,Ze={width:q.width,height:q.height},lt={position:"relative",zIndex:Fe.stage,...Ze},hn=D=>sr(ne,T.current,s,c,D),Tn=D=>Ie||Ve.has(D),pr=qn(u),Gt=D=>(0,le.jsx)(Yn.Provider,{value:pr,children:D}),zt=ne.nodes.filter(D=>D.screenOf===void 0).map(D=>(0,le.jsx)($a,{node:D,crowded:Wa(D),useDom:Tn(D.id),blur:mt||!Ie&&Le,...D.plot&&ne.city&&Math.round(D.plane)===2?{frontY:un(ne.city,D,D.plot,1),centerY:un(ne.city,D,D.plot,2)}:{},touched:rt.has(D.id),...cd(Ue(D)),scheme:s,canvasWidth:q.width,canvasHeight:q.height,selected:x.includes(D.id),...At(D),onMenu:y,selection:x,onDragStart:fe=>cn(D,fe),onDragMove:dt,onDragEnd:ae,swallowClick:we,children:D.beyond?(0,le.jsx)(ra,{kinds:D.beyond}):D.aggregate?.opens?(0,le.jsx)(sa,{node:D}):(0,le.jsx)(ia,{node:D,mode:"scene",selected:x.includes(D.id),...Wa(D)?{fidelity:"glyph"}:{}})},D.id));return(0,le.jsxs)("div",{ref:T,className:`graview-ground${r?` ${r}`:""}`,"data-graview-altitude":h.overview?"":void 0,"data-graview-reach":ne.city?ud(bt(q)):void 0,"data-graview-settled":ne.t>=1&&!Rt.gliding()?"":void 0,"data-graview-box":g?`${g.width}x${g.height}`:void 0,"data-graview-renderer":Ie?"dom":"gpu","data-graview-blur":(Ie?mt:Le)?"":void 0,onPointerDown:pt,onPointerMove:dt,onPointerUp:ae,onPointerCancel:ae,onClick:D=>{we.current||D.target.closest("[data-graview-view], button, aside, section[aria-label], [data-graview-offstage], a, input, select")||(f([]),y(null))},style:{position:"relative",width:"100%",height:"100%",cursor:"grab",touchAction:"none","--graview-altitude":h.overview?1:0,...ne.city?{"--graview-lattice-cell":`${ne.city.cell.toFixed(2)}px`,"--graview-lattice-tilt":(ne.city.tilt??.5).toFixed(3),"--graview-lattice-x":`${(ne.city.originX+ne.city.pan.x).toFixed(1)}px`,"--graview-lattice-y":`${(ne.city.originY+ne.city.pan.y).toFixed(1)}px`}:{},overflow:"hidden",...a},children:[(0,le.jsx)("div",{className:"graview-measure","aria-hidden":"true",style:{"--graview-world-x":`${(ne.pan?.x??0).toFixed(1)}px`,"--graview-world-y":`${(ne.pan?.y??0).toFixed(1)}px`}}),h.overview&&ne.city?(0,le.jsx)(U.Suspense,{fallback:null,children:(0,le.jsx)(Ad,{frame:ne,...Ze,pan:ne.city.pan,store:d,graphVersion:j,selection:x,view:{overview:h.overview,focusId:h.focusId,beside:$},emphasis:v,hiddenKinds:u.hiddenKinds,drawn:jt})}):null,(0,le.jsx)("div",{ref:F,"aria-hidden":"true",style:{position:"absolute",top:0,right:0,width:"var(--graview-dock, 0px)",height:"var(--graview-sheet, 0px)",visibility:"hidden",pointerEvents:"none"}}),ne.city?(0,le.jsx)(U.Suspense,{fallback:null,children:(0,le.jsx)(Cd,{frame:ne,...Ze,pan:ne.city?ne.city.pan:B,brand:k,pinned:z,close:K*te>1.2,swallowed:we,...h.overview?{chosen:kn(x,{overview:h.overview,focusId:h.focusId,beside:$},D=>d.graph.getNode(D)?.kind).records}:{},onFocus:D=>{let fe=Pe(D);fe!==null&&p(Ee=>gt(Ee,Ce(fe)))}})}):null,Ie?(0,le.jsx)("div",{"data-graview-stage":"dom","data-graview-world":"",style:{...lt,overflow:"hidden"},children:Gt(zt)}):(0,le.jsxs)("div",{"data-graview-world":"",style:lt,children:[(0,le.jsx)("div",{"data-graview-stage":"dom","data-graview-under-canvas":"",style:{position:"absolute",left:0,top:0,...Ze,overflow:"hidden"},children:Gt(zt.filter(D=>Ve.has(String(D.key))))}),(0,le.jsx)("canvas",{ref:X,"data-graview-stage":"gpu",content:"drawable",layoutsubtree:"",...Ze,style:{display:"block",position:"relative",...Ze},children:Gt(zt.filter(D=>!Ve.has(String(D.key))))})]}),h.overview?(0,le.jsx)(ji,{result:q,schema:d.schema,chrome:S?[...C.chrome??[],S]:C.chrome??[],onGo:D=>{ot(D.x,D.y),w()}}):null,h.overview?(0,le.jsx)(Td,{zoom:te,zoomBy:D=>P.current(D),above:N,setAbove:Q}):null,(0,le.jsx)(Ta,{frame:ne,focusId:h.focusId,beside:$,holding:he,...Ze,scheme:s,overview:!!h.overview,selection:x,emphasis:v,stageRef:T,store:d,graphNodes:j,...(D=>D?{provisional:D}:{})(Ca(d)),onPickEdge:(D,fe)=>{we.current||(f([D]),y(fe?{...fe,on:D}:null))},liveOf:D=>{let fe=Vt(D.from),Ee=Vt(D.to);return fe?.wrote&&Ee?.wrote?fe.at>Ee.at?fe:Ee:void 0}}),(0,le.jsx)(Fi,{width:q.width,whereIs:hn}),(0,le.jsx)($i,{marks:$e.marks,questions:[...O.values()].filter(D=>D.mode==="asking"&&D.at!==null&&D.say).map(D=>({id:D.at,who:D.who,asks:D.say})),whereIs:hn,stageRef:T,...Ze}),(0,le.jsx)(Ia,{nodes:ne.nodes,moving:ne.t<1,holding:he,scheme:s,width:q.width,stageRef:T}),l,(0,le.jsx)("div",{className:"graview-lattice","aria-hidden":"true"})]})}var nt=re(Oe(),1);function Nd(){return Ua(),null}var Ka=()=>window.location.pathname.endsWith(Co),Ya=()=>(Ka()?No:Mr)(window.location.hash),Bd=e=>(Ka()?Bo:Sr)(e);function Ua(){let{view:e,setView:t,views:n,principal:o}=pe(),r=JSON.stringify(o),a=(0,nt.useCallback)(s=>{let c=s.within?.view;if(c===void 0||s.focusId)return s;let h=n.places().find(p=>p.as===c);return h?{...s,focusId:Ce(h.kind)}:s},[n]),i=(0,nt.useRef)(!1);(0,nt.useEffect)(()=>{if(typeof window>"u")return;let s=a(Ya());!Gn(s,kr)&&!Gn(s,e)&&(i.current=!0,t(s))},[]),(0,nt.useEffect)(()=>{if(typeof window>"u")return;let s=()=>t(a(Ya()));return window.addEventListener("popstate",s),window.addEventListener("hashchange",s),()=>{window.removeEventListener("popstate",s),window.removeEventListener("hashchange",s)}},[t,a]);let l=(0,nt.useRef)(!1),u=(0,nt.useRef)(null),d=(0,nt.useRef)(r);(0,nt.useEffect)(()=>{if(typeof window>"u")return;if(i.current){i.current=!1;return}let s=d.current!==r;d.current=r;let c=Bd(e),h=c||`${window.location.pathname}${window.location.search}`;if((window.location.hash||(window.location.href.includes("#")?"#":""))===c){l.current=!0,u.current=e;return}if(!l.current){l.current=!0,u.current=e,window.history.replaceState({graview:Nt.at},"",h);return}if(s||Xa(u.current,e)){window.history.replaceState({graview:Nt.at},"",h),u.current=e;return}u.current=e,window.history.pushState({graview:++Nt.at},"",h),Nt.depth=Nt.at,Nt.tell()},[e,r])}function Xa(e,t){return e?e.focusId===t.focusId&&e.relation===t.relation&&(e.overview??!1)===(t.overview??!1)&&(e.zoom??!1)===(t.zoom??!1)&&(e.past??!1)===(t.past??!1)&&e.expanded.join(",")===t.expanded.join(",")&&(e.shown??[]).join(",")===(t.shown??[]).join(",")&&Hd(e.within,t.within):!1}function Hd(e,t){let n=o=>Object.entries(o??{}).sort(([r],[a])=>r.localeCompare(a)).map(([r,a])=>`${r}=${a}`).join("&");return n(_a(e))===n(_a(t))}function _a(e){if(!e||!("q"in e))return e;let{q:t,...n}=e;return n}var Ro=re(Oe(),1);var qa=new WeakMap,Dd=64,Qa=new WeakMap,$d=0,Fd=e=>{if(e===void 0)return 0;let t=Qa.get(e);return t===void 0&&Qa.set(e,t=$d+=1),t};function Za(e,t,n,o={}){let r=()=>{let d=[...new Set(t.flatMap(c=>yn(c)))],s=t.map(c=>Pt(c)).filter(c=>c!==null);return si(e,t,{...n.principal?{principal:n.principal}:{},kindSelection:d,edgeSelection:s,...n.providers?{providers:n.providers}:{},...n.pins?{pins:n.pins}:{},...n.focus!==void 0?{focus:n.focus}:{},...o})};if(Object.keys(o).length>0)return r();let a=qa.get(e);if(!a){let d={kept:new Map,at:e.log.length};qa.set(e,a=d),e.subscribe(()=>d.kept.clear())}a.at!==e.log.length&&(a.kept.clear(),a.at=e.log.length);let i=JSON.stringify([t,n.principal??null,Fd(n.providers),n.pins??null,n.focus??null]),l=a.kept.get(i);if(l)return l;let u=r();return a.kept.set(i,u),a.kept.size>Dd&&a.kept.delete(a.kept.keys().next().value),u}function Wd(e,t,n={}){return Za(e,t,n)}function jd(e={}){let{store:t,selection:n,principal:o,providers:r}=pe(),{about:a,principal:i=o,providers:l=r,pins:u,focus:d,...s}=e,c=a??n,h=It();return(0,Ro.useMemo)(()=>Za(t,c,{principal:i,providers:l,pins:u,focus:d},s),[t,c,e,h,i,l])}function Vd(){let{store:e,principal:t}=pe();return(0,Ro.useMemo)(()=>({preview:(n,o)=>li(e,n,o??{},{pressed:t?{author:t}:{}}),apply:(n,o)=>di(e,n,o??{},{author:t})}),[e,t])}export{gs as a,ws as b,xs as c,bs as d,vs as e,ks as f,ss as g,Id as h,Nd as i,Wd as j,jd as k,Vd as l};