graview 0.1.39 → 0.1.41

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 (174) hide show
  1. package/dist/preview/{chunk.WQPNGBR7.js → chunk.242EUAPE.js} +1 -1
  2. package/dist/preview/chunk.2FGYWAID.js +1 -0
  3. package/dist/preview/{chunk.NSNGPQGT.js → chunk.2FLPDPEL.js} +1 -1
  4. package/dist/preview/{chunk.RXSHFG6S.js → chunk.2GQPLTV3.js} +1 -1
  5. package/dist/preview/chunk.2NB7U4EW.js +88 -0
  6. package/dist/preview/{chunk.Z7JRBKA7.js → chunk.2RVUDRRY.js} +1 -1
  7. package/dist/preview/{chunk.I7CU2E3C.js → chunk.33KXSD6F.js} +1 -1
  8. package/dist/preview/{chunk.WJQY4E45.js → chunk.3Q75TIGL.js} +1 -1
  9. package/dist/preview/{chunk.7WSXVXP3.js → chunk.3ZILIZZ6.js} +1 -1
  10. package/dist/preview/{chunk.HHUCPVG5.js → chunk.42XSBKPO.js} +1 -1
  11. package/dist/preview/chunk.4EEWBCT2.js +1 -0
  12. package/dist/preview/{chunk.23WYWIAJ.js → chunk.4Q7XJJZY.js} +1 -1
  13. package/dist/preview/{chunk.U7QMA4H7.js → chunk.4QPVS2ZM.js} +1 -1
  14. package/dist/preview/chunk.53CDFJNM.js +1 -0
  15. package/dist/preview/{chunk.CAMQ7MYJ.js → chunk.57R2GXXN.js} +1 -1
  16. package/dist/preview/chunk.5P556A7W.js +1 -0
  17. package/dist/preview/{chunk.5R4E5C76.js → chunk.5QXWMC6C.js} +1 -1
  18. package/dist/preview/{chunk.6XU2CXRZ.js → chunk.5RABSIF7.js} +1 -1
  19. package/dist/preview/{chunk.7EFNLMKU.js → chunk.67WWRC6Y.js} +1 -1
  20. package/dist/preview/{chunk.C2OAKTZX.js → chunk.6CRRPXKP.js} +1 -1
  21. package/dist/preview/{chunk.WXYUWBKX.js → chunk.6FNMDAX5.js} +1 -1
  22. package/dist/preview/chunk.6RID3OWK.js +1 -0
  23. package/dist/preview/{chunk.GXKECZ4S.js → chunk.6YPLZNVT.js} +1 -1
  24. package/dist/preview/{chunk.VC4JPG7O.js → chunk.7LIKEE5Z.js} +1 -1
  25. package/dist/preview/{chunk.LCYMYLOP.js → chunk.7YIFF6BF.js} +1 -1
  26. package/dist/preview/chunk.A4UIM35E.js +1 -0
  27. package/dist/preview/{chunk.2GGDOFTF.js → chunk.AIZQBPGU.js} +1 -1
  28. package/dist/preview/{chunk.EWWJMS6G.js → chunk.AKQXF7GW.js} +1 -1
  29. package/dist/preview/{chunk.N2SV3KX7.js → chunk.B5724ULM.js} +1 -1
  30. package/dist/preview/{chunk.CTK2P4JV.js → chunk.BELCPW66.js} +2 -2
  31. package/dist/preview/chunk.BFNVG5JE.js +1 -0
  32. package/dist/preview/{chunk.LP3QUPCE.js → chunk.BK6RWVRE.js} +1 -1
  33. package/dist/preview/{chunk.6CFP5UYP.js → chunk.BQRAIU5R.js} +1 -1
  34. package/dist/preview/{chunk.B7TB6YRZ.js → chunk.BXT6FDT4.js} +1 -1
  35. package/dist/preview/{chunk.FCXBCKED.js → chunk.C2PECN4C.js} +1 -1
  36. package/dist/preview/{chunk.QEXXLWEU.js → chunk.C4TSM4W5.js} +2 -2
  37. package/dist/preview/chunk.C7JKMOFC.js +1 -0
  38. package/dist/preview/{chunk.M5QFUGGG.js → chunk.D25XEVKO.js} +1 -1
  39. package/dist/preview/{chunk.EDC4EMIX.js → chunk.DGCMEDQA.js} +1 -1
  40. package/dist/preview/{chunk.P3JYH6HO.js → chunk.DL26BKT7.js} +1 -1
  41. package/dist/preview/{chunk.UB3O3QJQ.js → chunk.DMF35E7D.js} +1 -1
  42. package/dist/preview/{chunk.XLI44BBI.js → chunk.EAH47SCN.js} +1 -1
  43. package/dist/preview/{chunk.U4E5GQTK.js → chunk.EQ4UAWRB.js} +1 -1
  44. package/dist/preview/chunk.F2MQJH6Y.js +1 -0
  45. package/dist/preview/{chunk.37ASLBGE.js → chunk.FFZBOP65.js} +1 -1
  46. package/dist/preview/chunk.FOQZADMA.js +25 -0
  47. package/dist/preview/{chunk.OM5CDW2S.js → chunk.GT2BITLW.js} +1 -1
  48. package/dist/preview/{chunk.UIUHGA6W.js → chunk.H5ADMSE7.js} +1 -1
  49. package/dist/preview/{chunk.XBOZTQQA.js → chunk.H5HWN7A2.js} +1 -1
  50. package/dist/preview/{chunk.OYMM2UWE.js → chunk.H7POIT3V.js} +1 -1
  51. package/dist/preview/{chunk.CMN6VVK2.js → chunk.HB7ELBVK.js} +1 -1
  52. package/dist/preview/{chunk.WTZOOAIW.js → chunk.HEVC6HHP.js} +1 -1
  53. package/dist/preview/{chunk.CF7DHTKL.js → chunk.HI7X6PLZ.js} +2 -2
  54. package/dist/preview/{chunk.IXYBIDAN.js → chunk.HKCK3JI4.js} +1 -1
  55. package/dist/preview/{chunk.IAZRY42B.js → chunk.HPAGOEZG.js} +1 -1
  56. package/dist/preview/chunk.HPUN5DKZ.js +117 -0
  57. package/dist/preview/chunk.I4JBWTZM.js +2 -0
  58. package/dist/preview/{chunk.4BBJ62ZO.js → chunk.I7XSDXQ3.js} +1 -1
  59. package/dist/preview/{chunk.FMN5XDLE.js → chunk.ISXFH3CK.js} +1 -1
  60. package/dist/preview/chunk.J4IULZFD.js +1 -0
  61. package/dist/preview/chunk.JACGQ2PR.js +4 -0
  62. package/dist/preview/{chunk.YXGI7H4Y.js → chunk.JDRLSVOI.js} +1 -1
  63. package/dist/preview/chunk.JHEVGLKB.js +345 -0
  64. package/dist/preview/chunk.JLBGJSCZ.js +1 -0
  65. package/dist/preview/chunk.JYJ4LZJJ.js +5 -0
  66. package/dist/preview/{chunk.ZR5KVYWZ.js → chunk.L3A6YLMT.js} +2 -2
  67. package/dist/preview/{chunk.5JPRFXYQ.js → chunk.L4STJLUV.js} +1 -1
  68. package/dist/preview/{chunk.JEZTPXEB.js → chunk.LOCSF3BR.js} +1 -1
  69. package/dist/preview/{chunk.XLZ2QRRS.js → chunk.LOSMUESM.js} +1 -1
  70. package/dist/preview/chunk.LOZJQ5ZX.js +1 -0
  71. package/dist/preview/{chunk.TU4KG22J.js → chunk.LPNIEPYI.js} +2 -2
  72. package/dist/preview/{chunk.OJKS3UQS.js → chunk.LPYVOBWB.js} +1 -1
  73. package/dist/preview/{chunk.2NSTEREJ.js → chunk.M4T377LG.js} +1 -1
  74. package/dist/preview/{chunk.G46WGK5E.js → chunk.MSP73H5Z.js} +1 -1
  75. package/dist/preview/chunk.MUKDKVVC.js +1 -0
  76. package/dist/preview/chunk.MUPO5S2A.js +47 -0
  77. package/dist/preview/{chunk.P4WYBSYA.js → chunk.N2K25KH3.js} +1 -1
  78. package/dist/preview/{chunk.KJNUZYXS.js → chunk.N6MVK3KD.js} +1 -1
  79. package/dist/preview/{chunk.3ZNQ5YKX.js → chunk.NGDXH66B.js} +1 -1
  80. package/dist/preview/chunk.O6F3K6CU.js +1 -0
  81. package/dist/preview/chunk.O75JKQPF.js +1 -0
  82. package/dist/preview/{chunk.KSXB4LDF.js → chunk.OF34OZ4V.js} +1 -1
  83. package/dist/preview/chunk.OVTCW3AI.js +1 -0
  84. package/dist/preview/{chunk.HA3PPIEQ.js → chunk.OW7NSJ4H.js} +1 -1
  85. package/dist/preview/{chunk.ROKRQRID.js → chunk.PMDNFN7Z.js} +1 -1
  86. package/dist/preview/chunk.PMGXASFI.js +32 -0
  87. package/dist/preview/{chunk.JBTU2PJ4.js → chunk.Q4TZHWQX.js} +1 -1
  88. package/dist/preview/chunk.QHYXXZRD.js +1 -0
  89. package/dist/preview/chunk.QIV65FWE.js +1 -0
  90. package/dist/preview/{chunk.GP2F7TIN.js → chunk.RCM7NOPF.js} +2 -1
  91. package/dist/preview/{chunk.NG3YMQ36.js → chunk.RQGTHRRJ.js} +1 -1
  92. package/dist/preview/{chunk.F5UVEF2R.js → chunk.S2U5CEP4.js} +1 -1
  93. package/dist/preview/chunk.SADG5RMV.js +1 -0
  94. package/dist/preview/chunk.SCYQSXW4.js +1 -0
  95. package/dist/preview/{chunk.W4OX4BMP.js → chunk.SIGC3G7S.js} +1 -1
  96. package/dist/preview/chunk.T3BWINOF.js +1 -0
  97. package/dist/preview/{chunk.2BJRS3YJ.js → chunk.TGVUIFKD.js} +1 -1
  98. package/dist/preview/{chunk.AYHCQWSU.js → chunk.TIH2PDFH.js} +1 -1
  99. package/dist/preview/chunk.TKUNRFDE.js +1 -0
  100. package/dist/preview/{chunk.5XNVN4HE.js → chunk.TN5PYGU7.js} +1 -1
  101. package/dist/preview/{chunk.6DHHUBSC.js → chunk.TNESS3LQ.js} +1 -1
  102. package/dist/preview/{chunk.QMFUPTR4.js → chunk.UEXIKCLF.js} +1 -1
  103. package/dist/preview/chunk.UHI3D7JC.js +1 -0
  104. package/dist/preview/chunk.USZPOOLZ.js +1 -0
  105. package/dist/preview/chunk.UTWPZULC.js +1 -0
  106. package/dist/preview/{chunk.H5CZZZLX.js → chunk.UUBYFBPN.js} +1 -1
  107. package/dist/preview/{chunk.ROINZMNO.js → chunk.UWW6ZEPY.js} +2 -2
  108. package/dist/preview/{chunk.ZTMDU3OH.js → chunk.V3V47QRE.js} +1 -1
  109. package/dist/preview/{chunk.BYKR7NEE.js → chunk.V4KLBSC4.js} +1 -1
  110. package/dist/preview/chunk.V5MYKNL7.js +5 -0
  111. package/dist/preview/{chunk.C4CFYTCW.js → chunk.VCX3HEIE.js} +1 -1
  112. package/dist/preview/{chunk.DYNBWIPF.js → chunk.VDAMCTNL.js} +1 -1
  113. package/dist/preview/chunk.VIYECFKZ.js +6 -0
  114. package/dist/preview/{chunk.ITEF3U2E.js → chunk.VJXXCUKS.js} +1 -1
  115. package/dist/preview/{chunk.EBHKKOPO.js → chunk.VNUHESMZ.js} +1 -1
  116. package/dist/preview/{chunk.67USHK26.js → chunk.W3FTEJH5.js} +1 -1
  117. package/dist/preview/chunk.W4HBRXMY.js +1 -0
  118. package/dist/preview/{chunk.5OJJ2TKZ.js → chunk.WUKHYLQT.js} +2 -2
  119. package/dist/preview/{chunk.CC47O2DW.js → chunk.WVDKYUF3.js} +1 -1
  120. package/dist/preview/{chunk.BEC5ZH2L.js → chunk.XEKLEHC3.js} +1 -1
  121. package/dist/preview/{chunk.FILCNVGH.js → chunk.XFZKP4IF.js} +1 -1
  122. package/dist/preview/chunk.XOYJ26YB.js +1 -0
  123. package/dist/preview/{chunk.4PNFX3TX.js → chunk.YWNHCZQ5.js} +1 -1
  124. package/dist/preview/{chunk.4ECICQ2S.js → chunk.YYFLTMNN.js} +1 -1
  125. package/dist/preview/{chunk.B2IRADR2.js → chunk.Z5AB2DBF.js} +1 -1
  126. package/dist/preview/chunk.Z7BCIYDW.js +1 -0
  127. package/dist/preview/{chunk.C6X7CKU6.js → chunk.Z7LDT55A.js} +1 -1
  128. package/dist/preview/{chunk.2IX3CZNP.js → chunk.ZHLQWMV5.js} +1 -1
  129. package/dist/preview/{chunk.JCR3ECUM.js → chunk.ZOR6FKNI.js} +1 -1
  130. package/dist/preview/{chunk.STBJV6HJ.js → chunk.ZRLXVYPG.js} +1 -1
  131. package/dist/preview/{chunk.RM7NVN7B.js → chunk.ZRYSVOLA.js} +2 -2
  132. package/dist/preview/chunk.ZTMEESII.js +1 -0
  133. package/dist/preview/index.html +45 -43
  134. package/dist/preview/page.js +8 -8
  135. package/package.json +6 -6
  136. package/dist/preview/chunk.2HF54MYG.js +0 -1
  137. package/dist/preview/chunk.2RCNSHXK.js +0 -1
  138. package/dist/preview/chunk.546WEHEX.js +0 -47
  139. package/dist/preview/chunk.57OPL5WD.js +0 -1
  140. package/dist/preview/chunk.5ZMENPY4.js +0 -5
  141. package/dist/preview/chunk.6HBEYRJU.js +0 -1
  142. package/dist/preview/chunk.6L7IDF3J.js +0 -1
  143. package/dist/preview/chunk.ALDLAQ7V.js +0 -1
  144. package/dist/preview/chunk.BCHHBGM6.js +0 -1
  145. package/dist/preview/chunk.BL4S3I2N.js +0 -1
  146. package/dist/preview/chunk.BS3FX4PX.js +0 -1
  147. package/dist/preview/chunk.BTSXYZ6Z.js +0 -25
  148. package/dist/preview/chunk.BZSU4HH2.js +0 -1
  149. package/dist/preview/chunk.DAA7IDQ4.js +0 -1
  150. package/dist/preview/chunk.E3HXXUKY.js +0 -1
  151. package/dist/preview/chunk.EM4Y4YAD.js +0 -2
  152. package/dist/preview/chunk.FGDHEVH4.js +0 -1
  153. package/dist/preview/chunk.FJBQ4UP3.js +0 -32
  154. package/dist/preview/chunk.G23VFYGF.js +0 -88
  155. package/dist/preview/chunk.HFDYFPMJ.js +0 -1
  156. package/dist/preview/chunk.HGS32FT2.js +0 -1
  157. package/dist/preview/chunk.J3M2MZHG.js +0 -1
  158. package/dist/preview/chunk.KIJCOW25.js +0 -1
  159. package/dist/preview/chunk.L7DQKPJV.js +0 -117
  160. package/dist/preview/chunk.LP2DJ5ZB.js +0 -6
  161. package/dist/preview/chunk.N7N5OFPL.js +0 -1
  162. package/dist/preview/chunk.ORXFUK6F.js +0 -344
  163. package/dist/preview/chunk.OXTUXWMU.js +0 -1
  164. package/dist/preview/chunk.P5325GYR.js +0 -1
  165. package/dist/preview/chunk.PMER4LVT.js +0 -1
  166. package/dist/preview/chunk.PONWLTTB.js +0 -1
  167. package/dist/preview/chunk.QCF6Z2AZ.js +0 -1
  168. package/dist/preview/chunk.RWB4235L.js +0 -1
  169. package/dist/preview/chunk.SK33IHL2.js +0 -4
  170. package/dist/preview/chunk.TCUB6IDY.js +0 -1
  171. package/dist/preview/chunk.TJCTTJWE.js +0 -1
  172. package/dist/preview/chunk.UCZR33MK.js +0 -1
  173. package/dist/preview/chunk.UGCNMAPC.js +0 -1
  174. package/dist/preview/chunk.XDYAG276.js +0 -1
