graview 0.1.41 → 0.1.43

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 (216) hide show
  1. package/dist/preview/chunk.22E4GKYU.js +1 -0
  2. package/dist/preview/chunk.25VAWLKJ.js +1 -0
  3. package/dist/preview/chunk.26SI4K3P.js +35 -0
  4. package/dist/preview/chunk.27QYTMXP.js +1 -0
  5. package/dist/preview/chunk.2AZTW66C.js +1 -0
  6. package/dist/preview/chunk.2JMJTREH.js +1 -0
  7. package/dist/preview/chunk.3B47UX2J.js +2 -0
  8. package/dist/preview/{chunk.JDRLSVOI.js → chunk.3GQL4K3Q.js} +1 -1
  9. package/dist/preview/chunk.3HLNRVFY.js +1 -0
  10. package/dist/preview/chunk.3JATXDSP.js +1 -0
  11. package/dist/preview/chunk.4C65DXZB.js +1 -0
  12. package/dist/preview/chunk.4HAGPMY6.js +117 -0
  13. package/dist/preview/chunk.4IDXQVSW.js +1 -0
  14. package/dist/preview/{chunk.ZRLXVYPG.js → chunk.4P3LS2OE.js} +1 -1
  15. package/dist/preview/{chunk.RQGTHRRJ.js → chunk.4YLBGGWT.js} +1 -1
  16. package/dist/preview/chunk.4ZHUGSJL.js +1 -0
  17. package/dist/preview/{chunk.D25XEVKO.js → chunk.4ZSHTUNK.js} +1 -1
  18. package/dist/preview/chunk.5BJW4IPW.js +1 -0
  19. package/dist/preview/{chunk.BFNVG5JE.js → chunk.5J2HETUO.js} +1 -1
  20. package/dist/preview/{chunk.V3V47QRE.js → chunk.5TBK44MK.js} +1 -1
  21. package/dist/preview/chunk.63DI7XNE.js +21 -0
  22. package/dist/preview/{chunk.VJXXCUKS.js → chunk.64MP7636.js} +1 -1
  23. package/dist/preview/chunk.6AYTF53S.js +1 -0
  24. package/dist/preview/chunk.6BU3GCHK.js +1 -0
  25. package/dist/preview/{chunk.C7JKMOFC.js → chunk.6IEDQHKI.js} +1 -1
  26. package/dist/preview/chunk.6K4JBLOP.js +1 -0
  27. package/dist/preview/{chunk.OF34OZ4V.js → chunk.6PF5LWRK.js} +1 -1
  28. package/dist/preview/{chunk.YWNHCZQ5.js → chunk.6ROYIMQ2.js} +1 -1
  29. package/dist/preview/{chunk.AIZQBPGU.js → chunk.6XEATXZC.js} +1 -1
  30. package/dist/preview/chunk.7IXLH7PR.js +1 -0
  31. package/dist/preview/chunk.7L6LYXCV.js +25 -0
  32. package/dist/preview/chunk.7MQ7UWVW.js +5 -0
  33. package/dist/preview/{chunk.Z7LDT55A.js → chunk.7MXQRSNR.js} +1 -1
  34. package/dist/preview/{chunk.DMF35E7D.js → chunk.7ROWZZN5.js} +1 -1
  35. package/dist/preview/chunk.7TU2PDYW.js +1 -0
  36. package/dist/preview/{chunk.WVDKYUF3.js → chunk.7XCBIID7.js} +1 -1
  37. package/dist/preview/{chunk.VNUHESMZ.js → chunk.A3WOUDOG.js} +1 -1
  38. package/dist/preview/{chunk.MUKDKVVC.js → chunk.AXJJUCWT.js} +1 -1
  39. package/dist/preview/chunk.B2KDYES6.js +1 -0
  40. package/dist/preview/chunk.BBLIT7S7.js +1 -0
  41. package/dist/preview/{chunk.NGDXH66B.js → chunk.BT6FUNQI.js} +1 -1
  42. package/dist/preview/chunk.BYVE2NQY.js +1 -0
  43. package/dist/preview/chunk.BYVLGDVJ.js +1 -0
  44. package/dist/preview/chunk.C3DX4LWD.js +49 -0
  45. package/dist/preview/chunk.C3X3R7LP.js +9 -0
  46. package/dist/preview/{chunk.C2PECN4C.js → chunk.C5NOO4CC.js} +1 -1
  47. package/dist/preview/{chunk.C4TSM4W5.js → chunk.CO2ZPX3D.js} +2 -2
  48. package/dist/preview/{chunk.5RABSIF7.js → chunk.CTSPNTDX.js} +1 -1
  49. package/dist/preview/{chunk.LPNIEPYI.js → chunk.CW6IPHRR.js} +2 -2
  50. package/dist/preview/chunk.CXJXVBGF.js +1 -0
  51. package/dist/preview/{chunk.4QPVS2ZM.js → chunk.DJ3BD7AZ.js} +1 -1
  52. package/dist/preview/{chunk.HB7ELBVK.js → chunk.DQR45N7V.js} +1 -1
  53. package/dist/preview/{chunk.2RVUDRRY.js → chunk.DYW4D74X.js} +1 -1
  54. package/dist/preview/chunk.DZN26GKS.js +1 -0
  55. package/dist/preview/chunk.E2AJ7U5Z.js +1 -0
  56. package/dist/preview/chunk.E5PHLNXR.js +1 -0
  57. package/dist/preview/{chunk.42XSBKPO.js → chunk.EBTYR5CZ.js} +1 -1
  58. package/dist/preview/chunk.EPPAFWP7.js +5 -0
  59. package/dist/preview/{chunk.UWW6ZEPY.js → chunk.F6CPM7SL.js} +1 -1
  60. package/dist/preview/chunk.FCPH4YZN.js +1 -0
  61. package/dist/preview/{chunk.BXT6FDT4.js → chunk.FKLEIR4Y.js} +1 -1
  62. package/dist/preview/chunk.FLMNHV6A.js +19 -0
  63. package/dist/preview/chunk.FTF67QE2.js +1 -0
  64. package/dist/preview/chunk.GNPYSMHA.js +1 -0
  65. package/dist/preview/chunk.GSZYT6GF.js +1 -0
  66. package/dist/preview/chunk.GZA5ZNLJ.js +1 -0
  67. package/dist/preview/chunk.HMABYAZR.js +1 -0
  68. package/dist/preview/chunk.I4HUBO22.js +1 -0
  69. package/dist/preview/chunk.IJ2AF3AW.js +1 -0
  70. package/dist/preview/{chunk.EAH47SCN.js → chunk.IJU322EP.js} +1 -1
  71. package/dist/preview/chunk.IQ3LUSD6.js +6 -0
  72. package/dist/preview/chunk.IWUSCCZN.js +1 -0
  73. package/dist/preview/{chunk.W3FTEJH5.js → chunk.JNCSGUO3.js} +1 -1
  74. package/dist/preview/{chunk.33KXSD6F.js → chunk.K6SPN4D6.js} +1 -1
  75. package/dist/preview/chunk.KBMVUIWR.js +6 -0
  76. package/dist/preview/{chunk.ISXFH3CK.js → chunk.KG5R4GTK.js} +1 -1
  77. package/dist/preview/chunk.KR3J27IA.js +88 -0
  78. package/dist/preview/chunk.KWQ67UK2.js +1 -0
  79. package/dist/preview/chunk.LBIDNJ6G.js +1 -0
  80. package/dist/preview/{chunk.HKCK3JI4.js → chunk.LDU25CCL.js} +1 -1
  81. package/dist/preview/{chunk.67WWRC6Y.js → chunk.MBOOUJOE.js} +1 -1
  82. package/dist/preview/{chunk.ZHLQWMV5.js → chunk.MI2HL3LQ.js} +1 -1
  83. package/dist/preview/chunk.MXU3VQSQ.js +1 -0
  84. package/dist/preview/{chunk.PMGXASFI.js → chunk.N3FONYEP.js} +2 -2
  85. package/dist/preview/chunk.NH6D6TWY.js +1 -0
  86. package/dist/preview/chunk.NQTCOBOQ.js +1 -0
  87. package/dist/preview/chunk.O4X5WJIC.js +1 -0
  88. package/dist/preview/chunk.OH2N3SX7.js +1 -0
  89. package/dist/preview/chunk.OIJP6PQV.js +1 -0
  90. package/dist/preview/{chunk.TN5PYGU7.js → chunk.ONSG3OIL.js} +1 -1
  91. package/dist/preview/chunk.ORKXXLWD.js +1 -0
  92. package/dist/preview/chunk.OUN2H3TR.js +1 -0
  93. package/dist/preview/{chunk.6FNMDAX5.js → chunk.OWL5GZ6U.js} +1 -1
  94. package/dist/preview/chunk.PEXPTDX7.js +1 -0
  95. package/dist/preview/chunk.PWYMZWAN.js +1 -0
  96. package/dist/preview/{chunk.QIV65FWE.js → chunk.Q5XICUDZ.js} +1 -1
  97. package/dist/preview/chunk.QJUFVEAU.js +1 -0
  98. package/dist/preview/{chunk.N6MVK3KD.js → chunk.QWY54AVN.js} +1 -1
  99. package/dist/preview/{chunk.XEKLEHC3.js → chunk.QXTLZSBL.js} +1 -1
  100. package/dist/preview/{chunk.UHI3D7JC.js → chunk.R2B2ZAWI.js} +1 -1
  101. package/dist/preview/{chunk.UUBYFBPN.js → chunk.R7F6UJVG.js} +1 -1
  102. package/dist/preview/chunk.RDXDEFOC.js +1 -0
  103. package/dist/preview/{chunk.JACGQ2PR.js → chunk.RPDTWQKA.js} +3 -3
  104. package/dist/preview/{chunk.BELCPW66.js → chunk.RQBX7M7Q.js} +2 -2
  105. package/dist/preview/chunk.RRCPEHM4.js +1 -0
  106. package/dist/preview/{chunk.2FLPDPEL.js → chunk.RSYFIL2Z.js} +1 -1
  107. package/dist/preview/{chunk.Z5AB2DBF.js → chunk.RY4E4JRI.js} +1 -1
  108. package/dist/preview/{chunk.RCM7NOPF.js → chunk.S2MP53RO.js} +1 -1
  109. package/dist/preview/chunk.S6BZXNMV.js +1 -0
  110. package/dist/preview/{chunk.HPAGOEZG.js → chunk.SGRKCQ2X.js} +1 -1
  111. package/dist/preview/chunk.SKB4XSDG.js +1 -0
  112. package/dist/preview/chunk.T4M4MLOS.js +1 -0
  113. package/dist/preview/{chunk.I7XSDXQ3.js → chunk.T4Q6OLZU.js} +1 -1
  114. package/dist/preview/{chunk.L4STJLUV.js → chunk.T4QT5SZY.js} +1 -1
  115. package/dist/preview/chunk.TMBFLZNH.js +2 -0
  116. package/dist/preview/chunk.TX65ZO27.js +1 -0
  117. package/dist/preview/chunk.U3ETEQDO.js +1 -0
  118. package/dist/preview/chunk.VCOIFBUE.js +1 -0
  119. package/dist/preview/chunk.VP35BUUZ.js +349 -0
  120. package/dist/preview/{chunk.N2K25KH3.js → chunk.WH2RYGXR.js} +1 -1
  121. package/dist/preview/{chunk.LOCSF3BR.js → chunk.WWR7Y2KE.js} +1 -1
  122. package/dist/preview/chunk.X5WB4GJ4.js +1 -0
  123. package/dist/preview/chunk.XAXZCOZK.js +1 -0
  124. package/dist/preview/chunk.XBV4WO7D.js +1 -0
  125. package/dist/preview/chunk.XFQUVMRI.js +1 -0
  126. package/dist/preview/{chunk.AKQXF7GW.js → chunk.XGRMQUFB.js} +1 -1
  127. package/dist/preview/chunk.XVWJD2DG.js +2 -0
  128. package/dist/preview/{chunk.ZRYSVOLA.js → chunk.YKN2VWWQ.js} +2 -2
  129. package/dist/preview/chunk.YPEZZLOY.js +1 -0
  130. package/dist/preview/chunk.YQDIVHCH.js +1 -0
  131. package/dist/preview/{chunk.TGVUIFKD.js → chunk.Z56L6V6Z.js} +1 -1
  132. package/dist/preview/{chunk.HI7X6PLZ.js → chunk.ZE4U4JBF.js} +2 -2
  133. package/dist/preview/chunk.ZE6LJVVN.js +1 -0
  134. package/dist/preview/{chunk.H5ADMSE7.js → chunk.ZEC64CK6.js} +1 -1
  135. package/dist/preview/chunk.ZHRW2UF4.js +1 -0
  136. package/dist/preview/{chunk.VIYECFKZ.js → chunk.ZRICIE6T.js} +1 -1
  137. package/dist/preview/chunk.ZUJZVK2X.js +1 -0
  138. package/dist/preview/index.html +46 -45
  139. package/dist/preview/page.js +6 -6
  140. package/package.json +6 -6
  141. package/dist/preview/chunk.242EUAPE.js +0 -1
  142. package/dist/preview/chunk.2FGYWAID.js +0 -1
  143. package/dist/preview/chunk.2GQPLTV3.js +0 -1
  144. package/dist/preview/chunk.2NB7U4EW.js +0 -88
  145. package/dist/preview/chunk.3Q75TIGL.js +0 -1
  146. package/dist/preview/chunk.3ZILIZZ6.js +0 -1
  147. package/dist/preview/chunk.4EEWBCT2.js +0 -1
  148. package/dist/preview/chunk.4Q7XJJZY.js +0 -1
  149. package/dist/preview/chunk.53CDFJNM.js +0 -1
  150. package/dist/preview/chunk.57R2GXXN.js +0 -1
  151. package/dist/preview/chunk.5P556A7W.js +0 -1
  152. package/dist/preview/chunk.5QXWMC6C.js +0 -1
  153. package/dist/preview/chunk.6CRRPXKP.js +0 -1
  154. package/dist/preview/chunk.6RID3OWK.js +0 -1
  155. package/dist/preview/chunk.6YPLZNVT.js +0 -19
  156. package/dist/preview/chunk.7LIKEE5Z.js +0 -1
  157. package/dist/preview/chunk.7YIFF6BF.js +0 -1
  158. package/dist/preview/chunk.A4UIM35E.js +0 -1
  159. package/dist/preview/chunk.B5724ULM.js +0 -1
  160. package/dist/preview/chunk.BK6RWVRE.js +0 -1
  161. package/dist/preview/chunk.BQRAIU5R.js +0 -1
  162. package/dist/preview/chunk.DGCMEDQA.js +0 -1
  163. package/dist/preview/chunk.DL26BKT7.js +0 -1
  164. package/dist/preview/chunk.EQ4UAWRB.js +0 -1
  165. package/dist/preview/chunk.F2MQJH6Y.js +0 -1
  166. package/dist/preview/chunk.FFZBOP65.js +0 -1
  167. package/dist/preview/chunk.FOQZADMA.js +0 -25
  168. package/dist/preview/chunk.GT2BITLW.js +0 -1
  169. package/dist/preview/chunk.H5HWN7A2.js +0 -1
  170. package/dist/preview/chunk.H7POIT3V.js +0 -1
  171. package/dist/preview/chunk.HEVC6HHP.js +0 -1
  172. package/dist/preview/chunk.HFYUAK5Z.js +0 -6
  173. package/dist/preview/chunk.HPUN5DKZ.js +0 -117
  174. package/dist/preview/chunk.I4JBWTZM.js +0 -2
  175. package/dist/preview/chunk.J2CR4RRH.js +0 -1
  176. package/dist/preview/chunk.J4IULZFD.js +0 -1
  177. package/dist/preview/chunk.JHEVGLKB.js +0 -345
  178. package/dist/preview/chunk.JLBGJSCZ.js +0 -1
  179. package/dist/preview/chunk.JYJ4LZJJ.js +0 -5
  180. package/dist/preview/chunk.L3A6YLMT.js +0 -21
  181. package/dist/preview/chunk.LOSMUESM.js +0 -1
  182. package/dist/preview/chunk.LOZJQ5ZX.js +0 -1
  183. package/dist/preview/chunk.LPYVOBWB.js +0 -1
  184. package/dist/preview/chunk.M4T377LG.js +0 -1
  185. package/dist/preview/chunk.MSP73H5Z.js +0 -1
  186. package/dist/preview/chunk.MUPO5S2A.js +0 -47
  187. package/dist/preview/chunk.O6F3K6CU.js +0 -1
  188. package/dist/preview/chunk.O75JKQPF.js +0 -1
  189. package/dist/preview/chunk.OVTCW3AI.js +0 -1
  190. package/dist/preview/chunk.OW7NSJ4H.js +0 -1
  191. package/dist/preview/chunk.PMDNFN7Z.js +0 -35
  192. package/dist/preview/chunk.Q4TZHWQX.js +0 -1
  193. package/dist/preview/chunk.QHYXXZRD.js +0 -1
  194. package/dist/preview/chunk.S2U5CEP4.js +0 -1
  195. package/dist/preview/chunk.SADG5RMV.js +0 -1
  196. package/dist/preview/chunk.SCYQSXW4.js +0 -1
  197. package/dist/preview/chunk.SIGC3G7S.js +0 -1
  198. package/dist/preview/chunk.T3BWINOF.js +0 -1
  199. package/dist/preview/chunk.TIH2PDFH.js +0 -1
  200. package/dist/preview/chunk.TNESS3LQ.js +0 -2
  201. package/dist/preview/chunk.UEXIKCLF.js +0 -1
  202. package/dist/preview/chunk.USZPOOLZ.js +0 -1
  203. package/dist/preview/chunk.UTWPZULC.js +0 -1
  204. package/dist/preview/chunk.V4KLBSC4.js +0 -1
  205. package/dist/preview/chunk.V5MYKNL7.js +0 -5
  206. package/dist/preview/chunk.VCX3HEIE.js +0 -1
  207. package/dist/preview/chunk.VDAMCTNL.js +0 -1
  208. package/dist/preview/chunk.W4HBRXMY.js +0 -1
  209. package/dist/preview/chunk.WUKHYLQT.js +0 -9
  210. package/dist/preview/chunk.XFZKP4IF.js +0 -2
  211. package/dist/preview/chunk.XOYJ26YB.js +0 -1
  212. package/dist/preview/chunk.XQTMO5PW.js +0 -1
  213. package/dist/preview/chunk.YYFLTMNN.js +0 -1
  214. package/dist/preview/chunk.Z7BCIYDW.js +0 -1
  215. package/dist/preview/chunk.ZOR6FKNI.js +0 -1
  216. package/dist/preview/chunk.ZTMEESII.js +0 -1
