graview 0.1.64 → 0.1.66

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 (269) hide show
  1. package/dist/index.js +4 -4
  2. package/dist/index.js.map +1 -1
  3. package/dist/preview/chunk.2KFZHUAC.js +1 -0
  4. package/dist/preview/chunk.2MHNPBHC.js +1 -0
  5. package/dist/preview/{chunk.77JI5T4F.js → chunk.2VR7YEJ6.js} +1 -1
  6. package/dist/preview/chunk.32SHA3EY.js +1 -0
  7. package/dist/preview/chunk.3L4JMM3P.js +1 -0
  8. package/dist/preview/chunk.3PBTN7RO.js +1 -0
  9. package/dist/preview/chunk.45JP6VGJ.js +5 -0
  10. package/dist/preview/{chunk.DUP2CGVH.js → chunk.4AC2QM7T.js} +1 -1
  11. package/dist/preview/chunk.4FCFNAA4.js +1 -0
  12. package/dist/preview/chunk.4FDVINRJ.js +1 -0
  13. package/dist/preview/chunk.4JULYKGD.js +1 -0
  14. package/dist/preview/chunk.4U4D7WOI.js +1 -0
  15. package/dist/preview/chunk.4WGYUYWU.js +2 -0
  16. package/dist/preview/chunk.5B5SRTUK.js +1 -0
  17. package/dist/preview/chunk.5BX66FBP.js +1 -0
  18. package/dist/preview/chunk.5CXIEYHY.js +2 -0
  19. package/dist/preview/chunk.5EMIWORS.js +1 -0
  20. package/dist/preview/{chunk.D2XLECMP.js → chunk.5FNFRVTL.js} +1 -1
  21. package/dist/preview/chunk.5LJVOLKR.js +1 -0
  22. package/dist/preview/{chunk.APUQIELA.js → chunk.6EHHMWPP.js} +1 -1
  23. package/dist/preview/chunk.6EVMXBNB.js +1 -0
  24. package/dist/preview/chunk.6FQW6FNL.js +1 -0
  25. package/dist/preview/chunk.6HY6ZGEE.js +5 -0
  26. package/dist/preview/{chunk.K5YFUMRS.js → chunk.6LXIEM6B.js} +1 -1
  27. package/dist/preview/chunk.6MQ5NT7S.js +1 -0
  28. package/dist/preview/chunk.6P6NGZ6D.js +1 -0
  29. package/dist/preview/{chunk.XIVELWAM.js → chunk.6TLXFMX2.js} +1 -1
  30. package/dist/preview/chunk.72XP2ARZ.js +1 -0
  31. package/dist/preview/{chunk.2V7QTIAV.js → chunk.72ZCLEQC.js} +1 -1
  32. package/dist/preview/{chunk.ITBG37WJ.js → chunk.7BIPZTJB.js} +1 -1
  33. package/dist/preview/chunk.7VADSNPZ.js +1 -0
  34. package/dist/preview/{chunk.2VYGDY5Z.js → chunk.7VP6Y6D2.js} +1 -1
  35. package/dist/preview/{chunk.S7SHWDPR.js → chunk.7ZKBYXUM.js} +1 -1
  36. package/dist/preview/chunk.AK7NGFEX.js +6 -0
  37. package/dist/preview/{chunk.2VIS2NAT.js → chunk.ANS2IEEV.js} +1 -1
  38. package/dist/preview/{chunk.UDYFGYJP.js → chunk.B6JRTW3A.js} +1 -1
  39. package/dist/preview/chunk.BCQWAFGD.js +1 -0
  40. package/dist/preview/{chunk.7SRSE5IS.js → chunk.BFAFCVL4.js} +1 -1
  41. package/dist/preview/chunk.BGAC3B7X.js +1 -0
  42. package/dist/preview/chunk.BMENTGDC.js +21 -0
  43. package/dist/preview/chunk.BOCVLC7X.js +1 -0
  44. package/dist/preview/{chunk.7VAHHEDX.js → chunk.BUVTUAB5.js} +1 -1
  45. package/dist/preview/chunk.BXBEGMPO.js +22 -0
  46. package/dist/preview/{chunk.4XCYZRZ3.js → chunk.BZ7QWHAE.js} +1 -1
  47. package/dist/preview/chunk.C2C3AXGI.js +1141 -0
  48. package/dist/preview/chunk.CBXS23YH.js +23 -0
  49. package/dist/preview/chunk.CEQQIW7Z.js +1 -0
  50. package/dist/preview/chunk.CEVGND3Y.js +6 -0
  51. package/dist/preview/{chunk.WHX47OJM.js → chunk.CTASTRQN.js} +1 -1
  52. package/dist/preview/chunk.CU2WCYMK.js +1 -0
  53. package/dist/preview/{chunk.7CLKGKSF.js → chunk.CVPMSPCH.js} +1 -1
  54. package/dist/preview/chunk.DEHIR4EG.js +1 -0
  55. package/dist/preview/chunk.DPJNGFEZ.js +4 -0
  56. package/dist/preview/chunk.DQFHIJFN.js +1 -0
  57. package/dist/preview/chunk.DSYP43NN.js +1 -0
  58. package/dist/preview/chunk.DTCAUPLC.js +1 -0
  59. package/dist/preview/{chunk.4U45EY5M.js → chunk.DZFM6GSY.js} +1 -1
  60. package/dist/preview/chunk.E3UL4MCD.js +35 -0
  61. package/dist/preview/chunk.E4VRRWFP.js +1 -0
  62. package/dist/preview/chunk.E7EWNWAN.js +1 -0
  63. package/dist/preview/chunk.EG7OOJH5.js +1 -0
  64. package/dist/preview/{chunk.TQ2G4AM4.js → chunk.EMFOMSMI.js} +1 -1
  65. package/dist/preview/{chunk.5B7NG6WH.js → chunk.EQ4OODGO.js} +1 -1
  66. package/dist/preview/{chunk.CJHYGRWV.js → chunk.ES63XSIM.js} +1 -1
  67. package/dist/preview/chunk.EUAO4QNV.js +1 -0
  68. package/dist/preview/{chunk.47N2G7A5.js → chunk.EXYCN4WI.js} +1 -1
  69. package/dist/preview/chunk.F4VB6Q2W.js +1 -0
  70. package/dist/preview/chunk.F7672TKJ.js +1 -0
  71. package/dist/preview/chunk.FA42HCPW.js +1 -0
  72. package/dist/preview/{chunk.DLWFULWE.js → chunk.FBILPNGH.js} +1 -1
  73. package/dist/preview/chunk.FBJAQPZ6.js +1 -0
  74. package/dist/preview/{chunk.2DH42I7L.js → chunk.FDZE5LTJ.js} +2 -2
  75. package/dist/preview/chunk.FFOD5B4B.js +2 -0
  76. package/dist/preview/{chunk.TA2JTUNX.js → chunk.FIFUMX5X.js} +1 -1
  77. package/dist/preview/{chunk.T4TRJDBF.js → chunk.FK722SHI.js} +1 -1
  78. package/dist/preview/chunk.FV72U33M.js +1 -0
  79. package/dist/preview/chunk.FXT5CN32.js +19 -0
  80. package/dist/preview/chunk.GAFMWOME.js +1 -0
  81. package/dist/preview/{chunk.OXFDB5BB.js → chunk.GEFXU4VO.js} +1 -1
  82. package/dist/preview/chunk.GG47EIKO.js +1 -0
  83. package/dist/preview/chunk.GME63ZHI.js +1 -0
  84. package/dist/preview/{chunk.PVDDSBRG.js → chunk.GNEOSHQ6.js} +1 -1
  85. package/dist/preview/chunk.HOCD7KIR.js +1 -0
  86. package/dist/preview/chunk.HSSIMVVM.js +1 -0
  87. package/dist/preview/{chunk.ZA5TDCBC.js → chunk.I2737CPF.js} +1 -1
  88. package/dist/preview/chunk.I4Z7HVRT.js +1 -0
  89. package/dist/preview/chunk.IAEHUSQQ.js +1 -0
  90. package/dist/preview/chunk.IGK7EZCX.js +1 -0
  91. package/dist/preview/chunk.INHS3KTK.js +1 -0
  92. package/dist/preview/{chunk.JHUCKEJS.js → chunk.IWYMKGZZ.js} +1 -1
  93. package/dist/preview/chunk.J2MM6BUW.js +1 -0
  94. package/dist/preview/{chunk.JOM6MFVE.js → chunk.J7W2OFHY.js} +1 -1
  95. package/dist/preview/chunk.JMXXA4YG.js +1 -0
  96. package/dist/preview/chunk.JMYUQNXN.js +6 -0
  97. package/dist/preview/chunk.JO2X52D4.js +1 -0
  98. package/dist/preview/{chunk.YEXFVDRA.js → chunk.JXNVNFV4.js} +1 -1
  99. package/dist/preview/chunk.K6DFXDPZ.js +1 -0
  100. package/dist/preview/{chunk.WPQP54FM.js → chunk.KACSYPEV.js} +1 -1
  101. package/dist/preview/{chunk.R5MLRKAO.js → chunk.KBPJ7X7W.js} +1 -1
  102. package/dist/preview/chunk.KF27ME27.js +1 -0
  103. package/dist/preview/{chunk.WX23K7ZU.js → chunk.KSIEO5W7.js} +1 -1
  104. package/dist/preview/chunk.L25DCT5S.js +1 -0
  105. package/dist/preview/{chunk.UDU545CL.js → chunk.LETAQTLJ.js} +1 -1
  106. package/dist/preview/{chunk.VZAF3452.js → chunk.LGRVEHXT.js} +2 -2
  107. package/dist/preview/chunk.LINSO5PN.js +1 -0
  108. package/dist/preview/{chunk.XJWKIXPV.js → chunk.LLIURXFP.js} +1 -1
  109. package/dist/preview/{chunk.BVIJXL4J.js → chunk.LSN2IPAI.js} +1 -1
  110. package/dist/preview/chunk.M2JCFNHJ.js +1 -0
  111. package/dist/preview/{chunk.B3WVCSW5.js → chunk.M5FP4Y4Q.js} +1 -1
  112. package/dist/preview/{chunk.YSBTE3PX.js → chunk.M6ZN2KUO.js} +1 -1
  113. package/dist/preview/chunk.MODLZJD4.js +25 -0
  114. package/dist/preview/chunk.MWGZKZD6.js +1 -0
  115. package/dist/preview/{chunk.2JEN2RCB.js → chunk.NJRLJEJY.js} +1 -1
  116. package/dist/preview/chunk.NYLKG25K.js +4 -0
  117. package/dist/preview/{chunk.YMXWS4XN.js → chunk.OEIWIZCP.js} +1 -1
  118. package/dist/preview/{chunk.DQAMVVE6.js → chunk.OJY7VJ7D.js} +1 -1
  119. package/dist/preview/chunk.OMT4QUZY.js +23 -0
  120. package/dist/preview/{chunk.Z26T5E76.js → chunk.ONYBW45K.js} +1 -1
  121. package/dist/preview/chunk.OO2OP76C.js +1 -0
  122. package/dist/preview/{chunk.UJNLT3L6.js → chunk.OOSIKCOS.js} +1 -1
  123. package/dist/preview/{chunk.B6JR7EQO.js → chunk.OPTYYIGC.js} +1 -1
  124. package/dist/preview/{chunk.TMHVYI5R.js → chunk.OTV5XTBB.js} +1 -1
  125. package/dist/preview/{chunk.F6BNFLQM.js → chunk.OWFS2YDQ.js} +1 -1
  126. package/dist/preview/{chunk.CXDGE5ZS.js → chunk.OWO3OV62.js} +1 -1
  127. package/dist/preview/{chunk.4VRX7FCO.js → chunk.PAGEGBUD.js} +1 -1
  128. package/dist/preview/{chunk.NGRL3QOI.js → chunk.PDDIQ6PK.js} +1 -1
  129. package/dist/preview/{chunk.OW3M4OBN.js → chunk.PFQBCHQA.js} +1 -1
  130. package/dist/preview/{chunk.LDMBJC3B.js → chunk.PPSYUOH7.js} +1 -1
  131. package/dist/preview/{chunk.GH5UBSQI.js → chunk.PSQYDCVM.js} +1 -1
  132. package/dist/preview/chunk.QDVGHI7R.js +1 -0
  133. package/dist/preview/chunk.QFHWG4LN.js +1 -0
  134. package/dist/preview/chunk.QGIM2WAY.js +1 -0
  135. package/dist/preview/chunk.QHMHUL6B.js +3 -0
  136. package/dist/preview/chunk.QOS5T46W.js +1 -0
  137. package/dist/preview/{chunk.E4TXLT25.js → chunk.QPF4KSAW.js} +1 -1
  138. package/dist/preview/chunk.QQAZQDRW.js +1 -0
  139. package/dist/preview/chunk.QU52E5RG.js +3 -0
  140. package/dist/preview/{chunk.REXU6ARY.js → chunk.QWNSHISU.js} +2 -2
  141. package/dist/preview/chunk.RSMCTI2N.js +1 -0
  142. package/dist/preview/chunk.RWIN3POV.js +1 -0
  143. package/dist/preview/chunk.SSF47GUY.js +1 -0
  144. package/dist/preview/chunk.T6DPWW2K.js +3 -0
  145. package/dist/preview/chunk.TA36WBHK.js +1 -0
  146. package/dist/preview/chunk.TBY5IR7C.js +1 -0
  147. package/dist/preview/chunk.TGEL6EUA.js +1 -0
  148. package/dist/preview/chunk.TTGKX7LT.js +1 -0
  149. package/dist/preview/chunk.TXHYGFIZ.js +1 -0
  150. package/dist/preview/chunk.U3ED7W2U.js +1 -0
  151. package/dist/preview/chunk.U3HERHAI.js +88 -0
  152. package/dist/preview/chunk.U6QXLNHF.js +15 -0
  153. package/dist/preview/{chunk.P4TAX3HE.js → chunk.U6TEW6YD.js} +1 -1
  154. package/dist/preview/chunk.UJPX3BUV.js +1 -0
  155. package/dist/preview/chunk.V5I4GZEY.js +1 -0
  156. package/dist/preview/{chunk.HZPRMHSL.js → chunk.V7W5AQKL.js} +1 -1
  157. package/dist/preview/{chunk.77MLXWZV.js → chunk.VGHO3VCB.js} +1 -1
  158. package/dist/preview/{chunk.YIZPW7IK.js → chunk.VKZIEZ5C.js} +2 -2
  159. package/dist/preview/chunk.VT2YGDK2.js +1 -0
  160. package/dist/preview/{chunk.XCLW4GP7.js → chunk.W4YDPHCQ.js} +1 -1
  161. package/dist/preview/{chunk.2TCOLAL2.js → chunk.W53YNBSM.js} +1 -1
  162. package/dist/preview/chunk.WAB3L3ZI.js +1 -0
  163. package/dist/preview/chunk.WSDJPXJD.js +1 -0
  164. package/dist/preview/chunk.WSO7JOW5.js +1 -0
  165. package/dist/preview/{chunk.4DZOAB4D.js → chunk.WVLEGCRI.js} +1 -1
  166. package/dist/preview/chunk.XK65Y2KX.js +1 -0
  167. package/dist/preview/chunk.XMQG2PSM.js +50 -0
  168. package/dist/preview/{chunk.WFCE7NLK.js → chunk.XOE4KNP2.js} +2 -2
  169. package/dist/preview/chunk.Y7QDQ3WF.js +1 -0
  170. package/dist/preview/chunk.YIPXZUTT.js +2 -0
  171. package/dist/preview/chunk.YNEHJWJV.js +2 -0
  172. package/dist/preview/chunk.YXEO3Y65.js +1 -0
  173. package/dist/preview/chunk.Z274CL7J.js +1 -0
  174. package/dist/preview/chunk.Z7Y3R3YR.js +3 -0
  175. package/dist/preview/{chunk.JS2UZYGB.js → chunk.ZBVYD4OX.js} +1 -1
  176. package/dist/preview/{chunk.P6FNJR6E.js → chunk.ZD7T234N.js} +1 -1
  177. package/dist/preview/{chunk.2G5WLG3Z.js → chunk.ZQR2SN65.js} +1 -1
  178. package/dist/preview/chunk.ZR2TP3BF.js +111 -0
  179. package/dist/preview/chunk.ZRBGYXAO.js +6 -0
  180. package/dist/preview/index.html +57 -55
  181. package/dist/preview/page.js +2 -2
  182. package/dist/preview/splash.js +17 -14
  183. package/package.json +6 -6
  184. package/dist/preview/chunk.2D7K2IJQ.js +0 -4
  185. package/dist/preview/chunk.2E62YCMZ.js +0 -1
  186. package/dist/preview/chunk.2HV5FF6O.js +0 -1
  187. package/dist/preview/chunk.2JDAUKSN.js +0 -1133
  188. package/dist/preview/chunk.37I45R6V.js +0 -35
  189. package/dist/preview/chunk.3FKKH2XU.js +0 -74
  190. package/dist/preview/chunk.3J7XLJP2.js +0 -1
  191. package/dist/preview/chunk.3L37FY3G.js +0 -4
  192. package/dist/preview/chunk.3OEODIHB.js +0 -1
  193. package/dist/preview/chunk.3RD4JHVG.js +0 -88
  194. package/dist/preview/chunk.3RUV4HE4.js +0 -1
  195. package/dist/preview/chunk.3SAESG6X.js +0 -1
  196. package/dist/preview/chunk.4HTB6TX2.js +0 -1
  197. package/dist/preview/chunk.4Q5PCMGZ.js +0 -18
  198. package/dist/preview/chunk.52MBXPEK.js +0 -1
  199. package/dist/preview/chunk.5AD2QHWH.js +0 -3
  200. package/dist/preview/chunk.5HJ2GTKZ.js +0 -1
  201. package/dist/preview/chunk.5IEZF433.js +0 -2
  202. package/dist/preview/chunk.5PPCK7QT.js +0 -1
  203. package/dist/preview/chunk.6NRWLCIZ.js +0 -5
  204. package/dist/preview/chunk.75JQCTR6.js +0 -1
  205. package/dist/preview/chunk.7AOEZJRM.js +0 -1
  206. package/dist/preview/chunk.7ZG77OI3.js +0 -1
  207. package/dist/preview/chunk.7ZHH7WBN.js +0 -1
  208. package/dist/preview/chunk.AJEK3I5X.js +0 -6
  209. package/dist/preview/chunk.APRWUIE3.js +0 -1
  210. package/dist/preview/chunk.ATHLE33D.js +0 -1
  211. package/dist/preview/chunk.B2YTHEX5.js +0 -1
  212. package/dist/preview/chunk.BN42H3C6.js +0 -1
  213. package/dist/preview/chunk.CC7P435K.js +0 -9
  214. package/dist/preview/chunk.CM65MCHA.js +0 -1
  215. package/dist/preview/chunk.DJIF7IAQ.js +0 -2
  216. package/dist/preview/chunk.DMENNIHT.js +0 -1
  217. package/dist/preview/chunk.DN7UCBOA.js +0 -1
  218. package/dist/preview/chunk.DVSTLVIH.js +0 -15
  219. package/dist/preview/chunk.DYRULRFX.js +0 -1
  220. package/dist/preview/chunk.FN34P4IS.js +0 -1
  221. package/dist/preview/chunk.FUPYIOXZ.js +0 -1
  222. package/dist/preview/chunk.FXRYMT3U.js +0 -1
  223. package/dist/preview/chunk.G5BVZLCM.js +0 -1
  224. package/dist/preview/chunk.G7YLK4PX.js +0 -1
  225. package/dist/preview/chunk.GF62K25C.js +0 -1
  226. package/dist/preview/chunk.GFQPO3NC.js +0 -1
  227. package/dist/preview/chunk.GHHKRFPD.js +0 -1
  228. package/dist/preview/chunk.GP5DAA4P.js +0 -3
  229. package/dist/preview/chunk.HPG6CNKM.js +0 -1
  230. package/dist/preview/chunk.HSJEOM3W.js +0 -1
  231. package/dist/preview/chunk.IQGSEAQ2.js +0 -5
  232. package/dist/preview/chunk.K2HDEL7I.js +0 -1
  233. package/dist/preview/chunk.K2PXP5H6.js +0 -1
  234. package/dist/preview/chunk.K54ISAXN.js +0 -1
  235. package/dist/preview/chunk.KHXRJLLU.js +0 -50
  236. package/dist/preview/chunk.KMIFSPGQ.js +0 -1
  237. package/dist/preview/chunk.L4V5VLSM.js +0 -1
  238. package/dist/preview/chunk.LTOQ22ZJ.js +0 -1
  239. package/dist/preview/chunk.M5VHUIDB.js +0 -1
  240. package/dist/preview/chunk.N643PVQA.js +0 -1
  241. package/dist/preview/chunk.NJSK3UO2.js +0 -6
  242. package/dist/preview/chunk.NRPBTV6O.js +0 -21
  243. package/dist/preview/chunk.O7HHNQK4.js +0 -2
  244. package/dist/preview/chunk.PR74PGLC.js +0 -1
  245. package/dist/preview/chunk.QROPDEJF.js +0 -1
  246. package/dist/preview/chunk.QRT6BZR6.js +0 -1
  247. package/dist/preview/chunk.RDA35HZB.js +0 -2
  248. package/dist/preview/chunk.S6QZBWCJ.js +0 -1
  249. package/dist/preview/chunk.SADHOSRC.js +0 -19
  250. package/dist/preview/chunk.SJHUC4TL.js +0 -1
  251. package/dist/preview/chunk.SL5FXE3R.js +0 -1
  252. package/dist/preview/chunk.T4JP6BGP.js +0 -1
  253. package/dist/preview/chunk.TOLW64EO.js +0 -1
  254. package/dist/preview/chunk.TP3PZRHE.js +0 -1
  255. package/dist/preview/chunk.TUR2DA2M.js +0 -1
  256. package/dist/preview/chunk.TYIBLD2D.js +0 -1
  257. package/dist/preview/chunk.UD2GGG7L.js +0 -1
  258. package/dist/preview/chunk.UN2IAA5R.js +0 -1
  259. package/dist/preview/chunk.VLX7YWVH.js +0 -25
  260. package/dist/preview/chunk.VT4YBFZL.js +0 -1
  261. package/dist/preview/chunk.WMARJ5E3.js +0 -1
  262. package/dist/preview/chunk.X36BYTEG.js +0 -1
  263. package/dist/preview/chunk.XEG7ZDRG.js +0 -1
  264. package/dist/preview/chunk.XQ5RTPEF.js +0 -1
  265. package/dist/preview/chunk.YLOGIJOH.js +0 -1
  266. package/dist/preview/chunk.Z4XGEV34.js +0 -1
  267. package/dist/preview/chunk.ZNDVJGTY.js +0 -1
  268. package/dist/preview/chunk.ZQGLPP7A.js +0 -1
  269. /package/dist/preview/{chunk.GZHZLJBF.js → chunk.MIE4TJRW.js} +0 -0
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{r as qe}from"./chunk.7VAHHEDX.js";import{d as Je,e as Ee,h as He,i as je,k as ze,l as Ie,m as Le}from"./chunk.S6QZBWCJ.js";import{a as We}from"./chunk.TQ2G4AM4.js";import{e as X}from"./chunk.G7YLK4PX.js";import{a as j}from"./chunk.YEXFVDRA.js";import{f as $e,g as Y,i as De}from"./chunk.5IEZF433.js";import{a as be}from"./chunk.5AD2QHWH.js";import{Fa as me,Ia as K,Ic as xe,Id as Ne,Jc as Pe,Ka as he,Kc as Me,Ma as ye,Na as Z,Nb as ve,O as pe,Ua as ge,Va as we,Vb as Ae,Wb as Oe,Ya as ke,_b as Re,a as fe,bc as _e,db as F,ec as C,hb as Se,ma as G,mc as Te}from"./chunk.IQGSEAQ2.js";var E=(t,e,n)=>{(t[e]===void 0||n>t[e])&&(t[e]=n)},H=(t,e,n)=>{(t[e]===void 0||n<t[e])&&(t[e]=n)},Q=(t,e)=>{t.format=e,e.includes("int")&&(t.isInt=!0)},Fe=(t,e)=>{t.mime=t.mime?t.mime.filter(n=>e.includes(n)):[...e]},Ce=(t,e)=>{t.multipleOf??=[],t.multipleOf.includes(e)||t.multipleOf.push(e)},Be=(t,e)=>(t.patterns??=new Set).add(e),gt={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]};function z(t){let e={},{def:n,bag:o}=t._zod,i=t._zod.traits.has("$ZodCheck")?[t,...n.checks??[]]:n.checks??[];for(let r of i){let a=r._zod.def;switch(a.check){case"greater_than":E(e,a.inclusive?"minimum":"exclusiveMinimum",a.value);break;case"less_than":H(e,a.inclusive?"maximum":"exclusiveMaximum",a.value);break;case"multiple_of":Ce(e,a.value);break;case"number_format":{Q(e,a.format);let d=gt[a.format];d&&(E(e,"minimum",d[0]),H(e,"maximum",d[1]));break}case"bigint_format":Q(e,a.format);break;case"min_length":case"min_size":E(e,"minimum",a.minimum);break;case"max_length":case"max_size":H(e,"maximum",a.maximum);break;case"length_equals":E(e,"minimum",a.length),H(e,"maximum",a.length);break;case"size_equals":E(e,"minimum",a.size),H(e,"maximum",a.size);break;case"string_format":Q(e,a.format),a.pattern&&Be(e,a.pattern),(a.format==="base64"||a.format==="base64url")&&(e.contentEncoding=a.format),(a.local||a.precision===-1)&&(e.laxFormat=!0);break;case"mime_type":Fe(e,a.mime);break}}o.minimum!==void 0&&E(e,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&E(e,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&H(e,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&H(e,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Ce(e,o.multipleOf),o.format!==void 0&&(e.format??=o.format,o.format.includes("int")&&(e.isInt=!0)),o.mime&&Fe(e,o.mime);for(let r of o.patterns??[])Be(e,r);return e}var wt={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""};function L(t){let e=t._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?L(e.out):e.type==="catch"?L(e.innerType):t._zod.optin}var kt=new Set(["promise","optional","nonoptional","nullable","readonly","default","prefault","catch"]);function T(t,e=new Set){if(e.has(t))return!1;e.add(t);let n=t._zod.def,o=n.type;return o==="transform"?!0:o==="array"?T(n.element,e):o==="set"?T(n.valueType,e):o==="lazy"?T(n.getter(),e):kt.has(o)?T(n.innerType,e):o==="intersection"?T(n.left,e)||T(n.right,e):o==="record"||o==="map"?T(n.keyType,e)||T(n.valueType,e):o==="pipe"?t._zod.traits.has("$ZodCodec")||T(n.in,e)||T(n.out,e):o==="object"?Object.values(n.shape).some(i=>T(i,e)):o==="union"?n.options.some(i=>T(i,e)):o==="tuple"?n.items.some(i=>T(i,e))||(n.rest?T(n.rest,e):!1):!1}function bt(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n])=>e.indexOf(+n)===-1).map(([,n])=>n)}function Ge(t){let e=t.anyOf;if(!Array.isArray(e)||e.length===0||t.type!==void 0)return;let n=[];for(let o of e){if(!o||typeof o!="object")return;Ge(o);let i=Object.keys(o);if(i.length!==1||i[0]!=="type")return;for(let r of[o.type].flat()){if(typeof r!="string")return;n.includes(r)||n.push(r)}}delete t.anyOf,t.type=n.length===1?n[0]:n}var Ke=new Set(["type","properties","required","additionalProperties"]),Ue=t=>{let e=t.additionalProperties;return e&&typeof e=="object"&&Object.keys(e).length?e:null},Ve=(t,e)=>JSON.stringify(t)===JSON.stringify(e);function ee(t){for(let i of t){if(typeof i!="object"||i.type!=="object")return null;for(let r in i)if(!Ke.has(r))return null}let e={},n=new Set;for(let i of t){for(let r in i.properties){if(Object.prototype.hasOwnProperty.call(e,r))continue;let a=[];for(let d of t){let s=d.properties?.[r]??Ue(d);s&&!a.some(g=>Ve(g,s))&&a.push(s)}e[r]=a.length===1?a[0]:ee(a)??{allOf:a}}for(let r of i.required??[])n.add(r)}let o={type:"object",properties:e};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let r of t){let a=Ue(r);a&&!i.some(d=>Ve(d,a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function St(t){let e=t.allOf;if(!Array.isArray(e)||e.length<2)return;for(let i of Ke)if(i in t)return;let n=e.filter(i=>Array.isArray(i.oneOf)||Array.isArray(i.anyOf)),o;if(!n.length)o=ee(e);else{let i=n[0],r=Array.isArray(i.oneOf)?"oneOf":"anyOf";if(Object.keys(i).length!==1)return;let a=e.filter(s=>s!==i),d=i[r].map(s=>ee([...a,s]));if(d.some(s=>!s))return;o={[r]:d}}o&&(delete t.allOf,Object.assign(t,o))}function Ze(t){let e=t;for(let k of["anyOf","oneOf"]){let R=e[k];if(!Array.isArray(R))continue;let v=R.map(Ze);v.some((A,m)=>A!==R[m])&&(e={...e,[k]:v})}let n=[e.type].flat(),o=!n.includes("string")&&n.some(k=>k==="number"||k==="integer"),i=e.enum??(e.const!==void 0?[e.const]:void 0);if(!o&&!i?.some(k=>typeof k=="number"))return e;let{minimum:r,maximum:a,exclusiveMinimum:d,exclusiveMaximum:s,multipleOf:g,format:p,id:w,...h}=e;return h.enum?h.enum=h.enum.map(k=>typeof k=="number"?String(k):k):typeof h.const=="number"&&(h.const=String(h.const)),o&&(h.type="string",i||(h.pattern=n.includes("number")?"^-?\\d+(?:\\.\\d+)?$":"^-?\\d+$")),h}var B=class{constructor(e,n){this.override=e;this.refs=n}done=new Map;path=[];cyclic=new Map;write(e,n=!1){let o=this.refs.get(e);if(o!==void 0&&!n)return{$ref:o};if(this.path.includes(e))return this.cyclic.has(e)||this.cyclic.set(e,""),{};let i=this.done.get(e);if(i)return i;this.path.push(e);try{let r=this.written(e);return this.done.set(e,r),r}finally{this.path.pop()}}written(e){let n={},o,i=e._zod.toJSONSchema?.();i?Object.assign(n,i):o=this.process(e,n);let r=fe.get(e);if(r)for(let d of Object.keys(r))n[d]=r[d];T(e)&&(delete n.examples,delete n.default),"_prefault"in n&&(n.default??=n._prefault,delete n._prefault);let a=n;if(o){let d=this.write(o);a={...n};for(let s of Object.keys(d))s in n||(a[s]=d[s])}return this.override({zodSchema:e,jsonSchema:a}),Ge(a),e._zod.def.type==="intersection"&&St(a),a}process(e,n){let o=e._zod.def;switch(o.type){case"string":{n.type="string";let{minimum:i,maximum:r,format:a,patterns:d,contentEncoding:s,laxFormat:g}=z(e);if(typeof i=="number"&&(n.minLength=i),typeof r=="number"&&(n.maxLength=r),a&&(n.format=wt[a]??a,(n.format===""||a==="time"||g)&&delete n.format),s&&(n.contentEncoding=s),d&&d.size>0){let p=[...d];p.length===1?n.pattern=p[0].source:n.allOf=p.map(w=>({pattern:w.source}))}return}case"number":{let{minimum:i,maximum:r,multipleOf:a,exclusiveMinimum:d,exclusiveMaximum:s,isInt:g}=z(e);if(n.type=g?"integer":"number",typeof d=="number"&&d>=(i??Number.NEGATIVE_INFINITY)?n.exclusiveMinimum=d:typeof i=="number"&&(n.minimum=i),typeof s=="number"&&s<=(r??Number.POSITIVE_INFINITY)?n.exclusiveMaximum=s:typeof r=="number"&&(n.maximum=r),a){let[p,...w]=new Set(a.filter(h=>Number.isFinite(h)&&h!==0).map(Math.abs));p!==void 0&&(n.multipleOf=p),w.length&&(n.allOf=[...n.allOf??[],...w.map(h=>({multipleOf:h}))])}return}case"boolean":case"success":n.type="boolean";return;case"null":n.type="null";return;case"never":n.not={};return;case"enum":{let i=bt(o.entries);i.length===0?n.not={}:(i.every(r=>typeof r=="number")&&(n.type="number"),i.every(r=>typeof r=="string")&&(n.type="string"),n.enum=i);return}case"literal":{let i=o.values.filter(r=>r!==void 0).map(r=>typeof r=="bigint"?Number(r):r);if(o.values.length===0)n.not={};else if(i.length===1)n.type=i[0]===null?"null":typeof i[0],n.const=i[0];else if(i.length>1){for(let r of["number","string","boolean"])i.every(a=>typeof a===r)&&(n.type=r);i.every(r=>r===null)&&(n.type="null"),n.enum=i}return}case"template_literal":n.type="string",n.pattern=e._zod.pattern.source;return;case"file":{n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:i,maximum:r,mime:a}=z(e);i!==void 0&&(n.minLength=i),r!==void 0&&(n.maxLength=r),a&&(a.length===0?n.not={}:a.length===1?n.contentMediaType=a[0]:n.anyOf=a.map(d=>({contentMediaType:d})));return}case"array":{let{minimum:i,maximum:r}=z(e);typeof i=="number"&&(n.minItems=i),typeof r=="number"&&(n.maxItems=r),n.type="array",n.items=this.write(o.element);return}case"object":{let i=o.shape;n.type="object";let r={};n.properties=r;for(let d in i)Object.defineProperty(r,d,{value:this.write(i[d]),writable:!0,enumerable:!0,configurable:!0});let a=Object.keys(i).filter(d=>L(i[d])===void 0);a.length>0&&(n.required=a),o.catchall?._zod.def.type==="never"?n.additionalProperties=!1:o.catchall&&(n.additionalProperties=this.write(o.catchall));return}case"union":n[o.inclusive===!1?"oneOf":"anyOf"]=o.options.map(i=>this.write(i));return;case"intersection":{let i=d=>"allOf"in d&&Object.keys(d).length===1,r=this.write(o.left),a=this.write(o.right);n.allOf=[...i(r)?r.allOf:[r],...i(a)?a.allOf:[a]];return}case"tuple":{let i=o.items;n.type="array",n.prefixItems=i.map(s=>this.write(s)),o.rest?n.items=this.write(o.rest):n.items=!1;let r=i.length;for(;r>0&&L(i[r-1])!==void 0;)r-=1;r>0&&(n.minItems=r),o.rest||(n.maxItems=i.length);let{minimum:a,maximum:d}=z(e);typeof a=="number"&&(n.minItems=a),typeof d=="number"&&(n.maxItems=d);return}case"record":{let i=o.keyType;n.type="object";let r=z(i).patterns;if(o.mode==="loose"&&r&&r.size>0){let d=this.write(o.valueType),s={};for(let g of r)s[g.source]=d;n.patternProperties=s}else n.propertyNames=Ze(this.write(i)),n.additionalProperties=this.write(o.valueType);let a=i._zod.values;if(a&&!o.partial&&L(o.valueType)===void 0){let d=[...a].filter(s=>typeof s=="string"||typeof s=="number");d.length>0&&(n.required=d.map(String))}return}case"nullable":n.anyOf=[this.write(o.innerType),{type:"null"}];return;case"default":case"prefault":{let i=o.defaultValue,r,a=!1,d=JSON.stringify(i,(s,g)=>typeof g=="bigint"?(a=!0,null):g);return!a&&d!==void 0&&(r=JSON.parse(d)),a||(n[o.type==="default"?"default":"_prefault"]=r),o.innerType}case"catch":{try{n.default=o.catchValue(void 0)}catch{}return o.innerType}case"readonly":return n.readOnly=!0,o.innerType;case"pipe":return o.in._zod.traits.has("$ZodTransform")?o.out:o.in;case"lazy":return e._zod.innerType;case"optional":case"nonoptional":case"promise":return o.innerType;default:return}}};function Ye(t,e=()=>{}){let n=t,o=new B(e,new Map),i=o.write(n,!0);if(o.cyclic.size>0){let r=new Map,a=0,d=[];for(let g of o.cyclic.keys())if(g===n)r.set(g,"#");else{let p=`__schema${a++}`;r.set(g,`#/$defs/${p}`),d.push([g,p])}o=new B(e,r),i=o.write(n,!0);let s={};for(let[g,p]of d)s[p]=o.write(g,!0);d.length>0&&(i={...i,$defs:s})}return JSON.parse(JSON.stringify({$schema:"https://json-schema.org/draft/2020-12/schema",...i}))}function Xe(t){return Ye(t,Ot)}var vt={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"},At={phone:"A phone number as it is written, like +1 555 123 4567 or 020 7946 0958 ext. 12.",place:"An address or a place's name, as a person would search a map for it.",duration:"A length of time in whole minutes: 90 is 1 h 30 min."};function Ot(t){me(t.zodSchema)&&(t.jsonSchema["x-graview-app-link"]=!0);let e=ye(t.zodSchema);if(e&&(t.jsonSchema.type==="string"||t.jsonSchema.type==="array")){t.jsonSchema["x-graview-linked"]={address:e.address,kinds:[...e.kinds],cardinality:e.cardinality};let s=e.kinds.join(" or "),g=`${e.cardinality==="many"?"Records":"A record"}: a ${s} in the app ${e.address}, as "${e.kinds[0]}:<id>" \u2014 an id found there with find_linked. Linking never changes that app.`,p=t.jsonSchema.description;typeof p=="string"&&p.includes(g)||(t.jsonSchema.description=`${typeof p=="string"&&p?`${p.replace(/\.?$/,".")} `:""}${g}`)}if(ke(t.zodSchema)&&(t.jsonSchema["x-graview-repeat"]=!0,!t.jsonSchema.type&&!t.jsonSchema.anyOf&&!t.jsonSchema.oneOf&&Object.assign(t.jsonSchema,Rt())),be(t.zodSchema)){t.jsonSchema.contentMediaType="text/markdown";let s=t.jsonSchema.description;typeof s=="string"&&s.endsWith("Written in Markdown.")||(t.jsonSchema.description=`${typeof s=="string"&&s?`${s.replace(/\.?$/,".")} `:""}Written in Markdown.`)}let n=_e(t.zodSchema);if(n){let s=t.jsonSchema;s["x-graview-type"]=n,n==="duration"&&(s["x-graview-unit"]="minutes"),s.description??=At[n]}let o=Re(t.zodSchema,!1);if(o){let s=$e(o);t.jsonSchema["x-graview-format"]=s.format??"unit",s.currency&&(t.jsonSchema["x-graview-currency"]=s.currency),s.unit&&s.format!=="money"&&(t.jsonSchema["x-graview-unit"]=s.unit);let g=t.jsonSchema.description;t.jsonSchema.description=typeof g=="string"&&g.length>0?`${g} ${Y(s)}`:Y(s)}let i=t.zodSchema._zod?.def;if(!i||i.type!=="string"||typeof i.format!="string"||i.format==="regex")return;let r=t.jsonSchema,a=(i.checks??[]).map(s=>s._zod?.def).filter(s=>s?.format==="regex"&&s.pattern instanceof RegExp).map(s=>s.pattern.source);delete r.pattern;let d=r.allOf;Array.isArray(d)&&d.every(s=>typeof s=="object"&&s!==null&&Object.keys(s).length===1&&"pattern"in s)&&delete r.allOf,r.format=vt[i.format]??i.format,a.length===1?r.pattern=a[0]:a.length>1&&(r.allOf=a.map(s=>({pattern:s})))}function te(t,e){let n=C(t.input),o=Xe(t.input);if(e&&o.properties){let r=a=>e.includes(a)?e.indexOf(a):e.length;o.properties=Object.fromEntries(Object.entries(o.properties).sort(([a],[d])=>r(a)-r(d)))}let i=o.properties??{};if(Ae(t)){let r=t.creates.join(" | ");i.id={type:"string",minLength:1,description:`Optional: the id for the ${r} this makes, beginning with its kind (${t.creates.map(a=>`"${a}:"`).join(" or ")}). Refused if the graph already has it; left out, one is minted from the label.`},o.properties=i}Oe(t)&&(o.additionalProperties=!1);for(let r of n){let a=i[r.name];if(!a)continue;let d=r.kinds.includes("*")?"any node kind":r.kinds.join(" | ");a.description=[a.description,`Id of a node (${d}).`].filter(Boolean).join(" ")}return{name:t.name,...t.title===void 0?{}:{title:t.title},description:t.description??t.title??t.name,inputSchema:o,nodeRefs:n}}function Rt(){let t={type:"string",pattern:"^\\d{4}-\\d{2}-\\d{2}$"},e=(n,o)=>({type:"integer",minimum:n,maximum:o});return{type:"object",description:'How the date beside it repeats; the date is the first occurrence. "on" is weekdays for "week", days of the month (-1 the last) for "month".',properties:{every:{type:"string",enum:[...we]},interval:e(1,99),on:{type:"array",minItems:1,maxItems:31,items:{anyOf:[{type:"string",enum:[...ge]},e(-1,31)]}},until:t,count:e(1,1e3),except:{type:"array",maxItems:500,items:t},continues:{type:"string",maxLength:200}},required:["every"],additionalProperties:!1}}function Qe(t){let e=new Set;for(let n=t;n;n=n.onBehalfOf)n.id!==void 0&&e.add(`${n.kind}:${n.id}`);return e}function U(t,e){let n=Qe(e),o=p=>{if(p.kind==="rule")return!1;let w=Qe(p);if(w.size===0)return!1;for(let h of w)if(n.has(h))return!1;return!0},i,r=()=>{if(i)return i;i=new Map;for(let p of t.log.live()){if(p.undoes!==void 0)continue;let w=o(p.author)?p.author:void 0;for(let h of p.primitives){h.op==="remove-node"&&i.delete(h.node.id);let k=h.op==="add-node"?h.node.id:h.op==="patch-node"||h.op==="splice-text"?h.id:void 0;if(k===void 0)continue;let R=h.op==="add-node"?Object.keys(h.node):h.op==="splice-text"?[h.field]:Object.keys(h.after),v=i.get(k);(h.op==="add-node"||!v)&&i.set(k,v=new Map);for(let A of R)A==="id"||A==="kind"||(w?v.set(A,w):v.delete(A))}}return i},a=t.schema,d=new Map,s=(p,w)=>{let h=`${p}\0${w}`,k=d.get(h);if(k===void 0){let R=a.tryDefinition(p)?.fields?.shape;k=R!==void 0&&w in R&&De(R[w]).type==="text",d.set(h,k)}return k},g=p=>t.graph.getNode(p)?.kind;return{prose:s,say:p=>F(p,{graph:t.graph,schema:a}),fieldBy(p,w){let h=g(p);if(!(h===void 0||!s(h,w)))return r().get(p)?.get(w)},recordBy(p){let w=g(p),h=r().get(p);if(w===void 0||!h)return;let k;for(let[R,v]of h)s(w,R)&&(k=v);return k}}}var ne=(t,e,n)=>({untrusted:!0,authoredBy:n.say(e),text:t}),_t="the host's ranker";function et(t,e){return{...t,hits:t.hits.map(n=>{if(n.about!=="node")return n;n.why.by==="meaning"&&n.why.matched!==void 0&&(n={...n,why:{...n.why,matched:{untrusted:!0,authoredBy:_t,text:n.why.matched}}});let o=e.recordBy(n.id);if(!o)return n;let i=e.prose(n.kind,n.why.field)?e.fieldBy(n.id,n.why.field):o;return{...n,label:ne(n.label,o,e),...n.apart!==void 0?{apart:ne(n.apart,o,e)}:{},why:i?{...n.why,fragment:ne(n.why.fragment,i,e)}:n.why}})}}var ie=(t,e,n)=>({title:t,readOnlyHint:e,destructiveHint:!1,idempotentHint:n,openWorldHint:!1}),Tt={name:"subscribe",title:"Notify me when something happens",description:`Subscribe the person you act for to be told when something happens in this app \u2014 their host delivers it (an email, a push). on is one of: "act" (an act runs; give act, its declared name, and/or record), "created" (a record of kind is added), "changed" (a record of kind, or the one record, changes), "reaches" (a record of kind, or the one record, comes to satisfy condition, an expression in the app's rule language such as done == true or amount > 100). They are told only of changes someone else made, unless alsoMine is true, and only of records they may see. Returns the subscription and its sentence. Changes nothing in the app.`,inputSchema:{type:"object",properties:{on:{type:"string",enum:["act","created","changed","reaches"],description:"What to be told of."},act:{type:"string",description:"An act's declared name, for on: act."},kind:{type:"string",description:"A kind, for created, changed and reaches."},record:{type:"string",description:"One record, by id or name: for act, changed and reaches."},condition:{type:"string",description:"For reaches: what the record should come to satisfy, in the rule language (done == true)."},alsoMine:{type:"boolean",description:"Also when the person themselves made the change; false when unsaid."}},required:["on"],additionalProperties:!1},mutating:!1,annotations:ie("Notify me when something happens",!1,!1)},xt={name:"unsubscribe",title:"Stop notifying me",description:"Take away one of the person's subscriptions, by the id list_subscriptions or subscribe answered. Changes nothing in the app.",inputSchema:{type:"object",properties:{id:{type:"string",description:"The subscription's id."}},required:["id"],additionalProperties:!1},mutating:!1,annotations:ie("Stop notifying me",!1,!0)},Pt={name:"list_subscriptions",title:"What I am notified of",description:`List what the person you act for is told of in this app: each subscription's id and its sentence ("When someone else adds a task").`,inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:ie("What I am notified of",!0,!0)},oe=[Tt,xt,Pt];var it=t=>({type:"string",enum:[...t],description:"The workflow, by its name."}),tt=t=>({name:"run_workflow",title:"Run a workflow now",description:"Run one of the app's workflows now, by hand, as the app's own actor: its steps make, change, set aside or suggest what they say, as its approve setting says. With dryRun: true nothing is kept and the answer says what it would do. The first run after a workflow is added or changed is a dry run whatever you ask; run it again to keep it. A paused workflow only dry-runs. Returns the run: its outcome, what it made, changed, archived and suggested, what it held back and why.",inputSchema:{type:"object",properties:{name:it(t),dryRun:{type:"boolean",description:"Keep nothing; say what it would do. False when unsaid."}},required:["name"],additionalProperties:!1},mutating:!0,annotations:{title:"Run a workflow now",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1}}),nt=(t,e)=>({name:t?"pause_workflow":"resume_workflow",title:t?"Pause a workflow":"Resume a workflow",description:t?"Pause one of the app's workflows: it runs on no schedule and no change until it is resumed, and run_workflow only dry-runs it. Changes the app's declaration, not its records. Returns the edit that takes it back.":"Resume a paused workflow: it runs again on its schedule and the changes it waits for. Changes the app's declaration, not its records. Returns the edit that takes it back.",inputSchema:{type:"object",properties:{name:it(e)},required:["name"],additionalProperties:!1},mutating:!0,annotations:{title:t?"Pause a workflow":"Resume a workflow",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}}),ot=["run_workflow","pause_workflow","resume_workflow"];function rt(t,e){return e===void 0||t.length===0?[]:e==="manage"?[tt(t),nt(!0,t),nt(!1,t)]:[tt(t)]}function Mt(t){return{run:t.id,workflow:t.workflow,outcome:t.outcome,dry:t.dry,made:t.made,changed:t.changed,archived:t.archived,suggested:t.suggested,heldBack:t.heldBack,notes:t.notes}}async function at(t,e,n){let o=n.workflows.declared(),i=o.map(w=>w.name),r=String(e.name??"");if(!i.includes(r))return{ok:!1,error:`No workflow is called "${r}". The app's workflows are: ${i.join(", ")||"none"}. Nothing was changed.`,reason:"invalid"};if(t==="run_workflow"){let w=await n.workflows.run(r,{dryRun:e.dryRun===!0,...n.principal.id!==void 0?{who:n.principal.id}:{}});return{ok:!0,data:Mt(w)}}let a=n.workflows.edit;if(!a)return{ok:!1,error:"This seat's host does not write the app's declaration, so it cannot pause or resume a workflow. Nothing was changed.",reason:"forbidden"};let d=t==="pause_workflow",s=o.find(w=>w.name===r),g=s.status;if(g==="paused"===d)return{ok:!0,data:{workflow:r,status:g,said:`\u201C${s.title}\u201D is already ${g}. Nothing was changed.`}};let p=await a({op:d?"pause-workflow":"resume-workflow",name:r});return p.ok?{ok:!0,data:{workflow:r,status:d?"paused":"active",...p.said?{said:p.said}:{},undo:{op:d?"resume-workflow":"pause-workflow",name:r}}}:{ok:!1,error:p.error}}var q=t=>{let e;return()=>e??=t().catch(n=>{throw e=void 0,n})},Nt=q(()=>(__graviewPreload(import.meta.url,["./chunk.DJIF7IAQ.js","./chunk.HZPRMHSL.js","./chunk.G7YLK4PX.js","./chunk.ZA5TDCBC.js","./chunk.2JEN2RCB.js","./chunk.7CLKGKSF.js","./chunk.TMHVYI5R.js","./chunk.R5MLRKAO.js","./chunk.YMXWS4XN.js","./chunk.5IEZF433.js","./chunk.5AD2QHWH.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.N643PVQA.js"))),$t=()=>(__graviewPreload(import.meta.url,["./chunk.YEXFVDRA.js","./chunk.TMHVYI5R.js","./chunk.R5MLRKAO.js","./chunk.YMXWS4XN.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.E4TXLT25.js")).catch(()=>{}),Dt=async()=>{(await $t())?.judgeWithLines()},W=q(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.ZA5TDCBC.js","./chunk.2JEN2RCB.js","./chunk.7CLKGKSF.js","./chunk.TMHVYI5R.js","./chunk.R5MLRKAO.js","./chunk.YMXWS4XN.js","./chunk.5AD2QHWH.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BN42H3C6.js"))),Jt=q(()=>(__graviewPreload(import.meta.url,["./chunk.REXU6ARY.js","./chunk.G4JJXA63.js","./chunk.BIDL7GQD.js","./chunk.TA2JTUNX.js","./chunk.HZPRMHSL.js","./chunk.LDMBJC3B.js","./chunk.XOZU4OFA.js","./chunk.G7YLK4PX.js","./chunk.Q5WEOX3Q.js","./chunk.2E62YCMZ.js","./chunk.DUP2CGVH.js","./chunk.YEXFVDRA.js","./chunk.WVUJXDXZ.js","./chunk.ZA5TDCBC.js","./chunk.2JEN2RCB.js","./chunk.7CLKGKSF.js","./chunk.TMHVYI5R.js","./chunk.R5MLRKAO.js","./chunk.YMXWS4XN.js","./chunk.75JQCTR6.js","./chunk.5IEZF433.js","./chunk.5AD2QHWH.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.TP3PZRHE.js"))),Et=q(()=>(__graviewPreload(import.meta.url,["./chunk.B6JR7EQO.js","./chunk.DJIF7IAQ.js","./chunk.HZPRMHSL.js","./chunk.TQ2G4AM4.js","./chunk.X36BYTEG.js","./chunk.G7YLK4PX.js","./chunk.ZA5TDCBC.js","./chunk.2JEN2RCB.js","./chunk.7CLKGKSF.js","./chunk.TMHVYI5R.js","./chunk.R5MLRKAO.js","./chunk.YMXWS4XN.js","./chunk.75JQCTR6.js","./chunk.5IEZF433.js","./chunk.5AD2QHWH.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.2HV5FF6O.js"))),Ht=q(()=>(__graviewPreload(import.meta.url,["./chunk.5B7NG6WH.js","./chunk.UDYFGYJP.js","./chunk.TMHVYI5R.js","./chunk.R5MLRKAO.js","./chunk.YMXWS4XN.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.S7SHWDPR.js"))),jt=t=>t.definitions.some(e=>Z(e).size>0),st=t=>({value:K(t),label:t.label,...t.describe?{describe:t.describe}:{},...t.card?{card:t.card}:{},fields:t.fields,...t.app?{app:t.app}:{}});async function zt(t,e,n,o){let i=String(n.relation??""),[r,a]=i.includes(".")?i.split(".",2):[void 0,i],d=t.schema.definitions.flatMap(A=>[...Z(A)].map(([m,u])=>({kind:A.kind,name:m,relation:u}))),s=d.filter(A=>A.name===a&&(r===void 0||A.kind===r));if(s.length!==1){let A=d.map(m=>`${m.kind}.${m.name}`).join(", ")||"none";return{ok:!1,error:`${s.length===0?`No relation to another app is called "${i}"`:`"${i}" names a relation of several kinds`}. The relations to other apps are: ${A}.`}}let{kind:g,name:p,relation:w}=s[0];if(!o)return{ok:!1,error:`This seat cannot read ${w.address}: its host reads no other app's records. Nothing was changed.`};let h={kind:e.kind,...e.id===void 0?{}:{id:e.id},...e.roles?{roles:e.roles}:{},...e.onBehalfOf?{onBehalfOf:e.onBehalfOf}:{}},k=typeof n.of=="string"?n.of:void 0;if(k!==void 0){let A=t.graph.getNode(k);if(!A||A.kind!==g)return{ok:!1,error:`No ${g} "${k}".`};let m=he(A[p],w),u=await Promise.all(m.map(b=>Promise.resolve().then(()=>o.resolve(b,h)).catch(()=>null)));return{ok:!0,data:{relation:`${g}.${p}`,app:w.address,records:u.map((b,S)=>b===null?{value:K(m[S]),missing:!0}:"denied"in b?{denied:!0,said:"linked record (no access)"}:st(b))},reads:[k]}}let R=typeof n.limit=="number"&&n.limit>0?Math.min(n.limit,20):20,v=await Promise.resolve().then(()=>o.find({address:w.address,kinds:w.kinds,query:String(n.query??""),limit:R},h)).catch(()=>[]);return Array.isArray(v)?{ok:!0,data:{relation:`${g}.${p}`,app:w.address,records:v.map(st),link:`edit-${g} with ${p} set to a record's value`}}:{ok:!0,data:{relation:`${g}.${p}`,app:w.address,denied:!0,said:"linked record (no access)"}}}var M=t=>({title:t,readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}),dt={description:'Which records: false (the default) the live ones, true only the archived ones, "all" both. An archived record is set aside, not gone: unarchive-<kind> brings it back.',anyOf:[{type:"boolean"},{type:"string",enum:["all"]}]},re={type:"number",description:"Where the page starts; 0 when unsaid."},se=[{name:"search_graph",title:"Find by name",description:"Find things by name: records whose name or readable fields carry the words, and the kinds, places and rules the words name \u2014 each with why it matched. Reach for this before get_graph when you know what something is called. Words match the start of words, case and accents aside; key:value tokens narrow as a list's filter does (done:false, is:any for past records, kind:<kind>). Pass subject (a node id) to get the acts you may run on it as hits too. When few records match exactly, records with a near word follow \u2014 a typo, another form of the word, a meaning \u2014 each with near: true and why.matched, the record's own word that answered.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Words, with optional key:value conditions."},limit:{type:"number",description:"Most hits to return; at most 20."},subject:{type:"string",description:"A node id whose acts to include."},archived:dt},required:["query"],additionalProperties:!1},mutating:!1,annotations:M("Find by name")},{name:"get_graph",title:"Read the graph",description:"Read the graph, 25 nodes a page: their fields, the edges out of them, and how many more. Start here when you need the shape of the domain rather than one thing in it.",inputSchema:{type:"object",properties:{offset:re,archived:dt},additionalProperties:!1},mutating:!1,annotations:M("Read the graph")},{name:"get_node",title:"Read one node",description:"Read one node: its fields, its links (id, kind and label, 20 each way a page), the violations that implicate it, and its computed values: read-only fields worked out from what you can see, which no act sets. Use this to check a thing before you change it.",inputSchema:{type:"object",properties:{id:{type:"string",description:"A node's id, or its name."},offset:re},required:["id"],additionalProperties:!1},mutating:!1,annotations:M("Read one node")},{name:"get_violations",title:"List the problems",description:"List the invariant violations the graph currently has, 20 a page, with the repairs that would resolve each one. Read this before proposing work: a rule that is already broken is more urgent than anything you could add.",inputSchema:{type:"object",properties:{offset:re,context:{type:"object",description:"Evaluation context, e.g. { weekStart }."}},additionalProperties:!1},mutating:!1,annotations:M("List the problems")},{name:"get_affordances",title:"Ask what can be done",description:"Ask what can legally be done with a selection, ranked. Prefer these over composing a mutation by hand: they are derived from the schema, the invariants and the shape of the graph, so they cannot name an action that does not exist.",inputSchema:{type:"object",properties:{selection:{type:"array",items:{type:"string"},description:"Node ids."},context:{type:"object"}},required:["selection"],additionalProperties:!1},mutating:!1,annotations:M("Ask what can be done")},{name:"describe_place",title:"Say what a place shows",description:`Say what one place of the app shows you, as a person in your seat would see it: its headings, its figures as drawn, its lists with each record's title and what its card or row says, the headings a list is grouped under, what an empty list says, the forms it offers (each field in the order asked, its label, whether it must be answered, what it takes and its choices), and any block that could not be worked out. Pass a place's slug ("home", a lens's address like "the-offers", a kind's like "offers"), a record's id, or a visitor form's "forms/<name>", and width 390 for a phone. Use it after a change to check what somebody now sees, instead of guessing.`,inputSchema:{type:"object",properties:{place:{type:"string",description:`"home", a place's slug, a record's id, or "forms/<name>" for a visitor form.`},width:{type:"number",description:"The screen's width in CSS pixels; 390 is a phone, 1440 when unsaid."}},required:["place"],additionalProperties:!1},mutating:!1,annotations:M("Say what a place shows")},{name:"preview_mutation",title:"Try an act without applying it",description:"Try a mutation without applying it: get back the diff it would produce and any invariant it would break. Do this when you are unsure, rather than applying and undoing.",inputSchema:{type:"object",properties:{mutation:{type:"string"},args:{type:"object"}},required:["mutation","args"],additionalProperties:!1},mutating:!1,annotations:M("Try an act without applying it")},{name:"undo_batch",title:"Undo a batch",description:"Undo one batch of operations. Fails, naming the blocking operation, when a later operation read what it wrote.",inputSchema:{type:"object",properties:{batch:{type:"string"},include:{type:"array",items:{type:"string"}}},required:["batch"],additionalProperties:!1},mutating:!0,annotations:{title:"Undo a batch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}},{name:"list_suggestions",title:"List what is suggested",description:"List the suggestions waiting for a person: changes the app's own actor proposed and did not make, each with its id, what it would do, who suggested it, what it was based on and how sure (0 to 1), and the votes on it (tally: for, against, and this seat's own as mine). Nothing changes until one is accepted (accept_suggestion) or declined (decline_suggestion); a declined one is never suggested again.",inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:M("List what is suggested")},{name:"accept_suggestion",title:"Accept a suggestion",description:`Make a waiting suggestion's change, as this seat, carrying what it was based on. Returns the batch (undo_batch takes it back). From a seat that may see the suggestion and may not make the change, it records this seat's vote for it instead (voted: "for"; a later vote replaces it) and the suggestion still waits for someone who may.`,inputSchema:{type:"object",properties:{suggestion:{type:"string",description:"The suggestion's id, from list_suggestions."}},required:["suggestion"],additionalProperties:!1},mutating:!0,annotations:{title:"Accept a suggestion",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1}},{name:"decline_suggestion",title:"Decline a suggestion",description:`Decline a waiting suggestion: nothing changes, the decline is kept in the log, and the same change is never suggested or made by the app's own actor again. From a seat that may not make the change, it records this seat's vote against it instead (voted: "against") and the suggestion still waits.`,inputSchema:{type:"object",properties:{suggestion:{type:"string",description:"The suggestion's id, from list_suggestions."}},required:["suggestion"],additionalProperties:!1},mutating:!0,annotations:{title:"Decline a suggestion",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}}],lt={name:"act_on_several",title:"Do one act to several records",description:`Run one act on several records at once, as one change with one undo. act is the act (its tool name or its declared name), records the records it runs on (ids or names; each goes in the act's subject), args what every call shares ("Set stage to Declined" is args { stage: "declined" }). Each record is judged on its own: one this seat may not change is named with why, and the rest still apply. Returns the batch (undo_batch takes it all back), the records changed, those already so, and those refused.`,inputSchema:{type:"object",properties:{act:{type:"string",description:"The act to run on each record."},records:{type:"array",items:{type:"string"},minItems:1,maxItems:200,description:"Ids or names of the records."},args:{type:"object",description:"Arguments every call shares, besides the record."}},required:["act","records"],additionalProperties:!1},mutating:!0,annotations:{title:"Do one act to several records",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}},ue={name:"suggest_changes",title:"Suggest changes",description:"Keep calls ({ act, args }) as one suggestion a person accepts or declines, with its basis and confidence (0 to 1). Changes nothing; a declined change is refused.",inputSchema:{type:"object",properties:{calls:{type:"array",items:{type:"object"}},basis:{type:"string"},confidence:{type:"number"}},required:["calls","basis"]},mutating:!0,annotations:{title:"Suggest changes",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},ut={name:"propose_changes",title:"Propose changes for review",description:"Propose calls ({ act, args }) this seat may not run as one proposal that somebody who may run them accepts or declines, with what it is for in the person's words (intent). Changes nothing now; each call is judged as it would be for the reviewer, and an act this seat may neither run nor propose is refused. Returns the proposal's id (list_suggestions shows it waiting).",inputSchema:{type:"object",properties:{calls:{type:"array",items:{type:"object",properties:{act:{type:"string"},args:{type:"object"}},required:["act","args"]}},intent:{type:"string",description:"What the proposal is for, in words: 1 to 500 characters."}},required:["calls"],additionalProperties:!1},mutating:!0,annotations:{title:"Propose changes for review",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},de={type:"object",description:"A lens, as draft_view returns one.",properties:{title:{type:"string"},lens:{type:"string"},on:{type:"string"},bindings:{type:"object"},options:{type:"object"}},required:["title","lens","on"]},ce={name:"draft_view",title:"Draw a view",description:'Draw a view of the data from words ("a board of tasks by status", "who covers what") as a lens the app could keep; or check a lens you wrote (lens); or change the one on screen (current, with ask: "only this month"). Returns the lens and its add-lens edit, or one sentence saying why not. Writes nothing.',inputSchema:{type:"object",properties:{ask:{type:"string",description:"What to see, in words."},lens:de,current:de},additionalProperties:!1},mutating:!1,annotations:M("Draw a view")},ft={name:"keep_lens",title:"Keep a view as a lens",description:"Keep a lens draft_view drew as one of the app's places: checked again, then written as the add-lens edit. Returns the remove-lens edit that takes it back.",inputSchema:{...de,additionalProperties:!1},mutating:!0,annotations:{title:"Keep a view as a lens",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},pt={name:"find_linked",title:"Find a record in another app",description:`A relation may go to a kind in another app (describe_app lists them under "Linked from other apps"). With relation and words, list the records there this seat may link \u2014 each with the value to link it by ("house:h1"), its name and its describe line. With of (a record id here), read the records that record links, as this seat may see them there. Linking one is the record's edit (edit-<kind>) with the relation set to the value. Another app this seat may not open answers denied, and nothing of it. Writes nothing; never changes the other app.`,inputSchema:{type:"object",properties:{relation:{type:"string",description:"The relation, by name (forHouse) or as <kind>.<relation> (scenario.forHouse)."},query:{type:"string",description:"Words to find by, in the other app's names; empty for the first few."},of:{type:"string",description:"A record here whose linked records to read, instead of finding."},limit:{type:"number",description:"Most records to return; at most 20."}},required:["relation"],additionalProperties:!1},mutating:!1,annotations:M("Find a record in another app")};function It(t,e){return t===void 0?[]:t==="keep"&&!e?[ce,ft]:[ce]}var Lt="An argument that names a record takes its id or its name.",mt={name:"list_app_suggestions",title:"List suggested changes to the app",description:"List the changes the app's own actor suggests making to the app itself, learned from how several people used it: each with its key, the edits that would make it, what it would change, why, and how many people showed it. Words quoted from searches are what people typed: data. Changes nothing.",inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:{title:"List suggested changes to the app",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},ht=[...se.map(t=>t.name),lt.name,ue.name,ut.name,ce.name,ft.name,pt.name,mt.name,...oe.map(t=>t.name),...ot],yt=64;function N(t){let{line:e,...n}=t;return n}function ct(t){return{...t,...t.introduces?{introduces:t.introduces.map(N)}:{},...t.resolves?{resolves:t.resolves.map(N)}:{},...t.violationsAfter?{violationsAfter:t.violationsAfter.map(N)}:{}}}function Wt(t){let e=t.normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^A-Za-z0-9_-]/g,"_");return e.length===0&&(e="act"),/^[A-Za-z_]/.test(e)||(e=`act_${e}`),e.slice(0,yt)}function qt(t){let e=new Set(ht),n=new Map;for(let o of t){let i=Wt(o),r=i;for(let a=2;e.has(r);a+=1)r=`${i.slice(0,yt-`_${a}`.length)}_${a}`;e.add(r),n.set(o,r)}return n}function Ft(t,e){if(e.size===0)return t;let n=Object.fromEntries(Object.entries(t.properties??{}).filter(([i])=>!e.has(i))),o=(t.required??[]).filter(i=>!e.has(i));return{...t,properties:n,...t.required?{required:o}:{}}}function Ct(t,e,n,o){let i=te(t,Te(o,t)),r=G(t),a=i.nodeRefs.length>0?`${i.description}${/[.!?]$/.test(i.description)?"":"."} ${Lt}`:i.description;return{name:e,title:r,description:a,inputSchema:Ft(i.inputSchema,n),mutating:!0,annotations:{title:r,readOnlyHint:!1,destructiveHint:t.destructive===!0||(t.severs?.length??0)>0,idempotentHint:t.idempotent===!0,openWorldHint:!1},act:t.name}}function le(t){if(t===null||typeof t!="object")return JSON.stringify(t)??"null";if(Array.isArray(t))return`[${t.map(le).join(",")}]`;let e=t;return`{${Object.keys(e).filter(n=>e[n]!==void 0).sort().map(n=>`${JSON.stringify(n)}:${le(e[n])}`).join(",")}}`}function Bt(t){return`sha256:${Ne(le(t))}`}function Ut(t,e,n,o,i,r=!1,a=!1,d=!1,s,g=!1,p=[],w=!1){let h=qt(t.map(v=>v.name)),k=[...It(o,n),...r?[pt]:[],...a?oe:[],...g?[mt]:[]];return{definitions:n?[...se.filter(v=>!v.mutating),...k]:[...se,lt,...d?[ue]:[],...w?[ut]:[],...k,...p,...t.filter(v=>e.has(v.name)).map(v=>Ct(v,h.get(v.name),i(v),s))],names:h}}function jn(t,e={}){let n=e.author??{kind:"agent"},o=t.allMutations(),i=new Set(t.permittedMutations(n).map(m=>m.name)),{definitions:r,names:a}=Ut(o,i,e.readOnly===!0,e.drafts?e.drafts.keep?"keep":"draw":void 0,m=>X(t.schema,t.policy,n,m),jt(t.schema),e.subscriptions!==void 0,Me(n),t.schema,e.learned!==void 0,rt(e.workflows?.declared().map(m=>m.name)??[],e.workflows?e.workflows.edit?"manage":"run":void 0),Le(t.policy,n,o).length>0),d=Bt(r),s={app:e.app?.brand?.locale,appTimeZone:e.app?.brand?.timeZone},g=m=>pe(s,m),p=m=>{if(!ht.includes(m)){for(let[u,b]of a)if(b===m)return u;return a.has(m)?m:xe(m,a.keys())}},w=m=>{let u=Pe(m,a.keys());return u?` Did you mean "${u}"?`:""},h=m=>{let u=r.find(S=>S.name===m)??r.find(S=>S.act===m);if(u)return u;let b=p(m);return b===void 0?void 0:r.find(S=>S.act===b)},k=(m,u)=>{let b=o.find(l=>l.name===m);if(!b)return{args:u,resolved:[]};let S={...u},c=[];for(let l of C(b.input)){let f=S[l.name];if(typeof f!="string"||f.trim()==="")continue;let y=t.resolveRef(l,f,n);if(!y.ok){let O=y.reason==="none"?` Nothing was changed. Use search_graph to look it up, then pass its id as ${l.name}.`:" Nothing was changed.";return{ok:!1,error:`${y.message}${O}`,argument:l.name,candidates:y.candidates}}y.by!=="id"&&(S[l.name]=y.id,c.push({argument:l.name,given:f,id:y.id,label:y.label}))}return{args:S,resolved:c}},R=async(m,u)=>{try{await Dt();let b=h(m);if(!b&&m===ue.name)return{ok:!1,error:"Only the app's own actor (automated: true) suggests changes.",reason:"forbidden"};if(!b){let c=p(m);if(c){let l=t.permits({name:c,args:u},n);if(!l.ok)return{ok:!1,error:l.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${m}".${w(m)} Available: ${r.map(l=>l.name).join(", ")}`}}if(b.mutating&&e.readOnly)return{ok:!1,error:`"${m}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(b.act!==void 0){let c=k(b.act,u);if("ok"in c)return c;let l=b.act,f=g(()=>j(t,n,t.apply({name:l,args:c.args},{...e.author?{author:e.author}:{},...V(e.via)})));return{ok:!0,data:{batch:f.batch,intent:f.intent,introduces:f.introduces.map(N),resolves:f.resolves.map(N),...c.resolved.length>0?{resolved:c.resolved}:{}},diff:f.diff}}let S=t.seenBy(n);switch(b.name){case"search_graph":{let c=typeof e.places=="function"?e.places():e.places,l=typeof u.subject=="string"?u.subject:void 0,f=qe(S,String(u.query??""),{principal:n,rank:e.near,archived:Se(u.archived),limit:typeof u.limit=="number"&&u.limit>0?Math.min(u.limit,20):20,...c?{places:c}:{},...l?{subject:l,from:[l]}:{}}),y=f.later?await f.later:f;return{ok:!0,data:(await W()).searchRead(y,et(y,U(S,n))),reads:y.hits.flatMap(O=>O.about==="node"?[O.id]:[])}}case"get_graph":return{ok:!0,...(await W()).graphRead(S,U(S,n),u)};case"get_node":{let c=String(u.id??""),l=c,f;if(!S.graph.getNode(c)){let O=c.trim()===""?void 0:t.resolveRef({name:"id",kinds:["*"]},c,n);if(O?.ok)l=O.id,f={argument:"id",given:c,id:l,label:O.label};else return O?.reason==="ambiguous"?{ok:!1,error:O.message,argument:"id",candidates:O.candidates}:{ok:!1,error:`No node "${c}".`}}let y=(await W()).nodeRead(S,U(S,n),l,u);return{ok:!0,data:f?{...y.data,resolved:[f]}:y.data,reads:y.reads}}case"describe_place":{let c=e.app??{name:"",schema:t.schema},l=typeof u.width=="number"&&Number.isFinite(u.width)&&u.width>0?u.width:1440,{describePlace:f}=await Nt(),y=f(t,n,String(u.place??""),{app:c,width:l});if(!y.ok)return{ok:!1,error:`${y.error} The places are: ${y.places.join(", ")}.`};let O=new Set,P=I=>{for(let D of I)for(let x of D.groups??[])for(let $ of x.items)O.add($.id),P($.parts)};return P(y.description.parts),{ok:!0,data:y.description,reads:[...O]}}case"find_linked":return zt(S,n,u,e.linked);case"draft_view":case"keep_lens":{let c=e.app??{name:"",schema:t.schema};return(await Jt()).runDraftTool(b.name,u,{app:c,principal:n,...e.drafts?{drafts:e.drafts}:{}})}case"get_violations":{let c=S.violations(u.context);return{ok:!0,...(await W()).violationsRead(c,u)}}case"get_affordances":{let c=u.selection??[];return{ok:!0,data:We(S,c,{...typeof e.derive=="function"?e.derive():e.derive,...e.author?{principal:e.author}:{},...u.context?{context:u.context}:{}}),reads:c.filter(f=>S.graph.has(f))}}case"preview_mutation":{let c=String(u.mutation),l=p(c)??c,f=k(l,u.args??{});if("ok"in f)return f;let y=t.missingFor({name:l,args:f.args},n);if(y)return{ok:!1,error:y.message,reason:"missing"};let O=j(t,n,t.preview({name:l,args:f.args},void 0,{author:n})),P=ct(O);return{ok:!0,data:f.resolved.length>0?{...P,resolved:f.resolved}:P}}case"act_on_several":{let c=String(u.act??""),l=p(c)??c,f=o.find(_=>_.name===l);if(!f||!i.has(l)){let _=f?t.permits({name:l,args:{}},n):void 0;return _&&!_.ok?{ok:!1,error:_.refusal.message,reason:"forbidden"}:{ok:!1,error:`There is no act "${c}" this seat may run.${w(c)} Nothing was changed.`,reason:"invalid"}}let y=f.subject;if(!y)return{ok:!1,error:`"${G(f)}" does not act on a record, so it cannot be run on several. Nothing was changed.`,reason:"invalid"};let O=Array.isArray(u.records)?u.records.filter(_=>typeof _=="string"&&_.trim()!==""):[];if(O.length===0)return{ok:!1,error:"Name at least one record. Nothing was changed.",reason:"invalid"};let P=[],I=[];for(let _ of O.slice(0,200)){let J=t.resolveRef({name:y.arg,kinds:y.kinds},_,n);if(!J.ok)return{ok:!1,error:`${J.message} Nothing was changed.`,argument:"records",candidates:J.candidates};P.push(J.id),J.by!=="id"&&I.push({argument:"records",given:_,id:J.id,label:J.label})}let D=k(l,{...u.args??{}});if("ok"in D)return D;let x=(await Et()).actOnSeveral(t,{mutation:l,subject:y.arg,args:D.args},P,{author:n,...V(e.via)}),$=x.result?j(t,n,x.result):void 0;return{ok:!0,data:{...x.batch?{batch:x.batch,intent:x.intent}:{},applied:x.applied,unchanged:x.unchanged,refused:x.refused.map(_=>({record:_.id,label:_.label,error:_.message,reason:_.reason})),...x.allOrNothing?{keptNone:!0}:{},...$?{introduces:$.introduces.map(N),resolves:$.resolves.map(N)}:{},...I.length>0||D.resolved.length>0?{resolved:[...I,...D.resolved]}:{}},...$?{diff:$.diff}:{}}}case"subscribe":case"unsubscribe":case"list_subscriptions":{let c=await(await Ht()).runSubscriptionTool(b.name,u,{store:t,principal:e.subscriber??n,app:e.app?.name??"app",subscriptions:e.subscriptions});return c.ok?{ok:!0,data:c.data}:{ok:!1,error:c.error}}case"run_workflow":case"pause_workflow":case"resume_workflow":{let c=await at(b.name,u,{principal:n,workflows:e.workflows});return c.ok?{ok:!0,data:c.data}:{ok:!1,error:c.error,...c.reason?{reason:c.reason}:{}}}case"list_app_suggestions":return{ok:!0,data:{suggestions:(await e.learned()).map(({key:l,said:f,why:y,edits:O,evidence:P})=>({key:l,said:f,why:y,edits:O,evidence:P}))}};case"list_suggestions":{let c=Ee(t,n).map(l=>{let f=F(l.author,{graph:S.graph,schema:t.schema});return{id:l.id,intent:l.intent,by:f,at:l.at,about:l.about,tally:l.tally,...ze(l)?{proposedBy:l.lineage.proposedBy}:{},...l.lineage?{basis:{untrusted:!0,authoredBy:f,text:l.lineage.basis},...l.lineage.confidence!==void 0?{confidence:l.lineage.confidence}:{}}:{}}});return{ok:!0,data:{suggestions:c},reads:[...new Set(c.flatMap(l=>l.about))]}}case"suggest_changes":{let c=u.calls.map(f=>({name:p(f.act)??f.act,args:f.args}));return{ok:!0,data:{suggestion:Je(t,c,{author:n,lineage:{basis:u.basis,confidence:u.confidence},...V(e.via)})?.id??null}}}case"propose_changes":{let c=(u.calls??[]).map(y=>({name:p(y.act)??y.act,args:y.args??{}})),l=typeof u.intent=="string"&&u.intent.trim()!==""?u.intent.trim():void 0,f=Ie(t,n,c,l);return{ok:!0,data:{proposal:f?.id??null,...f?{intent:f.intent}:{}}}}case"accept_suggestion":case"decline_suggestion":{let c=String(u.suggestion??""),l={author:n,...V(e.via)},f=b.name==="accept_suggestion"?He(t,c,l):je(t,c,l),y=j(t,n,f);return{ok:!0,data:{batch:y.batch,intent:y.intent,...f.voted?{voted:f.voted}:{},introduces:y.introduces.map(N),resolves:y.resolves.map(N)},diff:y.diff}}case"undo_batch":{let c=String(u.batch),l=u.include??[],f=S.canUndo([c,...l]);if(!f.ok)return{ok:!1,error:f.message};let y=j(t,n,t.undo([c,...l],{...e.author?{author:e.author}:{}}));return{ok:!0,data:ct(y),diff:y.diff}}default:return{ok:!1,error:`Unknown tool "${m}".`}}}catch(b){let{reason:S,wouldNeed:c}=ve(b);return{ok:!1,error:b instanceof Error?b.message:String(b),reason:S,...c?{wouldNeed:c}:{}}}},v=new Set,A=m=>{for(let u of v)u(m)};return{definitions:r,hash:d,...e.author?{author:e.author}:{},onDiff(m){return t.subscribe(m)},onCall(m){return v.add(m),()=>v.delete(m)},async call(m,u){let b=h(m)?.mutating??!1,S={name:m,args:u,mutating:b,at:new Date().toISOString()};A({...S,phase:"running"});let c=f=>(A(f.ok?{...S,phase:"ok",...!b&&f.reads?{reads:f.reads}:{}}:{...S,phase:"failed",error:f.error}),f),l=await R(m,u);return c(l.ok&&!b?{...l,data:(await W()).withinReadChars(m,l.data)}:l)}}}function V(t){let e=typeof t=="function"?t():t;return e?{via:e}:{}}export{le as a,jn as b};
@@ -1 +0,0 @@
1
- import"./chunk.GZHZLJBF.js";import{o as P}from"./chunk.3SAESG6X.js";import"./chunk.OJGHDWI6.js";import"./chunk.F6BNFLQM.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{G as A,V as S,ea as b}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import{Ia as w,rd as x,va as L}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";var u=R(A(),1);var n=R(S(),1),C={kind:"human"},p={color:"var(--graview-ink-muted)"};function I(e){if(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}return L(e)?e:void 0}}function z(e){let o=b(),t=o?.linkedReads,[i,a]=(0,u.useState)(()=>t?t.answered(e)??"asking":null);return(0,u.useEffect)(()=>{if(!t){a(o?.linkedRecords?"asking":null);return}let d=t.answered(e);if(a(d===void 0?"asking":d),d!==void 0)return;let s=!0;return t.ask(e).then(l=>s&&a(l)),()=>{s=!1}},[t,o?.linkedRecords,e.address,e.kind,e.id]),i}function V({reference:e,as:o}){let t=b(),i=z(e),a={position:"relative",zIndex:x.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%"};if(i==="asking")return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"asking","aria-busy":"true",style:{...p,...a},children:"Linked record"});if(i&&"denied"in i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"denied",style:{...p,fontStyle:"italic",...a},children:"linked record (no access)"});if(!i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"missing",style:{...p,fontStyle:"italic",...a},children:"linked record (not found)"});let d=I(i.href),s=t?.linkedRecords,l=t?.principal??C,g=s?.open?c=>{c.metaKey||c.ctrlKey||(c.preventDefault(),s.open(e,l))}:void 0,k=(0,n.jsx)("a",{"data-graview-linked-title":"",...d?{href:d}:{role:"link",tabIndex:0},...g?{onClick:g,onKeyDown:c=>!d&&(c.key==="Enter"||c.key===" ")?g(c):void 0}:{},style:{fontWeight:600,color:"inherit",textUnderlineOffset:3,cursor:d||g?"pointer":"default"},children:i.label});return o==="chip"?(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"found",title:i.describe,style:{display:"inline-flex",alignItems:"center",minHeight:24,...a},children:k}):(0,n.jsx)(D,{record:i,title:k,base:a})}function D({record:e,title:o,base:t}){return(0,n.jsxs)("span",{"data-graview-linked":"","data-graview-linked-state":"found",style:{display:"grid",gap:2,padding:"8px 10px",border:"1px solid var(--graview-line)",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-surface)",...t},children:[(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"2px 8px"},children:[o,e.app?(0,n.jsxs)("span",{"data-graview-linked-app":"",style:{...p,fontSize:"0.75rem"},children:["in ",e.app]}):null]}),e.describe?(0,n.jsx)("span",{"data-graview-linked-describe":"",style:{...p,fontSize:"0.8125rem"},children:e.describe}):null,e.card&&e.card.length>0?(0,n.jsx)("span",{"data-graview-linked-card":"",style:{display:"flex",flexWrap:"wrap",gap:"2px 12px",fontSize:"0.8125rem"},children:e.card.map(i=>(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{style:p,children:i.label})," ",i.text]},i.label))}):null]})}function H({relation:e,refs:o,as:t="record",nodeId:i,field:a,style:d}){let s=(0,n.jsx)("span",{"data-graview-linked-list":"",style:{display:"grid",gap:6,minWidth:0,...d},children:o.map(l=>(0,n.jsx)(V,{reference:l,as:t},w(l)))});return i&&a?(0,n.jsx)(K,{nodeId:i,field:a,relation:e,refs:o,drawn:s}):s}function K({nodeId:e,field:o,relation:t,refs:i,drawn:a}){let{fields:d,commit:s}=P(e),l=d.find(f=>f.field===o),[g,k]=(0,u.useState)(!1);if(!l)return a;let c=t.cardinality==="one"?i[0]?w(i[0]):void 0:i.map(w);return(0,n.jsxs)("span",{style:{display:"grid",gap:6,minWidth:0},children:[a,g?(0,n.jsx)(N,{relation:t,value:c,label:"Link another record",onChange:f=>{s(l,f),k(!1)},onCancel:()=>k(!1)}):(0,n.jsx)("button",{type:"button","data-graview-linked-change":"",onClick:()=>k(!0),style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-accent)",cursor:"pointer",minHeight:24},children:"Change"})]})}function N({relation:e,value:o,onChange:t,onCancel:i,label:a}){let d=b(),s=d?.linkedRecords,l=d?.principal??C,g=(0,u.useId)(),[k,c]=(0,u.useState)(""),[f,m]=(0,u.useState)("asking");(0,u.useEffect)(()=>{if(!s)return;let r=!0;m("asking");let y=setTimeout(()=>{Promise.resolve().then(()=>s.find({address:e.address,kinds:e.kinds,query:k,limit:20},l)).then(h=>r&&m(Array.isArray(h)?h:"denied"),()=>r&&m([]))},150);return()=>{r=!1,clearTimeout(y)}},[s,e.address,e.kinds.join(","),k,l.kind,l.id]);let v=new Set([o].flat().filter(r=>typeof r=="string")),W=r=>{let y=w(r);if(e.cardinality==="one")return t(y);t(v.has(y)?[...v].filter(h=>h!==y):[...v,y])};return s?(0,n.jsxs)("span",{"data-graview-linked-picker":"",style:{display:"grid",gap:6,minWidth:0},children:[(0,n.jsx)("label",{htmlFor:g,style:{...p,fontSize:"0.8125rem"},children:a}),(0,n.jsx)("input",{id:g,type:"search",value:k,placeholder:`Find one in ${e.address}`,onChange:r=>c(r.target.value),style:{font:"inherit",minHeight:32,padding:"4px 8px",border:"1px solid var(--graview-line)",borderRadius:6,background:"var(--graview-surface)",color:"inherit",minWidth:0}}),f==="asking"?(0,n.jsx)("span",{"aria-busy":"true",style:p,children:"Looking\u2026"}):f==="denied"?(0,n.jsx)("span",{"data-graview-linked-state":"denied",style:{...p,fontStyle:"italic"},children:"linked record (no access)"}):f.length===0?(0,n.jsx)("span",{style:p,children:"Nothing there matches."}):(0,n.jsx)("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:4},children:f.map(r=>{let y=v.has(w(r));return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-graview-linked-candidate":w(r),"aria-pressed":y,onClick:()=>W(r),style:{display:"grid",gap:2,width:"100%",textAlign:"start",font:"inherit",padding:"6px 8px",minHeight:32,border:"1px solid var(--graview-line)",borderRadius:6,background:y?"var(--graview-accent-soft, var(--graview-surface))":"var(--graview-surface)",color:"inherit",cursor:"pointer"},children:[(0,n.jsx)("span",{style:{fontWeight:600},children:r.label}),r.describe?(0,n.jsx)("span",{style:{...p,fontSize:"0.8125rem"},children:r.describe}):null]})},w(r))})}),i?(0,n.jsx)("button",{type:"button",onClick:i,style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-ink-muted)",cursor:"pointer",minHeight:24},children:"Keep it as it is"}):null]}):(0,n.jsxs)("span",{"data-graview-linked-picker":"","data-graview-linked-state":"no-host",style:p,children:["This page cannot read ",e.address,", so nothing there can be linked here."]})}var T=e=>(0,n.jsx)(H,{...e}),U=e=>(0,n.jsx)(N,{...e});export{N as LinkedPicker,H as LinkedRecordView,U as drawLinkedPicker,T as drawLinkedRecord};
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{d as be,f as ke}from"./chunk.Z26T5E76.js";import{e as wt}from"./chunk.77JI5T4F.js";import{a as yt,b as vt}from"./chunk.4DZOAB4D.js";import{h as ft}from"./chunk.UDU545CL.js";import{a as ie,b as it}from"./chunk.2VYGDY5Z.js";import{b as we,c as J,d as Y,e as st,f as lt}from"./chunk.FUPYIOXZ.js";import{a as bt,d as kt,f as xt}from"./chunk.APRWUIE3.js";import{a as Se,b as ht}from"./chunk.3OEODIHB.js";import{a as Ce,b as St}from"./chunk.WFCE7NLK.js";import{d as dt,e as re,f as j,g as ct,h as ye,i as gt,l as ut,n as oe}from"./chunk.ZA5TDCBC.js";import{j as pt,p as ve}from"./chunk.3SAESG6X.js";import{c as mt}from"./chunk.F6BNFLQM.js";import{c as ot,d as Pe}from"./chunk.5IEZF433.js";import{c as rt}from"./chunk.5AD2QHWH.js";import{G as U,Ka as fe,Ma as at,Oa as Ne,Pa as X,Qa as Re,V as W,Y as et,ca as tt,da as V,fa as pe,j as Ue,l as Xe,m as Je,oa as nt,pa as _,qa as me,r as ae,v as Ye,xa as he,y as Ze,z as Qe}from"./chunk.VLX7YWVH.js";import{a as ue}from"./chunk.SDO3U72B.js";import{Qc as ne,Z as ee,ga as te,la as A,nd as qe,ta as H,ub as je}from"./chunk.IQGSEAQ2.js";import{b as M}from"./chunk.AJZBJBMO.js";var f=M(U(),1);var Nt=M(U(),1);function Rt(e){(0,Nt.useLayoutEffect)(()=>{let n=e.current,t=n?.parentElement;if(!n||!t)return;let a=n.style.bottom,o=()=>{let l=t.querySelector(jt);if(!l){n.style.bottom=a;return}let u=t.getBoundingClientRect(),m=l.getBoundingClientRect(),g=u.height>0?t.offsetHeight/u.height:1;n.style.bottom=`${Math.max(0,Math.round((u.bottom-m.top)*g))}px`};if(o(),typeof ResizeObserver>"u")return;let s=new ResizeObserver(o);return s.observe(t),()=>s.disconnect()},[e])}var jt=".graview-spec-listing";var Ae=M(U(),1);var P=M(U(),1);var Pt=M(U(),1);var B=M(W(),1);function Ct({id:e,max:n=8,empty:t,hide:a}){let{store:o}=V();pe();let s=Ut(o,e,X()),[l,u]=(0,Pt.useState)(()=>new Set),m=a?s.flatMap(g=>{let w=g.ids.filter(r=>!a.has(r));return w.length>0?[{...g,ids:w}]:[]}):s;return m.length===0?t&&s.length===0?(0,B.jsx)("p",{style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-faint)"},children:t}):null:(0,B.jsx)("div",{"data-graview-primitive":"connections",style:{display:"flex",flexDirection:"column",gap:12},children:m.map(g=>{let w=l.has(g.key),r=g.ids.length>n,c=w?g.ids:g.ids.slice(0,n),y=g.ids.length-Math.min(n,g.ids.length),S=`graview-more-${e}-${g.key}`.replace(/[^A-Za-z0-9_-]/g,"-");return(0,B.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,B.jsx)("h2",{...g.said?{"aria-label":g.said}:{},style:{margin:0,fontSize:"0.75rem",fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:g.label}),(0,B.jsxs)("div",{id:S,style:{display:"flex",flexWrap:"wrap",gap:6},children:[c.map(h=>{let b=o.graph.getNode(h);return b?(0,B.jsx)(Y,{pickId:h,hue:ne(b.kind),title:`Go to the ${H(o.schema.tryDefinition(b.kind),b.kind)}`,label:A(o.schema.tryDefinition(b.kind),b)},h):null}),r?(0,B.jsx)("button",{type:"button","data-graview-more":g.key,"aria-expanded":w,"aria-controls":S,...w?{}:{"aria-label":`${y} more: ${g.said??g.label}`},onClick:h=>{h.stopPropagation(),u(b=>{let k=new Set(b);return k.has(g.key)?k.delete(g.key):k.add(g.key),k})},style:qt,children:w?"Show fewer":`+${y} more`}):null]})]},g.key)})})}var qt={display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,border:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",color:"var(--graview-accent)",font:"inherit",fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",cursor:"pointer"};function Ut(e,n,t=[]){let a=e.graph.getNode(n);if(!a)return[];let o=new Map,s=[];for(let l of t)if(l.subjectId===n)for(let u of l.nodeIds)u!==n&&!s.includes(u)&&e.graph.has(u)&&s.push(u);s.length>0&&o.set("judges",{key:"judges",label:"what it finds wrong",ids:s});for(let l of e.graph.allEdges()){let u=l.from===n?l.to:l.to===n?l.from:null;if(u===null||u===n)continue;let m=e.graph.getNode(u);if(!m)continue;let g=l.from===n?"out":"in",w=g==="out"?a.kind:m.kind,r=Xt(e.schema,w,l.kind,g),c=`${l.kind}:${g}:${r.label}`,y=o.get(c)??{key:c,...r,ids:[]};y.ids.includes(u)||y.ids.push(u),o.set(c,y)}for(let l of o.values())l.ids.sort();return[...o.values()].sort((l,u)=>l.key<u.key?-1:l.key>u.key?1:0)}function Xt(e,n,t,a){let o=rt(e,n,t,a),s=te(t).toLowerCase();return o.trim().toLowerCase()!==s?{label:o}:a==="out"?{label:`\u2192 ${s}`,said:s}:{label:`\u2190 ${s}`,said:`${s}, pointing here`}}var $t=M(U(),1),se=(0,$t.createContext)(null);var d=M(W(),1),Jt=fe(ue(()=>(__graviewPreload(import.meta.url,["./chunk.SADHOSRC.js","./chunk.4DZOAB4D.js","./chunk.UDU545CL.js","./chunk.7VAHHEDX.js","./chunk.75JQCTR6.js","./chunk.5IEZF433.js","./chunk.5AD2QHWH.js","./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VT4YBFZL.js")))).part((e,n)=>(0,d.jsx)(e.ArrangeBar,{...n}),{what:"Arranging this list"}),Yt=fe(ue(()=>(__graviewPreload(import.meta.url,["./chunk.FN34P4IS.js","./chunk.2DH42I7L.js","./chunk.VZAF3452.js","./chunk.WHX47OJM.js","./chunk.2D7K2IJQ.js","./chunk.QRT6BZR6.js","./chunk.2V7QTIAV.js","./chunk.Z26T5E76.js","./chunk.77JI5T4F.js","./chunk.SADHOSRC.js","./chunk.4DZOAB4D.js","./chunk.UDU545CL.js","./chunk.7VAHHEDX.js","./chunk.HJCQ6I3S.js","./chunk.DQAMVVE6.js","./chunk.OXFDB5BB.js","./chunk.DJIF7IAQ.js","./chunk.LTOQ22ZJ.js","./chunk.2TCOLAL2.js","./chunk.2VYGDY5Z.js","./chunk.FUPYIOXZ.js","./chunk.APRWUIE3.js","./chunk.3OEODIHB.js","./chunk.WFCE7NLK.js","./chunk.REXU6ARY.js","./chunk.G4JJXA63.js","./chunk.BIDL7GQD.js","./chunk.TA2JTUNX.js","./chunk.HZPRMHSL.js","./chunk.TQ2G4AM4.js","./chunk.X36BYTEG.js","./chunk.LDMBJC3B.js","./chunk.XOZU4OFA.js","./chunk.G7YLK4PX.js","./chunk.Q5WEOX3Q.js","./chunk.2E62YCMZ.js","./chunk.DUP2CGVH.js","./chunk.YEXFVDRA.js","./chunk.WVUJXDXZ.js","./chunk.ZA5TDCBC.js","./chunk.2JEN2RCB.js","./chunk.7CLKGKSF.js","./chunk.TMHVYI5R.js","./chunk.R5MLRKAO.js","./chunk.YMXWS4XN.js","./chunk.GZHZLJBF.js","./chunk.3SAESG6X.js","./chunk.OJGHDWI6.js","./chunk.F6BNFLQM.js","./chunk.75JQCTR6.js","./chunk.5IEZF433.js","./chunk.5AD2QHWH.js","./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.3RD4JHVG.js")))).part((e,n)=>(0,d.jsx)(e.KindStop,{...n}),{what:"This list"});function $e(e){let{brand:n}=V();return ne(e,n?.accents)}function Zt(e,n){if(!n.endsWith("\u2026")&&!n.endsWith("..."))return;let t=n.replace(/[…]|\.\.\.$/g,"").trim();if(!(t.length<12)){for(let a of Object.values(e))if(typeof a=="string"&&a.length>t.length&&a.startsWith(t))return a}}function Qt(e,n){let a=Math.max(0,...e.slice(0,n*2).map(s=>s.length))*7.5+28<=212/2?2:1,o=n*a;return{columns:a,shown:Math.min(e.length,o)}}var en=8,At=500,tn=12;function Lt(e){return{x:e.clientX,y:e.clientY,pointerType:e.pointerType??""}}function nn(e,n,t){let a=performance.now()+At,o=["pointerdown","pointerup","mousedown","mouseup","dblclick"],s=r=>{if(performance.now()>a||!(r instanceof MouseEvent))return!1;let c=Lt(r);return n.pointerType&&c.pointerType&&n.pointerType!==c.pointerType?!1:Math.hypot(c.x-n.x,c.y-n.y)<=tn},l=r=>{if(!s(r))return g();r.stopPropagation()},u=r=>{if(!s(r))return g();r.stopPropagation(),r.preventDefault(),e.removeEventListener("click",u,!0),setTimeout(g,50),t()},m=!1,g=()=>{if(!m){m=!0,clearTimeout(w),e.removeEventListener("click",u,!0);for(let r of o)e.removeEventListener(r,l,!0)}};for(let r of o)e.addEventListener(r,l,!0);e.addEventListener("click",u,!0);let w=setTimeout(g,At)}function an({View:e,members:n,mode:t,flagged:a}){let{isSelected:o}=Ne(),s=n.slice(0,en);return(0,d.jsxs)("div",{"data-graview-rows":"",style:{display:"grid",gap:4,minWidth:0},children:[s.map(l=>(0,d.jsx)("div",{"data-graview-pick":l.id,style:{minWidth:0,cursor:"pointer"},children:(0,d.jsx)(e,{node:l,cardinality:"one",fidelity:"glyph",mode:t,selected:o(l.id),...a?.includes(l.id)?{flagged:[l.id]}:{}})},l.id)),n.length>s.length?(0,d.jsx)(Y,{label:`+${n.length-s.length} more`}):null]})}var rn=11/15,on=fe(ue(()=>(__graviewPreload(import.meta.url,["./chunk.75JQCTR6.js","./chunk.5IEZF433.js","./chunk.5AD2QHWH.js","./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.FXRYMT3U.js")))).part((e,n)=>(0,d.jsx)(e.StatesBar,{...n}),{quiet:!0});function sn({text:e,accent:n}){let t=(0,P.useRef)(null),a=(0,P.useRef)(null),[o,s]=(0,P.useState)(1),[l,u]=(0,P.useState)(!1),m=o<1?`${o}em`:void 0;return(0,P.useLayoutEffect)(()=>{let g=t.current,w=a.current;if(!g||!w)return;let r=()=>{let y=g.clientWidth,S=w.offsetWidth;if(y<=0||S<=0)return;let h=parseFloat(getComputedStyle(w).fontSize)/parseFloat(getComputedStyle(g).fontSize)||1,b=S/h,k=Math.max(rn,Math.min(1,Math.floor(y/b*100)/100));s(N=>Math.abs(N-k)<.01?N:k),u(b*k>y+.5)};if(r(),typeof ResizeObserver>"u")return;let c=new ResizeObserver(r);return c.observe(g),()=>c.disconnect()},[e]),(0,d.jsx)("span",{ref:t,"data-graview-district-name":"",...o<1?{"data-graview-fitted":""}:{},...l?{title:e}:{},style:{display:"block",minWidth:0,fontSize:"0.9375rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,d.jsx)("span",{ref:a,style:{fontSize:m},children:e})})}function Vt(e,n){return!!e?.display?.page?.groups?.length||Pe(n,e).some(t=>t.long)}function Mt(e,n=he(e)){for(let t of e.kinds){let a=e.tryDefinition(t),o=a?.plural??`${String(t)}s`,s=r=>{let c=r.node,y=X(),S=(0,P.useContext)(se);if(!c)return null;let h=S?.nodeId===c.id?S:null,b=A(a,c),k=r.mode==="fullscreen"?Zt(c,b)??b:b,N=je(y,[c.id]);return(0,d.jsxs)(J,{title:(0,d.jsx)(xt,{nodeId:c.id,children:h?.title??k}),...h?{}:{subtitle:a?.describe?ot(a,c):a?.description??String(t)},selected:r.selected,...r.flagged?.includes(c.id)?{tone:"warning"}:{},fit:!0,children:[h?(0,d.jsx)(se.Provider,{value:null,children:h.body}):null,(0,d.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"22px 34px",alignItems:"flex-start"},children:[(0,d.jsx)("div",{style:{flex:Vt(a,c)?"1 1 100%":"1 1 0",minWidth:"min(200px, 100%)"},children:(0,d.jsx)(kt,{id:c.id,shown:[k,b,a?.description,h?.title],...h?{hide:[...h.fields]}:{}})}),(0,d.jsx)("div",{style:{flex:Vt(a,c)?"1 1 100%":"1.4 1 0",minWidth:"min(220px, 100%)"},children:(0,d.jsx)(Ct,{id:c.id,empty:`Nothing is connected to this ${H(a,String(t))} yet.`,...h?{hide:h.records}:{}})})]}),N.length>0?(0,d.jsx)("p",{"data-graview-broken":"",style:{margin:"14px 0 0",paddingTop:12,borderTop:"1px solid var(--graview-edge)",fontSize:"0.875rem",color:"var(--graview-warn)"},children:N.map(v=>v.message).join(" \xB7 ")}):null]})},l=r=>{let c=r.node;if(!c)return null;let{store:y}=V(),S=a?.computed?ut(y.schema,y.graph,c):c,h=Pe(S,a,{limit:3,said:[A(a,c)],glance:!0}),b=$e(t),k=h.filter(x=>!x.long&&!x.markdown),N=h.find(x=>x.long||x.markdown),v=dt(c,a);return(0,d.jsxs)(J,{title:A(a,c),selected:r.selected,tone:r.flagged?.includes(c.id)?"warning":"muted",fit:!0,children:[v?(0,d.jsx)(Se,{as:"thumb",file:v,size:64,style:{marginBottom:6}}):null,(0,d.jsx)(st,{items:k.map(x=>({id:x.key,label:x.alone,hue:b})),max:3}),N?(0,d.jsx)("p",{"data-graview-excerpt":N.key,title:N.value,style:{margin:k.length>0?"6px 0 0":0,fontSize:"0.8125rem",lineHeight:1.35,color:"var(--graview-ink-muted)",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:N.value}):null]})},u=r=>{let c=r.node,y=$e(t),S=ve().marks.flag;if(!c)return null;let h=r.flagged?.includes(c.id)??!1;return(0,d.jsx)(Y,{label:h?`${A(a,c)} ${S}`:A(a,c),hue:y,selected:r.selected,title:h?`${te(H(a,String(t)))} \u2014 implicated in a problem`:te(H(a,String(t)))})},m=r=>r.fidelity==="full"?(0,d.jsx)(P.Suspense,{fallback:(0,d.jsx)(g,{...r}),children:(0,d.jsx)(Yt,{kind:String(t),members:r.nodes??[],...r.flagged?{flagged:r.flagged}:{},...r.label?{label:r.label}:{},...r.retired?{retired:r.retired}:{}})}):(0,d.jsx)(g,{...r}),g=r=>{let{brand:c,store:y,views:S}=V(),{view:h,go:b}=Re(),k=r.nodes??[],N=S.lookup(String(t),{cardinality:"one",fidelity:"glyph"}),v=N!==void 0&&!me(N)?N:void 0,x=yt(h),C=ft(k,x,{schema:e,graph:y.graph,flagged:new Set(r.flagged??[])}),E=R=>({id:R.id,label:A(e.tryDefinition(R.kind),R),hue:ne(R.kind,c?.accents)}),I=r.fidelity==="full"&&k.length>1?(0,d.jsx)(P.Suspense,{fallback:null,children:(0,d.jsx)(Jt,{schema:e,graph:y.graph,kind:String(t),arrangement:x,onChange:R=>b(vt(h,R)),kept:{shown:C.nodes.length,of:k.length},style:{marginBottom:8}})}):null,le=R=>R.some($=>r.flagged?.includes($.id)),de=X(),Z=ve().marks.flag,z=(R,$,ce)=>v?(0,d.jsx)(J,{title:R,meta:(0,d.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,d.jsx)(ke,{kind:String(t),plural:o,problems:be(de,$),flag:Z}),(0,d.jsx)("span",{title:`${ee($.length)} ${$.length===1?H(a,String(t)):o.toLowerCase()}`,children:ee($.length)})]}),tone:le($)?"warning":"muted",children:(0,d.jsx)(an,{View:v,members:$,mode:r.mode,...r.flagged?{flagged:r.flagged}:{}})},ce):(0,d.jsx)(lt,{label:R,count:$.length,flagged:le($),items:$.map(E),problems:(0,d.jsx)(ke,{kind:String(t),plural:o,problems:be(de,$),flag:Z})},ce);return C.grouped?(0,d.jsxs)("div",{style:{display:"grid",gap:8},"data-graview-grouped":x.group?.by,children:[I,C.groups.map(R=>z(`${r.label??o} \xB7 ${R.label}`,R.nodes,R.key||"-"))]}):(0,d.jsxs)("div",{style:{display:"grid",gap:4},children:[I,z(r.label??o,C.nodes)]})},w=r=>{let c=r.nodes??[],y=Qt(c.map(p=>A(a,p)),r.openedRows??pt(c.length)),S=$e(t),{brand:h}=V(),b=it(String(t),e,h),k=ve().marks.flag,{selection:N,set:v,clear:x}=Ne(),{toggle:C,view:E,go:I}=Re(),{views:le,hiddenKinds:de}=V(),Z=(0,P.useContext)(nt),z=E.overview&&!de.has(String(t))?le.places().filter(p=>p.kind===String(t)):[],R=r.focused?E.within?.view??z[0]?.as:void 0,$=c.filter(p=>r.flagged?.includes(p.id)).length,ce=$>0,zt=X(),Ft=be(zt,c),F=(E.overview??!1)&&r.nestedUnder===void 0,G=r.focused||r.raised,Ie=r.rank==="secondary"&&!G,L=r.nestedUnder!==void 0,ze=new Set(N),K=Z?N.length===1&&N[0]===ae(String(t)):r.opened??!1,Kt=mt(),O=G||F?0:c.filter(p=>Kt.includes(p.id)&&!ze.has(p.id)).length,xe=O>0&&!ce,ge=tt(),q=ge&&!L?ge.byKind[String(t)]??0:0,Fe=(0,P.useRef)(null),Ke=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>{let p=Ke.current,T=Fe.current;if(!p||!T||!F)return;let D=()=>T.style.setProperty("--graview-plate-h",`${p.offsetHeight}px`);if(D(),typeof ResizeObserver>"u")return;let Q=new ResizeObserver(D);return Q.observe(p,{box:"border-box"}),()=>Q.disconnect()},[F]);let _t=L?8:Math.min(46,10+Math.round(Math.sqrt(c.length)*8)),_e=L?(0,d.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:G?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r.label??o}):(0,d.jsx)(sn,{text:r.label??o,accent:!!G});return(0,d.jsxs)("div",{ref:Fe,className:"graview-kind-card","data-graview-rank":r.rank,"data-graview-landmark":b||void 0,"data-graview-nested":L||void 0,"data-graview-tied":O||void 0,"data-graview-hits":ge&&!L?q:void 0,"data-graview-emphasis":ge&&!L?q>0?"lit":"dimmed":void 0,...a?.description||L?{title:L?[r.label??o,a?.description].filter(Boolean).join(" \u2014 "):a.description}:{},style:{position:"relative",height:"100%","--graview-hue":Math.round(S)},children:[b?(0,d.jsx)("span",{className:"graview-kind-block graview-kind-landmark","data-graview-opened":r.opened||void 0,"aria-hidden":"true",style:{"--graview-rise":_t},children:(0,d.jsx)(ie,{kind:String(t),schema:e,...h?{brand:h}:{},size:96})}):null,(0,d.jsxs)("div",{ref:Ke,className:"graview-kind-face","data-graview-opened":r.opened||void 0,"data-graview-nameplate":F?r.nameplate??"full":void 0,style:{display:"flex",flexDirection:"column",gap:L?1:3,padding:L?"5px 7px":"7px 10px",borderRadius:"var(--graview-radius-sm, 9px)",justifyContent:"center",position:"relative",height:"100%",overflow:"hidden",boxSizing:"border-box",border:G?"1px solid var(--graview-accent)":O>0?"1px solid var(--graview-accent-dim)":`1px solid hsl(${Math.round(S)} 55% var(--graview-tint-lightness) / 0.34)`,backgroundColor:"var(--graview-panel)",backgroundImage:`linear-gradient(hsl(${Math.round(S)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${G?1.1:Ie?.28:.5})), hsl(${Math.round(S)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${G?1.1:Ie?.28:.5})))`,boxShadow:G?"0 0 0 1px var(--graview-accent-dim)":void 0},children:[!L&&!F&&c.length>0?(0,d.jsx)("div",{"data-graview-tally":c.length,"data-graview-broken":$||void 0,"aria-hidden":"true",style:{position:"absolute",left:0,right:0,top:0,display:"flex",height:3,background:`hsl(${Math.round(S)} 55% var(--graview-tint-lightness) / 0.4)`},children:$>0?(0,d.jsx)("span",{style:{width:`${Math.max(6,Math.round($/c.length*100))}%`,background:"var(--graview-warn)"}}):null}):null,b?(0,d.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:L?4:6},children:[(0,d.jsx)(ie,{kind:String(t),schema:e,...h?{brand:h}:{},size:L?14:18}),_e]}):_e,(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:5,fontSize:"0.875rem"},children:[(0,d.jsx)("span",{title:c.length>0?`${ee(c.length)} ${c.length===1?H(a,String(t)):o.toLowerCase()}`:void 0,style:{fontVariantNumeric:"tabular-nums",color:xe?"var(--graview-accent)":"var(--graview-ink-faint)"},children:c.length===0?"none yet":xe?O===c.length?`${O} tied`:`${O} of ${c.length} tied`:ee(c.length)}),(0,d.jsx)(ke,{kind:String(t),plural:o,problems:Ft,flag:k,listed:K}),(r.retired??0)>0?(0,d.jsxs)("button",{type:"button",className:"graview-kind-past","data-graview-retired":r.retired,title:`${r.retired} retired ${o.toLowerCase()} \u2014 press to widen the view to the past`,onClick:p=>{p.stopPropagation(),I(wt(E,!0))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:["+",r.retired," past"]}):null,q>0?(0,d.jsxs)("button",{type:"button",className:"graview-kind-hits","data-testid":`hits-${String(t)}`,title:`${q} ${q===1?"match":"matches"} for \u201C${E.q??""}\u201D \u2014 press to go in, narrowed`,onClick:p=>{p.stopPropagation(),I(Ze(E,ae(String(t)),{ownPicture:!0,...E.q?{carry:E.q}:{}}))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:[q," match"]}):null,O>0&&!xe?(0,d.jsxs)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-accent)"},children:[O," tied"]}):null,r.hasOwnView&&!F?(0,d.jsx)("span",{title:`${o} has a view of its own`,"aria-label":"has its own view",style:{fontSize:"0.6875rem",color:"var(--graview-accent)"},children:"\u25C6"}):null,!L&&c.length>0&&!r.focused?(0,d.jsxs)("button",{type:"button",className:"graview-kind-open","data-testid":`open-${String(t)}`,"aria-expanded":K,"aria-label":K?`Close up the ${o}`:`See the ${o} in here`,title:K?"Close it up":`See the ${o} in here`,onClick:p=>{p.stopPropagation(),Z?K?x():v([ae(String(t))]):C(ae(String(t)))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:[(0,d.jsx)("span",{className:"graview-kind-open-word",children:K?"close":"open"})," ",(0,d.jsx)("span",{"aria-hidden":"true",children:K?"\u25B4":"\u25BE"})]}):null]}),F&&r.states?(0,d.jsx)(P.Suspense,{fallback:null,children:(0,d.jsx)(on,{states:r.states,definition:a})}):null,r.opened?(0,d.jsxs)("div",{className:"graview-kind-members","data-graview-buildings":r.plot?.side??1,style:{display:"grid",gridTemplateColumns:`repeat(${y.columns}, minmax(0, 1fr))`,gap:3},children:[c.slice(0,y.shown).map(p=>{let T=r.flagged?.includes(p.id)??!1,D=A(a,p);return(0,d.jsx)(Y,{pickId:p.id,label:T?`${D} ${k}`:D,title:T?`${D} \u2014 implicated in a problem`:void 0,hue:S,selected:ze.has(p.id)},p.id)}),c.length>y.shown?(0,d.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",padding:"2px 4px",gridColumn:"1 / -1"},children:["+",c.length-y.shown," more \u2014 double-click to go in"]}):null]}):null]}),!L&&z.length>0?(0,d.jsx)("div",{className:"graview-drive-in","data-testid":`drive-in-${String(t)}`,"data-graview-showing":R,onPointerDown:p=>p.stopPropagation(),onDoubleClick:p=>p.stopPropagation(),children:(0,d.jsx)("div",{className:"graview-drive-in-marquee",role:"group","aria-label":`${o}: pictures`,"data-graview-thumbs":z.length===1?"one":"two",children:z.map(p=>{let T=R===p.as;return(0,d.jsxs)("div",{className:"graview-drive-in-thumb","data-graview-pressed":T||void 0,children:[(0,d.jsx)("span",{className:"graview-drive-in-thumb-title","aria-hidden":"true",children:p.title}),(0,d.jsx)("button",{type:"button",className:"graview-drive-in-thumb-press","data-testid":`showing-${p.as}`,"aria-label":`${o}: ${p.title}`,"aria-pressed":T,title:T?`${p.title} is showing \u2014 press again to open it`:`Show ${p.title} on the billboard \u2014 double-click to open it`,onClick:D=>{D.stopPropagation();let Q=()=>I(Qe(E,String(t),p.as));if(D.detail>=2||T&&r.focused){Q();return}I(Xe(Ue(Je(E,!0),Ye(String(t))),"view",p.as)),D.detail===1&&nn(D.currentTarget.ownerDocument,Lt(D.nativeEvent),Q)}})]},p.as)})})}):null]})};m.generic=!0,w.generic=!0,n.register(t,{cardinality:"one",fidelity:"full"},_(s)).register(t,{cardinality:"one",fidelity:"summary"},_(l)).register(t,{cardinality:"one",fidelity:"glyph"},_(u)).register(t,{cardinality:"many",fidelity:"full"},_(m)).register(t,{cardinality:"many",fidelity:"summary"},_(m)).register(t,{cardinality:"many",fidelity:"glyph"},_(w))}return n}var Le=M(W(),1),Et=new WeakMap;function ln(e){let n=Et.get(e);return n||Et.set(e,n=Mt(e,he(e))),n}var Ve=at;function Dt(){return(0,Ae.useContext)(Ve)}function Yn({children:e}){return(0,Le.jsx)(Ve.Provider,{value:!0,children:e})}function Tt(e){let n=(0,Ae.useContext)(Ve),{store:t}=V();if(n)return null;let a=e.kind??e.node?.kind??e.nodes?.[0]?.kind;if(!a)return null;let o=ln(t.schema).lookup(a,{cardinality:e.cardinality,fidelity:e.fidelity});return o?(0,Le.jsx)(o,{...e}):null}var i=M(W(),1);function Me(e,n){return e===void 0?{}:e===0?{"data-graview-lines":"all",style:{WebkitLineClamp:"none",lineClamp:"none",maxHeight:"none",overflow:"visible"}}:{"data-graview-lines":String(e),style:{...n?{display:"-webkit-box",WebkitBoxOrient:"vertical"}:{},WebkitLineClamp:e,lineClamp:e,overflow:"hidden",maxHeight:`${e*1.45}em`}}}var dn=90,Gt=(0,f.createContext)(null),Ee=(e,n)=>e.trim().toLowerCase().replace(/[_-]+/g," ")===n.trim().toLowerCase().replace(/[_-]+/g," "),cn=(0,f.createContext)(null),Oe=(0,f.createContext)(null);function Bt({block:e}){let n=(0,f.useContext)(Oe),t=n?.slots?.[e.key],a=(0,i.jsx)(gn,{block:e});return t?(0,i.jsx)(f.Suspense,{fallback:a,children:(0,i.jsx)(t,{block:e,node:n.node,drawn:a})}):a}function gn({block:e}){let n=(0,f.useContext)(Gt),t=(0,f.useContext)(pn),a=(0,f.useContext)(Be),o=(0,f.useContext)(we);if(n&&e.t==="badge"&&n.values.some(s=>Ee(s,e.text))||n&&e.t==="field"&&n.field!==void 0&&e.field===n.field||e.t==="badge"&&/^0(?:\s+\p{L}+)?$/u.test(e.text.trim()))return null;switch(e.t){case"title":return(0,i.jsx)("strong",{className:"graview-spec-title",...o!==null&&Ee(o,e.text)?{"aria-hidden":!0}:{},children:e.text});case"text":return e.markdown||Ce(e.text)?(0,i.jsx)("div",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},...Me(e.lines,!0),children:(0,i.jsx)(St,{text:e.text,markdown:e.markdown})}):e.runs?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-meta",...e.tone?{"data-graview-tone":e.tone}:{},...Me(e.lines,!1),children:e.runs.map((s,l)=>(0,i.jsxs)(f.Fragment,{children:[l>0?" ":null,s.field!==void 0?(0,i.jsx)("span",{className:"graview-spec-chip","data-graview-field":s.field,children:s.text}):(0,i.jsx)("span",{className:"graview-spec-meta-words",children:l>0&&e.runs[l-1].field===void 0?`\xB7 ${s.text}`:s.text})]},l))}):(0,i.jsx)("p",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},...Me(e.lines,!0),children:e.text});case"badge":return(0,i.jsx)("span",{className:"graview-spec-badge","data-graview-tone":e.tone,children:e.text});case"field":return(0,i.jsxs)("span",{className:"graview-spec-field","data-graview-field":e.field,children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-value",...Ce(e.text)?{style:{whiteSpace:"pre-line"}}:{},children:e.linked?(0,i.jsx)(ht,{relation:e.linked.relation,refs:e.linked.refs,as:"chip"}):e.app?(0,i.jsx)(bt,{address:e.app}):e.href?(0,i.jsx)("a",{className:"graview-spec-link",href:e.href,...e.href.startsWith("tel:")?{}:{rel:"noopener noreferrer",target:"_blank"},children:e.text}):e.text})]});case"image":return(0,i.jsx)(Se,{as:"block",field:e.field,files:e.files,label:e.label,view:e.as});case"progress":return e.value===void 0||e.max===void 0?(0,i.jsxs)("span",{className:"graview-spec-progress",children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-value",children:e.text})]}):(0,i.jsxs)("span",{className:"graview-spec-progress",children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-track",role:"progressbar","aria-label":e.label,"aria-valuemin":0,"aria-valuemax":e.max,"aria-valuenow":Math.max(0,Math.min(e.value,e.max)),"aria-valuetext":e.text,children:(0,i.jsx)("span",{className:"graview-spec-fill",style:{width:`${Math.round(Math.max(0,Math.min(e.value,e.max))/e.max*100)}%`}})}),(0,i.jsx)("span",{className:"graview-spec-value",children:e.text})]});case"group":return(0,i.jsx)("span",{className:"graview-spec-group","data-direction":e.direction,children:(0,i.jsx)(De,{blocks:e.blocks})});case"when":return e.shown?(0,i.jsx)(De,{blocks:e.blocks}):null;case"divider":return(0,i.jsx)("hr",{className:"graview-spec-divider"});case"figure":return(0,i.jsx)(un,{});case"headline":{let s=`h${Math.min(6,e.level+t)}`,l=(0,i.jsx)(s,{className:"graview-spec-headline","data-level":e.level,"data-long":e.text.length>dn?"":void 0,children:e.text});return a!==null&&e.level===1?(0,i.jsxs)(i.Fragment,{children:[l,a]}):l}case"number":return(0,i.jsxs)("span",{className:"graview-spec-number",...e.emphasis?{"data-emphasis":e.emphasis}:{},children:[(0,i.jsx)("span",{className:"graview-spec-number-value",children:e.text}),e.label?(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}):null]});case"list":return(0,i.jsx)(wn,{list:e})}}function un(){let e=(0,f.useContext)(Oe)?.figure;return e?(0,i.jsx)("span",{className:"graview-spec-figure","aria-hidden":"true",children:e()}):null}function De({blocks:e}){let n=[];for(let t=0;t<e.length;t++){let a=t;for(;e[a]?.t==="badge"&&e[a+1]?.t==="badge";)a++;if(a===t){n.push((0,i.jsx)(Bt,{block:e[t]},t));continue}n.push((0,i.jsx)("span",{className:"graview-spec-badges",children:e.slice(t,a+1).map((o,s)=>(0,i.jsx)(Bt,{block:o},s))},t)),t=a}return n}function He({blocks:e,ctx:n,view:t}){let a=(0,f.useContext)(cn)?.[t];return(0,i.jsx)(Oe.Provider,{value:{figure:n.figure,slots:a,node:n.node},children:(0,i.jsx)(De,{blocks:e})})}function Ot({blocks:e,ctx:n,view:t}){return(0,i.jsx)(He,{blocks:j(e,n),ctx:n,view:t})}var Te=3,Ht=(0,f.createContext)(0),Wt=(0,f.createContext)(null),pn=(0,f.createContext)(0),Be=(0,f.createContext)(null),mn=(0,f.createContext)(null),It=(0,f.createContext)(null);function hn(){let{brand:e}=V();return qe(e?.kit).marks.flag}function fn({node:e,as:n,depth:t,said:a=null}){let{store:o,views:s}=V(),l=A(o.schema.tryDefinition(e.kind),e),u=s.lookup(e.kind,{cardinality:"one",fidelity:n==="card"?"summary":"glyph"}),m=(0,f.useContext)(It)?.has(e.id)===!0,g=hn(),w=m?{"data-graview-flagged":"",title:`${l} \u2014 implicated in a problem`}:{};return n==="row"&&t<=Te&&(!u||me(u))?(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":n,...w,children:[(0,i.jsx)(Ge,{node:e,label:l}),(0,i.jsx)("div",{className:"graview-spec graview-spec-row","data-graview-spec":"row","data-graview-kind":e.kind,"aria-hidden":"true",children:(0,i.jsx)("strong",{className:"graview-spec-title",children:m?`${l} ${g}`:l})})]}):(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":n,...w,children:[(0,i.jsx)(Ge,{node:e,label:l}),t<=Te&&u?(0,i.jsx)(et,{mode:"scene",children:(0,i.jsx)(Ht.Provider,{value:t,children:(0,i.jsx)(Gt.Provider,{value:a,children:(0,i.jsx)(we.Provider,{value:l,children:(0,i.jsx)(u,{node:e,cardinality:"one",fidelity:n==="card"?"summary":"glyph",mode:"scene",selected:!1,...m?{flagged:[e.id]}:{}})})})})}):(0,i.jsx)("span",{className:"graview-spec-item-name","aria-hidden":"true",children:m?`${l} ${g}`:l})]})}function Ge({node:e,label:n,describedBy:t}){let a=(0,f.useContext)(Wt),o=(0,f.useRef)(null);return Rt(o),a?(0,i.jsx)("a",{ref:o,className:"graview-spec-item-link",href:a.href(e),"aria-label":n,...t?{"aria-describedby":t}:{},onClick:s=>{s.metaKey||s.ctrlKey||s.shiftKey||s.button!==0||(s.preventDefault(),s.stopPropagation(),a.go(e))}}):(0,i.jsx)("button",{ref:o,type:"button",className:"graview-spec-item-link","data-graview-pick":e.id,"aria-label":n,...t?{"aria-describedby":t}:{}})}function wn({list:e}){let n=(0,f.useContext)(Ht)+1,{store:t}=V(),a=(0,f.useContext)(Wt),[o,s]=(0,f.useState)(e.members.length);if(e.failed)return(0,i.jsx)("p",{className:"graview-spec-text",children:"\u2014"});if(e.members.length===0)return e.empty?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-empty",children:e.empty}):null;let l=(v,x=null)=>n>Te?(0,i.jsx)("ul",{className:"graview-spec-list","data-as":"names",children:v.map(C=>(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":C.id,"data-as":"name",children:[(0,i.jsx)(Ge,{node:C,label:A(t.schema.tryDefinition(C.kind),C)}),(0,i.jsx)("span",{className:"graview-spec-item-name","aria-hidden":"true",children:A(t.schema.tryDefinition(C.kind),C)})]},C.id))}):(0,i.jsx)("ul",{className:"graview-spec-list","data-as":e.as,children:v.map(C=>(0,i.jsx)(fn,{node:C,as:e.as,depth:n,said:x},C.id))}),u=e.rest??[],m=Math.min(o,e.members.length+u.length),g=m>e.members.length?[...e.members,...u].slice(0,m):e.members,w=e.members.length+u.length-m,r=Math.max(1,e.members.length),c=w>0?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,i.jsx)("button",{type:"button",className:"graview-spec-show-more","data-graview-show-more":w,onClick:()=>s(m+r),children:`Show ${Math.min(r,w)} more`})}):null,y=e.total??e.members.length+e.more,S=e.more-u.length,h=c??(a?.more&&y>g.length?a.more({members:g,total:y}):S>0?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${S} more`}):null);if(!e.groups)return(0,i.jsxs)("div",{className:"graview-spec-listing",children:[l(g),h]});let b=`h${e.headingLevel}`,k=m,N=m>e.members.length&&e.everyGroup?e.everyGroup.flatMap(v=>{if(k<=0)return[];let x=v.members.slice(0,k);return k-=x.length,[{...v,members:x}]}):e.groups;return(0,i.jsxs)("div",{className:"graview-spec-listing",children:[N.map(v=>(0,i.jsxs)("section",{className:"graview-spec-list-group","data-graview-group":v.value??"",children:[v.heading?(0,i.jsxs)(b,{className:"graview-spec-list-heading",children:[v.heading," ",(0,i.jsx)("span",{className:"graview-spec-list-count",children:(e.everyGroup?.find(x=>x.value===v.value)??v).members.length})]}):null,l(v.members,v.value!==null?{values:[v.value,...v.heading?[v.heading]:[]]}:null)]},v.value??"")),h]})}function pa({blocks:e,heading:n=2,firstHeading:t,slot:a,view:o=a,flagged:s}){let{store:l,brand:u}=V();pe();let m=(0,f.useMemo)(()=>s&&s.length>0?new Set(s):null,[s]),g=oe(l,null,null,{heading:n,firstHeading:t,money:u}),w=(0,f.useContext)(Be),c=(0,f.useContext)(mn)?.lede===!0&&a==="place"&&e[0]?.t==="headline"?e.slice(1):e,y=c.some(S=>S.t==="headline");return(0,i.jsxs)("div",{className:`graview-spec graview-spec-${a}`,"data-graview-spec":a,children:[w!==null&&!y?w:null,(0,i.jsx)(Be.Provider,{value:y?w:null,children:(0,i.jsx)(It.Provider,{value:m,children:(0,i.jsx)(Ot,{blocks:c,ctx:g,view:o})})})]})}function We(e,n="card"){let{store:t,brand:a}=V(),o=t.schema;return{...oe(t,null,e,{slot:n,money:a}),figure:()=>(0,i.jsx)(ie,{kind:e.kind,schema:o,...a?{brand:a}:{},size:22})}}function yn({blocks:e,node:n,selected:t,flagged:a}){let o=We(n),[s,...l]=e,u=s?.t==="title";return(0,i.jsx)(J,{...u?{title:j([s],o)[0].text}:{},selected:t,tone:a?"warning":"muted",fit:!0,children:(0,i.jsx)("div",{className:"graview-spec graview-spec-card","data-graview-spec":"card","data-graview-kind":n.kind,children:(0,i.jsx)(Ot,{blocks:u?l:e,ctx:o,view:`${n.kind}.card`})})})}function vn({blocks:e,props:n}){let t=n.node,a=We(t,"page"),o=Dt(),s=j(e,a),l=ye(e,s),u=l.title!==void 0&&(!o||l.title===A(a.schema?.tryDefinition(t.kind),t)),m=(0,i.jsx)("div",{className:"graview-spec graview-spec-page","data-graview-spec":"page","data-graview-kind":t.kind,children:(0,i.jsx)(He,{blocks:u?s.slice(1):s,ctx:a,view:`${t.kind}.page`})});return o?m:(0,i.jsx)(se.Provider,{value:{nodeId:t.id,...l.title!==void 0?{title:l.title}:{},body:m,fields:l.fields,records:l.records},children:(0,i.jsx)(Tt,{...n})})}function ma(e,n,t){return typeof e=="function"?e.says?.(n,t):void 0}function Sn({blocks:e,node:n,selected:t}){let{store:a}=V(),o=A(a.schema.tryDefinition(n.kind),n),s=We(n,"row"),l=j(e,s),u=(0,f.useContext)(we);return(0,i.jsx)("div",{title:o,style:{minWidth:0,maxWidth:"100%"},children:(0,i.jsxs)("div",{className:"graview-spec graview-spec-row","data-graview-spec":"row","data-graview-kind":n.kind,...e.some(gt)?{"data-graview-tall":""}:{},...t?{"data-selected":""}:{},children:[ct(l,o)?null:(0,i.jsx)("strong",{className:"graview-spec-title","data-graview-row-name":"",...u!==null&&Ee(u,o)?{"aria-hidden":!0}:{},children:o}),(0,i.jsx)(He,{blocks:l,ctx:s,view:`${n.kind}.row`})]})})}function ha(e,n,t){if(!t)return e;let a=new Set(n.kinds);for(let[o,s]of Object.entries(t)){if(!a.has(o)||!s)continue;let l=o;if(s.card){let u=re(s.card),m=g=>g.node?(0,i.jsx)(yn,{blocks:u,node:g.node,selected:g.selected,flagged:g.flagged?.includes(g.node.id)??!1}):null;e.register(l,{cardinality:"one",fidelity:"summary"},m)}if(s.row){let u=re(s.row),m=g=>g.node?(0,i.jsx)(Sn,{blocks:u,node:g.node,selected:g.selected}):null;m.says=(g,w)=>ye(u,j(u,oe({graph:w,schema:n},null,g,{slot:"row"}))),e.register(l,{cardinality:"one",fidelity:"glyph"},m)}if(s.page){let u=re(s.page),m=g=>g.node?(0,i.jsx)(vn,{blocks:u,props:g}):null;m.says=(g,w)=>ye(u,j(u,oe({graph:w,schema:n},null,g))),e.register(l,{cardinality:"one",fidelity:"full"},m)}}return e}export{Rt as a,Yn as b,Gt as c,Wt as d,pn as e,Be as f,mn as g,Ge as h,pa as i,ma as j,ha as k,Mt as l};
@@ -1,2 +0,0 @@
1
- import{a as te,b as Ke}from"./chunk.KHRS2SKB.js";import"./chunk.PR74PGLC.js";import"./chunk.T6PU3NKP.js";import"./chunk.B6JR7EQO.js";import{j as qe,k as Be,l as Fe}from"./chunk.2D7K2IJQ.js";import"./chunk.77JI5T4F.js";import"./chunk.UDU545CL.js";import"./chunk.7VAHHEDX.js";import"./chunk.HJCQ6I3S.js";import"./chunk.DQAMVVE6.js";import"./chunk.OXFDB5BB.js";import"./chunk.DJIF7IAQ.js";import"./chunk.S6QZBWCJ.js";import{a as Oe,b as S}from"./chunk.LTOQ22ZJ.js";import{a as ee,b as Ne}from"./chunk.2TCOLAL2.js";import"./chunk.FUPYIOXZ.js";import"./chunk.3OEODIHB.js";import"./chunk.BIDL7GQD.js";import"./chunk.TA2JTUNX.js";import"./chunk.HZPRMHSL.js";import"./chunk.TQ2G4AM4.js";import{b as $e,c as We}from"./chunk.X36BYTEG.js";import"./chunk.LDMBJC3B.js";import"./chunk.XOZU4OFA.js";import"./chunk.G7YLK4PX.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.2E62YCMZ.js";import"./chunk.DUP2CGVH.js";import"./chunk.YFVJUHAK.js";import"./chunk.YEXFVDRA.js";import"./chunk.ZA5TDCBC.js";import"./chunk.2JEN2RCB.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import{v as De}from"./chunk.3SAESG6X.js";import"./chunk.OJGHDWI6.js";import"./chunk.F6BNFLQM.js";import"./chunk.75JQCTR6.js";import{l as Le}from"./chunk.5IEZF433.js";import{c as Re}from"./chunk.5AD2QHWH.js";import{k as Pe}from"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{G as dt,Oa as Z,Ta as Ce,V as Ie,Xa as ze,da as B,h as He,u as Ee}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import{Mc as Ae,Ob as Se,Oc as Te,sa as X,sd as Me,ta as q}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as J}from"./chunk.AJZBJBMO.js";var a=J(dt(),1);var n=J(Ie(),1);function St(u,o,r){let g=o.on??o.about[o.about.length-1];qe(u,o.about,{...r,pins:te(),...g===void 0?{}:{focus:g}})}function At({placement:u="float",chosen:o=!0}={}){let{menuAt:r}=B();return u==="menu"&&r===null?o?(0,n.jsx)(ut,{}):null:(0,n.jsx)(ct,{placement:u})}function ut(){let{store:u,setMenuAt:o,view:r}=B(),{selection:g}=Z(),h=(0,a.useRef)(null),[C,v]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let b=h.current?.offsetParent??h.current?.parentElement;if(!b)return;let m=Math.round(b.getBoundingClientRect().width);m!==C&&v(m)});let y=g.length===1&&!r.overview?u.graph.getNode(g[0]):void 0;return!y||C===null||C>=je?(0,n.jsx)("span",{ref:h,hidden:!0}):(0,n.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${S(u,y.id)}`,"aria-haspopup":"menu",onClick:b=>{let m=b.currentTarget.getBoundingClientRect();o({x:Math.round(m.right),y:Math.round(m.bottom+4),on:y.id})},style:{position:"absolute",right:"calc(14px + var(--graview-dock, 0px))",top:98,zIndex:"var(--graview-layer-overview, 10)",minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var je=564;function ct({placement:u}){let{store:o,menuAt:r,setMenuAt:g,view:h,signIn:C}=B(),v=(0,a.useRef)(null),y=(0,a.useRef)(null),b=(0,a.useRef)(null),m=(0,a.useRef)(null);r?.returnTo&&(m.current=r.returnTo);let Ue=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),t=e.getAttribute("data-pin-for"),l=i??e.getAttribute("data-affordance")??(t===null?null:`pin:${t}`)??e.getAttribute("data-menu-item");y.current=l===null?null:{key:l,element:e}};(0,a.useEffect)(()=>{let e=v.current,i=y.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let t=i.key;if(!e){y.current=null;let k=m.current;m.current=null,(k?.isConnected?k:b.current)?.focus();return}((t.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(t.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(t)}"]:not([disabled])`)??e).focus()});let[Ve,Ge]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let e=v.current?.offsetParent??v.current?.parentElement;if(e instanceof HTMLElement&&(b.current=e),!e)return;let i=e.getBoundingClientRect();Ge(t=>t&&t.left===i.left&&t.top===i.top&&t.width===i.width&&t.height===i.height?t:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Ye,set:Qe,clear:Je}=Z(),d=r?.about??Ye,[F,Xe]=(0,a.useState)(()=>te()),K=r?.on??d[d.length-1],_=r?.about,Ze=(0,a.useMemo)(()=>({pins:F,...K===void 0?{}:{focus:K},..._?{about:_}:{}}),[F,K,_]),et=(0,a.useMemo)(()=>new Set(o.allMutations().filter(e=>e.pinned).map(e=>e.name)),[o]),{affordances:p,withheld:ne,observations:ie}=Be(Ze),z=Te(ne,C),f=z?pt:ne,tt=r===null?null:{face:r.face??"scene",on:r.on,about:d,field:r.field,place:r.place,href:r.href,act:r.act,column:r.column,element:r.returnTo},re=De(tt),oe=ie.some(e=>e.id.startsWith("schema:waits:")),{apply:nt,preview:it}=Fe(),[P,A]=(0,a.useState)(null),[j,rt]=(0,a.useState)(null),[ot,ae]=(0,a.useState)(!1),[le,se]=(0,a.useState)(!1),[L,$]=(0,a.useState)(""),at=Ne({letters:!0}),[de,U]=(0,a.useState)(null),V=(0,a.useRef)([]),W=(e,i)=>{try{return it(e,i),nt(e,i),U(null),g(null),V.current=[],!0}catch(t){return U(Le(o.schema,o.allMutations(),t)),V.current=t instanceof Se?t.issues.map(l=>String(l.path[0]??"")).filter(Boolean):[],!1}},D=[...new Set(d.flatMap(e=>{let i=o.graph.getNode(e);return i?[i.kind]:[]}))],x=D.length>0?D:[...new Set(d.flatMap(e=>Ee(e)))],c=d.length===1?He(d[0]):null,G=c?{from:o.graph.getNode(c.from),to:o.graph.getNode(c.to)}:null,ue=c?We(o,c):void 0,ce=ue?.provisional?ue:void 0,pe=c?(()=>{let e=o.schema.tryDefinition(o.graph.getNode(c.from)?.kind??"")?.edges?.[c.kind],i=o.graph.getNode(c.to);return e?.inverse&&i?`From ${S(o,i.id)}: ${e.inverse}`:null})():null;(0,a.useEffect)(()=>{A(null),ae(!1),se(!1),U(null),$("")},[d,r?.about]);let ge=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=r?.begin;if(!e||ge.current===r)return;let i=p.find(l=>l.mutation===e.act);if(!i)return;ge.current=r;let t={...e.given};rt({id:i.id,given:t}),i.open.every(l=>l.name in t)?W({...i,args:{...i.args,...t},open:[]}):A(i.id)},[r,p]);let s=r!==null,lt=u==="menu"&&!s,T=(0,a.useRef)(r);T.current=r;let he=ze("acts",{open:s&&u==="menu",onOpenChange:e=>{e||g(null)},at:()=>T.current?{x:T.current.x,y:T.current.y}:null,returnTo:()=>{let e=T.current?.returnTo;if(e?.isConnected)return e;let i=T.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),me=(Ve?.width??Number.POSITIVE_INFINITY)<je;if((0,a.useLayoutEffect)(()=>{let e=v.current?.offsetParent;if(!e||!me||s)return;let i=v.current?.getBoundingClientRect().height??0,t=`${Math.round(i)+20}px`;if(e.style.paddingBottom===t)return;let l=e.style.paddingBottom;return e.style.paddingBottom=t,()=>{e.style.paddingBottom=l}}),d.length===0&&!s)return null;let fe=r?.title!==void 0||d.length>0&&!(d.length===1&&d[0]===h.focusId),ve=Math.max(1,Math.min(9,p.length)),M=[...p.filter(e=>e.provider==="invariant"&&!e.destructive),...p.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...p.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...p.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...p.filter(e=>e.destructive)],ye=M.length>ve&&!s,we=L.trim().toLowerCase(),w=ye&&we.length>0?M.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(we)):null,Y=w??(ot||s?M:M.slice(0,ve)),be=w?0:M.length-Y.length,N=[];for(let e of Y){let i=!s&&e.provider==="invariant",t=!s&&!i&&e.pinned!==void 0&&!e.destructive,l=!s&&!i&&!t&&e.ties===!0&&!e.destructive,k=i?e.why:t?"pinned":l?"its ties":null,O=i?"violation":t||l?"ties":null,I=N[N.length-1];I&&I.heading===k?I.items.push(e):N.push({heading:k,tone:O,items:[e]})}let H=p.find(e=>e.id===P),Q=H&&j?.id===H.id?{...H,args:{...H.args,...j.given},open:H.open.filter(e=>!(e.name in j.given))}:H,R=d.length===1?S(o,d[0]):null,xe=e=>{if(!R)return e;let i=e.startsWith(`"${R}"`)?e.slice(R.length+2):e.startsWith(R)?e.slice(R.length):null;if(i===null)return e;let t=i.trimStart();return t.length===0?e:t[0].toUpperCase()+t.slice(1)},st=new Set(s?[]:Y.filter(e=>e.provider==="invariant").map(e=>e.why)),E=ie.filter(e=>!st.has(e.text)).map(e=>({...e,text:xe(e.text)}));return lt?null:(0,n.jsxs)("section",{...s?he.pane:{},ref:e=>{v.current=e,s&&he.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":s?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>Ue(e.target),onBlur:e=>{e.relatedTarget!==null&&(y.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...s?Ce:{position:"absolute",zIndex:Me("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...s?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:me?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:h.overview?"min(296px, 38cqh)":44,width:236,maxHeight:h.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,n.jsx)("h2",{style:{...Pe,margin:0},children:"Inspector"}),(0,n.jsxs)("div",{style:{display:fe||!s?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:s?0:24},children:[fe?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:r?.title??(d.length===1?S(o,d[0]):`${d.length} selected`)}),D.length>0||c?(0,n.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:c?"relation":D.map(e=>q(o.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,d.length===1&&!c&&r?.face!=="pages"?(0,n.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:h.expanded.includes(d[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,n.jsx)("span",{style:{flex:"1 1 auto"}})]}),s?null:(0,n.jsx)("button",{type:"button",onClick:()=>{g(null),Je()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),c&&G?(0,n.jsxs)("div",{style:{display:"grid",gap:6},children:[pe?(0,n.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:pe}):null,ce?(0,n.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:$e(ce)}):null,(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",G.from],["to",G.to]].map(([e,i],t)=>(0,n.jsxs)(a.Fragment,{children:[t===1?(0,n.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,n.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>Qe([i.id]),title:`Select ${S(o,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:S(o,i.id)}):(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!c&&d.length===1&&Ae(o,d[0])?(0,n.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,E.length>0?(0,n.jsx)("div",{"data-testid":"observations",title:E.map(e=>e.text).join(`
2
- `),style:{display:"grid",gap:3},children:E.slice(0,2).map(e=>(0,n.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===E[1]&&E.length>2?(0,n.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",E.length-2]}):null]},e.id))}):null,s?re.start.map(e=>(0,n.jsx)(_e,{section:e,close:()=>g(null)},e.id)):null,de?(0,n.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:de}):null,ye?(0,n.jsx)("input",{"data-testid":"action-filter",value:L,onChange:e=>$(e.target.value),placeholder:`Filter ${M.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),L.length>0?$(""):e.currentTarget.blur();return}if(e.key==="Enter"&&w?.length===1){let i=w[0];if(i.destructive)return;i.open.length>0?A(i.id):W(i)&&$("")}},style:{font:"inherit",fontSize:"0.875rem",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,w!==null&&w.length===0?(0,n.jsxs)("p",{"data-testid":"no-matches",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing offered here matches \u201C",L.trim(),"\u201D."]}):null,z&&p.length===0||p.length===0&&!oe&&d.length===0?null:p.length===0&&!oe?(0,n.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:f.length>0?`Nothing you may do with ${c?"this relation":x.length===1?X(q(o.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} \u2014 ${f.length} action${f.length===1?"":"s"} withheld.`:c?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${Re(o.schema,o.graph.getNode(c.from)?.kind??"",c.kind,"out")}\u201D.`:`Nothing can be done with ${x.length===1?X(q(o.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${x.length===1?"it":"them"}.`}):(0,n.jsxs)("ol",{...at,"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[N.map((e,i)=>(0,n.jsxs)(a.Fragment,{children:[e.heading?(0,n.jsxs)("li",{"data-graview-heading":e.tone,style:{fontSize:"0.75rem",lineHeight:1.4,color:e.tone==="violation"?"var(--graview-warn)":"var(--graview-ink-faint)",...e.tone!=="violation"?{letterSpacing:"0.12em",textTransform:"uppercase",fontSize:"0.75rem"}:{},padding:"2px 2px 1px",marginTop:i>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?xe(e.heading):e.heading]}):i>0?(0,n.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(t=>(0,n.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},onKeyDown:l=>{if(l.metaKey||l.ctrlKey||l.altKey)return;let k=l.currentTarget.querySelector("[data-affordance]"),O=l.currentTarget.querySelector("[data-pin-for]"),I=l.target===O,ke=l.key==="ArrowRight"&&!I?O:I&&["ArrowLeft","ArrowUp","ArrowDown"].includes(l.key)?k:null;ke&&(l.preventDefault(),l.stopPropagation(),ke.focus())},children:[(0,n.jsxs)("button",{type:"button",[ee]:"","data-affordance":t.id,"data-rank":t.rank,"data-graview-destructive":t.destructive||void 0,"aria-pressed":P===t.id,title:t.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:P===t.id?"var(--graview-accent)":s?"transparent":"var(--graview-edge)",background:s?"none":"var(--graview-panel)",boxShadow:"none",...t.destructive?{color:"var(--graview-warn)"}:{},...P===t.id?{color:"var(--graview-accent)"}:{}},onClick:()=>{if(t.open.length>0){A(P===t.id?null:t.id);return}W(t)},children:[t.label,t.open.length>0?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,w?.length===1&&w[0]?.id===t.id&&!t.destructive?(0,n.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,n.jsx)("button",{type:"button","data-testid":"pin-toggle",tabIndex:-1,"data-pin-for":t.mutation,"aria-pressed":t.pinned!==void 0,"aria-label":t.pinned!==void 0?`Unpin ${t.label}`:`Pin ${t.label}`,title:t.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":t.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>Xe(Ke(F,t.mutation,et.has(t.mutation))),style:{flex:"0 0 auto",width:24,minHeight:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.75rem",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7,color:t.pinned==="user"?"var(--graview-accent)":t.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:t.pinned!==void 0?"\u2605":"\u2606"})]},t.id))]},`${e.heading??"plain"}-${i}`)),be>0?(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",[ee]:"",onClick:()=>ae(!0),title:`Show all ${p.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",be," more"]})}):null]}),z?(0,n.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>{g(null),z.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left"},children:z.label}):null,f.length>0?(0,n.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[f.slice(0,s||le?f.length:3).map(e=>(0,n.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,n.jsx)("button",{type:"button",disabled:!0,"data-affordance":e.id,"data-rank":e.rank,"data-withheld":e.refusal.wouldNeed.join(",")||"nobody",style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8,borderStyle:"dashed",width:"100%",textAlign:"left",background:"none"},children:(0,n.jsx)("s",{children:e.label})}),(0,n.jsx)("span",{"data-testid":"withheld-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:e.refusal.message})]},e.id)),!s&&!le&&f.length>3?(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>se(!0),title:`Show all ${f.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",f.length-3," more withheld"]})}):null]}):null,s?re.end.map(e=>(0,n.jsx)(_e,{section:e,close:()=>g(null)},e.id)):null,Q?(0,n.jsx)(Oe,{affordance:Q,onApply:e=>{if(W(Q,e))A(null);else return V.current},onCancel:()=>A(null)}):null]})}var pt=[];function _e({section:u,close:o}){return(0,n.jsxs)("div",{"data-menu-section":u.id,...u.heading?{role:"group","aria-label":u.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[u.heading?(0,n.jsx)("p",{"aria-hidden":"true",style:{margin:0,padding:"2px 2px 1px",fontSize:"0.75rem",lineHeight:1.4,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:u.heading}):null,u.items&&u.items.length>0?(0,n.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:u.items.map(r=>(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-menu-item":r.id,onClick:()=>{o(),r.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},children:[r.label,r.hint?(0,n.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",r.hint]}):null]})},r.id))}):null,u.render?.(o)]})}export{At as InspectorPane,St as prepareActs};
@@ -1 +0,0 @@
1
- import{$ as L,Bb as q,Bc as Q,Cb as H,Cc as ee,Db as J,Dc as M,Eb as U,Ec as I,Fc as N,Kc as P,L as K,Nc as w,R as _,U as G,Y as $,nb as z,ob as h,ra as F,vc as V,xb as Y,yc as X,zc as Z}from"./chunk.IQGSEAQ2.js";import{j as f}from"./chunk.FQLNBIQ5.js";var te=e=>Y(e).id??e.session;function D(e,o={}){let i=V(e),n=new Map,t=o.advisory===!0;for(let s of e){if(s.vote===void 0||s.withheld||i.has(s.id)||s.vote.advisory===!0!==t)continue;let r=t?s.vote.voter:te(s.author);if(r===void 0)continue;let a=n.get(s.vote.suggestion);a||n.set(s.vote.suggestion,a=new Map),s.vote.vote===null?a.delete(r):a.set(r,s.vote.vote)}return n}function ne(e){let o=0,i=0;for(let n of e?.values()??[])n==="for"?o++:i++;return{for:o,against:i}}function le(e,o,i){let n=M(o)?I(o):void 0,t=o&&(n===void 0?te(o):void 0),s=n!==void 0?i?.get(n):t!==void 0?e?.get(t):void 0,r=ne(i);return{...ne(e),...s!==void 0?{mine:s}:{},...r.for+r.against>0?{advisory:r}:{}}}var j=(e,o)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(o),ue=(e,o,i)=>(e??[]).some(n=>n.suggestion===o&&(n.until===void 0||Date.parse(n.until)>Date.parse(i)));function oe(e,o=()=>!0,i={}){let n=V(e),t=ce(e),s=i.now??new Date().toISOString(),r,a;return e.filter(d=>d.suggests&&!d.withheld&&!n.has(d.id)&&t.get(d.id)!=="all"&&!j(d,s)&&!ue(i.dismissed,d.id,s)).flatMap(({id:d,batch:l,suggests:u,suggestsSaid:g,intent:c,batchIntent:A,author:T,lineage:S,at:p,expiresAt:de})=>{let C=t.get(d),O=ge(u,g,c).filter(m=>!C?.has(m.at));if(O.length===0)return[];let B=O.map(m=>m.call),W=new Set;return JSON.stringify(B.map(m=>m.args),(m,k)=>(typeof k=="string"&&o(k)&&W.add(k),k)),[{id:d,batch:l,calls:B,intent:C?O.map(m=>m.intent).join("; "):c,...A!==void 0?{headline:A}:{},items:O,author:T,...S?{lineage:S}:{},at:p,expiresAt:de,about:[...W],tally:le((r??=D(e)).get(d),i.voter,(a??=D(e,{advisory:!0})).get(d))}]})}function ge(e,o,i){let n=o&&o.length===e.length?o:void 0;return e.map((t,s)=>({at:s,call:t,intent:n?.[s]??(e.length===1?i:t.name)}))}function ce(e){let o=new Map;for(let n of e){let t=n.lineage?.suggestion;if(t===void 0)continue;let s=n.lineage.items,r=o.get(t);if(r!=="all")if(s===void 0)o.set(t,"all");else{let a=r??new Set;for(let d of s)a.add(d);o.set(t,a)}}let i=new Map(e.filter(n=>n.suggests&&o.has(n.id)).map(n=>[n.id,n.suggests.length]));for(let[n,t]of o)t!=="all"&&i.has(n)&&t.size>=i.get(n)&&o.set(n,"all");return o}function ie(e,o){return e.ops.length>0&&e.ops.every(i=>i.suggests!==void 0||i.undoes!==void 0&&o(i.undoes)?.suggests!==void 0)}var E=e=>[...e].length;function pe(e){let o,i=0,n=0;for(let t of e.ops){let s=t.mutation?.name===U&&t.withheld!==!0&&t.undoes===void 0?t.mutation.args:void 0;if(typeof s?.node!="string"||typeof s.field!="string"||o&&(o.node!==s.node||o.field!==s.field))return;o={node:s.node,field:s.field};for(let r of t.primitives)r.op==="splice-text"?(i+=E(r.inserted),n+=E(r.removed)):r.op==="patch-node"&&typeof r.after[s.field]=="string"&&(i+=E(r.after[s.field]))}return o&&{...o,inserted:i,removed:n}}function fe(e,o,i){let n=i.getNode(e.node)?.kind,t=[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]];return`Wrote in ${F(n?o.tryDefinition(n):void 0,e.field)} (${t.join(" ")})`}var x=e=>JSON.stringify([e.kind,e.id??"",e.name??""]),ye=e=>e.ops.find(o=>o.lineage?.run!==void 0)?.lineage?.run;function me(e,o=()=>{}){let i=[];for(let n of e){if(ie(n,o))continue;if(!P(n.author)){let u=pe(n),g=i.at(-1),c=u&&g&&"batch"in g&&x(g.batch.author)===x(n.author)&&g.typed?.node===u.node&&g.typed.field===u.field?g.typed:void 0;c?i[i.length-1]={batch:n,typed:{...c,batches:[...c.batches,n],inserted:c.inserted+u.inserted,removed:c.removed+u.removed}}:i.push(u?{batch:n,typed:{batches:[n],...u}}:{batch:n});continue}let t=ye(n),s=x(n.author),r=t!==void 0?i.findIndex(u=>"digest"in u&&u.digest.run===t&&x(u.digest.author)===s):i.length-1,a=i[r],d=a!==void 0&&"digest"in a&&x(a.digest.author)===s&&a.digest.run===t?a.digest:void 0,l=[...d?.batches??[],n];d&&i.splice(r,1),i.push({digest:{author:n.author,batches:l,things:he(l),at:n.at,...t!==void 0?{run:t}:{}}})}return i}var he=e=>e.reduce((o,i)=>o+(i.undone?0:i.ops.length),0),Se=e=>{let o=Date.parse(e);if(Number.isNaN(o))return!1;let{minutes:i}=G(o,_());return i<6*60||i>=21*60};function ve(e,o=$(new Date().toISOString())??K()){let i=$(e.at)??e.at.slice(0,10),t=e.run!==void 0&&i===o&&[e.at,...(e.batches??[]).map(r=>r.at)].every(Se)?"overnight":i===o?"today":`on ${L(i)}`,s=e.things===1?"one thing":`${e.things} things`;return e.author?.id?.startsWith("workflow:")&&e.author.name?`${e.author.name}: ${s} ${t}`:`Tidied ${s} ${t}`}var y=e=>e,v=(e,o)=>o===void 0?{}:{[e]:o};function Ge(e,o,i){let n=f(e)?.store??e,t=y(n),s=Z(i.lineage);if(s===void 0)throw new h("A suggestion says what it is based on: { basis, confidence? }");let r=i.author??t.by;if(i.expiresAt!==void 0&&Number.isNaN(Date.parse(i.expiresAt)))throw new h(`A suggestion expires at a time: "${i.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let a=t.actMeanings(),d=w(o,a),l=R(n).find(p=>w(p.calls,a)===d);if(l)return n.log.get(l.id);t.refuseDeclined(o,r);let u=t.rehearsal();u.suggesting=!0;let g=u.applying(o,{author:r,lineage:s,...v("via",i.via)});if(g.ops.length===0)return;let c=[...new Set(g.ops.flatMap(p=>p.described??[]))],A=g.ops.filter(p=>p.mutation!==null&&p.author===r),T=o.length>1&&A.length===o.length?A.map(p=>p.intent):void 0,S={id:t.nextId(),seq:n.log.length,batch:t.mintBatch("batch"),author:r,intent:g.ops.map(p=>p.intent).join("; "),...v("batchIntent",i.intent),mutation:null,primitives:[],reads:[],writes:[],...c.length>0?{described:c}:{},at:t.now(),...v("via",i.via),lineage:s,suggests:o,...v("suggestsSaid",T),...v("expiresAt",i.expiresAt)};return n.log.append(S),n.notify(z,[S]),S}function R(e,o,i={}){let n=f(e),t=n?.store??e,s=o??n?.principal,r=(s!==void 0?t.seenBy(s):t).log.all();return oe(r,a=>t.graph.has(a),{now:y(t).now(),dismissed:i.dismissed,voter:s})}function se(e,o,i){let n=f(e),t=n?.store??e,s=i??n?.principal??y(t).by;return o.calls.every(r=>t.permits(r,s).ok)}function re(e,o,i,n={}){let t=f(e)?.store??e,s=n.author??y(t).by;b(t,o,s);let r=t.applyAll([{name:ee,args:{suggestion:o,vote:i}}],{...n,author:s});return i===null?r:{...r,voted:i}}function b(e,o,i){let n=R(e,i).find(s=>s.id===o),t=n?void 0:e.log.get(o);if(t?.suggests&&j(t,y(e).now()))throw new h(`That suggestion expired on ${t.expiresAt.slice(0,10)}.`);if(!n)throw new h("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return n}function Le(e,o,i={}){let n=f(e)?.store??e,{items:t,...s}=i,r=s.author??y(n).by,a=b(n,o,r),d=t===void 0?a.items:a.items.filter(c=>t.includes(c.at));if(t!==void 0&&(t.length===0||d.length!==new Set(t).size))throw new h("Name the changes to accept by their place among those still waiting in the suggestion.");let l={...a,calls:d.map(c=>c.call)};if(!se(n,l,r))return re(n,o,"for",{...s,author:r});let u=n.log.get(o)?.suggests?.length??d.length,g=d.length<u?{items:d.map(c=>c.at)}:{};return n.applyAll(l.calls,{...s,author:r,lineage:{...a.lineage,suggestion:o,...g}})}function Fe(e,o,i={}){let n=f(e)?.store??e,t=i.author??y(n).by,s=b(n,o,t);if(!se(n,s,t))return re(n,o,"against",{...i,author:t});let r=ae(s)&&i.intent===void 0?{intent:`Declined ${xe(we(s))} proposal: ${s.intent}`}:{};return n.undo(s.batch,{...i,...r,author:t})}function ze(e,o,i={}){let n=f(e)?.store??e,t=i.author??y(n).by,s=b(n,o,t);if(s.author.kind!==t.kind||s.author.id!==t.id)throw new h("Only who made a suggestion withdraws it: a person declines it (declineSuggestion).");return n.undo(s.batch,{...i,author:t})}var Ae={kind:"system",id:"tidying",name:"Graview, tidying",automated:!0};N.op=(e,o,i,n,t,s)=>{let r=e,{suggestion:a,vote:d}=i.args,l=b(r,a,t),u=M(t)?I(t):void 0,g=d==="for"?`For: ${l.intent}`:d==="against"?`Against: ${l.intent}`:`Withdraws a vote on: ${l.intent}`;return{id:o.id,seq:r.log.length,batch:n,author:t,intent:g,mutation:i,primitives:[],reads:[],writes:[],...l.about.length>0?{described:l.about}:{},at:o.at,...s.via!==void 0?{via:s.via}:{},vote:{suggestion:a,vote:d,...u!==void 0?{advisory:!0,voter:u}:{}}}};N.accepting=(e,o)=>{let i=e,n=i.tidying?.autoAcceptAt;if(n===void 0||o.vote?.vote!=="for")return;let t=o.vote.suggestion,s=R(i).find(l=>l.id===t);if(!s)return;let a=[...D(i.log.all()).get(t)??[]].filter(([,l])=>l==="for").map(([l])=>l);if(a.length<n)return;let d=P(s.author)?s.author:Ae;return{calls:s.calls,author:d,lineage:{...s.lineage,suggestion:t,voters:a.slice(0,X)}}};var ae=e=>e.lineage?.proposedBy!==void 0,we=e=>e.author.name??e.author.id??"Somebody",xe=e=>/s$/i.test(e)?`${e}'`:`${e}'s`;function Ye(e,o,i,n){let t=f(e)?.store??e,s=y(t).actMeanings(),r=w(i,s),a=R(t,o).find(l=>ae(l)&&w(l.calls,s)===r);if(a)return t.log.get(a.id);let d={calls:i.map(({name:l,args:u})=>({name:l,args:u})),...v("intent",n)};return t.applyAll([{name:Q,args:d}],{author:o}).ops.find(l=>l.suggests!==void 0)}function qe(e,o,i){if(!e||!e.grants.some(t=>t.propose!==void 0))return[];let n=new Set(q(e,o,i));return i.filter(t=>!n.has(t)&&H(t).some(s=>J(e,o,t.name,s)))}export{fe as a,me as b,ve as c,Ge as d,R as e,se as f,re as g,Le as h,Fe as i,ze as j,ae as k,Ye as l,qe as m};
@@ -1,19 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{d as C,e as re}from"./chunk.UDU545CL.js";import{e as ee}from"./chunk.7VAHHEDX.js";import{b as S}from"./chunk.5AD2QHWH.js";import{k as X}from"./chunk.3FKKH2XU.js";import{G as se,Ka as V,Ta as J,V as Z,Xa as Q}from"./chunk.VLX7YWVH.js";import{a as K}from"./chunk.SDO3U72B.js";import{T as Y,Z as M,la as U}from"./chunk.IQGSEAQ2.js";import{b as D}from"./chunk.AJZBJBMO.js";var h=D(se(),1);var n=D(Z(),1),Re=9,le=40,ge=2;function de(e){let r=new Map;for(let i of e.allNodes())r.set(i.kind,(r.get(i.kind)??0)+1);return r}var ue=(e,r)=>(e.far??[]).reduce((i,a)=>i+(r.get(a)??0),0);function ce(e,r,i){if(i)return i.flatMap(s=>e.filters.filter(u=>u.key===s));let a=de(r),o=new Set(e.filters.filter(s=>s.about==="edge"&&ue(s,a)>le).map(s=>s.key));return e.filters.filter(s=>s.about==="edge"?!o.has(s.key):s.about==="via"?o.has(s.key.split(".")[0]):!0)}function pe(e,r){let i=e.filter(a=>a.about==="field"&&a.type==="choice"&&(a.options?.length??0)>0);return r?i:i.slice(0,ge)}var fe=520;function ye(e,r,i,a){let o=i.filters.find(s=>s.key===a.key);if(!o)return`${a.key}: ${a.value}`;if(o.about==="is")return a.value.charAt(0).toUpperCase()+a.value.slice(1);if(o.about==="via")return`${o.label}: ${S(e.tryDefinition(o.far?.[0]??""),o.key.split(".")[1],a.value)}`;if(o.about==="edge"){if(a.value==="*")return`${o.label}: anything`;if(a.value==="none")return`${o.label}: nothing`;let s=r.getNode(a.value);return`${o.label}: ${s?U(e.tryDefinition(s.kind),s):a.value}`}if(o.type==="date"){let[s,u]=a.value.split(":");return`${o.label} ${s} ${u?Y(u):""}`.trim()}if(o.type==="boolean")return`${o.label}: ${a.value==="true"?"yes":"no"}`;if(o.type==="number"){let s=a.value.lastIndexOf(":"),u=a.value.slice(0,Math.max(0,s));if(u==="at-most"||u==="at-least")return`${o.label}: ${u==="at-most"?"at most":"at least"} ${S(e.tryDefinition(i.kind),o.key,Number(a.value.slice(s+1)))}`}return o.type==="text"?`${o.label}: ${a.value}`:`${o.label}: ${S(e.tryDefinition(i.kind),o.key,a.value)}`}var P=e=>/^[A-Z][a-z]/.test(e)?e.charAt(0).toLowerCase()+e.slice(1):e;function me(e){return e?.type==="date"?{asc:"Earliest first",desc:"Latest first"}:e?.type==="number"?{asc:"Lowest first",desc:"Highest first"}:e?.type==="boolean"?{asc:"No first",desc:"Yes first"}:e?.type==="choice"?{asc:"In their order",desc:"In reverse order"}:{asc:"A to Z",desc:"Z to A"}}var x=V(K(()=>(__graviewPreload(import.meta.url,["./chunk.SADHOSRC.js","./chunk.4DZOAB4D.js","./chunk.UDU545CL.js","./chunk.7VAHHEDX.js","./chunk.75JQCTR6.js","./chunk.5IEZF433.js","./chunk.5AD2QHWH.js","./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.37I45R6V.js")))),N=x.part((e,r)=>(0,n.jsx)(e.ArrangeLists,{...r}),{what:"This list",quiet:!0}),he=x.part((e,r)=>(0,n.jsx)(e.ArrangeChips,{...r}),{what:"This list",quiet:!0}),Oe=()=>x.load(),q=new Map;function Te(e){let{schema:r,graph:i,kind:a,arrangement:o,onChange:s}=e,u=e.offers??ee(r,a),g=e.testId??"arrange",y=C(e.allow,"sort")&&u.sorts.length>1,m=C(e.allow,"group")&&u.groups.length>0,F=C(e.allow,"filter")?ce(u,i,e.filters):[],L=e.chips?pe(F,e.filters):[],H=F.filter(t=>!L.includes(t)),G=H.length>0,_=e.query!==!1&&e.allow!==!1,w=we(e.noun,e.kept),v=e.past&&e.past.count>0?e.past:null;if(!y&&!m&&!G&&!_&&!w&&!v)return null;let z=t=>JSON.stringify(re(t)),R=`${g}|${a}`,p={current:q.get(R)??{words:new Set,latest:null,at:0}};q.set(R,p.current),p.current.latest&&Date.now()-p.current.at>1500&&!p.current.words.has(z(o))&&(p.current={words:new Set,latest:null,at:0},q.set(R,p.current));let d=p.current.latest??o,b=t=>{let l={...p.current.latest??o,...t};for(let c of Object.keys(l))l[c]===void 0&&delete l[c];p.current.latest=l,p.current.at=Date.now(),p.current.words.add(z(l)),s(l)},f=d.filter??[],O=t=>{let l=f.filter((c,I)=>I!==t);b({filter:l.length>0?l:void 0})},A=t=>f.some(l=>l.key===t.key&&l.value===t.value),te=t=>A(t)?O(f.findIndex(l=>l.key===t.key&&l.value===t.value)):b({filter:[...f,t]}),T=d.sort?u.sorts.find(t=>t.key===d.sort.by):void 0,j=d.group?u.groups.find(t=>t.key===d.group.by):void 0,ne=me(T),k={schema:r,graph:i,offers:{...u,filters:H},arrangement:d,set:b,toggle:te,has:A,testId:g},ae=(t,l)=>A({key:t,value:l})?O(f.findIndex(c=>c.key===t&&c.value===l)):b({filter:[...f.filter(c=>c.key!==t),{key:t,value:l}]}),oe=d.sort?(0,n.jsxs)(n.Fragment,{children:["Sorted by ",P(T?.label??d.sort.by),(0,n.jsx)("span",{"aria-hidden":"true",children:d.sort.direction==="desc"?" \u2193":" \u2191"})]}):"Sort",ie=d.group?.bucket&&j?.buckets?`, a ${d.group.bucket} each`:"",B=d.group?`Grouped by ${P(j?.label??d.group.by)}${ie}`:"Group";return(0,n.jsxs)("div",{"data-testid":`${g}-bar`,role:"group","aria-label":"Arrange",className:"graview-arrange",style:e.style,onPointerEnter:x.prefetch,onFocus:x.prefetch,children:[(0,n.jsx)("style",{children:xe}),(0,n.jsxs)("div",{className:"graview-arrange-line",children:[w?(0,n.jsxs)("span",{className:"graview-arrange-count","data-testid":`${g}-count`,children:[w.kept?(0,n.jsx)("span",{"data-testid":`${g}-kept`,children:w.kept}):null,w.words]}):null,v?(0,n.jsxs)("button",{type:"button",className:"graview-arrange-open","data-testid":`${g}-past`,title:`${M(v.count)} more behind the horizon \u2014 press to widen the view to the past`,onClick:t=>{let l=t.currentTarget.closest("[data-graview-view]"),c=t.currentTarget;v.widen();let I=0,W=()=>{if(document.activeElement!==c&&document.activeElement!==document.body&&c.isConnected)return;let $=l?.querySelector('[role="group"][aria-label="Arrange"] :is(button, input)');if($&&$!==c&&$.isConnected)return $.focus({preventScroll:!0});++I<120&&requestAnimationFrame(W)};requestAnimationFrame(W)},children:["+",M(v.count)," past"]}):null,f.map((t,l)=>{let c=ye(r,i,u,t);return(0,n.jsxs)("span",{className:"graview-arrange-token","data-testid":`${g}-condition`,children:[c,(0,n.jsx)("button",{type:"button","aria-label":`Remove: ${c}`,title:"Remove",onClick:()=>O(l),children:"\xD7"})]},`${t.key}:${t.value}`)}),y?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,n.jsx)(E,{testId:`${g}-sort`,value:d.sort?.by??"",set:d.sort!==void 0,label:"Sort",name:d.sort?`Sorted by ${P(T?.label??d.sort.by)}, ${ne[d.sort.direction].toLowerCase()}`:"Sort",list:t=>(0,n.jsx)(N,{which:"sort",done:t,...k}),children:oe})}):null,m?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,n.jsx)(E,{testId:`${g}-group`,value:d.group?.by??"",set:d.group!==void 0,label:"Group",name:B,list:t=>(0,n.jsx)(N,{which:"group",done:t,...k}),children:B})}):null,G?(0,n.jsx)("span",{className:"graview-arrange-part",children:(0,n.jsx)(E,{testId:`${g}-add`,value:"",set:!1,label:"Filter",name:f.length>0?`Filter \u2014 ${f.length} on`:"Filter",list:t=>(0,n.jsx)(N,{which:"filter",done:t,...k}),children:"Filter"})}):null,y||m?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-all",children:(0,n.jsx)(E,{testId:`${g}-all`,value:"",set:!1,label:"Arrange",name:"Arrange: sort and group",list:t=>(0,n.jsx)(N,{which:"all",done:t,parts:{sort:y,group:m,filter:!1},...k}),children:"Arrange"})}):null,_?(0,n.jsxs)("label",{className:"graview-arrange-words-at",children:[(0,n.jsx)("span",{style:X,children:"Find"}),(0,n.jsx)("input",{type:"search",className:"graview-arrange-words","data-testid":`${g}-query`,value:d.query??"",placeholder:"Find\u2026",onChange:t=>b({query:t.target.value.length>0?t.target.value:void 0})})]}):null,L.length>0&&e.chips?(0,n.jsx)(h.Suspense,{fallback:null,children:(0,n.jsx)(he,{offers:L,chips:e.chips,schema:r,graph:i,kind:a,arrangement:d,has:A,choose:ae,testId:g})}):null,e.end]})]})}function we(e,r){if(!r)return null;let i=r.shown!==r.of;if(!e)return i?{words:"",kept:`${r.shown} of ${r.of}`}:null;let a=r.of===1?e.one:e.many;return i?{words:` ${a}`,kept:`${r.shown} of ${r.of}`}:{words:`${r.of} ${a}`}}function E({testId:e,value:r,set:i,label:a,name:o,list:s,children:u}){let g=Q("arrange",{align:"start"}),y=(0,h.useRef)(null);return(0,h.useEffect)(()=>{g.open&&y.current?.querySelector('[aria-pressed="true"]')?.focus({preventScroll:!0})},[g.open]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"graview-arrange-open","data-testid":e,"data-set":i?"":void 0,value:r,"aria-label":o,...g.trigger,onClick:g.toggle,children:[u,(0,n.jsx)(be,{})]}),g.open?(0,n.jsx)("div",{...g.pane,ref:m=>{g.pane.ref(m),y.current=m},role:"group","aria-label":a,"data-testid":"arrange-list","data-arrange":e,className:"graview-arrange-list",style:J,onKeyDown:ve,children:s(()=>g.setOpen(!1))}):null]})}function ve(e){if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;let r=[...e.currentTarget.querySelectorAll("button:not([disabled]), input")];if(r.length===0)return;let i=r.indexOf(document.activeElement);if(document.activeElement instanceof HTMLInputElement&&document.activeElement.type==="date"&&(e.key==="ArrowUp"||e.key==="ArrowDown"))return;e.preventDefault();let a=e.key==="Home"?0:e.key==="End"?r.length-1:e.key==="ArrowDown"?(i+1)%r.length:(i-1+r.length)%r.length;r[a].focus()}function be(){return(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10","aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto",opacity:.7},children:(0,n.jsx)("path",{d:"M2 3.5 L5 6.5 L8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}var xe=`
2
- .graview-arrange{container-type:inline-size;box-sizing:border-box;width:100%;min-width:0;max-width:100%}
3
- .graview-arrange-line{display:flex;flex-wrap:wrap;align-items:center;gap:2px 6px;min-width:0;font-size:.875rem;line-height:1.35;color:var(--graview-ink-muted)}
4
- .graview-arrange-count{margin-right:2px;color:var(--graview-ink-muted)}
5
- .graview-arrange-part{display:inline-flex;align-items:center;min-width:0}
6
- .graview-arrange-count~.graview-arrange-part::before{content:"\xB7" / "";margin-right:6px;color:var(--graview-ink-muted)}
7
- .graview-arrange-open{display:inline-flex;align-items:center;gap:5px;min-height:28px;min-width:0;max-width:100%;margin:0;padding:0 6px;border:1px solid transparent;border-radius:7px;background:none;box-shadow:none;font:inherit;letter-spacing:normal;text-transform:none;text-align:left;color:var(--graview-ink-muted);cursor:pointer}
8
- .graview-arrange-open[data-set]{color:var(--graview-ink)}
9
- .graview-arrange-open:hover,.graview-arrange-open[aria-expanded=true]{border-color:var(--graview-edge);color:var(--graview-ink)}
10
- .graview-arrange :focus-visible,.graview-arrange-list :focus-visible{outline:2px solid var(--graview-accent);outline-offset:1px}
11
- .graview-arrange-all{display:none}
12
- @container (max-width: ${fe-1}px){.graview-arrange-one{display:none}.graview-arrange-all{display:inline-flex}}
13
- .graview-arrange-token{display:inline-flex;align-items:center;gap:0;min-width:0;min-height:26px;box-sizing:border-box;padding:0 2px 0 10px;border:1px solid var(--graview-edge);border-radius:999px;background:var(--graview-panel);color:var(--graview-ink);overflow-wrap:anywhere}
14
- .graview-arrange-token button{display:inline-flex;align-items:center;justify-content:center;min-width:24px;min-height:24px;margin:0;padding:0;border:0;border-radius:6px;background:none;font:inherit;line-height:1;color:var(--graview-ink-muted);cursor:pointer}
15
- .graview-arrange-token button:hover{color:var(--graview-ink);background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
16
- .graview-arrange-words-at{display:inline-flex;min-width:0;max-width:100%}
17
- .graview-arrange-words{box-sizing:border-box;width:min(100%,12rem);min-height:28px;margin:0;padding:0 8px;border:1px solid transparent;border-radius:7px;background:transparent;font:inherit;color:var(--graview-ink)}
18
- .graview-arrange-words:hover,.graview-arrange-words:focus{border-color:var(--graview-edge)}
19
- `;function Ie(e){let r=[];return e.query&&r.push(`\u201C${e.query}\u201D`),e.filter?.length&&r.push(`${e.filter.length} condition${e.filter.length===1?"":"s"}`),e.group&&r.push(`by ${e.group.by}`),e.sort&&r.push(`sorted by ${e.sort.by}`),r.length>0?r.join(" \xB7 "):null}export{Re as a,le as b,ge as c,de as d,ue as e,ce as f,pe as g,fe as h,ye as i,P as j,me as k,Oe as l,Te as m,Ie as n};
@@ -1 +0,0 @@
1
- import{k as a,l as b,m as c,n as d,o as e,p as f,q as g,r as h,s as i}from"./chunk.O7HHNQK4.js";import"./chunk.BJUUSIQY.js";import"./chunk.TQ2G4AM4.js";import"./chunk.X36BYTEG.js";import"./chunk.LDMBJC3B.js";import"./chunk.XOZU4OFA.js";import"./chunk.G7YLK4PX.js";import"./chunk.GH5UBSQI.js";import"./chunk.2JEN2RCB.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{i as GhostTray,h as InlineAiMenu,g as askAgain,c as askInline,a as askOf,b as drawPanel,d as heldSuggestion,e as suggestOnce,f as takeOffer};
@@ -1 +0,0 @@
1
- import{a}from"./chunk.ATHLE33D.js";import"./chunk.T4TRJDBF.js";import"./chunk.APUQIELA.js";import"./chunk.S6QZBWCJ.js";import"./chunk.LTOQ22ZJ.js";import"./chunk.2TCOLAL2.js";import"./chunk.FUPYIOXZ.js";import"./chunk.3OEODIHB.js";import"./chunk.X36BYTEG.js";import{b as n}from"./chunk.K2PXP5H6.js";import"./chunk.U5P23GO7.js";import"./chunk.GH5UBSQI.js";import"./chunk.GZHZLJBF.js";import"./chunk.3SAESG6X.js";import"./chunk.OJGHDWI6.js";import"./chunk.F6BNFLQM.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{V as i}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as o}from"./chunk.AJZBJBMO.js";var e=o(i(),1);function m({entries:d,style:l,headingStyle:p,className:r}){return(0,e.jsxs)("section",{...r?{className:r}:{},"data-testid":"record-ai","aria-label":"What AI did here",style:{display:"grid",gap:10,...l},children:[(0,e.jsx)("h2",{style:p??{margin:0,fontSize:"1rem"},children:"What AI did here"}),(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,fontSize:"0.875rem"},children:d.slice(0,8).map(t=>(0,e.jsx)(n,{entry:t,undo:s=>(0,e.jsx)(a,{batch:s})},t.id))})]})}export{m as RecordInteractions};
@@ -1 +0,0 @@
1
- import{a as D,c as L}from"./chunk.7SRSE5IS.js";import{a as R,f as T,g as W,h as I,i as K}from"./chunk.B3WVCSW5.js";import{Vd as N,je as j}from"./chunk.IQGSEAQ2.js";var J=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),G=e=>e?._zod?.def;function S(e){let t=G(e);for(;t&&(t.type==="optional"||t.type==="default"||t.type==="nullable"||t.type==="prefault");)t=G(t.innerType);return t}function q(e){if(e?.type==="boolean")return["true","false"];if(e?.type==="array"&&(e=S(e.element)),e?.type==="enum")return(e.entries?Object.values(e.entries):e.values??[]).filter(t=>typeof t=="string")}var A=e=>e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]/g," ").replace(/^./,t=>t.toUpperCase());function _(e,t,s){let d=e.tryDefinition(t);if(!d)return[];let c=new Set(d.display?.hide??[]),a=[];for(let[l,o]of Object.entries(d.fields.shape??{})){if(l==="id"||l==="kind"||l==="label"||c.has(l))continue;let i=S(o);if(i?.type==="array"||i?.type==="object"||i?.type==="record")continue;let f=q(i);a.push({key:l,label:A(l),...f?{options:f}:{}})}let g=new Map;for(let[l,o]of Object.entries(d.edges??{}))g.set(l,o.to==="*"?[]:[...o.to]);for(let l of e.definitions)if(l.kind!==t)for(let[o,i]of Object.entries(l.edges??{}))!g.has(o)&&(i.to==="*"||i.to.includes(t))&&g.set(o,[l.kind]);let u=[];for(let[l,o]of g){a.push({key:l,label:A(l)});let i=s&&o.length===1&&o[0]!==t?e.tryDefinition(o[0]):void 0;for(let[f,p]of Object.entries(i?.fields.shape??{})){let y=S(p);y?.type==="enum"&&!i?.display?.hide?.includes(f)&&u.push({key:`${l}.${f}`,label:`${A(l)} \xB7 ${A(f)}`,options:q(y)})}}return a.push(...u),a.push({key:"is",label:"Is",options:d.lifecycle?["current","past","any","flagged","clear"]:["flagged","clear"]}),a}var C=e=>e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function F(e,t,s,d={}){if(s==null)return{ok:!0};if(!J(s))return{ok:!1,says:'A filter is an object of a field and the value it keeps, like { where: { stage: "building" } }.'};let c=Object.entries(s);if(c.length===0)return{ok:!0};let a=[];for(let o of t)for(let i of _(e,o,d.through===!0))a.some(f=>f.key===i.key)||a.push(i);let g=t[0]?e.tryDefinition(t[0]):void 0,u=g?g.plural??`${A(g.kind)}s`:"These",l=[];for(let[o,i]of c){let f=a.find(y=>y.key===o);if(!f)return{ok:!1,says:`${u.replace(/^./,y=>y.toUpperCase())} have no field "${o}" to filter by${a.length>0?`; they filter by ${C(a.map(y=>y.key))}`:""}.`};if(typeof i!="string"&&typeof i!="number"&&typeof i!="boolean")return{ok:!1,says:`The filter on "${o}" is ${Array.isArray(i)?"a list":i===null?"null":`a ${typeof i}`}; it keeps one value: a word, a number, or true or false.`};let p=String(i);if(p.trim().length===0)return{ok:!1,says:`The filter on "${o}" keeps nothing; give it a value, or leave "${o}" out.`};if(p.includes(","))return{ok:!1,says:`The filter on "${o}" holds a comma, which an address reads as a second filter; keep one value.`};if(f.options&&f.options.length>0&&!f.options.includes(p))return{ok:!1,says:`${f.label} has no choice "${p}"; its choices are ${C(f.options.map(y=>`"${y}"`))}.`};l.push(`${o}:${p}`)}return{ok:!0,filter:l.join(",")}}var U=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");function V(e,t){let s=e.find(a=>a.as===t);if(s)return s;let d=t.trim().toLowerCase(),c=U(t);return e.find(a=>a.title!==void 0&&a.title.trim().toLowerCase()===d)??(c?e.find(a=>a.as===c||a.title!==void 0&&U(a.title)===c):void 0)}function ee(e){let t=[];for(let s of e){if(typeof s!="object"||s===null)continue;let{as:d,slug:c,title:a,kind:g}=s,u=typeof d=="string"&&d.length>0?d:typeof c=="string"&&c.length>0?c:void 0;!u||t.some(l=>l.as===u)||t.push({as:u,title:typeof a=="string"?a:u,kind:typeof g=="string"?g:""})}return t}var M=e=>` Its places: ${e.map(t=>typeof t=="string"?`"${t}"`:t.title&&t.title!==t.as?`"${t.as}" (${t.title})`:`"${t.as}"`).join(", ")||"none"}.`;var m=e=>`"${e.length>80?`${e.slice(0,79)}\u2026`:e}"`,O=(e,t)=>`${"place"in e?`The place ${m(e.place)}`:`${m(e.record)} is no record this viewer may see and`} is no place of this app: it goes nowhere.${M(t)}`;function E(e){let t={};for(let s of e.split(",")){let d=s.indexOf(":");d>0&&(t[s.slice(0,d).trim()]=s.slice(d+1).trim())}return t}function ae(e,t=new Set){return e.kinds.filter(s=>!t.has(s)).map(s=>({slug:N(e,s).slice(1),kind:s}))}function le(e,t,s={}){let d=[],c;for(let g of t){if(typeof g!="object"||g===null)continue;let{as:u,slug:l,title:o,kind:i,over:f,hidden:p,name:y}=g,h=typeof u=="string"&&u.length>0?u:typeof l=="string"&&l.length>0?l:void 0;if(h){if(typeof i!="string"||i.length===0){h===j&&typeof o=="string"&&o.length>0&&(c=o);continue}d.push({kind:i,title:typeof o=="string"&&o.length>0?o:h,as:h,...Array.isArray(f)&&f.every(n=>typeof n=="string")?{over:f}:{},...p===!0?{hidden:!0}:{},...typeof y=="string"?{name:y}:{}})}}let a=s.pages??(c!==void 0?{scene:c}:void 0);return L(e,d,{...a?{pages:a}:{},...s.kept?{kept:s.kept}:{}})}var H=(e,t)=>e.find(s=>s.is==="list"&&(s.as===t||s.kind===t));function Z(e,t){let s=t.places.filter((r,k,w)=>r.is!=="list"&&w.findIndex(b=>b.as===r.as)===k),d=[...new Set(t.places.map(r=>r.as))],c=[...new Set([...t.places.filter(r=>r.is==="list").map(r=>r.as),...t.lists.map(r=>r.slug).filter(r=>!d.includes(r))])],a;if(e.section!==void 0&&e.section!==null){if(typeof e.section!="string"||D(e.section).length===0||e.section.length>120)return{ok:!1,says:`The section ${typeof e.section=="string"?m(e.section):"asked for"} names nothing on a page: a section is a heading's words or an element's id, like "shipping-soon". It goes nowhere.`};a=e.section}let g=a!==void 0?{section:a}:{};if("record"in e&&t.sees(e.record))return e.where!==void 0&&e.where!==null?{ok:!1,says:`${m(e.record)} is one record, and a filter narrows a list or a place: it goes nowhere. Go to { place, where } for a list narrowed.`}:{ok:!0,arrival:{record:e.record,...g}};let u="place"in e?e.place:e.record,l=V(t.places,u),o=l?.is==="list"?void 0:l,i=o?void 0:l?.is==="list"?l:H(t.places,u),f=o||i?void 0:t.lists.find(r=>r.slug===u||r.kind===u),p=i?i.kind??void 0:f?.kind;if(!o&&p===void 0)return{ok:!1,says:`${O(e,s)}${B(c)}`};let y=o?o.kind?[o.kind]:[]:[p],h;if(e.where!==void 0&&e.where!==null){if(!t.schema||y.length===0)return{ok:!1,says:`The place ${m(u)} cannot be narrowed here: it goes nowhere.`};let r=F(t.schema,y,e.where,{through:p!==void 0});if(!r.ok)return{ok:!1,says:`The filter on ${m(u)} goes nowhere: ${r.says}`};h=r.filter}let n=h?{filter:h}:{};return{ok:!0,arrival:o?{place:o.as,...n,...g}:{list:p,...n,...g}}}var B=e=>e.length===0?"":` Its lists: ${e.slice(0,8).map(t=>`"${t}"`).join(", ")}${e.length>8?` and ${e.length-8} more`:""}.`,z="http://www.w3.org/1999/xhtml",Q="http://www.w3.org/2000/svg",X=e=>{let t=e;return t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||e.type==="click"&&typeof t.button=="number"&&t.button!==0};function de(e){let t=new WeakSet,s=new WeakSet,d=new WeakMap,c=new WeakMap,a=n=>Z(n,{sees:e.sees,places:e.places(),lists:e.lists?.()??[],...e.schema?{schema:e.schema}:{}}),g=n=>{let r=a(n);return r.ok?e.onNavigate?.(r.arrival):e.onLost?.(r.says),r.ok},u=n=>{let r=n.getAttribute("data-record"),k=n.getAttribute("data-place"),w=n.getAttribute("data-filter"),b=n.getAttribute("data-section"),v={...w?{where:E(w)}:{},...b?{section:b}:{}};if(r)return{record:r,...v};if(k)return{place:k,...v}},l=n=>{if(!e.hrefOf)return;let r=u(n),k=r?a(r):void 0;return k?.ok?e.hrefOf(k.arrival):void 0},o=n=>n.hasAttribute("tabindex")?!1:(n.setAttribute("tabindex","0"),t.add(n),!0),i=n=>{t.delete(n)&&n.removeAttribute("tabindex")},f=n=>{s.delete(n)&&n.getAttribute("role")==="link"&&n.removeAttribute("role")},p=n=>{let r=d.get(n);r&&(d.delete(n),n.getAttribute("href")===r.href&&n.removeAttribute("href"),r.target!==null&&!n.hasAttribute("target")&&n.setAttribute("target",r.target))},y=n=>{let r=c.get(n);r&&(c.delete(n),i(r))},h={link(n){if(!W(n,[...n.querySelectorAll("input, select, textarea")].some(R))){if(!n.hasAttribute("data-graview-link"))return;n.removeAttribute("data-graview-link"),f(n),i(n),p(n),y(n);return}n.hasAttribute("data-graview-link")||n.setAttribute("data-graview-link","");let k=n.localName==="a"&&(n.namespaceURI===z||n.namespaceURI===Q),w=n.getAttribute("href"),b=d.get(n),v=w!==null&&b?.href!==w,$=k&&!v?l(n):void 0;if($!==void 0){w!==$&&n.setAttribute("href",$),d.set(n,{href:$,target:b?b.target:n.getAttribute("target")}),n.removeAttribute("target"),f(n),i(n);return}if(v?d.delete(n):p(n),I(n,n.querySelectorAll("a"))){f(n),i(n),y(n);return}if(!n.hasAttribute("role")&&(k||T(n))&&(n.setAttribute("role","link"),s.add(n)),n.localName==="tr"&&n.namespaceURI===z){i(n);let x=[...n.children].find(P=>P.localName==="td"||P.localName==="th");c.get(n)!==x&&y(n),x&&!c.has(n)&&o(x)&&c.set(n,x);return}n.localName!=="button"&&o(n)},refresh(n){for(let r of n.querySelectorAll("[data-record], [data-place], [data-graview-link]"))h.link(r)},pressed(n,r,k){if(n.type!=="click"&&!(n.type==="keydown"&&n.key==="Enter"))return!1;let w=K(r,k,b=>b.hasAttribute("data-graview-link"));return w?(n.stopPropagation(),d.has(w)&&X(n)||(n.preventDefault(),h.follow(w)),!0):!1},follow(n){let r=u(n);r&&g(r)},go:g};return h}export{ee as a,M as b,m as c,O as d,E as e,ae as f,le as g,Z as h,de as i};
@@ -1 +0,0 @@
1
- import{a as re,b as B,c as oe}from"./chunk.4VRX7FCO.js";import{A as Q,C as X,E as Y,I as ee,K as ne,N as te,g as W,h as q,j as z,p as j,s as Z,t as _,x as U,y as J}from"./chunk.3FKKH2XU.js";import{a as M}from"./chunk.DLWFULWE.js";import{G as se,La as K,Sa as G,V as T,da as I,fa as D,ya as $}from"./chunk.VLX7YWVH.js";import{_c as V,cd as N}from"./chunk.IQGSEAQ2.js";import{b as P}from"./chunk.AJZBJBMO.js";var o=P(se(),1);var u=P(T(),1),ge=e=>typeof e=="object"?e:{};function be({rootRef:e,firstLook:t,app:n}){let r=(0,o.useCallback)(()=>e.current,[e]);return t?(0,u.jsx)(te,{firstLook:t,root:r,app:n}):null}function we(e,t,n){let{app:r}=e,a=(0,o.useMemo)(()=>{let i=ee(t(r.schema,r.viewSpecs),r),d=n?de(i,n):i,s=e.views?e.views(r.schema,d):i,c=s===d?i:$(i,s);return ne(c,r.schema,X(e.brand??r.brand,r.schema)),n?n.register(c):c},[e.views,r.schema,r.viewSpecs,r.lenses,r.pages,r.home,n]);return K(a,e.keptViews)}function de(e,t){let n={...e,register(r,a,i,d){return d?.name!==t.name&&e.register(r,a,i,d),n},...e.home?{home:(r,a)=>(t.home||e.home(r,a),n)}:{}};return n}var k=e=>e?e.getBoundingClientRect().height:0;function Se(e,t,n){let r=(0,o.useRef)(n);r.current=n;let a=n!==void 0;(0,o.useLayoutEffect)(()=>{let i=e.current;if(!i||!a)return;let d=()=>{let y=[...i.children],g=y.find(b=>b.hasAttribute("data-graview-app-bar")),p=y.find(b=>b.hasAttribute("data-embed-content")),h=p?.querySelector("[data-embed-measure]")??null,l=y.find(b=>b.hasAttribute("data-graview-place-line"));return{strip:g,line:l,content:p,measure:h}},s=-1,c=()=>{let{strip:y,line:g,content:p,measure:h}=d(),l=Math.ceil(k(y)+k(g)+k(h||p));l!==s&&(s=l,r.current?.(l))};if(c(),typeof ResizeObserver>"u")return;let m=new ResizeObserver(c),S=()=>{m.disconnect();let{strip:y,line:g,content:p,measure:h}=d();for(let l of[i,y,g,p,h])l&&m.observe(l)};S();let v=new MutationObserver(()=>{S(),c()});return v.observe(i,{childList:!0}),()=>{m.disconnect(),v.disconnect()}},[e,t,a])}var ve=480,ce=0;function Re(e){let{app:t,seed:n,scheme:r="auto",brand:a=t.brand,fonts:i=!0,height:d="100%",label:s}=e,c=(0,o.useRef)(null);G(c);let m=d==="viewport"?"100dvh":d,S=z(typeof m=="string"&&/vh\b/.test(m)),v=(0,o.useMemo)(()=>`graview-embed-${++ce}`,[]),y=(0,o.useMemo)(()=>e.store??e.remote?.store??B(t,n),[e.store,e.remote,t,n]),g=e.presence??e.remote?.presence,p=e.hostContext?.theme,h=oe(r==="auto"&&p===void 0,a?.scheme),l=r==="auto"?p??h:r,b=(0,o.useMemo)(()=>M(l,a,{scope:`.${v}`}),[l,a,v]);W(e.favicon?N(e.assetsAt,V(a)):void 0),q(e.favicon?a:void 0),(0,o.useEffect)(()=>{if(!i||typeof document>"u")return;let R=re(a);if(!R||document.querySelector(`link[href="${R}"]`))return;let f=document.createElement("link");f.rel="stylesheet",f.href=R,document.head.appendChild(f)},[a,i]);let x=(0,o.useRef)(void 0);(0,o.useLayoutEffect)(()=>{let R=c.current,f=x.current;if(x.current=s,!R||!s)return;let ie=w=>{let E=w.getAttribute("aria-label")??"",A=f&&f!==s?E.startsWith(`${f} \xB7 `)?E.slice(f.length+3):E===f?"":E:E;A===s&&(w.getAttribute("role")==="region"||w.tagName==="SECTION"&&!w.hasAttribute("role"))&&w.setAttribute("role","group");let O=A.startsWith(`${s} \xB7 `)||A===s?A:A?`${s} \xB7 ${A}`:s;O!==E&&w.setAttribute("aria-label",O)},H=()=>R.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(w=>{w.hasAttribute("data-graview-named-by-lens")||ie(w)});H();let L=new MutationObserver(H);return L.observe(R,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>L.disconnect()},[s]);let F=S?`${m}`.replace(/([\d.]+)[sdl]?vh\b/g,(R,f)=>`${+f*S/100}px`):m;return{rootRef:c,scope:v,css:b,scheme:l,store:y,presence:g,brand:a,auto:d==="auto",height:F}}function Ee({rootRef:e,board:t,onReport:n,where:r}){let a=(0,o.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]),i=(0,o.useRef)(r);i.current=r;let d=(0,o.useMemo)(()=>n?{tell:n,where:()=>i.current()}:void 0,[n]);return(0,u.jsx)(j,{board:t,anchor:a,report:d})}function Ae(e){let t=e.split(/[?#]/)[0].split("/").filter(Boolean).map(n=>{try{return decodeURIComponent(n)}catch{return n}});return t.length===0?{place:"home"}:t[0]==="places"?{place:t[1]??"places"}:{place:t[0],...t[1]!==void 0?{record:t[1]}:{}}}function xe(e,t,n){return{brand:n,locale:e.locale,timeZone:e.timeZone,principal:e.principal,seats:e.seats,presence:t,typing:e.remote?.typing,people:e.people,memory:e.memory,presenceTtlMs:e.presenceTtlMs,onKeepLens:e.onKeepLens,onProposeChange:e.onProposeChange,ai:e.ai,files:e.files,assetsAt:e.assetsAt,resolveApp:e.resolveApp,history:e.history,linkedRecords:e.linkedRecords,subscriptions:e.subscriptions,dismissals:e.dismissals,whileAway:e.whileAway,workflowRuns:e.workflowRuns,keptViews:e.keptViews,onExport:e.onExport,signIn:e.signIn,menuSections:e.menuSections,app:e.app}}function ke({name:e,heading:t,faces:n,at:r,without:a,home:i,reach:d,standing:s,hostActions:c,barActions:m,keeping:S,onFind:v,switch:y,named:g=!0}){let{brand:p,store:h,principal:l,views:b}=I();D();let x=a?.has("places")?[]:Z({store:h,principal:l,views:b}),F=Q();return(0,u.jsx)(U,{brand:p,name:e,named:g,description:p?.subtitle,heading:t,faces:n,home:i,places:x,current:r===null?null:_(x,r),reach:d,onFind:v,...y?{switch:y}:{},...n||r===null?{scenePlaces:F}:{},...m?{actions:m}:{},tools:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Y,{clean:s}),(0,u.jsx)(J,{...c?{hostActions:c}:{},...S?{keeping:S}:{}})]})})}var Fe=e=>e===!1?2:Math.min(e+1,6);function Pe(e){let[t,n]=(0,o.useState)(e),r=(0,o.useRef)(void 0),a=(0,o.useRef)(void 0),i=(0,o.useMemo)(()=>({go:r,at:n,pending:a}),[]),d=(0,o.useCallback)(s=>{if(r.current){r.current(s);return}a.current=s,n(s)},[]);return{at:t,setAt:n,steering:i,steer:d}}function le(e){let t=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof t=="string"&&t.length>0?t:typeof e=="object"?"Error":typeof e}}var C=()=>typeof performance<"u"?performance.now():Date.now();function Be(e,t){let n=(0,o.useRef)({onError:e,face:t});return n.current={onError:e,face:t},(0,o.useCallback)((r,a)=>n.current.onError?.(le(r),{module:a.module,face:n.current.face}),[])}function Ce(e,t){let n=(0,o.useRef)(null);n.current===null&&(n.current=C());let r=(0,o.useRef)({onReady:e,face:t});r.current={onReady:e,face:t};let a=(0,o.useRef)(!1);return(0,o.useCallback)(i=>{a.current||(a.current=!0,r.current.onReady?.({ms:Math.max(0,C()-(n.current??C())),face:i}))},[])}var ae=class extends o.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t,n){console.error(`[graview] ${this.props.module} threw while rendering`,t,n.componentStack),this.props.report(t,{module:this.props.module})}render(){return this.state.failed?(0,u.jsxs)("div",{role:"alert","data-graview-face-error":this.props.module,...this.props.content?{"data-embed-content":""}:{},style:this.props.content?{flex:"1 1 auto",display:"grid",alignContent:"center",justifyItems:"center",gap:8,padding:24,background:"var(--graview-ground)",color:"var(--graview-ink)",fontSize:"0.9375rem"}:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,u.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,u.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{ge as a,be as b,we as c,Se as d,ve as e,Re as f,Ee as g,Ae as h,xe as i,ke as j,Fe as k,Pe as l,Be as m,Ce as n,ae as o};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk.REXU6ARY.js";import"./chunk.G4JJXA63.js";import"./chunk.BIDL7GQD.js";import"./chunk.TA2JTUNX.js";import"./chunk.HZPRMHSL.js";import"./chunk.LDMBJC3B.js";import"./chunk.XOZU4OFA.js";import"./chunk.G7YLK4PX.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.2E62YCMZ.js";import"./chunk.DUP2CGVH.js";import"./chunk.YEXFVDRA.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ZA5TDCBC.js";import"./chunk.2JEN2RCB.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{i as draftAnswer,h as draftFromLens,b as draftSight,l as draftView,a as isDraftFailure,c as judgeLens,d as lensEditOf,f as lensFromSpec,j as recipeDraft,g as recipeOfLens,m as refineDraft,o as runDraftTool,e as takeBackEditOf,k as templateDraft,n as withReaderLenses};
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as U,b as V,d as b,e as B,f as C,g as W}from"./chunk.WX23K7ZU.js";import{a as p,b as T,c as S,e as _}from"./chunk.BBLIT7S7.js";import{b as z}from"./chunk.G5BVZLCM.js";import{a as J,b as h,e as A}from"./chunk.DMENNIHT.js";import{a as R}from"./chunk.SDO3U72B.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var Q=R(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.K2HDEL7I.js")));function te(d,e){let f=d.ownerDocument,u=f.defaultView,t=f.createElement("iframe");t.setAttribute("sandbox",T),t.setAttribute("referrerpolicy","no-referrer"),t.setAttribute("allow",""),t.setAttribute("title",e.title??e.view),t.setAttribute("data-guest-view",e.view),t.setAttribute("aria-busy","true"),t.style.border="0",t.style.width="100%",t.style.display="block",t.src=e.url;let a={applied:0,refused:0,dropped:0},P=h(e.limits),i,y,o={applied:0,refused:0,dropped:0},v=()=>{if(!i)return;let r=i.stats;a.applied+=r.applied-o.applied,a.refused+=r.refused-o.refused,a.dropped+=r.dropped-o.dropped,o={...r}},O=W(u,()=>l(),"data"),g=()=>C(()=>e.theme?.()??b(d),e.brand,O),L="",l=()=>{i&&(L=JSON.stringify(g()),i.push())},k=B(f,()=>{i&&JSON.stringify(g())!==L&&l()}),n,w=!1,D=e.pictures?z(Q,({createGuestPictures:r})=>{n=r(u,{as:"data",view:`"${e.title??e.view}"`,pictures:e.pictures,...e.limits?{limits:e.limits}:{},...e.file?{file:e.file}:{},moved:()=>{i?.push(),G&&E()}}),w&&x()}):()=>{},G=!1,c,N=()=>{!G||n?.waiting()||(clearTimeout(c),t.removeAttribute("data-guest-view-failed"),t.removeAttribute("aria-busy"),t.setAttribute("data-guest-view-drawn",""))},E=()=>{clearTimeout(c),c=setTimeout(N,250)},F=setTimeout(()=>{i||(t.removeAttribute("aria-busy"),t.setAttribute("data-guest-view-failed","silent"))},e.limits?.readyMs??8e3),H=()=>{v(),i?.dispose(),y?.close(),i=void 0,y=void 0,o={applied:0,refused:0,dropped:0}},M=r=>{if(!(r.source===null||r.source!==t.contentWindow)){if(r.origin!==S||!P.message()){a.dropped+=1;return}if(!_(r.data)||r.data.protocol!==1){a.dropped+=1;return}if(e.pictures&&!n){w=!0;return}x()}},x=()=>{w=!1,H();let r=U(),m=new MessageChannel;y=m.port1;let I=A({store:e.store,principal:e.principal,view:e.view,nonce:r,send:s=>m.port1.postMessage(s),...e.input?{input:e.input}:{},...e.reads?{reads:e.reads}:{},...n?{hand:n.hand}:{},theme:g,...e.places?{places:()=>[...new Set(e.places().map(s=>s.as))],placesShown:e.places}:{},...e.onNavigatePlace?{onNavigatePlace:e.onNavigatePlace}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{},...e.onArrive?{onArrive:e.onArrive}:e.goTo?{onArrive:s=>V(e.goTo(),s)}:{},...e.onLost?{onLost:e.onLost}:{},onSize:s=>{e.onSize?e.onSize(s):t.style.height=`${s}px`,N()},...e.limits?{limits:e.limits}:{},limiter:P});i=I,m.port1.onmessage=s=>{I.receive(s.data),v()};let j={graview:"host-hello",protocol:1,nonce:r,view:e.view};t.contentWindow.postMessage(j,"*",[m.port2]),l(),G=!0,E()};return u.addEventListener("message",M),d.appendChild(t),d.removeAttribute("aria-busy"),{iframe:t,update:l,get stats(){return v(),a},dispose(){H(),clearTimeout(F),clearTimeout(c),k(),O.dispose(),D(),n?.dispose(),u.removeEventListener("message",M),t.remove()}}}export{p as GUEST_PROTOCOL,T as GUEST_SANDBOX,S as OPAQUE_ORIGIN,A as createGuestHost,h as createGuestLimiter,te as mountGuestView,J as readAcross,b as readTheme};
@@ -1 +0,0 @@
1
- import{b as P,c as m,d as k}from"./chunk.NGRL3QOI.js";import{b as v,c as w,d as S,e as x,f as M}from"./chunk.B3WVCSW5.js";import"./chunk.DN7UCBOA.js";import"./chunk.DMENNIHT.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.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 +0,0 @@
1
- import"./chunk.WVUJXDXZ.js";import{a as F,b as K,c as pe}from"./chunk.ZA5TDCBC.js";import"./chunk.2JEN2RCB.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.GZHZLJBF.js";import{o as me}from"./chunk.3SAESG6X.js";import"./chunk.OJGHDWI6.js";import"./chunk.F6BNFLQM.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{G as Te,M as C,Q as ue,V as ce,da as ge,ga as he}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import{Aa as se,Ba as Y,ra as oe,rd as de,ua as x,wa as le,ya as W,za as E}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as q}from"./chunk.AJZBJBMO.js";var g=q(Te(),1);async function ye(e,t){let a=await createImageBitmap(e);try{let i=Math.min(1,t/Math.max(a.width,a.height)),r=document.createElement("canvas");r.width=Math.max(1,Math.round(a.width*i)),r.height=Math.max(1,Math.round(a.height*i));let l=r.getContext("2d");if(l===null)throw new Error("This browser will not give us a canvas to resize with.");return l.drawImage(a,0,0,r.width,r.height),r}finally{a.close()}}var n=q(ce(),1),He=2048,Ie=.85;function T(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function H(e){if(e.type==="application/pdf")return"PDF";let t=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return t?t.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ke(e){let t=[...new Set(e.map(a=>a==="image/*"?"pictures":a==="video/*"?"videos":a==="*/*"||a==="*"?"any file":`${H({type:a})} files`))];return t.length<=1?t[0]??"no files":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function xe(e,t){if(e.length===0)return!0;let a=`${t.split("/")[0]}/*`;return e.some(i=>i==="*"||i==="*/*"||i===t||i===a)}var fe=/^image\/hei[cf]$|\.hei[cf]$/i,be=e=>fe.test(e.type)||fe.test(e.name),De={mov:"video/quicktime",mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",ogv:"video/ogg"},Be=e=>De[/\.([a-z0-9]{2,4})$/i.exec(e)?.[1]?.toLowerCase()??""];async function je(e,t,a){let i=e.name||(a.camera?"photo.jpg":"file"),r=e.type||(be({type:"",name:i})?"image/heic":Be(i)??"application/octet-stream"),l=be({type:r,name:i}),u=r.startsWith("image/")||l;if(a.image&&!u)return{refused:`\u201C${i}\u201D isn\u2019t a picture.`};if(a.video)return r.startsWith("video/")?J({blob:e,name:i,type:r},t):{refused:`\u201C${i}\u201D isn\u2019t a video.`};if(l||u&&/^image\/(jpeg|webp)$/.test(r)&&(a.camera||e.size>t.maxBytes||e.size>15e5))try{let c=await ye(e,He),b=await new Promise(m=>c.toBlob(m,"image/jpeg",Ie));if(b)return J({blob:b,name:l?i.replace(/\.hei[cf]$/i,"")+".jpg":i,type:"image/jpeg",width:c.width,height:c.height},t)}catch{if(l&&!xe(t.kinds,r))return{refused:`\u201C${i}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let p={};if(u&&!l)try{let c=await createImageBitmap(e);p={width:c.width,height:c.height},c.close()}catch{}return J({blob:e,name:i,type:r,...p},t)}function J(e,t){return xe(t.kinds,e.type)?e.blob.size>t.maxBytes?{refused:`\u201C${e.name}\u201D is ${T(e.blob.size)}; this host takes files up to ${T(t.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${H(e)} file; this host takes ${ke(t.kinds)}.`}}async function _e(e,t,a,i=!1){let r;try{r=await t.upload(e.blob,e.name)}catch(u){let s=u instanceof Error&&u.message.trim()?u.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${s}`}}return le(r)?a&&!W(r)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:i&&!E(r)?{refused:`The host kept \u201C${e.name}\u201D as ${H(r)}, not as a video.`}:{...r,...r.width===void 0&&e.width?{width:e.width}:{},...r.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var $="var(--graview-radius, 8px)",P={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function ee(e){let t=C(),a=ue()?.past!=null,[i,r]=(0,g.useState)(!1),l=t?.kept?ze(t,e.href):!0,[,u]=(0,g.useState)(0);return(0,g.useEffect)(()=>{if(typeof l!="object")return;let s=!0;return l.then(()=>s&&u(p=>p+1)),()=>void(s=!1)},[l]),[l===!1||a&&i,()=>r(!0)]}var Q=new WeakMap;function ze(e,t){let a=Q.get(e)?.get(t);if(a!==void 0)return a;let i;try{i=e.kept(t)}catch{return!0}if(typeof i=="boolean")return i;let r=Q.get(e)??new Map;Q.set(e,r);let l=Promise.resolve(i).then(u=>u!==!1,()=>!0);return r.set(t,l),l.then(u=>r.set(t,u)),l}function te({file:e,style:t}){return(0,n.jsx)("span",{role:"img","aria-label":`${F(e)}, removed later`,"data-graview-removed-later":e.href,style:{display:"grid",placeItems:"center",textAlign:"center",padding:4,boxSizing:"border-box",fontSize:"0.6875rem",lineHeight:1.2,color:"var(--graview-ink-muted)",border:"1px dashed var(--graview-edge-bright)",borderRadius:$,...t},children:"removed later"})}function X({file:e,size:t=56,style:a}){let i=C(),[r,l]=ee(e);return r?(0,n.jsx)(te,{file:e,style:{width:t,height:t,flex:"none",...a}}):E(e)?(0,n.jsx)(Ae,{file:e,size:t,...a?{style:a}:{},onError:l}):(0,n.jsx)("img",{onError:l,src:x(i,e.href),alt:F(e),width:t,height:t,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:t,height:t,objectFit:"cover",borderRadius:$,display:"block",flex:"none",background:"var(--graview-edge)",...a}})}function Fe(e){let[t,a]=(0,g.useState)({}),i=e.duration??t.duration;return[{...i!==void 0?{duration:i}:{},width:e.width??t.width,height:e.height??t.height},u=>{let s=u.currentTarget;a({...Number.isFinite(s.duration)&&s.duration>0?{duration:s.duration}:{},...s.videoWidth>0&&s.videoHeight>0?{width:s.videoWidth,height:s.videoHeight}:{}})}]}var Ne=320,$e=(e,t)=>`${F(e)}, ${se({...t!==void 0?{duration:t}:{}})}`,Oe=(0,n.jsx)("span",{"data-graview-play-glyph":"","aria-hidden":"true",style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,n.jsxs)("svg",{viewBox:"0 0 24 24",width:"40%",height:"40%",style:{maxWidth:40,maxHeight:40,filter:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.5))"},children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"11",fill:"rgb(0 0 0 / 0.55)"}),(0,n.jsx)("path",{d:"M9.5 7.5v9l7-4.5z",fill:"#fff"})]})});function Ae({file:e,size:t,style:a,onError:i}){let r=C(),[l,u]=Fe(e),s={width:t,height:t,objectFit:"cover",display:"block",borderRadius:$,background:"var(--graview-edge)"};return(0,n.jsxs)("span",{role:"img","aria-label":$e(e,l.duration),"data-graview-thumb":e.href,"data-graview-video-thumb":"",style:{position:"relative",display:"block",width:t,height:t,flex:"none",...a},children:[e.poster?(0,n.jsx)("img",{src:x(r,e.poster),alt:"",width:t,height:t,loading:"lazy",decoding:"async",onError:i,style:s}):(0,n.jsx)("video",{src:x(r,e.href),preload:"metadata",muted:!0,playsInline:!0,"aria-hidden":"true",tabIndex:-1,width:t,height:t,onLoadedMetadata:u,onError:i,style:s}),Oe,l.duration!==void 0?(0,n.jsx)("span",{"data-graview-video-clock":"","aria-hidden":"true",style:{position:"absolute",right:3,bottom:3,padding:"0 4px",borderRadius:4,background:"rgb(0 0 0 / 0.65)",color:"#fff",fontSize:"0.6875rem",lineHeight:"16px",fontVariantNumeric:"tabular-nums"},children:K(l.duration)}):null]})}function Ge(){let e=()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):void 0,[t,a]=(0,g.useState)(()=>e()?.matches===!0);return(0,g.useEffect)(()=>{let i=e();if(!i)return;let r=()=>a(i.matches);return r(),i.addEventListener?.("change",r),()=>i.removeEventListener?.("change",r)},[]),t}function Ue({file:e,autoplay:t=!1,cover:a=!1}){let i=C(),[r,l]=ee(e),[u,s]=Fe(e),p=Ge(),c=t&&p,b=(0,g.useRef)(null),m=(0,g.useRef)(c);if((0,g.useEffect)(()=>{let d=b.current;!d||!t||(c?d.pause():m.current&&d.play?.()?.catch?.(()=>{}),m.current=c)},[t,c]),r)return(0,n.jsx)(te,{file:e,style:{width:"100%",aspectRatio:"16 / 9"}});let v=u.width!==void 0&&u.height!==void 0,w=a?{display:"block",width:"100%",height:"100%",objectFit:"cover",background:"#000"}:{display:"block",width:"100%",maxWidth:v?Math.max(u.width,Ne):"100%",height:"auto",maxHeight:"80vh",aspectRatio:v?`${u.width} / ${u.height}`:"16 / 9",borderRadius:$,background:"#000"};return(0,n.jsxs)("figure",{"data-graview-video-figure":e.href,style:{margin:0,display:"grid",gap:4,minWidth:0,...a?{height:"100%"}:{}},children:[(0,n.jsx)("video",{ref:b,"data-graview-video":e.href,...t?{"data-graview-video-autoplay":""}:{},...a?{"data-graview-video-cover":""}:{},...c?{"data-graview-video-still":""}:{},src:x(i,e.href),...e.poster?{poster:x(i,e.poster)}:{},...t?{muted:!0,loop:!0,...c?{}:{autoPlay:!0}}:{controls:!0},preload:t&&!c?"auto":"metadata",playsInline:!0,...v?{width:u.width,height:u.height}:{},"aria-label":$e(e,u.duration),onLoadedMetadata:s,onError:l,style:w,children:e.captions?(0,n.jsx)("track",{kind:"captions",src:x(i,e.captions),srcLang:"en",label:"Captions",default:!0}):null}),t?null:(0,n.jsx)("figcaption",{"data-graview-video-said":"",style:P,children:[e.caption??e.name,...u.duration!==void 0?[K(u.duration)]:[]].join(" \xB7 ")})]})}function qe({file:e,onOpen:t}){let a=C(),[i,r]=ee(e);return i?(0,n.jsx)(te,{file:e,style:{width:"100%",aspectRatio:"1"}}):(0,n.jsx)("button",{type:"button","aria-label":`Open ${F(e)} full size`,onClick:l=>t(l.currentTarget),style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:$},children:(0,n.jsx)("img",{src:x(a,e.href),alt:F(e),loading:"lazy",decoding:"async",onError:r,style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:$,display:"block",background:"var(--graview-edge)"}})})}function Ye({src:e,file:t}){let[a,i]=(0,g.useState)(!1);return(0,n.jsx)("object",{data:e,type:"application/pdf","aria-label":F(t),"data-graview-pdf":a?"shown":"waiting",onLoad:()=>i(!0),style:a?{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:$}:{width:"100%",height:0,display:"block"}})}function Z({files:e,label:t,autoplay:a,cover:i}){let r=C(),l=d=>x(r,d.href),u=e.filter(W),s=e.filter(E),p=e.filter(d=>!W(d)&&!E(d)),[c,b]=(0,g.useState)(null),m=(0,g.useRef)(null),v=(0,g.useRef)(null);(0,g.useEffect)(()=>{let d=m.current;c!==null&&d&&!d.open&&d.showModal?.()},[c]);let w=c===null?void 0:u[c];return(0,n.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[u.length>0?(0,n.jsx)("ul",{"data-graview-gallery":"","aria-label":t,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:u.map((d,I)=>(0,n.jsx)("li",{style:{minWidth:0},children:(0,n.jsx)(qe,{file:d,onOpen:M=>{v.current=M,b(I)}})},d.href))}):null,s.length>0?(0,n.jsx)("ul",{"data-graview-videos":"","aria-label":t,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:12},children:s.map(d=>(0,n.jsx)("li",{style:{minWidth:0},children:(0,n.jsx)(Ue,{file:d,...a?{autoplay:a}:{},...i?{cover:i}:{}})},d.href))}):null,p.length>0?(0,n.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:p.map(d=>(0,n.jsxs)("li",{"data-graview-document":d.type,style:{display:"grid",gap:6,minWidth:0},children:[d.type==="application/pdf"?(0,n.jsx)(Ye,{src:l(d),file:d}):null,d.type==="application/pdf"?(0,n.jsxs)("span",{"data-graview-file-line":"",style:{minWidth:0,overflowWrap:"anywhere",lineHeight:1.5},children:[d.name," ",(0,n.jsxs)("span",{style:P,children:["\xB7 ",H(d)," \xB7 ",T(d.bytes)," \u2014"]})," ",(0,n.jsx)("a",{href:l(d),target:"_blank",rel:"noopener",children:"Open"})," ",(0,n.jsx)("span",{style:P,"aria-hidden":"true",children:"/"})," ",(0,n.jsx)("a",{href:l(d),download:d.name,children:"Download"})]}):(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,n.jsx)("a",{href:l(d),download:d.name,children:d.name}),(0,n.jsxs)("span",{style:P,children:[H(d)," \xB7 ",T(d.bytes)]})]}),d.caption?(0,n.jsx)("span",{style:P,children:d.caption}):null]},d.href))}):null,w?(0,n.jsx)("dialog",{ref:m,"data-graview-full":w.href,"aria-label":F(w),onClose:()=>{b(null),v.current?.focus()},onClick:d=>{d.target===d.currentTarget&&d.currentTarget.close()},style:{padding:0,border:0,borderRadius:$,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,n.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,n.jsx)("img",{src:l(w),alt:F(w),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,n.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,n.jsx)("span",{children:w.caption??w.name}),(0,n.jsx)("form",{method:"dialog",style:{margin:0},children:(0,n.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function Se({value:e,onChange:t,several:a,image:i,video:r=!1,label:l,thumbs:u=!0}){let s=C(),p=(0,g.useId)(),c=(0,g.useRef)(null),b=(0,g.useRef)(null),[m,v]=(0,g.useState)(null),[w,d]=(0,g.useState)(null),[I,M]=(0,g.useState)([]),[O,A]=(0,g.useState)(!1),L=i?"image/":r?"video/":void 0,R=s?L?s.kinds.filter(o=>o.startsWith(L)||o==="*"||o==="*/*"):s.kinds:[],Pe=s?s.kinds.length===0||R.length>0:!1,We=!r&&(s?s.kinds.length===0||(i?R:s.kinds).some(o=>o.startsWith("image/")||o.startsWith("*")):!1),ne=!!s&&s.maxBytes>0,D=ne&&(!L||Pe),B=i?"picture":r?"video":"file",ae=a?`${B}s`:`a ${B}`,ie=L?R.length>0?R.join(","):`${L}*`:s?.kinds.join(",")||void 0,Me=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,G=(0,g.useRef)(e);G.current=e;let re=(0,g.useRef)(null),j=(0,g.useRef)(null);(0,g.useEffect)(()=>{let o=j.current;if(!o||o.from===e)return;j.current=null;let h=re.current?.children,f=h?.[Math.min(o.at,h.length-1)];((o.what==="move"?f?.querySelector("[data-graview-file-move]"):null)??f?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let _=async(o,h)=>{if(!s||o.length===0)return;let f=a?o:o.slice(0,1),y=[],S=[];f.length<o.length&&S.push(`${l} holds one ${B}, so ${o.slice(1).map(k=>`\u201C${k.name||"the photo"}\u201D`).join(", ")} ${o.length>2?"were":"was"} left out.`),M([]),d(null);for(let k of f){v(`Sending ${k.name||"the photo"}\u2026`);let U=await je(k,s,{image:i,video:r,camera:h==="camera"});if("refused"in U){S.push(U.refused);continue}let V=await _e(U,s,i,r);"refused"in V?S.push(V.refused):[...a?G.current:[],...y].some(Ve=>Ve.href===V.href)?S.push(`\u201C${V.name}\u201D is already here.`):y.push(V)}if(v(null),M(S),y.length!==0)try{t(a?[...G.current,...y]:y.slice(-1)),d(`Added ${y.map(k=>k.name).join(", ")}.`)}catch(k){M([...S,k instanceof Error?k.message:String(k)])}},z=(o,h,f)=>{try{j.current=f?{...f,from:e}:null,t(o),d(h)}catch(y){j.current=null,M([y instanceof Error?y.message:String(y)])}},N=o=>o?Array.from(o):[],Re=o=>{let h=N(o.clipboardData?.files);!D||h.length===0||(o.preventDefault(),_(h,"pasted"))},Le=o=>{A(!1),D&&(o.preventDefault(),_(N(o.dataTransfer?.files),"dropped"))};return(0,n.jsxs)("div",{role:"group","aria-labelledby":`${p}-label`,"data-graview-file-editor":"","data-graview-dropping":O?"":void 0,onPaste:Re,onDragOver:o=>{D&&(o.preventDefault(),A(!0))},onDragLeave:()=>A(!1),onDrop:Le,style:{display:"grid",gap:8,minWidth:0,padding:O?6:0,outline:O?"2px dashed var(--graview-accent)":"none",borderRadius:$},children:[(0,n.jsx)("span",{id:`${p}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:l}),e.length>0&&(a||e.length>1)?(0,n.jsx)("ul",{ref:re,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((o,h)=>(0,n.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[u&&(W(o)||E(o))?(0,n.jsx)(X,{file:o,size:40}):null,(0,n.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:o.name}),(0,n.jsx)(we,{file:o,onCaption:f=>z(e.map((y,S)=>S===h?ve(y,f):y),f?`${o.name} now says \u201C${f}\u201D.`:`${o.name} says its name again.`)}),a&&h>0?(0,n.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${o.name} earlier`,onClick:()=>z(e.map((f,y)=>y===h-1?o:y===h?e[h-1]:f),`Moved ${o.name} earlier.`,{at:h-1,what:"move"}),children:"\u2191"}):null,a?(0,n.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${o.name}`,onClick:()=>z(e.filter((f,y)=>y!==h),`Removed ${o.name}.`,{at:h,what:"remove"}),children:"Remove"}):null]},`${h}:${o.href}`))}):e.length===1?(0,n.jsx)(we,{file:e[0],onCaption:o=>z([ve(e[0],o)],o?`${e[0].name} now says \u201C${o}\u201D.`:`${e[0].name} says its name again.`)}):null,D?(0,n.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,n.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:a,...ie?{accept:ie}:{},"data-graview-file-input":"","aria-label":`Choose ${ae}`,onChange:o=>{let h=N(o.currentTarget.files);o.currentTarget.value="",_(h,"picked")}}),(0,n.jsx)("button",{type:"button",disabled:m!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!a?`Replace the ${B}`:`Choose ${ae}`}),We?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("input",{ref:b,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:o=>{let h=N(o.currentTarget.files);o.currentTarget.value="",_(h,"camera")}}),Me?(0,n.jsx)("button",{type:"button",disabled:m!==null,onClick:()=>b.current?.click(),children:"Take a photo"}):null]}):null,(0,n.jsxs)("span",{style:P,"data-graview-file-takes":"",children:["or drop or paste ",a?"them":"it"," here \xB7 ",s.kinds.length>0?ke(R.length>0?R:s.kinds):"any file",", up to ",T(s.maxBytes)]})]}):(0,n.jsx)("p",{style:{...P,margin:0},"data-graview-file-none":"",children:ne?`This host doesn\u2019t take ${r?"videos":"pictures"}, so none can be added here.`:"This host doesn\u2019t take files, so none can be added here."}),(0,n.jsx)("p",{"aria-live":"polite",style:{...P,margin:0,minHeight:m||w?void 0:0},"data-graview-file-status":"",children:m??w??""}),I.length>0?(0,n.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:I.map((o,h)=>(0,n.jsx)("p",{style:{margin:0},children:o},h))}):null]})}var ve=(e,t)=>{let{caption:a,...i}=e;return t?{...i,caption:t}:i};function we({file:e,onCaption:t}){let[a,i]=(0,g.useState)(e.caption??"");(0,g.useEffect)(()=>i(e.caption??""),[e.caption]);let r=()=>{let l=a.trim().slice(0,500);l!==(e.caption??"")&&t(l)};return(0,n.jsx)("input",{type:"text",value:a,placeholder:W(e)||E(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${W(e)||E(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:l=>i(l.target.value),onBlur:r,onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),r())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function Ee({field:e,label:t,labelStyle:a,valueStyle:i,style:r,children:l}){return(0,n.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...r},children:[(0,n.jsx)("dt",{style:a,children:t}),(0,n.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...i},children:l})]})}function Ce(e){let{nodeId:t,field:a,label:i,files:r}=e,{fields:l,commit:u}=me(t),s=l.find(m=>m.field===a&&m.takesValue),p=s?.shape,c=p?.type==="several"?p.of:p,b=p?.type==="several";return r.length===0&&c?.type!=="file"?null:(0,n.jsxs)(Ee,{...e,children:[(0,n.jsx)(Z,{files:r,label:i}),s&&c?.type==="file"?(0,n.jsx)(Se,{value:r,thumbs:!1,several:b,image:c.image===!0,video:c.video===!0,label:i,onChange:m=>{let v=b?m:m[m.length-1];v!==void 0&&u(s,v)}}):null]})}function nt(e){switch(e.as){case"field":{if(!e.read)return(0,n.jsx)(Ce,{...e});let{autoplay:t,cover:a,...i}=e;return e.files.length>0?(0,n.jsx)(Ee,{...i,children:(0,n.jsx)(Z,{files:e.files,label:e.label,...t?{autoplay:t}:{},...a?{cover:a}:{}})}):null}case"unfilled":return(0,n.jsx)(Ke,{...e});case"thumb":return(0,n.jsx)(X,{...e});case"block":return e.files.length>0?(0,n.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:de.raised}:{}},children:e.view==="thumb"?(0,n.jsx)(X,{file:e.files[0],size:72}):(0,n.jsx)(Z,{files:e.files,label:e.label,...e.autoplay?{autoplay:!0}:{},...e.cover?{cover:!0}:{}})}):null;case"control":{let t=(0,n.jsx)(Se,{value:Y(e.value),several:e.several,image:e.image,video:e.video===!0,label:e.label,onChange:a=>e.onChange(e.several?a:a[a.length-1])});return e.title===void 0?t:(0,n.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,n.jsx)("legend",{"data-graview-part":"label",children:e.title}),t]})}}}function Ke({nodeId:e,skip:t,labels:a,labelStyle:i,style:r}){let{store:l}=ge(),u=he(e),s=u?l.schema.tryDefinition(u.kind):void 0,p=pe(s).filter(c=>!t.includes(c)&&!(s?.display?.hide??[]).includes(c)&&Y(u?.[c]).length===0);return p.length===0?null:(0,n.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:p.map(c=>(0,n.jsx)(Ce,{nodeId:e,field:c,label:a?.[c]??oe(s,c),files:[],...i?{labelStyle:i}:{},...r?{style:r}:{}},c))})}export{Se as FilesEditor,He as SEND_EDGE,nt as drawFiles,ke as kindsWords,je as prepare,_e as send,T as sizeWords,xe as takes,H as typeWords};