graview 0.1.54 → 0.1.56

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 (197) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +6 -6
  3. package/dist/index.js.map +1 -1
  4. package/dist/preview/{chunk.XTT6ERI3.js → chunk.22MIRLL6.js} +1 -1
  5. package/dist/preview/chunk.2BLRCT3E.js +1 -0
  6. package/dist/preview/chunk.2DETYEJM.js +1 -0
  7. package/dist/preview/{chunk.AN5QCSVK.js → chunk.2E6EWVWR.js} +1 -1
  8. package/dist/preview/{chunk.RBYRT2I2.js → chunk.2HZGUVB2.js} +1 -1
  9. package/dist/preview/{chunk.ZBHFCSKO.js → chunk.2OX4YI46.js} +1 -1
  10. package/dist/preview/{chunk.E5JX5LWY.js → chunk.2YNZVNCA.js} +1 -1
  11. package/dist/preview/chunk.3V2WH6F7.js +1 -0
  12. package/dist/preview/chunk.3X3GLNWQ.js +1 -0
  13. package/dist/preview/chunk.45VIF2SX.js +5 -0
  14. package/dist/preview/{chunk.VGOWGOGD.js → chunk.4EUH6TLG.js} +2 -2
  15. package/dist/preview/chunk.4EY6WPSM.js +2 -0
  16. package/dist/preview/{chunk.Y2DFDMT6.js → chunk.4KMY24YC.js} +1 -1
  17. package/dist/preview/chunk.4YI6656P.js +1 -0
  18. package/dist/preview/{chunk.D2PJG5N7.js → chunk.5B4HNQGR.js} +1 -1
  19. package/dist/preview/chunk.5MS2TQFX.js +1 -0
  20. package/dist/preview/chunk.5MSWUTDB.js +1 -0
  21. package/dist/preview/{chunk.BOMYLOCX.js → chunk.64IKLRUS.js} +1 -1
  22. package/dist/preview/{chunk.VYKEIKY5.js → chunk.65Q5MKDW.js} +1 -1
  23. package/dist/preview/{chunk.3IEJQAK7.js → chunk.6HLKAUWF.js} +1 -1
  24. package/dist/preview/chunk.6Q6BW4QT.js +2 -0
  25. package/dist/preview/chunk.7ECBGIUK.js +1 -0
  26. package/dist/preview/{chunk.J2Z6WLCH.js → chunk.7NP2I2UP.js} +1 -1
  27. package/dist/preview/{chunk.5C43AM3X.js → chunk.7O6Z3BFR.js} +1 -1
  28. package/dist/preview/chunk.7RJGEU3Y.js +1 -0
  29. package/dist/preview/{chunk.TUNHUTQ5.js → chunk.7U2JO7ET.js} +1 -1
  30. package/dist/preview/chunk.7Z2PRPYE.js +1 -0
  31. package/dist/preview/{chunk.3JMZHCB4.js → chunk.7Z4USR3Y.js} +1 -1
  32. package/dist/preview/chunk.AGTFYPXY.js +1 -0
  33. package/dist/preview/{chunk.XZJ6XX5I.js → chunk.AIK3Z25Y.js} +1 -1
  34. package/dist/preview/{chunk.ZDDWXRPK.js → chunk.AKVBU5K5.js} +1 -1
  35. package/dist/preview/chunk.AKW6NR3X.js +1 -0
  36. package/dist/preview/{chunk.2DFWOLL2.js → chunk.AM2YRNOQ.js} +1 -1
  37. package/dist/preview/{chunk.2WSRJGW2.js → chunk.APXYWI3L.js} +1 -1
  38. package/dist/preview/{chunk.7SCENHVG.js → chunk.AQCU6TPV.js} +1 -1
  39. package/dist/preview/{chunk.B2X6DA2Q.js → chunk.AZUTYY2S.js} +1 -1
  40. package/dist/preview/chunk.BJUUSIQY.js +1 -0
  41. package/dist/preview/{chunk.FRZQSSGE.js → chunk.BNEOLRQG.js} +1 -1
  42. package/dist/preview/chunk.BT7RLFPO.js +1 -0
  43. package/dist/preview/{chunk.4GHXAWIE.js → chunk.C2VFDBSG.js} +1 -1
  44. package/dist/preview/{chunk.C3AHDHX7.js → chunk.CGM7OER2.js} +1 -1
  45. package/dist/preview/{chunk.4F5M5XZG.js → chunk.CKV2QCH5.js} +1 -1
  46. package/dist/preview/{chunk.4KTHJY5N.js → chunk.CU2NQ5WF.js} +1 -1
  47. package/dist/preview/{chunk.ARRLAAG6.js → chunk.D4LN33J2.js} +1 -1
  48. package/dist/preview/{chunk.W6NCLU5Y.js → chunk.D6BMAGPR.js} +1 -1
  49. package/dist/preview/{chunk.RCFAHV5N.js → chunk.D6KF72MZ.js} +1 -1
  50. package/dist/preview/{chunk.L7MFTL5S.js → chunk.DH7M57SE.js} +1 -1
  51. package/dist/preview/chunk.DPPT6WAJ.js +2 -0
  52. package/dist/preview/{chunk.45HTFSWD.js → chunk.DTSTUC2W.js} +1 -1
  53. package/dist/preview/{chunk.VTO6UWUP.js → chunk.DWMAFMYZ.js} +1 -1
  54. package/dist/preview/chunk.DZYLH5IM.js +1 -0
  55. package/dist/preview/{chunk.PZ4G5QA5.js → chunk.E33EJU3Q.js} +1 -1
  56. package/dist/preview/{chunk.33YC5RCB.js → chunk.E4EN4X5F.js} +1 -1
  57. package/dist/preview/{chunk.DF7IPT7V.js → chunk.E4HSSGF7.js} +1 -1
  58. package/dist/preview/{chunk.PZWJUQAO.js → chunk.E5XNQTEU.js} +1 -1
  59. package/dist/preview/{chunk.FWKNR7XF.js → chunk.EC5IWN74.js} +2 -2
  60. package/dist/preview/chunk.FBR4HJ2Q.js +1 -0
  61. package/dist/preview/{chunk.AKLVSZ5A.js → chunk.FCUDBMGC.js} +1 -1
  62. package/dist/preview/chunk.FOQENWF5.js +1 -0
  63. package/dist/preview/{chunk.SLBWPVIY.js → chunk.FQLNBIQ5.js} +1 -1
  64. package/dist/preview/{chunk.562IVJHX.js → chunk.G3ORIU7C.js} +1 -1
  65. package/dist/preview/chunk.GNQW4JOG.js +18 -0
  66. package/dist/preview/chunk.GUP7LC5O.js +21 -0
  67. package/dist/preview/{chunk.FWZF7X6A.js → chunk.HFVMGTNL.js} +2 -2
  68. package/dist/preview/chunk.HVN2DVP3.js +1 -0
  69. package/dist/preview/{chunk.4WH4N4V7.js → chunk.I2C5LPB5.js} +1 -1
  70. package/dist/preview/{chunk.BPWSQVEN.js → chunk.IF4FCQPG.js} +1 -1
  71. package/dist/preview/{chunk.U7GN6UPR.js → chunk.ILSK2E3R.js} +1 -1
  72. package/dist/preview/{chunk.2LMB5E6N.js → chunk.IRMO4FUC.js} +1 -1
  73. package/dist/preview/chunk.IT763BYH.js +1 -0
  74. package/dist/preview/chunk.IUQOSPQX.js +1 -0
  75. package/dist/preview/{chunk.Y36WSKL5.js → chunk.J3YBEZKE.js} +1 -1
  76. package/dist/preview/{chunk.4V64RBCK.js → chunk.JHFHIG4P.js} +1 -1
  77. package/dist/preview/chunk.JL4DGITZ.js +1 -0
  78. package/dist/preview/{chunk.463PGKOL.js → chunk.JQY2UKU6.js} +1 -1
  79. package/dist/preview/{chunk.IDYPQ45A.js → chunk.JZDKHWRL.js} +1 -1
  80. package/dist/preview/{chunk.6BBB7SJL.js → chunk.K2JE3PD7.js} +1 -1
  81. package/dist/preview/chunk.K4MO22RM.js +1 -0
  82. package/dist/preview/{chunk.NEJSKMJV.js → chunk.K5YLQAFW.js} +1 -1
  83. package/dist/preview/{chunk.IMHUKSPM.js → chunk.KBL4Y4UN.js} +1 -1
  84. package/dist/preview/chunk.KMEKMCKG.js +3 -0
  85. package/dist/preview/{chunk.3ZONBC6L.js → chunk.LKK7VQBA.js} +1 -1
  86. package/dist/preview/chunk.LLOZKUCA.js +1 -0
  87. package/dist/preview/{chunk.YXRKZMS5.js → chunk.LP3SHWJG.js} +1 -1
  88. package/dist/preview/chunk.LVOVPU64.js +1 -0
  89. package/dist/preview/chunk.MEJUAV3Y.js +1 -0
  90. package/dist/preview/{chunk.7JCUSYS5.js → chunk.MFDSWA2W.js} +1 -1
  91. package/dist/preview/{chunk.JTOAZ2IR.js → chunk.MJMVGW6Z.js} +1 -1
  92. package/dist/preview/{chunk.SDO3DD77.js → chunk.MLRPCZVS.js} +1 -1
  93. package/dist/preview/{chunk.OCV46AFN.js → chunk.MORMTKVR.js} +1 -1
  94. package/dist/preview/{chunk.FMP6NDRZ.js → chunk.N3Q5CPVA.js} +1 -1
  95. package/dist/preview/{chunk.VW6X53E7.js → chunk.N7EEPFYV.js} +1 -1
  96. package/dist/preview/{chunk.NGWHV4G6.js → chunk.NBLMANHT.js} +1 -1
  97. package/dist/preview/{chunk.5RH6FO3K.js → chunk.NFU4UM6F.js} +1 -1
  98. package/dist/preview/chunk.NPAWTPLQ.js +25 -0
  99. package/dist/preview/{chunk.B6PKKEY3.js → chunk.NQ4VGKEC.js} +1 -1
  100. package/dist/preview/{chunk.MNW2ZBQ6.js → chunk.NUE5VG4G.js} +1 -1
  101. package/dist/preview/{chunk.XBDFXFWM.js → chunk.O6LDZWLR.js} +1 -1
  102. package/dist/preview/chunk.OBUKZQCZ.js +1 -0
  103. package/dist/preview/{chunk.GKLDSHHH.js → chunk.ONGZ3YQF.js} +1 -1
  104. package/dist/preview/chunk.OYGPNO7A.js +1 -0
  105. package/dist/preview/chunk.PJCVFYFU.js +1 -0
  106. package/dist/preview/{chunk.IYYP6QUH.js → chunk.PMPDLE56.js} +1 -1
  107. package/dist/preview/{chunk.PR2TSHE7.js → chunk.PRV3KYT6.js} +2 -2
  108. package/dist/preview/chunk.Q7X2IVLH.js +1 -0
  109. package/dist/preview/chunk.QAIYYIZQ.js +1 -0
  110. package/dist/preview/chunk.QNNRSPIJ.js +2 -0
  111. package/dist/preview/{chunk.KI6M3EWZ.js → chunk.QSO5BP2H.js} +1 -1
  112. package/dist/preview/{chunk.WICMCZ27.js → chunk.QW3QLE53.js} +1 -1
  113. package/dist/preview/{chunk.WHGEDJB2.js → chunk.QYFZ7AZS.js} +2 -2
  114. package/dist/preview/{chunk.Q6RUTFU3.js → chunk.RDL6652E.js} +1 -1
  115. package/dist/preview/{chunk.MDWCX3YU.js → chunk.RR2IFETZ.js} +1 -1
  116. package/dist/preview/{chunk.R7RDUW37.js → chunk.RXYE2DAJ.js} +1 -1
  117. package/dist/preview/chunk.SDLUWRGI.js +1 -0
  118. package/dist/preview/chunk.SOTB6C5A.js +1 -0
  119. package/dist/preview/{chunk.3SOJJAMY.js → chunk.SRC37GNP.js} +1 -1
  120. package/dist/preview/{chunk.CB7IUKY7.js → chunk.SVAQGVS4.js} +1 -1
  121. package/dist/preview/chunk.T2RME6XF.js +1 -0
  122. package/dist/preview/{chunk.COWJTVZV.js → chunk.T6HG2XIP.js} +1 -1
  123. package/dist/preview/{chunk.6TILXTP6.js → chunk.TAIYNHSW.js} +1 -1
  124. package/dist/preview/chunk.TAJ2R44N.js +1 -0
  125. package/dist/preview/{chunk.BUDEUNBN.js → chunk.TQCRFZ53.js} +1 -1
  126. package/dist/preview/{chunk.ZYW7Q5EN.js → chunk.TXWCTHMI.js} +1 -1
  127. package/dist/preview/chunk.UE5YS3GN.js +1 -0
  128. package/dist/preview/{chunk.C6HBYRGJ.js → chunk.UQQAGT3R.js} +1 -1
  129. package/dist/preview/chunk.USB6B6L3.js +104 -0
  130. package/dist/preview/{chunk.KRVEAIKW.js → chunk.USQNSNIA.js} +1 -1
  131. package/dist/preview/{chunk.AZGXBTOQ.js → chunk.V3NPUAPB.js} +1 -1
  132. package/dist/preview/{chunk.NDI5OWIB.js → chunk.VDD3RHLB.js} +1 -1
  133. package/dist/preview/{chunk.ULSN3ASK.js → chunk.VEOS25PQ.js} +1 -1
  134. package/dist/preview/chunk.VIQ6EF2O.js +1 -0
  135. package/dist/preview/{chunk.OZ4EJ5M6.js → chunk.VLBY66PB.js} +2 -2
  136. package/dist/preview/chunk.VSM72NVF.js +1 -0
  137. package/dist/preview/{chunk.GVUJCOKD.js → chunk.VYW7DSUW.js} +2 -2
  138. package/dist/preview/{chunk.DTJ4FIHM.js → chunk.WMB2NNBD.js} +1 -1
  139. package/dist/preview/{chunk.KJGNLWU3.js → chunk.WPJVMVAL.js} +1 -1
  140. package/dist/preview/{chunk.CB5DGKR5.js → chunk.XGCOWCA2.js} +1 -1
  141. package/dist/preview/chunk.XJFAUOJS.js +1 -0
  142. package/dist/preview/{chunk.7TMWMW4W.js → chunk.XY5EVI22.js} +1 -1
  143. package/dist/preview/chunk.YEJ4LNUP.js +5 -0
  144. package/dist/preview/{chunk.FCZ7UFJI.js → chunk.YL5ZCRHQ.js} +1 -1
  145. package/dist/preview/{chunk.MAWP27FD.js → chunk.YLMOGGEP.js} +1 -1
  146. package/dist/preview/{chunk.WVWXNW74.js → chunk.ZFXHZZHW.js} +1 -1
  147. package/dist/preview/index.html +52 -51
  148. package/dist/preview/page.js +2 -2
  149. package/package.json +6 -6
  150. package/dist/preview/chunk.25P5SDNR.js +0 -1
  151. package/dist/preview/chunk.27O4LIDU.js +0 -1
  152. package/dist/preview/chunk.3G5DEGFA.js +0 -1
  153. package/dist/preview/chunk.3MZIWKNG.js +0 -5
  154. package/dist/preview/chunk.3V2WXZU3.js +0 -1
  155. package/dist/preview/chunk.4BX3KLAA.js +0 -1
  156. package/dist/preview/chunk.4TGQ6Z6E.js +0 -1
  157. package/dist/preview/chunk.57VTD3CU.js +0 -1
  158. package/dist/preview/chunk.5M62CMLA.js +0 -1
  159. package/dist/preview/chunk.5VF2RT4H.js +0 -1
  160. package/dist/preview/chunk.5XAIP3BS.js +0 -1
  161. package/dist/preview/chunk.5ZWE72VJ.js +0 -1
  162. package/dist/preview/chunk.6SPORDJC.js +0 -1
  163. package/dist/preview/chunk.7UD2JR6J.js +0 -1
  164. package/dist/preview/chunk.AG7CUSSV.js +0 -1
  165. package/dist/preview/chunk.C6HI3LRB.js +0 -1
  166. package/dist/preview/chunk.D6ACCKYJ.js +0 -1
  167. package/dist/preview/chunk.EC7I33WI.js +0 -1
  168. package/dist/preview/chunk.GHPCSNM6.js +0 -21
  169. package/dist/preview/chunk.HLDMTKUP.js +0 -1
  170. package/dist/preview/chunk.J3OX474P.js +0 -1
  171. package/dist/preview/chunk.JCFYZEMY.js +0 -1
  172. package/dist/preview/chunk.JLB4QP6Q.js +0 -1
  173. package/dist/preview/chunk.JXGDVJ4N.js +0 -1
  174. package/dist/preview/chunk.K2J26XMB.js +0 -104
  175. package/dist/preview/chunk.KLJDBYAZ.js +0 -1
  176. package/dist/preview/chunk.LNOWO3IY.js +0 -2
  177. package/dist/preview/chunk.LOUICR7K.js +0 -1
  178. package/dist/preview/chunk.LU3B3SZH.js +0 -1
  179. package/dist/preview/chunk.LVOL2LEC.js +0 -1
  180. package/dist/preview/chunk.LYFEGG6E.js +0 -1
  181. package/dist/preview/chunk.MPMROUZA.js +0 -1
  182. package/dist/preview/chunk.MVRNEC3Y.js +0 -2
  183. package/dist/preview/chunk.OLKFEHWB.js +0 -1
  184. package/dist/preview/chunk.PCNEM3WE.js +0 -1
  185. package/dist/preview/chunk.QB7RYJ67.js +0 -5
  186. package/dist/preview/chunk.RLO3RDYH.js +0 -2
  187. package/dist/preview/chunk.RYMSHMLM.js +0 -1
  188. package/dist/preview/chunk.SF4BYBH6.js +0 -25
  189. package/dist/preview/chunk.SG7YVKH4.js +0 -1
  190. package/dist/preview/chunk.T42H5RXN.js +0 -1
  191. package/dist/preview/chunk.TI4OSTQV.js +0 -1
  192. package/dist/preview/chunk.VFMC45E7.js +0 -1
  193. package/dist/preview/chunk.VWQ57LTT.js +0 -18
  194. package/dist/preview/chunk.Y36MLVMT.js +0 -1
  195. package/dist/preview/chunk.Z6O7RUSR.js +0 -1
  196. package/dist/preview/chunk.ZAGP3OKY.js +0 -1
  197. package/dist/preview/chunk.ZUBC3UFG.js +0 -2