@@ -1,3 +1,3 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ue}from"./chunk.J3M2MZHG.js";import{a as Be}from"./chunk.IAZRY42B.js";import{a as We}from"./chunk.UIUHGA6W.js";import{a as X}from"./chunk.TI4OSTQV.js";import{a as fe}from"./chunk.4BBJ62ZO.js";import{e as ce}from"./chunk.ORXFUK6F.js";import{E as we,G as ln,J as He,P as Le,R as Fe,_ as Je}from"./chunk.BTSXYZ6Z.js";import{Gb as Ne,Lb as le,Nb as je,ba as ae,da as U,fa as q,ia as Ee,ka as de,ob as Me,tc as De}from"./chunk.5ZMENPY4.js";import{b as Se}from"./chunk.AJZBJBMO.js";var cn=e=>/^(?:aggregate|kind):([^,]+)$/.exec(e)?.[1];function Ge(e,n){let t=e.about??[];if(e.field!==void 0&&e.on!==void 0&&n(e.on))return{on:"field",id:e.on,field:e.field};let i=t.filter(n);if(i.length>1)return{on:"selection",ids:i};if(e.on!==void 0&&n(e.on))return{on:"record",id:e.on};if(i.length===1)return{on:"record",id:i[0]};let o=[e.on,...t].map(s=>s===void 0?void 0:cn(s)).find(s=>s!==void 0);return e.place!==void 0?{on:"lens",place:e.place,...o?{kind:o}:{}}:o!==void 0?{on:"list",kind:o}:{on:"place",place:"home"}}var V=e=>e.on==="record"||e.on==="field"?[e.id]:e.on==="selection"?e.ids:e.on==="act"&&e.id!==void 0?[e.id]:[],ue=(e,n)=>e.tryDefinition(n)?.fields?.shape??{},K=(e,n)=>e.tryDefinition(n)?.edges??{},pe=(e,n)=>new Set(e.tryDefinition(n)?.display?.hide??[]),H=(e,n)=>ae(e.tryDefinition(n.kind),n),xe=(e,n,t)=>Ee(e.tryDefinition(n),t)||U(t),Oe=e=>typeof e=="boolean"?e?"yes":"no":String(e);function ge(e,n){let t=e.kindsKeptFrom(n);return new Set(e.schema.kinds.filter(i=>!t.has(i)))}function Ce(e,n,t,i){if(!e.permits(n,t).ok)return!1;if(!i)return!0;try{return e.previewAll([n],{author:t}).ops.length>0}catch{return!1}}function ye(e,n,t){let i=e,{principal:o}=t,s=t.each??8,c=X(i)?.store??i,d=c.seenBy(o),l=c.schema,p=ge(c,o),a=r=>{let y=d.graph.getNode(r);return y&&p.has(y.kind)?y:void 0},f=c.allMutations(),h=new Map(f.map(r=>[r.name,r])),b=[],P=new Set,S=r=>{P.has(r.id)||(P.add(r.id),b.push(r))},m=r=>r.slice(0,s),C=V(n).filter(r=>a(r)!==void 0);if(V(n).length>0&&C.length===0)return{target:n,candidates:[]};let k=C.length===1?a(C[0]):void 0,g=k?.kind??(n.on==="list"?n.kind:n.on==="lens"?n.kind??t.places?.find(r=>r.as===n.place)?.kind:void 0)??(n.on==="selection"?a(C[0])?.kind:void 0);if(g!==void 0&&!p.has(g))return{target:n,candidates:[]};let A=(r,y)=>`act:${r}${Object.keys(y).length>0?`:${Object.values(y).map(T=>String(T)).join(",")}`:""}`,w=(r,y,T,v,$)=>{r.destructive||Object.values(y).some(u=>typeof u=="string"&&c.graph.has(u)&&a(u)===void 0)||Ce(c,{name:r.name,args:{...y}},o,v.length===0)&&S({type:"act",id:A(r.name,y),label:T,description:$??r.description??T,mutation:r.name,args:y,asks:v})};if(n.on!=="place"||t.acts)if(t.acts)for(let r of t.acts){let y=h.get(r.mutation);!y||r.destructive||n.on==="act"&&r.mutation!==n.act||w(y,r.args,r.label,(r.open??[]).filter(T=>!T.optional).map(T=>T.name),r.why)}else{let r=k?[k]:[];for(let y of f){if(n.on==="act"&&y.name!==n.act)continue;let T=y.input.shape??{},v=$=>Object.entries(T).filter(([u,O])=>u!==$&&O.safeParse?.(void 0).success===!1).map(([u])=>u);if(y.subject)for(let $ of r)le(l,y).includes($.kind)&&w(y,{[y.subject.arg]:$.id},`${y.title??U(y.name)}: ${H(l,$)}`,v(y.subject.arg));else g!==void 0&&(y.creates??[]).includes(g)&&w(y,{},y.title??U(y.name),v(void 0))}}let M=b.filter(r=>r.type==="act");b.splice(0,b.length,...m(M));let L=(r,y)=>{let T=je(l,f).get(r.kind),v=ue(l,r.kind),$=pe(l,r.kind),u=[];for(let[O,j]of Object.entries(v)){if(y!==void 0?O!==y:$.has(O)||r[O]!==void 0)continue;let D=fe(j),z=D?.type==="enum"?D.options??[]:D?.type==="boolean"?[!0,!1]:[];if(z.length===0)continue;let W=(T?.get(O)??[]).map(N=>h.get(N)).find(N=>N?.subject!==void 0&&Ce(c,{name:N.name,args:{[N.subject.arg]:r.id,[O]:z.find(Ae=>Ae!==r[O])??z[0]}},o,!0));if(W?.subject)for(let N of z)r[O]!==N&&u.push({type:"fill",id:`fill:${r.id}:${O}:${Oe(N)}`,label:`${xe(l,r.kind,O)}: ${Oe(N)}`,description:`Set ${xe(l,r.kind,O).toLowerCase()} of ${H(l,r)} to ${Oe(N)}`,record:r.id,field:O,value:N,call:{name:W.name,args:{[W.subject.arg]:r.id,[O]:N}}})}for(let[O,j]of Object.entries(K(l,r.kind))){if(y!==void 0&&O!==y)continue;let D=j.to==="*"?[...p]:j.to.filter(R=>p.has(R)),z=new Set(d.graph.out(r.id,O).map(R=>R.id)),W=f.find(R=>(R.connects??[]).includes(O)&&R.subject!==void 0&&le(l,R).includes(r.kind));if(!W?.subject)continue;let N=Ne(W.input).find(R=>R.name!==W.subject.arg);if(!N)continue;let Ae=D.flatMap(R=>N.kinds.length===0||N.kinds.includes(R)?d.graph.nodesOfKind(R):[]).filter(R=>R.id!==r.id&&!z.has(R.id)&&a(R.id)!==void 0);for(let R of m(Ae)){let Re={name:W.name,args:{[W.subject.arg]:r.id,[N.name]:R.id}};Ce(c,Re,o,!0)&&u.push({type:"fill",id:`fill:${r.id}:${O}:${R.id}`,label:`${U(O)}: ${H(l,R)}`,description:`Link ${H(l,r)} to ${H(l,R)}${j.description?` as ${j.description}`:""}`,record:r.id,field:O,value:R.id,call:Re})}}return u};if(n.on==="field"&&k)for(let r of L(k,n.field))S(r);else if(k&&n.on==="record")for(let r of m(L(k)))S(r);let J=r=>{let y=q(l,r).toLowerCase(),T=[{type:"panel",id:`panel:${r}:list`,label:`A list of ${y}`,description:`Every ${de(l.tryDefinition(r),r).toLowerCase()} this viewer may see, as a list`,panel:{lens:"blocks",kind:r}}],v=pe(l,r);for(let[$,u]of Object.entries(ue(l,r))){if(v.has($))continue;let O=fe(u),j=xe(l,r,$).toLowerCase();if(O?.type==="enum")T.push({type:"panel",id:`panel:${r}:group:${$}`,label:`${_(y)} by ${j}`,description:`A list of ${y} grouped by ${j}`,panel:{lens:"blocks",kind:r,group:$}}),T.push({type:"panel",id:`panel:${r}:columns:${$}`,label:`Columns of ${y} by ${j}`,description:`${_(y)} in a column for each ${j}`,panel:{lens:"columns",kind:r,column:$}});else if(O?.type==="number"||O?.type==="integer"||O?.type==="date"||O?.type==="datetime"){let D=O.type==="date"||O.type==="datetime";T.push({type:"panel",id:`panel:${r}:sort:${$}`,label:`${_(y)} by ${j}`,description:`A list of ${y}, the ${D?"latest":"highest"} ${j} first`,panel:{lens:"blocks",kind:r,sort:{by:$,direction:"desc"}}}),D&&T.push({type:"panel",id:`panel:${r}:calendar:${$}`,label:`A calendar of ${y}`,description:`${_(y)} on a calendar by ${j}`,panel:{lens:"calendar",kind:r,start:$}})}}return T},F=n.on==="place"?[...p]:g!==void 0?[g]:[];for(let r of F)for(let y of m(J(r)))S(y);for(let r of m((t.places??[]).filter(y=>y.kind===void 0?n.on==="place":p.has(y.kind)&&(n.on==="place"||y.kind===g))))n.on==="lens"&&r.as===n.place||S({type:"place",id:`place:${r.as}`,label:r.title,description:`Go to ${r.title}`,place:r.as});if(k){let r=[];for(let[y,T]of Object.entries(K(l,k.kind)))for(let v of d.graph.out(k.id,y))a(v.id)&&r.push({type:"record",id:`record:${v.id}`,label:H(l,v),description:`${_(T.description??U(y))}: ${H(l,v)}`,record:v.id,relation:y});for(let y of l.kinds)for(let[T,v]of Object.entries(K(l,y)))if(!(v.to!=="*"&&!v.to.includes(k.kind)))for(let $ of d.graph.in(k.id,T))$.kind===y&&a($.id)&&r.push({type:"record",id:`record:${$.id}`,label:H(l,$),description:`${_(v.inverse??U(T))}: ${H(l,$)}`,record:$.id,relation:T});for(let y of m(r))S(y)}else if(n.on==="list"||n.on==="lens")for(let r of m(g!==void 0?d.graph.nodesOfKind(g):[]))a(r.id)&&S({type:"record",id:`record:${r.id}`,label:H(l,r),description:`Open ${H(l,r)}`,record:r.id});else if(n.on==="selection")for(let r of C){let y=a(r);S({type:"record",id:`record:${r}`,label:H(l,y),description:`Open ${H(l,y)}`,record:r})}return{target:n,candidates:b}}var _=e=>e&&`${e[0].toUpperCase()}${e.slice(1)}`,fn={columns:["board","kanban","column","lane","pipeline","stage","funnel"],board:["board","map","floor","layout","seat","slot"],calendar:["calendar","schedule","date","due","month","week","agenda","deadline","day"],timeline:["timeline","gantt","schedule","roadmap","span"],coverage:["coverage","matrix","grid","gap"],plan:["plan","floor","map","region","area"],blocks:["list","table","summary","overview","dashboard","card"]},un=new Set(["a","an","the","of","for","my","our","me","us","to","with","and","in","on","by","that","which","i","we","want","need","show","open","go","draw","make","new","view","views","panel","panels","page","lens","please","all","every","some","see","can","could","would","like","one","what","is","are","do","does","here","there","how","it","this","these","those"]),Z=e=>e.length>3&&e.endsWith("ies")?`${e.slice(0,-3)}y`:e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e,$e=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^a-z0-9]+/).filter(Boolean);function ze(e,n,t){let i=e,o=X(i)?.store??i,s=o.schema,c=ge(o,t.principal),d=o.seenBy(t.principal),l=V(n),p=new Set;for(let A of l){let w=d.graph.getNode(A)?.kind;w!==void 0&&c.has(w)&&p.add(w)}if(l.length>0&&p.size===0)return[];if(n.on==="list"&&p.add(n.kind),n.on==="lens"){let A=n.kind??t.places.find(w=>w.as===n.place)?.kind;A!==void 0&&p.add(A)}let a=new Map;for(let A of s.kinds){if(!c.has(A))continue;let w=s.tryDefinition(A);for(let M of[A,de(w,A),q(s,A)])for(let L of $e(M))a.set(Z(L),A)}let f=$e(t.said??"").filter(A=>!un.has(A)),h=new Set,b=[];for(let A of f){let w=a.get(Z(A));w!==void 0?h.add(w):b.push(Z(A))}let P=h.size>0?h:p;if((t.said??"").trim()!==""&&f.length===0)return[];if(P.size===0&&f.length===0)return[];let S=[];t.places.forEach((A,w)=>{if(A.hidden||n.on==="lens"&&A.as===n.place)return;let M=A.over??(A.kind!==void 0?[A.kind]:[]);if(M.length>0&&!M.some(F=>c.has(F)))return;let L=M.some(F=>P.has(F)),J=!L&&(A.reads??[]).some(F=>P.has(F));P.size>0&&!L&&!J||S.push({place:A,own:L,reads:J,at:w})});let m=A=>new Set($e(A.title).map(Z)),C=new Set(b.filter(A=>S.some(({place:w})=>m(w).has(A)))),k=[];for(let{place:A,own:w,reads:M,at:L}of S){let J=m(A),F=new Set((fn[A.lens??""]??[]).map(Z)),r=b.filter($=>J.has($)||F.has($)&&!C.has($)).length,y=b.length-r;if(b.length>0&&r===0)continue;let T=!M&&y===0?"full":"partial",v=(w?4:M?2:1)+r*2-y+(T==="full"?1:0);k.push({view:{place:A.as,title:A.title,...A.kind!==void 0?{kind:A.kind}:{},fit:T},score:v,at:L})}return k.filter((A,w)=>!k.slice(0,w).some(M=>M.view.place===A.view.place&&M.view.title===A.view.title)).sort((A,w)=>w.score-A.score||A.at-w.at).slice(0,t.most??3).map(A=>A.view)}var Pe=new WeakMap;function pn(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)>>>0;return n.toString(36)}function gn(e,n){let t=e,i=X(t)?.store??t,o=i.schema,s=ge(i,n),d=i.allMutations().filter(S=>!S.destructive&&i.permits({name:S.name,args:{}},n).ok!==!1),l=`${[...s].join(",")}|${d.map(S=>S.name).join(",")}`,p=Pe.get(o)?.get(l);if(p)return p;let a=[...s].map(S=>{let m=pe(o,S),C={};for(let[g,A]of Object.entries(ue(o,S))){if(m.has(g))continue;let w=fe(A);w&&(C[g]=w.type==="enum"?`enum:${(w.options??[]).join("|")}`:w.type)}let k={};for(let[g,A]of Object.entries(K(o,S)))k[g]=A.to==="*"?[...s]:A.to.filter(w=>s.has(w));return{kind:S,noun:de(o.tryDefinition(S),S),plural:q(o,S),fields:C,relations:k}}),f=d.map(S=>({name:S.name,title:S.title??U(S.name),...S.subject?{on:le(o,S).filter(m=>s.has(m))}:{}})),h={kinds:a,acts:f},b={version:pn(JSON.stringify(h)),...h},P=Pe.get(o)??new Map;return P.set(l,b),Pe.set(o,P),b}var yn=e=>e.name??e.id??e.kind;function qe(e,n,t){let i=e,{principal:o}=t,s=X(i)?.store??i,c=s.seenBy(o),d=s.schema,l=ge(s,o),p=k=>{let g=c.graph.getNode(k);return g&&l.has(g.kind)?g:void 0},a=k=>({id:k.id,kind:k.kind,label:H(d,k)}),f=V(n),h=f.length===1?p(f[0]):void 0,b=h?Object.fromEntries(Object.keys(ue(d,h.kind)).filter(k=>!pe(d,h.kind).has(k)&&h[k]!==void 0&&k!=="label").map(k=>[k,h[k]])):{},P={on:n.on,...h?{record:{...a(h),fields:b}}:{},...n.on==="field"&&h?{field:n.field}:{},...n.on==="list"&&l.has(n.kind)?{kind:n.kind}:{},...n.on==="lens"?{place:n.place,...n.kind&&l.has(n.kind)?{kind:n.kind}:{}}:{},...n.on==="place"?{place:n.place}:{},...n.on==="act"?{act:n.act}:{}},S=[...new Set([...n.on==="selection"?n.ids:[],...t.selection??[]])].flatMap(k=>{let g=p(k);return g?[a(g)]:[]}),m=[];if(h){for(let k of Object.keys(K(d,h.kind)))for(let g of c.graph.out(h.id,k))p(g.id)&&m.push({...a(g),relation:k,direction:"out"});for(let k of d.kinds)for(let g of Object.keys(K(d,k)))for(let A of c.graph.in(h.id,g))A.kind===k&&p(A.id)&&m.push({...a(A),relation:g,direction:"in"})}let C=c.batches().filter(k=>!k.ops.every(Me)).slice(-(t.recent??6)).reverse().map(k=>({intent:k.intent,at:k.at,by:yn(k.author)}));return{...t.place!==void 0?{place:t.place}:{},target:P,selection:S,neighbors:m.slice(0,24),recent:C,schema:gn(s,o)}}function ee(e){if(!e.off)return e.fast??(e.decide?{model:e.name??"decide",decide:e.decide}:void 0)}function B(e){if(e.off)return;if(e.thinking)return e.thinking;let n=e.name??"model";if(e.complete){let t=e.complete;return{model:n,think:async({system:i,prompt:o})=>({text:await t(`${i}
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ue}from"./chunk.QIV65FWE.js";import{a as Be}from"./chunk.HPAGOEZG.js";import{a as We}from"./chunk.H5ADMSE7.js";import{a as X}from"./chunk.TI4OSTQV.js";import{a as fe}from"./chunk.I7XSDXQ3.js";import{e as ce}from"./chunk.JHEVGLKB.js";import{E as we,G as ln,J as He,P as Le,R as Fe,_ as Je}from"./chunk.FOQZADMA.js";import{Hb as Ne,Mb as le,Ob as je,ba as ae,da as U,fa as q,ia as Ee,ka as de,pb as Me,uc as De}from"./chunk.V5MYKNL7.js";import{b as Se}from"./chunk.AJZBJBMO.js";var cn=e=>/^(?:aggregate|kind):([^,]+)$/.exec(e)?.[1];function Ge(e,n){let t=e.about??[];if(e.field!==void 0&&e.on!==void 0&&n(e.on))return{on:"field",id:e.on,field:e.field};let i=t.filter(n);if(i.length>1)return{on:"selection",ids:i};if(e.on!==void 0&&n(e.on))return{on:"record",id:e.on};if(i.length===1)return{on:"record",id:i[0]};let o=[e.on,...t].map(s=>s===void 0?void 0:cn(s)).find(s=>s!==void 0);return e.place!==void 0?{on:"lens",place:e.place,...o?{kind:o}:{}}:o!==void 0?{on:"list",kind:o}:{on:"place",place:"home"}}var V=e=>e.on==="record"||e.on==="field"?[e.id]:e.on==="selection"?e.ids:e.on==="act"&&e.id!==void 0?[e.id]:[],ue=(e,n)=>e.tryDefinition(n)?.fields?.shape??{},K=(e,n)=>e.tryDefinition(n)?.edges??{},pe=(e,n)=>new Set(e.tryDefinition(n)?.display?.hide??[]),H=(e,n)=>ae(e.tryDefinition(n.kind),n),xe=(e,n,t)=>Ee(e.tryDefinition(n),t)||U(t),Oe=e=>typeof e=="boolean"?e?"yes":"no":String(e);function ge(e,n){let t=e.kindsKeptFrom(n);return new Set(e.schema.kinds.filter(i=>!t.has(i)))}function Ce(e,n,t,i){if(!e.permits(n,t).ok)return!1;if(!i)return!0;try{return e.previewAll([n],{author:t}).ops.length>0}catch{return!1}}function ye(e,n,t){let i=e,{principal:o}=t,s=t.each??8,c=X(i)?.store??i,d=c.seenBy(o),l=c.schema,p=ge(c,o),a=r=>{let y=d.graph.getNode(r);return y&&p.has(y.kind)?y:void 0},f=c.allMutations(),h=new Map(f.map(r=>[r.name,r])),b=[],P=new Set,S=r=>{P.has(r.id)||(P.add(r.id),b.push(r))},m=r=>r.slice(0,s),C=V(n).filter(r=>a(r)!==void 0);if(V(n).length>0&&C.length===0)return{target:n,candidates:[]};let k=C.length===1?a(C[0]):void 0,g=k?.kind??(n.on==="list"?n.kind:n.on==="lens"?n.kind??t.places?.find(r=>r.as===n.place)?.kind:void 0)??(n.on==="selection"?a(C[0])?.kind:void 0);if(g!==void 0&&!p.has(g))return{target:n,candidates:[]};let A=(r,y)=>`act:${r}${Object.keys(y).length>0?`:${Object.values(y).map(T=>String(T)).join(",")}`:""}`,w=(r,y,T,v,$)=>{r.destructive||Object.values(y).some(u=>typeof u=="string"&&c.graph.has(u)&&a(u)===void 0)||Ce(c,{name:r.name,args:{...y}},o,v.length===0)&&S({type:"act",id:A(r.name,y),label:T,description:$??r.description??T,mutation:r.name,args:y,asks:v})};if(n.on!=="place"||t.acts)if(t.acts)for(let r of t.acts){let y=h.get(r.mutation);!y||r.destructive||n.on==="act"&&r.mutation!==n.act||w(y,r.args,r.label,(r.open??[]).filter(T=>!T.optional).map(T=>T.name),r.why)}else{let r=k?[k]:[];for(let y of f){if(n.on==="act"&&y.name!==n.act)continue;let T=y.input.shape??{},v=$=>Object.entries(T).filter(([u,O])=>u!==$&&O.safeParse?.(void 0).success===!1).map(([u])=>u);if(y.subject)for(let $ of r)le(l,y).includes($.kind)&&w(y,{[y.subject.arg]:$.id},`${y.title??U(y.name)}: ${H(l,$)}`,v(y.subject.arg));else g!==void 0&&(y.creates??[]).includes(g)&&w(y,{},y.title??U(y.name),v(void 0))}}let M=b.filter(r=>r.type==="act");b.splice(0,b.length,...m(M));let L=(r,y)=>{let T=je(l,f).get(r.kind),v=ue(l,r.kind),$=pe(l,r.kind),u=[];for(let[O,j]of Object.entries(v)){if(y!==void 0?O!==y:$.has(O)||r[O]!==void 0)continue;let D=fe(j),z=D?.type==="enum"?D.options??[]:D?.type==="boolean"?[!0,!1]:[];if(z.length===0)continue;let W=(T?.get(O)??[]).map(N=>h.get(N)).find(N=>N?.subject!==void 0&&Ce(c,{name:N.name,args:{[N.subject.arg]:r.id,[O]:z.find(Ae=>Ae!==r[O])??z[0]}},o,!0));if(W?.subject)for(let N of z)r[O]!==N&&u.push({type:"fill",id:`fill:${r.id}:${O}:${Oe(N)}`,label:`${xe(l,r.kind,O)}: ${Oe(N)}`,description:`Set ${xe(l,r.kind,O).toLowerCase()} of ${H(l,r)} to ${Oe(N)}`,record:r.id,field:O,value:N,call:{name:W.name,args:{[W.subject.arg]:r.id,[O]:N}}})}for(let[O,j]of Object.entries(K(l,r.kind))){if(y!==void 0&&O!==y)continue;let D=j.to==="*"?[...p]:j.to.filter(R=>p.has(R)),z=new Set(d.graph.out(r.id,O).map(R=>R.id)),W=f.find(R=>(R.connects??[]).includes(O)&&R.subject!==void 0&&le(l,R).includes(r.kind));if(!W?.subject)continue;let N=Ne(W.input).find(R=>R.name!==W.subject.arg);if(!N)continue;let Ae=D.flatMap(R=>N.kinds.length===0||N.kinds.includes(R)?d.graph.nodesOfKind(R):[]).filter(R=>R.id!==r.id&&!z.has(R.id)&&a(R.id)!==void 0);for(let R of m(Ae)){let Re={name:W.name,args:{[W.subject.arg]:r.id,[N.name]:R.id}};Ce(c,Re,o,!0)&&u.push({type:"fill",id:`fill:${r.id}:${O}:${R.id}`,label:`${U(O)}: ${H(l,R)}`,description:`Link ${H(l,r)} to ${H(l,R)}${j.description?` as ${j.description}`:""}`,record:r.id,field:O,value:R.id,call:Re})}}return u};if(n.on==="field"&&k)for(let r of L(k,n.field))S(r);else if(k&&n.on==="record")for(let r of m(L(k)))S(r);let J=r=>{let y=q(l,r).toLowerCase(),T=[{type:"panel",id:`panel:${r}:list`,label:`A list of ${y}`,description:`Every ${de(l.tryDefinition(r),r).toLowerCase()} this viewer may see, as a list`,panel:{lens:"blocks",kind:r}}],v=pe(l,r);for(let[$,u]of Object.entries(ue(l,r))){if(v.has($))continue;let O=fe(u),j=xe(l,r,$).toLowerCase();if(O?.type==="enum")T.push({type:"panel",id:`panel:${r}:group:${$}`,label:`${_(y)} by ${j}`,description:`A list of ${y} grouped by ${j}`,panel:{lens:"blocks",kind:r,group:$}}),T.push({type:"panel",id:`panel:${r}:columns:${$}`,label:`Columns of ${y} by ${j}`,description:`${_(y)} in a column for each ${j}`,panel:{lens:"columns",kind:r,column:$}});else if(O?.type==="number"||O?.type==="integer"||O?.type==="date"||O?.type==="datetime"){let D=O.type==="date"||O.type==="datetime";T.push({type:"panel",id:`panel:${r}:sort:${$}`,label:`${_(y)} by ${j}`,description:`A list of ${y}, the ${D?"latest":"highest"} ${j} first`,panel:{lens:"blocks",kind:r,sort:{by:$,direction:"desc"}}}),D&&T.push({type:"panel",id:`panel:${r}:calendar:${$}`,label:`A calendar of ${y}`,description:`${_(y)} on a calendar by ${j}`,panel:{lens:"calendar",kind:r,start:$}})}}return T},F=n.on==="place"?[...p]:g!==void 0?[g]:[];for(let r of F)for(let y of m(J(r)))S(y);for(let r of m((t.places??[]).filter(y=>y.kind===void 0?n.on==="place":p.has(y.kind)&&(n.on==="place"||y.kind===g))))n.on==="lens"&&r.as===n.place||S({type:"place",id:`place:${r.as}`,label:r.title,description:`Go to ${r.title}`,place:r.as});if(k){let r=[];for(let[y,T]of Object.entries(K(l,k.kind)))for(let v of d.graph.out(k.id,y))a(v.id)&&r.push({type:"record",id:`record:${v.id}`,label:H(l,v),description:`${_(T.description??U(y))}: ${H(l,v)}`,record:v.id,relation:y});for(let y of l.kinds)for(let[T,v]of Object.entries(K(l,y)))if(!(v.to!=="*"&&!v.to.includes(k.kind)))for(let $ of d.graph.in(k.id,T))$.kind===y&&a($.id)&&r.push({type:"record",id:`record:${$.id}`,label:H(l,$),description:`${_(v.inverse??U(T))}: ${H(l,$)}`,record:$.id,relation:T});for(let y of m(r))S(y)}else if(n.on==="list"||n.on==="lens")for(let r of m(g!==void 0?d.graph.nodesOfKind(g):[]))a(r.id)&&S({type:"record",id:`record:${r.id}`,label:H(l,r),description:`Open ${H(l,r)}`,record:r.id});else if(n.on==="selection")for(let r of C){let y=a(r);S({type:"record",id:`record:${r}`,label:H(l,y),description:`Open ${H(l,y)}`,record:r})}return{target:n,candidates:b}}var _=e=>e&&`${e[0].toUpperCase()}${e.slice(1)}`,fn={columns:["board","kanban","column","lane","pipeline","stage","funnel"],board:["board","map","floor","layout","seat","slot"],calendar:["calendar","schedule","date","due","month","week","agenda","deadline","day"],timeline:["timeline","gantt","schedule","roadmap","span"],coverage:["coverage","matrix","grid","gap"],plan:["plan","floor","map","region","area"],blocks:["list","table","summary","overview","dashboard","card"]},un=new Set(["a","an","the","of","for","my","our","me","us","to","with","and","in","on","by","that","which","i","we","want","need","show","open","go","draw","make","new","view","views","panel","panels","page","lens","please","all","every","some","see","can","could","would","like","one","what","is","are","do","does","here","there","how","it","this","these","those"]),Z=e=>e.length>3&&e.endsWith("ies")?`${e.slice(0,-3)}y`:e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e,$e=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^a-z0-9]+/).filter(Boolean);function ze(e,n,t){let i=e,o=X(i)?.store??i,s=o.schema,c=ge(o,t.principal),d=o.seenBy(t.principal),l=V(n),p=new Set;for(let A of l){let w=d.graph.getNode(A)?.kind;w!==void 0&&c.has(w)&&p.add(w)}if(l.length>0&&p.size===0)return[];if(n.on==="list"&&p.add(n.kind),n.on==="lens"){let A=n.kind??t.places.find(w=>w.as===n.place)?.kind;A!==void 0&&p.add(A)}let a=new Map;for(let A of s.kinds){if(!c.has(A))continue;let w=s.tryDefinition(A);for(let M of[A,de(w,A),q(s,A)])for(let L of $e(M))a.set(Z(L),A)}let f=$e(t.said??"").filter(A=>!un.has(A)),h=new Set,b=[];for(let A of f){let w=a.get(Z(A));w!==void 0?h.add(w):b.push(Z(A))}let P=h.size>0?h:p;if((t.said??"").trim()!==""&&f.length===0)return[];if(P.size===0&&f.length===0)return[];let S=[];t.places.forEach((A,w)=>{if(A.hidden||n.on==="lens"&&A.as===n.place)return;let M=A.over??(A.kind!==void 0?[A.kind]:[]);if(M.length>0&&!M.some(F=>c.has(F)))return;let L=M.some(F=>P.has(F)),J=!L&&(A.reads??[]).some(F=>P.has(F));P.size>0&&!L&&!J||S.push({place:A,own:L,reads:J,at:w})});let m=A=>new Set($e(A.title).map(Z)),C=new Set(b.filter(A=>S.some(({place:w})=>m(w).has(A)))),k=[];for(let{place:A,own:w,reads:M,at:L}of S){let J=m(A),F=new Set((fn[A.lens??""]??[]).map(Z)),r=b.filter($=>J.has($)||F.has($)&&!C.has($)).length,y=b.length-r;if(b.length>0&&r===0)continue;let T=!M&&y===0?"full":"partial",v=(w?4:M?2:1)+r*2-y+(T==="full"?1:0);k.push({view:{place:A.as,title:A.title,...A.kind!==void 0?{kind:A.kind}:{},fit:T},score:v,at:L})}return k.filter((A,w)=>!k.slice(0,w).some(M=>M.view.place===A.view.place&&M.view.title===A.view.title)).sort((A,w)=>w.score-A.score||A.at-w.at).slice(0,t.most??3).map(A=>A.view)}var Pe=new WeakMap;function pn(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)>>>0;return n.toString(36)}function gn(e,n){let t=e,i=X(t)?.store??t,o=i.schema,s=ge(i,n),d=i.allMutations().filter(S=>!S.destructive&&i.permits({name:S.name,args:{}},n).ok!==!1),l=`${[...s].join(",")}|${d.map(S=>S.name).join(",")}`,p=Pe.get(o)?.get(l);if(p)return p;let a=[...s].map(S=>{let m=pe(o,S),C={};for(let[g,A]of Object.entries(ue(o,S))){if(m.has(g))continue;let w=fe(A);w&&(C[g]=w.type==="enum"?`enum:${(w.options??[]).join("|")}`:w.type)}let k={};for(let[g,A]of Object.entries(K(o,S)))k[g]=A.to==="*"?[...s]:A.to.filter(w=>s.has(w));return{kind:S,noun:de(o.tryDefinition(S),S),plural:q(o,S),fields:C,relations:k}}),f=d.map(S=>({name:S.name,title:S.title??U(S.name),...S.subject?{on:le(o,S).filter(m=>s.has(m))}:{}})),h={kinds:a,acts:f},b={version:pn(JSON.stringify(h)),...h},P=Pe.get(o)??new Map;return P.set(l,b),Pe.set(o,P),b}var yn=e=>e.name??e.id??e.kind;function qe(e,n,t){let i=e,{principal:o}=t,s=X(i)?.store??i,c=s.seenBy(o),d=s.schema,l=ge(s,o),p=k=>{let g=c.graph.getNode(k);return g&&l.has(g.kind)?g:void 0},a=k=>({id:k.id,kind:k.kind,label:H(d,k)}),f=V(n),h=f.length===1?p(f[0]):void 0,b=h?Object.fromEntries(Object.keys(ue(d,h.kind)).filter(k=>!pe(d,h.kind).has(k)&&h[k]!==void 0&&k!=="label").map(k=>[k,h[k]])):{},P={on:n.on,...h?{record:{...a(h),fields:b}}:{},...n.on==="field"&&h?{field:n.field}:{},...n.on==="list"&&l.has(n.kind)?{kind:n.kind}:{},...n.on==="lens"?{place:n.place,...n.kind&&l.has(n.kind)?{kind:n.kind}:{}}:{},...n.on==="place"?{place:n.place}:{},...n.on==="act"?{act:n.act}:{}},S=[...new Set([...n.on==="selection"?n.ids:[],...t.selection??[]])].flatMap(k=>{let g=p(k);return g?[a(g)]:[]}),m=[];if(h){for(let k of Object.keys(K(d,h.kind)))for(let g of c.graph.out(h.id,k))p(g.id)&&m.push({...a(g),relation:k,direction:"out"});for(let k of d.kinds)for(let g of Object.keys(K(d,k)))for(let A of c.graph.in(h.id,g))A.kind===k&&p(A.id)&&m.push({...a(A),relation:g,direction:"in"})}let C=c.batches().filter(k=>!k.ops.every(Me)).slice(-(t.recent??6)).reverse().map(k=>({intent:k.intent,at:k.at,by:yn(k.author)}));return{...t.place!==void 0?{place:t.place}:{},target:P,selection:S,neighbors:m.slice(0,24),recent:C,schema:gn(s,o)}}function ee(e){if(!e.off)return e.fast??(e.decide?{model:e.name??"decide",decide:e.decide}:void 0)}function B(e){if(e.off)return;if(e.thinking)return e.thinking;let n=e.name??"model";if(e.complete){let t=e.complete;return{model:n,think:async({system:i,prompt:o})=>({text:await t(`${i}
2
2
 
3
- ${o}`)})}}if(e.turn){let t=e.turn;return{model:n,think:async({system:i,prompt:o})=>({text:await t({system:i,messages:[{role:"user",content:o}],tools:[],call:async()=>({error:"No tools here."})})})}}}var Te=(e,n,t)=>e?n/1e6*(e.inputPerMillion??0)+t/1e6*(e.outputPerMillion??0):void 0,ve=()=>`ai-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;function hn(e,n,t=[]){let i=o=>{let s=e.graph.getNode(o);return s?ae(e.schema.tryDefinition(s.kind),s):"a record"};switch(n.on){case"record":return i(n.id);case"field":return`${i(n.id)} \xB7 ${n.field}`;case"selection":return`${n.ids.length} records`;case"list":return e.schema.tryDefinition(n.kind)?q(e.schema,n.kind):n.kind;case"lens":case"place":return t.find(o=>o.as===n.place)?.title??(n.place==="home"?"Home":n.place);case"act":return n.act}}var _e=e=>e.type!=="act"||e.asks.length===0,me=(e,n)=>({id:e.id,type:e.type,label:e.label,...n!==void 0?{confidence:n}:{}});function Q(e,n){let t=n.interaction??ve(),i=ye(n.store,n.target,{principal:n.principal,...n.acts?{acts:n.acts}:{},...n.places?{places:n.places}:{}}),o=qe(n.store,n.target,{principal:n.principal,...n.place?{place:n.place}:{},...n.selection?{selection:n.selection}:{}}),s=[];return{id:t,catalog:i,state:o,entry:{id:t,at:new Date().toISOString(),by:n.by??n.principal,target:n.target,targetLabel:hn(n.store,n.target,n.places)},usage:s,meter:c=>{s.push(c),e.meter?.({...c,interaction:t})}}}async function ne(e,n,t,i){let o=await e.decide(n,t),{inputTokens:s,outputTokens:c}=o.usage,d=Te(e.price,s,c);return i({tier:"fast",model:e.model,inputTokens:s,outputTokens:c,...d!==void 0?{costUsd:d}:{}}),o.answers}async function te(e,n,t,i,o){let s=await e.think({system:n,prompt:t,state:i.state,catalog:i.catalog}),c=s.usage?.inputTokens,d=s.usage?.outputTokens,l=s.usage?.costUsd??(c!==void 0?Te(e.price,c,d??0):void 0);return o({tier:"thinking",model:e.model,...c!==void 0?{inputTokens:c}:{},...d!==void 0?{outputTokens:d}:{},...l!==void 0?{costUsd:l}:{}}),Be(s.text)}function ie(e,n){let t=new Map(e.map((i,o)=>[`c${o+1}`,i]));return{question:{type:"choice",instructions:n,criteria:Object.fromEntries([...t].map(([i,o])=>[i,`${o.label} \u2014 ${o.description}`]))},of:i=>t.get(i)}}function oe(e,n,t){if(e?.type!=="choice")return[];let i=e,o=Object.entries(i.probabilities).sort((s,c)=>c[1]-s[1]);return o.some(([s])=>s===i.choice)||o.unshift([i.choice,i.confidence]),o.flatMap(([s,c])=>{let d=n(s);return d?[{candidate:d,confidence:c}]:[]}).slice(0,t)}var E=(e,n,t,i)=>({interaction:{...e.entry,ask:{kind:t,said:n??""},offered:[],outcome:"failed",failed:i,usage:[...e.usage]},offers:[]}),Y="AI isn't on here.";async function Ke(e,n,t=3){let i=Q(e,n),o=n.said??"Suggest",s=i.catalog.candidates.filter(_e).slice(0,24);if(s.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let c=ee(e),d=B(e),l=[];try{if(c){let{question:p,of:a}=ie(s,"Which of these would the person most likely want to do next, here?"),f=await ne(c,{...i.state,candidates:s.map(h=>({id:h.id,type:h.type,says:h.description}))},{next:p},i.meter);l=oe(f.next,a,t)}else if(d){let p=await te(d,'You suggest what a person most likely wants to do next in an app. Answer only JSON: {"pick": [candidate ids, best first]}. Pick only ids from the candidates.',JSON.stringify({state:i.state,candidates:s.map(f=>({id:f.id,says:f.description}))}),i,i.meter);l=(Array.isArray(p?.pick)?p.pick.filter(f=>typeof f=="string"):[]).flatMap(f=>s.filter(h=>h.id===f)).slice(0,t).map(f=>({candidate:f}))}else return E(i,o,"suggest",Y)}catch(p){return E(i,o,"suggest",p instanceof Error?p.message:String(p))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:l.map(({candidate:p,confidence:a})=>me(p,a)),outcome:"offered",usage:[...i.usage]},offers:l.map(({candidate:p})=>p)}}var mn=e=>`several:${e}`;async function Fn(e,n,t=2){let i=Q(e,{...n,acts:[]}),o=n.said??"Suggest for the chosen",s=n.target.on==="selection"?n.target.ids.length:1,d=[...n.shared.map(a=>({type:"act",id:mn(a.id),label:a.label,description:`${a.label}, for all ${s} chosen`,mutation:a.mutation,args:a.args,asks:[]})),...i.catalog.candidates.filter(a=>a.type==="panel"||a.type==="place")].slice(0,24),l=ee(e);if(!l)return E(i,o,"suggest",Y);if(d.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let p;try{let{question:a,of:f}=ie(d,`Which of these would the person most likely want to do next with the ${s} records they chose together?`),h=await ne(l,{...i.state,candidates:d.map(b=>({id:b.id,type:b.type,says:b.description}))},{next:a},i.meter);p=oe(h.next,f,t).filter((b,P)=>P===0||b.confidence>=kn)}catch(a){return E(i,o,"suggest",a instanceof Error?a.message:String(a))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:p.map(({candidate:a,confidence:f})=>me(a,f)),outcome:"offered",usage:[...i.usage]},offers:p.map(({candidate:a})=>a)}}var kn=.25;async function Ve(e,n){let t=Q(e,n),i=n.said??"Fill in",o=t.catalog.candidates.filter(f=>f.type==="fill"),s=new Map;for(let f of o)s.set(f.field,[...s.get(f.field)??[],f]);if(s.size===0)return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:[],outcome:"offered",usage:[]},offers:[]};let c=ee(e),d=B(e),l=[];try{if(c){let f=[...s].map(([b,P],S)=>({key:`f${S+1}`,field:b,...ie(P,`Which value fits "${b}" best for this record?`)})),h=await ne(c,t.state,Object.fromEntries(f.map(b=>[b.key,b.question])),t.meter);for(let b of f){let P=!bn(n.store,n.target,b.field)&&An(n.store,n.target,b.field)!=="one";l.push(...oe(h[b.key],b.of,P?3:1).filter((S,m)=>m===0||S.confidence>=.4))}}else if(d){let f=await te(d,`You fill in a record's fields in an app. Answer only JSON: {"fills": [candidate ids]}, at most one per field, only ids from the candidates.`,JSON.stringify({state:t.state,candidates:o.map(P=>({id:P.id,says:P.description}))}),t,t.meter),h=Array.isArray(f?.fills)?f.fills.filter(P=>typeof P=="string"):[],b=new Set;for(let P of h){let S=o.find(m=>m.id===P);S?.type==="fill"&&!b.has(S.field)&&(b.add(S.field),l.push({candidate:S}))}}else return E(t,i,"fill",Y)}catch(f){return E(t,i,"fill",f instanceof Error?f.message:String(f))}let p=t.usage.at(-1)?.model,a=se(n.store,{interaction:t.id,target:n.target,basis:i,...p?{model:p}:{},proposals:l.flatMap(({candidate:f,confidence:h})=>f.type==="fill"?[{id:f.id,label:f.label,said:f.description,call:f.call,record:f.record,field:f.field,...h!==void 0?{confidence:h}:{}}]:[])},n.principal);return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:a.proposals.map(f=>({id:f.id,type:"fill",label:f.label,...f.confidence!==void 0?{confidence:f.confidence}:{}})),outcome:"offered",usage:[...t.usage]},offers:[],...a.proposals.length>0?{ghost:a}:{}}}function bn(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0,s=(o?e.schema.tryDefinition(o)?.fields?.shape:void 0)??{};return t in s}function An(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0;return o?e.schema.tryDefinition(o)?.edges?.[t]?.cardinality:void 0}async function Qe(e,n){let t=Q(e,n),i=n.said??"Add one",o=new Set(n.store.allMutations().filter(a=>(a.creates??[]).length>0).map(a=>a.name)),s=t.catalog.candidates.filter(a=>a.type==="act"&&a.asks.length>0&&o.has(a.mutation));if(s.length===0)return E(t,i,"record","Nothing here makes a record.");let c=B(e);if(!c)return E(t,i,"record",Y);let d;try{let a=await te(c,'You propose one new record for an app by filling in an act. Answer only JSON: {"act": a candidate id, "args": {argument: value}}. Use only the candidates, and fill every argument the act asks for with a value that fits the state.',JSON.stringify({ask:i,state:t.state,candidates:s.map(b=>({id:b.id,says:b.description,asks:b.asks}))}),t,t.meter),f=s.find(b=>b.id===a?.act),h=typeof a?.args=="object"&&a.args!==null?a.args:{};f&&(d={act:f,args:Object.fromEntries(Object.entries(h).filter(([b])=>f.asks.includes(b)))})}catch(a){return E(t,i,"record",a instanceof Error?a.message:String(a))}if(!d)return E(t,i,"record","The model named no act this app has here.");let l=t.usage.at(-1)?.model,p=se(n.store,{interaction:t.id,target:n.target,basis:i,...l?{model:l}:{},proposals:[{id:d.act.id,label:d.act.label,said:d.act.description,call:{name:d.act.mutation,args:{...d.act.args,...d.args}}}]},n.principal);return p.proposals.length===0?E(t,i,"record","What the model proposed could not be made here."):{interaction:{...t.entry,ask:{kind:"record",said:i},offered:p.proposals.map(a=>({id:a.id,type:"act",label:a.said})),outcome:"offered",usage:[...t.usage]},offers:[d.act],ghost:p}}async function Ye(e,n){let t=Q(e,n),i=n.said??"Make a panel",o=t.catalog.candidates.filter(a=>a.type==="panel");if(o.length===0)return E(t,i,"panel","Nothing here can be drawn as a panel.");let s=ee(e),c=B(e),d;try{if(c){let a=await te(c,'You choose a panel to draw in an app. Answer only JSON: {"panel": a candidate id, "title": a short title}. Choose only among the candidates.',JSON.stringify({ask:i,state:t.state,candidates:o.map(h=>({id:h.id,says:h.description}))}),t,t.meter),f=o.find(h=>h.id===a?.panel);f&&(d={panel:f,...typeof a?.title=="string"&&a.title.trim()?{title:a.title.trim().slice(0,60)}:{}})}else if(s){let{question:a,of:f}=ie(o,`Which panel answers this best: ${i}`),h=oe((await ne(s,t.state,{panel:a},t.meter)).panel,f,1)[0];h?.candidate.type==="panel"&&(d={panel:h.candidate,confidence:h.confidence})}else return E(t,i,"panel",Y)}catch(a){return E(t,i,"panel",a instanceof Error?a.message:String(a))}if(!d)return E(t,i,"panel","The model named no panel this app can draw.");let l=d.title??d.panel.label,p={title:l,recipe:{...d.panel.panel,title:l}};return{interaction:{...t.entry,ask:{kind:"panel",said:i},offered:[me(d.panel,d.confidence)],outcome:"drawn",panel:p,usage:[...t.usage]},offers:[d.panel],panel:p}}function Sn(e){return e.off?void 0:e.answer}var wn=`You answer a person's question about what they are looking at in an app, from the state given and nothing else. Answer only JSON: {"answer": one to three short sentences, "pick": [candidate ids that act on the answer, best first, at most three]}. Pick only ids from the candidates, and none when nothing fits. Never say an id to the person.`;async function Jn(e,n){let t=Q(e,n),i=n.said.trim(),o=t.catalog.candidates.filter(m=>_e(m)||m.type==="panel"||m.type==="place"||m.type==="record").slice(0,32),s=Sn(e),c=B(e),d=ee(e),l="",p=[],a=m=>m.flatMap(C=>o.filter(k=>k.id===C)).slice(0,3).map(C=>({candidate:C}));try{if(s){let m=await s.answer({said:i,target:n.target,targetLabel:t.entry.targetLabel,state:t.state,catalog:{target:t.catalog.target,candidates:o},...n.follows?{follows:n.follows}:{}}),C=m.usage?.inputTokens,k=m.usage?.outputTokens,g=m.usage?.costUsd??(C!==void 0?Te(s.price,C,k??0):void 0);t.meter({tier:"thinking",model:s.model,...C!==void 0?{inputTokens:C}:{},...k!==void 0?{outputTokens:k}:{},...g!==void 0?{costUsd:g}:{}}),l=typeof m.text=="string"?m.text.trim():"",p=a(m.pick??[])}else if(c){let m=await te(c,wn,JSON.stringify({ask:i,about:t.entry.targetLabel,...n.follows?{follows:n.follows}:{},state:t.state,candidates:o.map(C=>({id:C.id,says:C.description}))}),t,t.meter);l=typeof m?.answer=="string"?m.answer.trim():"",p=a(Array.isArray(m?.pick)?m.pick:[])}else if(d&&o.length>0){let{question:m,of:C}=ie(o,`Which of these best answers, or acts on: ${i}`),k=await ne(d,{...t.state,asked:i,candidates:o.map(g=>({id:g.id,type:g.type,says:g.description}))},{answer:m},t.meter);p=oe(k.answer,C,3),l=p.length>0?`These fit \u201C${i}\u201D.`:""}else return E(t,i,"ask",Y)}catch(m){return E(t,i,"ask",m instanceof Error?m.message:String(m))}if(!l&&p.length===0)return E(t,i,"ask","The AI had no answer to that here.");let f=t.usage.at(-1)?.model,h=p.flatMap(({candidate:m,confidence:C})=>{let k=he(m);return k?[{...k,...C!==void 0?{confidence:C}:{}}]:[]}),b=h.length>0?se(n.store,{interaction:t.id,target:n.target,basis:i,...f?{model:f}:{},proposals:h},n.principal):void 0,P=p.map(({candidate:m})=>m).filter(m=>he(m)===void 0),S=[...P.map(m=>me(m,p.find(C=>C.candidate===m)?.confidence)),...(b?.proposals??[]).map(m=>({id:m.id,type:m.field!==void 0?"fill":"act",label:m.label,...m.confidence!==void 0?{confidence:m.confidence}:{}}))];return{interaction:{...t.entry,ask:{kind:"ask",said:i},offered:S,outcome:"offered",...l?{answer:l}:{},usage:[...t.usage]},offers:P,...b&&b.proposals.length>0?{ghost:b}:{},...l?{answer:l}:{}}}function se(e,n,t){let i=n.proposals.flatMap(o=>{try{let s=e.previewAll([o.call],{author:t}),c=s.ops.map(d=>d.intent).join("; ");return s.ops.length>0?[{...o,said:c||o.said}]:[]}catch{return[]}});return{...n,proposals:i}}function he(e){if(e.type==="fill")return{id:e.id,label:e.label,said:e.description,call:e.call,record:e.record,field:e.field};if(e.type==="act"&&e.asks.length===0)return{id:e.id,label:e.label,said:e.description,call:{name:e.mutation,args:{...e.args}}}}function Xe(e,n,t){let i=n.proposals.filter(s=>t.ids===void 0||t.ids.includes(s.id));if(i.length===0)return{ok:!1,refused:"Nothing was chosen."};let o=i.flatMap(s=>s.confidence===void 0?[]:[s.confidence]);try{let c=e.applyAll(i.map(d=>d.call),{author:t.author,via:`ai:${n.interaction}`,intent:n.basis,lineage:{basis:`Asked \u201C${n.basis}\u201D`,...n.model?{model:n.model}:{},...o.length>0?{confidence:Math.min(...o)}:{},interaction:n.interaction}}).ops[0]?.batch;return c?{ok:!0,batch:c,accepted:i.map(d=>d.id)}:{ok:!1,refused:"That changes nothing now."}}catch(s){return{ok:!1,refused:s instanceof Error?s.message:String(s)}}}function Ze(e,n,t){let i=e.ask.kind==="suggest"?n.length>0:e.offered.length>0&&e.offered.every(o=>n.includes(o.id));return{...e,outcome:i?"accepted":"partly",accepted:n,batches:[...e.batches??[],t]}}var en=e=>({...e,outcome:"dismissed"});var I=Se(ln(),1);var x=Se(Fe(),1);function tn(e,n,t){let i=n.on==="selection"?n.ids:n.on==="record"||n.on==="field"?[n.id]:[],o=i.length>0?Ue(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(s=>({mutation:s.mutation,label:s.label,args:s.args,open:s.open,why:s.why,...s.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:n,principal:e.principal,interaction:ve(),places:e.places,selection:e.selection,...o?{acts:o}:{},...e.place?{place:e.place}:{},...t?{said:t}:{}}}async function on(e,n,t){let i=await (__graviewPreload(import.meta.url,["./chunk.YXGI7H4Y.js","./chunk.G4JJXA63.js","./chunk.ITEF3U2E.js","./chunk.B2IRADR2.js","./chunk.IAZRY42B.js","./chunk.FMN5XDLE.js","./chunk.Q5WEOX3Q.js","./chunk.WQPNGBR7.js","./chunk.DYNBWIPF.js","./chunk.B7TB6YRZ.js","./chunk.WVUJXDXZ.js","./chunk.KJNUZYXS.js","./chunk.4BBJ62ZO.js","./chunk.UCZR33MK.js","./chunk.CC47O2DW.js","./chunk.2IX3CZNP.js","./chunk.6DHHUBSC.js","./chunk.NSNGPQGT.js","./chunk.H5CZZZLX.js","./chunk.Z7JRBKA7.js","./chunk.5ZMENPY4.js","./chunk.AJZBJBMO.js"]),import("./chunk.QCF6Z2AZ.js")),o=i.recipeDraft(n.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(o))return o.failed;t?.(),e.seatTalk.setDraft(o,null),e.goTo.draft?.(),sn()}function sn(e=180){if(typeof document>"u")return;let n=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(n){i&&n.focus();return}e>0&&requestAnimationFrame(()=>sn(e-1))}async function re(e,n,t,i,o){let s=tn(e,t,i),c=n==="suggest"?await Ke(e.ai,s):n==="fill"?await Ve(e.ai,s):n==="record"?await Qe(e.ai,s):await Ye(e.ai,s);if(c.interaction.outcome==="failed")return n!=="suggest"&&e.desk.record(c.interaction),c;let d=l=>{let p={...c.interaction,outcome:"failed",failed:l};return e.desk.record(p),{...c,interaction:p}};if(n==="fill"||n==="record"){if(!c.ghost||c.ghost.proposals.length===0)return d("Nothing here could be filled in.");o?.(),e.desk.setGhost({ghost:c.ghost}),e.desk.record(c.interaction)}if(n==="panel"&&c.panel){let l=await on(e,c.panel,o);if(l)return d(l);e.desk.record(c.interaction)}return c}var Ie=new WeakMap,xn=64,nn=new WeakMap;function On(e){let n=nn.get(e);if(!n){let t=n={n:0};nn.set(e,t),e.subscribe(()=>void(t.n+=1))}return n.n}var rn=(e,n)=>{let t=V(n);return t.length>0?t.map(i=>e.graph.getNode(i)):[On(e)]},an=(e,n,t)=>JSON.stringify({target:n,seat:e.principal,by:t}),dn=(e,n,t)=>{let i=rn(e.store,n);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((o,s)=>o===t.depends[s])};function Cn(e,n,t="menu"){let i=Ie.get(e.store)?.get(an(e,n,t));return i?.result!==void 0&&dn(e,n,i)?i.result:void 0}function $n(e,n,t){let i=Ie.get(e.store);i||Ie.set(e.store,i=new Map);let o=an(e,n,t?.by??"menu"),s=i.get(o);if(s&&dn(e,n,s))return s.result?Promise.resolve(s.result):s.asked;let c=t?t.ask():re(e,"suggest",n),d={schema:e.store.schema,ai:e.ai,depends:rn(e.store,n),asked:c};i.delete(o),i.set(o,d),i.size>xn&&i.delete(i.keys().next().value);let l=i;return c.then(p=>{p.interaction.outcome!=="failed"?d.result=p:l.get(o)===d&&l.delete(o)}),c}async function Pn(e,n,t,i){let o=n.interaction,s=he(t);if(s){let c=o.usage?.at(-1)?.model,d=o.offered.find(p=>p.id===t.id)?.confidence,l=se(e.store,{interaction:o.id,target:o.target,basis:`${o.ask.said}: ${t.label}`,...c?{model:c}:{},proposals:[{...s,...d!==void 0?{confidence:d}:{}}]},e.principal);if(l.proposals.length===0){let p="That can't be done now.";return e.desk.record({...o,outcome:"failed",failed:p}),p}i?.(),e.desk.setGhost({ghost:l}),e.desk.record(o);return}if(t.type==="panel"){let c=t.label,d={title:c,recipe:{...t.panel,title:c}},l=await on(e,d,i);return e.desk.record(l?{...o,outcome:"failed",failed:l}:{...o,outcome:"drawn",accepted:[t.id],panel:d}),l}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...o,outcome:"accepted",accepted:[t.id]})}async function Yn(e,n){if(n.ask.kind==="ask")return ce(e.desk,{target:n.target,asked:n.ask.said}),null;let t=n.ask.kind==="panel"||n.ask.kind==="record"?n.ask.kind:"fill";return re(e,t,n.target,n.ask.said)}var G={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},ke={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function Xn({target:e,close:n}){let t=We(),i=(0,I.useMemo)(()=>Ge(e,u=>t.store.graph.has(u)),[e,t.store]),o=(0,I.useMemo)(()=>{let u=tn(t,i);return ye(t.store,i,{principal:t.principal,places:t.places,...u.acts?{acts:u.acts}:{}})},[t,i]),s=o.candidates.some(u=>u.type==="fill"),c=o.candidates.some(u=>u.type==="panel"),d=(0,I.useMemo)(()=>c?ze(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[c,t,i]),l=(0,I.useMemo)(()=>new Set(t.store.allMutations().filter(u=>(u.creates??[]).length>0).map(u=>u.name)),[t.store]),p=B(t.ai)!==void 0&&o.candidates.some(u=>u.type==="act"&&u.asks.length>0&&l.has(u.mutation)),a=we(t.ai),f=Cn(t,i),h=JSON.stringify(i),[b,P]=(0,I.useState)(!1),[S,m]=(0,I.useState)(null),[C,k]=(0,I.useState)(a&&f===void 0);(0,I.useEffect)(()=>{if(f!==void 0||!(a||b))return;let u=!0;return k(!0),$n(t,i).then(O=>{u&&(m(O),k(!1))}),()=>{u=!1}},[h,b]);let g=f??S,A=(g?.offers??[]).filter(u=>!(u.type==="place"&&d.some(O=>O.place===u.place))).slice(0,Math.max(0,3-d.length)),w=g?.interaction.outcome==="failed"?g.interaction.failed??"The AI could not suggest anything here.":null,M=(0,I.useRef)(!1),L=(0,I.useRef)(null);(0,I.useLayoutEffect)(()=>{g===null||!M.current||(M.current=!1,L.current?.querySelector("button")?.focus())},[g]);let J=(0,I.useRef)(!0);(0,I.useEffect)(()=>()=>{J.current=!1},[]);let[F,r]=(0,I.useState)(!1),[y,T]=(0,I.useState)(null),v=u=>{if(F)return;r(!0),T(null);let O=!1;u(()=>{O=!0,n()}).then(D=>{J.current&&(r(!1),D?T(D):O||n())},D=>{J.current&&(r(!1),T(D instanceof Error?D.message:String(D)))})},$=u=>u.interaction.outcome==="failed"?u.interaction.failed??"The AI could not do that here.":void 0;return(0,x.jsxs)("div",{ref:L,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[C&&!b?(0,x.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:ke,children:"Thinking\u2026"}):F?(0,x.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:ke,children:"Asking\u2026"}):y?(0,x.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...ke,color:"var(--graview-warn)"},children:y}):w?(0,x.jsx)("p",{role:"status",style:ke,children:w}):null,(0,x.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[A.map(u=>(0,x.jsx)("li",{children:(0,x.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${u.id}`,"data-ai-offer":u.id,"data-ai-offer-type":u.type,onClick:()=>v(O=>Pn(t,g,u,O)),style:G,children:[u.label,(0,x.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",u.type==="panel"?"a panel":u.type==="place"?"go there":u.type==="record"?"open it":"suggested"]})]})},u.id)),!a&&g===null?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":b||void 0,onClick:u=>{b||(M.current=document.activeElement===u.currentTarget,P(!0))},style:G,children:b?"Thinking\u2026":"Suggest\u2026"})}):null,s?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>v(async u=>$(await re(t,"fill",i,"Fill in",u))),style:G,children:"Fill in with AI"})}):null,p?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>v(async u=>$(await re(t,"record",i,"Add one",u))),style:G,children:"Add one with AI"})}):null,d.map(u=>(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":`ai-open:${u.place}`,"data-ai-existing":u.fit,onClick:()=>{n(),t.goTo.place(u.place),u.fit==="partial"&&ce(t.desk,{target:{on:"lens",place:u.place,...u.kind?{kind:u.kind}:{}}})},style:G,children:u.fit==="full"?`Open ${u.title}`:`Open and adjust ${u.title}`})},u.place)),c?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>v(async u=>$(await re(t,"panel",i,"Draw a panel",u))),style:G,children:d.length>0?"Draw a new view":"Draw a panel"})}):null,(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let u=document.activeElement;n(),ce(t.desk,{target:i,returnTo:u instanceof HTMLElement&&u!==document.body?u:null})},style:G,children:"Ask about this\u2026"})})]})]})}var be={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function Zn({placement:e="picture"}){let{store:n,principal:t,aiDesk:i}=Je(),o=Le(n,t),{ghost:s,entries:c}=He(i),[d,l]=(0,I.useState)(new Set);(0,I.useEffect)(()=>l(new Set),[s?.ghost.interaction]);let p=(0,I.useRef)(null),a=(0,I.useRef)(null),f=s?.batch;if((0,I.useEffect)(()=>{f!==void 0&&a.current?.focus()},[f]),!s)return null;let{ghost:h}=s,b=c.find(g=>g.id===h.interaction),P=()=>{let g=h.target.on==="record"||h.target.on==="field"?h.target.id:void 0,A=p.current?.closest("[data-graview-face], main")?.parentElement??document,w=(g?A.querySelector(`[data-graview-view="${CSS.escape(g)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??p.current?.closest("main")??document.querySelector("main");w&&!w.hasAttribute("tabindex")&&w.setAttribute("tabindex","-1"),w?.focus({preventScroll:!0}),i.setGhost(null)},S=h.proposals.filter(g=>!d.has(g.id)).map(g=>g.id),m=()=>{let g=Xe(o,h,{author:t,ids:S});if(!g.ok){i.setGhost({...s,refused:g.refused});return}b&&i.record(Ze(b,g.accepted,g.batch)),i.setGhost({ghost:h,batch:g.batch,took:g.accepted.length,...s.onCard?{onCard:!0}:{}})},C=()=>{b&&s.batch===void 0&&i.record(en(b)),P()},k=()=>{if(s.batch!==void 0)try{o.undo(s.batch,{author:t}),P()}catch(g){i.setGhost({...s,refused:g instanceof Error?g.message:String(g)})}};return(0,x.jsxs)("section",{ref:p,"data-testid":"ai-ghost","data-interaction":h.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:De("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,x.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:s.batch!==void 0?`Done: ${s.took===1?"one change":`${s.took} changes`}, as one.`:`Proposed by AI \xB7 ${h.basis}`}),s.batch===void 0?(0,x.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:h.proposals.map(g=>(0,x.jsx)("li",{"data-ghost-proposal":g.id,children:(0,x.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,x.jsx)("input",{type:"checkbox",checked:!d.has(g.id),onChange:A=>{let w=new Set(d);A.target.checked?w.delete(g.id):w.add(g.id),l(w)}}),(0,x.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:g.said}),g.confidence!==void 0?(0,x.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(g.confidence*100),"% sure"]}):null]})},g.id))}):null,s.refused?(0,x.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:s.refused}):null,(0,x.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.batch===void 0?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:S.length===0,onClick:m,style:be,children:S.length===h.proposals.length?"Accept":`Accept ${S.length} of ${h.proposals.length}`}),(0,x.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:C,style:be,children:"Dismiss"})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("button",{type:"button",ref:a,"data-testid":"ghost-undo",onClick:k,style:be,children:"Undo"}),(0,x.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:P,style:be,children:"Close"})]})})]})}export{Ge as a,V as b,ye as c,ze as d,ee as e,ve as f,hn as g,mn as h,Fn as i,Jn as j,tn as k,on as l,re as m,Cn as n,$n as o,Pn as p,Yn as q,Xn as r,Zn as s};
3
+ ${o}`)})}}if(e.turn){let t=e.turn;return{model:n,think:async({system:i,prompt:o})=>({text:await t({system:i,messages:[{role:"user",content:o}],tools:[],call:async()=>({error:"No tools here."})})})}}}var Te=(e,n,t)=>e?n/1e6*(e.inputPerMillion??0)+t/1e6*(e.outputPerMillion??0):void 0,ve=()=>`ai-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;function hn(e,n,t=[]){let i=o=>{let s=e.graph.getNode(o);return s?ae(e.schema.tryDefinition(s.kind),s):"a record"};switch(n.on){case"record":return i(n.id);case"field":return`${i(n.id)} \xB7 ${n.field}`;case"selection":return`${n.ids.length} records`;case"list":return e.schema.tryDefinition(n.kind)?q(e.schema,n.kind):n.kind;case"lens":case"place":return t.find(o=>o.as===n.place)?.title??(n.place==="home"?"Home":n.place);case"act":return n.act}}var _e=e=>e.type!=="act"||e.asks.length===0,me=(e,n)=>({id:e.id,type:e.type,label:e.label,...n!==void 0?{confidence:n}:{}});function Q(e,n){let t=n.interaction??ve(),i=ye(n.store,n.target,{principal:n.principal,...n.acts?{acts:n.acts}:{},...n.places?{places:n.places}:{}}),o=qe(n.store,n.target,{principal:n.principal,...n.place?{place:n.place}:{},...n.selection?{selection:n.selection}:{}}),s=[];return{id:t,catalog:i,state:o,entry:{id:t,at:new Date().toISOString(),by:n.by??n.principal,target:n.target,targetLabel:hn(n.store,n.target,n.places)},usage:s,meter:c=>{s.push(c),e.meter?.({...c,interaction:t})}}}async function ne(e,n,t,i){let o=await e.decide(n,t),{inputTokens:s,outputTokens:c}=o.usage,d=Te(e.price,s,c);return i({tier:"fast",model:e.model,inputTokens:s,outputTokens:c,...d!==void 0?{costUsd:d}:{}}),o.answers}async function te(e,n,t,i,o){let s=await e.think({system:n,prompt:t,state:i.state,catalog:i.catalog}),c=s.usage?.inputTokens,d=s.usage?.outputTokens,l=s.usage?.costUsd??(c!==void 0?Te(e.price,c,d??0):void 0);return o({tier:"thinking",model:e.model,...c!==void 0?{inputTokens:c}:{},...d!==void 0?{outputTokens:d}:{},...l!==void 0?{costUsd:l}:{}}),Be(s.text)}function ie(e,n){let t=new Map(e.map((i,o)=>[`c${o+1}`,i]));return{question:{type:"choice",instructions:n,criteria:Object.fromEntries([...t].map(([i,o])=>[i,`${o.label} \u2014 ${o.description}`]))},of:i=>t.get(i)}}function oe(e,n,t){if(e?.type!=="choice")return[];let i=e,o=Object.entries(i.probabilities).sort((s,c)=>c[1]-s[1]);return o.some(([s])=>s===i.choice)||o.unshift([i.choice,i.confidence]),o.flatMap(([s,c])=>{let d=n(s);return d?[{candidate:d,confidence:c}]:[]}).slice(0,t)}var E=(e,n,t,i)=>({interaction:{...e.entry,ask:{kind:t,said:n??""},offered:[],outcome:"failed",failed:i,usage:[...e.usage]},offers:[]}),Y="AI isn't on here.";async function Ke(e,n,t=3){let i=Q(e,n),o=n.said??"Suggest",s=i.catalog.candidates.filter(_e).slice(0,24);if(s.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let c=ee(e),d=B(e),l=[];try{if(c){let{question:p,of:a}=ie(s,"Which of these would the person most likely want to do next, here?"),f=await ne(c,{...i.state,candidates:s.map(h=>({id:h.id,type:h.type,says:h.description}))},{next:p},i.meter);l=oe(f.next,a,t)}else if(d){let p=await te(d,'You suggest what a person most likely wants to do next in an app. Answer only JSON: {"pick": [candidate ids, best first]}. Pick only ids from the candidates.',JSON.stringify({state:i.state,candidates:s.map(f=>({id:f.id,says:f.description}))}),i,i.meter);l=(Array.isArray(p?.pick)?p.pick.filter(f=>typeof f=="string"):[]).flatMap(f=>s.filter(h=>h.id===f)).slice(0,t).map(f=>({candidate:f}))}else return E(i,o,"suggest",Y)}catch(p){return E(i,o,"suggest",p instanceof Error?p.message:String(p))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:l.map(({candidate:p,confidence:a})=>me(p,a)),outcome:"offered",usage:[...i.usage]},offers:l.map(({candidate:p})=>p)}}var mn=e=>`several:${e}`;async function Fn(e,n,t=2){let i=Q(e,{...n,acts:[]}),o=n.said??"Suggest for the chosen",s=n.target.on==="selection"?n.target.ids.length:1,d=[...n.shared.map(a=>({type:"act",id:mn(a.id),label:a.label,description:`${a.label}, for all ${s} chosen`,mutation:a.mutation,args:a.args,asks:[]})),...i.catalog.candidates.filter(a=>a.type==="panel"||a.type==="place")].slice(0,24),l=ee(e);if(!l)return E(i,o,"suggest",Y);if(d.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let p;try{let{question:a,of:f}=ie(d,`Which of these would the person most likely want to do next with the ${s} records they chose together?`),h=await ne(l,{...i.state,candidates:d.map(b=>({id:b.id,type:b.type,says:b.description}))},{next:a},i.meter);p=oe(h.next,f,t).filter((b,P)=>P===0||b.confidence>=kn)}catch(a){return E(i,o,"suggest",a instanceof Error?a.message:String(a))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:p.map(({candidate:a,confidence:f})=>me(a,f)),outcome:"offered",usage:[...i.usage]},offers:p.map(({candidate:a})=>a)}}var kn=.25;async function Ve(e,n){let t=Q(e,n),i=n.said??"Fill in",o=t.catalog.candidates.filter(f=>f.type==="fill"),s=new Map;for(let f of o)s.set(f.field,[...s.get(f.field)??[],f]);if(s.size===0)return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:[],outcome:"offered",usage:[]},offers:[]};let c=ee(e),d=B(e),l=[];try{if(c){let f=[...s].map(([b,P],S)=>({key:`f${S+1}`,field:b,...ie(P,`Which value fits "${b}" best for this record?`)})),h=await ne(c,t.state,Object.fromEntries(f.map(b=>[b.key,b.question])),t.meter);for(let b of f){let P=!bn(n.store,n.target,b.field)&&An(n.store,n.target,b.field)!=="one";l.push(...oe(h[b.key],b.of,P?3:1).filter((S,m)=>m===0||S.confidence>=.4))}}else if(d){let f=await te(d,`You fill in a record's fields in an app. Answer only JSON: {"fills": [candidate ids]}, at most one per field, only ids from the candidates.`,JSON.stringify({state:t.state,candidates:o.map(P=>({id:P.id,says:P.description}))}),t,t.meter),h=Array.isArray(f?.fills)?f.fills.filter(P=>typeof P=="string"):[],b=new Set;for(let P of h){let S=o.find(m=>m.id===P);S?.type==="fill"&&!b.has(S.field)&&(b.add(S.field),l.push({candidate:S}))}}else return E(t,i,"fill",Y)}catch(f){return E(t,i,"fill",f instanceof Error?f.message:String(f))}let p=t.usage.at(-1)?.model,a=se(n.store,{interaction:t.id,target:n.target,basis:i,...p?{model:p}:{},proposals:l.flatMap(({candidate:f,confidence:h})=>f.type==="fill"?[{id:f.id,label:f.label,said:f.description,call:f.call,record:f.record,field:f.field,...h!==void 0?{confidence:h}:{}}]:[])},n.principal);return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:a.proposals.map(f=>({id:f.id,type:"fill",label:f.label,...f.confidence!==void 0?{confidence:f.confidence}:{}})),outcome:"offered",usage:[...t.usage]},offers:[],...a.proposals.length>0?{ghost:a}:{}}}function bn(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0,s=(o?e.schema.tryDefinition(o)?.fields?.shape:void 0)??{};return t in s}function An(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0;return o?e.schema.tryDefinition(o)?.edges?.[t]?.cardinality:void 0}async function Qe(e,n){let t=Q(e,n),i=n.said??"Add one",o=new Set(n.store.allMutations().filter(a=>(a.creates??[]).length>0).map(a=>a.name)),s=t.catalog.candidates.filter(a=>a.type==="act"&&a.asks.length>0&&o.has(a.mutation));if(s.length===0)return E(t,i,"record","Nothing here makes a record.");let c=B(e);if(!c)return E(t,i,"record",Y);let d;try{let a=await te(c,'You propose one new record for an app by filling in an act. Answer only JSON: {"act": a candidate id, "args": {argument: value}}. Use only the candidates, and fill every argument the act asks for with a value that fits the state.',JSON.stringify({ask:i,state:t.state,candidates:s.map(b=>({id:b.id,says:b.description,asks:b.asks}))}),t,t.meter),f=s.find(b=>b.id===a?.act),h=typeof a?.args=="object"&&a.args!==null?a.args:{};f&&(d={act:f,args:Object.fromEntries(Object.entries(h).filter(([b])=>f.asks.includes(b)))})}catch(a){return E(t,i,"record",a instanceof Error?a.message:String(a))}if(!d)return E(t,i,"record","The model named no act this app has here.");let l=t.usage.at(-1)?.model,p=se(n.store,{interaction:t.id,target:n.target,basis:i,...l?{model:l}:{},proposals:[{id:d.act.id,label:d.act.label,said:d.act.description,call:{name:d.act.mutation,args:{...d.act.args,...d.args}}}]},n.principal);return p.proposals.length===0?E(t,i,"record","What the model proposed could not be made here."):{interaction:{...t.entry,ask:{kind:"record",said:i},offered:p.proposals.map(a=>({id:a.id,type:"act",label:a.said})),outcome:"offered",usage:[...t.usage]},offers:[d.act],ghost:p}}async function Ye(e,n){let t=Q(e,n),i=n.said??"Make a panel",o=t.catalog.candidates.filter(a=>a.type==="panel");if(o.length===0)return E(t,i,"panel","Nothing here can be drawn as a panel.");let s=ee(e),c=B(e),d;try{if(c){let a=await te(c,'You choose a panel to draw in an app. Answer only JSON: {"panel": a candidate id, "title": a short title}. Choose only among the candidates.',JSON.stringify({ask:i,state:t.state,candidates:o.map(h=>({id:h.id,says:h.description}))}),t,t.meter),f=o.find(h=>h.id===a?.panel);f&&(d={panel:f,...typeof a?.title=="string"&&a.title.trim()?{title:a.title.trim().slice(0,60)}:{}})}else if(s){let{question:a,of:f}=ie(o,`Which panel answers this best: ${i}`),h=oe((await ne(s,t.state,{panel:a},t.meter)).panel,f,1)[0];h?.candidate.type==="panel"&&(d={panel:h.candidate,confidence:h.confidence})}else return E(t,i,"panel",Y)}catch(a){return E(t,i,"panel",a instanceof Error?a.message:String(a))}if(!d)return E(t,i,"panel","The model named no panel this app can draw.");let l=d.title??d.panel.label,p={title:l,recipe:{...d.panel.panel,title:l}};return{interaction:{...t.entry,ask:{kind:"panel",said:i},offered:[me(d.panel,d.confidence)],outcome:"drawn",panel:p,usage:[...t.usage]},offers:[d.panel],panel:p}}function Sn(e){return e.off?void 0:e.answer}var wn=`You answer a person's question about what they are looking at in an app, from the state given and nothing else. Answer only JSON: {"answer": one to three short sentences, "pick": [candidate ids that act on the answer, best first, at most three]}. Pick only ids from the candidates, and none when nothing fits. Never say an id to the person.`;async function Jn(e,n){let t=Q(e,n),i=n.said.trim(),o=t.catalog.candidates.filter(m=>_e(m)||m.type==="panel"||m.type==="place"||m.type==="record").slice(0,32),s=Sn(e),c=B(e),d=ee(e),l="",p=[],a=m=>m.flatMap(C=>o.filter(k=>k.id===C)).slice(0,3).map(C=>({candidate:C}));try{if(s){let m=await s.answer({said:i,target:n.target,targetLabel:t.entry.targetLabel,state:t.state,catalog:{target:t.catalog.target,candidates:o},...n.follows?{follows:n.follows}:{}}),C=m.usage?.inputTokens,k=m.usage?.outputTokens,g=m.usage?.costUsd??(C!==void 0?Te(s.price,C,k??0):void 0);t.meter({tier:"thinking",model:s.model,...C!==void 0?{inputTokens:C}:{},...k!==void 0?{outputTokens:k}:{},...g!==void 0?{costUsd:g}:{}}),l=typeof m.text=="string"?m.text.trim():"",p=a(m.pick??[])}else if(c){let m=await te(c,wn,JSON.stringify({ask:i,about:t.entry.targetLabel,...n.follows?{follows:n.follows}:{},state:t.state,candidates:o.map(C=>({id:C.id,says:C.description}))}),t,t.meter);l=typeof m?.answer=="string"?m.answer.trim():"",p=a(Array.isArray(m?.pick)?m.pick:[])}else if(d&&o.length>0){let{question:m,of:C}=ie(o,`Which of these best answers, or acts on: ${i}`),k=await ne(d,{...t.state,asked:i,candidates:o.map(g=>({id:g.id,type:g.type,says:g.description}))},{answer:m},t.meter);p=oe(k.answer,C,3),l=p.length>0?`These fit \u201C${i}\u201D.`:""}else return E(t,i,"ask",Y)}catch(m){return E(t,i,"ask",m instanceof Error?m.message:String(m))}if(!l&&p.length===0)return E(t,i,"ask","The AI had no answer to that here.");let f=t.usage.at(-1)?.model,h=p.flatMap(({candidate:m,confidence:C})=>{let k=he(m);return k?[{...k,...C!==void 0?{confidence:C}:{}}]:[]}),b=h.length>0?se(n.store,{interaction:t.id,target:n.target,basis:i,...f?{model:f}:{},proposals:h},n.principal):void 0,P=p.map(({candidate:m})=>m).filter(m=>he(m)===void 0),S=[...P.map(m=>me(m,p.find(C=>C.candidate===m)?.confidence)),...(b?.proposals??[]).map(m=>({id:m.id,type:m.field!==void 0?"fill":"act",label:m.label,...m.confidence!==void 0?{confidence:m.confidence}:{}}))];return{interaction:{...t.entry,ask:{kind:"ask",said:i},offered:S,outcome:"offered",...l?{answer:l}:{},usage:[...t.usage]},offers:P,...b&&b.proposals.length>0?{ghost:b}:{},...l?{answer:l}:{}}}function se(e,n,t){let i=n.proposals.flatMap(o=>{try{let s=e.previewAll([o.call],{author:t}),c=s.ops.map(d=>d.intent).join("; ");return s.ops.length>0?[{...o,said:c||o.said}]:[]}catch{return[]}});return{...n,proposals:i}}function he(e){if(e.type==="fill")return{id:e.id,label:e.label,said:e.description,call:e.call,record:e.record,field:e.field};if(e.type==="act"&&e.asks.length===0)return{id:e.id,label:e.label,said:e.description,call:{name:e.mutation,args:{...e.args}}}}function Xe(e,n,t){let i=n.proposals.filter(s=>t.ids===void 0||t.ids.includes(s.id));if(i.length===0)return{ok:!1,refused:"Nothing was chosen."};let o=i.flatMap(s=>s.confidence===void 0?[]:[s.confidence]);try{let c=e.applyAll(i.map(d=>d.call),{author:t.author,via:`ai:${n.interaction}`,intent:n.basis,lineage:{basis:`Asked \u201C${n.basis}\u201D`,...n.model?{model:n.model}:{},...o.length>0?{confidence:Math.min(...o)}:{},interaction:n.interaction}}).ops[0]?.batch;return c?{ok:!0,batch:c,accepted:i.map(d=>d.id)}:{ok:!1,refused:"That changes nothing now."}}catch(s){return{ok:!1,refused:s instanceof Error?s.message:String(s)}}}function Ze(e,n,t){let i=e.ask.kind==="suggest"?n.length>0:e.offered.length>0&&e.offered.every(o=>n.includes(o.id));return{...e,outcome:i?"accepted":"partly",accepted:n,batches:[...e.batches??[],t]}}var en=e=>({...e,outcome:"dismissed"});var I=Se(ln(),1);var x=Se(Fe(),1);function tn(e,n,t){let i=n.on==="selection"?n.ids:n.on==="record"||n.on==="field"?[n.id]:[],o=i.length>0?Ue(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(s=>({mutation:s.mutation,label:s.label,args:s.args,open:s.open,why:s.why,...s.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:n,principal:e.principal,interaction:ve(),places:e.places,selection:e.selection,...o?{acts:o}:{},...e.place?{place:e.place}:{},...t?{said:t}:{}}}async function on(e,n,t){let i=await (__graviewPreload(import.meta.url,["./chunk.JDRLSVOI.js","./chunk.G4JJXA63.js","./chunk.VJXXCUKS.js","./chunk.Z5AB2DBF.js","./chunk.HPAGOEZG.js","./chunk.ISXFH3CK.js","./chunk.Q5WEOX3Q.js","./chunk.242EUAPE.js","./chunk.VDAMCTNL.js","./chunk.BXT6FDT4.js","./chunk.WVUJXDXZ.js","./chunk.N6MVK3KD.js","./chunk.I7XSDXQ3.js","./chunk.UHI3D7JC.js","./chunk.WVDKYUF3.js","./chunk.ZHLQWMV5.js","./chunk.TNESS3LQ.js","./chunk.2FLPDPEL.js","./chunk.UUBYFBPN.js","./chunk.2RVUDRRY.js","./chunk.V5MYKNL7.js","./chunk.AJZBJBMO.js"]),import("./chunk.J4IULZFD.js")),o=i.recipeDraft(n.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(o))return o.failed;t?.(),e.seatTalk.setDraft(o,null),e.goTo.draft?.(),sn()}function sn(e=180){if(typeof document>"u")return;let n=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(n){i&&n.focus();return}e>0&&requestAnimationFrame(()=>sn(e-1))}async function re(e,n,t,i,o){let s=tn(e,t,i),c=n==="suggest"?await Ke(e.ai,s):n==="fill"?await Ve(e.ai,s):n==="record"?await Qe(e.ai,s):await Ye(e.ai,s);if(c.interaction.outcome==="failed")return n!=="suggest"&&e.desk.record(c.interaction),c;let d=l=>{let p={...c.interaction,outcome:"failed",failed:l};return e.desk.record(p),{...c,interaction:p}};if(n==="fill"||n==="record"){if(!c.ghost||c.ghost.proposals.length===0)return d("Nothing here could be filled in.");o?.(),e.desk.setGhost({ghost:c.ghost}),e.desk.record(c.interaction)}if(n==="panel"&&c.panel){let l=await on(e,c.panel,o);if(l)return d(l);e.desk.record(c.interaction)}return c}var Ie=new WeakMap,xn=64,nn=new WeakMap;function On(e){let n=nn.get(e);if(!n){let t=n={n:0};nn.set(e,t),e.subscribe(()=>void(t.n+=1))}return n.n}var rn=(e,n)=>{let t=V(n);return t.length>0?t.map(i=>e.graph.getNode(i)):[On(e)]},an=(e,n,t)=>JSON.stringify({target:n,seat:e.principal,by:t}),dn=(e,n,t)=>{let i=rn(e.store,n);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((o,s)=>o===t.depends[s])};function Cn(e,n,t="menu"){let i=Ie.get(e.store)?.get(an(e,n,t));return i?.result!==void 0&&dn(e,n,i)?i.result:void 0}function $n(e,n,t){let i=Ie.get(e.store);i||Ie.set(e.store,i=new Map);let o=an(e,n,t?.by??"menu"),s=i.get(o);if(s&&dn(e,n,s))return s.result?Promise.resolve(s.result):s.asked;let c=t?t.ask():re(e,"suggest",n),d={schema:e.store.schema,ai:e.ai,depends:rn(e.store,n),asked:c};i.delete(o),i.set(o,d),i.size>xn&&i.delete(i.keys().next().value);let l=i;return c.then(p=>{p.interaction.outcome!=="failed"?d.result=p:l.get(o)===d&&l.delete(o)}),c}async function Pn(e,n,t,i){let o=n.interaction,s=he(t);if(s){let c=o.usage?.at(-1)?.model,d=o.offered.find(p=>p.id===t.id)?.confidence,l=se(e.store,{interaction:o.id,target:o.target,basis:`${o.ask.said}: ${t.label}`,...c?{model:c}:{},proposals:[{...s,...d!==void 0?{confidence:d}:{}}]},e.principal);if(l.proposals.length===0){let p="That can't be done now.";return e.desk.record({...o,outcome:"failed",failed:p}),p}i?.(),e.desk.setGhost({ghost:l}),e.desk.record(o);return}if(t.type==="panel"){let c=t.label,d={title:c,recipe:{...t.panel,title:c}},l=await on(e,d,i);return e.desk.record(l?{...o,outcome:"failed",failed:l}:{...o,outcome:"drawn",accepted:[t.id],panel:d}),l}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...o,outcome:"accepted",accepted:[t.id]})}async function Yn(e,n){if(n.ask.kind==="ask")return ce(e.desk,{target:n.target,asked:n.ask.said}),null;let t=n.ask.kind==="panel"||n.ask.kind==="record"?n.ask.kind:"fill";return re(e,t,n.target,n.ask.said)}var G={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},ke={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function Xn({target:e,close:n}){let t=We(),i=(0,I.useMemo)(()=>Ge(e,u=>t.store.graph.has(u)),[e,t.store]),o=(0,I.useMemo)(()=>{let u=tn(t,i);return ye(t.store,i,{principal:t.principal,places:t.places,...u.acts?{acts:u.acts}:{}})},[t,i]),s=o.candidates.some(u=>u.type==="fill"),c=o.candidates.some(u=>u.type==="panel"),d=(0,I.useMemo)(()=>c?ze(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[c,t,i]),l=(0,I.useMemo)(()=>new Set(t.store.allMutations().filter(u=>(u.creates??[]).length>0).map(u=>u.name)),[t.store]),p=B(t.ai)!==void 0&&o.candidates.some(u=>u.type==="act"&&u.asks.length>0&&l.has(u.mutation)),a=we(t.ai),f=Cn(t,i),h=JSON.stringify(i),[b,P]=(0,I.useState)(!1),[S,m]=(0,I.useState)(null),[C,k]=(0,I.useState)(a&&f===void 0);(0,I.useEffect)(()=>{if(f!==void 0||!(a||b))return;let u=!0;return k(!0),$n(t,i).then(O=>{u&&(m(O),k(!1))}),()=>{u=!1}},[h,b]);let g=f??S,A=(g?.offers??[]).filter(u=>!(u.type==="place"&&d.some(O=>O.place===u.place))).slice(0,Math.max(0,3-d.length)),w=g?.interaction.outcome==="failed"?g.interaction.failed??"The AI could not suggest anything here.":null,M=(0,I.useRef)(!1),L=(0,I.useRef)(null);(0,I.useLayoutEffect)(()=>{g===null||!M.current||(M.current=!1,L.current?.querySelector("button")?.focus())},[g]);let J=(0,I.useRef)(!0);(0,I.useEffect)(()=>()=>{J.current=!1},[]);let[F,r]=(0,I.useState)(!1),[y,T]=(0,I.useState)(null),v=u=>{if(F)return;r(!0),T(null);let O=!1;u(()=>{O=!0,n()}).then(D=>{J.current&&(r(!1),D?T(D):O||n())},D=>{J.current&&(r(!1),T(D instanceof Error?D.message:String(D)))})},$=u=>u.interaction.outcome==="failed"?u.interaction.failed??"The AI could not do that here.":void 0;return(0,x.jsxs)("div",{ref:L,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[C&&!b?(0,x.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:ke,children:"Thinking\u2026"}):F?(0,x.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:ke,children:"Asking\u2026"}):y?(0,x.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...ke,color:"var(--graview-warn)"},children:y}):w?(0,x.jsx)("p",{role:"status",style:ke,children:w}):null,(0,x.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[A.map(u=>(0,x.jsx)("li",{children:(0,x.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${u.id}`,"data-ai-offer":u.id,"data-ai-offer-type":u.type,onClick:()=>v(O=>Pn(t,g,u,O)),style:G,children:[u.label,(0,x.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",u.type==="panel"?"a panel":u.type==="place"?"go there":u.type==="record"?"open it":"suggested"]})]})},u.id)),!a&&g===null?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":b||void 0,onClick:u=>{b||(M.current=document.activeElement===u.currentTarget,P(!0))},style:G,children:b?"Thinking\u2026":"Suggest\u2026"})}):null,s?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>v(async u=>$(await re(t,"fill",i,"Fill in",u))),style:G,children:"Fill in with AI"})}):null,p?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>v(async u=>$(await re(t,"record",i,"Add one",u))),style:G,children:"Add one with AI"})}):null,d.map(u=>(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":`ai-open:${u.place}`,"data-ai-existing":u.fit,onClick:()=>{n(),t.goTo.place(u.place),u.fit==="partial"&&ce(t.desk,{target:{on:"lens",place:u.place,...u.kind?{kind:u.kind}:{}}})},style:G,children:u.fit==="full"?`Open ${u.title}`:`Open and adjust ${u.title}`})},u.place)),c?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>v(async u=>$(await re(t,"panel",i,"Draw a panel",u))),style:G,children:d.length>0?"Draw a new view":"Draw a panel"})}):null,(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let u=document.activeElement;n(),ce(t.desk,{target:i,returnTo:u instanceof HTMLElement&&u!==document.body?u:null})},style:G,children:"Ask about this\u2026"})})]})]})}var be={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function Zn({placement:e="picture"}){let{store:n,principal:t,aiDesk:i}=Je(),o=Le(n,t),{ghost:s,entries:c}=He(i),[d,l]=(0,I.useState)(new Set);(0,I.useEffect)(()=>l(new Set),[s?.ghost.interaction]);let p=(0,I.useRef)(null),a=(0,I.useRef)(null),f=s?.batch;if((0,I.useEffect)(()=>{f!==void 0&&a.current?.focus()},[f]),!s)return null;let{ghost:h}=s,b=c.find(g=>g.id===h.interaction),P=()=>{let g=h.target.on==="record"||h.target.on==="field"?h.target.id:void 0,A=p.current?.closest("[data-graview-face], main")?.parentElement??document,w=(g?A.querySelector(`[data-graview-view="${CSS.escape(g)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??p.current?.closest("main")??document.querySelector("main");w&&!w.hasAttribute("tabindex")&&w.setAttribute("tabindex","-1"),w?.focus({preventScroll:!0}),i.setGhost(null)},S=h.proposals.filter(g=>!d.has(g.id)).map(g=>g.id),m=()=>{let g=Xe(o,h,{author:t,ids:S});if(!g.ok){i.setGhost({...s,refused:g.refused});return}b&&i.record(Ze(b,g.accepted,g.batch)),i.setGhost({ghost:h,batch:g.batch,took:g.accepted.length,...s.onCard?{onCard:!0}:{}})},C=()=>{b&&s.batch===void 0&&i.record(en(b)),P()},k=()=>{if(s.batch!==void 0)try{o.undo(s.batch,{author:t}),P()}catch(g){i.setGhost({...s,refused:g instanceof Error?g.message:String(g)})}};return(0,x.jsxs)("section",{ref:p,"data-testid":"ai-ghost","data-interaction":h.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:De("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,x.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:s.batch!==void 0?`Done: ${s.took===1?"one change":`${s.took} changes`}, as one.`:`Proposed by AI \xB7 ${h.basis}`}),s.batch===void 0?(0,x.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:h.proposals.map(g=>(0,x.jsx)("li",{"data-ghost-proposal":g.id,children:(0,x.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,x.jsx)("input",{type:"checkbox",checked:!d.has(g.id),onChange:A=>{let w=new Set(d);A.target.checked?w.delete(g.id):w.add(g.id),l(w)}}),(0,x.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:g.said}),g.confidence!==void 0?(0,x.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(g.confidence*100),"% sure"]}):null]})},g.id))}):null,s.refused?(0,x.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:s.refused}):null,(0,x.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.batch===void 0?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:S.length===0,onClick:m,style:be,children:S.length===h.proposals.length?"Accept":`Accept ${S.length} of ${h.proposals.length}`}),(0,x.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:C,style:be,children:"Dismiss"})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("button",{type:"button",ref:a,"data-testid":"ghost-undo",onClick:k,style:be,children:"Undo"}),(0,x.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:P,style:be,children:"Close"})]})})]})}export{Ge as a,V as b,ye as c,ze as d,ee as e,ve as f,hn as g,mn as h,Fn as i,Jn as j,tn as k,on as l,re as m,Cn as n,$n as o,Pn as p,Yn as q,Xn as r,Zn as s};
@@ -0,0 +1 @@
1
+ import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n,m as o,n as p}from"./chunk.6YPLZNVT.js";import{a,b}from"./chunk.5RABSIF7.js";import"./chunk.NGDXH66B.js";import"./chunk.67WWRC6Y.js";import"./chunk.2FLPDPEL.js";import"./chunk.UUBYFBPN.js";import"./chunk.2RVUDRRY.js";import"./chunk.JHEVGLKB.js";import"./chunk.FOQZADMA.js";import"./chunk.SDO3U72B.js";import"./chunk.V5MYKNL7.js";import"./chunk.AJZBJBMO.js";export{j as ARRANGE_NARROW,o as ArrangeBar,e as CHIP_FIELDS,d as MANY_AT_THE_FAR_END,c as TYPED_FROM,p as arrangementCaption,a as arrangementOf,i as chipOffers,m as directionWords,g as farCount,f as farCounts,l as inSentence,h as offeredFilters,n as preloadArrangeLists,k as sayCondition,b as withArrangement};
@@ -5,59 +5,61 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <title>Graview preview</title>
7
7
  <link rel="preload" href="/graview/document" as="fetch" crossorigin="anonymous">
