graview 0.1.65 → 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 (261) hide show
  1. package/dist/index.js +4 -4
  2. package/dist/index.js.map +1 -1
  3. package/dist/preview/{chunk.6RZHKQP3.js → chunk.2KFZHUAC.js} +1 -1
  4. package/dist/preview/chunk.2MHNPBHC.js +1 -0
  5. package/dist/preview/{chunk.2PK335JQ.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.INTJD5WG.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.KIQXTQDU.js → chunk.5FNFRVTL.js} +1 -1
  21. package/dist/preview/chunk.5LJVOLKR.js +1 -0
  22. package/dist/preview/{chunk.GPCKOYSF.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.DICM56FT.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.F2TWV4TX.js → chunk.6TLXFMX2.js} +1 -1
  30. package/dist/preview/chunk.72XP2ARZ.js +1 -0
  31. package/dist/preview/{chunk.QSDBF7VL.js → chunk.72ZCLEQC.js} +1 -1
  32. package/dist/preview/{chunk.LY5CY7GE.js → chunk.7BIPZTJB.js} +1 -1
  33. package/dist/preview/chunk.7VADSNPZ.js +1 -0
  34. package/dist/preview/{chunk.IR4OW67N.js → chunk.7VP6Y6D2.js} +1 -1
  35. package/dist/preview/{chunk.C437FVD7.js → chunk.7ZKBYXUM.js} +1 -1
  36. package/dist/preview/chunk.AK7NGFEX.js +6 -0
  37. package/dist/preview/{chunk.FHHVW2WB.js → chunk.ANS2IEEV.js} +1 -1
  38. package/dist/preview/{chunk.LKK5YF2H.js → chunk.B6JRTW3A.js} +1 -1
  39. package/dist/preview/chunk.BCQWAFGD.js +1 -0
  40. package/dist/preview/{chunk.SOMRYDDH.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.IMKD6QQG.js → chunk.BUVTUAB5.js} +1 -1
  45. package/dist/preview/chunk.BXBEGMPO.js +22 -0
  46. package/dist/preview/{chunk.ZYNC73DJ.js → chunk.BZ7QWHAE.js} +1 -1
  47. package/dist/preview/{chunk.AB4RZSYW.js → chunk.C2C3AXGI.js} +16 -16
  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.ZDUTEM3Z.js → chunk.CTASTRQN.js} +1 -1
  52. package/dist/preview/chunk.CU2WCYMK.js +1 -0
  53. package/dist/preview/{chunk.SPCAMQJE.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.7Q43N5JS.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.6YDC6IDA.js → chunk.E7EWNWAN.js} +1 -1
  63. package/dist/preview/chunk.EG7OOJH5.js +1 -0
  64. package/dist/preview/{chunk.J6KNEI5R.js → chunk.EMFOMSMI.js} +1 -1
  65. package/dist/preview/{chunk.5THLLSS4.js → chunk.EQ4OODGO.js} +1 -1
  66. package/dist/preview/{chunk.P6TZGR3A.js → chunk.ES63XSIM.js} +1 -1
  67. package/dist/preview/chunk.EUAO4QNV.js +1 -0
  68. package/dist/preview/{chunk.O2W5JTWA.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.L6FGKJ5H.js → chunk.FBILPNGH.js} +1 -1
  73. package/dist/preview/chunk.FBJAQPZ6.js +1 -0
  74. package/dist/preview/{chunk.FDWRH5P2.js → chunk.FDZE5LTJ.js} +2 -2
  75. package/dist/preview/{chunk.FOSY7MZF.js → chunk.FFOD5B4B.js} +1 -1
  76. package/dist/preview/{chunk.XSWR5LI4.js → chunk.FIFUMX5X.js} +1 -1
  77. package/dist/preview/{chunk.RFVOXX3P.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.PTQPS2FJ.js → chunk.GEFXU4VO.js} +1 -1
  82. package/dist/preview/chunk.GG47EIKO.js +1 -0
  83. package/dist/preview/{chunk.5M34BJIQ.js → chunk.GME63ZHI.js} +1 -1
  84. package/dist/preview/{chunk.IJ3YDBWI.js → chunk.GNEOSHQ6.js} +1 -1
  85. package/dist/preview/{chunk.N2FNHRI2.js → chunk.HOCD7KIR.js} +1 -1
  86. package/dist/preview/chunk.HSSIMVVM.js +1 -0
  87. package/dist/preview/{chunk.S2DOVJRL.js → chunk.I2737CPF.js} +1 -1
  88. package/dist/preview/chunk.I4Z7HVRT.js +1 -0
  89. package/dist/preview/{chunk.F5VEHAP2.js → chunk.IAEHUSQQ.js} +1 -1
  90. package/dist/preview/{chunk.7E4CSXBT.js → chunk.IGK7EZCX.js} +1 -1
  91. package/dist/preview/chunk.INHS3KTK.js +1 -0
  92. package/dist/preview/{chunk.LGRQDILY.js → chunk.IWYMKGZZ.js} +1 -1
  93. package/dist/preview/{chunk.3RFAUIGT.js → chunk.J2MM6BUW.js} +1 -1
  94. package/dist/preview/{chunk.7IGD2K4M.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.2QQ37RCZ.js → chunk.JXNVNFV4.js} +1 -1
  99. package/dist/preview/chunk.K6DFXDPZ.js +1 -0
  100. package/dist/preview/{chunk.NSO6RUKW.js → chunk.KACSYPEV.js} +1 -1
  101. package/dist/preview/{chunk.ZMWAZACO.js → chunk.KBPJ7X7W.js} +1 -1
  102. package/dist/preview/chunk.KF27ME27.js +1 -0
  103. package/dist/preview/{chunk.35E75QJ7.js → chunk.KSIEO5W7.js} +1 -1
  104. package/dist/preview/chunk.L25DCT5S.js +1 -0
  105. package/dist/preview/{chunk.3KUYB5ZT.js → chunk.LETAQTLJ.js} +1 -1
  106. package/dist/preview/{chunk.44ZHHPPJ.js → chunk.LGRVEHXT.js} +2 -2
  107. package/dist/preview/chunk.LINSO5PN.js +1 -0
  108. package/dist/preview/{chunk.LVD3V77M.js → chunk.LLIURXFP.js} +1 -1
  109. package/dist/preview/{chunk.3IZEZPJB.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.CPYBJNHP.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.64FCAUAJ.js → chunk.NJRLJEJY.js} +1 -1
  116. package/dist/preview/chunk.NYLKG25K.js +4 -0
  117. package/dist/preview/{chunk.CD6YWH6T.js → chunk.OEIWIZCP.js} +1 -1
  118. package/dist/preview/{chunk.ZJFXM3LE.js → chunk.OJY7VJ7D.js} +1 -1
  119. package/dist/preview/chunk.OMT4QUZY.js +23 -0
  120. package/dist/preview/{chunk.R2TSTDS3.js → chunk.ONYBW45K.js} +1 -1
  121. package/dist/preview/chunk.OO2OP76C.js +1 -0
  122. package/dist/preview/{chunk.G3Q5IMM3.js → chunk.OOSIKCOS.js} +1 -1
  123. package/dist/preview/{chunk.7VQ3C7F4.js → chunk.OPTYYIGC.js} +1 -1
  124. package/dist/preview/{chunk.TUCSUZNO.js → chunk.OTV5XTBB.js} +1 -1
  125. package/dist/preview/{chunk.74B6KQF4.js → chunk.OWFS2YDQ.js} +1 -1
  126. package/dist/preview/{chunk.CXDGE5ZS.js → chunk.OWO3OV62.js} +1 -1
  127. package/dist/preview/{chunk.BUQKRXI6.js → chunk.PAGEGBUD.js} +1 -1
  128. package/dist/preview/{chunk.CGQ6KXVK.js → chunk.PDDIQ6PK.js} +1 -1
  129. package/dist/preview/{chunk.T3KNLP7C.js → chunk.PFQBCHQA.js} +1 -1
  130. package/dist/preview/{chunk.MH46V556.js → chunk.PPSYUOH7.js} +1 -1
  131. package/dist/preview/{chunk.HJS3LTSR.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.KHAVEYT7.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.CS72MISN.js → chunk.QWNSHISU.js} +1 -1
  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.TGEL6EUA.js +1 -0
  147. package/dist/preview/chunk.TTGKX7LT.js +1 -0
  148. package/dist/preview/chunk.TXHYGFIZ.js +1 -0
  149. package/dist/preview/chunk.U3ED7W2U.js +1 -0
  150. package/dist/preview/chunk.U3HERHAI.js +88 -0
  151. package/dist/preview/chunk.U6QXLNHF.js +15 -0
  152. package/dist/preview/{chunk.FXG5AJF6.js → chunk.U6TEW6YD.js} +1 -1
  153. package/dist/preview/chunk.UJPX3BUV.js +1 -0
  154. package/dist/preview/chunk.V5I4GZEY.js +1 -0
  155. package/dist/preview/{chunk.XTTESA7X.js → chunk.V7W5AQKL.js} +1 -1
  156. package/dist/preview/{chunk.IFBGYFS4.js → chunk.VGHO3VCB.js} +1 -1
  157. package/dist/preview/{chunk.2TZSLREX.js → chunk.VKZIEZ5C.js} +2 -2
  158. package/dist/preview/chunk.VT2YGDK2.js +1 -0
  159. package/dist/preview/{chunk.ZTN7BS5O.js → chunk.W4YDPHCQ.js} +1 -1
  160. package/dist/preview/{chunk.NKYYDFIX.js → chunk.W53YNBSM.js} +1 -1
  161. package/dist/preview/chunk.WAB3L3ZI.js +1 -0
  162. package/dist/preview/chunk.WSDJPXJD.js +1 -0
  163. package/dist/preview/chunk.WSO7JOW5.js +1 -0
  164. package/dist/preview/{chunk.BU5PVRX7.js → chunk.WVLEGCRI.js} +1 -1
  165. package/dist/preview/chunk.XK65Y2KX.js +1 -0
  166. package/dist/preview/chunk.XMQG2PSM.js +50 -0
  167. package/dist/preview/{chunk.QO5RXOCS.js → chunk.XOE4KNP2.js} +2 -2
  168. package/dist/preview/chunk.YIPXZUTT.js +2 -0
  169. package/dist/preview/chunk.YNEHJWJV.js +2 -0
  170. package/dist/preview/{chunk.S3EEY7T3.js → chunk.YXEO3Y65.js} +1 -1
  171. package/dist/preview/chunk.Z274CL7J.js +1 -0
  172. package/dist/preview/{chunk.NBVPWLRY.js → chunk.Z7Y3R3YR.js} +1 -1
  173. package/dist/preview/{chunk.DJMSXXP4.js → chunk.ZBVYD4OX.js} +1 -1
  174. package/dist/preview/{chunk.4O3C2LJF.js → chunk.ZD7T234N.js} +1 -1
  175. package/dist/preview/{chunk.TY74U3EI.js → chunk.ZQR2SN65.js} +1 -1
  176. package/dist/preview/chunk.ZR2TP3BF.js +111 -0
  177. package/dist/preview/chunk.ZRBGYXAO.js +6 -0
  178. package/dist/preview/index.html +56 -54
  179. package/dist/preview/page.js +2 -2
  180. package/dist/preview/splash.js +17 -14
  181. package/package.json +6 -6
  182. package/dist/preview/chunk.2P34ML3O.js +0 -111
  183. package/dist/preview/chunk.2UW5CRHF.js +0 -1
  184. package/dist/preview/chunk.2YMO7ZVX.js +0 -1
  185. package/dist/preview/chunk.33ULA3CG.js +0 -1
  186. package/dist/preview/chunk.3CJLAJXP.js +0 -25
  187. package/dist/preview/chunk.3IJSB5ET.js +0 -1
  188. package/dist/preview/chunk.3KO35VN4.js +0 -1
  189. package/dist/preview/chunk.3L37FY3G.js +0 -4
  190. package/dist/preview/chunk.3WP66LB5.js +0 -1
  191. package/dist/preview/chunk.4GJ7F4SP.js +0 -35
  192. package/dist/preview/chunk.4IJTPV5X.js +0 -1
  193. package/dist/preview/chunk.4JFBLVXJ.js +0 -1
  194. package/dist/preview/chunk.4PCVQEVI.js +0 -1
  195. package/dist/preview/chunk.5FQSYMAE.js +0 -1
  196. package/dist/preview/chunk.5NCLZ4NZ.js +0 -1
  197. package/dist/preview/chunk.5YNLFOBJ.js +0 -5
  198. package/dist/preview/chunk.77XQEDT5.js +0 -1
  199. package/dist/preview/chunk.7HPQI5SY.js +0 -1
  200. package/dist/preview/chunk.A4VA3DU5.js +0 -1
  201. package/dist/preview/chunk.ABSY3UZF.js +0 -1
  202. package/dist/preview/chunk.ARHAD5IS.js +0 -1
  203. package/dist/preview/chunk.BOC2EOGB.js +0 -9
  204. package/dist/preview/chunk.BR6TINGU.js +0 -1
  205. package/dist/preview/chunk.CDEAAWPS.js +0 -1
  206. package/dist/preview/chunk.CXJJB3MK.js +0 -1
  207. package/dist/preview/chunk.CXLQPE4J.js +0 -1
  208. package/dist/preview/chunk.DA4RSHLW.js +0 -1
  209. package/dist/preview/chunk.DJPNVXBQ.js +0 -6
  210. package/dist/preview/chunk.DJVHKBEI.js +0 -1
  211. package/dist/preview/chunk.DVSTLVIH.js +0 -15
  212. package/dist/preview/chunk.E5WJSTOV.js +0 -1
  213. package/dist/preview/chunk.FEGSYSA7.js +0 -1
  214. package/dist/preview/chunk.HJUXC5GM.js +0 -1
  215. package/dist/preview/chunk.HNMSYQRA.js +0 -1
  216. package/dist/preview/chunk.HWLRKOI3.js +0 -1
  217. package/dist/preview/chunk.IHUMKFYH.js +0 -10
  218. package/dist/preview/chunk.IQ54QTA5.js +0 -1
  219. package/dist/preview/chunk.IQC3GOXO.js +0 -1
  220. package/dist/preview/chunk.ISN2QTVL.js +0 -2
  221. package/dist/preview/chunk.J24YPQ5I.js +0 -5
  222. package/dist/preview/chunk.J545NAMY.js +0 -1
  223. package/dist/preview/chunk.K2HDEL7I.js +0 -1
  224. package/dist/preview/chunk.K3JARAWU.js +0 -1
  225. package/dist/preview/chunk.KROR65KD.js +0 -2
  226. package/dist/preview/chunk.KV7GZBJ6.js +0 -50
  227. package/dist/preview/chunk.L7NJLZWV.js +0 -1
  228. package/dist/preview/chunk.LON75VHP.js +0 -1
  229. package/dist/preview/chunk.LQWVJQ5X.js +0 -18
  230. package/dist/preview/chunk.M5W2RHC6.js +0 -1
  231. package/dist/preview/chunk.M6BTLH24.js +0 -1
  232. package/dist/preview/chunk.MAGKI4PD.js +0 -1
  233. package/dist/preview/chunk.MD36ZSM5.js +0 -74
  234. package/dist/preview/chunk.MFZJVHWP.js +0 -1
  235. package/dist/preview/chunk.MHTA4HYB.js +0 -19
  236. package/dist/preview/chunk.N2YM247R.js +0 -1
  237. package/dist/preview/chunk.N35SJWAM.js +0 -1
  238. package/dist/preview/chunk.NJSK3UO2.js +0 -6
  239. package/dist/preview/chunk.OHMHPTEW.js +0 -1
  240. package/dist/preview/chunk.PV2I4UPH.js +0 -1
  241. package/dist/preview/chunk.QFQSSZN7.js +0 -1
  242. package/dist/preview/chunk.RSS6OHXG.js +0 -1
  243. package/dist/preview/chunk.SBCAYTMT.js +0 -1
  244. package/dist/preview/chunk.SMTGRCMG.js +0 -3
  245. package/dist/preview/chunk.TCZIZ2PU.js +0 -1
  246. package/dist/preview/chunk.U74PTRHJ.js +0 -1
  247. package/dist/preview/chunk.UAORKZLO.js +0 -1
  248. package/dist/preview/chunk.UDVTPI2W.js +0 -1
  249. package/dist/preview/chunk.UETLP5KC.js +0 -1
  250. package/dist/preview/chunk.UHI3X2YD.js +0 -1
  251. package/dist/preview/chunk.UL62ELNR.js +0 -1
  252. package/dist/preview/chunk.VRYSZYAD.js +0 -1
  253. package/dist/preview/chunk.VUZFLDOX.js +0 -1
  254. package/dist/preview/chunk.X2NGFOAF.js +0 -1
  255. package/dist/preview/chunk.XE762VL2.js +0 -2
  256. package/dist/preview/chunk.Y2RZ5B4U.js +0 -1
  257. package/dist/preview/chunk.YKMBXMZE.js +0 -1
  258. package/dist/preview/chunk.Z34KASY7.js +0 -1
  259. package/dist/preview/chunk.ZMGKWMID.js +0 -1
  260. package/dist/preview/chunk.ZT5YQSSP.js +0 -21
  261. package/dist/preview/chunk.ZZM75ZTN.js +0 -4
