graview 0.1.50 → 0.1.51
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.
- package/dist/preview/{chunk.V5IWJ3ZV.js → chunk.2534FLZZ.js} +1 -1
- package/dist/preview/{chunk.QSZLY62B.js → chunk.2VJ52LGS.js} +1 -1
- package/dist/preview/{chunk.U2M4SGUU.js → chunk.2W2YVB6X.js} +1 -1
- package/dist/preview/{chunk.ECSWXLBI.js → chunk.2W45NM7Q.js} +2 -2
- package/dist/preview/chunk.32BOL7OL.js +1 -0
- package/dist/preview/chunk.34HGT7HQ.js +1 -0
- package/dist/preview/{chunk.YUV7HZYG.js → chunk.353CGK6C.js} +1 -1
- package/dist/preview/{chunk.64TFAR5Z.js → chunk.3H7YIKKC.js} +1 -1
- package/dist/preview/{chunk.Q7RI4SI4.js → chunk.3MU37W5D.js} +1 -1
- package/dist/preview/chunk.3SBTQ66X.js +1 -0
- package/dist/preview/{chunk.L5MDUZLQ.js → chunk.3TVAE7LE.js} +1 -1
- package/dist/preview/{chunk.ETX4QMM2.js → chunk.4EZFOZBA.js} +1 -1
- package/dist/preview/chunk.4N5R4K6O.js +1 -0
- package/dist/preview/{chunk.KGGWFL54.js → chunk.4T67XS2D.js} +1 -1
- package/dist/preview/chunk.5ON3JSAK.js +1 -0
- package/dist/preview/{chunk.YEKHDZ45.js → chunk.5ZAK57JA.js} +2 -2
- package/dist/preview/chunk.6KYWJXZR.js +1 -0
- package/dist/preview/{chunk.BJAQRV2R.js → chunk.76QSPWSJ.js} +1 -1
- package/dist/preview/{chunk.3SY6WWWQ.js → chunk.7G4M2PX3.js} +2 -2
- package/dist/preview/{chunk.XWLGHTH6.js → chunk.7GAC7U34.js} +1 -1
- package/dist/preview/{chunk.GDYI5QDS.js → chunk.7NQROWHU.js} +1 -1
- package/dist/preview/{chunk.LGHMUUTG.js → chunk.7RIFDWDF.js} +1 -1
- package/dist/preview/{chunk.MQISKON2.js → chunk.ACB4TD4W.js} +1 -1
- package/dist/preview/chunk.AJAMTRZ3.js +1 -0
- package/dist/preview/chunk.AL45OI4A.js +1 -0
- package/dist/preview/{chunk.WGRF6EHC.js → chunk.AL7LFNOS.js} +1 -1
- package/dist/preview/{chunk.ZBBCUK2K.js → chunk.ALCH5H7U.js} +1 -1
- package/dist/preview/{chunk.UOC3SIYT.js → chunk.APFRPN5S.js} +1 -1
- package/dist/preview/{chunk.ODHCSYXX.js → chunk.AZOW57MT.js} +1 -1
- package/dist/preview/chunk.B4PUI3GO.js +1 -0
- package/dist/preview/chunk.B6LKLV32.js +1 -0
- package/dist/preview/{chunk.UDTBFAS5.js → chunk.B7LBG4UP.js} +1 -1
- package/dist/preview/{chunk.YCJ74LZS.js → chunk.BV6HKTHK.js} +1 -1
- package/dist/preview/{chunk.UN2OB6OD.js → chunk.BYY7YXBI.js} +1 -1
- package/dist/preview/{chunk.7QW6JYGP.js → chunk.CI4DEKPX.js} +1 -1
- package/dist/preview/{chunk.ZOQ3OKKI.js → chunk.CMEETACI.js} +1 -1
- package/dist/preview/{chunk.O6SKKF4V.js → chunk.CQPNDJAC.js} +1 -1
- package/dist/preview/{chunk.FFPG4PHX.js → chunk.CTOBNZLM.js} +1 -1
- package/dist/preview/chunk.CUB4IAUJ.js +1 -0
- package/dist/preview/chunk.CUN4VN42.js +1 -0
- package/dist/preview/chunk.CV55N3Y6.js +1 -0
- package/dist/preview/{chunk.M55U47A6.js → chunk.CXC5FOIO.js} +1 -1
- package/dist/preview/{chunk.DUJUJN35.js → chunk.DEH6O3K4.js} +1 -1
- package/dist/preview/chunk.DQNN5FE5.js +1 -0
- package/dist/preview/{chunk.4SHSEIHT.js → chunk.DUY27OJV.js} +1 -1
- package/dist/preview/chunk.E2R6VFZX.js +1 -0
- package/dist/preview/{chunk.KZ3UPV2L.js → chunk.EA2NMVRE.js} +1 -1
- package/dist/preview/chunk.ESK3UZRC.js +1 -0
- package/dist/preview/{chunk.IMFAPZ6J.js → chunk.ESSENNHM.js} +2 -2
- package/dist/preview/{chunk.5DZR46YG.js → chunk.ET3XJDPX.js} +1 -1
- package/dist/preview/chunk.FEIJ7ETK.js +1 -0
- package/dist/preview/{chunk.4XOSDCCE.js → chunk.FFCUZPTC.js} +1 -1
- package/dist/preview/chunk.FG5ZFYYL.js +1 -0
- package/dist/preview/{chunk.KFHXTHIY.js → chunk.FKJ3HIA5.js} +1 -1
- package/dist/preview/chunk.FTBH7CPZ.js +1 -0
- package/dist/preview/{chunk.LDE5HLTM.js → chunk.FU4YSVWX.js} +1 -1
- package/dist/preview/{chunk.A53G42QO.js → chunk.FYDDFOSD.js} +1 -1
- package/dist/preview/{chunk.ETWREHXF.js → chunk.GJQF7I22.js} +1 -1
- package/dist/preview/{chunk.6SHF6IL5.js → chunk.GLTWLQ6L.js} +1 -1
- package/dist/preview/chunk.GMAXA5GV.js +1 -0
- package/dist/preview/{chunk.SRU2YDTJ.js → chunk.GRYS6VSF.js} +1 -1
- package/dist/preview/{chunk.ZK446PSX.js → chunk.GYTVL6GR.js} +3 -3
- package/dist/preview/chunk.HASVT7IC.js +1 -0
- package/dist/preview/{chunk.RK6BK5FD.js → chunk.HFKGND5Q.js} +1 -1
- package/dist/preview/{chunk.JJP5OL5E.js → chunk.HVX7LFWR.js} +1 -1
- package/dist/preview/chunk.IBJBCZKG.js +1 -0
- package/dist/preview/{chunk.CDZVUCEK.js → chunk.IE4ZJQV3.js} +1 -1
- package/dist/preview/chunk.IFL2MYTQ.js +1 -0
- package/dist/preview/{chunk.F7AFJRPP.js → chunk.IUIDDNN3.js} +1 -1
- package/dist/preview/{chunk.RXJBYP7B.js → chunk.JBR66TUP.js} +1 -1
- package/dist/preview/chunk.JG2FGZF2.js +18 -0
- package/dist/preview/{chunk.7VX6TBNY.js → chunk.JI2UVZUU.js} +1 -1
- package/dist/preview/{chunk.OB7XLVK6.js → chunk.JMDKAP23.js} +1 -1
- package/dist/preview/{chunk.IDQHSAAQ.js → chunk.JX2C3HVD.js} +1 -1
- package/dist/preview/{chunk.FKUVIG6D.js → chunk.K7ECYKZL.js} +1 -1
- package/dist/preview/{chunk.UGJ32SEL.js → chunk.K7RKWB2K.js} +1 -1
- package/dist/preview/{chunk.S64LCR23.js → chunk.KK46XLGU.js} +1 -1
- package/dist/preview/chunk.KOBCLWPC.js +1 -0
- package/dist/preview/chunk.KRODTMGR.js +1 -0
- package/dist/preview/chunk.KYKHZZT7.js +1 -0
- package/dist/preview/chunk.LYIHPVDZ.js +1 -0
- package/dist/preview/{chunk.JLPBXG4P.js → chunk.MG3DMURZ.js} +1 -1
- package/dist/preview/{chunk.YG3BLY67.js → chunk.MMVCZOEX.js} +1 -1
- package/dist/preview/{chunk.BBNF52IB.js → chunk.MN6WHE4B.js} +1 -1
- package/dist/preview/{chunk.UJTRKSCK.js → chunk.MRXQBEPQ.js} +1 -1
- package/dist/preview/{chunk.NB6WN4DO.js → chunk.MX3Y3LPH.js} +1 -1
- package/dist/preview/{chunk.LJXAZ5TF.js → chunk.MY5OXSS7.js} +1 -1
- package/dist/preview/chunk.N5XONWU2.js +1 -0
- package/dist/preview/chunk.NNUUD26E.js +1 -0
- package/dist/preview/{chunk.ZITDUHX3.js → chunk.NQ26KMSQ.js} +1 -1
- package/dist/preview/{chunk.QFI4L2HK.js → chunk.NVRK6A7T.js} +1 -1
- package/dist/preview/{chunk.DUIKIJKC.js → chunk.NZDHXREL.js} +1 -1
- package/dist/preview/chunk.OHDJYGH7.js +2 -0
- package/dist/preview/{chunk.GZEZMU2T.js → chunk.OJ64WTLW.js} +2 -2
- package/dist/preview/{chunk.OUNLAMBA.js → chunk.OPCBZNKF.js} +1 -1
- package/dist/preview/{chunk.UCS3CBT4.js → chunk.OU5TRY4N.js} +1 -1
- package/dist/preview/chunk.OW72XZF4.js +1 -0
- package/dist/preview/chunk.P4CLT32V.js +5 -0
- package/dist/preview/chunk.PFXGWY3P.js +1 -0
- package/dist/preview/{chunk.GPJFNLEJ.js → chunk.PMV6XVVZ.js} +1 -1
- package/dist/preview/{chunk.2P66HH5Y.js → chunk.PPZ2TOB5.js} +1 -1
- package/dist/preview/{chunk.JC5NXMG3.js → chunk.PYRJDTVS.js} +1 -1
- package/dist/preview/chunk.QEQQXWYU.js +1 -0
- package/dist/preview/chunk.QPAJCRFB.js +1 -0
- package/dist/preview/chunk.R5R7CLOU.js +1 -0
- package/dist/preview/{chunk.SWLDDQJS.js → chunk.RMMJQYJJ.js} +1 -1
- package/dist/preview/{chunk.FDFVGHQE.js → chunk.RNOBACJ6.js} +1 -1
- package/dist/preview/{chunk.4BQNG3W3.js → chunk.S32AGJ3W.js} +1 -1
- package/dist/preview/chunk.S4CKKT3C.js +1 -0
- package/dist/preview/{chunk.KOPRZLJH.js → chunk.SJKHVIHA.js} +2 -2
- package/dist/preview/chunk.SJYQ72EC.js +1 -0
- package/dist/preview/chunk.SKG4IHT5.js +88 -0
- package/dist/preview/chunk.SLBWPVIY.js +1 -0
- package/dist/preview/{chunk.YZ6UKKEL.js → chunk.SPU3BVAO.js} +1 -1
- package/dist/preview/{chunk.VVRI7DNK.js → chunk.SRFZKDQ6.js} +1 -1
- package/dist/preview/{chunk.MRUDTYOL.js → chunk.SSAY4ITS.js} +2 -2
- package/dist/preview/{chunk.TY6VILZB.js → chunk.T3RTFTOZ.js} +1 -1
- package/dist/preview/{chunk.73BJYIYS.js → chunk.TBSPEO2L.js} +1 -1
- package/dist/preview/chunk.TMYGLXR6.js +25 -0
- package/dist/preview/{chunk.GTUBIJTP.js → chunk.TNL2BVCH.js} +1 -1
- package/dist/preview/{chunk.QAUZDLDA.js → chunk.TVWN5I4M.js} +1 -1
- package/dist/preview/{chunk.MCPLU2U4.js → chunk.U7SNDY3F.js} +1 -1
- package/dist/preview/chunk.UCUWEYKM.js +1 -0
- package/dist/preview/{chunk.T4UYLB3Y.js → chunk.UIWI4GKW.js} +1 -1
- package/dist/preview/{chunk.HGP3Q7QX.js → chunk.UK5F3S2N.js} +1 -1
- package/dist/preview/{chunk.ZKDJQDKX.js → chunk.UVAWWCFW.js} +1 -1
- package/dist/preview/{chunk.L2AV6JRA.js → chunk.UWFEXEY3.js} +1 -1
- package/dist/preview/chunk.V4GAOZAW.js +1 -0
- package/dist/preview/{chunk.TT6QBWRA.js → chunk.VICCAWAN.js} +1 -1
- package/dist/preview/{chunk.AXMC6XVT.js → chunk.W2DKFQ6R.js} +1 -1
- package/dist/preview/{chunk.53BGPCM6.js → chunk.WESWDXRW.js} +1 -1
- package/dist/preview/{chunk.QZMBEG4E.js → chunk.WFHFWJ6E.js} +1 -1
- package/dist/preview/{chunk.AXCRFJDL.js → chunk.WQLAIEWJ.js} +1 -1
- package/dist/preview/{chunk.JYJNRCK5.js → chunk.XCCBUWMC.js} +1 -1
- package/dist/preview/{chunk.GQX57JIE.js → chunk.XCQ7ZPR5.js} +1 -1
- package/dist/preview/chunk.XWXYC3BJ.js +1 -0
- package/dist/preview/chunk.XZVPVAIS.js +1 -0
- package/dist/preview/chunk.Y2ZBVWII.js +1 -0
- package/dist/preview/chunk.Y3LTHEN7.js +1 -0
- package/dist/preview/{chunk.TL7UGUY4.js → chunk.Y5AMZBHA.js} +2 -2
- package/dist/preview/{chunk.CR5MQMOL.js → chunk.Z7N3MJ36.js} +1 -1
- package/dist/preview/{chunk.SVH3OMU2.js → chunk.ZJXUWOG3.js} +1 -1
- package/dist/preview/{chunk.BORCUDGS.js → chunk.ZZODDJYK.js} +1 -1
- package/dist/preview/index.html +51 -51
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.24MUPV4Y.js +0 -1
- package/dist/preview/chunk.2VZSC2MB.js +0 -1
- package/dist/preview/chunk.3L5USMQD.js +0 -1
- package/dist/preview/chunk.3O3H37WD.js +0 -1
- package/dist/preview/chunk.4VJARLJ5.js +0 -1
- package/dist/preview/chunk.5RNB6IC5.js +0 -1
- package/dist/preview/chunk.6BMCZPT6.js +0 -1
- package/dist/preview/chunk.6VA5XFRR.js +0 -1
- package/dist/preview/chunk.7PJVMADH.js +0 -2
- package/dist/preview/chunk.ATWNWPME.js +0 -1
- package/dist/preview/chunk.AVCW7C6V.js +0 -1
- package/dist/preview/chunk.BLS2G3CD.js +0 -5
- package/dist/preview/chunk.BNQL37AC.js +0 -88
- package/dist/preview/chunk.CBJHYNNT.js +0 -1
- package/dist/preview/chunk.EF3UB7US.js +0 -1
- package/dist/preview/chunk.EJUZGIQ5.js +0 -1
- package/dist/preview/chunk.F5FJHKWV.js +0 -1
- package/dist/preview/chunk.GQI53L5P.js +0 -1
- package/dist/preview/chunk.HG34MT7C.js +0 -1
- package/dist/preview/chunk.IATLUWAD.js +0 -1
- package/dist/preview/chunk.JLR74UFP.js +0 -1
- package/dist/preview/chunk.K4ITS63T.js +0 -1
- package/dist/preview/chunk.KT2LXHSI.js +0 -1
- package/dist/preview/chunk.M5RHVUZ6.js +0 -1
- package/dist/preview/chunk.MBZ6N5SO.js +0 -1
- package/dist/preview/chunk.N7FIUTVY.js +0 -1
- package/dist/preview/chunk.NPU4WYRB.js +0 -1
- package/dist/preview/chunk.OHAWUOUN.js +0 -1
- package/dist/preview/chunk.OKQ4JXTW.js +0 -1
- package/dist/preview/chunk.OYQ6ZA6T.js +0 -1
- package/dist/preview/chunk.Q7UQ5OXA.js +0 -1
- package/dist/preview/chunk.ROJZLOKZ.js +0 -1
- package/dist/preview/chunk.S7OFTGBQ.js +0 -18
- package/dist/preview/chunk.SGMVLKZO.js +0 -25
- package/dist/preview/chunk.SJRXBTGP.js +0 -1
- package/dist/preview/chunk.THTHNY4N.js +0 -1
- package/dist/preview/chunk.U6FGWVGB.js +0 -1
- package/dist/preview/chunk.UEL7FLL7.js +0 -1
- package/dist/preview/chunk.VM43YREJ.js +0 -1
- package/dist/preview/chunk.YAS6LXQ7.js +0 -1
- package/dist/preview/chunk.YEMNR4WU.js +0 -1
- package/dist/preview/chunk.YYS45ZGQ.js +0 -1
- package/dist/preview/chunk.ZI66HRES.js +0 -1
- package/dist/preview/chunk.ZVETGRUM.js +0 -1
- package/dist/preview/chunk.ZVOP2HHI.js +0 -1
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{A as zt,B as Re,C as ri,D as Ze,E as me,F as Wn,G as De,H as Ue,I as ii,J as Kn,K as Le,L as oi,M as si,N as O,O as pt,P as wt,Q as li,R as vt,S as Qt,T as di,U as te,V as Zt,W as ie,X as Bn,a as U,b as ve,c as _,d as jt,e as Hn,f as In,g as ct,h as X,i as we,j as re,k as C,l as ee,m as G,n as qe,o as Se,p as _t,q as ke,r as ce,s as ti,t as ht,u as ni,v as Fn,w as Dn,x as Y,y as Fe,z as ai}from"./chunk.CDZVUCEK.js";import{a as Ie}from"./chunk.UDTBFAS5.js";import{a as Qe,b as Yt,d as Q}from"./chunk.QAUZDLDA.js";import{b as Nn,c as Jr,d as ei}from"./chunk.3SY6WWWQ.js";import{a as Qr,d as Zr,e as Xr}from"./chunk.UGFDSE37.js";import{a as Ur,c as Vr,f as jr,g as _r,i as zr,j as Yr}from"./chunk.ATWNWPME.js";import{a as Nr,b as Hr,c as Ir,d as On}from"./chunk.GZEZMU2T.js";import{b as Or}from"./chunk.4VJARLJ5.js";import{a as Fr,b as Dr,d as Gt,e as Wr,f as Kr,g as Br,j as qt}from"./chunk.5RNB6IC5.js";import{a as Ut,b as Vt}from"./chunk.PXQVXBNG.js";import{a as Ht,b as za,c as Ya,d as It,e as Qa}from"./chunk.FFPG4PHX.js";import{b as ar,c as mr,e as fr,f as Tn}from"./chunk.3L5USMQD.js";import{a as Ln,b as gr}from"./chunk.GTUBIJTP.js";import{a as Kt,b as Bt,c as Mr,e as Er}from"./chunk.OKQ4JXTW.js";import{a as dt,b as pr,e as ur}from"./chunk.M5RHVUZ6.js";import{m as $r}from"./chunk.OUNLAMBA.js";import{a as hr,b as wr,c as vr,e as Tr,f as $n,h as Wt}from"./chunk.QSZLY62B.js";import{d as br,e as xr,f as Pr,g as Cr,n as Ar,o as Rr,q as Lr,s as Dt}from"./chunk.7VX6TBNY.js";import{a as Mn}from"./chunk.L5MDUZLQ.js";import{a as An,b as tr,c as nr}from"./chunk.IDQHSAAQ.js";import{a as yr}from"./chunk.CR5MQMOL.js";import{c as ir,d as or,e as sr,f as lr,k as yt,l as dr}from"./chunk.6SHF6IL5.js";import{a as rr}from"./chunk.MQISKON2.js";import{r as Rn,s as cr}from"./chunk.JLR74UFP.js";import{b as Za,c as Xa,d as Ja,e as er,l as Ft}from"./chunk.UCS3CBT4.js";import{C as En,K as Gr,N as qr,e as ja,f as _a,j as Zi,u as Sr,v as kr}from"./chunk.ZK446PSX.js";import{$ as Ka,G as He,L as Ha,N as Ia,Oa as Va,R as Fa,S as B,T as Cn,W as Da,X as Wa,aa as de,da as Ba,ea as Ga,ga as qa,ka as lt,ma as Ua,oa as Ot,r as Na,v as Ne,za as Nt}from"./chunk.SGMVLKZO.js";import{a as Oa}from"./chunk.SDO3U72B.js";import{$a as Pa,Dd as $a,Hc as Ta,J as wa,U as ft,Za as xa,ca as st,da as ge,dc as Aa,fa as ze,ga as Tt,gd as xn,ia as Ge,ic as Ra,ka as va,kb as bn,kc as La,la as Sa,lb as Ca,ld as Et,ma as Ye,md as Ma,od as $t,tb as Mt,xa as ka,xd as Pn,ya as ba,yd as Ea}from"./chunk.BLS2G3CD.js";import{b as H}from"./chunk.AJZBJBMO.js";function ci(e,t,n={}){let a=e.graph.getNode(t);if(!a)return;let r=e.schema.tryDefinition(a.kind),i=l=>ge(e.schema.tryDefinition(l.kind),l),d=new Map;for(let l of e.graph.allEdges()){let s=l.from===t?"out":l.to===t?"in":null;if(!s)continue;let c=s==="out"?l.to:l.from,m=e.graph.getNode(c);if(!m)continue;let w=(s==="out"?r:e.schema.tryDefinition(m.kind))?.edges?.[l.kind],g=s==="in"?w?.inverse??w?.description:w?.description,x=`${l.kind}|${s}|${g??""}`;(d.get(x)??(()=>{let q={edgeKind:l.kind,direction:s,...g?{description:g}:{},targets:[]};return d.set(x,q),q})()).targets.push({id:m.id,kind:m.kind,label:i(m)})}return{id:t,kind:a.kind,label:i(a),fields:Ja(yt(e.schema,e.graph,a),r),violations:bn(e.violations(n.context),[t]),actions:Mn(e,[t],{focus:t,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...d.values()].map(l=>{let s=Za(l.targets.flatMap(c=>{let m=e.graph.getNode(c.id);return m?[m]:[]}),c=>e.schema.tryDefinition(c));return{...l,targets:[...l.targets].map(c=>s.has(c.id)?{...c,apart:s.get(c.id)}:c).sort((c,m)=>c.label.localeCompare(m.label))}})}}function Xe(e,t,n={}){return{kind:t,members:e.graph.nodesOfKind(t),actions:Mn(e,[],{kindSelection:[t],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function pi(e,t){let n=(i,d)=>`${i}|${JSON.stringify(d)}`,a=new Map;for(let i of[...e.affordances,...e.withheld]){if(i.provider!=="invariant")continue;let d=n(i.mutation,i.args);a.has(d)||a.set(d,i.rank??Number.MAX_SAFE_INTEGER)}let r=Number.MAX_SAFE_INTEGER;return[...t].map((i,d)=>({repair:i,declared:d})).sort((i,d)=>(a.get(n(i.repair.mutation,i.repair.args??{}))??r)-(a.get(n(d.repair.mutation,d.repair.args??{}))??r)||i.declared-d.declared).map(i=>i.repair)}function Je(e){let t=e.schema.kinds.map(r=>({kind:r,plural:Ge(e.schema,r),count:e.graph.nodesOfKind(r).length})),n=new Map;for(let r of e.graph.allEdges()){let i=e.graph.getNode(r.from),d=e.graph.getNode(r.to);if(!i||!d)continue;let l=`${r.kind}|${i.kind}|${d.kind}`;n.set(l,(n.get(l)??0)+1)}let a=[];for(let{kind:r}of t){let i=e.schema.tryDefinition(r)?.edges??{};for(let[d,l]of Object.entries(i)){let s=l.to==="*"||l.to===void 0?(()=>{let c=[...n.keys()].filter(m=>m.startsWith(`${d}|${r}|`)).map(m=>m.split("|")[2]);return c.length>0?c:["*"]})():l.to;for(let c of s)a.push({edgeKind:d,from:r,to:c,...l.description?{description:l.description}:{},...l.inverse?{inverse:l.inverse}:{},count:n.get(`${d}|${r}|${c}`)??0})}}return{kinds:t,relations:a}}var We=H(He(),1);var St=H(He(),1);var Te=H(B(),1),Ji={problems:"Problems",search:"Search",map:"Connections",places:"Pictures","~draft":"A view drawn"},eo=e=>{try{return decodeURIComponent(e)}catch{return e}};function to(e,t,n={}){let{store:a}=e,r=a.schema,i=(n.base??"").replace(/\/$/,""),[d="/",l=""]=t.split("#")[0].split("?"),s=(u,M,j)=>({label:u,href:`${i}${M}`,path:M,...j?{current:j}:{}}),c=u=>{let M=n.registry?.sectionOf(u);return M?[M.path===void 0?{label:M.label}:s(M.label,M.path)]:[]},m=u=>n.registry?.sectionOf(u)?.label,v=u=>{let M=m(u);return M===void 0?{}:{section:M}},[w,g,...x]=d.split("/").filter(Boolean).map(eo);if(w===void 0)return{as:"home",label:"Home",trail:[s("Home","/",!0)]};if(w==="places"&&g!==void 0&&x.length===0){let u=new URLSearchParams(l).get("of"),M=new Set(Fe(a,e.principal)),j=e.views?.places()??[],P=j.find(D=>M.has(D.kind)&&D.as===g&&(!u||U(r,D.kind)===u));if(P){let D=jt(P.as,Et(P,j)?U(r,P.kind):void 0);return{as:"place",kind:P.kind,label:P.title,...v(P.kind),trail:[...c(P.kind),s(P.title,D,!0)]}}}let N=x.length===0?ve(r,w):void 0;if(N!==void 0){let u=s(Ge(r,N),`/${U(r,N)}`);if(g===void 0)return{as:"list",kind:N,label:u.label,...v(N),trail:[...c(N),{...u,current:!0}]};let M=a.graph.getNode(g),j=M&&M.kind===N?ge(r.tryDefinition(N),M):"Nothing lives here";return{as:"record",kind:N,id:g,label:j,...v(N),trail:[...c(N),u,s(j,_(r,N,g),!0)]}}let q=Ji[w]??no((x.at(-1)??g??w).replace(/[-_]+/g," "));return{as:"page",label:q,trail:[s(q,d,!0)]}}var no=e=>e.charAt(0).toUpperCase()+e.slice(1),Gn=(0,St.createContext)(null);function ao(e){let t=me(),n=Ze("/");return Q(e.context.store),to(e.context,`${t.pathname}${t.search}`,{registry:e.registry,base:n})}var ro={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},ui={display:"flex",alignItems:"center",gap:6,minWidth:0},gi={display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,lineHeight:"24px"};function ut({context:e,style:t}){let n=(0,St.useContext)(Gn),a=(0,St.useContext)(wt);return vt(a??oo,"trail")||n?.registry?.without().has("trail")?null:(0,Te.jsx)(io,{root:n??{context:e,registry:void 0},context:e,...t?{style:t}:{}})}function io({root:e,context:t,style:n}){let a=ao(e);return a.trail.length<2?null:(0,Te.jsx)(so,{here:a,mark:a.as==="record"?{kind:a.kind,context:t}:void 0,...n?{style:n}:{},"data-testid":"page-trail"})}var oo={count:()=>0,place:()=>()=>{},subscribe:()=>()=>{}};function so({here:e,mark:t,style:n,...a}){let r=e.as==="record"?e.trail.length-2:-1;return(0,Te.jsx)("nav",{"aria-label":"You are here","data-graview-trail":"",style:{minWidth:0,...n},...a,children:(0,Te.jsx)("ol",{style:{...we,listStyle:"none",padding:0,display:"flex",alignItems:"center",gap:6,minWidth:0,overflow:"hidden"},children:e.trail.map((i,d)=>(0,Te.jsxs)("li",{style:i.current?ro:{...ui,flexShrink:d===e.trail.length-2?0:1,maxWidth:"100%"},...i.current?{"aria-current":"page"}:{},children:[d>0&&!i.current?(0,Te.jsx)("span",{"aria-hidden":"true",children:"\u203A"}):null,i.current?i.label:i.path!==void 0?(0,Te.jsxs)(O,{to:i.path,style:{...Se,...ui},...d===r?{"data-testid":"trail-list"}:{},children:[d===r&&t?(0,Te.jsx)(ce,{kind:t.kind,brand:t.context.brand,schema:t.context.store.schema,size:8}):null,(0,Te.jsx)("span",{style:gi,children:i.label})]}):(0,Te.jsx)("span",{style:gi,children:i.label})]},`${d}:${i.label}`))})})}var A=H(B(),1);function $e(e){let t=e.views;if(!t)return[];let n=new Set(Fe(e.store,e.principal));return t.places().filter(a=>n.has(a.kind))}function Xt(e,t){if(!t.over)return[t.kind];let n=new Set(Fe(e.store,e.principal));return t.over.filter(a=>a===t.kind||n.has(a))}var et=e=>`place:${e.kind}:${e.as}`;function fe(e,t){return jt(t.as,Et(t,e.views?.places()??[])?U(e.store.schema,t.kind):void 0)}function kt(e,t){let n=e.schema.tryDefinition(t);return e.graph.nodesOfKind(t).filter(a=>st(n,a))}function qn(e,t,n){let a=(i,d)=>Tt(e.schema,d,i),r=(typeof t=="string"?[t]:t).map(i=>a(kt(e,i).length,i)).join(" and ");return n?`${r} across ${a(kt(e,n).length,n)}`:r}function Un({context:e,place:t,chosen:n,filter:a}){let{store:r,views:i,invariantContext:d}=e,s=i?.resolve(t.kind,{cardinality:"many",fidelity:"full"},t.as)?.view,c=[...new Set(r.violations(d).flatMap(w=>w.nodeIds))],m=Xt(e,t).flatMap(w=>kt(r,w));if(!s)return null;let v=lo(r,m,a,c);return(0,A.jsx)(Rn,{kind:t.kind,view:t.title,children:(0,A.jsx)(s,{nodes:v,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...c.length>0?{flagged:c}:{}})})}function lo(e,t,n,a){let r=n?$t({filter:n}).filter??[]:[];return r.length===0?t:Wt(t,{filter:r},{schema:e.schema,graph:e.graph,flagged:new Set(a)}).nodes}function co({store:e,views:t,as:n,invariantContext:a}){Q(e);let r={store:e,views:t,...a?{invariantContext:a}:{}},i=t.places().find(d=>d.as===n);return i?(0,A.jsx)(Un,{context:r,place:i}):null}function po({context:e,kind:t}){let{store:n,views:a,invariantContext:r}=e,i=kt(n,t),d=n.schema.tryDefinition(t),l=Y(n,t),c=a?.resolve(t,{cardinality:"many",fidelity:"full"})?.view,m=[...new Set(n.violations(r).flatMap(x=>x.nodeIds))];if(c&&!lt(c))return(0,A.jsx)(Rn,{kind:t,children:(0,A.jsx)(c,{nodes:i,label:l,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...m.length>0?{flagged:m}:{}})});let v=a?.resolve(t,{cardinality:"one",fidelity:"summary"})?.view,w=8,g=i.slice(0,w);return(0,A.jsxs)("div",{"data-testid":"kind-sheet",style:v?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gridAutoRows:"max-content",alignContent:"center",gap:12,padding:24}:{display:"flex",flexWrap:"wrap",alignContent:"center",justifyContent:"center",gap:10,padding:24},children:[g.map(x=>v?(0,A.jsx)(v,{node:x,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...m.includes(x.id)?{flagged:[x.id]}:{}},x.id):(0,A.jsx)("span",{style:{padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:ge(d,x)},x.id)),i.length>w?(0,A.jsxs)("span",{style:{...C,alignSelf:"center",padding:"0 6px"},children:["+",i.length-w," more ",l.toLowerCase()]}):null]})}function Vn(e){let{store:t}=e,n=ai(e),a=$e(e),r=e.views?.arrangement?.()?.order??[],i=s=>{let c=s.name===void 0?-1:r.indexOf(`view:${s.name}`);return c>=0?c-r.length:n.indexOf(s.kind)},d=xn([...a].sort((s,c)=>i(s)-i(c))).filter(s=>!s.hidden),l=new Set(d.flatMap(s=>s.over??[s.kind]));return[...d.map(s=>({key:et(s),kind:s.kind,title:Ma(s,a,t.schema),to:fe(e,s),place:s})),...zt(e).filter(s=>!l.has(s)).map(s=>({key:`kind:${s}`,kind:s,title:Y(t,s),to:`/${U(t.schema,s)}`}))]}var mi=.72,uo=540,fi=16/10;function go(e){let t=(0,We.useRef)(null),[n,a]=(0,We.useState)(e);return(0,We.useLayoutEffect)(()=>{let r=t.current;if(!r||typeof ResizeObserver>"u")return;let i=()=>{let l=r.getBoundingClientRect().width;l>0&&a(s=>Math.abs(s-l)<.5?s:l)};i();let d=new ResizeObserver(i);return d.observe(r),()=>d.disconnect()},[]),{ref:t,width:n}}function mo(e){for(let t=e.parentElement;t;t=t.parentElement)if(/(auto|scroll)/.test(getComputedStyle(t).overflowY))return t;return null}function fo(e){let[t,n]=(0,We.useState)(()=>typeof IntersectionObserver>"u");return(0,We.useLayoutEffect)(()=>{let a=e.current;if(t||!a)return;let r=new IntersectionObserver(i=>{i.some(d=>d.isIntersecting)&&(r.disconnect(),n(!0))},{root:mo(a),rootMargin:"50% 0px"});return r.observe(a),()=>r.disconnect()},[t,e]),t}function jn({context:e,entry:t}){let{store:n,brand:a,principal:r}=e,{ref:i,width:d}=go(uo),l=fo(i),s=d/mi,c=kt(n,t.kind),m=n.schema.tryDefinition(t.kind),v=c.length===0?Xe(n,t.kind,{...r?{principal:r}:{},...e.invariantContext?{context:e.invariantContext}:{}}).actions.affordances[0]:void 0,w=t.place!==void 0;return(0,A.jsxs)(O,{to:t.to,"data-testid":w?"place-card":"kind-card",className:"graview-gallery-card",style:{...Se,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,A.jsxs)("span",{ref:i,"data-testid":w?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${fi}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,A.jsx)("span",{style:{position:"absolute",left:0,top:0,width:s,height:s/fi,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${mi})`,transformOrigin:"0 0"},children:l?(0,A.jsx)(Gt.Provider,{value:null,children:t.place?(0,A.jsx)(Un,{context:e,place:t.place}):(0,A.jsx)(po,{context:e,kind:t.kind})}):null}),c.length===0?(0,A.jsx)("span",{"data-testid":"picture-empty",style:{position:"absolute",inset:0,display:"grid",placeContent:"center",justifyItems:"center",gap:2,padding:20,textAlign:"center"},children:(0,A.jsxs)("span",{style:{display:"grid",gap:2,padding:"10px 16px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:[(0,A.jsxs)("span",{style:{fontFamily:In,fontWeight:"var(--graview-weight-display)"},children:["No ",Y(n,t.kind).toLowerCase()," yet"]}),v?(0,A.jsxs)("span",{style:C,children:["Begin with \u201C",v.label,"\u201D"]}):null]})}):null]}),(0,A.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,A.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[w?null:(0,A.jsx)(ce,{kind:t.kind,brand:a,schema:n.schema,size:8}),(0,A.jsx)("span",{style:{fontFamily:In,fontSize:"var(--graview-text-heading)",fontWeight:"var(--graview-weight-display)",lineHeight:1.3,overflowWrap:"anywhere",textWrap:"balance"},children:t.title})]}),(0,A.jsxs)("span",{style:C,children:[t.place?qn(n,Xt(e,t.place),t.place.across):qn(n,t.kind),!w&&m?.description?` \xB7 ${m.description}`:null]})]})]})}var yi={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},yo=`
|
|
2
|
-
.graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
|
|
3
|
-
.graview-gallery-card:hover > span:first-child,
|
|
4
|
-
.graview-gallery-card:focus-visible > span:first-child { border-color: var(--graview-edge-bright); box-shadow: 0 1px 0 var(--graview-edge), 0 10px 30px -18px var(--graview-ink); }
|
|
5
|
-
`;function _n({context:e}){Q(e.store);let t=Vn(e);return t.length===0?null:(0,A.jsxs)("section",{style:yi,"data-testid":"gallery",children:[(0,A.jsx)("style",{children:yo}),t.map(n=>(0,A.jsx)(jn,{context:e,entry:n},n.key))]})}function zn({context:e}){let{store:t}=e;Q(t);let n=xn($e(e)).filter(r=>!r.hidden),a=Vn(e);return(0,A.jsxs)(te,{context:e,style:ct,children:[(0,A.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,A.jsx)("p",{style:we,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,A.jsx)(ie,{context:e,children:"Pictures"}),(0,A.jsx)("p",{style:re,children:n.length===0?"Nothing here has a picture of its own yet, so each kind is drawn as the scene draws it. Title a group view and it appears here by name.":"The ways this installation looks at what it holds \u2014 each one the same picture the scene shows, here as a page."})]}),a.length>0?(0,A.jsx)("div",{style:yi,"data-testid":"places",children:a.map(r=>(0,A.jsx)(jn,{context:e,entry:r},r.key))}):null]})}var ho={lede:!0},wo={lede:!1},vo={...re,textWrap:"pretty"};function So(e,t){if(t===void 0)return;let[n]=lr(sr([t]),dr(e.store,null,null,e.brand?{money:e.brand}:{}));return n?.t==="headline"&&!n.problem&&n.text.trim()!==""?n.text:void 0}function Yn({context:e}){let{store:t,principal:n}=e;Q(t);let a=Ue(),r=De(),[i]=pt(),d=decodeURIComponent(a.as??""),[l,s]=(0,We.useState)(null),c=i.get("of"),m=i.get("filter"),w=$e(e).find(P=>P.as===d&&(!c||U(t.schema,P.kind)===c));if(!w)return(0,A.jsxs)(te,{context:e,children:[(0,A.jsx)(ie,{context:e,children:"No picture is called that."}),(0,A.jsx)("p",{style:re,children:(0,A.jsx)(O,{to:"/places",style:qe,children:(0,A.jsx)(Qe,{children:"The pictures there are"})})})]});let g=Y(t,w.kind),x=e.views?.resolve(w.kind,{cardinality:"many",fidelity:"full"},w.as)?.view,N=x?.flows===!0,q=x?.creates!==!1,u=So(e,x?.lede),M=Xe(t,w.kind,{...n?{principal:n}:{},...e.invariantContext?{context:e.invariantContext}:{}}),j=q?M.actions.affordances.map(P=>({affordance:P,mutation:t.allMutations().find(D=>D.name===P.mutation)})).filter(P=>P.mutation!==void 0):[];return(0,A.jsxs)(te,{context:e,style:{...ct,gap:"var(--graview-space-6, 32px)"},children:[(0,A.jsxs)("header",{style:{display:"grid",gap:"var(--graview-space-2, 8px)"},children:[(0,A.jsx)(ut,{context:e}),(0,A.jsx)(ie,{context:e,children:w.title}),(0,A.jsx)("p",{style:vo,"data-testid":"place-lede",...u!==void 0?{"data-graview-lede":"headline"}:{},children:u??`${qn(t,Xt(e,w),w.across)}.`}),m&&!N?(0,A.jsxs)("p",{style:{...C,margin:0},"data-testid":"place-narrowed",children:[`Only those where ${m.split(",").map(P=>P.replace(":"," is ")).join(" and ")}. `,(0,A.jsx)(O,{to:`?${(()=>{let P=new URLSearchParams(i);return P.delete("filter"),P.toString()})()}`,style:{...G,...C},children:"Show all"})]}):null,(0,A.jsx)("p",{style:{...C,margin:0,display:"flex",flexWrap:"wrap",gap:"4px 16px"},children:Xt(e,w).map((P,D)=>(0,A.jsx)(O,{to:`/${U(t.schema,P)}`,style:{...qe,...C},...D===0?{"data-testid":"place-as-list"}:{},children:(0,A.jsxs)(Qe,{children:["All ",(P===w.kind?g:Y(t,P)).toLowerCase()," as a list"]})},P))})]}),(0,A.jsx)("div",{"data-testid":"place-lens","data-flows":N?"":void 0,...N?{}:{role:"group","aria-label":w.title,tabIndex:0},style:N?{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",maxWidth:"100%"}:{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",maxWidth:"100%",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},onClick:P=>{let D=P.target?.closest("[data-graview-pick]"),ae=D?.getAttribute("data-graview-pick"),oe=D?.getAttribute("data-graview-joins");if(oe)try{let J=JSON.parse(oe);if(Array.isArray(J)&&J.every(ue=>typeof ue=="string")){P.preventDefault(),s({at:et(w),ids:J});return}}catch{}if(!ae)return;let he=t.graph.getNode(ae);he&&(P.preventDefault(),r(_(t.schema,he.kind,ae)))},children:(0,A.jsx)(Br.Provider,{value:u!==void 0?ho:wo,children:(0,A.jsx)(Un,{context:e,place:w,filter:m,...l?.at===et(w)?{chosen:l.ids}:{}})})}),j.length>0?(0,A.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},"data-testid":"place-creators",children:j.map(({affordance:P,mutation:D})=>(0,A.jsxs)("section",{style:{...ee,display:"grid",gap:14},children:[(0,A.jsx)("h2",{style:X,children:D.title??D.name}),D.description?(0,A.jsx)("p",{style:{...C,margin:0,maxWidth:"58ch"},children:D.description}):null,(0,A.jsx)(Ie,{store:t,mutation:D,prefilled:P.args,open:P.open,label:P.label,...n?{principal:n}:{}})]},P.id))}):null]})}function ko(e,t=document){let n=Ut(e);if(!n)return null;let a=[t,...[...t.querySelectorAll("[data-worker-view]")].flatMap(r=>r.shadowRoot?[r.shadowRoot]:[])];for(let r of a)for(let i of r.querySelectorAll("[id], [data-section]")){let d=i.getAttribute("data-section")??i.id;if(d===e||Ut(d)===n)return i}for(let r of a)for(let i of r.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=heading]"))if(Ut(i.textContent??"")===n)return i;return null}function hi(e,t={}){if(typeof document>"u"||typeof requestAnimationFrame>"u")return()=>{};let n=t.frames??120,a=0,r=()=>{let i=ko(e,t.root??document);if(i){i.hasAttribute("tabindex")||i.setAttribute("tabindex","-1"),i.scrollIntoView?.({block:"start"}),i.focus({preventScroll:!0});return}n-=1,n>0&&(a=requestAnimationFrame(r))};return a=requestAnimationFrame(()=>{a=requestAnimationFrame(r)}),()=>cancelAnimationFrame(a)}var K=H(He(),1);var Jt=H(He(),1);var tt=H(B(),1);function wi({context:e}){return de()?(0,tt.jsxs)(tt.Fragment,{children:[(0,tt.jsx)(bo,{context:e}),(0,tt.jsx)(Vr,{face:"pages",on:e.quickAsk??!0})]}):null}function bo({context:e}){let{store:t}=e,n=de(),{pathname:a}=me(),r=(0,Jt.useRef)(n?.setSelection);return r.current=n?.setSelection,(0,Jt.useEffect)(()=>{let i=r.current;if(!i)return;let[,d,l]=a.split("/"),s=(()=>{if(d==="places"){let m=e.views?.places().find(v=>v.as===decodeURIComponent(l??""));return m?[Ne(m.kind)]:[]}let c=d?ve(t.schema,d):void 0;return c&&l?[decodeURIComponent(l)]:c?[Na(c)]:[]})();i(c=>c.length===s.length&&c.every((m,v)=>m===s[v])?c:s)},[a]),null}var be=H(He(),1);var Si=H(Zi(),1);var pe=H(B(),1);var xo=Nt(Oa(()=>(__graviewPreload(import.meta.url,["./chunk.QAUZDLDA.js","./chunk.3SY6WWWQ.js","./chunk.UGFDSE37.js","./chunk.ATWNWPME.js","./chunk.GZEZMU2T.js","./chunk.4VJARLJ5.js","./chunk.5RNB6IC5.js","./chunk.ZITDUHX3.js","./chunk.ETWREHXF.js","./chunk.YZ6UKKEL.js","./chunk.FFPG4PHX.js","./chunk.3L5USMQD.js","./chunk.GTUBIJTP.js","./chunk.DUIKIJKC.js","./chunk.73BJYIYS.js","./chunk.OKQ4JXTW.js","./chunk.M5RHVUZ6.js","./chunk.MRUDTYOL.js","./chunk.OUNLAMBA.js","./chunk.HGP3Q7QX.js","./chunk.QSZLY62B.js","./chunk.7VX6TBNY.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.6SHF6IL5.js","./chunk.MQISKON2.js","./chunk.GQX57JIE.js","./chunk.LJXAZ5TF.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.GZHZLJBF.js","./chunk.JLR74UFP.js","./chunk.OJGHDWI6.js","./chunk.HG34MT7C.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.RK6BK5FD.js")).then(e=>({default:e.TakeBack}))));function Po({context:e,docked:t,at:n,...a}){let{store:r}=e,i=Q(r),[d]=(0,be.useState)(()=>r.batches().length),l=(0,be.useRef)(!1);return l.current||=i>0||!t&&d>0,l.current?(0,pe.jsx)(be.Suspense,{fallback:null,children:(0,pe.jsx)(xo,{context:e,docked:t,at:n,since:d,...a})}):null}function Co(e,t,n){let{store:a,principal:r,embedded:i}=e;(0,be.useEffect)(()=>{if(!n)return;let d=l=>{if(!Xr(l))return;let s=l.target,c=s instanceof Node&&t.current?.contains(s),m=s===document.body||s===document.documentElement||s===document;if(!(!c&&!(m&&!i))&&Qr(a,r)){l.preventDefault();try{Zr(a,r)}catch{}}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[a,r,i,t,n])}function ki({context:e,registry:t,root:n,children:a}){let r=(0,be.useMemo)(li,[]),i=t?.without()??new Set;return Co(e,n,!i.has("undo")),(0,pe.jsxs)(wt.Provider,{value:r,children:[(0,pe.jsx)(Ao,{context:e,placed:r,without:i}),a]})}function Ao({context:e,placed:t,without:n}){let[a,r]=(0,be.useState)(!1);(0,be.useLayoutEffect)(()=>r(!0),[]);let i=vt(t,"find"),d=vt(t,"undo"),l=me(),s=kr();if(!a)return null;let c=l.pathname.split("/").filter(Boolean),v=(c.length===1?ve(e.store.schema,c[0]):void 0)!==void 0;return(0,pe.jsxs)(pe.Fragment,{children:[!i&&!n.has("find")&&s?(0,Si.createPortal)((0,pe.jsx)(vi,{context:e,narrowsLists:v}),s.slot):null,!i&&!n.has("find")&&!s?(0,pe.jsx)("div",{"data-testid":"face-find-bar",style:{display:"flex",alignItems:"center",padding:"8px 16px",borderBottom:"1px solid var(--graview-edge)",background:"var(--graview-bar)",minWidth:0},children:(0,pe.jsx)(vi,{context:e,narrowsLists:v})}):null,!d&&!n.has("undo")?(0,pe.jsx)(Po,{context:e,docked:!0,at:l.pathname+l.search}):null,s?.own&&!n.has("undo")?(0,pe.jsx)(ri,{context:e,own:s.own}):null]})}function vi({context:e,narrowsLists:t}){return(0,pe.jsx)(wt.Provider,{value:null,children:(0,pe.jsx)(Bn,{context:e,narrowsLists:t})})}var Z=H(He(),1);var xe=H(B(),1),Ro=500,Lo=10;function en(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function To(e){let t=typeof getSelection=="function"?getSelection():null;return t!==null&&!t.isCollapsed&&t.containsNode(e,!0)}function bi(e){let t=e.closest('a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])');if(t)return t;let n=document.activeElement;return n instanceof HTMLElement&&n!==document.body?n:null}function xi({context:e,root:t,children:n}){return de()===null?(0,xe.jsx)(xe.Fragment,{children:n}):(0,xe.jsx)(Mo,{context:e,root:t,children:n})}function Mo({context:e,root:t,children:n}){let{setMenuAt:a}=Ka(),{store:r}=e,i=r.schema,d=De(),{pathname:l,search:s}=me(),c=Ze("/").replace(/\/$/,""),m=(0,Z.useCallback)((S,f)=>e.views?.places().find(R=>R.as===S&&(f===null||R.kind===f)),[e.views]),v=(0,Z.useCallback)((S,f)=>{let[R="",E,ne]=S.split("/").filter(Boolean).map(p=>{try{return decodeURIComponent(p)}catch{return p}});if(ne!==void 0)return null;if(R==="places"&&E!==void 0){let p=m(E,new URLSearchParams(f).get("of"));return p?{face:"pages",place:p.as,about:[Ne(p.kind)],title:p.title}:null}let z=ve(i,R);return z?E===void 0?{face:"pages",about:[Ne(z)],title:Ge(i,z)}:r.graph.getNode(E)?{face:"pages",on:E,about:[E]}:null:null},[i,r,m]),w=(0,Z.useCallback)(S=>{let f=S.href;try{let R=new URL(f,location.href);if(R.origin===location.origin&&(c===""||R.pathname===c||R.pathname.startsWith(`${c}/`))){let E=v(R.pathname.slice(c.length),R.search);if(E)return{...E,href:f}}}catch{}return{face:"pages",about:[],href:f}},[c,v]),g=(0,Z.useCallback)(()=>v(l,s)??{face:"pages",about:[]},[v,l,s]),x=(0,Z.useCallback)(S=>{let f=g(),R=S.closest("[data-graview-field]")?.getAttribute("data-graview-field");if(R&&f.on!==void 0&&S.closest("[data-graview-pick], a[href]")===null)return{...f,field:R};let E=S.closest("[data-graview-act]")?.getAttribute("data-graview-act");if(E)return{...f,act:E};let ne=S.closest("a[href]"),z=S.closest("[data-graview-listed]"),p=[S.closest("[data-graview-pick]")?.getAttribute("data-graview-pick"),z&&(!ne||z.contains(ne)&&ne.classList.contains("graview-spec-item-link"))?z.getAttribute("data-graview-listed"):null].map(V=>V?r.graph.getNode(V):void 0).find(Boolean);if(p)return{face:"pages",on:p.id,about:[p.id],href:`${c}${_(i,p.kind,p.id)}`};if(ne)return w(ne);let L=S.closest("[data-graview-record]")?.getAttribute("data-graview-record");return L&&r.graph.getNode(L)?{face:"pages",on:L,about:[L]}:f},[g,w,r,i,c]),N=(0,Z.useCallback)(S=>{let f=t.current;if(f===null||!f.contains(S)||en(S)||S.closest("[data-graview-popover]"))return null;let R=x(S);return{face:"pages",on:R.on,about:R.about??[],field:R.field,place:R.place,href:R.href,act:R.act,element:bi(S)}},[x,t]),q=(0,Z.useCallback)((S,f,R)=>{let E=x(S);a({...E,x:Math.round(f),y:Math.round(R),returnTo:bi(S)})},[x,a]),u=(0,Z.useCallback)(S=>{let f=S.getBoundingClientRect();q(S,f.left+Math.min(16,f.width/2),Math.min(f.bottom,f.top+36))},[q]),M=(0,Z.useRef)(0),j=(0,Z.useRef)(null),P=(0,Z.useRef)(!1),D=()=>{j.current&&clearTimeout(j.current.timer),j.current=null};(0,Z.useEffect)(()=>D,[]),(0,Z.useEffect)(()=>{let S=f=>{if(f.defaultPrevented||!(f.key==="ContextMenu"||f.key==="F10"&&f.shiftKey))return;let R=t.current,E=f.target instanceof Element?f.target:null,ne=E===null||E===document.body||E===document.documentElement,z=R!==null&&E!==null&&R.contains(E);if(!z&&!(ne&&document.querySelector("[data-graview-face='pages']")===R)||en(E)||E?.closest("[data-graview-popover]"))return;f.preventDefault(),M.current=Date.now();let p=z&&E instanceof HTMLElement?E:R?.querySelector("[data-graview-page-title], main h1, main")??null;p&&u(p)};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[t,u]),(0,Z.useEffect)(()=>{let S=t.current;if(!S)return;let f=R=>{let E=R.detail;E&&a({...E,face:"pages"})};return S.addEventListener(Cn,f),()=>S.removeEventListener(Cn,f)},[t,a]);let ae=(0,Z.useMemo)(()=>S=>{if(S.face!=="pages")return null;let f=[],R=S.on===void 0?void 0:r.graph.getNode(S.on),E=S.place===void 0?void 0:e.views?.places().find(se=>se.as===S.place),ne=R?void 0:S.about.length===1&&S.about[0].startsWith("aggregate:")&&!E?Eo(S.about[0]):void 0,z=R?_(i,R.kind,R.id):E?fe(e,E):ne?`/${U(i,ne)}`:void 0,p=z!==void 0&&l===z.split("?")[0];z!==void 0&&!p&&f.push({id:"open",label:"Open",run:()=>d(z)});let L=z!==void 0?`${c}${z}`:S.href;L!==void 0&&f.push({id:"open-in-a-new-tab",label:"Open in a new tab",run:()=>void window.open(L,"_blank","noopener")});let V=R?`#focus=${encodeURIComponent(R.id)}`:E?`#focus=${encodeURIComponent(Ne(E.kind))}&view=${encodeURIComponent(E.as)}`:ne?`#focus=${encodeURIComponent(Ne(ne))}`:void 0;if(V!==void 0&&(e.overview||!e.embedded)){let se=e.overview;f.push({id:"in-the-scene",label:"Show in the scene",run:()=>se?se(V):location.assign(`${e.sceneHref??"/"}${V}`)})}return R===void 0&&S.href===void 0&&f.push({id:"find",label:"Find\u2026",run:()=>{let se=t.current?.querySelector('[data-testid="nav-find"]')??document.querySelector('[data-testid="nav-find"]');se&&se.offsetParent!==null?se.focus():d("/search")}}),f.length>0?{id:"pages",items:f}:null},[r,i,e,l,c,d,t]),oe=(0,Z.useMemo)(()=>S=>{if(S.face!=="pages"||S.field===void 0||S.on===void 0)return null;let f=r.graph.getNode(S.on),R=S.element?.closest("[data-graview-field]")??t.current?.querySelector(`[data-graview-field="${CSS.escape(S.field)}"]`);return!f||!(R instanceof HTMLElement)||!R.hasAttribute("data-graview-editable")?null:{id:"field",at:"start",items:[{id:"change-field",label:`Change \u201C${va(i.tryDefinition(f.kind),S.field)}\u201D`,run:()=>R.click()}]}},[r,i,t]),he=_r(),J=mr(),ue=Or(),Ke=(0,Z.useCallback)((S,f)=>{l===fe(e,S).split("?")[0]&&d(f?fe(e,f):"/")},[l,e,d]),Pe=Yr(Ke),Ce=(0,Z.useMemo)(()=>[oe,ue,ae,...Pe?[Pe]:[],...J?[J]:[],...he?[he]:[]],[oe,ue,ae,Pe,J,he]);return(0,xe.jsxs)(cr,{sections:Ce,children:[(0,xe.jsx)("div",{"data-graview-menu-ground":"",style:{display:"contents"},onContextMenu:S=>{let f=S.target;S.shiftKey||en(f)||To(f)||(S.preventDefault(),!f.closest("[data-graview-popover]")&&(Date.now()-M.current<700||(S.clientX===0&&S.clientY===0&&f instanceof HTMLElement?u(f):q(f,S.clientX,S.clientY))))},onPointerDown:S=>{if(P.current=!1,S.pointerType==="mouse"||!S.isPrimary)return;let f=S.target;if(en(f)||f.closest("[data-graview-choose], [data-graview-popover]"))return;D();let{clientX:R,clientY:E}=S;j.current={x:R,y:E,timer:setTimeout(()=>{j.current=null,P.current=!0,M.current=Date.now(),q(f,R,E)},Ro)}},onPointerMove:S=>{let f=j.current;f&&Math.hypot(S.clientX-f.x,S.clientY-f.y)>Lo&&D()},onPointerUp:D,onPointerCancel:D,onClickCapture:S=>{P.current&&(P.current=!1,S.preventDefault(),S.stopPropagation())},children:n}),(0,xe.jsx)($o,{openAt:u,readyAt:N}),(0,xe.jsx)(zr,{placement:"page"}),(0,xe.jsx)(fr,{})]})}function Eo(e){let t=e.slice(10).split("+");return t.length===1&&t[0]?t[0]:void 0}function $o({openAt:e,readyAt:t}){return(0,xe.jsx)("span",{"data-graview-menu-home":"",tabIndex:-1,onFocus:n=>{if(n.target!==n.currentTarget)return;let a=n.currentTarget.closest("[data-graview-face]"),r=a?.querySelector("[data-graview-page-title]")??a?.querySelector("main h1, main")??null;r&&(r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0}))},style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:(0,xe.jsx)(Ur,{placement:"menu",openActs:e,aimAt:t})})}var F=H(B(),1);function Pi(e,t){return t==="*"?{label:"anything",path:null}:{label:Y(e,t),path:`/${U(e.schema,t)}`}}function Oo({context:e,relation:t}){let{store:n}=e,a=Pi(n,t.from),r=Pi(n,t.to),i=d=>d.path?(0,F.jsx)(O,{to:d.path,style:{...Se,fontWeight:550},children:d.label}):(0,F.jsx)("span",{children:d.label});return(0,F.jsxs)("li",{"data-testid":"relation","data-relation":t.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,F.jsx)(jr,{edgeKind:t.edgeKind,...e.brand?.kit?{kit:e.brand.kit}:{}}),(0,F.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,F.jsxs)("span",{children:[i(a)," ",(0,F.jsxs)("span",{style:C,"data-graview-speaks-ids":"",children:[ze(t.edgeKind)," \u2192"]})," ",i(r)]}),t.description||t.inverse?(0,F.jsxs)("span",{style:C,children:[t.description?Re(t.description):null,t.description&&t.inverse?" \xB7 ":null,t.inverse?`from the other end, ${t.inverse}`:null]}):null]}),r.path?(0,F.jsx)(O,{to:`${r.path}?with=${encodeURIComponent(t.edgeKind)}`,style:{...G,...C,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${r.label.toLowerCase()} that have this`,children:t.count}):(0,F.jsx)("span",{style:{...C,fontVariantNumeric:"tabular-nums"},children:t.count})]})}function Ci({context:e,heading:t=!0}){let{store:n}=e,a=new Set(Fe(n,e.principal)),r=Je(n).relations.filter(i=>a.has(i.from)&&(i.to==="*"||a.has(i.to)));return r.length===0?null:(0,F.jsxs)("section",{style:{...ee,display:"grid",gap:12},"data-testid":"kind-map",children:[t?(0,F.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,F.jsx)("h2",{style:X,children:(0,F.jsx)(O,{to:"/map",style:Se,children:"Connections"})}),(0,F.jsx)("span",{style:C,children:r.length===1?"1 relation":`${r.length} relations`})]}):null,(0,F.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:r.map(i=>(0,F.jsx)(Oo,{context:e,relation:i},`${i.edgeKind}|${i.from}|${i.to}`))})]})}function Qn({context:e}){let{store:t}=e;Q(t);let n=new Set(Fe(t,e.principal)),a=Je(t),r=a.relations.filter(i=>n.has(i.from));return(0,F.jsxs)(te,{context:e,children:[(0,F.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,F.jsx)("p",{style:we,children:r.length===0?"No relations":`${r.length} ${r.length===1?"relation":"relations"}`}),(0,F.jsx)(ie,{context:e,children:"Connections"}),(0,F.jsx)("p",{style:re,children:r.length===0?"Nothing here is declared to relate to anything else yet.":"The kinds this installation holds, and the relations declared between them \u2014 each in the declaration's own words, with how many of it there are."})]}),(0,F.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:a.kinds.filter(i=>n.has(i.kind)).map(i=>(0,F.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,F.jsx)(ce,{kind:i.kind,brand:e.brand,schema:t.schema,size:7}),(0,F.jsx)(O,{to:`/${U(t.schema,i.kind)}`,style:G,children:i.plural}),(0,F.jsx)("span",{style:C,children:i.count})]},i.kind))}),(0,F.jsx)(Ci,{context:e,heading:!1})]})}function Ai({context:e}){let n=[...de()?.robots.values()??[]].filter(r=>r.mode==="asking"&&r.say);if(n.length===0)return null;let{store:a}=e;return(0,F.jsxs)("section",{style:{...ee,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,F.jsx)("h2",{style:X,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,F.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(r=>{let i=r.at?a.graph.getNode(r.at):void 0;return(0,F.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,F.jsx)("span",{children:r.say}),i?(0,F.jsxs)(O,{to:_(a.schema,i.kind,i.id),style:{...G,...C},children:[ge(a.schema.tryDefinition(i.kind),i)," \u2192"]}):null]},r.participant)})})]})}var W=H(B(),1);function Zn({context:e}){let{principal:t}=e,{store:n,brand:a,invariantContext:r}=e;Q(n);let i=n.violations(r),d=`${i.length===1?"A rule is broken":"Rules are broken"} \u2014 see what, and what would fix it`,l=[...n.log.all()].slice(-5).reverse(),c=zt(e).map(u=>({kind:u,members:n.graph.nodesOfKind(u).filter(M=>st(n.schema.tryDefinition(u),M))})),m=c.filter(u=>u.members.length>0),v=c.map(u=>({entry:u,creator:n.allMutations().find(M=>(M.creates??[]).includes(u.kind)&&n.permits({name:M.name,args:{}},e.principal).ok)})).find(u=>u.creator!==void 0),w=m.length===0?"Nothing here yet.":`${m.map(u=>Tt(n.schema,u.kind,u.members.length)).join(", ").replace(/, ([^,]*)$/," and $1")}.`,g=e.views?.homeView?.(),x=n.schema.kinds.some(u=>n.graph.nodesOfKind(u).length>0);if(g&&x){let u=a?.subtitle&&a.subtitleDrawn!==!1?(0,W.jsx)("p",{style:{...C,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,M=g[Symbol.for("graview.home-blocks")]===!0;return(0,W.jsx)(te,{context:e,style:ct,children:(0,W.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[M?null:u,i.length>0?(0,W.jsx)(O,{to:"/problems",style:{...G,color:"var(--graview-warn)"},children:d}):null,(0,W.jsx)(Kr.Provider,{value:M?u:null,children:(0,W.jsx)(Zt,{when:Ot(g),children:(0,W.jsx)(g,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})})]})})}let N=new Set(Fe(n,e.principal)),q=Je(n).relations.filter(u=>N.has(u.from)&&(u.to==="*"||N.has(u.to)));return(0,W.jsxs)(te,{context:e,style:ct,children:[(0,W.jsxs)("header",{style:{display:"grid",gap:12},children:[a?.subtitle&&a.subtitleDrawn!==!1?(0,W.jsx)("p",{style:{...C,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,(0,W.jsx)(ie,{context:e,"data-testid":"standing",children:w}),(0,W.jsxs)("p",{style:{...re,display:"grid",gap:4},"data-testid":"standing-card",children:[m.length===0&&v?(0,W.jsxs)("span",{children:["Begin with \u201C",v.creator?.title??v.creator?.name,"\u201D, under"," ",(0,W.jsx)(O,{to:`/${U(n.schema,v.entry.kind)}`,style:G,children:Y(n,v.entry.kind)}),"."]}):null,i.length===0?(0,W.jsx)("span",{children:"All rules hold."}):(0,W.jsx)(O,{to:"/problems",style:{...G,color:"var(--graview-warn)"},children:d})]})]}),(0,W.jsx)(_n,{context:e}),(0,W.jsxs)("section",{style:{...ee,display:"grid",gap:14},"data-testid":"kinds",children:[(0,W.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,W.jsx)("h2",{style:X,children:"What is here"}),q.length>0?(0,W.jsx)(O,{to:"/map",style:{...qe,...C,marginLeft:"auto"},"data-testid":"map-link",children:(0,W.jsxs)(Qe,{children:["Connections \xB7 ",q.length===1?"1 relation":`${q.length} relations`]})}):null]}),(0,W.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:c.map(({kind:u,members:M})=>(0,W.jsx)("li",{style:{maxWidth:"100%"},children:(0,W.jsxs)(O,{to:`/${U(n.schema,u)}`,style:{...Se,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,W.jsx)(ce,{kind:u,brand:a,schema:n.schema,size:7}),(0,W.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:Y(n,u)}),(0,W.jsx)("span",{style:{...C,fontVariantNumeric:"tabular-nums"},children:M.length===0?"none yet":ft(M.length)})]})},u))})]}),l.length>0?(0,W.jsxs)("section",{style:{...ee,display:"grid",gap:10},children:[(0,W.jsx)("h2",{style:X,children:"Recently"}),(0,W.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:l.map(u=>(0,W.jsxs)("li",{style:C,children:[(0,W.jsx)("span",{style:{color:"var(--graview-ink)"},children:u.intent})," \u2014 ",ht(u,t,{graph:n.graph,schema:n.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},u.id))})]}):null]})}var Me=H(He(),1);var nt=H(B(),1);function tn({context:e,withheld:t,style:n,testId:a}){let r=de(),i=La(t,e.signIn??r?.signIn);return i?(0,nt.jsx)("p",{style:{...n,margin:0},children:(0,nt.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>i.run(),style:ke,children:i.label})}):t.length===0?null:(0,nt.jsx)("ul",{style:{...n,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},...a?{"data-testid":a}:{},children:t.map(d=>(0,nt.jsxs)("li",{style:C,children:[(0,nt.jsx)("s",{children:d.label})," \u2014 ",d.refusal.message]},d.id))})}var T=H(B(),1);function Xn({context:e}){let{store:t,brand:n,principal:a,invariantContext:r}=e;Q(t);let[i]=pt(),d=i.get("q")??"",l=typeof r?.today=="string"?r.today:void 0,s=Lr(t,d,{...a?{principal:a}:{},places:$e(e),flagged:new Set(t.violations(r).flatMap(g=>g.nodeIds)),...l?{today:l}:{},limit:200}),c=s.hits.filter(g=>g.about==="node"),m=s.hits.filter(g=>g.about==="kind"||g.about==="place"||g.about==="rule"),v=[...new Set(c.map(g=>g.kind))],w=d.trim();return(0,T.jsxs)(te,{context:e,children:[(0,T.jsx)("style",{children:_t}),(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)("p",{style:we,children:"Search"}),(0,T.jsx)(ie,{context:e,"data-testid":"search-heading",children:w.length===0?"Find anything by its name":s.hits.length===0?(0,T.jsxs)(T.Fragment,{children:["Nothing here is called \u201C",w,"\u201D."]}):(0,T.jsxs)(T.Fragment,{children:[No(t,s.byKind)," for \u201C",w,"\u201D"]})}),w.length>0?(0,T.jsxs)("p",{style:{...C,margin:0},"data-testid":"search-searched",children:[Dt(t.schema,s.searched),s.conditions.filter(g=>g.key!=="is"&&g.admittedBy.length<s.searched.kinds.length).map(g=>(0,T.jsxs)("span",{children:[" ",g.key,":",g.value," narrows"," ",g.admittedBy.length===0?"nothing here":g.admittedBy.map(x=>Y(t,x).toLowerCase()).join(" and "),"."]},`${g.key}:${g.value}`))]}):(0,T.jsxs)("p",{style:re,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,T.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,T.jsx)("code",{children:"is:any"})," includes what is past."]})]}),m.length>0?(0,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:m.map(g=>(0,T.jsx)("li",{"data-testid":"search-hit","data-about":g.about,children:g.about==="kind"?(0,T.jsxs)(O,{to:`/${U(t.schema,g.kind)}`,style:G,children:[g.label,g.count>0?(0,T.jsxs)("span",{style:C,children:[" \xB7 ",g.count," match"]}):null]}):g.about==="place"?(0,T.jsxs)(O,{to:fe(e,g),style:G,children:["Go to ",g.title]}):g.about==="rule"?(0,T.jsxs)(O,{to:"/problems",style:G,children:["The rule \u201C",g.label,"\u201D"]}):null},`${g.about}:${g.about==="rule"?g.name:g.about==="place"?g.as:g.kind}`))}):null,v.map(g=>(0,T.jsxs)("section",{className:"graview-list",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",minWidth:0},"data-testid":"search-group","data-kind":g,children:[(0,T.jsxs)("h2",{className:"graview-group-head",style:{alignItems:"center"},children:[(0,T.jsx)(ce,{kind:g,brand:n,schema:t.schema,size:8}),(0,T.jsx)(O,{to:`/${U(t.schema,g)}?${new URLSearchParams({q:w}).toString()}`,style:G,"data-testid":"search-kind-link",children:Y(t,g)}),(0,T.jsx)("span",{children:s.byKind[g]})]}),(0,T.jsx)("ul",{className:"graview-rows",children:c.filter(x=>x.kind===g).map(x=>(0,T.jsxs)("li",{"data-testid":"search-hit","data-about":"node",className:"graview-row",children:[(0,T.jsxs)(O,{to:_(t.schema,g,x.id),className:"graview-row-title",...x.label.length>60?{title:x.label}:{},children:[x.flagged?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,x.label]}),x.apart||!x.current?(0,T.jsx)("span",{className:"graview-row-glance",children:[x.apart,x.current?"":"past"].filter(Boolean).join(" \xB7 ")}):null,(0,T.jsx)(nn,{why:x.why})]},x.id))})]},g)),w.length>0?(0,T.jsx)(Ho,{asked:w}):null,w.length>0&&s.hits.length===0?(0,T.jsx)(Li,{store:t,kinds:s.searched.kinds,words:s.words,...a?{principal:a}:{},...r?{invariantContext:r}:{}}):null]})}function nn({why:e}){return e.strength==="near"?(0,T.jsxs)("span",{style:C,"data-testid":"search-why","data-near":"",children:["Near \u201C",e.asked,"\u201D",e.field==="label"?"":` \u2014 ${e.reading}: ${e.fragment}`]}):e.field==="label"?null:(0,T.jsxs)("span",{style:C,"data-testid":"search-why",children:[e.reading,": ",e.fragment]})}function No(e,t){let n=Object.entries(t).map(([a,r])=>`${r} ${r===1?Ye(e.schema.tryDefinition(a),a):Y(e,a).toLowerCase()}`);return n.length===0?"Found":n.length===1?Re(n[0]):Re(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function Ri(e,t,n={}){let a=[];for(let r of t){let i=Xe(e,r,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let d of an(e,r,i.actions.affordances))a.some(l=>l.mutation.name===d.mutation.name)||a.push(d)}return a}function an(e,t,n){let a=e.schema.tryDefinition(t)?.fieldRoles?.label,r=[];for(let i of n){let d=e.allMutations().find(c=>c.name===i.mutation);if(!d||!d.creates?.includes(t)||r.some(c=>c.mutation.name===d.name))continue;let l=yr(d.input).map(c=>c.name),s=l.includes("label")?"label":a&&l.includes(a)?a:void 0;!s||i.args[s]!==void 0||r.push({kind:t,affordance:i,mutation:d,arg:s})}return r}function Li({store:e,kinds:t,words:n,principal:a,invariantContext:r}){let i=Ri(e,t,{...a?{principal:a}:{},...r?{invariantContext:r}:{}});return i.length===0||n.trim().length===0?null:(0,T.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:i.map(({kind:d,affordance:l,mutation:s,arg:c})=>(0,T.jsxs)("section",{style:{...ee,display:"grid",gap:14},children:[(0,T.jsxs)("h2",{style:X,children:[Re(Sa(Ye(e.schema.tryDefinition(d),d)))," called \u201C",n,"\u201D"]}),(0,T.jsx)(Ie,{store:e,mutation:s,prefilled:l.args,open:l.open,initial:{[c]:n},...a?{principal:a}:{}})]},`${l.id}|${n}`))})}function Ho({asked:e}){let t=de();return t?(0,T.jsx)(Io,{asked:e,desk:t.aiDesk}):null}function Io({asked:e,desk:t}){return _a(t)?(0,T.jsx)("p",{style:{margin:0},children:(0,T.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:a=>ja(t,{pointed:{about:[]},asked:e,returnTo:a.currentTarget}),style:{...G,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",e,"\u2019"]})}):null}var h=H(B(),1),Mi=8,Ei=40;function Fo(e,t){let n=t?.fields?.shape??{},a=Object.keys(n).find(r=>ba(n[r])&&ka(e[r]));return a===void 0?void 0:e[a]}function Jn({context:e}){let t=Ue(),n=ve(e.store.schema,t.slug??"");return n?(0,h.jsx)($i,{context:e,kind:n}):(0,h.jsx)(te,{context:e,children:(0,h.jsx)(ie,{context:e,children:"No such kind of thing here."})})}function $i({context:e,kind:t,opening:n,row:a,layout:r="list",description:i,bare:d}){let{store:l,brand:s,invariantContext:c}=e;Q(l);let[m,v]=pt(),w=`list-${(0,Me.useId)().replace(/:/g,"")}`,g=l.schema.tryDefinition(t),x=Pa(m.get("archived")),N=l.graph.nodesOfKind(t,{archived:x}),q=Je(l).relations.filter(o=>o.from===t||o.to===t),u=new Set(l.violations(c).flatMap(o=>o.nodeIds)),M=Cr(l.schema,Pr(l.schema,xr(l.schema,t))),j=q.map(o=>o.edgeKind),P=qo(m,M,j),D=["sort","filter","group","q","by","with","past","archived",...j].some(o=>m.has(o)),ae=N.length>=Ei,oe=g?.fieldRoles?.when,he=e.views?.arrangement?.()?.lists?.[t],J=wr(he),ue=hr(he?.group),Ke=Go(ae,oe),Pe=n??(J?{...Ke,...J}:Ke),Ce=D?P.arrangement:$n(Pe,M).arrangement,S=J?.sort,f=Ce.sort&&S?.then&&Ce.sort.by===S.by&&Ce.sort.direction===S.direction?{...Ce,sort:S}:Ce,R=Ar(f.query??""),E=[...f.filter??[],...R.conditions].some(o=>o.key==="is"&&(o.value==="past"||o.value==="any"))||br(g,[...f.filter??[],...R.conditions]),ne=E||!g?.lifecycle?f:{...f,filter:[...f.filter??[],{key:"is",value:"current"}]},z=new Map,p=Wt(N,ne,{schema:l.schema,graph:l.graph,flagged:u,...typeof c?.today=="string"?{today:c.today}:{},read:(o,y)=>{let $=z.get(o.id);return $||z.set(o.id,$=yt(l.schema,l.graph,o)),$[y]}}),L=ue&&f.group?.by===ue.by&&!f.group.bucket?M.groups.find(o=>o.key===ue.by):void 0,V=ue&&L&&(L.type==="choice"||L.type==="boolean")?vr(p.groups,ue,{type:L.type,...L.options?{options:L.options}:{}}):p.groups.map(o=>({...o,closed:!1})),se=new Set((m.get("open")??"").split(",").filter(Boolean)),Wi=!!f.query||(f.filter??[]).some(o=>o.key===ue?.by),aa=o=>L?.type==="boolean"?o==="1"?"true":"false":o,ra=o=>o.closed&&!Wi&&!se.has(aa(o.key)),Ki=o=>{let y=new URLSearchParams(m),$=new Set(se);$.has(o)?$.delete(o):$.add(o),$.size>0?y.set("open",[...$].join(",")):y.delete("open"),v(y,{replace:!0})},Ae=p.nodes,rt=g?.lifecycle&&!E?N.filter(o=>st(g,o)):N,ia=N.length-rt.length,sn=f.group?.by??null,Bi=o=>{let y=new URLSearchParams(m);for(let le of["sort","filter","group","q","by","with","past","archived",...q.map(Rt=>Rt.edgeKind)])y.delete(le);let $=Tr(o);for(let le of["sort","filter","group","q","archived"])$[le]&&y.set(le,$[le]);![...y.keys()].some(le=>["sort","filter","group","q"].includes(le))&&(n||J||ae||oe)&&y.set("sort",""),v(y)},{principal:it}=e,ln=Xe(l,t,{...it?{principal:it}:{},...e.invariantContext?{context:e.invariantContext}:{}}),Be=ln.actions.affordances.map(o=>({affordance:o,mutation:l.allMutations().find(y=>y.name===o.mutation)})).filter(o=>o.mutation!==void 0),Gi=ln.actions.withheld,dn=()=>new Set(Ae.length===0?Be.map(({mutation:o})=>o.name):[]),[cn,oa]=(0,Me.useState)(()=>({kind:t,open:dn()}));cn.kind!==t&&oa({kind:t,open:dn()});let sa=o=>(cn.kind===t?cn.open:dn()).has(o),la=(o,y)=>oa($=>{let le=new Set($.open);return y?le.add(o):le.delete(o),{kind:$.kind,open:le}}),da=`begin-${(0,Me.useId)().replace(/:/g,"")}`,ca=R.words&&Ae.length===0?Object.fromEntries(an(l,t,ln.actions.affordances).map(o=>[o.mutation.name,o.arg])):{},je=Y(l,t),xt=e.views?.lookup(t,{cardinality:"one",fidelity:"glyph"}),pn=xt!==void 0&&!lt(xt)?xt:void 0,un=(f.group?.bucket??"day")==="day"?f.group?.by:void 0,gn=(f.filter??[]).map(o=>o.key),qi=gn.filter(o=>gn.indexOf(o)===gn.lastIndexOf(o)&&/choice|boolean/.test(M.filters.find(y=>y.key===o)?.type??"")),mn=o=>{let y={...g?.computed?yt(l.schema,l.graph,o):o};un&&!String(y[un]).includes("T")&&delete y[un];for(let $ of qi)delete y[$];return y},pa=o=>rr(g?.fields?.shape?.[o])?.type==="enum",Pt=o=>{let y=ge(g,o);if(a)return(0,h.jsxs)("li",{"data-testid":"record-row","data-graview-record":o.id,style:{minWidth:0},...Sn(o.id),children:[vn(o,y),a(o,{label:y,href:_(l.schema,t,o.id),flagged:u.has(o.id),glance:ni(mn(o),g,y)})]},o.id);if(pn){let kn=qt(xt,o,l.graph),Yi=Object.fromEntries(Object.entries(mn(o)).filter(([Qi])=>!kn?.fields.has(Qi))),ha=kn?Fn(Yi,g,kn.title??y,pa):[];return(0,h.jsxs)("li",{"data-testid":"record-row","data-graview-record":o.id,style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,paddingBlock:10,borderTop:"1px solid var(--graview-edge)"},...Sn(o.id),children:[vn(o,y),(0,h.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,h.jsx)(pn,{node:o,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...u.has(o.id)?{flagged:[o.id]}:{}})}),ha.length>0?(0,h.jsx)("span",{style:{...C,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:(0,h.jsx)(Dn,{runs:ha})}):null,(0,h.jsx)(jo,{to:_(l.schema,t,o.id),label:u.has(o.id)?`${y} \u2014 implicated in a problem`:y})]},o.id)}let $=Fn(mn(o),g,y,pa),le=$.length>0,Rt=R.words?Rr(g,o,R.words):void 0,fa=ae?void 0:or(o,g),Lt=Fo(o,g),ya=(0,h.jsxs)(O,{to:_(l.schema,t,o.id),className:"graview-row-title",...y.length>60?{title:y}:{},children:[u.has(o.id)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,y]});return(0,h.jsxs)("li",{className:"graview-row","data-graview-record":o.id,...Sn(o.id),children:[vn(o,y),fa?(0,h.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:14,minWidth:0},children:[(0,h.jsx)(dt,{as:"thumb",file:fa}),ya]}):ya,le||Lt?(0,h.jsxs)("span",{className:"graview-row-glance",children:[(0,h.jsx)(Dn,{runs:$}),le&&Lt?" \xB7 ":null,Lt?(0,h.jsx)(Kt,{address:Lt}):null]}):null,Rt?(0,h.jsx)(nn,{why:Rt}):null]},o.id)},fn=$e(e).filter(o=>o.kind===t&&!o.hidden),ua=he?.filters,Ui=(f.filter??[]).some(o=>o.key!=="is"||o.value!=="any"),Vi=!!(f.sort||f.group||f.query||Ui),ji=rt.length>=Mi||D&&Vi,Oe=f.sort?M.sorts.find(o=>o.key===f.sort.by):void 0,yn=Oe?.type==="date"||Oe!==void 0&&Oe.key===oe,ga=ae&&!p.grouped&&Oe&&(Oe.about==="label"||Oe.type==="text"||yn)?o=>{let y=Oe.about==="label"?ge(g,o):o[Oe.key];if(typeof y!="string"||y.length===0)return yn?"No date":"#";if(yn)return y.slice(0,4);let $=y.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test($)?$:"#"}:void 0,_e=ga?Ae.reduce((o,y)=>{let $=ga(y);return o.at(-1)?.key===$?o.at(-1).nodes.push(y):o.push({key:$,nodes:[y]}),o},[]):void 0,ma=p.grouped&&sn?V.flatMap(o=>ra(o)?[]:o.nodes):_e&&_e.length>1?_e.flatMap(o=>o.nodes):Ae,hn=(0,Me.useMemo)(()=>ma.map(o=>o.id),[ma.map(o=>o.id).join(`
|
|
6
|
-
`)]),Ee=Nr(hn),wn=(0,Me.useId)(),gt=(it?l.permittedMutations(it):l.permittedMutations()).some(o=>{let y=o.subject?.kinds;return y!==void 0&&(y==="*"||y.includes(t))}),vn=(o,y)=>gt?(0,h.jsx)("span",{className:"graview-choose-at",children:(0,h.jsx)("input",{...Ee.boxProps(o.id,y),onPointerEnter:On,onFocus:On})}):null,Sn=o=>gt?{"data-graview-choose":o}:{},_i=(0,Me.useCallback)(o=>{Ee.choose(o),requestAnimationFrame(()=>{let y=Ee.list.current;((o[0]===void 0?null:y?.querySelector(`[data-graview-choose-box="${CSS.escape(o[0])}"]`))??y)?.focus({preventScroll:!0})})},[Ee]),ot=r==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",alignItems:"start",gap:12}:a||pn?{margin:0,padding:0,listStyle:"none",display:"grid",gap:a&&r==="list"?6:0}:void 0,Ct=ot?void 0:"graview-rows",mt=o=>`list-at-${o.replace(/[^\p{L}\p{N}]/gu,"_")}`,At=q.map(o=>{let y=o.from===t?o.to:o.from,$=o.from===t?o.description:o.inverse??o.description;return{relation:o,far:y,words:$}}),zi=new Set(At.map(o=>(o.words??"").toLowerCase()).filter((o,y,$)=>o&&$.indexOf(o)!==y));return(0,h.jsxs)(d?Bo:te,{context:e,children:[(0,h.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,h.jsxs)("header",{style:{display:"grid",gap:4},children:[d?null:(0,h.jsx)(ut,{context:e}),(0,h.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",columnGap:10,rowGap:4,minWidth:0},children:[(0,h.jsx)(ce,{kind:t,brand:s,schema:l.schema,size:8}),(0,h.jsx)(ie,{context:e,children:je}),Be.length>0?(0,h.jsx)("span",{style:{marginLeft:"auto",display:"flex",flexWrap:"wrap",columnGap:14,rowGap:8},"data-testid":"beginnings-open",children:Be.map(({affordance:o,mutation:y})=>(0,h.jsx)(Uo,{name:y.name,title:y.title??y.name,panel:`${da}-${y.name}`,open:sa(y.name),onOpen:$=>la(y.name,$)},o.id))}):null]}),Ae.length>0?(0,h.jsx)(Jr,{place:"here",to:[{label:`Skip to the ${Ae.length===1?Ye(g,t):`${Ae.length} ${je.toLowerCase()}`}`,testid:"records",go:()=>{let o=document.querySelector(`[data-graview-skip-target="${CSS.escape(wn)}"]`);Nn(o?.querySelector('[data-graview-choose-box][tabindex="0"]')??o)}},...rt.length>0?[{label:"Skip to arranging them",testid:"arranging",go:()=>{let o=document.querySelector(`[data-graview-skip-target="${CSS.escape(wn)}"]`)?.parentElement?.querySelector('[role="group"][aria-label="Arrange"]');Nn(o?.querySelector('button[data-testid$="-add"], button[data-testid$="-all"]')??o)}}]:[]]}):null,i??g?.description?(0,h.jsx)("p",{style:re,children:i??g?.description}):null,At.length>0||fn.length>0?(0,h.jsxs)("p",{style:{...C,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[At.length>0?(0,h.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",At.map(({relation:o,far:y,words:$},le)=>(0,h.jsxs)("span",{"data-relation":o.edgeKind,children:[le>0?(0,h.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,y==="*"?Re($??ze(o.edgeKind)):(0,h.jsx)(O,{to:`/${U(l.schema,y)}`,style:G,title:Y(l,y),children:$&&zi.has($.toLowerCase())?`${Re($)}: ${Y(l,y).toLowerCase()}`:Re($??Y(l,y))})]},`${o.edgeKind}|${o.from}|${o.to}`))]}):null,fn.length>0?(0,h.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",fn.map((o,y)=>(0,h.jsxs)("span",{children:[y>0?(0,h.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,h.jsx)(O,{to:fe(e,o),style:G,children:o.title})]},et(o)))]}):null]}):null]}),Be.length>0?(0,h.jsx)("div",{style:{display:"contents"},"data-testid":"beginnings",children:Be.map(({affordance:o,mutation:y})=>{let $=!!(ca[y.name]&&Ae.length===0);return(0,h.jsx)(Vo,{name:y.name,id:`${da}-${y.name}`,description:y.description,open:sa(y.name),onClose:()=>la(y.name,!1),children:(0,h.jsx)(Ie,{store:l,mutation:y,prefilled:o.args,open:o.open,...$?{initial:{[ca[y.name]]:R.words}}:{},...e.principal?{principal:e.principal}:{}},$?`${y.name}|${R.words}`:y.name)},o.id)})}):null,P.dropped.length>0?(0,h.jsxs)("p",{style:{...C,margin:0},"data-testid":"list-dropped",children:["This link asked for ",P.dropped.join(", "),", which ",je.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,rt.length>0?(0,h.jsx)($r,{schema:l.schema,graph:l.graph,kind:t,arrangement:f,onChange:Bi,kept:{shown:Ae.length,of:rt.length},noun:{one:Ye(g,t),many:je.toLowerCase()},...ji?{}:{allow:!1},...ua?{filters:ua}:{},offers:M,chips:{nodes:rt,flagged:u,...typeof c?.today=="string"?{today:c.today}:{}},query:e.framed===!0&&e.barAbove!==!0}):null,(0,h.jsx)("style",{children:_t}),gt?(0,h.jsx)("style",{children:Hr+Ko}):null,(0,h.jsx)("div",{className:"graview-list","data-graview-skip-target":wn,...gt?{...Ee.listProps,ref:Ee.list,tabIndex:-1,"data-graview-choosable":"","aria-label":Ee.chosen.length>0?`${je}, ${Ee.chosen.length} chosen`:je,role:"group"}:{},children:Ae.length===0&&R.words?(0,h.jsxs)("p",{style:re,"data-testid":"none-yet",children:["Nothing here is called \u201C",R.words,"\u201D."," ",(0,h.jsx)("span",{style:C,"data-testid":"list-searched",children:Dt(l.schema,{kinds:[t],past:E})})," ",(0,h.jsx)(O,{to:"?",style:G,children:"Show every one"})]}):Ae.length===0?(0,h.jsxs)("p",{style:re,"data-testid":"none-yet",children:[f.filter?.length||f.query?"None of them.":"None yet",!f.filter?.length&&!f.query&&Be.length>0?` \u2014 the first one starts above, with \u201C${Be[0]?.mutation.title??Be[0]?.mutation.name}\u201D.`:!f.filter?.length&&!f.query?".":"",f.filter?.length||f.query?(0,h.jsxs)(h.Fragment,{children:[" ",(0,h.jsx)(O,{to:"?",style:G,children:"Show every one"})]}):null]}):p.grouped&&sn?(0,h.jsx)("div",{style:{display:"grid",gap:"1rem"},"data-testid":"records","data-grouped":sn,children:V.map(o=>{if(!o.closed)return(0,h.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,h.jsxs)("h2",{className:"graview-group-head",children:[o.label," ",(0,h.jsx)("span",{children:o.nodes.length})]}),(0,h.jsx)("ul",{style:ot,className:Ct,"data-graview-rows":"",children:o.nodes.map(Pt)})]},o.key||"-");let y=ra(o),$=`${w}-${mt(o.key||"none")}`;return(0,h.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group","data-closed":y?"shut":"open",children:[(0,h.jsx)("h2",{className:"graview-group-head",children:(0,h.jsxs)("button",{type:"button",className:"graview-group-toggle","aria-expanded":!y,"aria-controls":$,"data-testid":"list-group-toggle",onClick:()=>Ki(aa(o.key)),children:[(0,h.jsx)("span",{"aria-hidden":"true",children:y?"\u25B8":"\u25BE"}),o.label," ",(0,h.jsxs)("span",{children:["\xB7 ",o.nodes.length]}),(0,h.jsxs)("span",{style:Do,children:[" ",o.nodes.length===1?Ye(g,t):je.toLowerCase()]})]})}),(0,h.jsx)("ul",{id:$,style:y?{...ot,display:"none"}:ot,className:Ct,"data-graview-rows":"",hidden:y,children:y?null:o.nodes.map(Pt)})]},o.key||"-")})}):_e&&_e.length>1?(0,h.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":Oe?.type==="date"?"year":"letter",children:[(0,h.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...C,display:"flex",flexWrap:"wrap",gap:Oe?.type==="date"?"0 10px":"0 4px",lineHeight:1.3},children:_e.map(o=>(0,h.jsx)("a",{href:`#${mt(o.key)}`,onClick:y=>{y.preventDefault(),document.getElementById(mt(o.key))?.scrollIntoView({block:"start"})},style:{...Se,minWidth:24,justifyContent:"center"},children:o.key},o.key))}),_e.map(o=>(0,h.jsxs)("section",{"data-testid":"list-section","aria-labelledby":mt(o.key),style:{display:"grid",gap:0},children:[(0,h.jsx)("h2",{id:mt(o.key),className:"graview-group-head",children:o.key}),(0,h.jsx)("ul",{style:ot,className:Ct,"data-graview-rows":"",children:o.nodes.map(Pt)})]},o.key))]}):(0,h.jsx)("ul",{style:ot,className:Ct,"data-testid":"records","data-graview-rows":"",children:Ae.map(Pt)})}),gt?(0,h.jsx)(Ir,{store:l,chosen:Ee.chosen,...it?{principal:it}:{},...c?{context:c}:{},anchor:Wo,of:hn.length,onChooseAll:()=>Ee.choose(hn),onClear:Ee.clear,onActed:_i}):null,ia>0?(0,h.jsxs)(O,{to:Ti(m,"filter","is:any"),style:{...G,...C,justifySelf:"start"},"data-testid":"past-link",children:["+",ia," past"]}):null,x===!1&&l.graph.count(t,{archived:!0})>0?(0,h.jsxs)(O,{to:Ti(m,"archived","true"),style:{...G,...C,justifySelf:"start"},"data-testid":"archived-link",children:["+",l.graph.count(t,{archived:!0})," archived"]}):null]}),(0,h.jsx)(tn,{context:e,withheld:Gi,style:ee,testId:"withheld"})]})}var Do={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Wo=()=>document.querySelector("[data-graview-choosable]")?.closest("[data-embed-content]")??null,Ko=`
|
|
7
|
-
.graview-list[data-graview-choosable]{outline:none}
|
|
8
|
-
.graview-list [data-graview-choose]{position:relative;padding-left:34px}
|
|
9
|
-
.graview-choose-at{position:absolute;left:2px;top:0;bottom:0;z-index:${Ta.raised};display:flex;align-items:center}
|
|
10
|
-
@media (min-width: 900px) and (pointer: fine){
|
|
11
|
-
.graview-list [data-graview-choose]{padding-left:0}
|
|
12
|
-
.graview-choose-at{left:-34px}
|
|
13
|
-
}
|
|
14
|
-
@media (pointer: coarse){
|
|
15
|
-
.graview-list:not([data-graview-choosing]) [data-graview-choose]{padding-left:0}
|
|
16
|
-
.graview-list:not([data-graview-choosing]) .graview-choose-at{display:none}
|
|
17
|
-
}
|
|
18
|
-
`;function Bo({children:e}){return(0,h.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:e})}var Go=(e,t)=>t?{sort:{by:t,direction:"desc"}}:e?{sort:{by:"label",direction:"asc"}}:{};function qo(e,t,n){let a=$t({...e.get("sort")?{sort:e.get("sort")}:{},...e.get("filter")?{filter:e.get("filter")}:{},...e.get("group")?{group:e.get("group")}:{},...e.get("q")?{q:e.get("q")}:{},...e.get("archived")?{archived:e.get("archived")}:{}}),r=[...a.filter??[]],i=e.get("by"),d=a.group??(i?{by:i}:void 0);for(let s of n){let c=e.get(s);c&&r.push({key:s,value:c})}let l=e.get("with");return l&&r.push({key:l,value:"*"}),e.get("past")==="1"&&!r.some(s=>s.key==="is")&&r.push({key:"is",value:"any"}),$n({...a.sort?{sort:a.sort}:{},...a.query?{query:a.query}:{},...r.length>0?{filter:r}:{},...d?{group:d}:{},...a.archived!==void 0?{archived:a.archived}:{}},t)}function Ti(e,t,n){let a=new URLSearchParams(e);return a.set(t,n),a.delete("past"),`?${a.toString()}`}function Uo({name:e,title:t,panel:n,open:a,onOpen:r}){return(0,h.jsxs)("button",{type:"button","data-testid":`act-open-${e}`,"data-graview-act":e,"aria-expanded":a,"aria-controls":n,onClick:()=>{r(!a),a||requestAnimationFrame(()=>document.getElementById(n)?.querySelector("input, select, textarea, button")?.focus())},style:{...Se,minHeight:28,margin:"-4px 0",padding:"0 2px",border:0,background:"none",font:"inherit",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,h.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),t]})}function Vo({name:e,id:t,description:n,open:a,onClose:r,children:i}){return(0,h.jsxs)("div",{"data-testid":`act-${e}`,id:t,hidden:!a,onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),r(),document.querySelector(`[aria-controls="${t}"]`)?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,h.jsx)("p",{style:{...C,margin:0,maxWidth:"58ch"},children:n}):null,i]})}function jo({to:e,label:t}){let n=(0,Me.useRef)(null);return Fr(n),(0,h.jsx)(O,{ref:n,to:e,"aria-label":t,style:{position:"absolute",inset:0,borderRadius:6}})}var at=H(He(),1);var bt=H(He(),1);var I=H(B(),1);function ea({context:e}){let{store:t,brand:n,invariantContext:a,principal:r}=e;Q(t);let i=t.violations(a),d=t.allInvariants(),l=Ht(t,i),s=za(t.schema,d);return(0,I.jsxs)(te,{context:e,children:[(0,I.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,I.jsx)(ie,{context:e,children:i.length===0?"All rules hold":"What is broken"}),(0,I.jsx)("p",{style:re,"data-testid":"problems-count",children:i.length===0?"Every declared rule is satisfied by what is here.":Ca(i)})]}),(0,I.jsx)(Ai,{context:e}),l.map((c,m)=>{let v=c.nodeIds[0],w=v?t.graph.getNode(v):void 0;return(0,I.jsxs)("section",{style:{display:"grid",gap:10,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:[c.line?null:(0,I.jsx)(rn,{violation:c,schema:t.schema,...n?{brand:n}:{}}),w?(0,I.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,I.jsx)(ce,{kind:w.kind,brand:n,schema:t.schema,size:7}),(0,I.jsx)(O,{to:_(t.schema,w.kind,w.id),style:G,children:ge(t.schema.tryDefinition(w.kind),w)})]}):null,c.line?(0,I.jsx)(rn,{violation:c,schema:t.schema,...n?{brand:n}:{}}):null,(0,I.jsx)(on,{store:t,repairs:c.repairs,...r?{principal:r}:{}})]},m)}),d.length>0?(0,I.jsxs)("section",{style:{...ee,display:"grid",gap:12},"data-testid":"rules",children:[(0,I.jsx)("h2",{style:X,children:"The rules"}),(0,I.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:d.map(c=>{let m=i.filter(g=>g.invariant===c.name).length,v=s.get(c.name),w=c.label??c.name;return(0,I.jsxs)("li",{"data-graview-rule":c.name,style:{display:"grid",gap:2},children:[(0,I.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[v?(0,I.jsx)(It,{line:v,schema:t.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,I.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:w}),(0,I.jsx)("span",{style:{...C,color:m>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:m===0?"holds":`broken in ${m} ${m===1?"place":"places"}`})]}),v&&w.trim().length>0?(0,I.jsx)("span",{style:C,children:w}):null]},c.name)})})]}):null]})}function rn({violation:e,schema:t,brand:n}){if(!e.line)return(0,I.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:e.message});let a=Qa(e),r=Ya(e);return r?(0,I.jsxs)("div",{style:{display:"grid",gap:4},"data-testid":"problem-line",children:[(0,I.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},"data-testid":"problem-says",children:r}),a?(0,I.jsx)("span",{style:C,children:a}):null,(0,I.jsxs)("details",{"data-testid":"problem-judged",style:C,children:[(0,I.jsx)("summary",{style:{cursor:"pointer",width:"fit-content",minHeight:24},children:"How it is judged"}),(0,I.jsx)(It,{line:e.line,schema:t,...n?{brand:n}:{},lead:"none"})]})]}):(0,I.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",children:[(0,I.jsx)(It,{line:e.line,schema:t,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)"}}),a?(0,I.jsx)("span",{style:C,children:a}):null]})}function on({store:e,repairs:t,principal:n}){let[a,r]=(0,bt.useState)(null),[i,d]=(0,bt.useState)(null),l=(0,bt.useRef)([]);if(t.length===0)return null;let s=a===null?null:t[a],c=s&&(s.missing??[]).length>0?e.allMutations().find(m=>m.name===s.mutation):void 0;return(0,I.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,I.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:t.map((m,v)=>{let w=(m.missing??[]).length>0,g=e.permits({name:m.mutation,args:{...m.args}},n);return g.ok?(0,I.jsx)("button",{ref:x=>{l.current[v]=x},type:"button","data-graview-repair":m.mutation,"data-graview-asks":w||void 0,"aria-expanded":w?a===v:void 0,onClick:()=>{if(d(null),w){r(a===v?null:v);return}r(null);try{e.apply({name:m.mutation,args:{...m.args}},n?{author:n}:{})}catch(x){d(Ft(e.schema,e.allMutations(),x))}},style:ke,children:w?`${m.label} \u2026`:m.label},v):(0,I.jsxs)("p",{"data-testid":"withheld","data-withheld":g.refusal.wouldNeed.join(",")||"nobody",style:{...C,margin:0},children:[(0,I.jsx)("s",{children:m.label})," \u2014 ",g.refusal.message]},v)})}),c&&s?(0,I.jsx)(Ie,{store:e,mutation:c,prefilled:{...s.args},only:s.missing??[],label:s.label,autoFocus:!0,onDone:()=>{let m=a;r(null),requestAnimationFrame(()=>{let v=m===null?null:l.current[m];if(v?.isConnected){v.focus();return}let w=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");w&&(w.hasAttribute("tabindex")||(w.tabIndex=-1),w.focus())})},...n?{principal:n}:{}}):null,s&&!c&&(s.missing??[]).length>0?(0,I.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:Hn},children:["\u201C",s.label,"\u201D names ",s.mutation,", which this app does not declare."]}):null,i?(0,I.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:Hn},children:i}):null]})}var ta=H(He(),1);var Ve=H(B(),1);function Oi({store:e,link:t,principal:n}){let[a,r]=(0,ta.useState)(!1),[i,d]=(0,ta.useState)(null),l=tr(t);return(0,Ve.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,Ve.jsx)("button",{type:"button","data-graview-provisional":"",title:l,"aria-label":`Unsure link: ${l}`,"aria-expanded":a,onClick:()=>r(!a),style:{border:"1px dashed var(--graview-ink-muted)",borderRadius:999,background:"transparent",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.75rem",lineHeight:1,padding:"2px 6px",cursor:"pointer"},children:"unsure"}),a?(0,Ve.jsxs)("span",{style:{...C,display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,Ve.jsx)("span",{children:l}),(0,Ve.jsx)("button",{type:"button",style:{...ke,padding:"4px 10px"},onClick:()=>{try{e.apply({name:Aa,args:{kind:t.edge.kind,from:t.edge.from,to:t.edge.to}},n?{author:n}:{}),r(!1)}catch(s){d(Ft(e.schema,e.allMutations(),s))}},children:"Keep this link"}),i?(0,Ve.jsx)("span",{role:"alert",children:i}):null]}):null]})}var ye=H(B(),1);function Ni({nodeId:e,node:t,field:n,inPlace:a,labelStyle:r=we}){return n.files?(0,ye.jsx)(dt,{as:"field",read:!a,nodeId:e,field:n.key,label:n.label,files:n.files,labelStyle:r,style:{gap:4}}):n.long?(0,ye.jsx)(Er,{nodeId:e,field:n.key,label:n.label,value:n.value,markdown:n.markdown,style:{gridColumn:"1 / -1",gap:4},labelStyle:r,valueStyle:{lineHeight:1.6}}):(0,ye.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,ye.jsx)("dt",{style:r,children:n.label}),(0,ye.jsx)("dd",{style:{margin:0,overflowWrap:"anywhere",minWidth:0},children:n.linked?(0,ye.jsx)(pr,{relation:n.linked.relation,refs:n.linked.refs,...a?{nodeId:e,field:n.key}:{}}):n.app?(0,ye.jsx)(Kt,{address:n.app,as:"record",...a?{nodeId:e,field:n.key}:{}}):n.href?(0,ye.jsx)(Mr,{href:n.href,field:n.key,value:n.value,stored:n.stored,...a?{nodeId:e}:{}}):a?(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsx)(Bt,{nodeId:e,field:n.key,value:n.value,stored:n.stored}),n.repeats?(0,ye.jsx)(ur,{nodeId:e,field:n.key,start:t?.[n.key],value:t?.[`${n.key}Repeat`],label:`${n.label} repeats`}):null]}):n.value})]})}var k=H(B(),1),_o=[];function na({context:e}){let{store:t,brand:n,principal:a,invariantContext:r}=e;Q(t);let i=de()!==null,d=Ue(),l=decodeURIComponent(d.id??""),s=ci(t,l,{...a?{principal:a}:{},...r?{context:r}:{}}),c=Ht(t,s?.violations??_o),[m,v]=(0,at.useState)(null),[w,g]=(0,at.useState)(!1),[x,N]=(0,at.useState)(null),q=(0,at.useRef)(null),u=(0,at.useRef)(null),M=gr({flow:"both",letters:!0}),j=p=>{(q.current?.parentElement?.querySelector(`[data-affordance="${p.replace(/["\\]/g,"\\$&")}"]`)??q.current)?.focus()};if(!s)return(0,k.jsx)(te,{context:e,children:(0,k.jsx)(ie,{context:e,children:"Nothing lives at this address."})});let P=t.graph.getNode(l),D=t.schema.tryDefinition(s.kind),ae=D?.describe&&P?Xa(D,P):null,oe=[...t.log.all()].filter(p=>!Mt(p)&&(p.writes.includes(l)||p.reads.includes(l))).slice(-8).reverse(),he=t.log.all().find(p=>!Mt(p)&&p.undoes===void 0&&p.primitives.some(L=>L.op==="add-node"&&L.node.id===l)),J=s.actions.affordances.filter(p=>p.provider!=="invariant"),ue=J.filter(p=>p.destructive||p.setsAside),Ke=w||ue.length<2?J:J.filter(p=>!ue.includes(p)),Pe=e.views?.lookup(s.kind,{cardinality:"one",fidelity:"full"}),Ce=Pe!==void 0&&!lt(Pe)?Pe:void 0,S=Ce&&P?qt(Pe,P,t.graph):void 0,f=S?s.fields.filter(p=>!S.fields.has(p.key)):s.fields,R=S?s.links.flatMap(p=>{let L=p.targets.filter(V=>!S.records.has(V.id));return L.length>0?[{...p,targets:L}]:[]}):s.links,E=Ce!==void 0&&Ua(Pe),ne=i&&ir(D).length>0,z=$e(e).filter(p=>!p.hidden&&(p.kind===s.kind||p.across===s.kind));return(0,k.jsxs)(te,{context:e,children:[(0,k.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,k.jsx)(ut,{context:e}),(0,k.jsx)(ie,{context:e,children:i&&P?.label===s.label?(0,k.jsx)(Bt,{nodeId:l,field:"label",value:s.label,said:s.label}):s.label}),ae&&ae!==s.label?(0,k.jsx)("p",{style:re,children:ae}):null,he?.lineage?(0,k.jsxs)("p",{style:{...C,margin:0},"data-testid":"record-lineage",children:["Made by ",ht(he,a,{graph:t.graph,schema:t.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}}),", ",An(he.lineage)]}):null,(0,k.jsx)(Yt,{context:e,stop:`#focus=${encodeURIComponent(l)}`,style:{...qe,...C},"data-testid":"spatial-link"}),i&&P?(0,k.jsx)(Tn,{choices:[{on:"changed",record:l},{on:"act",record:l},{on:"reaches",kind:s.kind,condition:"",record:l}],label:"Notify me when this changes",testId:"record-notify",style:{...ke,...C,justifySelf:"start"}}):null,z.length>0?(0,k.jsxs)("p",{style:{...C,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",z.map((p,L)=>(0,k.jsxs)("span",{children:[L>0?(0,k.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,k.jsx)(O,{to:fe(e,p),style:G,children:p.title})," ",(0,k.jsx)(Yt,{context:e,stop:`#view=${encodeURIComponent(p.as)}`,style:{...G,...C,display:"inline-block",minWidth:24,textAlign:"center"},title:`${p.title}, in the scene`,label:`${p.title}, in the scene`,children:(0,k.jsx)("span",{"aria-hidden":"true",children:"\u2197"})})]},et(p)))]}):null]}),P&&xa(P)?(0,k.jsx)(Yo,{context:e,id:l,kind:s.kind}):null,P&&Ra(t,l)?(0,k.jsx)(zo,{context:e,id:l,kind:s.kind}):null,Ce&&P?(0,k.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,k.jsx)(Dr,{children:(0,k.jsx)(Zt,{when:Ot(Pe),children:(0,k.jsx)(Ce,{node:P,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...s.violations.length>0?{flagged:[l]}:{}})})})}):null,s.violations.length>0?(0,k.jsx)("section",{"data-testid":"record-violations",style:{display:"grid",gap:12,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:c.map((p,L)=>(0,k.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,k.jsx)(rn,{violation:p,schema:t.schema,...n?{brand:n}:{}}),(0,k.jsx)(on,{store:t,repairs:pi(s.actions,p.repairs),...a?{principal:a}:{}})]},L))}):null,!E&&(f.length>0||ne)?(0,k.jsxs)("section",{style:{...ee,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,k.jsx)("h2",{style:X,children:"The facts"}),er(D,f).map((p,L)=>{let V=(0,k.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:p.fields.map(se=>(0,k.jsx)(Ni,{nodeId:l,node:P,field:se,inPlace:i},se.key))});return p.title?(0,k.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,k.jsx)("h3",{"data-graview-field-group":p.title,style:{...X,fontSize:"inherit"},children:p.title}),V]},L):(0,k.jsx)("div",{children:V},L)}),ne?(0,k.jsx)(dt,{as:"unfilled",nodeId:l,skip:[...S?.fields??[]],labelStyle:we,style:{gap:4}}):null]}):null,(E?[]:R).map(p=>(0,k.jsxs)("section",{style:{...ee,display:"grid",gap:10},children:[(0,k.jsx)("p",{style:we,children:ti(t,p)}),p.description?(0,k.jsx)("h2",{style:X,children:Re(p.description)}):(0,k.jsxs)("h2",{style:X,"aria-label":ze(p.edgeKind),children:[p.direction==="in"?"\u2190 ":"\u2192 ",ze(p.edgeKind)]}),(0,k.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:p.targets.map(L=>{let V=nr(t,p.direction==="in"?{kind:p.edgeKind,from:L.id,to:l}:{kind:p.edgeKind,from:l,to:L.id});return(0,k.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,k.jsx)(ce,{kind:L.kind,brand:n,schema:t.schema,size:7}),(0,k.jsxs)(O,{to:_(t.schema,L.kind,L.id),style:G,children:[L.label,L.apart?(0,k.jsxs)("span",{style:C,children:[" \xB7 ",L.apart]}):null]}),V?.provisional?(0,k.jsx)(Oi,{store:t,link:V,...a?{principal:a}:{}}):null]},L.id)})}),(p.direction==="out"&&t.schema.edge(p.edgeKind)?.cardinality==="one"?[]:[...new Set(p.targets.map(L=>L.kind))]).map(L=>(0,k.jsx)(O,{to:`/${U(t.schema,L)}?${encodeURIComponent(p.edgeKind)}=${encodeURIComponent(l)}`,style:{...qe,...C},"data-testid":"related-all",children:(0,k.jsxs)(Qe,{children:["Sort and filter ",p.description??`these ${Y(t,L).toLowerCase()}`,p.targets.some(V=>V.kind!==L)?` (${Y(t,L).toLowerCase()})`:""]})},L))]},`${p.edgeKind}|${p.direction}|${p.description??""}`)),!E&&(J.length>0||s.actions.withheld.length>0)?(0,k.jsxs)("section",{style:{...ee,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,k.jsx)("h2",{style:X,ref:q,tabIndex:-1,children:"What can be done"}),(0,k.jsxs)("div",{role:"toolbar","aria-label":"What can be done",...M,style:{display:"flex",flexWrap:"wrap",gap:8},children:[Ke.map(p=>{let L=m===p.id;return(0,k.jsx)("button",{type:"button","data-affordance":p.id,"data-rank":p.rank,"data-graview-act":p.mutation,[Ln]:"",autoFocus:w&&p===ue[0],"aria-expanded":L,onClick:()=>v(L?null:p.id),style:{...ke,...L?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:p.label},p.id)}),Ke.length<J.length?(0,k.jsxs)("button",{type:"button","aria-expanded":!1,onClick:()=>g(!0),style:{...ke,...C},"data-testid":"record-actions-more",[Ln]:"",children:["Show ",J.length-Ke.length," more"]}):null]}),J.map(p=>{if(m!==p.id)return null;let L=t.allMutations().find(V=>V.name===p.mutation);return L?(0,k.jsxs)("div",{ref:u,onKeyDown:V=>{if(V.key!=="Escape"||V.defaultPrevented)return;V.preventDefault(),v(null);let se=p.id;requestAnimationFrame(()=>j(se))},style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,k.jsx)("h3",{style:X,children:p.label}),L.description?(0,k.jsx)("p",{style:{...C,margin:0},children:L.description}):null,(0,k.jsx)(Ie,{store:t,mutation:L,prefilled:p.args,open:p.open,label:p.label,autoFocus:!0,onDone:()=>{v(null),N(p.mutation);let V=p.id;requestAnimationFrame(()=>j(V))},...a?{principal:a}:{}})]},p.id):null}),i&&x!==null&&m===null?(0,k.jsx)(Tn,{choices:[{on:"act",act:x,record:l},{on:"act",act:x}],label:"Notify me when someone else does this",testId:"notify-after-act",style:{...ke,...C,justifySelf:"start"}}):null,(0,k.jsx)(tn,{context:e,withheld:s.actions.withheld})]}):null,i?(0,k.jsx)(ei,{id:l,style:ee,headingStyle:X}):null,oe.length>0?(0,k.jsxs)("section",{style:{...ee,display:"grid",gap:10},"data-testid":"record-history",children:[(0,k.jsx)("h2",{style:X,children:"What has happened"}),(0,k.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:oe.map(p=>(0,k.jsxs)("li",{style:C,children:[(0,k.jsx)("span",{style:{color:"var(--graview-ink)"},children:p.intent}),p.lineage?(0,k.jsxs)("span",{"data-graview-lineage":"",children:[" \xB7 ",An(p.lineage)]}):null," \u2014 ",ht(p,a,{graph:t.graph,schema:t.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},p.id))})]}):null]})}function zo({context:e,id:t,kind:n}){let{store:a,principal:r}=e,i={name:`allow-tidying-${n}`,args:{id:t}},d=a.allMutations().some(l=>l.name===i.name)&&a.permits(i,r).ok;return(0,k.jsxs)("section",{"data-testid":"record-left-alone",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,k.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,k.jsx)("strong",{children:"Left alone."})," Nothing automated changes it; tidying passes it by."]}),d?(0,k.jsx)("button",{type:"button",style:ke,"data-testid":"allow-tidying",onClick:()=>a.apply(i,r?{author:r}:{}),children:"Allow tidying again"}):null]})}function Yo({context:e,id:t,kind:n}){let{store:a,principal:r}=e,i={name:`unarchive-${n}`,args:{id:t}},d=a.allMutations().some(c=>c.name===i.name)&&a.permits(i,r).ok,l=[...a.log.all()].reverse().find(c=>!Mt(c)&&c.mergedInto!==void 0&&c.writes.includes(t)),s=l?.mergedInto!==void 0?a.graph.getNode(l.mergedInto):void 0;return(0,k.jsxs)("section",{"data-testid":"record-archived",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,k.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,k.jsx)("strong",{children:"Archived."})," Kept with its ties and history, and out of lists, counts and rules.",s?(0,k.jsxs)(k.Fragment,{children:[" ","Merged into ",(0,k.jsx)(O,{to:_(a.schema,s.kind,s.id),style:G,children:ge(a.schema.tryDefinition(s.kind),s)}),"."]}):null]}),d?(0,k.jsx)("button",{type:"button",style:ke,"data-testid":"bring-it-back",onClick:()=>a.apply(i,r?{author:r}:{}),children:"Bring it back"}):null]})}var b=H(B(),1),Qo=Nt(()=>(__graviewPreload(import.meta.url,["./chunk.CDZVUCEK.js","./chunk.QAUZDLDA.js","./chunk.3SY6WWWQ.js","./chunk.UGFDSE37.js","./chunk.ATWNWPME.js","./chunk.GZEZMU2T.js","./chunk.4VJARLJ5.js","./chunk.5RNB6IC5.js","./chunk.ZITDUHX3.js","./chunk.ETWREHXF.js","./chunk.YZ6UKKEL.js","./chunk.FFPG4PHX.js","./chunk.3L5USMQD.js","./chunk.GTUBIJTP.js","./chunk.DUIKIJKC.js","./chunk.73BJYIYS.js","./chunk.OKQ4JXTW.js","./chunk.M5RHVUZ6.js","./chunk.MRUDTYOL.js","./chunk.OUNLAMBA.js","./chunk.HGP3Q7QX.js","./chunk.QSZLY62B.js","./chunk.7VX6TBNY.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.6SHF6IL5.js","./chunk.MQISKON2.js","./chunk.GQX57JIE.js","./chunk.LJXAZ5TF.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.GZHZLJBF.js","./chunk.JLR74UFP.js","./chunk.OJGHDWI6.js","./chunk.HG34MT7C.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.24MUPV4Y.js")).then(e=>({default:e.DraftPage}))),Zo={kind:"human"};function Xo({list:e,store:t}){let n=new Set(e.members.map(d=>d.kind)),a=e.total-e.members.length,r=n.size===1?[...n][0]:void 0;if(!r)return(0,b.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${a} more`});let i=Ge(t.schema,r).toLowerCase();return(0,b.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,b.jsx)(O,{to:`/${U(t.schema,r)}`,className:"graview-spec-link graview-spec-see-all","data-testid":"see-all",children:e.total===t.graph.nodesOfKind(r).length?`See all ${ft(e.total)} ${i}`:`${ft(a)} more \xB7 all ${i}`})})}function Jo({context:e,children:t}){let n=De(),a=e.store.schema,r=Ze("/").replace(/\/$/,""),i=(0,K.useMemo)(()=>({href:d=>`${r}${_(a,d.kind,d.id)}`,go:d=>n(_(a,d.kind,d.id)),more:d=>(0,b.jsx)(Xo,{list:d,store:e.store})}),[r,a,n,e.store]);return(0,b.jsx)(Gt.Provider,{value:i,children:(0,b.jsx)(Wr.Provider,{value:(e.titleLevel??(e.framed&&!e.barAbove?1:2))-1,children:t})})}var Ii=(0,K.createContext)(void 0);function es({steering:e}){let t=me(),n=De(),a=`${t.pathname}${t.search}`;return(0,K.useLayoutEffect)(()=>e.at(a),[a,e]),(0,K.useLayoutEffect)(()=>{let r=d=>{d!==a&&n(d)};e.go.current=r;let i=e.pending?.current;return i!==void 0&&(e.pending.current=void 0,r(i)),()=>{e.go.current===r&&(e.go.current=void 0)}},[a,n,e]),null}function ts({context:e,to:t}){let{pathname:n}=me(),a=de(),r=(t??a)?.sayWhere,i=ns(e,n);return(0,K.useEffect)(()=>(r?.(i),()=>r?.(null)),[r,i]),null}function ns(e,t){let[n="",a,r]=t.split("/").filter(Boolean).map(d=>{try{return decodeURIComponent(d)}catch{return d}});if(r!==void 0)return"#";if(n==="places"&&a!==void 0){if(a===Pn)return"#overview=1";let d=e.views?.places().find(l=>l.as===a);return d?`#focus=${encodeURIComponent(Ne(d.kind))}&view=${encodeURIComponent(d.as)}`:"#"}let i=ve(e.store.schema,n);return i?`#focus=${encodeURIComponent(a??Ne(i))}`:"#"}function as({onNavigate:e,path:t}){let n=me(),a=Wn(),r=De(),i=n.hash&&!n.hash.includes("=")?n.hash:"",d=`${n.pathname}${n.search}${i}`,l=(0,K.useRef)(e);l.current=e;let s=(0,K.useRef)(null);(0,K.useEffect)(()=>{let m=s.current;s.current=d,m!==null&&(d===m&&a!=="PUSH"||l.current?.(d,a==="POP"?"pop":a==="REPLACE"?"replace":"push"))},[n.key]);let c=(0,K.useRef)(t);return(0,K.useEffect)(()=>{t===void 0||t===c.current||(c.current=t,t!==d&&r(t))},[t]),null}function Hi({context:e,registry:t,page:n}){let a=Ue(),r=ve(e.store.schema,a.slug??""),i=n==="list"?Jn:na,l=(r?t?.lookup(r,n):void 0)??i;return(0,b.jsx)(l,{context:e})}function rs({context:e,registry:t,children:n}){let a=(0,K.useRef)(null);return Va(a),(0,b.jsx)("div",{ref:a,"data-graview-face":"pages",style:{display:"contents"},children:(0,b.jsx)(ki,{context:e,registry:t,root:a,children:(0,b.jsx)(xi,{context:e,root:a,children:n})})})}function is(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function os(){let{pathname:e}=me(),t=Wn(),n=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{if(t!=="POP"){for(let i=n.current?.parentElement;i;i=i.parentElement){let{overflowY:d}=getComputedStyle(i);if((d==="auto"||d==="scroll")&&i.scrollHeight>i.clientHeight){i.scrollTop=0;return}}window.scrollTo(0,0)}},[e]);let a=(0,K.useRef)(e),r=(0,K.useRef)(!1);return(0,K.useEffect)(()=>{if(!r.current&&e===a.current)return;r.current=!0;let i=document.activeElement;if(is(i))return;let d=n.current?.closest("main")??document.querySelector("main"),s=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??d?.querySelector("h1, h2")??null??d??null;s&&(s.hasAttribute("tabindex")||s.setAttribute("tabindex","-1"),s.focus({preventScroll:!0}))},[e]),(0,b.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function Fi({context:e,children:t}){let n=De(),a=Ze("/").replace(/\/$/,""),r=(0,K.useContext)(Ii),i=(0,K.useMemo)(()=>{let d=(s,c)=>{if("record"in s){let m=e.store.graph.getNode(s.record);return m?Vt(_(e.store.schema,m.kind,s.record),{section:c?.section}):void 0}if("place"in s){let m=e.views?.places().find(v=>v.as===s.place);return m?Vt(fe(e,m),c):void 0}return e.store.schema.tryDefinition(s.list)?Vt(`/${U(e.store.schema,s.list)}`,c):void 0},l=s=>{s!==void 0&&n(s)};return{record:(s,c)=>l(d({record:s},c)),place:(s,c)=>l(d({place:s},c)),list:(s,c)=>l(d({list:s},c)),draft:()=>n("/~draft"),href:(s,c)=>{let m=r===!1?void 0:d(s,c);if(m!==void 0)return r?r(m):`${a}${m}`}}},[e,n,a,r]);return(0,b.jsx)(qa.Provider,{value:i,children:t})}function ss(){let{pathname:e,search:t,hash:n}=me();return(0,K.useEffect)(()=>{let a=decodeURIComponent(n.replace(/^#/,""));if(!(!a||a.includes("=")))return hi(a)},[e,t,n]),null}function ls({context:e,Home:t}){let n=me(),a=e.views,r=n.key==="default"&&!(a&&Ba(a));(0,K.useEffect)(()=>{a&&Ga(a)},[a]);let i=r?$a(e.views?.arrangement?.()?.first,e.store.schema,e.views?.places()??[]):void 0,d=i?.to==="place"?fe(e,i.place):i?.to==="kind"?`/${U(e.store.schema,i.kind)}`:void 0;return d?(0,b.jsx)(Kn,{to:d,replace:!0}):(0,b.jsx)(t,{context:e})}function Di({context:e,registry:t}){let n=t?.lookupSurface("shell"),a=n!==void 0,r=a&&(t?.without().has("bar")??!1),i=a&&!r&&!e.embedded?{...e,barAbove:!0}:e,d=N=>n===void 0?(0,b.jsx)(Qt,{context:e,children:N}):r?(0,b.jsx)(n,{context:e,children:N}):(0,b.jsx)(Qt,{context:e,children:(0,b.jsx)(n,{context:i,children:N})}),l=t?.lookupSurface("home")??Zn,s=t?.lookupSurface("problems")??ea,c=a?{...i,framed:!0}:e,[m,v]=(0,K.useState)(null),w=(0,K.useMemo)(()=>({context:c,registry:t}),[c,t]),g=(0,K.useMemo)(()=>({onFind:v,find:!(t?.without().has("find")??!1),places:!(t?.without().has("places")??!1)}),[t]),x=(0,b.jsx)(Gn.Provider,{value:w,children:(0,b.jsx)(Fi,{context:e,children:(0,b.jsx)(rs,{context:e,registry:t,children:d((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ar,{face:"pages"}),(0,b.jsxs)(Jo,{context:c,children:[(0,b.jsx)(os,{}),(0,b.jsx)(ss,{}),(0,b.jsxs)(oi,{children:[(t?.routes()??[]).map(({path:N,component:q})=>(0,b.jsx)(Le,{path:N,element:(0,b.jsx)(q,{context:c})},N)),(0,b.jsx)(Le,{path:"/",element:(0,b.jsx)(ls,{context:c,Home:l})}),(0,b.jsx)(Le,{path:"/problems",element:(0,b.jsx)(s,{context:c})}),(0,b.jsx)(Le,{path:"/~draft",element:(0,b.jsx)(K.Suspense,{fallback:null,children:(0,b.jsx)(Qo,{context:c})})}),(0,b.jsx)(Le,{path:"/search",element:(0,b.jsx)(Xn,{context:c})}),(0,b.jsx)(Le,{path:"/map",element:(0,b.jsx)(Qn,{context:c})}),(0,b.jsx)(Le,{path:"/places",element:(0,b.jsx)(zn,{context:c})}),$e(c).some(N=>N.as===Pn)?null:(0,b.jsx)(Le,{path:Ea,element:(0,b.jsx)(Kn,{to:"/",replace:!0})}),(0,b.jsx)(Le,{path:"/places/:as",element:(0,b.jsx)(Yn,{context:c})}),(0,b.jsx)(Le,{path:"/:slug",element:(0,b.jsx)(Hi,{context:c,registry:t,page:"list"})}),(0,b.jsx)(Le,{path:"/:slug/:id",element:(0,b.jsx)(Hi,{context:c,registry:t,page:"record"})})]})]})]}))})})});return e.embedded||!a||r?x:(0,b.jsx)(di.Provider,{value:g,children:(0,b.jsx)(Sr.Provider,{value:m,children:x})})}var ds=()=>typeof document>"u"?null:document.body;function cs({context:e,registry:t,basename:n,initialPath:a,onNavigate:r,path:i,steering:d,firstLook:l,hrefOf:s}){let[c,m]=(0,K.useState)(void 0),v=c!==void 0&&c.from===e.principal?{...e,principal:c.seat}:e;(0,K.useState)(()=>v.views?Gr(v.views,v.store.schema,En(v.brand,v.store.schema)):void 0);let w=de();wa({reader:v.locale??w?.locale,app:v.brand?.locale??v.app?.brand?.locale,readerTimeZone:v.timeZone??w?.timeZone,appTimeZone:v.brand?.timeZone??v.app?.brand?.timeZone});let g=v.principal??Zo,x=Fa(v.store,g,v.history),q=(x.past&&x.live===v.store?x.past.store:v.store).seenBy(g),u=q===v.store?v:{...v,store:q};Da(v.store,v.principal);let M=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(as,{onNavigate:r,path:i}),d?(0,b.jsx)(es,{steering:d}):null,u.presence||w?(0,b.jsx)(ts,{context:u,to:w}):null,(0,b.jsx)(Di,{context:u,...t?{registry:t}:{}}),l?(0,b.jsx)(qr,{firstLook:l,root:ds,app:En(v.brand,v.store.schema)}):null]}),j=u.views?(0,b.jsxs)(Wa,{store:u.store,views:u.views,...u.principal?{principal:u.principal}:{},...u.brand?{brand:u.brand}:{},...u.locale?{locale:u.locale}:{},...u.timeZone?{timeZone:u.timeZone}:{},...u.settings?{settings:u.settings}:{},...u.presence&&!w?{presence:u.presence}:{},...u.people?{people:u.people}:{},...u.seats?{seats:u.seats}:{},onSeat:oe=>w?w.takeSeat(oe):m({from:e.principal,seat:oe}),...u.onKeepLens?{onKeepLens:u.onKeepLens}:{},...u.ai?{ai:u.ai}:{},...u.subscriptions?{subscriptions:u.subscriptions}:{},dismissals:u.dismissals,whileAway:u.whileAway,...u.signIn?{signIn:u.signIn}:{},resolveApp:u.resolveApp??w?.resolveApp,linkedRecords:u.linkedRecords??w?.linkedRecords,...u.app?{app:u.app}:{},...u.menuSections?{menuSections:u.menuSections}:{},children:[M,(0,b.jsx)(Fi,{context:u,children:(0,b.jsx)(wi,{context:u})})]}):M,P=(0,b.jsx)(Ia.Provider,{value:x,children:j}),D=u.files?(0,b.jsx)(Ha.Provider,{value:u.files,children:P}):P,ae=s===void 0?D:(0,b.jsx)(Ii.Provider,{value:s,children:D});if(a!==void 0){let oe=n===void 0?a:`${n.replace(/\/$/,"")}${a}`;return(0,b.jsx)(ii,{initialEntries:[oe],...n===void 0?{}:{basename:n},children:ae})}return(0,b.jsx)(si,{...n===void 0?{}:{basename:n},children:ae})}export{co as a,cs as b};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ke}from"./chunk.SDO3U72B.js";import{Dd as eo,Ga as Bn,Hd as to,Ic as Un,J as Kn,Jd as Fe,Ka as bt,Kd as xt,Ma as qn,Sc as Yn,Uc as Zn,Xc as Xn,Ya as zn,_c as Jn,lc as $n,nd as Qn}from"./chunk.BLS2G3CD.js";import{a as Ge,b as _}from"./chunk.AJZBJBMO.js";var bo=Ge(w=>{"use strict";var Ot=Symbol.for("react.transitional.element"),$r=Symbol.for("react.portal"),Ur=Symbol.for("react.fragment"),Yr=Symbol.for("react.strict_mode"),Zr=Symbol.for("react.profiler"),Xr=Symbol.for("react.consumer"),Jr=Symbol.for("react.context"),Qr=Symbol.for("react.forward_ref"),ei=Symbol.for("react.suspense"),ti=Symbol.for("react.memo"),mo=Symbol.for("react.lazy"),ni=Symbol.for("react.activity"),co=Symbol.iterator;function oi(e){return e===null||typeof e!="object"?null:(e=co&&e[co]||e["@@iterator"],typeof e=="function"?e:null)}var go={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ho=Object.assign,So={};function ge(e,t,n){this.props=e,this.context=t,this.refs=So,this.updater=n||go}ge.prototype.isReactComponent={};ge.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ge.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function wo(){}wo.prototype=ge.prototype;function Vt(e,t,n){this.props=e,this.context=t,this.refs=So,this.updater=n||go}var Ct=Vt.prototype=new wo;Ct.constructor=Vt;ho(Ct,ge.prototype);Ct.isPureReactComponent=!0;var fo=Array.isArray;function Mt(){}var O={H:null,A:null,T:null,S:null},vo=Object.prototype.hasOwnProperty;function It(e,t,n){var o=n.ref;return{$$typeof:Ot,type:e,key:t,ref:o!==void 0?o:null,props:n}}function ri(e,t){return It(e.type,t,e.props)}function _t(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ot}function ii(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var po=/\/+/g;function Tt(e,t){return typeof e=="object"&&e!==null&&e.key!=null?ii(""+e.key):t.toString(36)}function ai(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Mt,Mt):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function me(e,t,n,o,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Ot:case $r:a=!0;break;case mo:return a=e._init,me(a(e._payload),t,n,o,r)}}if(a)return r=r(e),a=o===""?"."+Tt(e,0):o,fo(r)?(n="",a!=null&&(n=a.replace(po,"$&/")+"/"),me(r,t,n,"",function(c){return c})):r!=null&&(_t(r)&&(r=ri(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(po,"$&/")+"/")+a)),t.push(r)),1;a=0;var s=o===""?".":o+":";if(fo(e))for(var l=0;l<e.length;l++)o=e[l],i=s+Tt(o,l),a+=me(o,t,n,i,r);else if(l=oi(e),typeof l=="function")for(e=l.call(e),l=0;!(o=e.next()).done;)o=o.value,i=s+Tt(o,l++),a+=me(o,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return me(ai(e),t,n,o,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function Xe(e,t,n){if(e==null)return e;var o=[],r=0;return me(e,o,"","",function(i){return t.call(n,i,r++)}),o}function si(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var yo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},li={map:Xe,forEach:function(e,t,n){Xe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Xe(e,function(){t++}),t},toArray:function(e){return Xe(e,function(t){return t})||[]},only:function(e){if(!_t(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};w.Activity=ni;w.Children=li;w.Component=ge;w.Fragment=Ur;w.Profiler=Zr;w.PureComponent=Vt;w.StrictMode=Yr;w.Suspense=ei;w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O;w.__COMPILER_RUNTIME={__proto__:null,c:function(e){return O.H.useMemoCache(e)}};w.cache=function(e){return function(){return e.apply(null,arguments)}};w.cacheSignal=function(){return null};w.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=ho({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!vo.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(o[i]=t[i]);var i=arguments.length-2;if(i===1)o.children=n;else if(1<i){for(var a=Array(i),s=0;s<i;s++)a[s]=arguments[s+2];o.children=a}return It(e.type,r,o)};w.createContext=function(e){return e={$$typeof:Jr,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Xr,_context:e},e};w.createElement=function(e,t,n){var o,r={},i=null;if(t!=null)for(o in t.key!==void 0&&(i=""+t.key),t)vo.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(r[o]=t[o]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var s=Array(a),l=0;l<a;l++)s[l]=arguments[l+2];r.children=s}if(e&&e.defaultProps)for(o in a=e.defaultProps,a)r[o]===void 0&&(r[o]=a[o]);return It(e,i,r)};w.createRef=function(){return{current:null}};w.forwardRef=function(e){return{$$typeof:Qr,render:e}};w.isValidElement=_t;w.lazy=function(e){return{$$typeof:mo,_payload:{_status:-1,_result:e},_init:si}};w.memo=function(e,t){return{$$typeof:ti,type:e,compare:t===void 0?null:t}};w.startTransition=function(e){var t=O.T,n={};O.T=n;try{var o=e(),r=O.S;r!==null&&r(n,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(Mt,yo)}catch(i){yo(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),O.T=t}};w.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()};w.use=function(e){return O.H.use(e)};w.useActionState=function(e,t,n){return O.H.useActionState(e,t,n)};w.useCallback=function(e,t){return O.H.useCallback(e,t)};w.useContext=function(e){return O.H.useContext(e)};w.useDebugValue=function(){};w.useDeferredValue=function(e,t){return O.H.useDeferredValue(e,t)};w.useEffect=function(e,t){return O.H.useEffect(e,t)};w.useEffectEvent=function(e){return O.H.useEffectEvent(e)};w.useId=function(){return O.H.useId()};w.useImperativeHandle=function(e,t,n){return O.H.useImperativeHandle(e,t,n)};w.useInsertionEffect=function(e,t){return O.H.useInsertionEffect(e,t)};w.useLayoutEffect=function(e,t){return O.H.useLayoutEffect(e,t)};w.useMemo=function(e,t){return O.H.useMemo(e,t)};w.useOptimistic=function(e,t){return O.H.useOptimistic(e,t)};w.useReducer=function(e,t,n){return O.H.useReducer(e,t,n)};w.useRef=function(e){return O.H.useRef(e)};w.useState=function(e){return O.H.useState(e)};w.useSyncExternalStore=function(e,t,n){return O.H.useSyncExternalStore(e,t,n)};w.useTransition=function(){return O.H.useTransition()};w.version="19.2.8"});var N=Ge((za,xo)=>{"use strict";xo.exports=bo()});var Co=Ge(et=>{"use strict";var Si=Symbol.for("react.transitional.element"),wi=Symbol.for("react.fragment");function Vo(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:Si,type:e,key:o,ref:t!==void 0?t:null,props:n}}et.Fragment=wi;et.jsx=Vo;et.jsxs=Vo});var Ie=Ge((ts,Io)=>{"use strict";Io.exports=Co()});var fe={focusId:null,relation:null,expanded:[],pins:{}},Be=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function ee(e){let t=new URLSearchParams;e.focusId&&t.set("focus",e.focusId),e.relation&&t.set("relation",e.relation),e.overview&&t.set("overview","1"),e.zoom&&t.set("zoom","1"),e.past&&t.set("past","1"),e.shown&&e.shown.length>0&&t.set("show",[...e.shown].sort().join(",")),e.selection!==void 0&&e.selection.length>0&&t.set("sel",[...e.selection].sort().join(",")),e.expanded.length>0&&t.set("expand",[...e.expanded].sort().join(","));for(let o of Object.keys(e.pins).sort()){let r=e.pins[o];t.set(`pin.${o}`,`${qe(r.x)},${qe(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${qe(e.pan.x)},${qe(e.pan.y)}`);for(let o of Object.keys(e.within??{}).sort()){let r=e.within[o];r.length>0&&t.set(`in.${o}`,r)}e.q&&e.q.trim().length>0&&t.set("q",e.q);let n=t.toString();return n?`#${n}`:"#"}function Gr(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function ze(e){let t=e.includes("#")?e.slice(e.indexOf("#")+1):e,n=new URLSearchParams(t),o=Object.create(null);for(let[m,p]of n){if(!m.startsWith("pin."))continue;let[g,x]=p.split(","),P=g===void 0?null:Be(g),y=x===void 0?null:Be(x);P===null||y===null||(o[m.slice(4)]={x:P,y})}let r=Object.create(null);for(let[m,p]of n)!m.startsWith("in.")||p.length===0||(r[m.slice(3)]=p);let i=n.get("view");i&&i.length>0&&r.view===void 0&&(r.view=i);let a=n.get("pan")?.split(",")??[],s=a[0]===void 0?null:Be(a[0]),l=a[1]===void 0?null:Be(a[1]),c=(n.get("sel")??"").split(",").filter(m=>m.length>0).sort(),u=n.get("overview")==="1";return{...c.length>0?{selection:c}:{},...u?{overview:!0}:{},...n.get("zoom")==="1"?{zoom:!0}:{},...n.get("past")==="1"?{past:!0}:{},...n.get("show")?{shown:[...new Set(n.get("show").split(",").filter(Boolean))].sort()}:{},...s!==null&&l!==null?{pan:{x:s,y:l}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:Gr(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(m=>m.length>0&&(u||!m.startsWith("kind:"))).sort(),pins:o}}function Ma(e){let t=ze(e);return ee(t)==="#"?{...t,overview:!0}:t}function Oa(e){let t=ee(e);return t==="#overview=1"?"":t}function qe(e){return Math.round(e*100)/100}function oo(e,t){return ee(e)===ee(t)}var no="edge:";function ro(e){if(!e.startsWith(no))return null;let t=e.slice(no.length).split(":");if(t.length!==3)return null;let[n,o,r]=t;if(!n||!o||!r)return null;try{return{kind:decodeURIComponent(n),from:decodeURIComponent(o),to:decodeURIComponent(r)}}catch{return null}}function Et(e){let{pan:t,...n}=e;return{...n,pins:{}}}function q(e,t){if(t===e.focusId)return{...e,focusId:t};let n=Et(e);return{...n.within?.q!==void 0?ae(n,"q",null):n,focusId:t}}function io(e,t){return{...e,relation:t}}function ae(e,t,n){let o={...e.within??{}};if(n===null?delete o[t]:o[t]=n,Object.keys(o).length===0){let{within:r,...i}=e;return i}return{...e,within:o}}function pe(e,t){if(t!==e.overview&&(e=Et(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function $e(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function Ve(e,t){if(t!==(e.zoom===!0)&&(e=Et(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function Ue(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}var Ze="aggregate:",Ye="kind:";function At(e){return`${Ye}${e}`}function ye(e){return e.startsWith(Ye)?e.slice(Ye.length):null}var Ia="kinds:beyond";function Fr(e){let t=ye(e);return t?[t]:se(e)}function te(...e){return`${Ze}${[...e].sort().join("+")}`}function ao(e){return e.startsWith(Ze)}function se(e){return!ao(e)||e.includes("|")?[]:e.slice(Ze.length).split("+").filter(Boolean)}function so(e,t,n={}){let o=ye(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return Ue(e,t);let r=o!==null?te(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return Ve(e,!1);if(o!==null&&n.carry){let i=pe({...q(e,r),relation:null},!1);return ae(Ve(i,!0),"q",n.carry)}return Ve({...q(e,r),relation:null},!0)}function Kr(e,t,n){return ae(pe(q(e,te(t)),!1),"view",n)}function _a(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var lo="aggregate:";function Pt(e){return e.startsWith(lo)&&e.includes("|")}var kt=e=>e?.off===!0,Br=e=>e!==void 0&&!kt(e)&&(e.fast!==void 0||e.thinking!==void 0||e.answer!==void 0||e.decide!==void 0||e.complete!==void 0||e.turn!==void 0),uo=e=>e!==void 0&&!kt(e)&&(e.fast!==void 0||e.decide!==void 0),qr=e=>e?.suggestOnOpen!==!1&&uo(e),zr=e=>e?.hoverChips===!0&&uo(e);var Rt={};var Eo=_(N(),1),di={turns:[],outcomes:new Map,busy:!1,pending:null,draft:null,draftNote:null},Ao=e=>`graview:seat:${e}`;function ui(e){if(!e)return{};try{let t=sessionStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return{...Array.isArray(n.turns)?{turns:n.turns}:{},...Array.isArray(n.outcomes)?{outcomes:new Map(n.outcomes)}:{},...n.draft?.drawn?{draft:n.draft}:{}}}catch{return{}}}function ci(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],draft:t.draft}))}catch{}}function Lt(e){let t=e===null?null:Ao(e),n={...di,...ui(t)},o=new Set,r=(i,a=!0)=>{n=i,a&&ci(t,n);for(let s of[...o])s()};return{get:()=>n,subscribe(i){return o.add(i),()=>void o.delete(i)},setTurns:i=>r({...n,turns:i(n.turns)}),settle:(i,a)=>r({...n,outcomes:new Map(n.outcomes).set(i,a)}),setBusy:i=>r({...n,busy:i},!1),ask:i=>r({...n,pending:i.trim()||null}),takePending(){let i=n.pending;return i!==null&&r({...n,pending:null},!1),i},setDraft:(i,a=null)=>r({...n,draft:i,draftNote:a})}}function fi(e){return(0,Eo.useSyncExternalStore)(e.subscribe,e.get,e.get)}var ko=_(N(),1),pi={entries:[],ghost:null,loaded:!1};function Po(e,t){let n=new Map(e.map(o=>[o.id,o]));for(let o of t)n.set(o.id,{...n.get(o.id),...o});return[...n.values()].sort((o,r)=>o.at<r.at?1:o.at>r.at?-1:0)}function Ht(e){let t=pi,n=new Set,o=r=>{t=r;for(let i of[...n])i()};return{get:()=>t,subscribe:r=>(n.add(r),()=>n.delete(r)),record:r=>{o({...t,entries:Po(t.entries,[r])}),Promise.resolve(e()?.keep?.(r)).catch(i=>{console.warn("The host did not keep an AI interaction:",i)})},setGhost:r=>o({...t,ghost:r}),load:()=>{if(t.loaded)return;o({...t,loaded:!0});let r=e()?.load;r&&Promise.resolve(r()).then(i=>o({...t,entries:Po(t.entries,i)})).catch(i=>{console.warn("The host's AI interactions could not be read:",i)})}}}function yi(e){return(0,ko.useSyncExternalStore)(e.subscribe,e.get,e.get)}function Ro(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}var Je=_(N(),1),Qe=(0,Je.createContext)(void 0),mi=()=>(0,Je.useContext)(Qe);var A=_(N(),1),Ce=(0,A.createContext)(null);function Mo(){return(0,A.useContext)(Ce)}function gi(e,t){let n=Mo(),o=(0,A.useMemo)(()=>n?n.live.seenBy(t):e,[n,e,t]),r=(0,A.useRef)(0),i=(0,A.useCallback)(a=>o.subscribe(()=>{r.current+=1,a()}),[o]);return(0,A.useSyncExternalStore)(i,()=>r.current,()=>0),o}var Oo=Ke(()=>(__graviewPreload(import.meta.url,["./chunk.SVH3OMU2.js","./chunk.TI4OSTQV.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.OYQ6ZA6T.js")));function Dt(e){let[,t]=(0,A.useReducer)(o=>o+1,0),n=e.publishing?.mode==="on-publish"&&!Yn();return(0,A.useEffect)(()=>{n&&Oo().then(t,()=>{})},[n]),!n}var To,hi=400;function Nt(e,t,n){let o=(0,A.useContext)(Ce),r=o!==null&&o.owns(e,t),[i,a]=(0,A.useState)(null),[s,l]=(0,A.useState)(To);(0,A.useEffect)(()=>{if(s||r||i===null)return;let b=!0;return Oo().then(I=>{To=I,b&&l(I)},()=>{}),()=>{b=!1}},[s,r,i]);let[c,u]=(0,A.useState)(0),m=(0,A.useMemo)(()=>r||i===null||i>=e.log.length||!s?void 0:s.askArchived(e,i,n)??s.askDeclaration(n,i),[r,e,i,n,s,c]),p=m&&"waiting"in m?m.waiting:void 0,g=m&&"seq"in m?m:null,[x,P]=(0,A.useState)(void 0);(0,A.useEffect)(()=>{if(!p)return;let b=!0,I=setTimeout(()=>b&&P(p),hi);return p.then(()=>b&&u(C=>C+1)),()=>{b=!1,clearTimeout(I)}},[p]);let y=p!==void 0&&x!==p||g!==null,v=(0,A.useMemo)(()=>{if(r||i===null||i>=e.log.length||!s||y)return null;try{let b=s.pastAt(e,i,n);return{seq:i,at:b.past?.at,store:b}}catch{return null}},[r,e,i,n,s,y,c]),S=(0,A.useRef)(null),E=y?S.current:v;(0,A.useEffect)(()=>{S.current=E},[E]);let k=(0,A.useCallback)(b=>a(b===null?null:b>=e.log.length?Number.POSITIVE_INFINITY:b),[e]),W=(0,A.useCallback)((b,I)=>[e,E?.store].some(C=>C!==void 0&&(C===b||C.seenBy(I)===b)),[e,E]),H=i!==null,j=(0,A.useMemo)(()=>({past:E,open:H,show:k,live:e,host:n,owns:W,archive:g}),[E,H,k,e,n,W,g]);return r?o:j}var _o=e=>`graview:setting:${e}`;function Lo(){return localStorage}function Ho(e,t){try{let n=(t??Lo()).getItem(_o(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function Do(e,t,n){try{(n??Lo()).setItem(_o(e.name),t)}catch{}}function No(e,t){if(typeof document>"u")return;let n=document.documentElement;if(e.honored==="root-font-size"){n.style.fontSize=t===e.initial?"":t;return}let o=`graview${e.name.replace(/-([a-z0-9])/g,(r,i)=>i.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}`;t===e.initial?delete n.dataset[o]:n.dataset[o]=t}var L=_(N(),1);function Wt(e){return Fe(e)}var vi=12,bi=4;function xi(e,t,n){let o=Wt(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var tt=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-vi);function Wo(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=bi)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?At([...o][0]):n[0]}function jt(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[a,s]of e)s.mode!=="asking"&&s.mode!=="docked"&&t.at-s.since>=t.holdMs&&o.set(a,{...s,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=xi(e,t.author,t.at),i=a=>o.set(r.participant,{...r,...a,since:t.at});switch(t.type){case"read":{let a=Wo(t.ids,n);return i({at:a,mode:"reading",trail:tt(r.trail,a)}),o}case"about-to-write":case"write":{let a=Wo(t.ids,n);return i({at:a,mode:"writing",trail:tt(r.trail,a),say:void 0,confidence:void 0}),o}case"refused":return i({at:t.where,mode:"refused",say:t.say,confidence:void 0,trail:tt(r.trail,t.where)}),o;case"asking":return i({at:t.where??r.at,mode:"asking",say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},trail:tt(r.trail,t.where)}),o;case"said":return i({say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},...t.caption?{caption:t.caption}:{}}),o;case"over":return i({over:t.over}),o;case"home":return i({at:null,mode:"docked",trail:[],say:void 0,confidence:void 0,over:null}),o;default:return o}}var jo="graview:session";function Go(e){let t=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);try{let n=e??sessionStorage,o=n.getItem(jo);if(o)return o;let r=t();return n.setItem(jo,r),r}catch{return t()}}var Gt={name:"share-where",title:"Where you are",description:"Whether the others here see which stop you are on.",honored:"root-attribute",options:[{value:"shared",label:"Shown"},{value:"private",label:"Hidden"}],initial:"shared"},Ft={name:"share-over",title:"What you point at",description:"Whether the others see the thing under your pointer, outlined in your color.",honored:"root-attribute",options:[{value:"private",label:"Kept to yourself"},{value:"shared",label:"Outlined for others"}],initial:"private"},Fo=[Gt,Ft],Ei=800;function Ko(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:a,seatWho:s,settingValues:l,setView:c,ttlMs:u=to,people:m,seats:p}=e,[g,x]=(0,L.useState)(()=>new Map),[P,y]=(0,L.useState)(null),[v,S]=(0,L.useState)(null),[E,k]=(0,L.useState)(null),W=typeof r.id=="string"&&r.id.length>0,H=W&&(l[Gt.name]??Gt.initial)==="shared",j=H&&(l[Ft.name]??Ft.initial)==="shared",b=Wt({kind:r.kind,...r.id?{id:r.id}:{},session:i}),I=W?zn(r,{graph:n.graph,schema:n.schema,...p?{seats:p}:{},...m?{people:m}:{}}):"",C=s?a.get(`agent:${s}:${i}`):void 0,F=(0,L.useMemo)(()=>!t||!H?null:{participant:b,kind:r.kind,name:I,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:$n(r.id??"nobody"),stop:E??ee(o),...j?{over:P}:{},...C?{robot:{at:C.at,mode:C.mode}}:{},at:new Date().toISOString()},[t,H,j,b,I,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,E,P,C?.at,C?.mode]);(0,L.useEffect)(()=>{if(!t||!F)return;t.here(F);let V=setInterval(()=>t.here({...F,at:new Date().toISOString()}),Ei);return()=>clearInterval(V)},[t,F]),(0,L.useEffect)(()=>t?t.onWho(K=>x(xt(new Map,K,Date.now(),u))):void 0,[t,u]);let Ee=g.size>0;(0,L.useEffect)(()=>{if(!Ee)return;let V=setInterval(()=>{x(K=>{let J=xt(K,[],Date.now(),u);return J.size===K.size?K:J})},Math.max(250,Math.min(1e3,u/4)));return()=>clearInterval(V)},[Ee,u]),(0,L.useEffect)(()=>{if(!t||typeof window>"u")return;let V=()=>t.leave();return window.addEventListener("pagehide",V),()=>window.removeEventListener("pagehide",V)},[t]),(0,L.useEffect)(()=>{if(!j||typeof document>"u")return;let V=null,K=J=>{let de=Ro(J.target);de!==V&&(V=de,y(de))};return document.addEventListener("pointermove",K,{passive:!0}),()=>document.removeEventListener("pointermove",K)},[j]);let oe=(0,L.useRef)(null),Y=v?g.get(v)??null:null,Z=(0,L.useCallback)(V=>{oe.current=null,S(V)},[]);return(0,L.useEffect)(()=>{if(v){if(!Y){S(null);return}Y.stop!==oe.current?.stop&&(oe.current={stop:Y.stop,at:Date.now()},c(ze(Y.stop)))}},[v,Y,c]),(0,L.useEffect)(()=>{let V=oe.current;!v||V===null||Date.now()-V.at<400||oo(o,ze(V.stop))||S(null)},[o,v]),(0,L.useEffect)(()=>{if(!v||typeof document>"u")return;let V=K=>{K.key==="Escape"&&S(null)};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[v]),(0,L.useMemo)(()=>({who:g,sharing:F?{participant:b,name:I}:null,following:Y,follow:Z,sayWhere:k}),[g,F,b,I,Y,Z])}var $=_(N(),1);function Bo(e){return Fe(e.author)}function Ai(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function qo(e,t,n,o,r){let i=new Map;for(let[l,c]of e)o-c.at<r&&i.set(l,c);let a=new Set(n.flatMap(l=>l.nodeIds)),s=(l,c,u)=>{let m=i.get(l),p=m?.participants.includes(Bo(c))?m.participants:[...m?.participants??[],Bo(c)];i.set(l,{at:o,manner:Ai(p,c.author.kind),intent:c.intent,wrote:(m?.wrote??!1)||(u.wrote??!1),read:(m?.read??!1)||(u.read??!1),broke:(m?.broke??!1)||a.has(l),participants:p})};for(let l of t){for(let c of l.writes)s(c,l,{wrote:!0});for(let c of l.reads)l.writes.includes(c)||s(c,l,{read:!0})}for(let l of n)for(let c of l.nodeIds){let u=i.get(c);i.set(c,{at:o,manner:u?.manner??"rule",intent:u?.intent??l.message,wrote:u?.wrote??!1,read:u?.read??!1,broke:!0,participants:u?.participants??["rule::"]})}return i}var Pi=2600;function zo(e,t=Pi){let[n,o]=(0,$.useState)(()=>new Map),r=(0,$.useRef)(n);r.current=n;let i=(0,$.useRef)(null),a=(0,$.useCallback)(l=>{r.current=l,o(l),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,$.useEffect)(()=>{let l=e.violations(),c=e.subscribe((u,m)=>{let p=e.violations(),g=Jn(e.allInvariants(),l,p).introduces;l=p,a(qo(r.current,m,g.map(x=>({nodeIds:x.nodeIds,message:x.message})),Date.now(),t))});return()=>{c(),i.current&&clearTimeout(i.current)}},[e,t,a]);let s=(0,$.useCallback)(l=>{l.reads.length!==0&&a(qo(r.current,[ki(l)],[],Date.now(),t))},[t,a]);return{activity:n,noteAttention:s}}function ki(e){return{id:`attention:${e.intent}`,seq:-1,batch:"attention",author:e.author,intent:e.intent,mutation:null,primitives:[],reads:e.reads,writes:[],at:new Date().toISOString()}}var d=_(N(),1);function $o(){let e=null,t=new Set,n=new Set,o=r=>{for(let i of n)i(r)};return{subscribe(r){return t.add(r),t.size===1&&o(!0),()=>{t.delete(r),t.size===0&&(e=null,o(!1))}},snapshot:()=>e,set(r){if(!(e===r||e&&r&&e.x===r.x&&e.y===r.y)){e=r;for(let i of t)i()}},get listeners(){return t.size},onActive(r){return n.add(r),()=>void n.delete(r)}}}var nt=_(N(),1),Ri=e=>e.definitions.some(t=>Bn(t).size>0);function Uo(e,t,n){let[o,r]=(0,nt.useState)(void 0),i=(n.roles??[]).join("\0");return(0,nt.useEffect)(()=>{if(!t||!Ri(e.schema)){r(void 0);return}let a=!0,s=!1,l=e.graph,c=()=>{s||(s=!0,queueMicrotask(()=>{s=!1,a&&e.reread()}))},u=qn(t,{kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{}},c);return bt(l,u.read),r(u),e.reread(),()=>{a=!1,bt(l,void 0)}},[e,t,n.kind,n.id,i]),o}function Yo(){let e=!1,t=new Set;return{moving:()=>e,set(n){if(n!==e){e=n;for(let o of t)o()}},subscribe(n){return t.add(n),()=>t.delete(n)}}}var le=_(Ie(),1),Ti="graview:place-menu",_e=(0,d.createContext)(null),Qo=(0,d.createContext)("scene");function Mi({mode:e,children:t}){return(0,le.jsx)(Qo.Provider,{value:e,children:t})}function Oi(){return(0,d.useContext)(Qo)}var er={kind:"human"},Vi=[],Ci=[],Ii=[],Kt=[];function tr(e,t){let n=(0,d.useId)();(0,d.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??er,r=()=>Xn(e,o,n);r();let i,a=e.subscribe(()=>{clearTimeout(i),i=setTimeout(r,250)});return()=>{clearTimeout(i),a(),globalThis.__graviewWatch?.unseen?.({words:[],from:n,gone:!0})}},[e,t,n])}var _i=()=>{try{return typeof location<"u"&&new URLSearchParams(location.search).get("as")==="published"?"published":void 0}catch{return}},Li={off:!0};function Hi({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,as:a,seats:s=Vi,onSeat:l,people:c=Ci,memory:u,presenceTtlMs:m,app:p,settings:g=p?.settings??Ii,presence:x,brand:P,locale:y,timeZone:v,onKeepLens:S,providers:E,ai:k,files:W,resolveApp:H,history:j,linkedRecords:b,menuSections:I,keptViews:C,subscriptions:F,dismissals:Ee,whileAway:oe,signIn:Y,view:Z,onViewChange:V,children:K}){let J=(0,d.useContext)(_e),de=I??J?.menuSections,sn=Y??J?.signIn,pt=C??J?.keptViews,[Rr,Tr]=(0,d.useState)(null),ue=Rr??i??s[0]?.principal??er,He=Nt(e,ue,j),ln=He.past&&He.live===e?He.past.store:e,yt=a??_i(),mt=!Dt(e),D=(0,d.useMemo)(()=>mt?e:ln.seenBy(ue,yt?{as:yt}:void 0),[mt,e,ln,ue,yt]);tr(e,ue);let[re]=(0,d.useState)(()=>Go(u)),[dn,Mr]=(0,d.useState)(!1),un=(0,d.useCallback)(()=>Mr(!0),[]),ie=(0,d.useMemo)(()=>x?[...g,...Fo]:g,[g,x]),[gt]=(0,d.useState)(()=>n??$t(t,e.schema)),[Or,cn]=(0,d.useState)(()=>$e(gt??fe,r??gt?.selection??[])),Ae=(0,d.useRef)(gt??fe).current,[fn,Vr]=(0,d.useState)(null),[pn,Cr]=(0,d.useState)(null),X=(0,d.useContext)(_e),[yn]=(0,d.useState)(()=>X?.seatTalk??Lt(P?.name??e.schema.kinds.join(","))),ht=k??X?.ai??Rt,De=(0,d.useMemo)(()=>ht.off?Li:ht,[ht]),mn=(0,d.useRef)(De.interactions);mn.current=De.interactions;let[gn]=(0,d.useState)(()=>X?.aiDesk??Ht(()=>mn.current)),[Ir]=(0,d.useState)(()=>X?.subscriptions??Zn()),hn=F??X?.subscriptions??Ir,St=S??X?.onKeepLens,Ne=p??X?.app,We=y??X?.locale,_r=P?.locale??Ne?.brand?.locale,je=v??X?.timeZone;Kn({reader:We,app:_r,readerTimeZone:je,appTimeZone:P?.timeZone??Ne?.brand?.timeZone});let Sn=(0,d.useRef)(null),wn=(0,d.useCallback)(f=>{Sn.current=f},[]),vn=(0,d.useCallback)(f=>Sn.current?.whereIs(f)??null,[]),[bn]=(0,d.useState)(()=>$o()),[xn]=(0,d.useState)(()=>Yo()),[wt,Lr]=(0,d.useState)(null),[Pe,En]=(0,d.useState)(()=>new Map),ke=(0,d.useRef)(Pe);ke.current=Pe;let Re=(0,d.useRef)(null),vt=(0,d.useCallback)(f=>D.graph.getNode(f)?.kind,[D]),Q=(0,d.useCallback)(f=>{let h=jt(ke.current,f,vt);ke.current=h,En(h),Re.current&&clearTimeout(Re.current),[...h.values()].some(M=>M.mode!=="docked"&&M.mode!=="asking")&&(Re.current=setTimeout(()=>{let M=jt(ke.current,{type:"rest",at:Date.now(),holdMs:zt},vt);ke.current=M,En(M)},zt+20))},[vt]),An=(0,d.useCallback)(f=>Q({...f,at:f.at??Date.now()}),[Q]),Pn=(0,d.useCallback)(f=>{Lr(f),f&&Q({type:"home",author:{kind:"agent",id:f,session:re},at:Date.now()})},[Q,re]);(0,d.useEffect)(()=>D.subscribe((f,h)=>{for(let R of h)R.author.kind==="agent"&&Q({type:"write",author:R.author,ids:R.writes,at:Date.now()})}),[D,Q]),(0,d.useEffect)(()=>()=>{Re.current&&clearTimeout(Re.current)},[]);let z=(0,d.useMemo)(()=>({...ue,session:re}),[ue,re]),kn=Uo(D,b,z),Rn=(0,d.useCallback)(f=>{Tr(f),l?.(f)},[l]),[Te,Hr]=(0,d.useState)(()=>Object.fromEntries(ie.map(f=>[f.name,Ho(f,u)])));(0,d.useEffect)(()=>{for(let f of ie)No(f,Te[f.name]??f.initial)},[ie,Te]);let Tn=(0,d.useCallback)((f,h)=>{let R=ie.find(M=>M.name===f);!R||!R.options.some(M=>M.value===h)||(Do(R,h,u),Hr(M=>({...M,[f]:h})))},[ie,u]),[Mn,Dr]=(0,d.useState)(null),{activity:On,noteAttention:Vn}=zo(D),Cn=(0,d.useCallback)(f=>{Vn(f),Q({type:"read",author:f.author,ids:f.reads,at:Date.now()})},[Vn,Q]),ce=(0,d.useCallback)(f=>{if(ye(f)!==null||se(f).length>0||Pt(f))return!0;let h=ro(f);return h?D.graph.allEdges().some(R=>R.kind===h.kind&&R.from===h.from&&R.to===h.to):D.graph.getNode(f)!==void 0},[D]),In=(0,d.useCallback)(f=>{let h=f.selection??Kt,R=h.filter(ce),M=R.length===h.length?f:$e(f,R);return M.focusId!==null&&!ce(M.focusId)&&(M=q(M,null)),M},[ce]),Me=(0,d.useCallback)(f=>{let h=In(f),R=Jo(D,z,h.shown);if(h.focusId!==null&&R.size>0){let M=se(h.focusId),Fn=D.graph.getNode(h.focusId);(M.length>0?M.every(jr=>R.has(jr)):Fn?R.has(Fn.kind):!1)&&(h={...h,focusId:null})}if(!h.overview&&h.focusId===null){let M=Ae.focusId!==null&&!ce(Ae.focusId)?$t(t,e.schema)??{...fe,overview:!0}:Ae;M.focusId!==null&&ce(M.focusId)?h={...h,focusId:M.focusId}:M.overview===!0&&(h={...h,overview:!0})}return h},[In,ce,D,Ae,z,t,e.schema]),B=Me(Z??Or),_n=(0,d.useMemo)(()=>Jo(D,z,B.shown),[D,z,B.shown]),Ln=(0,d.useMemo)(()=>[...D.modules.administered.entries()].map(([f,h])=>{let R=D.mayAdminister(f,z);return{name:f,...h.description?{description:h.description}:{},kinds:h.kinds??[],canShow:R,shown:R&&(B.shown??[]).includes(f)}}),[D,z,B.shown]),Oe=(0,d.useCallback)(f=>{let h=R=>Me(typeof f=="function"?f(R):f);if(Z!==void 0){V?.(h(Z));return}V&&V(h(B)),cn(R=>h(R))},[B,V,Z,Me]);(0,d.useEffect)(()=>{Z===void 0&&cn(f=>{let h=Me(f);return h===f?f:h})},[B,Z,Me]);let Hn=B.selection??Kt,Dn=(0,d.useCallback)(f=>{Oe(h=>$e(h,typeof f=="function"?f(h.selection??Kt):f))},[Oe]),{who:Nn,following:Wn,follow:jn,sayWhere:Nr,sharing:Gn}=Ko({channel:x,store:D,view:B,principal:z,session:re,robots:Pe,seatWho:wt,settingValues:Te,setView:Oe,seats:s,people:c,...m!==void 0?{ttlMs:m}:{}}),Wr=(0,d.useMemo)(()=>({store:D,scheme:o,views:t,view:B,setView:Oe,homeView:Ae,selection:Hn,setSelection:Dn,menuAt:fn,setMenuAt:Vr,whereIs:vn,pointer:bn,motion:xn,registerScene:wn,robots:Pe,noteSeat:An,seatWho:wt,registerSeatWho:Pn,actsDoor:pn,registerActsDoor:Cr,seatTalk:yn,aiDesk:gn,...u?{memory:u}:{},who:Nn,following:Wn,follow:jn,sayWhere:Nr,sharing:Gn,session:re,ai:De,resolveApp:H,linkedRecords:b,menuSections:de,...pt?{keptViews:pt}:{},subscriptions:hn,dismissals:Ee,whileAway:oe,signIn:sn,linkedReads:kn,movedByHand:dn,noteMoved:un,emphasis:Mn,setEmphasis:Dr,activity:On,noteAttention:Cn,principal:z,seats:s,people:c,takeSeat:Rn,settings:ie,settingValues:Te,chooseSetting:Tn,hiddenKinds:_n,administered:Ln,...E?{providers:E}:{},...P?{brand:P}:{},...St?{onKeepLens:St}:{},app:Ne,...We?{locale:We}:{},...je?{timeZone:je}:{}}),[D,o,t,B,Oe,Hn,Dn,fn,vn,bn,xn,wn,Pe,An,wt,Pn,pn,yn,gn,u,Nn,Wn,jn,Gn,re,De,H,b,de,pt,hn,Ee,oe,sn,kn,dn,un,Mn,On,Cn,z,s,c,Rn,ie,Te,Tn,_n,Ln,E,P,St,Ne,We,je]);return(0,le.jsx)(_e.Provider,{value:Wr,children:(0,le.jsx)(Ce.Provider,{value:He,children:(0,le.jsx)(Gi,{children:mt?null:W?(0,le.jsx)(Qe.Provider,{value:W,children:K}):K})})})}var nr=(0,d.createContext)(null),Bt,qt=new Set,Di=e=>(qt.add(e),()=>void qt.delete(e)),Zo=()=>Bt;function Ni(e){if(!Bt){Bt=e;for(let t of[...qt])t()}}var Wi=300;function ji(e){let t=0;return async(n,o)=>{let r=++t;return await new Promise(i=>setTimeout(i,Wi)),r===t?e(n,o):[]}}function Gi({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:a,ai:s}=ne(),l=ot(),c=n.q,u=n.focusId,m=!!(c&&c.trim().length>0),p=(0,d.useSyncExternalStore)(Di,Zo,Zo),g=(0,d.useMemo)(()=>m&&p?{flagged:new Set(t.violations().flatMap(E=>E.nodeIds)),touched:p.touchWeights(t.log.all())}:null,[t,l,m,p]),x=u?t.graph.getNode(u)?.kind??ye(u)??(se(u).length===1?se(u)[0]:void 0):void 0,P=(0,d.useMemo)(()=>s.near&&ji(s.near),[s.near]),y=(0,d.useMemo)(()=>!c||!g||!p?null:p.search(t,c,{...x?{inKind:x}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(E=>!i.has(E)),from:[...a,...u&&t.graph.has(u)?[u]:[]],flagged:g.flagged,touched:g.touched,limit:200,rank:P}),[t,c,r,o,i,a,u,x,g,P]),[v,S]=(0,d.useState)();return(0,d.useEffect)(()=>void y?.later?.then(E=>S([y,E])),[y]),(0,le.jsx)(nr.Provider,{value:v?.[0]===y?v[1]:y,children:e})}var Xo=new WeakMap;function Vs(e){let t=Xo.get(e);return t||Xo.set(e,t=new Set(e.matched)),t}function Fi(){return(0,d.useContext)(nr)}function ne(){let e=(0,d.useContext)(_e);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function Ut(){return(0,d.useContext)(_e)??null}function ot(){let{store:e}=ne(),t=(0,d.useRef)(null),n=(0,d.useRef)(null),o=(0,d.useCallback)(()=>(n.current!==e&&(n.current=e,t.current=null),t.current??=e.graph.allNodes(),t.current),[e]),r=(0,d.useCallback)(i=>e.subscribe(()=>{t.current=null,i()}),[e]);return(0,d.useSyncExternalStore)(r,o,o)}function Ki(e){let{store:t}=ne(),n=(0,d.useCallback)(r=>t.subscribe(r),[t]),o=(0,d.useCallback)(()=>e===null?void 0:t.graph.getNode(e),[t,e]);return(0,d.useSyncExternalStore)(n,o,o)}function Jo(e,t,n){let o=new Set(e.modules.disabledKinds);for(let r of e.kindsKeptFrom(t))o.add(r);for(let[r,i]of e.modules.administered)if(!(e.mayAdminister(r,t)&&(n??[]).includes(r)))for(let a of i.kinds??[])o.add(a);return o}var zt=2600;var or=new WeakSet,Bi=e=>or.has(e),qi=e=>void or.add(e);function $t(e,t){let n=eo(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...fe,focusId:te(n.place.kind),within:{view:n.place.as}}:{...fe,focusId:te(n.kind)}}var rr=_(N(),1),zi=(0,rr.createContext)(!1);var rt=Symbol.for("graview.default-view");function ir(e){return Object.defineProperty(e,rt,{value:!0,enumerable:!1}),e}function ar(e){return typeof e=="function"&&e[rt]===!0}var it=Symbol.for("graview.replaces-page");function sr(e){return Object.defineProperty(e,it,{value:!0,enumerable:!1}),e}function lr(e){return typeof e=="function"&&e[it]===!0}var at=Symbol.for("graview.bleeds");function dr(e){return Object.defineProperty(e,at,{value:!0,enumerable:!1}),e}function ur(e){return typeof e=="function"&&e[at]===!0}var st=Symbol.for("graview.previews");function cr(e,t={}){return Object.defineProperty(e,st,{value:t,enumerable:!1}),e}function fr(e){return typeof e=="function"?e[st]:void 0}function $i(e){return Qn(e)}function Ui(e,t){if(t===e)return e;for(let r of t.registrations())e.register(r.kind,r,r.view,r);let n=t.arrangement?.();n&&e.arrange?.(n);let o=t.homeView?.();return o&&e.home?.(o),e}var T=_(N(),1),U=_(Ie(),1),Yt=new Set,lt=0;function Zt(e){return()=>{lt+=1;let t=e();return t.then(()=>void(lt-=1),()=>void(lt-=1)),t}}var Yi=()=>lt,ut=(0,T.createContext)(null);function Zi(){return{waiting:new Map,at:0}}function Xi(e){for(let[t,n]of e.waiting)n<e.at&&e.waiting.delete(t);e.at+=1}var Ji=e=>e?.waiting.size??0;function mr(e,t){e?.waiting.set(t,e.at)}function gr(e){let t=(0,T.useContext)(ut);(0,T.useLayoutEffect)(()=>{t?.waiting.delete(e)},[t,e])}function Qi(e){let t={},n=!1,o=new Set,r=(0,T.lazy)(Zt(()=>e().then(a=>{n=!0;let s=a.default;function l(c){return gr(t),(0,T.createElement)(s,c)}return{default:l}},a=>{for(let s of o)s.waiting.delete(t);throw a})));function i(a){let s=(0,T.useContext)(ut);return!n&&s&&(o.add(s),mr(s,t)),(0,T.createElement)(r,a)}return i}var hr=!1,Sr=!1,dt=new Set;function ea(){hr=!0}function ta(){Sr=!0;for(let e of[...dt])e();dt.clear()}var wr=()=>Sr||!hr;function na(e){return wr()?(e(),()=>{}):(dt.add(e),()=>void dt.delete(e))}var pr=!1;function Xt(){for(let e of[...Yt])e()}function oa(){pr||typeof window>"u"||(pr=!0,window.addEventListener("online",Xt))}function Jt(e){let t,n=!1,o=!1,r,i=0,a=new Set,s=()=>{i+=1;for(let p of[...a])p()},l=p=>(a.add(p),()=>void a.delete(p)),c=()=>i,u=()=>void m().catch(()=>{});function m(){if(n)return Promise.resolve(t);if(r)return r;let p=e().then(g=>(t=g,n=!0,o=!1,r=void 0,Yt.delete(u),s(),g),g=>{throw r=void 0,o=!0,Yt.add(u),oa(),s(),g});return p.catch(()=>{}),r=p,p}return{load:m,prefetch:u,get current(){return t},get failed(){return o},part(p,g={}){let x=g.what??"This part",P={};function y(E){(0,T.useSyncExternalStore)(l,c,c),gr(P);let k=(0,T.useRef)(null),W=(0,T.useRef)(null),H=(0,T.useRef)(!1);return(0,T.useEffect)(()=>{o&&r===void 0&&u()},[]),n&&typeof document<"u"&&k.current!==null&&document.activeElement===k.current&&(H.current=!0),(0,T.useLayoutEffect)(()=>{if(!(!n||!H.current)){H.current=!1;for(let j=W.current?.nextElementSibling??null;j!==null;j=j.nextElementSibling){let b=j.matches(yr)?j:j.querySelector(yr);if(b instanceof HTMLElement){b.focus();return}}}}),n?(0,U.jsxs)(U.Fragment,{children:[H.current?(0,U.jsx)("span",{ref:W,hidden:!0}):null,p(t,E)]}):g.quiet?null:(0,U.jsx)(ra,{what:x,button:k,...g.as?{as:g.as}:{}})}let v=(0,T.lazy)(Zt(()=>m().then(()=>({default:y}),()=>({default:y}))));function S(E){let k=(0,T.useContext)(ut),[W]=(0,T.useState)(()=>n||o);return!n&&!o&&mr(k,P),(0,T.createElement)(W?y:v,E)}return S}}}var yr="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function ra({what:e,button:t,as:n="p"}){let r=typeof navigator<"u"&&navigator.onLine===!1?`${e} will load when you're back online.`:`${e} didn't load.`;return(0,U.jsxs)(n,{"data-testid":"lazy-part-missing",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,U.jsx)("span",{role:"status",children:r})," ",(0,U.jsx)("button",{ref:t,type:"button","data-testid":"lazy-part-retry",onClick:Xt,style:{font:"inherit",fontWeight:600,color:"var(--graview-ink)",background:"none",border:"1px solid var(--graview-edge)",borderRadius:6,padding:"2px 10px"},children:"Try again"})]})}var Se=_(N(),1);function ia(){let{selection:e,setSelection:t}=ne();return(0,Se.useMemo)(()=>({selection:e,set:n=>t(n),clear:()=>t([]),toggle:n=>t(o=>o.includes(n)?o.filter(r=>r!==n):[...o,n]),isSelected:n=>e.includes(n)}),[e,t])}function aa(){let{store:e}=ne(),t=ot();return(0,Se.useMemo)(()=>sa(e),[e,t])}var vr=new WeakMap;function sa(e){let t=vr.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),vr.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function la(){let{view:e,setView:t}=ne();return(0,Se.useMemo)(()=>({view:e,url:ee(e),focus:n=>t(o=>q(o,n)),show:n=>t(o=>io(o,n)),toggle:n=>t(o=>Ue(o,n)),go:n=>t(n)}),[e,t])}var he={at:0,depth:0,listeners:new Set,tell(){for(let e of this.listeners)e()}};typeof window<"u"&&window.addEventListener("popstate",e=>{let t=e.state;he.at=typeof t?.graview=="number"?t.graview:0,he.at>he.depth&&(he.depth=he.at),he.tell()});var G=_(N(),1),en={profile:{trigger:"profile-button",pane:"profile",opens:"press",focus:"into",drawn:["shell","embed"]},problems:{trigger:"standing",pane:"problems",opens:"press",focus:"into",drawn:["shell","embed"]},places:{trigger:"app-places-open",pane:"app-places",opens:"press",focus:"into",drawn:["embed"]},here:{trigger:"here-open",pane:"here-list",opens:"press",focus:"into",drawn:["shell","embed","pages"]},suggested:{trigger:"suggested-button",pane:"suggested",opens:"press",focus:"into",drawn:["shell","embed","pages"]},activity:{trigger:"activity-button",pane:"activity",opens:"press",focus:"into",drawn:["shell","embed","pages"]},find:{trigger:"find-box",pane:"find-strip",opens:"typing",focus:"stays",drawn:["shell"]},districts:{trigger:"beyond-more",pane:"beyond-list",opens:"press",focus:"into",drawn:["shell","embed"]},acts:{trigger:null,pane:"context-menu",opens:"context-menu",focus:"into",drawn:["shell","embed","pages"]},arrange:{trigger:"arrange-add",pane:"arrange-list",opens:"press",focus:"into",drawn:["pages"]},"studio-ask":{trigger:"studio-agent",pane:"studio-agent-panel",opens:"press",focus:"into",drawn:["studio"]}},da={position:"fixed",inset:"auto",margin:0,zIndex:Un("popover"),boxSizing:"border-box"},ct=6,we=8,ua=e=>typeof e.showPopover=="function";function ft(e){try{return e.matches(":popover-open")}catch{return!1}}function ca(e){if(typeof e=="function"){let o=e();return o?{left:o.x,right:o.x,top:o.y,bottom:o.y}:null}let t=e.current;if(!t||!t.isConnected)return null;let n=t.getBoundingClientRect();return{left:n.left,right:n.right,top:n.top,bottom:n.bottom}}function tn(e,t,n={}){let o=ca(t);if(!o)return;let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},i=e.dataset.graviewDesignedHeight??=e.style.maxHeight;e.style.maxHeight=i;let a=e.getBoundingClientRect(),s=r.height-o.bottom-ct-we,l=o.top-ct-we,c=a.height<=s||s>=l,u=Math.max(96,Math.floor(c?s:l)),m=Math.min(a.height,u);a.height>u&&(e.style.maxHeight=i?`min(${i}, ${u}px)`:`${u}px`);let p=a.width,g=n.align==="start"?o.left:o.right-p,x=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();x&&p<=x.right-x.left&&(g<x.left?g=o.left+p<=x.right?o.left:x.left:g+p>x.right&&(g=o.right-p>=x.left?o.right-p:x.right-p));let P=p>=r.width-2*we?Math.max(0,(r.width-p)/2):Math.max(we,Math.min(g,r.width-we-p)),y=c?o.bottom+ct:Math.max(we,o.top-ct-m);e.style.left=`${Math.round(P)}px`,e.style.top=`${Math.round(y)}px`}function br(e,t,n,o={}){let r=o.align??"end";(0,G.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(ua(i)&&!ft(i))try{i.showPopover(),pa()}catch{}let a=0,s=c=>{c?.target instanceof Node&&i.contains(c.target)||(cancelAnimationFrame(a),a=requestAnimationFrame(()=>tn(i,n,{align:r})))};tn(i,n,{align:r}),addEventListener("resize",s),addEventListener("scroll",s,!0);let l=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>s());return l?.observe(i),()=>{if(cancelAnimationFrame(a),removeEventListener("resize",s),removeEventListener("scroll",s,!0),l?.disconnect(),i.isConnected&&ft(i))try{i.hidePopover()}catch{}}},[t,e,r])}var nn=new Set;function fa(e){return nn.add(e),()=>nn.delete(e)}function pa(){for(let e of nn)if(!(!e.isConnected||!ft(e)))try{e.hidePopover(),e.showPopover()}catch{}}var ve=null,ya='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function ma(e){for(let t of e.querySelectorAll(ya))if(t.closest("[hidden]")===null&&getComputedStyle(t).visibility!=="hidden")return t;return e}var Qt=()=>{let e=document.activeElement;return e===null||e===document.body};function ga(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[a,s]=(0,G.useState)(!1),l=t.open??a,c=(0,G.useRef)(null),u=(0,G.useRef)(null),m=(0,G.useCallback)(S=>{c.current=S},[]),p=(0,G.useCallback)(S=>{u.current=S},[]),g=`graview-popover-${(0,G.useId)().replace(/:/g,"")}`,x=(0,G.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});x.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let P=(0,G.useCallback)(S=>{x.current.controlled||s(S),x.current.onOpenChange?.(S)},[]),y=(0,G.useCallback)(()=>{(document.querySelector(`[aria-controls="${g}"]`)??c.current??x.current.returnTo?.()??null)?.focus({preventScroll:!0})},[g]),v=(0,G.useCallback)(S=>{let E=u.current,k=typeof document>"u"?null:document.activeElement,W=k===null||k===document.body||E!==null&&E.contains(k);P(!1),!(!S||!W)&&(y(),requestAnimationFrame(()=>{Qt()&&y()}))},[P,y]);return br(u,i&&l,n??c,t.align?{align:t.align}:{}),(0,G.useEffect)(()=>{if(!i||!l)return;let S={name:e,close:()=>v(!1)};if(ve&&ve.close!==S.close&&ve.close(),ve=S,en[e].focus==="into"){let b=u.current;b&&!b.contains(document.activeElement)&&ma(b).focus({preventScroll:!0})}let E=b=>{b.key==="Escape"&&v(!0)},k=b=>{let I=b.target;if(!(I instanceof Node))return;let C=u.current;if(C?.contains(I)||c.current?.contains(I))return;let F=I instanceof Element?I.closest('[role="dialog"], [role="alertdialog"]'):null;F&&!(C&&F.contains(C))||(v(!1),en[e].focus==="into"&&requestAnimationFrame(()=>{(Qt()||C!==null&&C.contains(document.activeElement))&&y()}))},W=null,H=null,j=b=>{let I=b.target;if(!(I instanceof Element))return;let C=u.current,F=I.closest('[role="dialog"], [role="alertdialog"]');!F||C&&(C.contains(F)||F.contains(C))||(W=F,v(!1))};return document.addEventListener("keydown",E),document.addEventListener("pointerdown",k,!0),document.addEventListener("focusin",j),()=>{document.removeEventListener("keydown",E),document.removeEventListener("pointerdown",k,!0),document.removeEventListener("focusin",j);let b=W;b&&typeof MutationObserver<"u"&&(H?.disconnect(),H=new MutationObserver(()=>{b.isConnected||(H?.disconnect(),requestAnimationFrame(()=>{(Qt()||document.activeElement.closest("[hidden]")!==null)&&y()}))}),H.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>H?.disconnect(),10*6e4)),ve?.close===S.close&&(ve=null)}},[i,l,e,v,y]),{open:l,setOpen:S=>S?P(!0):v(!0),toggle:()=>l?v(!0):P(!0),trigger:{ref:m,"aria-expanded":l,"aria-controls":g,"data-graview-popover-trigger":e},pane:{ref:p,id:g,popover:"manual",tabIndex:-1,"data-graview-popover":e,"data-graview-overlay":""}}}var be=_(N(),1);var xr=(0,be.createContext)(null);function ha(){let e=(0,be.useContext)(xr),t=Ut(),n=(o,r,i)=>t?.setView(a=>ae(ae(pe(q(a,te(o)),!1),"view",r),"filter",i?.filter??null));return(0,be.useMemo)(()=>e??{record:o=>{t&&(t.setView(r=>q(pe(r,!1),o)),t.setSelection([o]))},place:(o,r)=>{let i=t?.views.places().find(a=>a.as===o);i&&n(i.kind,i.as,r)},list:(o,r)=>n(o,null,r)},[e,t])}var xe=_(N(),1);var Sa=Jt(Ke(()=>(__graviewPreload(import.meta.url,["./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ODHCSYXX.js"))));function wa(e,t,n){let o,r=!1,i=()=>{let{hidden:s,removed:l}=t.current();o||r||s.length+l.length===0||(o=()=>{},Sa.load().then(c=>{r||(o=c.watchTidied(e,t,n))},String))};i();let a=t.onChange?.(i);return()=>{r=!0,a?.(),o?.()}}function va(e,t){let[n,o]=(0,xe.useState)();return(0,xe.useEffect)(()=>t?wa(e,t,r=>o([e,r])):void 0,[e,t]),n?.[0]===e?n[1]:e}var Er=_(N(),1),ba=(0,Er.createContext)(!1);var on=_(N(),1),xa=(0,on.createContext)(null),Ea=(0,on.createContext)(null);var Ar=_(N(),1),Aa=(0,Ar.createContext)(null);var Pr=_(N(),1),rn='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',an=e=>e instanceof HTMLElement&&(e.matches(rn)||e.hasAttribute("tabindex")),Le=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function Pa(e,t){let n=l=>l.replace(/["\\]/g,"\\$&"),o=t.getAttribute("data-testid"),r=t.getAttribute("data-graview-pick"),i=t.getAttribute("aria-label"),a=o?`[data-testid="${n(o)}"]`:r?`[data-graview-pick="${n(r)}"]`:i?`${t.tagName.toLowerCase()}[aria-label="${n(i)}"]`:null;if(!a)return null;let s=e.querySelector(a);return s&&an(s)&&Le(s)?s:null}var ka=e=>e.isConnected&&an(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&Le(e);function kr(e,t){let n=t?Pa(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&Le(o))return o;for(let r of e.querySelectorAll(rn))if(Le(r))return r;return an(e)&&Le(e)?e:null}function Ra(e){(0,Pr.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=y=>{let v=y.target;if(v instanceof Element){n=[];for(let S=v;S&&S!==t.parentElement;S=S.parentElement)n.push(S)}},r=!1,i=!1,a=t.ownerDocument,s=()=>!i&&a.defaultView!==null,l=(y,v)=>void setTimeout(()=>s()&&v(),y),c=y=>void requestAnimationFrame(()=>s()&&y()),u=y=>{if(r=!1,i)return;let v=a.activeElement;if(!(!(v===null||v===a.body||v===a.documentElement)||n.length===0)){if(ka(n[0])){y&&n[0]instanceof HTMLElement&&n[0].focus({preventScroll:!0});return}for(let E of n.slice(1)){if(!E.isConnected)continue;let k=kr(E,n[0]);if(k){k.focus({preventScroll:!0}),n=[];return}}}},m=(y,v=Date.now()+2500)=>{l(100,()=>{u(y);let S=a.activeElement;(S===null||S===a.body||S===a.documentElement)&&n.length>0&&Date.now()<v&&m(y,v)})},p=()=>{r||n.length===0||(r=!0,l(60,()=>c(()=>{u(!1),m(!1)})))},g=y=>{if(!(y instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(y.key))){if(!(y instanceof KeyboardEvent)){let v=y.target instanceof Element?y.target.closest(rn):null,S=a.activeElement,E=S===null||S===a.body||S===a.documentElement;if(v&&E&&t.contains(v)){n=[];for(let k=v;k&&k!==t.parentElement;k=k.parentElement)n.push(k);l(150,()=>c(()=>{u(!1),m(!1)}));return}}!(y instanceof KeyboardEvent)&&!(y.target instanceof Node&&n[0]?.contains(y.target))||l(150,()=>c(()=>{u(!0),m(!0)}))}},x=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&p()}),P=y=>{y.relatedTarget===null&&p()};return t.addEventListener("focusin",o),t.addEventListener("focusout",P),t.addEventListener("click",g),t.addEventListener("keydown",g),x.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",P),t.removeEventListener("click",g),t.removeEventListener("keydown",g),x.disconnect()}},[e])}export{fe as a,ee as b,ze as c,Ma as d,Oa as e,oo as f,no as g,ro as h,Et as i,q as j,io as k,ae as l,pe as m,$e as n,Ve as o,Ue as p,Ze as q,At as r,ye as s,Ia as t,Fr as u,te as v,ao as w,se as x,so as y,Kr as z,_a as A,lo as B,Pt as C,Br as D,qr as E,zr as F,N as G,Lt as H,fi as I,yi as J,Ro as K,Qe as L,mi as M,Ce as N,Mo as O,gi as P,Dt as Q,Nt as R,Ie as S,Ti as T,Mi as U,Oi as V,tr as W,Hi as X,Ni as Y,Vs as Z,Fi as _,ne as $,Ut as aa,ot as ba,Ki as ca,Bi as da,qi as ea,$t as fa,xr as ga,ha,zi as ia,ir as ja,ar as ka,sr as la,lr as ma,dr as na,ur as oa,cr as pa,fr as qa,$i as ra,Ui as sa,Zt as ta,Yi as ua,ut as va,Zi as wa,Xi as xa,Ji as ya,Qi as za,ea as Aa,ta as Ba,wr as Ca,na as Da,Jt as Ea,va as Fa,ba as Ga,xa as Ha,Ea as Ia,Aa as Ja,ia as Ka,aa as La,la as Ma,he as Na,Ra as Oa,da as Pa,ft as Qa,br as Ra,fa as Sa,ga as Ta};
|
|
2
|
-
/*! Bundled license information:
|
|
3
|
-
|
|
4
|
-
react/cjs/react.production.js:
|
|
5
|
-
(**
|
|
6
|
-
* @license React
|
|
7
|
-
* react.production.js
|
|
8
|
-
*
|
|
9
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the MIT license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
*)
|
|
14
|
-
|
|
15
|
-
react/cjs/react-jsx-runtime.production.js:
|
|
16
|
-
(**
|
|
17
|
-
* @license React
|
|
18
|
-
* react-jsx-runtime.production.js
|
|
19
|
-
*
|
|
20
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
21
|
-
*
|
|
22
|
-
* This source code is licensed under the MIT license found in the
|
|
23
|
-
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*)
|
|
25
|
-
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ue}from"./chunk.L5MDUZLQ.js";import{a as Be}from"./chunk.Q7RI4SI4.js";import{a as We}from"./chunk.VM43YREJ.js";import{a as X}from"./chunk.TI4OSTQV.js";import{a as fe}from"./chunk.MQISKON2.js";import{e as ce}from"./chunk.ZK446PSX.js";import{$ as Je,E as we,G as ln,J as He,P as Le,S as Fe}from"./chunk.SGMVLKZO.js";import{Ic as De,Lb as Ne,Vb as le,Xb as je,da as ae,fa as U,ha as q,ka as Ee,ma as de,tb as Me}from"./chunk.BLS2G3CD.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:({system:i,prompt:o})=>t({prompt:o,system:i})}}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.KZ3UPV2L.js","./chunk.G4JJXA63.js","./chunk.64TFAR5Z.js","./chunk.5DZR46YG.js","./chunk.Q7RI4SI4.js","./chunk.XOZU4OFA.js","./chunk.CR5MQMOL.js","./chunk.Q5WEOX3Q.js","./chunk.RXJBYP7B.js","./chunk.BJAQRV2R.js","./chunk.JJP5OL5E.js","./chunk.WVUJXDXZ.js","./chunk.6SHF6IL5.js","./chunk.MQISKON2.js","./chunk.GQX57JIE.js","./chunk.LJXAZ5TF.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.K4ITS63T.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as n}from"./chunk.5RNB6IC5.js";import"./chunk.ZITDUHX3.js";import"./chunk.ETWREHXF.js";import"./chunk.YZ6UKKEL.js";import"./chunk.DUIKIJKC.js";import"./chunk.73BJYIYS.js";import"./chunk.OKQ4JXTW.js";import"./chunk.M5RHVUZ6.js";import"./chunk.MRUDTYOL.js";import"./chunk.HGP3Q7QX.js";import"./chunk.QSZLY62B.js";import"./chunk.7VX6TBNY.js";import"./chunk.WVUJXDXZ.js";import{e as p}from"./chunk.6SHF6IL5.js";import"./chunk.MQISKON2.js";import"./chunk.GQX57JIE.js";import"./chunk.LJXAZ5TF.js";import"./chunk.QFI4L2HK.js";import"./chunk.KFHXTHIY.js";import"./chunk.GZHZLJBF.js";import"./chunk.JLR74UFP.js";import"./chunk.OJGHDWI6.js";import"./chunk.HG34MT7C.js";import"./chunk.TT6QBWRA.js";import"./chunk.UCS3CBT4.js";import"./chunk.O6SKKF4V.js";import"./chunk.ZK446PSX.js";import{S as m}from"./chunk.SGMVLKZO.js";import"./chunk.SDO3U72B.js";import"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import{b as t}from"./chunk.AJZBJBMO.js";var i=t(m(),1),a=new WeakMap;function s(o){let e=a.get(o);if(!e){let r=p(o);e=c=>c.mode==="fullscreen"?(0,i.jsx)(n,{blocks:r,slot:"home",heading:2,firstHeading:1}):(0,i.jsx)(n,{blocks:r,slot:"home",heading:3,firstHeading:2}),a.set(o,e)}return e}export{s as homeView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk.ZK446PSX.js";import{G as X,O as I,P as B,S as H,aa as L}from"./chunk.SGMVLKZO.js";import"./chunk.SDO3U72B.js";import{Ic as $,R as z,Xa as N,Ya as W}from"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import{b as A}from"./chunk.AJZBJBMO.js";function x(n,t){let r=N(n);return r==="agent"?"agent":r!=="human"&&r!=="visitor"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var J=n=>n.ops.filter(t=>t.withheld!==!0);function K(n,t={}){let r=n.batches().map(e=>{let o=e.ops[0],l=e.ops.at(-1),c=J(e).length===0;return{seq:l.seq+1,from:o.seq,at:l.at,batch:e.id,maker:c?"person":x(e.author,t.me),author:c?void 0:e.author,said:e.intent,declaration:!1,withheld:c}}),s=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of s){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let o=r.findIndex(l=>l.seq===e.seq);if(o>=0&&!r[o].withheld){r[o]={...r[o],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?x(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,o)=>e.seq-o.seq||+(e.batch!==void 0)-+(o.batch!==void 0))}function V(n,t){let r=n.log.all(),s=new Map(r.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(o=>o.undoes!==void 0&&(s.get(o.undoes)??-1)>=t)).map(e=>e.id)}function _(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?W(n.author,t):"the app"}var d=A(X(),1);var i=A(H(),1),Q={kind:"human"},Z=[1,2,4,8],ee=900,T={you:"You",person:"A person",agent:"An agent",app:"The app"},F={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function te(n,t,r){let s=r?Array.from({length:t},(e,o)=>o):[];return[...new Set([...s,t,...n.map(e=>e.seq)])].sort((e,o)=>e-o)}function ne(n,t){let r=n.withheld===!0;return{seq:n.seq+1,from:n.seq,at:n.at,batch:n.batch,maker:r?"person":x(n.author,t),author:r?void 0:n.author,said:n.batchIntent??n.intent,declaration:!1,withheld:r}}function ae(n,t){let r=0;for(let s=0;s<n.length;s++)n[s]<=t&&(r=s);return r}function re(n,t,r){let s=V(n,t);if(s.length===0)return null;let e=n.canUndo(s);if(!e.ok)return null;let o=new Set(n.permittedMutations(r).map(l=>l.name));return e.ops.every(l=>l.mutation!==null&&o.has(l.mutation.name))?s:null}function pe({face:n}){let t=I(),r=L(),s=r?.principal??Q,e=B(t.live,s),o=e.log.length,l=(0,d.useMemo)(()=>K(e,{me:s,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,s,t.host,o]),c=e.log.horizon,k=c>0&&t.host?.archived!==void 0,h=(0,d.useMemo)(()=>te(l,c,k),[l,c,k]),f=t.archive,p=f?.seq??t.past?.seq??o,b=ae(h,p),m=h.length-1,D=p<c&&t.past?.seq===p?t.past.store.log.all().at(-1):void 0,w=D?ne(D,s):p<c?void 0:[...l].reverse().find(a=>a.seq<=p&&a.seq>(h[b-1]??-1))??[...l].reverse().find(a=>a.seq<=p),[v,q]=(0,d.useState)(!1),[P,U]=(0,d.useState)(1),[M,R]=(0,d.useState)(null);(0,d.useEffect)(()=>{if(!v)return;if(b>=m){q(!1);return}let a=setTimeout(()=>t.show(h[b+1]),ee/P);return()=>clearTimeout(a)},[v,b,m,P,h,t]);let E=(0,d.useMemo)(()=>t.past&&!f&&p>=c?re(e,p,s):null,[t.past,f,e,p,c,s,o]),C=a=>_(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),g=t.past?t.past.at?z(t.past.at,r?.locale):"the start":null,O=f?f.refused?"The archive could not be read":"Reading the older changes from the archive\u2026":w?`${C(w)==="you"?"You":C(w)}: ${w.said}`:"Nothing had happened yet",j=(0,d.useRef)(null);(0,d.useLayoutEffect)(()=>{let a=j.current,y=a?.parentElement;if(n!=="scene"||!a||!y)return;let u=()=>y.style.setProperty("--graview-sheet",`${Math.ceil(a.getBoundingClientRect().height)+24}px`);u();let S=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return S?.observe(a),()=>{S?.disconnect(),y.style.removeProperty("--graview-sheet")}},[n]);let Y=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:$("rail")}:{position:"sticky",top:0,zIndex:$("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,i.jsxs)("section",{ref:j,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...Y,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,i.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:f?"Archived changes":g?`As of ${g}`:"Now"}),(0,i.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:O}),g?(0,i.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,i.jsxs)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:[k?(0,i.jsx)("span",{"data-testid":"timeline-archived",title:"Changes read from the archive as you scrub back",style:{position:"absolute",left:0,bottom:0,height:6,width:`${m===0?0:h.indexOf(c)/m*100}%`,borderRadius:2,background:"var(--graview-edge)"}}):null,h.slice(1).map((a,y)=>{let u=[...l].reverse().find(G=>G.seq===a);if(!u)return null;let S=m===0?0:(y+1)/m*100;return(0,i.jsx)("span",{"data-graview-tick":a,"data-maker":u.maker,...u.declaration?{"data-declaration":""}:{},title:`${T[u.maker]}: ${u.said}`,style:{position:"absolute",left:`calc(${S}% - 1px)`,bottom:0,width:u.declaration?4:2,height:u.declaration?22:12,borderRadius:2,background:u.declaration?"var(--graview-ink)":F[u.maker],opacity:a<=p?1:.45}},`${a}:${u.batch??"declaration"}`)})]}),(0,i.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:m,step:1,value:b,"aria-valuetext":g?`As of ${g}. ${O}`:`Now. ${O}`,onChange:a=>{q(!1),t.show(h[Number(a.currentTarget.value)]??o)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,i.jsx)("button",{type:"button","data-testid":"play","aria-pressed":v,onClick:()=>{!v&&b>=m&&t.show(h[0]),q(!v)},style:{minHeight:28,minWidth:64},children:v?"Pause":"Play"}),(0,i.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,i.jsx)("select",{"data-testid":"speed",value:P,onChange:a=>U(Number(a.currentTarget.value)),style:{minHeight:28},children:Z.map(a=>(0,i.jsxs)("option",{value:a,children:[a,"\xD7"]},a))})]}),(0,i.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(T).filter(a=>l.some(y=>y.maker===a)).map(a=>(0,i.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,i.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:F[a]}}),T[a]]},a))}),(0,i.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[E?(0,i.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{R(null);try{e.undo([...E],{author:s,intent:g?`Restore to ${g}`:"Restore"}),t.show(null)}catch(a){R(a instanceof Error?a.message:String(a))}},style:{minHeight:28},children:"Restore to here"}):null,(0,i.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),M?(0,i.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:M}):null,f?.refused?(0,i.jsx)("span",{role:"alert","data-testid":"archive-refused",style:{color:"var(--graview-warn)"},children:f.refused}):null,c>0&&!k?(0,i.jsx)("span",{"data-testid":"timeline-horizon",style:{color:"var(--graview-ink-faint)"},children:"The changes before the timeline's start were archived."}):null]})}export{pe as Timeline};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as ee,b as H,c as ne}from"./chunk.S64LCR23.js";import{A as _,C as U,E as J,I as Q,K as X,N as Y,a as O,i as K,l as G,p as q,s as z,t as W,x as j,y as Z}from"./chunk.ZK446PSX.js";import{$ as N,Fa as D,G as ae,Oa as $,S as M,ba as T,sa as I}from"./chunk.SGMVLKZO.js";import{vc as C}from"./chunk.BLS2G3CD.js";import{b as F}from"./chunk.AJZBJBMO.js";var o=F(ae(),1);var u=F(M(),1),fe=e=>typeof e=="object"?e:{};function he({rootRef:e,firstLook:t,app:n}){let r=(0,o.useCallback)(()=>e.current,[e]);return t?(0,u.jsx)(Y,{firstLook:t,root:r,app:n}):null}function ge(e,t,n){let{app:r}=e,a=(0,o.useMemo)(()=>{let s=Q(t(r.schema,r.viewSpecs),r),d=n?se(s,n):s,i=e.views?e.views(r.schema,d):s,c=i===d?s:I(s,i);return X(c,r.schema,U(e.brand??r.brand,r.schema)),n?n.register(c):c},[e.views,r.schema,r.viewSpecs,r.lenses,r.pages,r.home,n]);return D(a,e.keptViews)}function se(e,t){let n={...e,register(r,a,s,d){return d?.name!==t.name&&e.register(r,a,s,d),n},...e.home?{home:r=>(t.home||e.home(r),n)}:{}};return n}var k=e=>e?e.getBoundingClientRect().height:0;function be(e,t,n){let r=(0,o.useRef)(n);r.current=n;let a=n!==void 0;(0,o.useLayoutEffect)(()=>{let s=e.current;if(!s||!a)return;let d=()=>{let m=[...s.children],h=m.find(b=>b.hasAttribute("data-graview-app-bar")),p=m.find(b=>b.hasAttribute("data-embed-content")),g=p?.querySelector("[data-embed-measure]")??null,l=m.find(b=>b.hasAttribute("data-graview-place-line"));return{strip:h,line:l,content:p,measure:g}},i=-1,c=()=>{let{strip:m,line:h,content:p,measure:g}=d(),l=Math.ceil(k(m)+k(h)+k(g||p));l!==i&&(i=l,r.current?.(l))};if(c(),typeof ResizeObserver>"u")return;let y=new ResizeObserver(c),R=()=>{y.disconnect();let{strip:m,line:h,content:p,measure:g}=d();for(let l of[s,m,h,p,g])l&&y.observe(l)};R();let w=new MutationObserver(()=>{R(),c()});return w.observe(s,{childList:!0}),()=>{y.disconnect(),w.disconnect()}},[e,t,a])}var we=480,ie=0;function Se(e){let{app:t,seed:n,scheme:r="auto",brand:a=t.brand,fonts:s=!0,height:d="100%",label:i}=e,c=(0,o.useRef)(null);$(c);let y=d==="viewport"?"100dvh":d,R=G(typeof y=="string"&&/vh\b/.test(y)),w=(0,o.useMemo)(()=>`graview-embed-${++ie}`,[]),m=(0,o.useMemo)(()=>e.store??e.remote?.store??H(t,n),[e.store,e.remote,t,n]),h=e.presence??e.remote?.presence,p=e.hostContext?.theme,g=ne(r==="auto"&&p===void 0,a?.scheme),l=r==="auto"?p??g:r,b=(0,o.useMemo)(()=>O(l,a,{scope:`.${w}`}),[l,a,w]);K(e.favicon?C(a):void 0),(0,o.useEffect)(()=>{if(!s||typeof document>"u")return;let v=ee(a);if(!v||document.querySelector(`link[href="${v}"]`))return;let f=document.createElement("link");f.rel="stylesheet",f.href=v,document.head.appendChild(f)},[a,s]);let x=(0,o.useRef)(void 0);(0,o.useLayoutEffect)(()=>{let v=c.current,f=x.current;if(x.current=i,!v||!i)return;let oe=S=>{let E=S.getAttribute("aria-label")??"",A=f&&f!==i?E.startsWith(`${f} \xB7 `)?E.slice(f.length+3):E===f?"":E:E;A===i&&(S.getAttribute("role")==="region"||S.tagName==="SECTION"&&!S.hasAttribute("role"))&&S.setAttribute("role","group");let P=A.startsWith(`${i} \xB7 `)||A===i?A:A?`${i} \xB7 ${A}`:i;P!==E&&S.setAttribute("aria-label",P)},B=()=>v.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(S=>{S.hasAttribute("data-graview-named-by-lens")||oe(S)});B();let V=new MutationObserver(B);return V.observe(v,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>V.disconnect()},[i]);let te=R?`${y}`.replace(/([\d.]+)[sdl]?vh\b/g,(v,f)=>`${+f*R/100}px`):y;return{rootRef:c,scope:w,css:b,scheme:l,store:m,presence:h,brand:a,auto:d==="auto",height:te}}function ve({rootRef:e,board:t}){let n=(0,o.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]);return(0,u.jsx)(q,{board:t,anchor:n})}function Re(e,t,n){return{brand:n,locale:e.locale,timeZone:e.timeZone,principal:e.principal,seats:e.seats,presence:t,people:e.people,memory:e.memory,presenceTtlMs:e.presenceTtlMs,onKeepLens:e.onKeepLens,ai:e.ai,files:e.files,resolveApp:e.resolveApp,history:e.history,linkedRecords:e.linkedRecords,subscriptions:e.subscriptions,dismissals:e.dismissals,whileAway:e.whileAway,keptViews:e.keptViews,signIn:e.signIn,menuSections:e.menuSections,app:e.app}}function Ee({name:e,heading:t,faces:n,at:r,without:a,home:s,reach:d,standing:i,hostActions:c,keeping:y,onFind:R,switch:w,named:m=!0}){let{brand:h,store:p,principal:g,views:l}=N();T();let b=a?.has("places")?[]:z({store:p,principal:g,views:l}),x=_();return(0,u.jsx)(j,{brand:h,name:e,named:m,description:h?.subtitle,heading:t,faces:n,home:s,places:b,current:r===null?null:W(b,r),reach:d,onFind:R,...w?{switch:w}:{},...n||r===null?{scenePlaces:x}:{},tools:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(J,{clean:i}),(0,u.jsx)(Z,{...c?{hostActions:c}:{},...y?{keeping:y}:{}})]})})}var Ae=e=>e===!1?2:Math.min(e+1,6);function xe(e){let[t,n]=(0,o.useState)(e),r=(0,o.useRef)(void 0),a=(0,o.useRef)(void 0),s=(0,o.useMemo)(()=>({go:r,at:n,pending:a}),[]),d=(0,o.useCallback)(i=>{if(r.current){r.current(i);return}a.current=i,n(i)},[]);return{at:t,setAt:n,steering:s,steer:d}}function de(e){let t=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof t=="string"&&t.length>0?t:typeof e=="object"?"Error":typeof e}}var L=()=>typeof performance<"u"?performance.now():Date.now();function ke(e,t){let n=(0,o.useRef)({onError:e,face:t});return n.current={onError:e,face:t},(0,o.useCallback)((r,a)=>n.current.onError?.(de(r),{module:a.module,face:n.current.face}),[])}function Fe(e,t){let n=(0,o.useRef)(null);n.current===null&&(n.current=L());let r=(0,o.useRef)({onReady:e,face:t});r.current={onReady:e,face:t};let a=(0,o.useRef)(!1);return(0,o.useCallback)(s=>{a.current||(a.current=!0,r.current.onReady?.({ms:Math.max(0,L()-(n.current??L())),face:s}))},[])}var re=class extends o.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t,n){console.error(`[graview] ${this.props.module} threw while rendering`,t,n.componentStack),this.props.report(t,{module:this.props.module})}render(){return this.state.failed?(0,u.jsxs)("div",{role:"alert","data-graview-face-error":this.props.module,...this.props.content?{"data-embed-content":""}:{},style:this.props.content?{flex:"1 1 auto",display:"grid",alignContent:"center",justifyItems:"center",gap:8,padding:24,background:"var(--graview-ground)",color:"var(--graview-ink)",fontSize:"0.9375rem"}:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,u.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,u.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{fe as a,he as b,ge as c,be as d,we as e,Se as f,ve as g,Re as h,Ee as i,Ae as j,xe as k,ke as l,Fe as m,re as n};
|