8
- <link rel="modulepreload" href="/chunk.5JPRFXYQ.js">
9
- <link rel="modulepreload" href="/chunk.HGS32FT2.js">
8
+ <link rel="modulepreload" href="/chunk.L4STJLUV.js">
9
+ <link rel="modulepreload" href="/chunk.MUKDKVVC.js">
10
10
  <link rel="modulepreload" href="/chunk.Q5WEOX3Q.js">
11
- <link rel="modulepreload" href="/chunk.DYNBWIPF.js">
12
- <link rel="modulepreload" href="/chunk.6DHHUBSC.js">
13
- <link rel="modulepreload" href="/chunk.ORXFUK6F.js">
14
- <link rel="modulepreload" href="/chunk.BTSXYZ6Z.js">
11
+ <link rel="modulepreload" href="/chunk.VDAMCTNL.js">
12
+ <link rel="modulepreload" href="/chunk.TNESS3LQ.js">
13
+ <link rel="modulepreload" href="/chunk.JHEVGLKB.js">
14
+ <link rel="modulepreload" href="/chunk.FOQZADMA.js">
15
15
  <link rel="modulepreload" href="/chunk.SDO3U72B.js">
16
- <link rel="modulepreload" href="/chunk.5ZMENPY4.js">
16
+ <link rel="modulepreload" href="/chunk.V5MYKNL7.js">
17
17
  <link rel="modulepreload" href="/chunk.AJZBJBMO.js">
