graview 0.1.29 → 0.1.32
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.2NIOHEMX.js +1 -0
- package/dist/preview/{chunk.GZH6PTXN.js → chunk.3AGY4QVS.js} +1 -1
- package/dist/preview/chunk.3HXN4BOY.js +1 -0
- package/dist/preview/chunk.3K6YSVHC.js +1 -0
- package/dist/preview/{chunk.7D77HEIJ.js → chunk.3TVXGJTU.js} +1 -1
- package/dist/preview/chunk.3TY5NFLY.js +1 -0
- package/dist/preview/{chunk.IZW7DBK4.js → chunk.47STJVRV.js} +1 -1
- package/dist/preview/chunk.4HRAQNJO.js +27 -0
- package/dist/preview/chunk.4HZ7QTXZ.js +1 -0
- package/dist/preview/chunk.4MERAWS2.js +1 -0
- package/dist/preview/chunk.52W7WYME.js +1 -0
- package/dist/preview/chunk.5A4AOFOA.js +1 -0
- package/dist/preview/chunk.5H4VXLZF.js +88 -0
- package/dist/preview/{chunk.D4GOVA25.js → chunk.5T5XGILP.js} +1 -1
- package/dist/preview/chunk.5TVB6BUY.js +1 -0
- package/dist/preview/chunk.5UL7YDUD.js +1 -0
- package/dist/preview/chunk.63GXY2ME.js +1 -0
- package/dist/preview/chunk.6QWV5MVH.js +25 -0
- package/dist/preview/{chunk.HV6I74DF.js → chunk.6UGEYZAC.js} +1 -1
- package/dist/preview/chunk.6YCBYL2Y.js +2 -0
- package/dist/preview/chunk.7GKUVQVF.js +1 -0
- package/dist/preview/{chunk.QSDT2RLY.js → chunk.7T7NZZTC.js} +1 -1
- package/dist/preview/chunk.AKFKM4SW.js +3 -0
- package/dist/preview/chunk.AOSMJKLH.js +1 -0
- package/dist/preview/{chunk.IPBXAAQV.js → chunk.ASCLIM2P.js} +1 -1
- package/dist/preview/chunk.B2GLDIAS.js +1 -0
- package/dist/preview/chunk.BNV77BQZ.js +4 -0
- package/dist/preview/chunk.BOO6WVM4.js +117 -0
- package/dist/preview/chunk.BQ3JHEHV.js +1 -0
- package/dist/preview/chunk.CAVBSL27.js +1 -0
- package/dist/preview/chunk.CDP2XL66.js +1 -0
- package/dist/preview/chunk.CIPS2OGR.js +1 -0
- package/dist/preview/chunk.CJJLJ3KW.js +2 -0
- package/dist/preview/chunk.CN3UEF5N.js +90 -0
- package/dist/preview/chunk.COQKECUH.js +1 -0
- package/dist/preview/{chunk.3G5MQFZK.js → chunk.CWHRDBOF.js} +1 -1
- package/dist/preview/chunk.CX3KL2C5.js +1 -0
- package/dist/preview/chunk.D75KC3LL.js +1 -0
- package/dist/preview/chunk.DAZ2VSRD.js +1 -0
- package/dist/preview/{chunk.ONGVH3ZM.js → chunk.DHIUSUCL.js} +75 -24
- package/dist/preview/{chunk.44FVJOK4.js → chunk.DYSPCGXX.js} +1 -1
- package/dist/preview/chunk.E2YEOMPH.js +1 -0
- package/dist/preview/chunk.EBGAYL32.js +1 -0
- package/dist/preview/{chunk.HRWLR7T4.js → chunk.EF3XNU4O.js} +1 -1
- package/dist/preview/chunk.EJPI3ST6.js +1 -0
- package/dist/preview/chunk.EKPRNDUV.js +1 -0
- package/dist/preview/chunk.ERIT3R6N.js +1 -0
- package/dist/preview/chunk.EYTBDMTW.js +1 -0
- package/dist/preview/chunk.F6EH7HI2.js +1 -0
- package/dist/preview/{chunk.OGXE2RHC.js → chunk.F6ZK7RMB.js} +2 -2
- package/dist/preview/chunk.FSTCX2AI.js +1 -0
- package/dist/preview/chunk.FWTIUYXH.js +2 -0
- package/dist/preview/{chunk.YCA7P5MK.js → chunk.G5NZVPJU.js} +1 -1
- package/dist/preview/chunk.GO4XBWJO.js +9 -0
- package/dist/preview/chunk.GV2CQVKV.js +1 -0
- package/dist/preview/chunk.GYICGZMG.js +3 -0
- package/dist/preview/chunk.H7BST3XO.js +1 -0
- package/dist/preview/chunk.H7EPE74C.js +1 -0
- package/dist/preview/{chunk.X53HI436.js → chunk.HAIG6NVX.js} +1 -1
- package/dist/preview/chunk.HLTRQU4Y.js +35 -0
- package/dist/preview/{chunk.O4QPITBD.js → chunk.I6FPNX43.js} +1 -1
- package/dist/preview/chunk.IDVAR5HM.js +1 -0
- package/dist/preview/chunk.J25KOSNW.js +1 -0
- package/dist/preview/chunk.JDUJDAGA.js +1 -0
- package/dist/preview/chunk.JFAOHHJJ.js +1 -0
- package/dist/preview/chunk.JOOQUWLT.js +341 -0
- package/dist/preview/{chunk.ZBXOX3W3.js → chunk.JQU5GEU3.js} +1 -1
- package/dist/preview/chunk.K5ME5GCG.js +1 -0
- package/dist/preview/chunk.K7PMDSOL.js +1 -0
- package/dist/preview/chunk.KSES5U5B.js +1 -0
- package/dist/preview/chunk.LLLZEGRK.js +1 -0
- package/dist/preview/chunk.LR3VDXPI.js +1 -0
- package/dist/preview/chunk.LXBOVRFI.js +1 -0
- package/dist/preview/chunk.MAF7C3VM.js +2 -0
- package/dist/preview/chunk.MNP4JI33.js +5 -0
- package/dist/preview/{chunk.5AT4O4BN.js → chunk.MWGGV7DE.js} +1 -1
- package/dist/preview/chunk.N6OX4NEQ.js +1 -0
- package/dist/preview/chunk.NM6MZYFN.js +47 -0
- package/dist/preview/chunk.NRAYZY3X.js +1 -0
- package/dist/preview/chunk.NTF7FVB2.js +1 -0
- package/dist/preview/chunk.OC6IWRQ3.js +1 -0
- package/dist/preview/chunk.OF34OZ4V.js +1 -0
- package/dist/preview/chunk.OJGHDWI6.js +1 -0
- package/dist/preview/chunk.OKRNJXTV.js +1 -0
- package/dist/preview/chunk.PBSMLINK.js +1 -0
- package/dist/preview/chunk.PHKSMUIA.js +1 -0
- package/dist/preview/chunk.PIP6Z563.js +1 -0
- package/dist/preview/chunk.QGTSHKJL.js +1 -0
- package/dist/preview/chunk.QVVJRSRM.js +1 -0
- package/dist/preview/{chunk.J46KDTEZ.js → chunk.QYZNAUIR.js} +1 -1
- package/dist/preview/chunk.R6K6GF5R.js +1 -0
- package/dist/preview/chunk.RCKTBOY2.js +1 -0
- package/dist/preview/{chunk.CK7QWLMX.js → chunk.RIJUCHP4.js} +1 -1
- package/dist/preview/chunk.SHPXD6FC.js +1 -0
- package/dist/preview/chunk.SHTJZ6UX.js +1 -0
- package/dist/preview/chunk.SYAEBGDC.js +2 -0
- package/dist/preview/chunk.T5VG5A6V.js +1 -0
- package/dist/preview/{chunk.JNGUSAWX.js → chunk.TAQ764IQ.js} +17 -3
- package/dist/preview/chunk.TCNBCTWO.js +1 -0
- package/dist/preview/chunk.TI4OSTQV.js +1 -0
- package/dist/preview/{chunk.ZSKP6UQS.js → chunk.UATVTXZY.js} +1 -1
- package/dist/preview/{chunk.V6TK4LHW.js → chunk.UBFNZMUX.js} +4 -4
- package/dist/preview/chunk.UGFDSE37.js +1 -0
- package/dist/preview/chunk.UGFJKSHU.js +3 -0
- package/dist/preview/chunk.UHUGOTUU.js +19 -0
- package/dist/preview/chunk.ULRW47RP.js +1 -0
- package/dist/preview/chunk.UNL2HIF2.js +1 -0
- package/dist/preview/chunk.UZGRRDHD.js +1 -0
- package/dist/preview/chunk.VG3O4LWB.js +1 -0
- package/dist/preview/chunk.WAZ7OGBD.js +1 -0
- package/dist/preview/chunk.XANVHJQ4.js +1 -0
- package/dist/preview/chunk.XKABS745.js +1 -0
- package/dist/preview/chunk.XMC7YDWT.js +1 -0
- package/dist/preview/chunk.XNJEFUF7.js +3 -0
- package/dist/preview/chunk.Y6ZNFQK3.js +6 -0
- package/dist/preview/{chunk.QNHECGMH.js → chunk.YIR7PPF3.js} +1 -1
- package/dist/preview/index.html +51 -0
- package/dist/preview/page.js +6 -6
- package/package.json +6 -6
- package/dist/preview/chunk.2643W7FT.js +0 -1
- package/dist/preview/chunk.2CLPRG3I.js +0 -1
- package/dist/preview/chunk.2IZFIORK.js +0 -1
- package/dist/preview/chunk.2NCTM5K2.js +0 -2
- package/dist/preview/chunk.3JM2TNDD.js +0 -2
- package/dist/preview/chunk.4GGAPOMK.js +0 -2
- package/dist/preview/chunk.5JXUAMKI.js +0 -1
- package/dist/preview/chunk.5R66YTET.js +0 -2
- package/dist/preview/chunk.64P76WK4.js +0 -1
- package/dist/preview/chunk.7DNFXJH3.js +0 -1
- package/dist/preview/chunk.7PRFYYVM.js +0 -1
- package/dist/preview/chunk.AE5GKL4C.js +0 -1
- package/dist/preview/chunk.ARR75WBP.js +0 -35
- package/dist/preview/chunk.AVUS5LMG.js +0 -3
- package/dist/preview/chunk.BKPGDEES.js +0 -1
- package/dist/preview/chunk.BZ5OJYHU.js +0 -1
- package/dist/preview/chunk.COTG2IG5.js +0 -1
- package/dist/preview/chunk.DAA6XWLF.js +0 -1
- package/dist/preview/chunk.DKTCRFMS.js +0 -1
- package/dist/preview/chunk.DLGTFXGM.js +0 -1
- package/dist/preview/chunk.DN7SN6ZR.js +0 -1
- package/dist/preview/chunk.G4WQGTZR.js +0 -3
- package/dist/preview/chunk.GDA3G4U2.js +0 -6
- package/dist/preview/chunk.GS4T26WW.js +0 -328
- package/dist/preview/chunk.HFKMHLJ3.js +0 -1
- package/dist/preview/chunk.HGAMNIST.js +0 -1
- package/dist/preview/chunk.HKBKH7EK.js +0 -1
- package/dist/preview/chunk.HLLWKSZB.js +0 -5
- package/dist/preview/chunk.HONUT6OG.js +0 -1
- package/dist/preview/chunk.IWYUFYDJ.js +0 -1
- package/dist/preview/chunk.JU2ZVKMT.js +0 -2
- package/dist/preview/chunk.K4ZUVH2G.js +0 -1
- package/dist/preview/chunk.KC6UZHBM.js +0 -1
- package/dist/preview/chunk.KLITC55P.js +0 -1
- package/dist/preview/chunk.KZ2376BD.js +0 -19
- package/dist/preview/chunk.LYJAVUST.js +0 -1
- package/dist/preview/chunk.MOUGB4H6.js +0 -1
- package/dist/preview/chunk.MYFWM572.js +0 -1
- package/dist/preview/chunk.N4FBDA2W.js +0 -1
- package/dist/preview/chunk.O42YET3W.js +0 -1
- package/dist/preview/chunk.ONDILMIX.js +0 -1
- package/dist/preview/chunk.OQDETV4X.js +0 -1
- package/dist/preview/chunk.OWBEV6FR.js +0 -1
- package/dist/preview/chunk.OWE6OJ4P.js +0 -1
- package/dist/preview/chunk.OYJSFO3A.js +0 -1
- package/dist/preview/chunk.P62SKNJS.js +0 -27
- package/dist/preview/chunk.PA5HYAEO.js +0 -1
- package/dist/preview/chunk.PMEDLEZY.js +0 -9
- package/dist/preview/chunk.PTXQHHKF.js +0 -1
- package/dist/preview/chunk.R2D373VG.js +0 -1
- package/dist/preview/chunk.RB4RTBRZ.js +0 -1
- package/dist/preview/chunk.RCLJ4H52.js +0 -116
- package/dist/preview/chunk.RKRSRKF3.js +0 -1
- package/dist/preview/chunk.RWGLKDWH.js +0 -1
- package/dist/preview/chunk.SIL4KD3K.js +0 -1
- package/dist/preview/chunk.SS76EIMI.js +0 -1
- package/dist/preview/chunk.T4LY5QXO.js +0 -14
- package/dist/preview/chunk.UIIVEQAT.js +0 -1
- package/dist/preview/chunk.UTHHX2TJ.js +0 -1
- package/dist/preview/chunk.UWNYT7PF.js +0 -1
- package/dist/preview/chunk.VNBO2RXD.js +0 -1
- package/dist/preview/chunk.VPPUTA74.js +0 -1
- package/dist/preview/chunk.WKXNBHTL.js +0 -4
- package/dist/preview/chunk.WLRTPFAC.js +0 -1
- package/dist/preview/chunk.XAXJHEMD.js +0 -1
- package/dist/preview/chunk.XDZSTIS6.js +0 -88
- package/dist/preview/chunk.XXHNV24G.js +0 -1
- package/dist/preview/chunk.YRQZZH5V.js +0 -1
- package/dist/preview/chunk.YUWRZWGX.js +0 -1
- package/dist/preview/chunk.Z2RGLFLS.js +0 -1
- package/dist/preview/chunk.Z56B2JR2.js +0 -25
- package/dist/preview/chunk.Z5V23DQN.js +0 -3
- package/dist/preview/chunk.ZEGSQCSD.js +0 -1
- package/dist/preview/chunk.ZEVVWWNA.js +0 -44
- package/dist/preview/chunk.ZS4DJ76C.js +0 -1
- /package/dist/preview/{chunk.OHE5AMHH.js → chunk.GZHZLJBF.js} +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
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 Ur,B as ke,C as bn,D as Ie,E as qe,F as jr,G as Sn,H as Pe,I as zr,J as _r,K as I,L as it,M as xn,N as Yr,O as Pn,P as Wt,Q as Qr,R as ie,S as le,T as An,a as Q,b as Re,c as te,d as Kr,e as vn,f as kn,g as rt,h as ne,i as he,j as se,k as A,l as re,m as B,n as ve,o as Ft,p as Le,q as me,r as Br,s as ut,t as It,u as ee,v as Ke,w as Gr,x as Dt,y as xe,z as Vr}from"./chunk.NM6MZYFN.js";import{b as qr,c as Ot,e as ae}from"./chunk.63GXY2ME.js";import{a as Dr,d as Wr,e as Hr}from"./chunk.UGFDSE37.js";import{a as Er,c as $r,f as Or,g as Fr,i as Ir}from"./chunk.FSTCX2AI.js";import{a as xr,b as Pr,c as Ar,d as wn}from"./chunk.Y6ZNFQK3.js";import{a as Cr,b as Rr,d as Et,e as Lr,f as Tr,i as $t}from"./chunk.NRAYZY3X.js";import{a as Nt,b as hn,c as kr,e as br}from"./chunk.3HXN4BOY.js";import{m as Sr}from"./chunk.UHUGOTUU.js";import{a as sr,b as lr,c as dr,e as vr,f as yn,h as Mt}from"./chunk.EBGAYL32.js";import{d as ur,e as gr,f as mr,g as fr,n as yr,o as hr,q as wr,s as Tt}from"./chunk.DAZ2VSRD.js";import{a as mn}from"./chunk.XANVHJQ4.js";import{a as Lt,b as ar,c as rr,d as ir,e as or}from"./chunk.CAVBSL27.js";import{a as At,b as $a,c as Oa,d as Ct,e as Fa}from"./chunk.J25KOSNW.js";import{b as ja,c as tr,e as nr,f as gn}from"./chunk.LR3VDXPI.js";import{a as Ve,b as Qa,c as Xa,d as Ja,e as Za,f as er}from"./chunk.SHTJZ6UX.js";import{a as pn,b as Va,c as Ua}from"./chunk.UT6642FC.js";import{b as za,c as _a,i as pt}from"./chunk.ULRW47RP.js";import{r as un,s as Ya}from"./chunk.XMC7YDWT.js";import{f as Ha,g as at,i as Ka,j as qa,k as cn,q as Ba,r as Ga}from"./chunk.B2GLDIAS.js";import{b as Rt,c as Ia,d as Da,e as Wa}from"./chunk.6YCBYL2Y.js";import{C as fn,K as Mr,N as Nr,e as Na,f as Ea,j as Ei,q as cr,r as pr}from"./chunk.JOOQUWLT.js";import{F as Ee,K as ka,M as ba,P as Sa,Q as Y,T as xa,U as Pa,Y as Aa,Z as ye,a as wa,aa as Ca,ba as Ra,da as La,ha as nt,ia as Ta,ra as Ma,s as va,w as Ne}from"./chunk.6QWV5MVH.js";import{Dc as ma,Ec as fa,Gb as pa,Gc as Pt,I as aa,Jb as ua,Ma as la,N as ct,Oa as da,Oc as dn,Pc as ya,Tc as ha,W as et,X as ge,Ya as sn,Z as we,Za as ca,_ as St,aa as tt,ca as ra,da as ia,dc as ga,ea as He,fb as xt,la as oa,ma as sa,yc as ln}from"./chunk.MNP4JI33.js";import{b as H}from"./chunk.AJZBJBMO.js";function Xr(t,e,n={}){let a=t.graph.getNode(e);if(!a)return;let i=t.schema.tryDefinition(a.kind),r=l=>ge(t.schema.tryDefinition(l.kind),l),o=new Map;for(let l of t.graph.allEdges()){let d=l.from===e?"out":l.to===e?"in":null;if(!d)continue;let c=d==="out"?l.to:l.from,p=t.graph.getNode(c);if(!p)continue;let f=(d==="out"?i:t.schema.tryDefinition(p.kind))?.edges?.[l.kind],u=d==="in"?f?.inverse??f?.description:f?.description,k=`${l.kind}|${d}|${u??""}`;(o.get(k)??(()=>{let v={edgeKind:l.kind,direction:d,...u?{description:u}:{},targets:[]};return o.set(k,v),v})()).targets.push({id:p.id,kind:p.kind,label:r(p)})}return{id:e,kind:a.kind,label:r(a),fields:Da(pt(t.schema,t.graph,a),i),violations:sn(t.violations(n.context),[e]),actions:mn(t,[e],{focus:e,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...o.values()].map(l=>{let d=Rt(l.targets.flatMap(c=>{let p=t.graph.getNode(c.id);return p?[p]:[]}),c=>t.schema.tryDefinition(c));return{...l,targets:[...l.targets].map(c=>d.has(c.id)?{...c,apart:d.get(c.id)}:c).sort((c,p)=>c.label.localeCompare(p.label))}})}}function Ue(t,e,n={}){return{kind:e,members:t.graph.nodesOfKind(e),actions:mn(t,[],{kindSelection:[e],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function Jr(t,e){let n=(r,o)=>`${r}|${JSON.stringify(o)}`,a=new Map;for(let r of[...t.affordances,...t.withheld]){if(r.provider!=="invariant")continue;let o=n(r.mutation,r.args);a.has(o)||a.set(o,r.rank??Number.MAX_SAFE_INTEGER)}let i=Number.MAX_SAFE_INTEGER;return[...e].map((r,o)=>({repair:r,declared:o})).sort((r,o)=>(a.get(n(r.repair.mutation,r.repair.args??{}))??i)-(a.get(n(o.repair.mutation,o.repair.args??{}))??i)||r.declared-o.declared).map(r=>r.repair)}function je(t){let e=t.schema.kinds.map(i=>({kind:i,plural:tt(t.schema,i),count:t.graph.nodesOfKind(i).length})),n=new Map;for(let i of t.graph.allEdges()){let r=t.graph.getNode(i.from),o=t.graph.getNode(i.to);if(!r||!o)continue;let l=`${i.kind}|${r.kind}|${o.kind}`;n.set(l,(n.get(l)??0)+1)}let a=[];for(let{kind:i}of e){let r=t.schema.tryDefinition(i)?.edges??{};for(let[o,l]of Object.entries(r)){let d=l.to==="*"||l.to===void 0?(()=>{let c=[...n.keys()].filter(p=>p.startsWith(`${o}|${i}|`)).map(p=>p.split("|")[2]);return c.length>0?c:["*"]})():l.to;for(let c of d)a.push({edgeKind:o,from:i,to:c,...l.description?{description:l.description}:{},...l.inverse?{inverse:l.inverse}:{},count:n.get(`${o}|${i}|${c}`)??0})}}return{kinds:e,relations:a}}var De=H(Ee(),1);var ze=H(Ee(),1),S=H(Y(),1),$i=`
|
|
2
|
+
form:where([data-graview-part="form"]) {
|
|
3
|
+
/* A grid item of the section above it and a grid container for the
|
|
4
|
+
fields below: both halves are allowed to be narrower than what is in
|
|
5
|
+
them, or a big enough text size pushes the page sideways. See the note
|
|
6
|
+
on \`column\` in pages.tsx. */
|
|
7
|
+
display: grid;
|
|
8
|
+
grid-template-columns: minmax(0, 1fr);
|
|
9
|
+
min-width: 0;
|
|
10
|
+
gap: 12px;
|
|
11
|
+
}
|
|
12
|
+
label:where([data-graview-part="field"]),
|
|
13
|
+
div:where([data-graview-part="field"][data-graview-field="date"]) {
|
|
14
|
+
display: grid;
|
|
15
|
+
/* A track the width it was given: see the note on \`column\` in pages.tsx. */
|
|
16
|
+
grid-template-columns: minmax(0, 1fr);
|
|
17
|
+
min-width: 0;
|
|
18
|
+
gap: 4px;
|
|
19
|
+
}
|
|
20
|
+
label:where([data-graview-part="field"][data-graview-field="boolean"]) {
|
|
21
|
+
grid-auto-flow: column;
|
|
22
|
+
justify-content: start;
|
|
23
|
+
align-items: center;
|
|
24
|
+
}
|
|
25
|
+
span:where([data-graview-part="label"]),
|
|
26
|
+
legend:where([data-graview-part="label"]),
|
|
27
|
+
p:where([data-graview-part="unasked"]) {
|
|
28
|
+
font-size: 0.8125rem;
|
|
29
|
+
color: var(--graview-ink-muted);
|
|
30
|
+
}
|
|
31
|
+
p:where([data-graview-part="unasked"]) { margin: 0; }
|
|
32
|
+
input:where([data-graview-part="control"]:not([type="checkbox"])),
|
|
33
|
+
select:where([data-graview-part="control"]) {
|
|
34
|
+
font: inherit;
|
|
35
|
+
/* A TARGET IN EVERY ENGINE, not only in the one it was measured in.
|
|
36
|
+
Padding and line height alone came to 24 in Chromium and to 22 in
|
|
37
|
+
WebKit, which has its own intrinsic metrics for a \`select\` and rounds
|
|
38
|
+
nothing up for anybody. So every picker on the routed face was under
|
|
39
|
+
the WCAG 2.2 minimum in the browser iOS ships, and the check that says
|
|
40
|
+
so (\`verify-pages\`' \`bigEnoughToHit\`) only ever ran there through
|
|
41
|
+
\`pnpm engines\`. */
|
|
42
|
+
min-height: 24px;
|
|
43
|
+
/* NEVER WIDER THAN ITS FIELD. A select is as wide as its longest option,
|
|
44
|
+
and a picker over 320 vehicles ("2027 Mercedes-Benz GLE AMG 53 4MATIC+
|
|
45
|
+
Coupe") was 618 pixels on a 390 phone, and the whole page scrolled
|
|
46
|
+
sideways. It shrinks to its track and cuts the option inside its box. */
|
|
47
|
+
min-width: 0;
|
|
48
|
+
max-width: 100%;
|
|
49
|
+
text-overflow: ellipsis;
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
padding: 7px 10px;
|
|
52
|
+
border-radius: 8px;
|
|
53
|
+
border: 1px solid var(--graview-edge);
|
|
54
|
+
background: var(--graview-panel);
|
|
55
|
+
color: var(--graview-ink);
|
|
56
|
+
}
|
|
57
|
+
/* A PICKER THAT STILL LOOKS LIKE ONE.
|
|
58
|
+
WebKit ignores an author's padding and minimum height on a \`select\`
|
|
59
|
+
while the native appearance is on \u2014 so every picker on the routed face
|
|
60
|
+
came out 22 pixels tall in the browser iOS ships, under the 24 WCAG 2.2
|
|
61
|
+
asks for, while the same element measured 35 in Chromium. Turning the
|
|
62
|
+
appearance off is what makes the box the size it was asked to be, and it
|
|
63
|
+
takes the platform's chevron with it; the chevron is put back, in the ink
|
|
64
|
+
the scheme is already using. */
|
|
65
|
+
span:where([data-graview-part="picker"]) {
|
|
66
|
+
position: relative;
|
|
67
|
+
display: grid;
|
|
68
|
+
min-width: 0;
|
|
69
|
+
}
|
|
70
|
+
span:where([data-graview-part="picker"]) > select:where([data-graview-part="control"]) {
|
|
71
|
+
appearance: none;
|
|
72
|
+
padding-right: 28px;
|
|
73
|
+
}
|
|
74
|
+
span:where([data-graview-part="chevron"]) {
|
|
75
|
+
position: absolute;
|
|
76
|
+
right: 10px;
|
|
77
|
+
top: 50%;
|
|
78
|
+
transform: translateY(-50%);
|
|
79
|
+
font-size: 0.75rem;
|
|
80
|
+
line-height: 1;
|
|
81
|
+
color: var(--graview-ink-muted);
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
}
|
|
84
|
+
fieldset:where([data-graview-part="group"]) {
|
|
85
|
+
display: grid;
|
|
86
|
+
gap: 10px;
|
|
87
|
+
border: 1px solid var(--graview-edge);
|
|
88
|
+
border-radius: 10px;
|
|
89
|
+
padding: 12px;
|
|
90
|
+
}
|
|
91
|
+
fieldset:where([data-graview-part="group"][data-graview-field="list"]) { gap: 8px; }
|
|
92
|
+
div:where([data-graview-part="item"]) {
|
|
93
|
+
display: flex;
|
|
94
|
+
gap: 8px;
|
|
95
|
+
align-items: end;
|
|
96
|
+
}
|
|
97
|
+
button:where([data-graview-part="add"]),
|
|
98
|
+
button:where([data-graview-part="submit"]) { justify-self: start; }
|
|
99
|
+
p:where([data-graview-part="refused"]) {
|
|
100
|
+
margin: 0;
|
|
101
|
+
color: var(--graview-warn);
|
|
102
|
+
font-size: 0.875rem;
|
|
103
|
+
}
|
|
104
|
+
`;function Oi({title:t,name:e,optional:n,amount:a,value:i,onChange:r}){let o=Ka(a),[l,d]=(0,ze.useState)(()=>typeof i=="number"?qa(i,a):""),c=l.trim()!==""&&cn(l,a)===void 0;return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"number","data-graview-amount":a.format??"unit",children:[(0,S.jsx)("span",{"data-graview-part":"label",children:t}),(0,S.jsxs)("span",{"data-graview-part":"amount",style:{display:"flex",alignItems:"center",gap:6},children:[o.prefix?(0,S.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:o.prefix}):null,(0,S.jsx)("input",{type:"text",inputMode:"decimal",name:e,required:!n,placeholder:o.placeholder,title:o.hint,"aria-invalid":c||void 0,value:l,onChange:p=>{d(p.target.value),r(cn(p.target.value,a))},"data-graview-part":"control",style:{flex:1,minWidth:0}}),o.suffix?(0,S.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:o.suffix}):null]}),c?(0,S.jsxs)("span",{"data-graview-part":"hint",role:"status",children:["Not an amount ",o.hint,": write it like ",o.prefix??"",o.placeholder,o.suffix?` ${o.suffix}`:""]}):null]})}function Zr({children:t}){return(0,S.jsxs)("span",{"data-graview-part":"picker",children:[t,(0,S.jsx)("span",{"aria-hidden":"true","data-graview-part":"chevron",children:"\u25BE"})]})}var Fi=t=>({label:we(t),option:e=>e}),Ii={phone:"+1 555 123 4567",place:"An address or a place's name",duration:"1h 30m, 90 or 1:30"};function Ht({store:t,spec:e,value:n,onChange:a,prefilled:i,open:r,words:o=Fi,values:l}){if(e.name in i&&e.control!=="group"&&e.control!=="variant")return null;let d=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(g=>we(He(t.schema.tryDefinition(g),g))).join(" or "):o(e.name).label,c=!(e.optional||e.control==="boolean"),p=c?(0,S.jsxs)(S.Fragment,{children:[d,(0,S.jsx)("span",{"aria-hidden":"true",children:" *"})]}):d;switch(e.control){case"text":case"date":return e.control==="text"&&e.long?(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"text",children:[(0,S.jsxs)("span",{"data-graview-part":"label",children:[p,e.markdown?(0,S.jsx)("span",{style:{fontWeight:"normal",color:"var(--graview-ink-faint)"},children:" \xB7 Markdown"}):null]}),(0,S.jsx)("textarea",{name:e.name,required:!e.optional,rows:6,value:typeof n=="string"?n:"",onChange:g=>a(g.target.value),"data-graview-part":"control",style:{fieldSizing:"content",minHeight:"7.5em",resize:"vertical",font:"inherit",lineHeight:1.5}})]}):e.control==="date"?(0,S.jsxs)("div",{"data-graview-part":"field","data-graview-field":"date",children:[(0,S.jsx)("span",{"data-graview-part":"label",children:p}),(0,S.jsx)(er,{name:e.name,label:o(e.name).label,required:!e.optional,value:typeof n=="string"&&n!==""?n:void 0,time:e.time===!0,instant:e.instant===!0,onChange:a})]}):(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control==="text"&&e.holds?e.holds:e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:p}),(0,S.jsx)("input",{type:e.control==="text"&&e.holds==="phone"?"tel":"text",name:e.name,required:!e.optional,...e.control==="text"&&e.app?{placeholder:"@owner/app or https://\u2026"}:{},...e.control==="text"&&e.holds?{placeholder:Ii[e.holds]}:{},...e.control==="text"&&e.holds==="phone"?{autoComplete:"tel"}:{},value:typeof n=="string"?n:typeof n=="number"?String(n):"",onChange:g=>a(g.target.value),"data-graview-part":"control"})]});case"number":return e.amount?(0,S.jsx)(Oi,{title:p,name:e.name,optional:e.optional,amount:e.amount,value:n,onChange:a}):(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:p}),(0,S.jsx)("input",{type:"number",name:e.name,required:!e.optional,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},value:typeof n=="number"?n:"",onChange:g=>a(g.target.value===""?void 0:Number(g.target.value)),"data-graview-part":"control"})]});case"boolean":return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"boolean",children:[(0,S.jsx)("input",{type:"checkbox",name:e.name,checked:n===!0,onChange:g=>a(g.target.checked),"data-graview-part":"control"}),(0,S.jsx)("span",{"data-graview-part":"label",children:p})]});case"choice":return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:p}),(0,S.jsx)(Zr,{children:(0,S.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:g=>a(g.target.value||void 0),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),(e.options??[]).map(g=>(0,S.jsx)("option",{value:g,children:o(e.name).option(g)},g))]})})]});case"node":{let g=r.find(v=>v.name===e.name)?.candidates,f=new Set(Object.values(i).filter(v=>typeof v=="string")),u=(e.kinds.includes("*")?[...t.graph.allNodes()]:e.kinds.flatMap(v=>t.graph.nodesOfKind(v))).filter(v=>!f.has(v.id)),k=g?g.map(v=>t.graph.getNode(v)).filter(v=>v!==void 0):u,q=Rt(k,v=>t.schema.tryDefinition(v));return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:p}),(0,S.jsx)(Zr,{children:(0,S.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:v=>a(v.target.value||void 0),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),k.map(v=>{let C=q.get(v.id);return(0,S.jsxs)("option",{value:v.id,children:[ge(t.schema.tryDefinition(v.kind),v),C?` \xB7 ${C}`:""]},v.id)})]})})]})}case"group":{let g=n??{};return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:p}),e.fields.map(f=>(0,S.jsx)(Ht,{store:t,spec:f,value:g[f.name],onChange:u=>a({...g,[f.name]:u}),prefilled:i,open:r,words:o},f.name))]})}case"variant":{let g=n??{},f=typeof g[e.tag]=="string"?g[e.tag]:"",u=e.options.find(k=>k.value===f);return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:p}),(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"choice",children:[(0,S.jsx)("span",{"data-graview-part":"label",children:we(e.tag)}),(0,S.jsxs)("select",{value:f,onChange:k=>a({[e.tag]:k.target.value}),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),e.options.map(k=>(0,S.jsx)("option",{value:k.value,children:we(k.value)},k.value))]})]}),u?.fields.map(k=>(0,S.jsx)(Ht,{store:t,spec:k,value:g[k.name],onChange:q=>a({...g,[k.name]:q}),prefilled:i,open:r,words:o},k.name))]})}case"file":case"list":{let g=e.control==="file"?e:e.item.control==="file"?e.item:void 0;if(g||e.control==="file")return(0,S.jsx)(Ve,{as:"control",title:c?`${d} *`:d,value:n,onChange:a,several:g!==e,image:g?.image===!0,label:d});let f=Array.isArray(n)?n:[];return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":"list",children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:p}),f.map((u,k)=>(0,S.jsxs)("div",{"data-graview-part":"item",children:[(0,S.jsx)("div",{style:{flex:1},children:(0,S.jsx)(Ht,{store:t,spec:{...e.item,optional:!1},value:u,onChange:q=>a(f.map((v,C)=>C===k?q:v)),prefilled:i,open:r,words:o})}),(0,S.jsx)("button",{type:"button","data-graview-part":"remove",onClick:()=>a(f.filter((q,v)=>v!==k)),children:"remove"})]},k)),(0,S.jsx)("button",{type:"button","data-graview-part":"add",onClick:()=>a([...f,void 0]),children:"add another"})]})}case"linked":return(0,S.jsx)("div",{"data-graview-part":"field","data-graview-field":"linked",children:(0,S.jsx)(Xa,{relation:e.relation,value:n,onChange:a,label:d})});case"repeat":return(0,S.jsx)(Ja,{value:n,onChange:a,start:e.of?l?.[e.of]:void 0,label:`${e.of?o(e.of).label:d} repeats`,name:e.name});case"opaque":return(0,S.jsxs)("p",{"data-graview-part":"unasked",children:["\u201C",we(e.name),"\u201D needs a structured answer this form cannot ask for yet."]})}}function $e({store:t,mutation:e,prefilled:n={},open:a=[],onDone:i,principal:r,initial:o,label:l,only:d}){let c=()=>rr(e,t.graph,n),[p,g]=(0,ze.useState)(c),[f,u]=(0,ze.useState)(()=>({...p,...o})),[k,q]=(0,ze.useState)(null),v=r??t.seenFor,C=e.subject&&n[e.subject.arg],G=v?or(t,v,e,typeof C=="string"?C:void 0):void 0,L=Lt(e.input).filter(D=>(d===void 0||d.includes(D.name))&&!G?.has(D.name)),U=D=>Ha(t.schema,e,D),X=Ga(L.filter(D=>D.control==="date").map(D=>D.name)),de=(0,ze.useRef)(void 0),ce=(D,J)=>u(b=>{let P={...b,[D.name]:J};if(X&&D.name===X.start&&D.control==="date"){let M=_=>typeof _=="string"&&_!==""?_:void 0,N=M(b[X.start])??de.current;if(M(J)){de.current=M(J);let _=Ba(N,M(J),M(b[X.end]),{time:D.time===!0,instant:D.instant===!0});_!==void 0&&(P[X.end]=_)}}return P});return(0,S.jsxs)("form",{"data-testid":`form-${e.name}`,onSubmit:D=>{D.preventDefault();try{t.apply({name:e.name,args:{...ir(ar(L,f),p),...n}},r?{author:r}:{}),q(null);let J=c();g(J),u({...J}),i?.()}catch(J){q(at(t.schema,t.allMutations(),J))}},"data-graview-part":"form",children:[(0,S.jsx)("style",{children:$i}),L.map(D=>(0,S.jsx)(Ht,{store:t,spec:D,value:f[D.name],values:f,onChange:J=>ce(D,J),prefilled:n,open:a,words:U},D.name)),k?(0,S.jsx)("p",{"data-testid":"refused","data-graview-part":"refused",role:"alert",children:k}):null,(0,S.jsx)("button",{type:"submit","data-graview-part":"submit",children:l??e.title??e.name})]})}var R=H(Y(),1);function Ae(t){let e=t.views;if(!e)return[];let n=new Set(Ke(t.store,t.principal));return e.places().filter(a=>n.has(a.kind))}function Kt(t,e){if(!e.over)return[e.kind];let n=new Set(Ke(t.store,t.principal));return e.over.filter(a=>a===e.kind||n.has(a))}var _e=t=>`place:${t.kind}:${t.as}`;function be(t,e){return Kr(e.as,ma(e,t.views?.places()??[])?Q(t.store.schema,e.kind):void 0)}function gt(t,e){let n=t.schema.tryDefinition(e);return t.graph.nodesOfKind(e).filter(a=>et(n,a))}function Cn(t,e,n){let a=(r,o)=>St(t.schema,o,r),i=(typeof e=="string"?[e]:e).map(r=>a(gt(t,r).length,r)).join(" and ");return n?`${i} across ${a(gt(t,n).length,n)}`:i}function Rn({context:t,place:e,chosen:n,filter:a}){let{store:i,views:r,invariantContext:o}=t,d=r?.resolve(e.kind,{cardinality:"many",fidelity:"full"},e.as)?.view,c=[...new Set(i.violations(o).flatMap(f=>f.nodeIds))],p=Kt(t,e).flatMap(f=>gt(i,f));if(!d)return null;let g=Di(i,p,a,c);return(0,R.jsx)(un,{kind:e.kind,view:e.title,children:(0,R.jsx)(d,{nodes:g,label:e.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...c.length>0?{flagged:c}:{}})})}function Di(t,e,n,a){let i=n?Pt({filter:n}).filter??[]:[];return i.length===0?e:Mt(e,{filter:i},{schema:t.schema,graph:t.graph,flagged:new Set(a)}).nodes}function Wi({store:t,views:e,as:n,invariantContext:a}){ae(t);let i={store:t,views:e,...a?{invariantContext:a}:{}},r=e.places().find(o=>o.as===n);return r?(0,R.jsx)(Rn,{context:i,place:r}):null}function Hi({context:t,kind:e}){let{store:n,views:a,invariantContext:i}=t,r=gt(n,e),o=n.schema.tryDefinition(e),l=ee(n,e),c=a?.resolve(e,{cardinality:"many",fidelity:"full"})?.view,p=[...new Set(n.violations(i).flatMap(k=>k.nodeIds))];if(c&&!nt(c))return(0,R.jsx)(un,{kind:e,children:(0,R.jsx)(c,{nodes:r,label:l,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...p.length>0?{flagged:p}:{}})});let g=a?.resolve(e,{cardinality:"one",fidelity:"summary"})?.view,f=8,u=r.slice(0,f);return(0,R.jsxs)("div",{"data-testid":"kind-sheet",style:g?{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:[u.map(k=>g?(0,R.jsx)(g,{node:k,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...p.includes(k.id)?{flagged:[k.id]}:{}},k.id):(0,R.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(o,k)},k.id)),r.length>f?(0,R.jsxs)("span",{style:{...A,alignSelf:"center",padding:"0 6px"},children:["+",r.length-f," more ",l.toLowerCase()]}):null]})}function Ln(t){let{store:e}=t,n=Gr(t),a=Ae(t),i=ln([...a].sort((o,l)=>n.indexOf(o.kind)-n.indexOf(l.kind))).filter(o=>!o.hidden),r=new Set(i.flatMap(o=>o.over??[o.kind]));return[...i.map(o=>({key:_e(o),kind:o.kind,title:fa(o,a,e.schema),to:be(t,o),place:o})),...Dt(t).filter(o=>!r.has(o)).map(o=>({key:`kind:${o}`,kind:o,title:ee(e,o),to:`/${Q(e.schema,o)}`}))]}var ei=.72,Ki=540,ti=16/10;function qi(t){let e=(0,De.useRef)(null),[n,a]=(0,De.useState)(t);return(0,De.useLayoutEffect)(()=>{let i=e.current;if(!i||typeof ResizeObserver>"u")return;let r=()=>{let l=i.getBoundingClientRect().width;l>0&&a(d=>Math.abs(d-l)<.5?d:l)};r();let o=new ResizeObserver(r);return o.observe(i),()=>o.disconnect()},[]),{ref:e,width:n}}function Bi(t){for(let e=t.parentElement;e;e=e.parentElement)if(/(auto|scroll)/.test(getComputedStyle(e).overflowY))return e;return null}function Gi(t){let[e,n]=(0,De.useState)(()=>typeof IntersectionObserver>"u");return(0,De.useLayoutEffect)(()=>{let a=t.current;if(e||!a)return;let i=new IntersectionObserver(r=>{r.some(o=>o.isIntersecting)&&(i.disconnect(),n(!0))},{root:Bi(a),rootMargin:"50% 0px"});return i.observe(a),()=>i.disconnect()},[e,t]),e}function Tn({context:t,entry:e}){let{store:n,brand:a,principal:i}=t,{ref:r,width:o}=qi(Ki),l=Gi(r),d=o/ei,c=gt(n,e.kind),p=n.schema.tryDefinition(e.kind),g=c.length===0?Ue(n,e.kind,{...i?{principal:i}:{},...t.invariantContext?{context:t.invariantContext}:{}}).actions.affordances[0]:void 0,f=e.place!==void 0;return(0,R.jsxs)(I,{to:e.to,"data-testid":f?"place-card":"kind-card",className:"graview-gallery-card",style:{...ve,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,R.jsxs)("span",{ref:r,"data-testid":f?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${ti}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,R.jsx)("span",{style:{position:"absolute",left:0,top:0,width:d,height:d/ti,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${ei})`,transformOrigin:"0 0"},children:l?(0,R.jsx)(Et.Provider,{value:null,children:e.place?(0,R.jsx)(Rn,{context:t,place:e.place}):(0,R.jsx)(Hi,{context:t,kind:e.kind})}):null}),c.length===0?(0,R.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,R.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,R.jsxs)("span",{style:{fontFamily:kn,fontWeight:"var(--graview-weight-display)"},children:["No ",ee(n,e.kind).toLowerCase()," yet"]}),g?(0,R.jsxs)("span",{style:A,children:["Begin with \u201C",g.label,"\u201D"]}):null]})}):null]}),(0,R.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,R.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[f?null:(0,R.jsx)(me,{kind:e.kind,brand:a,schema:n.schema,size:8}),(0,R.jsx)("span",{style:{fontFamily:kn,fontSize:"var(--graview-text-heading)",fontWeight:"var(--graview-weight-display)",lineHeight:1.3,overflowWrap:"anywhere",textWrap:"balance"},children:e.title})]}),(0,R.jsxs)("span",{style:A,children:[e.place?Cn(n,Kt(t,e.place),e.place.across):Cn(n,e.kind),!f&&p?.description?` \xB7 ${p.description}`:null]})]})]})}var ni={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},Vi=`
|
|
105
|
+
.graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
|
|
106
|
+
.graview-gallery-card:hover > span:first-child,
|
|
107
|
+
.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); }
|
|
108
|
+
`;function Mn({context:t}){ae(t.store);let e=Ln(t);return e.length===0?null:(0,R.jsxs)("section",{style:ni,"data-testid":"gallery",children:[(0,R.jsx)("style",{children:Vi}),e.map(n=>(0,R.jsx)(Tn,{context:t,entry:n},n.key))]})}function Nn({context:t}){let{store:e}=t;ae(e);let n=ln(Ae(t)).filter(i=>!i.hidden),a=Ln(t);return(0,R.jsxs)(ie,{context:t,style:rt,children:[(0,R.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,R.jsx)("p",{style:he,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,R.jsx)(le,{context:t,children:"Pictures"}),(0,R.jsx)("p",{style:se,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,R.jsx)("div",{style:ni,"data-testid":"places",children:a.map(i=>(0,R.jsx)(Tn,{context:t,entry:i},i.key))}):null]})}function En({context:t}){let{store:e,principal:n}=t;ae(e);let a=qe(),i=Ie(),[r]=it(),o=decodeURIComponent(a.as??""),[l,d]=(0,De.useState)(null),c=r.get("of"),p=r.get("filter"),f=Ae(t).find(L=>L.as===o&&(!c||Q(e.schema,L.kind)===c));if(!f)return(0,R.jsxs)(ie,{context:t,children:[(0,R.jsx)(le,{context:t,children:"No picture is called that."}),(0,R.jsx)("p",{style:se,children:(0,R.jsxs)(I,{to:"/places",style:B,children:["The pictures there are ",(0,R.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]})})]});let u=ee(e,f.kind),k=t.views?.resolve(f.kind,{cardinality:"many",fidelity:"full"},f.as)?.view,q=k?.flows===!0,v=k?.creates!==!1,C=Ue(e,f.kind,{...n?{principal:n}:{},...t.invariantContext?{context:t.invariantContext}:{}}),G=v?C.actions.affordances.map(L=>({affordance:L,mutation:e.allMutations().find(U=>U.name===L.mutation)})).filter(L=>L.mutation!==void 0):[];return(0,R.jsxs)(ie,{context:t,style:rt,children:[(0,R.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,R.jsx)(le,{context:t,children:f.title}),(0,R.jsxs)("p",{style:se,"data-testid":"place-lede",children:[Cn(e,Kt(t,f),f.across),"."]}),p&&!q?(0,R.jsxs)("p",{style:{...A,margin:0},"data-testid":"place-narrowed",children:[`Only those where ${p.split(",").map(L=>L.replace(":"," is ")).join(" and ")}. `,(0,R.jsx)(I,{to:`?${(()=>{let L=new URLSearchParams(r);return L.delete("filter"),L.toString()})()}`,style:{...B,...A},children:"Show all"})]}):null,(0,R.jsx)("p",{style:{...A,margin:0,display:"flex",flexWrap:"wrap",gap:"4px 16px"},children:Kt(t,f).map((L,U)=>(0,R.jsxs)(I,{to:`/${Q(e.schema,L)}`,style:{...B,...A},...U===0?{"data-testid":"place-as-list"}:{},children:["All ",(L===f.kind?u:ee(e,L)).toLowerCase()," as a list ",(0,R.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]},L))})]}),(0,R.jsx)("div",{"data-testid":"place-lens","data-flows":q?"":void 0,style:q?{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:L=>{let U=L.target?.closest("[data-graview-pick]"),X=U?.getAttribute("data-graview-pick"),de=U?.getAttribute("data-graview-joins");if(de)try{let D=JSON.parse(de);if(Array.isArray(D)&&D.every(J=>typeof J=="string")){L.preventDefault(),d({at:_e(f),ids:D});return}}catch{}if(!X)return;let ce=e.graph.getNode(X);ce&&(L.preventDefault(),i(te(e.schema,ce.kind,X)))},children:(0,R.jsx)(Rn,{context:t,place:f,filter:p,...l?.at===_e(f)?{chosen:l.ids}:{}})}),G.length>0?(0,R.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},"data-testid":"place-creators",children:G.map(({affordance:L,mutation:U})=>(0,R.jsxs)("section",{style:{...re,display:"grid",gap:14},children:[(0,R.jsx)("h2",{style:ne,children:U.title??U.name}),U.description?(0,R.jsx)("p",{style:{...A,margin:0,maxWidth:"58ch"},children:U.description}):null,(0,R.jsx)($e,{store:e,mutation:U,prefilled:L.args,open:L.open,label:L.label,...n?{principal:n}:{}})]},L.id))}):null]})}function ot(t){return t.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-|-$/g,"")}function mt(t,e={}){let[n="/",a=""]=t.split("#")[0].split("?"),i=new URLSearchParams(a);e.filter&&i.set("filter",e.filter);let r=i.toString(),o=e.section?ot(e.section):"";return`${n}${r?`?${r}`:""}${o?`#${o}`:""}`}function Ui(t,e=document){let n=ot(t);if(!n)return null;let a=[e,...[...e.querySelectorAll("[data-worker-view]")].flatMap(i=>i.shadowRoot?[i.shadowRoot]:[])];for(let i of a)for(let r of i.querySelectorAll("[id], [data-section]")){let o=r.getAttribute("data-section")??r.id;if(o===t||ot(o)===n)return r}for(let i of a)for(let r of i.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=heading]"))if(ot(r.textContent??"")===n)return r;return null}function ai(t,e={}){if(typeof document>"u"||typeof requestAnimationFrame>"u")return()=>{};let n=e.frames??120,a=0,i=()=>{let r=Ui(t,e.root??document);if(r){r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.scrollIntoView?.({block:"start"}),r.focus({preventScroll:!0});return}n-=1,n>0&&(a=requestAnimationFrame(i))};return a=requestAnimationFrame(()=>{a=requestAnimationFrame(i)}),()=>cancelAnimationFrame(a)}var z=H(Ee(),1);var qt=H(Ee(),1);var Ye=H(Y(),1);function ri({context:t}){return ye()?(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(ji,{context:t}),(0,Ye.jsx)($r,{face:"pages",on:t.quickAsk??!0})]}):null}function ji({context:t}){let{store:e}=t,n=ye(),{pathname:a}=ke(),i=(0,qt.useRef)(n?.setSelection);return i.current=n?.setSelection,(0,qt.useEffect)(()=>{let r=i.current;if(!r)return;let[,o,l]=a.split("/"),d=(()=>{if(o==="places"){let p=t.views?.places().find(g=>g.as===decodeURIComponent(l??""));return p?[Ne(p.kind)]:[]}let c=o?Re(e.schema,o):void 0;return c&&l?[decodeURIComponent(l)]:c?[va(c)]:[]})();r(c=>c.length===d.length&&c.every((p,g)=>p===d[g])?c:d)},[a]),null}var fe=H(Ee(),1);var oi=H(Ei(),1);var ue=H(Y(),1);var zi=(0,fe.lazy)(wa(()=>(__graviewPreload(import.meta.url,["./chunk.63GXY2ME.js","./chunk.UGFDSE37.js","./chunk.FSTCX2AI.js","./chunk.Y6ZNFQK3.js","./chunk.NRAYZY3X.js","./chunk.RIJUCHP4.js","./chunk.TAQ764IQ.js","./chunk.YIR7PPF3.js","./chunk.3HXN4BOY.js","./chunk.GYICGZMG.js","./chunk.UHUGOTUU.js","./chunk.47STJVRV.js","./chunk.EBGAYL32.js","./chunk.DAZ2VSRD.js","./chunk.J25KOSNW.js","./chunk.LR3VDXPI.js","./chunk.CWHRDBOF.js","./chunk.3K6YSVHC.js","./chunk.SHTJZ6UX.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.ULRW47RP.js","./chunk.PBSMLINK.js","./chunk.3TY5NFLY.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.GZHZLJBF.js","./chunk.XMC7YDWT.js","./chunk.6UGEYZAC.js","./chunk.OJGHDWI6.js","./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.QGTSHKJL.js")).then(t=>({default:t.TakeBack}))));function _i({context:t,docked:e,at:n}){let{store:a}=t,i=ae(a),[r]=(0,fe.useState)(()=>a.batches().length),o=(0,fe.useRef)(!1);return o.current||=i>0||!e&&r>0,o.current?(0,ue.jsx)(fe.Suspense,{fallback:null,children:(0,ue.jsx)(zi,{context:t,docked:e,at:n,since:r})}):null}function Yi(t,e,n){let{store:a,principal:i,embedded:r}=t;(0,fe.useEffect)(()=>{if(!n)return;let o=l=>{if(!Hr(l))return;let d=l.target,c=d instanceof Node&&e.current?.contains(d),p=d===document.body||d===document.documentElement||d===document;if(!(!c&&!(p&&!r))&&Dr(a,i)){l.preventDefault();try{Wr(a,i)}catch{}}};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[a,i,r,e,n])}function si({context:t,registry:e,root:n,children:a}){let i=(0,fe.useMemo)(Yr,[]),r=e?.without()??new Set;return Yi(t,n,!r.has("undo")),(0,ue.jsxs)(xn.Provider,{value:i,children:[(0,ue.jsx)(Qi,{context:t,placed:i,without:r}),a]})}function Qi({context:t,placed:e,without:n}){let[a,i]=(0,fe.useState)(!1);(0,fe.useLayoutEffect)(()=>i(!0),[]);let r=Pn(e,"find"),o=Pn(e,"undo"),l=ke(),d=pr();if(!a)return null;let c=l.pathname.split("/").filter(Boolean),g=(c.length===1?Re(t.store.schema,c[0]):void 0)!==void 0;return(0,ue.jsxs)(ue.Fragment,{children:[!r&&!n.has("find")&&d?(0,oi.createPortal)((0,ue.jsx)(ii,{context:t,narrowsLists:g}),d.slot):null,!r&&!n.has("find")&&!d?(0,ue.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,ue.jsx)(ii,{context:t,narrowsLists:g})}):null,!o&&!n.has("undo")?(0,ue.jsx)(_i,{context:t,docked:!0,at:l.pathname+l.search}):null,d?.own&&!n.has("undo")?(0,ue.jsx)(Vr,{context:t,own:d.own}):null]})}function ii({context:t,narrowsLists:e}){return(0,ue.jsx)(xn.Provider,{value:null,children:(0,ue.jsx)(An,{context:t,narrowsLists:e})})}var oe=H(Ee(),1);var Se=H(Y(),1),Xi=500,Ji=10;function $n(t){return t instanceof HTMLElement?t.isContentEditable||t.tagName==="TEXTAREA"||t.tagName==="SELECT"?!0:t.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(t.type):!1}function Zi(t){let e=typeof getSelection=="function"?getSelection():null;return e!==null&&!e.isCollapsed&&e.containsNode(t,!0)}function eo(t){let e=t.closest('a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])');if(e)return e;let n=document.activeElement;return n instanceof HTMLElement&&n!==document.body?n:null}function li({context:t,root:e,children:n}){return ye()===null?(0,Se.jsx)(Se.Fragment,{children:n}):(0,Se.jsx)(to,{context:t,root:e,children:n})}function to({context:t,root:e,children:n}){let{setMenuAt:a}=Aa(),{store:i}=t,r=i.schema,o=Ie(),{pathname:l,search:d}=ke(),c=Ur("/").replace(/\/$/,""),p=(0,oe.useCallback)((b,P)=>t.views?.places().find(M=>M.as===b&&(P===null||M.kind===P)),[t.views]),g=(0,oe.useCallback)((b,P)=>{let[M="",N,_]=b.split("/").filter(Boolean).map(j=>{try{return decodeURIComponent(j)}catch{return j}});if(_!==void 0)return null;if(M==="places"&&N!==void 0){let j=p(N,new URLSearchParams(P).get("of"));return j?{face:"pages",place:j.as,about:[Ne(j.kind)],title:j.title}:null}let E=Re(r,M);return E?N===void 0?{face:"pages",about:[Ne(E)],title:tt(r,E)}:i.graph.getNode(N)?{face:"pages",on:N,about:[N]}:null:null},[r,i,p]),f=(0,oe.useCallback)(b=>{let P=b.href;try{let M=new URL(P,location.href);if(M.origin===location.origin&&(c===""||M.pathname===c||M.pathname.startsWith(`${c}/`))){let N=g(M.pathname.slice(c.length),M.search);if(N)return{...N,href:P}}}catch{}return{face:"pages",about:[],href:P}},[c,g]),u=(0,oe.useCallback)(()=>g(l,d)??{face:"pages",about:[]},[g,l,d]),k=(0,oe.useCallback)(b=>{let P=u(),M=b.closest("[data-graview-field]")?.getAttribute("data-graview-field");if(M&&P.on!==void 0&&b.closest("[data-graview-pick], a[href]")===null)return{...P,field:M};let N=b.closest("[data-graview-act]")?.getAttribute("data-graview-act");if(N)return{...P,act:N};let _=b.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(_&&i.graph.getNode(_))return{face:"pages",on:_,about:[_],href:`${c}${te(r,i.graph.getNode(_).kind,_)}`};let E=b.closest("a[href]");if(E)return f(E);let j=b.closest("[data-graview-record]")?.getAttribute("data-graview-record");return j&&i.graph.getNode(j)?{face:"pages",on:j,about:[j]}:P},[u,f,i,r,c]),q=(0,oe.useCallback)((b,P,M)=>{let N=k(b);a({...N,x:Math.round(P),y:Math.round(M),returnTo:eo(b)})},[k,a]),v=(0,oe.useCallback)(b=>{let P=b.getBoundingClientRect();q(b,P.left+Math.min(16,P.width/2),Math.min(P.bottom,P.top+36))},[q]),C=(0,oe.useRef)(0),G=(0,oe.useRef)(null),L=(0,oe.useRef)(!1),U=()=>{G.current&&clearTimeout(G.current.timer),G.current=null};(0,oe.useEffect)(()=>U,[]),(0,oe.useEffect)(()=>{let b=P=>{if(P.defaultPrevented||!(P.key==="ContextMenu"||P.key==="F10"&&P.shiftKey))return;let M=e.current,N=P.target instanceof Element?P.target:null,_=N===null||N===document.body||N===document.documentElement,E=M!==null&&N!==null&&M.contains(N);if(!E&&!(_&&document.querySelector("[data-graview-face='pages']")===M)||$n(N)||N?.closest("[data-graview-popover]"))return;P.preventDefault(),C.current=Date.now();let j=E&&N instanceof HTMLElement?N:M?.querySelector("[data-graview-page-title], main h1, main")??null;j&&v(j)};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,v]);let X=(0,oe.useMemo)(()=>b=>{if(b.face!=="pages")return null;let P=[],M=b.on===void 0?void 0:i.graph.getNode(b.on),N=b.place===void 0?void 0:t.views?.places().find(T=>T.as===b.place),_=M?void 0:b.about.length===1&&b.about[0].startsWith("aggregate:")&&!N?no(b.about[0]):void 0,E=M?te(r,M.kind,M.id):N?be(t,N):_?`/${Q(r,_)}`:void 0,j=E!==void 0&&l===E.split("?")[0];E!==void 0&&!j&&P.push({id:"open",label:"Open",run:()=>o(E)});let Oe=E!==void 0?`${c}${E}`:b.href;Oe!==void 0&&P.push({id:"open-in-a-new-tab",label:"Open in a new tab",run:()=>void window.open(Oe,"_blank","noopener")});let m=M?`#focus=${encodeURIComponent(M.id)}`:N?`#focus=${encodeURIComponent(Ne(N.kind))}&view=${encodeURIComponent(N.as)}`:_?`#focus=${encodeURIComponent(Ne(_))}`:void 0;if(m!==void 0&&(t.overview||!t.embedded)){let T=t.overview;P.push({id:"in-the-scene",label:"Show in the scene",run:()=>T?T(m):location.assign(`${t.sceneHref??"/"}${m}`)})}return M===void 0&&b.href===void 0&&P.push({id:"find",label:"Find\u2026",run:()=>{let T=e.current?.querySelector('[data-testid="nav-find"]')??document.querySelector('[data-testid="nav-find"]');T&&T.offsetParent!==null?T.focus():o("/search")}}),P.length>0?{id:"pages",items:P}:null},[i,r,t,l,c,o,e]),de=(0,oe.useMemo)(()=>b=>{if(b.face!=="pages"||b.field===void 0||b.on===void 0)return null;let P=i.graph.getNode(b.on),M=b.element?.closest("[data-graview-field]")??e.current?.querySelector(`[data-graview-field="${CSS.escape(b.field)}"]`);return!P||!(M instanceof HTMLElement)||!M.hasAttribute("data-graview-editable")?null:{id:"field",at:"start",items:[{id:"change-field",label:`Change \u201C${ra(r.tryDefinition(P.kind),b.field)}\u201D`,run:()=>M.click()}]}},[i,r,e]),ce=Fr(),D=tr(),J=(0,oe.useMemo)(()=>[de,X,...D?[D]:[],...ce?[ce]:[]],[de,X,D,ce]);return(0,Se.jsxs)(Ya,{sections:J,children:[(0,Se.jsx)("div",{"data-graview-menu-ground":"",style:{display:"contents"},onContextMenu:b=>{let P=b.target;b.shiftKey||$n(P)||Zi(P)||(b.preventDefault(),!P.closest("[data-graview-popover]")&&(Date.now()-C.current<700||(b.clientX===0&&b.clientY===0&&P instanceof HTMLElement?v(P):q(P,b.clientX,b.clientY))))},onPointerDown:b=>{if(L.current=!1,b.pointerType==="mouse"||!b.isPrimary)return;let P=b.target;if($n(P)||P.closest("[data-graview-choose], [data-graview-popover]"))return;U();let{clientX:M,clientY:N}=b;G.current={x:M,y:N,timer:setTimeout(()=>{G.current=null,L.current=!0,C.current=Date.now(),q(P,M,N)},Xi)}},onPointerMove:b=>{let P=G.current;P&&Math.hypot(b.clientX-P.x,b.clientY-P.y)>Ji&&U()},onPointerUp:U,onPointerCancel:U,onClickCapture:b=>{L.current&&(L.current=!1,b.preventDefault(),b.stopPropagation())},children:n}),(0,Se.jsx)(ao,{openAt:v}),(0,Se.jsx)(Ir,{placement:"page"}),(0,Se.jsx)(nr,{})]})}function no(t){let e=t.slice(10).split("+");return e.length===1&&e[0]?e[0]:void 0}function ao({openAt:t}){return(0,Se.jsx)("span",{"data-graview-menu-home":"",tabIndex:-1,onFocus:e=>{if(e.target!==e.currentTarget)return;let n=e.currentTarget.closest("[data-graview-face]"),a=n?.querySelector("[data-graview-page-title]")??n?.querySelector("main h1, main")??null;a&&(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus({preventScroll:!0}))},style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:(0,Se.jsx)(Er,{placement:"menu",openActs:t})})}var K=H(Y(),1);function di(t,e){return e==="*"?{label:"anything",path:null}:{label:ee(t,e),path:`/${Q(t.schema,e)}`}}function ro({context:t,relation:e}){let{store:n}=t,a=di(n,e.from),i=di(n,e.to),r=o=>o.path?(0,K.jsx)(I,{to:o.path,style:{...ve,fontWeight:550},children:o.label}):(0,K.jsx)("span",{children:o.label});return(0,K.jsxs)("li",{"data-testid":"relation","data-relation":e.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,K.jsx)(Or,{edgeKind:e.edgeKind,...t.brand?.kit?{kit:t.brand.kit}:{}}),(0,K.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,K.jsxs)("span",{children:[r(a)," ",(0,K.jsxs)("span",{style:A,"data-graview-speaks-ids":"",children:[we(e.edgeKind)," \u2192"]})," ",r(i)]}),e.description||e.inverse?(0,K.jsxs)("span",{style:A,children:[e.description?xe(e.description):null,e.description&&e.inverse?" \xB7 ":null,e.inverse?`from the other end, ${e.inverse}`:null]}):null]}),i.path?(0,K.jsx)(I,{to:`${i.path}?with=${encodeURIComponent(e.edgeKind)}`,style:{...B,...A,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${i.label.toLowerCase()} that have this`,children:e.count}):(0,K.jsx)("span",{style:{...A,fontVariantNumeric:"tabular-nums"},children:e.count})]})}function ci({context:t,heading:e=!0}){let{store:n}=t,a=new Set(Ke(n,t.principal)),i=je(n).relations.filter(r=>a.has(r.from)&&(r.to==="*"||a.has(r.to)));return i.length===0?null:(0,K.jsxs)("section",{style:{...re,display:"grid",gap:12},"data-testid":"kind-map",children:[e?(0,K.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,K.jsx)("h2",{style:ne,children:(0,K.jsx)(I,{to:"/map",style:ve,children:"Connections"})}),(0,K.jsx)("span",{style:A,children:i.length===1?"1 relation":`${i.length} relations`})]}):null,(0,K.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:i.map(r=>(0,K.jsx)(ro,{context:t,relation:r},`${r.edgeKind}|${r.from}|${r.to}`))})]})}function On({context:t}){let{store:e}=t;ae(e);let n=new Set(Ke(e,t.principal)),a=je(e),i=a.relations.filter(r=>n.has(r.from));return(0,K.jsxs)(ie,{context:t,children:[(0,K.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,K.jsx)("p",{style:he,children:i.length===0?"No relations":`${i.length} ${i.length===1?"relation":"relations"}`}),(0,K.jsx)(le,{context:t,children:"Connections"}),(0,K.jsx)("p",{style:se,children:i.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,K.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:a.kinds.filter(r=>n.has(r.kind)).map(r=>(0,K.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,K.jsx)(me,{kind:r.kind,brand:t.brand,schema:e.schema,size:7}),(0,K.jsx)(I,{to:`/${Q(e.schema,r.kind)}`,style:B,children:r.plural}),(0,K.jsx)("span",{style:A,children:r.count})]},r.kind))}),(0,K.jsx)(ci,{context:t,heading:!1})]})}function pi({context:t}){let n=[...ye()?.robots.values()??[]].filter(i=>i.mode==="asking"&&i.say);if(n.length===0)return null;let{store:a}=t;return(0,K.jsxs)("section",{style:{...re,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,K.jsx)("h2",{style:ne,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,K.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(i=>{let r=i.at?a.graph.getNode(i.at):void 0;return(0,K.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,K.jsx)("span",{children:i.say}),r?(0,K.jsxs)(I,{to:te(a.schema,r.kind,r.id),style:{...B,...A},children:[ge(a.schema.tryDefinition(r.kind),r)," \u2192"]}):null]},i.participant)})})]})}var V=H(Y(),1);function Fn({context:t}){let{principal:e}=t,{store:n,brand:a,invariantContext:i}=t;ae(n);let r=n.violations(i),o=`${r.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=Dt(t).map(C=>({kind:C,members:n.graph.nodesOfKind(C).filter(G=>et(n.schema.tryDefinition(C),G))})),p=c.filter(C=>C.members.length>0),g=c.map(C=>({entry:C,creator:n.allMutations().find(G=>(G.creates??[]).includes(C.kind)&&n.permits({name:G.name,args:{}},t.principal).ok)})).find(C=>C.creator!==void 0),f=p.length===0?"Nothing here yet.":`${p.map(C=>St(n.schema,C.kind,C.members.length)).join(", ").replace(/, ([^,]*)$/," and $1")}.`,u=t.views?.homeView?.(),k=n.schema.kinds.some(C=>n.graph.nodesOfKind(C).length>0);if(u&&k){let C=a?.subtitle?(0,V.jsx)("p",{style:{...A,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,G=u[Symbol.for("graview.home-blocks")]===!0;return(0,V.jsx)(ie,{context:t,style:rt,children:(0,V.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[G?null:C,r.length>0?(0,V.jsx)(I,{to:"/problems",style:{...B,color:"var(--graview-warn)"},children:o}):null,(0,V.jsx)(Tr.Provider,{value:G?C:null,children:(0,V.jsx)(u,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})]})})}let q=new Set(Ke(n,t.principal)),v=je(n).relations.filter(C=>q.has(C.from)&&(C.to==="*"||q.has(C.to)));return(0,V.jsxs)(ie,{context:t,style:rt,children:[(0,V.jsxs)("header",{style:{display:"grid",gap:12},children:[a?.subtitle?(0,V.jsx)("p",{style:{...A,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,(0,V.jsx)(le,{context:t,"data-testid":"standing",children:f}),(0,V.jsxs)("p",{style:{...se,display:"grid",gap:4},"data-testid":"standing-card",children:[p.length===0&&g?(0,V.jsxs)("span",{children:["Begin with \u201C",g.creator?.title??g.creator?.name,"\u201D, under"," ",(0,V.jsx)(I,{to:`/${Q(n.schema,g.entry.kind)}`,style:B,children:ee(n,g.entry.kind)}),"."]}):null,r.length===0?(0,V.jsx)("span",{children:"All rules hold."}):(0,V.jsx)(I,{to:"/problems",style:{...B,color:"var(--graview-warn)"},children:o})]})]}),(0,V.jsx)(Mn,{context:t}),(0,V.jsxs)("section",{style:{...re,display:"grid",gap:14},"data-testid":"kinds",children:[(0,V.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,V.jsx)("h2",{style:ne,children:"What is here"}),v.length>0?(0,V.jsxs)(I,{to:"/map",style:{...B,...A,marginLeft:"auto"},"data-testid":"map-link",children:["Connections \xB7 ",v.length===1?"1 relation":`${v.length} relations`," ",(0,V.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]}):null]}),(0,V.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:c.map(({kind:C,members:G})=>(0,V.jsx)("li",{style:{maxWidth:"100%"},children:(0,V.jsxs)(I,{to:`/${Q(n.schema,C)}`,style:{...ve,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,V.jsx)(me,{kind:C,brand:a,schema:n.schema,size:7}),(0,V.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:ee(n,C)}),(0,V.jsx)("span",{style:{...A,fontVariantNumeric:"tabular-nums"},children:G.length===0?"none yet":ct(G.length)})]})},C))})]}),l.length>0?(0,V.jsxs)("section",{style:{...re,display:"grid",gap:10},children:[(0,V.jsx)("h2",{style:ne,children:"Recently"}),(0,V.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:l.map(C=>(0,V.jsxs)("li",{style:A,children:[(0,V.jsx)("span",{style:{color:"var(--graview-ink)"},children:C.intent})," \u2014 ",ut(C,e,{graph:n.graph,schema:n.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},C.id))})]}):null]})}var Te=H(Ee(),1);var $=H(Y(),1);function In({context:t}){let{store:e,brand:n,principal:a,invariantContext:i}=t;ae(e);let[r]=it(),o=r.get("q")??"",l=typeof i?.today=="string"?i.today:void 0,d=wr(e,o,{...a?{principal:a}:{},places:Ae(t),flagged:new Set(e.violations(i).flatMap(u=>u.nodeIds)),...l?{today:l}:{},limit:200}),c=d.hits.filter(u=>u.about==="node"),p=d.hits.filter(u=>u.about==="kind"||u.about==="place"||u.about==="rule"),g=[...new Set(c.map(u=>u.kind))],f=o.trim();return(0,$.jsxs)(ie,{context:t,children:[(0,$.jsx)("style",{children:Ft}),(0,$.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,$.jsx)("p",{style:he,children:"Search"}),(0,$.jsx)(le,{context:t,"data-testid":"search-heading",children:f.length===0?"Find anything by its name":d.hits.length===0?(0,$.jsxs)($.Fragment,{children:["Nothing here is called \u201C",f,"\u201D."]}):(0,$.jsxs)($.Fragment,{children:[io(e,d.byKind)," for \u201C",f,"\u201D"]})}),f.length>0?(0,$.jsxs)("p",{style:{...A,margin:0},"data-testid":"search-searched",children:[Tt(e.schema,d.searched),d.conditions.filter(u=>u.key!=="is"&&u.admittedBy.length<d.searched.kinds.length).map(u=>(0,$.jsxs)("span",{children:[" ",u.key,":",u.value," narrows"," ",u.admittedBy.length===0?"nothing here":u.admittedBy.map(k=>ee(e,k).toLowerCase()).join(" and "),"."]},`${u.key}:${u.value}`))]}):(0,$.jsxs)("p",{style:se,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,$.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,$.jsx)("code",{children:"is:any"})," includes what is past."]})]}),p.length>0?(0,$.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:p.map(u=>(0,$.jsx)("li",{"data-testid":"search-hit","data-about":u.about,children:u.about==="kind"?(0,$.jsxs)(I,{to:`/${Q(e.schema,u.kind)}`,style:B,children:[u.label,u.count>0?(0,$.jsxs)("span",{style:A,children:[" \xB7 ",u.count," match"]}):null]}):u.about==="place"?(0,$.jsxs)(I,{to:be(t,u),style:B,children:["Go to ",u.title]}):u.about==="rule"?(0,$.jsxs)(I,{to:"/problems",style:B,children:["The rule \u201C",u.label,"\u201D"]}):null},`${u.about}:${u.about==="rule"?u.name:u.about==="place"?u.as:u.kind}`))}):null,g.map(u=>(0,$.jsxs)("section",{className:"graview-list",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",minWidth:0},"data-testid":"search-group","data-kind":u,children:[(0,$.jsxs)("h2",{className:"graview-group-head",style:{alignItems:"center"},children:[(0,$.jsx)(me,{kind:u,brand:n,schema:e.schema,size:8}),(0,$.jsx)(I,{to:`/${Q(e.schema,u)}?${new URLSearchParams({q:f}).toString()}`,style:B,"data-testid":"search-kind-link",children:ee(e,u)}),(0,$.jsx)("span",{children:d.byKind[u]})]}),(0,$.jsx)("ul",{className:"graview-rows",children:c.filter(k=>k.kind===u).map(k=>(0,$.jsxs)("li",{"data-testid":"search-hit","data-about":"node",className:"graview-row",children:[(0,$.jsxs)(I,{to:te(e.schema,u,k.id),className:"graview-row-title",...k.label.length>60?{title:k.label}:{},children:[k.flagged?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,k.label]}),k.apart||!k.current?(0,$.jsx)("span",{className:"graview-row-glance",children:[k.apart,k.current?"":"past"].filter(Boolean).join(" \xB7 ")}):null,(0,$.jsx)(Bt,{why:k.why})]},k.id))})]},u)),f.length>0?(0,$.jsx)(oo,{asked:f}):null,f.length>0&&d.hits.length===0?(0,$.jsx)(gi,{store:e,kinds:d.searched.kinds,words:d.words,...a?{principal:a}:{},...i?{invariantContext:i}:{}}):null]})}function Bt({why:t}){return t.strength==="near"?(0,$.jsxs)("span",{style:A,"data-testid":"search-why","data-near":"",children:["Near \u201C",t.asked,"\u201D",t.field==="label"?"":` \u2014 ${t.reading}: ${t.fragment}`]}):t.field==="label"?null:(0,$.jsxs)("span",{style:A,"data-testid":"search-why",children:[t.reading,": ",t.fragment]})}function io(t,e){let n=Object.entries(e).map(([a,i])=>`${i} ${i===1?He(t.schema.tryDefinition(a),a):ee(t,a).toLowerCase()}`);return n.length===0?"Found":n.length===1?xe(n[0]):xe(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function ui(t,e,n={}){let a=[];for(let i of e){let r=Ue(t,i,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let o of Gt(t,i,r.actions.affordances))a.some(l=>l.mutation.name===o.mutation.name)||a.push(o)}return a}function Gt(t,e,n){let a=t.schema.tryDefinition(e)?.fieldRoles?.label,i=[];for(let r of n){let o=t.allMutations().find(c=>c.name===r.mutation);if(!o||!o.creates?.includes(e)||i.some(c=>c.mutation.name===o.name))continue;let l=Lt(o.input).map(c=>c.name),d=l.includes("label")?"label":a&&l.includes(a)?a:void 0;!d||r.args[d]!==void 0||i.push({kind:e,affordance:r,mutation:o,arg:d})}return i}function gi({store:t,kinds:e,words:n,principal:a,invariantContext:i}){let r=ui(t,e,{...a?{principal:a}:{},...i?{invariantContext:i}:{}});return r.length===0||n.trim().length===0?null:(0,$.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:r.map(({kind:o,affordance:l,mutation:d,arg:c})=>(0,$.jsxs)("section",{style:{...re,display:"grid",gap:14},children:[(0,$.jsxs)("h2",{style:ne,children:[xe(ia(He(t.schema.tryDefinition(o),o)))," called \u201C",n,"\u201D"]}),(0,$.jsx)($e,{store:t,mutation:d,prefilled:l.args,open:l.open,initial:{[c]:n},...a?{principal:a}:{}})]},`${l.id}|${n}`))})}function oo({asked:t}){let e=ye();return e?(0,$.jsx)(so,{asked:t,desk:e.aiDesk}):null}function so({asked:t,desk:e}){return Ea(e)?(0,$.jsx)("p",{style:{margin:0},children:(0,$.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:a=>Na(e,{pointed:{about:[]},asked:t,returnTo:a.currentTarget}),style:{...B,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",t,"\u2019"]})}):null}var w=H(Y(),1),fi=8,yi=40;function lo(t,e){let n=e?.fields?.shape??{},a=Object.keys(n).find(i=>sa(n[i])&&oa(t[i]));return a===void 0?void 0:t[a]}function Dn({context:t}){let e=qe(),n=Re(t.store.schema,e.slug??"");return n?(0,w.jsx)(hi,{context:t,kind:n}):(0,w.jsx)(ie,{context:t,children:(0,w.jsx)(le,{context:t,children:"No such kind of thing here."})})}function hi({context:t,kind:e,opening:n,row:a,layout:i="list",description:r,bare:o}){let{store:l,brand:d,invariantContext:c}=t;ae(l);let[p,g]=it(),f=`list-${(0,Te.useId)().replace(/:/g,"")}`,u=l.schema.tryDefinition(e),k=da(p.get("archived")),q=l.graph.nodesOfKind(e,{archived:k}),v=je(l).relations.filter(s=>s.from===e||s.to===e),C=new Set(l.violations(c).flatMap(s=>s.nodeIds)),G=fr(l.schema,mr(l.schema,gr(l.schema,e))),L=v.map(s=>s.edgeKind),U=fo(p,G,L),X=["sort","filter","group","q","by","with","past","archived",...L].some(s=>p.has(s)),de=q.length>=yi,ce=u?.fieldRoles?.when,D=t.views?.arrangement?.()?.lists?.[e],J=lr(D),b=sr(D?.group),P=mo(de,ce),M=n??(J?{...P,...J}:P),N=X?U.arrangement:yn(M,G).arrangement,_=J?.sort,E=N.sort&&_?.then&&N.sort.by===_.by&&N.sort.direction===_.direction?{...N,sort:_}:N,j=yr(E.query??""),Oe=[...E.filter??[],...j.conditions].some(s=>s.key==="is"&&(s.value==="past"||s.value==="any"))||ur(u,[...E.filter??[],...j.conditions]),m=Oe||!u?.lifecycle?E:{...E,filter:[...E.filter??[],{key:"is",value:"current"}]},T=new Map,Z=Mt(q,m,{schema:l.schema,graph:l.graph,flagged:C,...typeof c?.today=="string"?{today:c.today}:{},read:(s,h)=>{let O=T.get(s.id);return O||T.set(s.id,O=pt(l.schema,l.graph,s)),O[h]}}),F=b&&E.group?.by===b.by&&!E.group.bucket?G.groups.find(s=>s.key===b.by):void 0,qn=b&&F&&(F.type==="choice"||F.type==="boolean")?dr(Z.groups,b,{type:F.type,...F.options?{options:F.options}:{}}):Z.groups.map(s=>({...s,closed:!1})),Bn=new Set((p.get("open")??"").split(",").filter(Boolean)),bi=!!E.query||(E.filter??[]).some(s=>s.key===b?.by),Gn=s=>F?.type==="boolean"?s==="1"?"true":"false":s,Vn=s=>s.closed&&!bi&&!Bn.has(Gn(s.key)),Si=s=>{let h=new URLSearchParams(p),O=new Set(Bn);O.has(s)?O.delete(s):O.add(s),O.size>0?h.set("open",[...O].join(",")):h.delete("open"),g(h,{replace:!0})},Fe=Z.nodes,st=u?.lifecycle&&!Oe?q.filter(s=>et(u,s)):q,Un=q.length-st.length,jt=E.group?.by??null,xi=s=>{let h=new URLSearchParams(p);for(let pe of["sort","filter","group","q","by","with","past","archived",...v.map(kt=>kt.edgeKind)])h.delete(pe);let O=vr(s);for(let pe of["sort","filter","group","q","archived"])O[pe]&&h.set(pe,O[pe]);![...h.keys()].some(pe=>["sort","filter","group","q"].includes(pe))&&(n||J||de||ce)&&h.set("sort",""),g(h)},{principal:Xe}=t,zt=Ue(l,e,{...Xe?{principal:Xe}:{},...t.invariantContext?{context:t.invariantContext}:{}}),We=zt.actions.affordances.map(s=>({affordance:s,mutation:l.allMutations().find(h=>h.name===s.mutation)})).filter(s=>s.mutation!==void 0),jn=zt.actions.withheld,_t=()=>new Set(Fe.length===0?We.map(({mutation:s})=>s.name):[]),[Yt,zn]=(0,Te.useState)(()=>({kind:e,open:_t()}));Yt.kind!==e&&zn({kind:e,open:_t()});let _n=s=>(Yt.kind===e?Yt.open:_t()).has(s),Yn=(s,h)=>zn(O=>{let pe=new Set(O.open);return h?pe.add(s):pe.delete(s),{kind:O.kind,open:pe}}),Qn=`begin-${(0,Te.useId)().replace(/:/g,"")}`,Xn=j.words&&Fe.length===0?Object.fromEntries(Gt(l,e,zt.actions.affordances).map(s=>[s.mutation.name,s.arg])):{},Je=ee(l,e),yt=t.views?.lookup(e,{cardinality:"one",fidelity:"glyph"}),Qt=yt!==void 0&&!nt(yt)?yt:void 0,Xt=(E.group?.bucket??"day")==="day"?E.group?.by:void 0,Jt=(E.filter??[]).map(s=>s.key),Pi=Jt.filter(s=>Jt.indexOf(s)===Jt.lastIndexOf(s)&&/choice|boolean/.test(G.filters.find(h=>h.key===s)?.type??"")),Zt=s=>{let h={...u?.computed?pt(l.schema,l.graph,s):s};Xt&&!String(h[Xt]).includes("T")&&delete h[Xt];for(let O of Pi)delete h[O];return h},ht=s=>{let h=ge(u,s);if(a)return(0,w.jsxs)("li",{"data-testid":"record-row","data-graview-record":s.id,style:{minWidth:0},...rn(s.id),children:[an(s,h),a(s,{label:h,href:te(l.schema,e,s.id),flagged:C.has(s.id),glance:It(Zt(s),u,h)})]},s.id);if(Qt){let on=$t(yt,s,l.graph),Mi=Object.fromEntries(Object.entries(Zt(s)).filter(([Ni])=>!on?.fields.has(Ni))),na=on?It(Mi,u,on.title??h):"";return(0,w.jsxs)("li",{"data-testid":"record-row","data-graview-record":s.id,style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,paddingBlock:10,borderTop:"1px solid var(--graview-edge)"},...rn(s.id),children:[an(s,h),(0,w.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,w.jsx)(Qt,{node:s,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...C.has(s.id)?{flagged:[s.id]}:{}})}),na?(0,w.jsx)("span",{style:{...A,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:na}):null,(0,w.jsx)(wo,{to:te(l.schema,e,s.id),label:C.has(s.id)?`${h} \u2014 implicated in a problem`:h})]},s.id)}let O=It(Zt(s),u,h),pe=j.words?hr(u,s,j.words):void 0,kt=de?void 0:_a(s,u),bt=lo(s,u),ta=(0,w.jsxs)(I,{to:te(l.schema,e,s.id),className:"graview-row-title",...h.length>60?{title:h}:{},children:[C.has(s.id)?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,h]});return(0,w.jsxs)("li",{className:"graview-row","data-graview-record":s.id,...rn(s.id),children:[an(s,h),kt?(0,w.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:14,minWidth:0},children:[(0,w.jsx)(Ve,{as:"thumb",file:kt}),ta]}):ta,O||bt?(0,w.jsxs)("span",{className:"graview-row-glance",children:[O,O&&bt?" \xB7 ":null,bt?(0,w.jsx)(Nt,{address:bt}):null]}):null,pe?(0,w.jsx)(Bt,{why:pe}):null]},s.id)},en=Ae(t).filter(s=>s.kind===e),Jn=D?.filters,Ai=(E.filter??[]).some(s=>s.key!=="is"||s.value!=="any"),Ci=!!(E.sort||E.group||E.query||Ai),Ri=st.length>=fi||X&&Ci,Me=E.sort?G.sorts.find(s=>s.key===E.sort.by):void 0,tn=Me?.type==="date"||Me!==void 0&&Me.key===ce,Zn=de&&!Z.grouped&&Me&&(Me.about==="label"||Me.type==="text"||tn)?s=>{let h=Me.about==="label"?ge(u,s):s[Me.key];if(typeof h!="string"||h.length===0)return tn?"No date":"#";if(tn)return h.slice(0,4);let O=h.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(O)?O:"#"}:void 0,Ge=Zn?Fe.reduce((s,h)=>{let O=Zn(h);return s.at(-1)?.key===O?s.at(-1).nodes.push(h):s.push({key:O,nodes:[h]}),s},[]):void 0,ea=Z.grouped&&jt?qn.flatMap(s=>Vn(s)?[]:s.nodes):Ge&&Ge.length>1?Ge.flatMap(s=>s.nodes):Fe,nn=(0,Te.useMemo)(()=>ea.map(s=>s.id),[ea.map(s=>s.id).join(`
|
|
109
|
+
`)]),Ce=xr(nn),lt=(Xe?l.permittedMutations(Xe):l.permittedMutations()).some(s=>{let h=s.subject?.kinds;return h!==void 0&&(h==="*"||h.includes(e))}),an=(s,h)=>lt?(0,w.jsx)("span",{className:"graview-choose-at",children:(0,w.jsx)("input",{...Ce.boxProps(s.id,h),onPointerEnter:wn,onFocus:wn})}):null,rn=s=>lt?{"data-graview-choose":s}:{},Li=(0,Te.useCallback)(s=>{Ce.choose(s),requestAnimationFrame(()=>{let h=Ce.list.current;((s[0]===void 0?null:h?.querySelector(`[data-graview-choose-box="${CSS.escape(s[0])}"]`))??h)?.focus({preventScroll:!0})})},[Ce]),Ze=i==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",alignItems:"start",gap:12}:a||Qt?{margin:0,padding:0,listStyle:"none",display:"grid",gap:a&&i==="list"?6:0}:void 0,wt=Ze?void 0:"graview-rows",dt=s=>`list-at-${s.replace(/[^\p{L}\p{N}]/gu,"_")}`,vt=v.map(s=>{let h=s.from===e?s.to:s.from,O=s.from===e?s.description:s.inverse??s.description;return{relation:s,far:h,words:O}}),Ti=new Set(vt.map(s=>(s.words??"").toLowerCase()).filter((s,h,O)=>s&&O.indexOf(s)!==h));return(0,w.jsxs)(o?go:ie,{context:t,children:[(0,w.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,w.jsxs)("header",{style:{display:"grid",gap:4},children:[(0,w.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",columnGap:10,rowGap:4,minWidth:0},children:[(0,w.jsx)(me,{kind:e,brand:d,schema:l.schema,size:8}),(0,w.jsx)(le,{context:t,children:Je}),We.length>0?(0,w.jsx)("span",{style:{marginLeft:"auto",display:"flex",flexWrap:"wrap",columnGap:14},"data-testid":"beginnings-open",children:We.map(({affordance:s,mutation:h})=>(0,w.jsx)(yo,{name:h.name,title:h.title??h.name,panel:`${Qn}-${h.name}`,open:_n(h.name),onOpen:O=>Yn(h.name,O)},s.id))}):null]}),r??u?.description?(0,w.jsx)("p",{style:se,children:r??u?.description}):null,vt.length>0||en.length>0?(0,w.jsxs)("p",{style:{...A,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[vt.length>0?(0,w.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",vt.map(({relation:s,far:h,words:O},pe)=>(0,w.jsxs)("span",{"data-relation":s.edgeKind,children:[pe>0?(0,w.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,h==="*"?xe(O??we(s.edgeKind)):(0,w.jsx)(I,{to:`/${Q(l.schema,h)}`,style:B,title:ee(l,h),children:O&&Ti.has(O.toLowerCase())?`${xe(O)}: ${ee(l,h).toLowerCase()}`:xe(O??ee(l,h))})]},`${s.edgeKind}|${s.from}|${s.to}`))]}):null,en.length>0?(0,w.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",en.map((s,h)=>(0,w.jsxs)("span",{children:[h>0?(0,w.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,w.jsx)(I,{to:be(t,s),style:B,children:s.title})]},_e(s)))]}):null]}):null]}),We.length>0?(0,w.jsx)("div",{style:{display:"contents"},"data-testid":"beginnings",children:We.map(({affordance:s,mutation:h})=>{let O=!!(Xn[h.name]&&Fe.length===0);return(0,w.jsx)(ho,{name:h.name,id:`${Qn}-${h.name}`,description:h.description,open:_n(h.name),onClose:()=>Yn(h.name,!1),children:(0,w.jsx)($e,{store:l,mutation:h,prefilled:s.args,open:s.open,...O?{initial:{[Xn[h.name]]:j.words}}:{},...t.principal?{principal:t.principal}:{}},O?`${h.name}|${j.words}`:h.name)},s.id)})}):null,U.dropped.length>0?(0,w.jsxs)("p",{style:{...A,margin:0},"data-testid":"list-dropped",children:["This link asked for ",U.dropped.join(", "),", which ",Je.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,st.length>0?(0,w.jsx)(Sr,{schema:l.schema,graph:l.graph,kind:e,arrangement:E,onChange:xi,kept:{shown:Fe.length,of:st.length},noun:{one:He(u,e),many:Je.toLowerCase()},...Ri?{}:{allow:!1},...Jn?{filters:Jn}:{},offers:G,chips:{nodes:st,flagged:C,...typeof c?.today=="string"?{today:c.today}:{}},query:t.framed===!0&&t.barAbove!==!0}):null,(0,w.jsx)("style",{children:Ft}),lt?(0,w.jsx)("style",{children:Pr+uo}):null,(0,w.jsx)("div",{className:"graview-list",...lt?{...Ce.listProps,ref:Ce.list,tabIndex:-1,"data-graview-choosable":"","aria-label":Ce.chosen.length>0?`${Je}, ${Ce.chosen.length} chosen`:Je,role:"group"}:{},children:Fe.length===0&&j.words?(0,w.jsxs)("p",{style:se,"data-testid":"none-yet",children:["Nothing here is called \u201C",j.words,"\u201D."," ",(0,w.jsx)("span",{style:A,"data-testid":"list-searched",children:Tt(l.schema,{kinds:[e],past:Oe})})," ",(0,w.jsx)(I,{to:"?",style:B,children:"Show every one"})]}):Fe.length===0?(0,w.jsxs)("p",{style:se,"data-testid":"none-yet",children:[E.filter?.length||E.query?"None of them.":"None yet",!E.filter?.length&&!E.query&&We.length>0?` \u2014 the first one starts above, with \u201C${We[0]?.mutation.title??We[0]?.mutation.name}\u201D.`:!E.filter?.length&&!E.query?".":"",E.filter?.length||E.query?(0,w.jsxs)(w.Fragment,{children:[" ",(0,w.jsx)(I,{to:"?",style:B,children:"Show every one"})]}):null]}):Z.grouped&&jt?(0,w.jsx)("div",{style:{display:"grid",gap:"1rem"},"data-testid":"records","data-grouped":jt,children:qn.map(s=>{if(!s.closed)return(0,w.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,w.jsxs)("h2",{className:"graview-group-head",children:[s.label," ",(0,w.jsx)("span",{children:s.nodes.length})]}),(0,w.jsx)("ul",{style:Ze,className:wt,"data-graview-rows":"",children:s.nodes.map(ht)})]},s.key||"-");let h=Vn(s),O=`${f}-${dt(s.key||"none")}`;return(0,w.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group","data-closed":h?"shut":"open",children:[(0,w.jsx)("h2",{className:"graview-group-head",children:(0,w.jsxs)("button",{type:"button",className:"graview-group-toggle","aria-expanded":!h,"aria-controls":O,"data-testid":"list-group-toggle",onClick:()=>Si(Gn(s.key)),children:[(0,w.jsx)("span",{"aria-hidden":"true",children:h?"\u25B8":"\u25BE"}),s.label," ",(0,w.jsxs)("span",{children:["\xB7 ",s.nodes.length]}),(0,w.jsxs)("span",{style:co,children:[" ",s.nodes.length===1?He(u,e):Je.toLowerCase()]})]})}),(0,w.jsx)("ul",{id:O,style:h?{...Ze,display:"none"}:Ze,className:wt,"data-graview-rows":"",hidden:h,children:h?null:s.nodes.map(ht)})]},s.key||"-")})}):Ge&&Ge.length>1?(0,w.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":Me?.type==="date"?"year":"letter",children:[(0,w.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...A,display:"flex",flexWrap:"wrap",gap:Me?.type==="date"?"0 10px":"0 4px",lineHeight:1.3},children:Ge.map(s=>(0,w.jsx)("a",{href:`#${dt(s.key)}`,onClick:h=>{h.preventDefault(),document.getElementById(dt(s.key))?.scrollIntoView({block:"start"})},style:{...ve,minWidth:24,justifyContent:"center"},children:s.key},s.key))}),Ge.map(s=>(0,w.jsxs)("section",{"data-testid":"list-section","aria-labelledby":dt(s.key),style:{display:"grid",gap:0},children:[(0,w.jsx)("h2",{id:dt(s.key),className:"graview-group-head",children:s.key}),(0,w.jsx)("ul",{style:Ze,className:wt,"data-graview-rows":"",children:s.nodes.map(ht)})]},s.key))]}):(0,w.jsx)("ul",{style:Ze,className:wt,"data-testid":"records","data-graview-rows":"",children:Fe.map(ht)})}),lt?(0,w.jsx)(Ar,{store:l,chosen:Ce.chosen,...Xe?{principal:Xe}:{},...c?{context:c}:{},anchor:po,of:nn.length,onChooseAll:()=>Ce.choose(nn),onClear:Ce.clear,onActed:Li}):null,Un>0?(0,w.jsxs)(I,{to:mi(p,"filter","is:any"),style:{...B,...A,justifySelf:"start"},"data-testid":"past-link",children:["+",Un," past"]}):null,k===!1&&l.graph.count(e,{archived:!0})>0?(0,w.jsxs)(I,{to:mi(p,"archived","true"),style:{...B,...A,justifySelf:"start"},"data-testid":"archived-link",children:["+",l.graph.count(e,{archived:!0})," archived"]}):null]}),jn.length>0?(0,w.jsx)("ul",{style:{...re,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},"data-testid":"withheld",children:jn.map(s=>(0,w.jsxs)("li",{style:A,children:[(0,w.jsx)("s",{children:s.label})," \u2014 ",s.refusal.message]},s.id))}):null]})}var co={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},po=()=>document.querySelector("[data-graview-choosable]")?.closest("[data-embed-content]")??null,uo=`
|
|
110
|
+
.graview-list[data-graview-choosable]{outline:none}
|
|
111
|
+
.graview-list [data-graview-choose]{position:relative;padding-left:34px}
|
|
112
|
+
.graview-choose-at{position:absolute;left:2px;top:0;bottom:0;z-index:${ga.raised};display:flex;align-items:center}
|
|
113
|
+
@media (pointer: coarse){
|
|
114
|
+
.graview-list:not([data-graview-choosing]) [data-graview-choose]{padding-left:0}
|
|
115
|
+
.graview-list:not([data-graview-choosing]) .graview-choose-at{display:none}
|
|
116
|
+
}
|
|
117
|
+
`;function go({children:t}){return(0,w.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:t})}var mo=(t,e)=>e?{sort:{by:e,direction:"desc"}}:t?{sort:{by:"label",direction:"asc"}}:{};function fo(t,e,n){let a=Pt({...t.get("sort")?{sort:t.get("sort")}:{},...t.get("filter")?{filter:t.get("filter")}:{},...t.get("group")?{group:t.get("group")}:{},...t.get("q")?{q:t.get("q")}:{},...t.get("archived")?{archived:t.get("archived")}:{}}),i=[...a.filter??[]],r=t.get("by"),o=a.group??(r?{by:r}:void 0);for(let d of n){let c=t.get(d);c&&i.push({key:d,value:c})}let l=t.get("with");return l&&i.push({key:l,value:"*"}),t.get("past")==="1"&&!i.some(d=>d.key==="is")&&i.push({key:"is",value:"any"}),yn({...a.sort?{sort:a.sort}:{},...a.query?{query:a.query}:{},...i.length>0?{filter:i}:{},...o?{group:o}:{},...a.archived!==void 0?{archived:a.archived}:{}},e)}function mi(t,e,n){let a=new URLSearchParams(t);return a.set(e,n),a.delete("past"),`?${a.toString()}`}function yo({name:t,title:e,panel:n,open:a,onOpen:i}){return(0,w.jsxs)("button",{type:"button","data-testid":`act-open-${t}`,"data-graview-act":t,"aria-expanded":a,"aria-controls":n,onClick:()=>{i(!a),a||requestAnimationFrame(()=>document.getElementById(n)?.querySelector("input, select, textarea, button")?.focus())},style:{...ve,minHeight:28,margin:"-4px 0",padding:"0 2px",border:0,background:"none",font:"inherit",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,w.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),e]})}function ho({name:t,id:e,description:n,open:a,onClose:i,children:r}){return(0,w.jsxs)("div",{"data-testid":`act-${t}`,id:e,hidden:!a,onKeyDown:o=>{o.key==="Escape"&&(o.preventDefault(),i(),document.querySelector(`[aria-controls="${e}"]`)?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,w.jsx)("p",{style:{...A,margin:0,maxWidth:"58ch"},children:n}):null,r]})}function wo({to:t,label:e}){let n=(0,Te.useRef)(null);return Cr(n),(0,w.jsx)(I,{ref:n,to:t,"aria-label":e,style:{position:"absolute",inset:0,borderRadius:6}})}var Qe=H(Ee(),1);var ft=H(Ee(),1);var W=H(Y(),1);function Wn({context:t}){let{store:e,brand:n,invariantContext:a,principal:i}=t;ae(e);let r=e.violations(a),o=e.allInvariants(),l=At(e,r),d=$a(e.schema,o);return(0,W.jsxs)(ie,{context:t,children:[(0,W.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,W.jsx)(le,{context:t,children:r.length===0?"All rules hold":"What is broken"}),(0,W.jsx)("p",{style:se,"data-testid":"problems-count",children:r.length===0?"Every declared rule is satisfied by what is here.":ca(r)})]}),(0,W.jsx)(pi,{context:t}),l.map((c,p)=>{let g=c.nodeIds[0],f=g?e.graph.getNode(g):void 0;return(0,W.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,W.jsx)(Vt,{violation:c,schema:e.schema,...n?{brand:n}:{}}),f?(0,W.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,W.jsx)(me,{kind:f.kind,brand:n,schema:e.schema,size:7}),(0,W.jsx)(I,{to:te(e.schema,f.kind,f.id),style:B,children:ge(e.schema.tryDefinition(f.kind),f)})]}):null,c.line?(0,W.jsx)(Vt,{violation:c,schema:e.schema,...n?{brand:n}:{}}):null,(0,W.jsx)(Ut,{store:e,repairs:c.repairs,...i?{principal:i}:{}})]},p)}),o.length>0?(0,W.jsxs)("section",{style:{...re,display:"grid",gap:12},"data-testid":"rules",children:[(0,W.jsx)("h2",{style:ne,children:"The rules"}),(0,W.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:o.map(c=>{let p=r.filter(u=>u.invariant===c.name).length,g=d.get(c.name),f=c.label??c.name;return(0,W.jsxs)("li",{"data-graview-rule":c.name,style:{display:"grid",gap:2},children:[(0,W.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[g?(0,W.jsx)(Ct,{line:g,schema:e.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,W.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:f}),(0,W.jsx)("span",{style:{...A,color:p>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:p===0?"holds":`broken in ${p} ${p===1?"place":"places"}`})]}),g&&f.trim().length>0?(0,W.jsx)("span",{style:A,children:f}):null]},c.name)})})]}):null]})}function Vt({violation:t,schema:e,brand:n}){if(!t.line)return(0,W.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:t.message});let a=Fa(t),i=Oa(t);return i?(0,W.jsxs)("div",{style:{display:"grid",gap:4},"data-testid":"problem-line",children:[(0,W.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},"data-testid":"problem-says",children:i}),a?(0,W.jsx)("span",{style:A,children:a}):null,(0,W.jsxs)("details",{"data-testid":"problem-judged",style:A,children:[(0,W.jsx)("summary",{style:{cursor:"pointer",width:"fit-content",minHeight:24},children:"How it is judged"}),(0,W.jsx)(Ct,{line:t.line,schema:e,...n?{brand:n}:{},lead:"none"})]})]}):(0,W.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",children:[(0,W.jsx)(Ct,{line:t.line,schema:e,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)"}}),a?(0,W.jsx)("span",{style:A,children:a}):null]})}function Ut({store:t,repairs:e,principal:n}){let[a,i]=(0,ft.useState)(null),[r,o]=(0,ft.useState)(null),l=(0,ft.useRef)([]);if(e.length===0)return null;let d=a===null?null:e[a],c=d&&(d.missing??[]).length>0?t.allMutations().find(p=>p.name===d.mutation):void 0;return(0,W.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,W.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:e.map((p,g)=>{let f=(p.missing??[]).length>0,u=t.permits({name:p.mutation,args:{...p.args}},n);return u.ok?(0,W.jsx)("button",{ref:k=>{l.current[g]=k},type:"button","data-graview-repair":p.mutation,"data-graview-asks":f||void 0,"aria-expanded":f?a===g:void 0,onClick:()=>{if(o(null),f){i(a===g?null:g);return}i(null);try{t.apply({name:p.mutation,args:{...p.args}},n?{author:n}:{})}catch(k){o(at(t.schema,t.allMutations(),k))}},style:Le,children:f?`${p.label} \u2026`:p.label},g):(0,W.jsxs)("p",{"data-testid":"withheld","data-withheld":u.refusal.wouldNeed.join(",")||"nobody",style:{...A,margin:0},children:[(0,W.jsx)("s",{children:p.label})," \u2014 ",u.refusal.message]},g)})}),c&&d?(0,W.jsx)($e,{store:t,mutation:c,prefilled:{...d.args},only:d.missing??[],label:d.label,onDone:()=>{let p=a;i(null),requestAnimationFrame(()=>{let g=p===null?null:l.current[p];if(g?.isConnected){g.focus();return}let f=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");f&&(f.hasAttribute("tabindex")||(f.tabIndex=-1),f.focus())})},...n?{principal:n}:{}}):null,d&&!c&&(d.missing??[]).length>0?(0,W.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:vn},children:["\u201C",d.label,"\u201D names ",d.mutation,", which this app does not declare."]}):null,r?(0,W.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:vn},children:r}):null]})}var Hn=H(Ee(),1);var Be=H(Y(),1);function wi({store:t,link:e,principal:n}){let[a,i]=(0,Hn.useState)(!1),[r,o]=(0,Hn.useState)(null),l=Va(e);return(0,Be.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,Be.jsx)("button",{type:"button","data-graview-provisional":"",title:l,"aria-label":`Unsure link: ${l}`,"aria-expanded":a,onClick:()=>i(!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,Be.jsxs)("span",{style:{...A,display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,Be.jsx)("span",{children:l}),(0,Be.jsx)("button",{type:"button",style:{...Le,padding:"4px 10px"},onClick:()=>{try{t.apply({name:pa,args:{kind:e.edge.kind,from:e.edge.from,to:e.edge.to}},n?{author:n}:{}),i(!1)}catch(d){o(at(t.schema,t.allMutations(),d))}},children:"Keep this link"}),r?(0,Be.jsx)("span",{role:"alert",children:r}):null]}):null]})}var y=H(Y(),1),vo=[];function Kn({context:t}){let{store:e,brand:n,principal:a,invariantContext:i}=t;ae(e);let r=ye()!==null,o=qe(),l=decodeURIComponent(o.id??""),d=Xr(e,l,{...a?{principal:a}:{},...i?{context:i}:{}}),c=At(e,d?.violations??vo),[p,g]=(0,Qe.useState)(null),[f,u]=(0,Qe.useState)(!1),[k,q]=(0,Qe.useState)(null),v=(0,Qe.useRef)(null),C=(0,Qe.useRef)(null),G=m=>{(v.current?.parentElement?.querySelector(`[data-affordance="${m.replace(/["\\]/g,"\\$&")}"]`)??v.current)?.focus()};if(!d)return(0,y.jsx)(ie,{context:t,children:(0,y.jsx)(le,{context:t,children:"Nothing lives at this address."})});let L=e.graph.getNode(l),U=e.schema.tryDefinition(d.kind),X=U?.describe&&L?Ia(U,L):null,de=[...e.log.all()].filter(m=>!xt(m)&&(m.writes.includes(l)||m.reads.includes(l))).slice(-8).reverse(),ce=e.log.all().find(m=>!xt(m)&&m.undoes===void 0&&m.primitives.some(T=>T.op==="add-node"&&T.node.id===l)),D=d.actions.affordances.filter(m=>m.provider!=="invariant"),J=D.filter(m=>m.destructive||m.setsAside),b=f||J.length<2?D:D.filter(m=>!J.includes(m)),P=t.views?.lookup(d.kind,{cardinality:"one",fidelity:"full"}),M=P!==void 0&&!nt(P)?P:void 0,N=M&&L?$t(P,L,e.graph):void 0,_=N?d.fields.filter(m=>!N.fields.has(m.key)):d.fields,E=N?d.links.flatMap(m=>{let T=m.targets.filter(Z=>!N.records.has(Z.id));return T.length>0?[{...m,targets:T}]:[]}):d.links,j=M!==void 0&&Ta(P),Oe=r&&za(U).length>0;return(0,y.jsxs)(ie,{context:t,children:[(0,y.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,y.jsxs)("p",{style:{...he,display:"flex",alignItems:"center",gap:8},children:[(0,y.jsx)(me,{kind:d.kind,brand:n,schema:e.schema,size:8}),(0,y.jsx)(I,{to:`/${Q(e.schema,d.kind)}`,style:ve,children:ee(e,d.kind)})]}),(0,y.jsx)(le,{context:t,children:r&&L?.label===d.label?(0,y.jsx)(hn,{nodeId:l,field:"label",value:d.label,said:d.label}):d.label}),X&&X!==d.label?(0,y.jsx)("p",{style:se,children:X}):null,ce?.lineage?(0,y.jsxs)("p",{style:{...A,margin:0},"data-testid":"record-lineage",children:["Made by ",ut(ce,a,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),", ",pn(ce.lineage)]}):null,(0,y.jsx)(Ot,{context:t,stop:`#focus=${encodeURIComponent(l)}`,style:{...B,...A},"data-testid":"spatial-link"}),r&&L?(0,y.jsx)(gn,{choices:[{on:"changed",record:l},{on:"act",record:l},{on:"reaches",kind:d.kind,condition:"",record:l}],label:"Notify me when this changes",testId:"record-notify",style:{...Le,...A,justifySelf:"start"}}):null,Ae(t).some(m=>m.kind===d.kind||m.across===d.kind)?(0,y.jsxs)("p",{style:{...A,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",Ae(t).filter(m=>m.kind===d.kind||m.across===d.kind).map((m,T)=>(0,y.jsxs)("span",{children:[T>0?(0,y.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,y.jsx)(I,{to:be(t,m),style:B,children:m.title})," ",(0,y.jsx)(Ot,{context:t,stop:`#view=${encodeURIComponent(m.as)}`,style:{...B,...A,display:"inline-block",minWidth:24,textAlign:"center"},title:`${m.title}, in the scene`,label:`${m.title}, in the scene`,children:(0,y.jsx)("span",{"aria-hidden":"true",children:"\u2197"})})]},_e(m)))]}):null]}),L&&la(L)?(0,y.jsx)(bo,{context:t,id:l,kind:d.kind}):null,L&&ua(e,l)?(0,y.jsx)(ko,{context:t,id:l,kind:d.kind}):null,M&&L?(0,y.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,y.jsx)(Rr,{children:(0,y.jsx)(M,{node:L,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...d.violations.length>0?{flagged:[l]}:{}})})}):null,d.violations.length>0?(0,y.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((m,T)=>(0,y.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,y.jsx)(Vt,{violation:m,schema:e.schema,...n?{brand:n}:{}}),(0,y.jsx)(Ut,{store:e,repairs:Jr(d.actions,m.repairs),...a?{principal:a}:{}})]},T))}):null,!j&&(_.length>0||Oe)?(0,y.jsxs)("section",{style:{...re,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,y.jsx)("h2",{style:ne,children:"The facts"}),Wa(U,_).map((m,T)=>{let Z=(0,y.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:m.fields.map(F=>F.files?(0,y.jsx)(Ve,{as:"field",read:!r,nodeId:l,field:F.key,label:F.label,files:F.files,labelStyle:he,style:{gap:4}},F.key):F.long?(0,y.jsx)(br,{nodeId:l,field:F.key,label:F.label,value:F.value,markdown:F.markdown,style:{gridColumn:"1 / -1",gap:4},labelStyle:he,valueStyle:{lineHeight:1.6}},F.key):(0,y.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,y.jsx)("dt",{style:he,children:F.label}),(0,y.jsx)("dd",{style:{margin:0,overflowWrap:"anywhere",minWidth:0},children:F.linked?(0,y.jsx)(Qa,{relation:F.linked.relation,refs:F.linked.refs,...r?{nodeId:l,field:F.key}:{}}):F.app?(0,y.jsx)(Nt,{address:F.app,as:"record",...r?{nodeId:l,field:F.key}:{}}):F.href?(0,y.jsx)(kr,{href:F.href,field:F.key,value:F.value,stored:F.stored,...r?{nodeId:l}:{}}):r?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(hn,{nodeId:l,field:F.key,value:F.value,stored:F.stored}),F.repeats?(0,y.jsx)(Za,{nodeId:l,field:F.key,start:L?.[F.key],value:L?.[`${F.key}Repeat`],label:`${F.label} repeats`}):null]}):F.value})]},F.key))});return m.title?(0,y.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,y.jsx)("h3",{"data-graview-field-group":m.title,style:{...ne,fontSize:"inherit"},children:m.title}),Z]},T):(0,y.jsx)("div",{children:Z},T)}),Oe?(0,y.jsx)(Ve,{as:"unfilled",nodeId:l,skip:[...N?.fields??[]],labelStyle:he,style:{gap:4}}):null]}):null,(j?[]:E).map(m=>(0,y.jsxs)("section",{style:{...re,display:"grid",gap:10},children:[(0,y.jsx)("p",{style:he,children:Br(e,m)}),m.description?(0,y.jsx)("h2",{style:ne,children:xe(m.description)}):(0,y.jsxs)("h2",{style:ne,"aria-label":we(m.edgeKind),children:[m.direction==="in"?"\u2190 ":"\u2192 ",we(m.edgeKind)]}),(0,y.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:m.targets.map(T=>{let Z=Ua(e,m.direction==="in"?{kind:m.edgeKind,from:T.id,to:l}:{kind:m.edgeKind,from:l,to:T.id});return(0,y.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,y.jsx)(me,{kind:T.kind,brand:n,schema:e.schema,size:7}),(0,y.jsxs)(I,{to:te(e.schema,T.kind,T.id),style:B,children:[T.label,T.apart?(0,y.jsxs)("span",{style:A,children:[" \xB7 ",T.apart]}):null]}),Z?.provisional?(0,y.jsx)(wi,{store:e,link:Z,...a?{principal:a}:{}}):null]},T.id)})}),(m.direction==="out"&&e.schema.edge(m.edgeKind)?.cardinality==="one"?[]:[...new Set(m.targets.map(T=>T.kind))]).map(T=>(0,y.jsxs)(I,{to:`/${Q(e.schema,T)}?${encodeURIComponent(m.edgeKind)}=${encodeURIComponent(l)}`,style:{...B,...A},"data-testid":"related-all",children:["Sort and filter ",m.description??`these ${ee(e,T).toLowerCase()}`,m.targets.some(Z=>Z.kind!==T)?` (${ee(e,T).toLowerCase()})`:""," ",(0,y.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]},T))]},`${m.edgeKind}|${m.direction}|${m.description??""}`)),!j&&(D.length>0||d.actions.withheld.length>0)?(0,y.jsxs)("section",{style:{...re,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,y.jsx)("h2",{style:ne,ref:v,tabIndex:-1,children:"What can be done"}),(0,y.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[b.map(m=>{let T=p===m.id;return(0,y.jsx)("button",{type:"button","data-affordance":m.id,"data-rank":m.rank,"data-graview-act":m.mutation,autoFocus:f&&m===J[0],"aria-expanded":T,onClick:()=>{g(T?null:m.id),T||requestAnimationFrame(()=>C.current?.querySelector("input:not([type=hidden]), select, textarea, button")?.focus())},style:{...Le,...T?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:m.label},m.id)}),b.length<D.length?(0,y.jsxs)("button",{type:"button","aria-expanded":!1,onClick:()=>u(!0),style:{...Le,...A},"data-testid":"record-actions-more",children:["Show ",D.length-b.length," more"]}):null]}),D.map(m=>{if(p!==m.id)return null;let T=e.allMutations().find(Z=>Z.name===m.mutation);return T?(0,y.jsxs)("div",{ref:C,onKeyDown:Z=>{if(Z.key!=="Escape"||Z.defaultPrevented)return;Z.preventDefault(),g(null);let F=m.id;requestAnimationFrame(()=>G(F))},style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,y.jsx)("h3",{style:ne,children:m.label}),T.description?(0,y.jsx)("p",{style:{...A,margin:0},children:T.description}):null,(0,y.jsx)($e,{store:e,mutation:T,prefilled:m.args,open:m.open,label:m.label,onDone:()=>{g(null),q(m.mutation);let Z=m.id;requestAnimationFrame(()=>G(Z))},...a?{principal:a}:{}})]},m.id):null}),r&&k!==null&&p===null?(0,y.jsx)(gn,{choices:[{on:"act",act:k,record:l},{on:"act",act:k}],label:"Notify me when someone else does this",testId:"notify-after-act",style:{...Le,...A,justifySelf:"start"}}):null,d.actions.withheld.length>0?(0,y.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:d.actions.withheld.map(m=>(0,y.jsxs)("li",{style:A,children:[(0,y.jsx)("s",{children:m.label})," \u2014 ",m.refusal.message]},m.id))}):null]}):null,r?(0,y.jsx)(qr,{id:l,style:re,headingStyle:ne}):null,de.length>0?(0,y.jsxs)("section",{style:{...re,display:"grid",gap:10},"data-testid":"record-history",children:[(0,y.jsx)("h2",{style:ne,children:"What has happened"}),(0,y.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:de.map(m=>(0,y.jsxs)("li",{style:A,children:[(0,y.jsx)("span",{style:{color:"var(--graview-ink)"},children:m.intent}),m.lineage?(0,y.jsxs)("span",{"data-graview-lineage":"",children:[" \xB7 ",pn(m.lineage)]}):null," \u2014 ",ut(m,a,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},m.id))})]}):null]})}function ko({context:t,id:e,kind:n}){let{store:a,principal:i}=t,r={name:`allow-tidying-${n}`,args:{id:e}},o=a.allMutations().some(l=>l.name===r.name)&&a.permits(r,i).ok;return(0,y.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,y.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,y.jsx)("strong",{children:"Left alone."})," Nothing automated changes it; tidying passes it by."]}),o?(0,y.jsx)("button",{type:"button",style:Le,"data-testid":"allow-tidying",onClick:()=>a.apply(r,i?{author:i}:{}),children:"Allow tidying again"}):null]})}function bo({context:t,id:e,kind:n}){let{store:a,principal:i}=t,r={name:`unarchive-${n}`,args:{id:e}},o=a.allMutations().some(c=>c.name===r.name)&&a.permits(r,i).ok,l=[...a.log.all()].reverse().find(c=>!xt(c)&&c.mergedInto!==void 0&&c.writes.includes(e)),d=l?.mergedInto!==void 0?a.graph.getNode(l.mergedInto):void 0;return(0,y.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,y.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,y.jsx)("strong",{children:"Archived."})," Kept with its ties and history, and out of lists, counts and rules.",d?(0,y.jsxs)(y.Fragment,{children:[" ","Merged into ",(0,y.jsx)(I,{to:te(a.schema,d.kind,d.id),style:B,children:ge(a.schema.tryDefinition(d.kind),d)}),"."]}):null]}),o?(0,y.jsx)("button",{type:"button",style:Le,"data-testid":"bring-it-back",onClick:()=>a.apply(r,i?{author:i}:{}),children:"Bring it back"}):null]})}var x=H(Y(),1),So=(0,z.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.NM6MZYFN.js","./chunk.63GXY2ME.js","./chunk.UGFDSE37.js","./chunk.FSTCX2AI.js","./chunk.Y6ZNFQK3.js","./chunk.NRAYZY3X.js","./chunk.RIJUCHP4.js","./chunk.TAQ764IQ.js","./chunk.YIR7PPF3.js","./chunk.3HXN4BOY.js","./chunk.GYICGZMG.js","./chunk.UHUGOTUU.js","./chunk.47STJVRV.js","./chunk.EBGAYL32.js","./chunk.DAZ2VSRD.js","./chunk.J25KOSNW.js","./chunk.LR3VDXPI.js","./chunk.CWHRDBOF.js","./chunk.3K6YSVHC.js","./chunk.SHTJZ6UX.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.ULRW47RP.js","./chunk.PBSMLINK.js","./chunk.3TY5NFLY.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.GZHZLJBF.js","./chunk.XMC7YDWT.js","./chunk.6UGEYZAC.js","./chunk.OJGHDWI6.js","./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.TCNBCTWO.js")).then(t=>({default:t.DraftPage}))),xo={kind:"human"};function Po({list:t,store:e}){let n=new Set(t.members.map(o=>o.kind)),a=t.total-t.members.length,i=n.size===1?[...n][0]:void 0;if(!i)return(0,x.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${a} more`});let r=tt(e.schema,i).toLowerCase();return(0,x.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,x.jsx)(I,{to:`/${Q(e.schema,i)}`,className:"graview-spec-link graview-spec-see-all","data-testid":"see-all",children:t.total===e.graph.nodesOfKind(i).length?`See all ${ct(t.total)} ${r}`:`${ct(a)} more \xB7 all ${r}`})})}function Ao({context:t,children:e}){let n=Ie(),a=t.store.schema,i=(0,z.useMemo)(()=>({href:r=>te(a,r.kind,r.id),go:r=>n(te(a,r.kind,r.id)),more:r=>(0,x.jsx)(Po,{list:r,store:t.store})}),[a,n,t.store]);return(0,x.jsx)(Et.Provider,{value:i,children:(0,x.jsx)(Lr.Provider,{value:(t.titleLevel??(t.framed&&!t.barAbove?1:2))-1,children:e})})}function Co({steering:t}){let e=ke(),n=Ie(),a=`${e.pathname}${e.search}`;return(0,z.useLayoutEffect)(()=>t.at(a),[a,t]),(0,z.useLayoutEffect)(()=>{let i=o=>{o!==a&&n(o)};t.go.current=i;let r=t.pending?.current;return r!==void 0&&(t.pending.current=void 0,i(r)),()=>{t.go.current===i&&(t.go.current=void 0)}},[a,n,t]),null}function Ro({context:t,to:e}){let{pathname:n}=ke(),a=ye(),i=(e??a)?.sayWhere,r=Lo(t,n);return(0,z.useEffect)(()=>(i?.(r),()=>i?.(null)),[i,r]),null}function Lo(t,e){let[n="",a,i]=e.split("/").filter(Boolean).map(o=>{try{return decodeURIComponent(o)}catch{return o}});if(i!==void 0)return"#";if(n==="places"&&a!==void 0){if(a===dn)return"#overview=1";let o=t.views?.places().find(l=>l.as===a);return o?`#focus=${encodeURIComponent(Ne(o.kind))}&view=${encodeURIComponent(o.as)}`:"#"}let r=Re(t.store.schema,n);return r?`#focus=${encodeURIComponent(a??Ne(r))}`:"#"}function To({onNavigate:t,path:e}){let n=ke(),a=bn(),i=Ie(),r=n.hash&&!n.hash.includes("=")?n.hash:"",o=`${n.pathname}${n.search}${r}`,l=(0,z.useRef)(t);l.current=t;let d=(0,z.useRef)(null);(0,z.useEffect)(()=>{let p=d.current;d.current=o,p!==null&&(o===p&&a!=="PUSH"||l.current?.(o,a==="POP"?"pop":a==="REPLACE"?"replace":"push"))},[n.key]);let c=(0,z.useRef)(e);return(0,z.useEffect)(()=>{e===void 0||e===c.current||(c.current=e,e!==o&&i(e))},[e]),null}function vi({context:t,registry:e,page:n}){let a=qe(),i=Re(t.store.schema,a.slug??""),r=n==="list"?Dn:Kn,l=(i?e?.lookup(i,n):void 0)??r;return(0,x.jsx)(l,{context:t})}function Mo({context:t,registry:e,children:n}){let a=(0,z.useRef)(null);return Ma(a),(0,x.jsx)("div",{ref:a,"data-graview-face":"pages",style:{display:"contents"},children:(0,x.jsx)(si,{context:t,registry:e,root:a,children:(0,x.jsx)(li,{context:t,root:a,children:n})})})}function No(t){return t instanceof HTMLElement?t.isContentEditable||t.tagName==="TEXTAREA"||t.tagName==="SELECT"?!0:t.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(t.type):!1}function Eo(){let{pathname:t}=ke(),e=bn(),n=(0,z.useRef)(null);(0,z.useLayoutEffect)(()=>{if(e!=="POP"){for(let r=n.current?.parentElement;r;r=r.parentElement){let{overflowY:o}=getComputedStyle(r);if((o==="auto"||o==="scroll")&&r.scrollHeight>r.clientHeight){r.scrollTop=0;return}}window.scrollTo(0,0)}},[t]);let a=(0,z.useRef)(t),i=(0,z.useRef)(!1);return(0,z.useEffect)(()=>{if(!i.current&&t===a.current)return;i.current=!0;let r=document.activeElement;if(No(r))return;let o=n.current?.closest("main")??document.querySelector("main"),d=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??o?.querySelector("h1, h2")??null??o??null;d&&(d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1"),d.focus({preventScroll:!0}))},[t]),(0,x.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function $o({context:t,children:e}){let n=Ie(),a=(0,z.useMemo)(()=>({record:(i,r)=>{let o=t.store.graph.getNode(i);o&&n(mt(te(t.store.schema,o.kind,i),{section:r?.section}))},place:(i,r)=>{let o=t.views?.places().find(l=>l.as===i);o&&n(mt(be(t,o),r))},list:(i,r)=>{t.store.schema.tryDefinition(i)&&n(mt(`/${Q(t.store.schema,i)}`,r))},draft:()=>n("/~draft")}),[t,n]);return(0,x.jsx)(La.Provider,{value:a,children:e})}function Oo(){let{pathname:t,search:e,hash:n}=ke();return(0,z.useEffect)(()=>{let a=decodeURIComponent(n.replace(/^#/,""));if(!(!a||a.includes("=")))return ai(a)},[t,e,n]),null}function Fo({context:t,Home:e}){let n=ke(),a=t.views,i=n.key==="default"&&!(a&&Ca(a));(0,z.useEffect)(()=>{a&&Ra(a)},[a]);let r=i?ha(t.views?.arrangement?.()?.first,t.store.schema,t.views?.places()??[]):void 0,o=r?.to==="place"?be(t,r.place):r?.to==="kind"?`/${Q(t.store.schema,r.kind)}`:void 0;return o?(0,x.jsx)(Sn,{to:o,replace:!0}):(0,x.jsx)(e,{context:t})}function ki({context:t,registry:e}){let n=e?.lookupSurface("shell"),a=n!==void 0,i=a&&(e?.without().has("bar")??!1),r=a&&!i&&!t.embedded?{...t,barAbove:!0}:t,o=k=>n===void 0?(0,x.jsx)(Wt,{context:t,children:k}):i?(0,x.jsx)(n,{context:t,children:k}):(0,x.jsx)(Wt,{context:t,children:(0,x.jsx)(n,{context:r,children:k})}),l=e?.lookupSurface("home")??Fn,d=e?.lookupSurface("problems")??Wn,c=a?{...r,framed:!0}:t,[p,g]=(0,z.useState)(null),f=(0,z.useMemo)(()=>({onFind:g,find:!(e?.without().has("find")??!1),places:!(e?.without().has("places")??!1)}),[e]),u=(0,x.jsx)(Mo,{context:t,registry:e,children:(0,x.jsx)($o,{context:t,children:o((0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ja,{face:"pages"}),(0,x.jsxs)(Ao,{context:c,children:[(0,x.jsx)(Eo,{}),(0,x.jsx)(Oo,{}),(0,x.jsxs)(zr,{children:[(e?.routes()??[]).map(({path:k,component:q})=>(0,x.jsx)(Pe,{path:k,element:(0,x.jsx)(q,{context:c})},k)),(0,x.jsx)(Pe,{path:"/",element:(0,x.jsx)(Fo,{context:c,Home:l})}),(0,x.jsx)(Pe,{path:"/problems",element:(0,x.jsx)(d,{context:c})}),(0,x.jsx)(Pe,{path:"/~draft",element:(0,x.jsx)(z.Suspense,{fallback:null,children:(0,x.jsx)(So,{context:c})})}),(0,x.jsx)(Pe,{path:"/search",element:(0,x.jsx)(In,{context:c})}),(0,x.jsx)(Pe,{path:"/map",element:(0,x.jsx)(On,{context:c})}),(0,x.jsx)(Pe,{path:"/places",element:(0,x.jsx)(Nn,{context:c})}),Ae(c).some(k=>k.as===dn)?null:(0,x.jsx)(Pe,{path:ya,element:(0,x.jsx)(Sn,{to:"/",replace:!0})}),(0,x.jsx)(Pe,{path:"/places/:as",element:(0,x.jsx)(En,{context:c})}),(0,x.jsx)(Pe,{path:"/:slug",element:(0,x.jsx)(vi,{context:c,registry:e,page:"list"})}),(0,x.jsx)(Pe,{path:"/:slug/:id",element:(0,x.jsx)(vi,{context:c,registry:e,page:"record"})})]})]})]}))})});return t.embedded||!a||i?u:(0,x.jsx)(Qr.Provider,{value:f,children:(0,x.jsx)(cr.Provider,{value:p,children:u})})}var Io=()=>typeof document>"u"?null:document.body;function Do({context:t,registry:e,basename:n,initialPath:a,onNavigate:i,path:r,steering:o,firstLook:l}){let[d,c]=(0,z.useState)(void 0),p=d!==void 0&&d.from===t.principal?{...t,principal:d.seat}:t;(0,z.useState)(()=>p.views?Mr(p.views,p.store.schema,fn(p.brand,p.store.schema)):void 0);let g=ye();aa({reader:p.locale??g?.locale,app:p.brand?.locale??p.app?.brand?.locale});let f=p.principal??xo,u=Sa(p.store,f,p.history),q=(u.past&&u.live===p.store?u.past.store:p.store).seenBy(f),v=q===p.store?p:{...p,store:q};xa(p.store,p.principal);let C=(0,x.jsxs)(x.Fragment,{children:[i||r!==void 0?(0,x.jsx)(To,{onNavigate:i,path:r}):null,o?(0,x.jsx)(Co,{steering:o}):null,v.presence||g?(0,x.jsx)(Ro,{context:v,to:g}):null,(0,x.jsx)(ki,{context:v,...e?{registry:e}:{}}),l?(0,x.jsx)(Nr,{firstLook:l,root:Io,app:fn(p.brand,p.store.schema)}):null]}),G=v.views?(0,x.jsxs)(Pa,{store:v.store,views:v.views,...v.principal?{principal:v.principal}:{},...v.brand?{brand:v.brand}:{},...v.locale?{locale:v.locale}:{},...v.settings?{settings:v.settings}:{},...v.presence&&!g?{presence:v.presence}:{},...v.people?{people:v.people}:{},...v.seats?{seats:v.seats}:{},onSeat:X=>g?g.takeSeat(X):c({from:t.principal,seat:X}),...v.onKeepLens?{onKeepLens:v.onKeepLens}:{},...v.ai?{ai:v.ai}:{},...v.subscriptions?{subscriptions:v.subscriptions}:{},resolveApp:v.resolveApp??g?.resolveApp,linkedRecords:v.linkedRecords??g?.linkedRecords,...v.app?{app:v.app}:{},...v.menuSections?{menuSections:v.menuSections}:{},children:[C,(0,x.jsx)(ri,{context:v})]}):C,L=(0,x.jsx)(ba.Provider,{value:u,children:G}),U=v.files?(0,x.jsx)(ka.Provider,{value:v.files,children:L}):L;if(a!==void 0){let X=n===void 0?a:`${n.replace(/\/$/,"")}${a}`;return(0,x.jsx)(jr,{initialEntries:[X],...n===void 0?{}:{basename:n},children:U})}return(0,x.jsx)(_r,{...n===void 0?{}:{basename:n},children:U})}export{Wi as a,Do as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f}from"./chunk.GV2CQVKV.js";import"./chunk.4HZ7QTXZ.js";import"./chunk.3TY5NFLY.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import{ib as a}from"./chunk.MNP4JI33.js";import"./chunk.AJZBJBMO.js";export{a as ActRefusal,e as compileDocumentWithoutCheck,d as effectsOf,f as inDocumentWords,c as kindShapes,b as readDocument};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as b,d as J}from"./chunk.B2GLDIAS.js";import{a as O,f as q}from"./chunk.UGFJKSHU.js";import{$a as D,Ab as w,B as m,Ea as j,Fa as A,Pa as v,ab as L,bb as N,gc as Z,hc as k,ja as R,ma as x,ta as S,vb as M,zb as P}from"./chunk.MNP4JI33.js";var E=n=>n.safeParse?.(void 0).success??!1,T=n=>b(n).shape,F=n=>{let s=b(n);if(m(s)?.type!=="literal")return;let e=m(s)?.values;return e&&e.length===1&&typeof e[0]=="string"?e[0]:void 0};function g(n,s){let e=E(s),o=b(s),r=m(o)?.type,l=M(s);if(l)return{control:"node",name:n,optional:e,kinds:l};let y=S(s);if(y)return{control:"linked",name:n,optional:e,relation:y};if(A(s)){let a=j(n);return{control:"repeat",name:n,optional:e,...a?{of:a}:{}}}if(r==="boolean")return{control:"boolean",name:n,optional:e};let p=R(o);if(p)return{control:"file",name:n,optional:e,...p==="image"?{image:!0}:{}};if(r==="object"){let a=o.shape??{};return{control:"group",name:n,optional:e,fields:Object.entries(a).map(([c,d])=>g(c,d))}}if(r==="union"){let a=m(o)?.options??[],c=a.map(t=>T(t));if(c.every(t=>t!==void 0)){let t=Object.keys(c[0]??{}).find(f=>c.every(u=>F(u?.[f])!==void 0));if(t)return{control:"variant",name:n,optional:e,tag:t,options:a.map((f,u)=>({value:F(c[u]?.[t])??"",fields:Object.entries(c[u]??{}).filter(([h])=>h!==t).map(([h,z])=>g(h,z))}))}}let d=a.map(t=>F(t));return d.every(t=>t!==void 0)?{control:"choice",name:n,optional:e,options:d}:{control:"opaque",name:n,optional:e}}if(r==="array"){let a=m(o)?.element;return a!==void 0?{control:"list",name:n,optional:e,item:g(n,a)}:{control:"opaque",name:n,optional:e}}let i=J(s);return i.type==="text"?{control:"text",name:n,optional:e,...i.long?{long:!0}:{},...x(o)?{app:!0}:{},...O(o)?{markdown:!0}:{},...i.holds?{holds:i.holds}:{}}:i.type==="number"&&i.duration?{control:"text",name:n,optional:e,holds:"duration"}:i.type==="date"?{control:"date",name:n,optional:e,...i.time?{time:!0}:{},...i.instant?{instant:!0}:{}}:i.type==="number"?{control:"number",name:n,optional:e,...i.min===void 0?{}:{min:i.min},...i.max===void 0?{}:{max:i.max},...i.step===void 0?{}:{step:i.step},...i.amount?{amount:i.amount}:{}}:i.type==="choice"?{control:"choice",name:n,optional:e,options:i.options}:{control:"opaque",name:n,optional:e}}function B(n){let s=n.shape;return s?Object.entries(s).map(([e,o])=>g(e,o)):[]}function K(n,s){let e={...s};for(let o of n){let r=s[o.name];r===void 0&&!o.optional&&(o.control==="list"||o.control==="boolean")&&(e[o.name]=o.control==="list"?[]:!1),o.control==="text"&&o.holds&&typeof r=="string"&&(e[o.name]=r.trim()===""?void 0:o.holds==="duration"?q(r)??r:r.trim()),o.control==="group"&&r!==void 0&&typeof r=="object"&&r!==null&&(e[o.name]=K(o.fields,r))}return e}function C(n,s,e){let o=n.derived?.act==="edit"&&n.subject?e[n.subject.arg]:void 0,r=typeof o=="string"?s.getNode(o):void 0;return r?Object.fromEntries((n.writes??[]).filter(l=>r[l]!==void 0&&r[l]!==null).map(l=>[l,r[l]])):{}}function I(n,s){return Object.fromEntries(Object.entries(n).filter(([e,o])=>!Object.hasOwn(s,e)||JSON.stringify(o)!==JSON.stringify(s[e])))}function _(n,s,e,o){let r=Z.keptFrom?.(n,s),l=new Set;if(!r)return l;let y=Object.keys(e.input.shape??{});for(let c of e.creates??[]){let d=r({id:"\0new",kind:c});for(let t of y)d?.(t)&&l.add(t)}let p=o===void 0?void 0:n.graph.getNode(o),i=p&&n.schema.tryDefinition(p.kind),a=p&&r(p);if(i&&a)for(let c of w(e,i))a(c)&&y.includes(c)&&l.add(c);return l}function dn(n,s,e,o){let r=new Set,l=s?.sees??[];if(L(e)||!l.some(k))return r;let y=D(e),p=(d,t)=>{let f=l.filter(u=>u.kinds.includes(d)&&N(u,y));return f.some(k)?v.has(t)||f.some(u=>!k(u)||(u.fields===void 0||u.fields.includes(t))&&!u.hide?.includes(t)):!0},i=Object.keys(o.input.shape??{}),a=new Map,c=(d,t)=>a.set(d,a.get(d)===!0||t);for(let d of o.creates??[]){let t=Object.keys(n.tryDefinition(d)?.fields.shape??{});for(let f of i)t.includes(f)&&c(f,p(d,f))}for(let d of P(n,o)){let t=n.tryDefinition(d);if(t)for(let f of w(o,t))i.includes(f)&&c(f,p(d,f))}for(let[d,t]of a)t||r.add(d);return r}export{B as a,K as b,C as c,I as d,_ as e,dn as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.XDYAG276.js";import{a as xe}from"./chunk.HJCQ6I3S.js";import{c as he}from"./chunk.MWGGV7DE.js";import{a as je,b as Ee,c as Ie,d as Re}from"./chunk.JQU5GEU3.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import{F as Ke,Q as Pe}from"./chunk.6QWV5MVH.js";import"./chunk.MNP4JI33.js";import{b as pe}from"./chunk.AJZBJBMO.js";var P=pe(Ke(),1);var E=.5,fe=1,ye=.76,Le=3,We=3,Ae=.6;function Oe(c){let{ribbons:m,plots:u,cell:i}=c,a=c.tilt??.5,g=c.labels??[],b=[...u.values()],k=new Map;if(b.length===0||i<=0)return k;let L=Math.min(...b.map(n=>n.col))-3,A=Math.min(...b.map(n=>n.row))-3,G=Math.max(...b.map(n=>n.col+n.side))+3,ce=Math.max(...b.map(n=>n.row+n.side))+3,h=Math.round((G-L)/E)+1,p=Math.round((ce-A)/E)+1,N=n=>L+n*E,B=n=>A+n*E,I=4,_=!0,C=(n,e)=>{if(!_)return!1;let t=he(n,e,i,a);return g.some(s=>t.x>s.x-I&&t.x<s.x+s.width+I&&t.y>s.y-I&&t.y<s.y+s.height+I)},H=(n,e)=>b.some(t=>n>t.col-ye&&n<t.col+t.side+ye&&e>t.row-ye&&e<t.row+t.side+ye),F=new Uint8Array(h*p),J=new Uint8Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);J[e*h+n]=H(t,s)?0:1,F[e*h+n]=J[e*h+n]&&!C(t,s)?1:0}let Q=F,se=new Float32Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);se[e*h+n]=Math.min(...b.map(o=>Math.max(0,o.col-t,t-(o.col+o.side),o.row-s,s-(o.row+o.side))))}let Z=(n,e,t,s)=>{let o=N(n)+t*E/2,l=B(e)+s*E/2;return!H(o,l)&&!C(o,l)},ue=n=>{let e=[],t=(o,l)=>{let w=[],d=Math.min(1,l/3);for(let y=Math.ceil((o+d)/E-1e-9)*E;y<=o+l-d+1e-9;y+=E)w.push(y);return w},s=(o,l,w,d)=>{let y=Math.round((o-L)/E),r=Math.round((l-A)/E);y>=0&&r>=0&&y<h&&r<p&&Q[r*h+y]&&e.push({i:y,j:r,out:w,curb:d})};for(let o of t(n.row,n.side))s(n.col-fe,o,1,{col:n.col,row:o}),s(n.col+n.side+fe,o,0,{col:n.col+n.side,row:o});for(let o of t(n.col,n.side))s(o,n.row-fe,3,{col:o,row:n.row}),s(o,n.row+n.side+fe,2,{col:o,row:n.row+n.side});return e},ee=new Map,V=(n,e,t,s)=>n<t||n===t&&e<s?`${n},${e}-${t},${s}`:`${t},${s}-${n},${e}`,de=[[1,0],[-1,0],[0,1],[0,-1]],X=new Map;for(let n of m){let e=u.get(n.from),t=u.get(n.to);if(!e||!t||e===t)continue;let s=-1,o=[],l=new Map,w=new Int32Array(0),d=1/0,y=[];for(let f of[!0,!1]){s=-1,d=1/0,_=f,Q=f?F:J,o=ue(e);let W=ue(t);if(o.length===0||W.length===0){y.push({reached:-1,starts:o,goal:l,back:w,best:d});continue}l=new Map(W.map(j=>[j.j*h+j.i,j]));let ne=(j,R)=>{let re=N(j),ae=B(R);return(Math.max(0,t.col-re,re-(t.col+t.side))+Math.max(0,t.row-ae,ae-(t.row+t.side)))*Ae},oe=h*p*4,ie=new Float64Array(oe).fill(1/0);w=new Int32Array(oe).fill(-1);let le=new ke;for(let j of o){let R=(j.j*h+j.i)*4+j.out;ie[R]=0,le.push(R,ne(j.i,j.j))}let Ce=[1,0,3,2];for(;le.size>0&&!(le.peekKey()>=d);){let R=le.pop(),re=Math.floor(R/4),ae=R%4,ge=re%h,we=Math.floor(re/h),ve=l.get(re);if(ve){let q=ie[R]+(ae===Ce[ve.out]?0:Le);q<d&&(d=q,s=R);continue}for(let q=0;q<4;q++){let[Me,$e]=de[q],U=ge+Me,z=we+$e;if(U<0||z<0||U>=h||z>=p||!Q[z*h+U]||!Z(ge,we,Me,$e))continue;let Te=E*(ee.has(V(ge,we,U,z))?Ae:1)*(1+Math.max(0,se[z*h+U]-We))+(q===ae?0:Le),me=(z*h+U)*4+q,be=ie[R]+Te;be<ie[me]&&(ie[me]=be,w[me]=R,le.push(me,be+ne(U,z)))}}y.push({reached:s,starts:o,goal:l,back:w,best:d})}_=!0,Q=F;let[r,v]=y,M=r&&r.reached!==-1&&(!v||v.reached===-1||r.best<=1.3*v.best+2)?r:v;if(!M||M.reached===-1)continue;({reached:s,starts:o,goal:l,back:w}=M);let x=[];for(let f=s;f!==-1;f=w[f]){let W=Math.floor(f/4),ne=x[x.length-1],oe={i:W%h,j:Math.floor(W/h)};(!ne||ne.i!==oe.i||ne.j!==oe.j)&&x.push(oe)}x.reverse();for(let f=1;f<x.length;f++){let W=V(x[f-1].i,x[f-1].j,x[f].i,x[f].j);ee.set(W,[...ee.get(W)??[],n.key])}let D=o.find(f=>f.i===x[0].i&&f.j===x[0].j),$=l.get(x[x.length-1].j*h+x[x.length-1].i);X.set(n.key,{cells:x,start:D.curb,end:$.curb})}let O=new Map(m.map(n=>[n.key,n.width])),T=new Map(m.map((n,e)=>[n.key,e])),te=i*a/Math.sqrt(1+a*a),Y=(n,e)=>n==="col"?`r${e.row.toFixed(2)}`:`c${e.col.toFixed(2)}`,K=new Map;for(let[n,e]of X)for(let t=1;t<e.cells.length;t++){let s=e.cells[t-1],o=e.cells[t],l=Y(s.i!==o.i?"col":"row",{col:N(s.i),row:B(s.j)});K.set(l,(K.get(l)??new Set).add(n))}for(let[n,e]of X){let t=[e.start,...e.cells.map(r=>({col:N(r.i),row:B(r.j)})),e.end],s=r=>r>=2&&r<=e.cells.length?V(e.cells[r-2].i,e.cells[r-2].j,e.cells[r-1].i,e.cells[r-1].j):null,o=[];for(let r=1;r<t.length;r++){let v=Math.abs(t[r].col-t[r-1].col)>1e-9?"col":"row",M=o[o.length-1];M&&M.axis===v?M.to=r:o.push({from:r-1,to:r,axis:v})}if(o.length===0)continue;let l=o.map(r=>{if(!Array.from({length:r.to-r.from},($,f)=>s(r.from+1+f)).some($=>$!==null))return 0;let v=K.get(Y(r.axis,t[r.from]))??new Set;if(!v.has(n))return 0;let M=[...v].sort(($,f)=>(T.get($)??0)-(T.get(f)??0)),D=-(M.reduce(($,f)=>$+(O.get(f)??2)+2,0)-2)/2;for(let $ of M){if($===n)return(D+(O.get($)??2)/2)/te;D+=(O.get($)??2)+2}return 0}),w=r=>{let v=o[r],M=t[v.from];return v.axis==="col"?{row:M.row+l[r]}:{col:M.col+l[r]}},d=(r,v,M)=>({col:r.col??v.col??M.col,row:r.row??v.row??M.row}),y=[d(w(0),{},t[0])];for(let r=0;r+1<o.length;r++)y.push(d(w(r),w(r+1),t[o[r].to]));y.push(d(w(o.length-1),{},t[t.length-1])),k.set(n,y.map(r=>he(r.col,r.row,i,a)))}return k}var ke=class{items=[];keys=[];get size(){return this.items.length}peekKey(){return this.keys[0]??1/0}push(m,u){this.items.push(m),this.keys.push(u);let i=this.items.length-1;for(;i>0;){let a=i-1>>1;if(this.keys[a]<=this.keys[i])break;this.swap(i,a),i=a}}pop(){let m=this.items[0],u=this.items.pop(),i=this.keys.pop();if(this.items.length>0){this.items[0]=u,this.keys[0]=i;let a=0;for(;;){let g=2*a+1,b=g+1,k=a;if(g<this.items.length&&this.keys[g]<this.keys[k]&&(k=g),b<this.items.length&&this.keys[b]<this.keys[k]&&(k=b),k===a)break;this.swap(a,k),a=k}}return m}swap(m,u){[this.items[m],this.items[u]]=[this.items[u],this.items[m]],[this.keys[m],this.keys[u]]=[this.keys[u],this.keys[m]]}};function Se(c,m){let u=c.col+c.side,i=u+.25+.22*Math.max(0,m),a=c.row+c.side*Math.max(.1,.3-.06*m),g=c.row+c.side*Math.min(.9,.7+.06*m);return[{col:u,row:a},{col:i,row:a},{col:i,row:g},{col:u,row:g}]}function Be(c,m){return c.map(u=>he(u.col,u.row,m.cell,m.tilt))}function Fe(c){return c.map((m,u)=>`${u===0?"M":"L"} ${m.x.toFixed(1)} ${m.y.toFixed(1)}`).join(" ")}function Ne(c){if(c.length===0)return{x:0,y:0};let m=0;for(let i=1;i<c.length;i++)m+=Math.hypot(c[i].x-c[i-1].x,c[i].y-c[i-1].y);let u=m/2;for(let i=1;i<c.length;i++){let a=c[i-1],g=c[i],b=Math.hypot(g.x-a.x,g.y-a.y);if(b>=u&&b>0)return{x:a.x+(g.x-a.x)*u/b,y:a.y+(g.y-a.y)*u/b};u-=b}return c[c.length-1]}var S=pe(Pe(),1);function Ue({frame:c,width:m,height:u,pan:i,store:a,graphVersion:g,selection:b,view:k,emphasis:L,hiddenKinds:A,drawn:G}){let[ce,h]=(0,P.useState)(null),p=c.city,N=e=>a.graph.getNode(e)?.kind,B=(0,P.useMemo)(()=>je(a.graph.allEdges(),e=>a.graph.getNode(e)?.kind),[a,g]),I=new Map;for(let e of c.nodes){let t=e.id.startsWith("kind:")?Ie(e.id):null;t!==null&&e.plot&&Math.round(e.plane)===2&&I.set(t,e.plot)}let _=[...I].map(([e,t])=>`${e}:${t.col},${t.row},${t.side}`).join(";"),C=p?.cell??0,H=B.filter(e=>I.has(e.from)&&I.has(e.to)&&!A.has(e.from)&&!A.has(e.to)&&G(e.edge)),F=p?.tilt??.5,[J,Q]=(0,P.useState)([]),se=J.map(e=>`${Math.round(e.x)},${Math.round(e.y)},${Math.round(e.width)},${Math.round(e.height)}`).join(";"),[Z,ue]=(0,P.useState)(null),ee=c.t>=1;(0,P.useLayoutEffect)(()=>{let e=Z?.parentElement;if(!e||!p||!ee)return;let t=e.getBoundingClientRect(),s=p.originX+i.x,o=p.originY+i.y,l=[...e.querySelectorAll('[data-graview-view^="kind:"] .graview-kind-face')].flatMap(d=>{let y=d.getBoundingClientRect();return y.width>0&&y.height>0?[{x:y.left-t.left-s,y:y.top-t.top-o,width:y.width,height:y.height}]:[]});l.map(d=>`${Math.round(d.x)},${Math.round(d.y)},${Math.round(d.width)},${Math.round(d.height)}`).join(";")!==se&&Q(l)},[Z,ee,_,C,F]);let V=(0,P.useMemo)(()=>{if(C===0)return[];let e=new Map,t=Math.max(0,...H.map(o=>o.links)),s=Oe({ribbons:H.map(o=>({key:o.key,from:o.from,to:o.to,width:xe(o.links,t)})),plots:I,cell:C,tilt:F,labels:J});return H.flatMap(o=>{let l;if(o.from===o.to){let w=e.get(o.from)??0;e.set(o.from,w+1),l=Be(Se(I.get(o.from),w),{cell:C,tilt:F})}else l=s.get(o.key);return!l||l.length<2?[]:[{ribbon:o,points:l,d:Fe(l),middle:Ne(l),width:xe(o.links,t)}]})},[C,F,_,B,G,A,se]),de=(0,P.useRef)([]),X=(0,P.useRef)({x:0,y:0});if(X.current=p?{x:p.originX+i.x,y:p.originY+i.y}:{x:0,y:0},(0,P.useEffect)(()=>{let e=Z?.parentElement;if(!e||typeof window>"u")return;let t=0,s=null,o=()=>{t=0;let d=s;if(!d)return;let y=d.target;if(d.pointerType==="touch"||d.buttons!==0||y?.closest("[data-graview-view], button, a, input, select, textarea, [data-graview-overlay], [data-graview-offstage]")){h(null);return}let r=e.getBoundingClientRect(),v=d.clientX-r.left-X.current.x,M=d.clientY-r.top-X.current.y,x=null,D=1/0;for(let $ of de.current){let f=qe($.points,v,M);f<=$.reach&&f<D&&(D=f,x=$.key)}h(x)},l=d=>{s=d,t===0&&(t=requestAnimationFrame(o))},w=()=>h(null);return e.addEventListener("pointermove",l,{passive:!0}),e.addEventListener("pointerleave",w),()=>{t!==0&&cancelAnimationFrame(t),e.removeEventListener("pointermove",l),e.removeEventListener("pointerleave",w)}},[Z]),!p||!k.overview||V.length===0)return null;let O=Ee(b,k,N);if(O.records.length>0||O.lens!==null)return null;let T=O.districts.length>0?V.filter(({ribbon:e})=>O.districts.includes(e.from)||O.districts.includes(e.to)):V;if(T.length===0)return null;let te=L??null,Y=T.find(({ribbon:e})=>e.key===ce);de.current=T.map(({ribbon:e,points:t,width:s})=>({key:e.key,points:t,reach:s/2+6}));let K={x:p.originX+i.x,y:p.originY+i.y},n=`translate(${K.x.toFixed(1)} ${K.y.toFixed(1)})`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("svg",{ref:ue,className:"graview-ribbons","aria-hidden":"true","data-graview-world":"","data-graview-ribbons":T.length,width:m,height:u,style:{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible"},children:(0,S.jsx)("g",{transform:n,children:T.map(({ribbon:e,d:t,width:s})=>{let o=ce===e.key||te!==null&&te===e.edge||O.districts.length>0,l=te!==null&&te!==e.edge;return(0,S.jsx)("g",{className:"graview-ribbon","data-graview-ribbon":e.edge,"data-graview-from":`kind:${e.from}`,"data-graview-to":`kind:${e.to}`,"data-graview-links":e.links,"data-graview-lit":o&&!l?"":void 0,"data-graview-receded":l?"":void 0,children:(0,S.jsx)("path",{className:"graview-ribbon-band",d:t,style:{strokeWidth:s}})},e.key)})})}),Y?(0,S.jsx)("div",{className:"graview-ribbon-said","data-graview-world":"","data-testid":"ribbon-said",role:"status",style:{position:"absolute",left:K.x+Y.middle.x,top:K.y+Y.middle.y,pointerEvents:"none"},children:Re(a.schema,Y.ribbon)}):null]})}function qe(c,m,u){let i=1/0;for(let a=1;a<c.length;a++){let g=c[a-1],b=c[a],k=b.x-g.x,L=b.y-g.y,A=k*k+L*L,G=A===0?0:Math.max(0,Math.min(1,((m-g.x)*k+(u-g.y)*L)/A));i=Math.min(i,Math.hypot(m-(g.x+G*k),u-(g.y+G*L)))}return i}export{Ue as Ribbons,qe as distanceTo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.WVUJXDXZ.js";import{a as v,b as ae}from"./chunk.ULRW47RP.js";import"./chunk.PBSMLINK.js";import"./chunk.3TY5NFLY.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import"./chunk.GZHZLJBF.js";import{n as re}from"./chunk.XMC7YDWT.js";import"./chunk.6UGEYZAC.js";import"./chunk.OJGHDWI6.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import"./chunk.JOOQUWLT.js";import{$ as ne,F as Fe,L as _,N as Z,Q as ee,Y as te}from"./chunk.6QWV5MVH.js";import{ca as Q,dc as X,ga as Y,ha as k,ia as j}from"./chunk.MNP4JI33.js";import{b as z}from"./chunk.AJZBJBMO.js";var g=z(Fe(),1);async function ie(e,n){let a=await createImageBitmap(e);try{let i=Math.min(1,n/Math.max(a.width,a.height)),o=document.createElement("canvas");o.width=Math.max(1,Math.round(a.width*i)),o.height=Math.max(1,Math.round(a.height*i));let s=o.getContext("2d");if(s===null)throw new Error("This browser will not give us a canvas to resize with.");return s.drawImage(a,0,0,o.width,o.height),o}finally{a.close()}}var t=z(ee(),1),$e=2048,xe=.85;function H(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function U(e){if(e.type==="application/pdf")return"PDF";let n=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return n?n.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ce(e){let n=[...new Set(e.map(a=>a==="image/*"?"pictures":a==="*/*"||a==="*"?"any file":`${U({type:a})} files`))];return n.length<=1?n[0]??"no files":`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`}function ge(e,n){if(e.length===0)return!0;let a=`${n.split("/")[0]}/*`;return e.some(i=>i==="*"||i==="*/*"||i===n||i===a)}var le=/^image\/hei[cf]$|\.hei[cf]$/i,oe=e=>le.test(e.type)||le.test(e.name);async function Se(e,n,a){let i=e.name||(a.camera?"photo.jpg":"file"),o=e.type||(oe({type:"",name:i})?"image/heic":"application/octet-stream"),s=oe({type:o,name:i}),d=o.startsWith("image/")||s;if(a.image&&!d)return{refused:`\u201C${i}\u201D isn\u2019t a picture.`};if(s||d&&/^image\/(jpeg|webp)$/.test(o)&&(a.camera||e.size>n.maxBytes||e.size>15e5))try{let l=await ie(e,$e),f=await new Promise(y=>l.toBlob(y,"image/jpeg",xe));if(f)return se({blob:f,name:s?i.replace(/\.hei[cf]$/i,"")+".jpg":i,type:"image/jpeg",width:l.width,height:l.height},n)}catch{if(s&&!ge(n.kinds,o))return{refused:`\u201C${i}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let c={};if(d&&!s)try{let l=await createImageBitmap(e);c={width:l.width,height:l.height},l.close()}catch{}return se({blob:e,name:i,type:o,...c},n)}function se(e,n){return ge(n.kinds,e.type)?e.blob.size>n.maxBytes?{refused:`\u201C${e.name}\u201D is ${H(e.blob.size)}; this host takes files up to ${H(n.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${U(e)} file; this host takes ${ce(n.kinds)}.`}}async function Ce(e,n,a){let i;try{i=await n.upload(e.blob,e.name)}catch(s){let d=s instanceof Error&&s.message.trim()?s.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${d}`}}return Y(i)?a&&!k(i)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:{...i,...i.width===void 0&&e.width?{width:e.width}:{},...i.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var F="var(--graview-radius, 8px)",C={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function pe(e){let n=_(),a=Z()?.past!=null,[i,o]=(0,g.useState)(!1);return[n?.kept?.(e.href)===!1||a&&i,()=>o(!0)]}function he({file:e,style:n}){return(0,t.jsx)("span",{role:"img","aria-label":`${v(e)}, removed later`,"data-graview-removed-later":e.href,style:{display:"grid",placeItems:"center",textAlign:"center",padding:4,boxSizing:"border-box",fontSize:"0.6875rem",lineHeight:1.2,color:"var(--graview-ink-muted)",border:"1px dashed var(--graview-edge-bright)",borderRadius:F,...n},children:"removed later"})}function O({file:e,size:n=56,style:a}){let[i,o]=pe(e);return i?(0,t.jsx)(he,{file:e,style:{width:n,height:n,flex:"none",...a}}):(0,t.jsx)("img",{onError:o,src:e.href,alt:v(e),width:n,height:n,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:n,height:n,objectFit:"cover",borderRadius:F,display:"block",flex:"none",background:"var(--graview-edge)",...a}})}function Ee({file:e,onOpen:n}){let[a,i]=pe(e);return a?(0,t.jsx)(he,{file:e,style:{width:"100%",aspectRatio:"1"}}):(0,t.jsx)("button",{type:"button","aria-label":`Open ${v(e)} full size`,onClick:o=>n(o.currentTarget),style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:F},children:(0,t.jsx)("img",{src:e.href,alt:v(e),loading:"lazy",decoding:"async",onError:i,style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:F,display:"block",background:"var(--graview-edge)"}})})}function N({files:e,label:n}){let a=e.filter(k),i=e.filter(l=>!k(l)),[o,s]=(0,g.useState)(null),d=(0,g.useRef)(null),m=(0,g.useRef)(null);(0,g.useEffect)(()=>{let l=d.current;o!==null&&l&&!l.open&&l.showModal?.()},[o]);let c=o===null?void 0:a[o];return(0,t.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[a.length>0?(0,t.jsx)("ul",{"data-graview-gallery":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:a.map((l,f)=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ee,{file:l,onOpen:y=>{m.current=y,s(f)}})},l.href))}):null,i.length>0?(0,t.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:i.map(l=>(0,t.jsxs)("li",{"data-graview-document":l.type,style:{display:"grid",gap:6,minWidth:0},children:[l.type==="application/pdf"?(0,t.jsx)("object",{data:l.href,type:"application/pdf","aria-label":v(l),style:{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:F},children:(0,t.jsxs)("p",{style:{margin:0,padding:12},children:["This browser shows no PDF here: ",(0,t.jsxs)("a",{href:l.href,download:l.name,children:["download ",l.name]}),"."]})}):null,(0,t.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,t.jsx)("a",{href:l.href,download:l.name,...l.type==="application/pdf"?{target:"_blank",rel:"noopener"}:{},children:l.name}),(0,t.jsxs)("span",{style:C,children:[U(l)," \xB7 ",H(l.bytes)]})]}),l.caption?(0,t.jsx)("span",{style:C,children:l.caption}):null]},l.href))}):null,c?(0,t.jsx)("dialog",{ref:d,"data-graview-full":c.href,"aria-label":v(c),onClose:()=>{s(null),m.current?.focus()},onClick:l=>{l.target===l.currentTarget&&l.currentTarget.close()},style:{padding:0,border:0,borderRadius:F,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,t.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,t.jsx)("img",{src:c.href,alt:v(c),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,t.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:c.caption??c.name}),(0,t.jsx)("form",{method:"dialog",style:{margin:0},children:(0,t.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function me({value:e,onChange:n,several:a,image:i,label:o,thumbs:s=!0}){let d=_(),m=(0,g.useId)(),c=(0,g.useRef)(null),l=(0,g.useRef)(null),[f,y]=(0,g.useState)(null),[$,I]=(0,g.useState)(null),[A,E]=(0,g.useState)([]),[D,L]=(0,g.useState)(!1),x=d?i?d.kinds.filter(r=>r.startsWith("image/")||r==="*"||r==="*/*"):d.kinds:[],G=d?d.kinds.length===0||x.some(r=>r.startsWith("image/")||r.startsWith("*")):!1,P=!!d&&(!i||G),q=i?a?"pictures":"a picture":a?"files":"a file",K=i?x.length>0?x.join(","):"image/*":d?.kinds.join(",")||void 0,be=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,V=(0,g.useRef)(e);V.current=e;let J=(0,g.useRef)(null),R=(0,g.useRef)(null);(0,g.useEffect)(()=>{let r=R.current;if(!r||r.from===e)return;R.current=null;let u=J.current?.children,h=u?.[Math.min(r.at,u.length-1)];((r.what==="move"?h?.querySelector("[data-graview-file-move]"):null)??h?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let T=async(r,u)=>{if(!d||r.length===0)return;let h=a?r:r.slice(0,1),p=[],w=[];h.length<r.length&&w.push(`${o} holds one ${i?"picture":"file"}, so ${r.slice(1).map(b=>`\u201C${b.name||"the photo"}\u201D`).join(", ")} ${r.length>2?"were":"was"} left out.`),E([]),I(null);for(let b of h){y(`Sending ${b.name||"the photo"}\u2026`);let B=await Se(b,d,{image:i,camera:u==="camera"});if("refused"in B){w.push(B.refused);continue}let S=await Ce(B,d,i);"refused"in S?w.push(S.refused):[...a?V.current:[],...p].some(ke=>ke.href===S.href)?w.push(`\u201C${S.name}\u201D is already here.`):p.push(S)}if(y(null),E(w),p.length!==0)try{n(a?[...V.current,...p]:p.slice(-1)),I(`Added ${p.map(b=>b.name).join(", ")}.`)}catch(b){E([...w,b instanceof Error?b.message:String(b)])}},W=(r,u,h)=>{try{R.current=h?{...h,from:e}:null,n(r),I(u)}catch(p){R.current=null,E([p instanceof Error?p.message:String(p)])}},M=r=>r?Array.from(r):[],we=r=>{let u=M(r.clipboardData?.files);!P||u.length===0||(r.preventDefault(),T(u,"pasted"))},ve=r=>{L(!1),P&&(r.preventDefault(),T(M(r.dataTransfer?.files),"dropped"))};return(0,t.jsxs)("div",{role:"group","aria-labelledby":`${m}-label`,"data-graview-file-editor":"","data-graview-dropping":D?"":void 0,onPaste:we,onDragOver:r=>{P&&(r.preventDefault(),L(!0))},onDragLeave:()=>L(!1),onDrop:ve,style:{display:"grid",gap:8,minWidth:0,padding:D?6:0,outline:D?"2px dashed var(--graview-accent)":"none",borderRadius:F},children:[(0,t.jsx)("span",{id:`${m}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:o}),e.length>0&&(a||e.length>1)?(0,t.jsx)("ul",{ref:J,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((r,u)=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[s&&k(r)?(0,t.jsx)(O,{file:r,size:40}):null,(0,t.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:r.name}),(0,t.jsx)(ue,{file:r,onCaption:h=>W(e.map((p,w)=>w===u?de(p,h):p),h?`${r.name} now says \u201C${h}\u201D.`:`${r.name} says its name again.`)}),a&&u>0?(0,t.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${r.name} earlier`,onClick:()=>W(e.map((h,p)=>p===u-1?r:p===u?e[u-1]:h),`Moved ${r.name} earlier.`,{at:u-1,what:"move"}),children:"\u2191"}):null,a?(0,t.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${r.name}`,onClick:()=>W(e.filter((h,p)=>p!==u),`Removed ${r.name}.`,{at:u,what:"remove"}),children:"Remove"}):null]},`${u}:${r.href}`))}):e.length===1?(0,t.jsx)(ue,{file:e[0],onCaption:r=>W([de(e[0],r)],r?`${e[0].name} now says \u201C${r}\u201D.`:`${e[0].name} says its name again.`)}):null,P?(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:a,...K?{accept:K}:{},"data-graview-file-input":"","aria-label":`Choose ${q}`,onChange:r=>{let u=M(r.currentTarget.files);r.currentTarget.value="",T(u,"picked")}}),(0,t.jsx)("button",{type:"button",disabled:f!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!a?`Replace ${i?"the picture":"the file"}`:`Choose ${q}`}),G?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:l,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:r=>{let u=M(r.currentTarget.files);r.currentTarget.value="",T(u,"camera")}}),be?(0,t.jsx)("button",{type:"button",disabled:f!==null,onClick:()=>l.current?.click(),children:"Take a photo"}):null]}):null,(0,t.jsxs)("span",{style:C,"data-graview-file-takes":"",children:["or drop or paste ",a?"them":"it"," here \xB7 ",d.kinds.length>0?ce(x.length>0?x:d.kinds):"any file",", up to ",H(d.maxBytes)]})]}):(0,t.jsx)("p",{style:{...C,margin:0},"data-graview-file-none":"",children:d?"This host doesn\u2019t take pictures, so none can be added here.":"This host doesn\u2019t take files, so none can be added here."}),(0,t.jsx)("p",{"aria-live":"polite",style:{...C,margin:0,minHeight:f||$?void 0:0},"data-graview-file-status":"",children:f??$??""}),A.length>0?(0,t.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:A.map((r,u)=>(0,t.jsx)("p",{style:{margin:0},children:r},u))}):null]})}var de=(e,n)=>{let{caption:a,...i}=e;return n?{...i,caption:n}:i};function ue({file:e,onCaption:n}){let[a,i]=(0,g.useState)(e.caption??"");(0,g.useEffect)(()=>i(e.caption??""),[e.caption]);let o=()=>{let s=a.trim().slice(0,500);s!==(e.caption??"")&&n(s)};return(0,t.jsx)("input",{type:"text",value:a,placeholder:k(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${k(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:s=>i(s.target.value),onBlur:o,onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),o())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function ye({field:e,label:n,labelStyle:a,valueStyle:i,style:o,children:s}){return(0,t.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...o},children:[(0,t.jsx)("dt",{style:a,children:n}),(0,t.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...i},children:s})]})}function fe(e){let{nodeId:n,field:a,label:i,files:o}=e,{fields:s,commit:d}=re(n),m=s.find(y=>y.field===a&&y.takesValue),c=m?.shape,l=c?.type==="several"?c.of:c,f=c?.type==="several";return o.length===0&&l?.type!=="file"?null:(0,t.jsxs)(ye,{...e,children:[(0,t.jsx)(N,{files:o,label:i}),m&&l?.type==="file"?(0,t.jsx)(me,{value:o,thumbs:!1,several:f,image:l.image===!0,label:i,onChange:y=>{let $=f?y:y[y.length-1];$!==void 0&&d(m,$)}}):null]})}function Le(e){switch(e.as){case"field":return e.read?e.files.length>0?(0,t.jsx)(ye,{...e,children:(0,t.jsx)(N,{files:e.files,label:e.label})}):null:(0,t.jsx)(fe,{...e});case"unfilled":return(0,t.jsx)(Pe,{...e});case"thumb":return(0,t.jsx)(O,{...e});case"block":return e.files.length>0?(0,t.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:X.raised}:{}},children:e.view==="thumb"?(0,t.jsx)(O,{file:e.files[0],size:72}):(0,t.jsx)(N,{files:e.files,label:e.label})}):null;case"control":{let n=(0,t.jsx)(me,{value:j(e.value),several:e.several,image:e.image,label:e.label,onChange:a=>e.onChange(e.several?a:a[a.length-1])});return e.title===void 0?n:(0,t.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,t.jsx)("legend",{"data-graview-part":"label",children:e.title}),n]})}}}function Pe({nodeId:e,skip:n,labels:a,labelStyle:i,style:o}){let{store:s}=te(),d=ne(e),m=d?s.schema.tryDefinition(d.kind):void 0,c=ae(m).filter(l=>!n.includes(l)&&!(m?.display?.hide??[]).includes(l)&&j(d?.[l]).length===0);return c.length===0?null:(0,t.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:c.map(l=>(0,t.jsx)(fe,{nodeId:e,field:l,label:a?.[l]??Q(m,l),files:[],...i?{labelStyle:i}:{},...o?{style:o}:{}},l))})}export{me as FilesEditor,$e as SEND_EDGE,Le as drawFiles,ce as kindsWords,Se as prepare,Ce as send,H as sizeWords,ge as takes,U as typeWords};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as Pe,b as $e}from"./chunk.5A4AOFOA.js";import"./chunk.OF34OZ4V.js";import"./chunk.R6K6GF5R.js";import"./chunk.3AGY4QVS.js";import{i as Ee,j as He}from"./chunk.BNV77BQZ.js";import"./chunk.SYAEBGDC.js";import"./chunk.YIR7PPF3.js";import"./chunk.EBGAYL32.js";import"./chunk.DAZ2VSRD.js";import"./chunk.HJCQ6I3S.js";import"./chunk.MWGGV7DE.js";import"./chunk.JQU5GEU3.js";import"./chunk.HAIG6NVX.js";import"./chunk.UZGRRDHD.js";import"./chunk.XANVHJQ4.js";import"./chunk.OKRNJXTV.js";import"./chunk.CAVBSL27.js";import"./chunk.COQKECUH.js";import{a as ze,b as x}from"./chunk.EJPI3ST6.js";import"./chunk.3K6YSVHC.js";import"./chunk.SHTJZ6UX.js";import{b as Te,c as Me}from"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.G5NZVPJU.js";import"./chunk.ULRW47RP.js";import"./chunk.PBSMLINK.js";import"./chunk.3TY5NFLY.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import{t as Ce}from"./chunk.XMC7YDWT.js";import"./chunk.6UGEYZAC.js";import"./chunk.OJGHDWI6.js";import{g as Ae}from"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import{c as Se}from"./chunk.UGFJKSHU.js";import{m as ke}from"./chunk.JOOQUWLT.js";import{F as Ge,Q as we,Y as W,i as ve,na as Q,sa as be,v as ye,wa as xe}from"./chunk.6QWV5MVH.js";import{Jb as me,da as K,ea as L,ec as fe,kb as he}from"./chunk.MNP4JI33.js";import{b as Y}from"./chunk.AJZBJBMO.js";var a=Y(Ge(),1);var n=Y(we(),1);function dt({placement:d="float",chosen:o=!0}={}){let{menuAt:r}=W();return d==="menu"&&r===null?o?(0,n.jsx)(Je,{}):null:(0,n.jsx)(Xe,{placement:d})}function Je(){let{store:d,setMenuAt:o,view:r}=W(),{selection:f}=Q(),h=(0,a.useRef)(null),[p,k]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let v=h.current?.offsetParent??h.current?.parentElement;if(!v)return;let w=Math.round(v.getBoundingClientRect().width);w!==p&&k(w)});let S=f.length===1&&!r.overview?d.graph.getNode(f[0]):void 0;return!S||p===null||p>=Re?(0,n.jsx)("span",{ref:h,hidden:!0}):(0,n.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${x(d,S.id)}`,"aria-haspopup":"menu",onClick:v=>{let w=v.currentTarget.getBoundingClientRect();o({x:Math.round(w.right),y:Math.round(w.bottom+4),on:S.id})},style:{position:"absolute",right:"calc(14px + var(--graview-dock, 0px))",top:98,zIndex:"var(--graview-layer-overview, 10)",minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var Re=564;function Xe({placement:d}){let{store:o,menuAt:r,setMenuAt:f,view:h}=W(),p=(0,a.useRef)(null),k=(0,a.useRef)(null),S=(0,a.useRef)(null),v=(0,a.useRef)(null);r?.returnTo&&(v.current=r.returnTo);let w=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),t=e.getAttribute("data-pin-for"),g=i??e.getAttribute("data-affordance")??(t===null?null:`pin:${t}`)??e.getAttribute("data-menu-item");k.current=g===null?null:{key:g,element:e}};(0,a.useEffect)(()=>{let e=p.current,i=k.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let t=i.key;if(!e){k.current=null;let H=v.current;v.current=null,(H?.isConnected?H:S.current)?.focus();return}((t.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(t.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(t)}"]:not([disabled])`)??e).focus()});let[Le,We]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let e=p.current?.offsetParent??p.current?.parentElement;if(e instanceof HTMLElement&&(S.current=e),!e)return;let i=e.getBoundingClientRect();We(t=>t&&t.left===i.left&&t.top===i.top&&t.width===i.width&&t.height===i.height?t:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Ne,set:De,clear:Oe}=Q(),s=r?.about??Ne,[N,Fe]=(0,a.useState)(()=>Pe()),D=r?.on??s[s.length-1],O=r?.about,qe=(0,a.useMemo)(()=>({pins:N,...D===void 0?{}:{focus:D},...O?{about:O}:{}}),[N,D,O]),Be=(0,a.useMemo)(()=>new Set(o.allMutations().filter(e=>e.pinned).map(e=>e.name)),[o]),{affordances:c,withheld:m,observations:G}=Ee(qe),je=r===null?null:{face:r.face??"scene",on:r.on,about:s,field:r.field,place:r.place,href:r.href,act:r.act,element:r.returnTo},J=Ce(je),X=G.some(e=>e.id.startsWith("schema:waits:")),{apply:Ue,preview:_e}=He(),[C,z]=(0,a.useState)(null),[Ve,Z]=(0,a.useState)(!1),[ee,te]=(0,a.useState)(!1),[P,$]=(0,a.useState)(""),[ne,F]=(0,a.useState)(null),q=(0,a.useRef)([]),B=(e,i)=>{try{return _e(e,i),Ue(e,i),F(null),f(null),q.current=[],!0}catch(t){return F(Ae(o.schema,o.allMutations(),t)),q.current=t instanceof he?t.issues.map(g=>String(g.path[0]??"")).filter(Boolean):[],!1}},I=[...new Set(s.flatMap(e=>{let i=o.graph.getNode(e);return i?[i.kind]:[]}))],b=I.length>0?I:[...new Set(s.flatMap(e=>ye(e)))],u=s.length===1?ve(s[0]):null,j=u?{from:o.graph.getNode(u.from),to:o.graph.getNode(u.to)}:null,ie=u?Me(o,u):void 0,re=ie?.provisional?ie:void 0,ae=u?(()=>{let e=o.schema.tryDefinition(o.graph.getNode(u.from)?.kind??"")?.edges?.[u.kind],i=o.graph.getNode(u.to);return e?.inverse&&i?`From ${x(o,i.id)}: ${e.inverse}`:null})():null;(0,a.useEffect)(()=>{z(null),Z(!1),te(!1),F(null),$("")},[s,r?.about]);let l=r!==null,Ye=d==="menu"&&!l,A=(0,a.useRef)(r);A.current=r;let oe=xe("acts",{open:l&&d==="menu",onOpenChange:e=>{e||f(null)},at:()=>A.current?{x:A.current.x,y:A.current.y}:null,returnTo:()=>{let e=A.current?.returnTo;if(e?.isConnected)return e;let i=A.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),le=(Le?.width??Number.POSITIVE_INFINITY)<Re;if((0,a.useLayoutEffect)(()=>{let e=p.current?.offsetParent;if(!e||!le||l)return;let i=p.current?.getBoundingClientRect().height??0,t=`${Math.round(i)+20}px`;if(e.style.paddingBottom===t)return;let g=e.style.paddingBottom;return e.style.paddingBottom=t,()=>{e.style.paddingBottom=g}}),s.length===0&&!l)return null;let se=r?.title!==void 0||s.length>0&&!(s.length===1&&s[0]===h.focusId),de=Math.max(1,Math.min(9,c.length)),T=[...c.filter(e=>e.provider==="invariant"&&!e.destructive),...c.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...c.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...c.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...c.filter(e=>e.destructive)],ue=T.length>de&&!l,pe=P.trim().toLowerCase(),y=ue&&pe.length>0?T.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(pe)):null,U=y??(Ve||l?T:T.slice(0,de)),ce=y?0:T.length-U.length,R=[];for(let e of U){let i=!l&&e.provider==="invariant",t=!l&&!i&&e.pinned!==void 0&&!e.destructive,g=!l&&!i&&!t&&e.ties===!0&&!e.destructive,H=i?e.why:t?"pinned":g?"its ties":null,Qe=i?"violation":t||g?"ties":null,V=R[R.length-1];V&&V.heading===H?V.items.push(e):R.push({heading:H,tone:Qe,items:[e]})}let _=c.find(e=>e.id===C),E=s.length===1?x(o,s[0]):null,ge=e=>{if(!E)return e;let i=e.startsWith(`"${E}"`)?e.slice(E.length+2):e.startsWith(E)?e.slice(E.length):null;if(i===null)return e;let t=i.trimStart();return t.length===0?e:t[0].toUpperCase()+t.slice(1)},Ke=new Set(l?[]:U.filter(e=>e.provider==="invariant").map(e=>e.why)),M=G.filter(e=>!Ke.has(e.text)).map(e=>({...e,text:ge(e.text)}));return Ye?null:(0,n.jsxs)("section",{...l?oe.pane:{},ref:e=>{p.current=e,l&&oe.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":l?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>w(e.target),onBlur:e=>{e.relatedTarget!==null&&(k.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...l?be:{position:"absolute",zIndex:fe("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...l?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:le?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:h.overview?"min(296px, 38cqh)":44,width:236,maxHeight:h.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,n.jsx)("h2",{style:{...ke,margin:0},children:"Inspector"}),(0,n.jsxs)("div",{style:{display:se||!l?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:l?0:24},children:[se?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:r?.title??(s.length===1?x(o,s[0]):`${s.length} selected`)}),I.length>0||u?(0,n.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:u?"relation":I.map(e=>L(o.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,s.length===1&&!u&&r?.face!=="pages"?(0,n.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:h.expanded.includes(s[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,n.jsx)("span",{style:{flex:"1 1 auto"}})]}),l?null:(0,n.jsx)("button",{type:"button",onClick:()=>{f(null),Oe()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),u&&j?(0,n.jsxs)("div",{style:{display:"grid",gap:6},children:[ae?(0,n.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:ae}):null,re?(0,n.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:Te(re)}):null,(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",j.from],["to",j.to]].map(([e,i],t)=>(0,n.jsxs)(a.Fragment,{children:[t===1?(0,n.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,n.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>De([i.id]),title:`Select ${x(o,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:x(o,i.id)}):(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!u&&s.length===1&&me(o,s[0])?(0,n.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,M.length>0?(0,n.jsx)("div",{"data-testid":"observations",title:M.map(e=>e.text).join(`
|
|
2
|
+
`),style:{display:"grid",gap:3},children:M.slice(0,2).map(e=>(0,n.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===M[1]&&M.length>2?(0,n.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",M.length-2]}):null]},e.id))}):null,l?J.start.map(e=>(0,n.jsx)(Ie,{section:e,close:()=>f(null)},e.id)):null,ne?(0,n.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:ne}):null,ue?(0,n.jsx)("input",{"data-testid":"action-filter",value:P,onChange:e=>$(e.target.value),placeholder:`Filter ${T.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),P.length>0?$(""):e.currentTarget.blur();return}if(e.key==="Enter"&&y?.length===1){let i=y[0];if(i.destructive)return;i.open.length>0?z(i.id):B(i)&&$("")}},style:{font:"inherit",fontSize:"0.875rem",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,y!==null&&y.length===0?(0,n.jsxs)("p",{"data-testid":"no-matches",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing offered here matches \u201C",P.trim(),"\u201D."]}):null,c.length===0&&!X&&s.length===0?null:c.length===0&&!X?(0,n.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:m.length>0?`Nothing you may do with ${u?"this relation":b.length===1?K(L(o.schema.tryDefinition(b[0]),b[0])):"this mix of kinds"} \u2014 ${m.length} action${m.length===1?"":"s"} withheld.`:u?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${Se(o.schema,o.graph.getNode(u.from)?.kind??"",u.kind,"out")}\u201D.`:`Nothing can be done with ${b.length===1?K(L(o.schema.tryDefinition(b[0]),b[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${b.length===1?"it":"them"}.`}):(0,n.jsxs)("ol",{"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[R.map((e,i)=>(0,n.jsxs)(a.Fragment,{children:[e.heading?(0,n.jsxs)("li",{"data-graview-heading":e.tone,style:{fontSize:"0.75rem",lineHeight:1.4,color:e.tone==="violation"?"var(--graview-warn)":"var(--graview-ink-faint)",...e.tone!=="violation"?{letterSpacing:"0.12em",textTransform:"uppercase",fontSize:"0.75rem"}:{},padding:"2px 2px 1px",marginTop:i>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?ge(e.heading):e.heading]}):i>0?(0,n.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(t=>(0,n.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},children:[(0,n.jsxs)("button",{type:"button","data-affordance":t.id,"data-rank":t.rank,"data-graview-destructive":t.destructive||void 0,"aria-pressed":C===t.id,title:t.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:C===t.id?"var(--graview-accent)":l?"transparent":"var(--graview-edge)",background:l?"none":"var(--graview-panel)",boxShadow:"none",...t.destructive?{color:"var(--graview-warn)"}:{},...C===t.id?{color:"var(--graview-accent)"}:{}},onClick:()=>{if(t.open.length>0){z(C===t.id?null:t.id);return}B(t)},children:[t.label,t.open.length>0?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,y?.length===1&&y[0]?.id===t.id&&!t.destructive?(0,n.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,n.jsx)("button",{type:"button","data-testid":"pin-toggle","data-pin-for":t.mutation,"aria-pressed":t.pinned!==void 0,"aria-label":t.pinned!==void 0?`Unpin ${t.label}`:`Pin ${t.label}`,title:t.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":t.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>Fe($e(N,t.mutation,Be.has(t.mutation))),style:{flex:"0 0 auto",width:24,minHeight:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.75rem",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7,color:t.pinned==="user"?"var(--graview-accent)":t.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:t.pinned!==void 0?"\u2605":"\u2606"})]},t.id))]},`${e.heading??"plain"}-${i}`)),ce>0?(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",onClick:()=>Z(!0),title:`Show all ${c.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",ce," more"]})}):null]}),m.length>0?(0,n.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[m.slice(0,l||ee?m.length:3).map(e=>(0,n.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,n.jsx)("button",{type:"button",disabled:!0,"data-affordance":e.id,"data-rank":e.rank,"data-withheld":e.refusal.wouldNeed.join(",")||"nobody",style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8,borderStyle:"dashed",width:"100%",textAlign:"left",background:"none"},children:(0,n.jsx)("s",{children:e.label})}),(0,n.jsx)("span",{"data-testid":"withheld-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:e.refusal.message})]},e.id)),!l&&!ee&&m.length>3?(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>te(!0),title:`Show all ${m.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",m.length-3," more withheld"]})}):null]}):null,l?J.end.map(e=>(0,n.jsx)(Ie,{section:e,close:()=>f(null)},e.id)):null,_?(0,n.jsx)(ze,{affordance:_,onApply:e=>{if(B(_,e))z(null);else return q.current},onCancel:()=>z(null)}):null]})}function Ie({section:d,close:o}){return(0,n.jsxs)("div",{"data-menu-section":d.id,...d.heading?{role:"group","aria-label":d.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[d.heading?(0,n.jsx)("p",{"aria-hidden":"true",style:{margin:0,padding:"2px 2px 1px",fontSize:"0.75rem",lineHeight:1.4,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:d.heading}):null,d.items&&d.items.length>0?(0,n.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:d.items.map(r=>(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-menu-item":r.id,onClick:()=>{o(),r.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},children:[r.label,r.hint?(0,n.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",r.hint]}):null]})},r.id))}):null,d.render?.(o)]})}export{dt as InspectorPane};
|