@@ -1 +0,0 @@
1
- import"./chunk.AJZBJBMO.js";var O=e=>Array.isArray(e);function q(e){return e===!0||O(e)||typeof e.width!="number"?Y:e.width}function Q(e){if(e===!0)return()=>!0;if(O(e)){let a=new Set(e);return s=>a.has(s)}let t=new Map;for(let[a,s]of Object.entries(e))typeof s=="string"?t.set(a,new Set([s])):Array.isArray(s)&&t.set(a,new Set(s));return t.size===0?()=>!0:(a,s)=>t.get(a)?.has(s)??!1}var Y=1200,ee="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",J=100,I=4e7,B=e=>/^image\//i.test(e.type)&&!/^image\/svg/i.test(e.type);function P(e,t={}){let a={name:e.name,type:e.type,bytes:e.bytes};return/^video\//i.test(e.type)?{...a,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.caption!==void 0?{caption:e.caption}:{},...e.duration!==void 0?{duration:e.duration}:{},...e.poster?{poster:!0}:{}}:B(e)?{...a,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.caption!==void 0?{caption:e.caption}:{},...t.src!==void 0?{src:t.src}:{},...t.left!==void 0?{left:t.left}:{}}:a}var X=new Set(["id","kind","label"]),N=e=>{let t=e;return typeof t=="object"&&t!==null&&typeof t.href=="string"&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.bytes=="number"};function L(e,t){let a=s=>{let l;for(let[h,u]of Object.entries(s)){if(X.has(h))continue;let m=N(u)?t(u,s,h):Array.isArray(u)&&u.length>0&&u.every(N)?u.map(d=>t(d,s,h)):void 0;m!==void 0&&((l??={...s})[h]=m)}return l??s};return{...e,...e.node?{node:a(e.node)}:{},...e.nodes?{nodes:e.nodes.map(a)}:{}}}var F=e=>e.toLocaleString("en-US"),S=(e,t)=>`The picture "${e.name}" on ${t.label?`"${t.label}"`:"a record"}`;function U(e,t,a){let s=q(e),l=t?.pictureBytes??15e5,h=t?.picturesBytes??12e6,u=Math.round(s*Math.min(2,Math.max(1,a||1)));return{width:s,perFile:l,perView:h,need:u,reckon:d=>Math.min(l,Math.ceil(d.bytes*(d.width&&d.width>u?(u/d.width)**2:1))),chosen:Q(e)}}var j=(e,t)=>`${S(e,t)} is left out: at ${F(e.bytes)} bytes it is more than the host fetches for a view.`,C=(e,t,a,s)=>`${S(e,t)} is left out: the view ${a} is handed at most ${F(s)} bytes of pictures, and the pictures before it, in the order its records are handed, took them. A view that draws only some kinds' pictures says which ("pictures": ["<kind>"]).`;function te(e,t){let{perView:a,reckon:s,chosen:l}=U(t.pictures,t.limits,2),h=[],u=0;return{props:L(e,(d,f,b)=>{if(!B(d)||!l(f.kind,b))return P(d);let v=y=>(h.includes(y)||h.push(y),P(d,{left:y}));if(d.bytes>I)return v(j(d,f));let g=s(d);return u+g>a?v(C(d,f,t.view,a)):(u+=g,P(d,{src:t.standIn}))}),left:h}}function ne(e,t){let{width:a,perFile:s,perView:l,need:h,reckon:u,chosen:m}=U(t.pictures,t.limits,e.devicePixelRatio),d=t.shrink??((n,r,i)=>Z(e,n,r,i)),f=new Map,b=new Map,v=new Set,g=!1,y,k=-1/0,z=()=>{if(y!==void 0||g)return;let n=()=>{y=void 0,!g&&(k=e.performance.now(),t.moved())},r=k+J-e.performance.now();r<=0?(y=!0,queueMicrotask(n)):y=e.setTimeout(n,r)},$=n=>{v.has(n)||(v.add(n),t.onLeft?.(n))},x=n=>{n?.state==="ready"&&(b.delete(n.url),n.url.startsWith("blob:")&&e.URL.revokeObjectURL(n.url))},T=S,V,H=n=>new Promise(r=>{let i=new e.Image;i.onload=()=>r(!0),i.onerror=()=>r(!1),e.setTimeout(()=>r(!1),2e3),i.src=n}),M=n=>new Promise((r,i)=>{let w=new e.FileReader;w.onload=()=>r(String(w.result)),w.onerror=i,w.readAsDataURL(n)}),W=async n=>{if(t.as==="blob"){let i=e.URL.createObjectURL(n);return V??=H(i),await V?{url:i,drawn:i}:{url:i,drawn:await M(n)}}let r=await M(n);return{url:r,drawn:r}},E=(n,r,i)=>({state:"left",said:`${T(n,r)} could not be loaded for the view ${t.view}${i?`: the host answered ${i}.`:"."}${i&&!t.file?" A host that serves the app under a base says where a record's files are (file, on the view's definition).":""}`}),D=async(n,r)=>{let i=E(n,r),w=t.file?t.file(n.href):n.href;if(w===void 0)return i;let o=new e.URL(w,e.document.baseURI);if(o.origin!==e.location.origin||!/^https?:$/.test(o.protocol))return i;let p=await e.fetch(o.href,{credentials:"same-origin"}),A=(p.headers.get("content-type")??"").split(";")[0].trim();if(!p.ok)return E(n,r,String(p.status));if(!B({type:A}))return E(n,r,`${A||"no type"}, not a picture`);let c=new e.Blob([await p.arrayBuffer()],{type:A});if(c.size>I)return i;if(!(n.width!==void 0&&n.width<=h)||c.size>s){let G=await d(c,h,s).catch(()=>{});if(G)c=G;else if(c.size>s)return i}return c.size>s?{state:"left",said:`${T(n,r)} is left out: made as small as the ${F(a)} pixels across the view ${t.view} draws a picture at, it is still more than the ${F(s)} bytes one picture is handed.`}:{state:"ready",...await W(c)}},K=(n,r)=>{f.set(n.href,{state:"pending"}),D(n,r).then(i=>_(n.href,i),()=>_(n.href,{state:"left",said:`${T(n,r)} could not be loaded for the view ${t.view}.`}))},_=(n,r)=>{if(g||f.get(n)?.state!=="pending")return x(r);f.set(n,r),r.state==="ready"&&b.set(r.url,r.drawn),r.state==="left"&&$(r.said),z()};return{hand(n){if(g)return L(n,o=>P(o));let r=0,i=new Set,w=L(n,(o,p,A)=>{if(!B(o)||!m(p.kind,A))return P(o);i.add(o.href);let c=f.get(o.href);if(c?.state==="left")return P(o,{left:c.said});if(!c&&o.bytes>I)return c={state:"left",said:j(o,p)},f.set(o.href,c),$(c.said),P(o,{left:c.said});let R=u(o);if(r+R>l){let G=C(o,p,t.view,l);return $(G),P(o,{left:G})}return r+=R,c||K(o,p),P(o,c?.state==="ready"?{src:c.url}:{})});for(let[o,p]of f)i.has(o)||(x(p),f.delete(o));return w},drawn:n=>b.get(n),waiting:()=>y!==void 0||[...f.values()].some(n=>n.state==="pending"),dispose(){g=!0,y!==void 0&&y!==!0&&e.clearTimeout(y);for(let n of f.values())x(n);f.clear(),b.clear()}}}async function Z(e,t,a,s){if(typeof e.createImageBitmap!="function")return;let l=await e.createImageBitmap(t);try{if(l.width<=a&&t.size<=s)return t;let h=Math.min(1,a/l.width),u=Math.max(1,Math.round(l.width*h)),m=Math.max(1,Math.round(l.height*h)),d=e.document.createElement("canvas");d.width=u,d.height=m;let f=d.getContext("2d");if(!f)return;f.drawImage(l,0,0,u,m);let b=y=>new Promise(k=>d.toBlob(k,y,.85)),v=/^image\/(jpeg|webp|png)$/i.test(t.type)?t.type:"image/png",g=await b(v);return g&&g.size<=s?g:await b("image/jpeg")??g??void 0}finally{l.close()}}export{J as PICTURES_SETTLE_MS,I as PICTURE_FETCH_BYTES,ee as PICTURE_STAND_IN,Y as PICTURE_WIDTH,ne as createGuestPictures,P as guestFileOf,L as handFiles,B as isGuestPicture,U as pictureBudget,q as pictureWidthOf,Q as picturesChosen,te as standInPictures};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk.FDWRH5P2.js";import"./chunk.44ZHHPPJ.js";import"./chunk.ZDUTEM3Z.js";import"./chunk.ZZM75ZTN.js";import"./chunk.ISN2QTVL.js";import"./chunk.ARHAD5IS.js";import"./chunk.R2TSTDS3.js";import"./chunk.QSDBF7VL.js";import"./chunk.2PK335JQ.js";import"./chunk.MHTA4HYB.js";import"./chunk.BU5PVRX7.js";import"./chunk.3KUYB5ZT.js";import"./chunk.IMKD6QQG.js";import"./chunk.HJCQ6I3S.js";import"./chunk.ZJFXM3LE.js";import"./chunk.PTQPS2FJ.js";import"./chunk.IR4OW67N.js";import"./chunk.6RZHKQP3.js";import"./chunk.N35SJWAM.js";import"./chunk.L7NJLZWV.js";import"./chunk.QO5RXOCS.js";import"./chunk.XSWR5LI4.js";import"./chunk.BIDL7GQD.js";import"./chunk.XTTESA7X.js";import"./chunk.J6KNEI5R.js";import"./chunk.2YMO7ZVX.js";import"./chunk.5M34BJIQ.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.UHI3X2YD.js";import"./chunk.INTJD5WG.js";import"./chunk.2QQ37RCZ.js";import"./chunk.MIE4TJRW.js";import"./chunk.CXJJB3MK.js";import"./chunk.OJGHDWI6.js";import"./chunk.74B6KQF4.js";import"./chunk.WVUJXDXZ.js";import"./chunk.S2DOVJRL.js";import"./chunk.64FCAUAJ.js";import"./chunk.DA4RSHLW.js";import"./chunk.FOSY7MZF.js";import"./chunk.NBVPWLRY.js";import"./chunk.S3EEY7T3.js";import"./chunk.SPCAMQJE.js";import"./chunk.TUCSUZNO.js";import"./chunk.ZMWAZACO.js";import"./chunk.CD6YWH6T.js";import"./chunk.MD36ZSM5.js";import"./chunk.L6FGKJ5H.js";import"./chunk.3CJLAJXP.js";import"./chunk.SDO3U72B.js";import"./chunk.J24YPQ5I.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{b as declaredLensView,a as formatFor};
@@ -1,2 +0,0 @@
1
- import{a as Ae}from"./chunk.BJUUSIQY.js";import{a as X}from"./chunk.64FCAUAJ.js";import{Cd as $e,Ib as be,ec as we,ga as B,la as he,oa as _,oc as Q,qc as Se,ra as ke,ta as W}from"./chunk.J24YPQ5I.js";import{j as H}from"./chunk.FQLNBIQ5.js";var M=e=>e.trim().toLowerCase(),U=e=>e.charAt(0).toUpperCase()+e.slice(1),le=e=>/^(?:[aeio]|u(?![sn]i|se|ser))/i.test(e),ee=e=>`${le(e)?"an":"a"} ${e}`,xe=e=>M(e).replace(/[^a-z0-9]+([a-z0-9])/g,(n,o)=>o.toUpperCase()).replace(/[^A-Za-z0-9]/g,""),se=e=>M(e).replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),ae=new Set(["person","people","someone","somebody","user","users","member","members"]);function de(e,n){let o=M(n);return Object.entries(e.kinds).find(([f,d])=>[f,d.noun,d.plural].some(c=>c!==void 0&&M(c)===o))?.[0]}function K(e,n){if(!e(n))return n;for(let o=2;;o++)if(!e(`${n}${o}`))return`${n}${o}`}function Fe(e,n){let o=e.acts??{},f=m=>m in o;if("link"in n){let m=de(e,n.link.on);if(!m)return{refused:`This app has no ${n.link.on} to give it to.`};let k=e.kinds[m],C=M(k.noun??m),v=M(n.link.called)||"linked to",u=de(e,n.link.to)??(ae.has(M(n.link.to))?(Object.entries(e.kinds).find(([,T])=>T.people)??Object.entries(e.kinds).find(([T,P])=>[T,P.noun,P.plural].some(t=>t!==void 0&&ae.has(M(t)))))?.[0]:void 0),A=[],j=[],$,F=u===void 0;if(!u){let T=M(n.link.to)||"person",P=ae.has(T),t=P?"person":T.replace(/s$/,""),a=P?"people":`${t}s`;u=K(b=>b in e.kinds,se(t)),A.push({op:"add-kind",kind:u,noun:t,plural:a,fields:{name:{type:"string",required:!0}},label:"{name}"}),$=K(f,`add-${u}`),j.push(`Add ${ee(U(a))} list.`)}let i=u in e.kinds?e.kinds[u]:A[0],p=M(i.noun??u),S=K(T=>T in(k.edges??{})||T in(k.fields??{}),xe(v)||"linkedTo");A.push({op:"add-relation",kind:m,relation:S,to:[u],cardinality:"one",description:U(v)});let R=K(f,`set-${se(v)}`);return A.push({op:"add-act",act:R,title:`Set \u201C${U(v)}\u201D`,on:m,connects:S,description:`Say who ${ee(C)} is ${v}.`}),j.push(`Give each ${C} ${le(v)?"an":"a"} \u201C${U(v)}\u201D field that points to ${ee(p)}.`),{edits:A,steps:j,on:m,relation:S,to:u,made:F,act:R,arg:"to",...$?{makes:$}:{},called:v}}let d=de(e,n.field.on);if(!d)return{refused:`This app has no ${n.field.on} to give it to.`};let c=e.kinds[d],g=M(c.noun??d),y=M(n.field.called)||"note",l=n.field.type??"string",s=K(m=>m in(c.fields??{})||m in(c.edges??{}),xe(y)||"note"),r=K(f,`set-${se(y)}`);return{edits:[{op:"add-field",kind:d,field:s,spec:{type:l}},{op:"add-act",act:r,title:`Set \u201C${U(y)}\u201D`,on:d,args:{value:{type:l,required:!0}},sets:{[s]:"$value"},description:`Say ${ee(g)}'s ${y}.`}],steps:[`Give each ${g} ${le(y)?"an":"a"} \u201C${U(y)}\u201D field.`],on:d,field:s,act:r,arg:"value",called:y}}var Re=["search-miss","unanswered","refused","tool-invalid"];var Le=new RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2066-\\u2069]","g");var G=e=>e.onBehalfOf?G(e.onBehalfOf):e.id!==void 0?`${e.kind}:${e.id}`:`${e.kind}:?`,ce=e=>e.toLowerCase().replace(/\s+/g," ").replace(/^[\s\p{P}]+|[\s\p{P}]+$/gu,"");var Ce=new Set("a an and are at be by can do does for from has have how i in is it me my of on or our the their there this to was we what when where which who why will with you your".split(" "));function J(e,n,o,f,d){let c=new Map;for(let g of e){let y=n(g);if(y===void 0)continue;let l=c.get(y)??{first:g,people:new Set,times:0,last:g};l.people.add(G(g.by)),l.times+=1,l.last=g,c.set(y,l)}return[...c.entries()].filter(([,g])=>g.people.size>=f).sort(([g,y],[l,s])=>s.people.size-y.people.size||s.times-y.times||g.localeCompare(l)).slice(0,d).map(([g,y])=>({...o(y.last,g),people:y.people.size,times:y.times}))}function je(e,n={}){let o=Math.max(1,n.minPeople??2),f=n.most??12,d=n.reader?G(n.reader):void 0,c=e.filter(s=>!$e(s.by)&&(d===void 0||G(s.by)!==d)),g=Object.fromEntries(Re.map(s=>{let r=c.filter(m=>m.type===s);return[s,{events:r.length,people:new Set(r.map(m=>G(m.by))).size}]})),y=[],l=new Map;for(let s of c){let r=s.type==="search-miss"?s.words:s.type==="unanswered"?s.question:void 0;if(r!==void 0)for(let m of new Set(ce(r).split(/[^\p{L}\p{N}]+/u))){if(m.length<3||Ce.has(m))continue;let k={...s,id:`${s.id}:${m}`};y.push(k),l.set(k,m)}}return{events:c.length,people:new Set(c.map(s=>G(s.by))).size,byType:g,searches:J(c,s=>s.type==="search-miss"&&ce(s.words)||void 0,(s,r)=>({words:r}),o,f),questions:J(c,s=>s.type==="unanswered"&&ce(s.question)||void 0,(s,r)=>({question:r}),o,f),words:J(y,s=>l.get(s),(s,r)=>({word:r}),o,f),refusals:J(c,s=>s.type==="refused"?`${s.act}|${s.code}`:void 0,s=>({act:s.act,code:s.code}),o,f),tools:J(c,s=>s.type==="tool-invalid"?`${s.tool}|${s.act??""}`:void 0,s=>{let r=s;return{tool:r.tool,...r.act?{act:r.act}:{},...r.then?{then:r.then}:{}}},1,f)}}var ve=e=>e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e;function Ee(e){let n=new Set,o=f=>{for(let d of f.toLowerCase().split(/[^\p{L}\p{N}]+/u))d.length>0&&n.add(ve(d))};for(let f of e.kinds){let d=e.tryDefinition(f);o(f),o(W(d,f)),o(_(e,f));for(let c of[...d?.aliases??[],...Object.values(d?.fieldAliases??{}).flat()])o(c);for(let c of Object.keys(d?.fields?.shape??{}))o(c),o(B(c))}return n}function Oe(e,n,o={}){let f=je(e,{most:8,...o}),d=Ee(n),c=f.searches.filter(r=>!r.words.split(/[^\p{L}\p{N}]+/u).some(m=>m.length>0&&d.has(ve(m)))).map(r=>({words:r.words,people:r.people})),g=f.questions.map(r=>({question:r.question,people:r.people})),y=f.tools.map(r=>({tool:r.tool,...r.act?{act:r.act}:{},...r.then?{then:r.then}:{},times:r.times})),l=r=>`${r} ${r===1?"person":"people"}`;return{said:[...c.length>0?[`Searched for, found nothing, and nothing here is called it: ${c.map(r=>`\u201C${r.words}\u201D (${l(r.people)})`).join(", ")}.`]:[],...g.length>0?[`Asked and not answered: ${g.map(r=>`\u201C${r.question}\u201D (${l(r.people)})`).join(", ")}.`]:[],...y.length>0?[`Tool calls refused as invalid: ${y.map(r=>`${r.tool}${r.act?` (${r.act})`:""} ${r.times===1?"once":`${r.times} times`}${r.then?`, then worked as ${r.then}`:""}`).join("; ")}.`]:[]].join(`
2
- `),unknownWords:c,questions:g,toolMistakes:y}}var Te=e=>/^(?:aggregate|kind):([^,]+)$/.exec(e)?.[1];function Ze(e,n){let o=e.about??[];if(e.field!==void 0&&e.on!==void 0&&n(e.on))return{on:"field",id:e.on,field:e.field};let f=o.filter(n);if(f.length>1)return{on:"selection",ids:f};if(e.on!==void 0&&n(e.on))return{on:"record",id:e.on};if(f.length===1)return{on:"record",id:f[0]};let d=[e.on,...o].map(c=>c===void 0?void 0:Te(c)).find(c=>c!==void 0);return e.place!==void 0?{on:"lens",place:e.place,...d?{kind:d}:{}}:d!==void 0?{on:"list",kind:d}:{on:"place",place:"home"}}var ne=e=>e.on==="record"||e.on==="field"?[e.id]:e.on==="selection"?e.ids:e.on==="act"&&e.id!==void 0?[e.id]:[],te=(e,n)=>e.tryDefinition(n)?.fields?.shape??{},Y=(e,n)=>e.tryDefinition(n)?.edges??{},ie=(e,n)=>new Set(e.tryDefinition(n)?.display?.hide??[]),N=(e,n)=>he(e.tryDefinition(n.kind),n),fe=(e,n,o)=>ke(e.tryDefinition(n),o)||B(o),pe=e=>typeof e=="boolean"?e?"yes":"no":String(e);function oe(e,n){let o=e.kindsKeptFrom(n);return new Set(e.schema.kinds.filter(f=>!o.has(f)))}function ye(e,n,o,f){if(!e.permits(n,o).ok)return!1;if(!f)return!0;try{return e.previewAll([n],{author:o}).ops.length>0}catch{return!1}}function Qe(e,n,o){let f=e,{principal:d}=o,c=o.each??8,g=H(f)?.store??f,y=g.seenBy(d),l=g.schema,s=oe(g,d),r=t=>{let a=y.graph.getNode(t);return a&&s.has(a.kind)?a:void 0},m=g.allMutations(),k=new Map(m.map(t=>[t.name,t])),C=[],v=new Set,u=t=>{v.has(t.id)||(v.add(t.id),C.push(t))},A=t=>t.slice(0,c),j=ne(n).filter(t=>r(t)!==void 0);if(ne(n).length>0&&j.length===0)return{target:n,candidates:[]};let $=j.length===1?r(j[0]):void 0,F=$?.kind??(n.on==="list"?n.kind:n.on==="lens"?n.kind??o.places?.find(t=>t.as===n.place)?.kind:void 0)??(n.on==="selection"?r(j[0])?.kind:void 0);if(F!==void 0&&!s.has(F))return{target:n,candidates:[]};let i=(t,a)=>`act:${t}${Object.keys(a).length>0?`:${Object.values(a).map(b=>String(b)).join(",")}`:""}`,p=(t,a,b,O,h)=>{t.destructive||Object.values(a).some(I=>typeof I=="string"&&g.graph.has(I)&&r(I)===void 0)||ye(g,{name:t.name,args:{...a}},d,O.length===0)&&u({type:"act",id:i(t.name,a),label:b,description:h??t.description??b,mutation:t.name,args:a,asks:O})};if(n.on!=="place"||o.acts)if(o.acts)for(let t of o.acts){let a=k.get(t.mutation);!a||t.destructive||n.on==="act"&&t.mutation!==n.act||p(a,t.args,t.label,(t.open??[]).filter(b=>!b.optional).map(b=>b.name),t.why)}else{let t=$?[$]:[];for(let a of m){if(n.on==="act"&&a.name!==n.act)continue;let b=a.input.shape??{},O=h=>Object.entries(b).filter(([I,w])=>I!==h&&w.safeParse?.(void 0).success===!1).map(([I])=>I);if(a.subject)for(let h of t)Q(l,a).includes(h.kind)&&p(a,{[a.subject.arg]:h.id},`${a.title??B(a.name)}: ${N(l,h)}`,O(a.subject.arg));else F!==void 0&&(a.creates??[]).includes(F)&&p(a,{},a.title??B(a.name),O(void 0))}}let S=C.filter(t=>t.type==="act");C.splice(0,C.length,...A(S));let R=(t,a)=>{let b=Se(l,m).get(t.kind),O=te(l,t.kind),h=ie(l,t.kind),I=[];for(let[w,D]of Object.entries(O)){if(a!==void 0?w!==a:h.has(w)||t[w]!==void 0)continue;let z=X(D),L=z?.type==="enum"&&!z.multiple?z.options??[]:z?.type==="boolean"?[!0,!1]:[];if(L.length===0)continue;let q=(b?.get(w)??[]).map(E=>k.get(E)).find(E=>E?.subject!==void 0&&ye(g,{name:E.name,args:{[E.subject.arg]:t.id,[w]:L.find(re=>re!==t[w])??L[0]}},d,!0));if(q?.subject)for(let E of L)t[w]!==E&&I.push({type:"fill",id:`fill:${t.id}:${w}:${pe(E)}`,label:`${fe(l,t.kind,w)}: ${pe(E)}`,description:`Set ${fe(l,t.kind,w).toLowerCase()} of ${N(l,t)} to ${pe(E)}`,record:t.id,field:w,value:E,call:{name:q.name,args:{[q.subject.arg]:t.id,[w]:E}}})}for(let[w,D]of Object.entries(Y(l,t.kind))){if(a!==void 0&&w!==a)continue;let z=D.to==="*"?[...s]:D.to.filter(x=>s.has(x)),L=new Set(y.graph.out(t.id,w).map(x=>x.id)),q=m.find(x=>(x.connects??[]).includes(w)&&x.subject!==void 0&&Q(l,x).includes(t.kind));if(!q?.subject)continue;let E=we(q.input).find(x=>x.name!==q.subject.arg);if(!E)continue;let re=z.flatMap(x=>E.kinds.length===0||E.kinds.includes(x)?y.graph.nodesOfKind(x):[]).filter(x=>x.id!==t.id&&!L.has(x.id)&&r(x.id)!==void 0);for(let x of A(re)){let me={name:q.name,args:{[q.subject.arg]:t.id,[E.name]:x.id}};ye(g,me,d,!0)&&I.push({type:"fill",id:`fill:${t.id}:${w}:${x.id}`,label:`${B(w)}: ${N(l,x)}`,description:`Link ${N(l,t)} to ${N(l,x)}${D.description?` as ${D.description}`:""}`,record:t.id,field:w,value:x.id,call:me})}}return I};if(n.on==="field"&&$)for(let t of R($,n.field))u(t);else if($&&n.on==="record")for(let t of A(R($)))u(t);let T=t=>{let a=_(l,t).toLowerCase(),b=[{type:"panel",id:`panel:${t}:list`,label:`A list of ${a}`,description:`Every ${W(l.tryDefinition(t),t).toLowerCase()} this viewer may see, as a list`,panel:{lens:"blocks",kind:t}}],O=ie(l,t);for(let[h,I]of Object.entries(te(l,t))){if(O.has(h))continue;let w=X(I),D=fe(l,t,h).toLowerCase();if(w?.type==="enum")b.push({type:"panel",id:`panel:${t}:group:${h}`,label:`${V(a)} by ${D}`,description:`A list of ${a} grouped by ${D}`,panel:{lens:"blocks",kind:t,group:h}}),b.push({type:"panel",id:`panel:${t}:columns:${h}`,label:`Columns of ${a} by ${D}`,description:`${V(a)} in a column for each ${D}`,panel:{lens:"columns",kind:t,column:h}});else if(w?.type==="number"||w?.type==="integer"||w?.type==="date"||w?.type==="datetime"){let z=w.type==="date"||w.type==="datetime";b.push({type:"panel",id:`panel:${t}:sort:${h}`,label:`${V(a)} by ${D}`,description:`A list of ${a}, the ${z?"latest":"highest"} ${D} first`,panel:{lens:"blocks",kind:t,sort:{by:h,direction:"desc"}}}),z&&b.push({type:"panel",id:`panel:${t}:calendar:${h}`,label:`A calendar of ${a}`,description:`${V(a)} on a calendar by ${D}`,panel:{lens:"calendar",kind:t,start:h}})}}return b},P=n.on==="place"?[...s]:F!==void 0?[F]:[];for(let t of P)for(let a of A(T(t)))u(a);for(let t of A((o.places??[]).filter(a=>a.kind===void 0?n.on==="place":s.has(a.kind)&&(n.on==="place"||a.kind===F))))n.on==="lens"&&t.as===n.place||u({type:"place",id:`place:${t.as}`,label:t.title,description:`Go to ${t.title}`,place:t.as});if($){let t=[];for(let[a,b]of Object.entries(Y(l,$.kind)))for(let O of y.graph.out($.id,a))r(O.id)&&t.push({type:"record",id:`record:${O.id}`,label:N(l,O),description:`${V(b.description??B(a))}: ${N(l,O)}`,record:O.id,relation:a});for(let a of l.kinds)for(let[b,O]of Object.entries(Y(l,a)))if(!(O.to!=="*"&&!O.to.includes($.kind)))for(let h of y.graph.in($.id,b))h.kind===a&&r(h.id)&&t.push({type:"record",id:`record:${h.id}`,label:N(l,h),description:`${V(O.inverse??B(b))}: ${N(l,h)}`,record:h.id,relation:b});for(let a of A(t))u(a)}else if(n.on==="list"||n.on==="lens")for(let t of A(F!==void 0?y.graph.nodesOfKind(F):[]))r(t.id)&&u({type:"record",id:`record:${t.id}`,label:N(l,t),description:`Open ${N(l,t)}`,record:t.id});else if(n.on==="selection")for(let t of j){let a=r(t);u({type:"record",id:`record:${t}`,label:N(l,a),description:`Open ${N(l,a)}`,record:t})}return{target:n,candidates:C}}var V=e=>e&&`${e[0].toUpperCase()}${e.slice(1)}`,Pe={columns:["board","kanban","column","lane","pipeline","stage","funnel"],board:["board","map","floor","layout","seat","slot"],calendar:["calendar","schedule","date","due","month","week","agenda","deadline","day"],timeline:["timeline","gantt","schedule","roadmap","span"],coverage:["coverage","matrix","grid","gap"],plan:["plan","floor","map","region","area"],blocks:["list","table","summary","overview","dashboard","card"]},De=new Set(["a","an","the","of","for","my","our","me","us","to","with","and","in","on","by","that","which","i","we","want","need","show","open","go","draw","make","new","view","views","panel","panels","page","lens","please","all","every","some","see","can","could","would","like","one","what","is","are","do","does","here","there","how","it","this","these","those"]),Z=e=>e.length>3&&e.endsWith("ies")?`${e.slice(0,-3)}y`:e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e,ue=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^a-z0-9]+/).filter(Boolean);function Xe(e,n,o){let f=e,d=H(f)?.store??f,c=d.schema,g=oe(d,o.principal),y=d.seenBy(o.principal),l=ne(n),s=new Set;for(let i of l){let p=y.graph.getNode(i)?.kind;p!==void 0&&g.has(p)&&s.add(p)}if(l.length>0&&s.size===0)return[];if(n.on==="list"&&s.add(n.kind),n.on==="lens"){let i=n.kind??o.places.find(p=>p.as===n.place)?.kind;i!==void 0&&s.add(i)}let r=new Map;for(let i of c.kinds){if(!g.has(i))continue;let p=c.tryDefinition(i);for(let S of[i,W(p,i),_(c,i)])for(let R of ue(S))r.set(Z(R),i)}let m=ue(o.said??"").filter(i=>!De.has(i)),k=new Set,C=[];for(let i of m){let p=r.get(Z(i));p!==void 0?k.add(p):C.push(Z(i))}let v=k.size>0?k:s;if((o.said??"").trim()!==""&&m.length===0)return[];if(v.size===0&&m.length===0)return[];let u=[];o.places.forEach((i,p)=>{if(i.hidden||n.on==="lens"&&i.as===n.place)return;let S=i.over??(i.kind!==void 0?[i.kind]:[]);if(S.length>0&&!S.some(P=>g.has(P)))return;let R=S.some(P=>v.has(P)),T=!R&&(i.reads??[]).some(P=>v.has(P));v.size>0&&!R&&!T||u.push({place:i,own:R,reads:T,at:p})});let A=i=>new Set(ue(i.title).map(Z)),j=new Set(C.filter(i=>u.some(({place:p})=>A(p).has(i)))),$=[];for(let{place:i,own:p,reads:S,at:R}of u){let T=A(i),P=new Set((Pe[i.lens??""]??[]).map(Z)),t=C.filter(h=>T.has(h)||P.has(h)&&!j.has(h)).length,a=C.length-t;if(C.length>0&&t===0)continue;let b=!S&&a===0?"full":"partial",O=(p?4:S?2:1)+t*2-a+(b==="full"?1:0);$.push({view:{place:i.as,title:i.title,...i.kind!==void 0?{kind:i.kind}:{},fit:b},score:O,at:R})}return $.filter((i,p)=>!$.slice(0,p).some(S=>S.view.place===i.view.place&&S.view.title===i.view.title)).sort((i,p)=>p.score-i.score||i.at-p.at).slice(0,o.most??3).map(i=>i.view)}var ge=new WeakMap;function Ne(e){let n=2166136261;for(let o=0;o<e.length;o++)n^=e.charCodeAt(o),n=Math.imul(n,16777619)>>>0;return n.toString(36)}function Ie(e,n){let o=e,f=H(o)?.store??o,d=f.schema,c=oe(f,n),y=f.allMutations().filter(u=>!u.destructive&&f.permits({name:u.name,args:{}},n).ok!==!1),l=`${[...c].join(",")}|${y.map(u=>u.name).join(",")}`,s=ge.get(d)?.get(l);if(s)return s;let r=[...c].map(u=>{let A=ie(d,u),j={};for(let[p,S]of Object.entries(te(d,u))){if(A.has(p))continue;let R=X(S);R&&(j[p]=R.type==="enum"?`enum:${(R.options??[]).join("|")}`:R.type)}let $={};for(let[p,S]of Object.entries(Y(d,u)))$[p]=S.to==="*"?[...c]:S.to.filter(R=>c.has(R));let F=d.tryDefinition(u),i=Object.entries(F?.fieldAliases??{}).filter(([p,S])=>p in j&&S.length>0);return{kind:u,noun:W(d.tryDefinition(u),u),plural:_(d,u),fields:j,relations:$,...F?.aliases&&F.aliases.length>0?{aliases:F.aliases}:{},...i.length>0?{fieldAliases:Object.fromEntries(i)}:{}}}),m=y.map(u=>({name:u.name,title:u.title??B(u.name),...u.subject?{on:Q(d,u).filter(A=>c.has(A))}:{}})),k={kinds:r,acts:m},C={version:Ne(JSON.stringify(k)),...k},v=ge.get(d)??new Map;return v.set(l,C),ge.set(d,v),C}var Me=e=>e.name??e.id??e.kind;function en(e,n,o){let f=e,{principal:d}=o,c=H(f)?.store??f,g=c.seenBy(d),y=c.schema,l=oe(c,d),s=i=>{let p=g.graph.getNode(i);return p&&l.has(p.kind)?p:void 0},r=i=>({id:i.id,kind:i.kind,label:N(y,i)}),m=ne(n),k=m.length===1?s(m[0]):void 0,C=k?Object.fromEntries(Object.keys(te(y,k.kind)).filter(i=>!ie(y,k.kind).has(i)&&k[i]!==void 0&&i!=="label").map(i=>[i,k[i]])):{},v={on:n.on,...k?{record:{...r(k),fields:C}}:{},...n.on==="field"&&k?{field:n.field}:{},...n.on==="list"&&l.has(n.kind)?{kind:n.kind}:{},...n.on==="lens"?{place:n.place,...n.kind&&l.has(n.kind)?{kind:n.kind}:{}}:{},...n.on==="place"?{place:n.place}:{},...n.on==="act"?{act:n.act}:{}},u=[...new Set([...n.on==="selection"?n.ids:[],...o.selection??[]])].flatMap(i=>{let p=s(i);return p?[r(p)]:[]}),A=[];if(k){for(let i of Object.keys(Y(y,k.kind)))for(let p of g.graph.out(k.id,i))s(p.id)&&A.push({...r(p),relation:i,direction:"out"});for(let i of y.kinds)for(let p of Object.keys(Y(y,i)))for(let S of g.graph.in(k.id,p))S.kind===i&&s(S.id)&&A.push({...r(S),relation:p,direction:"in"})}let j=g.batches().filter(i=>!i.ops.every(be)).slice(-(o.recent??6)).reverse().map(i=>({intent:i.intent,at:i.at,by:Me(i.author)})),$=(o.purpose?.jobs??[]).filter(i=>Ae(i,d.roles)&&l.has(i.kind)).map(i=>({name:i.name,ask:i.ask,kind:i.kind})),F=o.purpose&&(o.purpose.for!==void 0||$.length>0)?{...o.purpose.for!==void 0?{for:o.purpose.for}:{},jobs:$}:void 0;return{...o.place!==void 0?{place:o.place}:{},target:v,selection:u,neighbors:A.slice(0,24),recent:j,schema:Ie(c,d),...F?{purpose:F}:{},...o.friction?{friction:Oe(o.friction,y,{reader:d})}:{}}}export{Fe as a,Ze as b,ne as c,Qe as d,Xe as e,en as f};
@@ -1,50 +0,0 @@
1
- import{a as Ft,b as Le,c as Tt,g as Nt,h as ne,i as Mt,j as Ot}from"./chunk.5YNLFOBJ.js";import{p as kt}from"./chunk.HNMSYQRA.js";import{g as St}from"./chunk.RFVOXX3P.js";import{a as vt}from"./chunk.IR4OW67N.js";import{d as wt}from"./chunk.FOSY7MZF.js";import{c as Rt}from"./chunk.NBVPWLRY.js";import{A as Ct,H as Lt,I as Dt,i as yt,j as gt,u as bt,v as Et,y as xt,z as Pt}from"./chunk.MD36ZSM5.js";import{c as Ar}from"./chunk.L6FGKJ5H.js";import{G as M,O as ht,Q as mt,V as ee,ea as pt}from"./chunk.3CJLAJXP.js";import{Vd as lt,Wd as st,Xd as ut,_c as nt,cd as ot,db as at,ga as Ce,le as ct,me as dt,ne as ft,pa as de,rd as it}from"./chunk.J24YPQ5I.js";import{b as D}from"./chunk.AJZBJBMO.js";function _r(e,t){return lt(e,t).slice(1)}function fe(e,t){return e.kinds.find(r=>_r(e,r)===t)}function Mn(e,t,r){return st(e,t,r)}function On(e,t){return ut(e,t)}var _=D(M(),1),g=D(M(),1),x=D(M(),1),Ve=D(M(),1),yr=D(M(),1),S=D(M(),1),nn=D(M(),1),on=D(M(),1),ln=D(M(),1),v=D(M(),1),Dr=D(M(),1);var Ae=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Bt=/^[\\/]{2}/;function $r(e,t){return t+e.replace(/\\/g,"/")}var At="popstate";function ge(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Wt(e={}){let{initialEntries:t=["/"],initialIndex:r,v5Compat:a=!1}=e,n;n=t.map((h,y)=>c(h,typeof h=="string"?null:h.state,y===0?"default":void 0,typeof h=="string"?void 0:h.mask));let o=s(r??n.length-1),i="POP",l=null;function s(h){return Math.min(Math.max(h,0),n.length-1)}function u(){return n[o]}function c(h,y=null,p,f){let R=ve(n?u().pathname:"/",h,y,p,f);return O(R.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(h)}`),R}function d(h){return typeof h=="string"?h:W(h)}return{get index(){return o},get action(){return i},get location(){return u()},createHref:d,createURL(h){return new URL(d(h),"http://localhost")},encodeLocation(h){let y=typeof h=="string"?V(h):h;return{pathname:y.pathname||"",search:y.search||"",hash:y.hash||""}},push(h,y){i="PUSH";let p=ge(h)?h:c(h,y);o+=1,n.splice(o,n.length,p),a&&l&&l({action:i,location:p,delta:1})},replace(h,y){i="REPLACE";let p=ge(h)?h:c(h,y);n[o]=p,a&&l&&l({action:i,location:p,delta:0})},go(h){i="POP";let y=s(o+h),p=n[y];o=y,l&&l({action:i,location:p,delta:h})},listen(h){return l=h,()=>{l=null}}}}function Yt(e={}){function t(a,n){let o=n.state?.masked,{pathname:i,search:l,hash:s}=o||a.location;return ve("",{pathname:i,search:l,hash:s},n.state&&n.state.usr||null,n.state&&n.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,n){return typeof n=="string"?n:W(n)}return Hr(t,r,null,e)}function L(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function O(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Ir(){return Math.random().toString(36).substring(2,10)}function _t(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ve(e,t,r=null,a,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?V(t):t,state:r,key:t&&t.key||a||Ir(),mask:n}}function W({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function V(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function Hr(e,t,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,l="POP",s=null,u=c();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function c(){return(i.state||{idx:null}).idx}function d(){l="POP";let f=c(),R=f==null?null:f-u;u=f,s&&s({action:l,location:p.location,delta:R})}function m(f,R){l="PUSH";let w=ge(f)?f:ve(p.location,f,R);r&&r(w,f),u=c()+1;let b=_t(w,u),P=p.createHref(w.mask||w);try{i.pushState(b,"",P)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;n.location.assign(P)}o&&s&&s({action:l,location:p.location,delta:1})}function h(f,R){l="REPLACE";let w=ge(f)?f:ve(p.location,f,R);r&&r(w,f),u=c();let b=_t(w,u),P=p.createHref(w.mask||w);i.replaceState(b,"",P),o&&s&&s({action:l,location:p.location,delta:0})}function y(f){return Ur(n,f)}let p={get action(){return l},get location(){return e(n,i)},listen(f){if(s)throw new Error("A history only accepts one active listener");return n.addEventListener(At,d),s=f,()=>{n.removeEventListener(At,d),s=null}},createHref(f){return t(n,f)},createURL:y,encodeLocation(f){let R=y(f);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:m,replace:h,go(f){return i.go(f)}};return p}function Ur(e,t,r=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),L(a,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:W(t);return n=n.replace(/ $/,"%20"),!r&&Bt.test(n)&&(n=a+n),new URL(n,a)}var jr;jr=new WeakMap;function _e(e,t,r="/"){return zr(e,t,r,!1)}function zr(e,t,r,a,n){let o=typeof t=="string"?V(t):t,i=U(o.pathname||"/",r);if(i==null)return null;let l=n??Wr(e),s=null,u=ta(i);for(let c=0;s==null&&c<l.length;++c)s=ea(l[c],u,a);return s}function Br(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function Wr(e){let t=Vt(e);return Yr(t),t}function Vt(e,t=[],r=[],a="",n=!1){let o=(i,l,s=n,u)=>{let c={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(c.relativePath.startsWith("/")){if(!c.relativePath.startsWith(a)&&s)return;L(c.relativePath.startsWith(a),`Absolute route path "${c.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(a.length)}let d=H([a,c.relativePath]),m=r.concat(c);i.children&&i.children.length>0&&(L(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),Vt(i.children,t,m,d,s)),!(i.path==null&&!i.index)&&t.push({path:d,score:qr(d,i.index),routesMeta:m.map((h,y)=>{let[p,f]=Gt(h.relativePath,h.caseSensitive,y===m.length-1);return{...h,matcher:p,compiledParams:f}})})};return e.forEach((i,l)=>{if(i.path===""||!i.path?.includes("?"))o(i,l);else for(let s of Jt(i.path))o(i,l,!0,s)}),t}function Jt(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=Jt(a.join("/")),l=[];return l.push(...i.map(s=>s===""?o:[o,s].join("/"))),n&&l.push(...i),l.map(s=>e.startsWith("/")&&s===""?"/":s)}function Yr(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Zr(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Vr=/^:[\w-]+$/,Jr=3,Kr=2,Gr=1,Xr=10,Qr=-2,$t=e=>e==="*";function qr(e,t){let r=e.split("/"),a=r.length;return r.some($t)&&(a+=Qr),t&&(a+=Kr),r.filter(n=>!$t(n)).reduce((n,o)=>n+(Vr.test(o)?Jr:o===""?Gr:Xr),a)}function Zr(e,t){return e.length===t.length&&e.slice(0,-1).every((a,n)=>a===t[n])?e[e.length-1]-t[t.length-1]:0}function ea(e,t,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let l=0;l<a.length;++l){let s=a[l],u=l===a.length-1,c=o==="/"?t:t.slice(o.length)||"/",d={path:s.relativePath,caseSensitive:s.caseSensitive,end:u},m=s.matcher&&s.compiledParams?Kt(d,c,s.matcher,s.compiledParams):ie(d,c),h=s.route;if(!m&&u&&r&&!a[a.length-1].route.index&&(m=ie({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},c)),!m)return null;Object.assign(n,m.params),i.push({params:n,pathname:H([o,m.pathname]),pathnameBase:aa(H([o,m.pathnameBase])),route:h}),m.pathnameBase!=="/"&&(o=H([o,m.pathnameBase]))}return i}function ie(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Gt(e.path,e.caseSensitive,e.end);return Kt(e,t,r,a)}function Kt(e,t,r,a){let n=t.match(r);if(!n)return null;let o=n[0],i=te(o,1),l=n.slice(1);return{params:a.reduce((u,{paramName:c,isOptional:d},m)=>{if(c==="*"){let y=l[m]||"";i=te(o.slice(0,o.length-y.length),1)}let h=l[m];return d&&!h?u[c]=void 0:u[c]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Gt(e,t=!1,r=!0){O(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,s,u,c)=>{if(a.push({paramName:l,isOptional:s!=null}),s){let d=c.charAt(u+i.length);return d&&d!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function ta(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return O(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function U(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function Xt(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?V(e):e,o;return r?(r=Qt(r),r.startsWith("/")||r.startsWith("\\")?o=It(r.substring(1),"/"):o=It(r,t)):o=t,{pathname:o,search:na(a),hash:oa(n)}}function It(e,t){let r=te(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function De(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ra(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function $e(e){let t=ra(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function Se(e,t,r,a=!1){let n;typeof e=="string"?n=V(e):(n={...e},L(!n.pathname||!n.pathname.includes("?"),De("?","pathname","search",n)),L(!n.pathname||!n.pathname.includes("#"),De("#","pathname","hash",n)),L(!n.search||!n.search.includes("#"),De("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,l;if(i==null)l=r;else{let d=t.length-1;if(!a&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),d-=1;n.pathname=m.join("/")}l=d>=0?t[d]:"/"}let s=Xt(n,l),u=i&&i!=="/"&&i.endsWith("/"),c=(o||i===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(u||c)&&(s.pathname+="/"),s}var Qt=e=>e.replace(/[\\/]{2,}/g,"/"),H=e=>Qt(e.join("/"));function te(e,t=0){let r=e.length;for(;r>t&&e.charCodeAt(r-1)===47;)r--;return r===e.length?e:e.slice(0,r)}var aa=e=>te(e).replace(/^\/*/,"/"),na=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,oa=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var qt=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Zt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ia(e){let t=e.map(r=>r.route.path).filter(Boolean);return H(t)||"/"}var er=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function tr(e,t){let r=e;if(typeof r!="string"||!Ae.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(er)try{let o=new URL(window.location.href),i=Bt.test(r)?new URL($r(r,o.protocol)):new URL(r),l=U(i.pathname,t);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{O(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:n,to:r}}var _n=Symbol("Uninstrumented");var $n=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ht=new URL("http://localhost");function Ie(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),Ht)}catch{return Ht}}function ke(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function la(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return e.toLowerCase().startsWith(r)?t.host===""||e.slice(r.length).startsWith("//"):!1}function He(e,t,r,a){let n=null;try{n=e==null?null:new URL(e,r)}catch{}let o=new URL(t,r),i=n!=null&&!ke(n,r),l=!ke(o,r);if(a==="reject"){if(i||l)throw new Error("External navigation is not allowed")}else if(l&&(n==null||!la(e,n)||!ke(n,o)))throw new Error("External navigation is not allowed")}var rr=["POST","PUT","PATCH","DELETE"],In=new Set(rr),sa=["GET",...rr],Hn=new Set(sa);var Un=Symbol("ResetLoaderData"),ua,ca,da,fa;ua=new WeakMap;ca=new WeakMap;da=new WeakMap;fa=new WeakMap;var ha=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function ma(e){try{return ha.includes(new URL(e).protocol)}catch{return!1}}var G=_.createContext(null);G.displayName="DataRouter";var re=_.createContext(null);re.displayName="DataRouterState";var ar=_.createContext(!1);function pa(){return _.useContext(ar)}var Ue=_.createContext({isTransitioning:!1});Ue.displayName="ViewTransition";var nr=_.createContext(new Map);nr.displayName="Fetchers";var ya=_.createContext(null);ya.displayName="Await";var N=_.createContext(null);N.displayName="Navigation";var X=_.createContext(null);X.displayName="Location";var I=_.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName="Route";var je=_.createContext(null);je.displayName="RouteError";var Ne=!0,or="REACT_ROUTER_ERROR",ga="REDIRECT",va="ROUTE_ERROR_RESPONSE";function Ra(e){if(e.startsWith(`${or}:${ga}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function wa(e){if(e.startsWith(`${or}:${va}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new qt(t.status,t.statusText,t.data)}catch{}}function be(e,{relative:t}={}){L(Q(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=g.useContext(N),{hash:n,pathname:o,search:i}=ae(e,{relative:t}),l=o;return r!=="/"&&(l=o==="/"?r:H([r,o])),a.createHref({pathname:l,search:i,hash:n})}function Q(){return g.useContext(X)!=null}function T(){return L(Q(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(X).location}function Sa(){return g.useContext(X).navigationType}var ir="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function lr(e){g.useContext(N).static||g.useLayoutEffect(e)}function q(){let{isDataRoute:e}=g.useContext(I);return e?Na():ba()}function ba(){L(Q(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(G),{basename:t,navigator:r}=g.useContext(N),{matches:a}=g.useContext(I),{pathname:n}=T(),o=JSON.stringify($e(a)),i=g.useRef(!1);return lr(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(O(i.current,ir),!i.current)return;if(typeof s=="number"){r.go(s);return}let c=Se(s,JSON.parse(o),n,u.relative==="path");e==null&&t!=="/"&&(c.pathname=c.pathname==="/"?t:H([t,c.pathname])),He(typeof s=="string"?s:W(s),r.createHref(c),Ie(r),"reject"),(u.replace?r.replace:r.push)(c,u.state,u)},[t,r,o,n,e])}var jn=g.createContext(null);function Ea(){let{matches:e}=g.useContext(I);return e[e.length-1]?.params??{}}function ae(e,{relative:t}={}){let{matches:r}=g.useContext(I),{pathname:a}=T(),n=JSON.stringify($e(r));return g.useMemo(()=>Se(e,JSON.parse(n),a,t==="path"),[e,n,a,t])}function sr(e,t){return ur(e,t)}function ur(e,t,r){L(Q(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=g.useContext(N),{matches:n}=g.useContext(I),o=n[n.length-1],i=o?o.params:{},l=o?o.pathname:"/",s=o?o.pathnameBase:"/",u=o&&o.route;if(Ne){let f=u&&u.path||"";hr(l,!u||f.endsWith("*")||f.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${f}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2
-
3
- Please change the parent <Route path="${f}"> to <Route path="${f==="/"?"*":`${f}/*`}">.`)}let c=T(),d;if(t){let f=typeof t=="string"?V(t):t;L(s==="/"||f.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${f.pathname}" was given in the \`location\` prop.`),d=f}else d=c;let m=d.pathname||"/",h=m;if(s!=="/"){let f=s.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(f.length).join("/")}let y=r&&r.state.matches.length?r.state.matches.map(f=>Object.assign(f,{route:r.manifest[f.route.id]||f.route})):_e(e,{pathname:h});Ne&&(O(u||y!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),O(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`));let p=Da(y&&y.map(f=>Object.assign({},f,{params:Object.assign({},i,f.params),pathname:H([s,a.encodeLocation?a.encodeLocation(f.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:f.pathname]),pathnameBase:f.pathnameBase==="/"?s:H([s,a.encodeLocation?a.encodeLocation(f.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:f.pathnameBase])})),n,r);return t&&p?g.createElement(X.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:"POP"}},p):p}function xa(){let e=fr(),t=Zt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},i=null;return Ne&&(console.error("Error handled by React Router default ErrorBoundary:",e),i=g.createElement(g.Fragment,null,g.createElement("p",null,"\u{1F4BF} Hey developer \u{1F44B}"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:o},"ErrorBoundary")," or"," ",g.createElement("code",{style:o},"errorElement")," prop on your route."))),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),r?g.createElement("pre",{style:n},r):null,i)}var Pa=g.createElement(xa,null),cr=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=wa(e.digest);r&&(e=r)}let t=e!==void 0?g.createElement(I.Provider,{value:this.props.routeContext},g.createElement(je.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(Ca,{error:e},t):t}};cr.contextType=ar;var Fe=new WeakMap;function Ca({children:e,error:t}){let{basename:r,navigator:a}=g.useContext(N);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=Ra(t.digest);if(n){let o=Fe.get(t);if(o)throw o;let i=tr(n.location,r),l=i.absoluteURL||i.to;if(He(n.location,l,Ie(a),"allow-explicit"),ma(l))throw new Error("Invalid redirect location");if(er&&!Fe.get(t))if(i.isExternal||n.reloadDocument)window.location.href=l;else{let s=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:n.replace}));throw Fe.set(t,s),s}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l}`})}}return e}function La({routeContext:e,match:t,children:r}){let a=g.useContext(G);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(I.Provider,{value:e},r)}function Da(e,t=[],r){let a=r?.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let n=e,o=a?.errors;if(o!=null){let c=n.findIndex(d=>d.route.id&&o?.[d.route.id]!==void 0);L(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),n=n.slice(0,Math.min(n.length,c+1))}let i=!1,l=-1;if(r&&a){i=a.renderFallback;for(let c=0;c<n.length;c++){let d=n[c];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(l=c),d.route.id){let{loaderData:m,errors:h}=a,y=d.route.loader&&!m.hasOwnProperty(d.route.id)&&(!h||h[d.route.id]===void 0);if(d.route.lazy||y){r.isStatic&&(i=!0),l>=0?n=n.slice(0,l+1):n=[n[0]];break}}}}let s=r?.onError,u=a&&s?(c,d)=>{s(c,{location:a.location,params:a.matches?.[0]?.params??{},pattern:ia(a.matches),errorInfo:d})}:void 0;return n.reduceRight((c,d,m)=>{let h,y=!1,p=null,f=null;a&&(h=o&&d.route.id?o[d.route.id]:void 0,p=d.route.errorElement||Pa,i&&(l<0&&m===0?(hr("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,f=null):l===m&&(y=!0,f=d.route.hydrateFallbackElement||null)));let R=t.concat(n.slice(0,m+1)),w=()=>{let b;return h?b=p:y?b=f:d.route.Component?b=g.createElement(d.route.Component,null):d.route.element?b=d.route.element:b=c,g.createElement(La,{match:d,routeContext:{outlet:c,matches:R,isDataRoute:a!=null},children:b})};return a&&(d.route.ErrorBoundary||d.route.errorElement||m===0)?g.createElement(cr,{location:a.location,revalidation:a.revalidation,component:p,error:h,children:w(),routeContext:{outlet:null,matches:R,isDataRoute:!0},onError:u}):w()},null)}function ze(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ka(e){let t=g.useContext(G);return L(t,ze(e)),t}function Be(e){let t=g.useContext(re);return L(t,ze(e)),t}function Fa(e){let t=g.useContext(I);return L(t,ze(e)),t}function We(e){let t=Fa(e),r=t.matches[t.matches.length-1];return L(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function Ta(){return We("useRouteId")}function dr(){let e=Be("useNavigation");return g.useMemo(()=>{let{matches:t,historyAction:r,...a}=e.navigation;return a},[e.navigation])}function Ye(){let{matches:e,loaderData:t}=Be("useMatches");return g.useMemo(()=>e.map(r=>Br(r,t)),[e,t])}function fr(){let e=g.useContext(je),t=Be("useRouteError"),r=We("useRouteError");return e!==void 0?e:t.errors?.[r]}function Na(){let{router:e}=ka("useNavigate"),t=We("useNavigate"),r=g.useRef(!1);return lr(()=>{r.current=!0}),g.useCallback(async(n,o={})=>{O(r.current,ir),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}var Ut={};function hr(e,t,r){!t&&!Ut[e]&&(Ut[e]=!0,O(!1,r))}var Ma="useOptimistic",zn=x[Ma];var Bn=x.memo(Oa);function Oa({routes:e,manifest:t,future:r,state:a,isStatic:n,onError:o}){return ur(e,void 0,{manifest:t,state:a,isStatic:n,onError:o,future:r})}function Aa({basename:e,children:t,initialEntries:r,initialIndex:a,useTransitions:n}){let o=x.useRef();o.current==null&&(o.current=Wt({initialEntries:r,initialIndex:a,v5Compat:!0}));let i=o.current,[l,s]=x.useState({action:i.action,location:i.location}),u=x.useCallback(c=>{n===!1?s(c):x.startTransition(()=>s(c))},[n]);return x.useLayoutEffect(()=>i.listen(u),[i,u]),x.createElement(Ee,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:i,useTransitions:n})}function _a({to:e,replace:t,state:r,relative:a}){L(Q(),"<Navigate> may be used only in the context of a <Router> component.");let{static:n,navigator:o}=x.useContext(N);O(!n,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=x.useContext(I),{pathname:l}=T(),s=q(),u=Se(e,$e(i),l,a==="path");He(typeof e=="string"?e:W(e),o.createHref(u),Ie(o),"reject");let c=JSON.stringify(u);return x.useEffect(()=>{s(JSON.parse(c),{replace:t,state:r,relative:a})},[s,c,a,t,r]),null}function mr(e){L(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Ee({basename:e="/",children:t=null,location:r,navigationType:a="POP",navigator:n,static:o=!1,useTransitions:i}){L(!Q(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),s=x.useMemo(()=>({basename:l,navigator:n,static:o,useTransitions:i,future:{}}),[l,n,o,i]);typeof r=="string"&&(r=V(r));let{pathname:u="/",search:c="",hash:d="",state:m=null,key:h="default",mask:y}=r,p=x.useMemo(()=>{let f=U(u,l);return f==null?null:{location:{pathname:f,search:c,hash:d,state:m,key:h,mask:y},navigationType:a}},[l,u,c,d,m,h,a,y]);return O(p!=null,`<Router basename="${l}"> is not able to match the URL "${u}${c}${d}" because it does not start with the basename, so the <Router> won't render anything.`),p==null?null:x.createElement(N.Provider,{value:s},x.createElement(X.Provider,{children:t,value:p}))}function $a({children:e,location:t}){return sr(Re(e),t)}function Re(e,t=[]){let r=[];return x.Children.forEach(e,(a,n)=>{if(!x.isValidElement(a))return;let o=[...t,n];if(a.type===x.Fragment){r.push.apply(r,Re(a.props.children,o));return}L(a.type===mr,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),L(!a.props.index||!a.props.children,"An index route cannot have child routes.");let i={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(i.children=Re(a.props.children,o)),r.push(i)}),r}var pe="get",ye="application/x-www-form-urlencoded";function xe(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Ia(e){return xe(e)&&e.tagName.toLowerCase()==="button"}function Ha(e){return xe(e)&&e.tagName.toLowerCase()==="form"}function Ua(e){return xe(e)&&e.tagName.toLowerCase()==="input"}function ja(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function za(e,t){return e.button===0&&(!t||t==="_self")&&!ja(e)}function we(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let a=e[r];return t.concat(Array.isArray(a)?a.map(n=>[r,n]):[[r,a]])},[]))}function Ba(e,t){let r=we(e);return t&&t.forEach((a,n)=>{r.has(n)||t.getAll(n).forEach(o=>{r.append(n,o)})}),r}var he=null;function Wa(){if(he===null)try{new FormData(document.createElement("form"),0),he=!1}catch{he=!0}return he}var Ya=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Te(e){return e!=null&&!Ya.has(e)?(O(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ye}"`),null):e}function Va(e,t){let r,a,n,o,i;if(Ha(e)){let l=e.getAttribute("action");a=l?U(l,t):null,r=e.getAttribute("method")||pe,n=Te(e.getAttribute("enctype"))||ye,o=new FormData(e)}else if(Ia(e)||Ua(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||l.getAttribute("action");if(a=s?U(s,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||pe,n=Te(e.getAttribute("formenctype"))||Te(l.getAttribute("enctype"))||ye,o=new FormData(l,e),!Wa()){let{name:u,type:c,value:d}=e;if(c==="image"){let m=u?`${u}.`:"";o.append(`${m}x`,"0"),o.append(`${m}y`,"0")}else u&&o.append(u,d)}}else{if(xe(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=pe,a=null,n=ye,i=e}return o&&n==="text/plain"&&(i=o,o=void 0),{action:a,method:r.toLowerCase(),encType:n,formData:o,body:i}}var Wn=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ja={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},Ka=/[&><\u2028\u2029]/g;function jt(e){return e.replace(Ka,t=>Ja[t])}function Je(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}var Ga=Symbol("SingleFetchRedirect");function pr(e,t,r,a){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?n.pathname.endsWith("/")?n.pathname=`${n.pathname}_.${a}`:n.pathname=`${n.pathname}.${a}`:n.pathname==="/"?n.pathname=`_root.${a}`:t&&U(n.pathname,t)==="/"?n.pathname=`${te(t)}/_root.${a}`:n.pathname=`${te(n.pathname)}.${a}`,n}async function Xa(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){if(console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode&&import.meta.hot)throw r;return window.location.reload(),new Promise(()=>{})}}function Qa(e){return e!=null&&typeof e.page=="string"}function qa(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Za(e,t,r){let a=await Promise.all(e.map(async n=>{let o=t.routes[n.route.id];if(o){let i=await Xa(o,r);return i.links?i.links():[]}return[]}));return an(a.flat(1).filter(qa).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function zt(e,t,r,a,n,o){let i=(s,u)=>r[u]?s.route.id!==r[u].route.id:!0,l=(s,u)=>r[u].pathname!==s.pathname||r[u].route.path?.endsWith("*")&&r[u].params["*"]!==s.params["*"];return o==="assets"?t.filter((s,u)=>i(s,u)||l(s,u)):o==="data"?t.filter((s,u)=>{let c=a.routes[s.route.id];if(!c||!c.hasLoader)return!1;if(i(s,u)||l(s,u))return!0;if(s.route.shouldRevalidate){let d=s.route.shouldRevalidate({currentUrl:new URL(n.pathname+n.search+n.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:s.params,defaultShouldRevalidate:!0});if(typeof d=="boolean")return d}return!0}):[]}function en(e,t,{includeHydrateFallback:r}={}){return tn(e.map(a=>{let n=t.routes[a.route.id];if(!n)return[];let o=[n.module];return n.clientActionModule&&(o=o.concat(n.clientActionModule)),n.clientLoaderModule&&(o=o.concat(n.clientLoaderModule)),r&&n.hydrateFallbackModule&&(o=o.concat(n.hydrateFallbackModule)),n.imports&&(o=o.concat(n.imports)),o}).flat(1))}function tn(e){return[...new Set(e)]}function rn(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function an(e,t){let r=new Set,a=new Set(t);return e.reduce((n,o)=>{if(t&&!Qa(o)&&o.as==="script"&&o.href&&a.has(o.href))return n;let l=JSON.stringify(rn(o));return r.has(l)||(r.add(l),n.push({key:l,link:o})),n},[])}function Ke(){let e=S.useContext(G);return Je(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function sn(){let e=S.useContext(re);return Je(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var le=S.createContext(void 0);le.displayName="FrameworkContext";function Pe(){let e=S.useContext(le);return Je(e,"You must render this element inside a <HydratedRouter> element"),e}function un(e,t){let r=S.useContext(le),[a,n]=S.useState(!1),[o,i]=S.useState(!1),{onFocus:l,onBlur:s,onMouseEnter:u,onMouseLeave:c,onTouchStart:d}=t,m=S.useRef(null);S.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let p=R=>{R.forEach(w=>{i(w.isIntersecting)})},f=new IntersectionObserver(p,{threshold:.5});return m.current&&f.observe(m.current),()=>{f.disconnect()}}},[e]),S.useEffect(()=>{if(a){let p=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(p)}}},[a]);let h=()=>{n(!0)},y=()=>{n(!1),i(!1)};return r?e!=="intent"?[o,m,{}]:[o,m,{onFocus:oe(l,h),onBlur:oe(s,y),onMouseEnter:oe(u,h),onMouseLeave:oe(c,y),onTouchStart:oe(d,h)}]:[!1,m,{}]}function oe(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function gr({page:e,...t}){let r=pa(),{nonce:a}=Pe(),{router:n}=Ke(),o=S.useMemo(()=>_e(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?(t.nonce==null&&a&&(t={...t,nonce:a}),r?S.createElement(dn,{page:e,matches:o,...t}):S.createElement(fn,{page:e,matches:o,...t})):null}function cn(e){let{manifest:t,routeModules:r}=Pe(),[a,n]=S.useState([]);return S.useEffect(()=>{let o=!1;return Za(e,t,r).then(i=>{o||n(i)}),()=>{o=!0}},[e,t,r]),a}function dn({page:e,matches:t,...r}){let a=T(),{future:n}=Pe(),{basename:o}=Ke(),i=S.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let l=pr(e,o,n.v8_trailingSlashAwareDataRequests,"rsc"),s=!1,u=[];for(let c of t)typeof c.route.shouldRevalidate=="function"?s=!0:u.push(c.route.id);return s&&u.length>0&&l.searchParams.set("_routes",u.join(",")),[l.pathname+l.search]},[o,n.v8_trailingSlashAwareDataRequests,e,a,t]);return S.createElement(S.Fragment,null,i.map(l=>S.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...r})))}function fn({page:e,matches:t,...r}){let a=T(),{future:n,manifest:o,routeModules:i}=Pe(),{basename:l}=Ke(),{loaderData:s,matches:u}=sn(),c=S.useMemo(()=>zt(e,t,u,o,a,"data"),[e,t,u,o,a]),d=S.useMemo(()=>zt(e,t,u,o,a,"assets"),[e,t,u,o,a]),m=S.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let p=new Set,f=!1;if(t.forEach(w=>{let b=o.routes[w.route.id];!b||!b.hasLoader||(!c.some(P=>P.route.id===w.route.id)&&w.route.id in s&&i[w.route.id]?.shouldRevalidate||b.hasClientLoader?f=!0:p.add(w.route.id))}),p.size===0)return[];let R=pr(e,l,n.v8_trailingSlashAwareDataRequests,"data");return f&&p.size>0&&R.searchParams.set("_routes",t.filter(w=>p.has(w.route.id)).map(w=>w.route.id).join(",")),[R.pathname+R.search]},[l,n.v8_trailingSlashAwareDataRequests,s,a,o,c,t,e,i]),h=S.useMemo(()=>en(d,o),[d,o]),y=cn(d);return S.createElement(S.Fragment,null,m.map(p=>S.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...r})),h.map(p=>S.createElement("link",{key:p,rel:"modulepreload",href:p,...r})),y.map(({key:p,link:f})=>S.createElement("link",{key:p,nonce:r.nonce,...f,crossOrigin:f.crossOrigin??r.crossOrigin})))}function hn(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var mn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{mn&&(window.__reactRouterVersion="7.18.3")}catch{}function pn({basename:e,children:t,useTransitions:r,window:a}){let n=v.useRef();n.current==null&&(n.current=Yt({window:a,v5Compat:!0}));let o=n.current,[i,l]=v.useState({action:o.action,location:o.location}),s=v.useCallback(u=>{r===!1?l(u):v.startTransition(()=>l(u))},[r]);return v.useLayoutEffect(()=>o.listen(s),[o,s]),v.createElement(Ee,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,useTransitions:r})}function vr({basename:e,children:t,history:r,useTransitions:a}){let[n,o]=v.useState({action:r.action,location:r.location}),i=v.useCallback(l=>{a===!1?o(l):v.startTransition(()=>o(l))},[a]);return v.useLayoutEffect(()=>r.listen(i),[r,i]),v.createElement(Ee,{basename:e,children:t,location:n.location,navigationType:n.action,navigator:r,useTransitions:a})}vr.displayName="unstable_HistoryRouter";var se=v.forwardRef(function({onClick:t,discover:r="render",prefetch:a="none",relative:n,reloadDocument:o,replace:i,mask:l,state:s,target:u,to:c,preventScrollReset:d,viewTransition:m,defaultShouldRevalidate:h,...y},p){let{basename:f,navigator:R,useTransitions:w}=v.useContext(N),b=typeof c=="string"&&Ae.test(c),P=tr(c,f);c=P.to;let E=be(c,{relative:n}),F=T(),k=null;if(l){let Y=Se(l,[],F.mask?F.mask.pathname:"/",!0);f!=="/"&&(Y.pathname=Y.pathname==="/"?f:H([f,Y.pathname])),k=R.createHref(Y)}let[$,K,B]=un(a,y),ue=Er(c,{replace:i,mask:l,state:s,target:u,preventScrollReset:d,relative:n,viewTransition:m,defaultShouldRevalidate:h,useTransitions:w});function Z(Y){t&&t(Y),Y.defaultPrevented||ue(Y)}let ce=!(P.isExternal||o),rt=v.createElement("a",{...y,...B,href:(ce?k:void 0)||P.absoluteURL||E,onClick:ce?Z:t,ref:hn(p,K),target:u,"data-discover":!b&&r==="render"?"true":void 0});return $&&!b?v.createElement(v.Fragment,null,rt,v.createElement(gr,{page:E})):rt});se.displayName="Link";var Rr=v.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:a="",end:n=!1,style:o,to:i,viewTransition:l,children:s,...u},c){let d=ae(i,{relative:u.relative}),m=T(),h=v.useContext(re),{navigator:y,basename:p}=v.useContext(N),f=h!=null&&Lr(d)&&l===!0,R=y.encodeLocation?y.encodeLocation(d).pathname:d.pathname,w=m.pathname,b=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;r||(w=w.toLowerCase(),b=b?b.toLowerCase():null,R=R.toLowerCase()),b&&p&&(b=U(b,p)||b);let P=R!=="/"&&R.endsWith("/")?R.length-1:R.length,E=w===R||!n&&w.startsWith(R)&&w.charAt(P)==="/",F=b!=null&&(b===R||!n&&b.startsWith(R)&&b.charAt(R.length)==="/"),k={isActive:E,isPending:F,isTransitioning:f},$=E?t:void 0,K;typeof a=="function"?K=a(k):K=[a,E?"active":null,F?"pending":null,f?"transitioning":null].filter(Boolean).join(" ");let B=typeof o=="function"?o(k):o;return v.createElement(se,{...u,"aria-current":$,className:K,ref:c,style:B,to:i,viewTransition:l},typeof s=="function"?s(k):s)});Rr.displayName="NavLink";var wr=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:a,replace:n,state:o,method:i=pe,action:l,onSubmit:s,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:m,...h},y)=>{let{useTransitions:p}=v.useContext(N),f=xr(),R=Pr(l,{relative:u}),w=i.toLowerCase()==="get"?"get":"post",b=typeof l=="string"&&Ae.test(l);return v.createElement("form",{ref:y,method:w,action:R,onSubmit:a?s:E=>{if(s&&s(E),E.defaultPrevented)return;E.preventDefault();let F=E.nativeEvent.submitter,k=F?.getAttribute("formmethod")||i,$=()=>f(F||E.currentTarget,{fetcherKey:t,method:k,navigate:r,replace:n,state:o,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:m});p&&r!==!1?v.startTransition(()=>$()):$()},...h,"data-discover":!b&&e==="render"?"true":void 0})});wr.displayName="Form";function Sr({getKey:e,storageKey:t,...r}){let a=v.useContext(le),{basename:n}=v.useContext(N),o=T(),i=Ye();Cr({getKey:e,storageKey:t});let l=v.useMemo(()=>{if(!a||!e)return null;let u=Oe(o,i,n,e);return u!==o.key?u:null},[]);if(!a||a.isSpaMode)return null;let s=((u,c)=>{if(!window.history.state||!window.history.state.key){let d=Math.random().toString(32).slice(2);window.history.replaceState({key:d},"")}try{let m=JSON.parse(sessionStorage.getItem(u)||"{}")[c||window.history.state.key];typeof m=="number"&&window.scrollTo(0,m)}catch(d){console.error(d),sessionStorage.removeItem(u)}}).toString();return r.nonce==null&&a?.nonce&&(r.nonce=a.nonce),v.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${s})(${jt(JSON.stringify(t||Me))}, ${jt(JSON.stringify(l))})`}})}Sr.displayName="ScrollRestoration";function br(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ge(e){let t=v.useContext(G);return L(t,br(e)),t}function yn(e){let t=v.useContext(re);return L(t,br(e)),t}function Er(e,{target:t,replace:r,mask:a,state:n,preventScrollReset:o,relative:i,viewTransition:l,defaultShouldRevalidate:s,useTransitions:u}={}){let c=q(),d=T(),m=ae(e,{relative:i});return v.useCallback(h=>{if(za(h,t)){h.preventDefault();let y=r!==void 0?r:W(d)===W(m),p=()=>c(e,{replace:y,mask:a,state:n,preventScrollReset:o,relative:i,viewTransition:l,defaultShouldRevalidate:s});u?v.startTransition(()=>p()):p()}},[d,c,m,r,a,n,t,e,o,i,l,s,u])}function Xe(e){O(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=v.useRef(we(e)),r=v.useRef(!1),a=T(),n=v.useMemo(()=>Ba(a.search,r.current?null:t.current),[a.search]),o=q(),i=v.useCallback((l,s)=>{let u=we(typeof l=="function"?l(new URLSearchParams(n)):l);r.current=!0,o("?"+u,s)},[o,n]);return[n,i]}var gn=0,vn=()=>`__${String(++gn)}__`;function xr(){let{router:e}=Ge("useSubmit"),{basename:t}=v.useContext(N),r=Ta(),a=e.fetch,n=e.navigate;return v.useCallback(async(o,i={})=>{let{action:l,method:s,encType:u,formData:c,body:d}=Va(o,t);if(i.navigate===!1){let m=i.fetcherKey||vn();await a(m,r,i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:c,body:d,formMethod:i.method||s,formEncType:i.encType||u,flushSync:i.flushSync})}else await n(i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:c,body:d,formMethod:i.method||s,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:r,flushSync:i.flushSync,viewTransition:i.viewTransition})},[a,n,t,r])}function Pr(e,{relative:t}={}){let{basename:r}=v.useContext(N),a=v.useContext(I);L(a,"useFormAction must be used inside a RouteContext");let[n]=a.matches.slice(-1),o={...ae(e||".",{relative:t})},i=T();if(e==null){o.search=i.search;let l=new URLSearchParams(o.search),s=l.getAll("index");if(s.some(c=>c==="")){l.delete("index"),s.filter(d=>d).forEach(d=>l.append("index",d));let c=l.toString();o.search=c?`?${c}`:""}}return(!e||e===".")&&n.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:H([r,o.pathname])),W(o)}var Me="react-router-scroll-positions",me={};function Oe(e,t,r,a){let n=null;return a&&(r!=="/"?n=a({...e,pathname:U(e.pathname,r)||e.pathname},t):n=a(e,t)),n==null&&(n=e.key),n}function Cr({getKey:e,storageKey:t}={}){let{router:r}=Ge("useScrollRestoration"),{restoreScrollPosition:a,preventScrollReset:n}=yn("useScrollRestoration"),{basename:o}=v.useContext(N),i=T(),l=Ye(),s=dr();v.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),Rn(v.useCallback(()=>{if(s.state==="idle"){let u=Oe(i,l,o,e);me[u]=window.scrollY}try{sessionStorage.setItem(t||Me,JSON.stringify(me))}catch(u){O(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${u}).`)}window.history.scrollRestoration="auto"},[s.state,e,o,i,l,t])),typeof document<"u"&&(v.useLayoutEffect(()=>{try{let u=sessionStorage.getItem(t||Me);u&&(me=JSON.parse(u))}catch{}},[t]),v.useLayoutEffect(()=>{let u=r?.enableScrollRestoration(me,()=>window.scrollY,e?(c,d)=>Oe(c,d,o,e):void 0);return()=>u&&u()},[r,o,e]),v.useLayoutEffect(()=>{if(a!==!1){if(typeof a=="number"){window.scrollTo(0,a);return}try{if(i.hash){let u=document.getElementById(decodeURIComponent(i.hash.slice(1)));if(u){u.scrollIntoView();return}}}catch{O(!1,`"${i.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}n!==!0&&window.scrollTo(0,0)}},[i,a,n]))}function Rn(e,t){let{capture:r}=t||{};v.useEffect(()=>{let a=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,a),()=>{window.removeEventListener("pagehide",e,a)}},[e,r])}function Lr(e,{relative:t}={}){let r=v.useContext(Ue);L(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Ge("useViewTransitionState"),n=ae(e,{relative:t});if(!r.isTransitioning)return!1;let o=U(r.currentLocation.pathname,a)||r.currentLocation.pathname,i=U(r.nextLocation.pathname,a)||r.nextLocation.pathname;return ie(n.pathname,i)!=null||ie(n.pathname,o)!=null}var Qe=D(M(),1),kr=D(Ar(),1);var j=D(ee(),1);function Fr({context:e,own:t}){ne(e.store);let r=pt(),a=mt()?.live??e.store;ne(a);let n=St();if(!r||a.batches().length===0&&n===0)return null;let o=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Qe.Suspense,{fallback:null,children:(0,j.jsx)(kt,{})}),(0,j.jsx)(Qe.Suspense,{fallback:null,children:(0,j.jsx)(Ft,{})})]});return t?(0,kr.createPortal)(o,t):(0,j.jsx)("div",{className:"graview-bar-own",children:o})}var A=D(M(),1);var J=D(M(),1),wn=(0,J.createContext)(null);function ui(){let e=new Map,t=new Set,r=()=>{for(let a of t)a()};return{count:a=>e.get(a)??0,place(a){return e.set(a,(e.get(a)??0)+1),r(),()=>{e.set(a,(e.get(a)??1)-1),r()}},subscribe(a){return t.add(a),()=>t.delete(a)}}}function Tr(e){let t=(0,J.useContext)(wn);(0,J.useLayoutEffect)(()=>t?.place(e),[t,e])}function ci(e,t){return(0,J.useSyncExternalStore)(e.subscribe,()=>e.count(t)>0,()=>!1)}var Nr=D(M(),1),z=D(ee(),1),qe="var(--graview-text-small)",Ze="var(--graview-text-body)",gi="var(--graview-font-display, var(--graview-font-body, system-ui))",et={maxWidth:760,margin:"0 auto",padding:"40px var(--graview-page-gutter, 20px) max(96px, calc(var(--graview-foot-room, 0px) + env(safe-area-inset-bottom, 0px)))",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40},tt=1160,vi={...et,maxWidth:tt},Mr={margin:0,fontSize:"var(--graview-text-title)",lineHeight:1.2,letterSpacing:"-0.012em",overflowWrap:"anywhere",textWrap:"balance"},Ri={margin:0,fontSize:"var(--graview-text-heading)",lineHeight:1.3,textWrap:"balance"},wi={margin:0,fontSize:qe,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Si={margin:0,fontSize:Ze,color:"var(--graview-ink-muted)",maxWidth:"60ch"},Or={color:"var(--graview-ink-muted)",fontSize:qe},bi={borderTop:"1px solid var(--graview-edge)",paddingTop:24},Sn={color:"var(--graview-accent)",textDecorationColor:"color-mix(in srgb, currentColor 50%, transparent)",textDecorationThickness:1,textUnderlineOffset:"0.2em",display:"inline-flex",alignItems:"center",columnGap:"0.3em",minHeight:24},Ei={...Sn,textDecoration:"none"},xi={color:"inherit",textDecoration:"none",display:"inline-flex",alignItems:"center",minHeight:24},Pi=`.graview-list{container-type:inline-size}
4
- .graview-rows{display:grid;grid-template-columns:minmax(0,1fr);column-gap:1.5rem;margin:0;padding:0;list-style:none;border-top:1px solid var(--graview-edge)}
5
- .graview-row{grid-column:1/-1;display:grid;grid-template-columns:subgrid;align-items:baseline;align-content:center;position:relative;box-sizing:border-box;min-height:2.75rem;padding:.5rem 0;border-bottom:1px solid var(--graview-edge);overflow-wrap:anywhere}
6
- .graview-row-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;min-height:24px;color:inherit;text-decoration:none;font-size:var(--graview-text-body);font-weight:500;line-height:1.3;text-wrap:pretty;hyphens:manual}
7
- .graview-row-title::after{content:"";position:absolute;inset:0}
8
- .graview-row-title:focus-visible{outline:0}
9
- .graview-row-title:focus-visible::after{outline:2px solid var(--graview-accent);outline-offset:-2px;border-radius:var(--graview-radius-sm)}
10
- .graview-row:hover .graview-row-title{text-decoration:underline 1px color-mix(in srgb,currentColor 50%,transparent);text-underline-offset:.2em}
11
- .graview-row:active .graview-row-title{color:var(--graview-accent)}
12
- .graview-row :is(a,button):not(.graview-row-title){position:relative}
13
- .graview-row-glance,.graview-row>[data-testid=search-why]{font-size:var(--graview-text-small);line-height:1.5;color:var(--graview-ink-muted)}
14
- .graview-row>[data-testid=search-why]{grid-column:1/-1}
15
- .graview-row-glance{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
16
- .graview-chip{display:inline-block;padding:0 .5em;border-radius:var(--graview-radius-sm);background:color-mix(in srgb,var(--graview-ink) 7%,transparent);color:var(--graview-ink);font-weight:500;line-height:1.6;white-space:nowrap}
17
- .graview-group-head{display:flex;gap:.5em;align-items:baseline;margin:0;padding:.375rem 0;font-family:var(--graview-font-body);font-size:var(--graview-text-small);font-weight:var(--graview-weight-label);line-height:1.3;letter-spacing:.02em;scroll-margin-top:4rem}
18
- .graview-group-head>span{color:var(--graview-ink-muted);font-weight:var(--graview-weight-body)}
19
- .graview-group-toggle{display:inline-flex;gap:.5em;align-items:center;min-height:2.75rem;margin:-.375rem 0;padding:0 .5rem 0 0;border:0;background:none;color:inherit;font:inherit;letter-spacing:inherit;text-align:start;cursor:pointer;border-radius:var(--graview-radius-sm)}
20
- .graview-group-toggle:focus-visible{outline:2px solid var(--graview-accent);outline-offset:2px}
21
- .graview-group-toggle>span{color:var(--graview-ink-muted);font-weight:var(--graview-weight-body)}
22
- @container (min-width:36rem){.graview-rows{grid-template-columns:minmax(0,1fr) fit-content(40%)}.graview-group-head:has(+.graview-rows){position:sticky;top:0;z-index:${it.raised};background:var(--graview-ground)}}`,Ci={font:"inherit",fontSize:qe,padding:"8px 14px",borderRadius:"var(--graview-radius-sm, 8px)",border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)",color:"var(--graview-ink)",cursor:"pointer"};function Li({kind:e,brand:t,size:r=10,schema:a}){return(0,z.jsx)(vt,{kind:e,...a?{schema:a}:{},...t?{brand:t}:{},size:Math.round(r*1.6)})}function Di(e,t){let a=[...new Set(t.targets.map(n=>n.kind))].map(n=>e.schema.tryDefinition(n)?.plural??Ce(n));return a.length>0?a.join(" and "):Ce(t.edgeKind)}function ki(e,t,r){return e.author.kind==="human"&&(e.author.id===void 0||t?.id===void 0||e.author.id===t.id)?"you":r?at(e.author,r):e.author.kind==="agent"?e.author.id??"an agent":e.author.id??e.author.kind}function Fi(e,t,r){return bn(e,t,r).map(a=>a.text).join(" \xB7 ")}function bn(e,t,r,a=()=>!1){return wt(e,t,{limit:3,said:[r],glance:!0}).map(n=>n.long?{text:Rt(n.stored,{markdown:n.markdown,most:100})}:a(n.key)?{text:n.alone,choice:n.key}:{text:n.alone})}function Ti({runs:e}){return(0,z.jsx)(z.Fragment,{children:e.map((t,r)=>{let a=r===0?"":t.choice===void 0&&e[r-1].choice===void 0?" \xB7 ":" ";return(0,z.jsx)(Nr.Fragment,{children:t.choice!==void 0?(0,z.jsxs)(z.Fragment,{children:[a,(0,z.jsx)("span",{className:"graview-chip","data-graview-field":t.choice,children:t.text})]}):`${a}${t.text}`},r)})})}var Ni=(e,t)=>de(e.schema,t),En=(e,t)=>{let r=e.kindsKeptFrom(t);return e.schema.kinds.filter(a=>!e.modules.disabledKinds.has(a)&&!r.has(a))},xn=e=>ft(En(e.store,e.principal),e.views?.arrangement?.()?.order),Mi=e=>{let t=new Set(e.views?.arrangement?.()?.hide??[]);return xn(e).filter(r=>!t.has(r))},Oi=e=>e.charAt(0).toUpperCase()+e.slice(1);var C=D(ee(),1);function Ji({context:e,children:t}){let{store:r,brand:a}=e;ne(r);let n=ht();return yt(e.embedded?void 0:ot(e.assetsAt??n,nt(a))),gt(e.embedded?void 0:a),(0,C.jsxs)("div",{style:{...e.embedded?{}:{minHeight:"100vh"},display:"flex",flexDirection:"column",background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:Ze,lineHeight:1.5},children:[e.embedded?null:(0,C.jsx)(Cn,{context:e}),(0,C.jsx)("div",{style:{flex:1},children:t}),e.remembers?(0,C.jsx)("footer",{style:{borderTop:"1px solid var(--graview-edge)",padding:"14px 20px max(20px, calc(var(--graview-foot-room, 0px) + env(safe-area-inset-bottom, 0px)))",...Or},children:(0,C.jsx)("div",{style:{maxWidth:tt,margin:"0 auto",display:"flex",gap:14,flexWrap:"wrap",alignItems:"center",justifyContent:"flex-end"},children:(0,C.jsxs)("span",{"data-testid":"remembered",children:["Remembered in this browser \xB7 ",(0,C.jsx)(Nt,{})]})})}):null]})}var Pn=(0,A.createContext)(null);function Cn({context:e}){let{store:t,brand:r,sceneHref:a="/",invariantContext:n}=e,o=T(),i=q(),l=be("/").replace(/\/$/,""),s=(0,A.useContext)(Pn),u=s?.places===!1?[]:bt({store:t,principal:e.principal,views:e.views}),c=e.views?.arrangement?.(),d=`${o.pathname}${o.search}`,m=t.violations(n),h=m.length,y=Lt(m,"All rules hold"),p=o.pathname.split("/").filter(Boolean),f=p.length===2&&fe(t.schema,p[0])!==void 0&&t.graph.getNode(decodeURIComponent(p[1]))!==void 0;return(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(Pt,{brand:r,name:r?.name??"Graview",description:r?.subtitle,home:{href:`${l}/`,go:()=>i("/"),current:o.pathname==="/"},faces:{scene:{label:ct(c),current:!1,go:()=>window.location.assign(a)},pages:{label:dt(c),current:!0,go:()=>{}}},places:u,current:Et(u,d),reach:{href:R=>`${l}${R}`,go:R=>i(R.path)},...s?{onFind:s.onFind,find:s.find}:{findBox:(0,C.jsx)(Fn,{context:e})},skips:(0,C.jsx)(Tt,{to:[{label:"Skip to the content",testid:"content",go:()=>{let R=document.querySelector("[data-graview-skip-target]");Le(R?.querySelector('[data-graview-choose-box][tabindex="0"]')??R??document.querySelector("main"))}},...f?[{label:"Skip to what can be done",testid:"acts",go:()=>void Le(document.querySelector("main [data-affordance]:not([disabled]):not([tabindex='-1'])")??document.querySelector("main [data-affordance]:not([disabled])")??document.querySelector("main"))}]:[]]}),tools:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(se,{to:"/problems","data-testid":"standing-link","aria-label":y,title:y,style:{...xt,padding:h===0?0:"0 8px",textDecoration:"none",fontWeight:600,fontVariantNumeric:"tabular-nums",color:h===0?"var(--graview-ink-muted)":"var(--graview-warn)"},children:[(0,C.jsx)(Dt,{tone:h===0?"var(--graview-good)":"var(--graview-warn)"}),h>0?(0,C.jsx)("span",{"aria-hidden":"true",children:h}):null]}),s?null:(0,C.jsx)(Fr,{context:e}),e.views?(0,C.jsx)(Ct,{...e.signature?{signature:!0}:{}}):null]})})})}function Ki({context:e,style:t,bleedTop:r,children:a,...n}){let o=e.embedded||e.framed?"section":"main";return(0,C.jsxs)(o,{style:{...et,...t},"data-graview-page-main":"",...r?{"data-graview-bleed-top":""}:{},...n,children:[r?(0,C.jsx)("style",{children:Ln}):null,a]})}var Ln="@media (max-width:680px){[data-graview-bleed-top]:not(:has([data-graview-bleed]>[data-worker-view-fallback])){padding-top:0 !important}}";function Gi({when:e,children:t}){return e?(0,C.jsxs)("div",{"data-graview-bleed":"",style:{display:"grid",minWidth:0},children:[(0,C.jsx)("style",{children:Dn}),t]}):(0,C.jsx)(C.Fragment,{children:t})}var Dn="@media (max-width:680px){[data-graview-bleed]:not(:has(>[data-worker-view-fallback])){margin-inline:min(0px,calc(env(safe-area-inset-left,0px) - var(--graview-page-gutter,20px))) min(0px,calc(env(safe-area-inset-right,0px) - var(--graview-page-gutter,20px)))}}",kn={position:"absolute",width:1,height:1,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"};function Xi({context:e,unseen:t,children:r,...a}){let n=`h${e.titleLevel??(e.framed&&!e.barAbove?1:2)}`;return(0,C.jsx)(n,{style:t?kn:Mr,"data-graview-page-title":"",...a,children:r})}function Fn({context:e,narrowsLists:t=!0,className:r,size:a}){Tr("find");let n=T(),o=q(),[i,l]=Xe(),s=n.pathname.split("/").filter(Boolean),u=t&&s.length===1&&fe(e.store.schema,s[0])!==void 0,c=n.pathname==="/search",d=u||c?i.get("q")??"":"",m=u?`Narrow ${de(e.store.schema,fe(e.store.schema,s[0])).toLowerCase()}\u2026`:"",[h,y]=(0,A.useState)(!0);(0,A.useLayoutEffect)(()=>{let P=R.current;if(!P||!m||typeof ResizeObserver>"u")return;let E=()=>{let k=getComputedStyle(P),$=document.createElement("canvas").getContext("2d");$&&($.font=`${k.fontWeight} ${k.fontSize} ${k.fontFamily}`,y($.measureText(m).width<=P.clientWidth-parseFloat(k.paddingLeft)-parseFloat(k.paddingRight)))};E();let F=new ResizeObserver(E);return F.observe(P),()=>F.disconnect()},[m]);let[p,f]=(0,A.useState)(d),R=(0,A.useRef)(null);(0,A.useEffect)(()=>{let P=E=>{if(E.defaultPrevented||E.altKey)return;let F=!E.shiftKey&&(E.metaKey||E.ctrlKey)&&E.key.toLowerCase()==="k",k=document.activeElement,$=k instanceof HTMLInputElement||k instanceof HTMLTextAreaElement||k instanceof HTMLSelectElement||k instanceof HTMLElement&&k.isContentEditable,K=E.key==="/"&&!E.metaKey&&!E.ctrlKey&&!$;if(!F&&!K)return;let B=R.current,ue=B?.closest("[data-graview-embed]"),Z=E.target,ce=Z===document.body||Z===document.documentElement;!B||!(ce||!ue||Z instanceof Node&&ue.contains(Z))||(E.preventDefault(),B.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),requestAnimationFrame(()=>{B.focus(),B.select()}))};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[]);let w=(0,A.useRef)(new Set([d]));(0,A.useEffect)(()=>{w.current.has(d)||(w.current=new Set([d]),f(d))},[d]);let b=P=>{if(f(P),w.current.add(P),u){let F=new URLSearchParams(i);P.trim()?F.set("q",P):F.delete("q"),l(F,{replace:!0});return}let E=P.trim()?`/search?${new URLSearchParams({q:P}).toString()}`:"/search";o(E,{replace:c})};return(0,C.jsxs)("form",{role:"search","aria-label":u?"Narrow this list":"Find anything",className:Ot("graview-find",r),...Mt(a),onSubmit:P=>{P.preventDefault(),u&&p.trim()&&o(`/search?${new URLSearchParams({q:p}).toString()}`)},children:[(0,C.jsx)("input",{ref:R,type:"search","data-testid":"nav-find",value:p,onChange:P=>b(P.target.value),placeholder:u?h?m:"Narrow\u2026":"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K","aria-label":u?"Narrow this list":"Find anything",className:"graview-find-box"}),(0,C.jsx)("style",{children:Tn})]})}var Tn=`:where(.graview-find){display:flex;min-width:0;flex:1 1 auto}
23
- :where(.graview-find[data-size=md]){--graview-control-height:36px}
24
- :where(.graview-find-box){box-sizing:border-box;width:100%;min-width:0;height:var(--graview-control-height,30px);padding:0 var(--graview-bar-find-end,10px) 0 10px;font:inherit;font-size:.875rem;color:var(--graview-ink);background:var(--graview-ground);border:1px solid var(--graview-edge);border-radius:8px}`;export{_r as a,fe as b,Mn as c,On as d,qe as e,gi as f,vi as g,Ri as h,wi as i,Si as j,Or as k,bi as l,Sn as m,Ei as n,xi as o,Pi as p,Ci as q,Li as r,Di as s,ki as t,Fi as u,bn as v,Ti as w,Ni as x,En as y,xn as z,Mi as A,Oi as B,Fr as C,be as D,T as E,Sa as F,q as G,Ea as H,Aa as I,_a as J,mr as K,$a as L,pn as M,se as N,Xe as O,wn as P,ui as Q,ci as R,Ji as S,Pn as T,Ki as U,Gi as V,Xi as W,Fn as X};
25
- /*! Bundled license information:
26
-
27
- react-router/dist/development/chunk-BV7QT456.mjs:
28
- (**
29
- * react-router v7.18.3
30
- *
31
- * Copyright (c) Remix Software Inc.
32
- *
33
- * This source code is licensed under the MIT license found in the
34
- * LICENSE.md file in the root directory of this source tree.
35
- *
36
- * @license MIT
37
- *)
38
-
39
- react-router/dist/development/index.mjs:
40
- (**
41
- * react-router v7.18.3
42
- *
43
- * Copyright (c) Remix Software Inc.
44
- *
45
- * This source code is licensed under the MIT license found in the
46
- * LICENSE.md file in the root directory of this source tree.
47
- *
48
- * @license MIT
49
- *)
50
- */
@@ -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{G as k,Ka as o,V as n}from"./chunk.3CJLAJXP.js";import{a as t}from"./chunk.SDO3U72B.js";import{b as p}from"./chunk.AJZBJBMO.js";var f=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.MIE4TJRW.js","./chunk.CXJJB3MK.js","./chunk.OJGHDWI6.js","./chunk.74B6KQF4.js","./chunk.WVUJXDXZ.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.E5WJSTOV.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.MIE4TJRW.js","./chunk.CXJJB3MK.js","./chunk.OJGHDWI6.js","./chunk.74B6KQF4.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.X2NGFOAF.js")))),I=d.part((e,r)=>e.drawLinkedRecord(r),{quiet:!0}),w=d.part((e,r)=>e.drawLinkedPicker(r),{what:"Picking a linked record"});var s=p(n(),1),m=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.MIE4TJRW.js","./chunk.CXJJB3MK.js","./chunk.OJGHDWI6.js","./chunk.74B6KQF4.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.J545NAMY.js")))),g=m.part((e,r)=>(0,s.jsx)(e.RepeatPicker,{...r}),{quiet:!0}),E=m.part((e,r)=>(0,s.jsx)(e.RepeatEditor,{...r}),{quiet:!0});var a=p(k(),1),i=p(n(),1),c=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4PCVQEVI.js")))),l=c.part((e,r)=>(0,i.jsx)(e.WhenInput,{...r}),{quiet:!0});function M(e){return(0,i.jsx)(a.Suspense,{fallback:(0,i.jsx)("span",{"data-graview-when-arriving":"",style:{display:"inline-block",minHeight:24}}),children:(0,i.jsx)(l,{...e})})}var N=()=>c.load().then(()=>{},()=>{});export{y as a,I as b,w as c,g as d,E as e,M as f,N as g};
@@ -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.IMKD6QQG.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.UETLP5KC.js";import{a as We}from"./chunk.J6KNEI5R.js";import{e as X}from"./chunk.5M34BJIQ.js";import{a as j}from"./chunk.2QQ37RCZ.js";import{f as $e,g as Y,i as De}from"./chunk.FOSY7MZF.js";import{a as be}from"./chunk.S3EEY7T3.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.J24YPQ5I.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.ISN2QTVL.js","./chunk.XTTESA7X.js","./chunk.5M34BJIQ.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BR6TINGU.js"))),$t=()=>(__graviewPreload(import.meta.url,["./chunk.2QQ37RCZ.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KHAVEYT7.js")).catch(()=>{}),Dt=async()=>{(await $t())?.judgeWithLines()},W=q(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.3RFAUIGT.js"))),Jt=q(()=>(__graviewPreload(import.meta.url,["./chunk.CS72MISN.js","./chunk.G4JJXA63.js","./chunk.TBY5IR7C.js","./chunk.XSWR5LI4.js","./chunk.BIDL7GQD.js","./chunk.XTTESA7X.js","./chunk.MH46V556.js","./chunk.XOZU4OFA.js","./chunk.5M34BJIQ.js","./chunk.Q5WEOX3Q.js","./chunk.UHI3X2YD.js","./chunk.INTJD5WG.js","./chunk.2QQ37RCZ.js","./chunk.WVUJXDXZ.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VRYSZYAD.js"))),Et=q(()=>(__graviewPreload(import.meta.url,["./chunk.7VQ3C7F4.js","./chunk.ISN2QTVL.js","./chunk.XTTESA7X.js","./chunk.J6KNEI5R.js","./chunk.2YMO7ZVX.js","./chunk.5M34BJIQ.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.3KO35VN4.js"))),Ht=q(()=>(__graviewPreload(import.meta.url,["./chunk.5THLLSS4.js","./chunk.LKK5YF2H.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.C437FVD7.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};