18
- <link rel="modulepreload" href="/chunk.2HF54MYG.js">
19
- <link rel="modulepreload" href="/chunk.L7DQKPJV.js">
20
- <link rel="modulepreload" href="/chunk.546WEHEX.js">
21
- <link rel="modulepreload" href="/chunk.BZSU4HH2.js">
18
+ <link rel="modulepreload" href="/chunk.T3BWINOF.js">
19
+ <link rel="modulepreload" href="/chunk.HPUN5DKZ.js">
20
+ <link rel="modulepreload" href="/chunk.MUPO5S2A.js">
21
+ <link rel="modulepreload" href="/chunk.JYJ4LZJJ.js">
22
22
  <link rel="modulepreload" href="/chunk.UGFDSE37.js">
23
- <link rel="modulepreload" href="/chunk.P5325GYR.js">
24
- <link rel="modulepreload" href="/chunk.QEXXLWEU.js">
25
- <link rel="modulepreload" href="/chunk.BEC5ZH2L.js">
26
- <link rel="modulepreload" href="/chunk.6HBEYRJU.js">
27
- <link rel="modulepreload" href="/chunk.U7QMA4H7.js">
28
- <link rel="modulepreload" href="/chunk.GP2F7TIN.js">
29
- <link rel="modulepreload" href="/chunk.C6X7CKU6.js">
23
+ <link rel="modulepreload" href="/chunk.USZPOOLZ.js">
24
+ <link rel="modulepreload" href="/chunk.C4TSM4W5.js">
25
+ <link rel="modulepreload" href="/chunk.XEKLEHC3.js">
26
+ <link rel="modulepreload" href="/chunk.53CDFJNM.js">
27
+ <link rel="modulepreload" href="/chunk.4QPVS2ZM.js">
28
+ <link rel="modulepreload" href="/chunk.RCM7NOPF.js">
29
+ <link rel="modulepreload" href="/chunk.Z7LDT55A.js">
30
30
  <link rel="modulepreload" href="/chunk.PXQVXBNG.js">
