graview 0.1.53 → 0.1.55

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 (190) 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.Z4YSCHZT.js → chunk.27ZSRO3O.js} +1 -1
  5. package/dist/preview/{chunk.PEA4D66Y.js → chunk.2HANQ737.js} +1 -1
  6. package/dist/preview/{chunk.VRJ4TULC.js → chunk.2KH2LWZL.js} +1 -1
  7. package/dist/preview/{chunk.YI7WHBAD.js → chunk.2ORJGMRT.js} +2 -2
  8. package/dist/preview/{chunk.AQJD23AN.js → chunk.2SWQI4HF.js} +1 -1
  9. package/dist/preview/{chunk.5XFRWXYQ.js → chunk.354A4QCG.js} +1 -1
  10. package/dist/preview/chunk.35O5H5L7.js +2 -0
  11. package/dist/preview/chunk.3IZOXNJH.js +1 -0
  12. package/dist/preview/{chunk.HDXDYS4C.js → chunk.4BFJWNVM.js} +1 -1
  13. package/dist/preview/{chunk.GANAZIRD.js → chunk.4OMSQFIY.js} +1 -1
  14. package/dist/preview/{chunk.4SVAHPJA.js → chunk.4TLWZVVG.js} +1 -1
  15. package/dist/preview/chunk.5D6SIBOK.js +1 -0
  16. package/dist/preview/{chunk.ICYJ7QJG.js → chunk.5DPFAVCZ.js} +1 -1
  17. package/dist/preview/{chunk.5K5D4IMM.js → chunk.5EOSEVZB.js} +1 -1
  18. package/dist/preview/{chunk.MT45H2T5.js → chunk.5EZDXWOE.js} +1 -1
  19. package/dist/preview/{chunk.OPKXCL5R.js → chunk.5L4J2XAI.js} +1 -1
  20. package/dist/preview/{chunk.U4T4Y2MT.js → chunk.5MCXTY2P.js} +1 -1
  21. package/dist/preview/{chunk.K7WME4P4.js → chunk.5MSNKSTE.js} +1 -1
  22. package/dist/preview/{chunk.3FRVG6JW.js → chunk.5SANELJT.js} +2 -2
  23. package/dist/preview/chunk.5XUVCM7X.js +1 -0
  24. package/dist/preview/{chunk.CIUQWCU4.js → chunk.62LPYPP3.js} +1 -1
  25. package/dist/preview/{chunk.S6TN3MLY.js → chunk.644FUGSX.js} +1 -1
  26. package/dist/preview/{chunk.UYCPQ6IW.js → chunk.6JYNNPAI.js} +1 -1
  27. package/dist/preview/chunk.6NGSR2ZQ.js +1 -0
  28. package/dist/preview/{chunk.6ESAZJBN.js → chunk.6NQQUIBX.js} +1 -1
  29. package/dist/preview/{chunk.CSA6SWTI.js → chunk.6UAUME5U.js} +1 -1
  30. package/dist/preview/{chunk.G226CUJQ.js → chunk.6ZJE5M2A.js} +1 -1
  31. package/dist/preview/chunk.7ECBGIUK.js +1 -0
  32. package/dist/preview/chunk.7KERB5CH.js +1 -0
  33. package/dist/preview/chunk.7WEQHJ3N.js +6 -0
  34. package/dist/preview/{chunk.OCWZJNZF.js → chunk.7Y6NK5CT.js} +1 -1
  35. package/dist/preview/{chunk.I6W3IQ4W.js → chunk.AFEEXRN3.js} +1 -1
  36. package/dist/preview/{chunk.YA7ZMGOL.js → chunk.AFK5HHLL.js} +1 -1
  37. package/dist/preview/{chunk.MSPRCR3Q.js → chunk.ATXSLBE3.js} +1 -1
  38. package/dist/preview/chunk.AVNOLMCV.js +1 -0
  39. package/dist/preview/chunk.AVVNQKA7.js +1 -0
  40. package/dist/preview/chunk.AZ6Q3WT2.js +1 -0
  41. package/dist/preview/chunk.BJUUSIQY.js +1 -0
  42. package/dist/preview/{chunk.4DCPB67O.js → chunk.BRCKXL7B.js} +1 -1
  43. package/dist/preview/{chunk.LAOZEYYQ.js → chunk.CM2ETM2A.js} +2 -2
  44. package/dist/preview/{chunk.Y4VOCJ7R.js → chunk.CPNE6HPQ.js} +1 -1
  45. package/dist/preview/{chunk.UVMLX4US.js → chunk.DB3HOKZD.js} +1 -1
  46. package/dist/preview/{chunk.W54NXXC5.js → chunk.DBCVZGCC.js} +1 -1
  47. package/dist/preview/{chunk.USAGE5C6.js → chunk.DH4AC7TC.js} +1 -1
  48. package/dist/preview/{chunk.CANTHIRO.js → chunk.DKJK2MMV.js} +1 -1
  49. package/dist/preview/{chunk.XBNASVTY.js → chunk.DNJM6WQO.js} +1 -1
  50. package/dist/preview/{chunk.NAEEPUWJ.js → chunk.DU75P3Y7.js} +1 -1
  51. package/dist/preview/chunk.DVG47BK3.js +1 -0
  52. package/dist/preview/{chunk.FGJM4LJO.js → chunk.DXJFAAOI.js} +1 -1
  53. package/dist/preview/{chunk.NCTTPW7A.js → chunk.EGSE6NNE.js} +1 -1
  54. package/dist/preview/{chunk.MKWVNW4Q.js → chunk.EJXUOL2C.js} +3 -3
  55. package/dist/preview/{chunk.3FUFVVR4.js → chunk.EKP3HQAX.js} +1 -1
  56. package/dist/preview/{chunk.SLBWPVIY.js → chunk.FQLNBIQ5.js} +1 -1
  57. package/dist/preview/chunk.FTW3K3G6.js +5 -0
  58. package/dist/preview/{chunk.BB5XKTVC.js → chunk.FUS2FJS3.js} +1 -1
  59. package/dist/preview/{chunk.LCG3VLCB.js → chunk.FUZWXKTN.js} +1 -1
  60. package/dist/preview/chunk.FVOFTM5J.js +1 -0
  61. package/dist/preview/{chunk.WDEMPWS4.js → chunk.G2XDQPE4.js} +1 -1
  62. package/dist/preview/{chunk.N6A3DIOY.js → chunk.G5XTASMO.js} +1 -1
  63. package/dist/preview/chunk.H536YUAZ.js +3 -0
  64. package/dist/preview/chunk.HNJFBI7J.js +1 -0
  65. package/dist/preview/{chunk.VTCPA4V4.js → chunk.HUABTCQE.js} +1 -1
  66. package/dist/preview/{chunk.HIFLBWQJ.js → chunk.HXHFWZ2U.js} +2 -2
  67. package/dist/preview/{chunk.GZBODS7Z.js → chunk.HXR7EEXR.js} +1 -1
  68. package/dist/preview/chunk.INBHY3SA.js +1 -0
  69. package/dist/preview/{chunk.OZYZBRWO.js → chunk.IXHLP2CL.js} +1 -1
  70. package/dist/preview/{chunk.RIS3OKAI.js → chunk.JRRVLGEK.js} +1 -1
  71. package/dist/preview/{chunk.GPYZR6HE.js → chunk.K5WPS4RR.js} +1 -1
  72. package/dist/preview/{chunk.KAKJYAHM.js → chunk.KHJ2MCMS.js} +1 -1
  73. package/dist/preview/{chunk.56UFDIX5.js → chunk.KIMIPHAI.js} +1 -1
  74. package/dist/preview/{chunk.MDIAWTNK.js → chunk.KVQZ5FR6.js} +1 -1
  75. package/dist/preview/chunk.KXNWZ33P.js +1 -0
  76. package/dist/preview/{chunk.6S3B4XC4.js → chunk.LEPKPNPA.js} +1 -1
  77. package/dist/preview/chunk.LLXEWLIP.js +1 -0
  78. package/dist/preview/{chunk.G6DISMVT.js → chunk.LMXNHBGH.js} +2 -2
  79. package/dist/preview/{chunk.QATG5HNV.js → chunk.LQCH2NFE.js} +1 -1
  80. package/dist/preview/{chunk.KCM2VOC7.js → chunk.LWLI5PI4.js} +1 -1
  81. package/dist/preview/{chunk.FCAKLO5U.js → chunk.LYVRXRIH.js} +1 -1
  82. package/dist/preview/{chunk.5E4UGVAD.js → chunk.MFCBAQS3.js} +1 -1
  83. package/dist/preview/{chunk.TXEWSZGO.js → chunk.MFOSEOF4.js} +1 -1
  84. package/dist/preview/{chunk.S2ATSY6P.js → chunk.MIQMPOWF.js} +1 -1
  85. package/dist/preview/{chunk.7BXOQEUP.js → chunk.MNSKBGRM.js} +1 -1
  86. package/dist/preview/chunk.MSM6E6JK.js +1 -0
  87. package/dist/preview/{chunk.ULTYDYTS.js → chunk.NDLQXQV2.js} +2 -2
  88. package/dist/preview/chunk.NS6KWKF5.js +1 -0
  89. package/dist/preview/{chunk.JKCLYLT4.js → chunk.NXM73RZA.js} +1 -1
  90. package/dist/preview/{chunk.A2RQFAZ6.js → chunk.O752PM42.js} +1 -1
  91. package/dist/preview/{chunk.6CVW53WA.js → chunk.O7RMVGAB.js} +1 -1
  92. package/dist/preview/{chunk.65F3DF5Q.js → chunk.OIMYSR2J.js} +1 -1
  93. package/dist/preview/{chunk.TTFYXKLI.js → chunk.OL2N5NUV.js} +1 -1
  94. package/dist/preview/chunk.OS5EALHY.js +1 -0
  95. package/dist/preview/{chunk.XDEKL6TJ.js → chunk.OT6EWYK2.js} +1 -1
  96. package/dist/preview/chunk.P4ZZSFOQ.js +1 -0
  97. package/dist/preview/{chunk.BPPDBPTL.js → chunk.PCKX2FHR.js} +1 -1
  98. package/dist/preview/{chunk.VOHDRH3P.js → chunk.PHLMQO7V.js} +2 -2
  99. package/dist/preview/{chunk.FJN4OGAS.js → chunk.PIHCXN5U.js} +2 -2
  100. package/dist/preview/{chunk.FBRARPGR.js → chunk.PIQ52FCI.js} +2 -2
  101. package/dist/preview/{chunk.XFIZLWYA.js → chunk.PM64C5PX.js} +1 -1
  102. package/dist/preview/chunk.PSLCI3GO.js +2 -0
  103. package/dist/preview/chunk.QBMIET7P.js +1 -0
  104. package/dist/preview/{chunk.R3DWF35R.js → chunk.QIAH7HHO.js} +1 -1
  105. package/dist/preview/chunk.QJ42D5GM.js +1 -0
  106. package/dist/preview/{chunk.IYVBJDR7.js → chunk.QQ3YWKWU.js} +1 -1
  107. package/dist/preview/{chunk.36XV4ZMC.js → chunk.QWICAV2C.js} +2 -2
  108. package/dist/preview/chunk.R3ZS4QO6.js +18 -0
  109. package/dist/preview/{chunk.LDLWYAHK.js → chunk.RNYLNBIB.js} +1 -1
  110. package/dist/preview/{chunk.H6EMDQP5.js → chunk.RPVJ5IXD.js} +1 -1
  111. package/dist/preview/{chunk.CWPRQSED.js → chunk.RZQKCLTW.js} +1 -1
  112. package/dist/preview/chunk.SDLUWRGI.js +1 -0
  113. package/dist/preview/chunk.SG67ID6C.js +1 -0
  114. package/dist/preview/{chunk.UQENE3VE.js → chunk.SIABGHF2.js} +1 -1
  115. package/dist/preview/{chunk.UQ4CASST.js → chunk.SUGOENC4.js} +1 -1
  116. package/dist/preview/chunk.SYX7AEHU.js +1 -0
  117. package/dist/preview/{chunk.72Q4R7N6.js → chunk.T66UK7PQ.js} +1 -1
  118. package/dist/preview/{chunk.3377DLPA.js → chunk.TAQB64FZ.js} +1 -1
  119. package/dist/preview/{chunk.ASCTAUFD.js → chunk.TDV7JGIQ.js} +1 -1
  120. package/dist/preview/chunk.TEE23CVQ.js +1 -0
  121. package/dist/preview/{chunk.HAIHXBVX.js → chunk.TT6GKRBE.js} +1 -1
  122. package/dist/preview/{chunk.DQPEVPKQ.js → chunk.TUBAFVV4.js} +2 -2
  123. package/dist/preview/chunk.TZTRGNAA.js +1 -0
  124. package/dist/preview/{chunk.DUZS52WX.js → chunk.U5AX4DD5.js} +1 -1
  125. package/dist/preview/chunk.UADL2LHO.js +1 -0
  126. package/dist/preview/{chunk.TLQTDKOL.js → chunk.UE5GAP67.js} +2 -2
  127. package/dist/preview/{chunk.HBVURYWY.js → chunk.URDCHVH3.js} +2 -2
  128. package/dist/preview/{chunk.GBIVIHGD.js → chunk.USJ4J3GL.js} +2 -2
  129. package/dist/preview/{chunk.E647LWH5.js → chunk.V5PAFSWP.js} +2 -2
  130. package/dist/preview/chunk.WR63RQGU.js +5 -0
  131. package/dist/preview/chunk.WSMYFEGU.js +25 -0
  132. package/dist/preview/{chunk.2LQ37DC2.js → chunk.WUFCRE7O.js} +1 -1
  133. package/dist/preview/{chunk.7NFCI4LH.js → chunk.WVKXELAF.js} +2 -2
  134. package/dist/preview/{chunk.UXNZPPWR.js → chunk.XEHLSKHP.js} +1 -1
  135. package/dist/preview/{chunk.CYP5KXIQ.js → chunk.XSMXSNDR.js} +1 -1
  136. package/dist/preview/chunk.XTP5DGPJ.js +88 -0
  137. package/dist/preview/{chunk.BG2SC77J.js → chunk.XUHY4XO2.js} +1 -1
  138. package/dist/preview/{chunk.EZXGVTT2.js → chunk.Y3BEKXYB.js} +1 -1
  139. package/dist/preview/chunk.YG2WZO53.js +1 -0
  140. package/dist/preview/{chunk.KWMBRB6O.js → chunk.YGZGMRDC.js} +1 -1
  141. package/dist/preview/{chunk.P7FN3SFB.js → chunk.YOBRVKJT.js} +1 -1
  142. package/dist/preview/{chunk.E52UTLQ2.js → chunk.YRFN4VDD.js} +1 -1
  143. package/dist/preview/{chunk.T56SOSIR.js → chunk.YYWANGIC.js} +1 -1
  144. package/dist/preview/{chunk.JCJ7NTW4.js → chunk.ZAHVKXYQ.js} +1 -1
  145. package/dist/preview/{chunk.RUTZEEBR.js → chunk.ZOW7AC7U.js} +1 -1
  146. package/dist/preview/{chunk.J6OT74RM.js → chunk.ZPXAKRKG.js} +1 -1
  147. package/dist/preview/{chunk.JQTO52Q7.js → chunk.ZXOD5GM3.js} +1 -1
  148. package/dist/preview/index.html +52 -52
  149. package/dist/preview/page.js +2 -2
  150. package/package.json +6 -6
  151. package/dist/preview/chunk.2IKVO743.js +0 -1
  152. package/dist/preview/chunk.34Q7OKK3.js +0 -1
  153. package/dist/preview/chunk.3Y7BDRP3.js +0 -1
  154. package/dist/preview/chunk.4DFO43VM.js +0 -1
  155. package/dist/preview/chunk.4QVZXCV5.js +0 -1
  156. package/dist/preview/chunk.52Y37IAD.js +0 -1
  157. package/dist/preview/chunk.5H3VCAPN.js +0 -1
  158. package/dist/preview/chunk.6W2DUW5S.js +0 -5
  159. package/dist/preview/chunk.7R6GXJS4.js +0 -6
  160. package/dist/preview/chunk.B3T4N2XM.js +0 -25
  161. package/dist/preview/chunk.BQHRZJ5Z.js +0 -1
  162. package/dist/preview/chunk.D3A24PQ6.js +0 -1
  163. package/dist/preview/chunk.EG2N5F6L.js +0 -1
  164. package/dist/preview/chunk.FXNUR5JI.js +0 -88
  165. package/dist/preview/chunk.GGHZEAAT.js +0 -1
  166. package/dist/preview/chunk.GYO57LKD.js +0 -1
  167. package/dist/preview/chunk.GZWC72HS.js +0 -1
  168. package/dist/preview/chunk.H2B3SEI7.js +0 -1
  169. package/dist/preview/chunk.HE545Z6I.js +0 -1
  170. package/dist/preview/chunk.HIDLE6BN.js +0 -18
  171. package/dist/preview/chunk.I62MCBQM.js +0 -1
  172. package/dist/preview/chunk.I6SUHXJF.js +0 -1
  173. package/dist/preview/chunk.JRU5BT7K.js +0 -5
  174. package/dist/preview/chunk.LEKML4S4.js +0 -1
  175. package/dist/preview/chunk.MXTDQXVW.js +0 -1
  176. package/dist/preview/chunk.OP3ZUI4W.js +0 -1
  177. package/dist/preview/chunk.OXLYDXQV.js +0 -1
  178. package/dist/preview/chunk.P2W727C7.js +0 -1
  179. package/dist/preview/chunk.PFXGWY3P.js +0 -1
  180. package/dist/preview/chunk.Q5JVKSEN.js +0 -1
  181. package/dist/preview/chunk.Q5WEOX3Q.js +0 -1
  182. package/dist/preview/chunk.SHNYYBNW.js +0 -1
  183. package/dist/preview/chunk.THL67D77.js +0 -1
  184. package/dist/preview/chunk.TI4OSTQV.js +0 -1
  185. package/dist/preview/chunk.TRPPN2GD.js +0 -2
  186. package/dist/preview/chunk.VTRI2MT2.js +0 -2
  187. package/dist/preview/chunk.XXCT6DLX.js +0 -1
  188. package/dist/preview/chunk.ZJXUWOG3.js +0 -1
  189. package/dist/preview/chunk.ZQWKS6K5.js +0 -1
  190. package/dist/preview/chunk.ZYYM52N5.js +0 -1