@@ -1,3 +1,3 @@
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 f,R as u,oa as y}from"./chunk.FOQZADMA.js";import{b as m}from"./chunk.AJZBJBMO.js";var d=m(f(),1),n=m(u(),1),c=/^\s*(\d{1,6})[.)]\s+(.*)$/s,S=/^\s*[-*•]\s+(.*)$/s;function h(o){let s=[];for(let p of o.replace(/\r\n?/g,`
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 f,R as u,oa as y}from"./chunk.7L6LYXCV.js";import{b as m}from"./chunk.AJZBJBMO.js";var d=m(f(),1),n=m(u(),1),c=/^\s*(\d{1,6})[.)]\s+(.*)$/s,S=/^\s*[-*•]\s+(.*)$/s;function h(o){let s=[];for(let p of o.replace(/\r\n?/g,`
2
2
  `).split(/\n[ \t]*\n+/)){let t=null,a=()=>{t&&(t.t==="p"?t.lines.length>0:t.items.length>0)&&s.push(t),t=null};for(let e of p.split(`
3
- `)){let i=c.exec(e),l=i?null:S.exec(e);if(i)t?.t!=="ol"&&(a(),t={t:"ol",start:Number(i[1]),items:[]}),t.items.push(i[2]);else if(l)t?.t!=="ul"&&(a(),t={t:"ul",items:[]}),t.items.push(l[1]);else if(t&&t.t!=="p"&&/^\s+\S/.test(e)){let r=t.items;r[r.length-1]=`${r[r.length-1]} ${e.trim()}`}else e.trim().length>0&&(t?.t!=="p"&&(a(),t={t:"p",lines:[]}),t.lines.push(e.trim()))}a()}return s}function T(o){return/[\r\n]/.test(o)}var k={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},x={margin:0},g={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"},B=(0,d.lazy)(y(()=>(__graviewPreload(import.meta.url,["./chunk.JHEVGLKB.js","./chunk.FOQZADMA.js","./chunk.SDO3U72B.js","./chunk.V5MYKNL7.js","./chunk.AJZBJBMO.js"]),import("./chunk.LOCSF3BR.js"))));function b({text:o,className:s,style:p,markdown:t,headingsFrom:a}){return t?(0,n.jsx)(d.Suspense,{fallback:(0,n.jsx)(b,{text:o,...s?{className:s}:{},...p?{style:p}:{}}),children:(0,n.jsx)(B,{text:o,...s?{className:s}:{},...p?{style:p}:{},...a?{headingsFrom:a}:{}})}):(0,n.jsx)("div",{"data-graview-text-body":"",...s?{className:s}:{},style:{...k,...p},children:h(o).map((e,i)=>e.t==="p"?(0,n.jsx)("p",{style:x,children:e.lines.map((l,r)=>(0,n.jsxs)("span",{children:[r>0?(0,n.jsx)("br",{}):null,l]},r))},i):e.t==="ol"?(0,n.jsx)("ol",{start:e.start,style:g,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i):(0,n.jsx)("ul",{style:g,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i))})}export{T as a,b};
3
+ `)){let i=c.exec(e),l=i?null:S.exec(e);if(i)t?.t!=="ol"&&(a(),t={t:"ol",start:Number(i[1]),items:[]}),t.items.push(i[2]);else if(l)t?.t!=="ul"&&(a(),t={t:"ul",items:[]}),t.items.push(l[1]);else if(t&&t.t!=="p"&&/^\s+\S/.test(e)){let r=t.items;r[r.length-1]=`${r[r.length-1]} ${e.trim()}`}else e.trim().length>0&&(t?.t!=="p"&&(a(),t={t:"p",lines:[]}),t.lines.push(e.trim()))}a()}return s}function T(o){return/[\r\n]/.test(o)}var k={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},x={margin:0},g={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"},B=(0,d.lazy)(y(()=>(__graviewPreload(import.meta.url,["./chunk.VP35BUUZ.js","./chunk.7L6LYXCV.js","./chunk.SDO3U72B.js","./chunk.7MQ7UWVW.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.WWR7Y2KE.js"))));function b({text:o,className:s,style:p,markdown:t,headingsFrom:a}){return t?(0,n.jsx)(d.Suspense,{fallback:(0,n.jsx)(b,{text:o,...s?{className:s}:{},...p?{style:p}:{}}),children:(0,n.jsx)(B,{text:o,...s?{className:s}:{},...p?{style:p}:{},...a?{headingsFrom:a}:{}})}):(0,n.jsx)("div",{"data-graview-text-body":"",...s?{className:s}:{},style:{...k,...p},children:h(o).map((e,i)=>e.t==="p"?(0,n.jsx)("p",{style:x,children:e.lines.map((l,r)=>(0,n.jsxs)("span",{children:[r>0?(0,n.jsx)("br",{}):null,l]},r))},i):e.t==="ol"?(0,n.jsx)("ol",{start:e.start,style:g,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i):(0,n.jsx)("ul",{style:g,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i))})}export{T as a,b};
@@ -0,0 +1 @@
1
+ import{d as M}from"./chunk.BBLIT7S7.js";import"./chunk.AJZBJBMO.js";var W=c=>`The view "${c}" listens for a wheel, a drag or a pinch, and its manifest does not say "gestures": true: the host forwards none.`,L=100;function D(c,u){let E=c.ownerDocument.defaultView,O=u.frame??(t=>E?.requestAnimationFrame?E.requestAnimationFrame(()=>t()):setTimeout(t,16)),w=[],b=t=>{let e=u.root();for(let n=t.composedPath()[0];n&&n!==e&&n!==c;n=n.parentNode)if(n.nodeType===1&&u.idOf(n)!==void 0)return n},y=(t,e)=>{let n=u.root(),r=w.filter(s=>s.event===e).map(s=>s.selector);if(!(r.length===0||!n))for(let s=t;s&&s!==n;s=s.parentElement)for(let i of r)try{if(s.matches(i))return s}catch{}},h=t=>{let e=u.idOf(t.target)??u.idOf(t.bound);if(e===void 0||!t.bound.isConnected)return;let n=t.bound.getBoundingClientRect(),r={x:t.clientX-n.left,y:t.clientY-n.top,width:n.width,height:n.height};t.event==="wheel"?u.send({type:"dom-event",target:e,event:"wheel",...r,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode,ctrlKey:t.ctrlKey,metaKey:t.metaKey}):t.event==="drag"?u.send({type:"dom-event",target:e,event:"drag",...r,phase:t.phase,pointerId:t.pointerId,button:t.button,pressure:t.pressure,dx:t.dx,dy:t.dy}):u.send({type:"dom-event",target:e,event:"pinch",...r,phase:t.phase,scale:t.scale,rotation:t.rotation})},a=new Map,X=!1,g=t=>{for(let[e,n]of[...a])t!==void 0&&e!==t||(a.delete(e),h(n))},v=()=>{X||(X=!0,O(()=>{X=!1,g()}))},f=(t,e,n,r,s)=>({event:t,bound:e,target:n,clientX:r,clientY:s,deltaX:0,deltaY:0,deltaMode:0,ctrlKey:!1,metaKey:!1,pointerId:0,button:0,pressure:0,dx:0,dy:0,scale:1,rotation:0}),I=t=>{let e=t,n=b(e);if(!n)return;let r=e.ctrlKey?y(n,"pinch"):void 0,s=r??y(n,"wheel");if(!s)return;if(e.preventDefault(),r){let m=e.deltaY*(e.deltaMode===1?16:e.deltaMode===2?800:1),o=a.get("pinch");return o&&o.bound!==s&&g("pinch"),o=a.get("pinch")??f("pinch",s,n,e.clientX,e.clientY),o.phase="change",o.scale*=Math.exp(-m/L),Object.assign(o,{target:n,clientX:e.clientX,clientY:e.clientY}),a.set("pinch",o),v()}let i=a.get("wheel");i&&(i.bound!==s||i.deltaMode!==e.deltaMode||i.ctrlKey!==e.ctrlKey||i.metaKey!==e.metaKey)&&g("wheel"),i=a.get("wheel")??{...f("wheel",s,n,e.clientX,e.clientY),deltaMode:e.deltaMode,ctrlKey:e.ctrlKey,metaKey:e.metaKey},i.deltaX+=e.deltaX,i.deltaY+=e.deltaY,Object.assign(i,{target:n,clientX:e.clientX,clientY:e.clientY}),a.set("wheel",i),v()},G=new Map,K=t=>{let e=t,n=`drag:${e.pointerId}`;if(e.type==="pointerdown"){let l=b(e),p=l&&y(l,"drag");if(!l||!p)return;try{p.setPointerCapture?.(e.pointerId)}catch{}G.set(e.pointerId,{bound:p,button:e.button,lastX:e.clientX,lastY:e.clientY}),g(n),h({...f("drag",p,l,e.clientX,e.clientY),phase:"start",pointerId:e.pointerId,button:e.button,pressure:e.pressure??0});return}let r=G.get(e.pointerId);if(!r)return;let s=e.clientX-r.lastX,i=e.clientY-r.lastY;r.lastX=e.clientX,r.lastY=e.clientY;let m=b(e)??r.bound;if(e.type==="pointermove"){let l=a.get(n)??{...f("drag",r.bound,m,e.clientX,e.clientY),phase:"move",pointerId:e.pointerId,button:r.button};return l.dx+=s,l.dy+=i,Object.assign(l,{target:m,clientX:e.clientX,clientY:e.clientY,pressure:e.pressure??0}),a.set(n,l),v()}G.delete(e.pointerId);let o=a.get(n);o&&(o.dx+=s,o.dy+=i,Object.assign(o,{clientX:e.clientX,clientY:e.clientY}),g(n)),h({...f("drag",r.bound,m,e.clientX,e.clientY),phase:"end",pointerId:e.pointerId,button:r.button,pressure:0,...o?{}:{dx:s,dy:i}})},d,x=t=>{let e=t,n=e.clientX??0,r=e.clientY??0;if(e.type==="gesturestart"){let p=b(e),Y=p&&y(p,"pinch");if(!p||!Y)return;e.preventDefault(),d={bound:Y,scale:1,rotation:0},g("pinch"),h({...f("pinch",Y,p,n,r),phase:"start"});return}if(!d)return;e.preventDefault();let s=b(e)??d.bound,i=Number.isFinite(e.scale)&&e.scale>0?e.scale:d.scale,m=Number.isFinite(e.rotation)?e.rotation:d.rotation,o=a.get("pinch")??{...f("pinch",d.bound,s,n,r),phase:"change"};if(o.scale*=i/d.scale,o.rotation+=m-d.rotation,d.scale=i,d.rotation=m,Object.assign(o,{target:s,...e.clientX!==void 0?{clientX:n,clientY:r}:{}}),a.set("pinch",o),e.type==="gesturechange")return v();let l=d;d=void 0,g("pinch"),h({...f("pinch",l.bound,s,o.clientX,o.clientY),phase:"end"})},B={passive:!1};c.addEventListener("wheel",I,B);for(let t of["pointerdown","pointermove","pointerup","pointercancel"])c.addEventListener(t,K);for(let t of["gesturestart","gesturechange","gestureend"])c.addEventListener(t,x);return{bind(t){w=t.filter(e=>M.includes(e?.event)&&typeof e.selector=="string"&&e.selector.length<=200).map(({event:e,selector:n})=>({event:e,selector:n}))},dispose(){c.removeEventListener("wheel",I);for(let t of["pointerdown","pointermove","pointerup","pointercancel"])c.removeEventListener(t,K);for(let t of["gesturestart","gesturechange","gestureend"])c.removeEventListener(t,x);a.clear(),G.clear()}}}export{D as createGuestGestures,W as unheardWords};
@@ -1 +1 @@
1
- import{B as $,Bb as O,D as h,Eb as M,G as E,K as N,L as S,M as W,O as R,P as I,T as p,da as D,ia as T,ta as j,vb as v}from"./chunk.V5MYKNL7.js";function z(e,n,t){let o=[...n?.creates??[],...n?.subject&&n.subject.kinds!=="*"?n.subject.kinds:[]];for(let r of o){let i=e.tryDefinition(r),u=i?.fields?.shape??{};if(!i||!(t in u))continue;let a=i.display?.format?.[t];return{label:i.display?.labels?.[t]??T(i,t),option:d=>a?a(d):D(d)}}return{label:T(void 0,t),option:r=>D(r)}}function K(e,n,t){if(t instanceof v){let o=n.find(i=>i.name===t.mutation);return`Not yet: ${t.issues.map(i=>{let u=i.path.length>0?z(e,o,String(i.path[0])).label:void 0;return u?`${u} \u2014 ${i.message.replace(/^./,a=>a.toLowerCase())}`:i.message}).join("; ")}.`}return t instanceof Error?t.message:String(t)}var x=864e5,X=/^(\d{4})-(\d{2})-(\d{2})/,g=e=>String(e).padStart(2,"0"),_=e=>new Date(e).toISOString().slice(0,10),m=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),b=(e,n)=>_(m(e)+n*x),C=e=>new Date(m(e)).getUTCDay();function l(e,n,t){if(!(n>=1&&n<=12&&t>=1&&t<=31))return;let o=`${String(e).padStart(4,"0")}-${g(n)}-${g(t)}`;return _(m(o))===o?o:void 0}function L(e=new Date){let n=S();return n?R(e.getTime(),n):{day:`${e.getFullYear()}-${g(e.getMonth()+1)}-${g(e.getDate())}`,minutes:e.getHours()*60+e.getMinutes()}}var w=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e);function y(e){if(typeof e!="string")return;if(w(e)){let o=new Date(e);return Number.isNaN(o.getTime())?void 0:L(o)}let n=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!n||!l(Number(n[1]),Number(n[2]),Number(n[3])))return;let t=e.slice(0,10);return n[4]===void 0?{day:t}:{day:t,minutes:Number(n[4])*60+Number(n[5])}}function F(e,n){if(!n.time)return e.day;let t=e.minutes??9*60;if(!n.instant)return`${e.day}T${g(Math.floor(t/60))}:${g(t%60)}`;let o=S(),[,r,i,u]=X.exec(e.day);return(o?new Date(I(e.day,t,o)):new Date(Number(r),Number(i)-1,Number(u),Math.floor(t/60),t%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function V(e,n=new Date){let t=W(),o=t;try{o=new Intl.DateTimeFormat(e??h,{timeZoneName:"short",timeZone:t}).formatToParts(n).find(r=>r.type==="timeZoneName")?.value??t}catch{o=t}return{zone:t,short:o}}function q(e,n,t,o){let r=y(n);if(!r)return t;let i=e===void 0?void 0:y(e),u=t===void 0?void 0:y(t),a=d=>m(d.day)+(d.minutes??0)*6e4,c=(d,s)=>{let f=a(d)+s;return{day:_(f),...o.time?{minutes:Math.round(f%x/6e4)}:{}}};return i&&u?F(c(u,a(r)-a(i)),o):u&&a(u)>=a(r)?t:o.time?F(c(r,36e5),o):t}var J=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,Q=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function ee(e,n={}){let t=(n.start&&e.includes(n.start)?n.start:void 0)??e.find(r=>J.test(r)),o=(n.end&&e.includes(n.end)?n.end:void 0)??e.find(r=>r!==t&&Q.test(r));return t&&o?{start:t,end:o}:void 0}var ne=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],te=["sun","mon","tue","wed","thu","fri","sat"],B="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",U="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",re=e=>ne.indexOf(e.slice(0,3))+1,Y=e=>e===void 0?void 0:e.length===2?2e3+Number(e):Number(e);function oe(e){try{let n=new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}).formatToParts(0).map(t=>t.type);return n.indexOf("month")<n.indexOf("day")}catch{return!0}}function ie(e){let n=(r,i)=>({minutes:i,rest:`${e.slice(0,r.index)} ${e.slice(r.index+r[0].length)}`}),t=/\b(noon|midday)\b/.exec(e);if(t)return n(t,12*60);if(t=/\bmidnight\b/.exec(e),t)return n(t,0);if(t=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(e),t){let r=Number(t[1]),i=Number(t[2]??0);return r<1||r>12||i>59?{rest:e,bad:!0}:n(t,(r%12+(t[3]==="p"?12:0))*60+i)}if(t=/\b(\d{1,2}):(\d{2})\b/.exec(e),t){let r=Number(t[1]),i=Number(t[2]);return r>23||i>59?{rest:e,bad:!0}:n(t,r*60+i)}if(t=/\bat\s+(\d{1,2})\b/.exec(e),t){let r=Number(t[1]);return r>23?{rest:e,bad:!0}:n(t,(r>=1&&r<=7?r+12:r)*60)}let o=/\b(morning|afternoon|evening|tonight)\b/.exec(e);return o?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[o[1]]*60,rest:o[1]==="tonight"?`${e.slice(0,o.index)} today ${e.slice(o.index+o[0].length)}`:`${e.slice(0,o.index)} ${e.slice(o.index+o[0].length)}`}:{rest:e}}function ue(e,n,t){let o=e.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(o==="")return null;if(o==="today"||o==="now")return n;if(o==="tomorrow"||o==="tmrw"||o==="tmr")return b(n,1);if(o==="yesterday")return b(n,-1);if(o==="next week")return b(n,7);let r=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(o);if(r)return b(n,Number(r[1])*(r[2].startsWith("week")?7:1));if(r=new RegExp(`^(next )?${U}$`).exec(o),r){let d=(te.indexOf(r[2].slice(0,3))-C(n)+7)%7;return b(n,r[1]&&d===0?7:d)}if(r=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(o),r)return l(Number(r[1]),Number(r[2]),Number(r[3]));let i=o.replace(new RegExp(`^${U} `),"");r=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${B}(?: (\\d{4}))?$`).exec(i);let u=r?{date:r[1],month:r[2],year:r[3]}:void 0;r=new RegExp(`^${B} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(i);let a=u??(r?{date:r[2],month:r[1],year:r[3]}:void 0);if(a)return Z(n,Y(a.year),re(a.month),Number(a.date));if(r=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(i),r){let[c,d]=[Number(r[1]),Number(r[2])],[s,f]=oe(t)?[c,d]:[d,c];return Z(n,Y(r[3]),s,f)}}function Z(e,n,t,o){if(n!==void 0)return l(n,t,o);let r=Number(e.slice(0,4)),i=l(r,t,o);return i===void 0?l(r+1,t,o):m(e)-m(i)>183*x?l(r+1,t,o):i}function de(e,n){let t=e.trim();if(w(t)){let a=y(t);if(a)return n.time?a:{day:a.day}}let o=e.toLowerCase().replace(/,/g," ").replace(/(\d{4}-\d{2}-\d{2})t(\d\d:\d\d)(:\d\d(\.\d+)?)?/,"$1 $2").replace(/\s+/g," ").trim();if(o==="")return;let r=ie(o);if(r.bad)return;let i=ue(r.rest,n.today,n.locale??h);if(i===void 0||i===null&&r.minutes===void 0)return;let u=i??n.base?.day??n.today;return n.time?{day:u,minutes:r.minutes??n.base?.minutes??9*60}:{day:u}}var ae=e=>/^[A-Z]{3}$/.test(e??"");function P(e){let{format:n,unit:t,currency:o,locale:r}=e,i=ae(t),u=n==="money"||!n&&i,a=u?i?t:o:void 0;return{...u?{format:"money"}:n?{format:n}:{},...t&&!(u&&i)?{unit:t}:{},...a?{currency:a}:{},...r?{locale:r}:{}}}function Te(e){switch(e.format){case"money":return e.currency?`An amount of money in ${e.currency}: a plain number, 1250.5 for 1,250.50 ${e.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return e.unit?`A number of ${e.unit}.`:"A number."}}function H(e){let n=$(e)?.innerType;return n===void 0?e:H(n)}var se={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ce=e=>(e?._zod?.def?.checks??[]).map(n=>n._zod?.def).filter(n=>n!==void 0);function k(e){let n=H(e),t=$(n),o=t?.type,r=ce(n);if(o==="enum")return{type:"choice",options:Object.keys(t?.entries??{})};let i=j(n);if(i)return i==="image"?{type:"file",image:!0}:i==="video"?{type:"file",video:!0}:{type:"file"};if(o==="boolean")return{type:"boolean"};if(o==="array"){let u=k(t?.element);return u.type==="unknown"?{type:"unknown"}:{type:"several",of:u}}if(o==="number"){let u,a,c;for(let d of r){d.check==="multiple_of"&&typeof d.value=="number"?c=d.value:d.check==="number_format"&&(d.format==="safeint"||d.format==="int32"||d.format==="uint32")&&(c??=1);let s=d.check==="number_format"&&d.format?se[d.format]:void 0,f=s?s[0]:d.check==="greater_than"&&d.inclusive&&typeof d.value=="number"?d.value:void 0,A=s?s[1]:d.check==="less_than"&&d.inclusive&&typeof d.value=="number"?d.value:void 0;f!==void 0&&(u=u===void 0?f:Math.max(u,f)),A!==void 0&&(a=a===void 0?A:Math.min(a,A))}return{type:"number",...u===void 0?{}:{min:u},...a===void 0?{}:{max:a},...c===void 0?{}:{step:c},...M(n)==="duration"?{duration:!0}:{},...O(e)?{amount:P(O(e))}:{}}}if(o==="string"){if(r.some(s=>s.fn===E||s.format==="datetime")||t?.format==="datetime")return{type:"date",time:!0,instant:!0};let a=[t?.pattern,...r.map(s=>s.pattern)].filter(s=>s instanceof RegExp).map(s=>s.source);if(a.some(s=>s.includes("\\d{4}")))return a.some(s=>s.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:{type:"date"};let c=r.some(s=>s.check==="max_length"&&typeof s.maximum=="number"&&s.maximum>500),d=M(n);return c?{type:"text",long:!0}:d==="phone"||d==="place"?{type:"text",holds:d}:{type:"text"}}return{type:"unknown"}}function fe(e,n){let t=e?.shape;return!t||!(n in t)?{type:"unknown"}:k(t[n])}function me(e){if(e===void 0||e==="web"||e.startsWith("ai:")||e.startsWith("app:"))return;if(e==="api")return"via the API";if(e==="cli")return"via the command line";let[n,...t]=e.split(":"),o=t.join(":");return(n==="mcp"||n==="view")&&o?`via ${o}`:n==="mcp"?"via an agent's tools":`via ${e}`}var G=e=>{if(!e.currency)return{before:!0};try{let n=N(e.locale),t=new Intl.NumberFormat(n,{style:"currency",currency:e.currency}).formatToParts(1),o=t.findIndex(u=>u.type==="currency"),r=t.findIndex(u=>u.type==="integer"),i;try{i=new Intl.DisplayNames([n],{type:"currency"}).of(e.currency)}catch{}return{...o>=0?{symbol:t[o].value}:{},before:o<r,...i?{name:i}:{}}}catch{return{symbol:e.currency,before:!0}}};function le(e){let n=e.locale;if(e.format==="money"){let{symbol:t,before:o,name:r}=G(e),i=p(1250,n,{minimumFractionDigits:2,maximumFractionDigits:2});return{...t?o?{prefix:t}:{suffix:t}:{},placeholder:i,hint:r?`in ${r}`:e.currency?`in ${e.currency}`:"an amount of money"}}return e.format==="percent"?{suffix:"%",placeholder:p(15,n),hint:"as a percent"}:{...e.unit?{suffix:e.unit}:{},placeholder:"",hint:e.unit?`in ${e.unit}`:"a number"}}function pe(e,n){return e===void 0||!Number.isFinite(e)?"":n.format==="money"?p(e,n.locale,Number.isInteger(e)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):n.format==="percent"?p(e*100,n.locale,{maximumFractionDigits:4}):p(e,n.locale,{maximumFractionDigits:6})}function ye(e){try{let n=new Intl.NumberFormat(N(e)).formatToParts(12345.6);return{group:n.find(t=>t.type==="group")?.value??",",decimal:n.find(t=>t.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function ge(e,n){let{group:t,decimal:o}=ye(n),r=e.replace(/[\s  ']/g,"").replace(/[−–]/g,"-");if(o!=="."&&!r.includes(o)&&/^-?\d+\.\d{1,2}$/.test(r))return Number(r);if(t&&(r=r.split(t).join("")),o!=="."&&(r=r.replace(o,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(r))return;let i=Number(r);return Number.isFinite(i)?i:void 0}function be(e,n){let t=e.trim();if(t==="")return;let o=n?.format==="money"&&n.currency?G(n).symbol:void 0,r=t;o&&(r=r.split(o).join("")),n?.currency&&(r=r.replace(new RegExp(n.currency,"gi"),"")),r=r.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(r)&&(r=r.replace(/%\s*$/,"")),n?.unit&&n.format!=="money"&&(r=r.replace(new RegExp(`\\s*${n.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let u=ge(r,n?.locale);if(u!==void 0)return n?.format==="percent"?u/100:u}export{P as a,Te as b,H as c,k as d,fe as e,z as f,K as g,me as h,le as i,pe as j,be as k,L as l,w as m,y as n,F as o,V as p,q,ee as r,de as s};
1
+ import{C as $,Cb as O,E as h,Fb as M,H as E,L as N,M as S,N as W,P as R,Q as I,U as p,ea as D,ja as T,ua as j,wb as v}from"./chunk.7MQ7UWVW.js";function z(e,n,t){let o=[...n?.creates??[],...n?.subject&&n.subject.kinds!=="*"?n.subject.kinds:[]];for(let r of o){let i=e.tryDefinition(r),u=i?.fields?.shape??{};if(!i||!(t in u))continue;let a=i.display?.format?.[t];return{label:i.display?.labels?.[t]??T(i,t),option:d=>a?a(d):D(d)}}return{label:T(void 0,t),option:r=>D(r)}}function K(e,n,t){if(t instanceof v){let o=n.find(i=>i.name===t.mutation);return`Not yet: ${t.issues.map(i=>{let u=i.path.length>0?z(e,o,String(i.path[0])).label:void 0;return u?`${u} \u2014 ${i.message.replace(/^./,a=>a.toLowerCase())}`:i.message}).join("; ")}.`}return t instanceof Error?t.message:String(t)}var x=864e5,X=/^(\d{4})-(\d{2})-(\d{2})/,g=e=>String(e).padStart(2,"0"),_=e=>new Date(e).toISOString().slice(0,10),m=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),b=(e,n)=>_(m(e)+n*x),C=e=>new Date(m(e)).getUTCDay();function l(e,n,t){if(!(n>=1&&n<=12&&t>=1&&t<=31))return;let o=`${String(e).padStart(4,"0")}-${g(n)}-${g(t)}`;return _(m(o))===o?o:void 0}function L(e=new Date){let n=S();return n?R(e.getTime(),n):{day:`${e.getFullYear()}-${g(e.getMonth()+1)}-${g(e.getDate())}`,minutes:e.getHours()*60+e.getMinutes()}}var w=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e);function y(e){if(typeof e!="string")return;if(w(e)){let o=new Date(e);return Number.isNaN(o.getTime())?void 0:L(o)}let n=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!n||!l(Number(n[1]),Number(n[2]),Number(n[3])))return;let t=e.slice(0,10);return n[4]===void 0?{day:t}:{day:t,minutes:Number(n[4])*60+Number(n[5])}}function F(e,n){if(!n.time)return e.day;let t=e.minutes??9*60;if(!n.instant)return`${e.day}T${g(Math.floor(t/60))}:${g(t%60)}`;let o=S(),[,r,i,u]=X.exec(e.day);return(o?new Date(I(e.day,t,o)):new Date(Number(r),Number(i)-1,Number(u),Math.floor(t/60),t%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function V(e,n=new Date){let t=W(),o=t;try{o=new Intl.DateTimeFormat(e??h,{timeZoneName:"short",timeZone:t}).formatToParts(n).find(r=>r.type==="timeZoneName")?.value??t}catch{o=t}return{zone:t,short:o}}function q(e,n,t,o){let r=y(n);if(!r)return t;let i=e===void 0?void 0:y(e),u=t===void 0?void 0:y(t),a=d=>m(d.day)+(d.minutes??0)*6e4,c=(d,s)=>{let f=a(d)+s;return{day:_(f),...o.time?{minutes:Math.round(f%x/6e4)}:{}}};return i&&u?F(c(u,a(r)-a(i)),o):u&&a(u)>=a(r)?t:o.time?F(c(r,36e5),o):t}var J=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,Q=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function ee(e,n={}){let t=(n.start&&e.includes(n.start)?n.start:void 0)??e.find(r=>J.test(r)),o=(n.end&&e.includes(n.end)?n.end:void 0)??e.find(r=>r!==t&&Q.test(r));return t&&o?{start:t,end:o}:void 0}var ne=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],te=["sun","mon","tue","wed","thu","fri","sat"],B="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",U="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",re=e=>ne.indexOf(e.slice(0,3))+1,Y=e=>e===void 0?void 0:e.length===2?2e3+Number(e):Number(e);function oe(e){try{let n=new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}).formatToParts(0).map(t=>t.type);return n.indexOf("month")<n.indexOf("day")}catch{return!0}}function ie(e){let n=(r,i)=>({minutes:i,rest:`${e.slice(0,r.index)} ${e.slice(r.index+r[0].length)}`}),t=/\b(noon|midday)\b/.exec(e);if(t)return n(t,12*60);if(t=/\bmidnight\b/.exec(e),t)return n(t,0);if(t=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(e),t){let r=Number(t[1]),i=Number(t[2]??0);return r<1||r>12||i>59?{rest:e,bad:!0}:n(t,(r%12+(t[3]==="p"?12:0))*60+i)}if(t=/\b(\d{1,2}):(\d{2})\b/.exec(e),t){let r=Number(t[1]),i=Number(t[2]);return r>23||i>59?{rest:e,bad:!0}:n(t,r*60+i)}if(t=/\bat\s+(\d{1,2})\b/.exec(e),t){let r=Number(t[1]);return r>23?{rest:e,bad:!0}:n(t,(r>=1&&r<=7?r+12:r)*60)}let o=/\b(morning|afternoon|evening|tonight)\b/.exec(e);return o?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[o[1]]*60,rest:o[1]==="tonight"?`${e.slice(0,o.index)} today ${e.slice(o.index+o[0].length)}`:`${e.slice(0,o.index)} ${e.slice(o.index+o[0].length)}`}:{rest:e}}function ue(e,n,t){let o=e.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(o==="")return null;if(o==="today"||o==="now")return n;if(o==="tomorrow"||o==="tmrw"||o==="tmr")return b(n,1);if(o==="yesterday")return b(n,-1);if(o==="next week")return b(n,7);let r=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(o);if(r)return b(n,Number(r[1])*(r[2].startsWith("week")?7:1));if(r=new RegExp(`^(next )?${U}$`).exec(o),r){let d=(te.indexOf(r[2].slice(0,3))-C(n)+7)%7;return b(n,r[1]&&d===0?7:d)}if(r=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(o),r)return l(Number(r[1]),Number(r[2]),Number(r[3]));let i=o.replace(new RegExp(`^${U} `),"");r=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${B}(?: (\\d{4}))?$`).exec(i);let u=r?{date:r[1],month:r[2],year:r[3]}:void 0;r=new RegExp(`^${B} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(i);let a=u??(r?{date:r[2],month:r[1],year:r[3]}:void 0);if(a)return Z(n,Y(a.year),re(a.month),Number(a.date));if(r=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(i),r){let[c,d]=[Number(r[1]),Number(r[2])],[s,f]=oe(t)?[c,d]:[d,c];return Z(n,Y(r[3]),s,f)}}function Z(e,n,t,o){if(n!==void 0)return l(n,t,o);let r=Number(e.slice(0,4)),i=l(r,t,o);return i===void 0?l(r+1,t,o):m(e)-m(i)>183*x?l(r+1,t,o):i}function de(e,n){let t=e.trim();if(w(t)){let a=y(t);if(a)return n.time?a:{day:a.day}}let o=e.toLowerCase().replace(/,/g," ").replace(/(\d{4}-\d{2}-\d{2})t(\d\d:\d\d)(:\d\d(\.\d+)?)?/,"$1 $2").replace(/\s+/g," ").trim();if(o==="")return;let r=ie(o);if(r.bad)return;let i=ue(r.rest,n.today,n.locale??h);if(i===void 0||i===null&&r.minutes===void 0)return;let u=i??n.base?.day??n.today;return n.time?{day:u,minutes:r.minutes??n.base?.minutes??9*60}:{day:u}}var ae=e=>/^[A-Z]{3}$/.test(e??"");function P(e){let{format:n,unit:t,currency:o,locale:r}=e,i=ae(t),u=n==="money"||!n&&i,a=u?i?t:o:void 0;return{...u?{format:"money"}:n?{format:n}:{},...t&&!(u&&i)?{unit:t}:{},...a?{currency:a}:{},...r?{locale:r}:{}}}function Te(e){switch(e.format){case"money":return e.currency?`An amount of money in ${e.currency}: a plain number, 1250.5 for 1,250.50 ${e.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return e.unit?`A number of ${e.unit}.`:"A number."}}function H(e){let n=$(e)?.innerType;return n===void 0?e:H(n)}var se={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ce=e=>(e?._zod?.def?.checks??[]).map(n=>n._zod?.def).filter(n=>n!==void 0);function k(e){let n=H(e),t=$(n),o=t?.type,r=ce(n);if(o==="enum")return{type:"choice",options:Object.keys(t?.entries??{})};let i=j(n);if(i)return i==="image"?{type:"file",image:!0}:i==="video"?{type:"file",video:!0}:{type:"file"};if(o==="boolean")return{type:"boolean"};if(o==="array"){let u=k(t?.element);return u.type==="unknown"?{type:"unknown"}:{type:"several",of:u}}if(o==="number"){let u,a,c;for(let d of r){d.check==="multiple_of"&&typeof d.value=="number"?c=d.value:d.check==="number_format"&&(d.format==="safeint"||d.format==="int32"||d.format==="uint32")&&(c??=1);let s=d.check==="number_format"&&d.format?se[d.format]:void 0,f=s?s[0]:d.check==="greater_than"&&d.inclusive&&typeof d.value=="number"?d.value:void 0,A=s?s[1]:d.check==="less_than"&&d.inclusive&&typeof d.value=="number"?d.value:void 0;f!==void 0&&(u=u===void 0?f:Math.max(u,f)),A!==void 0&&(a=a===void 0?A:Math.min(a,A))}return{type:"number",...u===void 0?{}:{min:u},...a===void 0?{}:{max:a},...c===void 0?{}:{step:c},...M(n)==="duration"?{duration:!0}:{},...O(e)?{amount:P(O(e))}:{}}}if(o==="string"){if(r.some(s=>s.fn===E||s.format==="datetime")||t?.format==="datetime")return{type:"date",time:!0,instant:!0};let a=[t?.pattern,...r.map(s=>s.pattern)].filter(s=>s instanceof RegExp).map(s=>s.source);if(a.some(s=>s.includes("\\d{4}")))return a.some(s=>s.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:{type:"date"};let c=r.some(s=>s.check==="max_length"&&typeof s.maximum=="number"&&s.maximum>500),d=M(n);return c?{type:"text",long:!0}:d==="phone"||d==="place"?{type:"text",holds:d}:{type:"text"}}return{type:"unknown"}}function fe(e,n){let t=e?.shape;return!t||!(n in t)?{type:"unknown"}:k(t[n])}function me(e){if(e===void 0||e==="web"||e.startsWith("ai:")||e.startsWith("app:"))return;if(e==="api")return"via the API";if(e==="cli")return"via the command line";let[n,...t]=e.split(":"),o=t.join(":");return(n==="mcp"||n==="view")&&o?`via ${o}`:n==="mcp"?"via an agent's tools":`via ${e}`}var G=e=>{if(!e.currency)return{before:!0};try{let n=N(e.locale),t=new Intl.NumberFormat(n,{style:"currency",currency:e.currency}).formatToParts(1),o=t.findIndex(u=>u.type==="currency"),r=t.findIndex(u=>u.type==="integer"),i;try{i=new Intl.DisplayNames([n],{type:"currency"}).of(e.currency)}catch{}return{...o>=0?{symbol:t[o].value}:{},before:o<r,...i?{name:i}:{}}}catch{return{symbol:e.currency,before:!0}}};function le(e){let n=e.locale;if(e.format==="money"){let{symbol:t,before:o,name:r}=G(e),i=p(1250,n,{minimumFractionDigits:2,maximumFractionDigits:2});return{...t?o?{prefix:t}:{suffix:t}:{},placeholder:i,hint:r?`in ${r}`:e.currency?`in ${e.currency}`:"an amount of money"}}return e.format==="percent"?{suffix:"%",placeholder:p(15,n),hint:"as a percent"}:{...e.unit?{suffix:e.unit}:{},placeholder:"",hint:e.unit?`in ${e.unit}`:"a number"}}function pe(e,n){return e===void 0||!Number.isFinite(e)?"":n.format==="money"?p(e,n.locale,Number.isInteger(e)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):n.format==="percent"?p(e*100,n.locale,{maximumFractionDigits:4}):p(e,n.locale,{maximumFractionDigits:6})}function ye(e){try{let n=new Intl.NumberFormat(N(e)).formatToParts(12345.6);return{group:n.find(t=>t.type==="group")?.value??",",decimal:n.find(t=>t.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function ge(e,n){let{group:t,decimal:o}=ye(n),r=e.replace(/[\s  ']/g,"").replace(/[−–]/g,"-");if(o!=="."&&!r.includes(o)&&/^-?\d+\.\d{1,2}$/.test(r))return Number(r);if(t&&(r=r.split(t).join("")),o!=="."&&(r=r.replace(o,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(r))return;let i=Number(r);return Number.isFinite(i)?i:void 0}function be(e,n){let t=e.trim();if(t==="")return;let o=n?.format==="money"&&n.currency?G(n).symbol:void 0,r=t;o&&(r=r.split(o).join("")),n?.currency&&(r=r.replace(new RegExp(n.currency,"gi"),"")),r=r.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(r)&&(r=r.replace(/%\s*$/,"")),n?.unit&&n.format!=="money"&&(r=r.replace(new RegExp(`\\s*${n.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let u=ge(r,n?.locale);if(u!==void 0)return n?.format==="percent"?u/100:u}export{P as a,Te as b,H as c,k as d,fe as e,z as f,K as g,me as h,le as i,pe as j,be as k,L as l,w as m,y as n,F as o,V as p,q,ee as r,de as s};
@@ -1 +1 @@
1
- import{Tc as y,Vc as d,Xc as u,Yc as k,ed as f,ga as g,id as w,jd as $,kd as v,md as b,nd as S}from"./chunk.V5MYKNL7.js";function A(s){let i=[];for(let n of f(s).drawn)for(let t of n.kinds)i.push({kind:t,title:n.title,as:n.as,...n.across?{across:n.across}:{},...n.kinds.length>1?{over:n.kinds}:{},...n.hidden?{hidden:!0}:{}});for(let n of s.views?.places?.()??[])i.some(t=>t.kind===n.kind&&t.as===n.as)||i.push(n);return i}function F(s){return L(s.schema,A(s),{...s.pages?{pages:s.pages}:{},lenses:f(s).drawn,home:(s.home?.length??0)>0})}function L(s,i,n={}){let{pages:t}=n,l=s.kinds,h=i.filter(e=>l.includes(e.kind)),a=S(t?.first,s,h),P=new Set(t?.hide??[]),c=b(l,t?.order),p=[{slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#",...a?.to==="home"||a===void 0&&n.home?{first:!0}:{}},{slug:w,title:v(t),kind:null,cardinality:"many",address:$,stop:"#"}],x=y([...h].sort((e,o)=>c.indexOf(e.kind)-c.indexOf(o.kind)));for(let e of x){let o=n.lenses?.find(r=>r.as===e.as&&r.kinds.includes(e.kind)),m=k(e,h);p.push({slug:e.as,title:e.title,kind:e.kind,...e.over?{over:e.over.filter(r=>l.includes(r))}:{},cardinality:"many",address:u(e.as,m?d(s,e.kind).slice(1):void 0),stop:m?`#focus=aggregate:${e.kind}&in.view=${encodeURIComponent(e.as)}`:`#view=${encodeURIComponent(e.as)}`,...o?{lens:o.lens}:{},...e.hidden?{hidden:!0}:{},...a?.to==="place"&&a.place.as===e.as&&(a.place.kind===e.kind||e.over?.includes(a.place.kind))?{first:!0}:{}})}for(let e of c)p.push({slug:d(s,e).slice(1),title:g(s,e),kind:e,cardinality:"many",address:d(s,e),stop:`#focus=aggregate:${e}`,...P.has(e)?{hidden:!0}:{},...a?.to==="kind"&&a.kind===e?{first:!0}:{}});return p}export{F as a,L as b};
1
+ import{Vc as y,Xc as d,Zc as u,_c as k,gd as f,ha as g,kd as w,ld as $,md as v,od as b,pd as S}from"./chunk.7MQ7UWVW.js";function A(s){let i=[];for(let n of f(s).drawn)for(let t of n.kinds)i.push({kind:t,title:n.title,as:n.as,...n.across?{across:n.across}:{},...n.kinds.length>1?{over:n.kinds}:{},...n.hidden?{hidden:!0}:{}});for(let n of s.views?.places?.()??[])i.some(t=>t.kind===n.kind&&t.as===n.as)||i.push(n);return i}function F(s){return L(s.schema,A(s),{...s.pages?{pages:s.pages}:{},lenses:f(s).drawn,home:(s.home?.length??0)>0})}function L(s,i,n={}){let{pages:t}=n,l=s.kinds,h=i.filter(e=>l.includes(e.kind)),a=S(t?.first,s,h),P=new Set(t?.hide??[]),c=b(l,t?.order),p=[{slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#",...a?.to==="home"||a===void 0&&n.home?{first:!0}:{}},{slug:w,title:v(t),kind:null,cardinality:"many",address:$,stop:"#"}],x=y([...h].sort((e,o)=>c.indexOf(e.kind)-c.indexOf(o.kind)));for(let e of x){let o=n.lenses?.find(r=>r.as===e.as&&r.kinds.includes(e.kind)),m=k(e,h);p.push({slug:e.as,title:e.title,kind:e.kind,...e.over?{over:e.over.filter(r=>l.includes(r))}:{},cardinality:"many",address:u(e.as,m?d(s,e.kind).slice(1):void 0),stop:m?`#focus=aggregate:${e.kind}&in.view=${encodeURIComponent(e.as)}`:`#view=${encodeURIComponent(e.as)}`,...o?{lens:o.lens}:{},...e.hidden?{hidden:!0}:{},...a?.to==="place"&&a.place.as===e.as&&(a.place.kind===e.kind||e.over?.includes(a.place.kind))?{first:!0}:{}})}for(let e of c)p.push({slug:d(s,e).slice(1),title:g(s,e),kind:e,cardinality:"many",address:d(s,e),stop:`#focus=aggregate:${e}`,...P.has(e)?{hidden:!0}:{},...a?.to==="kind"&&a.kind===e?{first:!0}:{}});return p}export{F as a,L as b};
@@ -1,4 +1,4 @@
1
- import{tc as e}from"./chunk.V5MYKNL7.js";var a=`
1
+ import{vc as e}from"./chunk.7MQ7UWVW.js";var a=`
2
2
  .graview-spec{display:flex;flex-direction:column;gap:6px;min-width:0;color:var(--graview-ink)}
3
3
 
4
4
  .graview-spec-row{flex-direction:row;flex-wrap:wrap;align-items:center;gap:4px 10px;box-sizing:border-box;max-width:100%;padding:5px 10px;border:1px solid var(--graview-edge);border-radius:var(--graview-radius-sm,8px);background:var(--graview-panel);font-size:.875rem}
@@ -0,0 +1 @@
1
+ import{a as we,b as De,c as Ke,d as le,e as A,f as Me,h as Te}from"./chunk.GZA5ZNLJ.js";import{h as Ge,i as Ce,j as Ne}from"./chunk.R2B2ZAWI.js";import{a as oe,b as se,c as Y,d as Pe,e as J,g as ee,h as _e}from"./chunk.MI2HL3LQ.js";import{c as Ae,h as z,i as Fe,j as de}from"./chunk.TMBFLZNH.js";import{A as ve,Ga as Ee,Ha as Q,Ia as ae,Lb as ce,Mb as Re,b as L,c as V,e as Se,f as je,g as _,h as S,k as G,l as H,m as C,n as Oe,o as B,p as D,r as $,s as X,t as E,u as R,v as q,w as T,x as e,y as K,z as U,za as xe}from"./chunk.7MQ7UWVW.js";var on=n=>Object.entries(n).map(([s,r])=>[s,Object.keys(Q(r?.edges))]),pe=(n,s)=>Re(n,on(s));var me="graview-document",ge=1,ze=256*1024,ne=64*1024,fe=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ue=/^[a-z][A-Za-z0-9]*$/,sn=new Set(["id","kind"]),rn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,an=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function cn(){let n=k=>k in Object.prototype,s=U(k=>!n(k),"every object already has this name \u2014 choose another"),r=(k,N)=>[...k===void 0?[]:[je(k)],...N===void 0?[]:[Se(N)]],t=(k,N)=>S().check(...r(k,N)),a=(k,N,tn)=>D(k).check(...r(N,tn)),l=k=>S().check(_(fe,`${k} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=S().check(_(rn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),m=S().check(_(ue,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),U(k=>!sn.has(k),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),y=t(1,500),i=t(1,2e3),o=t(1,300),p=$({type:q(an),required:e(C()),description:e(y),label:e(t(1,60)),options:e(a(t(1,80),1,100)),of:e(q(["string","number","date","image","video","file"])),default:e(B()),unit:e(t(void 0,12)),format:e(q(["money","percent","duration","markdown"])),min:e(G()),max:e(G()),step:e(G()),renamedFrom:e(S().check(_(ue))),repeats:e(C())}).check(ve((k,N)=>{k.type==="enum"&&!k.options&&N.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),k.type!=="enum"&&k.options&&N.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),k.type!=="list"&&k.of&&N.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),k.repeats&&k.type!=="date"&&k.type!=="datetime"&&N.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),w=S().check(_(new RegExp(`${fe.source}|${xe.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),f=$({to:E([a(w,1),T("*")]),cardinality:e(q(["one","many"])),description:e(y),inverse:e(t(1,80)),appendOnly:e(C()),renamedFrom:e(S()),tidying:e(T("never"))}),d=E([i,$({expr:i,label:e(t(1,60)),description:e(y)})]),c=$({noun:e(t(1,40)),plural:e(t(1,40)),description:e(y),fields:R(m,p).check(U(k=>Object.keys(k).length>0,"a kind has at least one field")),label:e(o),describe:e(o),lifecycle:e($({field:m,retired:a(E([S(),G(),C()]),1)})),figure:e(t(void 0,2e4)),glance:e(a(m,1,20)),page:e($({fields:e(a(m,1,40)),groups:e(a($({title:t(1,60),fields:a(m,1,40)}),1,12))})),edges:e(R(u,f)),computed:e(R(S(),d).check(U(k=>Object.keys(k).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:e(R(S(),S())),renamedFrom:e(S().check(_(fe))),people:e(C()),archives:e(T(!1)),tidying:e(q(["never","no-links"]))}),O=E([S(),G(),C(),Oe(),D(B()),$({expr:i})]),h=S().check(_(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),j=E([$({create:l("kind"),as:e(S().check(_(ue))),set:e(R(m,O))}),$({set:R(m,O),target:e(h)}),$({connect:u,from:h,to:h}),$({sever:u,from:h,to:h}),$({remove:h})]),v=$({title:e(t(1,80)),description:e(y),fromTheOtherEnd:e(t(1,80)),on:e(E([l("kind"),a(l("kind"),1)])),creates:e(l("kind")),sets:e(R(m,O)),writes:e(a(m,1)),connects:e(u),severs:e(u),setsOther:e(R(m,O)),replaces:e(E([T(!0),a(u,1,10)])),removes:e(T(!0)),args:e(R(m,p)),effects:e(a(j,1,20)),allowedWhen:e(i),refusal:e(o),destructive:e(C())}),b=$({act:l("act"),label:e(t(1,80)),args:e(R(S(),O))}),W=$({title:e(t(1,120)),description:e(y),over:E([T("graph"),l("kind")]),when:e(i),require:i,says:e(o),repairs:e(a(b,void 0,10))}),P=$({roles:E([a(l("role"),1),T("*")]),mutations:E([a(l("act"),1),T("*")]),kinds:e(E([D(l("kind")),T("*")])),describe:e(y),self:e(C()),ownEnd:e(C())}),g=e(a(l("field"),1)),x=$({roles:E([a(l("role"),1),T("*")]),kinds:a(l("kind"),1),own:e(C()),via:e(u),fields:g,hide:g}),F=$({grants:D(P),sees:e(D(x))}),te=$({accent:e(S().check(_(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),name:e(t(1,60)),currency:e(S().check(_(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:e(t(2,35)),timeZone:e(t(1,64)),logo:e(E([t(1,ne),$({src:t(1,ne),alt:e(t(1,120))}),$({light:t(1,ne),dark:e(t(1,ne)),alt:e(t(1,120)),darkFallback:e(T("invert"))})])),favicon:e(E([t(1,ne),$({emoji:S()})])),typography:e($({display:e(t(1,200)),body:e(t(1,200)),mono:e(t(1,200))})),shape:e($({radius:e(G().check(V(0),L(32))),density:e(G().check(V(.75),L(1.5)))})),accents:e(R(S(),G().check(V(0),L(360)))),scheme:e(q(["light","dark","auto"]))}),I=R(S(),B()),Z=E([t(1,120),$({by:t(1,120),direction:e(q(["asc","desc"]))})]),ke=G().check(H(),V(1),L(9999)),He=X({create:e(C()),options:e(X({sort:e(Z),columnSort:e(Z),search:e(a(t(1,120),void 0,40)),filters:e(a(t(1,120),void 0,40)),horizon:e(E([G().check(H(),V(1),L(200)),X({years:G().check(H(),V(1),L(200)),title:t(1,80),from:e(ke),to:e(ke)})]))}))}),Xe=$({card:e(D(B())),row:e(D(B())),page:e(D(B()))}),Qe=()=>{let k=e(q(["asc","desc"]));return E([t(1,120),$({by:t(1,120),direction:k,then:e(E([t(1,120),$({by:t(1,120),direction:k})]))})])},en=()=>E([t(1,120),$({by:t(1,120),order:e(a(t(1,80),void 0,40)),closed:e(a(t(1,80),void 0,40))})]),$e=X({order:e(D(S())),hide:e(D(S())),first:e(S()),primary:e(a(t(1,80),void 0,40)),scene:e(t(1,40)),pages:e(t(1,40)),lists:e(R(S(),$({filters:e(a(t(1,120),void 0,40)),sort:e(Qe()),group:e(en())})))}),nn=$({$schema:e(S()),format:T(me),formatVersion:T(ge),name:t(1,80),description:e(y),version:e(G().check(H(),V(1))),kinds:R(l("kind"),c).check(U(k=>Object.keys(k).length>0,"a document declares at least one kind"),U(k=>Object.keys(k).length<=40,"a document declares at most 40 kinds")),computed:e(R(S(),d)),acts:e(R(l("act"),v)),rules:e(R(l("rule"),W)),roles:e(D(l("role"))),policy:e(F),modules:e(I),lenses:e(D(He)),pages:e($e),views:e(R(S(),E([Xe,D(B())]))),brand:e(te),settings:e(D(I)),migrations:e(D(I)),connections:e(R(l("connection"),I))});return{FieldSpec:p,EdgeSpec:f,ComputedSpec:d,KindSpec:c,ValueSpec:O,EffectSpec:j,ActSpec:v,RepairSpec:b,RuleSpec:W,GrantSpec:P,SightSpec:x,PolicySpec:F,BrandSpec:te,PagesSpec:$e,DocumentSpec:nn}}var dn,M=()=>dn??=cn(),Sn=K(()=>M().FieldSpec),jn=K(()=>M().EdgeSpec),On=K(()=>M().ComputedSpec),vn=K(()=>M().KindSpec),xn=K(()=>M().ValueSpec),En=K(()=>M().EffectSpec),Rn=K(()=>M().ActSpec),An=K(()=>M().RepairSpec),Fn=K(()=>M().RuleSpec),Dn=K(()=>M().GrantSpec),Kn=K(()=>M().SightSpec),Mn=K(()=>M().PolicySpec),Tn=K(()=>M().BrandSpec),Pn=K(()=>M().PagesSpec),Ie=K(()=>M().DocumentSpec);var ln={};function qe(n,s=ln,r=ge){let{document:t,respelled:a}=we(n),l=a.length>0?{respelled:a}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==me||typeof u.formatVersion!="number"||u.formatVersion>=r)return{document:t,...l};let m=u.formatVersion,y=structuredClone(u);for(let i=m;i<r;i++){let o=s[i];if(!o)throw new Error(`there is no upgrade from format ${i} to ${i+1}`);y={...o(y),formatVersion:i+1}}return{document:y,from:m,...l}}function Ve(n,s,r){let t=Object.keys(n).filter(m=>n[m].edges?.[s]!==void 0);if(t.length===0)return;let a=t.map(m=>n[m].edges[s].to),l=a.some(m=>m==="*")?"*":[...new Set(a.flatMap(m=>m))];if(r.length===0||r.some(m=>t.includes(m)))return{reversed:!1,kinds:l};let u=t.filter(m=>{let y=n[m].edges[s].to;return y==="*"||r.every(i=>y.includes(i))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:l}}var Ue=(n,s)=>{let r=n?.fields[s];return r!==void 0&&(r.type==="duration"||(r.type==="number"||r.type==="integer")&&r.format==="duration")};function Be(n,s,r,t){if(t==="out"){let a=n[s]?.edges?.[r]?.to;return a===void 0?[]:a==="*"?Object.keys(n):a}return Object.entries(n).filter(([,a])=>{let l=a.edges?.[r]?.to;return l!==void 0&&(l==="*"||l.includes(s))}).map(([a])=>a)}function he(n,s,r){if(r.t==="ident")return n[s]?.edges?.[r.name]?Be(n,s,r.name,"out"):void 0;if(r.t==="where")return he(n,s,r.set);if(r.t==="call"&&(r.fn==="out"||r.fn==="in")&&r.args[0]?.t==="lit"&&typeof r.args[0].value=="string")return Be(n,s,r.args[0].value,r.fn)}var Le=(n,s,r)=>{let t=s.filter(a=>n[a]?.fields[r]!==void 0);return t.length>0&&t.every(a=>Ue(n[a],r))};function We(n,s,r){let t=n.kinds,a=t[s],l=new Map(r),u=new Map,m=(i,o)=>{if(o>8)return!1;switch(i.t){case"ident":return Ue(a,i.name)||y(i.name,o+1);case"member":{let p=he(t,s,i.object);return p!==void 0&&Le(t,p,i.name)}case"call":{if(i.fn!=="sum"&&i.fn!=="min"&&i.fn!=="max")return!1;let[p,w]=i.args,f=p&&he(t,s,p);return f!==void 0&&w?.t==="ident"&&Le(t,f,w.name)}case"binary":return(i.op==="+"||i.op==="-")&&m(i.left,o)&&m(i.right,o);case"unary":return i.op==="-"&&m(i.operand,o);default:return!1}},y=(i,o)=>{if(a?.computed?.[i]===void 0)return!1;if(u.has(i))return u.get(i);u.set(i,!1);let p=l.get(i),w=p!==void 0&&m(p,o);return u.set(i,w),w};return r.map(([i])=>i).filter(i=>y(i,0))}function Ze(n,s,r=`kinds.${n}.page`){let t=s.page;if(!t)return[];let a=[],l=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,m=(i,o)=>{l.includes(i)?u.has(i)&&a.push(z("page-field-twice",o,`"${i}" is on ${n}'s page twice; name each field once`)):a.push(z("page-field",o,`${n}'s page is to show "${i}", and ${n} has no field or computed field called that`,`use one of: ${l.join(", ")}`)),u.add(i)};(t.fields??[]).forEach((i,o)=>m(i,`${r}.fields.${o}`));let y=new Set;return(t.groups??[]).forEach((i,o)=>{let p=i.title.trim().toLowerCase();y.has(p)&&a.push(z("page-group-twice",`${r}.groups.${o}.title`,`${n}'s page has two groups called "${i.title}"; give each its own title`)),y.add(p),i.fields.forEach((w,f)=>m(w,`${r}.groups.${o}.fields.${f}`))}),a}var pn=new Set(["subject","now","today","me"]);function fn(n){if((typeof n=="string"?n:JSON.stringify(n??null)).length>ze)return{findings:[z("too-large","",`a document may be at most ${ze/1024} KB`)]};if(typeof n=="string")try{n=JSON.parse(n)}catch(t){return{findings:[z("not-json","",`this is not JSON: ${t.message}`)]}}try{n=qe(n).document}catch(t){return{findings:[z("format","formatVersion",t.message)]}}let s=Ie.safeParse(n);if(!s.success)return{findings:s.error.issues.map(t=>{let a=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return z("unknown-key",a,`${t.keys.map(l=>`"${l}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(a))return z("effect-shape",a,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let l=t.issues?.[0]?.message;return z("shape",a,`the name "${String(t.path.at(-1))}" is not allowed here${l?`: ${l}`:""}`)}return z("shape",a,t.message)})};let r=s.data;return{document:r,findings:un(r)}}var re=n=>[n??[]].flat();function Ye(n){let s=new Map;for(let[r,t]of Object.entries(n.kinds))for(let[a,l]of Object.entries(Q(t.edges))){let u=s.get(a);s.set(a,{name:a,from:[...u?.from??[],r],to:l.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...l.to])],cardinality:l.cardinality??"many"})}return s}function lt(n){let s=new Map;for(let[t,a]of Object.entries(n.kinds)){let l=ee(a),u=ae(a.edges);s.set(t,{fields:new Set([...Object.keys(a.fields),...u.keys()]),edges:new Map(Object.entries(Q(a.edges)).map(([m,y])=>[m,y.cardinality??"many"])),...l?{computed:l}:{},...u.size>0?{linked:u}:{}})}let r=ee(n);return r&&s.set(Ae,{computed:r}),s}function Je(n,s){let r=[],t=re(n.on),a=(l,u)=>{let m=Ve(s.kinds,l,t)?.reversed===!0,[y,i]=m?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:l,from:y,to:i}:{sever:l,from:y,to:i}};if(n.creates){let l=s.kinds[n.creates],u={};for(let m of Object.keys(l?.fields??{}))u[m]=`$${m}`;for(let m of n.effects??[])"set"in m&&!("create"in m)&&A(m.target)==="new"&&Object.assign(u,m.set);r.push({create:n.creates,as:"new",set:u})}return n.sets&&r.push({set:n.sets}),n.writes&&!(n.creates&&n.on===void 0)&&r.push({set:Object.fromEntries(n.writes.map(l=>[l,`$${l}`]))}),n.connects&&(n.replaces&&r.push({replace:n.replaces===!0?[n.connects]:[...n.replaces],keep:n.connects}),r.push(a(n.connects,"connect"))),n.severs&&r.push(a(n.severs,"sever")),n.setsOther&&(n.connects||n.severs)&&r.push({set:n.setsOther,target:"$to"}),n.removes&&r.push({remove:"$subject"}),n.effects&&r.push(...n.effects.filter(l=>!(n.creates&&"set"in l&&!("create"in l)&&A(l.target)==="new"))),r}function ye(n,s,r){try{let t=Y(n),a=oe(t);for(let l of a.unknownFunctions)r.push(z("unknown-function",s,`"${l}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return t}catch(t){if(t instanceof se){r.push(z("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function be(n,s,r){try{return J(n)}catch(t){if(t instanceof Pe||t instanceof se){r.push(z("template",s,(t instanceof se,t.sentence)));return}throw t}}function un(n){let s=[],r=new Set(Object.keys(n.kinds)),t=Ye(n),a=n.acts??{},l=new Set(n.roles??[]),u=(i,o)=>ae(n.kinds[i]?.edges).has(o),m=i=>Object.keys(n.kinds).some(o=>u(o,i));for(let[i,o]of Object.entries(n.kinds)){let p=`kinds.${i}`;for(let[f,d]of Object.entries(o.edges??{})){if(!Ee(d)&&d.to!=="*")for(let c of d.to)r.has(c)||s.push(z("edge-target",`${p}.edges.${f}.to`,`"${c}" is not a kind this document declares`));o.fields[f]&&s.push(z("edge-field-clash",`${p}.edges.${f}`,`"${f}" is both a field and a relation of ${i}`,"rename one of them"))}o.lifecycle&&!o.fields[o.lifecycle.field]&&s.push(z("lifecycle-field",`${p}.lifecycle.field`,`${i} has no field "${o.lifecycle.field}"`));let w=f=>o.computed!==void 0&&Object.hasOwn(o.computed,f);for(let f of o.glance??[])!o.fields[f]&&!w(f)&&s.push(z("glance-field",`${p}.glance`,`a glance at ${i} is to say "${f}", and ${i} has no field or computed field called that`,`use one of: ${[...Object.keys(o.fields),...Object.keys(o.computed??{})].join(", ")}`));s.push(...Ze(i,o));for(let f of["label","describe"]){let d=o[f];if(!d)continue;let c=be(d,`${p}.${f}`,s);for(let O of c??[])if(O.expr){for(let h of oe(O.expr).names)if(!o.fields[h]){if(w(h)){_e(o,h)||s.push(z("template-field",`${p}.${f}`,`${i}'s ${h} is worked out from beyond the record, and a ${f} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${i}'s own fields`));continue}s.push(z("template-field",`${p}.${f}`,`${i} has no field "${h}" for its ${f} to show`,f==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[f,d]of Object.entries(o.fields)){d.default!==void 0&&d.type==="enum"&&!d.options?.includes(String(d.default))&&s.push(z("default-option",`${p}.fields.${f}.default`,`"${String(d.default)}" is not one of ${f}'s options`));let c=`${f}Repeat`;d.repeats&&(o.fields[c]||o.edges?.[c]||o.computed?.[c])&&s.push(z("repeat-clash",`${p}.fields.${f}.repeats`,`${i} already has "${c}", where how ${f} repeats is kept`))}}for(let[i,o]of Object.entries(a)){let p=`acts.${i}`;for(let c of re(o.on))r.has(c)||s.push(z("act-kind",`${p}.on`,`"${c}" is not a kind this document declares`));let w=re(o.on),f=Je(o,n);if(o.creates&&o.on===void 0&&o.writes&&r.has(o.creates)){for(let c of o.writes)if(!n.kinds[o.creates].fields[c])if(n.kinds[o.creates].computed?.[c]!==void 0)s.push(z("computed-written",`${p}.writes`,`${o.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(o.creates,c))continue;s.push(z("act-field",`${p}.writes`,`${o.creates} has no field "${c}"`))}}f.length===0&&s.push(z("act-empty",p,`"${i}" does nothing`,"give it effects or a shorthand such as sets or creates"));let d=new Map;f.forEach((c,O)=>{let h=f.length-(o.effects?.length??0),j=o.effects&&O>=h?`${p}.effects.${O-h}`:p;if("create"in c){if(!r.has(c.create))s.push(z("act-kind",`${j}.create`,`"${c.create}" is not a kind this document declares`));else for(let b of Object.keys(c.set??{}))n.kinds[c.create].fields[b]||(n.kinds[c.create].computed?.[b]!==void 0?s.push(z("computed-written",`${j}.set.${b}`,`${c.create}'s ${b} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(z("act-field",`${j}.set.${b}`,`${c.create} has no field "${b}"`)));c.as&&d.set(c.as,c.create)}else if("connect"in c||"sever"in c){let b="connect"in c?c.connect:c.sever;!t.has(b)&&!m(b)&&s.push(z("act-edge",`${j}.${"connect"in c?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),A(c.from)==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in c){let b=A(c.target??"$subject"),W=b==="subject"?w:d.has(b??"")?[d.get(b)]:[];b==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" changes "$subject" but does not say which kinds it is "on"`));for(let P of Object.keys(c.set))for(let g of W)if(!(!r.has(g)||n.kinds[g].fields[P]))if(n.kinds[g].computed?.[P]!==void 0)s.push(z("computed-written",`${j}.set.${P}`,`${g}'s ${P} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(g,P))continue;s.push(z("act-field",`${j}.set.${P}`,`${g} has no field "${P}"`))}}else"remove"in c&&A(c.remove)==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" removes "$subject" but does not say which kinds it is "on"`));("set"in c&&c.set?Object.values(c.set):[]).forEach(b=>{b&&typeof b=="object"&&!Array.isArray(b)&&"expr"in b&&ye(b.expr,`${j}.set`,s)})}),o.allowedWhen&&ye(o.allowedWhen,`${p}.allowedWhen`,s),o.refusal&&be(o.refusal,`${p}.refusal`,s)}for(let[i,o]of Object.entries(n.rules??{})){let p=`rules.${i}`;o.over!=="graph"&&!r.has(o.over)&&s.push(z("rule-kind",`${p}.over`,`"${o.over}" is not a kind this document declares`));let w=o.over==="graph"?void 0:n.kinds[o.over];for(let f of["when","require"]){let d=o[f];if(!d)continue;let c=ye(d,`${p}.${f}`,s);if(!c)continue;let O=oe(c);for(let h of O.names)if(o.over==="graph")s.push(z("rule-name",`${p}.${f}`,`"${h}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(w&&!w.fields[h]&&!w.edges?.[h]&&w.computed?.[h]===void 0){let j=Object.keys(w.edges??{}).find(v=>v.includes("-")&&v.split("-").includes(h));s.push(z("rule-name",`${p}.${f}`,`${o.over} has no field or relation called "${h}"`,j?`"${j}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${j.replace(/-([a-z0-9])/g,(v,b)=>b.toUpperCase())}"`:void 0))}for(let h of O.edges)!t.has(h)&&!m(h)&&s.push(z("rule-edge",`${p}.${f}`,`"${h}" is not a relation any kind declares`));for(let h of O.sweeps)r.has(h)?o.over!=="graph"&&s.push(Fe("rule-cost",`${p}.${f}`,`this rule looks at every ${h} for every ${o.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(z("rule-kind",`${p}.${f}`,`"${h}" is not a kind this document declares`))}o.says&&be(o.says,`${p}.says`,s),(o.repairs??[]).forEach((f,d)=>{!a[f.act]&&!ce(f.act)&&!pe(f.act,n.kinds)&&s.push(z("repair-act",`${p}.repairs.${d}.act`,`"${f.act}" is not an act this document declares`))})}let y=n.policy;return y&&(y.grants.forEach((i,o)=>{if(i.roles!=="*"&&l.size>0)for(let p of i.roles)l.has(p)||s.push(z("grant-role",`policy.grants.${o}.roles`,`"${p}" is not one of the document's roles`));if(i.mutations!=="*")for(let p of i.mutations)!a[p]&&!ce(p)&&!pe(p,n.kinds)&&s.push(z("grant-act",`policy.grants.${o}.mutations`,`"${p}" is not an act this document declares`))}),(y.sees??[]).forEach((i,o)=>{for(let p of i.kinds)r.has(p)||s.push(z("sight-kind",`policy.sees.${o}.kinds`,`"${p}" is not a kind this document declares`));if(i.roles!=="*"&&l.size>0)for(let p of i.roles)l.has(p)||s.push(z("sight-role",`policy.sees.${o}.roles`,`"${p}" is not one of the document's roles`))})),s.push(...Ne(n)),s}function mn(n,s,r,t){let a=new Map,l=re(n.on),u=new Map,m=new Map;(l.length>0||s.some(d=>"remove"in d&&A(d.remove)==="subject"||"from"in d&&(A(d.from)==="subject"||A(d.to)==="subject")||"set"in d&&!("create"in d)&&A(d.target??"$subject")==="subject"))&&a.set(le,{ref:l.length>0?l:"*",required:!0});let i=n.args??{},o=n.writes?.length===1,p=(d,c)=>c&&d.type===c.type&&d.min===void 0&&d.max===void 0&&d.step===void 0?{...d,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:d,w=(d,c)=>c&&d.type===c.type&&d.format===void 0&&d.unit===void 0?{...p(d,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:p(d,c),f=(d,c,O)=>{if(d===le||pn.has(d)||u.has(d)||a.has(d))return;let h=i[d]?w(i[d],O):void 0;a.set(d,h?{field:h,optional:!h.required,required:!!h.required}:c())};for(let d of s)if("create"in d){let c=r.kinds[d.create];for(let[O,h]of Object.entries(d.set??{})){let j=A(h),v=c?.fields[O];if(j&&v){let b=!!v.required&&v.default===void 0;f(j,()=>({field:v,optional:!b,required:b}),v)}}d.as&&u.set(d.as,d.create)}else if("connect"in d||"sever"in d){let c=t.get("connect"in d?d.connect:d.sever);for(let[O,h]of[["from",d.from],["to",d.to]]){let j=A(h);if(!j)continue;let v=O==="to"?c?.to??"*":c?.from??"*";v!=="*"&&!m.has(j)&&m.set(j,v),f(j,()=>({ref:v,required:!0}))}}else if("set"in d){let c=A(d.target??"$subject"),O=c==="subject"?l[0]:u.get(c??"")??m.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&f(c,()=>({ref:"*",required:!0}));for(let[h,j]of Object.entries(d.set)){let v=A(j);if(!v)continue;let b=O?r.kinds[O]?.fields[h]:void 0;f(v,()=>b?{field:b,optional:!o,required:o}:{any:!0,required:!1},b)}}else if("remove"in d){let c=A(d.remove);c&&f(c,()=>({ref:"*",required:!0}))}for(let[d,c]of Object.entries(i))a.has(d)||a.set(d,{field:c,optional:!c.required,required:!!c.required});return a}function pt(n,s={}){let r=fn(n);if(!r.document||de(r.findings))return{ok:!1,findings:r.findings};let t=r.document,a=[...r.findings];s.previous&&a.push(...zn(t,s.previous));let l=gn(t,a);return de(l.findings)?{ok:!1,findings:l.findings}:Te(l,s)}function ie(n,s){return n.map(r=>{let t=!r.format&&r.expr?.t==="ident"?s?.[r.expr.name]?.format:void 0;return t==="money"||t==="percent"?{...r,format:t}:r})}function gn(n,s){let r=Ye(n),t={};for(let[i,o]of Object.entries(n.kinds)){let p=Me(o),w=o.label??(p?`{${p}}`:void 0),f=ee(o),d=f?We(n,i,[...f]):[];t[i]={...w?{label:ie(J(w),o.fields)}:{},...o.describe?{describe:ie(J(o.describe),o.fields)}:{},...f?{computed:[...f]}:{},...d.length>0?{durations:d}:{}}}let a={};for(let[i,o]of Object.entries(n.acts??{})){let p=Je(o,n),w=mn(o,p,n,r),f=o.destructive??p.some(g=>"remove"in g||"sever"in g||"replace"in g),d=[...new Set(p.flatMap(g=>"create"in g?[g.create]:[]))],c=[...new Set(p.flatMap(g=>"connect"in g?[g.connect]:[]))],O=[...new Set(p.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],h=[...new Set(p.flatMap(g=>"set"in g&&!("create"in g)&&A(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],j=new Map;for(let g of p){if(!("connect"in g)&&!("sever"in g))continue;let x=r.get("connect"in g?g.connect:g.sever);for(let[F,te]of[["from",g.from],["to",g.to]]){let I=A(te),Z=F==="to"?x?.to:x?.from;I&&I!=="subject"&&Z&&Z!=="*"&&j.set(I,[...new Set([...j.get(I)??[],...Z])])}}let v={};for(let g of p){if(!("set"in g)||"create"in g)continue;let x=A(g.target??"$subject");for(let F of x&&x!=="subject"&&j.get(x)||[])v[F]=[...new Set([...v[F]??[],...Object.keys(g.set)])]}let b={};for(let g of p)if(!(!("set"in g)||"create"in g||A(g.target??"$subject")!=="subject"))for(let[x,F]of Object.entries(g.set??{}))typeof F=="string"&&A(F)===void 0||typeof F=="number"||typeof F=="boolean"?b[x]=typeof F=="string"&&F.startsWith("$$")?F.slice(1):F:delete b[x];let W=d.length===0&&p.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(x=>!(x&&typeof x=="object"&&!Array.isArray(x)&&"expr"in x))),P=new Map;for(let g of p)if(!(!("set"in g)||!g.set))for(let x of Object.values(g.set))x&&typeof x=="object"&&!Array.isArray(x)&&"expr"in x&&P.set(x.expr,Y(x.expr));a[i]={title:o.title??i.replace(/-/g," "),effects:p,args:[...w],...o.allowedWhen?{guard:Y(o.allowedWhen)}:{},...o.refusal?{refusal:ie(J(o.refusal),n.kinds[[o.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...P],destructive:f,idempotent:W,creates:d,connects:c,severs:O,writes:h,writesOther:v,sets:b}}let l={};for(let[i,o]of Object.entries(n.rules??{}))l[i]={title:o.title??i.replace(/-/g," "),require:Y(o.require),...o.when?{when:Y(o.when)}:{},...o.says?{says:ie(J(o.says),n.kinds[o.over]?.fields)}:{}};let u=De(n,s),m=Ge(n),y=Ce(n);return{format:Ke,document:n,findings:s,kinds:t,...n.computed?{facts:[...ee(n)??[]]}:{},edges:[...r].map(([i,{from:o,to:p,cardinality:w}])=>[i,{from:o,to:p,cardinality:w}]),acts:a,rules:l,brand:u,...Object.keys(m).length>0?{viewSpecs:m}:{},...y?{home:y}:{}}}function ft(n,s,r){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],a=t?r.kinds[t]:void 0;if(!t||!a)return n;let l=Object.keys(a.fields).filter(u=>u!=="label").slice(0,3);return{...n,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${l.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function zn(n,s){let r=[],t=new Set(Object.values(s.kinds).flatMap(a=>Object.keys(a.edges??{})));for(let[a,l]of Object.entries(n.kinds)){let u=l.renamedFrom;u&&!s.kinds[u]&&r.push(z("renamed-from-nothing",`kinds.${a}.renamedFrom`,`${a} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let m=s.kinds[u??a];for(let[y,i]of Object.entries(l.fields)){let o=i.renamedFrom;o&&!m?.fields[o]&&r.push(z("renamed-from-nothing",`kinds.${a}.fields.${y}.renamedFrom`,`${y} says it was ${o}, and the previous ${u??a} has no field called ${o}`,"name the field it was, or drop renamedFrom"))}for(let[y,i]of Object.entries(l.edges??{})){let o=i.renamedFrom;o&&!t.has(o)&&r.push(z("renamed-from-nothing",`kinds.${a}.edges.${y}.renamedFrom`,`${y} says it was ${o}, and the previous version has no relation called ${o}`,"name the relation it was, or drop renamedFrom"))}}return r}export{fn as a,lt as b,Je as c,pt as d,ft as e};
@@ -1 +1 @@
1
- import{a as f}from"./chunk.ISXFH3CK.js";import{ba as d}from"./chunk.V5MYKNL7.js";function w(n){let o=n.indexOf("{"),r=n.indexOf("["),t=r!==-1&&(o===-1||r<o)?r:o;if(t===-1)return;let e=n[t],a=e==="["?"]":"}",i=0,c=!1,l=!1;for(let s=t;s<n.length;s++){let u=n[s];if(c){l?l=!1:u==="\\"?l=!0:u==='"'&&(c=!1);continue}if(u==='"')c=!0;else if(u===e)i+=1;else if(u===a&&(i-=1,i===0))try{return JSON.parse(n.slice(t,s+1))}catch{return}}}function v(n,o){let r;try{r=n.mutation(o.mutation)}catch{return o}let t={...o.args},e=!1;for(let a of f(r.input)){if(a.control!=="node")continue;let i=t[a.name];if(typeof i!="string"||i.length===0||n.graph.getNode(i))continue;let c=i.trim().toLowerCase(),l=[...n.graph.allNodes()].filter(s=>(a.kinds.includes("*")||a.kinds.includes(s.kind))&&d(n.schema.tryDefinition(s.kind),s).trim().toLowerCase()===c);l.length===1&&(t[a.name]=l[0].id,e=!0)}return e?{...o,args:t}:o}function P(n,o,r){let t=r===void 0?null:new Set(r),e=[];for(let a of o){if(typeof a.mutation!="string")continue;let i=!0;try{n.mutation(a.mutation)}catch{i=!1}i?t&&!t.has(a.mutation)&&e.push({proposal:a,why:"not-allowed"}):e.push({proposal:a,why:"unknown"})}return e}function x(n,o,r){let t=r===void 0?null:new Set(r);return o.filter(e=>{if(typeof e.mutation!="string"||t&&!t.has(e.mutation))return!1;try{n.mutation(e.mutation)}catch{return!1}return e.args!==null&&typeof e.args=="object"})}export{w as a,v as b,P as c,x as d};
1
+ import{a as f}from"./chunk.KG5R4GTK.js";import{ca as d}from"./chunk.7MQ7UWVW.js";function w(n){let o=n.indexOf("{"),r=n.indexOf("["),t=r!==-1&&(o===-1||r<o)?r:o;if(t===-1)return;let e=n[t],a=e==="["?"]":"}",i=0,c=!1,l=!1;for(let s=t;s<n.length;s++){let u=n[s];if(c){l?l=!1:u==="\\"?l=!0:u==='"'&&(c=!1);continue}if(u==='"')c=!0;else if(u===e)i+=1;else if(u===a&&(i-=1,i===0))try{return JSON.parse(n.slice(t,s+1))}catch{return}}}function v(n,o){let r;try{r=n.mutation(o.mutation)}catch{return o}let t={...o.args},e=!1;for(let a of f(r.input)){if(a.control!=="node")continue;let i=t[a.name];if(typeof i!="string"||i.length===0||n.graph.getNode(i))continue;let c=i.trim().toLowerCase(),l=[...n.graph.allNodes()].filter(s=>(a.kinds.includes("*")||a.kinds.includes(s.kind))&&d(n.schema.tryDefinition(s.kind),s).trim().toLowerCase()===c);l.length===1&&(t[a.name]=l[0].id,e=!0)}return e?{...o,args:t}:o}function P(n,o,r){let t=r===void 0?null:new Set(r),e=[];for(let a of o){if(typeof a.mutation!="string")continue;let i=!0;try{n.mutation(a.mutation)}catch{i=!1}i?t&&!t.has(a.mutation)&&e.push({proposal:a,why:"not-allowed"}):e.push({proposal:a,why:"unknown"})}return e}function x(n,o,r){let t=r===void 0?null:new Set(r);return o.filter(e=>{if(typeof e.mutation!="string"||t&&!t.has(e.mutation))return!1;try{n.mutation(e.mutation)}catch{return!1}return e.args!==null&&typeof e.args=="object"})}export{w as a,v as b,P as c,x as d};
@@ -0,0 +1 @@
1
+ import{ca as y,da as V}from"./chunk.7L6LYXCV.js";import"./chunk.SDO3U72B.js";import{Tc as u,Wc as m}from"./chunk.7MQ7UWVW.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";var c=t=>[t,...u.filter(r=>r!==t)];function w(t,r){if(r.hidden.length===0&&r.removed.length===0)return t;let f=new Set(r.removed.filter(e=>!e.lens).map(e=>e.name)),o=new Set(r.hidden),s=e=>e?.name!==void 0&&(f.has(e.name)||o.has(e.name)),a=(e,i,d)=>[...t.registrations()].reverse().find(n=>n.kind===e&&n.cardinality===i&&n.fidelity===d&&!n.beside&&!n.hidden&&!s(n)),h=(e,i)=>{for(let d of c(i.fidelity)){let n=a(e,i.cardinality,d);if(n)return n}if(i.cardinality==="one")for(let d of c(i.fidelity)){let n=a(e,"many",d);if(n)return n}},l={...t,register(e,i,d,n){return t.register(e,i,d,n),l},lookup(e,i){return t.lookup(e,i)===void 0?void 0:a(e,i.cardinality,i.fidelity)?.view},places:()=>t.places().filter(e=>!(e.name!==void 0&&f.has(e.name))).map(e=>e.name!==void 0&&o.has(e.name)&&!e.hidden?{...e,hidden:!0}:e),resolve(e,i,d){let n=t.resolve(e,i,d);return!n||!s(n)||d!==void 0&&n.name!==void 0&&!f.has(n.name)&&n.title!==void 0&&m(n.title)===d?n:h(e,i)},all:()=>t.all().filter(e=>!(e.name!==void 0&&f.has(e.name)))};return y(t)&&V(l),l}function v(t,r,f){let o,s=()=>{let a=r.current();o&&a.hidden===o.hidden&&a.removed===o.removed||(o=a,f(w(t,a)))};return s(),r.onChange?.(s)??(()=>{})}export{w as tidyViews,v as watchTidied};
@@ -0,0 +1 @@
1
+ import"./chunk.WVUJXDXZ.js";import{a as k,b as q,c as pe}from"./chunk.QWY54AVN.js";import"./chunk.T4Q6OLZU.js";import"./chunk.R2B2ZAWI.js";import"./chunk.7XCBIID7.js";import"./chunk.MI2HL3LQ.js";import"./chunk.TMBFLZNH.js";import"./chunk.GZHZLJBF.js";import{n as me}from"./chunk.EBTYR5CZ.js";import"./chunk.OJGHDWI6.js";import"./chunk.OWL5GZ6U.js";import"./chunk.RSYFIL2Z.js";import"./chunk.R7F6UJVG.js";import"./chunk.DYW4D74X.js";import"./chunk.VP35BUUZ.js";import{G as Le,M as S,O as ue,R as ce,_ as ge,ba as he}from"./chunk.7L6LYXCV.js";import"./chunk.SDO3U72B.js";import{ja as oe,ma as w,oa as le,qa as E,ra as x,sa as se,ta as Y,vc as de}from"./chunk.7MQ7UWVW.js";import"./chunk.2AZTW66C.js";import{b as U}from"./chunk.AJZBJBMO.js";var h=U(Le(),1);async function ye(e,n){let i=await createImageBitmap(e);try{let r=Math.min(1,n/Math.max(i.width,i.height)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(i.width*r)),a.height=Math.max(1,Math.round(i.height*r));let l=a.getContext("2d");if(l===null)throw new Error("This browser will not give us a canvas to resize with.");return l.drawImage(i,0,0,a.width,a.height),a}finally{i.close()}}var t=U(ce(),1),Ve=2048,Ie=.85;function _(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function z(e){if(e.type==="application/pdf")return"PDF";let n=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return n?n.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ke(e){let n=[...new Set(e.map(i=>i==="image/*"?"pictures":i==="video/*"?"videos":i==="*/*"||i==="*"?"any file":`${z({type:i})} files`))];return n.length<=1?n[0]??"no files":`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`}function Fe(e,n){if(e.length===0)return!0;let i=`${n.split("/")[0]}/*`;return e.some(r=>r==="*"||r==="*/*"||r===n||r===i)}var fe=/^image\/hei[cf]$|\.hei[cf]$/i,be=e=>fe.test(e.type)||fe.test(e.name),De={mov:"video/quicktime",mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",ogv:"video/ogg"},Be=e=>De[/\.([a-z0-9]{2,4})$/i.exec(e)?.[1]?.toLowerCase()??""];async function je(e,n,i){let r=e.name||(i.camera?"photo.jpg":"file"),a=e.type||(be({type:"",name:r})?"image/heic":Be(r)??"application/octet-stream"),l=be({type:a,name:r}),u=a.startsWith("image/")||l;if(i.image&&!u)return{refused:`\u201C${r}\u201D isn\u2019t a picture.`};if(i.video)return a.startsWith("video/")?K({blob:e,name:r,type:a},n):{refused:`\u201C${r}\u201D isn\u2019t a video.`};if(l||u&&/^image\/(jpeg|webp)$/.test(a)&&(i.camera||e.size>n.maxBytes||e.size>15e5))try{let c=await ye(e,Ve),b=await new Promise(p=>c.toBlob(p,"image/jpeg",Ie));if(b)return K({blob:b,name:l?r.replace(/\.hei[cf]$/i,"")+".jpg":r,type:"image/jpeg",width:c.width,height:c.height},n)}catch{if(l&&!Fe(n.kinds,a))return{refused:`\u201C${r}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let y={};if(u&&!l)try{let c=await createImageBitmap(e);y={width:c.width,height:c.height},c.close()}catch{}return K({blob:e,name:r,type:a,...y},n)}function K(e,n){return Fe(n.kinds,e.type)?e.blob.size>n.maxBytes?{refused:`\u201C${e.name}\u201D is ${_(e.blob.size)}; this host takes files up to ${_(n.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${z(e)} file; this host takes ${ke(n.kinds)}.`}}async function _e(e,n,i,r=!1){let a;try{a=await n.upload(e.blob,e.name)}catch(u){let s=u instanceof Error&&u.message.trim()?u.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${s}`}}return le(a)?i&&!E(a)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:r&&!x(a)?{refused:`The host kept \u201C${e.name}\u201D as ${z(a)}, not as a video.`}:{...a,...a.width===void 0&&e.width?{width:e.width}:{},...a.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var F="var(--graview-radius, 8px)",P={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function Z(e){let n=S(),i=ue()?.past!=null,[r,a]=(0,h.useState)(!1),l=n?.kept?ze(n,e.href):!0,[,u]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(typeof l!="object")return;let s=!0;return l.then(()=>s&&u(y=>y+1)),()=>void(s=!1)},[l]),[l===!1||i&&r,()=>a(!0)]}var J=new WeakMap;function ze(e,n){let i=J.get(e)?.get(n);if(i!==void 0)return i;let r;try{r=e.kept(n)}catch{return!0}if(typeof r=="boolean")return r;let a=J.get(e)??new Map;J.set(e,a);let l=Promise.resolve(r).then(u=>u!==!1,()=>!0);return a.set(n,l),l.then(u=>a.set(n,u)),l}function ee({file:e,style:n}){return(0,t.jsx)("span",{role:"img","aria-label":`${k(e)}, removed later`,"data-graview-removed-later":e.href,style:{display:"grid",placeItems:"center",textAlign:"center",padding:4,boxSizing:"border-box",fontSize:"0.6875rem",lineHeight:1.2,color:"var(--graview-ink-muted)",border:"1px dashed var(--graview-edge-bright)",borderRadius:F,...n},children:"removed later"})}function Q({file:e,size:n=56,style:i}){let r=S(),[a,l]=Z(e);return a?(0,t.jsx)(ee,{file:e,style:{width:n,height:n,flex:"none",...i}}):x(e)?(0,t.jsx)(Ae,{file:e,size:n,...i?{style:i}:{},onError:l}):(0,t.jsx)("img",{onError:l,src:w(r,e.href),alt:k(e),width:n,height:n,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:n,height:n,objectFit:"cover",borderRadius:F,display:"block",flex:"none",background:"var(--graview-edge)",...i}})}function $e(e){let[n,i]=(0,h.useState)({}),r=e.duration??n.duration;return[{...r!==void 0?{duration:r}:{},width:e.width??n.width,height:e.height??n.height},u=>{let s=u.currentTarget;i({...Number.isFinite(s.duration)&&s.duration>0?{duration:s.duration}:{},...s.videoWidth>0&&s.videoHeight>0?{width:s.videoWidth,height:s.videoHeight}:{}})}]}var Ne=320,xe=(e,n)=>`${k(e)}, ${se({...n!==void 0?{duration:n}:{}})}`,Oe=(0,t.jsx)("span",{"data-graview-play-glyph":"","aria-hidden":"true",style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,t.jsxs)("svg",{viewBox:"0 0 24 24",width:"40%",height:"40%",style:{maxWidth:40,maxHeight:40,filter:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.5))"},children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"11",fill:"rgb(0 0 0 / 0.55)"}),(0,t.jsx)("path",{d:"M9.5 7.5v9l7-4.5z",fill:"#fff"})]})});function Ae({file:e,size:n,style:i,onError:r}){let a=S(),[l,u]=$e(e),s={width:n,height:n,objectFit:"cover",display:"block",borderRadius:F,background:"var(--graview-edge)"};return(0,t.jsxs)("span",{role:"img","aria-label":xe(e,l.duration),"data-graview-thumb":e.href,"data-graview-video-thumb":"",style:{position:"relative",display:"block",width:n,height:n,flex:"none",...i},children:[e.poster?(0,t.jsx)("img",{src:w(a,e.poster),alt:"",width:n,height:n,loading:"lazy",decoding:"async",onError:r,style:s}):(0,t.jsx)("video",{src:w(a,e.href),preload:"metadata",muted:!0,playsInline:!0,"aria-hidden":"true",tabIndex:-1,width:n,height:n,onLoadedMetadata:u,onError:r,style:s}),Oe,l.duration!==void 0?(0,t.jsx)("span",{"data-graview-video-clock":"","aria-hidden":"true",style:{position:"absolute",right:3,bottom:3,padding:"0 4px",borderRadius:4,background:"rgb(0 0 0 / 0.65)",color:"#fff",fontSize:"0.6875rem",lineHeight:"16px",fontVariantNumeric:"tabular-nums"},children:q(l.duration)}):null]})}function Ge({file:e}){let n=S(),[i,r]=Z(e),[a,l]=$e(e);if(i)return(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"16 / 9"}});let u=a.width!==void 0&&a.height!==void 0;return(0,t.jsxs)("figure",{"data-graview-video-figure":e.href,style:{margin:0,display:"grid",gap:4,minWidth:0},children:[(0,t.jsx)("video",{"data-graview-video":e.href,src:w(n,e.href),...e.poster?{poster:w(n,e.poster)}:{},controls:!0,preload:"metadata",playsInline:!0,...u?{width:a.width,height:a.height}:{},"aria-label":xe(e,a.duration),onLoadedMetadata:l,onError:r,style:{display:"block",width:"100%",maxWidth:u?Math.max(a.width,Ne):"100%",height:"auto",maxHeight:"80vh",aspectRatio:u?`${a.width} / ${a.height}`:"16 / 9",borderRadius:F,background:"#000"},children:e.captions?(0,t.jsx)("track",{kind:"captions",src:w(n,e.captions),srcLang:"en",label:"Captions",default:!0}):null}),(0,t.jsx)("figcaption",{"data-graview-video-said":"",style:P,children:[e.caption??e.name,...a.duration!==void 0?[q(a.duration)]:[]].join(" \xB7 ")})]})}function Ue({file:e,onOpen:n}){let i=S(),[r,a]=Z(e);return r?(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"1"}}):(0,t.jsx)("button",{type:"button","aria-label":`Open ${k(e)} full size`,onClick:l=>n(l.currentTarget),style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:F},children:(0,t.jsx)("img",{src:w(i,e.href),alt:k(e),loading:"lazy",decoding:"async",onError:a,style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:F,display:"block",background:"var(--graview-edge)"}})})}function X({files:e,label:n}){let i=S(),r=d=>w(i,d.href),a=e.filter(E),l=e.filter(x),u=e.filter(d=>!E(d)&&!x(d)),[s,y]=(0,h.useState)(null),c=(0,h.useRef)(null),b=(0,h.useRef)(null);(0,h.useEffect)(()=>{let d=c.current;s!==null&&d&&!d.open&&d.showModal?.()},[s]);let p=s===null?void 0:a[s];return(0,t.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[a.length>0?(0,t.jsx)("ul",{"data-graview-gallery":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:a.map((d,T)=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ue,{file:d,onOpen:R=>{b.current=R,y(T)}})},d.href))}):null,l.length>0?(0,t.jsx)("ul",{"data-graview-videos":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:12},children:l.map(d=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ge,{file:d})},d.href))}):null,u.length>0?(0,t.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:u.map(d=>(0,t.jsxs)("li",{"data-graview-document":d.type,style:{display:"grid",gap:6,minWidth:0},children:[d.type==="application/pdf"?(0,t.jsx)("object",{data:r(d),type:"application/pdf","aria-label":k(d),style:{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:F},children:(0,t.jsxs)("p",{style:{margin:0,padding:12},children:["This browser shows no PDF here: ",(0,t.jsxs)("a",{href:r(d),download:d.name,children:["download ",d.name]}),"."]})}):null,(0,t.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,t.jsx)("a",{href:r(d),download:d.name,...d.type==="application/pdf"?{target:"_blank",rel:"noopener"}:{},children:d.name}),(0,t.jsxs)("span",{style:P,children:[z(d)," \xB7 ",_(d.bytes)]})]}),d.caption?(0,t.jsx)("span",{style:P,children:d.caption}):null]},d.href))}):null,p?(0,t.jsx)("dialog",{ref:c,"data-graview-full":p.href,"aria-label":k(p),onClose:()=>{y(null),b.current?.focus()},onClick:d=>{d.target===d.currentTarget&&d.currentTarget.close()},style:{padding:0,border:0,borderRadius:F,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,t.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,t.jsx)("img",{src:r(p),alt:k(p),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,t.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:p.caption??p.name}),(0,t.jsx)("form",{method:"dialog",style:{margin:0},children:(0,t.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function Se({value:e,onChange:n,several:i,image:r,video:a=!1,label:l,thumbs:u=!0}){let s=S(),y=(0,h.useId)(),c=(0,h.useRef)(null),b=(0,h.useRef)(null),[p,d]=(0,h.useState)(null),[T,R]=(0,h.useState)(null),[te,H]=(0,h.useState)([]),[N,O]=(0,h.useState)(!1),W=r?"image/":a?"video/":void 0,C=s?W?s.kinds.filter(o=>o.startsWith(W)||o==="*"||o==="*/*"):s.kinds:[],Pe=s?s.kinds.length===0||C.length>0:!1,Re=!a&&(s?s.kinds.length===0||(r?C:s.kinds).some(o=>o.startsWith("image/")||o.startsWith("*")):!1),ne=!!s&&s.maxBytes>0,L=ne&&(!W||Pe),V=r?"picture":a?"video":"file",ae=i?`${V}s`:`a ${V}`,ie=W?C.length>0?C.join(","):`${W}*`:s?.kinds.join(",")||void 0,We=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,A=(0,h.useRef)(e);A.current=e;let re=(0,h.useRef)(null),I=(0,h.useRef)(null);(0,h.useEffect)(()=>{let o=I.current;if(!o||o.from===e)return;I.current=null;let g=re.current?.children,f=g?.[Math.min(o.at,g.length-1)];((o.what==="move"?f?.querySelector("[data-graview-file-move]"):null)??f?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let D=async(o,g)=>{if(!s||o.length===0)return;let f=i?o:o.slice(0,1),m=[],$=[];f.length<o.length&&$.push(`${l} holds one ${V}, so ${o.slice(1).map(v=>`\u201C${v.name||"the photo"}\u201D`).join(", ")} ${o.length>2?"were":"was"} left out.`),H([]),R(null);for(let v of f){d(`Sending ${v.name||"the photo"}\u2026`);let G=await je(v,s,{image:r,video:a,camera:g==="camera"});if("refused"in G){$.push(G.refused);continue}let M=await _e(G,s,r,a);"refused"in M?$.push(M.refused):[...i?A.current:[],...m].some(He=>He.href===M.href)?$.push(`\u201C${M.name}\u201D is already here.`):m.push(M)}if(d(null),H($),m.length!==0)try{n(i?[...A.current,...m]:m.slice(-1)),R(`Added ${m.map(v=>v.name).join(", ")}.`)}catch(v){H([...$,v instanceof Error?v.message:String(v)])}},B=(o,g,f)=>{try{I.current=f?{...f,from:e}:null,n(o),R(g)}catch(m){I.current=null,H([m instanceof Error?m.message:String(m)])}},j=o=>o?Array.from(o):[],Me=o=>{let g=j(o.clipboardData?.files);!L||g.length===0||(o.preventDefault(),D(g,"pasted"))},Te=o=>{O(!1),L&&(o.preventDefault(),D(j(o.dataTransfer?.files),"dropped"))};return(0,t.jsxs)("div",{role:"group","aria-labelledby":`${y}-label`,"data-graview-file-editor":"","data-graview-dropping":N?"":void 0,onPaste:Me,onDragOver:o=>{L&&(o.preventDefault(),O(!0))},onDragLeave:()=>O(!1),onDrop:Te,style:{display:"grid",gap:8,minWidth:0,padding:N?6:0,outline:N?"2px dashed var(--graview-accent)":"none",borderRadius:F},children:[(0,t.jsx)("span",{id:`${y}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:l}),e.length>0&&(i||e.length>1)?(0,t.jsx)("ul",{ref:re,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((o,g)=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[u&&(E(o)||x(o))?(0,t.jsx)(Q,{file:o,size:40}):null,(0,t.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:o.name}),(0,t.jsx)(we,{file:o,onCaption:f=>B(e.map((m,$)=>$===g?ve(m,f):m),f?`${o.name} now says \u201C${f}\u201D.`:`${o.name} says its name again.`)}),i&&g>0?(0,t.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${o.name} earlier`,onClick:()=>B(e.map((f,m)=>m===g-1?o:m===g?e[g-1]:f),`Moved ${o.name} earlier.`,{at:g-1,what:"move"}),children:"\u2191"}):null,i?(0,t.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${o.name}`,onClick:()=>B(e.filter((f,m)=>m!==g),`Removed ${o.name}.`,{at:g,what:"remove"}),children:"Remove"}):null]},`${g}:${o.href}`))}):e.length===1?(0,t.jsx)(we,{file:e[0],onCaption:o=>B([ve(e[0],o)],o?`${e[0].name} now says \u201C${o}\u201D.`:`${e[0].name} says its name again.`)}):null,L?(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:i,...ie?{accept:ie}:{},"data-graview-file-input":"","aria-label":`Choose ${ae}`,onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"picked")}}),(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!i?`Replace the ${V}`:`Choose ${ae}`}),Re?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:b,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"camera")}}),We?(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>b.current?.click(),children:"Take a photo"}):null]}):null,(0,t.jsxs)("span",{style:P,"data-graview-file-takes":"",children:["or drop or paste ",i?"them":"it"," here \xB7 ",s.kinds.length>0?ke(C.length>0?C:s.kinds):"any file",", up to ",_(s.maxBytes)]})]}):(0,t.jsx)("p",{style:{...P,margin:0},"data-graview-file-none":"",children:ne?`This host doesn\u2019t take ${a?"videos":"pictures"}, so none can be added here.`:"This host doesn\u2019t take files, so none can be added here."}),(0,t.jsx)("p",{"aria-live":"polite",style:{...P,margin:0,minHeight:p||T?void 0:0},"data-graview-file-status":"",children:p??T??""}),te.length>0?(0,t.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:te.map((o,g)=>(0,t.jsx)("p",{style:{margin:0},children:o},g))}):null]})}var ve=(e,n)=>{let{caption:i,...r}=e;return n?{...r,caption:n}:r};function we({file:e,onCaption:n}){let[i,r]=(0,h.useState)(e.caption??"");(0,h.useEffect)(()=>r(e.caption??""),[e.caption]);let a=()=>{let l=i.trim().slice(0,500);l!==(e.caption??"")&&n(l)};return(0,t.jsx)("input",{type:"text",value:i,placeholder:E(e)||x(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${E(e)||x(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:l=>r(l.target.value),onBlur:a,onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),a())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function Ee({field:e,label:n,labelStyle:i,valueStyle:r,style:a,children:l}){return(0,t.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...a},children:[(0,t.jsx)("dt",{style:i,children:n}),(0,t.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...r},children:l})]})}function Ce(e){let{nodeId:n,field:i,label:r,files:a}=e,{fields:l,commit:u}=me(n),s=l.find(p=>p.field===i&&p.takesValue),y=s?.shape,c=y?.type==="several"?y.of:y,b=y?.type==="several";return a.length===0&&c?.type!=="file"?null:(0,t.jsxs)(Ee,{...e,children:[(0,t.jsx)(X,{files:a,label:r}),s&&c?.type==="file"?(0,t.jsx)(Se,{value:a,thumbs:!1,several:b,image:c.image===!0,video:c.video===!0,label:r,onChange:p=>{let d=b?p:p[p.length-1];d!==void 0&&u(s,d)}}):null]})}function tt(e){switch(e.as){case"field":return e.read?e.files.length>0?(0,t.jsx)(Ee,{...e,children:(0,t.jsx)(X,{files:e.files,label:e.label})}):null:(0,t.jsx)(Ce,{...e});case"unfilled":return(0,t.jsx)(Ye,{...e});case"thumb":return(0,t.jsx)(Q,{...e});case"block":return e.files.length>0?(0,t.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:de.raised}:{}},children:e.view==="thumb"?(0,t.jsx)(Q,{file:e.files[0],size:72}):(0,t.jsx)(X,{files:e.files,label:e.label})}):null;case"control":{let n=(0,t.jsx)(Se,{value:Y(e.value),several:e.several,image:e.image,video:e.video===!0,label:e.label,onChange:i=>e.onChange(e.several?i:i[i.length-1])});return e.title===void 0?n:(0,t.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,t.jsx)("legend",{"data-graview-part":"label",children:e.title}),n]})}}}function Ye({nodeId:e,skip:n,labels:i,labelStyle:r,style:a}){let{store:l}=ge(),u=he(e),s=u?l.schema.tryDefinition(u.kind):void 0,y=pe(s).filter(c=>!n.includes(c)&&!(s?.display?.hide??[]).includes(c)&&Y(u?.[c]).length===0);return y.length===0?null:(0,t.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:y.map(c=>(0,t.jsx)(Ce,{nodeId:e,field:c,label:i?.[c]??oe(s,c),files:[],...r?{labelStyle:r}:{},...a?{style:a}:{}},c))})}export{Se as FilesEditor,Ve as SEND_EDGE,tt as drawFiles,ke as kindsWords,je as prepare,_e as send,_ as sizeWords,Fe as takes,z as typeWords};
@@ -1 +1 @@
1
- import{a as g}from"./chunk.2RVUDRRY.js";import{C as m,Eb as w,G as y,ta as a,wa as k}from"./chunk.V5MYKNL7.js";var d=i=>i?._zod?.def,h=/^\^\\d\{4\}-\\d\{2\}-\\d\{2\}\$$/;function b(i){let t=d(i),p=!0,f;for(let e=0;t&&e<4;e++){if(t.type==="optional"||t.type==="nullable")p=!1;else if(t.type==="default")p=!1,f=t.defaultValue;else break;t=d(t.innerType)}if(!t)return{why:"it is not a zod field"};let u=m(i),r={...p?{required:!0}:{},...f!==void 0?{default:f}:{},...u?{description:u}:{}},s=(t.checks??[]).map(e=>d(e)),c=a(i);if(c)return{spec:{type:c,...r}};if(k(i))return{spec:{type:"app-link",...r}};if(g(i))return{spec:{type:"text",format:"markdown",...r}};let l=w(i);if(l)return{spec:{type:l,...r}};switch(t.type){case"string":{let e=t.format;return e==="email"?{spec:{type:"email",...r}}:e==="url"?{spec:{type:"url",...r}}:e==="date"?{spec:{type:"date",...r}}:e==="datetime"||s.some(n=>n?.fn===y)?{spec:{type:"datetime",...r}}:s.some(n=>n?.format==="regex"&&h.test(String(n?.pattern?.source??"")))?{spec:{type:"date",...r}}:{spec:{type:"string",...r}}}case"number":{let e={};for(let n of s){let o=n?.value;typeof o=="number"&&(n?.check==="greater_than"&&n.inclusive?e.min=Math.max(e.min??o,o):n?.check==="less_than"&&n.inclusive?e.max=Math.min(e.max??o,o):n?.check==="multiple_of"&&(e.step=o))}return{spec:{type:s.some(n=>n?.format==="safeint"||n?.format==="int")?"integer":"number",...e,...r}}}case"boolean":return{spec:{type:"boolean",...r}};case"enum":{let e=Object.keys(t.entries??{});return e.length>0?{spec:{type:"enum",options:e,...r}}:{why:"it is an enum with no options"}}case"array":{let e=d(t.element),n=a(t.element)??(e?.type==="number"?"number":e?.type==="string"?"string":void 0);return n?{spec:{type:"list",of:n,...r}}:{why:`it is a list of ${String(e?.type??"something")}, and a document lists words, numbers, dates, images, videos or files`}}default:return{why:`it is a ${String(t.type)}, which a document has no field type for`}}}function L(i){let t=b(i);return"spec"in t?t.spec:void 0}export{L as a};
1
+ import{a as g}from"./chunk.DYW4D74X.js";import{D as m,Fb as w,H as y,ua as a,xa as k}from"./chunk.7MQ7UWVW.js";var d=i=>i?._zod?.def,h=/^\^\\d\{4\}-\\d\{2\}-\\d\{2\}\$$/;function b(i){let t=d(i),p=!0,f;for(let e=0;t&&e<4;e++){if(t.type==="optional"||t.type==="nullable")p=!1;else if(t.type==="default")p=!1,f=t.defaultValue;else break;t=d(t.innerType)}if(!t)return{why:"it is not a zod field"};let u=m(i),r={...p?{required:!0}:{},...f!==void 0?{default:f}:{},...u?{description:u}:{}},s=(t.checks??[]).map(e=>d(e)),c=a(i);if(c)return{spec:{type:c,...r}};if(k(i))return{spec:{type:"app-link",...r}};if(g(i))return{spec:{type:"text",format:"markdown",...r}};let l=w(i);if(l)return{spec:{type:l,...r}};switch(t.type){case"string":{let e=t.format;return e==="email"?{spec:{type:"email",...r}}:e==="url"?{spec:{type:"url",...r}}:e==="date"?{spec:{type:"date",...r}}:e==="datetime"||s.some(n=>n?.fn===y)?{spec:{type:"datetime",...r}}:s.some(n=>n?.format==="regex"&&h.test(String(n?.pattern?.source??"")))?{spec:{type:"date",...r}}:{spec:{type:"string",...r}}}case"number":{let e={};for(let n of s){let o=n?.value;typeof o=="number"&&(n?.check==="greater_than"&&n.inclusive?e.min=Math.max(e.min??o,o):n?.check==="less_than"&&n.inclusive?e.max=Math.min(e.max??o,o):n?.check==="multiple_of"&&(e.step=o))}return{spec:{type:s.some(n=>n?.format==="safeint"||n?.format==="int")?"integer":"number",...e,...r}}}case"boolean":return{spec:{type:"boolean",...r}};case"enum":{let e=Object.keys(t.entries??{});return e.length>0?{spec:{type:"enum",options:e,...r}}:{why:"it is an enum with no options"}}case"array":{let e=d(t.element),n=a(t.element)??(e?.type==="number"?"number":e?.type==="string"?"string":void 0);return n?{spec:{type:"list",of:n,...r}}:{why:`it is a list of ${String(e?.type??"something")}, and a document lists words, numbers, dates, images, videos or files`}}default:return{why:`it is a ${String(t.type)}, which a document has no field type for`}}}function L(i){let t=b(i);return"spec"in t?t.spec:void 0}export{L as a};
@@ -1 +1 @@
1
- import{H as $}from"./chunk.JHEVGLKB.js";import{Aa as U,G as L,a as I,b as R,c as E,d as f,e as k,j as W,m as F,v as j}from"./chunk.FOQZADMA.js";import{jd as s,pd as b,qd as r}from"./chunk.V5MYKNL7.js";import{b as H}from"./chunk.AJZBJBMO.js";var u=H(L(),1),_=e=>typeof e=="object"&&e!==null&&"idx"in e;function S(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":_(window.history.state)?"pages":null}function K(e){let n=e.face??(e.stop&&E(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:S(e.basePath)??n}function Q(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&S(e.basePath)===null}function X(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?R(f(window.location.hash)):void 0}function Z({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:N,places:w,opens:B,landed:V}){let{view:O,go:p}=U(),g=(0,u.useRef)({shown:t,view:O,onFace:i,landed:V});g.current={shown:t,view:O,onFace:i,landed:V};let m=(0,u.useRef)(n??"/"),P=()=>{m.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:h,onFace:A}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",b(c??m.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){P();let y=a===void 0?h:M(E(a),w),v=q(y)?z(B):y,T=v!==y&&v.overview?"graview":o,x=Y(T,v,N);p(x),window.history.pushState(null,"",`${b(s,{basePath:e})}${k(x)}`),A?.(T);return}A?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=S(e)??"pages",{shown:a,onFace:d,landed:h}=g.current;if(c==="pages"){P(),h?.(m.current),a!=="pages"&&d?.("pages");return}a==="pages"&&(p(M(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function M(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:j(i.kind)}:e}function Y(e,n,t){return e==="graview"?F(n,!0):n.overview?W(F(n,!1),$(n,t)):n}function q(e){return e.focusId===null&&e.overview!==!0}function z(e){return e??{...I,overview:!0}}export{K as a,Q as b,X as c,Z as d,M as e,Y as f,q as g,z as h};
1
+ import{H as $}from"./chunk.VP35BUUZ.js";import{Aa as U,G as L,a as I,b as R,c as E,d as f,e as k,j as W,m as F,v as j}from"./chunk.7L6LYXCV.js";import{ld as s,rd as b,sd as r}from"./chunk.7MQ7UWVW.js";import{b as H}from"./chunk.AJZBJBMO.js";var u=H(L(),1),_=e=>typeof e=="object"&&e!==null&&"idx"in e;function S(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":_(window.history.state)?"pages":null}function K(e){let n=e.face??(e.stop&&E(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:S(e.basePath)??n}function Q(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&S(e.basePath)===null}function X(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?R(f(window.location.hash)):void 0}function Z({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:N,places:w,opens:B,landed:V}){let{view:O,go:p}=U(),g=(0,u.useRef)({shown:t,view:O,onFace:i,landed:V});g.current={shown:t,view:O,onFace:i,landed:V};let m=(0,u.useRef)(n??"/"),P=()=>{m.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:h,onFace:A}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",b(c??m.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){P();let y=a===void 0?h:M(E(a),w),v=q(y)?z(B):y,T=v!==y&&v.overview?"graview":o,x=Y(T,v,N);p(x),window.history.pushState(null,"",`${b(s,{basePath:e})}${k(x)}`),A?.(T);return}A?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=S(e)??"pages",{shown:a,onFace:d,landed:h}=g.current;if(c==="pages"){P(),h?.(m.current),a!=="pages"&&d?.("pages");return}a==="pages"&&(p(M(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function M(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:j(i.kind)}:e}function Y(e,n,t){return e==="graview"?F(n,!0):n.overview?W(F(n,!1),$(n,t)):n}function q(e){return e.focusId===null&&e.overview!==!0}function z(e){return e??{...I,overview:!0}}export{K as a,Q as b,X as c,Z as d,M as e,Y as f,q as g,z as h};
@@ -0,0 +1,2 @@
1
+ import{$ as Z,Ca as Q,Db as I,F,G as Y,I as L,Ka as X,Kb as en,O,R as j,S as B,T as U,U as K,Va as v,Xa as nn,_ as J,ka as P}from"./chunk.7MQ7UWVW.js";var un=1e4,p=class{constructor(a){this.nodes=a}},rn=Symbol.for("@graview/core:far-record"),fn=e=>typeof e=="object"&&e!==null&&e[rn]===!0;function cn(e){let a={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(a,rn,{value:!0}),a}function Nn(e){let a=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${a} is not one this viewer may open`:`${a} has not been read`}var pn="",f=class extends Error{constructor(g,l){super(g);this.sentence=g;this.at=l}},z=class extends f{},V=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof p)&&typeof e.id=="string",tn=e=>{let a=new Set;return new p(e.filter(g=>!a.has(g.id)&&a.add(g.id)))},w=e=>e===null?"nothing":e instanceof p?"a set of records":Array.isArray(e)?"a list":V(e)?"a record":typeof e=="string"?"a word":typeof e;function on(e,a){let g=a.budget??un,l=(n,s)=>{if(g-=n,g<0)throw new z("this rule looks at too much of the graph to judge in one go",s)},u=a.today??L(),b=a.now??new Date().toISOString(),k=new Map,S=new Set,A=a.bindings,q=(n,s,t,o)=>{let d=`${n?.id}\0${s}`;if(k.has(d))return k.get(d);if(S.has(d))throw new f(`"${s}"${n?` of ${P(n.kind)}`:""} depends on itself`,o);S.add(d);let r=A;A=void 0;try{let i=$(t,n);return k.set(d,i),i}finally{A=r,S.delete(d)}},E=(n,s,t)=>{l(1,t);let o=a.kinds.get(n.kind),d=o?.computed?.get(s);if(d)return q(n,s,d,t);let r=o?.linked?.get(s);if(r){let y=Q(Object.hasOwn(n,s)?n[s]:void 0,r);l(y.length,t);let m=a.linked??X(a.graph),h=y.flatMap(x=>{let C=m?m(x):{unread:!0};return"record"in C?[cn(C.record)]:(a.onUnread?.({relation:s,ref:x,reason:"denied"in C?"denied":"unread"}),[])});return r.cardinality==="one"?h[0]??null:new p(h)}let i=Object.hasOwn(n,s);if(o?.fields.has(s)||i){let y=i?v(n,s,u):void 0;return y===void 0?null:y}let c=o?.edges.get(s);if(c){let y=a.graph.out(n.id,s);return l(y.length,t),c==="one"?y[0]??null:new p(y)}if(s==="id")return n.id;if(fn(n))return null;throw new f(`${P(n.kind)} has no field or relation called "${s}"`,t)},N=(n,s,t)=>{if(n instanceof p)return n;if(n===null)return new p([]);if(V(n))return new p([n]);throw new f(`${t}(\u2026) needs a set of records, and was given ${w(n)}`,s)},G=(n,s,t)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new f(`${t}(\u2026) needs a word, and was given ${w(n)}`,s)},_=(n,s,t)=>{let o=G(n,s,t);if(o===null)return null;let d=Date.parse(o.length===10?`${o}T00:00:00Z`:o);if(Number.isNaN(d))throw new f(`${t}(\u2026) needs a date, and "${o}" is not one`,s);return d},M=(n,s)=>V(n)&&V(s)?n.id===s.id:V(n)&&typeof s=="string"?n.id===s:typeof n=="string"&&V(s)?n===s.id:Array.isArray(n)&&Array.isArray(s)?n.length===s.length&&n.every((t,o)=>M(t,s[o])):n===s,R=(n,s,t)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new f(`${t} must be true or false, and was ${w(n)}`,s)},T=(n,s)=>$(s,n);function $(n,s){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(t=>$(t,s));case"ident":{let t=A&&Object.hasOwn(A,n.name)?A[n.name]:void 0;if(t!==void 0)return t;if(s)return E(s,n.name,n.at);throw new f(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let t=$(n.object,s);if(t===null)return null;if(V(t))return E(t,n.name,n.at);throw new f(`".${n.name}" needs a record before it, and was given ${w(t)}`,n.at)}case"unary":{let t=$(n.operand,s);if(n.op==="!")return!R(t,n.at,"what follows not");if(t===null)return null;if(typeof t!="number")throw new f(`"-" needs a number, and was given ${w(t)}`,n.at);return-t}case"where":{let t=N($(n.set,s),n.at,"where");return l(t.nodes.length,n.at),new p(t.nodes.filter(o=>R(T(o,n.filter),n.at,"a where condition")))}case"binary":return dn(n,s);case"call":return ln(n,s)}}function dn(n,s){if(n.op==="&&")return R($(n.left,s),n.at,"each side of and")&&R($(n.right,s),n.at,"each side of and");if(n.op==="||")return R($(n.left,s),n.at,"each side of or")||R($(n.right,s),n.at,"each side of or");let t=$(n.left,s),o=$(n.right,s);if(n.op==="&"||n.op==="|"||n.op==="-"&&(t instanceof p||o instanceof p)){let d=N(t,n.at,n.op).nodes,r=N(o,n.at,n.op).nodes;l(d.length+r.length,n.at);let i=new Set(r.map(c=>c.id));return tn(n.op==="|"?[...d,...r]:d.filter(c=>i.has(c.id)===(n.op==="&")))}switch(n.op){case"==":return M(t,o);case"!=":return!M(t,o);case"in":{if(o===null)return!1;if(o instanceof p)return o.nodes.some(d=>M(t,d));if(Array.isArray(o))return o.some(d=>M(t,d));if(typeof o=="string"&&typeof t=="string")return o.includes(t);throw new f(`"in" needs a list or a set on its right, and was given ${w(o)}`,n.at)}case"<":case"<=":case">":case">=":{if(t===null||o===null)return!1;if(!(typeof t=="number"&&typeof o=="number"||typeof t=="string"&&typeof o=="string"))throw new f(`cannot compare ${w(t)} with ${w(o)}`,n.at);return n.op==="<"?t<o:n.op==="<="?t<=o:n.op===">"?t>o:t>=o}default:{if(t===null||o===null)return null;if(n.op==="+"&&(typeof t=="string"||typeof o=="string")){let d=`${G(t,n.at,"+")}${G(o,n.at,"+")}`;if(d.length>1e4)throw new f("that makes a word too long",n.at);return d}if(typeof t!="number"||typeof o!="number")throw new f(`"${n.op}" needs numbers, and was given ${w(t)} and ${w(o)}`,n.at);return(n.op==="/"||n.op==="%")&&o===0?null:n.op==="+"?t+o:n.op==="-"?t-o:n.op==="*"?t*o:n.op==="/"?t/o:t%o}}}function ln(n,s){let t=(r,i=r)=>{if(n.args.length<r||n.args.length>i)throw new f(`${n.fn}(\u2026) takes ${r===i?r:`${r} to ${i}`} argument${i===1?"":"s"}`,n.at)},o=r=>$(n.args[r],s),d=r=>{let i=o(r);if(typeof i!="string")throw new f(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return i};switch(n.fn){case"out":case"in":{t(1,2);let r=(y,m)=>n.fn==="out"?a.graph.out(y,m):a.graph.in(y,m);if(n.args.length===2){let y=N(o(0),n.at,n.fn).nodes,m=d(1);return tn(y.flatMap(h=>{let x=r(h.id,m);return l(x.length+1,n.at),x}))}let i=d(0);if(!s)throw new f(`${n.fn}('${i}') needs a record to start from`,n.at);let c=r(s.id,i);return l(c.length,n.at),new p(c)}case"all":{t(1,2);let r=a.graph.nodesOfKind(d(0),{archived:n.args.length===2?o(1):!1});return l(r.length,n.at),new p(r)}case"archived":return t(0,1),nn(n.args.length===1?o(0):s);case"count":return t(1),N(o(0),n.at,"count").nodes.length;case"exists":return t(1),N(o(0),n.at,"exists").nodes.length>0;case"every":case"some":{t(2);let r=N(o(0),n.at,n.fn);l(r.nodes.length,n.at);let i=c=>R(T(c,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(i):r.nodes.some(i)}case"sum":case"min":case"max":{t(2);let r=N(o(0),n.at,n.fn);l(r.nodes.length,n.at);let i=n.args[1],c=i.t==="lit"&&typeof i.value=="string"?i.value:void 0,y=i.t==="ident"?`'${i.name}'`:c!==void 0?`'${c}'`:"\u2026",m=r.nodes.map(h=>i.t==="ident"?E(h,i.name,n.at):c!==void 0?E(h,c,n.at):T(h,i)).filter(h=>{if(h===null)return!1;if(typeof h!="number")throw new f(`${n.fn}(\u2026, ${y}) needs a number for each member, and found ${w(h)}`,n.at);return!0});return n.fn==="sum"?m.reduce((h,x)=>h+x,0):m.length===0?null:n.fn==="min"?Math.min(...m):Math.max(...m)}case"fact":{t(1);let r=d(0),i=a.kinds.get(pn)?.computed?.get(r);if(!i)throw new f(`no fact is called "${r}"`,n.at);return q(null,r,i,n.at)}case"first":return t(1),N(o(0),n.at,"first").nodes[0]??null;case"sort":{t(2,3);let r=N(o(0),n.at,"sort"),i=n.args.length===3?o(2):"asc";if(i!=="asc"&&i!=="desc")throw new f("sort(\u2026) goes 'asc' or 'desc'",n.at);let c=r.nodes.length;l(c+c*Math.ceil(Math.log2(c+1)),n.at);let y=r.nodes.map((h,x)=>({node:h,i:x,key:T(h,n.args[1])})),m=i==="desc"?-1:1;return y.sort((h,x)=>H(h.key,x.key,m,n.at)||h.i-x.i),new p(y.map(h=>h.node))}case"either":{if(n.args.length<1)throw new f("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let i=o(r);if(i!==null&&!(i instanceof p&&i.nodes.length===0))return i}return null}case"present":{t(1);let r=o(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof p?r.nodes.length>0:!0}case"len":{t(1);let r=o(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof p)return r.nodes.length;throw new f(`len(\u2026) needs a word or a list, and was given ${w(r)}`,n.at)}case"contains":case"startsWith":{t(2);let r=o(0),i=o(1);if(r===null||i===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(m=>M(m,i));let c=G(r,n.at,n.fn),y=G(i,n.at,n.fn);return n.fn==="contains"?c.toLowerCase().includes(y.toLowerCase()):c.startsWith(y)}case"lower":{t(1);let r=G(o(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"today":return t(0),u;case"now":return t(0),b;case"date":{t(1);let r=_(o(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{t(2);let r=_(o(0),n.at,n.fn),i=_(o(1),n.at,n.fn);if(r===null||i===null)return null;let c=(i-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(c):c}case"if":return t(3),R(o(0),n.at,"the condition in if(\u2026)")?o(1):o(2);default:throw new f(`"${n.fn}" is not a function the rule language knows`,n.at)}}function H(n,s,t,o){if(n===null||s===null)return n===s?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(s)){for(let r=0;r<Math.max(n.length,s.length);r++){let i=H(n[r]??null,s[r]??null,t,o);if(i!==0)return i}return 0}let d=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:w(r);if(d(n)!==d(s)||typeof n=="object"||typeof s=="object")throw new f(`sort(\u2026) cannot put ${w(n)} and ${w(s)} in order`,o);return typeof n=="string"?t*(n<s?-1:n>s?1:0):t*(Number(n)-Number(s))}return $(e,a.subject)}var Sn=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact","archived"];var Vn=(e,a,g,l)=>({severity:"error",code:e,path:a,message:g,...l?{fix:l}:{}}),Gn=(e,a,g,l)=>({severity:"warning",code:e,path:a,message:g,...l?{fix:l}:{}}),Mn=e=>e.some(a=>a.severity==="error");function On(e){return e.map(a=>`${a.severity==="error"?"\u2717":a.severity==="warning"?"!":"\xB7"} ${a.path||"(document)"}: ${a.message}${a.fix?` \u2014 ${a.fix}`:""}`).join(`
2
+ `)}var Cn=["money","percent","date","time","datetime","relative","upper","lower","count","words","and","plural","excerpt"],gn={getNode:()=>{},allNodes:()=>[],allEdges:()=>[],nodesOfKind:()=>[],edgesOfKind:()=>[],out:()=>[],in:()=>[],neighbors:()=>[],has:()=>!1};function jn(e,a,g,l=[],u,b=D){return W(e,a,g,l,u,b)}var yn=(e,a)=>e.capital?J(a):a;function hn(e){return e?a=>{let g=e.tryDefinition(a.kind)?.label;return g?g(a):D(a)}:D}var sn=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],an=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function mn(e,a){return!Number.isInteger(e)||e<0||e>99?K(e,a):e<20?sn[e]:e%10===0?an[e/10]:`${an[Math.floor(e/10)]}-${sn[e%10]}`}function wn(e){return/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:`${e}s`}var D=e=>String(e.name??e.title??e.label??e.id);function W(e,a,g,l=[],u,b=D){if(a==="plural"){let k=e instanceof p?e.nodes.length:Array.isArray(e)?e.length:typeof e=="number"?e:null;return k===null||l[0]===void 0?"\u2014":k===1?l[0]:l[1]??wn(l[0])}if(e===null)return"\u2014";if(e instanceof p)return a==="count"?String(e.nodes.length):a==="and"?Z(e.nodes.map(b)):e.nodes.map(b).join(", ");if(Array.isArray(e)){if(a==="count")return String(e.length);let k=e.map(S=>W(S,void 0,g,[],u,b));return a==="and"?Z(k):k.join(", ")}if(typeof e=="object")return b(e);switch(a){case"words":return typeof e=="number"?mn(e,u?.locale):String(e);case"money":return typeof e=="number"?I(e,u):String(e);case"percent":return typeof e=="number"?K(e,u?.locale,{style:"percent",maximumFractionDigits:0}):String(e);case"upper":return String(e).toUpperCase();case"lower":return String(e).toLowerCase();case"excerpt":return en(String(e),Number(l[0])||void 0);case"date":return O(U(String(e),u?.timeZone)??String(e).slice(0,10),u?.locale);case"time":return typeof e=="string"&&F.test(e)?O(e,u?.locale):B(String(e),u?.locale,u?.timeZone);case"datetime":return typeof e=="string"&&F.test(e)?O(e,u?.locale):j(String(e),u?.locale,u?.timeZone);case"relative":{let k=U(String(e),u?.timeZone),S=k===void 0?Date.parse(String(e)):Date.parse(`${k}T00:00:00Z`);if(Number.isNaN(S))return String(e);let A=Math.round((S-Date.parse(`${g}T00:00:00Z`))/864e5);return A===0?"today":A===1?"tomorrow":A===-1?"yesterday":A>0?`in ${A} days`:`${-A} days ago`}default:return typeof e=="string"&&F.test(e)?O(e,u?.locale):typeof e=="string"&&Y.test(e)?j(e,u?.locale,u?.timeZone):String(e)}}function Un(e,a){let g=a.today??L(),l=a.name??hn(a.graph?.schema);return e.map(u=>{if(u.text!==void 0)return u.text;try{let b=on(u.expr,{graph:a.graph??gn,subject:a.node,kinds:a.kinds,today:g,budget:a.budget??500,...a.bindings?{bindings:a.bindings}:{}});return yn(u,W(b,u.format,g,u.formatArgs,a.money,l))}catch(b){if(b instanceof f)return"\u2014";throw b}}).join("")}export{p as a,Nn as b,pn as c,f as d,z as e,on as f,Sn as g,Vn as h,Gn as i,Mn as j,On as k,Cn as l,gn as m,jn as n,yn as o,hn as p,Un as q};
@@ -0,0 +1 @@
1
+ import"./chunk.GZHZLJBF.js";import{n as D}from"./chunk.EBTYR5CZ.js";import"./chunk.OJGHDWI6.js";import"./chunk.OWL5GZ6U.js";import"./chunk.RSYFIL2Z.js";import{a as $}from"./chunk.R7F6UJVG.js";import"./chunk.DYW4D74X.js";import"./chunk.VP35BUUZ.js";import{G as P,R as C}from"./chunk.7L6LYXCV.js";import"./chunk.SDO3U72B.js";import{Ma as w,Oa as R,Sa as c,Y as S}from"./chunk.7MQ7UWVW.js";import"./chunk.2AZTW66C.js";import{b as k}from"./chunk.AJZBJBMO.js";var m=k(P(),1);var e=k(C(),1),W=[["","Does not repeat"],["day","Daily"],["week","Weekly"],["month","Monthly"],["year","Yearly"]],E=r=>`${r}${r%100>=11&&r%100<=13?"th":["th","st","nd","rd"][r%10]??"th"}`,v={display:"flex",flexWrap:"wrap",gap:"6px 12px",alignItems:"center"};function N({value:r,onChange:d,start:p,label:s,name:l="repeat"}){let f=(0,m.useId)(),a=c(r)?r:void 0,i=typeof p=="string"&&/^\d{4}-\d{2}-\d{2}/.test(p)?p:void 0,u=i?w[new Date(`${i.slice(0,10)}T00:00:00Z`).getUTCDay()]:void 0,o=t=>{let n={...a??{every:"week"},...t};for(let b of Object.keys(n))n[b]===void 0&&delete n[b];d(n)},y=a?.every??"week",g=a?.on??(u?[u]:[]);return(0,e.jsxs)("fieldset",{"data-graview-part":"field","data-graview-field":"repeat","data-graview-repeat":l,style:{display:"grid",gap:8,border:"1px solid var(--graview-edge)",borderRadius:8,padding:"8px 12px",margin:0,minWidth:0},children:[(0,e.jsx)("legend",{"data-graview-part":"label",style:{padding:"0 4px"},children:s}),(0,e.jsxs)("div",{style:v,children:[(0,e.jsx)("label",{htmlFor:`${f}-every`,children:"Repeats"}),(0,e.jsx)("select",{id:`${f}-every`,name:`${l}.every`,value:a?.every??"",onChange:t=>{let n=t.target.value;d(n===""?void 0:{...a?.interval?{interval:a.interval}:{},...a?.until?{until:a.until}:{},every:n})},"data-graview-part":"control",children:W.map(([t,n])=>(0,e.jsx)("option",{value:t,children:n},t))}),a?(0,e.jsxs)("label",{style:v,children:["every",(0,e.jsx)("input",{type:"number",min:1,max:99,name:`${l}.interval`,"aria-label":`Every how many ${y}s`,value:a.interval??1,onChange:t=>o({interval:Number(t.target.value)>1?Math.min(99,Math.round(Number(t.target.value))):void 0}),style:{width:"4.5em"},"data-graview-part":"control"}),y,(a.interval??1)>1?"s":""]}):null]}),a?.every==="week"?(0,e.jsxs)("div",{role:"group","aria-label":"On",style:v,children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"On"}),w.map((t,n)=>(0,e.jsxs)("label",{style:{display:"inline-flex",gap:4,alignItems:"center",minHeight:24},children:[(0,e.jsx)("input",{type:"checkbox",name:`${l}.on`,value:t,checked:g.includes(t),onChange:b=>{let h=w.filter(x=>x===t?b.target.checked:g.includes(x));o({on:h.length===0||h.length===1&&h[0]===u?void 0:h})}}),S(n,"short")]},t))]}):null,a?.every==="month"?(0,e.jsxs)("label",{style:v,children:["On",(0,e.jsxs)("select",{name:`${l}.on`,value:a.on?.[0]===-1?"last":"",onChange:t=>o({on:t.target.value==="last"?[-1]:void 0}),"data-graview-part":"control",children:[(0,e.jsx)("option",{value:"",children:i?`the ${E(Number(i.slice(8,10)))}`:"the same day"}),(0,e.jsx)("option",{value:"last",children:"the last day"})]})]}):null,a?(0,e.jsxs)("label",{style:v,children:["Until",(0,e.jsx)("input",{type:"date",name:`${l}.until`,value:a.until??"",onChange:t=>o({until:t.target.value||void 0}),"data-graview-part":"control"})]}):null,(0,e.jsx)("p",{"aria-live":"polite","data-graview-repeat-said":"",style:{margin:0,color:"var(--graview-ink-dim)",fontSize:"0.8125rem"},children:a?$(i??"",a):"Does not repeat"})]})}function M({nodeId:r,field:d,start:p,value:s,label:l}){let{fields:f,commit:a}=D(r),i=f.find(t=>t.field===R(d)&&t.takesValue&&t.open.length===0),[u,o]=(0,m.useState)(!1),[y,g]=(0,m.useState)(c(s)?s:void 0);return i?u?(0,e.jsxs)("form",{onSubmit:t=>{t.preventDefault(),o(!1),a(i,y??null)},style:{display:"grid",gap:6,marginTop:6},children:[(0,e.jsx)(N,{value:y,onChange:g,start:p,label:l,name:R(d)}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("button",{type:"submit","data-graview-repeat-keep":d,children:"Keep"}),(0,e.jsx)("button",{type:"button",onClick:()=>o(!1),children:"Cancel"})]})]}):(0,e.jsx)("button",{type:"button","data-graview-repeat-open":d,onClick:()=>(g(c(s)?s:void 0),o(!0)),style:{marginInlineStart:8,fontSize:"0.75rem",padding:"1px 8px",borderRadius:999,minHeight:24},children:c(s)?"Change how it repeats":"Repeat\u2026"}):null}export{M as RepeatEditor,N as RepeatPicker};
@@ -0,0 +1 @@
1
+ import{b,c as m,d as g}from"./chunk.4P3LS2OE.js";import"./chunk.YPEZZLOY.js";import"./chunk.ZUJZVK2X.js";import"./chunk.7MQ7UWVW.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";var A=new Set(["input","select","textarea"]),y=r=>r.namespaceURI==="http://www.w3.org/1999/xhtml"&&A.has(r.localName),E=r=>r.localName==="select"||r.type==="checkbox"||r.type==="radio",v=r=>r.type==="checkbox"||r.type==="radio"?!r.checked:r.localName!=="select"&&r.value==="";function h(r){return r.type==="checkbox"||r.type==="radio"?`checked:${r.checked}`:r.localName==="select"&&r.multiple?`selected:${[...r.selectedOptions].map(d=>d.value).join("\0")}`:`value:${r.value}`}function T(r=d=>d.isTrusted){let d=new WeakMap,u=new WeakSet,s=new WeakMap,o={heard(e,t){if(!(!y(t)||!r(e))&&(e.type==="input"||e.type==="change"&&E(t))&&((E(t)||v(t))&&u.delete(t),v(t)&&s.delete(t),d.set(t,h(t)),t.type==="radio"&&t.name)){let i=t.getRootNode();for(let c of i.querySelectorAll?.('input[type="radio"]')??[])c.name===t.name&&d.set(c,h(c))}},filled(e){d.delete(e),s.delete(e),y(e)&&!v(e)?u.add(e):u.delete(e)},press(e,t,i){if(e.type!=="click"||!r(e))return;let c=t.closest("[data-act]");if(!(!c||y(c)&&c.hasAttribute("data-save")))return o.collect(c,i)},collect(e,t){if(!e.hasAttribute("data-act")||!t.contains(e))return;let i=e.closest("[data-record]"),c=e.closest("fieldset, [role='group']")??t,l=[];for(let n of c.querySelectorAll("input[name], select[name], textarea[name]")){let a=n,f=!u.has(a)&&d.get(a)===h(a);if(a.type==="radio"){if(!a.checked)continue;l.push({name:a.name,value:a.value,typed:f,empty:!1,chosen:!0});continue}if(a.localName==="select"){l.push({name:a.name,value:a.value,typed:f,empty:a.value===""&&!f,chosen:!0});continue}if(a.type==="checkbox"){l.push({name:a.name,value:a.checked,typed:f,empty:!a.checked&&!u.has(a)&&!f});continue}let k=(a.type==="number"||a.type==="range")&&a.value!==""&&Number.isFinite(a.valueAsNumber)?a.valueAsNumber:a.value,w=f?s.get(a):void 0;l.push({name:a.name,value:k,typed:f,empty:a.value===""&&!f,...w?{from:w}:{}})}return{as:e.getAttribute("data-act")??"",...i&&t.contains(i)?{record:i.getAttribute("data-record")}:{},fields:l}},prefilled(e,t){u.delete(e),s.set(e,t),d.set(e,h(e))}};return o}var M=1e3;function x(r){let d=r.getAttribute("data-debounce")?.trim(),u=d?Number(d):Number.NaN;return Number.isFinite(u)?Math.min(1e4,Math.max(250,Math.round(u))):M}function R(r){let d=r.trusted??(e=>e.isTrusted),u=r.timers??{set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e)},s=new Map,o=(e,t)=>{let i=s.get(e);i&&u.clear(i.handle),s.delete(e);let c=r.reader.collect(e,t);c&&r.save(c,e)};return{heard(e,t,i){if(!y(t)||!d(e)||!t.hasAttribute("data-act"))return;let c=t.getAttribute("data-save");if(e.type==="input"&&c==="input"){let l=s.get(t);l&&u.clear(l.handle),s.set(t,{root:i,handle:u.set(()=>o(t,i),x(t))})}else e.type==="change"&&(c==="change"||c==="input"&&s.has(t))&&o(t,i)},flush(){for(let[e,{root:t}]of[...s])o(e,t)},get waiting(){return s.size}}}var N=new Set(["text","search","email","url","tel","number"]);function O(r,d,u,s){for(let o of r.querySelectorAll("input[data-prefill], textarea[data-prefill]")){let e=o;if(u.has(e))continue;let t=e.getAttribute("data-prefill")??"";if(t===""||e.getAttribute("name")!==t||e.localName==="input"&&!N.has(e.type))continue;if(e.value!==""){u.add(e);continue}let c=[...(e.closest("fieldset, [role='group']")??r).querySelectorAll("[data-act]")],l=e.closest("[data-record]"),n=new Set(c.map(p=>p.closest("[data-record]")?.getAttribute("data-record")).filter(p=>typeof p=="string")),a=l&&r.contains(l)?l.getAttribute("data-record"):n.size===1?[...n][0]:void 0;if(!a)continue;let f=s({record:a,field:t,acts:c.map(p=>p.getAttribute("data-act")??"")});if(f!==void 0){if(e.value=f,u.add(e),e.value!==f){e.value="";continue}d.prefilled(e,{record:a,field:t,value:f})}}}function L(r,d,u,s){let o=g(d,s.as);if(!o)return m("undeclared",`This view may not ask for \u201C${s.as}\u201D: its manifest does not name it.`);let e=r.allMutations().find(n=>n.name===o.act);if(!e)return m("unknown-act","There is no act by that name here.");let t={};if(s.record!==void 0){let n=o.record??e.subject?.arg;if(!n)return m("unbound",`\u201C${s.as}\u201D is not done to a record.`);if(!u.has(s.record))return m("unbound","That press is bound to a record this view was not shown.");t[n]=s.record}for(let[n,a]of Object.entries(o.constants??{})){if(n in t)return m("malformed",`\u201C${n}\u201D is both the bound record and a constant.`);t[n]=a}let i=e.input?.shape??{},c=new Set(Object.keys(i)),l=new Set;for(let n of s.fields)if(!(!c.has(n.name)||n.name in t)){if(l.has(n.name))return m("malformed",`Two fields here are called \u201C${n.name}\u201D.`);if(l.add(n.name),n.typed&&n.chosen){let a=b(i[n.name])?.find(f=>String(f)===String(n.value));if(a!==void 0)t[n.name]=a;else if(typeof n.value=="string"&&u.has(n.value))t[n.name]=n.value;else return m("untyped",`\u201C${n.name}\u201D was a choice among the view's own words, not one this app declares, so it was not sent.`)}else{if(n.typed&&n.from&&!(s.record===n.from.record&&n.name===n.from.field&&S(r,o,n.from.record,n.from.field)))return m("untyped",`\u201C${n.name}\u201D was filled in from a record for an act that writes it back there, not for this one, so it was not sent.`);if(n.typed&&n.from&&String(n.value)===n.from.value)t[n.name]=r.graph.getNode(n.from.record)?.[n.name]??n.value;else if(n.typed)t[n.name]=n.value;else if(!n.empty)return m("untyped",`\u201C${n.name}\u201D was filled in by the view, not typed by you, so it was not sent.`)}}return{ok:!0,name:o.act,args:t}}function S(r,d,u,s){let o=r.allMutations().find(c=>c.name===d.act),e=o?.subject;if(!o||!e||(d.record??e.arg)!==e.arg||s===e.arg||Object.hasOwn(d.constants??{},s)||!Object.hasOwn(o.input.shape??{},s)||Object.keys(o.writesOther??{}).length>0)return!1;let t=r.graph.getNode(u)?.kind,i=t===void 0?void 0:r.schema.tryDefinition(t);return!i||e.kinds!=="*"&&!e.kinds.includes(t)||!Object.hasOwn(i.fields.shape??{},s)?!1:o.writes?.includes(s)??!1}function j(r,d,u,s,o){if(!s.has(o.record))return;let e=r.seenBy(d).graph.getNode(o.record);if(!e||!o.acts.some(c=>{let l=g(u,c);if(!l||!S(r,l,o.record,o.field))return!1;let n=r.allMutations().find(a=>a.name===l.act).subject;return r.permits({name:l.act,args:{[n.arg]:o.record}},d).ok}))return;let i=e[o.field];return typeof i=="string"?i:typeof i=="number"&&Number.isFinite(i)?String(i):void 0}export{M as SAVE_DEBOUNCE_MS,T as createPressReader,R as createSaver,O as fillPrefills,L as judgePress,j as prefillOf,x as saveDebounceOf,S as writesBack};
@@ -0,0 +1 @@
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,R as n,ua as o}from"./chunk.7L6LYXCV.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.WVUJXDXZ.js","./chunk.QWY54AVN.js","./chunk.T4Q6OLZU.js","./chunk.R2B2ZAWI.js","./chunk.7XCBIID7.js","./chunk.MI2HL3LQ.js","./chunk.TMBFLZNH.js","./chunk.GZHZLJBF.js","./chunk.EBTYR5CZ.js","./chunk.OJGHDWI6.js","./chunk.OWL5GZ6U.js","./chunk.RSYFIL2Z.js","./chunk.R7F6UJVG.js","./chunk.DYW4D74X.js","./chunk.VP35BUUZ.js","./chunk.7L6LYXCV.js","./chunk.SDO3U72B.js","./chunk.7MQ7UWVW.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.T4M4MLOS.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.EBTYR5CZ.js","./chunk.OJGHDWI6.js","./chunk.OWL5GZ6U.js","./chunk.RSYFIL2Z.js","./chunk.R7F6UJVG.js","./chunk.DYW4D74X.js","./chunk.VP35BUUZ.js","./chunk.7L6LYXCV.js","./chunk.SDO3U72B.js","./chunk.7MQ7UWVW.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.NH6D6TWY.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.GZHZLJBF.js","./chunk.EBTYR5CZ.js","./chunk.OJGHDWI6.js","./chunk.OWL5GZ6U.js","./chunk.RSYFIL2Z.js","./chunk.R7F6UJVG.js","./chunk.DYW4D74X.js","./chunk.VP35BUUZ.js","./chunk.7L6LYXCV.js","./chunk.SDO3U72B.js","./chunk.7MQ7UWVW.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.TX65ZO27.js")))),E=m.part((e,r)=>(0,s.jsx)(e.RepeatPicker,{...r}),{quiet:!0}),W=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.RSYFIL2Z.js","./chunk.R7F6UJVG.js","./chunk.DYW4D74X.js","./chunk.VP35BUUZ.js","./chunk.7L6LYXCV.js","./chunk.SDO3U72B.js","./chunk.7MQ7UWVW.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.FCPH4YZN.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,E as d,W as e,M as f,N as g};