31
- <link rel="modulepreload" href="/chunk.6CFP5UYP.js">
32
- <link rel="modulepreload" href="/chunk.CAMQ7MYJ.js">
33
- <link rel="modulepreload" href="/chunk.2GGDOFTF.js">
34
- <link rel="modulepreload" href="/chunk.ZTMDU3OH.js">
35
- <link rel="modulepreload" href="/chunk.HFDYFPMJ.js">
36
- <link rel="modulepreload" href="/chunk.RWB4235L.js">
37
- <link rel="modulepreload" href="/chunk.CTK2P4JV.js">
38
- <link rel="modulepreload" href="/chunk.GXKECZ4S.js">
39
- <link rel="modulepreload" href="/chunk.6XU2CXRZ.js">
40
- <link rel="modulepreload" href="/chunk.3ZNQ5YKX.js">
41
- <link rel="modulepreload" href="/chunk.7EFNLMKU.js">
42
- <link rel="modulepreload" href="/chunk.J3M2MZHG.js">
31
+ <link rel="modulepreload" href="/chunk.BQRAIU5R.js">
32
+ <link rel="modulepreload" href="/chunk.57R2GXXN.js">
33
+ <link rel="modulepreload" href="/chunk.BFNVG5JE.js">
34
+ <link rel="modulepreload" href="/chunk.AIZQBPGU.js">
35
+ <link rel="modulepreload" href="/chunk.V3V47QRE.js">
36
+ <link rel="modulepreload" href="/chunk.5P556A7W.js">
37
+ <link rel="modulepreload" href="/chunk.QHYXXZRD.js">
38
+ <link rel="modulepreload" href="/chunk.BELCPW66.js">
39
+ <link rel="modulepreload" href="/chunk.6YPLZNVT.js">
40
+ <link rel="modulepreload" href="/chunk.5RABSIF7.js">
41
+ <link rel="modulepreload" href="/chunk.NGDXH66B.js">
42
+ <link rel="modulepreload" href="/chunk.67WWRC6Y.js">
43
+ <link rel="modulepreload" href="/chunk.QIV65FWE.js">
43
44
  <link rel="modulepreload" href="/chunk.UT6642FC.js">
