graview 0.1.65 → 0.1.67

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 (265) hide show
  1. package/dist/index.js +4 -4
  2. package/dist/index.js.map +1 -1
  3. package/dist/preview/{chunk.3IZEZPJB.js → chunk.25QFDTCU.js} +1 -1
  4. package/dist/preview/{chunk.SOMRYDDH.js → chunk.264PB572.js} +1 -1
  5. package/dist/preview/chunk.2FHIINXG.js +2 -0
  6. package/dist/preview/chunk.2VUX54XH.js +1 -0
  7. package/dist/preview/chunk.32SHA3EY.js +1 -0
  8. package/dist/preview/{chunk.ZDUTEM3Z.js → chunk.35KMZHB7.js} +1 -1
  9. package/dist/preview/{chunk.74B6KQF4.js → chunk.37RFCHSS.js} +1 -1
  10. package/dist/preview/chunk.3ENPWZBG.js +1 -0
  11. package/dist/preview/chunk.3GNT5MKP.js +50 -0
  12. package/dist/preview/chunk.3NSV3WKM.js +22 -0
  13. package/dist/preview/chunk.3ZODN6BW.js +1 -0
  14. package/dist/preview/{chunk.7VQ3C7F4.js → chunk.47XEJZ3O.js} +1 -1
  15. package/dist/preview/{chunk.KIQXTQDU.js → chunk.4EMKCKDB.js} +1 -1
  16. package/dist/preview/{chunk.LKK5YF2H.js → chunk.4UUJHLHR.js} +1 -1
  17. package/dist/preview/{chunk.L6FGKJ5H.js → chunk.4W57E7AX.js} +1 -1
  18. package/dist/preview/chunk.55G4IPOO.js +1 -0
  19. package/dist/preview/chunk.5AKZROMR.js +1 -0
  20. package/dist/preview/chunk.5J6DVR7S.js +1 -0
  21. package/dist/preview/chunk.5R744JGZ.js +19 -0
  22. package/dist/preview/{chunk.64FCAUAJ.js → chunk.6KJGRM7A.js} +1 -1
  23. package/dist/preview/{chunk.INTJD5WG.js → chunk.6N4PE3U5.js} +1 -1
  24. package/dist/preview/{chunk.44ZHHPPJ.js → chunk.6NG76MDA.js} +2 -2
  25. package/dist/preview/chunk.6SJEZWH3.js +1 -0
  26. package/dist/preview/chunk.6UQFV53C.js +1 -0
  27. package/dist/preview/chunk.6W6XMLSF.js +1 -0
  28. package/dist/preview/chunk.77C556NM.js +1 -0
  29. package/dist/preview/{chunk.7E4CSXBT.js → chunk.7ARRVNUR.js} +1 -1
  30. package/dist/preview/chunk.7BJRHPE3.js +23 -0
  31. package/dist/preview/{chunk.TY74U3EI.js → chunk.7S6ZRMW4.js} +1 -1
  32. package/dist/preview/{chunk.F5VEHAP2.js → chunk.7UHPHEH5.js} +1 -1
  33. package/dist/preview/chunk.7WHQWLL6.js +1 -0
  34. package/dist/preview/{chunk.NSO6RUKW.js → chunk.A4EZAGG7.js} +1 -1
  35. package/dist/preview/chunk.A5PSEU3W.js +25 -0
  36. package/dist/preview/{chunk.2TZSLREX.js → chunk.A7GVTE5Y.js} +2 -2
  37. package/dist/preview/chunk.AJMVRFYX.js +5 -0
  38. package/dist/preview/chunk.AKJS2NUM.js +1 -0
  39. package/dist/preview/chunk.ARWO4WOV.js +1 -0
  40. package/dist/preview/chunk.B5SJMCTT.js +7 -0
  41. package/dist/preview/{chunk.2QQ37RCZ.js → chunk.B7KZBT27.js} +1 -1
  42. package/dist/preview/chunk.BDNQMKDG.js +35 -0
  43. package/dist/preview/chunk.BKYZSV2Y.js +2 -0
  44. package/dist/preview/chunk.CEQQIW7Z.js +1 -0
  45. package/dist/preview/chunk.CKDCTFLU.js +1 -0
  46. package/dist/preview/chunk.CTUJZ3IV.js +1 -0
  47. package/dist/preview/chunk.CY7FFKEZ.js +1 -0
  48. package/dist/preview/chunk.D4WJ7OM5.js +1 -0
  49. package/dist/preview/{chunk.AB4RZSYW.js → chunk.D7NWMXSX.js} +16 -16
  50. package/dist/preview/chunk.DEKRFTRN.js +4 -0
  51. package/dist/preview/{chunk.6YDC6IDA.js → chunk.DKEIEH2D.js} +1 -1
  52. package/dist/preview/{chunk.S2DOVJRL.js → chunk.DWM7AR5Y.js} +1 -1
  53. package/dist/preview/{chunk.FHHVW2WB.js → chunk.DZMIYEHQ.js} +1 -1
  54. package/dist/preview/chunk.E5PYNAYT.js +21 -0
  55. package/dist/preview/chunk.EBKH3ILT.js +1 -0
  56. package/dist/preview/chunk.EFVSZKB5.js +1 -0
  57. package/dist/preview/chunk.EG7OOJH5.js +1 -0
  58. package/dist/preview/chunk.EGPCVMDU.js +1 -0
  59. package/dist/preview/{chunk.C437FVD7.js → chunk.EJ2EZL2G.js} +1 -1
  60. package/dist/preview/{chunk.IR4OW67N.js → chunk.EP6Q32WT.js} +1 -1
  61. package/dist/preview/{chunk.G3Q5IMM3.js → chunk.F464JKHZ.js} +1 -1
  62. package/dist/preview/{chunk.IFBGYFS4.js → chunk.FLJXYESX.js} +1 -1
  63. package/dist/preview/chunk.FOUBDGL3.js +1 -0
  64. package/dist/preview/chunk.FPHRAO3R.js +1 -0
  65. package/dist/preview/chunk.FRQSLWP4.js +1 -0
  66. package/dist/preview/chunk.FVQKSN33.js +1 -0
  67. package/dist/preview/{chunk.CGQ6KXVK.js → chunk.G3GFDVO2.js} +1 -1
  68. package/dist/preview/{chunk.4O3C2LJF.js → chunk.G5GVT6JY.js} +1 -1
  69. package/dist/preview/chunk.GFLH7RCI.js +1 -0
  70. package/dist/preview/chunk.GG47EIKO.js +1 -0
  71. package/dist/preview/chunk.GMLONS5L.js +1 -0
  72. package/dist/preview/{chunk.RFVOXX3P.js → chunk.GRFD42WM.js} +1 -1
  73. package/dist/preview/{chunk.2PK335JQ.js → chunk.GVT4UUQA.js} +1 -1
  74. package/dist/preview/{chunk.5M34BJIQ.js → chunk.H3EGBDW2.js} +1 -1
  75. package/dist/preview/chunk.H6KIEDZN.js +1 -0
  76. package/dist/preview/chunk.HAOB6O72.js +1 -0
  77. package/dist/preview/chunk.HB5NWHFP.js +3 -0
  78. package/dist/preview/{chunk.GPCKOYSF.js → chunk.HJUZMOW2.js} +1 -1
  79. package/dist/preview/chunk.HN4ZJ4B4.js +1 -0
  80. package/dist/preview/chunk.HVBKI5ZO.js +1 -0
  81. package/dist/preview/chunk.I3SDKMQS.js +1 -0
  82. package/dist/preview/chunk.IAEGJDF3.js +1 -0
  83. package/dist/preview/{chunk.CS72MISN.js → chunk.IDALEKIW.js} +1 -1
  84. package/dist/preview/chunk.ILJDLBPJ.js +1 -0
  85. package/dist/preview/chunk.J2OPIS3H.js +111 -0
  86. package/dist/preview/chunk.J5OLYVZ4.js +1 -0
  87. package/dist/preview/{chunk.3KUYB5ZT.js → chunk.J6HF7IRQ.js} +1 -1
  88. package/dist/preview/chunk.JEC5FDKX.js +1 -0
  89. package/dist/preview/chunk.JKFVNQY7.js +1 -0
  90. package/dist/preview/chunk.JO2X52D4.js +1 -0
  91. package/dist/preview/{chunk.LVD3V77M.js → chunk.JQ2WNKDW.js} +1 -1
  92. package/dist/preview/{chunk.NBVPWLRY.js → chunk.JQ63N4MZ.js} +1 -1
  93. package/dist/preview/{chunk.7Q43N5JS.js → chunk.JU6UFWS3.js} +1 -1
  94. package/dist/preview/chunk.JVB5KDSG.js +1 -0
  95. package/dist/preview/chunk.KFT7JIEH.js +1 -0
  96. package/dist/preview/chunk.KGMSSXZL.js +1 -0
  97. package/dist/preview/chunk.KX5ZBHMA.js +2 -0
  98. package/dist/preview/{chunk.XTTESA7X.js → chunk.LP2ZMAT2.js} +1 -1
  99. package/dist/preview/{chunk.IMKD6QQG.js → chunk.LRNFE3UK.js} +1 -1
  100. package/dist/preview/{chunk.BUQKRXI6.js → chunk.LVOTLGJB.js} +1 -1
  101. package/dist/preview/chunk.LYEGRY77.js +3 -0
  102. package/dist/preview/{chunk.B3WVCSW5.js → chunk.M5FP4Y4Q.js} +1 -1
  103. package/dist/preview/{chunk.MH46V556.js → chunk.M7KXQGQL.js} +1 -1
  104. package/dist/preview/{chunk.LY5CY7GE.js → chunk.MAKCZ6B6.js} +1 -1
  105. package/dist/preview/{chunk.5THLLSS4.js → chunk.MJY4SLWA.js} +1 -1
  106. package/dist/preview/{chunk.J6KNEI5R.js → chunk.MSAYU25L.js} +1 -1
  107. package/dist/preview/chunk.MUSMNKE4.js +1 -0
  108. package/dist/preview/chunk.MW7R5G3C.js +1 -0
  109. package/dist/preview/chunk.N4ZKZ4GM.js +6 -0
  110. package/dist/preview/chunk.NAXOXBOF.js +1 -0
  111. package/dist/preview/{chunk.LGRQDILY.js → chunk.NKLPL7QD.js} +1 -1
  112. package/dist/preview/chunk.NKYWIGC7.js +3 -0
  113. package/dist/preview/{chunk.35E75QJ7.js → chunk.NRURQGXV.js} +1 -1
  114. package/dist/preview/chunk.NSOPYIT4.js +1 -0
  115. package/dist/preview/chunk.NXZL5CA2.js +1 -0
  116. package/dist/preview/chunk.NYLKG25K.js +4 -0
  117. package/dist/preview/{chunk.BU5PVRX7.js → chunk.O2OL6RQQ.js} +1 -1
  118. package/dist/preview/chunk.O5VFKVZS.js +1 -0
  119. package/dist/preview/chunk.OCXY5DCD.js +6 -0
  120. package/dist/preview/chunk.OHAO6KKH.js +1 -0
  121. package/dist/preview/{chunk.CXDGE5ZS.js → chunk.OWO3OV62.js} +1 -1
  122. package/dist/preview/chunk.P2EKKKK2.js +1 -0
  123. package/dist/preview/chunk.PSNMZBVS.js +1 -0
  124. package/dist/preview/{chunk.NKYYDFIX.js → chunk.PZ7KY6XH.js} +1 -1
  125. package/dist/preview/chunk.QAM76AXV.js +1 -0
  126. package/dist/preview/chunk.QDVGHI7R.js +1 -0
  127. package/dist/preview/{chunk.HJS3LTSR.js → chunk.QF5QB5YR.js} +1 -1
  128. package/dist/preview/chunk.QNP5OR3P.js +93 -0
  129. package/dist/preview/chunk.QRQ5WPZI.js +1 -0
  130. package/dist/preview/chunk.QWGWOEBZ.js +90 -0
  131. package/dist/preview/chunk.QXLJGHMC.js +23 -0
  132. package/dist/preview/{chunk.3RFAUIGT.js → chunk.QZQCQWQG.js} +1 -1
  133. package/dist/preview/chunk.R6JBA7UK.js +1 -0
  134. package/dist/preview/chunk.R7CRBRD4.js +1 -0
  135. package/dist/preview/chunk.RD2FSSLV.js +1 -0
  136. package/dist/preview/{chunk.CD6YWH6T.js → chunk.RG5G6YQD.js} +1 -1
  137. package/dist/preview/{chunk.T3KNLP7C.js → chunk.RJY7VJBH.js} +1 -1
  138. package/dist/preview/chunk.RR25BGWP.js +1 -0
  139. package/dist/preview/chunk.RSMCTI2N.js +1 -0
  140. package/dist/preview/{chunk.ZYNC73DJ.js → chunk.RSQ432QN.js} +1 -1
  141. package/dist/preview/chunk.SFBHPYRD.js +1 -0
  142. package/dist/preview/{chunk.FOSY7MZF.js → chunk.SJQPTDAT.js} +1 -1
  143. package/dist/preview/{chunk.TUCSUZNO.js → chunk.SNHKYH72.js} +1 -1
  144. package/dist/preview/chunk.SO6NT5K7.js +1 -0
  145. package/dist/preview/{chunk.FDWRH5P2.js → chunk.STPA7HBK.js} +3 -3
  146. package/dist/preview/{chunk.R2TSTDS3.js → chunk.SY5ID44D.js} +1 -1
  147. package/dist/preview/chunk.T27QKVKP.js +1 -0
  148. package/dist/preview/{chunk.FXG5AJF6.js → chunk.T2OUHRAA.js} +1 -1
  149. package/dist/preview/chunk.T3WCRS6M.js +1 -0
  150. package/dist/preview/chunk.TI5FR2QQ.js +1 -0
  151. package/dist/preview/{chunk.N2FNHRI2.js → chunk.TTSGCNPT.js} +1 -1
  152. package/dist/preview/{chunk.P6TZGR3A.js → chunk.TXZQEJ5T.js} +1 -1
  153. package/dist/preview/chunk.U6QXLNHF.js +15 -0
  154. package/dist/preview/{chunk.DICM56FT.js → chunk.UDHPMVC4.js} +1 -1
  155. package/dist/preview/{chunk.ZMWAZACO.js → chunk.UGQYMN4J.js} +1 -1
  156. package/dist/preview/chunk.UJPX3BUV.js +1 -0
  157. package/dist/preview/{chunk.CPYBJNHP.js → chunk.UQIPEMJ5.js} +1 -1
  158. package/dist/preview/{chunk.XSWR5LI4.js → chunk.URQTF5SY.js} +1 -1
  159. package/dist/preview/{chunk.7IGD2K4M.js → chunk.UW52CMGJ.js} +1 -1
  160. package/dist/preview/chunk.UWS4RMM3.js +1 -0
  161. package/dist/preview/{chunk.KHAVEYT7.js → chunk.V7H4BUEB.js} +1 -1
  162. package/dist/preview/{chunk.KHRS2SKB.js → chunk.VBHV4TLG.js} +1 -1
  163. package/dist/preview/chunk.VBLQJVQ5.js +1 -0
  164. package/dist/preview/{chunk.SPCAMQJE.js → chunk.WALVW3KJ.js} +1 -1
  165. package/dist/preview/{chunk.6RZHKQP3.js → chunk.WEMUKZKH.js} +1 -1
  166. package/dist/preview/chunk.X226YATK.js +2 -0
  167. package/dist/preview/{chunk.IJ3YDBWI.js → chunk.XFLGSUYO.js} +1 -1
  168. package/dist/preview/{chunk.ZTN7BS5O.js → chunk.XSWSBTUO.js} +1 -1
  169. package/dist/preview/{chunk.ZJFXM3LE.js → chunk.YCD4JSXD.js} +1 -1
  170. package/dist/preview/{chunk.QSDBF7VL.js → chunk.YZPESGCP.js} +1 -1
  171. package/dist/preview/{chunk.QO5RXOCS.js → chunk.Z27NSSYL.js} +2 -2
  172. package/dist/preview/chunk.Z2XUVJAL.js +1 -0
  173. package/dist/preview/{chunk.S3EEY7T3.js → chunk.Z3O2VZAJ.js} +1 -1
  174. package/dist/preview/chunk.Z4TY44CD.js +1 -0
  175. package/dist/preview/{chunk.O2W5JTWA.js → chunk.ZAPS4J6G.js} +1 -1
  176. package/dist/preview/{chunk.F2TWV4TX.js → chunk.ZAQ4IDX6.js} +1 -1
  177. package/dist/preview/chunk.ZEZUKRC6.js +5 -0
  178. package/dist/preview/{chunk.PTQPS2FJ.js → chunk.ZG5VGP5U.js} +1 -1
  179. package/dist/preview/chunk.ZRBGYXAO.js +6 -0
  180. package/dist/preview/index.html +57 -55
  181. package/dist/preview/page.js +2 -2
  182. package/dist/preview/splash.js +17 -14
  183. package/package.json +6 -6
  184. package/dist/preview/chunk.2P34ML3O.js +0 -111
  185. package/dist/preview/chunk.2UW5CRHF.js +0 -1
  186. package/dist/preview/chunk.2YMO7ZVX.js +0 -1
  187. package/dist/preview/chunk.33ULA3CG.js +0 -1
  188. package/dist/preview/chunk.3CJLAJXP.js +0 -25
  189. package/dist/preview/chunk.3IJSB5ET.js +0 -1
  190. package/dist/preview/chunk.3KO35VN4.js +0 -1
  191. package/dist/preview/chunk.3L37FY3G.js +0 -4
  192. package/dist/preview/chunk.3WP66LB5.js +0 -1
  193. package/dist/preview/chunk.4GJ7F4SP.js +0 -35
  194. package/dist/preview/chunk.4IJTPV5X.js +0 -1
  195. package/dist/preview/chunk.4JFBLVXJ.js +0 -1
  196. package/dist/preview/chunk.4PCVQEVI.js +0 -1
  197. package/dist/preview/chunk.5FQSYMAE.js +0 -1
  198. package/dist/preview/chunk.5NCLZ4NZ.js +0 -1
  199. package/dist/preview/chunk.5YNLFOBJ.js +0 -5
  200. package/dist/preview/chunk.77XQEDT5.js +0 -1
  201. package/dist/preview/chunk.7HPQI5SY.js +0 -1
  202. package/dist/preview/chunk.A4VA3DU5.js +0 -1
  203. package/dist/preview/chunk.ABSY3UZF.js +0 -1
  204. package/dist/preview/chunk.ARHAD5IS.js +0 -1
  205. package/dist/preview/chunk.BOC2EOGB.js +0 -9
  206. package/dist/preview/chunk.BR6TINGU.js +0 -1
  207. package/dist/preview/chunk.CDEAAWPS.js +0 -1
  208. package/dist/preview/chunk.CXJJB3MK.js +0 -1
  209. package/dist/preview/chunk.CXLQPE4J.js +0 -1
  210. package/dist/preview/chunk.DA4RSHLW.js +0 -1
  211. package/dist/preview/chunk.DJMSXXP4.js +0 -90
  212. package/dist/preview/chunk.DJPNVXBQ.js +0 -6
  213. package/dist/preview/chunk.DJVHKBEI.js +0 -1
  214. package/dist/preview/chunk.DVSTLVIH.js +0 -15
  215. package/dist/preview/chunk.E5WJSTOV.js +0 -1
  216. package/dist/preview/chunk.FEGSYSA7.js +0 -1
  217. package/dist/preview/chunk.HJUXC5GM.js +0 -1
  218. package/dist/preview/chunk.HNMSYQRA.js +0 -1
  219. package/dist/preview/chunk.HWLRKOI3.js +0 -1
  220. package/dist/preview/chunk.IHUMKFYH.js +0 -10
  221. package/dist/preview/chunk.IQ54QTA5.js +0 -1
  222. package/dist/preview/chunk.IQC3GOXO.js +0 -1
  223. package/dist/preview/chunk.ISN2QTVL.js +0 -2
  224. package/dist/preview/chunk.J24YPQ5I.js +0 -5
  225. package/dist/preview/chunk.J545NAMY.js +0 -1
  226. package/dist/preview/chunk.K2HDEL7I.js +0 -1
  227. package/dist/preview/chunk.K3JARAWU.js +0 -1
  228. package/dist/preview/chunk.KROR65KD.js +0 -2
  229. package/dist/preview/chunk.KV7GZBJ6.js +0 -50
  230. package/dist/preview/chunk.L7NJLZWV.js +0 -1
  231. package/dist/preview/chunk.LON75VHP.js +0 -1
  232. package/dist/preview/chunk.LQWVJQ5X.js +0 -18
  233. package/dist/preview/chunk.M5W2RHC6.js +0 -1
  234. package/dist/preview/chunk.M6BTLH24.js +0 -1
  235. package/dist/preview/chunk.MAGKI4PD.js +0 -1
  236. package/dist/preview/chunk.MD36ZSM5.js +0 -74
  237. package/dist/preview/chunk.MFZJVHWP.js +0 -1
  238. package/dist/preview/chunk.MHTA4HYB.js +0 -19
  239. package/dist/preview/chunk.N2YM247R.js +0 -1
  240. package/dist/preview/chunk.N35SJWAM.js +0 -1
  241. package/dist/preview/chunk.NJSK3UO2.js +0 -6
  242. package/dist/preview/chunk.OHMHPTEW.js +0 -1
  243. package/dist/preview/chunk.OJGHDWI6.js +0 -1
  244. package/dist/preview/chunk.PV2I4UPH.js +0 -1
  245. package/dist/preview/chunk.QFQSSZN7.js +0 -1
  246. package/dist/preview/chunk.RSS6OHXG.js +0 -1
  247. package/dist/preview/chunk.SBCAYTMT.js +0 -1
  248. package/dist/preview/chunk.SMTGRCMG.js +0 -3
  249. package/dist/preview/chunk.TCZIZ2PU.js +0 -1
  250. package/dist/preview/chunk.U74PTRHJ.js +0 -1
  251. package/dist/preview/chunk.UAORKZLO.js +0 -1
  252. package/dist/preview/chunk.UDVTPI2W.js +0 -1
  253. package/dist/preview/chunk.UETLP5KC.js +0 -1
  254. package/dist/preview/chunk.UHI3X2YD.js +0 -1
  255. package/dist/preview/chunk.UL62ELNR.js +0 -1
  256. package/dist/preview/chunk.VRYSZYAD.js +0 -1
  257. package/dist/preview/chunk.VUZFLDOX.js +0 -1
  258. package/dist/preview/chunk.X2NGFOAF.js +0 -1
  259. package/dist/preview/chunk.XE762VL2.js +0 -2
  260. package/dist/preview/chunk.Y2RZ5B4U.js +0 -1
  261. package/dist/preview/chunk.YKMBXMZE.js +0 -1
  262. package/dist/preview/chunk.Z34KASY7.js +0 -1
  263. package/dist/preview/chunk.ZMGKWMID.js +0 -1
  264. package/dist/preview/chunk.ZT5YQSSP.js +0 -21
  265. package/dist/preview/chunk.ZZM75ZTN.js +0 -4