@@ -1 +0,0 @@
1
- import{b as mt}from"./chunk.C6HBYRGJ.js";import{a as pt}from"./chunk.3IEJQAK7.js";import{f as dt}from"./chunk.AKLVSZ5A.js";import{a as F,f as q}from"./chunk.ZUBC3UFG.js";import{$ as rt,F as Q,G as X,I as k,Kb as ft,O as G,R as tt,T as nt,U as et,da as _,fa as M,gd as ct,ha as ot,hb as lt,ka as at,kb as ut,ma as st}from"./chunk.3MZIWKNG.js";import{e as it}from"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";function J(t){let e=[],n=!0;for(let r of t){if(r.text.length===0)continue;let s=r.as==="close"||r.text===","||r.text===":"||r.text.startsWith("'")||n;e.push({part:r,space:!s}),n=r.as==="open"}return e}function D(t,e){return J(t).map(({part:n,space:r})=>`${r?" ":""}${e?n.said??n.text:n.text}`).join("")}function Et(t){return D(t,!1)}function Pt(t){return D(t,!0)}function yt(t,e=!1){let n=e?t.said:t.text;return t.record!==void 0?`${t.record} \u2014 ${n}`:n}function z(t){let e=u=>J(u).map(({part:o,space:a})=>({...o,space:a})),n=e(t.parts),r=t.when&&t.when.length>0?e(t.when):void 0,s=u=>`${D(n,u)}${r?`, when ${D(r,u)}`:""}`;return{...t,parts:n,...r?{when:r}:{},text:s(!1),said:s(!0)}}function Lt(t,e=!1){return t.line?yt(t.line,e):t.message}var gt=60,O=t=>({text:t,as:"name"}),c=(t,e)=>e===void 0?{text:t,as:"word"}:{text:t,as:"word",said:e},L=(t,e)=>e===void 0||e===t?{text:t,as:"value"}:{text:t,as:"value",said:e},R=(t,e)=>({text:t,as:"op",said:e}),v={text:"(",as:"open"},w={text:")",as:"close"},N={text:"\u2014",as:"value",said:"empty"},V={">=":["\u2265","at least"],"<=":["\u2264","at most"],"<":["<","less than"],">":[">","more than"],"==":["=","is"],"!=":["\u2260","is not"]},B={">=":"<","<=":">","<":">=",">":"<=","==":"!=","!=":"=="},At={"+":["+","plus"],"-":["\u2212","minus"],"*":["\xD7","times"],"/":["\xF7","divided by"],"%":["mod","modulo"]},xt=t=>t.t==="binary"&&t.op in V;function I(t){return rt(t)}function bt(t){let{schema:e}=t,n=l=>l===null?void 0:e.tryDefinition(l),r=(l,m)=>{let g=n(l)?.edges;return g&&Object.hasOwn(g,m)?g[m]:void 0},s=(l,m)=>{let g=r(l,m)?.to;return Array.isArray(g)&&g.length===1?g[0]:null},u=(l,m)=>{let g=(e.edge(m)?.from??[]).filter(W=>{let K=r(W,m)?.to;return l===null||K==="*"||Array.isArray(K)&&K.includes(l)});return g.length===1?g[0]:null},o=(l,m)=>r(l,m)?M(m).toLowerCase():I(at(n(l),m)),a=l=>I(ot(e,l)),d=l=>I(dt(e).get(l)?.label??M(l)),b=l=>I(st(n(l),l)),i=(l,m)=>{let g=l===null?void 0:t.formatOf?.(l,m);if(g?.format)return g;let W=t.said?.get(m);return W?{...g,format:W}:g},p=l=>_(e.tryDefinition(l.kind),l),h=t.money?.locale,y=(l,m)=>{if(l==null)return N;if(l instanceof F){if(l.nodes.length===0)return N;let A=l.nodes.slice(0,3).map(p),Y=l.nodes.length-A.length;return L(Y>0?`${A.join(", ")} and ${Y} more`:A.length>1?`${A.slice(0,-1).join(", ")} and ${A[A.length-1]}`:A[0])}if(Array.isArray(l))return L(`{${l.map(A=>y(A,m).text).join(", ")}}`,l.map(A=>y(A,m).text).join(" or "));if(typeof l=="object")return L(p(l));if(typeof l=="boolean")return L(l?"yes":"no");let g=m?.format??(m?i(m.kind,m.key):void 0);if(typeof l=="number")return L(g&&g.format!=="date"?ft(l,{...t.money,...g}):et(l,h));if(Q.test(l)||g?.format==="date")return L(G(nt(l,t.money?.timeZone)??l.slice(0,10),h));if(X.test(l))return L(tt(l,h,t.money?.timeZone));let W=m&&m.kind!==null?n(m.kind)?.display?.format?.[m.key]:void 0;if(W)return L(W(l));let K=l.length>gt?`${l.slice(0,gt-1).trimEnd()}\u2026`:l;return L(/^[a-z][a-z0-9]*([-_][a-z0-9]+)*$/.test(K)?K.replace(/[-_]+/g," "):K)};return{definition:n,relation:r,farOf:s,nearOf:u,fieldName:o,plural:a,noun:b,factName:d,formatOf:i,valueWords:y,locale:h}}function P(t,e,n){if(t.t==="ident")return{kind:e,key:t.name};if(t.t==="member")return{kind:E(t.object,e,n),key:t.name};if(t.t==="call"&&(t.fn==="sum"||t.fn==="min"||t.fn==="max")&&t.args.length===2){let r=E(t.args[0],e,n),s=t.args[1];if(s.t==="ident")return{kind:r,key:s.name};if(s.t==="lit"&&typeof s.value=="string")return{kind:r,key:s.value}}if(t.t==="binary"&&(t.op==="+"||t.op==="-"))return P(t.left,e,n)??P(t.right,e,n);if(t.t==="call"&&t.fn==="if"&&t.args.length===3)return P(t.args[1],e,n)??P(t.args[2],e,n)}function E(t,e,n){switch(t.t){case"ident":return n.relation(e,t.name)?n.farOf(e,t.name):null;case"member":return n.farOf(E(t.object,e,n),t.name);case"where":return E(t.set,e,n);case"binary":return t.op==="|"||t.op==="&"||t.op==="-"?E(t.left,e,n):null;case"call":{let r=s=>{let u=t.args[s];return u?.t==="lit"&&typeof u.value=="string"?u.value:void 0};return t.fn==="all"?r(0)??null:t.fn==="out"?t.args.length===2?n.farOf(E(t.args[0],e,n),r(1)??""):n.farOf(e,r(0)??""):t.fn==="in"?t.args.length===2?n.nearOf(E(t.args[0],e,n),r(1)??""):n.nearOf(e,r(0)??""):(t.fn==="first"||t.fn==="sort")&&t.args[0]?E(t.args[0],e,n):null}default:return null}}function j(t){return t.t==="binary"?t.op==="||"?H(t)?4:1:t.op==="&&"?2:t.op in V||t.op==="in"?4:t.op==="+"||t.op==="-"?5:t.op==="*"||t.op==="/"||t.op==="%"?6:4.5:t.t==="unary"&&t.op==="!"?3:t.t==="where"?3.5:9}var $=t=>t.t==="lit",x=(t,e)=>t.t==="call"&&t.fn===e;function C(t,e){return t.t==="binary"&&t.op===e?[...C(t.left,e),...C(t.right,e)]:[t]}function H(t){if(t.t!=="binary"||t.op!=="||")return;let e=[];e.push(...C(t,"||"));let n,r=[];for(let s of e){if(s.t!=="binary"||s.op!=="=="||!$(s.right)||typeof s.right.value!="string"||n&&JSON.stringify(ht(n))!==JSON.stringify(ht(s.left)))return;n=s.left,r.push(s.right)}return n?{subject:n,values:r}:void 0}var ht=t=>JSON.parse(JSON.stringify(t,(e,n)=>e==="at"?void 0:n));function f(t,e,n,r){let s=(u,o,a=e)=>j(u)<o?[v,...f(u,a,n),w]:f(u,a,n);switch(t.t){case"lit":return[n.valueWords(t.value,r)];case"list":return[n.valueWords(t.items.map(u=>u.t==="lit"?u.value:null),r)];case"ident":return[O(n.fieldName(e,t.name))];case"member":{let u=x(t.object,"first")&&t.object.args[0]&&x(t.object.args[0],"all"),o=E(t.object,e,n);if(u&&o)return e!==null&&n.fieldName(e,t.name)===n.fieldName(o,t.name)&&n.definition(e)?.fields?.shape&&Object.prototype.hasOwnProperty.call(n.definition(e).fields.shape,t.name)?[O(`${n.noun(o)}'s ${n.fieldName(o,t.name)}`)]:[O(n.fieldName(o,t.name))];let a=f(t.object,e,n),d=a[a.length-1];return a.length===1&&d?.as==="name"?[O(`${d.text}'s ${n.fieldName(o,t.name)}`)]:[...a,c("'s"),O(n.fieldName(o,t.name))]}case"unary":return t.op==="-"?[R("\u2212","minus"),...s(t.operand,7)]:T(t.operand,e,n);case"where":{let u=E(t.set,e,n),o=f(t.filter,u,n),a=o.every(d=>d.as==="name"||d.as==="word"&&d.text==="not");return[...s(t.set,4),...a?[]:[c("with")],...j(t.filter)<=2?[v,...o,w]:o]}case"binary":return Rt(t,e,n);case"call":return jt(t,e,n)}}function T(t,e,n){return xt(t)?Rt({...t,op:B[t.op]},e,n):x(t,"present")||x(t,"exists")?[...f(t.args[0],e,n),R("=","is"),N]:t.t==="ident"?[c("not"),O(n.fieldName(e,t.name))]:[c("not"),v,...f(t,e,n),w]}function Rt(t,e,n){let r=(o,a)=>j(o)<a?[v,...f(o,e,n),w]:f(o,e,n);if(t.op==="&&"||t.op==="||"){let o=H(t);if(o){let d=P(o.subject,e,n);return[...f(o.subject,e,n),R("\u2208","is one of"),n.valueWords(o.values.map(b=>b.value),d)]}let a=t.op==="&&"?2:1;return[...r(t.left,a),c(t.op==="&&"?"and":"or"),...r(t.right,a+.5)]}if(t.op in V){if($(t.right)&&typeof t.right.value=="boolean"&&(t.op==="=="||t.op==="!="))return t.op==="=="===t.right.value?f(t.left,e,n):T(t.left,e,n);let[o,a]=V[t.op],d=P(t.left,e,n),b=P(t.right,e,n);return[...S(t.left,e,n,b),R(o,a),...S(t.right,e,n,d)]}if(t.op==="in")return[...r(t.left,5),R("\u2208","is one of"),...S(t.right,e,n,P(t.left,e,n))];let s=At[t.op];if(s){let o=j(t);return[...r(t.left,o),R(s[0],s[1]),...r(t.right,o+.5)]}let u={"|":"or","&":"and also","-":"except"};return[...r(t.left,5),c(u[t.op]??t.op),...r(t.right,5)]}function S(t,e,n,r){return t.t==="lit"||t.t==="list"?f(t,e,n,r):j(t)<5?[v,...f(t,e,n),w]:f(t,e,n)}function jt(t,e,n){let r=o=>t.args[o],s=o=>{let a=t.args[o];return a?.t==="lit"&&typeof a.value=="string"?a.value:void 0},u=o=>{let a=r(o);return j(a)<9&&a.t!=="where"?[v,...f(a,e,n),w]:f(a,e,n)};switch(t.fn){case"out":{let o=s(t.args.length-1)??"",a=O(M(o).toLowerCase());return t.args.length===2?[a,c("of"),...u(0)]:[a]}case"in":{let o=s(t.args.length-1)??"",a=t.args.length===2?n.nearOf(E(r(0),e,n),o):n.nearOf(e,o),d=O(a?n.plural(a):M(o).toLowerCase());return t.args.length===2?[d,c("of"),...u(0)]:[d]}case"all":{let o=s(0),a=t.args[1]?.t==="lit"?t.args[1].value:void 0,d=a===!0?[c("archived")]:a==="all"?[c("archived or not")]:[];return a===!0?[...d,O(o?n.plural(o):"everything")]:[O(o?n.plural(o):"everything"),...d]}case"fact":{let o=s(0);return[O(o?n.factName(o):"fact")]}case"count":return[c("number of"),...u(0)];case"exists":return[...u(0),R("\u2260","is not"),N];case"present":return[...f(r(0),e,n),R("\u2260","is not"),N];case"some":case"every":{let o=E(r(0),e,n),a=r(1);return[...t.fn==="some"?[c("some")]:[],...u(0),c(t.fn==="some"?"with":"all with"),...j(a)<=2?[v,...f(a,o,n),w]:f(a,o,n)]}case"sum":case"min":case"max":{let o=E(r(0),e,n),a=r(1),d=a.t==="lit"&&typeof a.value=="string"?[O(n.fieldName(o,a.value))]:j(a)<9?[v,...f(a,o,n),w]:f(a,o,n);return[c(t.fn==="sum"?"total":t.fn==="min"?"least":"most"),...d,c("of"),...u(0)]}case"first":{let o=r(0);if(x(o,"all")){let a=o.args[0]?.value;if(typeof a=="string")return[O(`the ${n.noun(a)}`)]}return[c("first of"),...u(0)]}case"sort":return[...u(0),c("by"),...f(r(1),E(r(0),e,n),n)];case"len":return[c("length of"),...f(r(0),e,n)];case"lower":return f(r(0),e,n);case"contains":case"startsWith":return[...f(r(0),e,n),c(t.fn==="contains"?"contains":"starts with"),...S(r(1),e,n,P(r(0),e,n))];case"today":return[L("today")];case"now":return[L("now")];case"date":return $(r(0))&&typeof r(0).value=="string"?[L(G(String(r(0).value),n.locale))]:f(r(0),e,n);case"days":case"hours":{let o=t.fn,[a,d]=[r(0),r(1)];return x(d,"today")||x(d,"now")?[c(`${o} since`),...f(a,e,n)]:x(a,"today")||x(a,"now")?[c(`${o} until`),...f(d,e,n)]:[c(`${o} from`),...f(a,e,n),c("to"),...f(d,e,n)]}case"if":return[v,...f(r(1),e,n),c("if"),...f(r(0),e,n),c(","),c("else"),...f(r(2),e,n),w];case"either":return t.args.flatMap((o,a)=>a===0?f(o,e,n):[c(","),c("else"),...f(o,e,n)]);default:return[c(t.fn),v,...t.args.flatMap((o,a)=>a===0?f(o,e,n):[c(","),...f(o,e,n)]),w]}}function U(t,e){let n=bt(e),r=t.over==="graph"?null:t.over;return z({...r===null?{}:{kind:r},parts:f(t.require,r,n),...t.when?{when:f(t.when,r,n)}:{}})}function Z(t,e,n){let r=bt(e),s=t.over==="graph"?null:t.over,u=n.subject,o=i=>{try{return q(i,{...n,budget:2e3})}catch{return}},a=(i,p)=>{let h=S(i,s,r,p);if(i.t==="lit"||i.t==="list"||x(i,"today")||x(i,"now")||x(i,"date"))return h;let y=o(i);if(y===void 0)return h;let l=P(i,s,r),m=r.valueWords(y,l?{...l,format:r.formatOf(l.kind,l.key)??(p?r.formatOf(p.kind,p.key):void 0)}:p);return y instanceof F?[...h,c(":"),m]:[...h,m]},d=i=>{if(i.t==="binary"&&i.op==="&&"){let p=[];p.push(...C(i,"&&"));let h=p.filter(y=>o(y)!==!0);return(h.length>0?h:p).flatMap((y,l)=>[...l>0?[c("and")]:[],...j(y)<=2?[v,...d(y),w]:d(y)])}if(i.t==="binary"&&i.op==="||"){let p=H(i);if(p){let y=P(p.subject,s,r);return[...a(p.subject),R("\u2209","is not one of"),r.valueWords(p.values.map(l=>l.value),y)]}let h=[];return h.push(...C(i,"||")),h.flatMap((y,l)=>[...l>0?[c("and")]:[],...j(y)<=2?[v,...d(y),w]:d(y)])}if(i.t==="binary"&&i.op in V){if($(i.right)&&typeof i.right.value=="boolean"&&(i.op==="=="||i.op==="!="))return i.op==="=="===i.right.value?T(i.left,s,r):f(i.left,s,r);let p=B[i.op],[h,y]=V[p],l=P(i.left,s,r),m=P(i.right,s,r);if($(i.right)&&i.right.value===null)return[...p==="=="?S(i.left,s,r,m):a(i.left,m),R(h,y),N];let g=p==="=="&&($(i.right)||$(i.left));return[...g?S(i.left,s,r,m):a(i.left,m),R(h,y),...g?S(i.right,s,r,l):a(i.right,l)]}if(i.t==="binary"&&i.op==="in")return[...a(i.left),R("\u2209","is not one of"),...S(i.right,s,r,P(i.left,s,r))];if(i.t==="unary"&&i.op==="!"){let p=i.operand;return xt(p)?d({...p,op:B[p.op]}):x(p,"present")||x(p,"exists")?[...a(p.args[0]),R("\u2260","is not"),N]:p.t==="ident"?f(p,s,r):[c("not"),v,...T(p,s,r),w]}if(x(i,"present")||x(i,"exists"))return[...f(i.args[0],s,r),R("=","is"),N];if(x(i,"some"))return[...f(i,s,r).slice(1),R("=","is"),N];if(x(i,"every")&&i.args.length===2){let p=o(i.args[0]);if(p instanceof F){let h=p.nodes.filter(y=>{try{return q(i.args[1],{...n,subject:y,budget:2e3})!==!0}catch{return!0}});return[...f(i,s,r),c(","),c("not"),r.valueWords(new F(h))]}}return i.t==="ident"?[c("not"),O(r.fieldName(s,i.name))]:[c("not"),v,...f(i,s,r),w]},b;try{b=d(t.require)}catch{b=[c("not"),v,...f(t.require,s,r),w]}return z({...s===null?{}:{kind:s},parts:b,...u?{record:_(e.schema.tryDefinition(u.kind),u)}:{}})}function vt(t){let e=new Map;for(let n of t??[])n.expr?.t==="ident"&&n.format&&(n.format==="money"||n.format==="percent"||n.format==="date")&&e.set(n.expr.name,n.format);return e}function St(t){return(e,n)=>{let r=t[e]?.fields?.[n],s=r?.format??(r?.type==="date"?"date":void 0);return s||r?.unit?{...s?{format:s}:{},...r?.unit?{unit:r.unit}:{}}:void 0}}function Ot(t,e){return{schema:e,said:vt(t.says),...t.declared?{formatOf:St(t.declared)}:{},...t.money?{money:t.money}:{}}}function Qt(t,e){return t.shape?U(t.shape,Ot(t.shape,e)):void 0}var wt=new WeakMap;function Nt(t,e){let n=new Map(t.allInvariants().map(r=>[r.name,r]));return e.map(r=>{let s=$t(r),u=n.get(s.invariant)?.shape;if(!u||s.status&&s.status!=="violated")return s;let o=s.subjectId?t.graph.getNode(s.subjectId):void 0;if(u.over!=="graph"&&!o)return s;let a=u.kinds;a||(a=wt.get(t.schema),a||wt.set(t.schema,a=pt(t.schema)));try{let d=t.today?.()??u.today?.()??k(),b=Z(u,Ot(u,t.schema),{graph:t.graph,subject:o??null,kinds:a,today:d});return{...s,line:b,...u.says?{}:{message:`${s.message} \u2014 ${b.text}`}}}catch{return s}})}function Wt(){ut((t,e,n,r)=>Nt({graph:t,schema:t.schema,allInvariants:()=>e,today:()=>r},n)),mt(Kt)}function Kt(t,e,n,r){let s=e.graph,u=lt.from(t.schema,s.snapshot(),{validate:!1});for(let b of n?[...r].reverse().map(it):r)try{u.applyPrimitives([b],{restoring:!0})}catch{}let o=b=>t.violations(void 0,b),a=o(n?u:s),d=o(n?s:u);return{...ct(t.allInvariants(),a,d),violationsAfter:d}}function $t(t){if(!t.line)return t;let{line:e,...n}=t,r=` \u2014 ${e.text}`;return n.message.endsWith(r)?{...n,message:n.message.slice(0,-r.length)}:n}Wt();export{Z as brokenLineOf,Wt as judgeWithLines,Kt as judgedForASeat,Lt as problemWords,Qt as ruleLine,U as ruleLineOf,yt as ruleLineWords,J as ruleSpacing,Pt as ruleSpoken,Et as ruleText,$t as unlined,Nt as withLines};
@@ -1 +0,0 @@
1
- import{b as f}from"./chunk.VWQ57LTT.js";import"./chunk.K2J26XMB.js";import"./chunk.B2X6DA2Q.js";import"./chunk.QB7RYJ67.js";import"./chunk.UGFDSE37.js";import{l as g}from"./chunk.EC7I33WI.js";import"./chunk.PXQVXBNG.js";import"./chunk.GVUJCOKD.js";import"./chunk.3ZONBC6L.js";import"./chunk.MDWCX3YU.js";import"./chunk.CB5DGKR5.js";import"./chunk.GKLDSHHH.js";import"./chunk.OCV46AFN.js";import"./chunk.4KTHJY5N.js";import"./chunk.PZ4G5QA5.js";import"./chunk.Y36MLVMT.js";import"./chunk.MPMROUZA.js";import"./chunk.XTT6ERI3.js";import"./chunk.5RH6FO3K.js";import"./chunk.L7MFTL5S.js";import"./chunk.XZJ6XX5I.js";import"./chunk.4F5M5XZG.js";import"./chunk.LVOL2LEC.js";import"./chunk.3G5DEGFA.js";import"./chunk.OZ4EJ5M6.js";import"./chunk.Q6RUTFU3.js";import"./chunk.AZGXBTOQ.js";import"./chunk.XOZU4OFA.js";import"./chunk.AG7CUSSV.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.3V2WXZU3.js";import"./chunk.7UD2JR6J.js";import"./chunk.BUDEUNBN.js";import"./chunk.3IEJQAK7.js";import"./chunk.AKLVSZ5A.js";import"./chunk.ZUBC3UFG.js";import"./chunk.GZHZLJBF.js";import"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{G as b,T as h}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import{Nd as n}from"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as t}from"./chunk.AJZBJBMO.js";var m=t(b(),1),a=t(h(),1);function P({store:c,auto:y,brand:i,views:u,presence:s,steering:r,overview:o,scope:d,titleLevel:w=2,quickAsk:l,props:e}){let v=(0,m.useMemo)(()=>g({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:y?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:v}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(f,{context:{store:c,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...o?{overview:o}:{},titleLevel:w,views:u,settings:e.app.settings??[],...s?{presence:s}:{},...i?{brand:i}:{},...e.locale?{locale:e.locale}:{},...e.timeZone?{timeZone:e.timeZone}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{},...e.subscriptions?{subscriptions:e.subscriptions}:{},dismissals:e.dismissals,whileAway:e.whileAway,...e.signIn?{signIn:e.signIn}:{},...l!==void 0?{quickAsk:l}:{}},...e.pages?{registry:e.pages}:{},...r?{steering:r}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.hrefOf?{hrefOf:e.hrefOf}:e.routing==="address"?{}:{hrefOf:!1},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{P as PagesContent};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk.SDO3DD77.js";import"./chunk.G4JJXA63.js";import"./chunk.BOMYLOCX.js";import"./chunk.45HTFSWD.js";import"./chunk.KRVEAIKW.js";import"./chunk.XOZU4OFA.js";import"./chunk.AG7CUSSV.js";import"./chunk.C6HBYRGJ.js";import"./chunk.WVUJXDXZ.js";import"./chunk.3V2WXZU3.js";import"./chunk.7UD2JR6J.js";import"./chunk.BUDEUNBN.js";import"./chunk.3IEJQAK7.js";import"./chunk.AKLVSZ5A.js";import"./chunk.ZUBC3UFG.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{i as draftAnswer,h as draftFromLens,b as draftSight,l as draftView,a as isDraftFailure,c as judgeLens,d as lensEditOf,f as lensFromSpec,j as recipeDraft,g as recipeOfLens,m as refineDraft,o as runDraftTool,e as takeBackEditOf,k as templateDraft,n as withReaderLenses};
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as q,g as te,h as ne}from"./chunk.5RH6FO3K.js";import{a as X,b as Z,c as ee}from"./chunk.ZDDWXRPK.js";import{b}from"./chunk.LOUICR7K.js";import{d as B}from"./chunk.4F5M5XZG.js";import{a as Q}from"./chunk.AZGXBTOQ.js";import{a as I}from"./chunk.5ZWE72VJ.js";import{j as K}from"./chunk.FWZF7X6A.js";import{G as P,Ga as Y,J as U,O as T,P as M,Ra as _,T as G,Va as J,ba as w,ja as V}from"./chunk.SF4BYBH6.js";import{a as F}from"./chunk.SDO3U72B.js";import{Ya as z,da as E,fa as $,wb as A}from"./chunk.3MZIWKNG.js";import{b as L}from"./chunk.AJZBJBMO.js";var y=L(P(),1);var ie=L(P(),1);function ae(){let{ai:i,aiDesk:n}=w(),{entries:r}=U(n),a=i.off===!0;return(0,ie.useEffect)(()=>{a||n.load()},[n,a]),a?[]:r}var e=L(G(),1),oe=Y(F(()=>(__graviewPreload(import.meta.url,["./chunk.VYKEIKY5.js","./chunk.IDYPQ45A.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.27O4LIDU.js")))),ue=oe.part((i,n)=>(0,e.jsx)(i.InteractionRow,{...n}),{quiet:!0,as:"li"}),he=oe.part((i,n)=>(0,e.jsx)(i.ActivityFilter,{...n}),{quiet:!0,as:"div"}),re=(i,n,r=se(i,[n]))=>({intent:n.intent,author:n.author.kind,...n.author.id?{authorId:n.author.id}:{},by:n.author,...n.ops[0]?.via?{via:n.ops[0].via}:{},...n.lineage?{basis:Q(n.lineage)}:{},touched:[...new Set(n.ops.filter(a=>!A(a)).flatMap(a=>a.writes))],...ye(n.ops.filter(a=>!A(a)).flatMap(a=>a.writes),r),batch:n.id,at:n.at,...n.lineage?.interaction?{interaction:n.lineage.interaction}:{},seq:n.ops.at(-1).seq+1,...n.ops.every(A)?{withheld:!0}:{}});function ce(i=4){let{store:n,principal:r}=w(),a=M(n,r),d=a.log.length;return(0,y.useMemo)(()=>{let s=a.batches(),l=se(a,s);return Z(s,o=>a.log.get(o)).reverse().slice(0,i).map(o=>{if("batch"in o){let p=re(a,o.batch,l);return o.typed?{...p,intent:X(o.typed,a.schema,a.graph),batches:o.typed.batches.filter(c=>!c.undone).map(c=>c.id)}:p}let u=[...o.digest.batches].reverse().map(p=>re(a,p,l));return{intent:ee(o.digest),author:o.digest.author.kind,...o.digest.author.id?{authorId:o.digest.author.id}:{},by:o.digest.author,touched:[...new Set(u.flatMap(p=>p.touched))],batch:"",...u[0]?.at?{at:u[0].at}:{},seq:u[0]?.seq??0,digest:u}})},[a,d,i])}function se(i,n){let r=new Map;for(let a of n)for(let d of a.ops)if(!A(d))for(let s of d.primitives)(s.op==="add-node"||s.op==="remove-node")&&s.node&&r.set(s.node.id,E(i.schema.tryDefinition(s.node.kind),s.node));return r}function ye(i,n){let r={};for(let a of i){let d=n.get(a);d!==void 0&&(r[a]=d)}return Object.keys(r).length>0?{named:r}:{}}function fe({change:i}){let{store:n,principal:r,seats:a,people:d}=w();return(0,e.jsxs)("strong",{style:{fontWeight:600},children:[i.author==="human"&&i.by?.onBehalfOf===void 0&&(i.authorId===void 0||r.id===void 0||i.authorId===r.id)?"you":z(i.by??{kind:i.author,id:i.authorId},{graph:n.graph,schema:n.schema,seats:a,people:d}),I(i.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",I(i.via)]}):null]})}function me({change:i,goes:n}){let{store:r}=w(),[a,d]=(0,y.useState)(!1),s=i.digest??[];return(0,e.jsxs)("li",{"data-testid":"activity-digest",style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)(fe,{change:i})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:i.intent})]}),(0,e.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":a,onClick:()=>d(l=>!l),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:a?"Hide":"Show each"})]}),a?(0,e.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:s.map(l=>(0,e.jsxs)("li",{"data-testid":"digest-change",style:{display:"grid",gap:3},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:l.intent}),l.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",l.basis]}):null]}),l.withheld?null:(0,e.jsx)(D,{batch:l.batch})]}),l.touched.length>0?(0,e.jsx)("div",{"data-touched":l.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:l.touched.slice(0,4).map(o=>(0,e.jsx)(O,{id:o,label:r.graph.has(o)?b(r,o):l.named?.[o]??b(r,o),go:n(o)},o))}):null]},l.batch))}):null]})}function D({batch:i}){let{store:n,principal:r,noteSeat:a}=w(),d=M(n,r),s=T()?.open??!1,l=d.log.length,[o,u]=(0,y.useState)(null),p=(0,y.useMemo)(()=>d.canUndo(i),[d,i,l]);if(s||!p.ok&&p.ops.length===0)return null;let c=!p.ok,k=c?p.includeBatches:[];return(0,e.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,e.jsx)("button",{type:"button","data-testid":"undo-turn",title:c?`${p.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{u(null);try{let v=typeof i=="string"?[i]:i,x=d.log.all().find(C=>v.includes(C.batch)&&C.author.kind==="agent");d.undo(c?[...v,...k]:typeof i=="string"?i:[...i],{author:r}),x&&a({type:"home",author:x.author})}catch(v){u(v instanceof Error?v.message:String(v))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...c?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:c?`undo +${k.length}`:"undo"}),o?(0,e.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:o}):null]})}function ve({seq:i,intent:n}){let r=T();if(!r)return null;let a=r.past?.seq===i;return(0,e.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${n}\u201D`,title:"Show the app as it was here","aria-pressed":a,onPointerEnter:q,onFocus:q,onClick:()=>r.show(i),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,e.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function we(){let i=()=>{let n=new URL(window.location.href);return n.searchParams.set("fresh","1"),n.toString()};return(0,e.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:n=>{n.preventDefault(),window.location.assign(i())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function O({id:i,label:n,go:r}){return r?(0,e.jsx)("button",{type:"button","data-testid":"activity-record","data-record":i,title:`Go to ${n}`,onClick:()=>r(i),style:{all:"unset",display:"inline-flex",cursor:"pointer",borderRadius:7},className:"graview-activity-record",children:(0,e.jsx)(B,{label:n})}):(0,e.jsx)(B,{label:n})}function He({calls:i,seat:n,remembers:r=!1}){let a=ce(),{store:d,principal:s,seats:l,people:o}=w(),u=ae(),[p,c]=(0,y.useState)("all"),[k,v]=(0,y.useState)(!1),x=t=>t!==void 0&&(t.id===s.id||t.onBehalfOf?.id===s.id)&&s.id!==void 0,C=new Set(u.map(t=>t.id)),de=a.filter(t=>!(t.interaction!==void 0&&C.has(t.interaction))&&(!k||x(t.by))),le=u.filter(t=>!k||x(t.by)).slice(0,4),R=[...p==="ai"?[]:de.map(t=>({at:t.at??"",change:t})),...p==="changes"?[]:le.map(t=>({at:t.at,entry:t}))].sort((t,f)=>t.at<f.at?1:t.at>f.at?-1:0),m=M(d,s),H=i.some(t=>t.phase==="running"),pe=te(),S=J("activity"),N=S.open,ge=V(),j=T(),W=t=>m.graph.has(t)?f=>{S.setOpen(!1),j?.past&&j.show(null),ge.record(f)}:null;return n===void 0&&i.length===0&&a.length===0&&u.length===0&&!r&&pe===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"activity-button",...S.trigger,onClick:S.toggle,title:H?"An agent is working":"What has happened",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:H?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[H?(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,background:"var(--graview-accent)"}}):null,a.length>0?a.length:"",(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.75",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),(0,e.jsx)("path",{d:"M8 4.75 V8 L10.25 9.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Activity"})]}),!N&&n!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:n}):null,N?(0,e.jsxs)("section",{...S.pane,"aria-label":"Activity","data-testid":"activity","data-graview-offstage":"",style:{..._,width:300,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...K,margin:0},children:"Activity"}),n!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:i.length>0||R.length>0?9:0,...i.length>0||R.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),n]}):null,i.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:i.slice(0,6).map((t,f)=>(0,e.jsxs)("li",{style:{display:"grid",gap:2,fontSize:"0.8125rem",lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:t.phase==="running"?"var(--graview-accent)":t.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,e.jsxs)("span",{style:{color:"var(--graview-ink)"},children:[t.mutating?"changed":"read"," \xB7"," ",m.allMutations().find(g=>g.name===t.name)?.title??$(t.name)]})]}),!t.mutating&&t.reads&&t.reads.length>0?(0,e.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(t.reads)].slice(0,3).map(g=>(0,e.jsx)(O,{id:g,label:b(m,g),go:W(g)},g)),new Set(t.reads).size>3?(0,e.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(t.reads).size-3]}):null]}):Object.values(t.args).some(g=>typeof g=="string")?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(t.args).filter(g=>typeof g[1]=="string").slice(0,3).map(([g,h])=>(0,e.jsx)(O,{id:h,label:b(m,h),go:W(h)},g))}):null,t.error?(0,e.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:t.error}):null]},`${t.at}:${f}`))}):null,u.length>0?(0,e.jsx)(y.Suspense,{fallback:null,children:(0,e.jsx)(he,{shows:p,onShows:c,mine:k,onMine:v})}):null,R.length>0?(0,e.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:R.map(({change:t,entry:f},g)=>f!==void 0?(0,e.jsx)(y.Suspense,{fallback:null,children:(0,e.jsx)(ue,{entry:f,undo:h=>(0,e.jsx)(D,{batch:h})})},`ai:${f.id}`):t.digest?(0,e.jsx)(me,{change:t,goes:W},`digest:${t.digest[0]?.batch??g}`):t.withheld?(0,e.jsx)("li",{"data-testid":"withheld-change",style:{display:"grid",gap:3,lineHeight:1.45},children:(0,e.jsx)("span",{"data-touched":"",style:{color:"var(--graview-ink-muted)",fontStyle:"italic"},children:t.intent})},`change:${g}`):(0,e.jsxs)("li",{"data-batch":t.batch,style:{display:"grid",gap:3,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsxs)("strong",{style:{fontWeight:600},children:[t.author==="human"&&t.by?.onBehalfOf===void 0&&(t.authorId===void 0||s.id===void 0||t.authorId===s.id)?"you":z(t.by??{kind:t.author,id:t.authorId},{graph:m.graph,schema:m.schema,seats:l,people:o}),I(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",I(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent}),t.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",t.basis]}):null]}),t.batch?(0,e.jsx)(ve,{seq:t.seq,intent:t.intent}):null,t.batch?(0,e.jsx)(D,{batch:t.batches&&t.batches.length>0?t.batches.length===1?t.batches[0]:t.batches:t.batch}):null]}),(0,e.jsx)("div",{"data-touched":t.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:t.touched.slice(0,4).map(h=>(0,e.jsx)(O,{id:h,label:m.graph.has(h)?b(m,h):t.named?.[h]??b(m,h),go:W(h)},h))})]},`change:${g}`))}):null,(0,e.jsx)(ne,{style:{paddingTop:8,borderTop:"1px solid var(--graview-edge)"}}),r?(0,e.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,e.jsx)("span",{children:"Remembered in this browser"}),(0,e.jsx)(we,{})]}):null]}):null]})}export{D as a,He as b};
@@ -1 +0,0 @@
1
- import{a as R,b as W}from"./chunk.25VJPUDH.js";import{e as E,f as C,g as z}from"./chunk.ZDDWXRPK.js";import{b as N}from"./chunk.LOUICR7K.js";import"./chunk.L7MFTL5S.js";import{d as I}from"./chunk.4F5M5XZG.js";import"./chunk.3G5DEGFA.js";import{a as D}from"./chunk.AZGXBTOQ.js";import"./chunk.TI4OSTQV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import{j as f}from"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{G as M,Ra as H,T as k,Va as A,ba as b,da as x}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import{Ya as S}from"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as w}from"./chunk.AJZBJBMO.js";var n=w(M(),1);var e=w(k(),1);function O(t,o){let r=[t>0?`${t===1?"one suggestion":`${t} suggestions`} waiting`:"",o>0?`tidied ${o===1?"one thing":`${o} things`} while you were away`:""].filter(Boolean);return r.length>0?r.join(" \xB7 ").replace(/^./,s=>s.toUpperCase()):void 0}function _(){let{store:t,principal:o,dismissals:r,whileAway:s,app:u}=b(),h=x(),l=(0,n.useMemo)(()=>W(r,u?.name??"app",o),[r,u?.name,o]),[m,y]=(0,n.useReducer)(g=>g+1,0);(0,n.useEffect)(()=>l.onChange?.(y),[l]);let a=(0,n.useMemo)(()=>E(t,o,{dismissed:l.list()}),[t,o,h,l,m]),[v,p]=(0,n.useState)(""),i=A("suggested"),d=s?.tidied??0,c=s?O(a.length,d):void 0;if(a.length===0&&d===0)return null;let L=g=>{if(p(g),a.length>1){requestAnimationFrame(()=>document.querySelector('[data-testid="suggested"] [data-testid="suggestion-accept"]')?.focus());return}i.setOpen(!1),(document.querySelector('[data-testid="activity-button"]')??document.querySelector('[data-graview-app-bar] button:not([data-testid="suggested-button"])'))?.focus()};return(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"suggested-button",...i.trigger,onClick:i.toggle,title:c??"What tidying suggests, waiting for you",...c?{"aria-label":`Suggested: ${c}`}:{},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:[a.length>0?a.length:`Tidied ${d}`,(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("path",{d:"M3 4.5 H13 M3 8 H10 M3 11.5 H8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12.25",cy:"11.5",r:"1.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]}),a.length>0?(0,e.jsx)("span",{className:"graview-activity-word",children:" Suggested"}):null]}),i.open?(0,e.jsxs)("section",{...i.pane,"aria-label":"Suggested","data-testid":"suggested","data-graview-offstage":"",style:{...H,width:320,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...f,margin:0},children:"Suggested"}),c?(0,e.jsxs)("p",{"data-testid":"while-away",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[c,"."]}):null,(0,e.jsx)("p",{style:{margin:0,fontSize:"0.75rem",lineHeight:1.45,color:"var(--graview-ink-faint)"},children:a.length>0?"Not made yet: each waits for you.":"What it did is in Activity."}),(0,e.jsx)("ol",{"data-testid":"suggestions",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10,fontSize:"0.8125rem"},children:a.map(g=>(0,e.jsx)($,{suggestion:g,notNow:l,settled:L},g.id))}),(0,e.jsx)("span",{role:"status","data-testid":"suggestion-heard",style:f,children:v})]}):null]})}var T={accept:"Accepted.",decline:"Declined: it will not be suggested again.",later:"Hidden from you until tomorrow."};function $({suggestion:t,notNow:o,settled:r}){let{store:s,principal:u,seats:h,people:l}=b(),[m,y]=(0,n.useState)(null),a=(0,n.useId)(),v=S(t.author,{graph:s.graph,schema:s.schema,seats:h,people:l}),p=async i=>{y(null);try{i==="accept"?C(s,t.id,{author:u}):i==="decline"?z(s,t.id,{author:u}):await o.dismiss({suggestion:t.id,at:new Date().toISOString(),until:R()}),r(T[i])}catch(d){y(d instanceof Error?d.message:String(d))}};return(0,e.jsxs)("li",{"data-testid":"suggestion","data-suggestion":t.id,style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{style:{fontWeight:600},children:v})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," ",t.intent]}),t.lineage?(0,e.jsx)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:D(t.lineage)}):null,t.about.length>0?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:t.about.slice(0,4).map(i=>(0,e.jsx)(I,{label:N(s,i),pickId:i},i))}):null,(0,e.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,e.jsx)("button",{type:"button","data-testid":"suggestion-accept",onClick:()=>void p("accept"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Accept"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-decline",onClick:()=>void p("decline"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Decline"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-not-now",onClick:()=>void p("later"),title:"Hide it from you until tomorrow. It still waits for everyone else.","aria-describedby":a,style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem",marginInlineStart:"auto",border:"1px solid transparent",background:"transparent",boxShadow:"none",color:"var(--graview-ink-muted)"},children:"Not now"}),(0,e.jsx)("span",{id:a,style:f,children:"Hides it from you until tomorrow; it still waits for everyone else."})]}),m?(0,e.jsx)("span",{"data-testid":"suggestion-refused",role:"alert",style:{fontSize:"0.75rem",color:"var(--graview-warn)"},children:m}):null]})}export{_ as SuggestedTray,O as awayWords};
@@ -1 +0,0 @@
1
- import{E as b,L as w,M as N,N as T,P as O,Q as S,U as m}from"./chunk.3MZIWKNG.js";var x=864e5,j=/^(\d{4})-(\d{2})-(\d{2})/,p=e=>String(e).padStart(2,"0"),D=e=>new Date(e).toISOString().slice(0,10),a=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),g=(e,t)=>D(a(e)+t*x),W=e=>new Date(a(e)).getUTCDay();function c(e,t,r){if(!(t>=1&&t<=12&&r>=1&&r<=31))return;let i=`${String(e).padStart(4,"0")}-${p(t)}-${p(r)}`;return D(a(i))===i?i:void 0}function F(e=new Date){let t=N();return t?O(e.getTime(),t):{day:`${e.getFullYear()}-${p(e.getMonth()+1)}-${p(e.getDate())}`,minutes:e.getHours()*60+e.getMinutes()}}var h=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e);function l(e){if(typeof e!="string")return;if(h(e)){let i=new Date(e);return Number.isNaN(i.getTime())?void 0:F(i)}let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t||!c(Number(t[1]),Number(t[2]),Number(t[3])))return;let r=e.slice(0,10);return t[4]===void 0?{day:r}:{day:r,minutes:Number(t[4])*60+Number(t[5])}}function A(e,t){if(!t.time)return e.day;let r=e.minutes??9*60;if(!t.instant)return`${e.day}T${p(Math.floor(r/60))}:${p(r%60)}`;let i=N(),[,n,o,d]=j.exec(e.day);return(i?new Date(S(e.day,r,i)):new Date(Number(n),Number(o)-1,Number(d),Math.floor(r/60),r%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function z(e,t=new Date){let r=T(),i=r;try{i=new Intl.DateTimeFormat(e??b,{timeZoneName:"short",timeZone:r}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??r}catch{i=r}return{zone:r,short:i}}function L(e,t,r,i){let n=l(t);if(!n)return r;let o=e===void 0?void 0:l(e),d=r===void 0?void 0:l(r),u=s=>a(s.day)+(s.minutes??0)*6e4,f=(s,$)=>{let y=u(s)+$;return{day:D(y),...i.time?{minutes:Math.round(y%x/6e4)}:{}}};return o&&d?A(f(d,u(n)-u(o)),i):d&&u(d)>=u(n)?r:i.time?A(f(n,36e5),i):r}var Y=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,B=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function P(e,t={}){let r=(t.start&&e.includes(t.start)?t.start:void 0)??e.find(n=>Y.test(n)),i=(t.end&&e.includes(t.end)?t.end:void 0)??e.find(n=>n!==r&&B.test(n));return r&&i?{start:r,end:i}:void 0}var Z=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],H=["sun","mon","tue","wed","thu","fri","sat"],I="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",E="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",C=e=>Z.indexOf(e.slice(0,3))+1,M=e=>e===void 0?void 0:e.length===2?2e3+Number(e):Number(e);function U(e){try{let t=new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}).formatToParts(0).map(r=>r.type);return t.indexOf("month")<t.indexOf("day")}catch{return!0}}function v(e){let t=(n,o)=>({minutes:o,rest:`${e.slice(0,n.index)} ${e.slice(n.index+n[0].length)}`}),r=/\b(noon|midday)\b/.exec(e);if(r)return t(r,12*60);if(r=/\bmidnight\b/.exec(e),r)return t(r,0);if(r=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(e),r){let n=Number(r[1]),o=Number(r[2]??0);return n<1||n>12||o>59?{rest:e,bad:!0}:t(r,(n%12+(r[3]==="p"?12:0))*60+o)}if(r=/\b(\d{1,2}):(\d{2})\b/.exec(e),r){let n=Number(r[1]),o=Number(r[2]);return n>23||o>59?{rest:e,bad:!0}:t(r,n*60+o)}if(r=/\bat\s+(\d{1,2})\b/.exec(e),r){let n=Number(r[1]);return n>23?{rest:e,bad:!0}:t(r,(n>=1&&n<=7?n+12:n)*60)}let i=/\b(morning|afternoon|evening|tonight)\b/.exec(e);return i?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[i[1]]*60,rest:i[1]==="tonight"?`${e.slice(0,i.index)} today ${e.slice(i.index+i[0].length)}`:`${e.slice(0,i.index)} ${e.slice(i.index+i[0].length)}`}:{rest:e}}function K(e,t,r){let i=e.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(i==="")return null;if(i==="today"||i==="now")return t;if(i==="tomorrow"||i==="tmrw"||i==="tmr")return g(t,1);if(i==="yesterday")return g(t,-1);if(i==="next week")return g(t,7);let n=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(i);if(n)return g(t,Number(n[1])*(n[2].startsWith("week")?7:1));if(n=new RegExp(`^(next )?${E}$`).exec(i),n){let s=(H.indexOf(n[2].slice(0,3))-W(t)+7)%7;return g(t,n[1]&&s===0?7:s)}if(n=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(i),n)return c(Number(n[1]),Number(n[2]),Number(n[3]));let o=i.replace(new RegExp(`^${E} `),"");n=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${I}(?: (\\d{4}))?$`).exec(o);let d=n?{date:n[1],month:n[2],year:n[3]}:void 0;n=new RegExp(`^${I} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(o);let u=d??(n?{date:n[2],month:n[1],year:n[3]}:void 0);if(u)return R(t,M(u.year),C(u.month),Number(u.date));if(n=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(o),n){let[f,s]=[Number(n[1]),Number(n[2])],[$,y]=U(r)?[f,s]:[s,f];return R(t,M(n[3]),$,y)}}function R(e,t,r,i){if(t!==void 0)return c(t,r,i);let n=Number(e.slice(0,4)),o=c(n,r,i);return o===void 0?c(n+1,r,i):a(e)-a(o)>183*x?c(n+1,r,i):o}function q(e,t){let r=e.trim();if(h(r)){let u=l(r);if(u)return t.time?u:{day:u.day}}let i=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(i==="")return;let n=v(i);if(n.bad)return;let o=K(n.rest,t.today,t.locale??b);if(o===void 0||o===null&&n.minutes===void 0)return;let d=o??t.base?.day??t.today;return t.time?{day:d,minutes:n.minutes??t.base?.minutes??9*60}:{day:d}}function G(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[t,...r]=e.split(":"),i=r.join(":");return(t==="mcp"||t==="view")&&i?`via ${i}`:t==="mcp"?"via an agent's tools":`via ${e}`}var _=e=>{if(!e.currency)return{before:!0};try{let t=w(e.locale),r=new Intl.NumberFormat(t,{style:"currency",currency:e.currency}).formatToParts(1),i=r.findIndex(d=>d.type==="currency"),n=r.findIndex(d=>d.type==="integer"),o;try{o=new Intl.DisplayNames([t],{type:"currency"}).of(e.currency)}catch{}return{...i>=0?{symbol:r[i].value}:{},before:i<n,...o?{name:o}:{}}}catch{return{symbol:e.currency,before:!0}}};function J(e){let t=e.locale;if(e.format==="money"){let{symbol:r,before:i,name:n}=_(e),o=m(1250,t,{minimumFractionDigits:2,maximumFractionDigits:2});return{...r?i?{prefix:r}:{suffix:r}:{},placeholder:o,hint:n?`in ${n}`:e.currency?`in ${e.currency}`:"an amount of money"}}return e.format==="percent"?{suffix:"%",placeholder:m(15,t),hint:"as a percent"}:{...e.unit?{suffix:e.unit}:{},placeholder:"",hint:e.unit?`in ${e.unit}`:"a number"}}function Q(e,t){return e===void 0||!Number.isFinite(e)?"":t.format==="money"?m(e,t.locale,Number.isInteger(e)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):t.format==="percent"?m(e*100,t.locale,{maximumFractionDigits:4}):m(e,t.locale,{maximumFractionDigits:6})}function V(e){try{let t=new Intl.NumberFormat(w(e)).formatToParts(12345.6);return{group:t.find(r=>r.type==="group")?.value??",",decimal:t.find(r=>r.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function X(e,t){let{group:r,decimal:i}=V(t),n=e.replace(/[\s  ']/g,"").replace(/[−–]/g,"-");if(i!=="."&&!n.includes(i)&&/^-?\d+\.\d{1,2}$/.test(n))return Number(n);if(r&&(n=n.split(r).join("")),i!=="."&&(n=n.replace(i,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(n))return;let o=Number(n);return Number.isFinite(o)?o:void 0}function k(e,t){let r=e.trim();if(r==="")return;let i=t?.format==="money"&&t.currency?_(t).symbol:void 0,n=r;i&&(n=n.split(i).join("")),t?.currency&&(n=n.replace(new RegExp(t.currency,"gi"),"")),n=n.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(n)&&(n=n.replace(/%\s*$/,"")),t?.unit&&t.format!=="money"&&(n=n.replace(new RegExp(`\\s*${t.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let d=X(n,t?.locale);if(d!==void 0)return t?.format==="percent"?d/100:d}export{G as a,J as b,Q as c,k as d,F as e,h as f,l as g,A as h,z as i,L as j,P as k,q as l};
@@ -1 +0,0 @@
1
- import{a}from"./chunk.5VF2RT4H.js";import"./chunk.5RH6FO3K.js";import"./chunk.ZDDWXRPK.js";import"./chunk.LOUICR7K.js";import"./chunk.L7MFTL5S.js";import"./chunk.4F5M5XZG.js";import"./chunk.3G5DEGFA.js";import"./chunk.AZGXBTOQ.js";import{b as n}from"./chunk.VYKEIKY5.js";import"./chunk.IDYPQ45A.js";import"./chunk.TI4OSTQV.js";import"./chunk.GZHZLJBF.js";import"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{T as i}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as o}from"./chunk.AJZBJBMO.js";var e=o(i(),1);function m({entries:d,style:l,headingStyle:p,className:r}){return(0,e.jsxs)("section",{...r?{className:r}:{},"data-testid":"record-ai","aria-label":"What AI did here",style:{display:"grid",gap:10,...l},children:[(0,e.jsx)("h2",{style:p??{margin:0,fontSize:"1rem"},children:"What AI did here"}),(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,fontSize:"0.875rem"},children:d.slice(0,8).map(t=>(0,e.jsx)(n,{entry:t,undo:s=>(0,e.jsx)(a,{batch:s})},t.id))})]})}export{m as RecordInteractions};
@@ -1 +0,0 @@
1
- import{a as b}from"./chunk.TUNHUTQ5.js";import{D as k,H as g,Lb as h,va as u,ya as w}from"./chunk.3MZIWKNG.js";var s=i=>i?._zod?.def,x=Symbol.for("@graview/core:collaborative"),O=/^\^\\d\{4\}-\\d\{2\}-\\d\{2\}\$$/;function v(i){let n=s(i),p=!0,a;for(let e=0;n&&e<4;e++){if(n.type==="optional"||n.type==="nullable")p=!1;else if(n.type==="default")p=!1,a=n.defaultValue;else break;n=s(n.innerType)}if(!n)return{why:"it is not a zod field"};let l=k(i),r={...p?{required:!0}:{},...a!==void 0?{default:a}:{},...l?{description:l}:{}},f=(n.checks??[]).map(e=>s(e)),c=u(i);if(c)return{spec:{type:c,...r}};if(w(i))return{spec:{type:"app-link",...r}};let d;for(let e=s(i),t=0;e&&d===void 0&&t<4;e=s(e.innerType),t++)d=e[x];let m=e=>d!==void 0&&d===1!=(e==="text")?{collaborative:d===1}:{};if(b(i))return{spec:{type:"text",format:"markdown",...r,...m("text")}};let y=h(i);if(y)return{spec:{type:y,...r}};switch(n.type){case"string":{let e=n.format;return e==="email"?{spec:{type:"email",...r}}:e==="url"?{spec:{type:"url",...r}}:e==="date"?{spec:{type:"date",...r}}:e==="datetime"||f.some(t=>t?.fn===g)?{spec:{type:"datetime",...r}}:f.some(t=>t?.format==="regex"&&O.test(String(t?.pattern?.source??"")))?{spec:{type:"date",...r}}:{spec:{type:"string",...r,...m("string")}}}case"number":{let e={};for(let t of f){let o=t?.value;typeof o=="number"&&(t?.check==="greater_than"&&t.inclusive?e.min=Math.max(e.min??o,o):t?.check==="less_than"&&t.inclusive?e.max=Math.min(e.max??o,o):t?.check==="multiple_of"&&(e.step=o))}return{spec:{type:f.some(t=>t?.format==="safeint"||t?.format==="int")?"integer":"number",...e,...r}}}case"boolean":return{spec:{type:"boolean",...r}};case"enum":{let e=Object.keys(n.entries??{});return e.length>0?{spec:{type:"enum",options:e,...r}}:{why:"it is an enum with no options"}}case"array":{let e=s(n.element),t=u(n.element)??(e?.type==="number"?"number":e?.type==="string"?"string":void 0);return t?{spec:{type:"list",of:t,...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(n.type)}, which a document has no field type for`}}}function M(i){let n=v(i);return"spec"in n?n.spec:void 0}export{M as a};
@@ -1 +0,0 @@
1
- import{h,i as E}from"./chunk.RLO3RDYH.js";import{a as M,f as z}from"./chunk.TUNHUTQ5.js";import{C as y,Fa as O,Nb as N,Qa as P,Ra as D,Sc as K,Tc as k,Wb as T,Xb as Z,Yb as q,Zb as v,ab as L,fa as S,qb as V,rb as I,sb as g,va as R,ya as j}from"./chunk.3MZIWKNG.js";var J=n=>n.safeParse?.(void 0).success??!1,C=n=>h(n).shape,A=n=>{let r=h(n);if(y(r)?.type!=="literal")return;let o=y(r)?.values;return o&&o.length===1&&typeof o[0]=="string"?o[0]:void 0};function F(n,r){let o=J(r),e=h(r),t=y(e)?.type,c=N(r);if(c)return{control:"node",name:n,optional:o,kinds:c};let p=O(r);if(p)return{control:"linked",name:n,optional:o,relation:p};if(D(r)){let d=P(n);return{control:"repeat",name:n,optional:o,...d?{of:d}:{}}}if(t==="boolean")return{control:"boolean",name:n,optional:o};let f=R(e);if(f)return{control:"file",name:n,optional:o,...f==="image"?{image:!0}:f==="video"?{video:!0}:{}};if(t==="object"){let d=e.shape??{};return{control:"group",name:n,optional:o,fields:Object.entries(d).map(([a,l])=>F(a,l))}}if(t==="union"){let d=y(e)?.options??[],a=d.map(s=>C(s));if(a.every(s=>s!==void 0)){let s=Object.keys(a[0]??{}).find(u=>a.every(m=>A(m?.[u])!==void 0));if(s)return{control:"variant",name:n,optional:o,tag:s,options:d.map((u,m)=>({value:A(a[m]?.[s])??"",fields:Object.entries(a[m]??{}).filter(([w])=>w!==s).map(([w,B])=>F(w,B))}))}}let l=d.map(s=>A(s));return l.every(s=>s!==void 0)?{control:"choice",name:n,optional:o,options:l}:{control:"opaque",name:n,optional:o}}if(t==="array"){let d=y(e)?.element;return d!==void 0?{control:"list",name:n,optional:o,item:F(n,d)}:{control:"opaque",name:n,optional:o}}let i=E(r);return i.type==="text"?{control:"text",name:n,optional:o,...i.long?{long:!0}:{},...j(e)?{app:!0}:{},...M(e)?{markdown:!0}:{},...i.holds?{holds:i.holds}:{}}:i.type==="number"&&i.duration?{control:"text",name:n,optional:o,holds:"duration"}:i.type==="date"?{control:"date",name:n,optional:o,...i.time?{time:!0}:{},...i.instant?{instant:!0}:{}}:i.type==="number"?{control:"number",name:n,optional:o,...i.min===void 0?{}:{min:i.min},...i.max===void 0?{}:{max:i.max},...i.step===void 0?{}:{step:i.step},...i.amount?{amount:i.amount}:{}}:i.type==="choice"?{control:"choice",name:n,optional:o,options:i.options}:{control:"opaque",name:n,optional:o}}function H(n){let r=n.shape;return r?Object.entries(r).map(([o,e])=>F(o,e)):[]}function W(n,r){let o={...r};for(let e of n){let t=r[e.name];t===void 0&&!e.optional&&(e.control==="list"||e.control==="boolean")&&(o[e.name]=e.control==="list"?[]:!1),e.control==="text"&&e.holds&&typeof t=="string"&&(o[e.name]=t.trim()===""?void 0:e.holds==="duration"?z(t)??t:t.trim()),e.control==="group"&&t!==void 0&&typeof t=="object"&&t!==null&&(o[e.name]=W(e.fields,t))}return o}function G(n,r){return Z(H(r.input),T(n,r))}var x="visitor";function gn(n,r,o,e){let t=K.keptFrom?.(n,r),c=new Set;if(!t)return c;let p=Object.keys(o.input.shape??{});for(let a of o.creates??[]){let l=t({id:"\0new",kind:a});for(let s of p)l?.(s)&&c.add(s)}let f=e===void 0?void 0:n.graph.getNode(e),i=f&&n.schema.tryDefinition(f.kind),d=f&&t(f);if(i&&d)for(let a of v(o,i))d(a)&&p.includes(a)&&c.add(a);return c}function _(n,r,o,e){let t=new Set,c=r?.sees??[];if(I(o)||!c.some(k))return t;let p=V(o),f=(l,s)=>{let u=c.filter(m=>m.kinds.includes(l)&&g(m,p));return u.some(k)?L.has(s)||u.some(m=>!k(m)||(m.fields===void 0||m.fields.includes(s))&&!m.hide?.includes(s)):!0},i=Object.keys(e.input.shape??{}),d=new Map,a=(l,s)=>d.set(l,d.get(l)===!0||s);for(let l of e.creates??[]){let s=Object.keys(n.tryDefinition(l)?.fields.shape??{});for(let u of i)s.includes(u)&&a(u,f(l,u))}for(let l of q(n,e)){let s=n.tryDefinition(l);if(s)for(let u of v(e,s))i.includes(u)&&a(u,f(l,u))}for(let[l,s]of d)s||t.add(l);return t}var $=(n,r)=>r.title??S(n);function Q(n,r,o){let e=n?.sees;return!e||e.length===0?!0:e.some(t=>t.kinds.includes(o)&&g(t,r)&&!t.own&&!t.via)}function b(n){switch(n.control){case"node":return[n];case"group":return n.fields.flatMap(b);case"variant":return n.options.flatMap(r=>r.fields.flatMap(b));case"list":return b(n.item);default:return[]}}function U(n,r,o,e){return e.has(o.name)?!1:b(o).every(t=>t.kinds.some(c=>c!=="*"&&Q(n,r,c)))}var X=n=>({kind:"human",id:"form:",roles:[n]});function vn(n,r,o=n.mutations??[]){let e=n.forms?.[r];if(!e)return;let t=o.find(a=>a.name===e.act);if(!t)return;let c=e.role??x,p=X(c),f=_(n.schema,n.policy,p,t),i=G(n.schema,t),d=e.fields?e.fields.flatMap(a=>i.find(l=>l.name===a)??[]):i.filter(a=>U(n.policy,p,a,f));return{name:r,title:$(r,e),...e.intro?{intro:e.intro}:{},...e.say?{say:e.say}:{},submit:e.submit??t.title??S(t.name),role:c,act:t,fields:d}}function An(n,r,o){let e=n.forms?.[r];if(!e)throw new Error(`There is no form called "${r}"${n.forms?`: the forms are ${Object.keys(n.forms).join(", ")}`:": the app declares none"}.`);return{kind:"visitor",id:o,name:`a visitor via the ${$(r,e)} form`,roles:[e.role??x]}}function xn(n){return{said:"Received \u2014 thank you.",...n.say?{next:n.say}:{}}}export{H as a,W as b,G as c,gn as d,_ as e,vn as f,An as g,xn as h};
@@ -1 +0,0 @@
1
- import{a as X,b as Y,c as R}from"./chunk.KY7QD22S.js";import{a as B,b as L}from"./chunk.WICMCZ27.js";import{a as Q,e as U}from"./chunk.2DFWOLL2.js";import{e as z,f as J,g as _}from"./chunk.LU3B3SZH.js";import"./chunk.HLDMTKUP.js";import{G as q,Ia as j,Ja as M,M as H,O as T,T as G,ca as b,ja as x,ma as V,na as D,pa as C,ra as I}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as v}from"./chunk.AJZBJBMO.js";var i=v(q(),1);var o=v(G(),1),Z=e=>({...e.node?{node:{id:e.node.id}}:{},...e.nodes?{nodes:e.nodes.map(n=>({id:n.id}))}:{},...e.label!==void 0?{label:e.label}:{},fidelity:e.fidelity,cardinality:e.cardinality,mode:e.mode,selected:e.selected,...e.implicated?{implicated:e.implicated}:{},...e.flagged?{flagged:e.flagged}:{}});function N(e){let n=T(),r=n?.past?.seq,s=n?.host?.viewAt,t=(0,i.useMemo)(()=>r===void 0||!s||e.draft?void 0:s(e.manifest.name,r),[s,r,e]);return(0,i.useMemo)(()=>t===null?null:t===void 0?e:{...e,worker:t},[t,e])}function E({definition:e,store:n,principal:r,input:s,goTo:t,places:a,scheme:d,brand:l,onFailure:m,drawsItsOwn:u,tick:f}){let w=(0,i.useRef)(null),p=(0,i.useRef)(null),y=H(),k=(0,i.useContext)(M),c=(0,i.useRef)({input:s,goTo:t,places:a,onFailure:m,brand:l,hostFiles:y,told:k});c.current={input:s,goTo:t,places:a,onFailure:m,brand:l,hostFiles:y,told:k},(0,i.useEffect)(()=>{let P=w.current;if(!P)return;let A=e.file??(c.current.hostFiles?.src?g=>c.current.hostFiles?.src?.(g)??g:void 0);typeof e.worker=="function"&&R(e.worker).catch(()=>{});let $=L(B,({mountWorkerView:g})=>{p.current=g(P,{manifest:e.manifest,worker:e.worker,store:n,principal:r,input:()=>c.current.input?.()??{},goTo:()=>c.current.goTo,places:()=>c.current.places?.()??[],brand:()=>c.current.brand,onFailure:(W,K)=>c.current.onFailure(W,K),...u?{fallback:!1}:{},...e.limits?{limits:e.limits}:{},...e.author?{author:e.author}:{},...e.onProblem?{onProblem:e.onProblem}:{},...e.asset?{asset:e.asset}:{},...A?{file:A}:{},...e.images?{images:e.images}:{},...e.links?{links:e.links}:{},files:()=>c.current.hostFiles,onContentHeight:W=>c.current.told?.(W)})});return()=>{$(),p.current?.dispose(),p.current=null}},[e,n,r]),(0,i.useEffect)(()=>p.current?.update(),[d,l,f]);let h=(0,o.jsx)("div",{ref:w,"data-worker-view-place":e.manifest.name,style:{minWidth:0}});if(!e.draft)return h;let S=e.manifest.title??e.manifest.name;return(0,o.jsxs)("div",{role:"group","aria-label":`Draft: ${S}`,"data-graview-draft-view":e.manifest.name,style:{display:"grid",gap:8,alignContent:"start",minWidth:0},children:[(0,o.jsxs)("p",{"data-testid":"draft-view-line",style:ee,children:[(0,o.jsxs)("span",{children:["Draft \u2014 ",(0,o.jsx)("span",{style:{color:"var(--graview-ink)",fontWeight:600},children:S})]}),(0,o.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,o.jsx)("span",{children:"Not kept"})]}),h]})}var ee={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};function O({view:e,props:n,fellBack:r}){return(0,o.jsx)("div",{"data-worker-view-fallback":"",...r?{"data-worker-view-fell-back":r.name,"data-worker-view-failed":r.reason}:{},style:{display:"contents"},children:(0,o.jsx)(e,{...n})})}function re({name:e,reason:n,children:r}){return(0,o.jsx)("div",{"data-worker-view-fell-back":e,"data-worker-view-failed":n,style:{display:"contents"},children:r})}function F(e,n={}){let r=n.fallback,s=e.manifest.replaces==="page";function t(a){let d=b(),l=x(),m=(0,i.useContext)(j),[u,f]=(0,i.useState)(null),w=(0,i.useRef)(a);w.current=a;let p=N(e);if(!d)return null;if(p===null)return r&&!(m&&V(r)&&!s)?(0,o.jsx)(O,{view:r,props:a}):null;if(u&&r)return m&&V(r)&&!s?null:(0,o.jsx)(O,{view:r,props:a,fellBack:{name:e.manifest.name,reason:u}});let y=n.beside&&!(m&&V(n.beside))?n.beside:void 0,k=(0,o.jsx)(E,{definition:p,store:d.store,principal:d.principal,input:()=>Z(w.current),goTo:l,places:()=>d.views.places(),scheme:d.scheme,brand:d.brand,tick:a,drawsItsOwn:r!==void 0,onFailure:(c,h)=>{f(c),e.onFailure?.(c,h)}});return y?(0,o.jsxs)("div",{"data-worker-view-beside":e.manifest.name,style:{display:"grid",gap:12,minWidth:0},children:[k,(0,o.jsx)(y,{...a})]}):k}return t.displayName=`WorkerView(${e.manifest.name})`,t}function ne(e,n){let{manifest:r}=n;if(r.attach==="home"){if(!e.home)throw new Error(`The worker view "${r.name}" is the home's body: draw it with workerHome, on the home.`);let u=e.homes?.(),f=n.draft?void 0:u?u.filter(p=>p.name===void 0).at(-1)?.view:e.homeView?.(),w=F(n,f?{fallback:f}:{});return e.home(r.bleed===!0?C(w):w,n.draft?void 0:{name:r.name}),e}let s={cardinality:r.cardinality,fidelity:"full"},t=e.lookup(r.attach,s)??e.resolve(r.attach,s)?.view,a=r.cardinality==="one",d=n.draft===!0,l=F(n,{...t&&!d?{fallback:t}:{},...a&&r.replaces!=="page"&&t?{beside:t}:{}});a&&r.replaces==="page"&&D(l);let m=t?.says;return a&&r.replaces!=="page"&&typeof m=="function"&&(l.says=m),r.bleed===!0&&C(l),l.flows=r.flows!==!1,r.heading==="own"&&(l.ownHeading=!0),I(l,r.scene?.maxHeight!==void 0?{maxHeight:r.scene.maxHeight}:{}),e.register(r.attach,s,l,r.title?{title:r.title,...d?{}:{name:r.name},lens:"view",...r.reads?.kinds?.length?{reads:r.reads.kinds}:{}}:d?void 0:{name:r.name}),e}function te(e,n={}){let r=n.fallback;function s({context:t}){let a=b(),d=x(),[l,m]=(0,i.useState)(null),u=N(e);return l&&r?(0,o.jsx)(re,{name:e.manifest.name,reason:l,children:(0,o.jsx)(r,{context:t})}):u===null&&r?(0,o.jsx)(r,{context:t}):u===null?null:(0,o.jsx)(E,{definition:u,store:t.store,principal:t.principal??a?.principal??{kind:"human"},goTo:d,...a?{places:()=>a.views.places(),scheme:a.scheme,brand:a.brand}:{},drawsItsOwn:r!==void 0,onFailure:(f,w)=>{m(f),e.onFailure?.(f,w)}})}return s.displayName=`WorkerHome(${e.manifest.name})`,s}export{J as checkManifest,X as checkViewSource,U as judgeCodeAct,z as manifestActs,ne as registerWorkerView,Q as sightIsTotal,Y as viewScript,te as workerHome,F as workerView,_ as workerViewProps};
@@ -1 +0,0 @@
1
- import{G as l,N as p,U as k,W as y,c}from"./chunk.B2X6DA2Q.js";import"./chunk.QB7RYJ67.js";import"./chunk.UGFDSE37.js";import{b as m}from"./chunk.EC7I33WI.js";import"./chunk.GVUJCOKD.js";import"./chunk.3ZONBC6L.js";import"./chunk.MDWCX3YU.js";import"./chunk.CB5DGKR5.js";import"./chunk.GKLDSHHH.js";import"./chunk.OCV46AFN.js";import"./chunk.4KTHJY5N.js";import"./chunk.PZ4G5QA5.js";import"./chunk.Y36MLVMT.js";import"./chunk.MPMROUZA.js";import"./chunk.XTT6ERI3.js";import"./chunk.5RH6FO3K.js";import"./chunk.L7MFTL5S.js";import"./chunk.XZJ6XX5I.js";import"./chunk.4F5M5XZG.js";import"./chunk.LVOL2LEC.js";import"./chunk.3G5DEGFA.js";import"./chunk.OZ4EJ5M6.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.3V2WXZU3.js";import"./chunk.7UD2JR6J.js";import"./chunk.BUDEUNBN.js";import"./chunk.3IEJQAK7.js";import"./chunk.AKLVSZ5A.js";import"./chunk.ZUBC3UFG.js";import"./chunk.GZHZLJBF.js";import"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{G as S,H as s,I as d,T as f,ca as g}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as te}from"./chunk.GKLDSHHH.js";import{o as Se,p as ee,s as $,t as be}from"./chunk.PZWJUQAO.js";import{m as J,n as ye,o as we,p as X,q as Z}from"./chunk.OJGHDWI6.js";import{c as ke}from"./chunk.TUNHUTQ5.js";import{a as he,b as U,c as j,e as ve,l as Me}from"./chunk.FWZF7X6A.js";import{b as de}from"./chunk.3JMZHCB4.js";import{D as z,Ea as fe,F as Y,Fa as ge,G as O,Ga as T,J as pe,Ma as _,O as me,Oa as F,T as M,ba as A,ca as q,da as B,m as le,v as ce,z as ue}from"./chunk.SF4BYBH6.js";import{a as E}from"./chunk.SDO3U72B.js";import{Lc as ie,Qc as ae,ia as H,ld as se}from"./chunk.3MZIWKNG.js";import{b as y}from"./chunk.AJZBJBMO.js";var P=y(O(),1),x=y(M(),1),ne=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.E5JX5LWY.js")))),xe=ne.part(t=>(0,x.jsx)(t.HoverChipDoor,{}),{quiet:!0}),De="A",Q=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.KHRS2SKB.js","./chunk.644FUGSX.js","./chunk.J3OX474P.js","./chunk.7SCENHVG.js","./chunk.FWKNR7XF.js","./chunk.OCV46AFN.js","./chunk.Y36MLVMT.js","./chunk.MPMROUZA.js","./chunk.HJCQ6I3S.js","./chunk.5C43AM3X.js","./chunk.4WH4N4V7.js","./chunk.MVRNEC3Y.js","./chunk.ZDDWXRPK.js","./chunk.LOUICR7K.js","./chunk.L7MFTL5S.js","./chunk.4F5M5XZG.js","./chunk.3G5DEGFA.js","./chunk.BOMYLOCX.js","./chunk.45HTFSWD.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.KRVEAIKW.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.RYMSHMLM.js","./chunk.TI4OSTQV.js","./chunk.C6HBYRGJ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.LNOWO3IY.js"))));var Ce=Q.part((t,e)=>(0,x.jsx)(t.InspectorPane,{...e}),{what:"This card's acts"});function Le(t){let e=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&t()},n=globalThis;if(n.requestIdleCallback){let c=n.requestIdleCallback(e,{timeout:5e3});return()=>n.cancelIdleCallback?.(c)}let i=setTimeout(e,2500);return()=>clearTimeout(i)}var Oe=150,Ne="[data-graview-pick], [data-graview-view], [data-graview-record], [data-graview-act], [data-graview-field], a[href]";function Re(t){if(t.closest("[data-graview-face='pages'], [data-graview-popover]"))return null;let e=t.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??t.closest("[data-graview-view]")?.getAttribute("data-graview-view");return e?{face:"scene",on:e,about:[e]}:null}function We(t){let{store:e,principal:n,providers:i,ai:c}=A(),p=be(),h=Y(c),r=(0,P.useRef)({aimAt:t,store:e,principal:n,providers:i,prepareSections:p,chipsOn:h});r.current={aimAt:t,store:e,principal:n,providers:i,prepareSections:p,chipsOn:h},(0,P.useEffect)(()=>{if(typeof document>"u")return;let u=null,w=null,k=null,l=g=>{let m=r.current,b=m.chipsOn?m.aimAt(g):null;b&&(k=g,ne.load().then(G=>{k===g&&G.restOn(b,g)},()=>{}))},f=()=>{u&&clearTimeout(u.timer),u=null},s=g=>{let m=r.current,b=m.aimAt(g);if(!b)return;let G=JSON.stringify([b.face,b.on,b.about,b.field,b.place,b.act,m.store.log.length]);G!==w&&(w=G,m.prepareSections(b),Q.load().then(Pe=>Pe.prepareActs(m.store,b,{principal:m.principal,providers:m.providers}),()=>{}))},o=g=>g.target instanceof Element?g.target.closest(Ne):null,d=g=>{if(g.pointerType==="touch")return;let m=o(g);m!==null&&m===u?.element||(f(),m!==null&&(u={element:m,timer:setTimeout(()=>{u=null,s(m),l(m)},Oe)}))},v=g=>{let m=g.relatedTarget;k!==null&&!(m instanceof Node&&k.contains(m))&&(k=null,ne.current?.leaveRest()),u!==null&&(m instanceof Node&&u.element.contains(m)||f())},S=g=>{if(g.pointerType==="mouse")return;let m=o(g);m&&s(m)},I=g=>{if(!fe())return;let m=o(g);m&&s(m)};return document.addEventListener("pointerover",d,{passive:!0}),document.addEventListener("pointerout",v,{passive:!0}),document.addEventListener("pointerdown",S,{capture:!0,passive:!0}),document.addEventListener("focusin",I),()=>{f(),document.removeEventListener("pointerover",d),document.removeEventListener("pointerout",v),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("focusin",I)}},[])}function it({placement:t="float",openActs:e,aimAt:n}={}){let{menuAt:i,setMenuAt:c,registerActsDoor:p,ai:h}=A(),{selection:r}=_();We(n??Re),(0,P.useEffect)(()=>{if(Q.current)return;let f=()=>{v(),Q.prefetch()},s=()=>{},o=ge(()=>void(s=Le(f))),d=["pointerdown","keydown"];for(let S of d)document.addEventListener(S,f,{capture:!0,passive:!0});function v(){o(),s();for(let S of d)document.removeEventListener(S,f,{capture:!0})}return v},[]),(0,P.useEffect)(()=>{if(t==="menu")return p({key:De,open:e??(f=>{let s=f.getBoundingClientRect(),o=f.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??f.closest("[data-graview-view]")?.getAttribute("data-graview-view")??void 0;c({x:Math.round(s.left+Math.min(16,s.width/2)),y:Math.round(Math.min(s.bottom,s.top+36)),...o?{on:o}:{}})})}),()=>p(null)},[t,p,c,e]);let u=i!==null||r.length>0&&e===void 0,[w,k]=(0,P.useState)(u);(0,P.useEffect)(()=>{u&&k(!0)},[u]);let l=Y(h)?(0,x.jsx)(P.Suspense,{fallback:null,children:(0,x.jsx)(xe,{})}):null;return!w&&!u?l:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(P.Suspense,{fallback:null,children:(0,x.jsx)(Ce,{placement:t,chosen:e===void 0})}),l]})}var K=y(O(),1),V=y(M(),1),Ge=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.KHRS2SKB.js","./chunk.25VJPUDH.js","./chunk.644FUGSX.js","./chunk.J3OX474P.js","./chunk.7SCENHVG.js","./chunk.2LMB5E6N.js","./chunk.KJGNLWU3.js","./chunk.GVUJCOKD.js","./chunk.3ZONBC6L.js","./chunk.FWKNR7XF.js","./chunk.MDWCX3YU.js","./chunk.CB5DGKR5.js","./chunk.GKLDSHHH.js","./chunk.OCV46AFN.js","./chunk.4KTHJY5N.js","./chunk.PZ4G5QA5.js","./chunk.Y36MLVMT.js","./chunk.MPMROUZA.js","./chunk.HJCQ6I3S.js","./chunk.5C43AM3X.js","./chunk.4WH4N4V7.js","./chunk.MVRNEC3Y.js","./chunk.ZDDWXRPK.js","./chunk.LOUICR7K.js","./chunk.L7MFTL5S.js","./chunk.XZJ6XX5I.js","./chunk.4F5M5XZG.js","./chunk.LVOL2LEC.js","./chunk.3G5DEGFA.js","./chunk.OZ4EJ5M6.js","./chunk.BOMYLOCX.js","./chunk.45HTFSWD.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.KRVEAIKW.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.RYMSHMLM.js","./chunk.TI4OSTQV.js","./chunk.C6HBYRGJ.js","./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.Z6O7RUSR.js")))),He=Ge.part((t,e)=>{let n=t.DraftFrame;return(0,V.jsx)(n,{...e})},{what:"The view"});function ct(t){let{seatTalk:e}=A();return(0,K.useSyncExternalStore)(e.subscribe,()=>e.get().draft!==null,()=>!1)?(0,V.jsx)(K.Suspense,{fallback:null,children:(0,V.jsx)(He,{...t})}):null}var C=y(O(),1),D=y(M(),1),Ae=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.MPMROUZA.js","./chunk.OLKFEHWB.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.KRVEAIKW.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.IDYPQ45A.js","./chunk.TI4OSTQV.js","./chunk.7UD2JR6J.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.B6PKKEY3.js")))),ze=Ae.part((t,e)=>{let n=t.QuickAskCard;return(0,D.jsx)(n,{...e})},{what:"The quick ask"});function gt({face:t,on:e=!0}){let{ai:n,aiDesk:i,selection:c,view:p}=A(),h=me()?.open??!1,r=e&&z(n)&&!h,u=ve(i),w=(0,C.useRef)(null),k=(0,C.useRef)({selection:c,place:p.within?.view});return k.current={selection:c,place:p.within?.view},(0,C.useEffect)(()=>{if(!r)return;let l=he(i);return l.drawn+=1,U(l),()=>{l.drawn=Math.max(0,l.drawn-1),l.drawn===0&&(l.open=null),U(l)}},[r,i]),(0,C.useEffect)(()=>{if(!r)return;let l=f=>{if(f.defaultPrevented||f.key.toLowerCase()!=="k"||!(f.metaKey||f.ctrlKey)||f.altKey||f.shiftKey)return;let s=w.current?.closest("[data-graview-embed]"),o=f.target,d=!(o instanceof Node)||o===document.body||o===document.documentElement;if(s&&!(d||o instanceof Node&&s.contains(o)))return;f.preventDefault(),Ae.prefetch();let v=document.activeElement,{selection:S,place:I}=k.current;j(i,{pointed:{...S[0]!==void 0?{on:S[0]}:{},about:S,...I?{place:I}:{}},returnTo:v instanceof HTMLElement&&v!==document.body?v:null})};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[r,i]),r?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("span",{ref:w,hidden:!0,"data-graview-quick-ask":t}),u?(0,D.jsx)(C.Suspense,{fallback:null,children:(0,D.jsx)(ze,{face:t,opening:u,close:()=>j(i,null)},u.at)}):null]}):null}var R=y(O(),1),L=y(M(),1),oe=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.OLKFEHWB.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.KRVEAIKW.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.IDYPQ45A.js","./chunk.TI4OSTQV.js","./chunk.7UD2JR6J.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZAGP3OKY.js")))),qe=oe.part((t,e)=>{let n=t.InlineAiMenu;return(0,L.jsx)(n,{...e})},{what:"The AI's suggestions"}),Be=oe.part((t,e)=>{let n=t.GhostTray;return(0,L.jsx)(n,{...e})},{quiet:!0});function _e(){let{ai:t}=A(),e=z(t);return(0,R.useMemo)(()=>e?n=>({id:"inline-ai",heading:"AI",render:i=>(0,L.jsx)(R.Suspense,{fallback:null,children:(0,L.jsx)(qe,{target:n,close:i})}),prepare:()=>oe.prefetch()}):null,[e])}var Fe=[];function St({children:t}){let e=_e(),n=(0,R.useMemo)(()=>e?[e]:Fe,[e]);return(0,L.jsx)($,{sections:n,children:t})}function bt(t){let{ai:e,aiDesk:n}=A(),{ghost:i}=pe(n);return i===null||i.onCard||e.off?null:(0,L.jsx)(R.Suspense,{fallback:null,children:(0,L.jsx)(Be,{...t})})}var N=y(O(),1);var Te=y(M(),1),Qe=t=>globalThis[Symbol.for("graview.shown-lists")]?.get(t),Ee=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.FRZQSSGE.js"))));function Ve(t){let e=t.about[0];if(t.about.length!==1||!e?.startsWith("aggregate:"))return;let n=e.slice(10).split("+");return n.length===1?n[0]:void 0}function Ke(t,e){return t.filter(n=>n.as!==e.as&&!n.hidden&&(n.kind===e.kind||n.over?.includes(e.kind)===!0)).at(-1)}function Ye(t){let e=q(),n=e?.keptViews,i=e?.views,c=(0,N.useContext)(Me);return(0,N.useMemo)(()=>i?p=>{let h=n?.current(),r=Ve(p),u=s=>s.length>0?{id:"tidy-view",items:s,prepare:()=>Ee.prefetch()}:null,w=(s,...o)=>Ee.load().then(d=>d[s](...o),()=>!1),k=(s,o)=>Qe(s)?.().menu(o,n,c)??[];if(p.place===void 0){if(p.face!=="pages"||r===void 0||p.on!==void 0)return null;let s=h?.may.lenses===!0&&n?.lens!==void 0,o=H(e.store.schema,r),d=i.arrangement?.()?.hide?.includes(r)===!0;return u([...s?[{id:d?"show-list":"hide-list",label:d?"Show":"Hide",hint:d?"Back in the places, for everyone":"Off the places, for everyone; still at its address",run:()=>void w("setListHidden",r,o,n,!d,c)}]:[],...k(`list:${r}`,s)])}let l=i.places().find(s=>s.as===p.place&&(r===void 0||s.kind===r||s.over?.includes(r)===!0));if(!l)return null;let f=n&&h?se(l,h,n):null;return u([...f?[l.hidden?{id:"show-view",label:"Show",hint:"Back in the places, for everyone",run:()=>void w("setHidden",l,f,n,!1,c)}:{id:"hide-view",label:"Hide",hint:"Off the places and the scene, for everyone",run:()=>void w("setHidden",l,f,n,!0,c)},{id:"delete-view",label:"Delete",hint:`Kept ${30} days under Recently deleted`,run:()=>{let s=Ke(i.places(),l);w("remove",l,f,n,c).then(o=>o&&t?.(l,s))}}]:[],...k(`place:${l.as}`,f==="lens")])}:null,[n,i,c,t])}var Ue=[];function Dt({children:t}){let{view:e,go:n}=F(),i=(0,N.useCallback)((h,r)=>{let u=e.within?.view;e.focusId===ce(h.kind)&&(u===void 0||u===h.as)&&n(r?ue(e,r.kind,r.as):le(e,!0))},[e,n]),c=Ye(i),p=(0,N.useMemo)(()=>c?[c]:Ue,[c]);return(0,Te.jsx)($,{sections:p,children:t})}function Nt(t={}){return t.scope===void 0?te:de(te,t.scope)}var W=y(O(),1),a=y(M(),1);function Bt({inside:t=!1,widthOf:e}={}){let{store:n,view:i,emphasis:c,setEmphasis:p}=A(),h=Se(),{selection:r,set:u}=_(),{show:w}=F(),k=B(),l=(0,W.useMemo)(()=>{let o=new Map;for(let d of n.graph.allEdges()){let v=o.get(d.kind)??{count:0,ends:new Set};v.count+=1;for(let S of[d.from,d.to]){let I=n.graph.getNode(S);I&&v.ends.add(`kind:${I.kind}`)}o.set(d.kind,v)}return[...o.entries()].sort(([d],[v])=>d.localeCompare(v)).map(([d,v])=>({kind:d,count:v.count,ends:[...v.ends]}))},[n,k]),f=Math.max(0,...l.map(o=>o.count));if((0,W.useEffect)(()=>()=>p(null),[p]),!i.overview&&!t||l.length===0)return null;let s=new Set;for(let o of r){if(o.startsWith("kind:")){s.add(o);continue}let d=n.graph.getNode(o);d&&s.add(`kind:${d.kind}`)}return(0,a.jsxs)("section",{"aria-label":"What the lines mean",role:t?"group":void 0,"data-testid":"relation-key",style:t?{display:"grid",gap:1}:{position:"absolute",left:16,top:14,zIndex:ae("rail"),display:"grid",gap:1,padding:"8px 10px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",maxWidth:je,animation:"graview-settle 380ms 280ms ease backwards"},children:[t?null:(0,a.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-faint)",paddingBottom:2},children:l.length===1?"1 relation":`${l.length} relations`}),e?(0,a.jsx)(Xe,{aloft:i.overview===!0}):null,l.map(({kind:o,count:d,ends:v})=>{let{connector:S,style:I}=ee(h,o),g=Je(n.schema,o),m=c!==null?c===o:s.size===0||v.some(b=>s.has(b));return(0,a.jsxs)("button",{type:"button",title:n.schema.edge(o)?.description===void 0?`${d} of these`:g.words,onMouseEnter:()=>p(o),onMouseLeave:()=>p(null),onFocus:()=>p(o),onBlur:()=>p(null),onClick:()=>{u(v),w(null)},style:{all:"unset",outline:"revert-layer",cursor:"pointer",display:"grid",gridTemplateColumns:"30px 1fr auto",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px",borderRadius:6,opacity:m?1:.4},children:[(0,a.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",style:{display:"block",opacity:S.visible?1:.35},children:i.overview&&e?(0,a.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",className:"graview-key-ribbon",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:e(d,f)}):(0,a.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",stroke:X(I),strokeWidth:Z(I,!0),strokeDasharray:J[I.pattern],strokeLinecap:"round"})}),(0,a.jsxs)("span",{style:{display:"grid",minWidth:0},"data-graview-relation-words":o,children:[(0,a.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink)"},children:g.words}),(0,a.jsx)("span",{style:{fontSize:"0.6875rem",color:"var(--graview-ink-faint)"},children:g.ends})]}),S.visible?null:(0,a.jsx)("span",{"data-graview-quiet":o,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontStyle:"italic"},children:"not drawn"}),(0,a.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontVariantNumeric:"tabular-nums"},children:d})]},o)})]})}var je="min(280px, calc(100% - 28px))";function Je(t,e,n){let i=t.edge(e)?.from??[],c=new Map;for(let r of n!==void 0&&i.includes(n)?[n]:i.length>0?i:[""]){let u=ke(t,r,e,"out");c.set(u,[...c.get(u)??[],r])}let p=r=>r==="*"?"anything":H(t,r),h=[...c].map(([r,u])=>{let w=u.flatMap(l=>t.tryDefinition(l)?.edges[e]?.to??[]),k=u[0]&&w.length>0?`${u.map(p).join(", ")} \u2192 ${(w.includes("*")?["*"]:[...new Set(w)]).map(p).join(", ")}`:"";return[r.charAt(0).toUpperCase()+r.slice(1),k]});return{words:h.map(([r])=>r).join(" \xB7 "),ends:h.flatMap(([,r])=>r?[r]:[]).join(" \xB7 ")}}function _t({edgeKind:t,kit:e,width:n=30}){let i=q(),c=(0,W.useMemo)(()=>ie(e??i?.brand?.kit),[e,i?.brand?.kit]),{connector:p,style:h}=ee(c,t);return(0,a.jsx)("svg",{width:n,height:"8","aria-hidden":"true","data-testid":"relation-mark","data-graview-relation":t,style:{display:"inline-block",verticalAlign:"middle",opacity:p.visible?1:.35},children:(0,a.jsx)("path",{d:`M 1 4 L ${n-1} 4`,fill:"none",stroke:X(h),strokeWidth:Z(h,!0),strokeDasharray:J[h.pattern],strokeLinecap:"round"})})}function Xe({aloft:t}){let e={display:"grid",gridTemplateColumns:"30px 1fr",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px"},n={fontSize:"0.75rem",color:"var(--graview-ink-muted)"};return(0,a.jsxs)("div",{role:"group","aria-label":"The lines","data-testid":"line-manners",style:{display:"grid",gap:1,paddingBottom:6,marginBottom:4,borderBottom:"1px solid var(--graview-edge)"},children:[t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{style:e,"data-graview-manner":"ribbon",children:[(0,a.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:6})}),(0,a.jsx)("span",{style:n,children:"A relation between two districts, as wide as the links along it \u2014 point at one for its words"})]}),(0,a.jsxs)("div",{style:e,"data-graview-manner":"record",children:[(0,a.jsxs)("svg",{width:"30",height:"10","aria-hidden":"true",children:[(0,a.jsx)("path",{d:"M 1 5 L 25 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeLinecap:"round"}),(0,a.jsx)("circle",{cx:26,cy:5,r:3,fill:"var(--graview-accent)"})]}),(0,a.jsx)("span",{style:n,children:"A chosen record's link to another record, labeled with the relation"})]}),(0,a.jsxs)("div",{style:e,"data-graview-manner":"district",children:[(0,a.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeDasharray:"5 4"})}),(0,a.jsx)("span",{style:n,children:"A chosen record's links into a district, with how many"})]})]}):null,(0,a.jsxs)("div",{style:e,"data-graview-manner":"unsure",children:[(0,a.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeOpacity:we,strokeWidth:1.8,strokeDasharray:ye,strokeLinecap:"round"})}),(0,a.jsx)("span",{style:n,children:"Unsure: a link its maker was less than sure of, until a person keeps it \u2014 point at its words for what it was based on"})]})]})}var Ie=y(O(),1),re=y(M(),1),Ze=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.25VJPUDH.js","./chunk.ZDDWXRPK.js","./chunk.LOUICR7K.js","./chunk.L7MFTL5S.js","./chunk.4F5M5XZG.js","./chunk.3G5DEGFA.js","./chunk.AZGXBTOQ.js","./chunk.TI4OSTQV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.5XAIP3BS.js")))),et=Ze.part(t=>(0,re.jsx)(t.SuggestedTray,{}),{quiet:!0});function Vt(){let{store:t,whileAway:e}=A(),n=B();return(0,Ie.useMemo)(()=>t.log.all().some(c=>c.suggests!==void 0&&!c.withheld),[t,n])||e?.tidied?(0,re.jsx)(et,{}):null}export{it as a,ct as b,gt as c,Bt as d,je as e,_t as f,_e as g,St as h,bt as i,Ye as j,Dt as k,Nt as l,Vt as m};
@@ -1,21 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as dt,b as gt,c as mt,d as yt,e as ht,f as wt,g as vt}from"./chunk.33YC5RCB.js";import{a as ke,e as at}from"./chunk.BBLIT7S7.js";import{a as ft,b as Se,c as bt}from"./chunk.KY7QD22S.js";import{a as se,f as st,h as it}from"./chunk.BPWSQVEN.js";import"./chunk.PXQVXBNG.js";import{h as lt}from"./chunk.F5RN6YXG.js";import{e as pt}from"./chunk.2DFWOLL2.js";import"./chunk.B3WVCSW5.js";import{c as ut,f as ct,g as xe}from"./chunk.LU3B3SZH.js";import{b as ie,d as ae}from"./chunk.HLDMTKUP.js";import{a as H}from"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";var kt=["good","warn","bad","neutral","accent"],xt=["value","max","aria-label","placeholder","disabled"],St=["click","change"],Te=["_blank","_self"],Tt=["section","div","span","strong","p","hr","a","button","input","progress"],de={type:{oneOf:kt}},Me={"gv-card":{host:"section",properties:{tone:de},events:{},children:"any"},"gv-group":{host:"div",properties:{direction:{type:{oneOf:["row","column"]}}},events:{},children:"any"},"gv-title":{host:"strong",properties:{},events:{},children:"text"},"gv-text":{host:"p",properties:{tone:de},events:{},children:"text"},"gv-badge":{host:"span",properties:{tone:de},events:{},children:"text"},"gv-field":{host:"div",properties:{label:{type:"string"}},events:{},children:"text"},"gv-progress":{host:"progress",properties:{value:{type:"number",as:"value"},max:{type:"number",as:"max"},label:{type:"string",as:"aria-label"}},events:{},children:"none"},"gv-divider":{host:"hr",properties:{},events:{},children:"none"},"gv-link":{host:"a",properties:{href:{type:"url"}},events:{},children:"text"},"gv-button":{host:"button",properties:{tone:de,disabled:{type:"boolean",as:"disabled"}},events:{press:{from:"click"}},children:"text"},"gv-input":{host:"input",properties:{label:{type:"string",as:"aria-label"},value:{type:"string",as:"value"},placeholder:{type:"string",as:"placeholder"}},events:{change:{from:"change",detail:"value"}},children:"none"}},Ee=1e4;var jt=0,Bt=1,Ut=2,$t=3,Mt=1,Ft=2,zt=3,qt=1,Xt=3,Yt=8,Re="~",Ke=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),J=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function Et(n,e){return e.type==="url"?"href":e.as??`data-gv-${n.toLowerCase()}`}var Jt=2e3;function Rt(n,e){if(e==null)return{ok:!0,value:null};let d=n.type;if(d==="boolean")return typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,reason:"value"};if(d==="number")return typeof e=="number"&&Number.isFinite(e)?{ok:!0,value:String(e)}:{ok:!1,reason:"value"};if(typeof e!="string"||e.length>Jt)return{ok:!1,reason:d==="url"?"url":"value"};if(typeof d=="object")return d.oneOf.includes(e)?{ok:!0,value:e}:{ok:!1,reason:"value"};if(d==="url"){let m;try{m=new URL(e)}catch{return{ok:!1,reason:"url"}}return m.protocol!=="https:"||m.hostname===""||!/^https:\/\//i.test(e)?{ok:!1,reason:"url"}:{ok:!0,value:m.href}}return{ok:!0,value:e}}function Qt(n){let e=n.host==="a";return Tt.includes(n.host)&&(n.target===void 0||e&&Te.includes(n.target))&&Object.values(n.properties).every(d=>d.type!=="url"||e)&&Object.values(n.properties).every(d=>d.as===void 0||d.type!=="url"&&xt.includes(d.as))&&Object.values(n.events).every(d=>St.includes(d.from))}function Ge(n,e){let d=e.kit??Me,m=e.maxNodes??2e3,o=n.ownerDocument,y=[],w=new Map,W={dom:n,name:Re,component:{host:"div",properties:{},events:{},children:"any"},children:[],listeners:new Map,id:Re};w.set(Re,W);let K=e.links?new Set(e.links.origins.flatMap(r=>{try{let l=new URL(r);return l.protocol==="https:"&&l.hostname!==""?[l.origin]:[]}catch{return[]}})):void 0,_=0,E=0,O=!1,p=r=>{y.push(r),y.length>200&&y.shift()},R=()=>({dom:o.createComment(""),children:[],refused:!0,listeners:new Map}),M=(r,l,h)=>{let u=r.component;if(!Ke(u.properties,l))return p({reason:"property",element:r.name,name:l});let i=u.properties[l],g=Rt(i,h),v=g.ok&&i.type==="url"&&K&&typeof g.value=="string"&&!K.has(new URL(g.value).origin)?{ok:!1,reason:"url"}:g,T=r.dom,f=Et(l,i);if(!v.ok)return T.removeAttribute(f),p({reason:v.reason,element:r.name,name:l});let L=v.value;L===null||L===!1?T.removeAttribute(f):T.setAttribute(f,L===!0?"":L),f==="value"&&"value"in T&&(T.value=typeof L=="string"?L:""),f==="disabled"&&"disabled"in T&&(T.disabled=L!==null&&L!==!1)},k=(r,l,h)=>{let u=r.component;if(!Ke(u.events,l))return p({reason:"event",element:r.name,name:l});let i=r.listeners.get(l);if(i&&(i(),r.listeners.delete(l),E-=1),h==null)return;if(!J(h)||typeof h.listener!="number")return p({reason:"value",element:r.name,name:l});let g=h.listener,v=u.events[l],T=r.dom,f=()=>e.onEvent(g,v.detail==="value"?String(T.value??""):void 0);T.addEventListener(v.from,f),r.listeners.set(l,()=>T.removeEventListener(v.from,f)),E+=1},x=r=>{if(!r.refused){_-=1,r.id!==void 0&&w.delete(r.id);for(let l of r.listeners.values())l();E-=r.listeners.size,r.listeners.clear();for(let l of r.children)x(l)}},A=(r,l)=>{if(!J(r)||typeof r.id!="string"||w.has(r.id))return p({reason:"record"}),R();if(_>=m)return p({reason:"budget"}),O||(O=!0,e.onOverBudget?.()),R();let h=r.id,u=l.component.children;if(r.type===Yt)return R();if(r.type===Xt){if(u==="none")return p({reason:"child",element:l.name}),R();let f={dom:o.createTextNode(String(r.data??"").slice(0,Ee)),children:[],text:!0,listeners:new Map,id:h};return w.set(h,f),_+=1,f}if(r.type!==qt)return p({reason:"record"}),R();let i=String(r.element);if(!Ke(d,i)||!Qt(d[i]))return p({reason:"element",element:i}),R();if(u!=="any")return p({reason:"child",element:i}),R();let g=d[i],v=o.createElement(g.host);v.setAttribute("data-gv",i.replace(/^gv-/,"")),v.className=`graview-guest-${i.replace(/^gv-/,"")}`,g.host==="a"&&(v.setAttribute("rel","noopener noreferrer"),v.setAttribute("target",g.target??"_blank"),v.setAttribute("referrerpolicy","no-referrer")),g.host==="button"&&v.setAttribute("type","button");let T={dom:v,name:i,component:g,children:[],listeners:new Map,id:h};if(w.set(h,T),_+=1,J(r.properties))for(let[f,L]of Object.entries(r.properties))M(T,f,L);if(J(r.attributes))for(let f of Object.keys(r.attributes))p({reason:"attribute",element:i,name:f});if(J(r.eventListeners))for(let[f,L]of Object.entries(r.eventListeners))k(T,f,L);if(Array.isArray(r.children))for(let f of r.children){let L=A(f,T);T.children.push(L),v.appendChild(L.dom)}return T},N=r=>{if(!Array.isArray(r))return p({reason:"record"});let[l,h]=r,u=typeof h=="string"?w.get(h):void 0;if(!u)return p({reason:"record"});switch(l){case jt:{if(u.text)return p({reason:"record"});let i=Number(r[3]),g=Number.isInteger(i)&&i>=0&&i<=u.children.length?i:u.children.length,v=A(r[2],u);u.dom.insertBefore(v.dom,u.children[g]?.dom??null),u.children.splice(g,0,v);return}case Bt:{let i=Number(r[2]),g=u.children[i];if(!g)return p({reason:"record"});u.children.splice(i,1),g.dom.parentNode?.removeChild(g.dom),x(g);return}case Ut:if(!u.text)return p({reason:"record"});u.dom.data=String(r[2]??"").slice(0,Ee);return;case $t:{if(u===W||u.text)return p({reason:"record"});let i=String(r[2]),g=r[4]??Mt;return g===Mt?M(u,i,r[3]):g===zt?k(u,i,r[3]):p(g===Ft?{reason:"attribute",element:u.name,name:i}:{reason:"record"})}default:return p({reason:"record"})}};return{apply(r,l){if(!Array.isArray(r))return p({reason:"record"}),!0;for(let h=0;h<r.length;h+=1){if(l&&h%32===0&&l())return!1;N(r[h])}return!0},get refused(){return y},get size(){return _},get listening(){return E},dispose(){for(let r of W.children)x(r);W.children.length=0,n.replaceChildren()}}}var We=`
2
- .graview-guest { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: var(--graview-ink, inherit); font: inherit; }
3
- .graview-guest-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--graview-edge, #d0d0d0); border-radius: 10px; background: var(--graview-panel, transparent); }
4
- .graview-guest-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
5
- .graview-guest-group[data-gv-direction="row"] { flex-direction: row; flex-wrap: wrap; align-items: center; }
6
- .graview-guest-title { font-weight: 600; font-size: 1rem; overflow-wrap: anywhere; }
7
- .graview-guest-text { margin: 0; font-size: 0.875rem; line-height: 1.45; overflow-wrap: anywhere; }
8
- .graview-guest-badge { align-self: flex-start; padding: 1px 8px; border: 1px solid currentColor; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; }
9
- .graview-guest-field { font-size: 0.875rem; overflow-wrap: anywhere; }
10
- .graview-guest-field[data-gv-label]::before { content: attr(data-gv-label) " "; color: var(--graview-ink-muted, inherit); }
11
- .graview-guest-progress { width: 100%; }
12
- .graview-guest-divider { width: 100%; margin: 2px 0; border: 0; border-top: 1px solid var(--graview-edge, #d0d0d0); }
13
- .graview-guest-link { color: var(--graview-accent, inherit); text-decoration: underline; }
14
- .graview-guest-button { align-self: flex-start; font: inherit; padding: 4px 12px; border-radius: 8px; border: 1px solid var(--graview-edge, #d0d0d0); background: var(--graview-panel, transparent); color: inherit; cursor: pointer; }
15
- .graview-guest-input { font: inherit; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--graview-edge, #d0d0d0); }
16
- .graview-guest [data-gv-tone="good"] { color: var(--graview-good, inherit); }
17
- .graview-guest [data-gv-tone="bad"] { color: var(--graview-bad, inherit); }
18
- .graview-guest [data-gv-tone="warn"] { color: var(--graview-warn, inherit); }
19
- .graview-guest [data-gv-tone="accent"] { color: var(--graview-accent, inherit); }
20
- .graview-guest [data-gv-tone="neutral"] { color: var(--graview-ink-muted, inherit); }
21
- `;var Kt=new WeakSet;function Zt(n,e){if(n.startsWith("blob:"))return"blob:";try{return new URL(n,e.location.href).origin}catch{return n}}function Gt(n,e,d){let m=Zt(e,n),o=`this page's Content-Security-Policy${d?` (${d})`:""} does not allow a worker from ${m}: it needs worker-src ${m}`;return Kt.has(n)||(Kt.add(n),n.console?.warn?.(`Graview: worker views cannot start on this page, because ${o}. A host that will not allow ${m} serves each view's whole script from its own origin and passes worker: { url } (the @graview/guest README, "What the host page allows").`)),o}function er(n,e){return n===""?!0:e.startsWith("blob:")?n.startsWith("blob"):e.startsWith(n)||n.startsWith(e)}function le(n,e){let d="script"in e.source?n.URL.createObjectURL(new n.Blob([e.source.script],{type:"text/javascript"})):void 0,m="script"in e.source?d:e.source.url,o,y,w=!1,W=!1,K=0,_=0,E="",O=0,p=0,R=n.performance,M=R.now(),k,x=u=>{let i=u,g=String(i.effectiveDirective||i.violatedDirective||"").split(" ")[0];/^(worker-src|script-src|script-src-elem|child-src|default-src)$/.test(g)&&er(String(i.blockedURI??""),m)&&(k=g)},A=n.document;A?.addEventListener("securitypolicyviolation",x);let N=()=>A?.removeEventListener("securitypolicyviolation",x),r=()=>{W||(W=!0,y?.close(),o?.terminate(),o=void 0,n.clearTimeout(K),n.clearInterval(_),N(),d&&n.URL.revokeObjectURL(d))},l=(u,i)=>{W||(r(),e.onStop(u,i))},h=()=>{n.clearTimeout(K),N(),E=dt();let u=new n.MessageChannel;y=u.port1;let i=Math.max(1,e.silentMs),g=Math.max(10,Math.min(1e3,Math.floor(i/4)));M=R.now();let v=M;_=n.setInterval(()=>{let f=R.now();if(f-v>g*2&&(M+=f-v-g),v=f,f-M>=i)return l("silent");O+=1,u.port1.postMessage({type:"heartbeat",beat:O})},g);let T={graview:"host-hello",protocol:1,nonce:E,view:e.name};o.postMessage(T,[u.port2]),e.onReady(E,u.port1)};try{o=new n.Worker(m,{name:e.name})}catch(u){o=void 0;let i=u,g=i?.name==="SecurityError"?Gt(n,m,k):`the worker could not be made: ${String(i?.message??u)}`;queueMicrotask(()=>l("start",g))}return o&&(K=n.setTimeout(()=>l("start",`it never said it was ready in ${e.readyMs.toLocaleString("en-US")} ms`),e.readyMs),o.onerror=u=>{let i=typeof u.message=="string"&&u.message!==""?u.message:void 0;if(w)return void e.onError?.(i??"an error");n.clearTimeout(K),n.setTimeout(()=>!w&&l("start",k?Gt(n,m,k):i?`it failed before it said ready: ${i}`:"it failed before it said ready, and the engine gave no reason (a page policy that refuses it, or a script that does not load)"),0)},o.onmessage=u=>{if(!e.limiter.message()||w||!at(u.data)||u.data.protocol!==1){e.onDropped();return}w=!0,h()}),{get worker(){return o},answer(u){let i=u;return typeof i!="object"||i===null||i.type!=="heartbeat"||i.nonce!==E?!1:(typeof i.beat=="number"&&i.beat>p&&i.beat<=O&&(p=i.beat,M=R.now()),!0)},stop:r}}function ue(n,e){let d=e(),m=0;return{draw(o){let y=e();y-d>=1e3&&(d=y,m=0);let w=o(()=>m+(e()-y)>=n);return m+=e()-y,w&&m<n}}}var tr=Symbol.for("graview.view.clicked");function Wt(n,e){n[tr]=Object.freeze([...e])}var rr=H(()=>(__graviewPreload(import.meta.url,["./chunk.F5RN6YXG.js","./chunk.AJZBJBMO.js"]),import("./chunk.XE72DFBV.js"))),nr=H(()=>(__graviewPreload(import.meta.url,["./chunk.2DFWOLL2.js","./chunk.B3WVCSW5.js","./chunk.LU3B3SZH.js","./chunk.HLDMTKUP.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.RCFAHV5N.js"))),or=H(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.DVG47BK3.js"))),sr=H(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.TUNHUTQ5.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZYW7Q5EN.js"))),ir=H(()=>(__graviewPreload(import.meta.url,["./chunk.LU3B3SZH.js","./chunk.HLDMTKUP.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.NGWHV4G6.js"))),ar=H(()=>(__graviewPreload(import.meta.url,["./chunk.BBLIT7S7.js","./chunk.AJZBJBMO.js"]),import("./chunk.RRCPEHM4.js")));function dr(n,e,d){switch(n){case"manifest":return d??"Its manifest names something this app does not have.";case"source":return d??`Its code is longer than the ${e.maxSourceBytes.toLocaleString("en-US")} bytes a view may be.`;case"start":return`It could not start${d?`: ${d}.`:"."}`;case"error":return`It failed before it drew anything${d?`: ${d}`:"."}`;case"silent":return`It stopped answering for ${e.silentMs.toLocaleString("en-US")} ms.`;case"nodes":return`It drew more than the ${e.maxNodes.toLocaleString("en-US")} things a view may draw.`;case"flood":return`It sent more than ${e.messages} messages in ${e.messageWindowMs.toLocaleString("en-US")} ms.`;case"slow":return`It took longer than ${e.pushMs.toLocaleString("en-US")} ms to draw what it was shown.`}}function lr(n,e){let d=n.ownerDocument,m=d.defaultView,{manifest:o}=e,y=d.createElement("div");y.className="graview-worker-view",y.setAttribute("role","region"),y.setAttribute("aria-label",o.title??o.name),y.setAttribute("data-worker-view",o.name),y.style.cssText="display:block;position:relative;contain:layout paint style;isolation:isolate;overflow:clip;min-width:0",n.appendChild(y);let w=y.attachShadow({mode:"open"}),W=e.author?d.createElement("p"):void 0;W&&(W.className="graview-worker-view-author",W.setAttribute("data-worker-view-author",o.name),W.style.cssText="margin:4px 0 0;font-size:0.75rem;color:var(--graview-ink-muted, inherit)",W.textContent=e.author,n.appendChild(W));let K={applied:0,refused:0,dropped:0},_=ie(e.limits),E={maxSourceBytes:e.limits?.maxSourceBytes??256e3,maxNodes:e.limits?.maxNodes??5e3,messages:e.limits?.messages??120,messageWindowMs:e.limits?.messageWindowMs??1e3,pushMs:e.limits?.pushMs??1e3,silentMs:e.limits?.silentMs??5e3,drawMs:e.limits?.drawMs??100},O,p,R,M,k=!1,x={applied:0,refused:0,dropped:0},A=[],N=()=>{if(!p)return;let t=p.stats;K.applied+=t.applied-x.applied,K.refused+=t.refused-x.refused,K.dropped+=t.dropped-x.dropped,x={...t}},r=()=>{},l,h,u=()=>{let t=w.querySelector("[data-graview-view-root]"),c=m.ResizeObserver;h||!t||typeof c!="function"||(h=new c(b=>{let S=b[b.length-1]?.borderBoxSize?.[0],s=Math.ceil(S?S.blockSize:t.offsetHeight);s!==l&&(l=s,y.setAttribute("data-graview-content-height",String(s)),e.onContentHeight?.(s))}),h.observe(t))},i=()=>{h&&(h.disconnect(),h=void 0,l=void 0,y.removeAttribute("data-graview-content-height"),e.onContentHeight?.(void 0))},g=0,v=()=>{},T=()=>{v(),v=()=>{},N(),p?.dispose(),p=void 0,R?.stop(),r(),m.clearInterval(g)},f=(t,c)=>{if(k)return;k=!0,T(),i(),M?.dispose();let b=dr(t,E,c);y.removeAttribute("data-worker-view-drawn"),y.setAttribute("data-worker-view-failed",t),e.fallback!==!1&&(e.fallback??L)(y,t,b),e.onFailure?.(t,b)},L=(t,c,b)=>{let S=O??(()=>{try{return xe(e.store,e.principal,{manifest:o,...e.input?{input:e.input()}:{}})}catch{return}})(),s=d.createElement("div");s.setAttribute("data-graview-fallback",c),s.style.cssText="padding:12px;display:grid;gap:6px;color:var(--graview-ink, inherit);font-family:var(--graview-font-body, inherit)";let I=d.createElement("strong");I.textContent=o.title??o.name;let C=d.createElement("ul");C.style.cssText="margin:0;padding-left:1.2em";for(let re of[...S?.node?[S.node]:[],...S?.nodes??[]]){let ne=d.createElement("li");ne.textContent=re.label??re.id,C.appendChild(ne)}let U=d.createElement("p");U.style.cssText="margin:0;font-size:0.8125rem;color:var(--graview-ink-muted, inherit)",U.textContent=`This view was stopped. ${b}`,s.append(I,C,U),w.replaceChildren(s)},Oe=ct(o,e.store);if(Oe.length>0)return queueMicrotask(()=>f("manifest",Oe.join(" "))),he();let Ae=t=>{if(("source"in t?new TextEncoder().encode(t.source).length:"script"in t?new TextEncoder().encode(t.script).length:0)>E.maxSourceBytes)return["source"];let b="source"in t?ft(t.source):[];return b.length>0?["source",b.join(" ")]:void 0},$=e.worker,Le=typeof $=="function"?void 0:Ae($);if(Le)return queueMicrotask(()=>f(...Le)),he();let _e=vt(m,()=>Ne(),"blob"),ce=()=>wt(()=>e.theme?.()??yt(y),e.brand,_e),Ie="",pe=()=>{Ie=JSON.stringify(ce()),p?.push()},Ne=()=>{p&&JSON.stringify(ce())!==Ie&&pe()},At=ht(d,Ne),j,B,Pe=o.pictures?or().then(({createGuestPictures:t})=>{k||(j=t(m,{as:"blob",view:`"${o.title??o.name}"`,pictures:o.pictures,...e.limits?{limits:e.limits}:{},...e.file?{file:e.file}:{},moved:()=>p?.push(),onLeft:c=>{V?.postMessage({type:"notice",text:c}),e.onProblem?.(c)}}))}):Promise.resolve();r=()=>{At(),_e.dispose(),j?.dispose(),X?.dispose(),B?.dispose(),te?.dispose()};let V,Q=t=>V?.postMessage(t),Ce=!1,Ve=!1,Z=()=>y.toggleAttribute("data-worker-view-drawn",!k&&Ve&&M!==void 0&&A.length===0&&z.size===0&&!j?.waiting()&&!(B?.waiting??0)),F=m.performance,z=new Map,ee=F.now(),fe=Math.max(10,Math.min(250,Math.floor(E.pushMs/4))),Lt=()=>{g||(ee=F.now(),g=m.setInterval(()=>{let t=F.now(),c=t-ee>fe*2?t-ee-fe:0;ee=t;for(let[b,S]of z){let s=S+c;if(z.set(b,s),t-s>=E.pushMs)return f("slow")}},fe))},_t=ue(E.drawMs,()=>F.now()),De=()=>{},ge=t=>{if(k)return;if(!M)return void A.push(t);let c=M;if(!_t.draw(S=>t[0]==="render"?c.apply(t[1],S):(c.style(t[1]),!0)))return f("slow");t[0]==="render"&&De()},He=()=>st(e.store.schema,new Set([...e.store.kindsKeptFrom(e.principal),...e.store.modules.disabledKinds])),q=it({sees:t=>e.store.seenBy(e.principal).graph.has(t),places:()=>se(e.places?.()??[]),lists:He,schema:e.store.schema,...e.onNavigate?{onNavigate:e.onNavigate}:e.goTo?{onNavigate:t=>gt(e.goTo(),t)}:{},...e.hrefOf?{hrefOf:e.hrefOf}:!e.onNavigate&&e.goTo?{hrefOf:t=>mt(e.goTo(),t)}:{},onLost:t=>{V?.postMessage({type:"notice",text:t}),e.onProblem?.(t)}}),D=new Set,je=new Set,X,Be=!1,Ue=()=>{Be||(Be=!0,sr().then(({createGuestMedia:t})=>{k||(X=t(m,{view:`"${o.title??o.name}"`,pictures:o.pictures!==void 0,shown:()=>O,...e.file?{file:e.file}:{},onProblem:c=>{V?.postMessage({type:"notice",text:c}),e.onProblem?.(c)}}),X.refresh(w))},()=>e.onProblem?.(`The view "${o.title??o.name}" places a video or a full-screen viewer, and the host's player could not be loaded.`)))},$e=!1,Fe=!1,me=new Map,ze=()=>{$e||!o.accepts?.length||($e=!0,ir().then(({createGuestDrops:t})=>{k||(B=t(m,{shadow:w,manifest:o,store:e.store,principal:e.principal,files:()=>e.files?.(),shown:()=>D,hears:()=>Fe,idOf:c=>M?.renderer.idOf(c),send:Q,change:(c,b)=>{if(!p)return{ok:!1,reason:"refused",message:"The view has gone."};let S=p.change(c,b);return N(),S},handed:c=>me.set(c.href,c),onProblem:c=>{V?.postMessage({type:"notice",text:c}),e.onProblem?.(c)},onBusy:()=>Z()}),B.refresh())},()=>e.onProblem?.(`The view "${o.title??o.name}" takes files, and the host's drop could not be loaded.`)))},te,qe=[],Xe=!1,It=t=>{qe=t,te?.bind(t),!(Xe||t.length===0)&&(Xe=!0,ar().then(({createGuestGestures:c,unheardWords:b})=>{if(!k){if(o.gestures!==!0){let S=b(o.title??o.name);return V?.postMessage({type:"notice",text:S}),e.onProblem?.(S)}te=c(w,{root:()=>w.querySelector("[data-graview-view-root]")??void 0,idOf:S=>M?.renderer.idOf(S),send:Q}),te.bind(qe)}},()=>{}))},Nt=t=>{let c=e.store.seenBy(e.principal).graph;for(let b of D){let S=c.getNode(b);for(let s of Object.values(S??{}))for(let I of ut(s))if(I.href===t)return I}},Ye=t=>{if(t.localName==="graview-video")return Ue();t.hasAttribute("data-lightbox")&&(t.setAttribute("aria-haspopup","dialog"),Ue())};Promise.all([rr(),nr()]).then(([{createOpenDrawing:t,handedLinks:c,judgeLink:b,linkRefusedWords:S},{createPressReader:s,createSaver:I,fillPrefills:C,judgePress:U,markPresses:re,prefillOf:ne,quietPictures:Pt}])=>{if(k)return;let Y=s(),Qe=(a,G)=>{let P=M?.renderer.idOf(a);P!==void 0&&Q({type:"dom-event",target:P,event:"acted",pressed:G})},we=I({reader:Y,save:(a,G)=>{if(!p)return;let P=p.pressed(U(e.store,o,D,a));N(),Qe(G,{as:a.as,...P})}}),Ze=()=>we.flush();m.addEventListener("pagehide",Ze),v=()=>{m.removeEventListener("pagehide",Ze),we.flush()};let Ct=new WeakSet;De=()=>{q.refresh(w),re(w),Pt(w),C(w,Y,Ct,a=>ne(e.store,e.principal,o,D,a)),X?.refresh(w),B?.refresh()};let et,tt=new Set,Vt=()=>(et!==O&&([et,tt]=[O,c(O)]),tt),rt=new Set;M=t(w,{origin:e.origin??m.location.origin,link:a=>b(a,{handed:Vt(),...e.links?{origins:e.links.origins}:{}}),...e.asset?{asset:e.asset}:{},...e.images?{imageOrigins:e.images.origins}:{},...o.pictures?{picture:a=>j?.drawn(a)}:{},onRefused:a=>{if(a.reason==="url"&&a.element==="a"&&a.address!==void 0&&!rt.has(a.address)){rt.add(a.address);let P=S(a.address,e.links?.origins);return V?.postMessage({type:"notice",text:P}),e.onProblem?.(P)}if(a.reason!=="url"||a.element!=="img"||a.address===void 0||je.has(a.address))return;je.add(a.address);let G=lt(a.address,{...e.images?{origins:e.images.origins}:{},assets:e.asset!==void 0},a.length);V?.postMessage({type:"notice",text:G}),e.onProblem?.(G)},...e.limits?.maxNodes!==void 0?{maxNodes:e.limits.maxNodes}:{},onOverBudget:()=>f("nodes"),send:Q,onFieldSet:a=>Y.filled(a),onAttribute:(a,G)=>{(G==="data-record"||G==="data-place")&&q.link(a),G==="data-lightbox"&&Ye(a),G==="data-drop"&&ze()},decorate:a=>{(a.hasAttribute("data-record")||a.hasAttribute("data-place"))&&q.link(a),Ye(a),a.hasAttribute("data-drop")&&ze()},before:(a,G,P)=>{Y.heard(a,G),we.heard(a,G,P),q.pressed(a,G,P);let ve=G.closest("a[href]");ve&&P.contains(ve)&&!ve.hasAttribute("data-graview-link")&&a.type==="click"&&a.stopPropagation();let oe=G.closest("[data-lightbox]"),nt=a.type==="keydown"?a.key:void 0;if(oe&&P.contains(oe)&&a.isTrusted&&(a.type==="click"||(nt==="Enter"||nt===" ")&&oe.localName!=="button")&&(a.preventDefault(),a.stopPropagation(),X?.open(oe)),B?.before(a,G,P))return!1;let be=Y.press(a,G,P);if(!be||!p)return;a.stopPropagation(),a.type==="keydown"&&a.preventDefault();let Dt=p.pressed(U(e.store,o,D,be));N();let ot={as:be.as,...Dt},Ht=G.closest("[data-act]");return queueMicrotask(()=>Qe(Ht,ot)),{pressed:ot}}});for(let a of A.splice(0))ge(a);u(),Z()},()=>f("start","the view's drawing could not be loaded"));let ye=t=>R=le(m,{source:t,name:o.name,limiter:_,readyMs:e.limits?.readyMs??5e3,silentMs:e.limits?.silentMs??5e3,onDropped:()=>K.dropped+=1,onStop:(c,b)=>f(c,b),onError:c=>{Ce||f("error",c)},onReady:(c,b)=>{V=b,Lt();let S=ae({store:e.store,principal:e.principal,view:o.name,nonce:c,send:s=>{s.type==="props"&&typeof s.push=="number"&&(z.set(s.push,F.now()),Z()),b.postMessage(s)},props:()=>{let s=xe(e.store,e.principal,{manifest:o,...e.input?{input:e.input()}:{},theme:ce(),...e.places?{places:se(e.places())}:{}});return D=new Set([...s.node?[s.node.id]:[],...(s.nodes??[]).map(I=>I.id)]),O=s,s},...j?{hand:j.hand}:{},judgeAct:(s,I)=>pt(e.store,o,s,I,{shown:D,file:C=>me.get(C)??Nt(C),dropped:C=>me.has(C)}),onHears:s=>{s.includes("drop")&&(Fe=!0)},onGestures:It,onClicks:s=>Wt(y,s),onRender:s=>{Ce=!0,ge(["render",s])},onPushed:(s,I)=>{if(z.delete(s),I>=E.pushMs)return f("slow");Ve=!0,Z()},onFlood:()=>f("flood"),onStyle:s=>ge(["style",s]),places:()=>[...new Set([...se(e.places?.()??[]).map(s=>s.as),...He().map(s=>s.slug)])],...e.limits?{limits:e.limits}:{},limiter:_});p=S,b.onmessage=({data:s})=>{if(!R?.answer(s)&&(S.receive(s),N(),!k&&s?.nonce===c&&s.type==="navigate")){let I={...s.where!==void 0?{where:s.where}:{},...s.section!==void 0?{section:s.section}:{}},C=typeof s.place=="string"?{place:s.place,...I}:typeof s.to=="string"&&{record:s.to,...I};C&&q.go(C)}},pe()}}),Je=t=>{"source"in t?(o.pictures?Promise.all([Se(t.source),Pe]).then(([c])=>c):Se(t.source)).then(c=>{k||ye({script:c})},()=>f("start","the view's runtime could not be loaded")):o.pictures?Pe.then(()=>{k||ye(t)},()=>f("start","the view's pictures could not be loaded")):ye(t)};return typeof $=="function"?bt($).then(t=>{if(k)return;let c=Ae(t);c?f(...c):Je(t)},t=>f("source",`Its code did not arrive${t instanceof Error&&t.message?`: ${t.message}`:""}.`)):Je($),he();function he(){return{element:y,shadow:w,get worker(){return R?.worker},update:()=>{p&&pe()},get stats(){return N(),K},get refused(){return M?.refused??[]},get contentHeight(){return l},dispose(){k=!0,T(),h?.disconnect(),M?.dispose(),y.remove(),W?.remove()}}}}var Ot="graview-guest-kit";function Vr(n,e){let d=n.ownerDocument,m=d.defaultView;if(!d.getElementById(Ot)){let x=d.createElement("style");x.id=Ot,x.textContent=We,d.head.appendChild(x)}let o=d.createElement("div");o.className="graview-guest",o.setAttribute("role","group"),o.setAttribute("aria-label",e.title??e.view),o.setAttribute("data-guest-view",e.view),n.appendChild(o);let y={applied:0,refused:0,dropped:0},w=ie(e.limits),W=ue(e.limits?.drawMs??100,()=>m.performance.now()),K,_,E,O=!1,p={applied:0,refused:0,dropped:0},R=()=>{if(!K)return;let x=K.stats;y.applied+=x.applied-p.applied,y.refused+=x.refused-p.refused,y.dropped+=x.dropped-p.dropped,p={...x}},M=()=>{R(),K?.dispose(),K=void 0,E?.stop()},k=(x,A)=>{O||(O=!0,M(),_?.dispose(),e.onFailure?.(x,A))};return E=le(m,{source:e.worker,name:e.view,limiter:w,readyMs:e.limits?.readyMs??5e3,silentMs:e.limits?.silentMs??5e3,onDropped:()=>y.dropped+=1,onStop:(x,A)=>k(x,A),onReady:(x,A)=>{let N=Ge(o,{...e.kit?{kit:e.kit}:{},...e.links?{links:e.links}:{},onEvent:(l,h)=>A.postMessage({type:"event",listener:l,...h!==void 0?{detail:h}:{}}),...e.limits?.maxNodes!==void 0?{maxNodes:e.limits.maxNodes}:{},onOverBudget:()=>k("budget")});_=N;let r=ae({store:e.store,principal:e.principal,view:e.view,nonce:x,send:l=>A.postMessage(l),onRender:l=>{W.draw(h=>N.apply(l,h))||k("slow")},...e.input?{input:e.input}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{},onSize:e.onSize??(l=>o.style.minHeight=`${l}px`),...e.limits?{limits:e.limits}:{},limiter:w});K=r,A.onmessage=l=>{E?.answer(l.data)||(r.receive(l.data),R())},r.push()}}),{element:o,get worker(){return E?.worker},update:()=>K?.push(),get stats(){return R(),y},get refused(){return _?.refused??[]},dispose(){O=!0,M(),_?.dispose(),o.remove()}}}export{Me as GUEST_KIT,We as GUEST_KIT_CSS,Te as KIT_LINK_TARGETS,kt as KIT_TONES,Ge as createKitRenderer,Et as hostAttribute,Rt as kitValue,Vr as mountGuestWorker,lr as mountWorkerView};
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{L as H,N,zb as L}from"./chunk.3MZIWKNG.js";var F=()=>(__graviewPreload(import.meta.url,["./chunk.BPWSQVEN.js","./chunk.PXQVXBNG.js","./chunk.B3WVCSW5.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.KI6M3EWZ.js"));function D(n,u,y){let a=new Map;for(let l of y?.kinds??[])for(let t of n.nodesOfKind(l))u.has(t.id)||a.set(t.id,t);let o=new Set([...u,...a.keys()]),p=new Set(y?.edges??[]),k=new Set;if(p.size>0&&u.size>0){for(let l of u)for(let t of n.outEdges(l))p.has(t.kind)&&a.has(t.to)&&k.add(t.to);for(let l of a.keys())n.outEdges(l).some(t=>p.has(t.kind)&&u.has(t.to))&&k.add(l)}let S=new Map([...[...a].filter(([l])=>k.has(l)),...[...a].filter(([l])=>!k.has(l))]),h=[];if(p.size>0)for(let l of o)for(let t of n.outEdges(l))p.has(t.kind)&&o.has(t.to)&&h.push({kind:t.kind,from:t.from,to:t.to});return{nodes:[...S.values()],edges:h}}function E(n,u,y){let a=[];return()=>{let o=y();for(;a.length>0&&a[0]<=o-u;)a.shift();return a.length>=n?!1:(a.push(o),!0)}}function C(n={},u=Date.now){return{act:E(n.acts??30,n.actWindowMs??6e4,u),message:E(n.messages??120,n.messageWindowMs??1e3,u)}}var A=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function K(n,u){let y=structuredClone(u),a=n.schema.tryDefinition(y.kind),o=y.label;return{...y,label:a?.label?a.label(y):typeof o=="string"&&o.length>0?o:y.id}}function J(n){let u=n.limiter??C(n.limits,n.now),y=n.limits?.maxHeight??4e3,a=`view:${n.view}`,o={applied:0,refused:0,dropped:0},p=()=>n.store.seenBy(n.principal),k=e=>K(n.store,e),S=()=>{if(n.props)return n.props();let e=p(),d=e.graph,r=n.input?.()??{},f=r.node?d.getNode(r.node.id):void 0,i=r.nodes?.flatMap(s=>{let m=d.getNode(s.id);return m?[m]:[]}),g=new Set([...f?[f.id]:[],...(i??[]).map(s=>s.id)]),c=[];for(let s of g)for(let m of d.outEdges(s))g.has(m.to)&&c.push({kind:m.kind,from:m.from,to:m.to});let G=D(d,g,n.reads),b=new Set(c.map(s=>`${s.kind} ${s.from} ${s.to}`));for(let s of G.edges)b.has(`${s.kind} ${s.from} ${s.to}`)||c.push(s);let v=G.nodes.length>0?[...i??[],...G.nodes]:i,M=s=>s?.filter(m=>d.has(m)),T=e.permittedMutations(n.principal).map(s=>({name:s.name,title:s.title??s.name,...s.description!==void 0?{description:s.description}:{},...s.subject?{subject:{kinds:s.subject.kinds,arg:s.subject.arg}}:{}}));return{view:n.view,...f?{node:k(f)}:{},...v?{nodes:v.map(k)}:{},edges:c,...r.label!==void 0?{label:r.label}:{},...r.fidelity!==void 0?{fidelity:r.fidelity}:{},...r.cardinality!==void 0?{cardinality:r.cardinality}:{},...r.mode!==void 0?{mode:r.mode}:{},...r.selected!==void 0?{selected:r.selected}:{},...r.implicated?{implicated:M(r.implicated)}:{},...r.flagged?{flagged:M(r.flagged)}:{},acts:T,...n.theme?{theme:n.theme()}:{},locale:H(),timeZone:N(),...n.placesShown?{places:n.placesShown().map(({as:s,title:m,kind:$})=>({as:s,title:m,kind:$}))}:{}}},h=!1,l=0,t=new Set,P=()=>{if(h)return;l+=1,t.add(l),t.size>100&&t.delete(t.values().next().value);let e=S();n.send({type:"props",props:n.hand?n.hand(e):e,push:l})},R=!1,j=n.store.subscribe(()=>{R||(R=!0,queueMicrotask(()=>{R=!1,P()}))}),w=(e,d)=>(o.refused+=1,{ok:!1,reason:e,message:d}),O=(e,d,r)=>x([{name:e,args:d}],r),x=(e,d,r)=>{if(!u.act())return w("rate-limited","Too many acts asked for at once; this one was not applied.");let f=[];for(let{name:i,args:g}of e){if(d){let c=d(i,g);if(!c.ok)return w(c.reason,c.message);i=c.name,g=c.args}if(!n.store.allMutations().some(c=>c.name===i))return w("unknown-act","There is no act by that name here.");f.push({name:i,args:g})}try{let i=n.store.applyAll(f,{author:n.principal,via:a,...r?{intent:r}:{}});return o.applied+=1,{ok:!0,intent:i.intent}}catch(i){return i instanceof L?w("refused",i.refusal.message):w("failed","The act could not be applied.")}},z=(e,d,r)=>{let f=Array.isArray(r);if(typeof d!="string"||(f?r.length===0||r.length>100||!r.every(A):!A(r)))return o.refused+=1,n.send({type:"answer",id:e,ok:!1,reason:"malformed",message:"An act is asked for by name, with its arguments as an object, or a list of 1 to 100 of them for several as one change."});let i=x((f?r:[r]).map(g=>({name:d,args:g})),n.judgeAct);n.send(i.ok?{type:"answer",id:e,ok:!0,intent:i.intent}:{type:"answer",id:e,ok:!1,reason:i.reason,message:i.message})};return{receive(e){if(h)return;if(!(A(e)&&e.nonce===n.nonce&&e.type==="pushed"&&typeof e.push=="number"&&t.delete(e.push))&&!u.message()){o.dropped+=1,n.onFlood?.();return}if(!A(e)||e.nonce!==n.nonce){o.dropped+=1;return}if(e.type==="act"&&(typeof e.id=="string"||typeof e.id=="number"))return z(e.id,e.name,e.args);if(e.type==="navigate"&&n.onArrive&&(typeof e.place=="string"||typeof e.to=="string")){let r={...e.where!==void 0?{where:e.where}:{},...e.section!==void 0?{section:e.section}:{}},f=typeof e.place=="string"?{place:e.place,...r}:{record:e.to,...r},i=n.onArrive;F().then(({judgeDestination:g,listsOf:c})=>{if(h)return;let G=new Set([...n.store.kindsKeptFrom(n.principal),...n.store.modules.disabledKinds]),b=g(f,{sees:v=>p().graph.has(v),places:n.placesShown?.()??[],lists:c(n.store.schema,G),schema:n.store.schema});b.ok?i(b.arrival):(o.dropped+=1,n.onLost?.(b.says))});return}if(e.type==="navigate"&&typeof e.place=="string"){n.places?.().includes(e.place)?n.onNavigatePlace?.(e.place):o.dropped+=1;return}if(e.type==="navigate"&&typeof e.to=="string"){p().graph.has(e.to)?n.onNavigate?.(e.to):o.dropped+=1;return}if(e.type==="render"&&Array.isArray(e.records)&&n.onRender){n.onRender(e.records);return}if(e.type==="style"&&Array.isArray(e.sheets)&&e.sheets.every(r=>typeof r=="string")&&n.onStyle){n.onStyle(e.sheets);return}if(e.type==="hears"&&Array.isArray(e.events)&&n.onHears){n.onHears(e.events.filter(r=>typeof r=="string").slice(0,20));return}if(e.type==="clicks"&&Array.isArray(e.selectors)){n.onClicks?.(e.selectors.filter(r=>typeof r=="string"&&r.length<=500).slice(0,200));return}if(e.type==="gestures"&&Array.isArray(e.bound)&&n.onGestures){n.onGestures(e.bound.slice(0,32));return}if(e.type==="pushed"&&typeof e.push=="number"&&typeof e.ms=="number"&&n.onPushed){n.onPushed(e.push,e.ms);return}if(e.type==="size"&&typeof e.height=="number"&&Number.isFinite(e.height)){n.onSize?.(Math.max(0,Math.min(y,Math.round(e.height))));return}o.dropped+=1},push:P,pressed(e){return h?{ok:!1,reason:"refused",message:"The view has gone."}:e.ok?O(e.name,e.args):(o.refused+=1,e)},change(e,d){return h?{ok:!1,reason:"refused",message:"The view has gone."}:x(e,void 0,d)},get stats(){return o},dispose(){h=!0,j()}}}export{D as a,C as b,K as c,J as d};
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{q as He}from"./chunk.MPMROUZA.js";import{d as Je,e as Ee,f as ze,g as je}from"./chunk.ZDDWXRPK.js";import{a as Ie}from"./chunk.Q6RUTFU3.js";import{e as X}from"./chunk.AG7CUSSV.js";import{a as j}from"./chunk.C6HBYRGJ.js";import{f as De,g as Y,i as Pe}from"./chunk.RLO3RDYH.js";import{a as Se}from"./chunk.TUNHUTQ5.js";import{$a as ke,Ba as K,Bb as ve,Da as he,Eb as Ae,Fa as ye,Fb as Oe,Ga as Z,Ib as Re,K as pe,Lb as Te,Na as ge,Oa as be,Ob as C,Ra as we,Wb as _e,Ya as W,a as fe,ea as G,ed as $e,kc as xe,lc as Me,mc as Ne,ya as me}from"./chunk.3MZIWKNG.js";var E=(t,e,n)=>{(t[e]===void 0||n>t[e])&&(t[e]=n)},z=(t,e,n)=>{(t[e]===void 0||n<t[e])&&(t[e]=n)},Q=(t,e)=>{t.format=e,e.includes("int")&&(t.isInt=!0)},Le=(t,e)=>{t.mime=t.mime?t.mime.filter(n=>e.includes(n)):[...e]},qe=(t,e)=>{t.multipleOf??=[],t.multipleOf.includes(e)||t.multipleOf.push(e)},Fe=(t,e)=>(t.patterns??=new Set).add(e),sn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function I(t){let e={},{def:n,bag:r}=t._zod,i=t._zod.traits.has("$ZodCheck")?[t,...n.checks??[]]:n.checks??[];for(let o of i){let a=o._zod.def;switch(a.check){case"greater_than":E(e,a.inclusive?"minimum":"exclusiveMinimum",a.value);break;case"less_than":z(e,a.inclusive?"maximum":"exclusiveMaximum",a.value);break;case"multiple_of":qe(e,a.value);break;case"number_format":{Q(e,a.format);let d=sn[a.format];d&&(E(e,"minimum",d[0]),z(e,"maximum",d[1]));break}case"bigint_format":Q(e,a.format);break;case"min_length":case"min_size":E(e,"minimum",a.minimum);break;case"max_length":case"max_size":z(e,"maximum",a.maximum);break;case"length_equals":E(e,"minimum",a.length),z(e,"maximum",a.length);break;case"size_equals":E(e,"minimum",a.size),z(e,"maximum",a.size);break;case"string_format":Q(e,a.format),a.pattern&&Fe(e,a.pattern),(a.format==="base64"||a.format==="base64url")&&(e.contentEncoding=a.format),(a.local||a.precision===-1)&&(e.laxFormat=!0);break;case"mime_type":Le(e,a.mime);break}}r.minimum!==void 0&&E(e,"minimum",r.minimum),r.exclusiveMinimum!==void 0&&E(e,"exclusiveMinimum",r.exclusiveMinimum),r.maximum!==void 0&&z(e,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&z(e,"exclusiveMaximum",r.exclusiveMaximum),r.multipleOf!==void 0&&qe(e,r.multipleOf),r.format!==void 0&&(e.format??=r.format,r.format.includes("int")&&(e.isInt=!0)),r.mime&&Le(e,r.mime);for(let o of r.patterns??[])Fe(e,o);return e}var dn={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""};function L(t){let e=t._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?L(e.out):e.type==="catch"?L(e.innerType):t._zod.optin}var cn=new Set(["promise","optional","nonoptional","nullable","readonly","default","prefault","catch"]);function _(t,e=new Set){if(e.has(t))return!1;e.add(t);let n=t._zod.def,r=n.type;return r==="transform"?!0:r==="array"?_(n.element,e):r==="set"?_(n.valueType,e):r==="lazy"?_(n.getter(),e):cn.has(r)?_(n.innerType,e):r==="intersection"?_(n.left,e)||_(n.right,e):r==="record"||r==="map"?_(n.keyType,e)||_(n.valueType,e):r==="pipe"?t._zod.traits.has("$ZodCodec")||_(n.in,e)||_(n.out,e):r==="object"?Object.values(n.shape).some(i=>_(i,e)):r==="union"?n.options.some(i=>_(i,e)):r==="tuple"?n.items.some(i=>_(i,e))||(n.rest?_(n.rest,e):!1):!1}function ln(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n])=>e.indexOf(+n)===-1).map(([,n])=>n)}function Be(t){let e=t.anyOf;if(!Array.isArray(e)||e.length===0||t.type!==void 0)return;let n=[];for(let r of e){if(!r||typeof r!="object")return;Be(r);let i=Object.keys(r);if(i.length!==1||i[0]!=="type")return;for(let o of[r.type].flat()){if(typeof o!="string")return;n.includes(o)||n.push(o)}}delete t.anyOf,t.type=n.length===1?n[0]:n}var Ue=new Set(["type","properties","required","additionalProperties"]),We=t=>{let e=t.additionalProperties;return e&&typeof e=="object"&&Object.keys(e).length?e:null},Ce=(t,e)=>JSON.stringify(t)===JSON.stringify(e);function ee(t){for(let i of t){if(typeof i!="object"||i.type!=="object")return null;for(let o in i)if(!Ue.has(o))return null}let e={},n=new Set;for(let i of t){for(let o in i.properties){if(Object.prototype.hasOwnProperty.call(e,o))continue;let a=[];for(let d of t){let s=d.properties?.[o]??We(d);s&&!a.some(y=>Ce(y,s))&&a.push(s)}e[o]=a.length===1?a[0]:ee(a)??{allOf:a}}for(let o of i.required??[])n.add(o)}let r={type:"object",properties:e};if(n.size&&(r.required=[...n]),t.every(i=>i.additionalProperties===!1))r.additionalProperties=!1;else{let i=[];for(let o of t){let a=We(o);a&&!i.some(d=>Ce(d,a))&&i.push(a)}i.length===1?r.additionalProperties=i[0]:i.length>1&&(r.additionalProperties={allOf:i})}return r}function un(t){let e=t.allOf;if(!Array.isArray(e)||e.length<2)return;for(let i of Ue)if(i in t)return;let n=e.filter(i=>Array.isArray(i.oneOf)||Array.isArray(i.anyOf)),r;if(!n.length)r=ee(e);else{let i=n[0],o=Array.isArray(i.oneOf)?"oneOf":"anyOf";if(Object.keys(i).length!==1)return;let a=e.filter(s=>s!==i),d=i[o].map(s=>ee([...a,s]));if(d.some(s=>!s))return;r={[o]:d}}r&&(delete t.allOf,Object.assign(t,r))}function Ve(t){let e=t;for(let S of["anyOf","oneOf"]){let T=e[S];if(!Array.isArray(T))continue;let O=T.map(Ve);O.some((v,h)=>v!==T[h])&&(e={...e,[S]:O})}let n=[e.type].flat(),r=!n.includes("string")&&n.some(S=>S==="number"||S==="integer"),i=e.enum??(e.const!==void 0?[e.const]:void 0);if(!r&&!i?.some(S=>typeof S=="number"))return e;let{minimum:o,maximum:a,exclusiveMinimum:d,exclusiveMaximum:s,multipleOf:y,format:p,id:b,...f}=e;return f.enum?f.enum=f.enum.map(S=>typeof S=="number"?String(S):S):typeof f.const=="number"&&(f.const=String(f.const)),r&&(f.type="string",i||(f.pattern=n.includes("number")?"^-?\\d+(?:\\.\\d+)?$":"^-?\\d+$")),f}var B=class{constructor(e,n){this.override=e;this.refs=n}done=new Map;path=[];cyclic=new Map;write(e,n=!1){let r=this.refs.get(e);if(r!==void 0&&!n)return{$ref:r};if(this.path.includes(e))return this.cyclic.has(e)||this.cyclic.set(e,""),{};let i=this.done.get(e);if(i)return i;this.path.push(e);try{let o=this.written(e);return this.done.set(e,o),o}finally{this.path.pop()}}written(e){let n={},r,i=e._zod.toJSONSchema?.();i?Object.assign(n,i):r=this.process(e,n);let o=fe.get(e);if(o)for(let d of Object.keys(o))n[d]=o[d];_(e)&&(delete n.examples,delete n.default),"_prefault"in n&&(n.default??=n._prefault,delete n._prefault);let a=n;if(r){let d=this.write(r);a={...n};for(let s of Object.keys(d))s in n||(a[s]=d[s])}return this.override({zodSchema:e,jsonSchema:a}),Be(a),e._zod.def.type==="intersection"&&un(a),a}process(e,n){let r=e._zod.def;switch(r.type){case"string":{n.type="string";let{minimum:i,maximum:o,format:a,patterns:d,contentEncoding:s,laxFormat:y}=I(e);if(typeof i=="number"&&(n.minLength=i),typeof o=="number"&&(n.maxLength=o),a&&(n.format=dn[a]??a,(n.format===""||a==="time"||y)&&delete n.format),s&&(n.contentEncoding=s),d&&d.size>0){let p=[...d];p.length===1?n.pattern=p[0].source:n.allOf=p.map(b=>({pattern:b.source}))}return}case"number":{let{minimum:i,maximum:o,multipleOf:a,exclusiveMinimum:d,exclusiveMaximum:s,isInt:y}=I(e);if(n.type=y?"integer":"number",typeof d=="number"&&d>=(i??Number.NEGATIVE_INFINITY)?n.exclusiveMinimum=d:typeof i=="number"&&(n.minimum=i),typeof s=="number"&&s<=(o??Number.POSITIVE_INFINITY)?n.exclusiveMaximum=s:typeof o=="number"&&(n.maximum=o),a){let[p,...b]=new Set(a.filter(f=>Number.isFinite(f)&&f!==0).map(Math.abs));p!==void 0&&(n.multipleOf=p),b.length&&(n.allOf=[...n.allOf??[],...b.map(f=>({multipleOf:f}))])}return}case"boolean":case"success":n.type="boolean";return;case"null":n.type="null";return;case"never":n.not={};return;case"enum":{let i=ln(r.entries);i.length===0?n.not={}:(i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),n.enum=i);return}case"literal":{let i=r.values.filter(o=>o!==void 0).map(o=>typeof o=="bigint"?Number(o):o);if(r.values.length===0)n.not={};else if(i.length===1)n.type=i[0]===null?"null":typeof i[0],n.const=i[0];else if(i.length>1){for(let o of["number","string","boolean"])i.every(a=>typeof a===o)&&(n.type=o);i.every(o=>o===null)&&(n.type="null"),n.enum=i}return}case"template_literal":n.type="string",n.pattern=e._zod.pattern.source;return;case"file":{n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:i,maximum:o,mime:a}=I(e);i!==void 0&&(n.minLength=i),o!==void 0&&(n.maxLength=o),a&&(a.length===0?n.not={}:a.length===1?n.contentMediaType=a[0]:n.anyOf=a.map(d=>({contentMediaType:d})));return}case"array":{let{minimum:i,maximum:o}=I(e);typeof i=="number"&&(n.minItems=i),typeof o=="number"&&(n.maxItems=o),n.type="array",n.items=this.write(r.element);return}case"object":{let i=r.shape;n.type="object";let o={};n.properties=o;for(let d in i)Object.defineProperty(o,d,{value:this.write(i[d]),writable:!0,enumerable:!0,configurable:!0});let a=Object.keys(i).filter(d=>L(i[d])===void 0);a.length>0&&(n.required=a),r.catchall?._zod.def.type==="never"?n.additionalProperties=!1:r.catchall&&(n.additionalProperties=this.write(r.catchall));return}case"union":n[r.inclusive===!1?"oneOf":"anyOf"]=r.options.map(i=>this.write(i));return;case"intersection":{let i=d=>"allOf"in d&&Object.keys(d).length===1,o=this.write(r.left),a=this.write(r.right);n.allOf=[...i(o)?o.allOf:[o],...i(a)?a.allOf:[a]];return}case"tuple":{let i=r.items;n.type="array",n.prefixItems=i.map(s=>this.write(s)),r.rest?n.items=this.write(r.rest):n.items=!1;let o=i.length;for(;o>0&&L(i[o-1])!==void 0;)o-=1;o>0&&(n.minItems=o),r.rest||(n.maxItems=i.length);let{minimum:a,maximum:d}=I(e);typeof a=="number"&&(n.minItems=a),typeof d=="number"&&(n.maxItems=d);return}case"record":{let i=r.keyType;n.type="object";let o=I(i).patterns;if(r.mode==="loose"&&o&&o.size>0){let d=this.write(r.valueType),s={};for(let y of o)s[y.source]=d;n.patternProperties=s}else n.propertyNames=Ve(this.write(i)),n.additionalProperties=this.write(r.valueType);let a=i._zod.values;if(a&&!r.partial&&L(r.valueType)===void 0){let d=[...a].filter(s=>typeof s=="string"||typeof s=="number");d.length>0&&(n.required=d.map(String))}return}case"nullable":n.anyOf=[this.write(r.innerType),{type:"null"}];return;case"default":case"prefault":{let i=r.defaultValue,o,a=!1,d=JSON.stringify(i,(s,y)=>typeof y=="bigint"?(a=!0,null):y);return!a&&d!==void 0&&(o=JSON.parse(d)),a||(n[r.type==="default"?"default":"_prefault"]=o),r.innerType}case"catch":{try{n.default=r.catchValue(void 0)}catch{}return r.innerType}case"readonly":return n.readOnly=!0,r.innerType;case"pipe":return r.in._zod.traits.has("$ZodTransform")?r.out:r.in;case"lazy":return e._zod.innerType;case"optional":case"nonoptional":case"promise":return r.innerType;default:return}}};function Ge(t,e=()=>{}){let n=t,r=new B(e,new Map),i=r.write(n,!0);if(r.cyclic.size>0){let o=new Map,a=0,d=[];for(let y of r.cyclic.keys())if(y===n)o.set(y,"#");else{let p=`__schema${a++}`;o.set(y,`#/$defs/${p}`),d.push([y,p])}r=new B(e,o),i=r.write(n,!0);let s={};for(let[y,p]of d)s[p]=r.write(y,!0);d.length>0&&(i={...i,$defs:s})}return JSON.parse(JSON.stringify({$schema:"https://json-schema.org/draft/2020-12/schema",...i}))}function Ke(t){return Ge(t,mn)}var fn={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"},pn={phone:"A phone number as it is written, like +1 555 123 4567 or 020 7946 0958 ext. 12.",place:"An address or a place's name, as a person would search a map for it.",duration:"A length of time in whole minutes: 90 is 1 h 30 min."};function mn(t){me(t.zodSchema)&&(t.jsonSchema["x-graview-app-link"]=!0);let e=ye(t.zodSchema);if(e&&(t.jsonSchema.type==="string"||t.jsonSchema.type==="array")){t.jsonSchema["x-graview-linked"]={address:e.address,kinds:[...e.kinds],cardinality:e.cardinality};let s=e.kinds.join(" or "),y=`${e.cardinality==="many"?"Records":"A record"}: a ${s} in the app ${e.address}, as "${e.kinds[0]}:<id>" \u2014 an id found there with find_linked. Linking never changes that app.`,p=t.jsonSchema.description;typeof p=="string"&&p.includes(y)||(t.jsonSchema.description=`${typeof p=="string"&&p?`${p.replace(/\.?$/,".")} `:""}${y}`)}if(we(t.zodSchema)&&(t.jsonSchema["x-graview-repeat"]=!0,!t.jsonSchema.type&&!t.jsonSchema.anyOf&&!t.jsonSchema.oneOf&&Object.assign(t.jsonSchema,hn())),Se(t.zodSchema)){t.jsonSchema.contentMediaType="text/markdown";let s=t.jsonSchema.description;typeof s=="string"&&s.endsWith("Written in Markdown.")||(t.jsonSchema.description=`${typeof s=="string"&&s?`${s.replace(/\.?$/,".")} `:""}Written in Markdown.`)}let n=Te(t.zodSchema);if(n){let s=t.jsonSchema;s["x-graview-type"]=n,n==="duration"&&(s["x-graview-unit"]="minutes"),s.description??=pn[n]}let r=Re(t.zodSchema,!1);if(r){let s=De(r);t.jsonSchema["x-graview-format"]=s.format??"unit",s.currency&&(t.jsonSchema["x-graview-currency"]=s.currency),s.unit&&s.format!=="money"&&(t.jsonSchema["x-graview-unit"]=s.unit);let y=t.jsonSchema.description;t.jsonSchema.description=typeof y=="string"&&y.length>0?`${y} ${Y(s)}`:Y(s)}let i=t.zodSchema._zod?.def;if(!i||i.type!=="string"||typeof i.format!="string"||i.format==="regex")return;let o=t.jsonSchema,a=(i.checks??[]).map(s=>s._zod?.def).filter(s=>s?.format==="regex"&&s.pattern instanceof RegExp).map(s=>s.pattern.source);delete o.pattern;let d=o.allOf;Array.isArray(d)&&d.every(s=>typeof s=="object"&&s!==null&&Object.keys(s).length===1&&"pattern"in s)&&delete o.allOf,o.format=fn[i.format]??i.format,a.length===1?o.pattern=a[0]:a.length>1&&(o.allOf=a.map(s=>({pattern:s})))}function ne(t,e){let n=C(t.input),r=Ke(t.input);if(e&&r.properties){let o=a=>e.includes(a)?e.indexOf(a):e.length;r.properties=Object.fromEntries(Object.entries(r.properties).sort(([a],[d])=>o(a)-o(d)))}let i=r.properties??{};if(Ae(t)){let o=t.creates.join(" | ");i.id={type:"string",minLength:1,description:`Optional: the id for the ${o} this makes. Refused if the graph already has it; left out, one is minted from the label.`},r.properties=i}Oe(t)&&(r.additionalProperties=!1);for(let o of n){let a=i[o.name];if(!a)continue;let d=o.kinds.includes("*")?"any node kind":o.kinds.join(" | ");a.description=[a.description,`Id of a node (${d}).`].filter(Boolean).join(" ")}return{name:t.name,...t.title===void 0?{}:{title:t.title},description:t.description??t.title??t.name,inputSchema:r,nodeRefs:n}}function hn(){let t={type:"string",pattern:"^\\d{4}-\\d{2}-\\d{2}$"},e=(n,r)=>({type:"integer",minimum:n,maximum:r});return{type:"object",description:'How the date beside it repeats; the date is the first occurrence. "on" is weekdays for "week", days of the month (-1 the last) for "month".',properties:{every:{type:"string",enum:[...be]},interval:e(1,99),on:{type:"array",minItems:1,maxItems:31,items:{anyOf:[{type:"string",enum:[...ge]},e(-1,31)]}},until:t,count:e(1,1e3),except:{type:"array",maxItems:500,items:t},continues:{type:"string",maxLength:200}},required:["every"],additionalProperties:!1}}function Ze(t){let e=new Set;for(let n=t;n;n=n.onBehalfOf)n.id!==void 0&&e.add(`${n.kind}:${n.id}`);return e}function U(t,e){let n=Ze(e),r=p=>{if(p.kind==="rule")return!1;let b=Ze(p);if(b.size===0)return!1;for(let f of b)if(n.has(f))return!1;return!0},i,o=()=>{if(i)return i;i=new Map;for(let p of t.log.live()){if(p.undoes!==void 0)continue;let b=r(p.author)?p.author:void 0;for(let f of p.primitives){f.op==="remove-node"&&i.delete(f.node.id);let S=f.op==="add-node"?f.node.id:f.op==="patch-node"||f.op==="splice-text"?f.id:void 0;if(S===void 0)continue;let T=f.op==="add-node"?Object.keys(f.node):f.op==="splice-text"?[f.field]:Object.keys(f.after),O=i.get(S);(f.op==="add-node"||!O)&&i.set(S,O=new Map);for(let v of T)v==="id"||v==="kind"||(b?O.set(v,b):O.delete(v))}}return i},a=t.schema,d=new Map,s=(p,b)=>{let f=`${p}\0${b}`,S=d.get(f);if(S===void 0){let T=a.tryDefinition(p)?.fields?.shape;S=T!==void 0&&b in T&&Pe(T[b]).type==="text",d.set(f,S)}return S},y=p=>t.graph.getNode(p)?.kind;return{prose:s,say:p=>W(p,{graph:t.graph,schema:a}),fieldBy(p,b){let f=y(p);if(!(f===void 0||!s(f,b)))return o().get(p)?.get(b)},recordBy(p){let b=y(p),f=o().get(p);if(b===void 0||!f)return;let S;for(let[T,O]of f)s(b,T)&&(S=O);return S}}}var te=(t,e,n)=>({untrusted:!0,authoredBy:n.say(e),text:t}),yn="the host's ranker";function Ye(t,e){return{...t,hits:t.hits.map(n=>{if(n.about!=="node")return n;n.why.by==="meaning"&&n.why.matched!==void 0&&(n={...n,why:{...n.why,matched:{untrusted:!0,authoredBy:yn,text:n.why.matched}}});let r=e.recordBy(n.id);if(!r)return n;let i=e.prose(n.kind,n.why.field)?e.fieldBy(n.id,n.why.field):r;return{...n,label:te(n.label,r,e),...n.apart!==void 0?{apart:te(n.apart,r,e)}:{},why:i?{...n.why,fragment:te(n.why.fragment,i,e)}:n.why}})}}var ie=(t,e,n)=>({title:t,readOnlyHint:e,destructiveHint:!1,idempotentHint:n,openWorldHint:!1}),gn={name:"subscribe",title:"Notify me when something happens",description:`Subscribe the person you act for to be told when something happens in this app \u2014 their host delivers it (an email, a push). on is one of: "act" (an act runs; give act, its declared name, and/or record), "created" (a record of kind is added), "changed" (a record of kind, or the one record, changes), "reaches" (a record of kind, or the one record, comes to satisfy condition, an expression in the app's rule language such as done == true or amount > 100). They are told only of changes someone else made, unless alsoMine is true, and only of records they may see. Returns the subscription and its sentence. Changes nothing in the app.`,inputSchema:{type:"object",properties:{on:{type:"string",enum:["act","created","changed","reaches"],description:"What to be told of."},act:{type:"string",description:"An act's declared name, for on: act."},kind:{type:"string",description:"A kind, for created, changed and reaches."},record:{type:"string",description:"One record, by id or name: for act, changed and reaches."},condition:{type:"string",description:"For reaches: what the record should come to satisfy, in the rule language (done == true)."},alsoMine:{type:"boolean",description:"Also when the person themselves made the change; false when unsaid."}},required:["on"],additionalProperties:!1},mutating:!1,annotations:ie("Notify me when something happens",!1,!1)},bn={name:"unsubscribe",title:"Stop notifying me",description:"Take away one of the person's subscriptions, by the id list_subscriptions or subscribe answered. Changes nothing in the app.",inputSchema:{type:"object",properties:{id:{type:"string",description:"The subscription's id."}},required:["id"],additionalProperties:!1},mutating:!1,annotations:ie("Stop notifying me",!1,!0)},wn={name:"list_subscriptions",title:"What I am notified of",description:`List what the person you act for is told of in this app: each subscription's id and its sentence ("When someone else adds a task").`,inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:ie("What I am notified of",!0,!0)},re=[gn,bn,wn];var F=t=>{let e;return()=>e??=t().catch(n=>{throw e=void 0,n})},Sn=F(()=>(__graviewPreload(import.meta.url,["./chunk.MVRNEC3Y.js","./chunk.45HTFSWD.js","./chunk.AG7CUSSV.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.4BX3KLAA.js"))),kn=()=>(__graviewPreload(import.meta.url,["./chunk.C6HBYRGJ.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.4TGQ6Z6E.js")).catch(()=>{}),vn=async()=>{(await kn())?.judgeWithLines()},q=F(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.TUNHUTQ5.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.COWJTVZV.js"))),An=F(()=>(__graviewPreload(import.meta.url,["./chunk.SDO3DD77.js","./chunk.G4JJXA63.js","./chunk.BOMYLOCX.js","./chunk.45HTFSWD.js","./chunk.KRVEAIKW.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.C6HBYRGJ.js","./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.5M62CMLA.js"))),On=F(()=>(__graviewPreload(import.meta.url,["./chunk.7SCENHVG.js","./chunk.MVRNEC3Y.js","./chunk.45HTFSWD.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.AG7CUSSV.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.PCNEM3WE.js"))),Rn=F(()=>(__graviewPreload(import.meta.url,["./chunk.RBYRT2I2.js","./chunk.JTOAZ2IR.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.W6NCLU5Y.js"))),Tn=t=>t.definitions.some(e=>Z(e).size>0),Xe=t=>({value:K(t),label:t.label,...t.describe?{describe:t.describe}:{},...t.card?{card:t.card}:{},fields:t.fields,...t.app?{app:t.app}:{}});async function _n(t,e,n,r){let i=String(n.relation??""),[o,a]=i.includes(".")?i.split(".",2):[void 0,i],d=t.schema.definitions.flatMap(v=>[...Z(v)].map(([h,u])=>({kind:v.kind,name:h,relation:u}))),s=d.filter(v=>v.name===a&&(o===void 0||v.kind===o));if(s.length!==1){let v=d.map(h=>`${h.kind}.${h.name}`).join(", ")||"none";return{ok:!1,error:`${s.length===0?`No relation to another app is called "${i}"`:`"${i}" names a relation of several kinds`}. The relations to other apps are: ${v}.`}}let{kind:y,name:p,relation:b}=s[0];if(!r)return{ok:!1,error:`This seat cannot read ${b.address}: its host reads no other app's records. Nothing was changed.`};let f={kind:e.kind,...e.id===void 0?{}:{id:e.id},...e.roles?{roles:e.roles}:{}},S=typeof n.of=="string"?n.of:void 0;if(S!==void 0){let v=t.graph.getNode(S);if(!v||v.kind!==y)return{ok:!1,error:`No ${y} "${S}".`};let h=he(v[p],b),u=await Promise.all(h.map(w=>Promise.resolve().then(()=>r.resolve(w,f)).catch(()=>null)));return{ok:!0,data:{relation:`${y}.${p}`,app:b.address,records:u.map((w,k)=>w===null?{value:K(h[k]),missing:!0}:"denied"in w?{denied:!0,said:"linked record (no access)"}:Xe(w))},reads:[S]}}let T=typeof n.limit=="number"&&n.limit>0?Math.min(n.limit,20):20,O=await Promise.resolve().then(()=>r.find({address:b.address,kinds:b.kinds,query:String(n.query??""),limit:T},f)).catch(()=>[]);return Array.isArray(O)?{ok:!0,data:{relation:`${y}.${p}`,app:b.address,records:O.map(Xe),link:`edit-${y} with ${p} set to a record's value`}}:{ok:!0,data:{relation:`${y}.${p}`,app:b.address,denied:!0,said:"linked record (no access)"}}}var M=t=>({title:t,readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}),Qe={description:'Which records: false (the default) the live ones, true only the archived ones, "all" both. An archived record is set aside, not gone: unarchive-<kind> brings it back.',anyOf:[{type:"boolean"},{type:"string",enum:["all"]}]},oe={type:"number",description:"Where the page starts; 0 when unsaid."},se=[{name:"search_graph",title:"Find by name",description:"Find things by name: records whose name or readable fields carry the words, and the kinds, places and rules the words name \u2014 each with why it matched. Reach for this before get_graph when you know what something is called. Words match the start of words, case and accents aside; key:value tokens narrow as a list's filter does (done:false, is:any for past records, kind:<kind>). Pass subject (a node id) to get the acts you may run on it as hits too. When few records match exactly, records with a near word follow \u2014 a typo, another form of the word, a meaning \u2014 each with near: true and why.matched, the record's own word that answered.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Words, with optional key:value conditions."},limit:{type:"number",description:"Most hits to return; at most 20."},subject:{type:"string",description:"A node id whose acts to include."},archived:Qe},required:["query"],additionalProperties:!1},mutating:!1,annotations:M("Find by name")},{name:"get_graph",title:"Read the graph",description:"Read the graph, 25 nodes a page: their fields, the edges out of them, and how many more. Start here when you need the shape of the domain rather than one thing in it.",inputSchema:{type:"object",properties:{offset:oe,archived:Qe},additionalProperties:!1},mutating:!1,annotations:M("Read the graph")},{name:"get_node",title:"Read one node",description:"Read one node: its fields, its links (id, kind and label, 20 each way a page), the violations that implicate it, and its computed values: read-only fields worked out from what you can see, which no act sets. Use this to check a thing before you change it.",inputSchema:{type:"object",properties:{id:{type:"string",description:"A node's id, or its name."},offset:oe},required:["id"],additionalProperties:!1},mutating:!1,annotations:M("Read one node")},{name:"get_violations",title:"List the problems",description:"List the invariant violations the graph currently has, 20 a page, with the repairs that would resolve each one. Read this before proposing work: a rule that is already broken is more urgent than anything you could add.",inputSchema:{type:"object",properties:{offset:oe,context:{type:"object",description:"Evaluation context, e.g. { weekStart }."}},additionalProperties:!1},mutating:!1,annotations:M("List the problems")},{name:"get_affordances",title:"Ask what can be done",description:"Ask what can legally be done with a selection, ranked. Prefer these over composing a mutation by hand: they are derived from the schema, the invariants and the shape of the graph, so they cannot name an action that does not exist.",inputSchema:{type:"object",properties:{selection:{type:"array",items:{type:"string"},description:"Node ids."},context:{type:"object"}},required:["selection"],additionalProperties:!1},mutating:!1,annotations:M("Ask what can be done")},{name:"describe_place",title:"Say what a place shows",description:`Say what one place of the app shows you, as a person in your seat would see it: its headings, its figures as drawn, its lists with each record's title and what its card or row says, the headings a list is grouped under, what an empty list says, the forms it offers (each field in the order asked, its label, whether it must be answered, what it takes and its choices), and any block that could not be worked out. Pass a place's slug ("home", a lens's address like "the-offers", a kind's like "offers"), a record's id, or a visitor form's "forms/<name>", and width 390 for a phone. Use it after a change to check what somebody now sees, instead of guessing.`,inputSchema:{type:"object",properties:{place:{type:"string",description:`"home", a place's slug, a record's id, or "forms/<name>" for a visitor form.`},width:{type:"number",description:"The screen's width in CSS pixels; 390 is a phone, 1440 when unsaid."}},required:["place"],additionalProperties:!1},mutating:!1,annotations:M("Say what a place shows")},{name:"preview_mutation",title:"Try an act without applying it",description:"Try a mutation without applying it: get back the diff it would produce and any invariant it would break. Do this when you are unsure, rather than applying and undoing.",inputSchema:{type:"object",properties:{mutation:{type:"string"},args:{type:"object"}},required:["mutation","args"],additionalProperties:!1},mutating:!1,annotations:M("Try an act without applying it")},{name:"undo_batch",title:"Undo a batch",description:"Undo one batch of operations. Fails, naming the blocking operation, when a later operation read what it wrote.",inputSchema:{type:"object",properties:{batch:{type:"string"},include:{type:"array",items:{type:"string"}}},required:["batch"],additionalProperties:!1},mutating:!0,annotations:{title:"Undo a batch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}},{name:"list_suggestions",title:"List what is suggested",description:"List the suggestions waiting for a person: changes the app's own actor proposed and did not make, each with its id, what it would do, who suggested it, what it was based on and how sure (0 to 1). Nothing changes until one is accepted (accept_suggestion) or declined (decline_suggestion); a declined one is never suggested again.",inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:M("List what is suggested")},{name:"accept_suggestion",title:"Accept a suggestion",description:"Make a waiting suggestion's change, as this seat, carrying what it was based on. Returns the batch (undo_batch takes it back).",inputSchema:{type:"object",properties:{suggestion:{type:"string",description:"The suggestion's id, from list_suggestions."}},required:["suggestion"],additionalProperties:!1},mutating:!0,annotations:{title:"Accept a suggestion",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1}},{name:"decline_suggestion",title:"Decline a suggestion",description:"Decline a waiting suggestion: nothing changes, the decline is kept in the log, and the same change is never suggested or made by the app's own actor again.",inputSchema:{type:"object",properties:{suggestion:{type:"string",description:"The suggestion's id, from list_suggestions."}},required:["suggestion"],additionalProperties:!1},mutating:!0,annotations:{title:"Decline a suggestion",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}}],nn={name:"act_on_several",title:"Do one act to several records",description:`Run one act on several records at once, as one change with one undo. act is the act (its tool name or its declared name), records the records it runs on (ids or names; each goes in the act's subject), args what every call shares ("Set stage to Declined" is args { stage: "declined" }). Each record is judged on its own: one this seat may not change is named with why, and the rest still apply. Returns the batch (undo_batch takes it all back), the records changed, those already so, and those refused.`,inputSchema:{type:"object",properties:{act:{type:"string",description:"The act to run on each record."},records:{type:"array",items:{type:"string"},minItems:1,maxItems:200,description:"Ids or names of the records."},args:{type:"object",description:"Arguments every call shares, besides the record."}},required:["act","records"],additionalProperties:!1},mutating:!0,annotations:{title:"Do one act to several records",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}},ue={name:"suggest_changes",title:"Suggest changes",description:"Keep calls ({ act, args }) as one suggestion a person accepts or declines, with its basis and confidence (0 to 1). Changes nothing; a declined change is refused.",inputSchema:{type:"object",properties:{calls:{type:"array",items:{type:"object"}},basis:{type:"string"},confidence:{type:"number"}},required:["calls","basis"]},mutating:!0,annotations:{title:"Suggest changes",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},de={type:"object",description:"A lens, as draft_view returns one.",properties:{title:{type:"string"},lens:{type:"string"},on:{type:"string"},bindings:{type:"object"},options:{type:"object"}},required:["title","lens","on"]},ce={name:"draft_view",title:"Draw a view",description:'Draw a view of the data from words ("a board of tasks by status", "who covers what") as a lens the app could keep; or check a lens you wrote (lens); or change the one on screen (current, with ask: "only this month"). Returns the lens and its add-lens edit, or one sentence saying why not. Writes nothing.',inputSchema:{type:"object",properties:{ask:{type:"string",description:"What to see, in words."},lens:de,current:de},additionalProperties:!1},mutating:!1,annotations:M("Draw a view")},tn={name:"keep_lens",title:"Keep a view as a lens",description:"Keep a lens draft_view drew as one of the app's places: checked again, then written as the add-lens edit. Returns the remove-lens edit that takes it back.",inputSchema:{...de,additionalProperties:!1},mutating:!0,annotations:{title:"Keep a view as a lens",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},rn={name:"find_linked",title:"Find a record in another app",description:`A relation may go to a kind in another app (describe_app lists them under "Linked from other apps"). With relation and words, list the records there this seat may link \u2014 each with the value to link it by ("house:h1"), its name and its describe line. With of (a record id here), read the records that record links, as this seat may see them there. Linking one is the record's edit (edit-<kind>) with the relation set to the value. Another app this seat may not open answers denied, and nothing of it. Writes nothing; never changes the other app.`,inputSchema:{type:"object",properties:{relation:{type:"string",description:"The relation, by name (forHouse) or as <kind>.<relation> (scenario.forHouse)."},query:{type:"string",description:"Words to find by, in the other app's names; empty for the first few."},of:{type:"string",description:"A record here whose linked records to read, instead of finding."},limit:{type:"number",description:"Most records to return; at most 20."}},required:["relation"],additionalProperties:!1},mutating:!1,annotations:M("Find a record in another app")};function xn(t,e){return t===void 0?[]:t==="keep"&&!e?[ce,tn]:[ce]}var Mn="An argument that names a record takes its id or its name.",on=[...se.map(t=>t.name),nn.name,ue.name,ce.name,tn.name,rn.name,...re.map(t=>t.name)],an=64;function N(t){let{line:e,...n}=t;return n}function en(t){return{...t,...t.introduces?{introduces:t.introduces.map(N)}:{},...t.resolves?{resolves:t.resolves.map(N)}:{},...t.violationsAfter?{violationsAfter:t.violationsAfter.map(N)}:{}}}function Nn(t){let e=t.normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^A-Za-z0-9_-]/g,"_");return e.length===0&&(e="act"),/^[A-Za-z_]/.test(e)||(e=`act_${e}`),e.slice(0,an)}function $n(t){let e=new Set(on),n=new Map;for(let r of t){let i=Nn(r),o=i;for(let a=2;e.has(o);a+=1)o=`${i.slice(0,an-`_${a}`.length)}_${a}`;e.add(o),n.set(r,o)}return n}function Dn(t,e){if(e.size===0)return t;let n=Object.fromEntries(Object.entries(t.properties??{}).filter(([i])=>!e.has(i))),r=(t.required??[]).filter(i=>!e.has(i));return{...t,properties:n,...t.required?{required:r}:{}}}function Pn(t,e,n,r){let i=ne(t,_e(r,t)),o=G(t),a=i.nodeRefs.length>0?`${i.description}${/[.!?]$/.test(i.description)?"":"."} ${Mn}`:i.description;return{name:e,title:o,description:a,inputSchema:Dn(i.inputSchema,n),mutating:!0,annotations:{title:o,readOnlyHint:!1,destructiveHint:t.destructive===!0||(t.severs?.length??0)>0,idempotentHint:t.idempotent===!0,openWorldHint:!1},act:t.name}}function le(t){if(t===null||typeof t!="object")return JSON.stringify(t)??"null";if(Array.isArray(t))return`[${t.map(le).join(",")}]`;let e=t;return`{${Object.keys(e).filter(n=>e[n]!==void 0).sort().map(n=>`${JSON.stringify(n)}:${le(e[n])}`).join(",")}}`}function Jn(t){return`sha256:${$e(le(t))}`}function En(t,e,n,r,i,o=!1,a=!1,d=!1,s){let y=$n(t.map(f=>f.name)),p=[...xn(r,n),...o?[rn]:[],...a?re:[]];return{definitions:n?[...se.filter(f=>!f.mutating),...p]:[...se,nn,...d?[ue]:[],...p,...t.filter(f=>e.has(f.name)).map(f=>Pn(f,y.get(f.name),i(f),s))],names:y}}function At(t,e={}){let n=e.author??{kind:"agent"},r=t.allMutations(),i=new Set(t.permittedMutations(n).map(h=>h.name)),{definitions:o,names:a}=En(r,i,e.readOnly===!0,e.drafts?e.drafts.keep?"keep":"draw":void 0,h=>X(t.schema,t.policy,n,h),Tn(t.schema),e.subscriptions!==void 0,Ne(n),t.schema),d=Jn(o),s={app:e.app?.brand?.locale,appTimeZone:e.app?.brand?.timeZone},y=h=>pe(s,h),p=h=>{if(!on.includes(h)){for(let[u,w]of a)if(w===h)return u;return a.has(h)?h:xe(h,a.keys())}},b=h=>{let u=Me(h,a.keys());return u?` Did you mean "${u}"?`:""},f=h=>{let u=o.find(k=>k.name===h)??o.find(k=>k.act===h);if(u)return u;let w=p(h);return w===void 0?void 0:o.find(k=>k.act===w)},S=(h,u)=>{let w=r.find(c=>c.name===h);if(!w)return{args:u,resolved:[]};let k={...u},l=[];for(let c of C(w.input)){let m=k[c.name];if(typeof m!="string"||m.trim()==="")continue;let g=t.resolveRef(c,m,n);if(!g.ok){let A=g.reason==="none"?` Nothing was changed. Use search_graph to look it up, then pass its id as ${c.name}.`:" Nothing was changed.";return{ok:!1,error:`${g.message}${A}`,argument:c.name,candidates:g.candidates}}g.by!=="id"&&(k[c.name]=g.id,l.push({argument:c.name,given:m,id:g.id,label:g.label}))}return{args:k,resolved:l}},T=async(h,u)=>{try{await vn();let w=f(h);if(!w&&h===ue.name)return{ok:!1,error:"Only the app's own actor (automated: true) suggests changes.",reason:"forbidden"};if(!w){let l=p(h);if(l){let c=t.permits({name:l,args:u},n);if(!c.ok)return{ok:!1,error:c.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${h}".${b(h)} Available: ${o.map(c=>c.name).join(", ")}`}}if(w.mutating&&e.readOnly)return{ok:!1,error:`"${h}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(w.act!==void 0){let l=S(w.act,u);if("ok"in l)return l;let c=w.act,m=y(()=>j(t,n,t.apply({name:c,args:l.args},{...e.author?{author:e.author}:{},...V(e.via)})));return{ok:!0,data:{batch:m.batch,intent:m.intent,introduces:m.introduces.map(N),resolves:m.resolves.map(N),...l.resolved.length>0?{resolved:l.resolved}:{}},diff:m.diff}}let k=t.seenBy(n);switch(w.name){case"search_graph":{let l=typeof e.places=="function"?e.places():e.places,c=typeof u.subject=="string"?u.subject:void 0,m=He(k,String(u.query??""),{principal:n,rank:e.near,archived:ke(u.archived),limit:typeof u.limit=="number"&&u.limit>0?Math.min(u.limit,20):20,...l?{places:l}:{},...c?{subject:c,from:[c]}:{}}),g=m.later?await m.later:m;return{ok:!0,data:(await q()).searchRead(g,Ye(g,U(k,n))),reads:g.hits.flatMap(A=>A.about==="node"?[A.id]:[])}}case"get_graph":return{ok:!0,...(await q()).graphRead(k,U(k,n),u)};case"get_node":{let l=String(u.id??""),c=l,m;if(!k.graph.getNode(l)){let A=l.trim()===""?void 0:t.resolveRef({name:"id",kinds:["*"]},l,n);if(A?.ok)c=A.id,m={argument:"id",given:l,id:c,label:A.label};else return A?.reason==="ambiguous"?{ok:!1,error:A.message,argument:"id",candidates:A.candidates}:{ok:!1,error:`No node "${l}".`}}let g=(await q()).nodeRead(k,U(k,n),c,u);return{ok:!0,data:m?{...g.data,resolved:[m]}:g.data,reads:g.reads}}case"describe_place":{let l=e.app??{name:"",schema:t.schema},c=typeof u.width=="number"&&Number.isFinite(u.width)&&u.width>0?u.width:1440,{describePlace:m}=await Sn(),g=m(t,n,String(u.place??""),{app:l,width:c});if(!g.ok)return{ok:!1,error:`${g.error} The places are: ${g.places.join(", ")}.`};let A=new Set,$=H=>{for(let P of H)for(let x of P.groups??[])for(let D of x.items)A.add(D.id),$(D.parts)};return $(g.description.parts),{ok:!0,data:g.description,reads:[...A]}}case"find_linked":return _n(k,n,u,e.linked);case"draft_view":case"keep_lens":{let l=e.app??{name:"",schema:t.schema};return(await An()).runDraftTool(w.name,u,{app:l,principal:n,...e.drafts?{drafts:e.drafts}:{}})}case"get_violations":{let l=k.violations(u.context);return{ok:!0,...(await q()).violationsRead(l,u)}}case"get_affordances":{let l=u.selection??[];return{ok:!0,data:Ie(k,l,{...typeof e.derive=="function"?e.derive():e.derive,...e.author?{principal:e.author}:{},...u.context?{context:u.context}:{}}),reads:l.filter(m=>k.graph.has(m))}}case"preview_mutation":{let l=String(u.mutation),c=p(l)??l,m=S(c,u.args??{});if("ok"in m)return m;let g=t.missingFor({name:c,args:m.args},n);if(g)return{ok:!1,error:g.message,reason:"missing"};let A=j(t,n,t.preview({name:c,args:m.args},void 0,{author:n})),$=en(A);return{ok:!0,data:m.resolved.length>0?{...$,resolved:m.resolved}:$}}case"act_on_several":{let l=String(u.act??""),c=p(l)??l,m=r.find(R=>R.name===c);if(!m||!i.has(c)){let R=m?t.permits({name:c,args:{}},n):void 0;return R&&!R.ok?{ok:!1,error:R.refusal.message,reason:"forbidden"}:{ok:!1,error:`There is no act "${l}" this seat may run.${b(l)} Nothing was changed.`,reason:"invalid"}}let g=m.subject;if(!g)return{ok:!1,error:`"${G(m)}" does not act on a record, so it cannot be run on several. Nothing was changed.`,reason:"invalid"};let A=Array.isArray(u.records)?u.records.filter(R=>typeof R=="string"&&R.trim()!==""):[];if(A.length===0)return{ok:!1,error:"Name at least one record. Nothing was changed.",reason:"invalid"};let $=[],H=[];for(let R of A.slice(0,200)){let J=t.resolveRef({name:g.arg,kinds:g.kinds},R,n);if(!J.ok)return{ok:!1,error:`${J.message} Nothing was changed.`,argument:"records",candidates:J.candidates};$.push(J.id),J.by!=="id"&&H.push({argument:"records",given:R,id:J.id,label:J.label})}let P=S(c,{...u.args??{}});if("ok"in P)return P;let x=(await On()).actOnSeveral(t,{mutation:c,subject:g.arg,args:P.args},$,{author:n,...V(e.via)}),D=x.result?j(t,n,x.result):void 0;return{ok:!0,data:{...x.batch?{batch:x.batch,intent:x.intent}:{},applied:x.applied,unchanged:x.unchanged,refused:x.refused.map(R=>({record:R.id,label:R.label,error:R.message,reason:R.reason})),...x.allOrNothing?{keptNone:!0}:{},...D?{introduces:D.introduces.map(N),resolves:D.resolves.map(N)}:{},...H.length>0||P.resolved.length>0?{resolved:[...H,...P.resolved]}:{}},...D?{diff:D.diff}:{}}}case"subscribe":case"unsubscribe":case"list_subscriptions":{let l=await(await Rn()).runSubscriptionTool(w.name,u,{store:t,principal:e.subscriber??n,app:e.app?.name??"app",subscriptions:e.subscriptions});return l.ok?{ok:!0,data:l.data}:{ok:!1,error:l.error}}case"list_suggestions":{let l=Ee(t,n).map(c=>{let m=W(c.author,{graph:k.graph,schema:t.schema});return{id:c.id,intent:c.intent,by:m,at:c.at,about:c.about,...c.lineage?{basis:{untrusted:!0,authoredBy:m,text:c.lineage.basis},...c.lineage.confidence!==void 0?{confidence:c.lineage.confidence}:{}}:{}}});return{ok:!0,data:{suggestions:l},reads:[...new Set(l.flatMap(c=>c.about))]}}case"suggest_changes":{let l=u.calls.map(m=>({name:p(m.act)??m.act,args:m.args}));return{ok:!0,data:{suggestion:Je(t,l,{author:n,lineage:{basis:u.basis,confidence:u.confidence},...V(e.via)})?.id??null}}}case"accept_suggestion":case"decline_suggestion":{let l=String(u.suggestion??""),c={author:n,...V(e.via)},m=w.name==="accept_suggestion"?ze(t,l,c):je(t,l,c),g=j(t,n,m);return{ok:!0,data:{batch:g.batch,intent:g.intent,introduces:g.introduces.map(N),resolves:g.resolves.map(N)},diff:g.diff}}case"undo_batch":{let l=String(u.batch),c=u.include??[],m=k.canUndo([l,...c]);if(!m.ok)return{ok:!1,error:m.message};let g=j(t,n,t.undo([l,...c],{...e.author?{author:e.author}:{}}));return{ok:!0,data:en(g),diff:g.diff}}default:return{ok:!1,error:`Unknown tool "${h}".`}}}catch(w){let{reason:k,wouldNeed:l}=ve(w);return{ok:!1,error:w instanceof Error?w.message:String(w),reason:k,...l?{wouldNeed:l}:{}}}},O=new Set,v=h=>{for(let u of O)u(h)};return{definitions:o,hash:d,...e.author?{author:e.author}:{},onDiff(h){return t.subscribe(h)},onCall(h){return O.add(h),()=>O.delete(h)},async call(h,u){let w=f(h)?.mutating??!1,k={name:h,args:u,mutating:w,at:new Date().toISOString()};v({...k,phase:"running"});let l=m=>(v(m.ok?{...k,phase:"ok",...!w&&m.reads?{reads:m.reads}:{}}:{...k,phase:"failed",error:m.error}),m),c=await T(h,u);return l(c.ok&&!w?{...c,data:(await q()).withinReadChars(h,c.data)}:c)}}}function V(t){let e=typeof t=="function"?t():t;return e?{via:e}:{}}export{le as a,At as b};
@@ -1 +0,0 @@
1
- import{b as dn,c as cn,d as re,e as ln,f as oe,h as ze,i as Ae,n as fn,r as ie}from"./chunk.ZUBC3UFG.js";import{Ab as U,B as ue,C as te,Ca as Ue,Db as nn,Ea as We,F as ke,Fc as an,Gc as Oe,H as Ve,Hb as tn,Hc as sn,I as Ie,Ia as we,Ic as Re,Ja as ve,Mb as rn,Pa as Je,Sa as Ye,b as Ge,ba as qe,bb as Qe,c as Pe,d as Me,db as Xe,e as K,fa as Be,g as ce,h as F,i as Le,ib as xe,j as Fe,jb as en,k as le,l as Ne,la as _e,m as Ce,o as Ze,p as fe,q as he,uc as on,v as Ke,wa as be,x as ne,z as pe,za as He}from"./chunk.3MZIWKNG.js";function pn(e){if(typeof e=="string")return{form:"string",light:e};if(typeof e!="object"||e===null)return;let a=e,n=v=>typeof a[v]=="string"?a[v]:void 0,t=n("light")??n("src");if(t===void 0)return;let[o,l,m]=[n("dark"),n("alt"),n("darkFallback")];return{form:n("light")!==void 0?"light":"src",light:t,...o!==void 0?{dark:o}:{},...l!==void 0?{alt:l}:{},...m!==void 0?{darkFallback:m}:{}}}function Fn(e,a){let n=e.brand??{},t=n.ground,o=n.accent?Re(n.accent,t):void 0;t&&sn(o?.ok?o.schemes:Oe(t),n.accent)&&(a.push(Ae("brand","brand.ground","words would not read on that page background, so the app keeps Graview's","pick a lighter ground for the light scheme, a darker one for the dark")),t=void 0,o=n.accent?Re(n.accent):void 0),o&&!o.ok&&a.push(Ae("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${o.why}`,"pick a color further from orange-red, or a darker one"));let l=pn(n.logo),m=n.name??e.name,v=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,j])=>typeof j=="string"&&!/url\(|@import|[;{}<>\\]/i.test(j)).map(([j,D])=>[j,an(D)])):void 0;return{name:m,schemes:o?.ok?o.schemes:t?Oe(t):on,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...n.timeZone?{timeZone:n.timeZone}:{},...l?{logo:l.dark||l.darkFallback==="invert"?{light:l.light,...l.dark?{dark:l.dark}:{darkFallback:"invert"}}:l.light,logoAlt:l.alt??m}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...n.subtitle===!1?{subtitleDrawn:!1}:{},...v?{typography:v}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{}}}function un(e){let{currency:a,locale:n,timeZone:t}=e.brand??{};return{...a?{currency:a}:{},...n?{locale:n}:{},...t?{timeZone:t}:{}}}var xn=Symbol.for("@graview/core:typed-field"),mn=(e,a)=>(/^(phone|place|duration)$/.test(a)&&(te(e)[xn]=a),e),gn=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function yn(e){let a=F().check(K(300),pe(t=>Ue(t,e)!==void 0,`a record of ${e.kinds.join(" or ")} in ${e.address}, as "<kind>:<id>"`)),n=e.cardinality==="one"?a:fe(a).check(K(200));return We(e.description?n.check(ue(e.description)):n,e)}var Rn=new WeakMap;function hn(e,a){Rn.set(e,a)}var zn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],V=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function kn(e,a=zn){if(!V(e))return{document:e,respelled:[]};let n=[],t=e;for(let o of a)t=Se(t,o.where.split("."),o,"",n);return{document:t,respelled:n}}function Se(e,a,n,t,o){if(a.length===0){if(!V(e)||!Object.hasOwn(e,n.was))return e;o.push(`${t}${n.was}`);let{[n.was]:G,...N}=e;return Object.hasOwn(e,n.now)?N:{...N,[n.now]:G}}if(!V(e))return e;let[l,...m]=a,v=l.endsWith("[]"),j=v?l.slice(0,-2):l,D=e[j],B=D;if(!v)B=Se(D,m,n,`${t}${j}.`,o);else if(Array.isArray(D)){let G=D.map((N,W)=>Se(N,m,n,`${t}${j}.${W}.`,o));B=G.some((N,W)=>N!==D[W])?G:D}return B===D?e:{...e,[j]:B}}var bn="graview-compiled@1";function An(e,a){return e.find(([n,t])=>n!==q&&"ref"in t&&(t.ref==="*"||t.ref.includes(a)))?.[0]}var q="id",me=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function wn(e){let a=Object.entries(e.fields),n=t=>["name","title","label"].find(o=>t.some(([l])=>l===o))??t[0]?.[0];return n(a.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(a.filter(([,t])=>t.type==="string"))}function vn(e,a,n){let t;switch(e.type){case"string":case"place":t=F().check(K(500));break;case"phone":t=F().check(K(40),ce(gn,"a phone number"));break;case"text":t=F().check(K(2e4)),e.format&&(te(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let l=e.min??(e.type==="duration"?0:void 0),m=[...e.type==="number"?[]:[Ne()],...l===void 0?[]:[Pe(l)],...e.max===void 0?[]:[Ge(e.max)],...e.step===void 0?[]:[Me(e.step)]];t=m.length>0?le().check(...m):le();break}case"boolean":t=Ce();break;case"date":t=F().check(ce(ke,"a date like 2026-10-02"));break;case"datetime":t=F().check(pe(Ve,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=Ke(e.options);break;case"list":t=fe(e.of==="number"?le():e.of==="date"?F().check(ce(ke)):e.of==="image"||e.of==="video"||e.of==="file"?be(e.of):F().check(K(500))).check(K(200));break;case"image":case"video":case"file":t=be(e.type);break;case"app-link":t=He();break;case"url":t=Fe();break;case"email":t=Le();break}let o=e.type==="number"||e.type==="integer";return mn(t,o&&e.format==="duration"?"duration":e.type),e.collaborative!==void 0&&(e.type==="text"||e.type==="string")&&(te(t)[Symbol.for("@graview/core:collaborative")]=e.collaborative?1:0),e.description&&(t=t.check(ue(e.description))),o&&(e.format==="money"||e.format==="percent"||!e.format&&e.unit)&&tn(t,{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{}}),a?ne(t):t}var ae=e=>{throw new U(`there is no record "${e}"`,"invalid")},Sn=(e,a)=>"field"in e?vn(e.field,e.optional,a):"ref"in e?rn(e.ref):ne(Ze()),En=new WeakMap;var Ee=(e,a)=>V(a)&&Object.keys(e??{}).length===Object.keys(a).length&&Object.keys(e??{}).every(n=>Object.hasOwn(a,n));function dt(e,a={}){let n=V(e)?e.format:void 0;if(n!==bn)return{ok:!1,findings:[ze("compiled-format","format",n===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(n)}, and this build reads ${bn}`,"compile the document instead")]};let t=e,o=kn(t.document).document,l=o===t.document?t:{...t,document:o},m=V(o)&&typeof o.name=="string"&&V(o.kinds)&&Ee(o.kinds,l.kinds)&&Ee(o.acts,l.acts)&&Ee(o.rules,l.rules)&&Array.isArray(l.edges)&&Array.isArray(l.findings),v={ok:!1,findings:[ze("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!m)return v;try{return jn(l,a)}catch{return v}}function jn(e,a={}){let{document:n}=e,t=n.brand?.timeZone,o=a.today??(()=>Ie(t)),l=new Map(e.edges.map(([h,r])=>[h,r])),m=new Map;for(let[h,r]of Object.entries(n.kinds)){let z=e.kinds[h]?.computed,R=ve(r.edges);m.set(h,{fields:new Set([...Object.keys(r.fields),...R.keys()]),edges:new Map(Object.entries(we(r.edges)).map(([T,P])=>[T,P.cardinality??"many"])),...z?{computed:new Map(z)}:{},...R.size>0?{linked:R}:{}})}e.facts&&m.set(cn,{computed:new Map(e.facts)});let v=un(n),j=new Map,D=Object.entries(n.kinds).map(([h,r])=>{let z={};for(let[i,g]of Object.entries(r.fields))z[i]=vn(g,!g.required,v),g.repeats&&(z[Je(i)]=ne(Ye()));for(let[i,g]of ve(r.edges))z[i]=ne(yn(g));let{label:R,describe:T,durations:P}=e.kinds[h]??{},M=Object.entries(r.computed??{}).map(([i,g])=>[i,typeof g=="string"?{expr:g}:g]),J=Object.hasOwn(r.fields,"label")&&!r.fields.label.label&&!/\{\s*label\b/.test(r.label??`{${wn(r)??""}}`),_=Object.fromEntries([...J?[["label","Label"]]:[],...Object.entries(r.fields).filter(([,i])=>i.label).map(([i,g])=>[i,g.label]),...M.filter(([,i])=>i.label).map(([i,g])=>[i,g.label])]),A=Object.keys(_).length>0,f=Object.fromEntries(Object.entries(r.fields).filter(([,i])=>i.default!==void 0).map(([i,g])=>[i,g.default]));j.set(h,f);let $=Object.fromEntries(Object.entries(we(r.edges)).map(([i,{renamedFrom:g,...I}])=>[i,I])),S=i=>r[i]?{[i]:r[i]}:{};return qe(h,{fields:he(z),edges:$,...S("plural"),...S("noun"),...S("description"),...R?{label:i=>ie(R,{node:i,kinds:m,today:o(),money:v})||i.id}:{},...T?{describe:i=>ie(T,{node:i,kinds:m,today:o(),money:v})}:{},...S("lifecycle"),...S("figure"),...S("fieldRoles"),...S("people"),archives:r.archives,...r.tidying?{tidying:r.tidying}:{},...M.length>0?{computed:Object.fromEntries(M.map(([i,g])=>[i,P?.includes(i)?{...g,as:"duration"}:r.computed[i]]))}:{},...A||r.glance||r.page?{display:{...A?{labels:_}:{},...r.glance?{glance:[...r.glance]}:{},...r.page?{page:r.page}:{}}}:{},...Object.keys(f).length>0?{defaults:f}:{}})}),B=Qe(D,n.computed);function G(h){return B.tryDefinition(h.kind)?.label?.(h)??h.id}let N=h=>({id:"",kind:h,...j.get(h)}),W=[];for(let[h,r]of Object.entries(n.acts??{})){let z=e.acts[h],{title:R,effects:T,guard:P,refusal:M,destructive:J,idempotent:_,creates:A,connects:f,severs:$,writes:S,writesOther:i,sets:g}=z,I=new Map(z.args),se={};for(let[d,x]of I)se[d]=Sn(x,v);let b=[r.on??[]].flat(),C=new Map(z.exprs),L=T.find(d=>"create"in d),Y=(d,x,p,w=null)=>{if(V(d)&&"expr"in d)return oe(C.get(d.expr),{graph:p,subject:w,kinds:m,bindings:x,today:o()});let k=me(d);return k===void 0?typeof d=="string"&&d.startsWith("$$")?d.slice(1):d:k==="now"?new Date().toISOString():k==="today"?o():x[k]},Te=(d,x)=>{if(!L)return"";let p=n.kinds[L.create].fields,w=N(L.create),k=[];for(let[O,ee]of Object.entries(L.set??{})){try{w[O]=Y(ee,d,x)??w[O]}catch{}let Q=me(ee);Q&&d[Q]!==void 0&&k.push(O)}let Z=G(w).trim(),H=k.filter(O=>w[O]!==!1&&p[O].type!=="text"&&!(/[^]{41}/.test(w[O])||/ .*[.!?]$/.test(w[O])&&!/[ .][A-Z]\w{0,3}\.$/.test(w[O]))&&G({...w,[O]:void 0}).trim()===Z).map(O=>w[O]===!0?p[O].label??Be(O):fn(w[O],p[O].format,o(),[],v));return Z&&H.length>0?`${Z} (${H.join(", ")})`:Z};W.push(nn(h,{input:he(se),title:R,...r.description?{description:r.description}:{},...r.fromTheOtherEnd?{fromTheOtherEnd:r.fromTheOtherEnd}:{},...I.has(q)?{subject:{kinds:b.length>0?b:"*",arg:q}}:{},...J?{destructive:!0}:{},..._?{idempotent:!0}:{},...A.length>0?{creates:A}:{},...f.length>0?{connects:f}:{},...$.length>0?{severs:$}:{},writes:S,...Object.keys(i).length>0?{writesOther:i}:{},...Object.keys(g).length>0?{sets:g}:{},describe:(d,x)=>{let p=typeof d[q]=="string"?x.getNode(d[q]):void 0,w=p?G(p):Te(d,x);return w?`${R}: ${w}`:R},apply(d,x){let p=d.graph,w=typeof x[q]=="string"?x[q]:void 0,k=w?p.getNode(w):void 0;if(w&&!k&&ae(w),k&&b.length>0&&!b.includes(k.kind))throw new U(`"${R}" acts on ${b.join(" or ")}, not on ${_e(k.kind)}`,"invalid");let Z={};for(let[s,c]of Object.entries(x))c!==void 0&&(Z[s]=c);if(P&&k){let s;try{s=oe(P,{graph:p,subject:k,kinds:m,bindings:Z,today:o()})}catch(c){throw c instanceof re?new U(`"${R}" could not be judged: ${c.sentence}`):c}if(s!==!0)throw new U(M?ie(M,{node:k,kinds:m,graph:p,bindings:Z,today:o(),money:v}):`"${R}" is not allowed for ${G(k)} right now`)}let H=new Map,O=s=>p.has(s)||[...H.values()].includes(s),ee=new Set,Q=s=>{let c=Xe(s);ee.has(c)||(ee.add(c),d.removeEdge(s))},X=(s,c)=>{let u=me(s);if(u==="subject")return w;if(u==="me"){let y=d.me;if(y&&n.kinds[p.getNode(y)?.kind]?.people)return y;throw new U(`"${R}" is done as you, and you have no record here`)}if(H.has(u))return H.get(u);try{return Y(s,Z,p,c??k??null)}catch(y){throw y instanceof re?new U(`"${R}" could not work out a value: ${y.sentence}`):y}};for(let s of T)if("create"in s){let c=n.kinds[s.create],u=N(s.create);for(let[ye,de]of Object.entries(s.set??{})){let $e=X(de,void 0);$e!==void 0&&(u[ye]=$e)}let y=wn(c),E=d.freshId(String((y&&u[y])??s.create),s.create);d.addNode({...u,id:E}),s.as&&H.set(s.as,E)}else if("connect"in s||"sever"in s){let c="connect"in s?s.connect:s.sever,u=String(X(s.from,void 0)??""),y=String(X(s.to,void 0)??"");if(O(u)||ae(u),O(y)||ae(y),"connect"in s){if(l.get(c)?.cardinality==="one")for(let E of p.out(u,c))E.id!==y&&Q({kind:c,from:u,to:E.id});p.out(u,c).some(E=>E.id===y)||d.addEdge({kind:c,from:u,to:y})}else Q({kind:c,from:u,to:y})}else if("set"in s){let c=String(X(s.target??"$subject",void 0)??""),u=p.getNode(c);!u&&!O(c)&&ae(c);let y={};for(let[E,ye]of Object.entries(s.set)){let de=X(ye,u);de!==void 0&&(y[E]=de)}Object.keys(y).length>0&&d.patchNode(c,y)}else if("remove"in s){let c=String(X(s.remove,void 0)??"");p.has(c)||ae(c),d.removeNode(c)}else if("replace"in s&&k){let c=x.to;for(let u of s.replace){let y=l.get(u)?.from.includes(k.kind)??!0;for(let E of y?p.out(k.id,u):p.in(k.id,u))u===s.keep&&E.id===c||Q(y?{kind:u,from:k.id,to:E.id}:{kind:u,from:E.id,to:k.id})}}}}))}let je=[];for(let[h,r]of Object.entries(n.rules??{})){let{title:z,require:R,when:T,says:P}=e.rules[h],M=r.repairs??[],J=(A,f,$=o(),S)=>{let i=[],g={graph:A,subject:f,kinds:m,today:$,...S?{linked:S}:{},onUnread:b=>i.push(b)},I;try{if(T&&oe(T,g)!==!0)return[];if(I=oe(R,g)===!0,!I&&i.length>0)throw new re(`it reads ${dn(i[0])}`,0)}catch(b){throw b instanceof ln?new en(b.sentence):b instanceof re?new Error(b.sentence):b}if(I)return[];let se=M.flatMap(b=>{let C=n.acts?.[b.act],L={},Y=f&&C?.on&&C.fromTheOtherEnd&&![C.on].flat().includes(f.kind)?An(e.acts[b.act].args,f.kind):void 0;Y?L[Y]=f.id:f&&(C?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(b.act))&&(L[q]=f.id);for(let[x,p]of Object.entries(b.args??{}))L[x]=me(p)==="subject"?f?.id:p;let d=(C?e.acts[b.act].args:[]).filter(([x,p])=>p.required&&L[x]===void 0).map(([x])=>x);return[{mutation:b.act,label:b.label??(Y?C.fromTheOtherEnd:C?.title)??b.act.replace(/-/g," "),args:L,...d.length>0?{missing:d}:{}}]});return[{invariant:h,...f?{subjectId:f.id}:{},label:z,message:P?ie(P,{node:f,kinds:m,graph:A,today:$,money:v}):f?`${G(f)}: ${z}`:z,nodeIds:f?[f.id]:[],repairs:se}]},_={label:z,shape:{over:r.over,require:R,when:T,says:P,declared:n.kinds,money:v,kinds:m,today:o},judgment:{require:r.require,...r.when?{when:r.when}:{},...r.says?{says:r.says}:{}},...r.description?{description:r.description}:{},...M.length>0?{repairs:M.map(A=>A.act)}:{}};je.push(r.over==="graph"?xe(h,{scope:"graph",..._,evaluate:({graph:A,today:f,context:$})=>J(A,null,f,$?.linked)}):xe(h,{scope:{kind:r.over},..._,evaluate:({graph:A,subject:f,today:$,context:S})=>J(A,f,$,S?.linked)}))}let De=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},ge={name:n.name,schema:B,mutations:W,invariants:je,...De?{policy:De}:{},...e.brand?{brand:e.brand}:{},...n.modules?{modules:n.modules}:{},...n.lenses?{lenses:n.lenses}:{},...n.pages?{pages:n.pages}:{},...n.settings?{settings:n.settings}:{},...n.connections?{connections:n.connections}:{},...n.forms?{forms:n.forms}:{},...n.publishing?{publishing:n.publishing}:{},...e.viewSpecs?{viewSpecs:e.viewSpecs}:{},...e.home?{home:e.home}:{},version:n.version??1};return hn(ge,n),En.set(ge,e),{ok:!0,app:ge,document:n,findings:e.findings,sights:n.policy?.sees,kinds:m}}export{kn as a,Fn as b,bn as c,q as d,me as e,wn as f,dt as g,jn as h};
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{e as k,g as M,h as I,i as B,l as P}from"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{G as te,Ga as q,T as W}from"./chunk.SF4BYBH6.js";import{a as L}from"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as h}from"./chunk.AJZBJBMO.js";var r=h(te(),1);var A=h(W(),1),U=q(L(()=>(__graviewPreload(import.meta.url,["./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.VTO6UWUP.js")))),v={Part:U.part((n,t)=>(0,A.jsx)(n.WhenMonth,{...t}),{quiet:!0}),prefetch:()=>U.prefetch()};var o=h(W(),1),z="try \u201Ctomorrow 3pm\u201D, \u201CFri 10:30\u201D or \u201C17 Oct\u201D";function K(n,t,d,p=!1){let S=Date.UTC(+n.day.slice(0,4),+n.day.slice(5,7)-1,+n.day.slice(8,10),0,t?n.minutes??0:0),g={weekday:p?"long":"short",year:"numeric",month:p?"long":"short",day:"numeric",...t?{hour:"numeric",minute:"2-digit"}:{},timeZone:"UTC"},m;try{m=new Intl.DateTimeFormat(d??"en-US",g)}catch{m=new Intl.DateTimeFormat("en-US",g)}return m.format(S).replace(/ /g," ")}function le({value:n,time:t,instant:d=!1,label:p,name:S,required:g,autoFocus:m,autoSelect:H,locale:s,onChange:j,onLeave:_,onCancel:V,inputRef:w,boxStyle:Z}){let x=(0,r.useId)(),u=(0,r.useRef)(null),D=(0,r.useRef)(null),b=e=>{let a=M(e);return a?K(a,t,s):e??""},[T,C]=(0,r.useState)(()=>b(n)),[F,y]=(0,r.useState)(!1),[G,E]=(0,r.useState)(n),[J,Q]=(0,r.useState)(n);n!==J&&(Q(n),n!==G&&(E(n),C(b(n)))),(0,r.useEffect)(()=>{H&&(u.current?.focus(),u.current?.select())},[H]);let i=t&&d?B(s):void 0,N=T===b(n),l=M(n),c=N?l:P(T,{today:k().day,time:t,...l?{base:l}:{},...s?{locale:s}:{}}),X=N?n:c?I(c,{time:t,instant:d}):void 0,$=T.trim()==="",f=!$&&c===void 0;(0,r.useEffect)(()=>{u.current?.setCustomValidity(f?`Not a date this reads \u2014 ${z}`:"")},[f]);let O=e=>{E(e),j(e)},Y=e=>{C(e);let a=e.trim()===""?void 0:P(e,{today:k().day,time:t,...l?{base:l}:{},...s?{locale:s}:{}});O(a?I(a,{time:t,instant:d}):void 0)},ee=e=>{let a=t?{day:e,minutes:c?.minutes??l?.minutes??540}:{day:e},R=I(a,{time:t,instant:d});C(b(R)),O(R),y(!1),requestAnimationFrame(()=>{u.current?.focus(),u.current?.select()})},ne=$?`Type a date, or pick one \u2014 ${z}`:f?`Not a date this reads \u2014 ${z}`:c?`${K(c,t,s,!0)}${i?` ${i.short}`:""}`:"";return(0,o.jsxs)("span",{"data-graview-when":t?d?"instant":"moment":"day",style:{display:"inline-flex",flex:"1 1 14rem",flexWrap:"wrap",alignItems:"center",gap:"4px 6px",maxWidth:"100%",minWidth:0},onBlur:e=>{let a=e.relatedTarget;a&&e.currentTarget.contains(a)||!a&&typeof document<"u"&&!document.hasFocus()||(y(!1),_?.(X))},children:[(0,o.jsx)("input",{ref:e=>{u.current=e,typeof w=="function"?w(e):w&&(w.current=e)},type:"text",name:S,required:g,autoFocus:m,"aria-label":p,"aria-describedby":`${x}-said`,"aria-invalid":f||void 0,autoComplete:"off",spellCheck:!1,enterKeyHint:"done",placeholder:t?"tomorrow 3pm":"17 Oct",value:T,"data-graview-part":"control",onChange:e=>Y(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),V?.()):e.key==="ArrowDown"&&e.altKey&&(e.preventDefault(),y(!0))},style:{flex:"1 1 12ch",minWidth:"10ch",maxWidth:"100%",boxSizing:"border-box",font:"inherit",...Z}}),(0,o.jsx)("button",{ref:D,type:"button","aria-label":`Pick a date for ${p}`,"aria-expanded":F,"aria-controls":`${x}-month`,"data-graview-part":"when-pick",onClick:()=>y(e=>!e),onPointerEnter:()=>v.prefetch(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:32,minHeight:32,padding:0,borderRadius:6},children:(0,o.jsxs)("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,o.jsx)("rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}),(0,o.jsx)("path",{d:"M2 6.5h12M5.5 1.5v3M10.5 1.5v3"})]})}),(0,o.jsxs)("span",{id:`${x}-said`,"aria-live":"polite","data-graview-part":"when-said",...i?{"data-graview-zone":i.zone,title:`Times are in ${i.zone.replace(/_/g," ")} (${i.short})`}:{},style:{flexBasis:"100%",fontSize:"0.75rem",color:f?"var(--graview-bad)":"var(--graview-ink-faint)"},children:[ne,i&&!f&&!$?(0,o.jsx)("span",{"data-graview-part":"when-zone",children:` \xB7 ${(i.zone.split("/").at(-1)??i.zone).replace(/_/g," ")} time`}):null]}),F?(0,o.jsx)(r.Suspense,{fallback:null,children:(0,o.jsx)(v.Part,{id:`${x}-month`,label:p,selected:c?.day??l?.day,today:k().day,locale:s,onPick:ee,onClose:()=>{y(!1),D.current?.focus()}})}):null]})}export{le as WhenInput,K as wallAsRead};
@@ -1 +0,0 @@
1
- import{i as n}from"./chunk.MDWCX3YU.js";import"./chunk.CB5DGKR5.js";import"./chunk.GKLDSHHH.js";import"./chunk.OCV46AFN.js";import"./chunk.PZ4G5QA5.js";import"./chunk.Y36MLVMT.js";import"./chunk.MPMROUZA.js";import"./chunk.XZJ6XX5I.js";import"./chunk.4F5M5XZG.js";import"./chunk.LVOL2LEC.js";import"./chunk.3G5DEGFA.js";import"./chunk.OZ4EJ5M6.js";import"./chunk.WVUJXDXZ.js";import{e as p}from"./chunk.3V2WXZU3.js";import"./chunk.7UD2JR6J.js";import"./chunk.BUDEUNBN.js";import"./chunk.3IEJQAK7.js";import"./chunk.AKLVSZ5A.js";import"./chunk.ZUBC3UFG.js";import"./chunk.GZHZLJBF.js";import"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{T as m}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as t}from"./chunk.AJZBJBMO.js";var i=t(m(),1),a=new WeakMap;function l(o){let e=a.get(o);if(!e){let r=p(o);e=c=>c.mode==="fullscreen"?(0,i.jsx)(n,{blocks:r,slot:"home",heading:2,firstHeading:1}):(0,i.jsx)(n,{blocks:r,slot:"home",heading:3,firstHeading:2}),a.set(o,e)}return e}export{l as homeView};