graview 0.1.47 → 0.1.48

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 (177) hide show
  1. package/dist/preview/{chunk.SWWAEOZ7.js → chunk.2GLJH253.js} +1 -1
  2. package/dist/preview/{chunk.ETPKXUAN.js → chunk.2QNGGF55.js} +1 -1
  3. package/dist/preview/{chunk.O4WEJ47H.js → chunk.2UIUMG23.js} +3 -3
  4. package/dist/preview/{chunk.IXOQQBJE.js → chunk.2VTMTW7K.js} +1 -1
  5. package/dist/preview/chunk.37CJSWLL.js +1 -0
  6. package/dist/preview/{chunk.RG6WNOBW.js → chunk.3BAHAK6W.js} +1 -1
  7. package/dist/preview/{chunk.T42S2WMB.js → chunk.3RP3N2JP.js} +1 -1
  8. package/dist/preview/{chunk.C3NHNYA6.js → chunk.3UD7GG5B.js} +1 -1
  9. package/dist/preview/{chunk.L4YNDNX7.js → chunk.44G5A53D.js} +1 -1
  10. package/dist/preview/chunk.4GQA3AJU.js +1 -0
  11. package/dist/preview/{chunk.QGG6ZRJ5.js → chunk.4KX53HCV.js} +2 -2
  12. package/dist/preview/chunk.4TJOS4C7.js +5 -0
  13. package/dist/preview/{chunk.FWSCBHZ5.js → chunk.4VW6THJF.js} +1 -1
  14. package/dist/preview/{chunk.MCB26YCQ.js → chunk.5IM645XQ.js} +1 -1
  15. package/dist/preview/{chunk.RBJAPOZ3.js → chunk.5IPH2SCE.js} +1 -1
  16. package/dist/preview/{chunk.TBQOSI4J.js → chunk.5Y3Q7ONN.js} +1 -1
  17. package/dist/preview/chunk.664PBQAQ.js +1 -0
  18. package/dist/preview/{chunk.2MCZ4CU5.js → chunk.6TKILWRM.js} +1 -1
  19. package/dist/preview/{chunk.DQS7D2W2.js → chunk.6VAFNCR4.js} +1 -1
  20. package/dist/preview/chunk.72OZLWJL.js +1 -0
  21. package/dist/preview/chunk.72W6S746.js +1 -0
  22. package/dist/preview/{chunk.OONCUAOH.js → chunk.76W2FXEC.js} +1 -1
  23. package/dist/preview/{chunk.64WM4IBI.js → chunk.7FRPNQU4.js} +1 -1
  24. package/dist/preview/chunk.7LL7OSBY.js +6 -0
  25. package/dist/preview/chunk.7QZYFLBS.js +1 -0
  26. package/dist/preview/{chunk.6RY6OSE6.js → chunk.7VT3TRHR.js} +1 -1
  27. package/dist/preview/{chunk.W6COSBO2.js → chunk.B2IIEVBF.js} +2 -2
  28. package/dist/preview/{chunk.IQ2HKGJS.js → chunk.BDHKWVNX.js} +1 -1
  29. package/dist/preview/{chunk.57ZSMK3R.js → chunk.CH5ROV7N.js} +1 -1
  30. package/dist/preview/{chunk.RZF3QM4E.js → chunk.CJ23XTSW.js} +1 -1
  31. package/dist/preview/{chunk.VAFSSSSI.js → chunk.D5ETRTAF.js} +1 -1
  32. package/dist/preview/{chunk.47RTA6M3.js → chunk.DAUC2DFY.js} +1 -1
  33. package/dist/preview/{chunk.63JLXGYX.js → chunk.DFK2NA6L.js} +1 -1
  34. package/dist/preview/{chunk.7N2GXZYI.js → chunk.DHAK6PPX.js} +2 -2
  35. package/dist/preview/{chunk.NFIGGSMJ.js → chunk.DOBQ4LO4.js} +1 -1
  36. package/dist/preview/{chunk.H7KCWCB4.js → chunk.DPHTUTOS.js} +1 -1
  37. package/dist/preview/chunk.DQ7M3LFV.js +1 -0
  38. package/dist/preview/{chunk.63MS2LOP.js → chunk.DUWYF7BO.js} +1 -1
  39. package/dist/preview/{chunk.TCXKPILZ.js → chunk.DWPU56S5.js} +1 -1
  40. package/dist/preview/{chunk.WBHM5I3I.js → chunk.E5GM2SMO.js} +1 -1
  41. package/dist/preview/{chunk.N7JT6MG2.js → chunk.EMQ5POGB.js} +1 -1
  42. package/dist/preview/{chunk.SD6N4DGF.js → chunk.ENPCLMP2.js} +1 -1
  43. package/dist/preview/chunk.EXEZBZGW.js +1 -0
  44. package/dist/preview/{chunk.CMOXKRWT.js → chunk.EZJNUFNQ.js} +1 -1
  45. package/dist/preview/{chunk.C44MC5X3.js → chunk.FOP5RBGF.js} +1 -1
  46. package/dist/preview/chunk.FPYL6REZ.js +1 -0
  47. package/dist/preview/chunk.FQYOTK34.js +1 -0
  48. package/dist/preview/chunk.G7WDMUDV.js +1 -0
  49. package/dist/preview/{chunk.VSNHCGKC.js → chunk.GACKGEUY.js} +1 -1
  50. package/dist/preview/chunk.GH2SWMCW.js +1 -0
  51. package/dist/preview/chunk.GNBN3BK7.js +1 -0
  52. package/dist/preview/{chunk.KSM6NVAT.js → chunk.GT3F6FQ6.js} +1 -1
  53. package/dist/preview/chunk.GTPC6JOW.js +2 -0
  54. package/dist/preview/{chunk.IROYMLER.js → chunk.GUMJEVVP.js} +1 -1
  55. package/dist/preview/{chunk.3LDYUO77.js → chunk.GVNYPFIM.js} +1 -1
  56. package/dist/preview/{chunk.EYI3Y2DY.js → chunk.HC5N3CT2.js} +1 -1
  57. package/dist/preview/{chunk.6TIEX67B.js → chunk.HDE2MGGU.js} +1 -1
  58. package/dist/preview/{chunk.6YD2DLIC.js → chunk.HG4DDNPG.js} +1 -1
  59. package/dist/preview/{chunk.MBETS27C.js → chunk.HKA5T7DL.js} +1 -1
  60. package/dist/preview/{chunk.7ELB37JU.js → chunk.I5TOMBIF.js} +1 -1
  61. package/dist/preview/{chunk.76GF5US2.js → chunk.I7QIHN66.js} +1 -1
  62. package/dist/preview/chunk.ILZYRJDS.js +1 -0
  63. package/dist/preview/{chunk.QZEZHCOI.js → chunk.IRHSTUZM.js} +1 -1
  64. package/dist/preview/{chunk.PYE3WZM7.js → chunk.J2V76Z6G.js} +1 -1
  65. package/dist/preview/{chunk.WHEUTAXA.js → chunk.J6ANRF6E.js} +1 -1
  66. package/dist/preview/{chunk.Y4ZUJUUT.js → chunk.KA44WNB4.js} +1 -1
  67. package/dist/preview/chunk.KTFUVR4V.js +2 -0
  68. package/dist/preview/{chunk.BNPQUI3F.js → chunk.KVEDIBXS.js} +1 -1
  69. package/dist/preview/chunk.KVJFY7N5.js +2 -0
  70. package/dist/preview/{chunk.F67F6QZ6.js → chunk.KW65F4WA.js} +1 -1
  71. package/dist/preview/chunk.LGSFGNWE.js +1 -0
  72. package/dist/preview/{chunk.VXVWUIGO.js → chunk.LNON6P7K.js} +1 -1
  73. package/dist/preview/{chunk.2W22AWSL.js → chunk.LPD74WBI.js} +1 -1
  74. package/dist/preview/{chunk.SZR3Z43B.js → chunk.LXCJVZF3.js} +1 -1
  75. package/dist/preview/{chunk.Q7RQC3F7.js → chunk.MAFFUPCR.js} +1 -1
  76. package/dist/preview/chunk.MTXEURFE.js +1 -0
  77. package/dist/preview/{chunk.DNROW6LX.js → chunk.MVRG75ZD.js} +1 -1
  78. package/dist/preview/{chunk.5TM5VA2H.js → chunk.MVSV7T6E.js} +1 -1
  79. package/dist/preview/{chunk.4YXJPKXD.js → chunk.MZLWLIKR.js} +1 -1
  80. package/dist/preview/chunk.N4M54YK6.js +1 -0
  81. package/dist/preview/{chunk.KSXB4LDF.js → chunk.NB6WN4DO.js} +1 -1
  82. package/dist/preview/{chunk.UHX4WTM7.js → chunk.NFDLCUCC.js} +1 -1
  83. package/dist/preview/{chunk.AGIO2GRV.js → chunk.NLBIX7LH.js} +1 -1
  84. package/dist/preview/{chunk.FOQ27RAR.js → chunk.NQZ73QV7.js} +1 -1
  85. package/dist/preview/chunk.NR5ODXMO.js +1 -0
  86. package/dist/preview/{chunk.VC3UGFHY.js → chunk.NTLHEHOM.js} +1 -1
  87. package/dist/preview/{chunk.TJEV5ZAM.js → chunk.NWT5FPEK.js} +2 -2
  88. package/dist/preview/chunk.NX7IIZLO.js +1 -0
  89. package/dist/preview/{chunk.UKAPFIPJ.js → chunk.O45VO36H.js} +1 -1
  90. package/dist/preview/{chunk.OCTOGZVJ.js → chunk.OAIWGWGU.js} +2 -2
  91. package/dist/preview/{chunk.PC6PID5X.js → chunk.ODRL5OWR.js} +1 -1
  92. package/dist/preview/{chunk.24OZGU7J.js → chunk.OFRGDJYX.js} +1 -1
  93. package/dist/preview/chunk.OVO6L5IP.js +88 -0
  94. package/dist/preview/{chunk.RUPRZDN3.js → chunk.OZGETOTK.js} +1 -1
  95. package/dist/preview/{chunk.ZCYGUP3I.js → chunk.P6FQAILU.js} +1 -1
  96. package/dist/preview/{chunk.5M4TMZXC.js → chunk.PCEYZQAW.js} +1 -1
  97. package/dist/preview/{chunk.IPAZOKMQ.js → chunk.PMJUGHW4.js} +1 -1
  98. package/dist/preview/{chunk.RNEJYIQ7.js → chunk.PPRSGM64.js} +1 -1
  99. package/dist/preview/chunk.PQVUQVRL.js +1 -0
  100. package/dist/preview/{chunk.NEEOVRB7.js → chunk.PTXLOFQW.js} +1 -1
  101. package/dist/preview/{chunk.P4KCZRIG.js → chunk.PVEPU6EA.js} +1 -1
  102. package/dist/preview/chunk.QGE6YKSU.js +1 -0
  103. package/dist/preview/{chunk.Z6TMIAAB.js → chunk.QII2C5OV.js} +1 -1
  104. package/dist/preview/{chunk.FOJDVK2Q.js → chunk.QO7MDWID.js} +1 -1
  105. package/dist/preview/{chunk.RVJXO5GG.js → chunk.QPICKSSM.js} +1 -1
  106. package/dist/preview/{chunk.KRGM25HF.js → chunk.QQCDCRR2.js} +1 -1
  107. package/dist/preview/{chunk.F2VMMCVK.js → chunk.QQTRAY5W.js} +1 -1
  108. package/dist/preview/{chunk.ZWVN75EY.js → chunk.RLXKDXPB.js} +1 -1
  109. package/dist/preview/{chunk.5AGW4NRZ.js → chunk.RQBEQYB2.js} +1 -1
  110. package/dist/preview/chunk.SA34Y3X5.js +2 -0
  111. package/dist/preview/chunk.SAHNXAV3.js +1 -0
  112. package/dist/preview/{chunk.52VGZBO3.js → chunk.SFAAM4KE.js} +1 -1
  113. package/dist/preview/{chunk.4YS7547F.js → chunk.SKJJBLXF.js} +1 -1
  114. package/dist/preview/chunk.SUPWMV2F.js +1 -0
  115. package/dist/preview/{chunk.WJS6P7GI.js → chunk.TBRJOKIK.js} +1 -1
  116. package/dist/preview/{chunk.S5IQFZ5Z.js → chunk.TKMQROXF.js} +1 -1
  117. package/dist/preview/chunk.TMDI7KRS.js +18 -0
  118. package/dist/preview/chunk.TPG6IY4M.js +1 -0
  119. package/dist/preview/{chunk.PKUDIWIF.js → chunk.UGJSMNVO.js} +1 -1
  120. package/dist/preview/{chunk.EUPSAYEI.js → chunk.UJRBOUGC.js} +1 -1
  121. package/dist/preview/{chunk.IJNOT4S4.js → chunk.V2GSBYDK.js} +2 -2
  122. package/dist/preview/chunk.V3N34DSU.js +1 -0
  123. package/dist/preview/{chunk.ZQY6ODXC.js → chunk.V4BCB7N2.js} +1 -1
  124. package/dist/preview/{chunk.CTQULC5F.js → chunk.VQAQQW4Q.js} +1 -1
  125. package/dist/preview/{chunk.A7RKTSOH.js → chunk.W72TTRLX.js} +2 -2
  126. package/dist/preview/{chunk.IKX4VDTW.js → chunk.X7JMJSLU.js} +1 -1
  127. package/dist/preview/{chunk.GCKZ2YRJ.js → chunk.X7N3JUO4.js} +2 -2
  128. package/dist/preview/chunk.XOZU4OFA.js +1 -0
  129. package/dist/preview/{chunk.O2WWYZI7.js → chunk.XTMOFRHL.js} +1 -1
  130. package/dist/preview/{chunk.V7XHNRQM.js → chunk.Y4MQGEUS.js} +2 -2
  131. package/dist/preview/{chunk.MF73YBJL.js → chunk.YDL5BSTG.js} +1 -1
  132. package/dist/preview/chunk.YEVA72L2.js +1 -0
  133. package/dist/preview/chunk.YLWON7X3.js +1 -0
  134. package/dist/preview/chunk.YUH43J2K.js +1 -0
  135. package/dist/preview/{chunk.UV3YU64Z.js → chunk.YVOABA2U.js} +1 -1
  136. package/dist/preview/{chunk.R6V37SR7.js → chunk.ZH4NWRWB.js} +1 -1
  137. package/dist/preview/chunk.ZXZNAG35.js +1 -0
  138. package/dist/preview/index.html +50 -49
  139. package/dist/preview/page.js +2 -2
  140. package/package.json +6 -6
  141. package/dist/preview/chunk.2CLANQHZ.js +0 -1
  142. package/dist/preview/chunk.2L3VFGHX.js +0 -1
  143. package/dist/preview/chunk.4OGOTHRD.js +0 -1
  144. package/dist/preview/chunk.5G53VDOC.js +0 -1
  145. package/dist/preview/chunk.6QVXXQCW.js +0 -2
  146. package/dist/preview/chunk.7NNI7YH4.js +0 -1
  147. package/dist/preview/chunk.A3RNSSUQ.js +0 -1
  148. package/dist/preview/chunk.AS4CQBOQ.js +0 -5
  149. package/dist/preview/chunk.AWXDZUKH.js +0 -1
  150. package/dist/preview/chunk.AYA7SYIU.js +0 -1
  151. package/dist/preview/chunk.BBS5C2BY.js +0 -1
  152. package/dist/preview/chunk.COYLGLTI.js +0 -1
  153. package/dist/preview/chunk.DX357TZ3.js +0 -2
  154. package/dist/preview/chunk.GQHAAKJG.js +0 -1
  155. package/dist/preview/chunk.HDRD33II.js +0 -1
  156. package/dist/preview/chunk.I6JLOEJU.js +0 -1
  157. package/dist/preview/chunk.ISNEX772.js +0 -1
  158. package/dist/preview/chunk.IW7YFPGG.js +0 -1
  159. package/dist/preview/chunk.IYIN6VSN.js +0 -1
  160. package/dist/preview/chunk.JUWWRRHA.js +0 -1
  161. package/dist/preview/chunk.K2NCGPCL.js +0 -1
  162. package/dist/preview/chunk.KWQ7QOHD.js +0 -2
  163. package/dist/preview/chunk.MCCUVGTE.js +0 -1
  164. package/dist/preview/chunk.NDWW5EER.js +0 -1
  165. package/dist/preview/chunk.OJGUIWDD.js +0 -88
  166. package/dist/preview/chunk.PBKO5CKD.js +0 -1
  167. package/dist/preview/chunk.QGVLJTZS.js +0 -1
  168. package/dist/preview/chunk.RX2M4C5W.js +0 -2
  169. package/dist/preview/chunk.SGKK4UKP.js +0 -1
  170. package/dist/preview/chunk.T7RJCEJB.js +0 -18
  171. package/dist/preview/chunk.VW2VCPJX.js +0 -1
  172. package/dist/preview/chunk.WAB7UDHU.js +0 -1
  173. package/dist/preview/chunk.XYEFZ2OO.js +0 -1
  174. package/dist/preview/chunk.YHH4TWZ2.js +0 -1
  175. package/dist/preview/chunk.YVONXFKE.js +0 -6
  176. package/dist/preview/chunk.ZIEHF67C.js +0 -1
  177. package/dist/preview/chunk.ZL7ZBJUU.js +0 -1