@@ -0,0 +1,4 @@
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 Yt,f as ct,g as Nn}from"./chunk.GVT4UUQA.js";import{h as Li}from"./chunk.J6HF7IRQ.js";import{e as Ai,q as sr,r as Pi}from"./chunk.LRNFE3UK.js";import{b as Hn}from"./chunk.YCD4JSXD.js";import{a as Fe,b as Zr,c as cn,d as Ci,e as Jr}from"./chunk.ZG5VGP5U.js";import{a as Oi}from"./chunk.URQTF5SY.js";import{a as Mi,b as Ei,c as Ri}from"./chunk.MSAYU25L.js";import{b as ki,d as Si}from"./chunk.EGPCVMDU.js";import{c as Go}from"./chunk.6N4PE3U5.js";import{A as xi,C as vi,a as fi,b as Kr,c as Ur,f as Xr,g as qr,h as Qr,i as mi,j as sn,k as dn,p as Gt,q as ln,r as yi,s as wi,z as bi}from"./chunk.QRQ5WPZI.js";import{A as si,B as di,C as li,D as ci,E as ui,f as Jo,g as on,h as ei,i as ti,j as ni,k as ri,m as ar,n as Tn,o as In,p as an,q as _r,r as oi,s as ii,z as ai}from"./chunk.RD2FSSLV.js";import{a as pi,b as gi}from"./chunk.37RFCHSS.js";import{b as hi}from"./chunk.JQ63N4MZ.js";import{A as wt,B as Fr,C as Ln,G as Oe,K as Ot,L as Uo,La as Cn,Qa as Vr,Ra as zr,Sa as zt,Ua as Gr,W as Ae,Y as or,Ya as Yr,Z as Wr,a as Ir,b as Nr,ba as jr,c as Hr,ca as ir,d as Yo,da as jt,e as _o,ea as ve,f as nr,ga as Vt,h as Ft,j as Et,k as Br,l as rr,la as Xo,m as An,ma as qo,p as Dr,pa as rn,r as Re,ra as Qo,s as He,t as Ko,u as Pn,v as Be,w as Wt,x as Rt,xa as Zo,y as $r}from"./chunk.A5PSEU3W.js";import{a as nn}from"./chunk.SDO3U72B.js";import{Rc as On,Yd as Tr,_d as jo,ga as Jn,ka as Fo,la as en,na as tn,oa as $t,oe as Vo,pa as er,rd as We,re as zo,ua as Wo,ye as tr}from"./chunk.ZEZUKRC6.js";import{b as de}from"./chunk.AJZBJBMO.js";var dr=de(Oe(),1);var Ti=de(Ae(),1);function lr(e){let t=(0,dr.useRef)(e);t.current=e;let n=(0,dr.useRef)(null),o=(0,dr.useRef)(new Map),r=n.current;if(r&&(r.outer===e||Ts(r.outer,e)))return r.outer=e,r.inner;let i=ct(e.view,null),s=(c,l,a)=>{let u=o.current.get(c);return u&&u.made===l?u.call:(o.current.set(c,{made:l,call:a}),a)},d=Object.fromEntries(Object.entries(e).map(([c,l])=>[c,c==="view"?i:c==="setView"?s(c,l,Cs(t)):typeof l=="function"?s(c,l,(...a)=>t.current[c](...a)):l]));return n.current={outer:e,inner:d},d}function Cs(e){return t=>e.current.setView(typeof t=="function"?t:n=>t.pan===void 0&&n.pan?{...t,pan:n.pan}:t)}function Ts(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],i=t[o];if(r!==i&&!(typeof r=="function"&&typeof i=="function"))return!1}return eo(e.view,t.view)}function eo(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 Is({children:e}){let t=lr(ve());return(0,Ti.jsx)(or.Provider,{value:t,children:e})}var Ii={width:1200,height:760,focusSize:{width:1200,height:420},relationSize:{width:240,height:140},contextSize:{width:300,height:104},gap:16,unit:16};var Ni=(e,t)=>e?`${e.edgeKind}|${e.direction}`:`raised|${t}`,_t=(e,t,n)=>`${Fr}${e}|${t}|${n}`;function cr(e,t){let n=e.map(()=>0),o=e.map((s,d)=>({size:s,index:d})).sort((s,d)=>s.size-d.size||s.index-d.index),r=Math.max(t,e.length),i=e.length;for(let{size:s,index:d}of o){let c=Math.max(1,Math.floor(r/i));n[d]=Math.min(s,c),r-=n[d],i-=1}return n}function no(e){return Ni(e.via,e.node.kind)}function un(e,t,n=[]){let o=[],r=0;return e.forEach((i,s)=>{if(i<=0)return;let d=Math.min(t,Math.max(1,n[s]??1)),c=Math.max(i,d);if(o.length>0&&i<=t&&c<=r){o[o.length-1].push({run:s,cards:i,slots:c}),r-=c;return}let l=i,a=!0;for(;l>0;){let u=Math.min(t,l),m=a?Math.max(u,d):u;o.push([{run:s,cards:u,slots:m}]),l-=u,r=t-m,a=!1}}),o}function ro(e,t,n,o=[]){let r=cr(e,t*n);for(;un(r,t,o).length>n;){let i=-1;if(r.forEach((s,d)=>{s>1&&(i<0||s>r[i])&&(i=d)}),i<0)break;r[i]=r[i]-1}return r}function Ns(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,i)=>({node:r,index:i,key:o(r)})).sort((r,i)=>{for(let s=0;s<r.key.length;s++)if(r.key[s]!==i.key[s])return r.key[s]-i.key[s];return r.index-i.index}).map(r=>r.node)}var Hs=5,Bs=(e,t)=>{for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n];return!1};function Hi(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}:{}},i=[];for(let d of Ai(n.schema,o).groups)if(d.key!==n.exclude)if(d.buckets)for(let c of["decade","year","month"])i.push({by:d.key,bucket:c});else i.push({by:d.key});let s;return i.forEach((d,c)=>{let a=Li(e,{group:d},r).groups;if(a.length<2||a.length>t)return;let m=a.filter(b=>b.key!=="").reduce((b,h)=>b+h.nodes.length,0)/e.length;if(m<.5||a.some(b=>b.nodes.length>e.length*.75))return;let f=[-Math.round(m*100),Math.abs(a.length-Hs),c];(!s||Bs(f,s.score))&&(s={grouping:{by:d.by,...d.bucket?{bucket:d.bucket}:{},groups:a},score:f})}),s?.grouping}function oo(e,t){let n=h=>({id:h.node.id,kind:h.node.kind,node:h.node,...h.via?{via:h.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 h of e){let y=Ni(h.via,h.node.kind),M=r.get(y);M?M.push(h):r.set(y,[h])}let i=[...r.entries()].map(([h,y])=>({key:h,run:y,via:y[0].via,kinds:[...new Set(y.map(M=>M.node.kind))],members:[],whole:!1,extra:0})),s=cr(i.map(h=>h.run.length),t.budget);i.forEach((h,y)=>h.whole=h.run.length<=s[y]);let d=i.filter(h=>!h.whole),c=i.filter(h=>h.whole).reduce((h,y)=>h+y.run.length,0),l=Math.max(d.length,t.budget-c);for(let h of d){h.members=Ns(h.run.map(M=>M.node),o,t.graph);let y=l-(d.length-1);h.kinds.length>1&&h.kinds.length<=y?h.byKind=!0:h.kinds.length===1&&(h.grouping=Hi(h.members,y,{schema:t.schema,graph:t.graph,...h.via?{exclude:h.via.edgeKind}:{},...t.today?{today:t.today}:{}}))}let a=h=>h.byKind?h.kinds.length:h.grouping?h.grouping.groups.length:1;for(;d.reduce((h,y)=>h+a(y),0)>l;){let h=[...d].filter(y=>a(y)>1).sort((y,M)=>a(M)-a(y))[0];if(!h)break;h.grouping=void 0,h.byKind=!1}l-=d.reduce((h,y)=>h+a(y),0);let u=h=>h.byKind?h.kinds.some(y=>t.expanded.has(_t(y,h.key,"kind"))):h.grouping?.groups.some(y=>t.expanded.has(_t(h.kinds[0],h.key,to(h.grouping,y.key)))),m=d.filter(h=>!h.grouping&&!h.byKind?!0:u(h)),f=cr(m.map(h=>h.members.length),Math.max(0,l));m.forEach((h,y)=>h.extra=l>0?f[y]:0);let b=[];for(let h of i){let{key:y,via:M}=h;if(h.whole){b.push(...h.run.map(n));continue}let v=g=>({id:g.id,kind:g.kind,node:g,...M?{via:M}:{}}),w=new Map(h.run.map((g,S)=>[g.node.id,S])),x=(g,S,L)=>{let C=[...g.slice(0,S)].sort((ae,I)=>w.get(ae.id)-w.get(I.id));b.push(...C.map(v));let V=g.slice(S);if(V.length===0)return;let X=V[0].kind;b.push({id:_t(X,y,L?`more:${L}`:"more"),kind:X,...M?{via:M}:{},aggregate:{kind:X,memberIds:V.map(ae=>ae.id),label:S>0?`${V.length} more ${t.plural(X).toLowerCase()}`:`${V.length} ${t.plural(X).toLowerCase()}`,opens:{in:"picture",focus:Be(X),within:L?{filter:L}:{}}}})},O=M&&t.focusId?`${M.edgeKind}:${t.focusId}`:void 0;if(h.byKind){let g=h.kinds.find(S=>t.expanded.has(_t(S,y,"kind")));for(let S of h.kinds){let L=h.members.filter(C=>C.kind===S);if(S===g){let C=h.extra+1;L.length<=C?b.push(...L.map(v)):x(L,C-1,O);continue}b.push({id:_t(S,y,"kind"),kind:S,...M?{via:M}:{},aggregate:{kind:S,memberIds:L.map(C=>C.id),label:t.plural(S),opens:{in:"place"}}})}continue}let E=h.grouping;if(!E){x(h.members,h.extra,O);continue}let T=h.kinds[0],D=E.groups.find(g=>t.expanded.has(_t(T,y,to(E,g.key))));for(let g of E.groups){if(g===D){let S=h.members.filter(C=>g.nodes.includes(C)),L=h.extra+1;if(S.length<=L)b.push(...S.map(v));else{let C=g.key!==""&&!g.key.includes(",")&&!E.bucket,V=[O,C?`${E.by}:${g.key}`:void 0].filter(Boolean).join(",")||void 0;x(S,L-1,V)}continue}b.push({id:_t(T,y,to(E,g.key)),kind:T,...M?{via:M}:{},aggregate:{kind:T,memberIds:h.members.filter(S=>g.nodes.includes(S)).map(S=>S.id),label:g.label.charAt(0).toUpperCase()+g.label.slice(1),opens:{in:"place"}}})}}return b}var to=(e,t)=>`${e.by}${e.bucket?`:${e.bucket}`:""}=${t||"none"}`;var ur=300,Bi=12,hn=8,io=19;var hr=(e,t=1)=>(e.length*8.4+16)*t;function Bn(e){return e.description??`${e.direction==="in"?"\u2190":"\u2192"} ${Jn(e.edgeKind).toLowerCase()}`}function ao(e,t,n=1){let o=d=>hr(d,n),r=new Map;for(let d of e){let c=r.get(d.key);c?c.push(d):r.set(d.key,[d])}let i=[...r.values()].map(d=>{let c=Math.min(...d.map(a=>a.top)),l=d.filter(a=>a.top-c<=Bi);return{key:d[0].key,text:d[0].text,left:Math.min(...l.map(a=>a.left)),right:Math.max(...l.map(a=>a.right)),top:c}});i.sort((d,c)=>d.top-c.top||d.left-c.left);let s=i.map(d=>{let c=Math.max(d.right-d.left,Math.min(ur,o(d.text))),l=(d.left+d.right)/2;return{left:l-c/2,right:l+c/2}});return i.map((d,c)=>{let l=i.map((w,x)=>({other:w,at:x})).filter(({other:w})=>w!==d&&Math.abs(w.top-d.top)<=Bi),a=l.filter(({other:w})=>w.right<=d.left).map(({other:w,at:x})=>s[x].right+hn<=(w.right+d.left)/2?s[x].right+hn:(w.right+d.left+hn)/2),u=l.filter(({other:w})=>w.left>=d.right).map(({other:w,at:x})=>s[x].left-hn>=(d.right+w.left)/2?s[x].left-hn:(d.right+w.left-hn)/2),m=Math.max(t.left,...a),f=Math.min(t.right,...u),b=d.right-d.left,h=s[c].right-s[c].left,y=Math.max(b,Math.min(h,f-m)),M=(d.left+d.right)/2,v=b>=y?d.left:Math.max(m,Math.min(M-y/2,f-y));return{key:d.key,text:d.text,left:v,width:y,top:d.top}})}function $i(e,t,n,o,r=1){let i=d=>String(d).length*7.4,s=e.length*8.6+6+i(t)+14+(n>0?22+i(n):0);return{width:Math.max(s,o?184:0)*r,height:(o?38:22)*r,short:{width:s*r,height:22*r}}}function Kt(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 so=(e,t,n,o)=>{let r=Math.max(e.x,Math.min(t.x,e.x+e.width)),i=Math.max(e.y,Math.min(t.y,e.y+e.height));return Math.abs(r-t.x)/n+Math.abs(i-t.y)/o<.92},Dn=4,Di=.45;function lo(e,t,n,o={},r={}){let i={};for(let k of e)i[k.kind]=k.count;let s={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},d=r.avoid??[],c=r.tilt??.5,l=k=>k.nameplate??{width:120,height:34,short:{width:90,height:20}},a=k=>e.map(R=>{let B=k.get(R.kind);return{card:R,plot:B,center:cn(B.col+B.side/2,B.row+B.side/2,1,c)}}),u=(k,R)=>{let B=1/0,G=-1/0,A=1/0,F=-1/0;for(let{card:z,plot:_,center:Z}of k){let ne=Z.x*R,J=Z.y*R,fe=_.side*R/2,ie=z.opened>0?l(z).width:l(z).short.width;B=Math.min(B,ne-Math.max(fe+(z.count>12?30:0),ie/2)),G=Math.max(G,ne+Math.max(fe,ie/2)),A=Math.min(A,J-fe*c-R*Di),F=Math.max(F,J+fe*c+Dn+l(z).short.height)}return{minX:B,maxX:G,minY:A,maxY:F}},m=k=>{let R=4,B=160;for(let G=0;G<24;G++){let A=(R+B)/2,F=u(k,A);F.maxX-F.minX<=s.width&&F.maxY-F.minY<=s.height?R=A:B=A}return R},f=k=>{let R={...r.order?{order:r.order}:{},counts:i,...r.plots?{plots:r.plots}:{},pitch:k},B=Zr(t,R),G=Zr(t,{...R,upright:!0}),A=m(a(B)),F=m(a(G)),z=n.height>n.width&&F>=A?G:B;return{map:z,fitted:z===G?F:A}},b=[],h=new Map,y=0,M=(k,R={x:0,y:0})=>{let B=u(b,k),G=s.x+s.width/2-(B.minX+B.maxX)/2+R.x,A=s.y+s.height/2-(B.minY+B.maxY)/2+R.y;return{originX:G,originY:A,cell:k}},v=k=>{let{originX:R,originY:B,cell:G}=k,A=b.map(({center:_})=>_.y),F=Math.max(...A),z=Math.min(...A);return b.map(({card:_,plot:Z,center:ne})=>{let J=R+ne.x*G,fe=B+ne.y*G,ie=Z.side*G/2,se=ie*c,we=F===z?.5:(ne.y-z)/(F-z);return{card:_,plot:Z,x:J,y:fe,halfW:ie,halfH:se,depth:1-we*.65}})},w=(k,R=!0)=>{let B=[];return[...k].sort((A,F)=>(F.card.weight??F.card.count)-(A.card.weight??A.card.count)||e.indexOf(A.card)-e.indexOf(F.card)).filter(A=>[l(A.card),l(A.card).short].some(F=>{let z=E(A,F),_=(!R||z.x>=0&&z.y>=0&&z.x+z.width<=n.width&&z.y+z.height<=n.height)&&!B.some(Z=>Kt(z,Z,4))&&!k.some(Z=>Z!==A&&so(z,Z,Z.halfW,Z.halfH))&&!d.some(Z=>Kt(z,Z,0));return _&&B.push(z),_})).length},x=k=>k.card.marquee?{x:k.x-k.card.marquee.width/2,y:k.y+k.halfH+Dn+l(k.card).height,width:k.card.marquee.width,height:k.card.marquee.height}:null,O=(k,R,B)=>B.some(G=>{if(G===R)return!1;let A=x(G);return A!==null&&Kt(k,A,4)}),E=(k,R,B="under")=>B==="aside"?{x:k.x+k.halfW+Dn,y:k.y-R.height/2,width:R.width,height:R.height}:B==="above"?{x:k.x-R.width/2,y:k.y-k.halfH-Dn-Di*S.cell-R.height,width:R.width,height:R.height}:{x:k.x-R.width/2,y:k.y+k.halfH+Dn,width:R.width,height:R.height},T=k=>k.some(R=>d.some(B=>so(B,R,R.halfW,R.halfH)||Kt(B,E(R,l(R.card).short),0))),D=k=>k.every(R=>{let B=E(R,l(R.card).short);return R.x-R.halfW>=0&&R.x+R.halfW<=n.width&&R.y-R.halfH>=0&&B.x>=0&&B.x+B.width<=n.width&&B.y+B.height<=n.height}),g={pitch:Fe,said:-1};for(let k of[Fe,Fe+1,Fe+2,Fe+3,Fe+5,Fe+7]){({map:h,fitted:y}=f(k)),b=a(h);let R=w(v(M(y)));if(R>g.said&&(g={pitch:k,said:R}),R===e.length)break}(g.pitch!==Fe+7||g.said!==e.length)&&({map:h,fitted:y}=f(g.pitch),b=a(h));let S=M(y);if(d.length>0&&T(v(S))){let k;for(let R=1;R>=.3&&!k;R-=.05){let B=y*R,G=Math.max(...d.map(F=>F.width))/2+B,A=Math.max(...d.map(F=>F.height))/2+B/2;for(let F of[0,.5,.75,1,1.25]){for(let[z,_]of[[1,0],[-1,0],[0,1],[0,-1],[1,1],[-1,1],[1,-1],[-1,-1]]){let Z=M(B,{x:z*G*F,y:_*A*F}),ne=v(Z);if(!T(ne)&&D(ne)){k=Z;break}if(F===0)break}if(k)break}}k&&(S=k)}let L=(k,R,B={x:n.width/2,y:n.height/2})=>({cell:k.cell*R,originX:B.x+(k.originX-B.x)*R,originY:B.y+(k.originY-B.y)*R}),C=k=>{let R=k,B=r.stood&&Math.abs(r.stood.cell-R.cell)<.01?r.stood:null;B&&(R={...R,originX:R.originX+B.x,originY:R.originY+B.y});let G={x:R.originX-(B?.x??0),y:R.originY-(B?.y??0)},A=v(R).filter(F=>r.keep?.includes(F.card.kind));if(A.length>0){let F=r.seen??n,z=A.flatMap(re=>[{x:re.x-re.halfW,y:re.y-re.halfH,width:re.halfW*2,height:re.halfH*2},E(re,l(re.card))]),_=r.seen?A.flatMap(re=>x(re)??[]):[],Z=re=>Math.max(...re.map(ee=>ee.y+ee.height))-Math.min(...re.map(ee=>ee.y)),ne=_.length>0&&Z([...z,..._])<=F.height-16?[...z,..._]:z,J=Math.min(...ne.map(re=>re.x)),fe=Math.max(...ne.map(re=>re.x+re.width)),ie=Math.min(...ne.map(re=>re.y)),se=Math.max(...ne.map(re=>re.y+re.height)),we=(re,ee,le)=>ee-re>le-16?le/2-(re+ee)/2:re<8?8-re:ee>le-8?le-8-ee:0;(!r.seen||se-ie<=F.height-16)&&(R={...R,originX:R.originX+we(J,fe,F.width),originY:R.originY+we(ie,se,F.height)})}return{where:R,stood:{x:R.originX-G.x,y:R.originY-G.y,cell:R.cell}}},V=1,X;if(w(v(S))<e.length){let k={said:w(v(S),!1),area:1/0,pitch:-1,by:1},R={map:h,shape:b,fitted:y,where:S};for(let B of[Fe,Fe+1,Fe+2,Fe+3,Fe+5,Fe+7]){({map:h,fitted:y}=f(B)),b=a(h);let G=M(y);for(let A=1;A<=3.001;A+=.1){let F=w(v(L(G,A)),!1),z=u(b,y*A),_=(z.maxX-z.minX)*(z.maxY-z.minY);if((F>k.said||F===k.said&&_<k.area)&&(k={said:F,area:_,pitch:B,by:A}),F===e.length)break}}k.pitch<0?{map:h,shape:b,fitted:y,where:S}=R:({map:h,fitted:y}=f(k.pitch),b=a(h),V=k.by,S=L(M(y),V)),{where:S,stood:X}=C(S)}else r.seen&&r.seen.height<n.height&&({where:S,stood:X}=C(S));let ae=r.zoom&&r.zoom!==1?r.zoom:1;ae!==1&&(S=L(S,ae,r.seen?{x:r.seen.width/2,y:r.seen.height/2}:void 0));let I=v(S),$=[],N=new Map,q=new Map,P=[...I].sort((k,R)=>(R.card.weight??R.card.count)-(k.card.weight??k.card.count)||e.indexOf(k.card)-e.indexOf(R.card));for(let k of P){let R=[["full",l(k.card),"under"],["short",l(k.card).short,"under"]],B="none",G=k===P[0],A=(z,_)=>R.filter(([Z])=>Z.startsWith(_)).map(([Z,ne,J])=>[Z,ne,J,z]),F=G?[...A(!1,"full"),...A(!1,"short"),...A(!0,"full"),...A(!0,"short")]:R.map(([z,_,Z])=>[z,_,Z,!1]);for(let[z,_,Z,ne]of F){let J=E(k,_,Z);if((ae!==1||V!==1||J.x>=0&&J.y>=0&&J.x+J.width<=n.width&&J.y+J.height<=n.height)&&!$.some(se=>Kt(J,se,4))&&(ne||!I.some(se=>se!==k&&so(J,se,se.halfW,se.halfH)))&&!O(J,k,I)&&!d.some(se=>Kt(J,se,0))){B=z,$.push(J),q.set(k.card.id,J);break}}N.set(k.card.id,B)}let j=I.map(k=>({id:k.card.id,x:k.x-k.halfW,y:k.y-k.halfH,width:k.halfW*2,height:k.halfH*2+(k.card.opened>0?Math.max(k.card.openedMin??0,k.card.opened):0),depth:k.depth,plot:k.plot,nameplate:N.get(k.card.id)??"none"})),W=u(b,S.cell),Q={cell:S.cell,originX:S.originX,originY:S.originY,pan:r.pan??{x:0,y:0},extent:{x:S.originX+W.minX,y:S.originY+W.minY,width:W.maxX-W.minX,height:W.maxY-W.minY},openedShare:1,...c!==.5?{tilt:c}:{},...X&&(X.x!==0||X.y!==0)?{stood:X}:{},...q.size>0?{nameplates:I.flatMap(k=>{let R=q.get(k.card.id);return R?[{id:k.card.id,x:R.x-(k.x-k.halfW),y:R.y-(k.y-k.halfH),width:R.width,height:R.height}]:[]})}:{},...I.some(k=>k.card.marquee)?{showings:I.flatMap(k=>{let R=x(k);return R?[{id:k.card.id,x:R.x-(k.x-k.halfW),y:R.y-(k.y-k.halfH),width:R.width,height:R.height}]:[]})}:{}};return{placed:j,frame:Q,map:h}}function At(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,i=24;return{x:Math.max(o.x,r.x+r.width-t+i,-r.x+i),y:Math.max(o.y,r.y+r.height-n+i,-r.y+i)}}var fr=48;function co(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 i=r.x+r.width/2,s=r.y+r.height/2,d=i<0?"left":i>t?"right":s<0?"top":s>n?"bottom":null;if(!d)continue;let c=d==="left"||d==="right",l=c?Math.max(0,Math.min(n,s)):Math.max(0,Math.min(t,i)),a=(f,b)=>f<b/4?b/4-f:f>b*3/4?b*3/4-f:0,u=(f,b)=>f<fr?fr-f:f>b-fr?b-fr-f:0,m=c?{x:a(i,t),y:u(s,n)}:{x:u(i,t),y:a(s,n)};o.push({id:r.id,kind:r.id.slice(5),side:d,along:l,by:m})}return o}function mr(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 Ds={rankOf:()=>{},parentOf:()=>{}};function Fi(e,t){if(t.size===0)return Ds;let n=e.kinds,o=new Map,r=(l,a)=>{l!==a&&((o.get(l)??o.set(l,new Set).get(l)).add(a),(o.get(a)??o.set(a,new Set).get(a)).add(l))};for(let l of n){let a=e.tryDefinition(l);if(a)for(let u of Object.values(a.edges??{})){let m=u.to==="*"?n:u.to;for(let f of m)r(l,f)}}let i=new Map,s=new Map,d=[...t].filter(l=>n.includes(l));for(let l of d)i.set(l,0);let c=0;for(;d.length>0;){c+=1;let l=[];for(let a of[...d].sort((u,m)=>n.indexOf(u)-n.indexOf(m)))for(let u of[...o.get(a)??[]].sort((m,f)=>n.indexOf(m)-n.indexOf(f)))i.has(u)||(i.set(u,c),c===2&&s.set(u,a),l.push(u));d=l}return{rankOf:l=>{let a=i.get(l);if(a!==0)return a===1?"primary":"secondary"},parentOf:l=>s.get(l)}}function Wi(e,t,n,o,r={}){if(n){let i=new Map;for(let s of e.allEdges()){if(o&&s.kind!==o)continue;let d=s.from===n.id?s.to:s.to===n.id?s.from:null;if(d===null||d===n.id)continue;let c=e.getNode(d);if(!c||i.has(d))continue;let l=s.from===n.id?"out":"in",a=l==="out"?n.kind:c.kind,u=$s(t,a,s.kind,l);i.set(d,{node:c,via:{edgeKind:s.kind,direction:l,...u?{description:u}:{}}})}if(i.size>0){let s=d=>`${d.via.edgeKind}|${d.via.description??""}`;return[...i.values()].sort((d,c)=>(s(d)<s(c)?-1:s(d)>s(c)?1:0)||wt(d.node,c.node))}}if(n){let i=r[n.id]??[],s=new Set,d=[];for(let c of i){if(c===n.id||s.has(c))continue;let l=e.getNode(c);l&&(o&&o!=="judges"&&l.kind!==o||(s.add(c),d.push({node:l,via:{edgeKind:"judges",direction:"out",description:"what it finds wrong"}})))}if(d.length>0)return d.sort((c,l)=>wt(c.node,l.node))}return o?e.allNodes().filter(i=>i.kind===o).sort(wt).map(i=>({node:i})):[]}function $s(e,t,n,o){let i=e.tryDefinition(t)?.edges?.[n];return o==="out"?i?.description:i?.inverse}function ji(e,t,n){let o=new Map,r=[...t.values()].sort((l,a)=>l.plane-a.plane);for(let l of r)for(let a of l.aggregate?.memberIds??[])!t.has(a)&&!o.has(a)&&o.set(a,l.id);let i=l=>t.get(l)??t.get(o.get(l)??""),s=new Map,d=new Map,c=new Map;for(let l of e.allEdges()){let a=i(l.from),u=i(l.to);if(!a||!u||a.id===u.id&&!(n.overview&&a.aggregate&&a.plane===2))continue;let m=`${l.kind}:${a.id}:${u.id}`,f=s.get(m);if(f){let b=`${l.from}
2
+ ${l.to}`,h=d.get(m);if(h.has(b))continue;if(h.add(b),c.get(m).push({from:l.from,to:l.to}),f.single){let{single:y,...M}=f;s.set(m,M)}continue}d.set(m,new Set([`${l.from}
3
+ ${l.to}`])),c.set(m,[{from:l.from,to:l.to}]),s.set(m,{id:m,kind:l.kind,from:a.id,to:u.id,edges:[{from:l.from,to:l.to}],single:{from:l.from,to:l.to},...a.id===u.id?{loop:!0}:{},x1:a.x+a.width/2,y1:a.y+a.height/2,x2:u.x+u.width/2,y2:u.y+u.height/2})}return[...s.values()].map(l=>({...l,edges:c.get(l.id)})).sort(wt)}var zi=.85,Vi=60,uo=160;function Fs(e,t,n,o,r,i=zi){let s=e*t.width+Math.max(0,e-1)*n,d=Math.max(n,(o-s)/2);return Array.from({length:e},(c,l)=>({x:d+l*(t.width+n),y:r,depth:i}))}function pr(e,t,n,o={}){let r={...Ii,...o},i=Math.max(8,r.unit??16)/16,s=r.inset?.left??0,d=n.overview?Math.max(0,r.dock?.right??0):0,c=n.overview?Math.max(0,r.dock?.bottom??0):0,l=r.width-d-s-(r.inset?.right??0),a=[],u=new Map,m=p=>n.past===!0||Fo(t.tryDefinition(p.kind),p,r.today),f=new Set(o.hiddenKinds??[]),b=p=>!f.has(p.kind),h=n.focusId?Rt(n.focusId).filter(p=>t.tryDefinition(p)!==void 0).filter(p=>!f.has(p)):[];n.focusId&&Rt(n.focusId).length>0&&h.length===0&&(n={...n,focusId:null});let y=n.focusId?e.getNode(n.focusId):void 0;y&&!b(y)&&(n={...n,focusId:null},h=[]);let M=h.length>0?[...e.allNodes()].filter(p=>h.includes(p.kind)).sort(wt):[],v=M.filter(b).filter(m),w=M.length-v.length,x=n.focusId&&h.length===0?e.getNode(n.focusId):void 0,O=n.zoom===!0&&!n.overview&&n.focusId!==null,E=Math.max(56,r.height*.062),T=Math.min(r.height*.895,r.height-E),D=O?x!==void 0?{focusY:r.height*.03,focusH:r.height*.58,relationY:r.height*.645,relationH:r.height*.2,contextY:T,contextH:E}:{focusY:r.height*.03,focusH:r.height*.71,relationY:r.height*.765,relationH:r.height*.1,contextY:T,contextH:E}:x===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 p=r.height,Y=p*.04,U=Math.max(p*.42,Math.min(p*.56,300)),he=Y+U+p*.06;return{focusY:Y,focusH:U,relationY:he,relationH:Math.max(p*.12,p*.878-p*.068-he),contextY:p*.878,contextH:p*.092}})(),g=Math.min(r.headroom??0,D.focusY+D.focusH*.2),S=g>D.focusY?{...D,focusY:g,focusH:D.focusH-(g-D.focusY)}:D,L=p=>Math.min(r.gap*p,Math.round(l*.1)),C=O?Math.min(880,l-L(5)):Math.min(700,l-L(6)),V=O?l-L(5):Math.min(r.focusSize.width,l-L(6)),X=(p,Y,U)=>({width:p===0?Y:Math.min(Y,(l-r.gap*(p+1))/p),height:U}),ae=(p,Y,U)=>{let he=X(p,Y,U),Ee=Math.min(Y,uo*i,l-r.gap*2);return he.width>=Ee?he:{width:Ee,height:U}},I=p=>Math.max(1,Math.floor((l-r.gap)/(Math.min(p,uo*i,l-r.gap*2)+r.gap))),$=new Set(n.expanded),N=n.overview?[]:Wi(e,t,x,n.relation,r.judged).filter(p=>b(p.node)).filter(p=>m(p.node)),q=n.overview?0:Math.max(0,Vi*i-S.contextH),P=N.length>0?S.focusH:S.contextY-S.focusY-r.gap*2-q,j=V,W=r.height,Q=Math.min(l*.5/j,r.height*.48/W),k=j*Q,R=W*Q,B=new Set(o.plainGroups??[]),G=n.overview&&!x&&h.length>0&&n.focusId!==null,A=G&&h.length>0&&h.every(p=>B.has(p));if(G)for(let p of h)A&&o.besideTheMap!==!0?$.add(Re(p)):$.delete(Re(p));let F=G&&!A&&h.length===1?h[0]:void 0,z=F!==void 0&&(o.screens?.[F]?.length??0)>0,_,Z=n.overview===!0&&x!==void 0&&o.besideTheMap===!0;n.overview&&(x||h.length>0)&&n.focusId&&!A&&!z&&!(G&&o.besideTheMap===!0)&&!Z?(_={x:s+(l-k)/2,y:r.height*.53-R/2,width:k,height:R},St({id:n.focusId,kind:x?x.kind:h[0],plane:0,x:_.x,y:_.y,width:k,height:R,natural:{width:j,height:W},...x?{}:{aggregate:{kind:h.join("+"),memberIds:v.map(p=>p.id),label:o.plurals?.[n.focusId]??h.map(p=>$t(t,p)).join(" and "),...w>0?{retired:w}:{}}}})):n.overview||(x?St({id:x.id,kind:x.kind,plane:0,x:s+(l-C)/2,y:S.focusY,width:C,height:P}):h.length>0&&n.focusId&&St({id:n.focusId,kind:h[0],plane:0,x:s+(l-V)/2,y:S.focusY,width:V,height:P,aggregate:{kind:h.join("+"),memberIds:v.map(p=>p.id),label:o.plurals?.[n.focusId]??h.map(p=>$t(t,p)).join(" and "),...w>0?{retired:w}:{}}}));let ne=26,J=52,fe=22,ie=Math.round(r.relationSize.width*.75),se=Math.max(1,Math.floor((l-r.gap)/(ie+r.gap))),we=r.unit/16,De=new Map;for(let p of N){let Y=no(p),U=De.get(Y);U?U.push(p):De.set(Y,[p])}let re=[...De.values()],ee=re.length>1,le=Math.max(r.gap,fe*we),at=ee?le:r.gap,Ke=Math.max(2,Math.floor((S.relationH+at)/(ne*we+at))),bn=Math.min(r.relationSize.width,(l-r.gap*(se+1))/se)+r.gap,Ze=re.map(p=>{let Y=p[0].via;return!ee||!Y?1:Math.ceil((Math.min(ur*we,hr(Bn(Y),we))+r.gap)/bn)}),Te=re.map(p=>p.length),Tt=un(Te,se,Ze),Je=N.length>se*Ke||Tt.length>Ke,It={schema:t,graph:e,focusId:x?.id,expanded:$,...r.relevance?{relevance:r.relevance}:{},...n.selection?{selection:n.selection}:{},plural:p=>$t(t,p),...r.today?{today:r.today}:{}},Ue=Je||ee?le:r.gap,Le,Ie;if(!Je)Le=re.flat().map(p=>({id:p.node.id,kind:p.node.kind,node:p.node,...p.via?{via:p.via}:{}})),Ie=Tt;else{let p=Math.max(1,Math.floor((S.relationH+Ue)/(J*we+Ue))),U=un(Te.map(()=>1),se,Ze).length<=p?Ze:[],he=ro(Te,se,p,U),Ee=re.map((be,Ce)=>oo(be,{...It,budget:he[Ce]}));Le=Ee.flat(),Ie=un(Ee.map(be=>be.length),se,U)}let st=Ie.length,oe=st===1?S.relationH:(S.relationH-Ue*(st-1))/st,et=X(Math.max(...Ie.map(p=>p.reduce((Y,U)=>Y+U.slots,0)),1),Le.length<=2?Math.round(r.relationSize.width*1.35):r.relationSize.width,oe),pt=[];{let p=et.width+r.gap,Y=[],U=0,he=new Map;for(let be of Ie.flat())he.set(be.run,(he.get(be.run)??0)+be.cards);for(let be=0;be<re.length;be++)Y[be]=U,U+=he.get(be)??0;let Ee=re.map(()=>0);Ie.forEach((be,Ce)=>{let yt=be.reduce((Mt,Lr)=>Mt+Lr.slots,0),Qn=yt*et.width+Math.max(0,yt-1)*r.gap,Zn=s+Math.max(r.gap,(l-Qn)/2),As=S.relationY+Ce*(oe+Ue);for(let Mt of be){let Lr=Mt.slots*p-r.gap,Ps=Mt.cards*p-r.gap,Ls=Zn+(Lr-Ps)/2;for(let Cr=0;Cr<Mt.cards;Cr++)pt[Y[Mt.run]+Ee[Mt.run]++]={x:Ls+Cr*p,y:As};Zn+=Mt.slots*p}})}Le.forEach((p,Y)=>{let U=pt[Y];St({id:p.id,kind:p.kind,plane:1,x:U.x,y:U.y,width:et.width,height:et.height,...p.via?{via:p.via}:{},...p.aggregate?{aggregate:p.aggregate}:{},...Je&&!p.aggregate?{compact:!0}:{}})});let xn=new Set(u.keys());for(let p of v)xn.add(p.id);let xt=new Map;for(let p of e.allNodes()){let Y=xt.get(p.kind);Y?Y.push(p):xt.set(p.kind,[p])}let ue=new Set(h.length>0?h:x?[x.kind]:[]),Pe=[];for(let p of t.kinds){if(f.has(p))continue;let Y=xt.get(p)??[],U=Y.filter(m);Pe.push({id:Re(p),kind:p,members:U.sort(wt),retired:Y.length-U.length,...ue.has(p)?{focused:!0}:{}})}for(let p of Pe)p.kind===n.relation&&(p.raised=!0);Pe.sort(wt);let dt=Fi(t,ue),Nt=!n.overview&&t.kinds.some(p=>dt.rankOf(p)==="primary"),$e=[];for(let p of Pe)if(!n.overview&&$.has(p.id)&&p.members.length>0)for(let Y of p.members)$e.push({id:Y.id,kind:Y.kind});else{let Y=Nt?dt.rankOf(p.kind):void 0,U=Y==="secondary"?dt.parentOf(p.kind):void 0;$e.push({id:p.id,kind:p.kind,...p.raised?{raised:!0}:{},...p.focused?{focused:!0}:{},...n.overview&&$.has(p.id)?{opened:!0}:{},...Y?{rank:Y}:{},...U&&!$.has(Re(U))?{nestedUnder:Re(U)}:{},aggregate:{kind:p.kind,memberIds:p.members.map(he=>he.id),label:o.plurals?.[p.kind]??$t(t,p.kind),...p.retired>0?{retired:p.retired}:{}}})}let tt=2;if($e.length<=I((O?240:r.contextSize.width)*i))for(let p of $e)delete p.nestedUnder;let vn=new Map;for(let p of $e){if(p.nestedUnder===void 0)continue;let Y=vn.get(p.nestedUnder)??0;Y>=tt?delete p.nestedUnder:vn.set(p.nestedUnder,Y+1)}let Yn=$e.filter(p=>p.nestedUnder!==void 0),vt=$e.filter(p=>p.nestedUnder===void 0),kn=I((O?240:r.contextSize.width)*i),Sn=!n.overview&&vt.length>kn,_n=Math.max(0,kn-1),gt=p=>p.focused?0:p.raised?1:2,kt=new Set([...vt].map((p,Y)=>({item:p,at:Y})).sort((p,Y)=>gt(p.item)-gt(Y.item)||p.at-Y.at).slice(0,_n).map(({item:p})=>p.id)),Qt=new Set(Sn?vt.filter(p=>!kt.has(p.id)).map(p=>p.id):[]),Kn=Yn.filter(p=>!Qt.has(p.nestedUnder)),Un=Yn.filter(p=>Qt.has(p.nestedUnder)),Ht=Sn?[...vt.filter(p=>kt.has(p.id)),{id:Ko,kind:"",beyond:[...vt.filter(p=>Qt.has(p.id)),...Un].map(p=>p.kind)}]:vt,lt=n.overview?{width:Math.min(220,l/6.5),height:Math.min(92,r.height*.125)}:ae(Ht.length,(O?240:r.contextSize.width)*i,S.contextH),Mn=r.relevance?.flagged,nt=(p,Y)=>{let U=Jr(t,p);if(!U)return{};let he=U.values.map(()=>0),Ee=0;for(let be of Y){let Ce=U.values.indexOf(e.getNode(be)?.[U.field]);Ce<0?Ee++:he[Ce]++}return{states:{field:U.field,values:[...U.values.map((be,Ce)=>({value:be,tier:U.tiers[Ce],count:he[Ce]})),...Ee>0?[{value:null,tier:"waiting",count:Ee}]:[]]}}},En=[...n.selection??[],...n.focusId?[n.focusId]:[]].flatMap(p=>p.startsWith("kind:")?[p.slice(5)]:p.startsWith("aggregate:")&&!p.includes("|")?[p.slice(10)]:Z&&p===x?.id?[x.kind]:[]),Zt=c>0&&d===0&&En.length>0,Xe=n.overview?lo(Ht.map(p=>{let Y=p.aggregate?.memberIds??[],U=Mn?Y.filter(he=>Mn.has(he)).length:0;return{id:p.id,kind:p.kind,count:Y.length,opened:$.has(p.id)?dn(sn(Y.length))*i:0,openedMin:$.has(p.id)?dn(Math.min(Qr,sn(Y.length)))*i:0,nameplate:$i(p.aggregate?.label??$t(t,p.kind),Y.length,U,Jr(t,p.kind)!==void 0,i),weight:U*1e3+Y.length,...h.includes(p.kind)&&(o.screens?.[p.kind]?.length??0)>0?{marquee:{width:Ur+12,height:Xr(o.screens[p.kind].map(he=>he.title),Ur,o.nameWidth)+8}}:{}}}),t,{width:r.width-d,height:Zt?r.height:r.height-c},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}:{},...o.cityStood?{stood:o.cityStood}:{},keep:En,...Zt?{seen:{width:r.width-d,height:r.height-c}}:{},...o.tilt!==void 0?{tilt:o.tilt}:{},pan:{x:n.pan?.x??0,y:n.pan?.y??0},..._||r.chrome?.length?{avoid:[..._?[_]:[],...(r.chrome??[]).filter(p=>!(Zt&&p.onSheet))]}:{}}):null,Xn=new Map(Xe?.placed.map(p=>[p.id,p.plot])??[]),Jt=new Map(Xe?.placed.map(p=>[p.id,p.nameplate])??[]),Bt=Xe?Xe.placed.map(({x:p,y:Y,depth:U,width:he,height:Ee})=>({x:p,y:Y,depth:U,width:he,height:Ee})):Fs(Ht.length,lt,r.gap,l,S.contextY,O?.97:zi).map(p=>({...p,x:p.x+s})),H=.74,me=.8,xe=52*i,Me=86*i,Ne=(p,Y)=>Math.min(1,p+(1-p)*Y),ze=new Map;Ht.forEach((p,Y)=>{let U=Bt[Y],he=U.width??lt.width,Ee=U.height??lt.height,be=p.rank==="secondary"?H:1,Ce=Xe?he:Math.max(Math.min(he,uo*i),he*be),yt=Xe?Ee:Math.max(Vi*i,Ee*be);ze.set(p.id,{x:U.x+(he-Ce)/2,y:U.y+(Ee-yt),depth:p.rank==="secondary"?Ne(U.depth,.5):U.depth,width:Ce,height:yt})});let qe=[],Dt=Bt[Bt.length-1],Rn=new Map;for(let p of Kn)Rn.set(p.nestedUnder,(Rn.get(p.nestedUnder)??0)+1);let qn=new Map;for(let p of Kn){let Y=ze.get(p.nestedUnder);if(Y){let U=Rn.get(p.nestedUnder)??1,he=qn.get(p.nestedUnder)??0;qn.set(p.nestedUnder,he+1);let Ee=.98,be=lt.width*me,Ce=Math.max(Me,Math.min(be,Y.width/(Ee*(U-1)+1))),yt=Math.max(xe,lt.height*me*(Ce/be)),Qn=Ce*Ee,Zn=(U-1)*Qn+Ce;qe.push({...p,x:Y.x+(Y.width-Zn)/2+he*Qn,y:Math.max(0,Y.y-yt+Math.min(yt*.5,16)),width:Ce,height:yt,depth:Ne(Y.depth,.8)})}else if(Dt){let U=lt.width*me,he=lt.height*me;qe.push({...p,x:Dt.x,y:Dt.y,width:U,height:he,depth:Ne(Dt.depth??1,.8)})}}for(let p of Ht)qe.push({...p,...ze.get(p.id)});return qe.forEach(p=>{St({id:p.id,kind:p.kind,plane:2,x:p.x,y:p.y,width:p.width,height:p.height,...p.aggregate?{aggregate:p.aggregate}:{},...p.raised?{raised:!0}:{},...p.focused?{focused:!0}:{},...p.opened?{opened:!0}:{},...p.opened?{openedRows:Math.max(1,Math.floor((Math.max(dn(Math.min(Qr,sn(p.aggregate?.memberIds.length??0))),dn(sn(p.aggregate?.memberIds.length??0))*(Xe?.frame.openedShare??1))-mi)/qr))}:{},...p.rank?{rank:p.rank}:{},...p.nestedUnder?{nestedUnder:p.nestedUnder}:{},...p.beyond?{beyond:p.beyond}:{},...Xn.has(p.id)?{plot:Xn.get(p.id)}:{},...Jt.has(p.id)?{nameplate:Jt.get(p.id)}:{},...Xe&&p.aggregate?nt(p.kind,p.aggregate.memberIds):{},depth:p.depth})}),{nodes:a,connectors:ji(e,u,n),width:r.width,height:r.height,...Xe?{city:Xe.frame}:{},...n.pan&&(n.pan.x!==0||n.pan.y!==0)?{pan:{x:n.pan.x,y:n.pan.y}}:{},...d>0||c>0?{visible:{width:r.width-d,height:r.height-c}}:{}};function St(p){let Y=n.overview&&He(p.id)!==null?void 0:n.pins[p.id],U=Y?{...p,x:Y.x,y:Y.y,pinned:!0}:{...p,pinned:!1},he=n.pan?{...U,x:U.x+n.pan.x,y:U.y+n.pan.y}:U;a.push(he),u.set(he.id,he)}}function ho(e,t,n){let o=e.nodes.find(d=>d.id===t);if(!o||o.screenOf!==void 0)return null;let r={...o,x:n.x,y:n.y,pinned:!0},i=r.x+r.width/2,s=r.y+r.height/2;return{...e,nodes:e.nodes.map(d=>d.id===t?r:d),connectors:e.connectors.map(d=>d.from===t?{...d,x1:i,y1:s}:d.to===t?{...d,x2:i,y2:s}:d)}}function fo(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 ke=(e,t,n)=>e+(t-e)*n;function Gi(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}var Yi=new WeakMap;function Ws(e){let t=Yi.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 i of r.aggregate?.memberIds??[]){let s=o.get(i);s?s.push(r):o.set(i,[r])}}return t={byId:n,groupsOf:o},Yi.set(e,t),t}var _i=new WeakMap;function Ki(e,t){let n=_i.get(t);if(n||_i.set(t,n=new WeakMap),n.has(e))return n.get(e);let o=js(e,t);return n.set(e,o),o}function js(e,t){let{byId:n,groupsOf:o}=Ws(t);if(e.screenOf!==void 0){let s=n.get(Re(e.screenOf));if(s)return{...e,x:s.x,y:s.y,width:s.width,height:s.height}}if(Wt(e.id)||He(e.id)!==null){let s=(e.aggregate?.memberIds??[]).map(a=>n.get(a)).filter(a=>a!==void 0);if(s.length===0)return null;let d=s.map(Gi),c=d.reduce((a,u)=>a+u.x,0)/d.length,l=d.reduce((a,u)=>a+u.y,0)/d.length;return{...e,x:c-e.width/2,y:l-e.height/2}}let r=o.get(e.id)?.find(s=>s.id===Re(e.kind)||s.id===Be(e.kind));if(!r)return null;let i=Gi(r);return{...e,x:i.x-e.width/2,y:i.y-e.height/2}}function ut(e,t,n){let o=Math.max(0,Math.min(1,n)),r=new Map(e.nodes.map(a=>[a.id,a])),i=new Map(t.nodes.map(a=>[a.id,a])),s=[];for(let[a,u]of r){let m=i.get(a);if(m){s.push(mo(u,m,o,1));continue}let f=Ki(u,t)??u;s.push(mo(u,f,o,1-o))}for(let[a,u]of i){if(r.has(a))continue;let m=Ki(u,e)??u;s.push(mo(m,u,o,o))}let d=new Map(e.connectors.map(a=>[a.id,a])),c=new Map(t.connectors.map(a=>[a.id,a])),l=[];for(let[a,u]of d){let m=c.get(a);l.push(m?{...Vs(u,m,o),opacity:1}:{...u,opacity:1-o})}for(let[a,u]of c)d.has(a)||l.push({...u,opacity:o});return{nodes:s.filter(a=>a.opacity>0).sort((a,u)=>a.id<u.id?-1:a.id>u.id?1:0),connectors:l.filter(a=>a.opacity>0).sort((a,u)=>a.id<u.id?-1:a.id>u.id?1:0),width:ke(e.width,t.width,o),height:ke(e.height,t.height,o),t:o,...Ui(e.city,t.city,o)?{city:Ui(e.city,t.city,o)}:{},...e.pan||t.pan?{pan:{x:ke(e.pan?.x??0,t.pan?.x??0,o),y:ke(e.pan?.y??0,t.pan?.y??0,o)}}:{}}}function Ui(e,t,n){return e?t?{cell:ke(e.cell,t.cell,n),...e.tilt!==void 0||t.tilt!==void 0?{tilt:ke(e.tilt??.5,t.tilt??.5,n)}:{},originX:ke(e.originX,t.originX,n),originY:ke(e.originY,t.originY,n),pan:{x:ke(e.pan.x,t.pan.x,n),y:ke(e.pan.y,t.pan.y,n)},extent:{x:ke(e.extent.x,t.extent.x,n),y:ke(e.extent.y,t.extent.y,n),width:ke(e.extent.width,t.extent.width,n),height:ke(e.extent.height,t.extent.height,n)}}:e:t}function mo(e,t,n,o){return{id:t.id,kind:t.kind,plane:ke(e.plane,t.plane,n),x:ke(e.x,t.x,n),y:ke(e.y,t.y,n),width:ke(e.width,t.width,n),height:ke(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:ke(e.depth??1,t.depth,n)},...t.natural?{natural:t.natural}:{}}}function Vs(e,t,n){return{...t,x1:ke(e.x1,t.x1,n),y1:ke(e.y1,t.y1,n),x2:ke(e.x2,t.x2,n),y2:ke(e.y2,t.y2,n)}}function gr(e){let t=Math.max(0,Math.min(1,e));return t<.5?4*t*t*t:1-(-2*t+2)**3/2}function zs(e,t){let n=[];for(let r=0;r<e.length;r+=1){let i=e[r],s=e[(r+1)%e.length];if(i.y===s.y)continue;let d=Math.min(i.y,s.y),c=Math.max(i.y,s.y);t<d||t>=c||n.push(i.x+(t-i.y)/(s.y-i.y)*(s.x-i.x))}n.sort((r,i)=>r-i);let o={x0:0,x1:0};for(let r=0;r+1<n.length;r+=2){let i={x0:n[r],x1:n[r+1]};i.x1-i.x0>o.x1-o.x0&&(o=i)}return o}function Gs(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 Ys(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 _s(e){let t=0,n=0,o=0;for(let r=0;r<e.length;r+=1){let i=e[r],s=e[(r+1)%e.length],d=i.x*s.y-s.x*i.y;t+=d,n+=(i.x+s.x)*d,o+=(i.y+s.y)*d}if(Math.abs(t)<1e-9){let r=e.reduce((i,s)=>({x:i.x+s.x,y:i.y+s.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 Ks(e,t){let{room:n,height:o,size:r,floor:i,measure:s=Kr,lines:d=2}=t,c=(h,y)=>h.every(M=>s(M,y)<=n)&&h.length*y*1.15<=o;if(c([e],r))return{lines:[e],fontSize:r,whole:!0};let l=e.split(/\s+/);if(d>1&&l.length>1){let h=1,y=1/0,M=0;for(let w=0;w<l.length-1;w+=1){M+=l[w].length+1;let x=Math.abs(M-e.length/2);x<y&&(y=x,h=w+1)}let v=[l.slice(0,h).join(" "),l.slice(h).join(" ")];if(c(v,r))return{lines:v,fontSize:r,whole:!0};for(let w=r;w>=i;w-=r*.06)if(c(v,w))return{lines:v,fontSize:w,whole:!0}}for(let h=r;h>=i;h-=r*.06)if(c([e],h))return{lines:[e],fontSize:h,whole:!0};let a=s(e,i)/Math.max(1,e.length),u=Math.floor(n/a)-1;if(u<4||i*1.15>o)return null;let m=e.slice(0,u),f=m.lastIndexOf(" ");return{lines:[`${f>3?m.slice(0,f):m}\u2026`],fontSize:i,whole:!1}}var Us=(e,t)=>e.x0<t.x1&&t.x0<e.x1&&e.y0<t.y1&&t.y0<e.y1;var K=de(Oe(),1);var po=de(Oe(),1),Xs=500,qs=10;function Xi(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function Qs(e){let t=typeof getSelection=="function"?getSelection():null;return t!==null&&!t.isCollapsed&&t.containsNode(e,!0)}function Zs(e){return e.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??e.closest("[data-graview-view]")?.getAttribute("data-graview-view")??void 0}function qi({swallow:e,setMenuAt:t,setSelection:n}){let o=(0,po.useRef)(0),r=(0,po.useRef)(null),i=()=>{r.current&&clearTimeout(r.current.timer),r.current=null},s=(d,c,l)=>{let a=Zs(d);a&&n([a]),t(a?{x:c,y:l,on:a}:{x:c,y:l})};return{onContextMenu:d=>{let c=d.target;d.shiftKey||d.altKey||Xi(c)||Qs(c)||(d.preventDefault(),!c.closest("[data-graview-popover], [data-graview-offstage]")&&(Date.now()-o.current<700||s(c,d.clientX,d.clientY)))},onPointerDown:d=>{if(i(),d.pointerType==="mouse"||!d.isPrimary)return;let c=d.target;if(Xi(c)||c.closest("[data-graview-popover], [data-graview-offstage], button, a, input, select, textarea"))return;let{clientX:l,clientY:a}=d;r.current={x:l,y:a,timer:setTimeout(()=>{r.current=null,o.current=Date.now(),e.current=!0,setTimeout(()=>e.current=!1,700),s(c,l,a)},Xs)}},onPointerMove:d=>{let c=r.current;c&&Math.hypot(d.clientX-c.x,d.clientY-c.y)>qs&&i()},onPointerUp:i}}var Pt=de(Oe(),1);function Qi(e){let[t,n]=(0,Pt.useState)(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(e).matches);return(0,Pt.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 Js(){let e=()=>typeof document>"u"?null:document.documentElement.getAttribute("data-graview-motion"),[t,n]=(0,Pt.useState)(e);return(0,Pt.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 Zi(e){let t=Qi("(prefers-reduced-motion: reduce)"),n=Qi("(prefers-reduced-transparency: reduce)"),o=Js();return ci({off:!e,reducedMotion:o==="reduce"||o!=="full"&&t,reducedTransparency:n})}var ed=ai*1.5,td=30;function Ji(e,t){let[n,o]=(0,Pt.useState)(!1),r=e&&!n;return(0,Pt.useEffect)(()=>{if(!r||!t||typeof requestAnimationFrame>"u")return;let i=[],s=0,d=0,c=l=>{if(s>0&&i.push(l-s),s=l,i.length>=td){if(!ui(i,ed)){o(!0);return}i.length=0}d=requestAnimationFrame(c)};return d=requestAnimationFrame(c),()=>cancelAnimationFrame(d)},[r,t]),r}var je=de(Oe(),1);var nd=520;function rd(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function ea(e,t={}){let n=t.duration??nd,o=(t.enabled??!0)&&!rd(),r=t.settle??!0,i=(0,je.useRef)(e),[,s]=(0,je.useState)(()=>ut(e,e,1)),d=(0,je.useRef)(null);d.current??=ut(e,e,1);let c=(0,je.useRef)(null),l=(0,je.useRef)(null);!o&&l.current!==e&&(l.current=e,d.current=ut(e,e,1)),o&&(l.current=null);let a=(0,je.useRef)(null);return(0,je.useEffect)(()=>{if(!o||typeof requestAnimationFrame>"u"){if(i.current=e,l.current!==e){let v=ut(e,e,1);d.current=v,s(v)}if(typeof requestAnimationFrame>"u"||!r)return;let M=requestAnimationFrame(()=>{let v=ut(e,e,1);d.current=v,s(v)});return()=>cancelAnimationFrame(M)}if(i.current===e&&d.current.t>=1){if(!r)return;let M=requestAnimationFrame(()=>{let v=ut(e,e,1);d.current=v,s(v)});return()=>cancelAnimationFrame(M)}let u=performance.now(),f=a.current!==null&&d.current.t<1&&u-a.current<n?a.current:u;a.current=f;let b=gr(Math.min(1,(u-f)/n)),h=i.current,y=M=>{let v=Math.min(1,(M-f)/n),w=b>=1?1:(gr(v)-b)/(1-b),x=ut(h,e,Math.max(0,w));d.current=x,s(x),v<1?c.current=requestAnimationFrame(y):(a.current=null,i.current=e,c.current=requestAnimationFrame(()=>{let O=ut(e,e,1);d.current=O,s(O),c.current=null}))};return c.current=requestAnimationFrame(y),()=>{c.current!==null&&cancelAnimationFrame(c.current);let M=d.current;i.current={...e,...M.city?{city:M.city}:{},pan:M.pan??{x:0,y:0},nodes:M.nodes.map(v=>({...v,plane:Math.round(v.plane)})),connectors:M.connectors}}},[e,n,o,r]),d.current}function ta(e=1100){let{store:t}=ve(),[n,o]=(0,je.useState)(()=>new Set);return(0,je.useEffect)(()=>{let r=null,i=t.subscribe(s=>{o(new Set(s.touched)),r&&clearTimeout(r),r=setTimeout(()=>o(new Set),e)});return()=>{i(),r&&clearTimeout(r)}},[t,e]),n}var od={marks:new Map,acts:[]};function na(e=4e3){let{store:t}=ve(),[n,o]=(0,je.useState)(od);return(0,je.useEffect)(()=>{let r=null,i=t.subscribe((s,d)=>{o(c=>{let l=new Map(c.marks),a=[...c.acts];for(let u of d){if(u.undoes!==void 0){let b=a.find(y=>y.batch===u.undoes||y.wrote.length>0),h=a.filter(y=>u.writes.some(M=>y.wrote.includes(M)));for(let y of h.length>0?h:b?[b]:[]){for(let M of y.wrote)l.delete(M);a=a.filter(M=>M.batch!==y.batch)}continue}if(u.author.kind!=="agent")continue;let m=u.author.id??"the seat";for(let b of u.writes)l.set(b,m);a.find(b=>b.batch===u.batch)?a=a.map(b=>b.batch===u.batch?{...b,wrote:[...new Set([...b.wrote,...u.writes])]}:b):a=[{batch:u.batch,who:m,intent:u.batchIntent??u.intent,at:u.at,wrote:[...u.writes]},...a].slice(0,12)}return l.size===c.marks.size&&a===c.acts&&l.size===0?c:{marks:l,acts:a}}),r&&clearTimeout(r),r=setTimeout(()=>o(c=>c.marks.size===0?c:{...c,marks:new Map}),e)});return()=>{i(),r&&clearTimeout(r)}},[t,e]),n}var Ut=de(Ae(),1),rt=16;function ra({marks:e,questions:t=[],whereIs:n,stageRef:o,width:r,height:i}){if(e.size===0&&t.length===0)return null;let s=o.current,d=s?.getBoundingClientRect()??null,c=[];for(let[a,u]of e){let m=null;if(s&&d&&typeof CSS<"u"){let y=s.querySelector(`[data-graview-pick="${CSS.escape(a)}"]`)?.getBoundingClientRect();y&&y.width>0&&y.height>0&&(m={x:y.left-d.left,y:y.top-d.top,width:y.width,height:y.height})}if(m??=n(a),!m)continue;let f=Math.min(Math.max(m.x+m.width-rt/2,rt/2),r-rt/2),b=Math.min(Math.max(m.y-rt/4,rt/2),i-rt/2);c.push({id:a,who:u,x:f,y:b})}let l=[];for(let a of t){let u=n(a.id);u&&l.push({...a,x:Math.min(Math.max(u.x+u.width/2,rt),r-rt),y:Math.min(Math.max(u.y-rt/2,rt),i-rt)})}return c.length===0&&l.length===0?null:(0,Ut.jsxs)("div",{className:"graview-seat-marks","data-testid":"seat-marks","data-graview-seat-marks":c.length,children:[c.map(({id:a,who:u,x:m,y:f})=>(0,Ut.jsx)("span",{className:"graview-seat-mark","data-testid":"seat-mark","data-graview-seat-mark":a,"data-graview-seat-who":u,title:`${u} just changed this`,"aria-hidden":"true",style:{left:m,top:f,"--graview-hue":On(u)},children:"\u25C6"},a)),l.map(a=>(0,Ut.jsxs)("span",{className:"graview-seat-asking","data-testid":"seat-question","data-graview-seat-asking":a.id,title:a.asks,style:{left:a.x,top:a.y},children:[(0,Ut.jsx)("span",{"aria-hidden":"true",children:"?"}),(0,Ut.jsx)("span",{className:"graview-seat-asking-said",children:a.asks})]},`asking:${a.id}`))]})}var te=de(Ae(),1);function id({hue:e,mode:t}){let n=t==="docked";return(0,te.jsxs)("svg",{viewBox:"0 0 32 38","aria-hidden":"true",children:[(0,te.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",strokeLinecap:"round",children:[(0,te.jsx)("line",{x1:"16",y1:"3.5",x2:"16",y2:"7"}),(0,te.jsx)("circle",{cx:"16",cy:"2.6",r:"1.5",fill:"none"}),(0,te.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,te.jsx)("line",{x1:"11",y1:"12.5",x2:"21",y2:"12.5",strokeWidth:"2"}):(0,te.jsxs)(te.Fragment,{children:[(0,te.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,te.jsx)("circle",{cx:"13.4",cy:"12.5",r:"1.25",fill:"currentColor",stroke:"none",opacity:n?.45:1}),(0,te.jsx)("circle",{cx:"18.6",cy:"12.5",r:"1.25",fill:"currentColor",stroke:"none",opacity:n?.45:1}),t==="reading"?(0,te.jsx)("line",{x1:"10.2",y1:"12.5",x2:"21.8",y2:"12.5",strokeWidth:"0.8",opacity:"0.7"}):null]}),(0,te.jsx)("line",{x1:"16",y1:"16",x2:"16",y2:"18.5"}),(0,te.jsx)("polygon",{points:"16,18.5 24,22.5 16,26.5 8,22.5",fill:"currentColor",fillOpacity:"0.22"}),(0,te.jsx)("polygon",{points:"8,22.5 16,26.5 16,33.5 8,29.5",fill:"currentColor",fillOpacity:"0.08"}),(0,te.jsx)("polygon",{points:"24,22.5 16,26.5 16,33.5 24,29.5",fill:"currentColor",fillOpacity:"0.3"}),t==="writing"?(0,te.jsxs)(te.Fragment,{children:[(0,te.jsx)("polyline",{points:"24,24 28.5,20.5"}),(0,te.jsx)("line",{x1:"27.5",y1:"19",x2:"30",y2:"21.5",strokeWidth:"1.8"})]}):(0,te.jsx)("line",{x1:"24",y1:"24",x2:"26.5",y2:"29"}),(0,te.jsx)("line",{x1:"8",y1:"24",x2:"5.5",y2:"29"}),(0,te.jsx)("path",{d:"M9.5 33.5 v2.2 h4"}),(0,te.jsx)("path",{d:"M22.5 33.5 v2.2 h-4"})]}),(0,te.jsx)("title",{children:`robot, ${t}`})]})}function ad({hue:e}){return(0,te.jsxs)("svg",{viewBox:"0 0 22 24","aria-hidden":"true",style:{color:`hsl(${Math.round(e)} 50% 48%)`},children:[(0,te.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",strokeLinecap:"round",children:[(0,te.jsx)("circle",{cx:"11",cy:"6",r:"4.2"}),(0,te.jsx)("path",{d:"M3 23 C3 15.5 6 13 11 13 C16 13 19 15.5 19 23"})]}),(0,te.jsx)("title",{children:"somebody"})]})}function oa({width:e,whereIs:t}){let{who:n,following:o,follow:r}=ve(),i=yi([...n.values()],t,e);if(i.length===0)return null;let s=h=>{let y=tr(h.presence)||"somebody";return h.presence.kind==="agent"?y:`${y}'s agent`},d=new Map;for(let h of i){if(h.kind!=="robot")continue;let y=`${Math.round(h.point.x)}:${Math.round(h.point.y)}`;d.set(y,[...d.get(y)??[],s(h)])}let c=19,l=h=>h.length*9+4,a=[],u=new Map,m=new Set;for(let h of i){if(h.kind!=="robot"&&h.kind!=="person")continue;let y=`${Math.round(h.point.x)}:${Math.round(h.point.y)}`;if(h.kind==="robot"&&m.has(y))continue;h.kind==="robot"&&m.add(y);let M=h.kind==="robot"?[...new Set(d.get(y)??[])].join(" \xB7 "):tr(h.presence)||"somebody",v=l(M)/2,w=0;for(;a.some(x=>x.row===w&&Math.abs(x.y-h.point.y)<c&&x.left<h.point.x+v&&x.right>h.point.x-v);)w++;a.push({left:h.point.x-v,right:h.point.x+v,y:h.point.y,row:w}),u.set(`${h.kind}:${h.presence.participant}`,w)}let f=h=>{let y=u.get(h)??0;return y>0?{top:2+y*c}:void 0},b=new Set;return(0,te.jsx)("div",{className:"graview-occupants","data-testid":"occupants","data-graview-occupants":i.length,children:i.map((h,y)=>{if(h.kind==="over")return(0,te.jsx)("div",{className:"graview-presence-over","data-testid":"presence-over","data-graview-over-by":h.presence.participant,style:{left:h.box.x-3,top:h.box.y-3,width:h.box.width+6,height:h.box.height+6,"--graview-hue":h.presence.hue}},`over:${h.presence.participant}`);if(h.kind==="count")return(0,te.jsxs)("span",{className:"graview-figure-count","data-testid":"presence-count","data-graview-at":h.at,style:{left:h.point.x,top:h.point.y},title:`${h.n} more here`,children:["+",h.n]},`count:${h.at}:${y}`);let M=h.presence.hue,v=tr(h.presence)||"somebody";if(h.kind==="edge")return(0,te.jsxs)("button",{type:"button",className:"graview-figure-edge","data-testid":"presence-edge","data-graview-person":h.presence.participant,style:{right:`calc(${Math.max(8,e-h.point.x)}px + var(--graview-dock, 0px))`,top:h.point.y},onClick:()=>r(h.presence.participant),"aria-label":`${v} is somewhere else \u2014 press to go where they are`,children:["\u2192 ",v]},`edge:${h.presence.participant}`);if(h.kind==="robot"){let x=`${Math.round(h.point.x)}:${Math.round(h.point.y)}`;if(b.has(x))return null;b.add(x);let O=[...new Set(d.get(x)??[s(h)])].join(" \xB7 ");return(0,te.jsxs)("div",{className:"graview-figure","data-graview-figure":`theirs:${h.presence.participant}`,"data-graview-theirs":"","data-graview-mode":h.mode,"data-graview-at":h.presence.robot?.at??"",style:{transform:`translate(${h.point.x.toFixed(1)}px, ${h.point.y.toFixed(1)}px)`,"--graview-hue":M},children:[(0,te.jsx)("span",{className:"graview-figure-body",role:"img","aria-label":`${O} \u2014 ${h.mode}`,style:{cursor:"default"},children:(0,te.jsx)(id,{hue:M,mode:h.mode})}),(0,te.jsx)("span",{className:"graview-figure-name","data-graview-label":"",style:f(`robot:${h.presence.participant}`),children:O})]},`robot:${h.presence.participant}`)}let w=o?.participant===h.presence.participant;return(0,te.jsxs)("div",{className:"graview-figure","data-graview-figure":h.presence.participant,"data-graview-person":"","data-graview-at":h.at,"data-graview-audience":h.audience?"":void 0,"data-graview-followed":w?"":void 0,style:{transform:`translate(${h.point.x.toFixed(1)}px, ${h.point.y.toFixed(1)}px)`,"--graview-hue":M},children:[(0,te.jsx)("button",{type:"button",className:"graview-figure-body","aria-label":`${v} is here${w?". Press to stop following":". Press to go where they go"}`,"aria-pressed":w,onClick:x=>{x.stopPropagation(),r(w?null:h.presence.participant)},onPointerDown:x=>x.stopPropagation(),children:(0,te.jsx)(ad,{hue:M})}),(0,te.jsx)("span",{className:"graview-figure-name",style:f(`person:${h.presence.participant}`),children:v})]},`person:${h.presence.participant}`)})})}var fn=de(Oe(),1),Wn=de(Ae(),1),ia={left:"\u2190",right:"\u2192",top:"\u2191",bottom:"\u2193"},go=36,sd=140,Fn=56;function aa({result:e,schema:t,chrome:n=[],onGo:o}){let r=co(e);if(r.length===0||(e.visible??e).height<sd)return null;let i=a=>(a??[]).flatMap(u=>{let m=e.nodes.find(f=>f.id===u.id);return m?[{left:m.x+u.x,top:m.y+u.y,right:m.x+u.x+u.width,bottom:m.y+u.y+u.height}]:[]}),s=i(e.city?.showings),d=i(e.city?.nameplates),c=[...s,...d,...n.map(a=>({left:a.x,top:a.y,right:a.x+a.width,bottom:a.y+a.height}))],l=[];for(let a of["left","right","top","bottom"]){let u=e.visible??e,m=a==="left"||a==="right"?u.height:u.width,f=a==="left"||a==="right",b=a==="bottom"?cd:a==="top"?Fn:ud+Fn/2,h=-1/0,y=[],M=r.filter(v=>v.side===a).sort((v,w)=>v.along-w.along);for(let v of M){let w=er(t,v.kind),x=dd(w),O=f?yr:x/2,E=m-b-(f?0:O),T=Math.max(Fn,v.along,h+O+ld);if(T>E)continue;let{at:D,inset:g}=hd([...c,...y],a,T,x,u,m);if(D>E+.5)continue;h=D+O,y.push(sa(a,D,x,u,g));let S=a==="left"?{left:g,top:D,transform:"translateY(-50%)"}:a==="right"?{right:`calc(${g}px + var(--graview-dock, 0px))`,top:D,transform:"translateY(-50%)"}:a==="top"?{top:g,left:D,transform:"translateX(-50%)"}:{bottom:`calc(${g}px + var(--graview-scene-foot, var(--graview-sheet, 0px)))`,left:D,transform:"translateX(-50%)"};l.push((0,Wn.jsx)("button",{type:"button",className:"graview-edge-sign","data-graview-past-edge":v.id,"aria-label":`${w}, past the ${a} edge \u2014 bring it into view`,title:`${w} is past the ${a} edge`,tabIndex:-1,onPointerDown:L=>L.stopPropagation(),onClick:L=>{L.stopPropagation(),o(v.by)},style:{...fd,...S},children:a==="right"||a==="bottom"?`${w} ${ia[a]}`:`${ia[a]} ${w}`},v.id))}}return(0,Wn.jsx)(Wn.Fragment,{children:l})}var dd=e=>(e.length+2)*7.4+22,yr=go/2,$n=6,ld=6,cd=236,ud=56;function sa(e,t,n,o,r=$n){return e==="left"||e==="right"?{left:e==="left"?r:o.width-r-n,right:e==="left"?r+n:o.width-r,top:t-yr,bottom:t+yr}:{left:t-n/2,right:t+n/2,top:e==="top"?r:o.height-r-go,bottom:e==="top"?r+go:o.height-r}}function hd(e,t,n,o,r,i){let s=t==="left"||t==="right",d=h=>sa(t,h,o,r),c=h=>e.find(y=>{let M=d(h);return M.left<y.right&&y.left<M.right&&M.top<y.bottom&&y.top<M.bottom}),l=c(n);if(!l)return{at:n,inset:$n};let a=s?yr:o/2,u=h=>{let y=n;for(let M=0;M<12;M++){let v=c(y);if(!v)return y;if(y=h>0?(s?v.bottom:v.right)+a+4:(s?v.top:v.left)-a-4,y>i-Fn||y<Fn)return null}return null},m=u(1);if(m!==null)return{at:m,inset:$n};let f=u(-1);if(f!==null)return{at:f,inset:$n};let b=t==="left"?l.right:t==="right"?r.width-l.left:t==="top"?l.bottom:r.height-l.top;return{at:n,inset:Math.max($n,b+4)}}var fd={position:"absolute",zIndex:We.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 da(e){let[t,n]=(0,fn.useState)(null);return(0,fn.useLayoutEffect)(()=>{let o=e.current,r=null;for(let d=o?.parentElement??null,c=0;d&&!r&&c<4;d=d.parentElement,c++)r=d.querySelector(":scope > [data-graview-scene-trail]");if(!o||!r)return;let i=()=>{let d=o.getBoundingClientRect(),c=r.getBoundingClientRect(),l=c.width>0&&c.height>0?{x:c.left-d.left,y:c.top-d.top,width:c.width,height:c.height}:null;n(a=>a===l||a&&l&&a.x===l.x&&a.y===l.y&&a.width===l.width&&a.height===l.height?a:l)};if(i(),typeof ResizeObserver>"u")return;let s=new ResizeObserver(i);return s.observe(r),()=>s.disconnect()},[e]),t}function la(e,t,n){let[o,r]=(0,fn.useState)([]);return(0,fn.useLayoutEffect)(()=>{let i=e.current;if(!i||!t)return;let s=[...i.querySelectorAll(".graview-drive-in")].flatMap(d=>{let c=d.closest("[data-graview-view]"),l=d.getBoundingClientRect();if(!c||l.width===0||l.height===0)return[];let a=c.getBoundingClientRect();return[{id:c.getAttribute("data-graview-view"),x:Math.round(l.left-a.left),y:Math.round(l.top-a.top),width:Math.round(l.width),height:Math.round(l.height)}]});r(d=>d.length===s.length&&d.every((c,l)=>c.id===s[l].id&&c.x===s[l].x&&c.y===s[l].y&&c.width===s[l].width&&c.height===s[l].height)?d:s)},[e,t,n]),o}function ca(e,t){return e.flatMap(n=>{let o=t.find(r=>r.id===n.id);return o?[{x:o.x+n.x,y:o.y+n.y,width:n.width,height:n.height}]:[]})}var Lt=de(Oe(),1),md=180;function ua({view:e,result:t,frame:n,panned:o,closer:r,screenId:i,setCamera:s}){let d=(0,Lt.useRef)(new Map),c=Math.round((t.nodes.find(u=>u.id===i)?.height??0)/16),l=(0,Lt.useRef)(e.overview??!1),a=(0,Lt.useRef)(null);if((0,Lt.useEffect)(()=>{if(!e.overview||!i||!t.city){if(l.current&&!e.overview)return;s(E=>E.x===0&&E.y===0?E:{x:0,y:0});return}let u=t.nodes.find(E=>E.id===i);if(!u)return;let m=r>1&&u.screenOf?t.nodes.find(E=>E.id===Re(u.screenOf)):void 0,f=m?{x:Math.min(u.x,m.x),y:Math.min(u.y,m.y),width:Math.max(u.x+u.width,m.x+m.width)-Math.min(u.x,m.x),height:Math.max(u.y+u.height,m.y+m.height)-Math.min(u.y,m.y)}:u;if(f.x>=0&&f.y>=0&&f.x+f.width<=t.width&&f.y+f.height<=t.height&&!m)return;let h=24,y=(E,T,D)=>E<h?h-E:E+T>D-h?D-h-(E+T):0,M=At(t),v=e.pan??{x:0,y:0},w=m?o.x+(t.width/2-(f.x+f.width/2)):o.x+y(f.x,f.width,t.width),x=t.height/2-(f.y+f.height/2),O=m?o.y+(u.y+x<h?h-u.y:x):o.y+y(f.y,f.height,t.height);s({x:(m?w:Math.max(-M.x,Math.min(M.x,w)))-v.x,y:(m?O:Math.max(-M.y,Math.min(M.y,O)))-v.y})},[i,e.overview,r,e.within?.view,c]),n.city){let u=new Map;for(let m of n.nodes){if(!m.plot||Math.round(m.plane)!==2)continue;let f=cn(m.plot.col+m.plot.side/2,m.plot.row+m.plot.side/2,n.city.cell,n.city.tilt);u.set(m.id,{x:n.city.originX+o.x+f.x,y:n.city.originY+o.y+f.y})}d.current=u}return(0,Lt.useEffect)(()=>{let u=e.overview??!1,m=l.current&&!u;if(l.current=u,u&&a.current&&(clearTimeout(a.current),a.current=null),!m)return;let f=e.focusId?Rt(e.focusId)[0]:void 0,b=f?d.current.get(Re(f)):void 0,h=t.nodes.find(y=>y.id===e.focusId);if(!b||!h){s({x:0,y:0});return}s({x:b.x-(h.x+h.width/2),y:b.y-(h.y+h.height/2)}),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,s({x:0,y:0})},md)},[e.overview]),(0,Lt.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),{gliding:()=>a.current!==null}}var br=de(Oe(),1),wr="[data-graview-view]";function pd(e,t){let n=null;for(let o=e?.closest(wr)??null;o&&t.contains(o);o=o.parentElement?.closest(wr)??null)n=o;return n}function ha(e,t,n=!1){let o=e.getBoundingClientRect(),r=o.bottom-t.bottom;if(n&&t.bottom>0){let i=e.querySelector(".graview-zoom")?.getBoundingClientRect();i&&i.height>0&&i.top<r&&i.bottom>r-i.height-24&&(r=Math.min(r,i.top))}return{left:o.left,top:o.top,right:o.right-t.right,bottom:r,box:o}}function fa(e,t,n){let o=(0,br.useRef)({dock:t,reveal:n});o.current={dock:t,reveal:n},(0,br.useEffect)(()=>{let r=e.current;if(!r)return;let i=l=>{let{dock:a}=o.current;if(l.key!=="Tab"||l.defaultPrevented||a.right<=0&&a.bottom<=0)return;let u=ha(r,a),m=[];for(let f of r.querySelectorAll(wr)){if(f.parentElement?.closest(wr)||f.inert||f.contains(document.activeElement))continue;let b=f.getBoundingClientRect(),h=Math.max(b.left,u.box.left),y=Math.min(b.right,u.box.right),M=Math.max(b.top,u.box.top),v=Math.min(b.bottom,u.box.bottom);y<=h||v<=M||!(a.right>0&&h>=u.right-1||a.bottom>0&&M>=u.bottom-1)||(f.inert=!0,m.push(f))}m.length!==0&&setTimeout(()=>{for(let f of m)f.inert=!1},0)},s=l=>{let a=l.target,u=pd(a,r);if(!u)return;let m=!0;try{m=a?.matches(":focus-visible")??!0}catch{}requestAnimationFrame(()=>{for(let f=u.parentElement;f;f=f===r?null:f.parentElement)f.scrollTop!==0&&(f.scrollTop=0),f.scrollLeft!==0&&(f.scrollLeft=0);m&&u.isConnected&&d(()=>u.isConnected&&u.contains(document.activeElement)&&c(u))})},d=(l,a=120)=>{let u=r.closest(".graview-ground")??r.querySelector(".graview-ground");!u||u.hasAttribute("data-graview-settled")||a<=0?l():requestAnimationFrame(()=>d(l,a-1))},c=l=>{let a=ha(r,o.current.dock,!0),u=l.getBoundingClientRect(),m=l.querySelector(".graview-drive-in")?.getBoundingClientRect(),f=m&&m.width>0&&m.height>0?m:null,b=12,h=f?{left:Math.min(u.left,f.left),right:Math.max(u.right,f.right),top:Math.min(u.top,f.top),bottom:Math.max(u.bottom,f.bottom)}:u,y=h.bottom-h.top<=a.bottom-a.top-2*b?h:u,M=(x,O,E,T)=>T-E>O-x-2*b||E<x+b?x+b-E:T>O-b?O-b-T:0,v=M(a.left,a.right,y.left,y.right),w=M(a.top,a.bottom,y.top,y.bottom);(Math.abs(v)>=1||Math.abs(w)>=1)&&o.current.reveal(Math.round(v),Math.round(w))};return document.addEventListener("keydown",i,!0),r.addEventListener("focusin",s),()=>{document.removeEventListener("keydown",i,!0),r.removeEventListener("focusin",s)}},[e])}var ce=de(Oe(),1);function pa(){let e=(0,ce.useRef)(null),[t,n]=(0,ce.useState)({right:0,bottom:0});return(0,ce.useLayoutEffect)(()=>{let o=e.current;if(!o)return;let r=()=>{let s=o.getBoundingClientRect(),d={right:Math.round(s.width),bottom:Math.round(s.height)};n(c=>c.right===d.right&&c.bottom===d.bottom?c:d)};if(r(),typeof ResizeObserver>"u")return;let i=new ResizeObserver(r);return i.observe(o),()=>i.disconnect()},[]),{probe:e,dock:t}}function ga(){let[e,t]=(0,ce.useState)(null),n=(0,ce.useRef)(null),o=(0,ce.useRef)(0),r=(0,ce.useCallback)(s=>{n.current=s,o.current===0&&(o.current=requestAnimationFrame(()=>{o.current=0,t(n.current)}))},[]),i=(0,ce.useCallback)(()=>{o.current!==0&&cancelAnimationFrame(o.current),o.current=0;let s=n.current;return n.current=null,s&&t(null),s},[]);return{held:e,place:r,release:i}}function ya({stage:e,pan:t,zoom:n,setView:o,settled:r,zoomTo:i}){let s=(0,ce.useRef)({x:0,y:0,s:1}),d=(0,ce.useRef)(0),c=(0,ce.useRef)(!1),l=(0,ce.useRef)(r);l.current=r;let a=(0,ce.useCallback)(()=>[...e.current?.querySelectorAll("[data-graview-world]")??[]],[e]),u=(0,ce.useCallback)(({x:w,y:x,s:O})=>{let E=O!==1?`translate3d(${w}px, ${x}px, 0) scale(${O})`:w===0&&x===0?"":`translate3d(${w}px, ${x}px, 0)`;for(let T of a())T.style.transform=E,T.style.transformOrigin=O!==1?"0 0":"";ma(e.current,w,x,O)},[a,e]),m=(0,ce.useCallback)(()=>{d.current===0&&(d.current=requestAnimationFrame(()=>{d.current=0,u(s.current)}))},[u]),f=(0,ce.useCallback)(()=>{c.current=!1;for(let w of a())w.style.transform="",w.style.transformOrigin="";ma(e.current,0,0,1),l.current()},[a,e]),b=(0,ce.useCallback)((w,x)=>{s.current={x:w.x-x.x,y:w.y-x.y,s:s.current.s},m()},[m]),h=(0,ce.useCallback)((w,x,O,E,T,D)=>{let{x:g,y:S,s:L}=s.current,C=Math.max(T,Math.min(D,L*w)),V=C/L;s.current={x:g*V+x.x*(1-V)+O,y:S*V+x.y*(1-V)+E,s:C},m()},[m]),y=(0,ce.useCallback)(()=>{let{x:w,y:x,s:O}=s.current;return w===0&&x===0&&O===1?!1:(d.current!==0&&cancelAnimationFrame(d.current),d.current=0,u({x:w,y:x,s:O}),s.current={x:0,y:0,s:1},c.current=!0,Math.abs(O-1)>1e-4?i.current(O,{x:w/(1-O),y:x/(1-O)}):o(E=>{let T=E.pan??{x:0,y:0};return ct(E,{x:T.x+w,y:T.y+x})}),window.setTimeout(()=>{c.current&&f()},300),!0)},[o,f,u,i]);(0,ce.useLayoutEffect)(()=>{c.current&&f()},[t,n,f]);let M=(0,ce.useCallback)(()=>{d.current!==0&&cancelAnimationFrame(d.current),d.current=0,s.current={x:0,y:0,s:1},f()},[f]),v=(0,ce.useCallback)(()=>s.current,[]);return{shiftTo:b,zoomBy:h,settle:y,drop:M,settling:c,offset:v}}function ma(e,t,n,o){for(let r of e?.querySelectorAll(":scope > .graview-lattice, :scope > .graview-measure")??[]){let i=o!==1&&r.classList.contains("graview-lattice")&&e?gd(e):null;i?r.style.setProperty("--graview-lattice-cell",`${(i.cell*o).toFixed(2)}px`):r.style.removeProperty("--graview-lattice-cell");let s=i?i.x*(o-1)+t:t,d=i?i.y*(o-1)+n:n;if(s===0&&d===0){r.style.removeProperty("--graview-hand-x"),r.style.removeProperty("--graview-hand-y");continue}r.style.setProperty("--graview-hand-x",`${s}px`),r.style.setProperty("--graview-hand-y",`${d}px`)}}function gd(e){let t=parseFloat(e.style.getPropertyValue("--graview-lattice-cell"));return Number.isFinite(t)?{cell:t,x:parseFloat(e.style.getPropertyValue("--graview-lattice-x"))||0,y:parseFloat(e.style.getPropertyValue("--graview-lattice-y"))||0}:null}var yd=4;function wd(e,t){for(let n=e;n&&n!==t;n=n.parentElement){let o=getComputedStyle(n);if(/(auto|scroll)/.test(o.overflowY)&&n.scrollHeight>n.clientHeight+1||/(auto|scroll)/.test(o.overflowX)&&n.scrollWidth>n.clientWidth+1)return!0}return!1}function wa({view:e,panned:t,limit:n,panWithin:o,moveByTransform:r,setView:i,setDragging:s,noteMoved:d,shift:c,district:l,pinching:a}){let u=(0,ce.useRef)(!1),m=(0,ce.useRef)(null),f=x=>{let O=e.pan??{x:0,y:0};m.current={kind:"pan",fromX:x.clientX,fromY:x.clientY,baseX:O.x,baseY:O.y,moved:!1}},b=x=>{x.button!==0||a.current||x.target.closest("[data-graview-view]")||f(x)},h=(x,O)=>{if(!(O.button!==0||a.current)&&!(O.pointerType!=="mouse"&&wd(O.target,O.currentTarget))){if(x.screenOf!==void 0&&!O.target.closest("[data-graview-grip]")){f(O);return}if(e.overview&&He(x.id)!==null){f(O);return}m.current={kind:"card",id:x.id,fromX:O.clientX,fromY:O.clientY,baseX:x.x-t.x,baseY:x.y-t.y,moved:!1}}},y=x=>{let O=m.current;m.current=null,l.release(),x?c.settle():c.drop(),O&&(u.current=!0,setTimeout(()=>u.current=!1,0)),c.settling.current||s(!1)};return{onGroundDown:b,onCardDown:h,onDragMove:x=>{let O=m.current;if(!O)return;if(a.current){y(!0);return}let E=x.clientX-O.fromX,T=x.clientY-O.fromY;if(!O.moved){if(Math.hypot(E,T)<yd)return;O.moved=!0,s(!0);try{x.currentTarget.setPointerCapture(x.pointerId)}catch{}}if(O.kind==="pan"){let D=o(n(),{x:O.baseX+E,y:O.baseY+T});r?c.shiftTo(D,e.pan??{x:0,y:0}):i(g=>ct(g,D))}else O.id&&l.place({id:O.id,x:O.baseX+E,y:O.baseY+T})},onDragUp:()=>{c.settle();let x=l.release();x&&i(O=>Nn(O,x.id,{x:x.x,y:x.y})),m.current?.moved&&(u.current=!0,setTimeout(()=>u.current=!1,0),d()),m.current=null,!c.settling.current&&s(!1)},onDragCancel:()=>{m.current&&y(!1)},swallow:u}}function ba({stage:e,view:t,setView:n}){let o=(0,ce.useRef)({view:t,charge:0,coolUntil:0,lastScale:1});o.current.view=t;let r=(0,ce.useRef)(()=>{}),i=(0,ce.useRef)(()=>{}),s=(0,ce.useRef)(()=>{}),d=(0,ce.useRef)(()=>{}),c=(0,ce.useRef)(!1),l=(0,ce.useRef)({fingers:new Map,pinch:null,owed:null,owing:0});return(0,ce.useEffect)(()=>{let a=e.current;if(!a)return;let u=(E,T)=>{let D=o.current;if(T<D.coolUntil)return;let g=D.view.overview??!1;E!==g&&(D.coolUntil=T+600,D.charge=0,n(An(D.view,E)))},m=E=>{let T=o.current,D=T.view.overview??!1;if(E.ctrlKey){if(E.preventDefault(),!D){if(T.charge+=E.deltaY,Math.abs(T.charge)<60)return;T.charge>0?u(!0,performance.now()):T.charge=0;return}s.current(Math.exp(-E.deltaY*.004),E.clientX,E.clientY,0,0);return}!D||E.target?.closest("[data-graview-view], .graview-scroll, [data-graview-overlay], .graview-zoom")||(E.preventDefault(),i.current(-E.deltaX,-E.deltaY))},f=l.current,b=f.fingers,h=()=>{f.owing=0;let E=f.owed;f.owed=null,E&&s.current(E.factor,E.x,E.y,E.dx,E.dy)},y=()=>{let[E,T]=[...b.values()];return{apart:Math.max(1,Math.hypot(E.x-T.x,E.y-T.y)),mid:{x:(E.x+T.x)/2,y:(E.y+T.y)/2}}},M=E=>{if(E.pointerType!=="touch"||(E.isPrimary&&(b.clear(),f.pinch=null,c.current=!1),b.set(E.pointerId,{x:E.clientX,y:E.clientY}),b.size!==2))return;let{apart:T,mid:D}=y();f.pinch={from:T,last:T,mid:D},c.current=!0},v=E=>{if(!b.has(E.pointerId))return;b.set(E.pointerId,{x:E.clientX,y:E.clientY});let T=f.pinch;if(!T||b.size!==2)return;let{apart:D,mid:g}=y();if(!(o.current.view.overview??!1))D/T.from<.72&&u(!0,performance.now());else{let L=f.owed??={factor:1,x:T.mid.x,y:T.mid.y,dx:0,dy:0};L.factor*=D/T.last,L.dx+=g.x-T.mid.x,L.dy+=g.y-T.mid.y,f.owing===0&&(f.owing=requestAnimationFrame(h))}T.last=D,T.mid=g},w=E=>{b.delete(E.pointerId)&&(b.size<2&&(f.pinch=null),!(b.size>0)&&(f.owing!==0&&cancelAnimationFrame(f.owing),h(),c.current=!1,d.current()))},x=E=>{E.preventDefault(),o.current.lastScale=1},O=E=>{if(E.preventDefault(),c.current||b.size>1)return;let T=o.current,D=E.scale??1;if(!(T.view.overview??!1)){D<.72&&u(!0,performance.now());return}let g=D/(T.lastScale||1);T.lastScale=D;let S=E;r.current(g,S.clientX,S.clientY)};return a.addEventListener("wheel",m,{passive:!1}),a.addEventListener("gesturestart",x),a.addEventListener("gesturechange",O),a.addEventListener("pointerdown",M),a.addEventListener("pointermove",v),a.addEventListener("pointerup",w),a.addEventListener("pointercancel",w),()=>{f.owing!==0&&(cancelAnimationFrame(f.owing),h()),a.removeEventListener("pointerdown",M),a.removeEventListener("pointermove",v),a.removeEventListener("pointerup",w),a.removeEventListener("pointercancel",w),a.removeEventListener("wheel",m),a.removeEventListener("gesturestart",x),a.removeEventListener("gesturechange",O)}},[n,e]),{zoomAbout:r,panBy:i,pinchBy:s,pinchDone:d,pinching:c}}var va=de(Oe(),1),bd=650,xd=400,yo="[data-graview-view]",ka="button, a, input, select, textarea, [role='button'], aside, section[aria-label], [data-graview-popover], [data-graview-offstage], [data-graview-overlay]";function vd(e,t){if(!(e instanceof Element)||e.closest("[data-graview-pick]"))return!1;let n=e.closest(ka);return n!==null&&n!==t&&t.contains(n)}function xa(e){return e instanceof Element?e.closest(yo):null}function kd(e,t,n){let o=null;for(let{id:r,box:i}of e.cards){if(t<i.left||t>i.right||n<i.top||n>i.bottom)continue;let s=i.width*i.height;(!o||s<o.area)&&(o={id:r,area:s})}return o?.id??null}function Sa(e,t){(0,va.useEffect)(()=>{let n=e.current;if(!n)return;let o=null,r=null,i=-1/0,s=!1,d=m=>{let f=o;if(o=null,r=null,!m.isPrimary||m.button!==0||!f||m.timeStamp-f.at>bd)return;let b=xa(m.target)?.getAttribute("data-graview-view")??null,h=kd(f,m.clientX,m.clientY);!(m.pointerType==="touch"&&f.on!==null&&h===f.on&&m.timeStamp-f.at<=xd)&&(h===b||vd(m.target,n)||h===null)||(m.stopPropagation(),r={to:h,double:h!==null&&h===f.on})},c=(m,f,b,h)=>{s=!0;try{m.dispatchEvent(new MouseEvent(f,{bubbles:!0,cancelable:!0,clientX:b.clientX,clientY:b.clientY,detail:h?2:1}))}finally{s=!1}},l=m=>{if(s)return;if(r){let{to:h,double:y}=r;r=null,i=m.timeStamp+500,m.stopPropagation(),m.preventDefault();let M=h===null?null:[...n.querySelectorAll(yo)].find(v=>v.getAttribute("data-graview-view")===h);h===null?c(n,"click",m,!1):M&&c(M,y?"dblclick":"click",m,y);return}if(t.current)return;let f=m.target instanceof Element?m.target.closest(ka):null;if(f&&f!==n&&n.contains(f)&&!m.target.closest("[data-graview-pick]"))return;let b=xa(m.target)?.getAttribute("data-graview-view")??null;o={at:m.timeStamp,on:b,cards:[...n.querySelectorAll(yo)].map(h=>({id:h.getAttribute("data-graview-view"),box:h.getBoundingClientRect()}))}},a=m=>{s||m.timeStamp>i||(m.stopPropagation(),m.preventDefault(),i=-1/0)},u=m=>{r&&m.stopPropagation()};return n.addEventListener("pointerdown",d,!0),n.addEventListener("pointerup",u,!0),n.addEventListener("click",l,!0),n.addEventListener("dblclick",a,!0),()=>{n.removeEventListener("pointerdown",d,!0),n.removeEventListener("pointerup",u,!0),n.removeEventListener("click",l,!0),n.removeEventListener("dblclick",a,!0)}},[e,t])}var Ma={directed:"You",autonomous:"An agent","co-edited":"You and an agent",rule:"A rule"};function wo(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 i=e.find(s=>s.aggregate?.memberIds.includes(r));i&&o.add(i.id)}return o}function bo(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 xo(e){return e.edgeChosen?.9:e.lit?.78:e.own*(e.anyLit?e.kit.dim:e.kit.rest)}function ht(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?on(n,t):ei(on(n,t),on(o,t),e.plane-n);return{x:e.x,y:e.y,width:e.width*r,height:e.height*r}}function mn(e,t){if(typeof getComputedStyle>"u"||getComputedStyle(e).visibility==="hidden")return null;let n=-1/0,o=-1/0,r=1/0,i=1/0,s=e.getBoundingClientRect();n=Math.max(n,s.left),o=Math.max(o,s.top),r=Math.min(r,s.right),i=Math.min(i,s.bottom);let d=e.parentElement;for(;d&&d!==t;){let l=getComputedStyle(d);if(l.overflowX!=="visible"||l.overflowY!=="visible"){let a=d.getBoundingClientRect();l.overflowX!=="visible"&&(n=Math.max(n,a.left),r=Math.min(r,a.right)),l.overflowY!=="visible"&&(o=Math.max(o,a.top),i=Math.min(i,a.bottom))}d=d.parentElement}if(r-n<=2||i-o<=2)return null;let c=t.getBoundingClientRect();return{x:n-c.left,y:o-c.top,width:r-n,height:i-o}}function Ve(e,t,n,o=!1){if(!e||typeof document>"u")return null;let r=e.querySelector(`[data-graview-view="${CSS.escape(t)}"]`);return r?mn(vo(r,n,o),e):null}function vo(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 xr(e,t,n,o,r){let i=l=>e.nodes.find(a=>a.id===l);if(r.startsWith("screen:")){let l=e.nodes.find(a=>a.id===Re(r.slice(7)));return l?Ve(t,l.id,!0)??ht(l,n):null}let s=i(r),d=He(r);if(!s&&d!==null&&(s=i(Be(d))),!s&&Wt(r)){let[l]=Rt(r);l&&(s=i(Re(l)))}if(!s){let l=o.places().find(a=>a.as===r);l&&(s=i(Be(l.kind))??i(Re(l.kind)))}if(s||(s=[...e.nodes].filter(l=>l.aggregate?.memberIds.includes(r)).sort((l,a)=>l.plane-a.plane)[0]),!s)return null;let c=e.city!==void 0;return Ve(t,s.id,c&&s.aggregate!==void 0&&Math.round(s.plane)===2)??ht(s,n)}var ft=de(Oe(),1);var Ye=de(Oe(),1);var Ge=de(Ae(),1);function Aa({title:e,name:t,path:n,maxHeight:o,children:r}){let i=(0,Ye.useContext)(qo),[s,d]=(0,Ye.useState)(void 0),[c,l]=(0,Ye.useState)(void 0),[a,u]=(0,Ye.useState)(void 0),[m,f]=(0,Ye.useState)(!1),[b,h]=(0,Ye.useState)(!1),y=(0,Ye.useRef)(null),M=(0,Ye.useRef)(null);(0,Ye.useLayoutEffect)(()=>{let S=y.current,L=M.current;if(!S||!L||typeof ResizeObserver>"u")return;let C=()=>{u(S.clientHeight),l(L.offsetHeight||void 0)};C();let V=new ResizeObserver(C);return V.observe(S),V.observe(L),()=>V.disconnect()},[]);let v=Math.max(s??0,c??0)||void 0,w=!m&&v!==void 0&&a!==void 0&&v>a+1,x=i&&n?n:void 0,O=x&&i?.href?i.href(x):void 0,E=S=>S.stopPropagation(),T=S=>{E(S),!(O&&(S.metaKey||S.ctrlKey||S.shiftKey||S.button!==0))&&(S.preventDefault(),x&&i?.open(x))},D=O?{href:O}:{role:"link",tabIndex:0},g={onPointerDown:E,onDoubleClick:E,onKeyDown:S=>{S.key!=="Enter"&&S.key!==" "||(E(S),S.key==="Enter"&&S.currentTarget.tagName==="A"&&!S.currentTarget.hasAttribute("href")&&(S.preventDefault(),S.currentTarget.click()))}};return(0,Ge.jsxs)("section",{"data-graview-preview":t,"aria-label":e,...m?{"data-graview-expanded":"","data-graview-overlay":""}:{},onKeyDown:m?S=>{S.key==="Escape"&&(S.stopPropagation(),f(!1))}:void 0,style:{...Sd,...m?Md:{}},children:[(0,Ge.jsxs)("div",{style:Ed,children:[(0,Ge.jsx)("strong",{style:Rd,children:e}),x?(0,Ge.jsx)("a",{"data-graview-preview-open":"",...D,"aria-label":`Open ${e}`,style:Ea,...g,onClick:T,children:"Open"}):w||m?(0,Ge.jsx)("button",{type:"button","data-graview-preview-expand":"","aria-expanded":m,"aria-label":`${m?"Collapse":"Expand"} ${e}`,style:{...Ea,...Ra},...g,onClick:S=>{E(S),f(L=>!L)},children:m?"Collapse":"Expand"}):null]}),(0,Ge.jsxs)("div",{ref:y,"data-graview-preview-body":"",...s!==void 0?{"data-graview-content-height":s}:{},...w?{"data-graview-more":""}:{},onFocus:()=>h(!0),onBlur:()=>h(!1),style:{...Od,...o!==void 0&&!m?{maxHeight:o}:{},...b?{overflowClipMargin:4}:{}},children:[(0,Ge.jsx)("div",{ref:M,"data-graview-preview-drawn":"",style:Ad,children:(0,Ge.jsx)(Xo.Provider,{value:d,children:r})}),w?(0,Ge.jsx)("div",{"aria-hidden":"true","data-graview-preview-fade":"",style:Pd}):null,w?x?(0,Ge.jsx)("a",{"data-graview-preview-more":"",...D,"aria-label":`More of ${e}`,style:Oa,...g,onClick:T,children:"More"}):(0,Ge.jsx)("button",{type:"button","data-graview-preview-more":"","aria-label":`More of ${e}`,style:{...Oa,...Ra},...g,onClick:S=>{E(S),f(!0)},children:"More"}):null]})]})}var Sd={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"},Md={maxHeight:"none",position:"absolute",top:0,left:0,right:0,width:"auto"},Ed={display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0,flex:"0 0 auto"},Rd={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"},Ra={font:"inherit",fontSize:"0.8125rem",fontWeight:560,background:"none",border:0,padding:0,cursor:"pointer"},Od={position:"relative",flex:"0 1 auto",minHeight:0,overflowX:"visible",overflowY:"clip",minWidth:0},Ad={display:"flow-root",minWidth:0},Pd={position:"absolute",left:0,right:0,bottom:0,height:64,pointerEvents:"none",background:"linear-gradient(to bottom, transparent, var(--graview-panel, #ffffff) 66%)"},Oa={position:"absolute",right:0,bottom:0,lineHeight:1.5,fontSize:"0.8125rem",fontWeight:560,color:"var(--graview-accent, #2f6f5e)",textDecoration:"none",textUnderlineOffset:"0.2em"};var ge=de(Ae(),1),La=(0,ft.memo)(function({kinds:t}){let{store:n}=ve(),{view:o,go:r}=zr(),i=(0,ft.useRef)(null),s=Yr("districts",{align:"start"}),d=s.open,c=f=>er(n.schema,f),l=f=>n.graph.allNodes().filter(b=>b.kind===f).length,a=f=>!o.overview&&o.focusId===Be(f),u=t.filter(f=>!a(f)),m=f=>{s.setOpen(!1);let b=i.current?.querySelector(".graview-beyond-more")??null;a(f)||r(Et(o,Be(f))),b?.focus({preventScroll:!0});let h=`[data-graview-view="${Be(f)}"][tabindex], [data-graview-view="${Re(f)}"][tabindex]`,y=40,M=()=>{let v=document.querySelector(h);v?v.focus({preventScroll:!0}):--y>0&&requestAnimationFrame(M)};requestAnimationFrame(M)};return(0,ge.jsxs)("div",{ref:i,className:"graview-beyond","data-graview-beyond":t.length,"data-graview-beyond-open":d?"":void 0,children:[(0,ge.jsxs)("button",{type:"button",className:"graview-beyond-more","data-testid":"beyond-more",...s.trigger,"aria-haspopup":"menu",title:`${u.length} more district${u.length===1?"":"s"} \u2014 press to see them`,onPointerDown:f=>f.stopPropagation(),onClick:f=>{f.stopPropagation(),s.toggle()},children:[(0,ge.jsx)("span",{className:"graview-beyond-count",children:u.length})," ",(0,ge.jsxs)("span",{className:"graview-beyond-word",children:["more district",u.length===1?"":"s"]}),(0,ge.jsx)("span",{className:"graview-beyond-chevron","aria-hidden":"true",children:d?"\u25BE":"\u25B4"})]}),d?(0,ge.jsx)("ul",{...s.pane,className:"graview-beyond-list",role:"menu","aria-label":"The other districts","data-testid":"beyond-list",style:Gr,onPointerDown:f=>f.stopPropagation(),children:t.map(f=>(0,ge.jsx)("li",{role:"none",children:(0,ge.jsxs)("button",{type:"button",role:"menuitem","data-graview-pick":Re(f),"aria-current":a(f)?"location":void 0,title:a(f)?`${c(f)} \u2014 where you are`:`Go to ${c(f)}`,onPointerDown:b=>b.stopPropagation(),onClick:b=>{b.stopPropagation(),m(f)},children:[(0,ge.jsx)("span",{className:"graview-beyond-name",children:c(f)}),(0,ge.jsx)("span",{className:"graview-beyond-tally",children:a(f)?"here":l(f)})]})},f))}):null]})},(e,t)=>e.kinds.length===t.kinds.length&&e.kinds.every((n,o)=>n===t.kinds[o]));function Ca(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"||So(e[o],t[o]))}function So(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 i=0;i<e.length;i++)if(!So(e[i],r[i]))return!1;return!0}let o=Object.keys(e);return o.length!==Object.keys(t).length?!1:o.every(r=>So(e[r],t[r]))}var Ta=(0,ft.memo)(Ia,(e,t)=>e.mode===t.mode&&e.selected===t.selected&&e.fidelity===t.fidelity&&Ca(e.node,t.node));function Ia({node:e,mode:t,selected:n,fidelity:o}){let{store:r,views:i,view:s}=ve(),d=Vt(),c=gi(),l=pi(),a=e.aggregate||Wt(e.id)||He(e.id)!==null?"many":"one",u={cardinality:a,fidelity:o??Jo[Cd(e.plane)].fidelity},m=a==="many"&&e.id===s.focusId?s.within?.view:void 0,f=i.resolve(e.kind,u,m),b=f?.view,h=i.resolve(e.kind,{cardinality:"many",fidelity:"full"})?.view,y=h!==void 0&&h.generic!==!0,M=e.aggregate?.memberIds,v=(0,ft.useMemo)(()=>(M??[]).map(D=>r.graph.getNode(D)).filter(D=>D!==void 0),[M,r,d]),w={...e.aggregate?{nodes:v,label:f?.title??e.aggregate.label}:{node:r.graph.getNode(e.id)},fidelity:u.fidelity,cardinality:u.cardinality,mode:t,selected:n,implicated:c,flagged:l,...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(!b)return(0,ge.jsx)(Td,{node:e,props:w});let x=Zo(b),O=!e.aggregate&&w.node?w.node:void 0,E=x?O?{title:en(r.schema.tryDefinition(O.kind),O),name:O.id,path:jo(r.schema,O.kind,O.id)}:{title:w.label??e.kind,name:f?.title?Tr(f.title):"",path:f?.title?`/places/${Tr(f.title)}`:void 0}:void 0,T=[e.id,f?.title??"",u.fidelity,u.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(D=>D.count).join(","):"",e.aggregate?ko(e.aggregate.memberIds):"",e.aggregate?.retired??"",c?ko(c):"",l?ko(l):"",y].join("|");return(0,ge.jsx)(Wr,{mode:t,children:(0,ge.jsx)(wi,{kind:w.label??e.kind,...f?.title?{view:f.title}:{},children:(0,ge.jsx)(Ld,{signature:T,graph:d,draw:()=>x&&E?(0,ge.jsx)(Aa,{...E,maxHeight:x.maxHeight,children:(0,ge.jsx)(b,{...w})}):(0,ge.jsx)(b,{...w})})},`${e.id}|${f?.title??""}`)})}var Ld=(0,ft.memo)(function({draw:t}){return(0,ge.jsx)(ge.Fragment,{children:t()})},(e,t)=>e.signature===t.signature&&e.graph===t.graph);function Cd(e){return Math.max(0,Math.min(2,Math.round(e)))}function Td({node:e,props:t}){return(0,ge.jsxs)("div",{style:{padding:8,font:"13px/1.4 system-ui",overflow:"hidden"},children:[(0,ge.jsx)("strong",{children:t.label??e.kind}),t.nodes?(0,ge.jsxs)("div",{children:[t.nodes.length," items"]}):(0,ge.jsx)("div",{children:e.id})]})}var Na=(0,ft.memo)(function({node:t}){let{store:n}=ve(),o=jt(),r=t.aggregate,i=r.opens,s=r.memberIds.length,d=tn(n.schema,r.kind,s),c=r.memberIds.slice(0,3).map(m=>{let f=n.graph.getNode(m),b=f?n.schema.tryDefinition(f.kind):void 0;return f?b?.label?b.label(f):String(f.label??m):m}),l=r.memberIds,a=(0,ft.useMemo)(()=>{let m=o?ir(o):null;return m?l.filter(f=>m.has(f)).length:0},[o,l]),u=i.in==="picture";return(0,ge.jsxs)("div",{className:"graview-band-group","data-graview-band":i.in,"data-graview-band-count":s,"data-graview-emphasis":o?a>0?"lit":"dimmed":void 0,title:u?`${r.label} \u2014 press twice to see them all, arranged`:`${r.label}: ${d} \u2014 press twice to open`,children:[(0,ge.jsxs)("span",{className:"graview-band-group-head",children:[(0,ge.jsx)("span",{className:"graview-band-group-name",children:r.label}),(0,ge.jsx)("span",{className:"graview-band-group-open","aria-hidden":"true",children:u?"\u2197":"\u25BE"})]}),(0,ge.jsxs)("span",{className:"graview-band-group-names",children:[u?null:(0,ge.jsxs)("span",{className:"graview-band-group-count",children:[d,a>0?` \xB7 ${a} match`:""," \xB7 "]}),c.join(" \xB7 "),s>c.length?" \u2026":""]})]})},(e,t)=>Ca(e.node,t.node)),Pa=new WeakMap;function ko(e){let t=Pa.get(e);if(t!==void 0)return t;let n=2166136261;for(let r of e){for(let i=0;i<r.length;i++)n=Math.imul(n^r.charCodeAt(i),16777619);n=Math.imul(n^44,16777619)}let o=`${e.length}:${(n>>>0).toString(36)}`;return Pa.set(e,o),o}var mt=de(Oe(),1);function Mo(e,t,n){let o=e.aggregate?[...e.aggregate.memberIds]:[e.id];return n?o.every(i=>t.includes(i))?t.filter(i=>!o.includes(i)):[...t,...o.filter(i=>!t.includes(i))]:o}function Ha(){let[e,t]=(0,mt.useState)(16);return(0,mt.useEffect)(()=>{if(typeof window>"u")return;let n=document.documentElement,o=()=>{let i=parseFloat(getComputedStyle(n).fontSize);Number.isFinite(i)&&t(s=>Math.abs(s-i)<.5?s:i)};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 Ba(e){let[t,n]=(0,mt.useState)(null);return(0,mt.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,mt.useEffect)(()=>{let o=e.current;if(!o||typeof ResizeObserver>"u")return;let r=d=>{!d||d.width===0||d.height===0||n(c=>{let l={width:Math.round(d.width),height:Math.round(d.height)};return c&&c.width===l.width&&c.height===l.height?c:l})},i=new ResizeObserver(d=>r(d[0]?.contentRect)),s=()=>r(o.getBoundingClientRect());return i.observe(o),addEventListener("resize",s),()=>{i.disconnect(),removeEventListener("resize",s)}},[e]),t}var Id=120;function Da(e){let t=(0,mt.useRef)(null);if(e===null)return t.current?.size??null;let n=t.current,o=typeof innerHeight=="number"?innerHeight:0;if(n&&n.size.width===e.width&&n.size.height===e.height)return n.size;let r=n?e.height-n.size.height:0,i=typeof navigator<"u"&&(navigator.maxTouchPoints>0||typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches);return n&&i&&e.width===n.size.width&&r>0&&r<=Id&&Math.abs(o-n.screen-r)<=1?n.size:(t.current={size:e,screen:o},e)}function Eo(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 $a(e){return`matrix3d(${e.join(",")})`}var ye=de(Oe(),1);var Ro=(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 Oo(e,t){let n=[],o=[];for(let i=0;i<e.length-1;i++){let s=e[i],d=e[i+1],c=!Ro(s,t);c&&o.length===0&&o.push(s);for(let l=1;l<=48;l++){let a=l/48,u={x:s.x+(d.x-s.x)*a,y:s.y+(d.y-s.y)*a},m=!Ro(u,t);if(m===c)continue;let f=(l-1)/48,b=a;for(let M=0;M<10;M++){let v=(f+b)/2,w={x:s.x+(d.x-s.x)*v,y:s.y+(d.y-s.y)*v};!Ro(w,t)===c?f=v:b=v}let h=(f+b)/2,y={x:s.x+(d.x-s.x)*h,y:s.y+(d.y-s.y)*h};m?o=[y]:(o.push(y),o.length>=2&&n.push(o),o=[]),c=m}c&&o.push(d)}return o.length>=2&&n.push(o),n}function jn(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 i=(e.y+t.y)/2;return[e,{x:e.x,y:i},{x:t.x,y:i},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 Qe=e=>Math.round(e*100)/100,Ct=e=>e.map(t=>t.map((n,o)=>`${o===0?"M":"L"} ${Qe(n.x)} ${Qe(n.y)}`).join(" ")).join(" ");function Ao(e,t){if(e.length<3)return Ct([e]);let n=[`M ${Qe(e[0].x)} ${Qe(e[0].y)}`];for(let r=1;r<e.length-1;r++){let i=e[r-1],s=e[r],d=e[r+1],c=Math.hypot(s.x-i.x,s.y-i.y),l=Math.hypot(d.x-s.x,d.y-s.y),a=Math.min(t,c/2,l/2),u={x:s.x+(i.x-s.x)/(c||1)*a,y:s.y+(i.y-s.y)/(c||1)*a},m={x:s.x+(d.x-s.x)/(l||1)*a,y:s.y+(d.y-s.y)/(l||1)*a};n.push(`L ${Qe(u.x)} ${Qe(u.y)} Q ${Qe(s.x)} ${Qe(s.y)} ${Qe(m.x)} ${Qe(m.y)}`)}let o=e[e.length-1];return n.push(`L ${Qe(o.x)} ${Qe(o.y)}`),n.join(" ")}function Fa(e,t){return t==="orthogonal"?Ct([e]):Ao(e,10)}function Wa(e,t,n){if(e==="orthogonal"){let d=jn(t.p0,t.p1),c=d.slice(1).map((u,m)=>Math.hypot(u.x-d[m].x,u.y-d[m].y)),l=c.reduce((u,m)=>u+m,0)||1,a=n*l;for(let u=0;u<c.length;u++){let m=c[u];if(a<=m||u===c.length-1){let f=m===0?0:Math.min(1,a/m),b=d[u],h=d[u+1];return{x:b.x+(h.x-b.x)*f,y:b.y+(h.y-b.y)*f}}a-=m}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),i=2*(1-n)*n,s=n*n;return{x:r*t.p0.x+i*o.x+s*t.p1.x,y:r*t.p0.y+i*o.y+s*t.p1.y}}function vr(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 ja(e,t){let n=t.x-e.x,o=t.y-e.y,r=(n/2+o)/2,i=(o-n/2)/2;if(Math.abs(r)<1||Math.abs(i)<1)return[e,t];let s={x:e.x+2*r,y:e.y+r};return[e,s,t]}function Va(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(i=>o.y<i.bottom+3&&o.y+o.height>i.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,i)=>r.x-i.x);return n.sort((o,r)=>o.top-r.top)}var Vn=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Lo=(e,t)=>e.findIndex(n=>n.boxes.some(o=>Vn(o,t)));function za(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 To(e,t){let n=[{from:-1/0,to:1/0}];for(let i of e){let s=[],d=-1/0;for(let l of i.boxes)s.push({from:d,to:l.x-12}),d=Math.max(d,l.x+l.width+12);s.push({from:d,to:1/0});let c=[];for(let l of n)for(let a of s){let u=Math.max(l.from,a.from),m=Math.min(l.to,a.to);m-u>=0&&c.push({from:u,to:m})}n=c}let o=t,r=1/0;for(let i of n){let s=Math.min(Math.max(t,i.from),i.to),d=i.from===-1/0||i.to===1/0,c=Math.abs(s-t)+(d?60:0);c<r&&(r=c,o=s)}return o}var ot=e=>({x:e.x,y:-(e.y+e.height),width:e.width,height:e.height}),kr=e=>e.map(t=>({x:t.x,y:-t.y}));function Co(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 i=n[r-1],s=n[r+1];return!i||!s||!(t(i.x,o.x)&&t(o.x,s.x)||t(i.y,o.y)&&t(o.y,s.y))})}function Io(e,t,n){let o=e.boxes.filter(l=>!Vn(l,t)&&l.y+l.height<=t.y+1&&l.x<t.x+t.width&&l.x+l.width>t.x),r=[{from:t.x+6,to:t.x+t.width-6}];for(let l of o)r=r.flatMap(a=>[{from:a.from,to:Math.min(a.to,l.x-12/2)},{from:Math.max(a.from,l.x+l.width+12/2),to:a.to}]).filter(a=>a.to>=a.from);let i=null;for(let l of r){let a=Math.min(Math.max(n,l.from),l.to);(i===null||Math.abs(a-n)<Math.abs(i-n))&&(i=a)}if(i!==null)return{x:i,tail:[{x:i,y:t.y}]};let s=n<t.x+t.width/2,d=To([e],s?t.x-12:t.x+t.width+12),c=t.y+t.height/2;return{x:d,tail:[{x:d,y:c},{x:d<t.x?t.x:t.x+t.width,y:c}]}}function Po(e,t,n){let o=Io({top:-e.bottom,bottom:-e.top,boxes:e.boxes.map(ot)},ot(t),n);return{x:o.x,head:kr(o.tail).reverse()}}function Ga(e,t,n,o){let r=t;for(;r>o&&!e[r-1].boxes.some(i=>n>i.x-12/2&&n<i.x+i.width+12/2);)r--;return r}var Ya=(e,t)=>(e%3-1)*Math.max(0,Math.min(4,t/2-3));function _a(e,t,n,o,r,i,s,d){let c=h=>h<0?e[0].top-n:e[h+1].top-e[h].bottom,l=h=>(h<0?(n+e[0].top)/2:za(e,h,h+1))+Ya(d,c(h)),a=Io(e[i],r,s),u=Ga(e,i,a.x,t+1),m=l(t);if(u===t+1)return Co([...o.head,{x:o.x,y:m},{x:a.x,y:m},...a.tail]);let f=To(e.slice(t+1,u),a.x),b=l(u-1);return Co([...o.head,{x:o.x,y:m},{x:f,y:m},{x:f,y:b},{x:a.x,y:b},...a.tail])}function pn(e,t,n,o=0){let r=Va(n.some(a=>Vn(a,e))&&n.some(a=>Vn(a,t))?n:[...n,e,t]),i=Lo(r,e),s=Lo(r,t),d=e.x+e.width/2,c=t.x+t.width/2;if(i===s){if(!(i<r.length-1||r.length===1))return kr(pn(ot(e),ot(t),n.map(ot),o));let u=za(r,i,i+1)+Ya(o,i<r.length-1?r[i+1].top-r[i].bottom:2*12),m=Po(r[i],e,c),f=Po(r[i],t,d);return Co([...m.head,{x:m.x,y:u},{x:f.x,y:u},...[...f.head].reverse()])}if(s<i)return kr(pn(ot(e),ot(t),n.map(ot),o));let l=Po(r[i],e,c);return _a(r,i,r[i].bottom,l,t,s,d,o)}function No(e,t,n,o=0){if(t.y+t.height<=e.y){let f=No(ot(e),ot(t),n.map(ot),o);return f?kr(f):null}let r=e.y+e.height;if(t.y<r)return null;let i=Va([...n.filter(f=>f.y>=r&&!Vn(f,t)),t]),s=Lo(i,t),d=t.x+t.width/2,c=Io(i[s],t,d),l=Ga(i,s,c.x,0),a=l===0?c.x:To(i.slice(0,l),c.x),u=Math.min(12,e.width/2),m=Math.min(Math.max(a,e.x+u),e.x+e.width-u);return _a(i,-1,r,{x:m,head:[{x:m,y:r}]},t,s,d,o)}function Ka(e,t=16){let n=new Map;for(let r of e){let i=r.a<r.b?`${r.a}\0${r.b}`:`${r.b}\0${r.a}`,s=n.get(i);s?s.push(r.key):n.set(i,[r.key])}let o=new Map;for(let r of n.values())r.forEach((i,s)=>o.set(i,(s-(r.length-1)/2)*t));return o}var _e=de(Ae(),1);function Bo(e,t,n,o){let r=[];for(let i of e.querySelectorAll("[data-graview-relation] > span")){let s=i.getBoundingClientRect();if(s.width<=0||s.height<=0)continue;let d=s.top-t.top,c=i.parentElement?.getAttribute("data-graview-relation"),l=1/0;for(let a of n){if(Math.round(a.plane)!==1||!a.via||`${a.via.edgeKind}|${a.via.direction}`!==c)continue;let u=o(a.id);u&&u.y>=d+s.height-1&&(l=Math.min(l,u.y))}r.push({x:s.left-t.left,y:d,width:s.width,height:l-d<=s.height*4?l-d:s.height})}return r}function Mr(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),i=!r&&o>.5*Math.min(e.height,t.height);if(r){let b={x:e.x+e.width,y:e.y+e.height/2},h={x:t.x+t.width,y:t.y+t.height/2};return{from:b,to:h,control:{x:Math.max(b.x,h.x)+18,y:(b.y+h.y)/2},mode:"stacked"}}if(i){let b={x:e.x+e.width/2,y:e.y},h={x:t.x+t.width/2,y:t.y};return{from:b,to:h,control:{x:(b.x+h.x)/2,y:Math.min(b.y,h.y)-18},mode:"abreast"}}let s={x:t.x+t.width/2,y:t.y+t.height/2},d={x:e.x+e.width/2,y:e.y+e.height/2},c=Sr(e,s),l=Sr(t,d),a=Math.hypot(l.x-c.x,l.y-c.y);if(a<8)return null;let u=Math.min(36,a*.12),m=-(l.y-c.y)/a,f=(l.x-c.x)/a;return{from:c,to:l,control:{x:(c.x+l.x)/2+m*u,y:(c.y+l.y)/2+f*u},mode:"direct"}}function Sr(e,t){let n=e.x+e.width/2,o=e.y+e.height/2,r=t.x-n,i=t.y-o;if(r===0&&i===0)return{x:n,y:o};let s=r===0?1/0:e.width/2/Math.abs(r),d=i===0?1/0:e.height/2/Math.abs(i),c=Math.min(s,d),l=Math.max(0,c*.98);return{x:n+r*l,y:o+i*l}}function Nd(e,t,n){let o=t.get(e.from),r=t.get(e.to);if(!o||!r)return!1;if(n)return!0;let i=Math.round(o.plane)===1||Math.round(r.plane)===1,s=d=>!!d.aggregate&&Math.round(d.plane)===2;return i&&!s(o)&&!s(r)}var Xa=e=>({clips:new Map,members:new Map,marks:new Map,...e?{owed:e}:{}});function qa(e,t){let n=Xa();for(let[o,r]of t){let i=e.querySelector(`[data-graview-view="${CSS.escape(o)}"]`);if(i!==null){for(let s of r)if(gn(e,i,s,n).length>0)return!0}}return!1}function Qa(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 i=n.get(r);i?i.push(o):n.set(r,[o])}return t.marks.set(e,n),n}function Hd(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 Bd(e,t,n){let o=e.parentElement;for(;o!==null;){let r=Hd(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 gn(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 i=r.get(n);if(i)return i;let s=e.getBoundingClientRect(),d=[];for(let l of Qa(t,o).get(n)??[]){if(l.closest("[data-graview-offstage]"))continue;let a=l.getBoundingClientRect();a.width<=2||a.height<=2||Bd(l,a,o)&&d.push({x:a.left-s.left,y:a.top-s.top,width:a.width,height:a.height})}d.sort((l,a)=>l.width*l.height-a.width*a.height),r.set(n,d);let c=t.getAttribute("data-graview-view");return d.length===0&&o.owed&&c!==null&&o.owed.set(c,(o.owed.get(c)??new Set).add(n)),d}function Er(e,t,n,o,r,i){let s=new Map(e.map(w=>[w.id,w])),d=Xa(i),c=new Map,l=w=>{if(!n||typeof document>"u")return null;let x=c.get(w);return x===void 0&&(x=n.querySelector(`[data-graview-view="${CSS.escape(w)}"]`),c.set(w,x)),x},a=new Map;for(let w of e){let x=Ve(n,w.id,o)??ht(w,r);x&&a.set(w.id,x)}let u=new Map;if(n&&typeof document<"u"){let w=n.getBoundingClientRect();for(let x of n.querySelectorAll("[data-graview-pick], [data-graview-slot]")){if(x.closest("[data-graview-offstage]"))continue;let O=x.getAttribute("data-graview-pick")??x.getAttribute("data-graview-slot");if(O===null)continue;let E=x.getBoundingClientRect();if(E.width<=2||E.height<=2||E.width>w.width*.6&&E.height>w.height*.6)continue;let T=u.get(O),D={x:E.left-w.left,y:E.top-w.top,width:E.width,height:E.height};T?T.push(D):u.set(O,[D])}}let m=(w,x)=>{let O=[];for(let[E,T]of a)E!==w&&E!==x&&O.push(T);for(let[E,T]of u)E!==w&&E!==x&&O.push(...T);return O},f=w=>Math.round(s.get(w)?.plane??-1)===1,b=[];for(let w of e){let x=a.get(w.id);x&&Math.round(w.plane)===1&&b.push(x)}if(!o&&n&&typeof document<"u"){let w=n.getBoundingClientRect();b.push(...Bo(n,w,e,x=>a.get(x)))}let h=(w,x)=>!o&&f(w)&&f(x)?b:void 0,y=o?void 0:e.find(w=>Math.round(w.plane)===0&&!w.aggregate),M=(w,x,O,E)=>{if(!y)return{};let T=w.to===y.id&&O===y.id;if(!T&&!(w.from===y.id&&x===y.id))return{};let D=T?w.from:w.to,g=a.get(y.id),S=a.get(D);if(D===y.id||!f(D)||!g||!S)return{};let L=l(y.id),C=ae=>L!==null&&Qa(L,d).get(ae)?.some(I=>!I.closest("[data-graview-offstage]"))===!0,V=E.map(ae=>ae.from===y.id?ae.to:ae.from),X=V.length>0&&V.every(C);return{band:b,tie:{card:g,chip:S,cardIsTo:T,toward:D,holds:s.get(D)?.aggregate?.memberIds??[D]},...X?{said:V}:{}}},v=[];for(let w of t){if(!Nd(w,s,o))continue;let x=a.get(w.from),O=a.get(w.to);if(!x||!O)continue;let E=m(w.from,w.to),T=w.edges,D=o&&T.some(L=>L.from!==w.from&&gn(n,l(w.from),L.from,d).length>0||L.to!==w.to&&gn(n,l(w.to),L.to,d).length>0),g=h(w.from,w.to);if(o&&!D||w.loop||T.length===0){v.push({key:w.id,connector:w,edges:T,fromBox:x,toBox:O,fromAnchor:w.from,toAnchor:w.to,obstacles:E,hosts:[],...g?{band:g}:{},...M(w,w.from,w.to,T)});continue}let S=new Map;for(let L of T){let C=L.from===w.from?[]:gn(n,l(w.from),L.from,d),V=L.to===w.to?[]:gn(n,l(w.to),L.to,d),X=[w.from,w.to].find(R=>Math.round(s.get(R)?.plane??-1)===0);if(!o&&X!==void 0&&(X===w.from?L.from!==w.from:L.to!==w.to)&&gn(n,l(X),X===w.from?L.to:L.from,d).length>0)continue;let ae=X!==void 0?s.get(X):void 0;if(!o&&ae?.aggregate&&n&&(X===w.from?L.from!==w.from&&C.length===0:L.to!==w.to&&V.length===0))continue;let I=C.length>0?L.from:w.from,$=V.length>0?L.to:w.to,N=`${w.id}|${I}|${$}`,q=S.get(N);if(q){q.edges.push(L);continue}let P=C.length>0?C:[x],j=V.length>0?V:[O],W=P[0],Q=j[0],k=1/0;for(let R of P)for(let B of j){let G=Math.hypot(R.x+R.width/2-(B.x+B.width/2),R.y+R.height/2-(B.y+B.height/2));G<k&&(k=G,W=R,Q=B)}S.set(N,{edges:[L],fromBox:W,toBox:Q,fromAnchor:I,toAnchor:$})}for(let[L,C]of S)v.push({key:L,connector:w,obstacles:E,hosts:[...C.fromAnchor!==w.from?[x]:[],...C.toAnchor!==w.to?[O]:[]],...g?{band:g}:{},...C,...M(w,C.fromAnchor,C.toAnchor,C.edges)})}return v}function Za(e,t,n){let o=new Map(t.map(s=>[s.id,s])),r=new Map;for(let s of n){let d=o.get(s.id);d&&(d.x!==s.x||d.y!==s.y)&&r.set(s.id,{x:s.x-d.x,y:s.y-d.y})}if(r.size===0)return[...e];let i=(s,d)=>{let c=r.get(d);return c?{...s,x:s.x+c.x,y:s.y+c.y}:s};return e.map(s=>{let{from:d,to:c}=s.connector;if(!r.has(d)&&!r.has(c))return s;let l=i(s.fromBox,d),a=i(s.toBox,c),u=s.tie&&{...s.tie,card:i(s.tie.card,s.tie.cardIsTo?c:d),chip:i(s.tie.chip,s.tie.toward)},m=f=>f===s.fromBox?l:f===s.toBox?a:s.tie&&f===s.tie.chip?u.chip:f;return{...s,fromBox:l,toBox:a,...u?{tie:u}:{},...s.band?{band:s.band.map(m)}:{}}})}function Ho(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 Ua(e,t,n){let o=(1-t)*(1-n),r=(1-t)*n+t*(1-n),i=t*n;return{p0:Ho(e,t),c:{x:o*e.p0.x+r*e.c.x+i*e.p1.x,y:o*e.p0.y+r*e.c.y+i*e.p1.y},p1:Ho(e,n)}}function zn(e,t){let n=l=>t.some(a=>l.x>a.x&&l.x<a.x+a.width&&l.y>a.y&&l.y<a.y+a.height),o=l=>!n(Ho(e,l)),i=(l,a,u)=>{for(let m=0;m<10;m++){let f=(l+a)/2;o(f)===u?l=f:a=f}return(l+a)/2},s=[],d=null,c=o(0);c&&(d=0);for(let l=1;l<=64;l++){let a=l/64,u=o(a);if(u===c)continue;let m=i((l-1)/64,a,c);u?d=m:d!==null&&(m-d>.001&&s.push(Ua(e,d,m)),d=null),c=u}return d!==null&&1-d>.001&&s.push(Ua(e,d,1)),s}function Ja({strands:e,result:t,scheme:n,overview:o,selection:r,emphasis:i,stageRef:s,liveOf:d,onPickEdge:c,provisional:l,pointed:a=null}){let u=Gt(),m=new Set(t.nodes.filter(g=>g.plot!==void 0&&Math.round(g.plane)===2).map(g=>g.id)),f=g=>o&&t.city!==void 0&&m.has(g.from)&&m.has(g.to),b=wo(t.nodes,r),h=g=>b.size===0||b.has(g.from)||b.has(g.to),y=new Set(r.filter(g=>Ft(g)===null)),M=o?t.nodes.find(g=>Math.round(g.plane)===0):void 0,v=M?Ve(s.current,M.id,!1)??ht(M,n):null;if(e.length===0)return null;let w=g=>g.edges.some(S=>y.has(S.from)||y.has(S.to)),x=y.size>0&&e.some(w),O=new Map;for(let g of e)O.set(g.connector.id,(O.get(g.connector.id)??0)+1);let E=Ka(e.map(g=>({key:g.key,a:g.fromAnchor,b:g.toAnchor}))),T=new Set,D=e.map((g,S)=>{let{connector:L,fromBox:C,toBox:V}=g,X={x:C.x+C.width/2,y:C.y+C.height/2},ae={x:V.x+V.width/2,y:V.y+V.height/2},I=o?Sr(C,ae):X,$=o?Sr(V,X):ae,N=L.loop===!0,{connector:q,style:P}=ln(u,L.kind);if(!q.visible)return null;let j=N?Math.max(22,Math.min(C.width,C.height)*.3):0,W=N?{x:X.x+C.width*.22,y:X.y-C.height/2-j+7}:I,Q=(I.x+$.x)/2,k=(I.y+$.y)/2,R=Math.hypot($.x-I.x,$.y-I.y),B=Math.min(o?40:90,R*(o?.09:.16)),G=0,A=0;if(R>0){G=-($.y-I.y)/R,A=($.x-I.x)/R;let ue=Q-t.width/2,Pe=k-t.height/2;if(v&&!N){let dt=v.x+v.width/2,Nt=v.y+v.height/2;ue=Q-dt,Pe=k-Nt;let $e=Math.abs(G*(dt-I.x)+A*(Nt-I.y)),tt=Math.hypot(v.width/2,v.height/2)*.85+24,qt=((dt-I.x)*($.x-I.x)+(Nt-I.y)*($.y-I.y))/(R*R);$e<tt&&qt>.1&&qt<.9&&(B=Math.min(180,Math.max(B,(tt-$e)*2)))}G*ue+A*Pe<0&&(G=-G,A=-A)}B+=2*(E.get(g.key)??0);let F=vr(q.route,{p0:I,c:{x:Q+G*B,y:k+A*B},p1:$}),z=f(L),_=q.route==="orthogonal"||z,Z=(ue,Pe)=>z?ja(ue,Pe):jn(ue,Pe),ne=!N&&g.tie?No(g.tie.card,g.tie.chip,g.band??[],S):null,J=ne?g.tie.cardIsTo?ne.reverse():ne:!N&&g.band?pn(C,V,g.band,S):null,fe=N||_||J?[]:zn(F,[C,V,...g.obstacles]),ie=J?[J]:!N&&_?Oo(Z(I,$),[C,V,...g.obstacles]):[];if(!N&&fe.length===0&&ie.length===0)return null;let se=ie[ie.length-1],we=_||J?ie[0]?.[0]:fe[0]?.p0,De=_||J?se?.[se.length-1]:fe[fe.length-1]?.p1,re=ue=>ue.map(Pe=>`M ${Pe.p0.x} ${Pe.p0.y} Q ${Pe.c.x} ${Pe.c.y} ${Pe.p1.x} ${Pe.p1.y}`).join(" "),ee=`M ${W.x-j} ${W.y} A ${j} ${j} 0 1 1 ${W.x+j} ${W.y} A ${j} ${j} 0 0 1 ${W.x-j} ${W.y}`,le=N?ee:J?Fa(J,q.route):_?Ct(ie):re(fe),at=ue=>({x:ue.x-8,y:ue.y-8,width:ue.width+16,height:ue.height+16}),Ke=[C,V,...g.hosts,...g.obstacles].map(at),bn=N?ee:J?Ct(ie):_?Ct(Oo(Z(I,$),Ke)):re(zn(F,Ke)),Ze=g.edges.length===1?g.edges[0]:null,Te=Ze?Yt(L.kind,Ze.from,Ze.to):null,Tt=Te!==null&&r.includes(Te),Je=Te!==null?l?.get(Te):void 0,It=g.edges.some(ue=>y.has(ue.from)||y.has(ue.to)),Ue=g.tie?.toward??"",Le=g.tie!==void 0&&(a!==null&&(Ue===a||g.tie.holds.includes(a)||g.said?.includes(a)===!0)||y.has(Ue))&&!T.has(Ue);Le&&T.add(Ue);let Ie=!o&&y.size>0&&It||Le,st=i!==null&&L.kind===i||Tt,oe=d?.(L)!==void 0;if(o&&!oe||!o&&!oe&&y.size>0&&!It&&!st&&!Le||g.said!==void 0&&!Le&&!g.said.some(ue=>y.has(ue))&&!st)return null;let et=o?bo({emphasized:i!==null,stressed:st,anyChosen:x,mine:It,touches:h(L),siblings:O.get(L.id)??1}):xo({edgeChosen:Tt,lit:Ie,anyLit:x||i!==null,own:P.opacity,kit:u.emphasis}),pt=Ie&&we&&De?g.tie?g.tie.cardIsTo?we:De:g.edges.some(ue=>y.has(ue.from))?De:we:null,xn=(0,_e.jsxs)("g",{children:[(0,_e.jsx)("path",{"data-graview-connector":L.kind,"data-graview-edges":g.edges.length,"data-graview-from":g.fromAnchor,"data-graview-to":g.toAnchor,"data-graview-lit":Ie||void 0,"data-graview-activity":d?.(L)?.manner,"data-graview-provisional":Je!==void 0||void 0,opacity:et*(L.opacity??1)*(Je!==void 0?In:1),d:le,fill:"none",stroke:an(P),strokeWidth:(Ie?Math.max(1.6,_r(P,o)):_r(P,o))+(st?.6:0),strokeDasharray:Je!==void 0?Tn:ar[P.pattern],strokeLinecap:"round"}),pt?(0,_e.jsx)("circle",{cx:pt.x,cy:pt.y,r:2.6,fill:an(P),opacity:et}):null,N&&o?(0,_e.jsx)("text",{x:W.x,y:W.y-j-5,textAnchor:"middle",opacity:et,style:{font:"9px var(--graview-font-body, system-ui)",letterSpacing:"0.09em",textTransform:"uppercase",fill:"var(--graview-ink-faint)"},children:Jn(L.kind).toLowerCase()}):null]},g.key),xt=null;return Te&&c&&!N&&et>=.2&&(xt=(0,_e.jsx)("path",{"data-graview-edge":Te,className:"graview-edge-hit",d:bn,fill:"none",pathLength:1,strokeDasharray:"0.86",strokeDashoffset:-.07,stroke:"transparent",strokeWidth:14,style:{pointerEvents:"stroke",cursor:"pointer"},onClick:ue=>{ue.stopPropagation(),c(Te,{x:ue.clientX,y:ue.clientY})},onContextMenu:ue=>{ue.altKey||(ue.preventDefault(),ue.stopPropagation(),c(Te,{x:ue.clientX,y:ue.clientY}))},children:Je!==void 0?(0,_e.jsx)("title",{children:Je}):null},`hit:${g.key}`)),{key:g.key,line:xn,hit:xt}});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:We.ties},children:D.map(g=>g?.line)}),D.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:We.tieLabels},children:D.map(g=>g?.hit)}):null]})}function es(e,t,n){if(t.size===0||typeof MutationObserver>"u")return()=>{};let o=0,r=()=>{o=0,qa(e,t)&&n()},i=()=>{o===0&&(o=requestAnimationFrame(r))},s=({target:c})=>{for(let l=c instanceof Element?c:c.parentElement;l&&l!==e;l=l.parentElement)if(t.has(l.getAttribute("data-graview-view")??""))return!0;return!1},d=new MutationObserver(c=>{c.some(s)&&i()});return d.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-graview-pick","data-graview-slot","data-graview-offstage"]}),i(),()=>{d.disconnect(),cancelAnimationFrame(o)}}function Rr(e){return e<640?{left:8,right:56}:{left:8,right:Math.round(Math.min(128,e*.107))}}function Dd(e){return Math.min(260,16+e.length*6.6)}var Gn=(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 ns(e,t,n){let o=new Map;for(let s of e){let d=o.get(s.said);d?d.push(s):o.set(s.said,[s])}let r=[],i=[];for(let[s,d]of o){let c=d[0],l=Dd(s),{end:a,far:u}=c,m=y=>Math.max(0,Math.min(n.width-l,y)),f=[{x:m(a.x-l/2),y:u.y-22-6,width:l,height:22},{x:m(a.x-l/2),y:u.y+u.height+6,width:l,height:22},{x:u.x+u.width+6,y:a.y-22/2,width:l,height:22},{x:u.x-l-6,y:a.y-22/2,width:l,height:22}],b=f[0],h=1/0;for(let y of f){let v=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)v+=Gn(y,w.title)*100+Gn(y,w.box);for(let w of r)v+=Gn(y,w)*100;if(v<h&&(h=v,b=y),v===0)break}r.push(b),i.push({said:s,keys:d.map(y=>y.key),...b})}return i}var ts=(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 Do(e,t){let n=new Set;for(let o of e)(t.edgeId&&o.edgeId===t.edgeId||t.point&&(ts(o.fromBox,t.point)||ts(o.toBox,t.point))||t.ids?.some(r=>o.ids.includes(r))||t.box&&(Gn(t.box,o.fromBox)>0||Gn(t.box,o.toBox)>0))&&n.add(o.key);return n}var Se=de(Ae(),1);function is(e){let t=Si(e);return t.length>0?new Map(t.map(n=>[Yt(n.edge.kind,n.edge.from,n.edge.to),ki(n)])):void 0}function as({frame:e,width:t,height:n,scheme:o,overview:r,selection:i,emphasis:s,stageRef:d,store:c,graphNodes:l,onPickEdge:a,liveOf:u,holding:m=!1,provisional:f,focusId:b=null,beside:h=!1}){let[y,M]=(0,ye.useState)(0),[v,w]=(0,ye.useState)(null),x=e.t<1,O=(0,ye.useRef)(""),E=(0,ye.useRef)([]),T=(0,ye.useRef)(new Map),D=()=>[...d.current?.querySelectorAll("[data-graview-relation] > span")??[]].map(I=>{let $=I.getBoundingClientRect();return`${Math.round($.left)},${Math.round($.top)},${Math.round($.width)}`}).join(" ");(0,ye.useLayoutEffect)(()=>{if(x||m)return;O.current=D(),E.current=e.nodes;let I=new Map;w(Er(e.nodes,e.connectors,d.current,r,o,I)),T.current=I},[e,x,m,i,r,l,o,y,d]),(0,ye.useEffect)(()=>{let I=d.current;if(!(x||m||I===null))return es(I,T.current,()=>M($=>$+1))},[v,x,m,d]),(0,ye.useEffect)(()=>{if(x||m||r||typeof requestAnimationFrame>"u")return;let I=requestAnimationFrame(()=>{D()!==O.current&&M($=>$+1)});return()=>cancelAnimationFrame(I)},[v]);let g=e.nodes.map(I=>I.id).join(`
4
+ `);(0,ye.useLayoutEffect)(()=>{let I=d.current;if(I===null||typeof window>"u")return;let $=0,N=()=>{$===0&&($=requestAnimationFrame(()=>{$=0,M(P=>P+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 P of I.querySelectorAll("[data-graview-view]"))q.observe(P)}return()=>{$!==0&&cancelAnimationFrame($),I.removeEventListener("scroll",N,{capture:!0}),window.removeEventListener("resize",N),q?.disconnect()}},[d,g]);let S=(0,ye.useRef)(new WeakMap);(0,ye.useEffect)(()=>{let I=d.current;if(x||m||I===null||typeof ResizeObserver>"u")return;let $=0,N=new ResizeObserver(q=>{let P=!1;for(let{target:j,contentRect:W}of q){let Q=`${Math.round(W.width)}x${Math.round(W.height)}`;S.current.has(j)&&S.current.get(j)!==Q&&(P=!0),S.current.set(j,Q)}P&&$===0&&($=requestAnimationFrame(()=>{$=0,M(j=>j+1)}))});for(let q of I.querySelectorAll("[data-graview-view]")){let P=vo(q);P!==q&&N.observe(P)}return()=>{$!==0&&cancelAnimationFrame($),N.disconnect()}},[v,x,m,d]);let[L,C]=(0,ye.useState)(null),V=(v??[]).some(I=>I.tie!==void 0);if((0,ye.useEffect)(()=>{let I=d.current;if(!V||I===null)return;let $=q=>{let P=q.target?.closest?.("[data-graview-pick], [data-graview-view]");C(P?.getAttribute("data-graview-pick")??P?.getAttribute("data-graview-view")??null)},N=()=>C(null);return I.addEventListener("pointerover",$),I.addEventListener("focusin",$),I.addEventListener("pointerleave",N),I.addEventListener("focusout",N),()=>{I.removeEventListener("pointerover",$),I.removeEventListener("focusin",$),I.removeEventListener("pointerleave",N),I.removeEventListener("focusout",N)}},[V,d]),x)return null;let X=(v&&m?Za(v,E.current,e.nodes):v)??Er(e.nodes,e.connectors,null,r,o),ae=new Set;for(let I of X){if(I.edges.length===1){let $=I.edges[0];ae.add(`${I.connector.kind}|${$.from}|${$.to}`);continue}for(let $ of I.edges)(I.connector.from===$.from||I.connector.to===$.to)&&ae.add(`${I.connector.kind}|${$.from}|${$.to}`)}return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(Ja,{strands:X,result:e,scheme:o,overview:r,selection:i,emphasis:s,stageRef:d,onPickEdge:a,liveOf:u,pointed:L,...f?{provisional:f}:{}}),r&&Hn(i,{overview:r,focusId:b,beside:h},I=>c.graph.getNode(I)?.kind).records.length>0?(0,Se.jsx)(ye.Suspense,{fallback:null,children:(0,Se.jsx)(Fd,{frame:e,width:t,height:n,stageRef:d,tick:y,store:c,graphVersion:l,selection:i,view:{overview:r,focusId:b,beside:h},rulers:f?{...rs,unsureOf:(I,$,N)=>f.get(Yt(I,$,N))}:rs})}):null,r?null:(0,Se.jsx)(jd,{...f?{provisional:f}:{},stageRef:d,nodes:e.nodes,scheme:o,selection:i,store:c,graphNodes:l,overview:r,width:t,height:n,onPickEdge:a,alreadyDrawn:ae,tick:y})]})}var rs={visibleRect:mn,clipQuadratic:zn,unsureDash:Tn,unsureOpacity:In},$d=Cn(nn(()=>(__graviewPreload(import.meta.url,["./chunk.YCD4JSXD.js","./chunk.SO6NT5K7.js","./chunk.MUSMNKE4.js","./chunk.SJQPTDAT.js","./chunk.JQ63N4MZ.js","./chunk.Z3O2VZAJ.js","./chunk.A5PSEU3W.js","./chunk.SDO3U72B.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4EMKCKDB.js")))),Fd=$d.part((e,t)=>(0,Se.jsx)(e.RecordLinks,{...t}),{what:"The links",quiet:!0}),Wd=44;function jd({stageRef:e,nodes:t,scheme:n,selection:o,store:r,graphNodes:i,overview:s,width:d,height:c,onPickEdge:l,alreadyDrawn:a,tick:u,provisional:m}){let f=Gt(),b=(0,ye.useMemo)(()=>{if(o.length===0||o.length>4)return[];let g=new Set(o),S=[];for(let C of o){let V=Ft(C);V&&S.push({kind:V.kind,self:V.from,other:V.to})}for(let C of r.graph.allEdges()){let V=g.has(C.from)?C.from:g.has(C.to)?C.to:null;if(!V)continue;let X=V===C.from?C.to:C.from;g.has(X)||S.push({kind:C.kind,self:V,other:X})}if(S.length<=14)return S;let L=new Set(t.map(C=>C.id));return S.map((C,V)=>({tie:C,index:V,real:L.has(C.other)?0:1})).sort((C,V)=>C.real-V.real||C.index-V.index).slice(0,14).map(({tie:C})=>C)},[r,o,i,t]),h=()=>{if(b.length===0||typeof document>"u")return[];let g=e.current?.getBoundingClientRect();if(!g)return[];let S=[...e.current?.querySelectorAll("[data-graview-joins]")??[]].find(P=>{if(P.closest("[data-graview-offstage]"))return!1;try{let j=JSON.parse(P.getAttribute("data-graview-joins")??"[]");return j.length===o.length&&j.every(W=>o.includes(W))}catch{return!1}});if(S){let P=mn(S,e.current);if(!P)return[];let j=[];for(let W of o){let Q=t.find(G=>G.id===W);if(!Q)continue;let k=Ve(e.current,Q.id,s)??ht(Q,n),R=k?Mr(P,k):null;if(!k||!R)continue;let B=[...r.graph.allEdges()].find(G=>G.from===W&&o.includes(G.to)||G.to===W&&o.includes(G.from));j.push({key:`join:${W}`,self:W,other:"",others:1,kind:B?.kind??"",endX:R.to.x,endY:R.to.y,...R,fromBox:P,toBox:k,proxy:!1,edgeId:B?Yt(B.kind,B.from,B.to):null})}return j}let L=(P,j)=>{let W=e.current?.querySelectorAll(`[data-graview-pick="${CSS.escape(P)}"], [data-graview-slot="${CSS.escape(P)}"]`),Q=[];for(let k of W??[]){if(k.closest("[data-graview-offstage]")||j(k)||k.closest("[data-graview-mark]"))continue;let R=mn(k,e.current);R&&Q.push(R)}return Q.sort((k,R)=>k.width*k.height-R.width*R.height)},C=P=>t.find(j=>j.id===P)??t.find(j=>j.aggregate?.memberIds.includes(P)),V=P=>`[data-graview-pick="${CSS.escape(P)}"], [data-graview-slot="${CSS.escape(P)}"]`,X=(P,j)=>{let W=e.current;if(!W)return!1;for(let Q of W.querySelectorAll("[data-graview-view]")){let k=Q.querySelector(V(P));if(k===null||k.closest("[data-graview-offstage]"))continue;let R=Q.querySelector(V(j));if(R!==null&&!R.closest("[data-graview-offstage]"))return!0}return!1},ae=[];if(!s&&e.current){for(let j of t){if(Math.round(j.plane)!==1)continue;let W=Ve(e.current,j.id,!1);W&&ae.push(W)}let P=e.current;ae.push(...Bo(P,g,t,j=>Ve(P,j,!1)))}let I=new Map,$=[];for(let P of b){if(X(P.self,P.other))continue;let j=C(P.self),W=j?e.current?.querySelector(`[data-graview-view="${CSS.escape(j.id)}"]`):null,Q=!s&&j?.id===P.self&&Math.round(j.plane)===1?Ve(e.current,j.id,!1):null,k=Q?[Q]:L(P.self,()=>!1);if(!(k.length>0)&&j){let ee=Ve(e.current,j.id,!1)??ht(j,n);ee&&k.push(ee)}let B=t.find(ee=>ee.id===P.other),G=[],A=!1;if(B){let ee=Ve(e.current,B.id,s)??ht(B,n);ee&&G.push(ee)}else if(G.push(...L(P.other,ee=>W?W.contains(ee):!1)),G.length===0){let ee=C(P.other);if(ee&&(!j||ee.id!==j.id)){let le=Ve(e.current,ee.id,s)??ht(ee,n);le&&(G.push(le),A=!0)}}if(k.length===0||G.length===0||A&&s)continue;let F=k[0],z=G[0],_=1/0;for(let ee of k)for(let le of G){let at=Math.hypot(ee.x+ee.width/2-(le.x+le.width/2),ee.y+ee.height/2-(le.y+le.height/2));at<_&&(_=at,F=ee,z=le)}if(a?.has(`${P.kind}|${P.self}|${P.other}`)||a?.has(`${P.kind}|${P.other}|${P.self}`))continue;let Z=`${P.kind}:${Math.round(F.x)},${Math.round(F.y)}:${Math.round(z.x)},${Math.round(z.y)}`,ne=I.get(Z);if(ne){ne.others+=1;continue}let J=Mr(F,z);if(!J)continue;let{from:fe,control:ie}=J,se=Q&&F===Q?pn(F,z,ae,$.length):void 0,we=se?se[se.length-1]:J.to,De=[...r.graph.allEdges()].find(ee=>ee.kind===P.kind&&(ee.from===P.self&&ee.to===P.other||ee.from===P.other&&ee.to===P.self)),re={key:`${P.kind}:${P.self}:${P.other}`,self:P.self,other:P.other,others:1,kind:P.kind,endX:we.x,endY:we.y,from:fe,to:we,control:ie,fromBox:F,toBox:z,...se?{points:se}:{},proxy:A,edgeId:De?Yt(De.kind,De.from,De.to):null};I.set(Z,re),$.push(re)}let N=s?void 0:t.find(P=>Math.round(P.plane)===0&&!P.aggregate),q=P=>{let j=t.find(W=>W.id===P.other)??t.find(W=>W.aggregate?.memberIds.includes(P.other));return j!==void 0&&Math.round(j.plane)===1&&j.via?.edgeKind===P.kind};for(let P of $){if(N&&(P.self!==N.id||q(P)))continue;let j=[...r.graph.allEdges()].find(G=>G.kind===P.kind&&(G.from===P.self&&G.to===P.other||G.from===P.other&&G.to===P.self)),W=r.graph.getNode(P.self),Q=r.graph.getNode(P.other);if(!j||!W||!Q)continue;let k=j.from===P.self?"out":"in",R=hi(r.schema,k==="out"?W.kind:Q.kind,P.kind,k),B=P.proxy?(k==="out"?r.graph.out(P.self,P.kind):r.graph.in(P.self,P.kind)).filter(G=>G.kind===Q.kind).length:1;P.said=P.proxy?`${R}: ${tn(r.schema,Q.kind,Math.max(B,P.others))}`:`${R}: ${en(r.schema.tryDefinition(Q.kind),Q)}`}return $},[y,M]=(0,ye.useState)([]),[v,w]=(0,ye.useState)([]);(0,ye.useLayoutEffect)(()=>{let g=h();M(g),w(g.some(S=>S.said)?x(g):[])},[b,t,s,n,d,c,a,u,e]);let x=g=>{let S=e.current;if(!S)return[];let L=[];for(let C of S.querySelectorAll("[data-graview-view]")){let V=[...C.children].find(ae=>!ae.classList.contains("graview-kind-tag")),X=V?mn(V,S):null;X&&L.push({box:X,title:{...X,height:Math.min(X.height,Wd)}})}return ns(g.flatMap(C=>C.said?[{key:C.key,said:C.said,end:{x:C.endX,y:C.endY},far:C.toBox}]:[]),L,{width:d,height:c})},[O,E]=(0,ye.useState)(()=>new Set),T=(0,ye.useRef)([]);T.current=y.map(g=>({key:g.key,fromBox:g.fromBox,toBox:g.toBox,ids:[g.self,g.other],edgeId:g.edgeId}));let D=v.length>0;return(0,ye.useEffect)(()=>{let g=e.current;if(!g||!D)return;let S=N=>E(q=>q.size===N.size&&[...N].every(P=>q.has(P))?q:N),L=0,C=null,V=()=>{if(L=0,!C)return;let N=g.getBoundingClientRect(),q=C.target instanceof Element?C.target:null;S(Do(T.current,{point:{x:C.clientX-N.left,y:C.clientY-N.top},edgeId:q?.closest("[data-graview-edge]")?.getAttribute("data-graview-edge")??null}))},X=N=>{C=N,L||(L=requestAnimationFrame(V))},ae=()=>{C=null,S(new Set)},I=N=>{let q=N.target instanceof Element?N.target:null;if(!q)return;let P=g.getBoundingClientRect(),j=q.getBoundingClientRect(),W=q.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??q.closest("[data-graview-view]")?.getAttribute("data-graview-view");S(Do(T.current,{...W?{ids:[W]}:{},box:{x:j.left-P.left,y:j.top-P.top,width:j.width,height:j.height}}))},$=N=>{N.relatedTarget instanceof Node&&g.contains(N.relatedTarget)||S(new Set)};return g.addEventListener("pointermove",X,{passive:!0}),g.addEventListener("pointerleave",ae),g.addEventListener("focusin",I),g.addEventListener("focusout",$),()=>{L&&cancelAnimationFrame(L),g.removeEventListener("pointermove",X),g.removeEventListener("pointerleave",ae),g.removeEventListener("focusin",I),g.removeEventListener("focusout",$)}},[e,D]),y.length===0?null:(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)("svg",{"aria-hidden":y.some(g=>g.edgeId)?void 0:!0,"data-graview-ties":y.length,"data-graview-world":"",width:d,height:c,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:We.lines},children:y.map(g=>{let{connector:S,style:L}=ln(f,g.kind);if(!S.visible)return null;let C=g.edgeId?m?.get(g.edgeId):void 0,V={p0:g.from,c:g.control,p1:g.to},X=g.points?Ao(g.points,10):S.route==="orthogonal"?Ct([jn(g.from,g.to)]):(({p0:I,c:$,p1:N})=>`M ${I.x} ${I.y} Q ${$.x} ${$.y} ${N.x} ${N.y}`)(vr(S.route,V)),ae=null;if(g.edgeId&&l&&!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,$=g.points?[...g.points]:[];for(let N=0;N<=(g.points?-1:40);N++){let q=Wa(S.route,V,N/40);I(g.fromBox,q)||I(g.toBox,q)||$.push(q)}$.length>=2&&(ae=(0,Se.jsx)("path",{"data-graview-edge":g.edgeId,className:"graview-edge-hit",d:`M ${$[0].x} ${$[0].y} ${$.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(),l(g.edgeId,{x:N.clientX,y:N.clientY})},onContextMenu:N=>{N.altKey||(N.preventDefault(),N.stopPropagation(),l(g.edgeId,{x:N.clientX,y:N.clientY}))},children:C!==void 0?(0,Se.jsx)("title",{children:C}):null}))}return(0,Se.jsxs)("g",{opacity:(g.proxy?.32:.72)*(C!==void 0?In:1),children:[(0,Se.jsx)("path",{"data-graview-tie":g.kind,"data-graview-tie-proxy":g.proxy||void 0,"data-graview-provisional":C!==void 0||void 0,d:X,fill:"none",stroke:an(L),strokeWidth:g.proxy?1.1:1.6,strokeDasharray:C!==void 0?Tn:ar[L.pattern],strokeLinecap:"round"}),(0,Se.jsx)("circle",{cx:g.endX,cy:g.endY,r:g.proxy?2:2.6,fill:an(L)}),ae]},g.key)})}),(0,Se.jsx)("div",{"aria-hidden":"true","data-graview-world":"",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:We.tieLabels},children:v.map(g=>{let S=y.find(L=>L.key===g.keys[0]);return(0,Se.jsx)("span",{className:"graview-record-link-said","data-graview-link-said":S?.kind,"data-graview-lands":S?.proxy?"district":"record","data-graview-said-for":g.keys.length,"data-graview-tie-said":g.keys.some(L=>O.has(L))?"shown":"waiting",style:{position:"absolute",left:g.x,top:g.y,transform:`translateX(min(0px, calc(${Math.round(d-g.x-8)}px - 100%)))`},children:g.said},g.said)})})]})}function os(){return typeof document>"u"?1:parseFloat(getComputedStyle(document.documentElement).fontSize)/16||1}function ss({nodes:e,scheme:t,width:n,stageRef:o,moving:r=!1,holding:i=!1}){let s=Gt(),[d,c]=(0,ye.useState)([]);(0,ye.useLayoutEffect)(()=>{r||i||c(l())},[e,r,i,t,n,o]);function l(){let u=[],m=[];for(let y of e){if(!y.via||Math.round(y.plane)!==1)continue;let M=Ve(o.current,y.id,!1,!0),{scale:v}=on(1,t);u.push({key:`${y.via.edgeKind}|${y.via.direction}`,text:Bn(y.via),left:M?.x??y.x,right:M?M.x+M.width:y.x+y.width*v,top:M?.y??y.y}),m.push(Math.round(y.y))}let f=new Map;u.forEach((y,M)=>f.set(m[M],Math.min(f.get(m[M])??1/0,y.top)));let b=u.map((y,M)=>({...y,top:f.get(m[M])??y.top})),h=Rr(n);return ao(b,{left:h.left,right:n-h.right},os())}if(d.length===0||!s.captions.visible||r)return null;let a=io*os();return(0,Se.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:We.lines},children:d.map(u=>{let{left:m,width:f}=u;return(0,Se.jsx)("div",{"data-graview-relation":u.key,title:u.text,style:{position:"absolute",left:m,width:f,textAlign:"center",top:Math.max(0,u.top-a),fontSize:"0.75rem",letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,Se.jsx)("span",{style:{background:"var(--graview-ground)",padding:"1px 7px",borderRadius:4},children:u.text})},u.key)})})}var Xt=de(Oe(),1);var zd=new Set;function ls(e,t,n,o,r,i,s=0,d=0){let{store:c,views:l,hiddenKinds:a}=ve(),u=jt(),m=(0,Xt.useContext)(rn),f=Vr(),b=(0,Xt.useMemo)(()=>{let v={};for(let w of f){if(w.subjectId===void 0)continue;let x=v[w.subjectId]??=[];for(let O of w.nodeIds)O!==w.subjectId&&!x.includes(O)&&x.push(O)}return v},[f]),h=(0,Xt.useMemo)(()=>({flagged:new Set(f.flatMap(v=>v.nodeIds)),touched:sr(c.log.all())}),[f,c,i]),y=(0,Xt.useMemo)(()=>({hits:u?ir(u):zd,...h}),[u,h]),M=(t?.width??1200)-r.right<640;return(0,Xt.useMemo)(()=>({...e,cityZoom:o,...m?{besideTheMap:!0}:{},...a.size>0?{hiddenKinds:[...a].sort()}:{},...Object.keys(b).length>0?{judged:b}:{},relevance:y,inset:M?{left:8,right:8,top:8,bottom:0}:{...Rr((t?.width??1200)-r.right),top:8,bottom:0},chrome:[{x:(t?.width??1200)-r.right-176,y:0,width:176,height:100},{...Yd(t,r),...r.bottom>0?{onSheet:!0}:{}}],...r.right>0||r.bottom>0?{dock:r}:{},...M||s>0?{headroom:M?Math.max(s,Gd):s}:{},unit:n,plainGroups:c.schema.kinds.filter(v=>Qo(l.lookup(v,{cardinality:"many",fidelity:"full"}))),cityOrder:zo(Oi({name:"scene",schema:c.schema,mutations:c.allMutations().filter(v=>!v.derived)}).order.map(v=>v.kind),l.arrangement?.()?.order),screens:l.places().reduce((v,w)=>((v[w.kind]??=[]).push({as:w.as,title:w.title,...w.across?{across:w.across}:{}}),v),{}),...t?{width:t.width,height:Math.max(0,t.height-Math.max(64,d))}:{}}),[e,t,n,c,l,a,b,y,o,m,r.right,r.bottom,s,d,M])}var Gd=60,ds=224;function Yd(e,t){let n=e?.width??1200,o=e?.height??800,r=58;return{x:n-t.right-ds,y:o-t.bottom-r,width:ds,height:r}}var bt=de(Oe(),1);var cs=de(Oe(),1);function Or(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 us(e){(0,cs.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{for(let i of t.querySelectorAll("[data-graview-pick]"))i.getAttribute("tabindex")===null&&i.setAttribute("tabindex","0"),i.getAttribute("role")===null&&Kd(i)&&i.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 _d=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 Kd(e){return _d.has(e.localName.toLowerCase())}var yn=de(Oe(),1),Ud=4,hs={top:0,right:0,bottom:0,left:0};function fs(e,t){let[n,o]=(0,yn.useState)(null),r=(0,yn.useRef)(null);return r.current=n,(0,yn.useLayoutEffect)(()=>{let i=e.current;if(!t||!i){o(null);return}let s=()=>{let m=i.getBoundingClientRect(),f=i.offsetWidth>0?m.width/i.offsetWidth:1;if(!(f>0))return;let b=r.current??hs,h={top:m.top+b.top*f,right:m.right-b.right*f,bottom:m.bottom-b.bottom*f,left:m.left+b.left*f},y=0,M=0,v=0,w=0;for(let D of i.querySelectorAll("*")){let g=D.getBoundingClientRect();g.width===0&&g.height===0||(y=Math.max(y,h.top-g.top),M=Math.max(M,g.right-h.right),v=Math.max(v,g.bottom-h.bottom),w=Math.max(w,h.left-g.left))}let x=D=>D>.5?Math.ceil(D/f)+Ud:0,O={top:x(y),right:x(M),bottom:x(v),left:x(w)},E=r.current??hs;if(O.top===E.top&&O.right===E.right&&O.bottom===E.bottom&&O.left===E.left)return;let T=O.top+O.right+O.bottom+O.left===0;r.current=T?null:O,o(T?null:O)},d=0,c=()=>{d||(d=requestAnimationFrame(()=>{d=0,s()}))};s();let l=typeof MutationObserver>"u"?null:new MutationObserver(c);l?.observe(i,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let a=typeof ResizeObserver>"u"?null:new ResizeObserver(c);a?.observe(i);let u=["pointerover","pointerout","focusin","focusout","transitionend","animationend"];for(let m of u)i.addEventListener(m,c);return()=>{d&&cancelAnimationFrame(d),l?.disconnect(),a?.disconnect();for(let m of u)i.removeEventListener(m,c)}},[e,t]),n}var wn=de(Ae(),1);function ms({node:e,useDom:t,blur:n,touched:o,frontY:r,centerY:i,screen:s,onDrawnHeight:d,crowded:c,activity:l,scheme:a,canvasWidth:u,canvasHeight:m,selected:f,onSelect:b,onPick:h,onTravel:y,onMenu:M,selection:v,onJackIn:w,onDragStart:x,onDragMove:O,onDragEnd:E,onDragCancel:T,swallowClick:D,children:g}){let{brand:S,store:L,actsDoor:C}=ve(),V=e.beyond?`${e.beyond.length} more district${e.beyond.length===1?"":"s"}`:e.aggregate?.opens?.in==="place"?`${e.aggregate.label}, ${tn(L.schema,e.aggregate.kind,e.aggregate.memberIds.length)}`:e.aggregate?e.aggregate.label:(()=>{let A=L.graph.getNode(e.id);return A?en(L.schema.tryDefinition(e.kind),A):e.id})(),[X,ae]=(0,bt.useState)(null),I=Math.round(e.plane)===0&&!e.aggregate;(0,bt.useLayoutEffect)(()=>{if(!I)return;let A=j.current;if(!A)return;let F=()=>{let _=[...A.children].find(ie=>ie.dataset.graviewKindtag===void 0);if(!_)return;let Z=A.getBoundingClientRect(),ne=_.getBoundingClientRect(),J=A.offsetWidth>0?Z.width/A.offsetWidth:1,fe={top:Math.round((ne.top-Z.top)/J)-9,right:Math.round((Z.right-ne.right)/J)+14};ae(ie=>ie&&ie.top===fe.top&&ie.right===fe.right?ie:fe)};if(typeof ResizeObserver>"u"){F();return}let z=new ResizeObserver(F);z.observe(A);for(let _ of A.children)z.observe(_);return()=>z.disconnect()},[I,e.id]);let $=ni({plane:e.plane,...e.depth!==void 0?{depth:e.depth}:{},onPlot:r!==void 0},a),N=$.style,q=ti(N,e.x,e.y,u,m),P=n?$.blur:0,j=(0,bt.useRef)(null);us(j);let W=fs(j,!t&&r!==void 0),Q=e.natural,k=Q?Math.min(e.width/Q.width,e.height/Q.height):1,R=(0,bt.useRef)(null);(0,bt.useEffect)(()=>{if(!s||!d)return;let A=R.current;if(!A||typeof ResizeObserver>"u")return;let F=()=>{let J=0,fe=0;for(let ie of A.children)if(!(!(ie instanceof HTMLElement)||ie.classList.contains("graview-screen-fullscreen"))){J=Math.max(J,ie.offsetTop+ie.offsetHeight);for(let se of[ie,...ie.querySelectorAll("*")]){let we=getComputedStyle(se).overflowY;(we==="auto"||we==="scroll")&&(fe+=se.scrollHeight-se.clientHeight)}}d(J+fe)},z=0,_=()=>{z||(z=requestAnimationFrame(()=>{z=0,F()}))};F();let Z=new ResizeObserver(_);Z.observe(A);for(let J of A.children)Z.observe(J);let ne=new MutationObserver(_);return ne.observe(A,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>{z&&cancelAnimationFrame(z),Z.disconnect(),ne.disconnect(),d(void 0)}},[s,d,e.id]);let B={...r!==void 0?{"--graview-front-y":`${r.toFixed(1)}px`}:{},...i!==void 0?{"--graview-center-y":`${i.toFixed(1)}px`}:{}},G=t?{transform:$a(q),transformOrigin:"0 0",filter:P>0?`blur(${P}px)`:void 0,opacity:ri(N)*(e.opacity??1),"--graview-lift-low":Eo(N.shadow,a),...B}:{"--graview-lift-low":Eo(N.shadow,a),...B};return(0,wn.jsxs)("div",{ref:j,"data-graview-view":e.id,...t?{}:{drawable:""},...W?{[oi]:ii(W)}:{},"data-graview-plane":Math.round(e.plane),"data-graview-selected":f||void 0,"data-graview-touched":o||void 0,"data-graview-plot":r!==void 0?"":void 0,"data-graview-screen":s?"":void 0,"data-graview-record-focus":Math.round(e.plane)===0&&!e.aggregate&&!Q&&!s?"":void 0,"data-graview-nested":e.nestedUnder??void 0,"data-graview-crowded":c||void 0,"data-graview-pinned":e.pinned||void 0,"data-graview-activity":l?l.manner:void 0,"data-graview-wrote":l?.wrote||void 0,"data-graview-read":l&&!l.wrote?!0:void 0,"data-graview-broke":l?.broke||void 0,title:l?`${Ma[l.manner]} ${l.wrote?"changed this":"read this"}: ${l.intent}`:e.aggregate&&Math.round(e.plane)!==0?`Open ${e.aggregate.label}`:void 0,role:"group","aria-label":V,"aria-keyshortcuts":C&&!e.beyond?C.key:void 0,tabIndex:0,onPointerDown:x,onPointerMove:O,onPointerUp:E,onPointerCancel:T??E,onClick:A=>{if(D.current)return;let F=A.target?.closest("input, textarea, select, button, a[href], [contenteditable='true']");if(F&&!F.hasAttribute("data-graview-pick"))return;let z=A.metaKey||A.shiftKey,_=Ot(A.target);if(_&&_!==e.id){A.stopPropagation(),h(_,z,Or(A.target)??void 0);return}b(z)},onKeyDown:A=>{if(C&&!e.beyond&&A.key.toLowerCase()===C.key.toLowerCase()&&!A.metaKey&&!A.ctrlKey&&!A.altKey&&!A.target?.closest("input, textarea, select, [contenteditable='true']")){A.preventDefault(),A.stopPropagation();let ne=Ot(A.target)??e.id;v.includes(ne)||h(ne,!1),C.open(A.target instanceof HTMLElement?A.target:A.currentTarget);return}if(A.key!=="Enter"&&A.key!==" "||A.target?.closest("input, textarea, select, button, [contenteditable='true']"))return;let z=Ot(A.target);if(A.preventDefault(),A.stopPropagation(),!z||z===e.id){v.length===1&&v[0]===e.id&&!A.metaKey&&!A.shiftKey?w():b(A.metaKey||A.shiftKey);return}let _=Or(A.target);(_?v.length===_.length&&_.every(ne=>v.includes(ne)):v.length===1&&v[0]===z)&&!A.metaKey&&!A.shiftKey?y(z):h(z,A.metaKey||A.shiftKey,_??void 0)},onContextMenu:A=>{if(A.altKey)return;let F=Ot(A.target);A.preventDefault(),A.stopPropagation();let z=F&&F!==e.id||!e.aggregate?null:Uo(A.target,A.currentTarget,(ie,se)=>L.graph.neighbors(ie).some(we=>we.id===se),e.id),_=F&&F!==e.id?F:z??e.id;h(_,!1,(_===F?Or(A.target):null)??void 0);let Z=A.nativeEvent.composedPath?.()[0],{clientX:ne,clientY:J}=A,fe=()=>{let ie=xi(Z);M({x:ne,y:J,on:_,...ie?{section:ie,title:ie.name}:{}})};vi(Z)?bi().then(fe,fe):fe()},onDoubleClick:A=>{let F=Ot(A.target);if(F&&F!==e.id){A.stopPropagation(),y(F);return}w()},style:{position:"absolute",...t?{}:{pointerEvents:"none"},zIndex:e.opened?We.opened:We.card-Math.round(e.plane),left:t?0:Math.round(e.x)-(W?.left??0),top:t?0:Math.round(e.y)-(W?.top??0),width:Math.round(e.width)+(W?W.left+W.right:0),height:Math.round(e.height)+(W?W.top+W.bottom:0),...W?{padding:`${W.top}px ${W.right}px ${W.bottom}px ${W.left}px`}:{},boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",...G},children:[Q?(0,wn.jsx)("div",{ref:R,"data-graview-natural":`${Math.round(Q.width)}x${Math.round(Q.height)}`,style:{position:"absolute",left:W?`calc(50% + ${(W.left-W.right)/2}px)`:"50%",top:W?`calc(50% + ${(W.top-W.bottom)/2}px)`:"50%",width:Q.width,height:Q.height,transform:`translate(-50%, -50%) scale(${k})`,transformOrigin:"50% 50%",display:"flex",flexDirection:"column"},children:g}):g,Math.round(e.plane)===0&&!e.aggregate?(0,wn.jsxs)("span",{"data-graview-kindtag":"",className:"graview-kind-tag","aria-hidden":"true",style:{...X??{},"--graview-hue":Math.round(On(e.kind,S?.accents))},children:[(0,wn.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(On(e.kind,S?.accents))} 55% var(--graview-tint-lightness) / 0.9)`}}),Wo(L.schema.tryDefinition(e.kind),e.kind)]}):null]})}var pe=de(Ae(),1);jr({search:Pi,touchWeights:sr});var Xd=e=>e?{activity:e}:{},qd=e=>`${Math.round(e.x)} ${Math.round(e.y)}`,ps=e=>e.stopPropagation(),Ar=.6,Pr=3,Qd=80,gs=e=>Math.round(e.plane)===1&&(e.compact===!0||e.width<175||e.height<Qd);function Zd(e){let[t,n]=(0,K.useState)(1),o=(0,K.useRef)(1);return(0,K.useEffect)(()=>{e||(o.current=1,n(1))},[e]),[t,o,n]}function Jd(e){let[t,n]=(0,K.useState)({x:0,y:0}),o=(0,K.useMemo)(()=>({x:(e.pan?.x??0)+t.x,y:(e.pan?.y??0)+t.y}),[e.pan,t]),r=(0,K.useMemo)(()=>t.x===0&&t.y===0?e:ct(e,o),[e,t,o]),i=(0,K.useRef)(t);i.current=t;let s=(0,K.useCallback)((d,c)=>{let l=i.current,a=(u,m,f)=>Math.max(Math.min(-u,m),Math.min(Math.max(u,m),f+m))-m;return{x:a(d.x,l.x,c.x),y:a(d.y,l.y,c.y)}},[]);return[o,r,s,i,n]}function el(e,t,n,o,r,i){let s=n!==null&&!t.overview,d=s?null:n,c=(0,K.useRef)(t);eo(c.current,t)||(c.current=t);let l=c.current,a=(0,K.useMemo)(()=>{let h=l.pan?{...l,pan:void 0}:l;return d?Nn(h,d.id,{x:d.x,y:d.y}):h},[l,d]),u=(0,K.useRef)(void 0),m=(0,K.useMemo)(()=>{let h=u.current?.stood,y=pr(e.graph,e.schema,a,h?{...o,cityStood:h}:o);return u.current=y.city,y},[e,a,o,r]),f=(0,K.useMemo)(()=>n&&s?ho(m,n.id,{x:n.x,y:n.y})??pr(e.graph,e.schema,Nn(a,n.id,{x:n.x,y:n.y}),o):m,[m,n,s,e,a,o]);return[(0,K.useMemo)(()=>fo(f,i??{x:0,y:0}),[f,i]),s]}function tl(e,t){let n=(0,K.useRef)(!1),o=(0,K.useRef)(!1),r=(0,K.useRef)(null),i=(0,K.useRef)(!1),s=(0,K.useCallback)(()=>{nl(e.current,{dragging:n.current,steering:o.current}),t.set(n.current||o.current||i.current)},[e,t]),d=(0,K.useCallback)(u=>{n.current!==u&&(n.current=u,s())},[s]),c=(0,K.useRef)(()=>!1),l=(0,K.useCallback)(()=>{o.current||(o.current=!0,s()),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,!c.current()&&(o.current=!1,s())},160)},[s]),a=(0,K.useCallback)(()=>{n.current=!1,o.current=!1,s()},[s]);return{dragging:n,steering:o,tweening:i,setDragging:d,steer:l,settleLive:c,settled:a}}function nl(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 rl(e){let t=(0,K.useRef)(!1),n=e!==null&&!t.current;return(0,K.useEffect)(()=>{e!==null&&(t.current=!0)},[e]),n}function ol({registerScene:e,scheme:t,views:n},o,r){let i=(0,K.useRef)(o);i.current=o,(0,K.useEffect)(()=>(e({whereIs:s=>xr(i.current,r.current,t,n,s)}),()=>e(null)),[e,t,n])}function il(e,t){(0,K.useEffect)(()=>{let n;return e.onActive(o=>{let r=t.current;if(!r)return;let i=c=>{let l=r.getBoundingClientRect();e.set({x:c.clientX-l.left,y:c.clientY-l.top})},s=c=>{c.buttons===0&&i(c)},d=()=>e.set(null);o?(r.addEventListener("pointermove",s),r.addEventListener("pointerup",i),r.addEventListener("pointerleave",d),n=()=>{r.removeEventListener("pointermove",s),r.removeEventListener("pointerup",i),r.removeEventListener("pointerleave",d)}):(n?.(),n=void 0)})},[e])}function al(e,t,n,o,r,i,s,d){(0,K.useEffect)(()=>{let c=t.current;if(!c||!e)return;let l=new Set;for(let u of n.nodes)(o.has(u.id)||u.aggregate?.memberIds.some(m=>o.has(m)))&&l.add(u.id);let a=e({canvas:c,layout:n,dirty:l,hostOf:u=>(c.parentElement??c).querySelector(`[data-graview-view="${CSS.escape(u)}"]`),drawOnDom:r,blur:i,scheme:s,fallBack:d});return()=>{a?.()}},[e,n,o,r,i,s,d])}var sl=nn(()=>(__graviewPreload(import.meta.url,["./chunk.RD2FSSLV.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QWGWOEBZ.js")));function dl(e,t){let[n]=(0,K.useState)(()=>{let a=si();return t?e==="dom"||e==="auto"&&a==="dom"?"dom":"gpu":li(e,{operator:a,present:di()})}),[o,r]=(0,K.useState)(!1),i=(0,K.useCallback)(()=>r(!0),[]),[s,d]=(0,K.useState)(null),c=n==="gpu"&&!t&&!o&&s===null;return(0,K.useEffect)(()=>{if(!c)return;let a=!0;return sl().then(u=>{a&&d(()=>u.attachGpu())},()=>{a&&r(!0)}),()=>{a=!1}},[c]),{attach:(n==="gpu"&&!o?t??s:null)??null,fallBack:i}}function ll(){let[e,t]=(0,K.useState)(()=>new Set),n=(0,K.useCallback)(o=>{t(r=>r.size===o.size&&[...o].every(i=>r.has(i))?r:new Set(o))},[]);return[e,n]}function cl(){let e=fi();return t=>{let n=t?e.get(t.id):void 0,o=t?.aggregate?.memberIds??[];if(!n&&o.length===0)return;let r=n,i=n?.wrote??!1,s=n?.read??!1,d=n?.broke??!1;for(let c of o){let l=e.get(c);l&&(i||=l.wrote,s||=l.read,d||=l.broke,(!r||l.at>r.at||l.at===r.at&&l.wrote&&!r.wrote)&&(r=l))}return r?{...r,wrote:i,read:s,broke:d}:void 0}}var ys=(e,t)=>e.includes(t)?e.filter(n=>n!==t):[...e,t];function ul(){let{views:e,view:t,setView:n,setSelection:o}=ve(),r=jt(),i=(0,K.useContext)(rn),s=d=>{if(He(d.id)===null&&!d.aggregate)return!1;let c=e.resolve(d.kind,{cardinality:"many",fidelity:"full"})?.view;return c!==void 0&&c.generic!==!0};return d=>({onSelect:c=>{if(Ln(d.id)){o(a=>c?ys(a,d.id):[d.id]);return}let l=d.aggregate?Pn(d.id):[];if(t.overview){o(a=>c?[...new Set([...a,d.id])]:[d.id]);return}if(l.length===1&&!c&&Math.round(d.plane)!==0){let a=l[0];n(u=>Br(u,u.relation===a?null:a));return}o(a=>Mo(d,a,c))},onPick:(c,l,a)=>o(u=>a?l?[...new Set([...u,...a])]:[...a]:l?ys(u,c):[c]),onTravel:c=>{n(l=>({...Et(l,c),relation:null})),o([c])},onJackIn:()=>{let c=d.aggregate?.opens;if(c){c.in==="place"?n(u=>Dr(u,d.id)):n(u=>Object.entries(c.within).reduce((m,[f,b])=>rr(m,f,b),Et(An(u,!1),c.focus))),o([]);return}let l=He(d.id),a=l!==null&&(r?.byKind[l]??0)>0;if(i&&l!==null&&t.overview&&!s(d)&&!(a&&t.q)){n(u=>rr({...Et(u,`aggregate:${l}`),relation:null},"view",null)),o([]);return}n(u=>$r(u,d.id,{ownPicture:s(d),...a&&u.q?{carry:u.q}:{}})),o(d.aggregate?[]:[d.id])}})}var hl=Cn(nn(()=>(__graviewPreload(import.meta.url,["./chunk.HJCQ6I3S.js","./chunk.YCD4JSXD.js","./chunk.A4EZAGG7.js","./chunk.ZG5VGP5U.js","./chunk.SO6NT5K7.js","./chunk.MUSMNKE4.js","./chunk.SJQPTDAT.js","./chunk.JQ63N4MZ.js","./chunk.Z3O2VZAJ.js","./chunk.A5PSEU3W.js","./chunk.SDO3U72B.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.HAOB6O72.js")))),fl=hl.part((e,t)=>(0,pe.jsx)(e.Ribbons,{...t}),{what:"The relations",quiet:!0}),ws="graview:map-from-above";function ml(){let[e,t]=(0,K.useState)(()=>{try{return globalThis.localStorage?.getItem(ws)==="1"}catch{return!1}}),n=(0,K.useCallback)(o=>{t(o);try{globalThis.localStorage?.setItem(ws,o?"1":"0")}catch{}},[]);return[e,n]}var bs=Cn(nn(()=>(__graviewPreload(import.meta.url,["./chunk.A4EZAGG7.js","./chunk.ZG5VGP5U.js","./chunk.37RFCHSS.js","./chunk.A5PSEU3W.js","./chunk.SDO3U72B.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.FLJXYESX.js")))),pl=bs.part((e,t)=>(0,pe.jsx)(e.Plots,{...t}),{quiet:!0}),gl=bs.part((e,t)=>(0,pe.jsx)(e.WorkflowsLayer,{...t}),{quiet:!0});function yl({zoom:e,zoomBy:t,above:n,setAbove:o}){let r=(i,s,d,c)=>(0,pe.jsx)("button",{type:"button",className:"graview-zoom-button","data-testid":`zoom-${i}`,"aria-label":`Zoom ${i}`,title:`Zoom ${i} \u2014 or pinch, or ctrl+wheel`,disabled:c,onClick:()=>t(d),children:s});return(0,pe.jsxs)("div",{className:"graview-zoom","data-graview-foot":"",role:"group","aria-label":"Zoom",onPointerDown:ps,onClick:ps,children:[r("out","\u2212",1/1.25,e<=Ar+1e-6),(0,pe.jsxs)("span",{className:"graview-zoom-level","data-testid":"zoom-level","aria-live":"polite",children:[Math.round(e*100),"%"]}),r("in","+",1.25,e>=Pr-1e-6),(0,pe.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 wl({options:e,renderer:t="auto",attachRenderer:n,blur:o=!0,className:r,style:i,animate:s=!0,children:d}){let c=ve(),l=c.app?c.app.workflows??Go(c.app)?.workflows:void 0,{store:a,scheme:u,views:m,view:f,setView:b,selection:h,setSelection:y,setMenuAt:M,emphasis:v,brand:w,noteMoved:x,robots:O,motion:E}=c,T=(0,K.useContext)(rn),D=(0,K.useRef)(null),g=(0,K.useRef)(null),S=Ba(g),L=Da(S),C=Ha(),{zoomAbout:V,panBy:X,pinchBy:ae,pinchDone:I,pinching:$}=ba({stage:g,view:f,setView:b}),N=Vt(),q=1,[P,j,W]=Zd(f.overview),[Q,k]=ml(),R=(0,K.useMemo)(()=>Q?{...e,tilt:Ci}:e,[e,Q]),{probe:B,dock:G}=pa(),A=!f.overview&&(f.zoom||f.past||f.relation)?Math.ceil(14+34*C/16+6):0,F=S&&L?S.height-L.height:0,z=(0,K.useRef)(G);F<=0&&(z.current=G);let _=F>0?z.current:G,Z=!!f.overview&&_.bottom>0&&_.right===0&&(h.length>0||f.focusId!==void 0),ne=ls(R,L,C,q*P,_,N,A,f.overview?0:_.bottom),J=da(g),[fe,ie,se,we,De]=Jd(f),re=(0,K.useMemo)(()=>new Set(Object.keys(f.pins).filter(H=>He(H)===null)),[f.pins]),ee=ga(),[le,at]=el(a,f,ee.held,ne,N,ie.pan),Ke=tl(g,E),{setDragging:bn,steer:Ze,settleLive:Te,settled:Tt}=Ke,Je=Ke.dragging.current||Ke.steering.current,It=rl(L),Ue=(0,K.useRef)(()=>{}),Le=ya({stage:g,pan:f.pan,zoom:P,setView:b,settled:Tt,zoomTo:Ue}),Ie=(0,K.useRef)(!1);Le.settling.current||(Ie.current=!1);let st=Le.settling.current&&!Ie.current,oe=ea(le,{enabled:s&&!Je&&L!==null&&!It,settle:!st});Ke.tweening.current=oe.t<1;let et=la(g,oe.t>=1,le);(0,K.useEffect)(()=>E.set(Ke.dragging.current||Ke.steering.current||oe.t<1),[E,oe]);let pt=ta(),xn=na(),xt=ua({view:f,result:le,frame:oe,panned:fe,closer:q,screenId:null,setCamera:De});ol(c,oe,g),il(c.pointer,g);let[ue,Pe]=ll(),{attach:dt,fallBack:Nt}=dl(t,n),$e=Zi(o);al(dt,D,oe,pt,Pe,$e,u,Nt);let tt=dt===null,qt=Ji($e&&tt,oe.t<1),vn=cl();Te.current=Le.settle;let{onGroundDown:Yn,onCardDown:vt,onDragMove:kn,onDragUp:Sn,onDragCancel:_n,swallow:gt}=wa({view:f,panned:fe,limit:()=>At(le),panWithin:se,moveByTransform:!0,setView:b,setDragging:bn,noteMoved:x,shift:Le,district:ee,pinching:$}),kt=qi({swallow:gt,setMenuAt:M,setSelection:y});Sa(g,gt),V.current=(H,me,xe)=>{if(!f.overview)return;Te.current();let Me=j.current,Ne=Math.max(Ar,Math.min(Pr,Me*H));if(Math.abs(Ne-Me)<1e-4)return;j.current=Ne,Ie.current=!0,Ze(),W(Ne);let ze=g.current?.getBoundingClientRect(),qe=le.visible??le,Dt={x:qe.width/2,y:qe.height/2},Rn=ze&&me!==void 0&&xe!==void 0?{x:me-ze.left,y:xe-ze.top}:Dt,qn=Ne/Me;b(St=>ct(St,mr(St.pan??{x:0,y:0},we.current,Rn,Dt,qn))),x()},ae.current=(H,me,xe,Me,Ne)=>{if(!f.overview)return;Ze();let ze=g.current?.getBoundingClientRect(),qe=ze?{x:me-ze.left,y:xe-ze.top}:{x:0,y:0};Le.zoomBy(H,qe,Me,Ne,Ar/j.current,Pr/j.current),x()},I.current=()=>{Te.current()},Ue.current=(H,me)=>{let xe=j.current,Me=Math.max(Ar,Math.min(Pr,xe*H));j.current=Me,Ie.current=!0,W(Me);let Ne=le.visible??le,ze={x:Ne.width/2,y:Ne.height/2};b(qe=>ct(qe,mr(qe.pan??{x:0,y:0},we.current,me,ze,Me/xe)))};let Qt=(H,me,xe=At(le))=>b(Me=>ct(Me,se(xe,{x:(Me.pan?.x??0)+H,y:(Me.pan?.y??0)+me})));fa(g,G,(H,me)=>Qt(H,me)),X.current=(H,me)=>{Ze();let xe=At(le),Me=f.pan??{x:0,y:0},Ne=Le.offset();Le.shiftTo(se(xe,{x:Me.x+Ne.x+H,y:Me.y+Ne.y+me}),Me),x()};let Kn=ul(),Un=Gt(),Ht=(0,K.useCallback)(H=>ln(Un,H).connector.visible,[Un]),lt=H=>vn(oe.nodes.find(me=>me.id===H)),Mn=(H,me,xe,Me)=>H.originY+fe.y+cn(xe.col+xe.side/Me,xe.row+xe.side/Me,H.cell,H.tilt).y-me.y,nt={width:le.width,height:le.height},En={position:"relative",zIndex:We.stage,...nt},Zt=H=>xr(oe,g.current,u,m,H),Xe=H=>tt||ue.has(H),Xn=lr(c),Jt=H=>(0,pe.jsx)(or.Provider,{value:Xn,children:H}),Bt=oe.nodes.filter(H=>H.screenOf===void 0).map(H=>(0,pe.jsx)(ms,{node:H,crowded:gs(H),useDom:Xe(H.id),blur:qt||!tt&&$e,...H.plot&&oe.city&&Math.round(H.plane)===2?{frontY:Mn(oe.city,H,H.plot,1),centerY:Mn(oe.city,H,H.plot,2)}:{},touched:pt.has(H.id),...Xd(vn(H)),scheme:u,canvasWidth:le.width,canvasHeight:le.height,selected:h.includes(H.id),...Kn(H),onMenu:M,selection:h,onDragStart:me=>vt(H,me),onDragMove:kn,onDragEnd:Sn,onDragCancel:_n,swallowClick:gt,children:H.beyond?(0,pe.jsx)(La,{kinds:H.beyond}):H.aggregate?.opens?(0,pe.jsx)(Na,{node:H}):(0,pe.jsx)(Ta,{node:H,mode:"scene",selected:h.includes(H.id),...gs(H)?{fidelity:"glyph"}:{}})},H.id));return(0,pe.jsxs)("div",{ref:g,className:`graview-ground${r?` ${r}`:""}`,"data-graview-altitude":f.overview?"":void 0,"data-graview-reach":oe.city?qd(At(le)):void 0,"data-graview-settled":oe.t>=1&&!xt.gliding()?"":void 0,"data-graview-box":L?`${L.width}x${L.height}`:void 0,"data-graview-renderer":tt?"dom":"gpu","data-graview-blur":(tt?qt:$e)?"":void 0,onPointerDown:H=>{kt.onPointerDown(H),Yn(H)},onPointerMove:H=>{kt.onPointerMove(H),kn(H)},onPointerUp:()=>{kt.onPointerUp(),Sn()},onPointerCancel:()=>{kt.onPointerUp(),_n()},onContextMenu:kt.onContextMenu,onClick:H=>{gt.current||H.target.closest("[data-graview-view], button, aside, section[aria-label], [data-graview-offstage], a, input, select")||(y([]),M(null))},style:{position:"relative",width:"100%",height:"100%",cursor:"grab",touchAction:"none",overscrollBehavior:"contain","--graview-altitude":f.overview?1:0,...oe.city?{"--graview-lattice-cell":`${oe.city.cell.toFixed(2)}px`,"--graview-lattice-tilt":(oe.city.tilt??.5).toFixed(3),"--graview-lattice-x":`${(oe.city.originX+oe.city.pan.x).toFixed(1)}px`,"--graview-lattice-y":`${(oe.city.originY+oe.city.pan.y).toFixed(1)}px`}:{},overflow:"hidden",...i},children:[(0,pe.jsx)("div",{className:"graview-measure","aria-hidden":"true",style:{"--graview-world-x":`${(oe.pan?.x??0).toFixed(1)}px`,"--graview-world-y":`${(oe.pan?.y??0).toFixed(1)}px`}}),f.overview&&oe.city?(0,pe.jsx)(K.Suspense,{fallback:null,children:(0,pe.jsx)(fl,{frame:oe,...nt,pan:oe.city.pan,store:a,graphVersion:N,selection:h,view:{overview:f.overview,focusId:f.focusId,beside:T},emphasis:v,hiddenKinds:c.hiddenKinds,drawn:Ht})}):null,(0,pe.jsx)("div",{ref:B,"aria-hidden":"true",style:{position:"absolute",top:0,right:0,width:"var(--graview-dock, 0px)",height:"var(--graview-sheet, 0px)",visibility:"hidden",pointerEvents:"none"}}),oe.city?(0,pe.jsx)(K.Suspense,{fallback:null,children:(0,pe.jsx)(pl,{frame:oe,...nt,pan:oe.city?oe.city.pan:fe,brand:w,pinned:re,close:q*P>1.2,swallowed:gt,...f.overview?{chosen:Hn(h,{overview:f.overview,focusId:f.focusId,beside:T},H=>a.graph.getNode(H)?.kind).records}:{},onFocus:H=>{let me=He(H);me!==null&&b(xe=>Et(xe,Be(me)))}})}):null,f.overview&&oe.city&&l?(0,pe.jsx)(K.Suspense,{fallback:null,children:(0,pe.jsx)(gl,{frame:oe,...nt,pan:oe.city.pan,app:c.app,workflows:l,acts:a.allMutations(),runs:c.workflowRuns,graphVersion:N,hiddenKinds:c.hiddenKinds})}):null,tt?(0,pe.jsx)("div",{"data-graview-stage":"dom","data-graview-world":"",style:{...En,overflow:"hidden"},children:Jt(Bt)}):(0,pe.jsxs)("div",{"data-graview-world":"",style:En,children:[(0,pe.jsx)("div",{"data-graview-stage":"dom","data-graview-under-canvas":"",style:{position:"absolute",left:0,top:0,...nt,overflow:"hidden"},children:Jt(Bt.filter(H=>ue.has(String(H.key))))}),(0,pe.jsx)("canvas",{ref:D,"data-graview-stage":"gpu",content:"drawable",layoutsubtree:"",...nt,style:{display:"block",position:"relative",...nt},children:Jt(Bt.filter(H=>!ue.has(String(H.key))))})]}),f.overview?(0,pe.jsx)(aa,{result:le,schema:a.schema,chrome:[...ne.chrome??[],...J?[J]:[],...ca(et,le.nodes)],onGo:H=>{Qt(H.x,H.y),x()}}):null,f.overview&&!Z?(0,pe.jsx)(yl,{zoom:P,zoomBy:H=>V.current(H),above:Q,setAbove:k}):null,(0,pe.jsx)(as,{frame:oe,focusId:f.focusId,beside:T,holding:at,...nt,scheme:u,overview:!!f.overview,selection:h,emphasis:v,stageRef:g,store:a,graphNodes:N,...(H=>H?{provisional:H}:{})(is(a)),onPickEdge:(H,me)=>{gt.current||(y([H]),M(me?{...me,on:H}:null))},liveOf:H=>{let me=lt(H.from),xe=lt(H.to);return me?.wrote&&xe?.wrote?me.at>xe.at?me:xe:void 0}}),(0,pe.jsx)(oa,{width:le.width,whereIs:Zt}),(0,pe.jsx)(ra,{marks:xn.marks,questions:[...O.values()].filter(H=>H.mode==="asking"&&H.at!==null&&H.say).map(H=>({id:H.at,who:H.who,asks:H.say})),whereIs:Zt,stageRef:g,...nt}),(0,pe.jsx)(ss,{nodes:oe.nodes,moving:oe.t<1,holding:at,scheme:u,width:le.width,stageRef:g}),d,(0,pe.jsx)("div",{className:"graview-lattice","aria-hidden":"true"})]})}var it=de(Oe(),1);function bl(){return Ss(),null}var ks=()=>window.location.pathname.endsWith(Vo),xs=()=>(ks()?Yo:Hr)(window.location.hash),xl=e=>(ks()?_o:Nr)(e);function Ss(){let{view:e,setView:t,views:n,principal:o}=ve(),r=JSON.stringify(o),i=(0,it.useCallback)(a=>{let u=a.within?.view;if(u===void 0||a.focusId)return a;let m=n.places().find(f=>f.as===u);return m?{...a,focusId:Be(m.kind)}:a},[n]),s=(0,it.useRef)(!1);(0,it.useEffect)(()=>{if(typeof window>"u")return;let a=i(xs());!nr(a,Ir)&&!nr(a,e)&&(s.current=!0,t(a))},[]),(0,it.useEffect)(()=>{if(typeof window>"u")return;let a=()=>t(i(xs()));return window.addEventListener("popstate",a),window.addEventListener("hashchange",a),()=>{window.removeEventListener("popstate",a),window.removeEventListener("hashchange",a)}},[t,i]);let d=(0,it.useRef)(!1),c=(0,it.useRef)(null),l=(0,it.useRef)(r);(0,it.useEffect)(()=>{if(typeof window>"u")return;if(s.current){s.current=!1;return}let a=l.current!==r;l.current=r;let u=xl(e),m=u||`${window.location.pathname}${window.location.search}`;if((window.location.hash||(window.location.href.includes("#")?"#":""))===u){d.current=!0,c.current=e;return}if(!d.current){d.current=!0,c.current=e,window.history.replaceState({graview:zt.at},"",m);return}if(a||Ms(c.current,e)){window.history.replaceState({graview:zt.at},"",m),c.current=e;return}c.current=e,window.history.pushState({graview:++zt.at},"",m),zt.depth=zt.at,zt.tell()},[e,r])}function Ms(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(",")&&vl(e.within,t.within):!1}function vl(e,t){let n=o=>Object.entries(o??{}).sort(([r],[i])=>r.localeCompare(i)).map(([r,i])=>`${r}=${i}`).join("&");return n(vs(e))===n(vs(t))}function vs(e){if(!e||!("q"in e))return e;let{q:t,...n}=e;return n}var $o=de(Oe(),1);var Es=new WeakMap,kl=64,Rs=new WeakMap,Sl=0,Ml=e=>{if(e===void 0)return 0;let t=Rs.get(e);return t===void 0&&Rs.set(e,t=Sl+=1),t};function Os(e,t,n,o={}){let r=()=>{let l=[...new Set(t.flatMap(u=>Pn(u)))],a=t.map(u=>Ft(u)).filter(u=>u!==null);return Mi(e,t,{...n.principal?{principal:n.principal}:{},kindSelection:l,edgeSelection:a,...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 i=Es.get(e);if(!i){let l={kept:new Map,at:e.log.length};Es.set(e,i=l),e.subscribe(()=>l.kept.clear())}i.at!==e.log.length&&(i.kept.clear(),i.at=e.log.length);let s=JSON.stringify([t,n.principal??null,Ml(n.providers),n.pins??null,n.focus??null]),d=i.kept.get(s);if(d)return d;let c=r();return i.kept.set(s,c),i.kept.size>kl&&i.kept.delete(i.kept.keys().next().value),c}function El(e,t,n={}){return Os(e,t,n)}function Rl(e={}){let{store:t,selection:n,principal:o,providers:r}=ve(),{about:i,principal:s=o,providers:d=r,pins:c,focus:l,...a}=e,u=i??n,m=Vt();return(0,$o.useMemo)(()=>Os(t,u,{principal:s,providers:d,pins:c,focus:l},a),[t,u,e,m,s,d])}function Ol(){let{store:e,principal:t}=ve();return(0,$o.useMemo)(()=>({preview:(n,o)=>Ri(e,n,o??{},{pressed:t?{author:t}:{}}),apply:(n,o)=>Ei(e,n,o??{},{author:t})}),[e,t])}export{zs as a,Gs as b,Ys as c,_s as d,Ks as e,Us as f,Is as g,wl as h,bl as i,El as j,Rl as k,Ol as l};
@@ -1 +1 @@
1
- import"./chunk.WVUJXDXZ.js";import{b as P}from"./chunk.S2DOVJRL.js";import"./chunk.64FCAUAJ.js";import"./chunk.NBVPWLRY.js";import"./chunk.S3EEY7T3.js";import"./chunk.SPCAMQJE.js";import"./chunk.TUCSUZNO.js";import"./chunk.ZMWAZACO.js";import"./chunk.CD6YWH6T.js";import{Aa as L,wa as M,ya as T,za as E}from"./chunk.J24YPQ5I.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function G(r,l,i){let g=r.getAttribute("data-record")??"",m=r.getAttribute("data-field")??"",c=Number(r.getAttribute("data-index")??"0"),e=[...l?.node?[l.node]:[],...l?.nodes??[]].find(p=>p.id===g);if(!g||!e)return{why:g?`names a record it was not shown ("${g.slice(0,80)}")`:"names no record (data-record)"};let h=m&&Object.hasOwn(e,m)?e[m]:void 0,f=(Array.isArray(h)?h:[h]).filter(M),o=Number.isInteger(c)&&c>=0?f[c]:void 0,v=e.label?`"${e.label}"`:"a record";return m?o?(i==="video"?!E(o):!E(o)&&!T(o))?{why:`names "${o.name}" on ${v}, which is not ${i==="video"?"a video":"a picture or a video"}`}:{file:o,on:e}:{why:f.length===0?`names "${m}" on ${v}, which holds no file it was shown`:`names file ${r.getAttribute("data-index")} of "${m}" on ${v}, which holds ${f.length}`}:{why:`names no field of ${v} (data-field)`}}var C=r=>`${r.caption?.trim()||r.name}, ${L(r)}`;function N(r,l,i,g,m,c={}){let e=r.createElement("video");e.setAttribute("data-graview-video",""),e.setAttribute("playsinline",""),e.setAttribute("aria-label",C(i)),c.autoplay?(e.setAttribute("data-graview-video-autoplay",""),e.setAttribute("muted",""),e.muted=!0,e.setAttribute("loop",""),e.setAttribute("preload",c.still?"metadata":"auto"),c.still?e.setAttribute("data-graview-video-still",""):e.setAttribute("autoplay","")):(e.setAttribute("controls",""),e.setAttribute("preload","metadata"));let h=i.poster?g(i.poster):void 0;h&&e.setAttribute("poster",h),i.width&&i.height?(e.setAttribute("width",String(i.width)),e.setAttribute("height",String(i.height)),e.style.aspectRatio=`${i.width} / ${i.height}`):e.style.aspectRatio="16 / 9",c.cover?(e.setAttribute("data-graview-video-cover",""),e.style.cssText+=";display:block;width:100%;height:100%;max-height:none;aspect-ratio:auto;object-fit:cover;background:#000"):e.style.cssText+=";display:block;width:100%;height:auto;max-height:80vh;background:#000;border-radius:var(--graview-radius, 8px)";let f=i.captions?g(i.captions):void 0;if(f){let o=r.createElement("track");o.setAttribute("kind","captions"),o.setAttribute("src",f),o.setAttribute("srclang","en"),o.setAttribute("label","Captions"),o.setAttribute("default",""),e.appendChild(o)}return i.duration===void 0&&e.addEventListener("loadedmetadata",()=>Number.isFinite(e.duration)&&e.duration>0&&e.setAttribute("aria-label",C({...i,duration:e.duration}))),e.setAttribute("src",m),l.appendChild(e),e}function S(r,l){let i=r.document,g=new Set,m=t=>{g.has(t)||(g.add(t),l.onProblem?.(t))},c=t=>{let a=l.file?l.file(t):t;if(a!==void 0)try{let s=new r.URL(a,i.baseURI);return s.origin===r.location.origin&&/^https?:$/.test(s.protocol)?a:void 0}catch{return}},e=new WeakMap,h=typeof r.matchMedia=="function"?r.matchMedia("(prefers-reduced-motion: reduce)"):void 0,f=new Set,o=(t,a)=>{a?(t.removeAttribute("autoplay"),t.setAttribute("data-graview-video-still",""),t.pause()):(t.removeAttribute("data-graview-video-still"),t.setAttribute("autoplay",""),t.setAttribute("preload","auto"),t.play?.()?.catch?.(()=>{}))},v=()=>{for(let t of f)t.isConnected?o(t,h?.matches===!0):f.delete(t)};h?.addEventListener?.("change",v);let p,k=t=>{if(typeof t.close=="function")return t.close();t.removeAttribute("open"),t.dispatchEvent(new r.Event("close"))},w=(t,a)=>m(`The ${t} in the view ${l.view} was not drawn: it ${a}.`);return{refresh(t){let a=l.shown();for(let s of Array.from(t.querySelectorAll("graview-video"))){let d=s.shadowRoot??s.attachShadow({mode:"open"});if(!l.pictures){e.delete(s),d.replaceChildren(),w("video",`asks for no pictures: a view places a record's video where its manifest says "pictures": true`);continue}let u=G(s,a,"video"),n={autoplay:s.hasAttribute("autoplay"),cover:s.hasAttribute("cover"),still:h?.matches===!0},b="file"in u?JSON.stringify([u.file,n.autoplay,n.cover]):"";if(e.get(s)===b&&d.childNodes.length>0)continue;if(e.set(s,b),d.replaceChildren(),"why"in u){w("video",u.why);continue}let A=c(u.file.href);if(!A){w("video",`names "${u.file.name}", which this host does not say it serves on this page`);continue}let $=i.createElement("style");$.textContent=":host { display: block; min-width: 0; }",d.appendChild($);let y=N(i,d,u.file,c,A,n);n.autoplay&&f.add(y)}},open(t){if(!l.pictures)return w("full-screen viewer",`asks for no pictures: a view opens a record's picture or video full screen where its manifest says "pictures": true`),!1;let a=G(t,l.shown(),"any");if("why"in a)return w("full-screen viewer",a.why),!1;let s=c(a.file.href);if(!s)return w("full-screen viewer",`names "${a.file.name}", which this host does not say it serves on this page`),!1;p&&k(p);let d=a.file,u=d.caption?.trim()||d.name,n=i.createElement("dialog");n.setAttribute("data-graview-lightbox",""),n.setAttribute("aria-label",E(d)?C(d):u),n.style.cssText="padding:0;border:0;border-radius:var(--graview-radius, 8px);max-width:min(96vw, 1600px);max-height:94vh;background:var(--graview-panel, Canvas);color:var(--graview-ink, CanvasText)";let b=i.createElement("figure");if(b.style.cssText="margin:0;display:grid;gap:8px;padding:10px",E(d))N(i,b,d,c,s);else{let x=i.createElement("img");x.setAttribute("src",s),x.setAttribute("alt",u),x.style.cssText="max-width:100%;max-height:80vh;object-fit:contain;display:block;margin:0 auto",b.appendChild(x)}let A=i.createElement("figcaption");A.style.cssText="display:flex;gap:12px;align-items:center;justify-content:space-between";let $=i.createElement("span");$.textContent=E(d)&&d.duration!==void 0?`${u} \xB7 ${P(d.duration)}`:u;let y=i.createElement("button");return y.type="button",y.textContent="Close",y.addEventListener("click",()=>k(n)),A.append($,y),b.appendChild(A),n.appendChild(b),n.addEventListener("click",x=>x.target===n&&k(n)),n.addEventListener("close",()=>{n.remove(),p===n&&(p=void 0),t.focus?.()}),i.body.appendChild(n),p=n,typeof n.showModal=="function"?n.showModal():n.setAttribute("open",""),y.focus(),!0},dispose(){p&&k(p),p?.remove(),p=void 0,h?.removeEventListener?.("change",v),f.clear()}}}export{S as createGuestMedia,G as namedFile};
1
+ import"./chunk.WVUJXDXZ.js";import{b as P}from"./chunk.DWM7AR5Y.js";import"./chunk.6KJGRM7A.js";import"./chunk.WALVW3KJ.js";import"./chunk.SNHKYH72.js";import"./chunk.UGQYMN4J.js";import"./chunk.RG5G6YQD.js";import"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import{Aa as E,Ba as L,xa as M,za as T}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function G(r,l,i){let g=r.getAttribute("data-record")??"",m=r.getAttribute("data-field")??"",c=Number(r.getAttribute("data-index")??"0"),e=[...l?.node?[l.node]:[],...l?.nodes??[]].find(p=>p.id===g);if(!g||!e)return{why:g?`names a record it was not shown ("${g.slice(0,80)}")`:"names no record (data-record)"};let h=m&&Object.hasOwn(e,m)?e[m]:void 0,f=(Array.isArray(h)?h:[h]).filter(M),o=Number.isInteger(c)&&c>=0?f[c]:void 0,v=e.label?`"${e.label}"`:"a record";return m?o?(i==="video"?!E(o):!E(o)&&!T(o))?{why:`names "${o.name}" on ${v}, which is not ${i==="video"?"a video":"a picture or a video"}`}:{file:o,on:e}:{why:f.length===0?`names "${m}" on ${v}, which holds no file it was shown`:`names file ${r.getAttribute("data-index")} of "${m}" on ${v}, which holds ${f.length}`}:{why:`names no field of ${v} (data-field)`}}var C=r=>`${r.caption?.trim()||r.name}, ${L(r)}`;function N(r,l,i,g,m,c={}){let e=r.createElement("video");e.setAttribute("data-graview-video",""),e.setAttribute("playsinline",""),e.setAttribute("aria-label",C(i)),c.autoplay?(e.setAttribute("data-graview-video-autoplay",""),e.setAttribute("muted",""),e.muted=!0,e.setAttribute("loop",""),e.setAttribute("preload",c.still?"metadata":"auto"),c.still?e.setAttribute("data-graview-video-still",""):e.setAttribute("autoplay","")):(e.setAttribute("controls",""),e.setAttribute("preload","metadata"));let h=i.poster?g(i.poster):void 0;h&&e.setAttribute("poster",h),i.width&&i.height?(e.setAttribute("width",String(i.width)),e.setAttribute("height",String(i.height)),e.style.aspectRatio=`${i.width} / ${i.height}`):e.style.aspectRatio="16 / 9",c.cover?(e.setAttribute("data-graview-video-cover",""),e.style.cssText+=";display:block;width:100%;height:100%;max-height:none;aspect-ratio:auto;object-fit:cover;background:#000"):e.style.cssText+=";display:block;width:100%;height:auto;max-height:80vh;background:#000;border-radius:var(--graview-radius, 8px)";let f=i.captions?g(i.captions):void 0;if(f){let o=r.createElement("track");o.setAttribute("kind","captions"),o.setAttribute("src",f),o.setAttribute("srclang","en"),o.setAttribute("label","Captions"),o.setAttribute("default",""),e.appendChild(o)}return i.duration===void 0&&e.addEventListener("loadedmetadata",()=>Number.isFinite(e.duration)&&e.duration>0&&e.setAttribute("aria-label",C({...i,duration:e.duration}))),e.setAttribute("src",m),l.appendChild(e),e}function S(r,l){let i=r.document,g=new Set,m=t=>{g.has(t)||(g.add(t),l.onProblem?.(t))},c=t=>{let a=l.file?l.file(t):t;if(a!==void 0)try{let s=new r.URL(a,i.baseURI);return s.origin===r.location.origin&&/^https?:$/.test(s.protocol)?a:void 0}catch{return}},e=new WeakMap,h=typeof r.matchMedia=="function"?r.matchMedia("(prefers-reduced-motion: reduce)"):void 0,f=new Set,o=(t,a)=>{a?(t.removeAttribute("autoplay"),t.setAttribute("data-graview-video-still",""),t.pause()):(t.removeAttribute("data-graview-video-still"),t.setAttribute("autoplay",""),t.setAttribute("preload","auto"),t.play?.()?.catch?.(()=>{}))},v=()=>{for(let t of f)t.isConnected?o(t,h?.matches===!0):f.delete(t)};h?.addEventListener?.("change",v);let p,k=t=>{if(typeof t.close=="function")return t.close();t.removeAttribute("open"),t.dispatchEvent(new r.Event("close"))},w=(t,a)=>m(`The ${t} in the view ${l.view} was not drawn: it ${a}.`);return{refresh(t){let a=l.shown();for(let s of Array.from(t.querySelectorAll("graview-video"))){let d=s.shadowRoot??s.attachShadow({mode:"open"});if(!l.pictures){e.delete(s),d.replaceChildren(),w("video",`asks for no pictures: a view places a record's video where its manifest says "pictures": true`);continue}let u=G(s,a,"video"),n={autoplay:s.hasAttribute("autoplay"),cover:s.hasAttribute("cover"),still:h?.matches===!0},b="file"in u?JSON.stringify([u.file,n.autoplay,n.cover]):"";if(e.get(s)===b&&d.childNodes.length>0)continue;if(e.set(s,b),d.replaceChildren(),"why"in u){w("video",u.why);continue}let A=c(u.file.href);if(!A){w("video",`names "${u.file.name}", which this host does not say it serves on this page`);continue}let $=i.createElement("style");$.textContent=":host { display: block; min-width: 0; }",d.appendChild($);let y=N(i,d,u.file,c,A,n);n.autoplay&&f.add(y)}},open(t){if(!l.pictures)return w("full-screen viewer",`asks for no pictures: a view opens a record's picture or video full screen where its manifest says "pictures": true`),!1;let a=G(t,l.shown(),"any");if("why"in a)return w("full-screen viewer",a.why),!1;let s=c(a.file.href);if(!s)return w("full-screen viewer",`names "${a.file.name}", which this host does not say it serves on this page`),!1;p&&k(p);let d=a.file,u=d.caption?.trim()||d.name,n=i.createElement("dialog");n.setAttribute("data-graview-lightbox",""),n.setAttribute("aria-label",E(d)?C(d):u),n.style.cssText="padding:0;border:0;border-radius:var(--graview-radius, 8px);max-width:min(96vw, 1600px);max-height:94vh;background:var(--graview-panel, Canvas);color:var(--graview-ink, CanvasText)";let b=i.createElement("figure");if(b.style.cssText="margin:0;display:grid;gap:8px;padding:10px",E(d))N(i,b,d,c,s);else{let x=i.createElement("img");x.setAttribute("src",s),x.setAttribute("alt",u),x.style.cssText="max-width:100%;max-height:80vh;object-fit:contain;display:block;margin:0 auto",b.appendChild(x)}let A=i.createElement("figcaption");A.style.cssText="display:flex;gap:12px;align-items:center;justify-content:space-between";let $=i.createElement("span");$.textContent=E(d)&&d.duration!==void 0?`${u} \xB7 ${P(d.duration)}`:u;let y=i.createElement("button");return y.type="button",y.textContent="Close",y.addEventListener("click",()=>k(n)),A.append($,y),b.appendChild(A),n.appendChild(b),n.addEventListener("click",x=>x.target===n&&k(n)),n.addEventListener("close",()=>{n.remove(),p===n&&(p=void 0),t.focus?.()}),i.body.appendChild(n),p=n,typeof n.showModal=="function"?n.showModal():n.setAttribute("open",""),y.focus(),!0},dispose(){p&&k(p),p?.remove(),p=void 0,h?.removeEventListener?.("change",v),f.clear()}}}export{S as createGuestMedia,G as namedFile};
@@ -1 +1 @@
1
- import{a as _}from"./chunk.64FCAUAJ.js";import{a as x,c as ce,d as ge,f as he,h as be,i as we,j as Se}from"./chunk.NBVPWLRY.js";import{a as se,b as le,c as ue,d as fe,e as L,f as I,g as ye}from"./chunk.SPCAMQJE.js";import{a as me}from"./chunk.TUCSUZNO.js";import{c as T,e as de,f as pe}from"./chunk.ZMWAZACO.js";import{a as j,b as re,c as te,d as oe,f as G,m as ae,n as b,o as V,p as B,q as v,r as ie}from"./chunk.CD6YWH6T.js";import{$b as ne,Aa as q,Ba as O,C as P,Ca as M,Ka as Q,L as K,W as z,Z as F,_b as ee,ac as C,da as J,ha as X,la as Z,ra as N,ta as Y,ya as E,za as A}from"./chunk.J24YPQ5I.js";var Re=e=>e.caption?.trim()||e.name,D=e=>A(e)?`${Re(e)}, ${q(e)}`:Re(e);function dn(e){let n=Math.max(0,Math.round(e)),t=a=>String(a).padStart(2,"0"),r=Math.floor(n/3600),o=Math.floor(n%3600/60);return r>0?`${r}:${t(o)}:${t(n%60)}`:`${o}:${t(n%60)}`}function Ne(e){let n=e?.fields?.shape??{};return Object.keys(n).filter(t=>{let r=P(n[t]);for(;r?.innerType;)r=P(r.innerType);return M(n[t])!==void 0||r?.type==="array"&&M(r.element)!==void 0})}function sn(e,n){for(let t of Ne(n)){let r=O(e[t]).find(o=>E(o)||A(o));if(r)return r}}var k=e=>{try{return e()}catch{return null}},Ee=e=>typeof e=="string"&&se.includes(e);function Me(e){if(e!==void 0)return Ee(e)?e:e&&typeof e=="object"&&typeof e.expr=="string"?{expr:k(()=>T(e.expr))}:"neutral"}var Ce=4;function Ve(e){let n=typeof e.list=="string"?k(()=>T(e.list)):null,t=e.sort,r=typeof t=="string"?t:t&&typeof t=="object"&&typeof t.by=="string"?t.by:void 0,o=t&&typeof t=="object"?t.direction:void 0,a=n,d;if(n&&r!==void 0)if(o==="choices")d=r;else{let y=k(()=>T(r));a=y?{t:"call",fn:"sort",args:[n,y,{t:"lit",value:o==="desc"?"desc":"asc",at:0}],at:0}:null}let l=typeof e.limit=="number"&&Number.isInteger(e.limit)&&e.limit>=1?Math.min(e.limit,L):void 0,i=e.group,s=typeof i=="string"?i:i&&typeof i=="object"&&typeof i.by=="string"?i.by:void 0,f=i&&typeof i=="object"&&i.headings&&typeof i.headings=="object"?i.headings:{};return{t:"list",source:a,...d?{choiceOrder:d}:{},...l?{limit:l}:{},...s?{group:{by:s,headings:Object.fromEntries(Object.entries(f).filter(y=>typeof y[1]=="string"))}}:{},...typeof e.empty=="string"?{empty:e.empty}:{},as:e.as==="card"?"card":"row"}}function ke(e,n=1,t=""){if(!Array.isArray(e)||n>Ce)return[];let r={};return e.flatMap(o=>{if(!o||typeof o!="object"||Array.isArray(o))return[];let a=o,d=p=>typeof p=="string"?k(()=>de(p)):null,l=p=>typeof p=="string"?k(()=>T(p)):null,i=Me(a.tone),s=typeof a.label=="string"?a.label:void 0,f=p=>Object.hasOwn(a,p),y=typeof a.currency=="string"&&/^[A-Z]{3}$/.test(a.currency)?a.currency:void 0,u=f("list")?"list":f("headline")?"headline":typeof a.figure=="string"?"number":Le.find(f);if(!u)return[];let m=r[u]=(r[u]??0)+1,c=a.key,R=typeof c=="string"&&c?c:`${t}${u}.${m}`;return[{...(()=>{switch(u){case"list":return Ve(a);case"number":{let p=ue.includes(a.as)?a.as:void 0,H=fe.includes(a.emphasis)?a.emphasis:void 0;return{t:u,value:l(a.figure),...p?{as:p}:{},...y?{currency:y}:{},...s?{label:d(s)}:{},...H?{emphasis:H}:{}}}case"headline":case"title":return{t:u,parts:d(a[u])};case"text":{let p=a.lines;return{t:u,parts:d(a[u]),...i?{tone:i}:{},...typeof p=="number"&&Number.isInteger(p)&&p>=0?{lines:p}:{}}}case"badge":return{t:u,parts:d(a[u]),...i?{tone:i}:{}};case"field":{let p=le.includes(a.as)?a.as:void 0;return{t:u,field:String(a.field),...p?{as:p}:{},...y?{currency:y}:{},...s?{label:s}:{}}}case"image":return{t:u,field:String(a.image),as:a.as==="gallery"?"gallery":"thumb",...s?{label:s}:{}};case"progress":{let p=a.progress??{};return{t:u,value:l(p.value),max:l(p.max),...s?{label:d(s)}:{}}}case"group":return{t:u,blocks:ke(a.group,n+1,`${R}.`),direction:a.direction==="row"?"row":"column"};case"when":return{t:u,when:l(a.when),show:ke(a.show,n+1,`${R}.`)};default:return{t:u}}})(),key:R}]})}var Le=["title","text","badge","field","image","progress","group","when","divider","figure"],g="\u2014",Ie=500;function w(e,n){if(!e)return{ok:!1,problem:"an expression that does not parse"};try{return{ok:!0,value:G(e,{graph:n.graph??ae,subject:n.node,kinds:n.kinds,today:n.today,budget:n.budget??Ie})}}catch(t){return{ok:!1,problem:t instanceof Error?t.message:String(t)}}}function _e(e,n){let t=e.definition?.display?.format?.[n],r=e.fields[n]?.options??[];return t?Object.fromEntries(r.flatMap(o=>{let a=t(o);return a!==X(o)?[[o,a]]:[]})):{}}var De=(e,n,t)=>!e.format&&e.expr?.t==="ident"&&typeof t=="string"&&n.fields[e.expr.name]?.format==="markdown";function S(e,n,t){if(!e)return{text:g,problem:"a template that does not parse"};let r,o;return{text:e.map(d=>{if(d.text!==void 0)return d.text;let l=w(d.expr??null,n);if(!l.ok)return r??=`{${d.source??""}}: ${l.problem}`,g;if(De(d,n,l.value))return n.glance?ce(l.value,{markdown:!0}):t&&e.length===1?(o=!0,l.value):ge(l.value);let i=!d.format&&d.expr?.t==="ident"&&n.fields[d.expr.name]?.type==="enum"?d.expr.name:void 0;if(i&&(typeof l.value=="string"||Array.isArray(l.value)))return V(d,ie(l.value,_e(n,i),e.length===1));let s=!d.format&&d.expr?.t==="ident"&&typeof l.value=="number"?Be(n,d.expr.name):void 0;return V(d,s?C(l.value,s):b(l.value,d.format,n.today,d.formatArgs,n.money,v(n.schema)))}).join(""),...r?{problem:r}:{},...o?{markdown:o}:{}}}var $e=" \xB7 ";function Ue(e,n){if(!e||!n.node)return;let t=[[]];for(let d of e){if(d.text===void 0){t[t.length-1].push(d);continue}d.text.split($e).forEach((i,s)=>{s>0&&t.push([]),i!==""&&t[t.length-1].push({text:i})})}if(t.length<2)return;let r=d=>{let[l]=d;if(!(d.length!==1||!l||l.format||l.expr?.t!=="ident"))return n.fields[l.expr.name]?.type==="enum"?l.expr.name:void 0},o=0,a=t.flatMap(d=>{let l=r(d);if(l){let s=Object.hasOwn(n.node,l)?n.node[l]:void 0;return s==null||s===""?[]:(o++,[{text:x(n.definition,l,s),field:l}])}let i=S(d,n).text.trim();return i===""||i===g?[]:[{text:i}]});return o>0?a:void 0}function Ae(e,n){if(e===void 0)return;if(typeof e=="string")return e;let t=w(e.expr,n);return t.ok&&Ee(t.value)?t.value:"neutral"}function We(e){if(typeof e=="string")try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"?n.href:void 0}catch{return}}var Ge=(e,n)=>{let t=e.fields[n]?.type;return t==="phone"||t==="place"||t==="duration"?t:be(e.definition,n)},Be=(e,n)=>ee(e.definition?.fields?.shape?.[n])??he(e.definition,n);function He(e,n,t,r,o){if(n==null||n==="")return g;if(typeof n=="boolean")return n?"yes":"no";if(r)return b(n,r,t.today,[],o?{...t.money,currency:o}:t.money);let a=t.fields[e];if(t.definition?.display?.format?.[e])return x(t.definition,e,n);let d=we(Ge(t,e),n,t.money?.locale);if(d!==void 0)return d;if(a?.type==="date")return b(n,"date",t.today,[],t.money);if(a?.type==="datetime"&&typeof n=="string")return z(n,t.money?.locale,t.money?.timeZone);if(a?.type==="enum"&&(typeof n=="string"||Array.isArray(n)))return x(t.definition,e,n);let l=typeof n=="number"?Be(t,e):void 0;if(l)return C(n,l);if(typeof n=="number")return F(n,t.money?.locale,{});let i=O(n);return i[0]?i.map(D).join(", "):Array.isArray(n)?n.map(s=>String(s)).join(", "):typeof n=="object"?g:String(n)}function Ke(e,n,t,r,o){return typeof e!="number"?String(e):n==="money"?ne(e,t?{...o,currency:t}:o):n==="percent"?b(e,n,r,[],o):F(e,o?.locale)}var h=(e,n)=>n?{...e,problem:n}:e;function Oe(e){return e.firstHeading===void 0?e:{...e,firstHeading:void 0}}function ze(e,n,t){switch(e.t){case"title":{let r=S(e.parts,n);return h({t:"title",text:r.text},r.problem)}case"text":{let r=S(e.parts,n,!0),o=Ae(e.tone,n),a=n.glance&&!r.problem?Ue(e.parts,n):void 0;return h({t:"text",text:r.text,...o?{tone:o}:{},...e.lines!==void 0?{lines:e.lines}:{},...r.markdown?{markdown:r.markdown}:{},...a?{runs:a}:{}},r.problem)}case"badge":{let r=S(e.parts,n);return h({t:"badge",text:r.text,tone:Ae(e.tone,n)??"neutral"},r.problem)}case"field":{let r=e.label??N(n.definition,e.field);if(!n.node)return{t:"field",field:e.field,label:r,text:g,problem:`"${e.field}" names a field, and these blocks are about no one record`};let o=e.as===void 0?n.kinds.get(n.node.kind)?.linked?.get(e.field):void 0;if(o){let y=Q(Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0,o);return{t:"field",field:e.field,label:r,text:y.length>0?"linked record":g,...y.length>0?{linked:{relation:o,refs:y}}:{}}}let a=n.kinds.get(n.node.kind)?.computed?.has(e.field),d,l;if(a){let y=w({t:"ident",name:e.field,at:0},n);y.ok?d=y.value!==null&&typeof y.value=="object"?b(y.value,void 0,n.today,[],n.money,v(n.schema)):y.value:l=y.problem}else d=Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0;let i=e.as!==void 0?void 0:n.fields[e.field]?.type==="url"?We(d):Se(Ge(n,e.field),d),s=k(()=>He(e.field,d,n,e.as,e.currency))??g,f=n.fields[e.field]?.type==="app-link"&&e.as===void 0&&typeof d=="string"?d:void 0;return h({t:"field",field:e.field,label:r,text:s,...i?{href:i}:{},...f?{app:f}:{}},l)}case"image":{let r=O(n.node&&Object.hasOwn(n.node,e.field)?n.node[e.field]:null),o=e.as==="gallery"?r:r.filter(a=>E(a)||A(a)).slice(0,1);return{t:"image",field:e.field,label:e.label??N(n.definition,e.field),as:e.as,files:o,text:o.map(D).join(", ")||g}}case"progress":{let r=w(e.value,n),o=w(e.max,n),a=e.label?S(e.label,n):{text:"Progress"},d=e.label?B(e.label,a.text):a.text,l=r.ok?o.ok?a.problem:o.problem:r.problem;return r.ok&&o.ok&&typeof r.value=="number"&&typeof o.value=="number"&&Number.isFinite(r.value)&&Number.isFinite(o.value)&&o.value>0?h({t:"progress",label:d,value:r.value,max:o.value,text:`${b(r.value,void 0,n.today)} of ${b(o.value,void 0,n.today)}`},l):h({t:"progress",label:d,text:g},l)}case"group":return{t:"group",direction:e.direction,blocks:je(e.blocks,Oe(n))};case"when":{let r=w(e.when,n),o=r.ok&&r.value===!0;return h({t:"when",shown:o,blocks:o?je(e.show,Oe(n)):[]},r.ok?void 0:r.problem)}case"divider":return{t:"divider"};case"figure":return{t:"figure"};case"headline":{let r=S(e.parts,n),o=Math.min(6,Math.max(1,(t?n.firstHeading:void 0)??n.heading??3));return h({t:"headline",level:o,text:e.parts?B(e.parts,r.text):r.text},r.problem)}case"number":{let r=w(e.value,n),o=!r.ok||r.value===null||typeof r.value=="object"?g:Ke(r.value,e.as,e.currency,n.today,n.money),a=e.label?S(e.label,n):void 0;return h({t:"number",text:o,...a&&e.label?{label:B(e.label,a.text)}:{},...e.emphasis?{emphasis:e.emphasis}:{}},r.ok?a?.problem:r.problem)}case"list":return Xe(e,n)}}function je(e,n){let t=e.findIndex(r=>r.t==="headline");return e.map((r,o)=>({...ze(r,n,o===t),key:r.key}))}function Te(e,n){let t=n.trim().toLowerCase();return e.some(r=>{switch(r.t){case"title":case"headline":return r.text.trim()!=="";case"text":case"badge":return t!==""&&r.text.toLowerCase().includes(t);case"group":return Te(r.blocks,n);case"when":return r.shown&&Te(r.blocks,n);default:return!1}})}var Je=new Set(["every","some","sum","min","max","sort"]);function Gn(e,n){let t=new Set,r=new Set,o=i=>{if(i)switch(i.t){case"ident":t.add(i.name);return;case"list":i.items.forEach(o);return;case"member":return o(i.object);case"unary":return o(i.operand);case"binary":return o(i.left),o(i.right);case"where":return o(i.set);case"call":i.args.forEach((s,f)=>{f===1&&Je.has(i.fn)||o(s)});return;default:return}},a=i=>{for(let s of i??[])o(s.expr)},d=(i,s)=>{i.forEach((f,y)=>{let u=s[y];if(u)switch(f.t){case"field":case"image":t.add(f.field);return;case"title":case"text":case"badge":case"headline":a(f.parts);return;case"number":o(f.value),a(f.label);return;case"progress":o(f.value),o(f.max);return;case"group":u.t==="group"&&d(f.blocks,u.blocks);return;case"when":u.t==="when"&&u.shown&&d(f.show,u.blocks);return;case"list":if(u.t==="list")for(let m of u.members)r.add(m.id);return;default:return}})};d(e,n);let l=n[0];return{fields:t,records:r,...e[0]?.t==="title"&&l?.t==="title"?{title:l.text}:{}}}function Xe(e,n){let t=Math.min(6,(n.heading??3)+1),r=w(e.source,n);if(!r.ok)return{t:"list",as:e.as,failed:!0,members:[],headingLevel:t,more:0,problem:r.problem};let o=r.value,a=o instanceof j?o.nodes:o!==null&&typeof o=="object"&&!Array.isArray(o)?[o]:[];e.choiceOrder&&n.schema&&(a=Ze(a,e.choiceOrder,n.schema));let d=a.length,l=a.slice(0,e.limit??L),i=l.slice(0,I),s=l.slice(I),f=(e.limit===void 0?d:l.length)-i.length,y=c=>e.group&&n.schema&&c.length>0?Ye(c,e.group,n.schema,n.graph):void 0,u=y(i),m=s.length>0?y(l):void 0;return{t:"list",as:e.as,failed:!1,members:i,...s.length>0?{rest:s}:{},...u?{groups:u}:{},...m?{everyGroup:m}:{},headingLevel:t,...i.length===0&&e.empty?{empty:e.empty}:{},more:f,total:d}}function $(e,n,t){let r=e.tryDefinition(n)?.fields?.shape,o=r&&Object.hasOwn(r,t)?_(r[t]):void 0;return o?.type==="enum"?o.options??[]:[]}var U=(e,n)=>Object.hasOwn(e,n)?e[n]:void 0;function Ze(e,n,t){let r=o=>{let a=$(t,o.kind,n).indexOf(String(U(o,n)));return a<0?Number.MAX_SAFE_INTEGER:a};return e.map((o,a)=>({node:o,i:a,rank:r(o)})).sort((o,a)=>o.rank-a.rank||o.i-a.i).map(o=>o.node)}function Ye(e,n,t,r){let o=e.some(i=>$(t,i.kind,n.by).length>0)?void 0:ye(n.by);if(o&&r)return qe(e,o,n.headings,t,r);let a=[];for(let i of e)for(let s of $(t,i.kind,n.by))a.includes(s)||a.push(s);let d=[];for(let i of a){let s=e.filter(y=>U(y,n.by)===i);if(s.length===0)continue;let f=t.tryDefinition(s[0].kind);d.push({value:i,heading:n.headings[i]??J(x(f,n.by,i)),members:s})}let l=e.filter(i=>!a.includes(String(U(i,n.by))));return l.length>0&&d.push({value:null,members:l}),d}function qe(e,n,t,r,o){let a=u=>n.way??(Object.hasOwn(r.tryDefinition(u.kind)?.edges??{},n.edge)?"out":"in"),d=new Map,l=[],i=v(r),s;for(let u of e){let m=a(u)==="out"?o.out(u.id,n.edge):o.in(u.id,n.edge);m.length===0&&l.push(u);for(let c of m){s??=c.kind;let R=d.get(c.id)??{node:c,members:[]};R.members.push(u),d.set(c.id,R)}}let f=[...d.values()].map(({node:u,members:m})=>({value:u.id,heading:t[u.id]??i(u),members:m})).sort((u,m)=>u.heading.localeCompare(m.heading,void 0,{numeric:!0}));!s&&e[0]&&a(e[0])==="out"&&(s=(r.tryDefinition(e[0].kind)?.edges??{})[n.edge]?.to?.[0]);let y=s&&s!=="*"?Y(r.tryDefinition(s),s):void 0;return l.length>0&&f.push({value:null,...y?{heading:`No ${y}`}:{},members:l}),f}function xe(e){return e.t==="list"||e.t==="headline"||e.t==="number"||e.t==="image"&&e.as==="gallery"?!0:e.t==="group"?e.blocks.some(xe):e.t==="when"?e.show.some(xe):!1}function ve(e,n){let t=e.tryDefinition(n)?.fields?.shape??{},r={};for(let[o,a]of Object.entries(t)){let d=_(a);d&&(r[o]=d)}return r}var Pe=new WeakMap;function W(e){let n=Pe.get(e);return n||Pe.set(e,n=me(e)),n}function Qe(e,n,t,r={}){let o=W(e),a={},d={},l=i=>{if(i instanceof j)return i.nodes.map(s=>l(s));if(Array.isArray(i))return i.map(s=>l(s));if(i!==null&&typeof i=="object"){let s=i;return{id:s.id,kind:s.kind,label:Z(e.tryDefinition(s.kind),s)}}return i};for(let[i,s]of o.get(t?t.kind:te)?.computed??[])try{let f=[],y=G(s,{graph:n,subject:t,kinds:o,...r.today?{today:r.today}:{},...r.budget?{budget:r.budget}:{},...r.linked?{linked:r.linked}:{},onUnread:u=>f.push(u)});f.length>0&&(y===null||y instanceof j&&y.nodes.length===0)?d[i]=re(f[0]):a[i]=l(y)}catch(f){if(!(f instanceof oe))throw f;d[i]=f.sentence}return{values:a,refused:d}}function Mn(e,n,t){let{values:r}=Qe(e,n,t);if(Object.keys(r).length===0)return t;let o=a=>Array.isArray(a)?a.map(o):a!==null&&typeof a=="object"?a.label:a;return{...t,...Object.fromEntries(Object.entries(r).map(([a,d])=>[a,o(d)]))}}function Cn(e,n){return[...pe(e.tryDefinition(n)).keys()]}var en=500,nn=2e4,Fe=new WeakMap;function rn(e,n){let t=Fe.get(e);t||Fe.set(e,t=new Map);let r=t.get(n);return r||t.set(n,r=ve(e,n)),r}function Dn(e,n,t,r={}){if(n&&typeof e.seenBy!="function")throw new TypeError("blockContextFor: a seat is read from a store (its `seenBy`); a bare { graph, schema } is read as it is handed, with no principal");let o=n?e.seenBy(n):e,a=n&&t?o.graph.getNode(t.id)??null:t,d=o.schema,l=a&&d.tryDefinition(a.kind),i=!a||(r.slot??"page")==="page",{money:s,firstHeading:f}=r;return{node:a,graph:o.graph,schema:d,kinds:W(d),fields:a?rn(d,a.kind):{},definition:l||void 0,today:r.today??o.today?.()??K(s?.timeZone),money:s,heading:r.heading??(i?2:3),firstHeading:f,budget:r.budget??(i?nn:en),...i?{}:{glance:!0}}}export{Re as a,dn as b,Ne as c,sn as d,ke as e,je as f,Te as g,Gn as h,xe as i,W as j,Qe as k,Mn as l,Cn as m,Dn as n};
1
+ import{a as _}from"./chunk.6KJGRM7A.js";import{a as se,b as le,c as ue,d as fe,e as L,f as I,g as ye}from"./chunk.WALVW3KJ.js";import{a as me}from"./chunk.SNHKYH72.js";import{c as T,e as de,f as pe}from"./chunk.UGQYMN4J.js";import{a as j,b as re,c as te,d as oe,f as G,m as ae,n as b,o as V,p as B,q as v,r as ie}from"./chunk.RG5G6YQD.js";import{a as x,c as ce,d as ge,f as he,h as be,i as we,j as Se}from"./chunk.JQ63N4MZ.js";import{$b as ee,Aa as A,Ba as q,C as P,Ca as O,Da as M,L as K,La as Q,W as z,Z as F,ac as ne,bc as C,da as J,ha as X,la as Z,ra as N,ua as Y,za as E}from"./chunk.ZEZUKRC6.js";var Re=e=>e.caption?.trim()||e.name,D=e=>A(e)?`${Re(e)}, ${q(e)}`:Re(e);function dn(e){let n=Math.max(0,Math.round(e)),t=a=>String(a).padStart(2,"0"),r=Math.floor(n/3600),o=Math.floor(n%3600/60);return r>0?`${r}:${t(o)}:${t(n%60)}`:`${o}:${t(n%60)}`}function Ne(e){let n=e?.fields?.shape??{};return Object.keys(n).filter(t=>{let r=P(n[t]);for(;r?.innerType;)r=P(r.innerType);return M(n[t])!==void 0||r?.type==="array"&&M(r.element)!==void 0})}function sn(e,n){for(let t of Ne(n)){let r=O(e[t]).find(o=>E(o)||A(o));if(r)return r}}var k=e=>{try{return e()}catch{return null}},Ee=e=>typeof e=="string"&&se.includes(e);function Me(e){if(e!==void 0)return Ee(e)?e:e&&typeof e=="object"&&typeof e.expr=="string"?{expr:k(()=>T(e.expr))}:"neutral"}var Ce=4;function Ve(e){let n=typeof e.list=="string"?k(()=>T(e.list)):null,t=e.sort,r=typeof t=="string"?t:t&&typeof t=="object"&&typeof t.by=="string"?t.by:void 0,o=t&&typeof t=="object"?t.direction:void 0,a=n,d;if(n&&r!==void 0)if(o==="choices")d=r;else{let y=k(()=>T(r));a=y?{t:"call",fn:"sort",args:[n,y,{t:"lit",value:o==="desc"?"desc":"asc",at:0}],at:0}:null}let l=typeof e.limit=="number"&&Number.isInteger(e.limit)&&e.limit>=1?Math.min(e.limit,L):void 0,i=e.group,s=typeof i=="string"?i:i&&typeof i=="object"&&typeof i.by=="string"?i.by:void 0,f=i&&typeof i=="object"&&i.headings&&typeof i.headings=="object"?i.headings:{};return{t:"list",source:a,...d?{choiceOrder:d}:{},...l?{limit:l}:{},...s?{group:{by:s,headings:Object.fromEntries(Object.entries(f).filter(y=>typeof y[1]=="string"))}}:{},...typeof e.empty=="string"?{empty:e.empty}:{},as:e.as==="card"?"card":"row"}}function ke(e,n=1,t=""){if(!Array.isArray(e)||n>Ce)return[];let r={};return e.flatMap(o=>{if(!o||typeof o!="object"||Array.isArray(o))return[];let a=o,d=p=>typeof p=="string"?k(()=>de(p)):null,l=p=>typeof p=="string"?k(()=>T(p)):null,i=Me(a.tone),s=typeof a.label=="string"?a.label:void 0,f=p=>Object.hasOwn(a,p),y=typeof a.currency=="string"&&/^[A-Z]{3}$/.test(a.currency)?a.currency:void 0,u=f("list")?"list":f("headline")?"headline":typeof a.figure=="string"?"number":Le.find(f);if(!u)return[];let m=r[u]=(r[u]??0)+1,c=a.key,R=typeof c=="string"&&c?c:`${t}${u}.${m}`;return[{...(()=>{switch(u){case"list":return Ve(a);case"number":{let p=ue.includes(a.as)?a.as:void 0,H=fe.includes(a.emphasis)?a.emphasis:void 0;return{t:u,value:l(a.figure),...p?{as:p}:{},...y?{currency:y}:{},...s?{label:d(s)}:{},...H?{emphasis:H}:{}}}case"headline":case"title":return{t:u,parts:d(a[u])};case"text":{let p=a.lines;return{t:u,parts:d(a[u]),...i?{tone:i}:{},...typeof p=="number"&&Number.isInteger(p)&&p>=0?{lines:p}:{}}}case"badge":return{t:u,parts:d(a[u]),...i?{tone:i}:{}};case"field":{let p=le.includes(a.as)?a.as:void 0;return{t:u,field:String(a.field),...p?{as:p}:{},...y?{currency:y}:{},...s?{label:s}:{}}}case"image":return{t:u,field:String(a.image),as:a.as==="gallery"?"gallery":"thumb",...s?{label:s}:{}};case"progress":{let p=a.progress??{};return{t:u,value:l(p.value),max:l(p.max),...s?{label:d(s)}:{}}}case"group":return{t:u,blocks:ke(a.group,n+1,`${R}.`),direction:a.direction==="row"?"row":"column"};case"when":return{t:u,when:l(a.when),show:ke(a.show,n+1,`${R}.`)};default:return{t:u}}})(),key:R}]})}var Le=["title","text","badge","field","image","progress","group","when","divider","figure"],g="\u2014",Ie=500;function w(e,n){if(!e)return{ok:!1,problem:"an expression that does not parse"};try{return{ok:!0,value:G(e,{graph:n.graph??ae,subject:n.node,kinds:n.kinds,today:n.today,budget:n.budget??Ie})}}catch(t){return{ok:!1,problem:t instanceof Error?t.message:String(t)}}}function _e(e,n){let t=e.definition?.display?.format?.[n],r=e.fields[n]?.options??[];return t?Object.fromEntries(r.flatMap(o=>{let a=t(o);return a!==X(o)?[[o,a]]:[]})):{}}var De=(e,n,t)=>!e.format&&e.expr?.t==="ident"&&typeof t=="string"&&n.fields[e.expr.name]?.format==="markdown";function S(e,n,t){if(!e)return{text:g,problem:"a template that does not parse"};let r,o;return{text:e.map(d=>{if(d.text!==void 0)return d.text;let l=w(d.expr??null,n);if(!l.ok)return r??=`{${d.source??""}}: ${l.problem}`,g;if(De(d,n,l.value))return n.glance?ce(l.value,{markdown:!0}):t&&e.length===1?(o=!0,l.value):ge(l.value);let i=!d.format&&d.expr?.t==="ident"&&n.fields[d.expr.name]?.type==="enum"?d.expr.name:void 0;if(i&&(typeof l.value=="string"||Array.isArray(l.value)))return V(d,ie(l.value,_e(n,i),e.length===1));let s=!d.format&&d.expr?.t==="ident"&&typeof l.value=="number"?Be(n,d.expr.name):void 0;return V(d,s?C(l.value,s):b(l.value,d.format,n.today,d.formatArgs,n.money,v(n.schema)))}).join(""),...r?{problem:r}:{},...o?{markdown:o}:{}}}var $e=" \xB7 ";function Ue(e,n){if(!e||!n.node)return;let t=[[]];for(let d of e){if(d.text===void 0){t[t.length-1].push(d);continue}d.text.split($e).forEach((i,s)=>{s>0&&t.push([]),i!==""&&t[t.length-1].push({text:i})})}if(t.length<2)return;let r=d=>{let[l]=d;if(!(d.length!==1||!l||l.format||l.expr?.t!=="ident"))return n.fields[l.expr.name]?.type==="enum"?l.expr.name:void 0},o=0,a=t.flatMap(d=>{let l=r(d);if(l){let s=Object.hasOwn(n.node,l)?n.node[l]:void 0;return s==null||s===""?[]:(o++,[{text:x(n.definition,l,s),field:l}])}let i=S(d,n).text.trim();return i===""||i===g?[]:[{text:i}]});return o>0?a:void 0}function Ae(e,n){if(e===void 0)return;if(typeof e=="string")return e;let t=w(e.expr,n);return t.ok&&Ee(t.value)?t.value:"neutral"}function We(e){if(typeof e=="string")try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"?n.href:void 0}catch{return}}var Ge=(e,n)=>{let t=e.fields[n]?.type;return t==="phone"||t==="place"||t==="duration"?t:be(e.definition,n)},Be=(e,n)=>ee(e.definition?.fields?.shape?.[n])??he(e.definition,n);function He(e,n,t,r,o){if(n==null||n==="")return g;if(typeof n=="boolean")return n?"yes":"no";if(r)return b(n,r,t.today,[],o?{...t.money,currency:o}:t.money);let a=t.fields[e];if(t.definition?.display?.format?.[e])return x(t.definition,e,n);let d=we(Ge(t,e),n,t.money?.locale);if(d!==void 0)return d;if(a?.type==="date")return b(n,"date",t.today,[],t.money);if(a?.type==="datetime"&&typeof n=="string")return z(n,t.money?.locale,t.money?.timeZone);if(a?.type==="enum"&&(typeof n=="string"||Array.isArray(n)))return x(t.definition,e,n);let l=typeof n=="number"?Be(t,e):void 0;if(l)return C(n,l);if(typeof n=="number")return F(n,t.money?.locale,{});let i=O(n);return i[0]?i.map(D).join(", "):Array.isArray(n)?n.map(s=>String(s)).join(", "):typeof n=="object"?g:String(n)}function Ke(e,n,t,r,o){return typeof e!="number"?String(e):n==="money"?ne(e,t?{...o,currency:t}:o):n==="percent"?b(e,n,r,[],o):F(e,o?.locale)}var h=(e,n)=>n?{...e,problem:n}:e;function Oe(e){return e.firstHeading===void 0?e:{...e,firstHeading:void 0}}function ze(e,n,t){switch(e.t){case"title":{let r=S(e.parts,n);return h({t:"title",text:r.text},r.problem)}case"text":{let r=S(e.parts,n,!0),o=Ae(e.tone,n),a=n.glance&&!r.problem?Ue(e.parts,n):void 0;return h({t:"text",text:r.text,...o?{tone:o}:{},...e.lines!==void 0?{lines:e.lines}:{},...r.markdown?{markdown:r.markdown}:{},...a?{runs:a}:{}},r.problem)}case"badge":{let r=S(e.parts,n);return h({t:"badge",text:r.text,tone:Ae(e.tone,n)??"neutral"},r.problem)}case"field":{let r=e.label??N(n.definition,e.field);if(!n.node)return{t:"field",field:e.field,label:r,text:g,problem:`"${e.field}" names a field, and these blocks are about no one record`};let o=e.as===void 0?n.kinds.get(n.node.kind)?.linked?.get(e.field):void 0;if(o){let y=Q(Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0,o);return{t:"field",field:e.field,label:r,text:y.length>0?"linked record":g,...y.length>0?{linked:{relation:o,refs:y}}:{}}}let a=n.kinds.get(n.node.kind)?.computed?.has(e.field),d,l;if(a){let y=w({t:"ident",name:e.field,at:0},n);y.ok?d=y.value!==null&&typeof y.value=="object"?b(y.value,void 0,n.today,[],n.money,v(n.schema)):y.value:l=y.problem}else d=Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0;let i=e.as!==void 0?void 0:n.fields[e.field]?.type==="url"?We(d):Se(Ge(n,e.field),d),s=k(()=>He(e.field,d,n,e.as,e.currency))??g,f=n.fields[e.field]?.type==="app-link"&&e.as===void 0&&typeof d=="string"?d:void 0;return h({t:"field",field:e.field,label:r,text:s,...i?{href:i}:{},...f?{app:f}:{}},l)}case"image":{let r=O(n.node&&Object.hasOwn(n.node,e.field)?n.node[e.field]:null),o=e.as==="gallery"?r:r.filter(a=>E(a)||A(a)).slice(0,1);return{t:"image",field:e.field,label:e.label??N(n.definition,e.field),as:e.as,files:o,text:o.map(D).join(", ")||g}}case"progress":{let r=w(e.value,n),o=w(e.max,n),a=e.label?S(e.label,n):{text:"Progress"},d=e.label?B(e.label,a.text):a.text,l=r.ok?o.ok?a.problem:o.problem:r.problem;return r.ok&&o.ok&&typeof r.value=="number"&&typeof o.value=="number"&&Number.isFinite(r.value)&&Number.isFinite(o.value)&&o.value>0?h({t:"progress",label:d,value:r.value,max:o.value,text:`${b(r.value,void 0,n.today)} of ${b(o.value,void 0,n.today)}`},l):h({t:"progress",label:d,text:g},l)}case"group":return{t:"group",direction:e.direction,blocks:je(e.blocks,Oe(n))};case"when":{let r=w(e.when,n),o=r.ok&&r.value===!0;return h({t:"when",shown:o,blocks:o?je(e.show,Oe(n)):[]},r.ok?void 0:r.problem)}case"divider":return{t:"divider"};case"figure":return{t:"figure"};case"headline":{let r=S(e.parts,n),o=Math.min(6,Math.max(1,(t?n.firstHeading:void 0)??n.heading??3));return h({t:"headline",level:o,text:e.parts?B(e.parts,r.text):r.text},r.problem)}case"number":{let r=w(e.value,n),o=!r.ok||r.value===null||typeof r.value=="object"?g:Ke(r.value,e.as,e.currency,n.today,n.money),a=e.label?S(e.label,n):void 0;return h({t:"number",text:o,...a&&e.label?{label:B(e.label,a.text)}:{},...e.emphasis?{emphasis:e.emphasis}:{}},r.ok?a?.problem:r.problem)}case"list":return Xe(e,n)}}function je(e,n){let t=e.findIndex(r=>r.t==="headline");return e.map((r,o)=>({...ze(r,n,o===t),key:r.key}))}function Te(e,n){let t=n.trim().toLowerCase();return e.some(r=>{switch(r.t){case"title":case"headline":return r.text.trim()!=="";case"text":case"badge":return t!==""&&r.text.toLowerCase().includes(t);case"group":return Te(r.blocks,n);case"when":return r.shown&&Te(r.blocks,n);default:return!1}})}var Je=new Set(["every","some","sum","min","max","sort"]);function Gn(e,n){let t=new Set,r=new Set,o=i=>{if(i)switch(i.t){case"ident":t.add(i.name);return;case"list":i.items.forEach(o);return;case"member":return o(i.object);case"unary":return o(i.operand);case"binary":return o(i.left),o(i.right);case"where":return o(i.set);case"call":i.args.forEach((s,f)=>{f===1&&Je.has(i.fn)||o(s)});return;default:return}},a=i=>{for(let s of i??[])o(s.expr)},d=(i,s)=>{i.forEach((f,y)=>{let u=s[y];if(u)switch(f.t){case"field":case"image":t.add(f.field);return;case"title":case"text":case"badge":case"headline":a(f.parts);return;case"number":o(f.value),a(f.label);return;case"progress":o(f.value),o(f.max);return;case"group":u.t==="group"&&d(f.blocks,u.blocks);return;case"when":u.t==="when"&&u.shown&&d(f.show,u.blocks);return;case"list":if(u.t==="list")for(let m of u.members)r.add(m.id);return;default:return}})};d(e,n);let l=n[0];return{fields:t,records:r,...e[0]?.t==="title"&&l?.t==="title"?{title:l.text}:{}}}function Xe(e,n){let t=Math.min(6,(n.heading??3)+1),r=w(e.source,n);if(!r.ok)return{t:"list",as:e.as,failed:!0,members:[],headingLevel:t,more:0,problem:r.problem};let o=r.value,a=o instanceof j?o.nodes:o!==null&&typeof o=="object"&&!Array.isArray(o)?[o]:[];e.choiceOrder&&n.schema&&(a=Ze(a,e.choiceOrder,n.schema));let d=a.length,l=a.slice(0,e.limit??L),i=l.slice(0,I),s=l.slice(I),f=(e.limit===void 0?d:l.length)-i.length,y=c=>e.group&&n.schema&&c.length>0?Ye(c,e.group,n.schema,n.graph):void 0,u=y(i),m=s.length>0?y(l):void 0;return{t:"list",as:e.as,failed:!1,members:i,...s.length>0?{rest:s}:{},...u?{groups:u}:{},...m?{everyGroup:m}:{},headingLevel:t,...i.length===0&&e.empty?{empty:e.empty}:{},more:f,total:d}}function $(e,n,t){let r=e.tryDefinition(n)?.fields?.shape,o=r&&Object.hasOwn(r,t)?_(r[t]):void 0;return o?.type==="enum"?o.options??[]:[]}var U=(e,n)=>Object.hasOwn(e,n)?e[n]:void 0;function Ze(e,n,t){let r=o=>{let a=$(t,o.kind,n).indexOf(String(U(o,n)));return a<0?Number.MAX_SAFE_INTEGER:a};return e.map((o,a)=>({node:o,i:a,rank:r(o)})).sort((o,a)=>o.rank-a.rank||o.i-a.i).map(o=>o.node)}function Ye(e,n,t,r){let o=e.some(i=>$(t,i.kind,n.by).length>0)?void 0:ye(n.by);if(o&&r)return qe(e,o,n.headings,t,r);let a=[];for(let i of e)for(let s of $(t,i.kind,n.by))a.includes(s)||a.push(s);let d=[];for(let i of a){let s=e.filter(y=>U(y,n.by)===i);if(s.length===0)continue;let f=t.tryDefinition(s[0].kind);d.push({value:i,heading:n.headings[i]??J(x(f,n.by,i)),members:s})}let l=e.filter(i=>!a.includes(String(U(i,n.by))));return l.length>0&&d.push({value:null,members:l}),d}function qe(e,n,t,r,o){let a=u=>n.way??(Object.hasOwn(r.tryDefinition(u.kind)?.edges??{},n.edge)?"out":"in"),d=new Map,l=[],i=v(r),s;for(let u of e){let m=a(u)==="out"?o.out(u.id,n.edge):o.in(u.id,n.edge);m.length===0&&l.push(u);for(let c of m){s??=c.kind;let R=d.get(c.id)??{node:c,members:[]};R.members.push(u),d.set(c.id,R)}}let f=[...d.values()].map(({node:u,members:m})=>({value:u.id,heading:t[u.id]??i(u),members:m})).sort((u,m)=>u.heading.localeCompare(m.heading,void 0,{numeric:!0}));!s&&e[0]&&a(e[0])==="out"&&(s=(r.tryDefinition(e[0].kind)?.edges??{})[n.edge]?.to?.[0]);let y=s&&s!=="*"?Y(r.tryDefinition(s),s):void 0;return l.length>0&&f.push({value:null,...y?{heading:`No ${y}`}:{},members:l}),f}function xe(e){return e.t==="list"||e.t==="headline"||e.t==="number"||e.t==="image"&&e.as==="gallery"?!0:e.t==="group"?e.blocks.some(xe):e.t==="when"?e.show.some(xe):!1}function ve(e,n){let t=e.tryDefinition(n)?.fields?.shape??{},r={};for(let[o,a]of Object.entries(t)){let d=_(a);d&&(r[o]=d)}return r}var Pe=new WeakMap;function W(e){let n=Pe.get(e);return n||Pe.set(e,n=me(e)),n}function Qe(e,n,t,r={}){let o=W(e),a={},d={},l=i=>{if(i instanceof j)return i.nodes.map(s=>l(s));if(Array.isArray(i))return i.map(s=>l(s));if(i!==null&&typeof i=="object"){let s=i;return{id:s.id,kind:s.kind,label:Z(e.tryDefinition(s.kind),s)}}return i};for(let[i,s]of o.get(t?t.kind:te)?.computed??[])try{let f=[],y=G(s,{graph:n,subject:t,kinds:o,...r.today?{today:r.today}:{},...r.budget?{budget:r.budget}:{},...r.linked?{linked:r.linked}:{},onUnread:u=>f.push(u)});f.length>0&&(y===null||y instanceof j&&y.nodes.length===0)?d[i]=re(f[0]):a[i]=l(y)}catch(f){if(!(f instanceof oe))throw f;d[i]=f.sentence}return{values:a,refused:d}}function Mn(e,n,t){let{values:r}=Qe(e,n,t);if(Object.keys(r).length===0)return t;let o=a=>Array.isArray(a)?a.map(o):a!==null&&typeof a=="object"?a.label:a;return{...t,...Object.fromEntries(Object.entries(r).map(([a,d])=>[a,o(d)]))}}function Cn(e,n){return[...pe(e.tryDefinition(n)).keys()]}var en=500,nn=2e4,Fe=new WeakMap;function rn(e,n){let t=Fe.get(e);t||Fe.set(e,t=new Map);let r=t.get(n);return r||t.set(n,r=ve(e,n)),r}function Dn(e,n,t,r={}){if(n&&typeof e.seenBy!="function")throw new TypeError("blockContextFor: a seat is read from a store (its `seenBy`); a bare { graph, schema } is read as it is handed, with no principal");let o=n?e.seenBy(n):e,a=n&&t?o.graph.getNode(t.id)??null:t,d=o.schema,l=a&&d.tryDefinition(a.kind),i=!a||(r.slot??"page")==="page",{money:s,firstHeading:f}=r;return{node:a,graph:o.graph,schema:d,kinds:W(d),fields:a?rn(d,a.kind):{},definition:l||void 0,today:r.today??o.today?.()??K(s?.timeZone),money:s,heading:r.heading??(i?2:3),firstHeading:f,budget:r.budget??(i?nn:en),...i?{}:{glance:!0}}}export{Re as a,dn as b,Ne as c,sn as d,ke as e,je as f,Te as g,Gn as h,xe as i,W as j,Qe as k,Mn as l,Cn as m,Dn as n};
@@ -1,4 +1,4 @@
1
- import{a as W,c as I,d as q,f as H}from"./chunk.L7NJLZWV.js";import{a as re,b as ie}from"./chunk.XOZU4OFA.js";import{b as te,c as ne,d as oe}from"./chunk.5M34BJIQ.js";import{b as X,c as Z,d as L,j as ee,k as ae}from"./chunk.DA4RSHLW.js";import{b as Q,k as U,l as T}from"./chunk.FOSY7MZF.js";import{G as ge,V as J}from"./chunk.3CJLAJXP.js";import{Bc as _,Ed as Y,Nb as V,ga as E,ha as K,la as $,ta as B}from"./chunk.J24YPQ5I.js";import{b as O}from"./chunk.AJZBJBMO.js";var b=O(ge(),1),a=O(J(),1),fe=`
1
+ import{a as W,c as I,d as q,f as H}from"./chunk.T27QKVKP.js";import{a as re,b as ie}from"./chunk.XOZU4OFA.js";import{b as te,c as ne,d as oe}from"./chunk.H3EGBDW2.js";import{b as X,c as Z,d as L}from"./chunk.SO6NT5K7.js";import{k as ee,l as ae}from"./chunk.MUSMNKE4.js";import{b as Q,k as U,l as T}from"./chunk.SJQPTDAT.js";import{G as ge,W as J}from"./chunk.A5PSEU3W.js";import{Cc as _,Fd as Y,Ob as V,ga as E,ha as K,la as $,ua as B}from"./chunk.ZEZUKRC6.js";import{b as O}from"./chunk.AJZBJBMO.js";var b=O(ge(),1),a=O(J(),1),fe=`
2
2
  form:where([data-graview-part="form"]) {
3
3
  /* A grid item of the section above it and a grid container for the
4
4
  fields below: both halves are allowed to be narrower than what is in