44
- <link rel="modulepreload" href="/chunk.FMN5XDLE.js">
45
+ <link rel="modulepreload" href="/chunk.ISXFH3CK.js">
45
46
  <link rel="modulepreload" href="/chunk.MB7LKKUD.js">
46
47
  <link rel="modulepreload" href="/chunk.WVUJXDXZ.js">
47
- <link rel="modulepreload" href="/chunk.KJNUZYXS.js">
48
- <link rel="modulepreload" href="/chunk.4BBJ62ZO.js">
49
- <link rel="modulepreload" href="/chunk.UCZR33MK.js">
50
- <link rel="modulepreload" href="/chunk.CC47O2DW.js">
51
- <link rel="modulepreload" href="/chunk.2IX3CZNP.js">
48
+ <link rel="modulepreload" href="/chunk.N6MVK3KD.js">
49
+ <link rel="modulepreload" href="/chunk.I7XSDXQ3.js">
50
+ <link rel="modulepreload" href="/chunk.UHI3D7JC.js">
51
+ <link rel="modulepreload" href="/chunk.WVDKYUF3.js">
52
+ <link rel="modulepreload" href="/chunk.ZHLQWMV5.js">
52
53
  <link rel="modulepreload" href="/chunk.GZHZLJBF.js">
53
- <link rel="modulepreload" href="/chunk.HHUCPVG5.js">
54
+ <link rel="modulepreload" href="/chunk.42XSBKPO.js">
54
55
  <link rel="modulepreload" href="/chunk.OJGHDWI6.js">