@@ -1,4 +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 G,b as J}from"./chunk.47RTA6M3.js";import"./chunk.RX2M4C5W.js";import{a as K}from"./chunk.IQ2HKGJS.js";import"./chunk.R6V37SR7.js";import"./chunk.7NNI7YH4.js";import"./chunk.FOQ27RAR.js";import"./chunk.UKAPFIPJ.js";import"./chunk.UT6642FC.js";import{a as S,b as W}from"./chunk.MB7LKKUD.js";import"./chunk.ZIEHF67C.js";import"./chunk.UHX4WTM7.js";import"./chunk.IKX4VDTW.js";import"./chunk.RNEJYIQ7.js";import"./chunk.TBQOSI4J.js";import"./chunk.KWQ7QOHD.js";import"./chunk.HDRD33II.js";import"./chunk.DX357TZ3.js";import"./chunk.H7KCWCB4.js";import"./chunk.O4WEJ47H.js";import{$ as F,D as H,Da as _,E as V,G as ee,Pa as x,R as D}from"./chunk.Y4ZUJUUT.js";import{a as j}from"./chunk.SDO3U72B.js";import{fa as q,wc as B}from"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import{b}from"./chunk.AJZBJBMO.js";var t=b(ee(),1);var a=b(D(),1);function ae(n){let r=[];return n.applied.length>0&&n.intent&&r.push(`${n.intent}.`),n.unchanged.length>0&&r.push(`${n.unchanged.length} already so.`),n.allOrNothing&&r.push("None of it was kept."),r.join(" ")}var re=_(j(()=>(__graviewPreload(import.meta.url,["./chunk.OCTOGZVJ.js","./chunk.UKAPFIPJ.js","./chunk.UT6642FC.js","./chunk.WAB7UDHU.js","./chunk.IW7YFPGG.js","./chunk.2W22AWSL.js","./chunk.TI4OSTQV.js","./chunk.UHX4WTM7.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.6TIEX67B.js")))),te=re.part((n,r)=>(0,a.jsx)(n.SeveralAi,{...r}),{quiet:!0});function ne(n){let r=F()?.ai;return!H(r)||!V(r)?null:(0,a.jsx)(t.Suspense,{fallback:null,children:(0,a.jsx)(te,{...n})})}function me({store:n,chosen:r,principal:d,context:v,via:k,anchor:A,of:g,onChooseAll:E,onClear:m,onActed:Q}){let[U,X]=(0,t.useState)(0);(0,t.useEffect)(()=>n.subscribe(()=>X(e=>e+1)),[n]);let f=r.join(`
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 G,b as J}from"./chunk.DAUC2DFY.js";import"./chunk.GTPC6JOW.js";import{a as K}from"./chunk.BDHKWVNX.js";import"./chunk.ZH4NWRWB.js";import"./chunk.SAHNXAV3.js";import"./chunk.NQZ73QV7.js";import"./chunk.O45VO36H.js";import"./chunk.UT6642FC.js";import"./chunk.SUPWMV2F.js";import{a as S,b as W}from"./chunk.MB7LKKUD.js";import"./chunk.TPG6IY4M.js";import"./chunk.NFDLCUCC.js";import"./chunk.X7JMJSLU.js";import"./chunk.PPRSGM64.js";import"./chunk.5Y3Q7ONN.js";import"./chunk.KTFUVR4V.js";import"./chunk.N4M54YK6.js";import"./chunk.KVJFY7N5.js";import"./chunk.DPHTUTOS.js";import"./chunk.2UIUMG23.js";import{$ as F,D as H,Da as _,E as V,G as ee,Pa as x,R as D}from"./chunk.KA44WNB4.js";import{a as j}from"./chunk.SDO3U72B.js";import{ga as q,xc as B}from"./chunk.4TJOS4C7.js";import"./chunk.2AZTW66C.js";import{b}from"./chunk.AJZBJBMO.js";var t=b(ee(),1);var a=b(D(),1);function ae(n){let r=[];return n.applied.length>0&&n.intent&&r.push(`${n.intent}.`),n.unchanged.length>0&&r.push(`${n.unchanged.length} already so.`),n.allOrNothing&&r.push("None of it was kept."),r.join(" ")}var re=_(j(()=>(__graviewPreload(import.meta.url,["./chunk.OAIWGWGU.js","./chunk.O45VO36H.js","./chunk.UT6642FC.js","./chunk.NX7IIZLO.js","./chunk.XOZU4OFA.js","./chunk.SUPWMV2F.js","./chunk.LPD74WBI.js","./chunk.TI4OSTQV.js","./chunk.NFDLCUCC.js","./chunk.N4M54YK6.js","./chunk.KVJFY7N5.js","./chunk.DPHTUTOS.js","./chunk.2UIUMG23.js","./chunk.KA44WNB4.js","./chunk.SDO3U72B.js","./chunk.4TJOS4C7.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.HDE2MGGU.js")))),te=re.part((n,r)=>(0,a.jsx)(n.SeveralAi,{...r}),{quiet:!0});function ne(n){let r=F()?.ai;return!H(r)||!V(r)?null:(0,a.jsx)(t.Suspense,{fallback:null,children:(0,a.jsx)(te,{...n})})}function me({store:n,chosen:r,principal:d,context:v,via:k,anchor:A,of:g,onChooseAll:E,onClear:m,onActed:Q}){let[U,X]=(0,t.useState)(0);(0,t.useEffect)(()=>n.subscribe(()=>X(e=>e+1)),[n]);let f=r.join(`
2
2
  `),{acts:c,withheld:N}=(0,t.useMemo)(()=>G(n,r,{...d?{principal:d}:{},...v?{context:v}:{}}),[n,f,d,v,U]),[O,p]=(0,t.useState)(!1),[l,u]=(0,t.useState)(null),[s,P]=(0,t.useState)(null),h=(0,t.useRef)(null),L=(0,t.useId)(),w=(0,t.useMemo)(()=>[...new Set(r.map(e=>n.graph.getNode(e)?.kind))],[n,f]),Y=w.length===1&&w[0]?`${q(n.schema,w[0],r.length)} chosen`:`${r.length} chosen`,M=typeof matchMedia=="function"&&matchMedia("(pointer: coarse), (max-width: 599px)").matches?2:3,C=c.filter(e=>!e.more),Z=C.slice(0,M),R=[...C.slice(M),...c.filter(e=>e.more)];(0,t.useEffect)(()=>{u(null),p(!1)},[f]),(0,t.useLayoutEffect)(()=>{let e=h.current;if(!e)return;if(typeof e.showPopover=="function"&&!x(e))try{e.showPopover()}catch{}let i=()=>{W(e,A?.()??null),dispatchEvent(new Event(S))};i(),addEventListener("resize",i),addEventListener("scroll",i,!0);let o=typeof ResizeObserver=="function"?new ResizeObserver(i):null;return o?.observe(e),()=>{if(o?.disconnect(),removeEventListener("resize",i),removeEventListener("scroll",i,!0),e.isConnected&&x(e))try{e.hidePopover()}catch{}dispatchEvent(new Event(S))}},[A]);let y=(0,t.useRef)({asking:l,onClear:m});y.current={asking:l,onClear:m},(0,t.useEffect)(()=>{let e=i=>{if(i.key!=="Escape"||i.defaultPrevented)return;let o=document.activeElement;if(!(!(h.current?.contains(o)??!1)&&(o instanceof HTMLTextAreaElement||o instanceof HTMLInputElement&&o.type!=="checkbox"||o instanceof HTMLSelectElement))){if(i.preventDefault(),i.stopPropagation(),y.current.asking){u(null);return}y.current.onClear()}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]);let T=(e,i={})=>{let o=J(n,{mutation:e.mutation,subject:e.subject,args:{...e.args,...i},label:e.label},r,{...d?{author:d}:{},...k?{via:k}:{},...v?{context:v}:{}});u(null),p(!1),P(o.refused.length>0||o.applied.length===0?o:null),Q(o.refused.map(I=>I.id))},$=e=>{P(null),p(!1),e.open.length>0?u(e):T(e)},z=e=>(0,a.jsxs)("button",{type:"button",className:"graview-several-act","data-testid":"several-act","data-act":e.id,"data-mutation":e.mutation,...e.destructive?{"data-tone":"warn"}:{},"aria-pressed":l?.id===e.id?!0:void 0,onClick:()=>$(e),children:[e.label,e.open.length>0?"\u2026":""]},e.id);return(0,a.jsxs)("div",{ref:h,popover:"manual",role:"region","aria-label":"The chosen records",className:"graview-several-bar","data-testid":"several-bar","data-graview-foot":"","data-graview-overlay":"","data-graview-popover":"","data-graview-offstage":"",style:ie,children:[(0,a.jsx)("style",{children:oe}),(0,a.jsxs)("div",{className:"graview-several-line",children:[(0,a.jsx)("span",{role:"status","aria-live":"polite",className:"graview-several-count","data-testid":"several-count",children:Y}),(0,a.jsxs)("div",{role:"group","aria-label":`What to do with the ${r.length} chosen`,className:"graview-several-acts",children:[Z.map(z),R.length>0?(0,a.jsx)("button",{type:"button",className:"graview-several-act","data-testid":"several-more","aria-expanded":O,"aria-controls":L,onClick:()=>p(e=>!e),children:"More"}):null,E&&g!==void 0&&g>r.length?(0,a.jsxs)("button",{type:"button",className:"graview-several-quiet","data-testid":"several-all",onClick:E,children:["Choose all ",g]}):null,(0,a.jsx)("button",{type:"button",className:"graview-several-quiet","data-testid":"several-clear","aria-keyshortcuts":"Escape",title:"Put the choice down \u2014 Escape",onClick:m,children:"Clear"})]})]}),c.length>0&&r.length>1?(0,a.jsx)(ne,{chosen:r,acts:c,onAct:$}):null,O?(0,a.jsx)("div",{id:L,role:"group","aria-label":"More",className:"graview-several-acts","data-testid":"several-more-acts",children:R.map(z)}):null,c.length===0?(0,a.jsx)("p",{className:"graview-several-said","data-testid":"several-none",children:N.length>0?`Nothing here can be done to all of them by you: ${N[0].message}`:"Nothing can be done to all of these at once."}):null,l?(0,a.jsx)("div",{className:"graview-several-ask",role:"group","aria-label":`${l.label}, for all ${r.length}`,"data-testid":"several-ask",children:(0,a.jsx)(K,{store:n,affordance:l.affordance,onApply:e=>T(l,e),onCancel:()=>u(null)})}):null,s?(0,a.jsxs)("div",{role:"alert",className:"graview-several-said","data-testid":"several-outcome",children:[ae(s),s.refused.length>0?(0,a.jsxs)(a.Fragment,{children:[" ",s.refused.length===1?"One was not changed, and is still chosen:":`${s.refused.length} were not changed, and are still chosen:`,(0,a.jsx)("ul",{"data-testid":"several-refused",children:s.refused.map(e=>(0,a.jsxs)("li",{"data-record":e.id,children:["\u201C",e.label,"\u201D \u2014 ",e.message]},e.id))})]}):null]}):null]})}var ie={position:"fixed",inset:"auto",margin:0,zIndex:B("toast"),boxSizing:"border-box",width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,overflow:"visible"},oe=`
3
3
  .graview-several-bar{display:grid;gap:8px;padding:8px 10px;border:1px solid var(--graview-edge);border-radius:var(--graview-radius,12px);background:var(--graview-float);color:var(--graview-ink);box-shadow:var(--graview-lift-high);font-size:.875rem;line-height:1.4;max-height:70vh;overflow:auto}
4
4
  .graview-several-line{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;min-width:0}
@@ -1,4 +1,4 @@
1
- import{a as z,b as Y,d as ee}from"./chunk.F2VMMCVK.js";import"./chunk.NFIGGSMJ.js";import{Rb as J,ca as Q,ga as U,la as X,pa as _}from"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";function ce(t){let r=t?.indexOf(":")??-1;if(!(!t||r<=0||r===t.length-1))return{relation:t.slice(0,r),record:t.slice(r+1)}}function ne(t,r){if(t.length===0)return!0;let d=`${r.split("/")[0]}/*`;return t.some(a=>a==="*"||a==="*/*"||a===r||a===d)}function re(t,r){let d=r.startsWith("image/")?"image":r.startsWith("video/")?"video":"file";return t.find(a=>a.as===d)??t.find(a=>a.as==="file")}function fe(t,r){let d=new Set(t.map(k=>k.as==="image"?"image/":k.as==="video"?"video/":""));if(d.has("")||r.kinds.length===0)return r.kinds.join(",");let a=[];for(let k of d){let m=r.kinds.filter(l=>l.startsWith(k));a.push(...m.length>0?m:[`${k}*`])}return a.join(",")}var T=t=>t.input?.shape??{},ie=(t,r)=>T(t)[r]?.safeParse(void 0).success===!1;function ae(t,r){let d=new Set(z(t.input).map(a=>a.name));return Object.keys(T(t)).filter(a=>!r.has(a)&&!d.has(a)&&ie(t,a)&&T(t)[a].safeParse("a name").success&&!T(t)[a].safeParse(1).success)}var ue=t=>t.replace(/\.[a-z0-9]{1,5}$/i,"")||t,se=(t,r)=>{let d=Number.isFinite(Date.parse(r))?new Date(Date.parse(r)).toISOString():r;return[r,d,d.replace(/\.\d{3}Z$/,"Z"),r.slice(0,10)].find(a=>t.safeParse(a).success)},pe="2026-01-01T00:00:00.000Z";function te(t,r){let d=T(t),a=new Set(ae(t,r)),k=Object.keys(d).filter(l=>!r.has(l)&&!a.has(l)&&ie(t,l)),m=k.filter(l=>se(d[l],pe)!==void 0);return{timed:m,left:k.filter(l=>!m.includes(l))}}function oe(t,r,d,a,k){let m=e=>({ok:!1,says:e}),{kind:l}=a,R=(d.accepts??[]).filter(e=>e.kind===l&&(a.field===void 0||e.field===a.field));if(R.length===0)return m(a.field===void 0?`The view's accepts names no field of "${l}", so nothing dropped there can become one.`:`The view's accepts does not name ${l}'s "${a.field}".`);let A=k.files;if(!A||!(A.maxBytes>0))return m("This host takes no files.");let j=R.flatMap(e=>{let n=ee(t,e.kind,e.field);return n?[{field:e.field,...n}]:[]}),w=j.filter(e=>e.as==="file"||A.kinds.length===0||A.kinds.some(n=>n==="*"||n==="*/*"||n.startsWith(e.as==="image"?"image/":"video/")));if(w.length===0)return m(`This host takes none of what ${l}'s ${j.map(e=>`"${e.field}"`).join(" or ")} holds.`);let c=a.connect===void 0?void 0:ce(a.connect);if(a.connect!==void 0&&(!c||k.shown.has(a.connect)))return m(`data-drop-connect is "<relation>:<record id>", not "${a.connect}".`);if(c&&!k.shown.has(c.record))return m(`data-drop-connect names "${c.record}", which this view was not shown.`);let g=c?t.seenBy(r).graph.getNode(c.record):void 0;if(c&&!g)return m(`data-drop-connect names "${c.record}", which this seat does not see.`);let $=e=>Object.hasOwn(t.schema.tryDefinition(e)?.edges??{},c.relation),E=c?$(l):!1;if(c&&!E&&!$(g.kind))return m(`Neither a "${l}" nor a "${g.kind}" has the relation "${c.relation}".`);let H=t.allMutations(),F=e=>t.permits(e,r).ok,Z=e=>w.every(n=>Object.hasOwn(T(e),n.field)),V=H.filter(e=>(e.creates??[]).includes(l)&&Z(e)),x=X(t.schema.tryDefinition(l),l),O=U(t.schema,l).toLowerCase(),S=g?Q(t.schema.tryDefinition(g.kind),g):void 0,G=e=>`${e===1?`a ${x}`:`${e} ${O}`}${S?` to ${S}`:""}`,K=e=>`Add ${G(e)}`,L=e=>`Added ${G(e)}.`,B=`Drop to add ${O}${S?` to ${S}`:""}.`,N=(e,n,u,v)=>{let I=new Set(Object.keys(n)),D=_(u.at)??v??new Date().toISOString();for(let C of te(e,I).timed)n[C]=se(T(e)[C],D);for(let C of ae(e,I))n[C]=ue(u.name);return n},q=(e,...n)=>new Set([...w.map(u=>u.field),...n,...z(e.input).map(u=>u.name)]),P=(e,...n)=>te(e,q(e,...n)).left,i=(e,n)=>m(`"${e.title??e.name}" asks for ${n.map(u=>`"${u}"`).join(" and ")}, which no dropped file says, so nothing dropped here can become a ${x}.`),o=(e,n)=>e.list?[n]:n,f={ok:!0,kind:l,fields:w,accept:fe(w,A),...c?{connect:c}:{},intent:K,invite:B,added:L};if(!c){let e=V.find(n=>!n.subject&&F({name:n.name,args:{}}));return e?P(e).length>0?i(e,P(e)):{...f,calls:n=>[{name:e.name,args:N(e,{[n.field]:o(w.find(u=>u.field===n.field),n.value)},n.value,n.at)}]}:m(`This seat may not make a "${l}" here.`)}let s=V.find(e=>e.subject&&(e.subject.kinds==="*"||e.subject.kinds.includes(g.kind))&&(e.connects??[]).includes(c.relation)&&F({name:e.name,args:{[e.subject.arg]:c.record}}));if(s){let e=s.subject.arg;return P(s,e).length>0?i(s,P(s,e)):{...f,calls:n=>[{name:s.name,args:N(s,{[e]:c.record,[n.field]:o(w.find(u=>u.field===n.field),n.value)},n.value,n.at)}]}}let p=V.find(e=>!e.subject&&F({name:e.name,args:{}}));if(!p)return m(`This seat may not make a "${l}" here.`);if(P(p).length>0)return i(p,P(p));let y=E?l:g.kind,W=E?g.kind:l,M=H.find(e=>{if(!(e.connects??[]).includes(c.relation)||!e.subject)return!1;let n=e.subject.kinds;if(n!=="*"&&!n.includes(y))return!1;let u=z(e.input).find(v=>v.name!==e.subject.arg&&(v.kinds.includes("*")||v.kinds.includes(W)));return u?F({name:e.name,args:E?{[u.name]:c.record}:{[e.subject.arg]:c.record}}):!1});if(!M)return m(`This seat may not link a "${l}" to ${c.record} by "${c.relation}".`);let h=M.subject.arg,b=z(M.input).find(e=>e.name!==h&&(e.kinds.includes("*")||e.kinds.includes(W))).name;return{...f,calls:(e,n)=>[{name:p.name,args:N(p,{[e.field]:o(w.find(u=>u.field===e.field),e.value)},e.value,e.at)},{name:M.name,args:E?{[h]:J(n*2),[b]:c.record}:{[h]:c.record,[b]:J(n*2)}}]}}var de=t=>t.type.startsWith("image/"),me=t=>t.type.startsWith("video/"),ge=`
1
+ import{a as z,b as Y,d as ee}from"./chunk.QQTRAY5W.js";import"./chunk.DOBQ4LO4.js";import{Sb as J,da as Q,ha as U,ma as X,qa as _}from"./chunk.4TJOS4C7.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";function ce(t){let r=t?.indexOf(":")??-1;if(!(!t||r<=0||r===t.length-1))return{relation:t.slice(0,r),record:t.slice(r+1)}}function ne(t,r){if(t.length===0)return!0;let d=`${r.split("/")[0]}/*`;return t.some(a=>a==="*"||a==="*/*"||a===r||a===d)}function re(t,r){let d=r.startsWith("image/")?"image":r.startsWith("video/")?"video":"file";return t.find(a=>a.as===d)??t.find(a=>a.as==="file")}function fe(t,r){let d=new Set(t.map(k=>k.as==="image"?"image/":k.as==="video"?"video/":""));if(d.has("")||r.kinds.length===0)return r.kinds.join(",");let a=[];for(let k of d){let m=r.kinds.filter(l=>l.startsWith(k));a.push(...m.length>0?m:[`${k}*`])}return a.join(",")}var T=t=>t.input?.shape??{},ie=(t,r)=>T(t)[r]?.safeParse(void 0).success===!1;function ae(t,r){let d=new Set(z(t.input).map(a=>a.name));return Object.keys(T(t)).filter(a=>!r.has(a)&&!d.has(a)&&ie(t,a)&&T(t)[a].safeParse("a name").success&&!T(t)[a].safeParse(1).success)}var ue=t=>t.replace(/\.[a-z0-9]{1,5}$/i,"")||t,se=(t,r)=>{let d=Number.isFinite(Date.parse(r))?new Date(Date.parse(r)).toISOString():r;return[r,d,d.replace(/\.\d{3}Z$/,"Z"),r.slice(0,10)].find(a=>t.safeParse(a).success)},pe="2026-01-01T00:00:00.000Z";function te(t,r){let d=T(t),a=new Set(ae(t,r)),k=Object.keys(d).filter(l=>!r.has(l)&&!a.has(l)&&ie(t,l)),m=k.filter(l=>se(d[l],pe)!==void 0);return{timed:m,left:k.filter(l=>!m.includes(l))}}function oe(t,r,d,a,k){let m=e=>({ok:!1,says:e}),{kind:l}=a,R=(d.accepts??[]).filter(e=>e.kind===l&&(a.field===void 0||e.field===a.field));if(R.length===0)return m(a.field===void 0?`The view's accepts names no field of "${l}", so nothing dropped there can become one.`:`The view's accepts does not name ${l}'s "${a.field}".`);let A=k.files;if(!A||!(A.maxBytes>0))return m("This host takes no files.");let j=R.flatMap(e=>{let n=ee(t,e.kind,e.field);return n?[{field:e.field,...n}]:[]}),w=j.filter(e=>e.as==="file"||A.kinds.length===0||A.kinds.some(n=>n==="*"||n==="*/*"||n.startsWith(e.as==="image"?"image/":"video/")));if(w.length===0)return m(`This host takes none of what ${l}'s ${j.map(e=>`"${e.field}"`).join(" or ")} holds.`);let c=a.connect===void 0?void 0:ce(a.connect);if(a.connect!==void 0&&(!c||k.shown.has(a.connect)))return m(`data-drop-connect is "<relation>:<record id>", not "${a.connect}".`);if(c&&!k.shown.has(c.record))return m(`data-drop-connect names "${c.record}", which this view was not shown.`);let g=c?t.seenBy(r).graph.getNode(c.record):void 0;if(c&&!g)return m(`data-drop-connect names "${c.record}", which this seat does not see.`);let $=e=>Object.hasOwn(t.schema.tryDefinition(e)?.edges??{},c.relation),E=c?$(l):!1;if(c&&!E&&!$(g.kind))return m(`Neither a "${l}" nor a "${g.kind}" has the relation "${c.relation}".`);let H=t.allMutations(),F=e=>t.permits(e,r).ok,Z=e=>w.every(n=>Object.hasOwn(T(e),n.field)),V=H.filter(e=>(e.creates??[]).includes(l)&&Z(e)),x=X(t.schema.tryDefinition(l),l),O=U(t.schema,l).toLowerCase(),S=g?Q(t.schema.tryDefinition(g.kind),g):void 0,G=e=>`${e===1?`a ${x}`:`${e} ${O}`}${S?` to ${S}`:""}`,K=e=>`Add ${G(e)}`,L=e=>`Added ${G(e)}.`,B=`Drop to add ${O}${S?` to ${S}`:""}.`,N=(e,n,u,v)=>{let I=new Set(Object.keys(n)),D=_(u.at)??v??new Date().toISOString();for(let C of te(e,I).timed)n[C]=se(T(e)[C],D);for(let C of ae(e,I))n[C]=ue(u.name);return n},q=(e,...n)=>new Set([...w.map(u=>u.field),...n,...z(e.input).map(u=>u.name)]),P=(e,...n)=>te(e,q(e,...n)).left,i=(e,n)=>m(`"${e.title??e.name}" asks for ${n.map(u=>`"${u}"`).join(" and ")}, which no dropped file says, so nothing dropped here can become a ${x}.`),o=(e,n)=>e.list?[n]:n,f={ok:!0,kind:l,fields:w,accept:fe(w,A),...c?{connect:c}:{},intent:K,invite:B,added:L};if(!c){let e=V.find(n=>!n.subject&&F({name:n.name,args:{}}));return e?P(e).length>0?i(e,P(e)):{...f,calls:n=>[{name:e.name,args:N(e,{[n.field]:o(w.find(u=>u.field===n.field),n.value)},n.value,n.at)}]}:m(`This seat may not make a "${l}" here.`)}let s=V.find(e=>e.subject&&(e.subject.kinds==="*"||e.subject.kinds.includes(g.kind))&&(e.connects??[]).includes(c.relation)&&F({name:e.name,args:{[e.subject.arg]:c.record}}));if(s){let e=s.subject.arg;return P(s,e).length>0?i(s,P(s,e)):{...f,calls:n=>[{name:s.name,args:N(s,{[e]:c.record,[n.field]:o(w.find(u=>u.field===n.field),n.value)},n.value,n.at)}]}}let p=V.find(e=>!e.subject&&F({name:e.name,args:{}}));if(!p)return m(`This seat may not make a "${l}" here.`);if(P(p).length>0)return i(p,P(p));let y=E?l:g.kind,W=E?g.kind:l,M=H.find(e=>{if(!(e.connects??[]).includes(c.relation)||!e.subject)return!1;let n=e.subject.kinds;if(n!=="*"&&!n.includes(y))return!1;let u=z(e.input).find(v=>v.name!==e.subject.arg&&(v.kinds.includes("*")||v.kinds.includes(W)));return u?F({name:e.name,args:E?{[u.name]:c.record}:{[e.subject.arg]:c.record}}):!1});if(!M)return m(`This seat may not link a "${l}" to ${c.record} by "${c.relation}".`);let h=M.subject.arg,b=z(M.input).find(e=>e.name!==h&&(e.kinds.includes("*")||e.kinds.includes(W))).name;return{...f,calls:(e,n)=>[{name:p.name,args:N(p,{[e.field]:o(w.find(u=>u.field===e.field),e.value)},e.value,e.at)},{name:M.name,args:E?{[h]:J(n*2),[b]:c.record}:{[h]:c.record,[b]:J(n*2)}}]}}var de=t=>t.type.startsWith("image/"),me=t=>t.type.startsWith("video/"),ge=`
2
2
  [data-graview-drop-over] { outline: 2px dashed var(--graview-accent, Highlight) !important; outline-offset: 2px !important; background-color: color-mix(in srgb, var(--graview-accent, Highlight) 10%, transparent) !important; }
3
3
  [data-graview-drop-status], [data-graview-drop-refused] { margin: 4px 0 0; font: 0.8125rem/1.4 var(--graview-font-body, system-ui, sans-serif); color: var(--graview-ink-muted, GrayText); }
4
4
  [data-graview-drop-refused] { color: var(--graview-warn, var(--graview-ink, CanvasText)); }
@@ -1 +1 @@
1
- import{H as $}from"./chunk.O4WEJ47H.js";import{G as L,La as U,a as I,b as R,c as E,d as f,e as k,j as W,m as F,v as j}from"./chunk.Y4ZUJUUT.js";import{ld as s,sd as b,td as r}from"./chunk.AS4CQBOQ.js";import{b as H}from"./chunk.AJZBJBMO.js";var u=H(L(),1),_=e=>typeof e=="object"&&e!==null&&"idx"in e;function S(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":_(window.history.state)?"pages":null}function K(e){let n=e.face??(e.stop&&E(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:S(e.basePath)??n}function Q(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&S(e.basePath)===null}function X(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?R(f(window.location.hash)):void 0}function Z({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:N,places:w,opens:B,landed:V}){let{view:O,go:p}=U(),g=(0,u.useRef)({shown:t,view:O,onFace:i,landed:V});g.current={shown:t,view:O,onFace:i,landed:V};let m=(0,u.useRef)(n??"/"),P=()=>{m.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:h,onFace:A}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",b(c??m.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){P();let y=a===void 0?h:M(E(a),w),v=q(y)?z(B):y,T=v!==y&&v.overview?"graview":o,x=Y(T,v,N);p(x),window.history.pushState(null,"",`${b(s,{basePath:e})}${k(x)}`),A?.(T);return}A?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=S(e)??"pages",{shown:a,onFace:d,landed:h}=g.current;if(c==="pages"){P(),h?.(m.current),a!=="pages"&&d?.("pages");return}a==="pages"&&(p(M(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function M(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:j(i.kind)}:e}function Y(e,n,t){return e==="graview"?F(n,!0):n.overview?W(F(n,!1),$(n,t)):n}function q(e){return e.focusId===null&&e.overview!==!0}function z(e){return e??{...I,overview:!0}}export{K as a,Q as b,X as c,Z as d,M as e,Y as f,q as g,z as h};
1
+ import{H as $}from"./chunk.2UIUMG23.js";import{G as L,La as U,a as I,b as R,c as E,d as f,e as k,j as W,m as F,v as j}from"./chunk.KA44WNB4.js";import{od as s,vd as b,wd as r}from"./chunk.4TJOS4C7.js";import{b as H}from"./chunk.AJZBJBMO.js";var u=H(L(),1),_=e=>typeof e=="object"&&e!==null&&"idx"in e;function S(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":_(window.history.state)?"pages":null}function K(e){let n=e.face??(e.stop&&E(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:S(e.basePath)??n}function Q(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&S(e.basePath)===null}function X(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?R(f(window.location.hash)):void 0}function Z({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:N,places:w,opens:B,landed:V}){let{view:O,go:p}=U(),g=(0,u.useRef)({shown:t,view:O,onFace:i,landed:V});g.current={shown:t,view:O,onFace:i,landed:V};let m=(0,u.useRef)(n??"/"),P=()=>{m.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:h,onFace:A}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",b(c??m.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){P();let y=a===void 0?h:M(E(a),w),v=q(y)?z(B):y,T=v!==y&&v.overview?"graview":o,x=Y(T,v,N);p(x),window.history.pushState(null,"",`${b(s,{basePath:e})}${k(x)}`),A?.(T);return}A?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=S(e)??"pages",{shown:a,onFace:d,landed:h}=g.current;if(c==="pages"){P(),h?.(m.current),a!=="pages"&&d?.("pages");return}a==="pages"&&(p(M(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function M(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:j(i.kind)}:e}function Y(e,n,t){return e==="graview"?F(n,!0):n.overview?W(F(n,!1),$(n,t)):n}function q(e){return e.focusId===null&&e.overview!==!0}function z(e){return e??{...I,overview:!0}}export{K as a,Q as b,X as c,Z as d,M as e,Y as f,q as g,z as h};
@@ -1,4 +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 Ke}from"./chunk.SDO3U72B.js";import{$b as Fn,Fa as jn,Hc as Bn,J as Nn,Ja as St,Kc as qn,La as Wn,Nc as zn,Wa as Gn,ad as $n,qd as Un,vd as Fe,wc as Kn,wd as wt}from"./chunk.AS4CQBOQ.js";import{a as Ge,b as _}from"./chunk.AJZBJBMO.js";var yo=Ge(w=>{"use strict";var Rt=Symbol.for("react.transitional.element"),Nr=Symbol.for("react.portal"),jr=Symbol.for("react.fragment"),Wr=Symbol.for("react.strict_mode"),Gr=Symbol.for("react.profiler"),Fr=Symbol.for("react.consumer"),Kr=Symbol.for("react.context"),Br=Symbol.for("react.forward_ref"),qr=Symbol.for("react.suspense"),zr=Symbol.for("react.memo"),so=Symbol.for("react.lazy"),$r=Symbol.for("react.activity"),oo=Symbol.iterator;function Ur(e){return e===null||typeof e!="object"?null:(e=oo&&e[oo]||e["@@iterator"],typeof e=="function"?e:null)}var lo={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},uo=Object.assign,co={};function ge(e,t,n){this.props=e,this.context=t,this.refs=co,this.updater=n||lo}ge.prototype.isReactComponent={};ge.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ge.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function fo(){}fo.prototype=ge.prototype;function Tt(e,t,n){this.props=e,this.context=t,this.refs=co,this.updater=n||lo}var Mt=Tt.prototype=new fo;Mt.constructor=Tt;uo(Mt,ge.prototype);Mt.isPureReactComponent=!0;var ro=Array.isArray;function kt(){}var O={H:null,A:null,T:null,S:null},po=Object.prototype.hasOwnProperty;function Ot(e,t,n){var o=n.ref;return{$$typeof:Rt,type:e,key:t,ref:o!==void 0?o:null,props:n}}function Yr(e,t){return Ot(e.type,t,e.props)}function Vt(e){return typeof e=="object"&&e!==null&&e.$$typeof===Rt}function Zr(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var io=/\/+/g;function At(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Zr(""+e.key):t.toString(36)}function Xr(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(kt,kt):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function me(e,t,n,o,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Rt:case Nr:a=!0;break;case so:return a=e._init,me(a(e._payload),t,n,o,r)}}if(a)return r=r(e),a=o===""?"."+At(e,0):o,ro(r)?(n="",a!=null&&(n=a.replace(io,"$&/")+"/"),me(r,t,n,"",function(u){return u})):r!=null&&(Vt(r)&&(r=Yr(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(io,"$&/")+"/")+a)),t.push(r)),1;a=0;var l=o===""?".":o+":";if(ro(e))for(var s=0;s<e.length;s++)o=e[s],i=l+At(o,s),a+=me(o,t,n,i,r);else if(s=Ur(e),typeof s=="function")for(e=s.call(e),s=0;!(o=e.next()).done;)o=o.value,i=l+At(o,s++),a+=me(o,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return me(Xr(e),t,n,o,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function Xe(e,t,n){if(e==null)return e;var o=[],r=0;return me(e,o,"","",function(i){return t.call(n,i,r++)}),o}function Jr(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ao=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Qr={map:Xe,forEach:function(e,t,n){Xe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Xe(e,function(){t++}),t},toArray:function(e){return Xe(e,function(t){return t})||[]},only:function(e){if(!Vt(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};w.Activity=$r;w.Children=Qr;w.Component=ge;w.Fragment=jr;w.Profiler=Gr;w.PureComponent=Tt;w.StrictMode=Wr;w.Suspense=qr;w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O;w.__COMPILER_RUNTIME={__proto__:null,c:function(e){return O.H.useMemoCache(e)}};w.cache=function(e){return function(){return e.apply(null,arguments)}};w.cacheSignal=function(){return null};w.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=uo({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!po.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(o[i]=t[i]);var i=arguments.length-2;if(i===1)o.children=n;else if(1<i){for(var a=Array(i),l=0;l<i;l++)a[l]=arguments[l+2];o.children=a}return Ot(e.type,r,o)};w.createContext=function(e){return e={$$typeof:Kr,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Fr,_context:e},e};w.createElement=function(e,t,n){var o,r={},i=null;if(t!=null)for(o in t.key!==void 0&&(i=""+t.key),t)po.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(r[o]=t[o]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var l=Array(a),s=0;s<a;s++)l[s]=arguments[s+2];r.children=l}if(e&&e.defaultProps)for(o in a=e.defaultProps,a)r[o]===void 0&&(r[o]=a[o]);return Ot(e,i,r)};w.createRef=function(){return{current:null}};w.forwardRef=function(e){return{$$typeof:Br,render:e}};w.isValidElement=Vt;w.lazy=function(e){return{$$typeof:so,_payload:{_status:-1,_result:e},_init:Jr}};w.memo=function(e,t){return{$$typeof:zr,type:e,compare:t===void 0?null:t}};w.startTransition=function(e){var t=O.T,n={};O.T=n;try{var o=e(),r=O.S;r!==null&&r(n,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(kt,ao)}catch(i){ao(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),O.T=t}};w.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()};w.use=function(e){return O.H.use(e)};w.useActionState=function(e,t,n){return O.H.useActionState(e,t,n)};w.useCallback=function(e,t){return O.H.useCallback(e,t)};w.useContext=function(e){return O.H.useContext(e)};w.useDebugValue=function(){};w.useDeferredValue=function(e,t){return O.H.useDeferredValue(e,t)};w.useEffect=function(e,t){return O.H.useEffect(e,t)};w.useEffectEvent=function(e){return O.H.useEffectEvent(e)};w.useId=function(){return O.H.useId()};w.useImperativeHandle=function(e,t,n){return O.H.useImperativeHandle(e,t,n)};w.useInsertionEffect=function(e,t){return O.H.useInsertionEffect(e,t)};w.useLayoutEffect=function(e,t){return O.H.useLayoutEffect(e,t)};w.useMemo=function(e,t){return O.H.useMemo(e,t)};w.useOptimistic=function(e,t){return O.H.useOptimistic(e,t)};w.useReducer=function(e,t,n){return O.H.useReducer(e,t,n)};w.useRef=function(e){return O.H.useRef(e)};w.useState=function(e){return O.H.useState(e)};w.useSyncExternalStore=function(e,t,n){return O.H.useSyncExternalStore(e,t,n)};w.useTransition=function(){return O.H.useTransition()};w.version="19.2.8"});var j=Ge((Na,mo)=>{"use strict";mo.exports=yo()});var Po=Ge(et=>{"use strict";var ui=Symbol.for("react.transitional.element"),ci=Symbol.for("react.fragment");function Eo(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:ui,type:e,key:o,ref:t!==void 0?t:null,props:n}}et.Fragment=ci;et.jsx=Eo;et.jsxs=Eo});var Ie=Ge((za,Ao)=>{"use strict";Ao.exports=Po()});var fe={focusId:null,relation:null,expanded:[],pins:{}},Be=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function te(e){let t=new URLSearchParams;e.focusId&&t.set("focus",e.focusId),e.relation&&t.set("relation",e.relation),e.overview&&t.set("overview","1"),e.zoom&&t.set("zoom","1"),e.past&&t.set("past","1"),e.shown&&e.shown.length>0&&t.set("show",[...e.shown].sort().join(",")),e.selection!==void 0&&e.selection.length>0&&t.set("sel",[...e.selection].sort().join(",")),e.expanded.length>0&&t.set("expand",[...e.expanded].sort().join(","));for(let o of Object.keys(e.pins).sort()){let r=e.pins[o];t.set(`pin.${o}`,`${qe(r.x)},${qe(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${qe(e.pan.x)},${qe(e.pan.y)}`);for(let o of Object.keys(e.within??{}).sort()){let r=e.within[o];r.length>0&&t.set(`in.${o}`,r)}e.q&&e.q.trim().length>0&&t.set("q",e.q);let n=t.toString();return n?`#${n}`:"#"}function Cr(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function ze(e){let t=e.includes("#")?e.slice(e.indexOf("#")+1):e,n=new URLSearchParams(t),o=Object.create(null);for(let[m,p]of n){if(!m.startsWith("pin."))continue;let[g,v]=p.split(","),T=g===void 0?null:Be(g),y=v===void 0?null:Be(v);T===null||y===null||(o[m.slice(4)]={x:T,y})}let r=Object.create(null);for(let[m,p]of n)!m.startsWith("in.")||p.length===0||(r[m.slice(3)]=p);let i=n.get("view");i&&i.length>0&&r.view===void 0&&(r.view=i);let a=n.get("pan")?.split(",")??[],l=a[0]===void 0?null:Be(a[0]),s=a[1]===void 0?null:Be(a[1]),u=(n.get("sel")??"").split(",").filter(m=>m.length>0).sort(),f=n.get("overview")==="1";return{...u.length>0?{selection:u}:{},...f?{overview:!0}:{},...n.get("zoom")==="1"?{zoom:!0}:{},...n.get("past")==="1"?{past:!0}:{},...n.get("show")?{shown:[...new Set(n.get("show").split(",").filter(Boolean))].sort()}:{},...l!==null&&s!==null?{pan:{x:l,y:s}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:Cr(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(m=>m.length>0&&(f||!m.startsWith("kind:"))).sort(),pins:o}}function ba(e){let t=ze(e);return te(t)==="#"?{...t,overview:!0}:t}function xa(e){let t=te(e);return t==="#overview=1"?"":t}function qe(e){return Math.round(e*100)/100}function Zn(e,t){return te(e)===te(t)}var Yn="edge:";function Xn(e){if(!e.startsWith(Yn))return null;let t=e.slice(Yn.length).split(":");if(t.length!==3)return null;let[n,o,r]=t;if(!n||!o||!r)return null;try{return{kind:decodeURIComponent(n),from:decodeURIComponent(o),to:decodeURIComponent(r)}}catch{return null}}function vt(e){let{pan:t,...n}=e;return{...n,pins:{}}}function q(e,t){if(t===e.focusId)return{...e,focusId:t};let n=vt(e);return{...n.within?.q!==void 0?ae(n,"q",null):n,focusId:t}}function Jn(e,t){return{...e,relation:t}}function ae(e,t,n){let o={...e.within??{}};if(n===null?delete o[t]:o[t]=n,Object.keys(o).length===0){let{within:r,...i}=e;return i}return{...e,within:o}}function pe(e,t){if(t!==e.overview&&(e=vt(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function $e(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function Ve(e,t){if(t!==(e.zoom===!0)&&(e=vt(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function Ue(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}var Ze="aggregate:",Ye="kind:";function bt(e){return`${Ye}${e}`}function ye(e){return e.startsWith(Ye)?e.slice(Ye.length):null}var Aa="kinds:beyond";function Ir(e){let t=ye(e);return t?[t]:se(e)}function ne(...e){return`${Ze}${[...e].sort().join("+")}`}function Qn(e){return e.startsWith(Ze)}function se(e){return!Qn(e)||e.includes("|")?[]:e.slice(Ze.length).split("+").filter(Boolean)}function eo(e,t,n={}){let o=ye(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return Ue(e,t);let r=o!==null?ne(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return Ve(e,!1);if(o!==null&&n.carry){let i=pe({...q(e,r),relation:null},!1);return ae(Ve(i,!0),"q",n.carry)}return Ve({...q(e,r),relation:null},!0)}function _r(e,t,n){return ae(pe(q(e,ne(t)),!1),"view",n)}function ka(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var to="aggregate:";function xt(e){return e.startsWith(to)&&e.includes("|")}var Et=e=>e?.off===!0,Lr=e=>e!==void 0&&!Et(e)&&(e.fast!==void 0||e.thinking!==void 0||e.answer!==void 0||e.decide!==void 0||e.complete!==void 0||e.turn!==void 0),no=e=>e!==void 0&&!Et(e)&&(e.fast!==void 0||e.decide!==void 0),Hr=e=>e?.suggestOnOpen!==!1&&no(e),Dr=e=>e?.hoverChips===!0&&no(e);var Pt={};var go=_(j(),1),ei={turns:[],outcomes:new Map,busy:!1,pending:null,draft:null,draftNote:null},ho=e=>`graview:seat:${e}`;function ti(e){if(!e)return{};try{let t=sessionStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return{...Array.isArray(n.turns)?{turns:n.turns}:{},...Array.isArray(n.outcomes)?{outcomes:new Map(n.outcomes)}:{},...n.draft?.drawn?{draft:n.draft}:{}}}catch{return{}}}function ni(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],draft:t.draft}))}catch{}}function Ct(e){let t=e===null?null:ho(e),n={...ei,...ti(t)},o=new Set,r=(i,a=!0)=>{n=i,a&&ni(t,n);for(let l of[...o])l()};return{get:()=>n,subscribe(i){return o.add(i),()=>void o.delete(i)},setTurns:i=>r({...n,turns:i(n.turns)}),settle:(i,a)=>r({...n,outcomes:new Map(n.outcomes).set(i,a)}),setBusy:i=>r({...n,busy:i},!1),ask:i=>r({...n,pending:i.trim()||null}),takePending(){let i=n.pending;return i!==null&&r({...n,pending:null},!1),i},setDraft:(i,a=null)=>r({...n,draft:i,draftNote:a})}}function oi(e){return(0,go.useSyncExternalStore)(e.subscribe,e.get,e.get)}var wo=_(j(),1),ri={entries:[],ghost:null,loaded:!1};function So(e,t){let n=new Map(e.map(o=>[o.id,o]));for(let o of t)n.set(o.id,{...n.get(o.id),...o});return[...n.values()].sort((o,r)=>o.at<r.at?1:o.at>r.at?-1:0)}function It(e){let t=ri,n=new Set,o=r=>{t=r;for(let i of[...n])i()};return{get:()=>t,subscribe:r=>(n.add(r),()=>n.delete(r)),record:r=>{o({...t,entries:So(t.entries,[r])}),Promise.resolve(e()?.keep?.(r)).catch(i=>{console.warn("The host did not keep an AI interaction:",i)})},setGhost:r=>o({...t,ghost:r}),load:()=>{if(t.loaded)return;o({...t,loaded:!0});let r=e()?.load;r&&Promise.resolve(r()).then(i=>o({...t,entries:So(t.entries,i)})).catch(i=>{console.warn("The host's AI interactions could not be read:",i)})}}}function ii(e){return(0,wo.useSyncExternalStore)(e.subscribe,e.get,e.get)}function vo(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}var Je=_(j(),1),Qe=(0,Je.createContext)(void 0),ai=()=>(0,Je.useContext)(Qe);var A=_(j(),1),Ce=(0,A.createContext)(null);function xo(){return(0,A.useContext)(Ce)}function si(e,t){let n=xo(),o=(0,A.useMemo)(()=>n?n.live.seenBy(t):e,[n,e,t]),r=(0,A.useRef)(0),i=(0,A.useCallback)(a=>o.subscribe(()=>{r.current+=1,a()}),[o]);return(0,A.useSyncExternalStore)(i,()=>r.current,()=>0),o}var li=Ke(()=>(__graviewPreload(import.meta.url,["./chunk.TI4OSTQV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.E2AJ7U5Z.js"))),bo,di=400;function _t(e,t,n){let o=(0,A.useContext)(Ce),r=o!==null&&o.owns(e,t),[i,a]=(0,A.useState)(null),[l,s]=(0,A.useState)(bo);(0,A.useEffect)(()=>{if(l||r||i===null)return;let x=!0;return li().then(C=>{bo=C,x&&s(C)},()=>{}),()=>{x=!1}},[l,r,i]);let[u,f]=(0,A.useState)(0),m=(0,A.useMemo)(()=>r||i===null||i>=e.log.length||!l?void 0:l.askArchived(e,i,n)??l.askDeclaration(n,i),[r,e,i,n,l,u]),p=m&&"waiting"in m?m.waiting:void 0,g=m&&"seq"in m?m:null,[v,T]=(0,A.useState)(void 0);(0,A.useEffect)(()=>{if(!p)return;let x=!0,C=setTimeout(()=>x&&T(p),di);return p.then(()=>x&&f(V=>V+1)),()=>{x=!1,clearTimeout(C)}},[p]);let y=p!==void 0&&v!==p||g!==null,b=(0,A.useMemo)(()=>{if(r||i===null||i>=e.log.length||!l||y)return null;try{let x=l.pastAt(e,i,n);return{seq:i,at:x.past?.at,store:x}}catch{return null}},[r,e,i,n,l,y,u]),h=(0,A.useRef)(null),E=y?h.current:b;(0,A.useEffect)(()=>{h.current=E},[E]);let P=(0,A.useCallback)(x=>a(x===null?null:x>=e.log.length?Number.POSITIVE_INFINITY:x),[e]),W=(0,A.useCallback)((x,C)=>[e,E?.store].some(V=>V!==void 0&&(V===x||V.seenBy(C)===x)),[e,E]),N=i!==null,H=(0,A.useMemo)(()=>({past:E,open:N,show:P,live:e,host:n,owns:W,archive:g}),[E,N,P,e,n,W,g]);return r?o:H}var ko=e=>`graview:setting:${e}`;function Ro(){return localStorage}function To(e,t){try{let n=(t??Ro()).getItem(ko(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function Mo(e,t,n){try{(n??Ro()).setItem(ko(e.name),t)}catch{}}function Oo(e,t){if(typeof document>"u")return;let n=document.documentElement;if(e.honored==="root-font-size"){n.style.fontSize=t===e.initial?"":t;return}let o=`graview${e.name.replace(/-([a-z0-9])/g,(r,i)=>i.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}`;t===e.initial?delete n.dataset[o]:n.dataset[o]=t}var L=_(j(),1);function Lt(e){return Fe(e)}var fi=12,pi=4;function yi(e,t,n){let o=Lt(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var tt=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-fi);function Vo(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=pi)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?bt([...o][0]):n[0]}function Ht(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[a,l]of e)l.mode!=="asking"&&l.mode!=="docked"&&t.at-l.since>=t.holdMs&&o.set(a,{...l,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=yi(e,t.author,t.at),i=a=>o.set(r.participant,{...r,...a,since:t.at});switch(t.type){case"read":{let a=Vo(t.ids,n);return i({at:a,mode:"reading",trail:tt(r.trail,a)}),o}case"about-to-write":case"write":{let a=Vo(t.ids,n);return i({at:a,mode:"writing",trail:tt(r.trail,a),say:void 0,confidence:void 0}),o}case"refused":return i({at:t.where,mode:"refused",say:t.say,confidence:void 0,trail:tt(r.trail,t.where)}),o;case"asking":return i({at:t.where??r.at,mode:"asking",say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},trail:tt(r.trail,t.where)}),o;case"said":return i({say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},...t.caption?{caption:t.caption}:{}}),o;case"over":return i({over:t.over}),o;case"home":return i({at:null,mode:"docked",trail:[],say:void 0,confidence:void 0,over:null}),o;default:return o}}var Co="graview:session";function Io(e){let t=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);try{let n=e??sessionStorage,o=n.getItem(Co);if(o)return o;let r=t();return n.setItem(Co,r),r}catch{return t()}}var Dt={name:"share-where",title:"Where you are",description:"Whether the others here see which stop you are on.",honored:"root-attribute",options:[{value:"shared",label:"Shown"},{value:"private",label:"Hidden"}],initial:"shared"},Nt={name:"share-over",title:"What you point at",description:"Whether the others see the thing under your pointer, outlined in your color.",honored:"root-attribute",options:[{value:"private",label:"Kept to yourself"},{value:"shared",label:"Outlined for others"}],initial:"private"},_o=[Dt,Nt],gi=800;function Lo(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:a,seatWho:l,settingValues:s,setView:u,ttlMs:f=1e4,people:m,seats:p}=e,[g,v]=(0,L.useState)(()=>new Map),[T,y]=(0,L.useState)(null),[b,h]=(0,L.useState)(null),[E,P]=(0,L.useState)(null),W=typeof r.id=="string"&&r.id.length>0,N=W&&(s[Dt.name]??Dt.initial)==="shared",H=N&&(s[Nt.name]??Nt.initial)==="shared",x=Lt({kind:r.kind,...r.id?{id:r.id}:{},session:i}),C=W?Gn(r,{graph:n.graph,schema:n.schema,...p?{seats:p}:{},...m?{people:m}:{}}):"",V=l?a.get(`agent:${l}:${i}`):void 0,F=(0,L.useMemo)(()=>!t||!N?null:{participant:x,kind:r.kind,name:C,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:Fn(r.id??"nobody"),stop:E??te(o),...H?{over:T}:{},...V?{robot:{at:V.at,mode:V.mode}}:{},at:new Date().toISOString()},[t,N,H,x,C,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,E,T,V?.at,V?.mode]);(0,L.useEffect)(()=>{if(!t||!F)return;t.here(F);let I=setInterval(()=>t.here({...F,at:new Date().toISOString()}),gi);return()=>clearInterval(I)},[t,F]),(0,L.useEffect)(()=>t?t.onWho(K=>v(wt(new Map,K,Date.now(),f))):void 0,[t,f]);let Z=g.size>0;(0,L.useEffect)(()=>{if(!Z)return;let I=setInterval(()=>{v(K=>{let Q=wt(K,[],Date.now(),f);return Q.size===K.size?K:Q})},Math.max(250,Math.min(1e3,f/4)));return()=>clearInterval(I)},[Z,f]),(0,L.useEffect)(()=>{if(!t||typeof window>"u")return;let I=()=>t.leave();return window.addEventListener("pagehide",I),()=>window.removeEventListener("pagehide",I)},[t]),(0,L.useEffect)(()=>{if(!H||typeof document>"u")return;let I=null,K=Q=>{let Ee=vo(Q.target);Ee!==I&&(I=Ee,y(Ee))};return document.addEventListener("pointermove",K,{passive:!0}),()=>document.removeEventListener("pointermove",K)},[H]);let X=(0,L.useRef)(null),z=b?g.get(b)??null:null,de=(0,L.useCallback)(I=>{X.current=null,h(I)},[]);return(0,L.useEffect)(()=>{if(b){if(!z){h(null);return}z.stop!==X.current?.stop&&(X.current={stop:z.stop,at:Date.now()},u(ze(z.stop)))}},[b,z,u]),(0,L.useEffect)(()=>{let I=X.current;!b||I===null||Date.now()-I.at<400||Zn(o,ze(I.stop))||h(null)},[o,b]),(0,L.useEffect)(()=>{if(!b||typeof document>"u")return;let I=K=>{K.key==="Escape"&&h(null)};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[b]),(0,L.useMemo)(()=>({who:g,sharing:F?{participant:x,name:C}:null,following:z,follow:de,sayWhere:P}),[g,F,x,C,z,de])}var U=_(j(),1);function Ho(e){return Fe(e.author)}function hi(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function Do(e,t,n,o,r){let i=new Map;for(let[s,u]of e)o-u.at<r&&i.set(s,u);let a=new Set(n.flatMap(s=>s.nodeIds)),l=(s,u,f)=>{let m=i.get(s),p=m?.participants.includes(Ho(u))?m.participants:[...m?.participants??[],Ho(u)];i.set(s,{at:o,manner:hi(p,u.author.kind),intent:u.intent,wrote:(m?.wrote??!1)||(f.wrote??!1),read:(m?.read??!1)||(f.read??!1),broke:(m?.broke??!1)||a.has(s),participants:p})};for(let s of t){for(let u of s.writes)l(u,s,{wrote:!0});for(let u of s.reads)s.writes.includes(u)||l(u,s,{read:!0})}for(let s of n)for(let u of s.nodeIds){let f=i.get(u);i.set(u,{at:o,manner:f?.manner??"rule",intent:f?.intent??s.message,wrote:f?.wrote??!1,read:f?.read??!1,broke:!0,participants:f?.participants??["rule::"]})}return i}var Si=2600;function No(e,t=Si){let[n,o]=(0,U.useState)(()=>new Map),r=(0,U.useRef)(n);r.current=n;let i=(0,U.useRef)(null),a=(0,U.useCallback)(s=>{r.current=s,o(s),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,U.useEffect)(()=>{let s=e.violations(),u=e.subscribe((f,m)=>{let p=e.violations(),g=zn(e.allInvariants(),s,p).introduces;s=p,a(Do(r.current,m,g.map(v=>({nodeIds:v.nodeIds,message:v.message})),Date.now(),t))});return()=>{u(),i.current&&clearTimeout(i.current)}},[e,t,a]);let l=(0,U.useCallback)(s=>{s.reads.length!==0&&a(Do(r.current,[wi(s)],[],Date.now(),t))},[t,a]);return{activity:n,noteAttention:l}}function wi(e){return{id:`attention:${e.intent}`,seq:-1,batch:"attention",author:e.author,intent:e.intent,mutation:null,primitives:[],reads:e.reads,writes:[],at:new Date().toISOString()}}var d=_(j(),1);function jo(){let e=null,t=new Set,n=new Set,o=r=>{for(let i of n)i(r)};return{subscribe(r){return t.add(r),t.size===1&&o(!0),()=>{t.delete(r),t.size===0&&(e=null,o(!1))}},snapshot:()=>e,set(r){if(!(e===r||e&&r&&e.x===r.x&&e.y===r.y)){e=r;for(let i of t)i()}},get listeners(){return t.size},onActive(r){return n.add(r),()=>void n.delete(r)}}}var nt=_(j(),1),vi=e=>e.definitions.some(t=>jn(t).size>0);function Wo(e,t,n){let[o,r]=(0,nt.useState)(void 0),i=(n.roles??[]).join("\0");return(0,nt.useEffect)(()=>{if(!t||!vi(e.schema)){r(void 0);return}let a=!0,l=!1,s=e.graph,u=()=>{l||(l=!0,queueMicrotask(()=>{l=!1,a&&e.reread()}))},f=Wn(t,{kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{}},u);return St(s,f.read),r(f),e.reread(),()=>{a=!1,St(s,void 0)}},[e,t,n.kind,n.id,i]),o}function Go(){let e=!1,t=new Set;return{moving:()=>e,set(n){if(n!==e){e=n;for(let o of t)o()}},subscribe(n){return t.add(n),()=>t.delete(n)}}}var le=_(Ie(),1),bi="graview:place-menu",_e=(0,d.createContext)(null),qo=(0,d.createContext)("scene");function xi({mode:e,children:t}){return(0,le.jsx)(qo.Provider,{value:e,children:t})}function Ei(){return(0,d.useContext)(qo)}var zo={kind:"human"},Pi=[],Ai=[],ki=[],jt=[];function $o(e,t){let n=(0,d.useId)();(0,d.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??zo,r=()=>qn(e,o,n);r();let i,a=e.subscribe(()=>{clearTimeout(i),i=setTimeout(r,250)});return()=>{clearTimeout(i),a(),globalThis.__graviewWatch?.unseen?.({words:[],from:n,gone:!0})}},[e,t,n])}var Ri={off:!0};function Ti({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,seats:a=Pi,onSeat:l,people:s=Ai,memory:u,presenceTtlMs:f,app:m,settings:p=m?.settings??ki,presence:g,brand:v,locale:T,timeZone:y,onKeepLens:b,providers:h,ai:E,files:P,resolveApp:W,history:N,linkedRecords:H,menuSections:x,keptViews:C,subscriptions:V,signIn:F,view:Z,onViewChange:X,children:z}){let de=(0,d.useContext)(_e),I=x??de?.menuSections,K=F??de?.signIn,Q=C??de?.keptViews,[Ee,wr]=(0,d.useState)(null),ue=Ee??i??a[0]?.principal??zo,He=_t(e,ue,N),nn=He.past&&He.live===e?He.past.store:e,D=(0,d.useMemo)(()=>nn.seenBy(ue),[nn,ue]);$o(e,ue);let[re]=(0,d.useState)(()=>Io(u)),[on,vr]=(0,d.useState)(!1),rn=(0,d.useCallback)(()=>vr(!0),[]),ie=(0,d.useMemo)(()=>g?[...p,..._o]:p,[p,g]),[pt]=(0,d.useState)(()=>n??Kt(t,e.schema)),[br,an]=(0,d.useState)(()=>$e(pt??fe,r??pt?.selection??[])),Pe=(0,d.useRef)(pt??fe).current,[sn,xr]=(0,d.useState)(null),[ln,Er]=(0,d.useState)(null),J=(0,d.useContext)(_e),[dn]=(0,d.useState)(()=>J?.seatTalk??Ct(v?.name??e.schema.kinds.join(","))),yt=E??J?.ai??Pt,De=(0,d.useMemo)(()=>yt.off?Ri:yt,[yt]),un=(0,d.useRef)(De.interactions);un.current=De.interactions;let[cn]=(0,d.useState)(()=>J?.aiDesk??It(()=>un.current)),[Pr]=(0,d.useState)(()=>J?.subscriptions??Bn()),fn=V??J?.subscriptions??Pr,mt=b??J?.onKeepLens,Ne=m??J?.app,je=T??J?.locale,Ar=v?.locale??Ne?.brand?.locale,We=y??J?.timeZone;Nn({reader:je,app:Ar,readerTimeZone:We,appTimeZone:v?.timeZone??Ne?.brand?.timeZone});let pn=(0,d.useRef)(null),yn=(0,d.useCallback)(c=>{pn.current=c},[]),mn=(0,d.useCallback)(c=>pn.current?.whereIs(c)??null,[]),[gn]=(0,d.useState)(()=>jo()),[hn]=(0,d.useState)(()=>Go()),[gt,kr]=(0,d.useState)(null),[Ae,Sn]=(0,d.useState)(()=>new Map),ke=(0,d.useRef)(Ae);ke.current=Ae;let Re=(0,d.useRef)(null),ht=(0,d.useCallback)(c=>D.graph.getNode(c)?.kind,[D]),ee=(0,d.useCallback)(c=>{let S=Ht(ke.current,c,ht);ke.current=S,Sn(S),Re.current&&clearTimeout(Re.current),[...S.values()].some(M=>M.mode!=="docked"&&M.mode!=="asking")&&(Re.current=setTimeout(()=>{let M=Ht(ke.current,{type:"rest",at:Date.now(),holdMs:Ft},ht);ke.current=M,Sn(M)},Ft+20))},[ht]),wn=(0,d.useCallback)(c=>ee({...c,at:c.at??Date.now()}),[ee]),vn=(0,d.useCallback)(c=>{kr(c),c&&ee({type:"home",author:{kind:"agent",id:c,session:re},at:Date.now()})},[ee,re]);(0,d.useEffect)(()=>D.subscribe((c,S)=>{for(let k of S)k.author.kind==="agent"&&ee({type:"write",author:k.author,ids:k.writes,at:Date.now()})}),[D,ee]),(0,d.useEffect)(()=>()=>{Re.current&&clearTimeout(Re.current)},[]);let $=(0,d.useMemo)(()=>({...ue,session:re}),[ue,re]),bn=Wo(D,H,$),xn=(0,d.useCallback)(c=>{wr(c),l?.(c)},[l]),[Te,Rr]=(0,d.useState)(()=>Object.fromEntries(ie.map(c=>[c.name,To(c,u)])));(0,d.useEffect)(()=>{for(let c of ie)Oo(c,Te[c.name]??c.initial)},[ie,Te]);let En=(0,d.useCallback)((c,S)=>{let k=ie.find(M=>M.name===c);!k||!k.options.some(M=>M.value===S)||(Mo(k,S,u),Rr(M=>({...M,[c]:S})))},[ie,u]),[Pn,Tr]=(0,d.useState)(null),{activity:An,noteAttention:kn}=No(D),Rn=(0,d.useCallback)(c=>{kn(c),ee({type:"read",author:c.author,ids:c.reads,at:Date.now()})},[kn,ee]),ce=(0,d.useCallback)(c=>{if(ye(c)!==null||se(c).length>0||xt(c))return!0;let S=Xn(c);return S?D.graph.allEdges().some(k=>k.kind===S.kind&&k.from===S.from&&k.to===S.to):D.graph.getNode(c)!==void 0},[D]),Tn=(0,d.useCallback)(c=>{let S=c.selection??jt,k=S.filter(ce),M=k.length===S.length?c:$e(c,k);return M.focusId!==null&&!ce(M.focusId)&&(M=q(M,null)),M},[ce]),Me=(0,d.useCallback)(c=>{let S=Tn(c),k=Bo(D,$,S.shown);if(S.focusId!==null&&k.size>0){let M=se(S.focusId),Dn=D.graph.getNode(S.focusId);(M.length>0?M.every(Vr=>k.has(Vr)):Dn?k.has(Dn.kind):!1)&&(S={...S,focusId:null})}if(!S.overview&&S.focusId===null){let M=Pe.focusId!==null&&!ce(Pe.focusId)?Kt(t,e.schema)??{...fe,overview:!0}:Pe;M.focusId!==null&&ce(M.focusId)?S={...S,focusId:M.focusId}:M.overview===!0&&(S={...S,overview:!0})}return S},[Tn,ce,D,Pe,$,t,e.schema]),B=Me(Z??br),Mn=(0,d.useMemo)(()=>Bo(D,$,B.shown),[D,$,B.shown]),On=(0,d.useMemo)(()=>[...D.modules.administered.entries()].map(([c,S])=>{let k=D.mayAdminister(c,$);return{name:c,...S.description?{description:S.description}:{},kinds:S.kinds??[],canShow:k,shown:k&&(B.shown??[]).includes(c)}}),[D,$,B.shown]),Oe=(0,d.useCallback)(c=>{let S=k=>Me(typeof c=="function"?c(k):c);if(Z!==void 0){X?.(S(Z));return}X&&X(S(B)),an(k=>S(k))},[B,X,Z,Me]);(0,d.useEffect)(()=>{Z===void 0&&an(c=>{let S=Me(c);return S===c?c:S})},[B,Z,Me]);let Vn=B.selection??jt,Cn=(0,d.useCallback)(c=>{Oe(S=>$e(S,typeof c=="function"?c(S.selection??jt):c))},[Oe]),{who:In,following:_n,follow:Ln,sayWhere:Mr,sharing:Hn}=Lo({channel:g,store:D,view:B,principal:$,session:re,robots:Ae,seatWho:gt,settingValues:Te,setView:Oe,seats:a,people:s,...f!==void 0?{ttlMs:f}:{}}),Or=(0,d.useMemo)(()=>({store:D,scheme:o,views:t,view:B,setView:Oe,homeView:Pe,selection:Vn,setSelection:Cn,menuAt:sn,setMenuAt:xr,whereIs:mn,pointer:gn,motion:hn,registerScene:yn,robots:Ae,noteSeat:wn,seatWho:gt,registerSeatWho:vn,actsDoor:ln,registerActsDoor:Er,seatTalk:dn,aiDesk:cn,...u?{memory:u}:{},who:In,following:_n,follow:Ln,sayWhere:Mr,sharing:Hn,session:re,ai:De,resolveApp:W,linkedRecords:H,menuSections:I,...Q?{keptViews:Q}:{},subscriptions:fn,signIn:K,linkedReads:bn,movedByHand:on,noteMoved:rn,emphasis:Pn,setEmphasis:Tr,activity:An,noteAttention:Rn,principal:$,seats:a,people:s,takeSeat:xn,settings:ie,settingValues:Te,chooseSetting:En,hiddenKinds:Mn,administered:On,...h?{providers:h}:{},...v?{brand:v}:{},...mt?{onKeepLens:mt}:{},app:Ne,...je?{locale:je}:{},...We?{timeZone:We}:{}}),[D,o,t,B,Oe,Vn,Cn,sn,mn,gn,hn,yn,Ae,wn,gt,vn,ln,dn,cn,u,In,_n,Ln,Hn,re,De,W,H,I,Q,fn,K,bn,on,rn,Pn,An,Rn,$,a,s,xn,ie,Te,En,Mn,On,h,v,mt,Ne,je,We]);return(0,le.jsx)(_e.Provider,{value:Or,children:(0,le.jsx)(Ce.Provider,{value:He,children:(0,le.jsx)(Ii,{children:P?(0,le.jsx)(Qe.Provider,{value:P,children:z}):z})})})}var Uo=(0,d.createContext)(null),Wt,Gt=new Set,Mi=e=>(Gt.add(e),()=>void Gt.delete(e)),Fo=()=>Wt;function Oi(e){if(!Wt){Wt=e;for(let t of[...Gt])t()}}var Vi=300;function Ci(e){let t=0;return async(n,o)=>{let r=++t;return await new Promise(i=>setTimeout(i,Vi)),r===t?e(n,o):[]}}function Ii({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:a,ai:l}=oe(),s=ot(),u=n.q,f=n.focusId,m=!!(u&&u.trim().length>0),p=(0,d.useSyncExternalStore)(Mi,Fo,Fo),g=(0,d.useMemo)(()=>m&&p?{flagged:new Set(t.violations().flatMap(E=>E.nodeIds)),touched:p.touchWeights(t.log.all())}:null,[t,s,m,p]),v=f?t.graph.getNode(f)?.kind??ye(f)??(se(f).length===1?se(f)[0]:void 0):void 0,T=(0,d.useMemo)(()=>l.near&&Ci(l.near),[l.near]),y=(0,d.useMemo)(()=>!u||!g||!p?null:p.search(t,u,{...v?{inKind:v}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(E=>!i.has(E)),from:[...a,...f&&t.graph.has(f)?[f]:[]],flagged:g.flagged,touched:g.touched,limit:200,rank:T}),[t,u,r,o,i,a,f,v,g,T]),[b,h]=(0,d.useState)();return(0,d.useEffect)(()=>void y?.later?.then(E=>h([y,E])),[y]),(0,le.jsx)(Uo.Provider,{value:b?.[0]===y?b[1]:y,children:e})}var Ko=new WeakMap;function xs(e){let t=Ko.get(e);return t||Ko.set(e,t=new Set(e.matched)),t}function _i(){return(0,d.useContext)(Uo)}function oe(){let e=(0,d.useContext)(_e);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function Bt(){return(0,d.useContext)(_e)??null}function ot(){let{store:e}=oe(),t=(0,d.useRef)(null),n=(0,d.useRef)(null),o=(0,d.useCallback)(()=>(n.current!==e&&(n.current=e,t.current=null),t.current??=e.graph.allNodes(),t.current),[e]),r=(0,d.useCallback)(i=>e.subscribe(()=>{t.current=null,i()}),[e]);return(0,d.useSyncExternalStore)(r,o,o)}function Li(e){let{store:t}=oe(),n=(0,d.useCallback)(r=>t.subscribe(r),[t]),o=(0,d.useCallback)(()=>e===null?void 0:t.graph.getNode(e),[t,e]);return(0,d.useSyncExternalStore)(n,o,o)}function Bo(e,t,n){let o=new Set(e.modules.disabledKinds);for(let r of e.kindsKeptFrom(t))o.add(r);for(let[r,i]of e.modules.administered)if(!(e.mayAdminister(r,t)&&(n??[]).includes(r)))for(let a of i.kinds??[])o.add(a);return o}var Ft=2600;var Yo=new WeakSet,Hi=e=>Yo.has(e),Di=e=>void Yo.add(e);function Kt(e,t){let n=Un(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...fe,focusId:ne(n.place.kind),within:{view:n.place.as}}:{...fe,focusId:ne(n.kind)}}var Zo=_(j(),1),Ni=(0,Zo.createContext)(!1);var rt=Symbol.for("graview.default-view");function Xo(e){return Object.defineProperty(e,rt,{value:!0,enumerable:!1}),e}function Jo(e){return typeof e=="function"&&e[rt]===!0}var it=Symbol.for("graview.replaces-page");function Qo(e){return Object.defineProperty(e,it,{value:!0,enumerable:!1}),e}function er(e){return typeof e=="function"&&e[it]===!0}var at=Symbol.for("graview.bleeds");function tr(e){return Object.defineProperty(e,at,{value:!0,enumerable:!1}),e}function nr(e){return typeof e=="function"&&e[at]===!0}var st=Symbol.for("graview.previews");function or(e,t={}){return Object.defineProperty(e,st,{value:t,enumerable:!1}),e}function rr(e){return typeof e=="function"?e[st]:void 0}function ji(e){return $n(e)}function Wi(e,t){if(t===e)return e;for(let r of t.registrations())e.register(r.kind,r,r.view,r);let n=t.arrangement?.();n&&e.arrange?.(n);let o=t.homeView?.();return o&&e.home?.(o),e}var R=_(j(),1),Y=_(Ie(),1),qt=new Set,lt=0;function zt(e){return()=>{lt+=1;let t=e();return t.then(()=>void(lt-=1),()=>void(lt-=1)),t}}var Gi=()=>lt,ut=(0,R.createContext)(null);function Fi(){return{waiting:new Map,at:0}}function Ki(e){for(let[t,n]of e.waiting)n<e.at&&e.waiting.delete(t);e.at+=1}var Bi=e=>e?.waiting.size??0;function sr(e,t){e?.waiting.set(t,e.at)}function lr(e){let t=(0,R.useContext)(ut);(0,R.useLayoutEffect)(()=>{t?.waiting.delete(e)},[t,e])}function qi(e){let t={},n=!1,o=new Set,r=(0,R.lazy)(zt(()=>e().then(a=>{n=!0;let l=a.default;function s(u){return lr(t),(0,R.createElement)(l,u)}return{default:s}},a=>{for(let l of o)l.waiting.delete(t);throw a})));function i(a){let l=(0,R.useContext)(ut);return!n&&l&&(o.add(l),sr(l,t)),(0,R.createElement)(r,a)}return i}var dr=!1,ur=!1,dt=new Set;function zi(){dr=!0}function $i(){ur=!0;for(let e of[...dt])e();dt.clear()}var cr=()=>ur||!dr;function Ui(e){return cr()?(e(),()=>{}):(dt.add(e),()=>void dt.delete(e))}var ir=!1;function $t(){for(let e of[...qt])e()}function Yi(){ir||typeof window>"u"||(ir=!0,window.addEventListener("online",$t))}function Ut(e){let t,n=!1,o=!1,r,i=0,a=new Set,l=()=>{i+=1;for(let p of[...a])p()},s=p=>(a.add(p),()=>void a.delete(p)),u=()=>i,f=()=>void m().catch(()=>{});function m(){if(n)return Promise.resolve(t);if(r)return r;let p=e().then(g=>(t=g,n=!0,o=!1,r=void 0,qt.delete(f),l(),g),g=>{throw r=void 0,o=!0,qt.add(f),Yi(),l(),g});return p.catch(()=>{}),r=p,p}return{load:m,prefetch:f,get current(){return t},get failed(){return o},part(p,g={}){let v=g.what??"This part",T={};function y(E){(0,R.useSyncExternalStore)(s,u,u),lr(T);let P=(0,R.useRef)(null),W=(0,R.useRef)(null),N=(0,R.useRef)(!1);return(0,R.useEffect)(()=>{o&&r===void 0&&f()},[]),n&&typeof document<"u"&&P.current!==null&&document.activeElement===P.current&&(N.current=!0),(0,R.useLayoutEffect)(()=>{if(!(!n||!N.current)){N.current=!1;for(let H=W.current?.nextElementSibling??null;H!==null;H=H.nextElementSibling){let x=H.matches(ar)?H:H.querySelector(ar);if(x instanceof HTMLElement){x.focus();return}}}}),n?(0,Y.jsxs)(Y.Fragment,{children:[N.current?(0,Y.jsx)("span",{ref:W,hidden:!0}):null,p(t,E)]}):g.quiet?null:(0,Y.jsx)(Zi,{what:v,button:P,...g.as?{as:g.as}:{}})}let b=(0,R.lazy)(zt(()=>m().then(()=>({default:y}),()=>({default:y}))));function h(E){let P=(0,R.useContext)(ut),[W]=(0,R.useState)(()=>n||o);return!n&&!o&&sr(P,T),(0,R.createElement)(W?y:b,E)}return h}}}var ar="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function Zi({what:e,button:t,as:n="p"}){let r=typeof navigator<"u"&&navigator.onLine===!1?`${e} will load when you're back online.`:`${e} didn't load.`;return(0,Y.jsxs)(n,{"data-testid":"lazy-part-missing",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,Y.jsx)("span",{role:"status",children:r})," ",(0,Y.jsx)("button",{ref:t,type:"button","data-testid":"lazy-part-retry",onClick:$t,style:{font:"inherit",fontWeight:600,color:"var(--graview-ink)",background:"none",border:"1px solid var(--graview-edge)",borderRadius:6,padding:"2px 10px"},children:"Try again"})]})}var Se=_(j(),1);function Xi(){let{selection:e,setSelection:t}=oe();return(0,Se.useMemo)(()=>({selection:e,set:n=>t(n),clear:()=>t([]),toggle:n=>t(o=>o.includes(n)?o.filter(r=>r!==n):[...o,n]),isSelected:n=>e.includes(n)}),[e,t])}function Ji(){let{store:e}=oe(),t=ot();return(0,Se.useMemo)(()=>Qi(e),[e,t])}var fr=new WeakMap;function Qi(e){let t=fr.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),fr.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function ea(){let{view:e,setView:t}=oe();return(0,Se.useMemo)(()=>({view:e,url:te(e),focus:n=>t(o=>q(o,n)),show:n=>t(o=>Jn(o,n)),toggle:n=>t(o=>Ue(o,n)),go:n=>t(n)}),[e,t])}var he={at:0,depth:0,listeners:new Set,tell(){for(let e of this.listeners)e()}};typeof window<"u"&&window.addEventListener("popstate",e=>{let t=e.state;he.at=typeof t?.graview=="number"?t.graview:0,he.at>he.depth&&(he.depth=he.at),he.tell()});var G=_(j(),1),Zt={profile:{trigger:"profile-button",pane:"profile",opens:"press",focus:"into",drawn:["shell","embed"]},problems:{trigger:"standing",pane:"problems",opens:"press",focus:"into",drawn:["shell","embed"]},places:{trigger:"app-places-open",pane:"app-places",opens:"press",focus:"into",drawn:["embed"]},here:{trigger:"here-open",pane:"here-list",opens:"press",focus:"into",drawn:["shell","embed","pages"]},suggested:{trigger:"suggested-button",pane:"suggested",opens:"press",focus:"into",drawn:["shell","embed","pages"]},activity:{trigger:"activity-button",pane:"activity",opens:"press",focus:"into",drawn:["shell","embed","pages"]},find:{trigger:"find-box",pane:"find-strip",opens:"typing",focus:"stays",drawn:["shell"]},districts:{trigger:"beyond-more",pane:"beyond-list",opens:"press",focus:"into",drawn:["shell","embed"]},acts:{trigger:null,pane:"context-menu",opens:"context-menu",focus:"into",drawn:["shell","embed","pages"]},arrange:{trigger:"arrange-add",pane:"arrange-list",opens:"press",focus:"into",drawn:["pages"]},"studio-ask":{trigger:"studio-agent",pane:"studio-agent-panel",opens:"press",focus:"into",drawn:["studio"]}},ta={position:"fixed",inset:"auto",margin:0,zIndex:Kn("popover"),boxSizing:"border-box"},ct=6,we=8,na=e=>typeof e.showPopover=="function";function ft(e){try{return e.matches(":popover-open")}catch{return!1}}function oa(e){if(typeof e=="function"){let o=e();return o?{left:o.x,right:o.x,top:o.y,bottom:o.y}:null}let t=e.current;if(!t||!t.isConnected)return null;let n=t.getBoundingClientRect();return{left:n.left,right:n.right,top:n.top,bottom:n.bottom}}function Xt(e,t,n={}){let o=oa(t);if(!o)return;let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},i=e.dataset.graviewDesignedHeight??=e.style.maxHeight;e.style.maxHeight=i;let a=e.getBoundingClientRect(),l=r.height-o.bottom-ct-we,s=o.top-ct-we,u=a.height<=l||l>=s,f=Math.max(96,Math.floor(u?l:s)),m=Math.min(a.height,f);a.height>f&&(e.style.maxHeight=i?`min(${i}, ${f}px)`:`${f}px`);let p=a.width,g=n.align==="start"?o.left:o.right-p,v=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();v&&p<=v.right-v.left&&(g<v.left?g=o.left+p<=v.right?o.left:v.left:g+p>v.right&&(g=o.right-p>=v.left?o.right-p:v.right-p));let T=p>=r.width-2*we?Math.max(0,(r.width-p)/2):Math.max(we,Math.min(g,r.width-we-p)),y=u?o.bottom+ct:Math.max(we,o.top-ct-m);e.style.left=`${Math.round(T)}px`,e.style.top=`${Math.round(y)}px`}function pr(e,t,n,o={}){let r=o.align??"end";(0,G.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(na(i)&&!ft(i))try{i.showPopover(),ia()}catch{}let a=0,l=u=>{u?.target instanceof Node&&i.contains(u.target)||(cancelAnimationFrame(a),a=requestAnimationFrame(()=>Xt(i,n,{align:r})))};Xt(i,n,{align:r}),addEventListener("resize",l),addEventListener("scroll",l,!0);let s=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>l());return s?.observe(i),()=>{if(cancelAnimationFrame(a),removeEventListener("resize",l),removeEventListener("scroll",l,!0),s?.disconnect(),i.isConnected&&ft(i))try{i.hidePopover()}catch{}}},[t,e,r])}var Jt=new Set;function ra(e){return Jt.add(e),()=>Jt.delete(e)}function ia(){for(let e of Jt)if(!(!e.isConnected||!ft(e)))try{e.hidePopover(),e.showPopover()}catch{}}var ve=null,aa='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function sa(e){for(let t of e.querySelectorAll(aa))if(t.closest("[hidden]")===null&&getComputedStyle(t).visibility!=="hidden")return t;return e}var Yt=()=>{let e=document.activeElement;return e===null||e===document.body};function la(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[a,l]=(0,G.useState)(!1),s=t.open??a,u=(0,G.useRef)(null),f=(0,G.useRef)(null),m=(0,G.useCallback)(h=>{u.current=h},[]),p=(0,G.useCallback)(h=>{f.current=h},[]),g=`graview-popover-${(0,G.useId)().replace(/:/g,"")}`,v=(0,G.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});v.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let T=(0,G.useCallback)(h=>{v.current.controlled||l(h),v.current.onOpenChange?.(h)},[]),y=(0,G.useCallback)(()=>{(document.querySelector(`[aria-controls="${g}"]`)??u.current??v.current.returnTo?.()??null)?.focus({preventScroll:!0})},[g]),b=(0,G.useCallback)(h=>{let E=f.current,P=typeof document>"u"?null:document.activeElement,W=P===null||P===document.body||E!==null&&E.contains(P);T(!1),!(!h||!W)&&(y(),requestAnimationFrame(()=>{Yt()&&y()}))},[T,y]);return pr(f,i&&s,n??u,t.align?{align:t.align}:{}),(0,G.useEffect)(()=>{if(!i||!s)return;let h={name:e,close:()=>b(!1)};if(ve&&ve.close!==h.close&&ve.close(),ve=h,Zt[e].focus==="into"){let x=f.current;x&&!x.contains(document.activeElement)&&sa(x).focus({preventScroll:!0})}let E=x=>{x.key==="Escape"&&b(!0)},P=x=>{let C=x.target;if(!(C instanceof Node))return;let V=f.current;if(V?.contains(C)||u.current?.contains(C))return;let F=C instanceof Element?C.closest('[role="dialog"], [role="alertdialog"]'):null;F&&!(V&&F.contains(V))||(b(!1),Zt[e].focus==="into"&&requestAnimationFrame(()=>{(Yt()||V!==null&&V.contains(document.activeElement))&&y()}))},W=null,N=null,H=x=>{let C=x.target;if(!(C instanceof Element))return;let V=f.current,F=C.closest('[role="dialog"], [role="alertdialog"]');!F||V&&(V.contains(F)||F.contains(V))||(W=F,b(!1))};return document.addEventListener("keydown",E),document.addEventListener("pointerdown",P,!0),document.addEventListener("focusin",H),()=>{document.removeEventListener("keydown",E),document.removeEventListener("pointerdown",P,!0),document.removeEventListener("focusin",H);let x=W;x&&typeof MutationObserver<"u"&&(N?.disconnect(),N=new MutationObserver(()=>{x.isConnected||(N?.disconnect(),requestAnimationFrame(()=>{(Yt()||document.activeElement.closest("[hidden]")!==null)&&y()}))}),N.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>N?.disconnect(),10*6e4)),ve?.close===h.close&&(ve=null)}},[i,s,e,b,y]),{open:s,setOpen:h=>h?T(!0):b(!0),toggle:()=>s?b(!0):T(!0),trigger:{ref:m,"aria-expanded":s,"aria-controls":g,"data-graview-popover-trigger":e},pane:{ref:p,id:g,popover:"manual",tabIndex:-1,"data-graview-popover":e,"data-graview-overlay":""}}}var be=_(j(),1);var yr=(0,be.createContext)(null);function da(){let e=(0,be.useContext)(yr),t=Bt(),n=(o,r,i)=>t?.setView(a=>ae(ae(pe(q(a,ne(o)),!1),"view",r),"filter",i?.filter??null));return(0,be.useMemo)(()=>e??{record:o=>{t&&(t.setView(r=>q(pe(r,!1),o)),t.setSelection([o]))},place:(o,r)=>{let i=t?.views.places().find(a=>a.as===o);i&&n(i.kind,i.as,r)},list:(o,r)=>n(o,null,r)},[e,t])}var xe=_(j(),1);var ua=Ut(Ke(()=>(__graviewPreload(import.meta.url,["./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZCYGUP3I.js"))));function ca(e,t,n){let o,r=!1,i=()=>{let{hidden:l,removed:s}=t.current();o||r||l.length+s.length===0||(o=()=>{},ua.load().then(u=>{r||(o=u.watchTidied(e,t,n))},String))};i();let a=t.onChange?.(i);return()=>{r=!0,a?.(),o?.()}}function fa(e,t){let[n,o]=(0,xe.useState)();return(0,xe.useEffect)(()=>t?ca(e,t,r=>o([e,r])):void 0,[e,t]),n?.[0]===e?n[1]:e}var mr=_(j(),1),pa=(0,mr.createContext)(!1);var Qt=_(j(),1),ya=(0,Qt.createContext)(null),ma=(0,Qt.createContext)(null);var gr=_(j(),1),ga=(0,gr.createContext)(null);var hr=_(j(),1),en='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',tn=e=>e instanceof HTMLElement&&(e.matches(en)||e.hasAttribute("tabindex")),Le=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function ha(e,t){let n=s=>s.replace(/["\\]/g,"\\$&"),o=t.getAttribute("data-testid"),r=t.getAttribute("data-graview-pick"),i=t.getAttribute("aria-label"),a=o?`[data-testid="${n(o)}"]`:r?`[data-graview-pick="${n(r)}"]`:i?`${t.tagName.toLowerCase()}[aria-label="${n(i)}"]`:null;if(!a)return null;let l=e.querySelector(a);return l&&tn(l)&&Le(l)?l:null}var Sa=e=>e.isConnected&&tn(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&Le(e);function Sr(e,t){let n=t?ha(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&Le(o))return o;for(let r of e.querySelectorAll(en))if(Le(r))return r;return tn(e)&&Le(e)?e:null}function wa(e){(0,hr.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=y=>{let b=y.target;if(b instanceof Element){n=[];for(let h=b;h&&h!==t.parentElement;h=h.parentElement)n.push(h)}},r=!1,i=!1,a=t.ownerDocument,l=()=>!i&&a.defaultView!==null,s=(y,b)=>void setTimeout(()=>l()&&b(),y),u=y=>void requestAnimationFrame(()=>l()&&y()),f=y=>{if(r=!1,i)return;let b=a.activeElement;if(!(!(b===null||b===a.body||b===a.documentElement)||n.length===0)){if(Sa(n[0])){y&&n[0]instanceof HTMLElement&&n[0].focus({preventScroll:!0});return}for(let E of n.slice(1)){if(!E.isConnected)continue;let P=Sr(E,n[0]);if(P){P.focus({preventScroll:!0}),n=[];return}}}},m=(y,b=Date.now()+2500)=>{s(100,()=>{f(y);let h=a.activeElement;(h===null||h===a.body||h===a.documentElement)&&n.length>0&&Date.now()<b&&m(y,b)})},p=()=>{r||n.length===0||(r=!0,s(60,()=>u(()=>{f(!1),m(!1)})))},g=y=>{if(!(y instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(y.key))){if(!(y instanceof KeyboardEvent)){let b=y.target instanceof Element?y.target.closest(en):null,h=a.activeElement,E=h===null||h===a.body||h===a.documentElement;if(b&&E&&t.contains(b)){n=[];for(let P=b;P&&P!==t.parentElement;P=P.parentElement)n.push(P);s(150,()=>u(()=>{f(!1),m(!1)}));return}}!(y instanceof KeyboardEvent)&&!(y.target instanceof Node&&n[0]?.contains(y.target))||s(150,()=>u(()=>{f(!0),m(!0)}))}},v=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&p()}),T=y=>{y.relatedTarget===null&&p()};return t.addEventListener("focusin",o),t.addEventListener("focusout",T),t.addEventListener("click",g),t.addEventListener("keydown",g),v.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",T),t.removeEventListener("click",g),t.removeEventListener("keydown",g),v.disconnect()}},[e])}export{fe as a,te as b,ze as c,ba as d,xa as e,Zn as f,Yn as g,Xn as h,vt as i,q as j,Jn as k,ae as l,pe as m,$e as n,Ve as o,Ue as p,Ze as q,bt as r,ye as s,Aa as t,Ir as u,ne as v,Qn as w,se as x,eo as y,_r as z,ka as A,to as B,xt as C,Lr as D,Hr as E,Dr as F,j as G,Ct as H,oi as I,ii as J,vo as K,Qe as L,ai as M,Ce as N,xo as O,si as P,_t as Q,Ie as R,bi as S,xi as T,Ei as U,$o as V,Ti as W,Oi as X,xs as Y,_i as Z,oe as _,Bt as $,ot as aa,Li as ba,Hi as ca,Di as da,Kt as ea,yr as fa,da as ga,Ni as ha,Xo as ia,Jo as ja,Qo as ka,er as la,tr as ma,nr as na,or as oa,rr as pa,ji as qa,Wi as ra,zt as sa,Gi as ta,ut as ua,Fi as va,Ki as wa,Bi as xa,qi as ya,zi as za,$i as Aa,cr as Ba,Ui as Ca,Ut as Da,fa as Ea,pa as Fa,ya as Ga,ma as Ha,ga as Ia,Xi as Ja,Ji as Ka,ea as La,he as Ma,wa as Na,ta as Oa,ft as Pa,pr as Qa,ra as Ra,la as Sa};
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 Ke}from"./chunk.SDO3U72B.js";import{Ga as jn,Ic as Bn,J as Nn,Ka as St,Lc as qn,Ma as Wn,Qc as zn,Xa as Gn,ac as Fn,dd as $n,td as Un,xc as Kn,yd as Fe,zd as wt}from"./chunk.4TJOS4C7.js";import{a as Ge,b as _}from"./chunk.AJZBJBMO.js";var yo=Ge(w=>{"use strict";var Rt=Symbol.for("react.transitional.element"),Nr=Symbol.for("react.portal"),jr=Symbol.for("react.fragment"),Wr=Symbol.for("react.strict_mode"),Gr=Symbol.for("react.profiler"),Fr=Symbol.for("react.consumer"),Kr=Symbol.for("react.context"),Br=Symbol.for("react.forward_ref"),qr=Symbol.for("react.suspense"),zr=Symbol.for("react.memo"),so=Symbol.for("react.lazy"),$r=Symbol.for("react.activity"),oo=Symbol.iterator;function Ur(e){return e===null||typeof e!="object"?null:(e=oo&&e[oo]||e["@@iterator"],typeof e=="function"?e:null)}var lo={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},uo=Object.assign,co={};function ge(e,t,n){this.props=e,this.context=t,this.refs=co,this.updater=n||lo}ge.prototype.isReactComponent={};ge.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ge.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function fo(){}fo.prototype=ge.prototype;function Tt(e,t,n){this.props=e,this.context=t,this.refs=co,this.updater=n||lo}var Mt=Tt.prototype=new fo;Mt.constructor=Tt;uo(Mt,ge.prototype);Mt.isPureReactComponent=!0;var ro=Array.isArray;function kt(){}var O={H:null,A:null,T:null,S:null},po=Object.prototype.hasOwnProperty;function Ot(e,t,n){var o=n.ref;return{$$typeof:Rt,type:e,key:t,ref:o!==void 0?o:null,props:n}}function Yr(e,t){return Ot(e.type,t,e.props)}function Vt(e){return typeof e=="object"&&e!==null&&e.$$typeof===Rt}function Zr(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var io=/\/+/g;function At(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Zr(""+e.key):t.toString(36)}function Xr(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(kt,kt):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function me(e,t,n,o,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Rt:case Nr:a=!0;break;case so:return a=e._init,me(a(e._payload),t,n,o,r)}}if(a)return r=r(e),a=o===""?"."+At(e,0):o,ro(r)?(n="",a!=null&&(n=a.replace(io,"$&/")+"/"),me(r,t,n,"",function(u){return u})):r!=null&&(Vt(r)&&(r=Yr(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(io,"$&/")+"/")+a)),t.push(r)),1;a=0;var l=o===""?".":o+":";if(ro(e))for(var s=0;s<e.length;s++)o=e[s],i=l+At(o,s),a+=me(o,t,n,i,r);else if(s=Ur(e),typeof s=="function")for(e=s.call(e),s=0;!(o=e.next()).done;)o=o.value,i=l+At(o,s++),a+=me(o,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return me(Xr(e),t,n,o,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function Xe(e,t,n){if(e==null)return e;var o=[],r=0;return me(e,o,"","",function(i){return t.call(n,i,r++)}),o}function Jr(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ao=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Qr={map:Xe,forEach:function(e,t,n){Xe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Xe(e,function(){t++}),t},toArray:function(e){return Xe(e,function(t){return t})||[]},only:function(e){if(!Vt(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};w.Activity=$r;w.Children=Qr;w.Component=ge;w.Fragment=jr;w.Profiler=Gr;w.PureComponent=Tt;w.StrictMode=Wr;w.Suspense=qr;w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O;w.__COMPILER_RUNTIME={__proto__:null,c:function(e){return O.H.useMemoCache(e)}};w.cache=function(e){return function(){return e.apply(null,arguments)}};w.cacheSignal=function(){return null};w.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=uo({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!po.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(o[i]=t[i]);var i=arguments.length-2;if(i===1)o.children=n;else if(1<i){for(var a=Array(i),l=0;l<i;l++)a[l]=arguments[l+2];o.children=a}return Ot(e.type,r,o)};w.createContext=function(e){return e={$$typeof:Kr,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Fr,_context:e},e};w.createElement=function(e,t,n){var o,r={},i=null;if(t!=null)for(o in t.key!==void 0&&(i=""+t.key),t)po.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(r[o]=t[o]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var l=Array(a),s=0;s<a;s++)l[s]=arguments[s+2];r.children=l}if(e&&e.defaultProps)for(o in a=e.defaultProps,a)r[o]===void 0&&(r[o]=a[o]);return Ot(e,i,r)};w.createRef=function(){return{current:null}};w.forwardRef=function(e){return{$$typeof:Br,render:e}};w.isValidElement=Vt;w.lazy=function(e){return{$$typeof:so,_payload:{_status:-1,_result:e},_init:Jr}};w.memo=function(e,t){return{$$typeof:zr,type:e,compare:t===void 0?null:t}};w.startTransition=function(e){var t=O.T,n={};O.T=n;try{var o=e(),r=O.S;r!==null&&r(n,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(kt,ao)}catch(i){ao(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),O.T=t}};w.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()};w.use=function(e){return O.H.use(e)};w.useActionState=function(e,t,n){return O.H.useActionState(e,t,n)};w.useCallback=function(e,t){return O.H.useCallback(e,t)};w.useContext=function(e){return O.H.useContext(e)};w.useDebugValue=function(){};w.useDeferredValue=function(e,t){return O.H.useDeferredValue(e,t)};w.useEffect=function(e,t){return O.H.useEffect(e,t)};w.useEffectEvent=function(e){return O.H.useEffectEvent(e)};w.useId=function(){return O.H.useId()};w.useImperativeHandle=function(e,t,n){return O.H.useImperativeHandle(e,t,n)};w.useInsertionEffect=function(e,t){return O.H.useInsertionEffect(e,t)};w.useLayoutEffect=function(e,t){return O.H.useLayoutEffect(e,t)};w.useMemo=function(e,t){return O.H.useMemo(e,t)};w.useOptimistic=function(e,t){return O.H.useOptimistic(e,t)};w.useReducer=function(e,t,n){return O.H.useReducer(e,t,n)};w.useRef=function(e){return O.H.useRef(e)};w.useState=function(e){return O.H.useState(e)};w.useSyncExternalStore=function(e,t,n){return O.H.useSyncExternalStore(e,t,n)};w.useTransition=function(){return O.H.useTransition()};w.version="19.2.8"});var j=Ge((Na,mo)=>{"use strict";mo.exports=yo()});var Po=Ge(et=>{"use strict";var ui=Symbol.for("react.transitional.element"),ci=Symbol.for("react.fragment");function Eo(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:ui,type:e,key:o,ref:t!==void 0?t:null,props:n}}et.Fragment=ci;et.jsx=Eo;et.jsxs=Eo});var Ie=Ge((za,Ao)=>{"use strict";Ao.exports=Po()});var fe={focusId:null,relation:null,expanded:[],pins:{}},Be=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function te(e){let t=new URLSearchParams;e.focusId&&t.set("focus",e.focusId),e.relation&&t.set("relation",e.relation),e.overview&&t.set("overview","1"),e.zoom&&t.set("zoom","1"),e.past&&t.set("past","1"),e.shown&&e.shown.length>0&&t.set("show",[...e.shown].sort().join(",")),e.selection!==void 0&&e.selection.length>0&&t.set("sel",[...e.selection].sort().join(",")),e.expanded.length>0&&t.set("expand",[...e.expanded].sort().join(","));for(let o of Object.keys(e.pins).sort()){let r=e.pins[o];t.set(`pin.${o}`,`${qe(r.x)},${qe(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${qe(e.pan.x)},${qe(e.pan.y)}`);for(let o of Object.keys(e.within??{}).sort()){let r=e.within[o];r.length>0&&t.set(`in.${o}`,r)}e.q&&e.q.trim().length>0&&t.set("q",e.q);let n=t.toString();return n?`#${n}`:"#"}function Cr(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function ze(e){let t=e.includes("#")?e.slice(e.indexOf("#")+1):e,n=new URLSearchParams(t),o=Object.create(null);for(let[m,p]of n){if(!m.startsWith("pin."))continue;let[g,v]=p.split(","),T=g===void 0?null:Be(g),y=v===void 0?null:Be(v);T===null||y===null||(o[m.slice(4)]={x:T,y})}let r=Object.create(null);for(let[m,p]of n)!m.startsWith("in.")||p.length===0||(r[m.slice(3)]=p);let i=n.get("view");i&&i.length>0&&r.view===void 0&&(r.view=i);let a=n.get("pan")?.split(",")??[],l=a[0]===void 0?null:Be(a[0]),s=a[1]===void 0?null:Be(a[1]),u=(n.get("sel")??"").split(",").filter(m=>m.length>0).sort(),f=n.get("overview")==="1";return{...u.length>0?{selection:u}:{},...f?{overview:!0}:{},...n.get("zoom")==="1"?{zoom:!0}:{},...n.get("past")==="1"?{past:!0}:{},...n.get("show")?{shown:[...new Set(n.get("show").split(",").filter(Boolean))].sort()}:{},...l!==null&&s!==null?{pan:{x:l,y:s}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:Cr(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(m=>m.length>0&&(f||!m.startsWith("kind:"))).sort(),pins:o}}function ba(e){let t=ze(e);return te(t)==="#"?{...t,overview:!0}:t}function xa(e){let t=te(e);return t==="#overview=1"?"":t}function qe(e){return Math.round(e*100)/100}function Zn(e,t){return te(e)===te(t)}var Yn="edge:";function Xn(e){if(!e.startsWith(Yn))return null;let t=e.slice(Yn.length).split(":");if(t.length!==3)return null;let[n,o,r]=t;if(!n||!o||!r)return null;try{return{kind:decodeURIComponent(n),from:decodeURIComponent(o),to:decodeURIComponent(r)}}catch{return null}}function vt(e){let{pan:t,...n}=e;return{...n,pins:{}}}function q(e,t){if(t===e.focusId)return{...e,focusId:t};let n=vt(e);return{...n.within?.q!==void 0?ae(n,"q",null):n,focusId:t}}function Jn(e,t){return{...e,relation:t}}function ae(e,t,n){let o={...e.within??{}};if(n===null?delete o[t]:o[t]=n,Object.keys(o).length===0){let{within:r,...i}=e;return i}return{...e,within:o}}function pe(e,t){if(t!==e.overview&&(e=vt(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function $e(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function Ve(e,t){if(t!==(e.zoom===!0)&&(e=vt(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function Ue(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}var Ze="aggregate:",Ye="kind:";function bt(e){return`${Ye}${e}`}function ye(e){return e.startsWith(Ye)?e.slice(Ye.length):null}var Aa="kinds:beyond";function Ir(e){let t=ye(e);return t?[t]:se(e)}function ne(...e){return`${Ze}${[...e].sort().join("+")}`}function Qn(e){return e.startsWith(Ze)}function se(e){return!Qn(e)||e.includes("|")?[]:e.slice(Ze.length).split("+").filter(Boolean)}function eo(e,t,n={}){let o=ye(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return Ue(e,t);let r=o!==null?ne(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return Ve(e,!1);if(o!==null&&n.carry){let i=pe({...q(e,r),relation:null},!1);return ae(Ve(i,!0),"q",n.carry)}return Ve({...q(e,r),relation:null},!0)}function _r(e,t,n){return ae(pe(q(e,ne(t)),!1),"view",n)}function ka(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var to="aggregate:";function xt(e){return e.startsWith(to)&&e.includes("|")}var Et=e=>e?.off===!0,Lr=e=>e!==void 0&&!Et(e)&&(e.fast!==void 0||e.thinking!==void 0||e.answer!==void 0||e.decide!==void 0||e.complete!==void 0||e.turn!==void 0),no=e=>e!==void 0&&!Et(e)&&(e.fast!==void 0||e.decide!==void 0),Hr=e=>e?.suggestOnOpen!==!1&&no(e),Dr=e=>e?.hoverChips===!0&&no(e);var Pt={};var go=_(j(),1),ei={turns:[],outcomes:new Map,busy:!1,pending:null,draft:null,draftNote:null},ho=e=>`graview:seat:${e}`;function ti(e){if(!e)return{};try{let t=sessionStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return{...Array.isArray(n.turns)?{turns:n.turns}:{},...Array.isArray(n.outcomes)?{outcomes:new Map(n.outcomes)}:{},...n.draft?.drawn?{draft:n.draft}:{}}}catch{return{}}}function ni(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],draft:t.draft}))}catch{}}function Ct(e){let t=e===null?null:ho(e),n={...ei,...ti(t)},o=new Set,r=(i,a=!0)=>{n=i,a&&ni(t,n);for(let l of[...o])l()};return{get:()=>n,subscribe(i){return o.add(i),()=>void o.delete(i)},setTurns:i=>r({...n,turns:i(n.turns)}),settle:(i,a)=>r({...n,outcomes:new Map(n.outcomes).set(i,a)}),setBusy:i=>r({...n,busy:i},!1),ask:i=>r({...n,pending:i.trim()||null}),takePending(){let i=n.pending;return i!==null&&r({...n,pending:null},!1),i},setDraft:(i,a=null)=>r({...n,draft:i,draftNote:a})}}function oi(e){return(0,go.useSyncExternalStore)(e.subscribe,e.get,e.get)}var wo=_(j(),1),ri={entries:[],ghost:null,loaded:!1};function So(e,t){let n=new Map(e.map(o=>[o.id,o]));for(let o of t)n.set(o.id,{...n.get(o.id),...o});return[...n.values()].sort((o,r)=>o.at<r.at?1:o.at>r.at?-1:0)}function It(e){let t=ri,n=new Set,o=r=>{t=r;for(let i of[...n])i()};return{get:()=>t,subscribe:r=>(n.add(r),()=>n.delete(r)),record:r=>{o({...t,entries:So(t.entries,[r])}),Promise.resolve(e()?.keep?.(r)).catch(i=>{console.warn("The host did not keep an AI interaction:",i)})},setGhost:r=>o({...t,ghost:r}),load:()=>{if(t.loaded)return;o({...t,loaded:!0});let r=e()?.load;r&&Promise.resolve(r()).then(i=>o({...t,entries:So(t.entries,i)})).catch(i=>{console.warn("The host's AI interactions could not be read:",i)})}}}function ii(e){return(0,wo.useSyncExternalStore)(e.subscribe,e.get,e.get)}function vo(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}var Je=_(j(),1),Qe=(0,Je.createContext)(void 0),ai=()=>(0,Je.useContext)(Qe);var A=_(j(),1),Ce=(0,A.createContext)(null);function xo(){return(0,A.useContext)(Ce)}function si(e,t){let n=xo(),o=(0,A.useMemo)(()=>n?n.live.seenBy(t):e,[n,e,t]),r=(0,A.useRef)(0),i=(0,A.useCallback)(a=>o.subscribe(()=>{r.current+=1,a()}),[o]);return(0,A.useSyncExternalStore)(i,()=>r.current,()=>0),o}var li=Ke(()=>(__graviewPreload(import.meta.url,["./chunk.TI4OSTQV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.E2AJ7U5Z.js"))),bo,di=400;function _t(e,t,n){let o=(0,A.useContext)(Ce),r=o!==null&&o.owns(e,t),[i,a]=(0,A.useState)(null),[l,s]=(0,A.useState)(bo);(0,A.useEffect)(()=>{if(l||r||i===null)return;let x=!0;return li().then(C=>{bo=C,x&&s(C)},()=>{}),()=>{x=!1}},[l,r,i]);let[u,f]=(0,A.useState)(0),m=(0,A.useMemo)(()=>r||i===null||i>=e.log.length||!l?void 0:l.askArchived(e,i,n)??l.askDeclaration(n,i),[r,e,i,n,l,u]),p=m&&"waiting"in m?m.waiting:void 0,g=m&&"seq"in m?m:null,[v,T]=(0,A.useState)(void 0);(0,A.useEffect)(()=>{if(!p)return;let x=!0,C=setTimeout(()=>x&&T(p),di);return p.then(()=>x&&f(V=>V+1)),()=>{x=!1,clearTimeout(C)}},[p]);let y=p!==void 0&&v!==p||g!==null,b=(0,A.useMemo)(()=>{if(r||i===null||i>=e.log.length||!l||y)return null;try{let x=l.pastAt(e,i,n);return{seq:i,at:x.past?.at,store:x}}catch{return null}},[r,e,i,n,l,y,u]),h=(0,A.useRef)(null),E=y?h.current:b;(0,A.useEffect)(()=>{h.current=E},[E]);let P=(0,A.useCallback)(x=>a(x===null?null:x>=e.log.length?Number.POSITIVE_INFINITY:x),[e]),W=(0,A.useCallback)((x,C)=>[e,E?.store].some(V=>V!==void 0&&(V===x||V.seenBy(C)===x)),[e,E]),N=i!==null,H=(0,A.useMemo)(()=>({past:E,open:N,show:P,live:e,host:n,owns:W,archive:g}),[E,N,P,e,n,W,g]);return r?o:H}var ko=e=>`graview:setting:${e}`;function Ro(){return localStorage}function To(e,t){try{let n=(t??Ro()).getItem(ko(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function Mo(e,t,n){try{(n??Ro()).setItem(ko(e.name),t)}catch{}}function Oo(e,t){if(typeof document>"u")return;let n=document.documentElement;if(e.honored==="root-font-size"){n.style.fontSize=t===e.initial?"":t;return}let o=`graview${e.name.replace(/-([a-z0-9])/g,(r,i)=>i.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}`;t===e.initial?delete n.dataset[o]:n.dataset[o]=t}var L=_(j(),1);function Lt(e){return Fe(e)}var fi=12,pi=4;function yi(e,t,n){let o=Lt(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var tt=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-fi);function Vo(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=pi)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?bt([...o][0]):n[0]}function Ht(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[a,l]of e)l.mode!=="asking"&&l.mode!=="docked"&&t.at-l.since>=t.holdMs&&o.set(a,{...l,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=yi(e,t.author,t.at),i=a=>o.set(r.participant,{...r,...a,since:t.at});switch(t.type){case"read":{let a=Vo(t.ids,n);return i({at:a,mode:"reading",trail:tt(r.trail,a)}),o}case"about-to-write":case"write":{let a=Vo(t.ids,n);return i({at:a,mode:"writing",trail:tt(r.trail,a),say:void 0,confidence:void 0}),o}case"refused":return i({at:t.where,mode:"refused",say:t.say,confidence:void 0,trail:tt(r.trail,t.where)}),o;case"asking":return i({at:t.where??r.at,mode:"asking",say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},trail:tt(r.trail,t.where)}),o;case"said":return i({say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},...t.caption?{caption:t.caption}:{}}),o;case"over":return i({over:t.over}),o;case"home":return i({at:null,mode:"docked",trail:[],say:void 0,confidence:void 0,over:null}),o;default:return o}}var Co="graview:session";function Io(e){let t=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);try{let n=e??sessionStorage,o=n.getItem(Co);if(o)return o;let r=t();return n.setItem(Co,r),r}catch{return t()}}var Dt={name:"share-where",title:"Where you are",description:"Whether the others here see which stop you are on.",honored:"root-attribute",options:[{value:"shared",label:"Shown"},{value:"private",label:"Hidden"}],initial:"shared"},Nt={name:"share-over",title:"What you point at",description:"Whether the others see the thing under your pointer, outlined in your color.",honored:"root-attribute",options:[{value:"private",label:"Kept to yourself"},{value:"shared",label:"Outlined for others"}],initial:"private"},_o=[Dt,Nt],gi=800;function Lo(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:a,seatWho:l,settingValues:s,setView:u,ttlMs:f=1e4,people:m,seats:p}=e,[g,v]=(0,L.useState)(()=>new Map),[T,y]=(0,L.useState)(null),[b,h]=(0,L.useState)(null),[E,P]=(0,L.useState)(null),W=typeof r.id=="string"&&r.id.length>0,N=W&&(s[Dt.name]??Dt.initial)==="shared",H=N&&(s[Nt.name]??Nt.initial)==="shared",x=Lt({kind:r.kind,...r.id?{id:r.id}:{},session:i}),C=W?Gn(r,{graph:n.graph,schema:n.schema,...p?{seats:p}:{},...m?{people:m}:{}}):"",V=l?a.get(`agent:${l}:${i}`):void 0,F=(0,L.useMemo)(()=>!t||!N?null:{participant:x,kind:r.kind,name:C,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:Fn(r.id??"nobody"),stop:E??te(o),...H?{over:T}:{},...V?{robot:{at:V.at,mode:V.mode}}:{},at:new Date().toISOString()},[t,N,H,x,C,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,E,T,V?.at,V?.mode]);(0,L.useEffect)(()=>{if(!t||!F)return;t.here(F);let I=setInterval(()=>t.here({...F,at:new Date().toISOString()}),gi);return()=>clearInterval(I)},[t,F]),(0,L.useEffect)(()=>t?t.onWho(K=>v(wt(new Map,K,Date.now(),f))):void 0,[t,f]);let Z=g.size>0;(0,L.useEffect)(()=>{if(!Z)return;let I=setInterval(()=>{v(K=>{let Q=wt(K,[],Date.now(),f);return Q.size===K.size?K:Q})},Math.max(250,Math.min(1e3,f/4)));return()=>clearInterval(I)},[Z,f]),(0,L.useEffect)(()=>{if(!t||typeof window>"u")return;let I=()=>t.leave();return window.addEventListener("pagehide",I),()=>window.removeEventListener("pagehide",I)},[t]),(0,L.useEffect)(()=>{if(!H||typeof document>"u")return;let I=null,K=Q=>{let Ee=vo(Q.target);Ee!==I&&(I=Ee,y(Ee))};return document.addEventListener("pointermove",K,{passive:!0}),()=>document.removeEventListener("pointermove",K)},[H]);let X=(0,L.useRef)(null),z=b?g.get(b)??null:null,de=(0,L.useCallback)(I=>{X.current=null,h(I)},[]);return(0,L.useEffect)(()=>{if(b){if(!z){h(null);return}z.stop!==X.current?.stop&&(X.current={stop:z.stop,at:Date.now()},u(ze(z.stop)))}},[b,z,u]),(0,L.useEffect)(()=>{let I=X.current;!b||I===null||Date.now()-I.at<400||Zn(o,ze(I.stop))||h(null)},[o,b]),(0,L.useEffect)(()=>{if(!b||typeof document>"u")return;let I=K=>{K.key==="Escape"&&h(null)};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[b]),(0,L.useMemo)(()=>({who:g,sharing:F?{participant:x,name:C}:null,following:z,follow:de,sayWhere:P}),[g,F,x,C,z,de])}var U=_(j(),1);function Ho(e){return Fe(e.author)}function hi(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function Do(e,t,n,o,r){let i=new Map;for(let[s,u]of e)o-u.at<r&&i.set(s,u);let a=new Set(n.flatMap(s=>s.nodeIds)),l=(s,u,f)=>{let m=i.get(s),p=m?.participants.includes(Ho(u))?m.participants:[...m?.participants??[],Ho(u)];i.set(s,{at:o,manner:hi(p,u.author.kind),intent:u.intent,wrote:(m?.wrote??!1)||(f.wrote??!1),read:(m?.read??!1)||(f.read??!1),broke:(m?.broke??!1)||a.has(s),participants:p})};for(let s of t){for(let u of s.writes)l(u,s,{wrote:!0});for(let u of s.reads)s.writes.includes(u)||l(u,s,{read:!0})}for(let s of n)for(let u of s.nodeIds){let f=i.get(u);i.set(u,{at:o,manner:f?.manner??"rule",intent:f?.intent??s.message,wrote:f?.wrote??!1,read:f?.read??!1,broke:!0,participants:f?.participants??["rule::"]})}return i}var Si=2600;function No(e,t=Si){let[n,o]=(0,U.useState)(()=>new Map),r=(0,U.useRef)(n);r.current=n;let i=(0,U.useRef)(null),a=(0,U.useCallback)(s=>{r.current=s,o(s),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,U.useEffect)(()=>{let s=e.violations(),u=e.subscribe((f,m)=>{let p=e.violations(),g=zn(e.allInvariants(),s,p).introduces;s=p,a(Do(r.current,m,g.map(v=>({nodeIds:v.nodeIds,message:v.message})),Date.now(),t))});return()=>{u(),i.current&&clearTimeout(i.current)}},[e,t,a]);let l=(0,U.useCallback)(s=>{s.reads.length!==0&&a(Do(r.current,[wi(s)],[],Date.now(),t))},[t,a]);return{activity:n,noteAttention:l}}function wi(e){return{id:`attention:${e.intent}`,seq:-1,batch:"attention",author:e.author,intent:e.intent,mutation:null,primitives:[],reads:e.reads,writes:[],at:new Date().toISOString()}}var d=_(j(),1);function jo(){let e=null,t=new Set,n=new Set,o=r=>{for(let i of n)i(r)};return{subscribe(r){return t.add(r),t.size===1&&o(!0),()=>{t.delete(r),t.size===0&&(e=null,o(!1))}},snapshot:()=>e,set(r){if(!(e===r||e&&r&&e.x===r.x&&e.y===r.y)){e=r;for(let i of t)i()}},get listeners(){return t.size},onActive(r){return n.add(r),()=>void n.delete(r)}}}var nt=_(j(),1),vi=e=>e.definitions.some(t=>jn(t).size>0);function Wo(e,t,n){let[o,r]=(0,nt.useState)(void 0),i=(n.roles??[]).join("\0");return(0,nt.useEffect)(()=>{if(!t||!vi(e.schema)){r(void 0);return}let a=!0,l=!1,s=e.graph,u=()=>{l||(l=!0,queueMicrotask(()=>{l=!1,a&&e.reread()}))},f=Wn(t,{kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{}},u);return St(s,f.read),r(f),e.reread(),()=>{a=!1,St(s,void 0)}},[e,t,n.kind,n.id,i]),o}function Go(){let e=!1,t=new Set;return{moving:()=>e,set(n){if(n!==e){e=n;for(let o of t)o()}},subscribe(n){return t.add(n),()=>t.delete(n)}}}var le=_(Ie(),1),bi="graview:place-menu",_e=(0,d.createContext)(null),qo=(0,d.createContext)("scene");function xi({mode:e,children:t}){return(0,le.jsx)(qo.Provider,{value:e,children:t})}function Ei(){return(0,d.useContext)(qo)}var zo={kind:"human"},Pi=[],Ai=[],ki=[],jt=[];function $o(e,t){let n=(0,d.useId)();(0,d.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??zo,r=()=>qn(e,o,n);r();let i,a=e.subscribe(()=>{clearTimeout(i),i=setTimeout(r,250)});return()=>{clearTimeout(i),a(),globalThis.__graviewWatch?.unseen?.({words:[],from:n,gone:!0})}},[e,t,n])}var Ri={off:!0};function Ti({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,seats:a=Pi,onSeat:l,people:s=Ai,memory:u,presenceTtlMs:f,app:m,settings:p=m?.settings??ki,presence:g,brand:v,locale:T,timeZone:y,onKeepLens:b,providers:h,ai:E,files:P,resolveApp:W,history:N,linkedRecords:H,menuSections:x,keptViews:C,subscriptions:V,signIn:F,view:Z,onViewChange:X,children:z}){let de=(0,d.useContext)(_e),I=x??de?.menuSections,K=F??de?.signIn,Q=C??de?.keptViews,[Ee,wr]=(0,d.useState)(null),ue=Ee??i??a[0]?.principal??zo,He=_t(e,ue,N),nn=He.past&&He.live===e?He.past.store:e,D=(0,d.useMemo)(()=>nn.seenBy(ue),[nn,ue]);$o(e,ue);let[re]=(0,d.useState)(()=>Io(u)),[on,vr]=(0,d.useState)(!1),rn=(0,d.useCallback)(()=>vr(!0),[]),ie=(0,d.useMemo)(()=>g?[...p,..._o]:p,[p,g]),[pt]=(0,d.useState)(()=>n??Kt(t,e.schema)),[br,an]=(0,d.useState)(()=>$e(pt??fe,r??pt?.selection??[])),Pe=(0,d.useRef)(pt??fe).current,[sn,xr]=(0,d.useState)(null),[ln,Er]=(0,d.useState)(null),J=(0,d.useContext)(_e),[dn]=(0,d.useState)(()=>J?.seatTalk??Ct(v?.name??e.schema.kinds.join(","))),yt=E??J?.ai??Pt,De=(0,d.useMemo)(()=>yt.off?Ri:yt,[yt]),un=(0,d.useRef)(De.interactions);un.current=De.interactions;let[cn]=(0,d.useState)(()=>J?.aiDesk??It(()=>un.current)),[Pr]=(0,d.useState)(()=>J?.subscriptions??Bn()),fn=V??J?.subscriptions??Pr,mt=b??J?.onKeepLens,Ne=m??J?.app,je=T??J?.locale,Ar=v?.locale??Ne?.brand?.locale,We=y??J?.timeZone;Nn({reader:je,app:Ar,readerTimeZone:We,appTimeZone:v?.timeZone??Ne?.brand?.timeZone});let pn=(0,d.useRef)(null),yn=(0,d.useCallback)(c=>{pn.current=c},[]),mn=(0,d.useCallback)(c=>pn.current?.whereIs(c)??null,[]),[gn]=(0,d.useState)(()=>jo()),[hn]=(0,d.useState)(()=>Go()),[gt,kr]=(0,d.useState)(null),[Ae,Sn]=(0,d.useState)(()=>new Map),ke=(0,d.useRef)(Ae);ke.current=Ae;let Re=(0,d.useRef)(null),ht=(0,d.useCallback)(c=>D.graph.getNode(c)?.kind,[D]),ee=(0,d.useCallback)(c=>{let S=Ht(ke.current,c,ht);ke.current=S,Sn(S),Re.current&&clearTimeout(Re.current),[...S.values()].some(M=>M.mode!=="docked"&&M.mode!=="asking")&&(Re.current=setTimeout(()=>{let M=Ht(ke.current,{type:"rest",at:Date.now(),holdMs:Ft},ht);ke.current=M,Sn(M)},Ft+20))},[ht]),wn=(0,d.useCallback)(c=>ee({...c,at:c.at??Date.now()}),[ee]),vn=(0,d.useCallback)(c=>{kr(c),c&&ee({type:"home",author:{kind:"agent",id:c,session:re},at:Date.now()})},[ee,re]);(0,d.useEffect)(()=>D.subscribe((c,S)=>{for(let k of S)k.author.kind==="agent"&&ee({type:"write",author:k.author,ids:k.writes,at:Date.now()})}),[D,ee]),(0,d.useEffect)(()=>()=>{Re.current&&clearTimeout(Re.current)},[]);let $=(0,d.useMemo)(()=>({...ue,session:re}),[ue,re]),bn=Wo(D,H,$),xn=(0,d.useCallback)(c=>{wr(c),l?.(c)},[l]),[Te,Rr]=(0,d.useState)(()=>Object.fromEntries(ie.map(c=>[c.name,To(c,u)])));(0,d.useEffect)(()=>{for(let c of ie)Oo(c,Te[c.name]??c.initial)},[ie,Te]);let En=(0,d.useCallback)((c,S)=>{let k=ie.find(M=>M.name===c);!k||!k.options.some(M=>M.value===S)||(Mo(k,S,u),Rr(M=>({...M,[c]:S})))},[ie,u]),[Pn,Tr]=(0,d.useState)(null),{activity:An,noteAttention:kn}=No(D),Rn=(0,d.useCallback)(c=>{kn(c),ee({type:"read",author:c.author,ids:c.reads,at:Date.now()})},[kn,ee]),ce=(0,d.useCallback)(c=>{if(ye(c)!==null||se(c).length>0||xt(c))return!0;let S=Xn(c);return S?D.graph.allEdges().some(k=>k.kind===S.kind&&k.from===S.from&&k.to===S.to):D.graph.getNode(c)!==void 0},[D]),Tn=(0,d.useCallback)(c=>{let S=c.selection??jt,k=S.filter(ce),M=k.length===S.length?c:$e(c,k);return M.focusId!==null&&!ce(M.focusId)&&(M=q(M,null)),M},[ce]),Me=(0,d.useCallback)(c=>{let S=Tn(c),k=Bo(D,$,S.shown);if(S.focusId!==null&&k.size>0){let M=se(S.focusId),Dn=D.graph.getNode(S.focusId);(M.length>0?M.every(Vr=>k.has(Vr)):Dn?k.has(Dn.kind):!1)&&(S={...S,focusId:null})}if(!S.overview&&S.focusId===null){let M=Pe.focusId!==null&&!ce(Pe.focusId)?Kt(t,e.schema)??{...fe,overview:!0}:Pe;M.focusId!==null&&ce(M.focusId)?S={...S,focusId:M.focusId}:M.overview===!0&&(S={...S,overview:!0})}return S},[Tn,ce,D,Pe,$,t,e.schema]),B=Me(Z??br),Mn=(0,d.useMemo)(()=>Bo(D,$,B.shown),[D,$,B.shown]),On=(0,d.useMemo)(()=>[...D.modules.administered.entries()].map(([c,S])=>{let k=D.mayAdminister(c,$);return{name:c,...S.description?{description:S.description}:{},kinds:S.kinds??[],canShow:k,shown:k&&(B.shown??[]).includes(c)}}),[D,$,B.shown]),Oe=(0,d.useCallback)(c=>{let S=k=>Me(typeof c=="function"?c(k):c);if(Z!==void 0){X?.(S(Z));return}X&&X(S(B)),an(k=>S(k))},[B,X,Z,Me]);(0,d.useEffect)(()=>{Z===void 0&&an(c=>{let S=Me(c);return S===c?c:S})},[B,Z,Me]);let Vn=B.selection??jt,Cn=(0,d.useCallback)(c=>{Oe(S=>$e(S,typeof c=="function"?c(S.selection??jt):c))},[Oe]),{who:In,following:_n,follow:Ln,sayWhere:Mr,sharing:Hn}=Lo({channel:g,store:D,view:B,principal:$,session:re,robots:Ae,seatWho:gt,settingValues:Te,setView:Oe,seats:a,people:s,...f!==void 0?{ttlMs:f}:{}}),Or=(0,d.useMemo)(()=>({store:D,scheme:o,views:t,view:B,setView:Oe,homeView:Pe,selection:Vn,setSelection:Cn,menuAt:sn,setMenuAt:xr,whereIs:mn,pointer:gn,motion:hn,registerScene:yn,robots:Ae,noteSeat:wn,seatWho:gt,registerSeatWho:vn,actsDoor:ln,registerActsDoor:Er,seatTalk:dn,aiDesk:cn,...u?{memory:u}:{},who:In,following:_n,follow:Ln,sayWhere:Mr,sharing:Hn,session:re,ai:De,resolveApp:W,linkedRecords:H,menuSections:I,...Q?{keptViews:Q}:{},subscriptions:fn,signIn:K,linkedReads:bn,movedByHand:on,noteMoved:rn,emphasis:Pn,setEmphasis:Tr,activity:An,noteAttention:Rn,principal:$,seats:a,people:s,takeSeat:xn,settings:ie,settingValues:Te,chooseSetting:En,hiddenKinds:Mn,administered:On,...h?{providers:h}:{},...v?{brand:v}:{},...mt?{onKeepLens:mt}:{},app:Ne,...je?{locale:je}:{},...We?{timeZone:We}:{}}),[D,o,t,B,Oe,Vn,Cn,sn,mn,gn,hn,yn,Ae,wn,gt,vn,ln,dn,cn,u,In,_n,Ln,Hn,re,De,W,H,I,Q,fn,K,bn,on,rn,Pn,An,Rn,$,a,s,xn,ie,Te,En,Mn,On,h,v,mt,Ne,je,We]);return(0,le.jsx)(_e.Provider,{value:Or,children:(0,le.jsx)(Ce.Provider,{value:He,children:(0,le.jsx)(Ii,{children:P?(0,le.jsx)(Qe.Provider,{value:P,children:z}):z})})})}var Uo=(0,d.createContext)(null),Wt,Gt=new Set,Mi=e=>(Gt.add(e),()=>void Gt.delete(e)),Fo=()=>Wt;function Oi(e){if(!Wt){Wt=e;for(let t of[...Gt])t()}}var Vi=300;function Ci(e){let t=0;return async(n,o)=>{let r=++t;return await new Promise(i=>setTimeout(i,Vi)),r===t?e(n,o):[]}}function Ii({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:a,ai:l}=oe(),s=ot(),u=n.q,f=n.focusId,m=!!(u&&u.trim().length>0),p=(0,d.useSyncExternalStore)(Mi,Fo,Fo),g=(0,d.useMemo)(()=>m&&p?{flagged:new Set(t.violations().flatMap(E=>E.nodeIds)),touched:p.touchWeights(t.log.all())}:null,[t,s,m,p]),v=f?t.graph.getNode(f)?.kind??ye(f)??(se(f).length===1?se(f)[0]:void 0):void 0,T=(0,d.useMemo)(()=>l.near&&Ci(l.near),[l.near]),y=(0,d.useMemo)(()=>!u||!g||!p?null:p.search(t,u,{...v?{inKind:v}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(E=>!i.has(E)),from:[...a,...f&&t.graph.has(f)?[f]:[]],flagged:g.flagged,touched:g.touched,limit:200,rank:T}),[t,u,r,o,i,a,f,v,g,T]),[b,h]=(0,d.useState)();return(0,d.useEffect)(()=>void y?.later?.then(E=>h([y,E])),[y]),(0,le.jsx)(Uo.Provider,{value:b?.[0]===y?b[1]:y,children:e})}var Ko=new WeakMap;function xs(e){let t=Ko.get(e);return t||Ko.set(e,t=new Set(e.matched)),t}function _i(){return(0,d.useContext)(Uo)}function oe(){let e=(0,d.useContext)(_e);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function Bt(){return(0,d.useContext)(_e)??null}function ot(){let{store:e}=oe(),t=(0,d.useRef)(null),n=(0,d.useRef)(null),o=(0,d.useCallback)(()=>(n.current!==e&&(n.current=e,t.current=null),t.current??=e.graph.allNodes(),t.current),[e]),r=(0,d.useCallback)(i=>e.subscribe(()=>{t.current=null,i()}),[e]);return(0,d.useSyncExternalStore)(r,o,o)}function Li(e){let{store:t}=oe(),n=(0,d.useCallback)(r=>t.subscribe(r),[t]),o=(0,d.useCallback)(()=>e===null?void 0:t.graph.getNode(e),[t,e]);return(0,d.useSyncExternalStore)(n,o,o)}function Bo(e,t,n){let o=new Set(e.modules.disabledKinds);for(let r of e.kindsKeptFrom(t))o.add(r);for(let[r,i]of e.modules.administered)if(!(e.mayAdminister(r,t)&&(n??[]).includes(r)))for(let a of i.kinds??[])o.add(a);return o}var Ft=2600;var Yo=new WeakSet,Hi=e=>Yo.has(e),Di=e=>void Yo.add(e);function Kt(e,t){let n=Un(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...fe,focusId:ne(n.place.kind),within:{view:n.place.as}}:{...fe,focusId:ne(n.kind)}}var Zo=_(j(),1),Ni=(0,Zo.createContext)(!1);var rt=Symbol.for("graview.default-view");function Xo(e){return Object.defineProperty(e,rt,{value:!0,enumerable:!1}),e}function Jo(e){return typeof e=="function"&&e[rt]===!0}var it=Symbol.for("graview.replaces-page");function Qo(e){return Object.defineProperty(e,it,{value:!0,enumerable:!1}),e}function er(e){return typeof e=="function"&&e[it]===!0}var at=Symbol.for("graview.bleeds");function tr(e){return Object.defineProperty(e,at,{value:!0,enumerable:!1}),e}function nr(e){return typeof e=="function"&&e[at]===!0}var st=Symbol.for("graview.previews");function or(e,t={}){return Object.defineProperty(e,st,{value:t,enumerable:!1}),e}function rr(e){return typeof e=="function"?e[st]:void 0}function ji(e){return $n(e)}function Wi(e,t){if(t===e)return e;for(let r of t.registrations())e.register(r.kind,r,r.view,r);let n=t.arrangement?.();n&&e.arrange?.(n);let o=t.homeView?.();return o&&e.home?.(o),e}var R=_(j(),1),Y=_(Ie(),1),qt=new Set,lt=0;function zt(e){return()=>{lt+=1;let t=e();return t.then(()=>void(lt-=1),()=>void(lt-=1)),t}}var Gi=()=>lt,ut=(0,R.createContext)(null);function Fi(){return{waiting:new Map,at:0}}function Ki(e){for(let[t,n]of e.waiting)n<e.at&&e.waiting.delete(t);e.at+=1}var Bi=e=>e?.waiting.size??0;function sr(e,t){e?.waiting.set(t,e.at)}function lr(e){let t=(0,R.useContext)(ut);(0,R.useLayoutEffect)(()=>{t?.waiting.delete(e)},[t,e])}function qi(e){let t={},n=!1,o=new Set,r=(0,R.lazy)(zt(()=>e().then(a=>{n=!0;let l=a.default;function s(u){return lr(t),(0,R.createElement)(l,u)}return{default:s}},a=>{for(let l of o)l.waiting.delete(t);throw a})));function i(a){let l=(0,R.useContext)(ut);return!n&&l&&(o.add(l),sr(l,t)),(0,R.createElement)(r,a)}return i}var dr=!1,ur=!1,dt=new Set;function zi(){dr=!0}function $i(){ur=!0;for(let e of[...dt])e();dt.clear()}var cr=()=>ur||!dr;function Ui(e){return cr()?(e(),()=>{}):(dt.add(e),()=>void dt.delete(e))}var ir=!1;function $t(){for(let e of[...qt])e()}function Yi(){ir||typeof window>"u"||(ir=!0,window.addEventListener("online",$t))}function Ut(e){let t,n=!1,o=!1,r,i=0,a=new Set,l=()=>{i+=1;for(let p of[...a])p()},s=p=>(a.add(p),()=>void a.delete(p)),u=()=>i,f=()=>void m().catch(()=>{});function m(){if(n)return Promise.resolve(t);if(r)return r;let p=e().then(g=>(t=g,n=!0,o=!1,r=void 0,qt.delete(f),l(),g),g=>{throw r=void 0,o=!0,qt.add(f),Yi(),l(),g});return p.catch(()=>{}),r=p,p}return{load:m,prefetch:f,get current(){return t},get failed(){return o},part(p,g={}){let v=g.what??"This part",T={};function y(E){(0,R.useSyncExternalStore)(s,u,u),lr(T);let P=(0,R.useRef)(null),W=(0,R.useRef)(null),N=(0,R.useRef)(!1);return(0,R.useEffect)(()=>{o&&r===void 0&&f()},[]),n&&typeof document<"u"&&P.current!==null&&document.activeElement===P.current&&(N.current=!0),(0,R.useLayoutEffect)(()=>{if(!(!n||!N.current)){N.current=!1;for(let H=W.current?.nextElementSibling??null;H!==null;H=H.nextElementSibling){let x=H.matches(ar)?H:H.querySelector(ar);if(x instanceof HTMLElement){x.focus();return}}}}),n?(0,Y.jsxs)(Y.Fragment,{children:[N.current?(0,Y.jsx)("span",{ref:W,hidden:!0}):null,p(t,E)]}):g.quiet?null:(0,Y.jsx)(Zi,{what:v,button:P,...g.as?{as:g.as}:{}})}let b=(0,R.lazy)(zt(()=>m().then(()=>({default:y}),()=>({default:y}))));function h(E){let P=(0,R.useContext)(ut),[W]=(0,R.useState)(()=>n||o);return!n&&!o&&sr(P,T),(0,R.createElement)(W?y:b,E)}return h}}}var ar="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function Zi({what:e,button:t,as:n="p"}){let r=typeof navigator<"u"&&navigator.onLine===!1?`${e} will load when you're back online.`:`${e} didn't load.`;return(0,Y.jsxs)(n,{"data-testid":"lazy-part-missing",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,Y.jsx)("span",{role:"status",children:r})," ",(0,Y.jsx)("button",{ref:t,type:"button","data-testid":"lazy-part-retry",onClick:$t,style:{font:"inherit",fontWeight:600,color:"var(--graview-ink)",background:"none",border:"1px solid var(--graview-edge)",borderRadius:6,padding:"2px 10px"},children:"Try again"})]})}var Se=_(j(),1);function Xi(){let{selection:e,setSelection:t}=oe();return(0,Se.useMemo)(()=>({selection:e,set:n=>t(n),clear:()=>t([]),toggle:n=>t(o=>o.includes(n)?o.filter(r=>r!==n):[...o,n]),isSelected:n=>e.includes(n)}),[e,t])}function Ji(){let{store:e}=oe(),t=ot();return(0,Se.useMemo)(()=>Qi(e),[e,t])}var fr=new WeakMap;function Qi(e){let t=fr.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),fr.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function ea(){let{view:e,setView:t}=oe();return(0,Se.useMemo)(()=>({view:e,url:te(e),focus:n=>t(o=>q(o,n)),show:n=>t(o=>Jn(o,n)),toggle:n=>t(o=>Ue(o,n)),go:n=>t(n)}),[e,t])}var he={at:0,depth:0,listeners:new Set,tell(){for(let e of this.listeners)e()}};typeof window<"u"&&window.addEventListener("popstate",e=>{let t=e.state;he.at=typeof t?.graview=="number"?t.graview:0,he.at>he.depth&&(he.depth=he.at),he.tell()});var G=_(j(),1),Zt={profile:{trigger:"profile-button",pane:"profile",opens:"press",focus:"into",drawn:["shell","embed"]},problems:{trigger:"standing",pane:"problems",opens:"press",focus:"into",drawn:["shell","embed"]},places:{trigger:"app-places-open",pane:"app-places",opens:"press",focus:"into",drawn:["embed"]},here:{trigger:"here-open",pane:"here-list",opens:"press",focus:"into",drawn:["shell","embed","pages"]},suggested:{trigger:"suggested-button",pane:"suggested",opens:"press",focus:"into",drawn:["shell","embed","pages"]},activity:{trigger:"activity-button",pane:"activity",opens:"press",focus:"into",drawn:["shell","embed","pages"]},find:{trigger:"find-box",pane:"find-strip",opens:"typing",focus:"stays",drawn:["shell"]},districts:{trigger:"beyond-more",pane:"beyond-list",opens:"press",focus:"into",drawn:["shell","embed"]},acts:{trigger:null,pane:"context-menu",opens:"context-menu",focus:"into",drawn:["shell","embed","pages"]},arrange:{trigger:"arrange-add",pane:"arrange-list",opens:"press",focus:"into",drawn:["pages"]},"studio-ask":{trigger:"studio-agent",pane:"studio-agent-panel",opens:"press",focus:"into",drawn:["studio"]}},ta={position:"fixed",inset:"auto",margin:0,zIndex:Kn("popover"),boxSizing:"border-box"},ct=6,we=8,na=e=>typeof e.showPopover=="function";function ft(e){try{return e.matches(":popover-open")}catch{return!1}}function oa(e){if(typeof e=="function"){let o=e();return o?{left:o.x,right:o.x,top:o.y,bottom:o.y}:null}let t=e.current;if(!t||!t.isConnected)return null;let n=t.getBoundingClientRect();return{left:n.left,right:n.right,top:n.top,bottom:n.bottom}}function Xt(e,t,n={}){let o=oa(t);if(!o)return;let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},i=e.dataset.graviewDesignedHeight??=e.style.maxHeight;e.style.maxHeight=i;let a=e.getBoundingClientRect(),l=r.height-o.bottom-ct-we,s=o.top-ct-we,u=a.height<=l||l>=s,f=Math.max(96,Math.floor(u?l:s)),m=Math.min(a.height,f);a.height>f&&(e.style.maxHeight=i?`min(${i}, ${f}px)`:`${f}px`);let p=a.width,g=n.align==="start"?o.left:o.right-p,v=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();v&&p<=v.right-v.left&&(g<v.left?g=o.left+p<=v.right?o.left:v.left:g+p>v.right&&(g=o.right-p>=v.left?o.right-p:v.right-p));let T=p>=r.width-2*we?Math.max(0,(r.width-p)/2):Math.max(we,Math.min(g,r.width-we-p)),y=u?o.bottom+ct:Math.max(we,o.top-ct-m);e.style.left=`${Math.round(T)}px`,e.style.top=`${Math.round(y)}px`}function pr(e,t,n,o={}){let r=o.align??"end";(0,G.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(na(i)&&!ft(i))try{i.showPopover(),ia()}catch{}let a=0,l=u=>{u?.target instanceof Node&&i.contains(u.target)||(cancelAnimationFrame(a),a=requestAnimationFrame(()=>Xt(i,n,{align:r})))};Xt(i,n,{align:r}),addEventListener("resize",l),addEventListener("scroll",l,!0);let s=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>l());return s?.observe(i),()=>{if(cancelAnimationFrame(a),removeEventListener("resize",l),removeEventListener("scroll",l,!0),s?.disconnect(),i.isConnected&&ft(i))try{i.hidePopover()}catch{}}},[t,e,r])}var Jt=new Set;function ra(e){return Jt.add(e),()=>Jt.delete(e)}function ia(){for(let e of Jt)if(!(!e.isConnected||!ft(e)))try{e.hidePopover(),e.showPopover()}catch{}}var ve=null,aa='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function sa(e){for(let t of e.querySelectorAll(aa))if(t.closest("[hidden]")===null&&getComputedStyle(t).visibility!=="hidden")return t;return e}var Yt=()=>{let e=document.activeElement;return e===null||e===document.body};function la(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[a,l]=(0,G.useState)(!1),s=t.open??a,u=(0,G.useRef)(null),f=(0,G.useRef)(null),m=(0,G.useCallback)(h=>{u.current=h},[]),p=(0,G.useCallback)(h=>{f.current=h},[]),g=`graview-popover-${(0,G.useId)().replace(/:/g,"")}`,v=(0,G.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});v.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let T=(0,G.useCallback)(h=>{v.current.controlled||l(h),v.current.onOpenChange?.(h)},[]),y=(0,G.useCallback)(()=>{(document.querySelector(`[aria-controls="${g}"]`)??u.current??v.current.returnTo?.()??null)?.focus({preventScroll:!0})},[g]),b=(0,G.useCallback)(h=>{let E=f.current,P=typeof document>"u"?null:document.activeElement,W=P===null||P===document.body||E!==null&&E.contains(P);T(!1),!(!h||!W)&&(y(),requestAnimationFrame(()=>{Yt()&&y()}))},[T,y]);return pr(f,i&&s,n??u,t.align?{align:t.align}:{}),(0,G.useEffect)(()=>{if(!i||!s)return;let h={name:e,close:()=>b(!1)};if(ve&&ve.close!==h.close&&ve.close(),ve=h,Zt[e].focus==="into"){let x=f.current;x&&!x.contains(document.activeElement)&&sa(x).focus({preventScroll:!0})}let E=x=>{x.key==="Escape"&&b(!0)},P=x=>{let C=x.target;if(!(C instanceof Node))return;let V=f.current;if(V?.contains(C)||u.current?.contains(C))return;let F=C instanceof Element?C.closest('[role="dialog"], [role="alertdialog"]'):null;F&&!(V&&F.contains(V))||(b(!1),Zt[e].focus==="into"&&requestAnimationFrame(()=>{(Yt()||V!==null&&V.contains(document.activeElement))&&y()}))},W=null,N=null,H=x=>{let C=x.target;if(!(C instanceof Element))return;let V=f.current,F=C.closest('[role="dialog"], [role="alertdialog"]');!F||V&&(V.contains(F)||F.contains(V))||(W=F,b(!1))};return document.addEventListener("keydown",E),document.addEventListener("pointerdown",P,!0),document.addEventListener("focusin",H),()=>{document.removeEventListener("keydown",E),document.removeEventListener("pointerdown",P,!0),document.removeEventListener("focusin",H);let x=W;x&&typeof MutationObserver<"u"&&(N?.disconnect(),N=new MutationObserver(()=>{x.isConnected||(N?.disconnect(),requestAnimationFrame(()=>{(Yt()||document.activeElement.closest("[hidden]")!==null)&&y()}))}),N.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>N?.disconnect(),10*6e4)),ve?.close===h.close&&(ve=null)}},[i,s,e,b,y]),{open:s,setOpen:h=>h?T(!0):b(!0),toggle:()=>s?b(!0):T(!0),trigger:{ref:m,"aria-expanded":s,"aria-controls":g,"data-graview-popover-trigger":e},pane:{ref:p,id:g,popover:"manual",tabIndex:-1,"data-graview-popover":e,"data-graview-overlay":""}}}var be=_(j(),1);var yr=(0,be.createContext)(null);function da(){let e=(0,be.useContext)(yr),t=Bt(),n=(o,r,i)=>t?.setView(a=>ae(ae(pe(q(a,ne(o)),!1),"view",r),"filter",i?.filter??null));return(0,be.useMemo)(()=>e??{record:o=>{t&&(t.setView(r=>q(pe(r,!1),o)),t.setSelection([o]))},place:(o,r)=>{let i=t?.views.places().find(a=>a.as===o);i&&n(i.kind,i.as,r)},list:(o,r)=>n(o,null,r)},[e,t])}var xe=_(j(),1);var ua=Ut(Ke(()=>(__graviewPreload(import.meta.url,["./chunk.KA44WNB4.js","./chunk.SDO3U72B.js","./chunk.4TJOS4C7.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.P6FQAILU.js"))));function ca(e,t,n){let o,r=!1,i=()=>{let{hidden:l,removed:s}=t.current();o||r||l.length+s.length===0||(o=()=>{},ua.load().then(u=>{r||(o=u.watchTidied(e,t,n))},String))};i();let a=t.onChange?.(i);return()=>{r=!0,a?.(),o?.()}}function fa(e,t){let[n,o]=(0,xe.useState)();return(0,xe.useEffect)(()=>t?ca(e,t,r=>o([e,r])):void 0,[e,t]),n?.[0]===e?n[1]:e}var mr=_(j(),1),pa=(0,mr.createContext)(!1);var Qt=_(j(),1),ya=(0,Qt.createContext)(null),ma=(0,Qt.createContext)(null);var gr=_(j(),1),ga=(0,gr.createContext)(null);var hr=_(j(),1),en='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',tn=e=>e instanceof HTMLElement&&(e.matches(en)||e.hasAttribute("tabindex")),Le=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function ha(e,t){let n=s=>s.replace(/["\\]/g,"\\$&"),o=t.getAttribute("data-testid"),r=t.getAttribute("data-graview-pick"),i=t.getAttribute("aria-label"),a=o?`[data-testid="${n(o)}"]`:r?`[data-graview-pick="${n(r)}"]`:i?`${t.tagName.toLowerCase()}[aria-label="${n(i)}"]`:null;if(!a)return null;let l=e.querySelector(a);return l&&tn(l)&&Le(l)?l:null}var Sa=e=>e.isConnected&&tn(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&Le(e);function Sr(e,t){let n=t?ha(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&Le(o))return o;for(let r of e.querySelectorAll(en))if(Le(r))return r;return tn(e)&&Le(e)?e:null}function wa(e){(0,hr.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=y=>{let b=y.target;if(b instanceof Element){n=[];for(let h=b;h&&h!==t.parentElement;h=h.parentElement)n.push(h)}},r=!1,i=!1,a=t.ownerDocument,l=()=>!i&&a.defaultView!==null,s=(y,b)=>void setTimeout(()=>l()&&b(),y),u=y=>void requestAnimationFrame(()=>l()&&y()),f=y=>{if(r=!1,i)return;let b=a.activeElement;if(!(!(b===null||b===a.body||b===a.documentElement)||n.length===0)){if(Sa(n[0])){y&&n[0]instanceof HTMLElement&&n[0].focus({preventScroll:!0});return}for(let E of n.slice(1)){if(!E.isConnected)continue;let P=Sr(E,n[0]);if(P){P.focus({preventScroll:!0}),n=[];return}}}},m=(y,b=Date.now()+2500)=>{s(100,()=>{f(y);let h=a.activeElement;(h===null||h===a.body||h===a.documentElement)&&n.length>0&&Date.now()<b&&m(y,b)})},p=()=>{r||n.length===0||(r=!0,s(60,()=>u(()=>{f(!1),m(!1)})))},g=y=>{if(!(y instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(y.key))){if(!(y instanceof KeyboardEvent)){let b=y.target instanceof Element?y.target.closest(en):null,h=a.activeElement,E=h===null||h===a.body||h===a.documentElement;if(b&&E&&t.contains(b)){n=[];for(let P=b;P&&P!==t.parentElement;P=P.parentElement)n.push(P);s(150,()=>u(()=>{f(!1),m(!1)}));return}}!(y instanceof KeyboardEvent)&&!(y.target instanceof Node&&n[0]?.contains(y.target))||s(150,()=>u(()=>{f(!0),m(!0)}))}},v=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&p()}),T=y=>{y.relatedTarget===null&&p()};return t.addEventListener("focusin",o),t.addEventListener("focusout",T),t.addEventListener("click",g),t.addEventListener("keydown",g),v.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",T),t.removeEventListener("click",g),t.removeEventListener("keydown",g),v.disconnect()}},[e])}export{fe as a,te as b,ze as c,ba as d,xa as e,Zn as f,Yn as g,Xn as h,vt as i,q as j,Jn as k,ae as l,pe as m,$e as n,Ve as o,Ue as p,Ze as q,bt as r,ye as s,Aa as t,Ir as u,ne as v,Qn as w,se as x,eo as y,_r as z,ka as A,to as B,xt as C,Lr as D,Hr as E,Dr as F,j as G,Ct as H,oi as I,ii as J,vo as K,Qe as L,ai as M,Ce as N,xo as O,si as P,_t as Q,Ie as R,bi as S,xi as T,Ei as U,$o as V,Ti as W,Oi as X,xs as Y,_i as Z,oe as _,Bt as $,ot as aa,Li as ba,Hi as ca,Di as da,Kt as ea,yr as fa,da as ga,Ni as ha,Xo as ia,Jo as ja,Qo as ka,er as la,tr as ma,nr as na,or as oa,rr as pa,ji as qa,Wi as ra,zt as sa,Gi as ta,ut as ua,Fi as va,Ki as wa,Bi as xa,qi as ya,zi as za,$i as Aa,cr as Ba,Ui as Ca,Ut as Da,fa as Ea,pa as Fa,ya as Ga,ma as Ha,ga as Ia,Xi as Ja,Ji as Ka,ea as La,he as Ma,wa as Na,ta as Oa,ft as Pa,pr as Qa,ra as Ra,la as Sa};
2
2
  /*! Bundled license information:
3
3
 
4
4
  react/cjs/react.production.js:
@@ -0,0 +1,2 @@
1
+ import{Da as Q,Eb as I,F,G as B,I as L,La as X,Lb as en,O,R as j,S as J,T as U,U as K,Wa as v,Ya as nn,_ as P,aa as Z,la as z}from"./chunk.4TJOS4C7.js";var un=1e4,g=class{constructor(s){this.nodes=s}},rn=Symbol.for("@graview/core:far-record"),fn=e=>typeof e=="object"&&e!==null&&e[rn]===!0;function cn(e){let s={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(s,rn,{value:!0}),s}function Nn(e){let s=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${s} is not one this viewer may open`:`${s} has not been read`}var pn="",f=class extends Error{constructor(c,l){super(c);this.sentence=c;this.at=l}},W=class extends f{},V=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof g)&&typeof e.id=="string",tn=e=>{let s=new Set;return new g(e.filter(c=>!s.has(c.id)&&s.add(c.id)))},w=e=>e===null?"nothing":e instanceof g?"a set of records":Array.isArray(e)?"a list":V(e)?"a record":typeof e=="string"?"a word":typeof e;function on(e,s){let c=s.budget??un,l=(n,a)=>{if(c-=n,c<0)throw new W("this rule looks at too much of the graph to judge in one go",a)},u=s.today??L(),b=s.now??new Date().toISOString(),k=new Map,N=new Set,A=s.bindings,H=(n,a,t,o)=>{let d=`${n?.id}\0${a}`;if(k.has(d))return k.get(d);if(N.has(d))throw new f(`"${a}"${n?` of ${z(n.kind)}`:""} depends on itself`,o);N.add(d);let r=A;A=void 0;try{let i=$(t,n);return k.set(d,i),i}finally{A=r,N.delete(d)}},E=(n,a,t)=>{l(1,t);let o=s.kinds.get(n.kind),d=o?.computed?.get(a);if(d)return H(n,a,d,t);let r=o?.linked?.get(a);if(r){let y=Q(Object.hasOwn(n,a)?n[a]:void 0,r);l(y.length,t);let m=s.linked??X(s.graph),h=y.flatMap(x=>{let C=m?m(x):{unread:!0};return"record"in C?[cn(C.record)]:(s.onUnread?.({relation:a,ref:x,reason:"denied"in C?"denied":"unread"}),[])});return r.cardinality==="one"?h[0]??null:new g(h)}let i=Object.hasOwn(n,a);if(o?.fields.has(a)||i){let y=i?v(n,a,u):void 0;return y===void 0?null:y}let p=o?.edges.get(a);if(p){let y=s.graph.out(n.id,a);return l(y.length,t),p==="one"?y[0]??null:new g(y)}if(a==="id")return n.id;if(fn(n))return null;throw new f(`${z(n.kind)} has no field or relation called "${a}"`,t)},S=(n,a,t)=>{if(n instanceof g)return n;if(n===null)return new g([]);if(V(n))return new g([n]);throw new f(`${t}(\u2026) needs a set of records, and was given ${w(n)}`,a)},G=(n,a,t)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new f(`${t}(\u2026) needs a word, and was given ${w(n)}`,a)},_=(n,a,t)=>{let o=G(n,a,t);if(o===null)return null;let d=Date.parse(o.length===10?`${o}T00:00:00Z`:o);if(Number.isNaN(d))throw new f(`${t}(\u2026) needs a date, and "${o}" is not one`,a);return d},M=(n,a)=>V(n)&&V(a)?n.id===a.id:V(n)&&typeof a=="string"?n.id===a:typeof n=="string"&&V(a)?n===a.id:Array.isArray(n)&&Array.isArray(a)?n.length===a.length&&n.every((t,o)=>M(t,a[o])):n===a,R=(n,a,t)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new f(`${t} must be true or false, and was ${w(n)}`,a)},T=(n,a)=>$(a,n);function $(n,a){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(t=>$(t,a));case"ident":{let t=A&&Object.hasOwn(A,n.name)?A[n.name]:void 0;if(t!==void 0)return t;if(a)return E(a,n.name,n.at);throw new f(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let t=$(n.object,a);if(t===null)return null;if(V(t))return E(t,n.name,n.at);throw new f(`".${n.name}" needs a record before it, and was given ${w(t)}`,n.at)}case"unary":{let t=$(n.operand,a);if(n.op==="!")return!R(t,n.at,"what follows not");if(t===null)return null;if(typeof t!="number")throw new f(`"-" needs a number, and was given ${w(t)}`,n.at);return-t}case"where":{let t=S($(n.set,a),n.at,"where");return l(t.nodes.length,n.at),new g(t.nodes.filter(o=>R(T(o,n.filter),n.at,"a where condition")))}case"binary":return dn(n,a);case"call":return ln(n,a)}}function dn(n,a){if(n.op==="&&")return R($(n.left,a),n.at,"each side of and")&&R($(n.right,a),n.at,"each side of and");if(n.op==="||")return R($(n.left,a),n.at,"each side of or")||R($(n.right,a),n.at,"each side of or");let t=$(n.left,a),o=$(n.right,a);if(n.op==="&"||n.op==="|"||n.op==="-"&&(t instanceof g||o instanceof g)){let d=S(t,n.at,n.op).nodes,r=S(o,n.at,n.op).nodes;l(d.length+r.length,n.at);let i=new Set(r.map(p=>p.id));return tn(n.op==="|"?[...d,...r]:d.filter(p=>i.has(p.id)===(n.op==="&")))}switch(n.op){case"==":return M(t,o);case"!=":return!M(t,o);case"in":{if(o===null)return!1;if(o instanceof g)return o.nodes.some(d=>M(t,d));if(Array.isArray(o))return o.some(d=>M(t,d));if(typeof o=="string"&&typeof t=="string")return o.includes(t);throw new f(`"in" needs a list or a set on its right, and was given ${w(o)}`,n.at)}case"<":case"<=":case">":case">=":{if(t===null||o===null)return!1;if(!(typeof t=="number"&&typeof o=="number"||typeof t=="string"&&typeof o=="string"))throw new f(`cannot compare ${w(t)} with ${w(o)}`,n.at);return n.op==="<"?t<o:n.op==="<="?t<=o:n.op===">"?t>o:t>=o}default:{if(t===null||o===null)return null;if(n.op==="+"&&(typeof t=="string"||typeof o=="string")){let d=`${G(t,n.at,"+")}${G(o,n.at,"+")}`;if(d.length>1e4)throw new f("that makes a word too long",n.at);return d}if(typeof t!="number"||typeof o!="number")throw new f(`"${n.op}" needs numbers, and was given ${w(t)} and ${w(o)}`,n.at);return(n.op==="/"||n.op==="%")&&o===0?null:n.op==="+"?t+o:n.op==="-"?t-o:n.op==="*"?t*o:n.op==="/"?t/o:t%o}}}function ln(n,a){let t=(r,i=r)=>{if(n.args.length<r||n.args.length>i)throw new f(`${n.fn}(\u2026) takes ${r===i?r:`${r} to ${i}`} argument${i===1?"":"s"}`,n.at)},o=r=>$(n.args[r],a),d=r=>{let i=o(r);if(typeof i!="string")throw new f(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return i};switch(n.fn){case"out":case"in":{t(1,2);let r=(y,m)=>n.fn==="out"?s.graph.out(y,m):s.graph.in(y,m);if(n.args.length===2){let y=S(o(0),n.at,n.fn).nodes,m=d(1);return tn(y.flatMap(h=>{let x=r(h.id,m);return l(x.length+1,n.at),x}))}let i=d(0);if(!a)throw new f(`${n.fn}('${i}') needs a record to start from`,n.at);let p=r(a.id,i);return l(p.length,n.at),new g(p)}case"all":{t(1,2);let r=s.graph.nodesOfKind(d(0),{archived:n.args.length===2?o(1):!1});return l(r.length,n.at),new g(r)}case"archived":return t(0,1),nn(n.args.length===1?o(0):a);case"count":return t(1),S(o(0),n.at,"count").nodes.length;case"exists":return t(1),S(o(0),n.at,"exists").nodes.length>0;case"every":case"some":{t(2);let r=S(o(0),n.at,n.fn);l(r.nodes.length,n.at);let i=p=>R(T(p,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(i):r.nodes.some(i)}case"sum":case"min":case"max":{t(2);let r=S(o(0),n.at,n.fn);l(r.nodes.length,n.at);let i=n.args[1],p=i.t==="lit"&&typeof i.value=="string"?i.value:void 0,y=i.t==="ident"?`'${i.name}'`:p!==void 0?`'${p}'`:"\u2026",m=r.nodes.map(h=>i.t==="ident"?E(h,i.name,n.at):p!==void 0?E(h,p,n.at):T(h,i)).filter(h=>{if(h===null)return!1;if(typeof h!="number")throw new f(`${n.fn}(\u2026, ${y}) needs a number for each member, and found ${w(h)}`,n.at);return!0});return n.fn==="sum"?m.reduce((h,x)=>h+x,0):m.length===0?null:n.fn==="min"?Math.min(...m):Math.max(...m)}case"fact":{t(1);let r=d(0),i=s.kinds.get(pn)?.computed?.get(r);if(!i)throw new f(`no fact is called "${r}"`,n.at);return H(null,r,i,n.at)}case"first":return t(1),S(o(0),n.at,"first").nodes[0]??null;case"sort":{t(2,3);let r=S(o(0),n.at,"sort"),i=n.args.length===3?o(2):"asc";if(i!=="asc"&&i!=="desc")throw new f("sort(\u2026) goes 'asc' or 'desc'",n.at);let p=r.nodes.length;l(p+p*Math.ceil(Math.log2(p+1)),n.at);let y=r.nodes.map((h,x)=>({node:h,i:x,key:T(h,n.args[1])})),m=i==="desc"?-1:1;return y.sort((h,x)=>Y(h.key,x.key,m,n.at)||h.i-x.i),new g(y.map(h=>h.node))}case"either":{if(n.args.length<1)throw new f("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let i=o(r);if(i!==null&&!(i instanceof g&&i.nodes.length===0))return i}return null}case"present":{t(1);let r=o(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof g?r.nodes.length>0:!0}case"len":{t(1);let r=o(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof g)return r.nodes.length;throw new f(`len(\u2026) needs a word or a list, and was given ${w(r)}`,n.at)}case"contains":case"startsWith":{t(2);let r=o(0),i=o(1);if(r===null||i===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(m=>M(m,i));let p=G(r,n.at,n.fn),y=G(i,n.at,n.fn);return n.fn==="contains"?p.toLowerCase().includes(y.toLowerCase()):p.startsWith(y)}case"lower":{t(1);let r=G(o(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"today":return t(0),u;case"now":return t(0),b;case"date":{t(1);let r=_(o(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{t(2);let r=_(o(0),n.at,n.fn),i=_(o(1),n.at,n.fn);if(r===null||i===null)return null;let p=(i-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(p):p}case"if":return t(3),R(o(0),n.at,"the condition in if(\u2026)")?o(1):o(2);default:throw new f(`"${n.fn}" is not a function the rule language knows`,n.at)}}function Y(n,a,t,o){if(n===null||a===null)return n===a?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(a)){for(let r=0;r<Math.max(n.length,a.length);r++){let i=Y(n[r]??null,a[r]??null,t,o);if(i!==0)return i}return 0}let d=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:w(r);if(d(n)!==d(a)||typeof n=="object"||typeof a=="object")throw new f(`sort(\u2026) cannot put ${w(n)} and ${w(a)} in order`,o);return typeof n=="string"?t*(n<a?-1:n>a?1:0):t*(Number(n)-Number(a))}return $(e,s.subject)}var Rn=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact","archived"];var Gn=(e,s,c,l)=>({severity:"error",code:e,path:s,message:c,...l?{fix:l}:{}}),Mn=(e,s,c,l)=>({severity:"warning",code:e,path:s,message:c,...l?{fix:l}:{}}),On=e=>e.some(s=>s.severity==="error");function En(e){return e.map(s=>`${s.severity==="error"?"\u2717":s.severity==="warning"?"!":"\xB7"} ${s.path||"(document)"}: ${s.message}${s.fix?` \u2014 ${s.fix}`:""}`).join(`
2
+ `)}var jn=["money","percent","date","time","datetime","relative","upper","lower","count","words","and","plural","excerpt"],gn={getNode:()=>{},allNodes:()=>[],allEdges:()=>[],nodesOfKind:()=>[],edgesOfKind:()=>[],out:()=>[],in:()=>[],neighbors:()=>[],has:()=>!1};function Un(e,s,c,l=[],u,b=D){return q(e,s,c,l,u,b)}var yn=(e,s)=>e.capital?P(s):s,hn=new Set(["words","plural","relative"]);function Kn(e,s){let c=e[0];return!c||c.text!==void 0||!c.format||!hn.has(c.format)?s:/^[a-z][a-z'’-]*(?=\s|$|[,.;:!?])/.test(s)?P(s):s}function mn(e){return e?s=>{let c=e.tryDefinition(s.kind)?.label;return c?c(s):D(s)}:D}var an=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],sn=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function wn(e,s){return!Number.isInteger(e)||e<0||e>99?K(e,s):e<20?an[e]:e%10===0?sn[e/10]:`${sn[Math.floor(e/10)]}-${an[e%10]}`}function $n(e){return/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:`${e}s`}var D=e=>String(e.name??e.title??e.label??e.id);function q(e,s,c,l=[],u,b=D){if(s==="plural"){let k=e instanceof g?e.nodes.length:Array.isArray(e)?e.length:typeof e=="number"?e:null;return k===null||l[0]===void 0?"\u2014":k===1?l[0]:l[1]??$n(l[0])}if(e===null)return"\u2014";if(e instanceof g)return s==="count"?String(e.nodes.length):s==="and"?Z(e.nodes.map(b)):e.nodes.map(b).join(", ");if(Array.isArray(e)){if(s==="count")return String(e.length);let k=e.map(N=>q(N,void 0,c,[],u,b));return s==="and"?Z(k):k.join(", ")}if(typeof e=="object")return b(e);switch(s){case"words":return typeof e=="number"?wn(e,u?.locale):String(e);case"money":return typeof e=="number"?I(e,u):String(e);case"percent":return typeof e=="number"?K(e,u?.locale,{style:"percent",maximumFractionDigits:0}):String(e);case"upper":return String(e).toUpperCase();case"lower":return String(e).toLowerCase();case"excerpt":return en(String(e),Number(l[0])||void 0);case"date":return O(U(String(e),u?.timeZone)??String(e).slice(0,10),u?.locale);case"time":return typeof e=="string"&&F.test(e)?O(e,u?.locale):J(String(e),u?.locale,u?.timeZone);case"datetime":return typeof e=="string"&&F.test(e)?O(e,u?.locale):j(String(e),u?.locale,u?.timeZone);case"relative":{let k=U(String(e),u?.timeZone),N=k===void 0?Date.parse(String(e)):Date.parse(`${k}T00:00:00Z`);if(Number.isNaN(N))return String(e);let A=Math.round((N-Date.parse(`${c}T00:00:00Z`))/864e5);return A===0?"today":A===1?"tomorrow":A===-1?"yesterday":A>0?`in ${A} days`:`${-A} days ago`}default:return typeof e=="string"&&F.test(e)?O(e,u?.locale):typeof e=="string"&&B.test(e)?j(e,u?.locale,u?.timeZone):String(e)}}function Pn(e,s){let c=s.today??L(),l=s.name??mn(s.graph?.schema);return e.map(u=>{if(u.text!==void 0)return u.text;try{let b=on(u.expr,{graph:s.graph??gn,subject:s.node,kinds:s.kinds,today:c,budget:s.budget??500,...s.bindings?{bindings:s.bindings}:{}});return yn(u,q(b,u.format,c,u.formatArgs,s.money,l))}catch(b){if(b instanceof f)return"\u2014";throw b}}).join("")}export{g as a,Nn as b,pn as c,f as d,W as e,on as f,Rn as g,Gn as h,Mn as i,On as j,En as k,jn as l,gn as m,Un as n,yn as o,Kn as p,mn as q,Pn as r};
@@ -1 +1 @@
1
- import{c as u}from"./chunk.H7KCWCB4.js";import{fa as l}from"./chunk.AS4CQBOQ.js";function a(e,n){let s=new Map;for(let o of e){let t=n(o.from),i=n(o.to);if(t===void 0||i===void 0)continue;let d=`${o.kind}|${t}|${i}`,r=s.get(d);r||s.set(d,r={edge:o.kind,from:t,to:i,links:0,froms:new Set,tos:new Set}),r.links+=1,r.froms.add(o.from),r.tos.add(o.to)}return[...s.entries()].sort(([o],[t])=>o<t?-1:o>t?1:0).map(([o,t])=>({key:o,edge:t.edge,from:t.from,to:t.to,links:t.links,fromCount:t.froms.size,toCount:t.tos.size}))}function m(e,n,s){let o=[],t=[];for(let d of e){let r=f(d);if(r!==null){o.includes(r)||o.push(r);continue}s(d)!==void 0&&t.push(d)}let i=n.overview&&n.focusId!==null?f(n.focusId):null;return n.beside&&n.overview&&i===null&&n.focusId!==null&&t.length===0&&o.length===0&&s(n.focusId)!==void 0&&t.push(n.focusId),{districts:o,records:t,lens:i}}function f(e){return e.startsWith("kind:")?e.slice(5)||null:e.startsWith("aggregate:")&&!e.includes("|")&&e.slice(10)||null}function y(e,n){let s=u(e,n.from,n.edge,"out"),o=n.from===n.to?" of their own":"";return`${l(e,n.from,n.fromCount)} \u2192 ${l(e,n.to,n.toCount)}${o}, ${s}`}export{a,m as b,f as c,y as d};
1
+ import{c as u}from"./chunk.DPHTUTOS.js";import{ga as l}from"./chunk.4TJOS4C7.js";function a(e,n){let s=new Map;for(let o of e){let t=n(o.from),i=n(o.to);if(t===void 0||i===void 0)continue;let d=`${o.kind}|${t}|${i}`,r=s.get(d);r||s.set(d,r={edge:o.kind,from:t,to:i,links:0,froms:new Set,tos:new Set}),r.links+=1,r.froms.add(o.from),r.tos.add(o.to)}return[...s.entries()].sort(([o],[t])=>o<t?-1:o>t?1:0).map(([o,t])=>({key:o,edge:t.edge,from:t.from,to:t.to,links:t.links,fromCount:t.froms.size,toCount:t.tos.size}))}function m(e,n,s){let o=[],t=[];for(let d of e){let r=f(d);if(r!==null){o.includes(r)||o.push(r);continue}s(d)!==void 0&&t.push(d)}let i=n.overview&&n.focusId!==null?f(n.focusId):null;return n.beside&&n.overview&&i===null&&n.focusId!==null&&t.length===0&&o.length===0&&s(n.focusId)!==void 0&&t.push(n.focusId),{districts:o,records:t,lens:i}}function f(e){return e.startsWith("kind:")?e.slice(5)||null:e.startsWith("aggregate:")&&!e.includes("|")&&e.slice(10)||null}function y(e,n){let s=u(e,n.from,n.edge,"out"),o=n.from===n.to?" of their own":"";return`${l(e,n.from,n.fromCount)} \u2192 ${l(e,n.to,n.toCount)}${o}, ${s}`}export{a,m as b,f as c,y as d};
@@ -0,0 +1,2 @@
1
+ import{a as le,b as I,d as ue,g as ye,h as me,i as pe}from"./chunk.DPHTUTOS.js";import{$ as q,C as T,Da as re,Db as v,F as Z,Fa as ie,Fb as ce,G as O,Gb as C,H as B,I as V,Na as W,O as x,R as X,Ra as se,S as Y,Ta as de,Va as ae,W as j,Y as H,da as M,fa as L,ka as _,ma as J,sa as Q,ta as ee,ua as ne,va as te,xb as fe,ya as oe}from"./chunk.4TJOS4C7.js";var $e=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,Re={day:"day",week:"week",month:"month",year:"year"},F=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function xe(t,e,n){let o=e.interval??1,i=Re[e.every],s=t.slice(0,10),l=o===1?`Every ${i}`:o===2?`Every other ${i}`:`Every ${o} ${i}s`,d;if(e.every==="week"){let y=(e.on?.length?e.on:[W[new Date(`${s}T00:00:00Z`).getUTCDay()]]).map(r=>H(W.indexOf(r),"long",n));d=o===1?`Every ${F(y)}`:o===2?`Every other ${F(y)}`:`${l} on ${F(y)}`}else if(e.every==="month"){let y=(e.on?.length?e.on:[+s.slice(8,10)]).map(r=>r===-1?"the last day":`the ${$e(Number(r))}`);d=`${l} on ${F(y)}`}else e.every==="year"?d=`${l} on ${j(s,n)}`:d=l;return O.test(t)&&(d+=` at ${Y(t,n)}`),e.until&&(d+=`, until ${x(e.until,n)}`),e.count&&(d+=`, ${e.count===1?"once":`${e.count} times`}`),d}function ge(t,e,n={}){if(!de(e)||typeof t!="string")return;let o=n.today??V(),i=ae(t,e,o),s=xe(t,e,n.locale),l=i.slice(0,4)===o.slice(0,4)?j(i.slice(0,10),n.locale):x(i.slice(0,10),n.locale);return i.slice(0,10)<o?`${s}, last ${l}`:`${s}, next ${l}`}function on(t,e){let n=new Map,o=new Map;for(let i of t){let s=M(e(i.kind),i).trim().toLowerCase();o.set(s,[...o.get(s)??[],i])}for(let i of o.values()){if(i.length<2)continue;let s=new Map;for(let l of i)s.set(l.kind,[...s.get(l.kind)??[],l]);for(let[l,d]of s){if(d.length===1){n.set(d[0].id,J(e(l),l));continue}let y=d.map(f=>new Map(Se(f,e(f.kind)).map(m=>[m.key,m.alone]))),r=[...new Set(y.flatMap(f=>[...f.keys()]))],u=f=>y.every(m=>!/\d/.test(m.get(f)??"")),h=[...r.filter(u),...r.filter(f=>!u(f))],b=(f,m)=>m.map(p=>y[f].get(p)??"").filter(Boolean).join(" \xB7 "),S=f=>new Set(d.map((m,p)=>b(p,f))).size===d.length&&d.every((m,p)=>b(p,f)!==""),c=h.find(f=>S([f])),a=c?void 0:h.flatMap((f,m)=>h.slice(m+1).map(p=>[f,p])).find(f=>S(f));d.forEach((f,m)=>{if(c||a)return void n.set(f.id,b(m,c?[c]:a));let p=h.find($=>{let w=y[m].get($);return w!==void 0&&w!==""&&y.every((R,k)=>k===m||R.get($)!==w)});n.set(f.id,p?y[m].get(p):`${m+1} of ${d.length}`)})}}return n}function rn(t,e){return t?.describe?t.describe(e):`${e.kind} ${M(t,e)}`}var _e=new Set(["id","kind","label"]);function ve(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function Se(t,e,n={}){let o=e?.display,i=new Set([..._e,...o?.hide??[]]);typeof t.label=="string"&&e?.label&&!M(e,t).includes(t.label)&&i.delete("label");let s=(n.said??[]).filter(c=>!!c),l=s.filter(c=>c.endsWith("\u2026")).map(c=>c.replace(/…$/,"").trim()).filter(c=>c.length>12),d=[],y=e?.fields?.shape,r=e?.fieldRoles,u=n.glance?o?.glance??[r?.who,r?.when].filter(c=>!!c):he(o?.page),h=n.glance&&o?.glance!==void 0,S=[...new Set(h?u:[...u,...Ne(e),...Object.keys(t)])].filter(c=>Object.hasOwn(t,c)).map(c=>[c,t[c]]);for(let[c,a]of S){if(i.has(c)||a===void 0||a===null)continue;let f=o?.format?.[c],m=f?[]:ne(a);if(m[0]&&n.glance)continue;let p=e?.fields?.shape?.[c],$=!f&&typeof a=="string"&&oe(p)?a:void 0,w=!f&&typeof a=="string"&&le(p);if($&&n.glance)continue;let R=f?void 0:ie(p),k=R?{relation:R,refs:re(a,R)}:void 0;if(k&&(n.glance||k.refs.length===0)||!m[0]&&typeof a=="object"&&(!Array.isArray(a)||a.some(g=>typeof g=="object"&&g!==null))&&f===void 0)continue;let U=typeof a=="string"&&!f?ge(a,t[`${c}Repeat`],{locale:n.locale}):void 0,N=m[0]?m.map(g=>`${g.caption?`${g.name} \u2014 ${g.caption}`:g.name}${Q(g)?` (${ee(g)})`:""}`).join(", "):Array.isArray(a)?a.join(", "):typeof a=="boolean"?a?"Yes":"No":String(a),E=f?void 0:ye(e,c),G=pe(E,a),K=!f&&!E&&typeof a=="number"?v(e?.fields?.shape?.[c]):void 0,z=k?k.refs.length>1?`${k.refs.length} linked records`:"linked record":f?f(a):K?ce(a,K):me(E,a,n.locale)??(Array.isArray(a)||typeof a=="boolean"?N:typeof a=="string"&&U!==void 0?U:typeof a=="string"&&Z.test(a)?x(a,n.locale):typeof a=="string"&&O.test(a)?X(a,n.locale,n.timeZone):typeof a=="string"&&Fe(e,c)?I(e,c,a):N),P=typeof a=="string"&&Te(e,c,z),A=(n.glance||n.excerpt)&&!f&&(P||w)?ue(z,{markdown:w}):z;if(s.includes(A)||l.some(g=>A.startsWith(g))||n.glance&&(typeof a=="string"||typeof a=="number")&&s.some(g=>ve(g,A)))continue;let D=_(e,c),Ae=typeof a=="number"?`${D} ${A}`:typeof a=="boolean"&&!f?`${D}: ${A.toLowerCase()}`:A;if(d.push({key:c,label:D,value:A,stored:N,alone:Ae,long:P,...w?{markdown:!0}:{},...m[0]?{files:m}:{},...$?{app:$}:{},...k?{linked:k}:{},...G?{href:G}:{},...se(y?.[`${c}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&d.length>=n.limit)break}return Oe(d,e)}function Oe(t,e){let n=new Map;for(let o of t){let i=Me(e,o.key);i&&n.set(o.key,new Set(i.map(s=>I(e,o.key,s).toLowerCase())))}return n.size<2?t:t.map(o=>{let i=n.get(o.key);return i!==void 0&&[...n].some(([l,d])=>l!==o.key&&[...i].some(y=>d.has(y)))?{...o,alone:`${o.label}: ${o.value.toLowerCase()}`}:o})}function Me(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function Fe(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function Ne(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function he(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Ee=500,ze=160;function De(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function Te(t,e,n){return De(t?.fields?.shape?.[e])?.checks?.some(i=>i._zod?.def?.check==="max_length"&&(i._zod.def.maximum??0)>Ee)?!0:typeof n=="string"&&(n.includes(`
2
+ `)||n.length>ze)}function sn(t,e){let n=t?.display?.page,o=n?.groups??[],i=new Map(e.map(r=>[r.key,r])),s=new Set(he(n)),l=r=>r.flatMap(u=>i.has(u)?[i.get(u)]:[]),d=e.filter(r=>!s.has(r.key));return[{fields:[...l(n?.fields??[]),...o.length>0?[]:d]},...o.map(r=>({title:r.title,fields:l(r.fields)})),...o.length>0?[{title:"Details",fields:d}]:[]].filter(r=>r.fields.length>0)}function je(t,e,n){let o=[...e?.creates??[],...e?.subject&&e.subject.kinds!=="*"?e.subject.kinds:[]];for(let i of o){let s=t.tryDefinition(i),l=s?.fields?.shape??{};if(!s||!(n in l))continue;let d=s.display?.format?.[n];return{label:s.display?.labels?.[n]??_(s,n),option:r=>d?d(r):L(r)}}return{label:_(void 0,n),option:i=>L(i)}}function cn(t,e,n){if(n instanceof fe){let o=e.find(s=>s.name===n.mutation);return`Not yet: ${n.issues.map(s=>{let l=s.path.length>0?je(t,o,String(s.path[0])).label:void 0;return l?`${l} \u2014 ${q(s.message)}`:s.message}).join("; ")}.`}return n instanceof Error?n.message:String(n)}var Le=t=>/^[A-Z]{3}$/.test(t??"");function ke(t){let{format:e,unit:n,currency:o,locale:i}=t,s=Le(n),l=e==="money"||!e&&s,d=l?s?n:o:void 0;return{...l?{format:"money"}:e?{format:e}:{},...n&&!(l&&s)?{unit:n}:{},...d?{currency:d}:{},...i?{locale:i}:{}}}function yn(t){switch(t.format){case"money":return t.currency?`An amount of money in ${t.currency}: a plain number, 1250.5 for 1,250.50 ${t.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return t.unit?`A number of ${t.unit}.`:"A number."}}function be(t){let e=T(t)?.innerType;return e===void 0?t:be(e)}var We={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ce=t=>(t?._zod?.def?.checks??[]).map(e=>e._zod?.def).filter(e=>e!==void 0);function we(t){let e=be(t),n=T(e),o=n?.type,i=Ce(e);if(o==="enum")return{type:"choice",options:Object.keys(n?.entries??{})};let s=te(e);if(s)return s==="image"?{type:"file",image:!0}:s==="video"?{type:"file",video:!0}:{type:"file"};if(o==="boolean")return{type:"boolean"};if(o==="array"){let l=we(n?.element);return l.type==="unknown"?{type:"unknown"}:{type:"several",of:l}}if(o==="number"){let l,d,y;for(let r of i){r.check==="multiple_of"&&typeof r.value=="number"?y=r.value:r.check==="number_format"&&(r.format==="safeint"||r.format==="int32"||r.format==="uint32")&&(y??=1);let u=r.check==="number_format"&&r.format?We[r.format]:void 0,h=u?u[0]:r.check==="greater_than"&&r.inclusive&&typeof r.value=="number"?r.value:void 0,b=u?u[1]:r.check==="less_than"&&r.inclusive&&typeof r.value=="number"?r.value:void 0;h!==void 0&&(l=l===void 0?h:Math.max(l,h)),b!==void 0&&(d=d===void 0?b:Math.min(d,b))}return{type:"number",...l===void 0?{}:{min:l},...d===void 0?{}:{max:d},...y===void 0?{}:{step:y},...C(e)==="duration"?{duration:!0}:{},...v(t)?{amount:ke(v(t))}:{}}}if(o==="string"){if(i.some(u=>u.fn===B||u.format==="datetime")||n?.format==="datetime")return{type:"date",time:!0,instant:!0};let d=[n?.pattern,...i.map(u=>u.pattern)].filter(u=>u instanceof RegExp).map(u=>u.source);if(d.some(u=>u.includes("\\d{4}")))return d.some(u=>u.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:{type:"date"};let y=i.some(u=>u.check==="max_length"&&typeof u.maximum=="number"&&u.maximum>500),r=C(e);return y?{type:"text",long:!0}:r==="phone"||r==="place"?{type:"text",holds:r}:{type:"text"}}return{type:"unknown"}}function An(t,e){let n=t?.shape;return!n||!(e in n)?{type:"unknown"}:we(n[e])}export{xe as a,on as b,rn as c,Se as d,sn as e,ke as f,yn as g,be as h,we as i,An as j,je as k,cn as l};
@@ -1 +1 @@
1
- import{b as y}from"./chunk.7N2GXZYI.js";import"./chunk.O4WEJ47H.js";import{G as w,R as c}from"./chunk.Y4ZUJUUT.js";import"./chunk.SDO3U72B.js";import"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import{b as l}from"./chunk.AJZBJBMO.js";var r=l(w(),1);var t=l(c(),1);function x({field:d,label:p,value:m,markdown:b,onSave:n,onCancel:u}){let[a,v]=(0,r.useState)(m),[i,h]=(0,r.useState)(!1),o=(0,r.useRef)(null);return(0,r.useEffect)(()=>o.current?.focus(),[i]),(0,r.useLayoutEffect)(()=>{let e=o.current;if(!e||i||typeof CSS<"u"&&CSS.supports?.("field-sizing","content"))return;let f=()=>{e.style.height="auto";let g=getComputedStyle(e);e.style.height=`${e.scrollHeight+parseFloat(g.borderTopWidth)+parseFloat(g.borderBottomWidth)}px`};f();let S=requestAnimationFrame(f);return()=>cancelAnimationFrame(S)},[a,i]),(0,t.jsxs)("form",{style:{display:"grid",gap:8,minWidth:0},onSubmit:e=>{e.preventDefault(),n(a,!1)},children:[i?(0,t.jsx)("div",{"data-graview-preview":d,"aria-label":`${p}, as it will read`,role:"region",style:C,children:(0,t.jsx)(y,{text:a,markdown:!0})}):(0,t.jsx)("textarea",{ref:o,"aria-label":p,"data-graview-field":d,value:a,rows:3,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),u()):e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),n(a,!1))},onBlur:e=>{e.relatedTarget instanceof Node&&e.currentTarget.form?.contains(e.relatedTarget)||n(a,!0)},style:E}),(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,t.jsx)("button",{type:"submit",style:s,children:"Save"}),(0,t.jsx)("button",{type:"button",onClick:u,style:s,children:"Cancel"}),b?(0,t.jsx)("button",{type:"button","aria-pressed":i,onClick:()=>h(!i),style:s,children:i?"Write":"Preview"}):null,(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Ctrl or \u2318 Enter saves \xB7 Esc puts it back"})]})]})}var C={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},s={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},E={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)",borderRadius:6};export{x as default};
1
+ import{b as y}from"./chunk.DHAK6PPX.js";import"./chunk.2UIUMG23.js";import{G as w,R as c}from"./chunk.KA44WNB4.js";import"./chunk.SDO3U72B.js";import"./chunk.4TJOS4C7.js";import"./chunk.2AZTW66C.js";import{b as l}from"./chunk.AJZBJBMO.js";var r=l(w(),1);var t=l(c(),1);function x({field:d,label:p,value:m,markdown:b,onSave:n,onCancel:u}){let[a,v]=(0,r.useState)(m),[i,h]=(0,r.useState)(!1),o=(0,r.useRef)(null);return(0,r.useEffect)(()=>o.current?.focus(),[i]),(0,r.useLayoutEffect)(()=>{let e=o.current;if(!e||i||typeof CSS<"u"&&CSS.supports?.("field-sizing","content"))return;let f=()=>{e.style.height="auto";let g=getComputedStyle(e);e.style.height=`${e.scrollHeight+parseFloat(g.borderTopWidth)+parseFloat(g.borderBottomWidth)}px`};f();let S=requestAnimationFrame(f);return()=>cancelAnimationFrame(S)},[a,i]),(0,t.jsxs)("form",{style:{display:"grid",gap:8,minWidth:0},onSubmit:e=>{e.preventDefault(),n(a,!1)},children:[i?(0,t.jsx)("div",{"data-graview-preview":d,"aria-label":`${p}, as it will read`,role:"region",style:C,children:(0,t.jsx)(y,{text:a,markdown:!0})}):(0,t.jsx)("textarea",{ref:o,"aria-label":p,"data-graview-field":d,value:a,rows:3,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),u()):e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),n(a,!1))},onBlur:e=>{e.relatedTarget instanceof Node&&e.currentTarget.form?.contains(e.relatedTarget)||n(a,!0)},style:E}),(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,t.jsx)("button",{type:"submit",style:s,children:"Save"}),(0,t.jsx)("button",{type:"button",onClick:u,style:s,children:"Cancel"}),b?(0,t.jsx)("button",{type:"button","aria-pressed":i,onClick:()=>h(!i),style:s,children:i?"Write":"Preview"}):null,(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Ctrl or \u2318 Enter saves \xB7 Esc puts it back"})]})]})}var C={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},s={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},E={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)",borderRadius:6};export{x as default};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk.76W2FXEC.js";import"./chunk.LPD74WBI.js";import"./chunk.2UIUMG23.js";import"./chunk.KA44WNB4.js";import"./chunk.SDO3U72B.js";import"./chunk.4TJOS4C7.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
@@ -1 +1 @@
1
- import{c as k,d as x,e as H}from"./chunk.64WM4IBI.js";import{b as A}from"./chunk.IQ2HKGJS.js";import"./chunk.R6V37SR7.js";import{d as E}from"./chunk.IROYMLER.js";import"./chunk.7NNI7YH4.js";import{a as b}from"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.HDRD33II.js";import"./chunk.DX357TZ3.js";import"./chunk.H7KCWCB4.js";import{m as S}from"./chunk.O4WEJ47H.js";import{G as L,Oa as v,R as h,Sa as w,_ as p,aa as f}from"./chunk.Y4ZUJUUT.js";import"./chunk.SDO3U72B.js";import{Wa as m}from"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import{b as g}from"./chunk.AJZBJBMO.js";var l=g(L(),1);var e=g(h(),1);function I(){let{store:t,principal:r}=p(),a=f(),i=(0,l.useMemo)(()=>k(t,r),[t,r,a]),n=w("suggested");return i.length===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"suggested-button",...n.trigger,onClick:n.toggle,title:"What tidying suggests, waiting for you",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:[i.length,(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("path",{d:"M3 4.5 H13 M3 8 H10 M3 11.5 H8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12.25",cy:"11.5",r:"1.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Suggested"})]}),n.open?(0,e.jsxs)("section",{...n.pane,"aria-label":"Suggested","data-testid":"suggested","data-graview-offstage":"",style:{...v,width:320,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...S,margin:0},children:"Suggested"}),(0,e.jsx)("p",{style:{margin:0,fontSize:"0.75rem",lineHeight:1.45,color:"var(--graview-ink-faint)"},children:"Not made yet: each waits for you."}),(0,e.jsx)("ol",{"data-testid":"suggestions",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10,fontSize:"0.8125rem"},children:i.map(s=>(0,e.jsx)(O,{suggestion:s,...i.length===1?{settled:()=>{n.setOpen(!1),document.querySelector('[data-testid="activity-button"]')?.focus()}}:{}},s.id))})]}):null]})}function O({suggestion:t,settled:r}){let{store:a,principal:i,seats:n,people:s}=p(),[c,u]=(0,l.useState)(null),T=m(t.author,{graph:a.graph,schema:a.schema,seats:n,people:s}),y=o=>{u(null);try{o==="accept"?x(a,t.id,{author:i}):H(a,t.id,{author:i}),r?.()}catch(d){u(d instanceof Error?d.message:String(d))}};return(0,e.jsxs)("li",{"data-testid":"suggestion","data-suggestion":t.id,style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{style:{fontWeight:600},children:T})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," ",t.intent]}),t.lineage?(0,e.jsx)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:b(t.lineage)}):null,t.about.length>0?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:t.about.slice(0,4).map(o=>(0,e.jsx)(E,{label:A(a,o),pickId:o},o))}):null,(0,e.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,e.jsx)("button",{type:"button","data-testid":"suggestion-accept",onClick:()=>y("accept"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Accept"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-decline",onClick:()=>y("decline"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Decline"})]}),c?(0,e.jsx)("span",{"data-testid":"suggestion-refused",role:"alert",style:{fontSize:"0.75rem",color:"var(--graview-warn)"},children:c}):null]})}export{I as SuggestedTray};
1
+ import{c as k,d as x,e as H}from"./chunk.7FRPNQU4.js";import{b as A}from"./chunk.BDHKWVNX.js";import"./chunk.ZH4NWRWB.js";import{d as E}from"./chunk.GUMJEVVP.js";import"./chunk.SAHNXAV3.js";import{a as b}from"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.N4M54YK6.js";import"./chunk.KVJFY7N5.js";import"./chunk.DPHTUTOS.js";import{m as S}from"./chunk.2UIUMG23.js";import{G as L,Oa as v,R as h,Sa as w,_ as p,aa as f}from"./chunk.KA44WNB4.js";import"./chunk.SDO3U72B.js";import{Xa as m}from"./chunk.4TJOS4C7.js";import"./chunk.2AZTW66C.js";import{b as g}from"./chunk.AJZBJBMO.js";var l=g(L(),1);var e=g(h(),1);function I(){let{store:t,principal:r}=p(),a=f(),i=(0,l.useMemo)(()=>k(t,r),[t,r,a]),n=w("suggested");return i.length===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"suggested-button",...n.trigger,onClick:n.toggle,title:"What tidying suggests, waiting for you",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:[i.length,(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("path",{d:"M3 4.5 H13 M3 8 H10 M3 11.5 H8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12.25",cy:"11.5",r:"1.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Suggested"})]}),n.open?(0,e.jsxs)("section",{...n.pane,"aria-label":"Suggested","data-testid":"suggested","data-graview-offstage":"",style:{...v,width:320,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...S,margin:0},children:"Suggested"}),(0,e.jsx)("p",{style:{margin:0,fontSize:"0.75rem",lineHeight:1.45,color:"var(--graview-ink-faint)"},children:"Not made yet: each waits for you."}),(0,e.jsx)("ol",{"data-testid":"suggestions",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10,fontSize:"0.8125rem"},children:i.map(s=>(0,e.jsx)(O,{suggestion:s,...i.length===1?{settled:()=>{n.setOpen(!1),document.querySelector('[data-testid="activity-button"]')?.focus()}}:{}},s.id))})]}):null]})}function O({suggestion:t,settled:r}){let{store:a,principal:i,seats:n,people:s}=p(),[c,u]=(0,l.useState)(null),T=m(t.author,{graph:a.graph,schema:a.schema,seats:n,people:s}),y=o=>{u(null);try{o==="accept"?x(a,t.id,{author:i}):H(a,t.id,{author:i}),r?.()}catch(d){u(d instanceof Error?d.message:String(d))}};return(0,e.jsxs)("li",{"data-testid":"suggestion","data-suggestion":t.id,style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{style:{fontWeight:600},children:T})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," ",t.intent]}),t.lineage?(0,e.jsx)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:b(t.lineage)}):null,t.about.length>0?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:t.about.slice(0,4).map(o=>(0,e.jsx)(E,{label:A(a,o),pickId:o},o))}):null,(0,e.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,e.jsx)("button",{type:"button","data-testid":"suggestion-accept",onClick:()=>y("accept"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Accept"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-decline",onClick:()=>y("decline"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Decline"})]}),c?(0,e.jsx)("span",{"data-testid":"suggestion-refused",role:"alert",style:{fontSize:"0.75rem",color:"var(--graview-warn)"},children:c}):null]})}export{I as SuggestedTray};
@@ -1 +1 @@
1
- import{G as g,P as y,_ as m,ga as d}from"./chunk.Y4ZUJUUT.js";import{b as S}from"./chunk.AJZBJBMO.js";var v=S(g(),1);function k(){let{store:w,principal:a,ai:n,aiDesk:r,seatTalk:i,views:p,app:t,brand:l,view:A,selection:s}=m(),e=y(w,a),c=d(),o=A.within?.view;return(0,v.useMemo)(()=>({store:e,principal:a,ai:n,desk:r,seatTalk:i,goTo:c,places:[...p.places()],app:t??{name:l?.name??"app",schema:e.schema,...e.policy?{policy:e.policy}:{}},...o?{place:o}:{},selection:s}),[e,a,n,r,i,c,p,t,l,o,s])}export{k as a};
1
+ import{G as g,P as y,_ as m,ga as d}from"./chunk.KA44WNB4.js";import{b as S}from"./chunk.AJZBJBMO.js";var v=S(g(),1);function k(){let{store:w,principal:a,ai:n,aiDesk:r,seatTalk:i,views:p,app:t,brand:l,view:A,selection:s}=m(),e=y(w,a),c=d(),o=A.within?.view;return(0,v.useMemo)(()=>({store:e,principal:a,ai:n,desk:r,seatTalk:i,goTo:c,places:[...p.places()],app:t??{name:l?.name??"app",schema:e.schema,...e.policy?{policy:e.policy}:{}},...o?{place:o}:{},selection:s}),[e,a,n,r,i,c,p,t,l,o,s])}export{k as a};
@@ -1 +1 @@
1
- import{b as P,c as m,d as k}from"./chunk.7ELB37JU.js";import"./chunk.F2VMMCVK.js";import"./chunk.NFIGGSMJ.js";import{b as v,c as w,d as S,e as x,f as M}from"./chunk.G446PWV6.js";import"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";var O=new Set(["input","select","textarea"]),g=r=>r.namespaceURI==="http://www.w3.org/1999/xhtml"&&O.has(r.localName),N=r=>r.localName==="select"||r.type==="checkbox"||r.type==="radio",E=r=>r.type==="checkbox"||r.type==="radio"?!r.checked:r.localName!=="select"&&r.value==="";function h(r){return r.type==="checkbox"||r.type==="radio"?`checked:${r.checked}`:r.localName==="select"&&r.multiple?`selected:${[...r.selectedOptions].map(n=>n.value).join("\0")}`:`value:${r.value}`}function F(r=n=>n.isTrusted){let n=new WeakMap,d=new WeakSet,o=new WeakMap,i={heard(e,t){if(!(!g(t)||!r(e))&&(e.type==="input"||e.type==="change"&&N(t))&&((N(t)||E(t))&&d.delete(t),E(t)&&o.delete(t),n.set(t,h(t)),t.type==="radio"&&t.name)){let c=t.getRootNode();for(let u of c.querySelectorAll?.('input[type="radio"]')??[])u.name===t.name&&n.set(u,h(u))}},filled(e){n.delete(e),o.delete(e),g(e)&&!E(e)?d.add(e):d.delete(e)},press(e,t,c){if(!r(e))return;let u=t.closest("[data-act]");if(!u||!w(u))return;let l=e.type==="keydown"?e.key:void 0;if(!(e.type!=="click"&&!((l==="Enter"||l===" ")&&t===u&&!v(u))))return i.collect(u,c)},collect(e,t){if(!e.hasAttribute("data-act")||!t.contains(e))return;let c=e.closest("[data-record]"),u=e.closest("fieldset, [role='group']")??t,l=[];for(let a of u.querySelectorAll("input[name], select[name], textarea[name]")){let s=a,f=!d.has(s)&&n.get(s)===h(s);if(s.type==="radio"){if(!s.checked)continue;l.push({name:s.name,value:s.value,typed:f,empty:!1,chosen:!0});continue}if(s.localName==="select"){l.push({name:s.name,value:s.value,typed:f,empty:s.value===""&&!f,chosen:!0});continue}if(s.type==="checkbox"){l.push({name:s.name,value:s.checked,typed:f,empty:!s.checked&&!d.has(s)&&!f});continue}let R=(s.type==="number"||s.type==="range")&&s.value!==""&&Number.isFinite(s.valueAsNumber)?s.valueAsNumber:s.value,A=f?o.get(s):void 0;l.push({name:s.name,value:R,typed:f,empty:s.value===""&&!f,...A?{from:A}:{}})}return{as:e.getAttribute("data-act")??"",...c&&t.contains(c)?{record:c.getAttribute("data-record")}:{},fields:l}},prefilled(e,t){d.delete(e),o.set(e,t),n.set(e,h(e))}};return i}var b=new WeakMap,L=(r,n)=>{n.tab&&r.removeAttribute("tabindex"),n.role&&r.getAttribute("role")==="button"&&r.removeAttribute("role"),r.removeAttribute("data-graview-press"),b.delete(r)};function W(r){for(let n of r.querySelectorAll("[data-act], [data-graview-press], [role], [aria-pressed], [aria-expanded]")){let d=b.get(n),o=w(n)&&!v(n)&&!g(n),i=!o&&S(n,d?.role?null:n.getAttribute("role"));if(d&&(d.bound!==o||!(o||i))&&L(n,d),(o||i)&&!b.has(n)){let e=!x(n),t=o&&M(n);e&&n.setAttribute("tabindex","0"),t&&n.setAttribute("role","button"),n.setAttribute("data-graview-press",""),b.set(n,{tab:e,role:t,bound:o})}}}var y=new WeakSet;function V(r){for(let n of r.querySelectorAll("svg")){let d=n.hasAttribute("role")||n.hasAttribute("aria-label")||n.hasAttribute("aria-labelledby")||[...n.children].some(e=>e.localName==="title"),o=n.hasAttribute("tabindex")||n.hasAttribute("data-graview-link")||n.hasAttribute("data-graview-press")||n.querySelector("[tabindex], [data-graview-link], [data-graview-press], a")!==null,i=!d&&!o;i&&!y.has(n)&&!n.hasAttribute("aria-hidden")?(n.setAttribute("aria-hidden","true"),y.add(n)):!i&&y.has(n)&&(n.removeAttribute("aria-hidden"),y.delete(n))}}var j=1e3;function I(r){let n=r.getAttribute("data-debounce")?.trim(),d=n?Number(n):Number.NaN;return Number.isFinite(d)?Math.min(1e4,Math.max(250,Math.round(d))):j}function B(r){let n=r.trusted??(e=>e.isTrusted),d=r.timers??{set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e)},o=new Map,i=(e,t)=>{let c=o.get(e);c&&d.clear(c.handle),o.delete(e);let u=r.reader.collect(e,t);u&&r.save(u,e)};return{heard(e,t,c){if(!g(t)||!n(e)||!t.hasAttribute("data-act"))return;let u=t.getAttribute("data-save");if(e.type==="input"&&u==="input"){let l=o.get(t);l&&d.clear(l.handle),o.set(t,{root:c,handle:d.set(()=>i(t,c),I(t))})}else e.type==="change"&&(u==="change"||u==="input"&&o.has(t))&&i(t,c)},flush(){for(let[e,{root:t}]of[...o])i(e,t)},get waiting(){return o.size}}}var H=new Set(["text","search","email","url","tel","number"]);function D(r,n,d,o){for(let i of r.querySelectorAll("input[data-prefill], textarea[data-prefill]")){let e=i;if(d.has(e))continue;let t=e.getAttribute("data-prefill")??"";if(t===""||e.getAttribute("name")!==t||e.localName==="input"&&!H.has(e.type))continue;if(e.value!==""){d.add(e);continue}let u=[...(e.closest("fieldset, [role='group']")??r).querySelectorAll("[data-act]")],l=e.closest("[data-record]"),a=new Set(u.map(p=>p.closest("[data-record]")?.getAttribute("data-record")).filter(p=>typeof p=="string")),s=l&&r.contains(l)?l.getAttribute("data-record"):a.size===1?[...a][0]:void 0;if(!s)continue;let f=o({record:s,field:t,acts:u.map(p=>p.getAttribute("data-act")??"")});if(f!==void 0){if(e.value=f,d.add(e),e.value!==f){e.value="";continue}n.prefilled(e,{record:s,field:t,value:f})}}}function _(r,n,d,o){let i=k(n,o.as);if(!i)return m("undeclared",`This view may not ask for \u201C${o.as}\u201D: its manifest does not name it.`);let e=r.allMutations().find(a=>a.name===i.act);if(!e)return m("unknown-act","There is no act by that name here.");let t={};if(o.record!==void 0){let a=i.record??e.subject?.arg;if(!a)return m("unbound",`\u201C${o.as}\u201D is not done to a record.`);if(!d.has(o.record))return m("unbound","That press is bound to a record this view was not shown.");t[a]=o.record}for(let[a,s]of Object.entries(i.constants??{})){if(a in t)return m("malformed",`\u201C${a}\u201D is both the bound record and a constant.`);t[a]=s}let c=e.input?.shape??{},u=new Set(Object.keys(c)),l=new Set;for(let a of o.fields)if(!(!u.has(a.name)||a.name in t)){if(l.has(a.name))return m("malformed",`Two fields here are called \u201C${a.name}\u201D.`);if(l.add(a.name),a.typed&&a.chosen){let s=P(c[a.name])?.find(f=>String(f)===String(a.value));if(s!==void 0)t[a.name]=s;else if(typeof a.value=="string"&&d.has(a.value))t[a.name]=a.value;else return m("untyped",`\u201C${a.name}\u201D was a choice among the view's own words, not one this app declares, so it was not sent.`)}else{if(a.typed&&a.from&&!(o.record===a.from.record&&a.name===a.from.field&&T(r,i,a.from.record,a.from.field)))return m("untyped",`\u201C${a.name}\u201D was filled in from a record for an act that writes it back there, not for this one, so it was not sent.`);if(a.typed&&a.from&&String(a.value)===a.from.value)t[a.name]=r.graph.getNode(a.from.record)?.[a.name]??a.value;else if(a.typed)t[a.name]=a.value;else if(!a.empty)return m("untyped",`\u201C${a.name}\u201D was filled in by the view, not typed by you, so it was not sent.`)}}return{ok:!0,name:i.act,args:t}}function T(r,n,d,o){let i=r.allMutations().find(u=>u.name===n.act),e=i?.subject;if(!i||!e||(n.record??e.arg)!==e.arg||o===e.arg||Object.hasOwn(n.constants??{},o)||!Object.hasOwn(i.input.shape??{},o)||Object.keys(i.writesOther??{}).length>0)return!1;let t=r.graph.getNode(d)?.kind,c=t===void 0?void 0:r.schema.tryDefinition(t);return!c||e.kinds!=="*"&&!e.kinds.includes(t)||!Object.hasOwn(c.fields.shape??{},o)?!1:i.writes?.includes(o)??!1}function C(r,n,d,o,i){if(!o.has(i.record))return;let e=r.seenBy(n).graph.getNode(i.record);if(!e||!i.acts.some(u=>{let l=k(d,u);if(!l||!T(r,l,i.record,i.field))return!1;let a=r.allMutations().find(s=>s.name===l.act).subject;return r.permits({name:l.act,args:{[a.arg]:i.record}},n).ok}))return;let c=e[i.field];return typeof c=="string"?c:typeof c=="number"&&Number.isFinite(c)?String(c):void 0}export{j as SAVE_DEBOUNCE_MS,F as createPressReader,B as createSaver,D as fillPrefills,_ as judgePress,W as markPresses,C as prefillOf,V as quietPictures,I as saveDebounceOf,T as writesBack};
1
+ import{b as P,c as m,d as k}from"./chunk.I5TOMBIF.js";import"./chunk.QQTRAY5W.js";import"./chunk.DOBQ4LO4.js";import{b as v,c as w,d as S,e as x,f as M}from"./chunk.G446PWV6.js";import"./chunk.4TJOS4C7.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";var O=new Set(["input","select","textarea"]),g=r=>r.namespaceURI==="http://www.w3.org/1999/xhtml"&&O.has(r.localName),N=r=>r.localName==="select"||r.type==="checkbox"||r.type==="radio",E=r=>r.type==="checkbox"||r.type==="radio"?!r.checked:r.localName!=="select"&&r.value==="";function h(r){return r.type==="checkbox"||r.type==="radio"?`checked:${r.checked}`:r.localName==="select"&&r.multiple?`selected:${[...r.selectedOptions].map(n=>n.value).join("\0")}`:`value:${r.value}`}function F(r=n=>n.isTrusted){let n=new WeakMap,d=new WeakSet,o=new WeakMap,i={heard(e,t){if(!(!g(t)||!r(e))&&(e.type==="input"||e.type==="change"&&N(t))&&((N(t)||E(t))&&d.delete(t),E(t)&&o.delete(t),n.set(t,h(t)),t.type==="radio"&&t.name)){let c=t.getRootNode();for(let u of c.querySelectorAll?.('input[type="radio"]')??[])u.name===t.name&&n.set(u,h(u))}},filled(e){n.delete(e),o.delete(e),g(e)&&!E(e)?d.add(e):d.delete(e)},press(e,t,c){if(!r(e))return;let u=t.closest("[data-act]");if(!u||!w(u))return;let l=e.type==="keydown"?e.key:void 0;if(!(e.type!=="click"&&!((l==="Enter"||l===" ")&&t===u&&!v(u))))return i.collect(u,c)},collect(e,t){if(!e.hasAttribute("data-act")||!t.contains(e))return;let c=e.closest("[data-record]"),u=e.closest("fieldset, [role='group']")??t,l=[];for(let a of u.querySelectorAll("input[name], select[name], textarea[name]")){let s=a,f=!d.has(s)&&n.get(s)===h(s);if(s.type==="radio"){if(!s.checked)continue;l.push({name:s.name,value:s.value,typed:f,empty:!1,chosen:!0});continue}if(s.localName==="select"){l.push({name:s.name,value:s.value,typed:f,empty:s.value===""&&!f,chosen:!0});continue}if(s.type==="checkbox"){l.push({name:s.name,value:s.checked,typed:f,empty:!s.checked&&!d.has(s)&&!f});continue}let R=(s.type==="number"||s.type==="range")&&s.value!==""&&Number.isFinite(s.valueAsNumber)?s.valueAsNumber:s.value,A=f?o.get(s):void 0;l.push({name:s.name,value:R,typed:f,empty:s.value===""&&!f,...A?{from:A}:{}})}return{as:e.getAttribute("data-act")??"",...c&&t.contains(c)?{record:c.getAttribute("data-record")}:{},fields:l}},prefilled(e,t){d.delete(e),o.set(e,t),n.set(e,h(e))}};return i}var b=new WeakMap,L=(r,n)=>{n.tab&&r.removeAttribute("tabindex"),n.role&&r.getAttribute("role")==="button"&&r.removeAttribute("role"),r.removeAttribute("data-graview-press"),b.delete(r)};function W(r){for(let n of r.querySelectorAll("[data-act], [data-graview-press], [role], [aria-pressed], [aria-expanded]")){let d=b.get(n),o=w(n)&&!v(n)&&!g(n),i=!o&&S(n,d?.role?null:n.getAttribute("role"));if(d&&(d.bound!==o||!(o||i))&&L(n,d),(o||i)&&!b.has(n)){let e=!x(n),t=o&&M(n);e&&n.setAttribute("tabindex","0"),t&&n.setAttribute("role","button"),n.setAttribute("data-graview-press",""),b.set(n,{tab:e,role:t,bound:o})}}}var y=new WeakSet;function V(r){for(let n of r.querySelectorAll("svg")){let d=n.hasAttribute("role")||n.hasAttribute("aria-label")||n.hasAttribute("aria-labelledby")||[...n.children].some(e=>e.localName==="title"),o=n.hasAttribute("tabindex")||n.hasAttribute("data-graview-link")||n.hasAttribute("data-graview-press")||n.querySelector("[tabindex], [data-graview-link], [data-graview-press], a")!==null,i=!d&&!o;i&&!y.has(n)&&!n.hasAttribute("aria-hidden")?(n.setAttribute("aria-hidden","true"),y.add(n)):!i&&y.has(n)&&(n.removeAttribute("aria-hidden"),y.delete(n))}}var j=1e3;function I(r){let n=r.getAttribute("data-debounce")?.trim(),d=n?Number(n):Number.NaN;return Number.isFinite(d)?Math.min(1e4,Math.max(250,Math.round(d))):j}function B(r){let n=r.trusted??(e=>e.isTrusted),d=r.timers??{set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e)},o=new Map,i=(e,t)=>{let c=o.get(e);c&&d.clear(c.handle),o.delete(e);let u=r.reader.collect(e,t);u&&r.save(u,e)};return{heard(e,t,c){if(!g(t)||!n(e)||!t.hasAttribute("data-act"))return;let u=t.getAttribute("data-save");if(e.type==="input"&&u==="input"){let l=o.get(t);l&&d.clear(l.handle),o.set(t,{root:c,handle:d.set(()=>i(t,c),I(t))})}else e.type==="change"&&(u==="change"||u==="input"&&o.has(t))&&i(t,c)},flush(){for(let[e,{root:t}]of[...o])i(e,t)},get waiting(){return o.size}}}var H=new Set(["text","search","email","url","tel","number"]);function D(r,n,d,o){for(let i of r.querySelectorAll("input[data-prefill], textarea[data-prefill]")){let e=i;if(d.has(e))continue;let t=e.getAttribute("data-prefill")??"";if(t===""||e.getAttribute("name")!==t||e.localName==="input"&&!H.has(e.type))continue;if(e.value!==""){d.add(e);continue}let u=[...(e.closest("fieldset, [role='group']")??r).querySelectorAll("[data-act]")],l=e.closest("[data-record]"),a=new Set(u.map(p=>p.closest("[data-record]")?.getAttribute("data-record")).filter(p=>typeof p=="string")),s=l&&r.contains(l)?l.getAttribute("data-record"):a.size===1?[...a][0]:void 0;if(!s)continue;let f=o({record:s,field:t,acts:u.map(p=>p.getAttribute("data-act")??"")});if(f!==void 0){if(e.value=f,d.add(e),e.value!==f){e.value="";continue}n.prefilled(e,{record:s,field:t,value:f})}}}function _(r,n,d,o){let i=k(n,o.as);if(!i)return m("undeclared",`This view may not ask for \u201C${o.as}\u201D: its manifest does not name it.`);let e=r.allMutations().find(a=>a.name===i.act);if(!e)return m("unknown-act","There is no act by that name here.");let t={};if(o.record!==void 0){let a=i.record??e.subject?.arg;if(!a)return m("unbound",`\u201C${o.as}\u201D is not done to a record.`);if(!d.has(o.record))return m("unbound","That press is bound to a record this view was not shown.");t[a]=o.record}for(let[a,s]of Object.entries(i.constants??{})){if(a in t)return m("malformed",`\u201C${a}\u201D is both the bound record and a constant.`);t[a]=s}let c=e.input?.shape??{},u=new Set(Object.keys(c)),l=new Set;for(let a of o.fields)if(!(!u.has(a.name)||a.name in t)){if(l.has(a.name))return m("malformed",`Two fields here are called \u201C${a.name}\u201D.`);if(l.add(a.name),a.typed&&a.chosen){let s=P(c[a.name])?.find(f=>String(f)===String(a.value));if(s!==void 0)t[a.name]=s;else if(typeof a.value=="string"&&d.has(a.value))t[a.name]=a.value;else return m("untyped",`\u201C${a.name}\u201D was a choice among the view's own words, not one this app declares, so it was not sent.`)}else{if(a.typed&&a.from&&!(o.record===a.from.record&&a.name===a.from.field&&T(r,i,a.from.record,a.from.field)))return m("untyped",`\u201C${a.name}\u201D was filled in from a record for an act that writes it back there, not for this one, so it was not sent.`);if(a.typed&&a.from&&String(a.value)===a.from.value)t[a.name]=r.graph.getNode(a.from.record)?.[a.name]??a.value;else if(a.typed)t[a.name]=a.value;else if(!a.empty)return m("untyped",`\u201C${a.name}\u201D was filled in by the view, not typed by you, so it was not sent.`)}}return{ok:!0,name:i.act,args:t}}function T(r,n,d,o){let i=r.allMutations().find(u=>u.name===n.act),e=i?.subject;if(!i||!e||(n.record??e.arg)!==e.arg||o===e.arg||Object.hasOwn(n.constants??{},o)||!Object.hasOwn(i.input.shape??{},o)||Object.keys(i.writesOther??{}).length>0)return!1;let t=r.graph.getNode(d)?.kind,c=t===void 0?void 0:r.schema.tryDefinition(t);return!c||e.kinds!=="*"&&!e.kinds.includes(t)||!Object.hasOwn(c.fields.shape??{},o)?!1:i.writes?.includes(o)??!1}function C(r,n,d,o,i){if(!o.has(i.record))return;let e=r.seenBy(n).graph.getNode(i.record);if(!e||!i.acts.some(u=>{let l=k(d,u);if(!l||!T(r,l,i.record,i.field))return!1;let a=r.allMutations().find(s=>s.name===l.act).subject;return r.permits({name:l.act,args:{[a.arg]:i.record}},n).ok}))return;let c=e[i.field];return typeof c=="string"?c:typeof c=="number"&&Number.isFinite(c)?String(c):void 0}export{j as SAVE_DEBOUNCE_MS,F as createPressReader,B as createSaver,D as fillPrefills,_ as judgePress,W as markPresses,C as prefillOf,V as quietPictures,I as saveDebounceOf,T as writesBack};
@@ -1 +1 @@
1
- import{Ac as E,Bc as G,Cc as F,Ec as J,Fc as W,kb as k,ob as O,pb as P,rb as h,sb as j}from"./chunk.AS4CQBOQ.js";var I=(o,a)=>{let t=o.kindOf(a);return t===void 0?void 0:o.kept?.({id:a,kind:t})};function w(o,a){return o.flatMap(t=>{if(t.op!=="patch-node")return[t];let i=I(a,t.id);if(!i||!Object.keys(t.after).some(i))return[t];let c=r=>Object.fromEntries(Object.entries(r).filter(([f])=>!i(f))),s=c(t.after);return Object.keys(s).length===0?[]:[{op:"patch-node",id:t.id,before:c(t.before),after:s}]})}function _(o,a,t){if(!F(o,a))return t;let i=J(o,a),c=r=>o.graph.getNode(r)!==void 0||E(o.log).kindOf(r)!==void 0,s={...t};if(t.diff){let r=t.diff,f=G(o.log),l=o.log.length??o.log.all().length,u=t.ops?.[0]?.seq??l,x=k(a).id,y=(e,n)=>d=>f.writerAt(e,d,n),m=(e,n)=>i.shows(e.id)?i.servedWith(e,n):void 0,b=(e,n)=>e.flatMap(d=>m(d,n(d.id))??[]),S=e=>i.shows(e.from)&&i.shows(e.to)&&!h(e,i.sees),v=(e,n)=>t.ops?y(e,l):d=>n===void 0||n.includes(d)?x:f.writerAt(e,d,l),M=r.changedNodes.flatMap(e=>{let n=m(e.before,y(e.before.id,u)),d=m(e.after,v(e.after.id,e.fields));return n&&d?[{before:n,after:d,fields:e.fields.filter(p=>p in n||p in d)}]:[]}),D=new Set(r.changedNodes.map(e=>e.after.id)),g=new Map;for(let e of t.ops?.flatMap(n=>n.primitives)??t.primitives??[])e.op!=="patch-node"||D.has(e.id)||g.set(e.id,[...g.get(e.id)??[],...Object.keys(e.after)]);let B=[...g].flatMap(([e,n])=>{let d=o.graph.getNode(e);if(!d)return[];let p=m(d,y(e,u)),N=m(d,v(e,n));return p&&N&&JSON.stringify(p)!==JSON.stringify(N)?[{before:p,after:N,fields:n}]:[]});s.diff={addedNodes:b(r.addedNodes,e=>v(e)),removedNodes:b(r.removedNodes,e=>y(e,u)),changedNodes:[...M,...B],addedEdges:r.addedEdges.filter(S),removedEdges:r.removedEdges.filter(S),touched:[...r.touched.filter(i.shows),...[...g.keys()].filter(e=>i.shows(e)&&!r.touched.includes(e))]}}if(t.ops&&(s.ops=j(t.ops,i)),t.primitives){let r=s.ops;s.primitives=r?r.flatMap(f=>f.primitives):i.timeline?O(t.primitives,i.timeline,{served:(f,l)=>i.servedWith(f,l),edgeClean:f=>!h(f,i.sees),sees:i.sees},k(a).id):j([{id:"",seq:0,batch:"",author:{kind:"system"},intent:"",mutation:null,primitives:t.primitives,reads:[],writes:[],at:""}],i)[0].primitives}return i.kept&&s.primitives&&(s.primitives=w(s.primitives,i)),t.reads&&(s.reads=t.reads.filter(r=>i.shows(r)&&c(r))),t.writes&&(s.writes=t.writes.filter(i.shows)),t.intent!==void 0&&h(t.intent,i.sees)&&(s.intent=P),t.violationsAfter&&Object.assign(s,A?A(o,W(o,a),!!t.ops,s.primitives??[]):{introduces:[],resolves:[],violationsAfter:[]}),s}var A,z=o=>void(A=o);export{_ as a,z as b};
1
+ import{Bc as E,Cc as G,Dc as F,Fc as J,Gc as W,lb as k,pb as O,qb as P,sb as h,tb as j}from"./chunk.4TJOS4C7.js";var I=(o,a)=>{let t=o.kindOf(a);return t===void 0?void 0:o.kept?.({id:a,kind:t})};function w(o,a){return o.flatMap(t=>{if(t.op!=="patch-node")return[t];let i=I(a,t.id);if(!i||!Object.keys(t.after).some(i))return[t];let c=r=>Object.fromEntries(Object.entries(r).filter(([f])=>!i(f))),s=c(t.after);return Object.keys(s).length===0?[]:[{op:"patch-node",id:t.id,before:c(t.before),after:s}]})}function _(o,a,t){if(!F(o,a))return t;let i=J(o,a),c=r=>o.graph.getNode(r)!==void 0||E(o.log).kindOf(r)!==void 0,s={...t};if(t.diff){let r=t.diff,f=G(o.log),l=o.log.length??o.log.all().length,u=t.ops?.[0]?.seq??l,x=k(a).id,y=(e,n)=>d=>f.writerAt(e,d,n),m=(e,n)=>i.shows(e.id)?i.servedWith(e,n):void 0,b=(e,n)=>e.flatMap(d=>m(d,n(d.id))??[]),S=e=>i.shows(e.from)&&i.shows(e.to)&&!h(e,i.sees),v=(e,n)=>t.ops?y(e,l):d=>n===void 0||n.includes(d)?x:f.writerAt(e,d,l),M=r.changedNodes.flatMap(e=>{let n=m(e.before,y(e.before.id,u)),d=m(e.after,v(e.after.id,e.fields));return n&&d?[{before:n,after:d,fields:e.fields.filter(p=>p in n||p in d)}]:[]}),D=new Set(r.changedNodes.map(e=>e.after.id)),g=new Map;for(let e of t.ops?.flatMap(n=>n.primitives)??t.primitives??[])e.op!=="patch-node"||D.has(e.id)||g.set(e.id,[...g.get(e.id)??[],...Object.keys(e.after)]);let B=[...g].flatMap(([e,n])=>{let d=o.graph.getNode(e);if(!d)return[];let p=m(d,y(e,u)),N=m(d,v(e,n));return p&&N&&JSON.stringify(p)!==JSON.stringify(N)?[{before:p,after:N,fields:n}]:[]});s.diff={addedNodes:b(r.addedNodes,e=>v(e)),removedNodes:b(r.removedNodes,e=>y(e,u)),changedNodes:[...M,...B],addedEdges:r.addedEdges.filter(S),removedEdges:r.removedEdges.filter(S),touched:[...r.touched.filter(i.shows),...[...g.keys()].filter(e=>i.shows(e)&&!r.touched.includes(e))]}}if(t.ops&&(s.ops=j(t.ops,i)),t.primitives){let r=s.ops;s.primitives=r?r.flatMap(f=>f.primitives):i.timeline?O(t.primitives,i.timeline,{served:(f,l)=>i.servedWith(f,l),edgeClean:f=>!h(f,i.sees),sees:i.sees},k(a).id):j([{id:"",seq:0,batch:"",author:{kind:"system"},intent:"",mutation:null,primitives:t.primitives,reads:[],writes:[],at:""}],i)[0].primitives}return i.kept&&s.primitives&&(s.primitives=w(s.primitives,i)),t.reads&&(s.reads=t.reads.filter(r=>i.shows(r)&&c(r))),t.writes&&(s.writes=t.writes.filter(i.shows)),t.intent!==void 0&&h(t.intent,i.sees)&&(s.intent=P),t.violationsAfter&&Object.assign(s,A?A(o,W(o,a),!!t.ops,s.primitives??[]):{introduces:[],resolves:[],violationsAfter:[]}),s}var A,z=o=>void(A=o);export{_ as a,z as b};