@@ -1 +1 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{F as g,G as T,Ga as C,T as v,ca as S}from"./chunk.B3T4N2XM.js";import{a as m}from"./chunk.SDO3U72B.js";import"./chunk.6W2DUW5S.js";import"./chunk.SLBWPVIY.js";import{b as c}from"./chunk.AJZBJBMO.js";var n=c(T(),1),r=c(v(),1),s=null,u=null,f=new Set,a=()=>{for(let e of f)e()},y=e=>(f.add(e),()=>void f.delete(e)),E=300,d=()=>{u!==null&&clearTimeout(u),u=null};function q(e,t){d(),x.prefetch(),!(s?.element===t&&s.target.on===e.on)&&(s={target:e,element:t},a())}function M(e=!1){if(d(),s!==null){if(e){s=null,a();return}u=setTimeout(()=>{u=null,s=null,a()},E)}}var R=()=>d(),P=()=>s,b="graview:hover-chips",h;function A(e){if(h!==void 0)return h;try{return(e??localStorage).getItem(b)!=="off"}catch{return!0}}function I(e,t){h=e;try{(t??localStorage).setItem(b,e?"on":"off")}catch{}e||(s=null),a()}function w(){let e=S(),t=g(e?.ai),o=e?.memory,l=(0,n.useSyncExternalStore)(y,()=>A(o),()=>!1),i=(0,n.useCallback)(H=>I(H,o),[o]);return{offered:t,on:t&&l,set:i}}function z({legend:e,style:t,choice:o}){let l=w();return l.offered?(0,r.jsxs)("fieldset",{"data-testid":"setting-hover-chips",style:{border:0,margin:0,padding:0,display:"grid",gap:5,...t},children:[(0,r.jsx)("legend",{style:{...e,padding:0},children:"AI suggestions on hover"}),(0,r.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:"A quiet suggestion beside a record the pointer rests on, when the AI is sure of one."}),(0,r.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[!0,!1].map(i=>(0,r.jsx)("button",{type:"button","aria-pressed":l.on===i,"data-testid":`setting-hover-chips-${i?"on":"off"}`,onClick:()=>l.set(i),style:o(l.on===i),children:i?"On":"Off"},String(i)))})]}):null}var x=C(m(()=>(__graviewPreload(import.meta.url,["./chunk.ZYYM52N5.js","./chunk.4DCPB67O.js","./chunk.Y4VOCJ7R.js","./chunk.3FUFVVR4.js","./chunk.XOZU4OFA.js","./chunk.IYVBJDR7.js","./chunk.OZYZBRWO.js","./chunk.TI4OSTQV.js","./chunk.FGJM4LJO.js","./chunk.MT45H2T5.js","./chunk.S2ATSY6P.js","./chunk.72Q4R7N6.js","./chunk.G6DISMVT.js","./chunk.W54NXXC5.js","./chunk.B3T4N2XM.js","./chunk.SDO3U72B.js","./chunk.6W2DUW5S.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.CIUQWCU4.js")))),k=x.part((e,t)=>{let o=e.HoverChip;return(0,r.jsx)(o,{...t})},{quiet:!0}),p=null,O=()=>p;function L(){let{on:e}=w(),t=(0,n.useSyncExternalStore)(y,P,()=>null),[o]=(0,n.useState)(()=>Symbol("hover-chip")),l=(0,n.useSyncExternalStore)(y,O,()=>null);return(0,n.useEffect)(()=>{if(e)return p===null&&(p=o,a()),()=>{p===o&&(p=null,s=null,d(),a())}},[e,o,l]),!e||t===null||l!==o||!t.element.isConnected?null:(0,r.jsx)(n.Suspense,{fallback:null,children:(0,r.jsx)(k,{rest:t,hold:R,leave:M})})}export{L as HoverChipDoor,z as HoverChipsSwitch,R as holdRest,A as hoverChipsWanted,M as leaveRest,q as restOn,I as setHoverChipsWanted,w as useHoverChipsSetting};
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{F as g,G as T,Ga as C,T as v,ca as S}from"./chunk.WSMYFEGU.js";import{a as m}from"./chunk.SDO3U72B.js";import"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b as c}from"./chunk.AJZBJBMO.js";var n=c(T(),1),r=c(v(),1),s=null,u=null,f=new Set,a=()=>{for(let e of f)e()},y=e=>(f.add(e),()=>void f.delete(e)),E=300,d=()=>{u!==null&&clearTimeout(u),u=null};function q(e,t){d(),x.prefetch(),!(s?.element===t&&s.target.on===e.on)&&(s={target:e,element:t},a())}function M(e=!1){if(d(),s!==null){if(e){s=null,a();return}u=setTimeout(()=>{u=null,s=null,a()},E)}}var R=()=>d(),P=()=>s,b="graview:hover-chips",h;function A(e){if(h!==void 0)return h;try{return(e??localStorage).getItem(b)!=="off"}catch{return!0}}function I(e,t){h=e;try{(t??localStorage).setItem(b,e?"on":"off")}catch{}e||(s=null),a()}function w(){let e=S(),t=g(e?.ai),o=e?.memory,l=(0,n.useSyncExternalStore)(y,()=>A(o),()=>!1),i=(0,n.useCallback)(H=>I(H,o),[o]);return{offered:t,on:t&&l,set:i}}function z({legend:e,style:t,choice:o}){let l=w();return l.offered?(0,r.jsxs)("fieldset",{"data-testid":"setting-hover-chips",style:{border:0,margin:0,padding:0,display:"grid",gap:5,...t},children:[(0,r.jsx)("legend",{style:{...e,padding:0},children:"AI suggestions on hover"}),(0,r.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:"A quiet suggestion beside a record the pointer rests on, when the AI is sure of one."}),(0,r.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[!0,!1].map(i=>(0,r.jsx)("button",{type:"button","aria-pressed":l.on===i,"data-testid":`setting-hover-chips-${i?"on":"off"}`,onClick:()=>l.set(i),style:o(l.on===i),children:i?"On":"Off"},String(i)))})]}):null}var x=C(m(()=>(__graviewPreload(import.meta.url,["./chunk.35O5H5L7.js","./chunk.BJUUSIQY.js","./chunk.BRCKXL7B.js","./chunk.CPNE6HPQ.js","./chunk.EKP3HQAX.js","./chunk.XOZU4OFA.js","./chunk.QQ3YWKWU.js","./chunk.IXHLP2CL.js","./chunk.DXJFAAOI.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.62LPYPP3.js")))),k=x.part((e,t)=>{let o=e.HoverChip;return(0,r.jsx)(o,{...t})},{quiet:!0}),p=null,O=()=>p;function L(){let{on:e}=w(),t=(0,n.useSyncExternalStore)(y,P,()=>null),[o]=(0,n.useState)(()=>Symbol("hover-chip")),l=(0,n.useSyncExternalStore)(y,O,()=>null);return(0,n.useEffect)(()=>{if(e)return p===null&&(p=o,a()),()=>{p===o&&(p=null,s=null,d(),a())}},[e,o,l]),!e||t===null||l!==o||!t.element.isConnected?null:(0,r.jsx)(n.Suspense,{fallback:null,children:(0,r.jsx)(k,{rest:t,hold:R,leave:M})})}export{L as HoverChipDoor,z as HoverChipsSwitch,R as holdRest,A as hoverChipsWanted,M as leaveRest,q as restOn,I as setHoverChipsWanted,w as useHoverChipsSetting};
@@ -1 +1 @@
1
- import{q as ce}from"./chunk.GYO57LKD.js";import{a as Z,b as C,c as ee,d as te,g as oe,j as re,k as P,l as se,p as le,s as de}from"./chunk.ZYYM52N5.js";import{a as ie,b as ne,c as ae}from"./chunk.4DCPB67O.js";import"./chunk.Y4VOCJ7R.js";import"./chunk.3FUFVVR4.js";import"./chunk.XOZU4OFA.js";import"./chunk.IYVBJDR7.js";import{a as X}from"./chunk.OZYZBRWO.js";import"./chunk.TI4OSTQV.js";import"./chunk.FGJM4LJO.js";import"./chunk.MT45H2T5.js";import"./chunk.S2ATSY6P.js";import"./chunk.72Q4R7N6.js";import{c as _,j as J}from"./chunk.G6DISMVT.js";import"./chunk.W54NXXC5.js";import{G as me,J as U,T as V,ba as j}from"./chunk.B3T4N2XM.js";import"./chunk.SDO3U72B.js";import{Oc as Y,ha as B}from"./chunk.6W2DUW5S.js";import"./chunk.SLBWPVIY.js";import{b as O}from"./chunk.AJZBJBMO.js";var a=O(me(),1);var d=O(V(),1),ke=new Set(["show","go","to","open","the","a","an","me"]),ge=r=>r.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,""),W=(r,p)=>{let s=ge(r);return p.every(t=>s.includes(t))},pe=r=>r&&!/^.\p{Lu}/u.test(r)?`${r[0].toLowerCase()}${r.slice(1)}`:r,L={act:4,show:3,place:3,record:4},we=360,h=12;function Oe({face:r,opening:p,close:s}){let t=X(),{setMenuAt:v}=j(),n=(0,a.useMemo)(()=>p.target??Z(p.pointed??{about:[]},e=>t.store.graph.has(e)),[p,t.store]),f=(0,a.useMemo)(()=>oe(t.store,n,t.places),[t.store,n,t.places]),[u,y]=(0,a.useState)(""),[b,m]=(0,a.useState)(-1),[l,$]=(0,a.useState)(null),[A,I]=(0,a.useState)(null),E=(0,a.useRef)(null),z=(0,a.useRef)(null),T=(0,a.useId)(),R=(0,a.useRef)(!0),{ghost:G}=U(t.desk);(0,a.useEffect)(()=>()=>{R.current=!1;let e=t.desk.get().ghost;e?.onCard&&t.desk.setGhost({...e,onCard:!1})},[t.desk]);let M=(0,a.useMemo)(()=>{let e=P(t,n);return ee(t.store,n,{principal:t.principal,places:t.places,...e.acts?{acts:e.acts}:{}})},[t,n]),K=(0,a.useMemo)(()=>{let e=C(n);if(e.length===0)return[];let i=new Set(M.candidates.flatMap(c=>c.type==="act"?[c.mutation]:[]));return ie(t.store,e,{principal:t.principal,...e.length===1?{focus:e[0]}:{}}).affordances.filter(c=>!c.destructive&&i.has(c.mutation))},[t.store,t.principal,n,M]),q=(0,a.useCallback)(()=>{let e=p.returnTo,i=ue(E.current,n,r);s(),requestAnimationFrame(()=>{if(e?.isConnected&&!e.closest("[inert]"))return e.focus({preventScroll:!0});let c=(i&&i.tabIndex>=0?i:null)??document.querySelector("[data-graview-page-title]")??document.querySelector("main");c&&c.tabIndex<0&&!c.hasAttribute("tabindex")&&c.setAttribute("tabindex","-1"),c?.focus({preventScroll:!0})})},[p.returnTo,n,r,s]),F=(0,a.useCallback)(e=>{if(e.open.length>0){let i=E.current?.getBoundingClientRect();s(),v({x:i?.left??0,y:i?.top??0,on:e.args.id??C(n)[0],about:C(n)});return}try{ae(t.store,e,{},{pressed:t.principal?{author:t.principal}:{}}),ne(t.store,e,{},{author:t.principal}),q()}catch(i){I(i instanceof Error?i.message:String(i))}},[t.store,t.principal,s,q,v,n]),H=(0,a.useCallback)(async e=>{let i=e.trim();if(!i)return;let c=l?.result?.answer?{said:l.said,answer:l.result.answer}:void 0;y(""),m(-1),I(null),$({said:i,result:null});let S=await re(t.ai,{...P(t,n,i),said:i,...c?{follows:c}:{}});t.desk.record(S.interaction),S.ghost&&S.ghost.proposals.length>0&&t.desk.setGhost({ghost:S.ghost,onCard:!0}),R.current&&$({said:i,result:S})},[l,t,n]),N=(0,a.useRef)(p.asked);(0,a.useEffect)(()=>{let e=N.current;N.current=void 0,e&&H(e)},[]);let k=(0,a.useMemo)(()=>{let e=u.trim();if(!e&&l)return[];let i=ge(e).split(/\s+/).filter(o=>o&&!ke.has(o)),c=/^show\b/i.test(e),S=/^(go|open)\b/i.test(e),x=[];if(!c&&!S)for(let o of K.filter(g=>W(g.label,i)).slice(0,L.act))x.push({id:`act:${o.id}`,kind:"act",label:o.label,hint:o.open.length>0?"asks more":"do it",take:()=>F(o)});let Q=e&&!/\?\s*$/.test(e)?te(t.store,n,{principal:t.principal,places:t.places,said:e}):[];for(let o of Q)x.push({id:`place:${o.place}`,kind:"place",label:o.fit==="full"?`Open ${o.title}`:`Open and adjust ${o.title}`,hint:o.fit==="full"?"a view you have":"adjust it",take:()=>{s(),t.goTo.place(o.place),o.fit==="partial"&&_(t.desk,{target:{on:"lens",place:o.place,...o.kind?{kind:o.kind}:{}},asked:e})}});if(!S){let o=M.candidates.filter(g=>g.type==="panel");for(let g of o.filter(D=>W(`show ${D.label}`,i)).slice(0,L.show))x.push({id:g.id,kind:"show",label:`Show ${pe(g.label)}`,hint:"a panel",take:()=>{s(),se(t,{title:g.label,recipe:{...g.panel,title:g.label}})}})}if(!c){for(let o of t.places.filter(g=>W(g.title,i)&&!Q.some(D=>D.place===g.as)).slice(0,L.place))x.push({id:`place:${o.as}`,kind:"place",label:`Go to ${o.title}`,take:()=>(s(),t.goTo.place(o.as))});if(i.length>0){let o=ce(t.store,e.replace(/^(go to|open)\s+/i,""),{principal:t.principal,from:C(n),limit:L.record}).hits;for(let g of o)g.about==="node"&&x.push({id:`record:${g.id}`,kind:"record",label:g.label,hint:B(t.store.schema,g.kind),take:()=>(s(),t.goTo.record(g.id))})}}return e&&x.push({id:"ask",kind:"ask",label:e,take:()=>void H(e)}),x},[u,K,M,t,n,F,H,s,l]);(0,a.useEffect)(()=>m(u.trim()?0:-1),[u]),(0,a.useLayoutEffect)(()=>{let e=E.current;if(!e)return;if(typeof e.showPopover=="function")try{e.showPopover()}catch{}z.current?.focus({preventScroll:!0});let i=0,c=()=>{be(e,ue(e,n,r)),i=requestAnimationFrame(c)};return c(),()=>cancelAnimationFrame(i)},[n,r]),(0,a.useEffect)(()=>{if(l)return;let e=i=>{i.target instanceof Node&&E.current?.contains(i.target)||s()};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[l,s]);let fe=e=>{if(e.key==="ArrowDown"&&k.length>0)e.preventDefault(),m(i=>Math.min(k.length-1,i+1));else if(e.key==="ArrowUp"&&k.length>0)e.preventDefault(),m(i=>Math.max(0,i-1));else if(e.key==="Enter"){e.preventDefault();let i=k[b];i?i.take():u.trim()&&H(u)}},w=l?.result??null,he=k[b];return(0,d.jsxs)("section",{ref:E,popover:"manual",role:"region","aria-label":l?`Answer about ${f}`:`Ask about ${f}`,"data-testid":"quick-ask","data-quick-ask":l?"answer":"bar","data-quick-ask-face":r,"data-graview-offstage":"","data-graview-overlay":"",onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),q())},onMouseDown:e=>e.stopPropagation(),style:ve,children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[(0,d.jsxs)("p",{"data-testid":"quick-ask-about",style:{margin:0,flex:"1 1 auto",minWidth:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},children:["About ",f]}),(0,d.jsx)("button",{type:"button","data-testid":"quick-ask-close","aria-label":"Close",title:"Close",onClick:q,style:ye,children:(0,d.jsx)("span",{"aria-hidden":"true",children:"\u2715"})})]}),l?(0,d.jsxs)("div",{"data-testid":"quick-answer",style:{display:"grid",gap:8},children:[(0,d.jsxs)("p",{"data-testid":"quick-answer-asked",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",fontStyle:"italic",overflowWrap:"anywhere"},children:["\u201C",l.said,"\u201D"]}),(0,d.jsx)("p",{"data-testid":"quick-answer-text","aria-live":"polite",style:{margin:0,fontSize:"0.9375rem",lineHeight:1.45,color:w?.interaction.outcome==="failed"?"var(--graview-warn)":"var(--graview-ink)",overflowWrap:"anywhere"},children:w===null?"Thinking\u2026":w.interaction.outcome==="failed"?w.interaction.failed??"The AI could not answer that here.":w.answer??""}),w&&w.offers.length>0?(0,d.jsx)("ul",{"aria-label":"What acts on it",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:6},children:w.offers.map(e=>(0,d.jsx)("li",{children:(0,d.jsx)("button",{type:"button","data-testid":"quick-answer-offer","data-ai-offer":e.id,"data-ai-offer-type":e.type,onClick:()=>{le(t,w,e,s).then(i=>{i&&R.current&&I(i)})},style:xe,children:e.type==="panel"?`Show ${pe(e.label)}`:e.type==="place"?`Go to ${e.label}`:e.label})},e.id))}):null,G?.onCard&&G.ghost.interaction===w?.interaction.id?(0,d.jsx)(de,{placement:"card"}):null]}):null,(0,d.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,d.jsx)("input",{ref:z,type:"text",role:"combobox","data-testid":"quick-ask-input","aria-label":l?`Ask a follow-up about ${f}`:`Ask about ${f}, or go somewhere`,"aria-expanded":k.length>0,"aria-controls":T,"aria-autocomplete":"list",...he?{"aria-activedescendant":`${T}-${b}`}:{},autoComplete:"off",enterKeyHint:"go",placeholder:l?"Ask a follow-up\u2026":"Ask, or go to\u2026",value:u,readOnly:l!==null&&w===null,"aria-busy":l!==null&&w===null,onChange:e=>y(e.target.value),onKeyDown:fe,style:Ae}),(0,d.jsx)("div",{id:T,role:"listbox","aria-label":u.trim()?`What \u201C${u.trim()}\u201D finds here`:"What can be done here",hidden:k.length===0,style:{display:k.length===0?"none":"grid",gap:1,maxHeight:280,overflowY:"auto"},children:k.map((e,i)=>(0,d.jsx)("div",{id:`${T}-${i}`,role:"option","aria-selected":i===b,"data-testid":"quick-ask-option","data-quick-ask-kind":e.kind,"data-quick-ask-row":e.id,onMouseEnter:()=>m(i),onMouseDown:c=>c.preventDefault(),onClick:e.take,style:{...Se,background:i===b?"var(--graview-panel-muted)":"transparent",...e.kind==="ask"?{borderTop:"1px solid var(--graview-edge)",marginTop:2}:{}},children:e.kind==="ask"?(0,d.jsxs)("span",{children:["Ask: ",(0,d.jsxs)("span",{style:{fontWeight:600},children:["\u2018",e.label,"\u2019"]})]}):(0,d.jsxs)("span",{children:[e.label,e.hint?(0,d.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.hint]}):null]})},e.id))})]}),A?(0,d.jsx)("p",{role:"alert","data-testid":"quick-ask-refused",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-warn)"},children:A}):null,(0,d.jsx)("span",{style:J,"aria-live":"polite",children:k.length>0&&u.trim()?`${k.length} ${k.length===1?"way":"ways"} to go on`:""})]})}function ue(r,p,s){let t=r?.closest("[data-graview-embed]")??document,v=p.on==="list"?[`aggregate:${p.kind}`,`kind:${p.kind}`]:p.on==="lens"&&p.kind?[`aggregate:${p.kind}`]:C(p);for(let n of v)for(let f of t.querySelectorAll(`[data-graview-view="${CSS.escape(n)}"], [data-graview-pick="${CSS.escape(n)}"]`)){if(r?.contains(f))continue;let u=f.getBoundingClientRect();if(u.width>0&&u.height>0)return f}return s==="pages"?t.querySelector("main [data-graview-page-title]")??t.querySelector("main h1"):null}function be(r,p){let s={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},t=Math.min(we,s.width-2*h),v=r.getBoundingClientRect().height,n=p?.getBoundingClientRect(),f,u,y,b=A=>Math.max(h,Math.min(A,s.height-v-h));if(n&&n.width>0&&n.bottom>0&&n.top<s.height)if(n.right+h+t<=s.width-h)f=n.right+h,u=b(n.top),y="right";else if(n.left-h-t>=h)f=n.left-h-t,u=b(n.top),y="left";else{f=Math.max(h,Math.min(n.left,s.width-t-h));let A=n.bottom+h;u=A+v<=s.height-h?A:b(n.top-h-v),y=A+v<=s.height-h?"below":"above"}else f=(s.width-t)/2,u=b(72),y="top";let m=r.style,l={left:`${Math.round(f)}px`,top:`${Math.round(u)}px`,width:`${Math.round(t)}px`};m.left!==l.left&&(m.left=l.left),m.top!==l.top&&(m.top=l.top),m.width!==l.width&&(m.width=l.width);let $=p?.getAttribute("data-graview-view")??p?.getAttribute("data-graview-pick")??(p?"page":"");r.getAttribute("data-quick-ask-beside")!==$&&r.setAttribute("data-quick-ask-beside",$),r.getAttribute("data-quick-ask-side")!==y&&r.setAttribute("data-quick-ask-side",y)}var ve={position:"fixed",inset:"auto",margin:0,zIndex:Y("popover"),boxSizing:"border-box",display:"grid",gap:10,padding:12,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",maxHeight:"calc(100dvh - 24px)",overflowY:"auto",fontSize:"0.875rem"},ye={display:"inline-grid",placeItems:"center",width:28,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,color:"var(--graview-ink-muted)",background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer"},Ae={boxSizing:"border-box",width:"100%",height:36,padding:"0 10px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8},Se={display:"flex",alignItems:"center",minHeight:30,padding:"4px 8px",borderRadius:6,cursor:"pointer",overflowWrap:"anywhere"},xe={display:"inline-flex",alignItems:"center",minHeight:30,padding:"2px 10px",font:"inherit",fontSize:"0.8125rem",borderRadius:8};export{Oe as QuickAskCard};
1
+ import{q as ce}from"./chunk.MSM6E6JK.js";import{a as Z,b as C,c as ee,d as te,g as oe,j as re,k as P,l as se,p as le,s as de}from"./chunk.35O5H5L7.js";import"./chunk.BJUUSIQY.js";import{a as ie,b as ne,c as ae}from"./chunk.BRCKXL7B.js";import"./chunk.CPNE6HPQ.js";import"./chunk.EKP3HQAX.js";import"./chunk.XOZU4OFA.js";import"./chunk.QQ3YWKWU.js";import{a as X}from"./chunk.IXHLP2CL.js";import"./chunk.DXJFAAOI.js";import"./chunk.5EZDXWOE.js";import"./chunk.MIQMPOWF.js";import"./chunk.T66UK7PQ.js";import{c as _,j as J}from"./chunk.LMXNHBGH.js";import"./chunk.DBCVZGCC.js";import{G as me,J as U,T as V,ba as j}from"./chunk.WSMYFEGU.js";import"./chunk.SDO3U72B.js";import{Rc as Y,ha as B}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b as O}from"./chunk.AJZBJBMO.js";var a=O(me(),1);var d=O(V(),1),ke=new Set(["show","go","to","open","the","a","an","me"]),ge=r=>r.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,""),W=(r,p)=>{let s=ge(r);return p.every(t=>s.includes(t))},pe=r=>r&&!/^.\p{Lu}/u.test(r)?`${r[0].toLowerCase()}${r.slice(1)}`:r,L={act:4,show:3,place:3,record:4},we=360,h=12;function De({face:r,opening:p,close:s}){let t=X(),{setMenuAt:v}=j(),n=(0,a.useMemo)(()=>p.target??Z(p.pointed??{about:[]},e=>t.store.graph.has(e)),[p,t.store]),f=(0,a.useMemo)(()=>oe(t.store,n,t.places),[t.store,n,t.places]),[u,y]=(0,a.useState)(""),[b,m]=(0,a.useState)(-1),[l,$]=(0,a.useState)(null),[A,I]=(0,a.useState)(null),E=(0,a.useRef)(null),z=(0,a.useRef)(null),T=(0,a.useId)(),R=(0,a.useRef)(!0),{ghost:G}=U(t.desk);(0,a.useEffect)(()=>()=>{R.current=!1;let e=t.desk.get().ghost;e?.onCard&&t.desk.setGhost({...e,onCard:!1})},[t.desk]);let M=(0,a.useMemo)(()=>{let e=P(t,n);return ee(t.store,n,{principal:t.principal,places:t.places,...e.acts?{acts:e.acts}:{}})},[t,n]),K=(0,a.useMemo)(()=>{let e=C(n);if(e.length===0)return[];let i=new Set(M.candidates.flatMap(c=>c.type==="act"?[c.mutation]:[]));return ie(t.store,e,{principal:t.principal,...e.length===1?{focus:e[0]}:{}}).affordances.filter(c=>!c.destructive&&i.has(c.mutation))},[t.store,t.principal,n,M]),q=(0,a.useCallback)(()=>{let e=p.returnTo,i=ue(E.current,n,r);s(),requestAnimationFrame(()=>{if(e?.isConnected&&!e.closest("[inert]"))return e.focus({preventScroll:!0});let c=(i&&i.tabIndex>=0?i:null)??document.querySelector("[data-graview-page-title]")??document.querySelector("main");c&&c.tabIndex<0&&!c.hasAttribute("tabindex")&&c.setAttribute("tabindex","-1"),c?.focus({preventScroll:!0})})},[p.returnTo,n,r,s]),F=(0,a.useCallback)(e=>{if(e.open.length>0){let i=E.current?.getBoundingClientRect();s(),v({x:i?.left??0,y:i?.top??0,on:e.args.id??C(n)[0],about:C(n)});return}try{ae(t.store,e,{},{pressed:t.principal?{author:t.principal}:{}}),ne(t.store,e,{},{author:t.principal}),q()}catch(i){I(i instanceof Error?i.message:String(i))}},[t.store,t.principal,s,q,v,n]),H=(0,a.useCallback)(async e=>{let i=e.trim();if(!i)return;let c=l?.result?.answer?{said:l.said,answer:l.result.answer}:void 0;y(""),m(-1),I(null),$({said:i,result:null});let S=await re(t.ai,{...P(t,n,i),said:i,...c?{follows:c}:{}});t.desk.record(S.interaction),S.ghost&&S.ghost.proposals.length>0&&t.desk.setGhost({ghost:S.ghost,onCard:!0}),R.current&&$({said:i,result:S})},[l,t,n]),N=(0,a.useRef)(p.asked);(0,a.useEffect)(()=>{let e=N.current;N.current=void 0,e&&H(e)},[]);let k=(0,a.useMemo)(()=>{let e=u.trim();if(!e&&l)return[];let i=ge(e).split(/\s+/).filter(o=>o&&!ke.has(o)),c=/^show\b/i.test(e),S=/^(go|open)\b/i.test(e),x=[];if(!c&&!S)for(let o of K.filter(g=>W(g.label,i)).slice(0,L.act))x.push({id:`act:${o.id}`,kind:"act",label:o.label,hint:o.open.length>0?"asks more":"do it",take:()=>F(o)});let Q=e&&!/\?\s*$/.test(e)?te(t.store,n,{principal:t.principal,places:t.places,said:e}):[];for(let o of Q)x.push({id:`place:${o.place}`,kind:"place",label:o.fit==="full"?`Open ${o.title}`:`Open and adjust ${o.title}`,hint:o.fit==="full"?"a view you have":"adjust it",take:()=>{s(),t.goTo.place(o.place),o.fit==="partial"&&_(t.desk,{target:{on:"lens",place:o.place,...o.kind?{kind:o.kind}:{}},asked:e})}});if(!S){let o=M.candidates.filter(g=>g.type==="panel");for(let g of o.filter(D=>W(`show ${D.label}`,i)).slice(0,L.show))x.push({id:g.id,kind:"show",label:`Show ${pe(g.label)}`,hint:"a panel",take:()=>{s(),se(t,{title:g.label,recipe:{...g.panel,title:g.label}})}})}if(!c){for(let o of t.places.filter(g=>W(g.title,i)&&!Q.some(D=>D.place===g.as)).slice(0,L.place))x.push({id:`place:${o.as}`,kind:"place",label:`Go to ${o.title}`,take:()=>(s(),t.goTo.place(o.as))});if(i.length>0){let o=ce(t.store,e.replace(/^(go to|open)\s+/i,""),{principal:t.principal,from:C(n),limit:L.record}).hits;for(let g of o)g.about==="node"&&x.push({id:`record:${g.id}`,kind:"record",label:g.label,hint:B(t.store.schema,g.kind),take:()=>(s(),t.goTo.record(g.id))})}}return e&&x.push({id:"ask",kind:"ask",label:e,take:()=>void H(e)}),x},[u,K,M,t,n,F,H,s,l]);(0,a.useEffect)(()=>m(u.trim()?0:-1),[u]),(0,a.useLayoutEffect)(()=>{let e=E.current;if(!e)return;if(typeof e.showPopover=="function")try{e.showPopover()}catch{}z.current?.focus({preventScroll:!0});let i=0,c=()=>{be(e,ue(e,n,r)),i=requestAnimationFrame(c)};return c(),()=>cancelAnimationFrame(i)},[n,r]),(0,a.useEffect)(()=>{if(l)return;let e=i=>{i.target instanceof Node&&E.current?.contains(i.target)||s()};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[l,s]);let fe=e=>{if(e.key==="ArrowDown"&&k.length>0)e.preventDefault(),m(i=>Math.min(k.length-1,i+1));else if(e.key==="ArrowUp"&&k.length>0)e.preventDefault(),m(i=>Math.max(0,i-1));else if(e.key==="Enter"){e.preventDefault();let i=k[b];i?i.take():u.trim()&&H(u)}},w=l?.result??null,he=k[b];return(0,d.jsxs)("section",{ref:E,popover:"manual",role:"region","aria-label":l?`Answer about ${f}`:`Ask about ${f}`,"data-testid":"quick-ask","data-quick-ask":l?"answer":"bar","data-quick-ask-face":r,"data-graview-offstage":"","data-graview-overlay":"",onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),q())},onMouseDown:e=>e.stopPropagation(),style:ve,children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[(0,d.jsxs)("p",{"data-testid":"quick-ask-about",style:{margin:0,flex:"1 1 auto",minWidth:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},children:["About ",f]}),(0,d.jsx)("button",{type:"button","data-testid":"quick-ask-close","aria-label":"Close",title:"Close",onClick:q,style:ye,children:(0,d.jsx)("span",{"aria-hidden":"true",children:"\u2715"})})]}),l?(0,d.jsxs)("div",{"data-testid":"quick-answer",style:{display:"grid",gap:8},children:[(0,d.jsxs)("p",{"data-testid":"quick-answer-asked",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",fontStyle:"italic",overflowWrap:"anywhere"},children:["\u201C",l.said,"\u201D"]}),(0,d.jsx)("p",{"data-testid":"quick-answer-text","aria-live":"polite",style:{margin:0,fontSize:"0.9375rem",lineHeight:1.45,color:w?.interaction.outcome==="failed"?"var(--graview-warn)":"var(--graview-ink)",overflowWrap:"anywhere"},children:w===null?"Thinking\u2026":w.interaction.outcome==="failed"?w.interaction.failed??"The AI could not answer that here.":w.answer??""}),w&&w.offers.length>0?(0,d.jsx)("ul",{"aria-label":"What acts on it",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:6},children:w.offers.map(e=>(0,d.jsx)("li",{children:(0,d.jsx)("button",{type:"button","data-testid":"quick-answer-offer","data-ai-offer":e.id,"data-ai-offer-type":e.type,onClick:()=>{le(t,w,e,s).then(i=>{i&&R.current&&I(i)})},style:xe,children:e.type==="panel"?`Show ${pe(e.label)}`:e.type==="place"?`Go to ${e.label}`:e.label})},e.id))}):null,G?.onCard&&G.ghost.interaction===w?.interaction.id?(0,d.jsx)(de,{placement:"card"}):null]}):null,(0,d.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,d.jsx)("input",{ref:z,type:"text",role:"combobox","data-testid":"quick-ask-input","aria-label":l?`Ask a follow-up about ${f}`:`Ask about ${f}, or go somewhere`,"aria-expanded":k.length>0,"aria-controls":T,"aria-autocomplete":"list",...he?{"aria-activedescendant":`${T}-${b}`}:{},autoComplete:"off",enterKeyHint:"go",placeholder:l?"Ask a follow-up\u2026":"Ask, or go to\u2026",value:u,readOnly:l!==null&&w===null,"aria-busy":l!==null&&w===null,onChange:e=>y(e.target.value),onKeyDown:fe,style:Ae}),(0,d.jsx)("div",{id:T,role:"listbox","aria-label":u.trim()?`What \u201C${u.trim()}\u201D finds here`:"What can be done here",hidden:k.length===0,style:{display:k.length===0?"none":"grid",gap:1,maxHeight:280,overflowY:"auto"},children:k.map((e,i)=>(0,d.jsx)("div",{id:`${T}-${i}`,role:"option","aria-selected":i===b,"data-testid":"quick-ask-option","data-quick-ask-kind":e.kind,"data-quick-ask-row":e.id,onMouseEnter:()=>m(i),onMouseDown:c=>c.preventDefault(),onClick:e.take,style:{...Se,background:i===b?"var(--graview-panel-muted)":"transparent",...e.kind==="ask"?{borderTop:"1px solid var(--graview-edge)",marginTop:2}:{}},children:e.kind==="ask"?(0,d.jsxs)("span",{children:["Ask: ",(0,d.jsxs)("span",{style:{fontWeight:600},children:["\u2018",e.label,"\u2019"]})]}):(0,d.jsxs)("span",{children:[e.label,e.hint?(0,d.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.hint]}):null]})},e.id))})]}),A?(0,d.jsx)("p",{role:"alert","data-testid":"quick-ask-refused",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-warn)"},children:A}):null,(0,d.jsx)("span",{style:J,"aria-live":"polite",children:k.length>0&&u.trim()?`${k.length} ${k.length===1?"way":"ways"} to go on`:""})]})}function ue(r,p,s){let t=r?.closest("[data-graview-embed]")??document,v=p.on==="list"?[`aggregate:${p.kind}`,`kind:${p.kind}`]:p.on==="lens"&&p.kind?[`aggregate:${p.kind}`]:C(p);for(let n of v)for(let f of t.querySelectorAll(`[data-graview-view="${CSS.escape(n)}"], [data-graview-pick="${CSS.escape(n)}"]`)){if(r?.contains(f))continue;let u=f.getBoundingClientRect();if(u.width>0&&u.height>0)return f}return s==="pages"?t.querySelector("main [data-graview-page-title]")??t.querySelector("main h1"):null}function be(r,p){let s={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},t=Math.min(we,s.width-2*h),v=r.getBoundingClientRect().height,n=p?.getBoundingClientRect(),f,u,y,b=A=>Math.max(h,Math.min(A,s.height-v-h));if(n&&n.width>0&&n.bottom>0&&n.top<s.height)if(n.right+h+t<=s.width-h)f=n.right+h,u=b(n.top),y="right";else if(n.left-h-t>=h)f=n.left-h-t,u=b(n.top),y="left";else{f=Math.max(h,Math.min(n.left,s.width-t-h));let A=n.bottom+h;u=A+v<=s.height-h?A:b(n.top-h-v),y=A+v<=s.height-h?"below":"above"}else f=(s.width-t)/2,u=b(72),y="top";let m=r.style,l={left:`${Math.round(f)}px`,top:`${Math.round(u)}px`,width:`${Math.round(t)}px`};m.left!==l.left&&(m.left=l.left),m.top!==l.top&&(m.top=l.top),m.width!==l.width&&(m.width=l.width);let $=p?.getAttribute("data-graview-view")??p?.getAttribute("data-graview-pick")??(p?"page":"");r.getAttribute("data-quick-ask-beside")!==$&&r.setAttribute("data-quick-ask-beside",$),r.getAttribute("data-quick-ask-side")!==y&&r.setAttribute("data-quick-ask-side",y)}var ve={position:"fixed",inset:"auto",margin:0,zIndex:Y("popover"),boxSizing:"border-box",display:"grid",gap:10,padding:12,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",maxHeight:"calc(100dvh - 24px)",overflowY:"auto",fontSize:"0.875rem"},ye={display:"inline-grid",placeItems:"center",width:28,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,color:"var(--graview-ink-muted)",background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer"},Ae={boxSizing:"border-box",width:"100%",height:36,padding:"0 10px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8},Se={display:"flex",alignItems:"center",minHeight:30,padding:"4px 8px",borderRadius:6,cursor:"pointer",overflowWrap:"anywhere"},xe={display:"inline-flex",alignItems:"center",minHeight:30,padding:"2px 10px",font:"inherit",fontSize:"0.8125rem",borderRadius:8};export{De as QuickAskCard};
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{G as k,Ga as o,T as n}from"./chunk.WSMYFEGU.js";import{a as t}from"./chunk.SDO3U72B.js";import{b as p}from"./chunk.AJZBJBMO.js";var f=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.HUABTCQE.js","./chunk.DXJFAAOI.js","./chunk.5MSNKSTE.js","./chunk.KVQZ5FR6.js","./chunk.2HANQ737.js","./chunk.H536YUAZ.js","./chunk.GZHZLJBF.js","./chunk.OL2N5NUV.js","./chunk.OJGHDWI6.js","./chunk.5DPFAVCZ.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.MFCBAQS3.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.OL2N5NUV.js","./chunk.OJGHDWI6.js","./chunk.5DPFAVCZ.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5EOSEVZB.js")))),I=d.part((e,r)=>e.drawLinkedRecord(r),{quiet:!0}),w=d.part((e,r)=>e.drawLinkedPicker(r),{what:"Picking a linked record"});var s=p(n(),1),m=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.OL2N5NUV.js","./chunk.OJGHDWI6.js","./chunk.5DPFAVCZ.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SUGOENC4.js")))),E=m.part((e,r)=>(0,s.jsx)(e.RepeatPicker,{...r}),{quiet:!0}),W=m.part((e,r)=>(0,s.jsx)(e.RepeatEditor,{...r}),{quiet:!0});var a=p(k(),1),i=p(n(),1),c=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.MNSKBGRM.js")))),l=c.part((e,r)=>(0,i.jsx)(e.WhenInput,{...r}),{quiet:!0});function M(e){return(0,i.jsx)(a.Suspense,{fallback:(0,i.jsx)("span",{"data-graview-when-arriving":"",style:{display:"inline-block",minHeight:24}}),children:(0,i.jsx)(l,{...e})})}var N=()=>c.load().then(()=>{},()=>{});export{y as a,I as b,w as c,E as d,W as e,M as f,N as g};
@@ -1,2 +1,2 @@
1
- import{G as w,Na as c,aa as f,ba as h,da as g}from"./chunk.B3T4N2XM.js";import{b as m}from"./chunk.AJZBJBMO.js";var d=m(w(),1);function j(){let e=c();return(0,d.useMemo)(()=>[...new Set(e.flatMap(n=>n.nodeIds))],[e])}function x(){let e=I(),n=f();return(0,d.useMemo)(()=>{if(!n)return e;let t=n.matched;return t.length===0&&e.length===0?[k]:[...new Set([...e,...t])]},[n,e])}function I(){let{store:e,selection:n}=h(),t=g(),r=c();return(0,d.useMemo)(()=>{if(n.length===0)return v;let u=n.join(`
1
+ import{G as w,Na as c,aa as f,ba as h,da as g}from"./chunk.WSMYFEGU.js";import{b as m}from"./chunk.AJZBJBMO.js";var d=m(w(),1);function j(){let e=c();return(0,d.useMemo)(()=>[...new Set(e.flatMap(n=>n.nodeIds))],[e])}function x(){let e=I(),n=f();return(0,d.useMemo)(()=>{if(!n)return e;let t=n.matched;return t.length===0&&e.length===0?[k]:[...new Set([...e,...t])]},[n,e])}function I(){let{store:e,selection:n}=h(),t=g(),r=c();return(0,d.useMemo)(()=>{if(n.length===0)return v;let u=n.join(`
2
2
  `),s=y.get(e);if(s&&s.violations===r&&s.key===u)return s.reached;let a=new Set(n),i=new Set(a);for(let o of e.graph.allEdges())a.has(o.from)&&i.add(o.to),a.has(o.to)&&i.add(o.from);for(let o of r)if(o.subjectId!==void 0&&a.has(o.subjectId))for(let p of o.nodeIds)i.add(p);let l=[...i];return y.set(e,{violations:r,key:u,reached:l}),l},[e,n,t,r])}var v=[],y=new WeakMap,k="search:nothing";export{j as a,x as b,I as c};
@@ -1 +1 @@
1
- import"./chunk.GZHZLJBF.js";import{n as P}from"./chunk.TTFYXKLI.js";import"./chunk.OJGHDWI6.js";import"./chunk.ICYJ7QJG.js";import"./chunk.MT45H2T5.js";import"./chunk.S2ATSY6P.js";import"./chunk.72Q4R7N6.js";import"./chunk.G6DISMVT.js";import"./chunk.W54NXXC5.js";import{G as A,T as S,ca as b}from"./chunk.B3T4N2XM.js";import"./chunk.SDO3U72B.js";import{Ba as w,Nc as x,oa as L}from"./chunk.6W2DUW5S.js";import"./chunk.SLBWPVIY.js";import{b as R}from"./chunk.AJZBJBMO.js";var u=R(A(),1);var n=R(S(),1),C={kind:"human"},p={color:"var(--graview-ink-muted)"};function I(e){if(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}return L(e)?e:void 0}}function z(e){let o=b(),t=o?.linkedReads,[i,a]=(0,u.useState)(()=>t?t.answered(e)??"asking":null);return(0,u.useEffect)(()=>{if(!t){a(o?.linkedRecords?"asking":null);return}let d=t.answered(e);if(a(d===void 0?"asking":d),d!==void 0)return;let s=!0;return t.ask(e).then(l=>s&&a(l)),()=>{s=!1}},[t,o?.linkedRecords,e.address,e.kind,e.id]),i}function V({reference:e,as:o}){let t=b(),i=z(e),a={position:"relative",zIndex:x.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%"};if(i==="asking")return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"asking","aria-busy":"true",style:{...p,...a},children:"Linked record"});if(i&&"denied"in i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"denied",style:{...p,fontStyle:"italic",...a},children:"linked record (no access)"});if(!i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"missing",style:{...p,fontStyle:"italic",...a},children:"linked record (not found)"});let d=I(i.href),s=t?.linkedRecords,l=t?.principal??C,g=s?.open?c=>{c.metaKey||c.ctrlKey||(c.preventDefault(),s.open(e,l))}:void 0,k=(0,n.jsx)("a",{"data-graview-linked-title":"",...d?{href:d}:{role:"link",tabIndex:0},...g?{onClick:g,onKeyDown:c=>!d&&(c.key==="Enter"||c.key===" ")?g(c):void 0}:{},style:{fontWeight:600,color:"inherit",textUnderlineOffset:3,cursor:d||g?"pointer":"default"},children:i.label});return o==="chip"?(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"found",title:i.describe,style:{display:"inline-flex",alignItems:"center",minHeight:24,...a},children:k}):(0,n.jsx)(D,{record:i,title:k,base:a})}function D({record:e,title:o,base:t}){return(0,n.jsxs)("span",{"data-graview-linked":"","data-graview-linked-state":"found",style:{display:"grid",gap:2,padding:"8px 10px",border:"1px solid var(--graview-line)",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-surface)",...t},children:[(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"2px 8px"},children:[o,e.app?(0,n.jsxs)("span",{"data-graview-linked-app":"",style:{...p,fontSize:"0.75rem"},children:["in ",e.app]}):null]}),e.describe?(0,n.jsx)("span",{"data-graview-linked-describe":"",style:{...p,fontSize:"0.8125rem"},children:e.describe}):null,e.card&&e.card.length>0?(0,n.jsx)("span",{"data-graview-linked-card":"",style:{display:"flex",flexWrap:"wrap",gap:"2px 12px",fontSize:"0.8125rem"},children:e.card.map(i=>(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{style:p,children:i.label})," ",i.text]},i.label))}):null]})}function H({relation:e,refs:o,as:t="record",nodeId:i,field:a,style:d}){let s=(0,n.jsx)("span",{"data-graview-linked-list":"",style:{display:"grid",gap:6,minWidth:0,...d},children:o.map(l=>(0,n.jsx)(V,{reference:l,as:t},w(l)))});return i&&a?(0,n.jsx)(K,{nodeId:i,field:a,relation:e,refs:o,drawn:s}):s}function K({nodeId:e,field:o,relation:t,refs:i,drawn:a}){let{fields:d,commit:s}=P(e),l=d.find(f=>f.field===o),[g,k]=(0,u.useState)(!1);if(!l)return a;let c=t.cardinality==="one"?i[0]?w(i[0]):void 0:i.map(w);return(0,n.jsxs)("span",{style:{display:"grid",gap:6,minWidth:0},children:[a,g?(0,n.jsx)(N,{relation:t,value:c,label:"Link another record",onChange:f=>{s(l,f),k(!1)},onCancel:()=>k(!1)}):(0,n.jsx)("button",{type:"button","data-graview-linked-change":"",onClick:()=>k(!0),style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-accent)",cursor:"pointer",minHeight:24},children:"Change"})]})}function N({relation:e,value:o,onChange:t,onCancel:i,label:a}){let d=b(),s=d?.linkedRecords,l=d?.principal??C,g=(0,u.useId)(),[k,c]=(0,u.useState)(""),[f,m]=(0,u.useState)("asking");(0,u.useEffect)(()=>{if(!s)return;let r=!0;m("asking");let y=setTimeout(()=>{Promise.resolve().then(()=>s.find({address:e.address,kinds:e.kinds,query:k,limit:20},l)).then(h=>r&&m(Array.isArray(h)?h:"denied"),()=>r&&m([]))},150);return()=>{r=!1,clearTimeout(y)}},[s,e.address,e.kinds.join(","),k,l.kind,l.id]);let v=new Set([o].flat().filter(r=>typeof r=="string")),W=r=>{let y=w(r);if(e.cardinality==="one")return t(y);t(v.has(y)?[...v].filter(h=>h!==y):[...v,y])};return s?(0,n.jsxs)("span",{"data-graview-linked-picker":"",style:{display:"grid",gap:6,minWidth:0},children:[(0,n.jsx)("label",{htmlFor:g,style:{...p,fontSize:"0.8125rem"},children:a}),(0,n.jsx)("input",{id:g,type:"search",value:k,placeholder:`Find one in ${e.address}`,onChange:r=>c(r.target.value),style:{font:"inherit",minHeight:32,padding:"4px 8px",border:"1px solid var(--graview-line)",borderRadius:6,background:"var(--graview-surface)",color:"inherit",minWidth:0}}),f==="asking"?(0,n.jsx)("span",{"aria-busy":"true",style:p,children:"Looking\u2026"}):f==="denied"?(0,n.jsx)("span",{"data-graview-linked-state":"denied",style:{...p,fontStyle:"italic"},children:"linked record (no access)"}):f.length===0?(0,n.jsx)("span",{style:p,children:"Nothing there matches."}):(0,n.jsx)("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:4},children:f.map(r=>{let y=v.has(w(r));return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-graview-linked-candidate":w(r),"aria-pressed":y,onClick:()=>W(r),style:{display:"grid",gap:2,width:"100%",textAlign:"start",font:"inherit",padding:"6px 8px",minHeight:32,border:"1px solid var(--graview-line)",borderRadius:6,background:y?"var(--graview-accent-soft, var(--graview-surface))":"var(--graview-surface)",color:"inherit",cursor:"pointer"},children:[(0,n.jsx)("span",{style:{fontWeight:600},children:r.label}),r.describe?(0,n.jsx)("span",{style:{...p,fontSize:"0.8125rem"},children:r.describe}):null]})},w(r))})}),i?(0,n.jsx)("button",{type:"button",onClick:i,style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-ink-muted)",cursor:"pointer",minHeight:24},children:"Keep it as it is"}):null]}):(0,n.jsxs)("span",{"data-graview-linked-picker":"","data-graview-linked-state":"no-host",style:p,children:["This page cannot read ",e.address,", so nothing there can be linked here."]})}var U=e=>(0,n.jsx)(H,{...e}),j=e=>(0,n.jsx)(N,{...e});export{N as LinkedPicker,H as LinkedRecordView,j as drawLinkedPicker,U as drawLinkedRecord};
1
+ import"./chunk.GZHZLJBF.js";import{n as P}from"./chunk.OL2N5NUV.js";import"./chunk.OJGHDWI6.js";import"./chunk.5DPFAVCZ.js";import"./chunk.5EZDXWOE.js";import"./chunk.MIQMPOWF.js";import"./chunk.T66UK7PQ.js";import"./chunk.LMXNHBGH.js";import"./chunk.DBCVZGCC.js";import{G as A,T as S,ca as b}from"./chunk.WSMYFEGU.js";import"./chunk.SDO3U72B.js";import{Ba as w,Qc as x,oa as L}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";var u=R(A(),1);var n=R(S(),1),C={kind:"human"},p={color:"var(--graview-ink-muted)"};function I(e){if(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}return L(e)?e:void 0}}function z(e){let o=b(),t=o?.linkedReads,[i,a]=(0,u.useState)(()=>t?t.answered(e)??"asking":null);return(0,u.useEffect)(()=>{if(!t){a(o?.linkedRecords?"asking":null);return}let d=t.answered(e);if(a(d===void 0?"asking":d),d!==void 0)return;let s=!0;return t.ask(e).then(l=>s&&a(l)),()=>{s=!1}},[t,o?.linkedRecords,e.address,e.kind,e.id]),i}function V({reference:e,as:o}){let t=b(),i=z(e),a={position:"relative",zIndex:x.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%"};if(i==="asking")return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"asking","aria-busy":"true",style:{...p,...a},children:"Linked record"});if(i&&"denied"in i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"denied",style:{...p,fontStyle:"italic",...a},children:"linked record (no access)"});if(!i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"missing",style:{...p,fontStyle:"italic",...a},children:"linked record (not found)"});let d=I(i.href),s=t?.linkedRecords,l=t?.principal??C,g=s?.open?c=>{c.metaKey||c.ctrlKey||(c.preventDefault(),s.open(e,l))}:void 0,k=(0,n.jsx)("a",{"data-graview-linked-title":"",...d?{href:d}:{role:"link",tabIndex:0},...g?{onClick:g,onKeyDown:c=>!d&&(c.key==="Enter"||c.key===" ")?g(c):void 0}:{},style:{fontWeight:600,color:"inherit",textUnderlineOffset:3,cursor:d||g?"pointer":"default"},children:i.label});return o==="chip"?(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"found",title:i.describe,style:{display:"inline-flex",alignItems:"center",minHeight:24,...a},children:k}):(0,n.jsx)(D,{record:i,title:k,base:a})}function D({record:e,title:o,base:t}){return(0,n.jsxs)("span",{"data-graview-linked":"","data-graview-linked-state":"found",style:{display:"grid",gap:2,padding:"8px 10px",border:"1px solid var(--graview-line)",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-surface)",...t},children:[(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"2px 8px"},children:[o,e.app?(0,n.jsxs)("span",{"data-graview-linked-app":"",style:{...p,fontSize:"0.75rem"},children:["in ",e.app]}):null]}),e.describe?(0,n.jsx)("span",{"data-graview-linked-describe":"",style:{...p,fontSize:"0.8125rem"},children:e.describe}):null,e.card&&e.card.length>0?(0,n.jsx)("span",{"data-graview-linked-card":"",style:{display:"flex",flexWrap:"wrap",gap:"2px 12px",fontSize:"0.8125rem"},children:e.card.map(i=>(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{style:p,children:i.label})," ",i.text]},i.label))}):null]})}function H({relation:e,refs:o,as:t="record",nodeId:i,field:a,style:d}){let s=(0,n.jsx)("span",{"data-graview-linked-list":"",style:{display:"grid",gap:6,minWidth:0,...d},children:o.map(l=>(0,n.jsx)(V,{reference:l,as:t},w(l)))});return i&&a?(0,n.jsx)(K,{nodeId:i,field:a,relation:e,refs:o,drawn:s}):s}function K({nodeId:e,field:o,relation:t,refs:i,drawn:a}){let{fields:d,commit:s}=P(e),l=d.find(f=>f.field===o),[g,k]=(0,u.useState)(!1);if(!l)return a;let c=t.cardinality==="one"?i[0]?w(i[0]):void 0:i.map(w);return(0,n.jsxs)("span",{style:{display:"grid",gap:6,minWidth:0},children:[a,g?(0,n.jsx)(N,{relation:t,value:c,label:"Link another record",onChange:f=>{s(l,f),k(!1)},onCancel:()=>k(!1)}):(0,n.jsx)("button",{type:"button","data-graview-linked-change":"",onClick:()=>k(!0),style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-accent)",cursor:"pointer",minHeight:24},children:"Change"})]})}function N({relation:e,value:o,onChange:t,onCancel:i,label:a}){let d=b(),s=d?.linkedRecords,l=d?.principal??C,g=(0,u.useId)(),[k,c]=(0,u.useState)(""),[f,m]=(0,u.useState)("asking");(0,u.useEffect)(()=>{if(!s)return;let r=!0;m("asking");let y=setTimeout(()=>{Promise.resolve().then(()=>s.find({address:e.address,kinds:e.kinds,query:k,limit:20},l)).then(h=>r&&m(Array.isArray(h)?h:"denied"),()=>r&&m([]))},150);return()=>{r=!1,clearTimeout(y)}},[s,e.address,e.kinds.join(","),k,l.kind,l.id]);let v=new Set([o].flat().filter(r=>typeof r=="string")),W=r=>{let y=w(r);if(e.cardinality==="one")return t(y);t(v.has(y)?[...v].filter(h=>h!==y):[...v,y])};return s?(0,n.jsxs)("span",{"data-graview-linked-picker":"",style:{display:"grid",gap:6,minWidth:0},children:[(0,n.jsx)("label",{htmlFor:g,style:{...p,fontSize:"0.8125rem"},children:a}),(0,n.jsx)("input",{id:g,type:"search",value:k,placeholder:`Find one in ${e.address}`,onChange:r=>c(r.target.value),style:{font:"inherit",minHeight:32,padding:"4px 8px",border:"1px solid var(--graview-line)",borderRadius:6,background:"var(--graview-surface)",color:"inherit",minWidth:0}}),f==="asking"?(0,n.jsx)("span",{"aria-busy":"true",style:p,children:"Looking\u2026"}):f==="denied"?(0,n.jsx)("span",{"data-graview-linked-state":"denied",style:{...p,fontStyle:"italic"},children:"linked record (no access)"}):f.length===0?(0,n.jsx)("span",{style:p,children:"Nothing there matches."}):(0,n.jsx)("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:4},children:f.map(r=>{let y=v.has(w(r));return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-graview-linked-candidate":w(r),"aria-pressed":y,onClick:()=>W(r),style:{display:"grid",gap:2,width:"100%",textAlign:"start",font:"inherit",padding:"6px 8px",minHeight:32,border:"1px solid var(--graview-line)",borderRadius:6,background:y?"var(--graview-accent-soft, var(--graview-surface))":"var(--graview-surface)",color:"inherit",cursor:"pointer"},children:[(0,n.jsx)("span",{style:{fontWeight:600},children:r.label}),r.describe?(0,n.jsx)("span",{style:{...p,fontSize:"0.8125rem"},children:r.describe}):null]})},w(r))})}),i?(0,n.jsx)("button",{type:"button",onClick:i,style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-ink-muted)",cursor:"pointer",minHeight:24},children:"Keep it as it is"}):null]}):(0,n.jsxs)("span",{"data-graview-linked-picker":"","data-graview-linked-state":"no-host",style:p,children:["This page cannot read ",e.address,", so nothing there can be linked here."]})}var T=e=>(0,n.jsx)(H,{...e}),U=e=>(0,n.jsx)(N,{...e});export{N as LinkedPicker,H as LinkedRecordView,U as drawLinkedPicker,T as drawLinkedRecord};
@@ -1 +1 @@
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.6W2DUW5S.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
+ import{E as b,L as w,M as N,N as T,P as O,Q as S,U as m}from"./chunk.WR63RQGU.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 +1 @@
1
- import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk.QATG5HNV.js";import"./chunk.PXQVXBNG.js";import"./chunk.B3WVCSW5.js";import"./chunk.6W2DUW5S.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{g as createLinks,f as judgeDestination,e as listsOf,c as nowhere,a as placesSaid,b as quoted,d as whereOfWords};
1
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk.LQCH2NFE.js";import"./chunk.PXQVXBNG.js";import"./chunk.B3WVCSW5.js";import"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{g as createLinks,f as judgeDestination,e as listsOf,c as nowhere,a as placesSaid,b as quoted,d as whereOfWords};
@@ -1 +1 @@
1
- import{fa as V,ga as w}from"./chunk.B3T4N2XM.js";import"./chunk.SDO3U72B.js";import{kd as u,od as h}from"./chunk.6W2DUW5S.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";var c=i=>[i,...u.filter(o=>o!==i)];function p(i,o){if(o.hidden.length===0&&o.removed.length===0)return i;let a=new Set(o.removed.filter(e=>!e.lens).map(e=>e.name)),f=new Set(o.hidden),r=e=>e?.name!==void 0&&(a.has(e.name)||e.title!==void 0&&f.has(e.name)),m=()=>(i.homes?.()??[]).filter(e=>e.name===void 0||!a.has(e.name)),l=(e,t,d)=>[...i.registrations()].reverse().find(n=>n.kind===e&&n.cardinality===t&&n.fidelity===d&&!n.beside&&!n.hidden&&!r(n)),y=(e,t)=>{for(let d of c(t.fidelity)){let n=l(e,t.cardinality,d);if(n)return n}if(t.cardinality==="one")for(let d of c(t.fidelity)){let n=l(e,"many",d);if(n)return n}},s={...i,register(e,t,d,n){return i.register(e,t,d,n),s},...i.home?{home(e,t){return i.home(e,t),s}}:{},...i.homes?{homes:m,homeView:()=>m().at(-1)?.view}:{},lookup(e,t){return i.lookup(e,t)===void 0?void 0:l(e,t.cardinality,t.fidelity)?.view},places:()=>i.places().filter(e=>!(e.name!==void 0&&a.has(e.name))).map(e=>e.name!==void 0&&f.has(e.name)&&!e.hidden?{...e,hidden:!0}:e),resolve(e,t,d){let n=i.resolve(e,t,d);return!n||!r(n)||d!==void 0&&n.name!==void 0&&!a.has(n.name)&&n.title!==void 0&&h(n.title)===d?n:y(e,t)},all:()=>i.all().filter(e=>!(e.name!==void 0&&a.has(e.name))),homes:()=>(i.homes?.()??[]).filter(e=>!(e.name!==void 0&&a.has(e.name))),homeView:()=>i.homes?s.homes().at(-1)?.view:i.homeView?.()};return V(i)&&w(s),s}function R(i,o,a){let f,r=()=>{let m=o.current();f&&m.hidden===f.hidden&&m.removed===f.removed||(f=m,a(p(i,m)))};return r(),o.onChange?.(r)??(()=>{})}export{p as tidyViews,R as watchTidied};
1
+ import{fa as V,ga as w}from"./chunk.WSMYFEGU.js";import"./chunk.SDO3U72B.js";import{qd as u,ud as h}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var c=i=>[i,...u.filter(o=>o!==i)];function p(i,o){if(o.hidden.length===0&&o.removed.length===0)return i;let a=new Set(o.removed.filter(e=>!e.lens).map(e=>e.name)),f=new Set(o.hidden),r=e=>e?.name!==void 0&&(a.has(e.name)||e.title!==void 0&&f.has(e.name)),m=()=>(i.homes?.()??[]).filter(e=>e.name===void 0||!a.has(e.name)),l=(e,t,d)=>[...i.registrations()].reverse().find(n=>n.kind===e&&n.cardinality===t&&n.fidelity===d&&!n.beside&&!n.hidden&&!r(n)),y=(e,t)=>{for(let d of c(t.fidelity)){let n=l(e,t.cardinality,d);if(n)return n}if(t.cardinality==="one")for(let d of c(t.fidelity)){let n=l(e,"many",d);if(n)return n}},s={...i,register(e,t,d,n){return i.register(e,t,d,n),s},...i.home?{home(e,t){return i.home(e,t),s}}:{},...i.homes?{homes:m,homeView:()=>m().at(-1)?.view}:{},lookup(e,t){return i.lookup(e,t)===void 0?void 0:l(e,t.cardinality,t.fidelity)?.view},places:()=>i.places().filter(e=>!(e.name!==void 0&&a.has(e.name))).map(e=>e.name!==void 0&&f.has(e.name)&&!e.hidden?{...e,hidden:!0}:e),resolve(e,t,d){let n=i.resolve(e,t,d);return!n||!r(n)||d!==void 0&&n.name!==void 0&&!a.has(n.name)&&n.title!==void 0&&h(n.title)===d?n:y(e,t)},all:()=>i.all().filter(e=>!(e.name!==void 0&&a.has(e.name))),homes:()=>(i.homes?.()??[]).filter(e=>!(e.name!==void 0&&a.has(e.name))),homeView:()=>i.homes?s.homes().at(-1)?.view:i.homeView?.()};return V(i)&&w(s),s}function R(i,o,a){let f,r=()=>{let m=o.current();f&&m.hidden===f.hidden&&m.removed===f.removed||(f=m,a(p(i,m)))};return r(),o.onChange?.(r)??(()=>{})}export{p as tidyViews,R as watchTidied};
@@ -1 +1 @@
1
- import{a as O,b,c as w,d as R,e as V}from"./chunk.PEA4D66Y.js";import{h as l,i as S}from"./chunk.TRPPN2GD.js";import{Ia as $,Ja as F}from"./chunk.6W2DUW5S.js";var E=["card","row","page"],j=["good","warn","bad","neutral","accent"],H=["money","percent","date","time","datetime","relative","count"],_=4,T=40,I=120,L=["number","money","percent"],B=["large"],U=["card","row"],M=1e3,fe=100;function C(e){let n=/^\s*(out|in)\(\s*['"]([A-Za-z][A-Za-z0-9_-]*)['"]\s*\)\s*$/.exec(e);return n?{edge:n[2],way:n[1]}:/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?{edge:e}:void 0}var v={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label","emphasis"]},Z=Object.keys(v),G=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?, "emphasis"?: "large"}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,X=e=>/^(image|video|file)$/.test(e?.of??e?.type??"");function ue(e){return Object.fromEntries(Object.entries(e.views??{}).filter(([,n])=>!Array.isArray(n)))}function ce(e){let n=e.views?.home;return Array.isArray(n)?n:void 0}var Y={field:()=>!1,relation:()=>!1,figure:!1},z=e=>e.kind??"the home",m=(e,n)=>e!==void 0&&Object.hasOwn(e,n),g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function N(e,n,t){let o=O(e);for(let a of o.unknownFunctions)t.findings.push(l("unknown-function",n,`"${a}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let a of o.names){if(t.kind===null){t.findings.push(l("view-name",n,`"${a}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}a==="id"||t.spec.field(a)||t.spec.relation(a)||t.findings.push(l("view-name",n,`${t.kind} has no field or relation called "${a}"`))}for(let a of o.edges)t.edges.has(a)||t.findings.push(l("view-edge",n,`"${a}" is not a relation any kind declares`));for(let a of o.sweeps)t.kinds.has(a)||t.findings.push(l("view-kind",n,`"${a}" is not a kind this document declares`))}function k(e,n,t){if(typeof e!="string"||e.length===0||e.length>2e3){t.findings.push(l("view-expression",n,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{N(w(e),n,t)}catch(o){if(!(o instanceof b))throw o;t.findings.push(l("expression",n,`${o.sentence} (at character ${o.at+1})`))}}function A(e,n,t,o){let a=o==="text";if(typeof e!="string"||e.length===0||e.length>300){t.findings.push(l("view-template",n,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let d;try{d=V(e)}catch(r){if(r instanceof R||r instanceof b){t.findings.push(l("template",n,r.sentence));return}throw r}for(let r of d)if(r.expr){if(N(r.expr,n,t),a&&!r.format&&r.expr.t==="ident"&&(t.slot==="card"||t.slot==="row")&&t.spec.prose?.(r.expr.name)){let i=r.expr.name;t.findings.push(S("view-whole-text",n,`${t.kind} ${t.slot} shows ${i} whole; it will be clamped. Use {${i}|excerpt} or move it to the page.`,`write {${i}|excerpt}, or {${i}|excerpt: 80} for fewer characters`))}if(o==="headline"&&!r.format&&r.expr.t==="ident"&&t.spec.prose?.(r.expr.name)){let i=r.expr.name;t.findings.push(S("view-headline-long",n,`${z(t)}${t.slot?` ${t.slot}`:""} heads it with ${i}, a long text, drawn at a headline's size; a headline is a few words.`,`say it in a text block, {"text": "{${i}}"}, or head it with {${i}|excerpt: 60}`))}}}function q(e,n,t){if(typeof e=="string"){j.includes(e)||t.findings.push(l("view-tone",n,`"${e}" is not a tone`,`use one of ${j.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(g(e)&&Object.keys(e).length===1&&"expr"in e){k(e.expr,`${n}.expr`,t);return}t.findings.push(l("view-tone",n,'a tone is a word or {"expr": \u2026}',`one of ${j.join(", ")}`))}function x(e,n,t,o){if(!Array.isArray(e)){o.findings.push(l("view-shape",n,"a view is a list of blocks"));return}if(t>_){o.findings.push(l("view-depth",n,`blocks nest at most ${_} deep`,"flatten a group or a condition"));return}e.forEach((a,d)=>J(a,`${n}.${d}`,t,o))}function J(e,n,t,o){if(t===1&&o.count++,o.all++,!g(e)){o.findings.push(l("view-block",n,"a block is an object naming what it shows",`one of ${G}`));return}let a=Object.keys(e),d=a.filter(s=>Z.includes(s)&&!(s==="group"&&a.includes("list")));if(d.length===0){o.findings.push(l("view-block",n,`${a.length>0?a.map(s=>`"${s}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${G}`));return}if(d.length>1){o.findings.push(l("view-block",n,`a block is one thing, and this says ${d.map(s=>`"${s}"`).join(" and ")}`,"split it into two blocks"));return}let r=d[0];for(let s of a)s!==r&&s!="key"&&!v[r].includes(s)&&o.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" is not part of a ${r} block`,v[r].length>0?`a ${r} block may also say ${v[r].map(f=>`"${f}"`).join(", ")}`:`a ${r} block says nothing else`));let i=e[r];switch(r){case"title":case"headline":case"text":case"badge":A(i,`${n}.${r}`,o,r==="text"||r==="headline"?r:void 0),"tone"in e&&q(e.tone,`${n}.tone`,o);return;case"image":case"field":{let s=r==="image";if(typeof i!="string"||!(s?o.spec.files?.(i):o.spec.field(i))){let u=typeof i=="string"&&o.spec.relation(i);o.findings.push(l(`view-${r}`,`${n}.${r}`,`${o.kind} has no ${s?"image, video or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,u?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let f=s?["thumb","gallery"]:H;"as"in e&&!f.includes(e.as)&&o.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to show ${s?"pictures":"a field"}`,`use one of ${f.join(", ")}`)),s||W(e,n,o,"field"),"label"in e&&ie(e.label,`${n}.label`,o);return}case"progress":{!g(i)||Object.keys(i).some(s=>s!=="value"&&s!=="max")||!("value"in i)||!("max"in i)?o.findings.push(l("view-progress",`${n}.progress`,'progress is {"value": expression, "max": expression}')):(k(i.value,`${n}.progress.value`,o),k(i.max,`${n}.progress.max`,o)),"label"in e&&A(e.label,`${n}.label`,o);return}case"group":"direction"in e&&e.direction!=="row"&&e.direction!=="column"&&o.findings.push(l("view-direction",`${n}.direction`,`a group runs "row" or "column", not "${String(e.direction)}"`)),x(i,`${n}.group`,t+1,o);return;case"when":k(i,`${n}.when`,o),"show"in e?x(e.show,`${n}.show`,t+1,o):o.findings.push(l("view-when",n,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return Q(e,n,o);for(let s of["as","currency","label","emphasis"])s in e&&o.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?o.findings.push(l("view-block",`${n}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):o.spec.figure||o.findings.push(l("view-figure",`${n}.figure`,`${z(o)} has no figure to show`,o.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return ne(e,n,o);case"divider":i!==!0&&o.findings.push(l("view-block",`${n}.${r}`,`write {"${r}": true}`));return}}function Q(e,n,t){k(e.figure,`${n}.figure`,t),"as"in e&&!L.includes(e.as)&&t.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to say a figure`,`use one of ${L.join(", ")}`)),W(e,n,t,"figure"),"label"in e&&A(e.label,`${n}.label`,t),"emphasis"in e&&!B.includes(e.emphasis)&&t.findings.push(l("view-emphasis",`${n}.emphasis`,`"${String(e.emphasis)}" is not how loudly a figure is said`,`use ${B.map(o=>`"${o}"`).join(", ")}, or leave it out for the figure's own size`))}function W(e,n,t,o){"currency"in e&&(typeof e.currency!="string"||!/^[A-Z]{3}$/.test(e.currency)?t.findings.push(l("view-currency",`${n}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):e.as!=="money"&&t.findings.push(l("view-currency",`${n}.currency`,`a currency belongs on a ${o} shown as money`,'add "as": "money"')))}function ee(e,n){let t=[...n.kinds],o=(d,r)=>{let i=new Set;for(let s of d){let f=n.vocabulary.namesOf(s)?.targets?.(r);if(f==="*")return t;for(let u of f??[])i.add(u)}return i.size>0?[...i]:void 0},a=d=>{switch(d.t){case"ident":return n.kind!==null&&n.spec.relation(d.name)?o([n.kind],d.name):void 0;case"member":{let r=a(d.object);return r?o(r,d.name):void 0}case"where":return a(d.set);case"call":{let r=d.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(d.fn==="all")return i!==void 0&&n.kinds.has(i)?[i]:void 0;let s=d.args.length===2&&d.args[1]?.t==="lit"&&typeof d.args[1].value=="string"?d.args[1].value:void 0;if(d.fn==="out"&&s!==void 0){let f=a(r);return f?o(f,s):void 0}if(d.fn==="out")return i!==void 0&&n.kind!==null?o([n.kind],i):void 0;if(d.fn==="in"){let f=s??i,u=s!==void 0?a(r):n.kind!==null?[n.kind]:void 0,c=f!==void 0?n.vocabulary.sources(f).filter(p=>{let y=n.vocabulary.namesOf(p)?.targets?.(f);return!u||y==="*"||u.some(h=>y?.includes(h))}):[];return c.length>0?c:void 0}if((d.fn==="sort"||d.fn==="first")&&r)return a(r);if(d.fn==="either"){let f=d.args.map(a);return f.every(u=>u!==void 0)?[...new Set(f.flatMap(u=>u??[]))]:void 0}return}default:return}};return a(e)}function K(e,n,t,o){let a;try{a=w(e)}catch(r){if(!(r instanceof b))throw r;o.findings.push(l("expression",n,`${r.sentence} (at character ${r.at+1})`));return}let d=O(a);for(let r of d.unknownFunctions)o.findings.push(l("unknown-function",n,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of d.edges)o.edges.has(r)||o.findings.push(l("view-edge",n,`"${r}" is not a relation any kind declares`));if(t)for(let r of d.names)r==="id"||t.some(i=>o.vocabulary.namesOf(i)?.field(r)||o.vocabulary.namesOf(i)?.relation(r))||o.findings.push(l("view-name",n,`${t.join(" and ")} ${t.length===1?"has":"have"} no field or relation called "${r}"`))}function ne(e,n,t){let o=e.list;k(o,`${n}.list`,t);let a;if(typeof o=="string")try{a=ee(w(o),t)}catch{a=void 0}let d=i=>{if(!a)return[...t.kinds].map(f=>t.vocabulary.namesOf(f)?.choices?.(i)).find(f=>f!==void 0);let s=a.map(f=>t.vocabulary.namesOf(f)?.choices?.(i));return s.every(f=>f!==void 0)?[...new Set(s.flatMap(f=>f??[]))]:void 0},r=a?a.join(" and "):"any kind";if("sort"in e){let i=e.sort;if(typeof i=="string")K(i,`${n}.sort`,a,t);else if(g(i)&&typeof i.by=="string"&&Object.keys(i).every(s=>s==="by"||s==="direction")){let s=i.direction;s!==void 0&&s!=="asc"&&s!=="desc"&&s!=="choices"?t.findings.push(l("list-sort",`${n}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(s)}"`,'"choices" puts a choice field in the order its choices are declared')):s==="choices"?d(i.by)===void 0&&t.findings.push(l("list-sort",`${n}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):K(i.by,`${n}.sort.by`,a,t)}else t.findings.push(l("list-sort",`${n}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in e){let i=e.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>M)&&t.findings.push(l("list-limit",`${n}.limit`,`a limit is a whole number from 1 to ${M}`))}if("group"in e){let i=e.group,s=typeof i=="string"?i:g(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||g(i)&&Object.keys(i).every(u=>u==="by"||u==="headings"))||s===void 0)t.findings.push(l("list-group",`${n}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}} \u2014 or a relation, like "inGenre", a heading per linked record'));else{let u=d(s),c=u===void 0?C(s):void 0,p=c!==void 0&&(c.way!==void 0?t.edges.has(c.edge):a?a.every(y=>t.vocabulary.namesOf(y)?.relation(c.edge)):t.edges.has(c.edge));if(u===void 0&&!p&&t.findings.push(l("list-group",`${n}.group`,`"${s}" is not a choice field or a relation of ${r}, so it has nothing to group by`,'group by a field whose type is enum, or by a relation of the kind listed, like "inGenre"')),g(i)&&"headings"in i){let y=i.headings;if(!g(y)||Object.values(y).some(h=>typeof h!="string"||h.length===0||h.length>80))t.findings.push(l("list-group",`${n}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(u)for(let h of Object.keys(y))u.includes(h)||t.findings.push(l("list-group",`${n}.group.headings.${h}`,`"${h}" is not one of ${s}'s choices`,`use ${u.join(", ")}`))}}}"empty"in e&&(typeof e.empty!="string"||e.empty.length===0||e.empty.length>200)&&t.findings.push(l("list-empty",`${n}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in e&&!U.includes(e.as)&&t.findings.push(l("list-as",`${n}.as`,`a list draws each record as its "card" or its "row", not "${String(e.as)}"`))}function ie(e,n,t){(typeof e!="string"||e.length===0||e.length>60)&&t.findings.push(l("view-label",n,"a label is a few words, at most 60 characters"))}function D(e,n,t,o,a,d,r){let i={kind:null,spec:Y,kinds:o,edges:a,vocabulary:t,findings:d,count:0,all:0};Array.isArray(e)&&e.length===0&&d.push(l("view-shape",n,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),x(e,n,1,i),P(i,n,r,"show less")}function P(e,n,t,o){e.count>T?e.findings.push(l("view-size",n,`${t} has ${e.count} blocks at its top; a view has at most ${T} there, a group or a condition counting as one`,`${o}, or gather some into a group`)):e.all>I&&e.findings.push(l("view-size",n,`${t} has ${e.all} blocks counting the ones inside its groups and conditions; a view has at most ${I} in all`,o))}function te(e,n,t,o,a){Array.isArray(e)&&e.forEach((d,r)=>{if(!g(d)||d.name!=="blocks"||!g(d.options)||!("blocks"in d.options))return;let i=[];D(d.options.blocks,`lenses.${r}.options.blocks`,n,t,o,i,`the lens "${String(d.title??r)}"`);for(let s of i)a.push({...s,severity:"warning"})})}function oe(e,n,t,o,a,d,r){let i=[];if(e===void 0)return i;if(!g(e))return i.push(l("view-shape",n,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[s,f]of Object.entries(e)){if(s==="home"&&Array.isArray(f)){D(f,`${n}.home`,r,o,a,i,"the home");continue}let u=t(s);if(!u){i.push(l("view-kind",`${n}.${s}`,`"${s}" is not a kind this ${d} declares`));continue}if(!g(f)){i.push(l("view-shape",`${n}.${s}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(f))E.includes(c)||i.push(l("view-slot",`${n}.${s}.${c}`,`"${c}" is not a place a view is drawn`,`use ${E.map(p=>`"${p}"`).join(", ")}`));for(let c of E){let p=f[c];if(p===void 0)continue;let y={kind:s,spec:u,kinds:o,edges:a,vocabulary:r,findings:i,count:0,all:0,slot:c};x(p,`${n}.${s}.${c}`,1,y),P(y,`${n}.${s}.${c}`,`this ${c}`,"show less, or move detail to the page")}}return i}function ge(e){let n=new Set(Object.keys(e.kinds)),t=new Set(Object.values(e.kinds).flatMap(r=>Object.keys($(r.edges)))),o=r=>{let i=m(e.kinds,r)?e.kinds[r]:void 0;return i?{field:s=>m(i.fields,s)||m(i.computed,s)||F(i.edges).has(s),relation:s=>m($(i.edges),s),figure:i.figure!==void 0,files:s=>m(i.fields,s)&&X(i.fields[s]),choices:s=>m(i.fields,s)&&i.fields[s].type==="enum"?i.fields[s].options:void 0,targets:s=>m($(i.edges),s)?i.edges[s].to:void 0,prose:s=>m(i.fields,s)&&i.fields[s].type==="text"}:void 0},a={namesOf:o,sources:r=>Object.keys(e.kinds).filter(i=>m(e.kinds[i].edges,r))},d=oe(e.views,"views",o,n,t,"document",a);return te(e.lenses,a,n,t,d),d}export{j as a,H as b,L as c,B as d,M as e,fe as f,C as g,ue as h,ce as i,ge as j};
1
+ import{a as O,b,c as w,d as R,e as V}from"./chunk.2HANQ737.js";import{h as l,i as S}from"./chunk.H536YUAZ.js";import{Ia as $,Ja as F}from"./chunk.WR63RQGU.js";var E=["card","row","page"],j=["good","warn","bad","neutral","accent"],H=["money","percent","date","time","datetime","relative","count"],_=4,T=40,I=120,L=["number","money","percent"],B=["large"],U=["card","row"],M=1e3,fe=100;function C(e){let n=/^\s*(out|in)\(\s*['"]([A-Za-z][A-Za-z0-9_-]*)['"]\s*\)\s*$/.exec(e);return n?{edge:n[2],way:n[1]}:/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?{edge:e}:void 0}var v={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label","emphasis"]},Z=Object.keys(v),G=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?, "emphasis"?: "large"}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,X=e=>/^(image|video|file)$/.test(e?.of??e?.type??"");function ue(e){return Object.fromEntries(Object.entries(e.views??{}).filter(([,n])=>!Array.isArray(n)))}function ce(e){let n=e.views?.home;return Array.isArray(n)?n:void 0}var Y={field:()=>!1,relation:()=>!1,figure:!1},z=e=>e.kind??"the home",m=(e,n)=>e!==void 0&&Object.hasOwn(e,n),g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function N(e,n,t){let o=O(e);for(let a of o.unknownFunctions)t.findings.push(l("unknown-function",n,`"${a}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let a of o.names){if(t.kind===null){t.findings.push(l("view-name",n,`"${a}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}a==="id"||t.spec.field(a)||t.spec.relation(a)||t.findings.push(l("view-name",n,`${t.kind} has no field or relation called "${a}"`))}for(let a of o.edges)t.edges.has(a)||t.findings.push(l("view-edge",n,`"${a}" is not a relation any kind declares`));for(let a of o.sweeps)t.kinds.has(a)||t.findings.push(l("view-kind",n,`"${a}" is not a kind this document declares`))}function k(e,n,t){if(typeof e!="string"||e.length===0||e.length>2e3){t.findings.push(l("view-expression",n,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{N(w(e),n,t)}catch(o){if(!(o instanceof b))throw o;t.findings.push(l("expression",n,`${o.sentence} (at character ${o.at+1})`))}}function A(e,n,t,o){let a=o==="text";if(typeof e!="string"||e.length===0||e.length>300){t.findings.push(l("view-template",n,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let d;try{d=V(e)}catch(r){if(r instanceof R||r instanceof b){t.findings.push(l("template",n,r.sentence));return}throw r}for(let r of d)if(r.expr){if(N(r.expr,n,t),a&&!r.format&&r.expr.t==="ident"&&(t.slot==="card"||t.slot==="row")&&t.spec.prose?.(r.expr.name)){let i=r.expr.name;t.findings.push(S("view-whole-text",n,`${t.kind} ${t.slot} shows ${i} whole; it will be clamped. Use {${i}|excerpt} or move it to the page.`,`write {${i}|excerpt}, or {${i}|excerpt: 80} for fewer characters`))}if(o==="headline"&&!r.format&&r.expr.t==="ident"&&t.spec.prose?.(r.expr.name)){let i=r.expr.name;t.findings.push(S("view-headline-long",n,`${z(t)}${t.slot?` ${t.slot}`:""} heads it with ${i}, a long text, drawn at a headline's size; a headline is a few words.`,`say it in a text block, {"text": "{${i}}"}, or head it with {${i}|excerpt: 60}`))}}}function q(e,n,t){if(typeof e=="string"){j.includes(e)||t.findings.push(l("view-tone",n,`"${e}" is not a tone`,`use one of ${j.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(g(e)&&Object.keys(e).length===1&&"expr"in e){k(e.expr,`${n}.expr`,t);return}t.findings.push(l("view-tone",n,'a tone is a word or {"expr": \u2026}',`one of ${j.join(", ")}`))}function x(e,n,t,o){if(!Array.isArray(e)){o.findings.push(l("view-shape",n,"a view is a list of blocks"));return}if(t>_){o.findings.push(l("view-depth",n,`blocks nest at most ${_} deep`,"flatten a group or a condition"));return}e.forEach((a,d)=>J(a,`${n}.${d}`,t,o))}function J(e,n,t,o){if(t===1&&o.count++,o.all++,!g(e)){o.findings.push(l("view-block",n,"a block is an object naming what it shows",`one of ${G}`));return}let a=Object.keys(e),d=a.filter(s=>Z.includes(s)&&!(s==="group"&&a.includes("list")));if(d.length===0){o.findings.push(l("view-block",n,`${a.length>0?a.map(s=>`"${s}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${G}`));return}if(d.length>1){o.findings.push(l("view-block",n,`a block is one thing, and this says ${d.map(s=>`"${s}"`).join(" and ")}`,"split it into two blocks"));return}let r=d[0];for(let s of a)s!==r&&s!="key"&&!v[r].includes(s)&&o.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" is not part of a ${r} block`,v[r].length>0?`a ${r} block may also say ${v[r].map(f=>`"${f}"`).join(", ")}`:`a ${r} block says nothing else`));let i=e[r];switch(r){case"title":case"headline":case"text":case"badge":A(i,`${n}.${r}`,o,r==="text"||r==="headline"?r:void 0),"tone"in e&&q(e.tone,`${n}.tone`,o);return;case"image":case"field":{let s=r==="image";if(typeof i!="string"||!(s?o.spec.files?.(i):o.spec.field(i))){let u=typeof i=="string"&&o.spec.relation(i);o.findings.push(l(`view-${r}`,`${n}.${r}`,`${o.kind} has no ${s?"image, video or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,u?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let f=s?["thumb","gallery"]:H;"as"in e&&!f.includes(e.as)&&o.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to show ${s?"pictures":"a field"}`,`use one of ${f.join(", ")}`)),s||W(e,n,o,"field"),"label"in e&&ie(e.label,`${n}.label`,o);return}case"progress":{!g(i)||Object.keys(i).some(s=>s!=="value"&&s!=="max")||!("value"in i)||!("max"in i)?o.findings.push(l("view-progress",`${n}.progress`,'progress is {"value": expression, "max": expression}')):(k(i.value,`${n}.progress.value`,o),k(i.max,`${n}.progress.max`,o)),"label"in e&&A(e.label,`${n}.label`,o);return}case"group":"direction"in e&&e.direction!=="row"&&e.direction!=="column"&&o.findings.push(l("view-direction",`${n}.direction`,`a group runs "row" or "column", not "${String(e.direction)}"`)),x(i,`${n}.group`,t+1,o);return;case"when":k(i,`${n}.when`,o),"show"in e?x(e.show,`${n}.show`,t+1,o):o.findings.push(l("view-when",n,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return Q(e,n,o);for(let s of["as","currency","label","emphasis"])s in e&&o.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?o.findings.push(l("view-block",`${n}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):o.spec.figure||o.findings.push(l("view-figure",`${n}.figure`,`${z(o)} has no figure to show`,o.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return ne(e,n,o);case"divider":i!==!0&&o.findings.push(l("view-block",`${n}.${r}`,`write {"${r}": true}`));return}}function Q(e,n,t){k(e.figure,`${n}.figure`,t),"as"in e&&!L.includes(e.as)&&t.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to say a figure`,`use one of ${L.join(", ")}`)),W(e,n,t,"figure"),"label"in e&&A(e.label,`${n}.label`,t),"emphasis"in e&&!B.includes(e.emphasis)&&t.findings.push(l("view-emphasis",`${n}.emphasis`,`"${String(e.emphasis)}" is not how loudly a figure is said`,`use ${B.map(o=>`"${o}"`).join(", ")}, or leave it out for the figure's own size`))}function W(e,n,t,o){"currency"in e&&(typeof e.currency!="string"||!/^[A-Z]{3}$/.test(e.currency)?t.findings.push(l("view-currency",`${n}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):e.as!=="money"&&t.findings.push(l("view-currency",`${n}.currency`,`a currency belongs on a ${o} shown as money`,'add "as": "money"')))}function ee(e,n){let t=[...n.kinds],o=(d,r)=>{let i=new Set;for(let s of d){let f=n.vocabulary.namesOf(s)?.targets?.(r);if(f==="*")return t;for(let u of f??[])i.add(u)}return i.size>0?[...i]:void 0},a=d=>{switch(d.t){case"ident":return n.kind!==null&&n.spec.relation(d.name)?o([n.kind],d.name):void 0;case"member":{let r=a(d.object);return r?o(r,d.name):void 0}case"where":return a(d.set);case"call":{let r=d.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(d.fn==="all")return i!==void 0&&n.kinds.has(i)?[i]:void 0;let s=d.args.length===2&&d.args[1]?.t==="lit"&&typeof d.args[1].value=="string"?d.args[1].value:void 0;if(d.fn==="out"&&s!==void 0){let f=a(r);return f?o(f,s):void 0}if(d.fn==="out")return i!==void 0&&n.kind!==null?o([n.kind],i):void 0;if(d.fn==="in"){let f=s??i,u=s!==void 0?a(r):n.kind!==null?[n.kind]:void 0,c=f!==void 0?n.vocabulary.sources(f).filter(p=>{let y=n.vocabulary.namesOf(p)?.targets?.(f);return!u||y==="*"||u.some(h=>y?.includes(h))}):[];return c.length>0?c:void 0}if((d.fn==="sort"||d.fn==="first")&&r)return a(r);if(d.fn==="either"){let f=d.args.map(a);return f.every(u=>u!==void 0)?[...new Set(f.flatMap(u=>u??[]))]:void 0}return}default:return}};return a(e)}function K(e,n,t,o){let a;try{a=w(e)}catch(r){if(!(r instanceof b))throw r;o.findings.push(l("expression",n,`${r.sentence} (at character ${r.at+1})`));return}let d=O(a);for(let r of d.unknownFunctions)o.findings.push(l("unknown-function",n,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of d.edges)o.edges.has(r)||o.findings.push(l("view-edge",n,`"${r}" is not a relation any kind declares`));if(t)for(let r of d.names)r==="id"||t.some(i=>o.vocabulary.namesOf(i)?.field(r)||o.vocabulary.namesOf(i)?.relation(r))||o.findings.push(l("view-name",n,`${t.join(" and ")} ${t.length===1?"has":"have"} no field or relation called "${r}"`))}function ne(e,n,t){let o=e.list;k(o,`${n}.list`,t);let a;if(typeof o=="string")try{a=ee(w(o),t)}catch{a=void 0}let d=i=>{if(!a)return[...t.kinds].map(f=>t.vocabulary.namesOf(f)?.choices?.(i)).find(f=>f!==void 0);let s=a.map(f=>t.vocabulary.namesOf(f)?.choices?.(i));return s.every(f=>f!==void 0)?[...new Set(s.flatMap(f=>f??[]))]:void 0},r=a?a.join(" and "):"any kind";if("sort"in e){let i=e.sort;if(typeof i=="string")K(i,`${n}.sort`,a,t);else if(g(i)&&typeof i.by=="string"&&Object.keys(i).every(s=>s==="by"||s==="direction")){let s=i.direction;s!==void 0&&s!=="asc"&&s!=="desc"&&s!=="choices"?t.findings.push(l("list-sort",`${n}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(s)}"`,'"choices" puts a choice field in the order its choices are declared')):s==="choices"?d(i.by)===void 0&&t.findings.push(l("list-sort",`${n}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):K(i.by,`${n}.sort.by`,a,t)}else t.findings.push(l("list-sort",`${n}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in e){let i=e.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>M)&&t.findings.push(l("list-limit",`${n}.limit`,`a limit is a whole number from 1 to ${M}`))}if("group"in e){let i=e.group,s=typeof i=="string"?i:g(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||g(i)&&Object.keys(i).every(u=>u==="by"||u==="headings"))||s===void 0)t.findings.push(l("list-group",`${n}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}} \u2014 or a relation, like "inGenre", a heading per linked record'));else{let u=d(s),c=u===void 0?C(s):void 0,p=c!==void 0&&(c.way!==void 0?t.edges.has(c.edge):a?a.every(y=>t.vocabulary.namesOf(y)?.relation(c.edge)):t.edges.has(c.edge));if(u===void 0&&!p&&t.findings.push(l("list-group",`${n}.group`,`"${s}" is not a choice field or a relation of ${r}, so it has nothing to group by`,'group by a field whose type is enum, or by a relation of the kind listed, like "inGenre"')),g(i)&&"headings"in i){let y=i.headings;if(!g(y)||Object.values(y).some(h=>typeof h!="string"||h.length===0||h.length>80))t.findings.push(l("list-group",`${n}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(u)for(let h of Object.keys(y))u.includes(h)||t.findings.push(l("list-group",`${n}.group.headings.${h}`,`"${h}" is not one of ${s}'s choices`,`use ${u.join(", ")}`))}}}"empty"in e&&(typeof e.empty!="string"||e.empty.length===0||e.empty.length>200)&&t.findings.push(l("list-empty",`${n}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in e&&!U.includes(e.as)&&t.findings.push(l("list-as",`${n}.as`,`a list draws each record as its "card" or its "row", not "${String(e.as)}"`))}function ie(e,n,t){(typeof e!="string"||e.length===0||e.length>60)&&t.findings.push(l("view-label",n,"a label is a few words, at most 60 characters"))}function D(e,n,t,o,a,d,r){let i={kind:null,spec:Y,kinds:o,edges:a,vocabulary:t,findings:d,count:0,all:0};Array.isArray(e)&&e.length===0&&d.push(l("view-shape",n,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),x(e,n,1,i),P(i,n,r,"show less")}function P(e,n,t,o){e.count>T?e.findings.push(l("view-size",n,`${t} has ${e.count} blocks at its top; a view has at most ${T} there, a group or a condition counting as one`,`${o}, or gather some into a group`)):e.all>I&&e.findings.push(l("view-size",n,`${t} has ${e.all} blocks counting the ones inside its groups and conditions; a view has at most ${I} in all`,o))}function te(e,n,t,o,a){Array.isArray(e)&&e.forEach((d,r)=>{if(!g(d)||d.name!=="blocks"||!g(d.options)||!("blocks"in d.options))return;let i=[];D(d.options.blocks,`lenses.${r}.options.blocks`,n,t,o,i,`the lens "${String(d.title??r)}"`);for(let s of i)a.push({...s,severity:"warning"})})}function oe(e,n,t,o,a,d,r){let i=[];if(e===void 0)return i;if(!g(e))return i.push(l("view-shape",n,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[s,f]of Object.entries(e)){if(s==="home"&&Array.isArray(f)){D(f,`${n}.home`,r,o,a,i,"the home");continue}let u=t(s);if(!u){i.push(l("view-kind",`${n}.${s}`,`"${s}" is not a kind this ${d} declares`));continue}if(!g(f)){i.push(l("view-shape",`${n}.${s}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(f))E.includes(c)||i.push(l("view-slot",`${n}.${s}.${c}`,`"${c}" is not a place a view is drawn`,`use ${E.map(p=>`"${p}"`).join(", ")}`));for(let c of E){let p=f[c];if(p===void 0)continue;let y={kind:s,spec:u,kinds:o,edges:a,vocabulary:r,findings:i,count:0,all:0,slot:c};x(p,`${n}.${s}.${c}`,1,y),P(y,`${n}.${s}.${c}`,`this ${c}`,"show less, or move detail to the page")}}return i}function ge(e){let n=new Set(Object.keys(e.kinds)),t=new Set(Object.values(e.kinds).flatMap(r=>Object.keys($(r.edges)))),o=r=>{let i=m(e.kinds,r)?e.kinds[r]:void 0;return i?{field:s=>m(i.fields,s)||m(i.computed,s)||F(i.edges).has(s),relation:s=>m($(i.edges),s),figure:i.figure!==void 0,files:s=>m(i.fields,s)&&X(i.fields[s]),choices:s=>m(i.fields,s)&&i.fields[s].type==="enum"?i.fields[s].options:void 0,targets:s=>m($(i.edges),s)?i.edges[s].to:void 0,prose:s=>m(i.fields,s)&&i.fields[s].type==="text"}:void 0},a={namesOf:o,sources:r=>Object.keys(e.kinds).filter(i=>m(e.kinds[i].edges,r))},d=oe(e.views,"views",o,n,t,"document",a);return te(e.lenses,a,n,t,d),d}export{j as a,H as b,L as c,B as d,M as e,fe as f,C as g,ue as h,ce as i,ge as j};