55
- <link rel="modulepreload" href="/chunk.WXYUWBKX.js">
56
- <link rel="modulepreload" href="/chunk.NSNGPQGT.js">
57
- <link rel="modulepreload" href="/chunk.H5CZZZLX.js">
58
- <link rel="modulepreload" href="/chunk.Z7JRBKA7.js">
59
- <link rel="modulepreload" href="/chunk.BS3FX4PX.js">
60
- <link rel="modulepreload" href="/chunk.LP3QUPCE.js">
56
+ <link rel="modulepreload" href="/chunk.6FNMDAX5.js">
57
+ <link rel="modulepreload" href="/chunk.2FLPDPEL.js">
58
+ <link rel="modulepreload" href="/chunk.UUBYFBPN.js">
59
+ <link rel="modulepreload" href="/chunk.2RVUDRRY.js">
60
+ <link rel="modulepreload" href="/chunk.OVTCW3AI.js">
61
+ <link rel="modulepreload" href="/chunk.BK6RWVRE.js">
62
+ <script>(()=>{const later=["/chunk.JLBGJSCZ.js","/chunk.PMGXASFI.js","/chunk.JACGQ2PR.js","/chunk.HJCQ6I3S.js","/chunk.VNUHESMZ.js","/chunk.N2K25KH3.js","/chunk.XFZKP4IF.js","/chunk.VJXXCUKS.js","/chunk.Z5AB2DBF.js","/chunk.BXT6FDT4.js","/chunk.SADG5RMV.js","/chunk.PMDNFN7Z.js","/chunk.WUKHYLQT.js","/chunk.M4T377LG.js","/chunk.AKQXF7GW.js","/chunk.C7JKMOFC.js","/chunk.TI4OSTQV.js","/chunk.UEXIKCLF.js"],first=[...document.querySelectorAll('link[rel="modulepreload"]')];let left=first.length;const go=()=>{for(const href of later){const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};if(left===0)return go();const one=()=>{if(--left===0)go()};for(const link of first){link.addEventListener("load",one,{once:true});link.addEventListener("error",one,{once:true})}})()</script>
61
63
  <style>html,body{margin:0;height:100%}#graview-app{min-height:100dvh}</style>
62
64
  </head>
63
65
  <body>