graview 0.1.27 → 0.1.28
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.FS5K4AVA.js → chunk.22H4JXTH.js} +1 -1
- package/dist/preview/{chunk.7SVIRYBB.js → chunk.25OYH6MY.js} +1 -1
- package/dist/preview/{chunk.LHAAZQNQ.js → chunk.2GBQJXJH.js} +1 -1
- package/dist/preview/chunk.2VUG6EAN.js +1 -0
- package/dist/preview/chunk.337WDTG3.js +2 -0
- package/dist/preview/{chunk.UPGDSOBY.js → chunk.3HLLQ5CJ.js} +1 -1
- package/dist/preview/{chunk.UMMN5Z6V.js → chunk.46KUPBQC.js} +1 -1
- package/dist/preview/{chunk.4R7LDCDO.js → chunk.4H7CQE56.js} +1 -1
- package/dist/preview/{chunk.7THQFY52.js → chunk.4RO5DA22.js} +1 -1
- package/dist/preview/{chunk.TX2GOL65.js → chunk.4TUNX4WM.js} +1 -1
- package/dist/preview/{chunk.IXVSJJQH.js → chunk.5BGA2VUS.js} +2 -2
- package/dist/preview/{chunk.T2EZ5MTH.js → chunk.7S22MBNN.js} +1 -1
- package/dist/preview/{chunk.KAKX5TZN.js → chunk.A73BXXE4.js} +2 -2
- package/dist/preview/chunk.ARE3MEDN.js +1 -0
- package/dist/preview/chunk.ASFZTYFO.js +1 -0
- package/dist/preview/{chunk.S5JWZIVE.js → chunk.BBJZ6O7J.js} +1 -1
- package/dist/preview/{chunk.NQNQPPPM.js → chunk.BCBH6WJF.js} +1 -1
- package/dist/preview/{chunk.ZNIJONZN.js → chunk.CAZAB352.js} +1 -1
- package/dist/preview/chunk.CY7MDLRS.js +1 -0
- package/dist/preview/chunk.DAVRLRGB.js +1 -0
- package/dist/preview/{chunk.IZDKEFPJ.js → chunk.DCIC3YHX.js} +1 -1
- package/dist/preview/{chunk.DQ5OWYLQ.js → chunk.EW4JFOJY.js} +1 -1
- package/dist/preview/{chunk.5BN2ARQ2.js → chunk.EYF6ONTA.js} +1 -1
- package/dist/preview/{chunk.Q7544RCB.js → chunk.FP27W5MU.js} +1 -1
- package/dist/preview/{chunk.U5ZUXGWM.js → chunk.G2OOBROL.js} +1 -1
- package/dist/preview/{chunk.7CO6VP6F.js → chunk.GCKSQ52O.js} +1 -1
- package/dist/preview/{chunk.VD6FJ6KJ.js → chunk.GE5EAN36.js} +1 -1
- package/dist/preview/chunk.HOPIZMJR.js +2 -0
- package/dist/preview/{chunk.VMD4PDYJ.js → chunk.IBGO4BUF.js} +1 -1
- package/dist/preview/{chunk.OA5BVKJH.js → chunk.IDI2BQ7Y.js} +1 -1
- package/dist/preview/{chunk.MNPNW4BQ.js → chunk.IH42QTOM.js} +1 -1
- package/dist/preview/{chunk.CW7BMVBG.js → chunk.ISRS7GOT.js} +1 -1
- package/dist/preview/{chunk.AS35X6KA.js → chunk.J6CBMLGR.js} +1 -1
- package/dist/preview/{chunk.4JXWQO6Y.js → chunk.JRCV6HVV.js} +1 -1
- package/dist/preview/{chunk.ATLUMYAJ.js → chunk.KWW3YHQ4.js} +1 -1
- package/dist/preview/{chunk.VMEX2KZ4.js → chunk.MKNXV4TM.js} +7 -7
- package/dist/preview/{chunk.V57P4LIZ.js → chunk.MVNIKZIC.js} +1 -1
- package/dist/preview/{chunk.DG2WKNMX.js → chunk.N2WTNKEV.js} +1 -1
- package/dist/preview/{chunk.VFICMX5G.js → chunk.N7HCALRK.js} +1 -1
- package/dist/preview/{chunk.OYULDOQP.js → chunk.NRRUGG22.js} +1 -1
- package/dist/preview/{chunk.ZMMMKTAG.js → chunk.OGL4PHTY.js} +1 -1
- package/dist/preview/{chunk.FTBKJ5RZ.js → chunk.PFQFPJ5L.js} +1 -1
- package/dist/preview/{chunk.EVTZE2OZ.js → chunk.PN2H6X7O.js} +1 -1
- package/dist/preview/{chunk.7QTBDACG.js → chunk.PWHJHFC4.js} +1 -1
- package/dist/preview/{chunk.4W24TPMR.js → chunk.Q3HVA6L4.js} +1 -1
- package/dist/preview/{chunk.LQZ2VQWN.js → chunk.RZLNDVGN.js} +2 -2
- package/dist/preview/{chunk.HPD3DSTP.js → chunk.SBHVVJY7.js} +1 -1
- package/dist/preview/{chunk.QZWN46V6.js → chunk.SNBIZ3B6.js} +1 -1
- package/dist/preview/chunk.TBG2QBOS.js +1 -0
- package/dist/preview/chunk.VR735ZQL.js +1 -0
- package/dist/preview/{chunk.YO7UFBJP.js → chunk.VSXCXPK2.js} +1 -1
- package/dist/preview/{chunk.TMPV4HLQ.js → chunk.W3LDQ6B2.js} +1 -1
- package/dist/preview/{chunk.YV2RTNPU.js → chunk.WCNONCTL.js} +1 -1
- package/dist/preview/{chunk.XDHBV5K5.js → chunk.WHTNSETN.js} +1 -1
- package/dist/preview/{chunk.NKIFVPS3.js → chunk.XG67BWH6.js} +1 -1
- package/dist/preview/{chunk.DG2UE7PJ.js → chunk.XRM6WXPW.js} +1 -1
- package/dist/preview/chunk.Y5LPZLDE.js +1 -0
- package/dist/preview/{chunk.E3SZ7T75.js → chunk.YETBY2LM.js} +1 -1
- package/dist/preview/chunk.ZEUBAAVQ.js +1 -0
- package/dist/preview/{chunk.PHY3AH3L.js → chunk.ZJDRD6PO.js} +1 -1
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.DY2FFBWF.js +0 -1
- package/dist/preview/chunk.GHMICJIB.js +0 -1
- package/dist/preview/chunk.HO6JR7VY.js +0 -1
- package/dist/preview/chunk.I5KD54S6.js +0 -1
- package/dist/preview/chunk.J36GTQTV.js +0 -1
- package/dist/preview/chunk.MHJJEGQO.js +0 -1
- package/dist/preview/chunk.OHGJ5BZ4.js +0 -2
- package/dist/preview/chunk.RUC4HFVC.js +0 -1
- package/dist/preview/chunk.SHDYLMZE.js +0 -2
- package/dist/preview/chunk.ZD5HGRPR.js +0 -1
- package/dist/preview/chunk.ZKM4P7US.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as he,B as ke,C as ta,D as At,E as pe,F as na,G as aa,H as L,I as De,J as Lt,K as ra,L as Tt,M as it,N as ia,O as U,P as J,Q as Mt,a as G,b as ye,c as q,d as Qn,e as Pe,f as Ne,g as D,h as ne,i as Y,j as k,k as _,l as F,m as X,n as tt,o as ee,p as Xn,q as nt,r as at,s as I,t as Ce,u as Zn,v as rt,w as le,x as ea,y as de,z as Rt}from"./chunk.
|
|
1
|
+
import{A as he,B as ke,C as ta,D as At,E as pe,F as na,G as aa,H as L,I as De,J as Lt,K as ra,L as Tt,M as it,N as ia,O as U,P as J,Q as Mt,a as G,b as ye,c as q,d as Qn,e as Pe,f as Ne,g as D,h as ne,i as Y,j as k,k as _,l as F,m as X,n as tt,o as ee,p as Xn,q as nt,r as at,s as I,t as Ce,u as Zn,v as rt,w as le,x as ea,y as de,z as Rt}from"./chunk.4TUNX4WM.js";import{b as et,d as V}from"./chunk.7S22MBNN.js";import{a as _n,d as Yn,e as Jn}from"./chunk.ONDILMIX.js";import{a as Un,e as jn}from"./chunk.J6CBMLGR.js";import{a as Ct}from"./chunk.TBG2QBOS.js";import{a as Ze,b as qn}from"./chunk.BCBH6WJF.js";import{a as Pt,b as In,d as Hn,f as zn,g as Bn,h as Gn,k as Xe}from"./chunk.A73BXXE4.js";import{a as Na}from"./chunk.IKT7JQUW.js";import{h as $n,i as En}from"./chunk.ISRS7GOT.js";import{e as Wn,i as Vn}from"./chunk.DCIC3YHX.js";import{o as bt}from"./chunk.WHTNSETN.js";import{c as Fn,d as On,j as We}from"./chunk.46KUPBQC.js";import{a as Qe,b as Ln,c as Tn,e as St,f as Mn}from"./chunk.PWHJHFC4.js";import{e as xe}from"./chunk.Q3HVA6L4.js";import{f as Kn}from"./chunk.2GBQJXJH.js";import{b as Nn,c as xt,d as Dn}from"./chunk.SNBIZ3B6.js";import{a as wn,c as An}from"./chunk.6LJ66MB7.js";import{$ as bn,B as He,V as kn,X as Sn,aa as xn,ea as se,ia as Pn,ka as Ee,la as Cn,ua as Rn,x as vn}from"./chunk.NRRUGG22.js";import{$ as be,Ga as ln,Ha as dn,Hb as fn,Ja as pn,O as $e,P as _e,Q as re,R as Zt,T as ie,V as en,X as tn,Xa as cn,Xb as kt,Ya as gn,Yb as yn,_ as nn,_a as un,aa as an,ab as Ye,ac as hn,ba as rn,bb as mn,db as Je,la as vt,ma as on,ra as sn}from"./chunk.MKNXV4TM.js";import{a as ve,b as B}from"./chunk.MRK6QJV5.js";import{b as $}from"./chunk.AJZBJBMO.js";function oa(t,e,n={}){let r=t.graph.getNode(e);if(!r)return;let i=t.schema.tryDefinition(r.kind),a=s=>re(t.schema.tryDefinition(s.kind),s),d=new Map;for(let s of t.graph.allEdges()){let l=s.from===e?"out":s.to===e?"in":null;if(!l)continue;let o=l==="out"?s.to:s.from,c=t.graph.getNode(o);if(!c)continue;let u=(l==="out"?i:t.schema.tryDefinition(c.kind))?.edges?.[s.kind],g=l==="in"?u?.inverse??u?.description:u?.description,m=`${s.kind}|${l}|${g??""}`;(d.get(m)??(()=>{let E={edgeKind:s.kind,direction:l,...g?{description:g}:{},targets:[]};return d.set(m,E),E})()).targets.push({id:c.id,kind:c.kind,label:a(c)})}return{id:e,kind:r.kind,label:a(r),fields:an(We(t.schema,t.graph,r),i),violations:vt(t.violations(n.context),[e]),actions:Ct(t,[e],{focus:e,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...d.values()].map(s=>{let l=_e(s.targets.flatMap(o=>{let c=t.graph.getNode(o.id);return c?[c]:[]}),o=>t.schema.tryDefinition(o));return{...s,targets:[...s.targets].map(o=>l.has(o.id)?{...o,apart:l.get(o.id)}:o).sort((o,c)=>o.label.localeCompare(c.label))}})}}function Re(t,e,n={}){return{kind:e,members:t.graph.nodesOfKind(e),actions:Ct(t,[],{kindSelection:[e],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function sa(t,e){let n=(a,d)=>`${a}|${JSON.stringify(d)}`,r=new Map;for(let a of[...t.affordances,...t.withheld]){if(a.provider!=="invariant")continue;let d=n(a.mutation,a.args);r.has(d)||r.set(d,a.rank??Number.MAX_SAFE_INTEGER)}let i=Number.MAX_SAFE_INTEGER;return[...e].map((a,d)=>({repair:a,declared:d})).sort((a,d)=>(r.get(n(a.repair.mutation,a.repair.args??{}))??i)-(r.get(n(d.repair.mutation,d.repair.args??{}))??i)||a.declared-d.declared).map(a=>a.repair)}function Ae(t){let e=t.schema.kinds.map(i=>({kind:i,plural:tn(t.schema,i),count:t.graph.nodesOfKind(i).length})),n=new Map;for(let i of t.graph.allEdges()){let a=t.graph.getNode(i.from),d=t.graph.getNode(i.to);if(!a||!d)continue;let s=`${i.kind}|${a.kind}|${d.kind}`;n.set(s,(n.get(s)??0)+1)}let r=[];for(let{kind:i}of e){let a=t.schema.tryDefinition(i)?.edges??{};for(let[d,s]of Object.entries(a)){let l=s.to==="*"||s.to===void 0?(()=>{let o=[...n.keys()].filter(c=>c.startsWith(`${d}|${i}|`)).map(c=>c.split("|")[2]);return o.length>0?o:["*"]})():s.to;for(let o of l)r.push({edgeKind:d,from:i,to:o,...s.description?{description:s.description}:{},...s.inverse?{inverse:s.inverse}:{},count:n.get(`${d}|${i}|${o}`)??0})}}return{kinds:e,relations:r}}var Te=$(ve(),1);var Ft=$(ve(),1),S=$(B(),1),Da=`
|
|
2
2
|
form:where([data-graview-part="form"]) {
|
|
3
3
|
/* A grid item of the section above it and a grid container for the
|
|
4
4
|
fields below: both halves are allowed to be narrower than what is in
|
|
@@ -104,4 +104,4 @@ p:where([data-graview-part="refused"]) {
|
|
|
104
104
|
.graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
|
|
105
105
|
.graview-gallery-card:hover > span:first-child,
|
|
106
106
|
.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); }
|
|
107
|
-
`;function Nt({context:t}){V(t.store);let e=Et(t);return e.length===0?null:(0,b.jsxs)("section",{style:ca,"data-testid":"gallery",children:[(0,b.jsx)("style",{children:Ga}),e.map(n=>(0,b.jsx)(Wt,{context:t,entry:n},n.key))]})}function Dt({context:t}){let{store:e}=t;V(e);let n=ce(t),r=Et(t);return(0,b.jsxs)(U,{context:t,style:Ne,children:[(0,b.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,b.jsx)("p",{style:ne,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,b.jsx)(J,{context:t,children:"Pictures"}),(0,b.jsx)("p",{style:Y,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."})]}),r.length>0?(0,b.jsx)("div",{style:ca,"data-testid":"places",children:r.map(i=>(0,b.jsx)(Wt,{context:t,entry:i},i.key))}):null]})}function It({context:t}){let{store:e,principal:n}=t;V(e);let r=ke(),i=he(),[a]=De(),d=decodeURIComponent(r.as??""),[s,l]=(0,Te.useState)(null),o=a.get("of"),f=ce(t).find(x=>x.as===d&&(!o||G(e.schema,x.kind)===o));if(!f)return(0,b.jsxs)(U,{context:t,children:[(0,b.jsx)(J,{context:t,children:"No picture is called that."}),(0,b.jsx)("p",{style:Y,children:(0,b.jsx)(L,{to:"/places",style:F,children:"The pictures there are \u2192"})})]});let u=I(e,f.kind),m=Re(e,f.kind,{...n?{principal:n}:{},...t.invariantContext?{context:t.invariantContext}:{}}).actions.affordances.map(x=>({affordance:x,mutation:e.allMutations().find(E=>E.name===x.mutation)})).filter(x=>x.mutation!==void 0);return(0,b.jsxs)(U,{context:t,style:Ne,children:[(0,b.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,b.jsx)(J,{context:t,children:f.title}),(0,b.jsxs)("p",{style:Y,"data-testid":"place-lede",children:[Ot(e,f.kind,f.across),"."]}),(0,b.jsx)("p",{style:{...k,margin:0},children:(0,b.jsxs)(L,{to:`/${G(e.schema,f.kind)}`,style:{...F,...k},"data-testid":"place-as-list",children:["All ",u.toLowerCase()," as a list \u2192"]})})]}),(0,b.jsx)("div",{"data-testid":"place-lens",style:{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:x=>{let E=x.target?.closest("[data-graview-pick]"),C=E?.getAttribute("data-graview-pick"),K=E?.getAttribute("data-graview-joins");if(K)try{let Q=JSON.parse(K);if(Array.isArray(Q)&&Q.every(we=>typeof we=="string")){x.preventDefault(),l({at:Le(f),ids:Q});return}}catch{}if(!C)return;let ue=e.graph.getNode(C);ue&&(x.preventDefault(),i(q(e.schema,ue.kind,C)))},children:(0,b.jsx)($t,{context:t,place:f,...s?.at===Le(f)?{chosen:s.ids}:{}})}),(0,b.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},children:m.map(({affordance:x,mutation:E})=>(0,b.jsxs)("section",{style:{..._,display:"grid",gap:14},children:[(0,b.jsx)("h2",{style:D,children:E.title??E.name}),E.description?(0,b.jsx)("p",{style:{...k,margin:0,maxWidth:"58ch"},children:E.description}):null,(0,b.jsx)(fe,{store:e,mutation:E,prefilled:x.args,open:x.open,label:x.label,...n?{principal:n}:{}})]},x.id))})]})}var W=$(ve(),1);var Me=$(ve(),1);function ga(t,e,n){let r=Math.max(0,t.left),i=Math.min(e.width,t.right),a=Math.max(0,t.top),d=Math.min(e.height,t.bottom);return{shown:d-a>=n.height+2*16&&i-r>=n.width+2*16,left:Math.round(r),top:Math.round(a),width:Math.round(Math.max(0,i-r)),height:Math.round(Math.max(0,d-a))}}function ua(t,e,n){let r=t.style;r.left=`${e.left}px`,r.top=`${e.top}px`,r.right="auto",r.bottom="auto",r.visibility=n?"":"hidden";let i=t.getBoundingClientRect();i.width!==0&&(r.left=`${Math.round(2*e.left-i.left)}px`,r.top=`${Math.round(2*e.top-i.top)}px`)}var Se=$(B(),1);function ma({context:t}){let e=he(),n=se(),{pathname:r}=de(),[,i,a]=r.split("/"),d=i==="places"&&a?decodeURIComponent(a):void 0,s=(0,Me.useRef)(null);return Va(s,n!==null),n?(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(Ua,{context:t}),(0,Se.jsx)("div",{ref:s,"data-testid":"page-seat",style:{position:"fixed",left:0,top:0,width:"100vw",height:"100dvh",pointerEvents:"none",zIndex:fn("rail"),containerType:"size"},children:(0,Se.jsx)(Un,{onPick:l=>{let o=t.store.graph.getNode(l);o&&e(q(t.store.schema,o.kind,l))},onMove:l=>{if(n.seatTalk.get().draft&&n.seatTalk.setDraft(null),l.to==="place"&&(l.face==="scene"||l.slug==="overview")){t.overview?t.overview("#"):t.embedded||window.location.assign(t.sceneHref??"/");return}e(l.address)},...d?{place:d}:{},onDraft:()=>{r!=="/~draft"&&e("/~draft")}})})]}):null}var qa={width:160,height:40};function Va(t,e){let{pathname:n}=de(),r=An(e);(0,Me.useLayoutEffect)(()=>{let i=t.current;if(!i)return;let a=i.parentElement?.closest("[data-embed-content]")??null,d=()=>a??document.querySelector("main")??null,s=()=>{let f=d(),u={width:document.documentElement.clientWidth||innerWidth,height:r??innerHeight},g=f?.getBoundingClientRect()??{left:0,top:0,right:u.width,bottom:u.height},m=ga(a?g:{left:g.left,right:g.right,top:g.top,bottom:Math.max(g.bottom,u.height)},u,qa);i.style.width=`${m.width}px`,i.style.height=`${m.height}px`,ua(i,m,m.shown)};s(),addEventListener("resize",s),addEventListener("scroll",s,!0);let l=0,o=typeof ResizeObserver=="function"?new ResizeObserver(()=>{cancelAnimationFrame(l),l=requestAnimationFrame(s)}):null,c=d();return c&&o?.observe(c),()=>{cancelAnimationFrame(l),o?.disconnect(),removeEventListener("resize",s),removeEventListener("scroll",s,!0)}},[t,e,n,r])}function Ua({context:t}){let{store:e}=t,n=se(),{pathname:r}=de(),i=(0,Me.useRef)(n?.setSelection);return i.current=n?.setSelection,(0,Me.useEffect)(()=>{let a=i.current;if(!a)return;let[,d,s]=r.split("/"),l=(()=>{if(d==="places"){let c=t.views?.places().find(f=>f.as===decodeURIComponent(s??""));return c?[He(c.kind)]:[]}let o=d?ye(e.schema,d):void 0;return o&&s?[decodeURIComponent(s)]:o?[vn(o)]:[]})();a(o=>o.length===l.length&&o.every((c,f)=>c===l[f])?o:l)},[r]),null}var te=$(ve(),1);var ya=$(Na(),1);var Z=$(B(),1);var ja=(0,te.lazy)(wn(()=>import("./chunk.YO7UFBJP.js").then(t=>({default:t.TakeBack}))));function _a({context:t,docked:e,at:n}){let{store:r}=t,i=V(r),[a]=(0,te.useState)(()=>r.batches().length),d=(0,te.useRef)(!1);return d.current||=i>0||!e&&a>0,d.current?(0,Z.jsx)(te.Suspense,{fallback:null,children:(0,Z.jsx)(ja,{context:t,docked:e,at:n,since:a})}):null}function Ya(t,e,n){let{store:r,principal:i,embedded:a}=t;(0,te.useEffect)(()=>{if(!n)return;let d=s=>{if(!Jn(s))return;let l=s.target,o=l instanceof Node&&e.current?.contains(l),c=l===document.body||l===document.documentElement||l===document;if(!(!o&&!(c&&!a))&&_n(r,i)){s.preventDefault();try{Yn(r,i)}catch{}}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[r,i,a,e,n])}function ha({context:t,registry:e,root:n,children:r}){let i=(0,te.useMemo)(ra,[]),a=e?.without()??new Set;return Ya(t,n,!a.has("undo")),(0,Z.jsxs)(Lt.Provider,{value:i,children:[(0,Z.jsx)(Ja,{context:t,placed:i,without:a}),r]})}function Ja({context:t,placed:e,without:n}){let[r,i]=(0,te.useState)(!1);(0,te.useLayoutEffect)(()=>i(!0),[]);let a=Tt(e,"find"),d=Tt(e,"undo"),s=de(),l=En();if(!r)return null;let o=s.pathname.split("/").filter(Boolean),f=(o.length===1?ye(t.store.schema,o[0]):void 0)!==void 0;return(0,Z.jsxs)(Z.Fragment,{children:[!a&&!n.has("find")&&l?(0,ya.createPortal)((0,Z.jsx)(fa,{context:t,narrowsLists:f}),l.slot):null,!a&&!n.has("find")&&!l?(0,Z.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,Z.jsx)(fa,{context:t,narrowsLists:f})}):null,!d&&!n.has("undo")?(0,Z.jsx)(_a,{context:t,docked:!0,at:s.pathname+s.search}):null,l?.own&&!n.has("undo")?(0,Z.jsx)(ea,{context:t,own:l.own}):null]})}function fa({context:t,narrowsLists:e}){return(0,Z.jsx)(Lt.Provider,{value:null,children:(0,Z.jsx)(Mt,{context:t,narrowsLists:e})})}var T=$(B(),1);function wa(t,e){return e==="*"?{label:"anything",path:null}:{label:I(t,e),path:`/${G(t.schema,e)}`}}function Qa({context:t,relation:e}){let{store:n}=t,r=wa(n,e.from),i=wa(n,e.to),a=d=>d.path?(0,T.jsx)(L,{to:d.path,style:{...X,fontWeight:550},children:d.label}):(0,T.jsx)("span",{children:d.label});return(0,T.jsxs)("li",{"data-testid":"relation","data-relation":e.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,T.jsx)(jn,{edgeKind:e.edgeKind,...t.brand?.kit?{kit:t.brand.kit}:{}}),(0,T.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,T.jsxs)("span",{children:[a(r)," ",(0,T.jsxs)("span",{style:k,"data-graview-speaks-ids":"",children:[ie(e.edgeKind)," \u2192"]})," ",a(i)]}),e.description||e.inverse?(0,T.jsxs)("span",{style:{...k,fontSize:"0.9375rem"},children:[e.description?le(e.description):null,e.description&&e.inverse?" \xB7 ":null,e.inverse?`from the other end, ${e.inverse}`:null]}):null]}),i.path?(0,T.jsx)(L,{to:`${i.path}?with=${encodeURIComponent(e.edgeKind)}`,style:{...F,...k,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${i.label.toLowerCase()} that have this`,children:e.count}):(0,T.jsx)("span",{style:{...k,fontVariantNumeric:"tabular-nums"},children:e.count})]})}function va({context:t,heading:e=!0}){let{store:n}=t,r=new Set(Ce(n,t.principal)),i=Ae(n).relations.filter(a=>r.has(a.from)&&(a.to==="*"||r.has(a.to)));return i.length===0?null:(0,T.jsxs)("section",{style:{..._,display:"grid",gap:12},"data-testid":"kind-map",children:[e?(0,T.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,T.jsx)("h2",{style:D,children:(0,T.jsx)(L,{to:"/map",style:X,children:"Connections"})}),(0,T.jsx)("span",{style:k,children:i.length===1?"1 relation":`${i.length} relations`})]}):null,(0,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:i.map(a=>(0,T.jsx)(Qa,{context:t,relation:a},`${a.edgeKind}|${a.from}|${a.to}`))})]})}function Kt({context:t}){let{store:e}=t;V(e);let n=new Set(Ce(e,t.principal)),r=Ae(e),i=r.relations.filter(a=>n.has(a.from));return(0,T.jsxs)(U,{context:t,children:[(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)("p",{style:ne,children:i.length===0?"No relations":`${i.length} ${i.length===1?"relation":"relations"}`}),(0,T.jsx)(J,{context:t,children:"Connections"}),(0,T.jsx)("p",{style:Y,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,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:r.kinds.filter(a=>n.has(a.kind)).map(a=>(0,T.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,T.jsx)(ee,{kind:a.kind,brand:t.brand,schema:e.schema,size:7}),(0,T.jsx)(L,{to:`/${G(e.schema,a.kind)}`,style:F,children:a.plural}),(0,T.jsx)("span",{style:k,children:a.count})]},a.kind))}),(0,T.jsx)(va,{context:t,heading:!1})]})}function ka({context:t}){let n=[...se()?.robots.values()??[]].filter(i=>i.mode==="asking"&&i.say);if(n.length===0)return null;let{store:r}=t;return(0,T.jsxs)("section",{style:{..._,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,T.jsx)("h2",{style:D,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(i=>{let a=i.at?r.graph.getNode(i.at):void 0;return(0,T.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,T.jsx)("span",{children:i.say}),a?(0,T.jsxs)(L,{to:q(r.schema,a.kind,a.id),style:{...F,...k},children:[re(r.schema.tryDefinition(a.kind),a)," \u2192"]}):null]},i.participant)})})]})}var O=$(B(),1);function Ht({context:t}){let{principal:e}=t,{store:n,brand:r,invariantContext:i}=t;V(n);let a=n.violations(i),d=`${a.length===1?"A rule is broken":"Rules are broken"} \u2014 see what, and what would fix it`,s=[...n.log.all()].slice(-5).reverse(),o=rt(t).map(C=>({kind:C,members:n.graph.nodesOfKind(C).filter(K=>$e(n.schema.tryDefinition(C),K))})),c=o.filter(C=>C.members.length>0),f=o.map(C=>({entry:C,creator:n.allMutations().find(K=>(K.creates??[]).includes(C.kind)&&n.permits({name:K.name,args:{}},t.principal).ok)})).find(C=>C.creator!==void 0),u=c.length===0?"Nothing here yet.":`${c.map(C=>`${C.members.length} ${C.members.length===1?C.kind:I(n,C.kind).toLowerCase()}`).join(", ").replace(/, ([^,]*)$/," and $1")}.`,g=t.views?.homeView?.(),m=n.schema.kinds.some(C=>n.graph.nodesOfKind(C).length>0);if(g&&m){let C=r?.subtitle?(0,O.jsx)("p",{style:{...k,margin:0},"data-testid":"app-subtitle",children:r.subtitle}):null,K=g[Symbol.for("graview.home-blocks")]===!0;return(0,O.jsx)(U,{context:t,style:Ne,children:(0,O.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[K?null:C,a.length>0?(0,O.jsx)(L,{to:"/problems",style:{...F,color:"var(--graview-warn)"},children:d}):null,(0,O.jsx)(Gn.Provider,{value:K?C:null,children:(0,O.jsx)(g,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})]})})}let x=new Set(Ce(n,t.principal)),E=Ae(n).relations.filter(C=>x.has(C.from)&&(C.to==="*"||x.has(C.to)));return(0,O.jsxs)(U,{context:t,style:Ne,children:[(0,O.jsxs)("header",{style:{display:"grid",gap:12},children:[r?.subtitle?(0,O.jsx)("p",{style:{...k,margin:0},"data-testid":"app-subtitle",children:r.subtitle}):null,(0,O.jsx)(J,{context:t,"data-testid":"standing",children:u}),(0,O.jsxs)("p",{style:{...Y,display:"grid",gap:4},"data-testid":"standing-card",children:[c.length===0&&f?(0,O.jsxs)("span",{children:["Begin with \u201C",f.creator?.title??f.creator?.name,"\u201D, under"," ",(0,O.jsx)(L,{to:`/${G(n.schema,f.entry.kind)}`,style:F,children:I(n,f.entry.kind)}),"."]}):null,a.length===0?(0,O.jsx)("span",{children:"All rules hold."}):(0,O.jsx)(L,{to:"/problems",style:{...F,color:"var(--graview-warn)"},children:d})]})]}),(0,O.jsx)(Nt,{context:t}),(0,O.jsxs)("section",{style:{..._,display:"grid",gap:14},"data-testid":"kinds",children:[(0,O.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,O.jsx)("h2",{style:D,children:"What is here"}),E.length>0?(0,O.jsxs)(L,{to:"/map",style:{...F,...k,marginLeft:"auto"},"data-testid":"map-link",children:["Connections \xB7 ",E.length===1?"1 relation":`${E.length} relations`," \u2192"]}):null]}),(0,O.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:o.map(({kind:C,members:K})=>(0,O.jsx)("li",{style:{maxWidth:"100%"},children:(0,O.jsxs)(L,{to:`/${G(n.schema,C)}`,style:{...X,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,O.jsx)(ee,{kind:C,brand:r,schema:n.schema,size:7}),(0,O.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:I(n,C)}),(0,O.jsx)("span",{style:{...k,fontVariantNumeric:"tabular-nums"},children:K.length===0?"none yet":K.length})]})},C))})]}),s.length>0?(0,O.jsxs)("section",{style:{..._,display:"grid",gap:10},children:[(0,O.jsx)("h2",{style:D,children:"Recently"}),(0,O.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:s.map(C=>(0,O.jsxs)("li",{style:k,children:[(0,O.jsx)("span",{style:{color:"var(--graview-ink)"},children:C.intent})," \u2014 ",nt(C,e,{graph:n.graph,schema:n.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},C.id))})]}):null]})}var Fe=$(ve(),1);var R=$(B(),1);function zt({context:t}){let{store:e,brand:n,principal:r,invariantContext:i}=t;V(e);let[a]=De(),d=a.get("q")??"",s=typeof i?.today=="string"?i.today:void 0,l=un(e,d,{...r?{principal:r}:{},places:ce(t),flagged:new Set(e.violations(i).flatMap(g=>g.nodeIds)),...s?{today:s}:{},limit:200}),o=l.hits.filter(g=>g.about==="node"),c=l.hits.filter(g=>g.about==="kind"||g.about==="place"||g.about==="rule"),f=[...new Set(o.map(g=>g.kind))],u=d.trim();return(0,R.jsxs)(U,{context:t,children:[(0,R.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,R.jsx)("p",{style:ne,children:"Search"}),(0,R.jsx)(J,{context:t,"data-testid":"search-heading",children:u.length===0?"Find anything by its name":l.hits.length===0?(0,R.jsxs)(R.Fragment,{children:["Nothing here is called \u201C",u,"\u201D."]}):(0,R.jsxs)(R.Fragment,{children:[Xa(e,l.byKind)," for \u201C",u,"\u201D"]})}),u.length>0?(0,R.jsxs)("p",{style:{...k,margin:0},"data-testid":"search-searched",children:[Ye(e.schema,l.searched),l.conditions.filter(g=>g.key!=="is"&&g.admittedBy.length<l.searched.kinds.length).map(g=>(0,R.jsxs)("span",{children:[" ",g.key,":",g.value," narrows"," ",g.admittedBy.length===0?"nothing here":g.admittedBy.map(m=>I(e,m).toLowerCase()).join(" and "),"."]},`${g.key}:${g.value}`))]}):(0,R.jsxs)("p",{style:Y,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,R.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,R.jsx)("code",{children:"is:any"})," includes what is past."]})]}),c.length>0?(0,R.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:c.map(g=>(0,R.jsx)("li",{"data-testid":"search-hit","data-about":g.about,children:g.about==="kind"?(0,R.jsxs)(L,{to:`/${G(e.schema,g.kind)}`,style:F,children:[g.label,g.count>0?(0,R.jsxs)("span",{style:k,children:[" \xB7 ",g.count," match"]}):null]}):g.about==="place"?(0,R.jsxs)(L,{to:ge(t,g),style:F,children:["Go to ",g.title]}):g.about==="rule"?(0,R.jsxs)(L,{to:"/problems",style:F,children:["The rule \u201C",g.label,"\u201D"]}):null},`${g.about}:${g.about==="rule"?g.name:g.about==="place"?g.as:g.kind}`))}):null,f.map(g=>(0,R.jsxs)("section",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:0,minWidth:0},"data-testid":"search-group","data-kind":g,children:[(0,R.jsxs)("h2",{style:{...D,fontSize:"1.0625rem",marginBottom:4,display:"flex",alignItems:"center",gap:8},children:[(0,R.jsx)(ee,{kind:g,brand:n,schema:e.schema,size:8}),(0,R.jsx)(L,{to:`/${G(e.schema,g)}?${new URLSearchParams({q:u}).toString()}`,style:F,"data-testid":"search-kind-link",children:I(e,g)}),(0,R.jsx)("span",{style:k,children:l.byKind[g]})]}),(0,R.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:0},children:o.filter(m=>m.kind===g).map(m=>(0,R.jsxs)("li",{"data-testid":"search-hit","data-about":"node",style:{display:"grid",gap:2,padding:"12px 0",minWidth:0,borderTop:"1px solid var(--graview-edge)"},children:[(0,R.jsxs)(L,{to:q(e.schema,g,m.id),style:{...X,fontFamily:Pe,fontSize:"1.1875rem",fontWeight:600,lineHeight:1.3,overflowWrap:"anywhere"},children:[m.flagged?(0,R.jsx)("span",{style:{color:"var(--graview-warn)"},children:"\u26A0 "}):null,m.label,m.apart?(0,R.jsxs)("span",{style:k,children:[" \xB7 ",m.apart]}):null,m.current?null:(0,R.jsx)("span",{style:k,children:" \xB7 past"})]}),(0,R.jsx)(st,{why:m.why})]},m.id))})]},g)),u.length>0?(0,R.jsx)(Za,{asked:u}):null,u.length>0&&l.hits.length===0?(0,R.jsx)(ba,{store:e,kinds:l.searched.kinds,words:l.words,...r?{principal:r}:{},...i?{invariantContext:i}:{}}):null]})}function st({why:t}){return t.field==="label"?null:(0,R.jsxs)("span",{style:k,"data-testid":"search-why",children:[t.reading,": ",t.fragment]})}function Xa(t,e){let n=Object.entries(e).map(([r,i])=>`${i} ${i===1?be(t.schema.tryDefinition(r),r):I(t,r).toLowerCase()}`);return n.length===0?"Found":n.length===1?le(n[0]):le(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function Sa(t,e,n={}){let r=[];for(let i of e){let a=Re(t,i,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let d of lt(t,i,a.actions.affordances))r.some(s=>s.mutation.name===d.mutation.name)||r.push(d)}return r}function lt(t,e,n){let r=t.schema.tryDefinition(e)?.fieldRoles?.label,i=[];for(let a of n){let d=t.allMutations().find(o=>o.name===a.mutation);if(!d||!d.creates?.includes(e)||i.some(o=>o.mutation.name===d.name))continue;let s=Ze(d.input).map(o=>o.name),l=s.includes("label")?"label":r&&s.includes(r)?r:void 0;!l||a.args[l]!==void 0||i.push({kind:e,affordance:a,mutation:d,arg:l})}return i}function ba({store:t,kinds:e,words:n,principal:r,invariantContext:i}){let a=Sa(t,e,{...r?{principal:r}:{},...i?{invariantContext:i}:{}});return a.length===0||n.trim().length===0?null:(0,R.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:a.map(({kind:d,affordance:s,mutation:l,arg:o})=>(0,R.jsxs)("section",{style:{..._,display:"grid",gap:14},children:[(0,R.jsxs)("h2",{style:D,children:[le(nn(be(t.schema.tryDefinition(d),d)))," called \u201C",n,"\u201D"]}),(0,R.jsx)(fe,{store:t,mutation:l,prefilled:s.args,open:s.open,initial:{[o]:n},...r?{principal:r}:{}})]},`${s.id}|${n}`))})}function Za({asked:t}){let e=se();return e?(0,R.jsx)(er,{asked:t,talk:e.seatTalk}):null}function er({asked:t,talk:e}){let{drawn:n}=kn(e);return n===0?null:(0,R.jsx)("p",{style:{margin:0},children:(0,R.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:()=>e.ask(t),style:{...F,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",t,"\u2019"]})})}var h=$(B(),1),xa=8,Pa=40;function Bt({context:t}){let e=ke(),n=ye(t.store.schema,e.slug??"");return n?(0,h.jsx)(Ca,{context:t,kind:n}):(0,h.jsx)(U,{context:t,children:(0,h.jsx)(J,{context:t,children:"No such kind of thing here."})})}function Ca({context:t,kind:e,opening:n,row:r,layout:i="list",description:a,bare:d}){let{store:s,brand:l,invariantContext:o}=t;V(s);let[c,f]=De(),u=s.schema.tryDefinition(e),g=s.graph.nodesOfKind(e),m=Ae(s).relations.filter(p=>p.from===e||p.to===e),x=new Set(s.violations(o).flatMap(p=>p.nodeIds)),E=dn(s.schema,e),C=m.map(p=>p.edgeKind),K=ar(c,E,C),ue=["sort","filter","group","q","by","with","past",...C].some(p=>c.has(p)),Q=g.length>=Pa,we=u?.fieldRoles?.when,N=ue?K.arrangement:xt(n??nr(Q,we),E).arrangement,ae=cn(N.query??""),Oe=[...N.filter??[],...ae.conditions].some(p=>p.key==="is"&&(p.value==="past"||p.value==="any"))||ln(u,[...N.filter??[],...ae.conditions]),y=Oe||!u?.lifecycle?N:{...N,filter:[...N.filter??[],{key:"is",value:"current"}]},A=Dn(g,y,{schema:s.schema,graph:s.graph,flagged:x,...typeof o?.today=="string"?{today:o.today}:{}}),j=A.nodes,z=u?.lifecycle&&!Oe?g.filter(p=>$e(u,p)):g,Vt=g.length-z.length,Ut=N.group?.by??null,La=p=>{let P=new URLSearchParams(c);for(let oe of["sort","filter","group","q","by","with","past",...m.map(je=>je.edgeKind)])P.delete(oe);let H=Nn(p);for(let oe of["sort","filter","group","q"])H[oe]&&P.set(oe,H[oe]);![...P.keys()].some(oe=>["sort","filter","group","q"].includes(oe))&&(n||Q||we)&&P.set("sort",""),f(P)},{principal:jt}=t,gt=Re(s,e,{...jt?{principal:jt}:{},...t.invariantContext?{context:t.invariantContext}:{}}),Ie=gt.actions.affordances.map(p=>({affordance:p,mutation:s.allMutations().find(P=>P.name===p.mutation)})).filter(p=>p.mutation!==void 0),_t=gt.actions.withheld,Yt=ae.words&&j.length===0?Object.fromEntries(lt(s,e,gt.actions.affordances).map(p=>[p.mutation.name,p.arg])):{},ut=I(s,e),Ge=t.views?.lookup(e,{cardinality:"one",fidelity:"glyph"}),Jt=Ge!==void 0&&!Ee(Ge)?Ge:void 0,mt=p=>{let P=re(u,p);if(r){let Ke=u?.computed?We(s.schema,s.graph,p):p;return(0,h.jsx)("li",{"data-testid":"record-row",style:{minWidth:0},children:r(p,{label:P,href:q(s.schema,e,p.id),flagged:x.has(p.id),glance:at(Ke,u,P)})},p.id)}if(Jt){let Ke=Xe(Ge,p,s.graph),$a=u?.computed?We(s.schema,s.graph,p):p,Ea=Object.fromEntries(Object.entries($a).filter(([Wa])=>!Ke?.fields.has(Wa))),Xt=Ke?at(Ea,u,Ke.title??P):"";return(0,h.jsxs)("li",{"data-testid":"record-row",style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,padding:"10px 0",borderTop:"1px solid var(--graview-edge)"},children:[(0,h.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,h.jsx)(Jt,{node:p,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...x.has(p.id)?{flagged:[p.id]}:{}})}),Xt?(0,h.jsx)("span",{style:{...k,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:Xt}):null,(0,h.jsx)(L,{to:q(s.schema,e,p.id),"aria-label":x.has(p.id)?`${P} \u2014 implicated in a problem`:P,style:{position:"absolute",inset:0,borderRadius:6}})]},p.id)}let H=u?.computed?We(s.schema,s.graph,p):p,oe=at(H,u,P),je=ae.words?gn(u,p,ae.words):void 0,wt=Q?void 0:On(p,u);return(0,h.jsxs)("li",{style:Q?{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:0,padding:"5px 0",borderTop:"1px solid var(--graview-edge)",overflowWrap:"anywhere"}:{display:"grid",gridTemplateColumns:wt?"auto minmax(0, 1fr)":"minmax(0, 1fr)",columnGap:14,gap:2,padding:"14px 0",borderTop:"1px solid var(--graview-edge)",overflowWrap:"anywhere"},children:[wt?(0,h.jsx)(xe,{as:"thumb",file:wt,style:{gridRow:"span 3"}}):null,(0,h.jsxs)(L,{to:q(s.schema,e,p.id),style:Q?{...X,flex:"1 1 14rem",minWidth:0,fontSize:"1rem",fontWeight:600,lineHeight:1.35}:{...X,fontFamily:Pe,fontSize:"1.25rem",fontWeight:600,lineHeight:1.3},children:[x.has(p.id)?(0,h.jsx)("span",{style:{color:"var(--graview-warn)"},children:"\u26A0 "}):null,P]}),oe?(0,h.jsx)("span",{style:Q?{...k,flex:"0 1 auto",minWidth:0,fontSize:"0.875rem"}:k,children:oe}):null,je?(0,h.jsx)(st,{why:je}):null]},p.id)},ft=ce(t).filter(p=>p.kind===e),Ta=(N.filter??[]).some(p=>p.key!=="is"||p.value!=="any"),Ma=!!(N.sort||N.group||N.query||Ta),Fa=z.length>=xa||ue&&Ma,me=N.sort?E.sorts.find(p=>p.key===N.sort.by):void 0,yt=me?.type==="date"||me!==void 0&&me.key===we,Qt=Q&&!A.grouped&&me&&(me.about==="label"||me.type==="text"||yt)?p=>{let P=me.about==="label"?re(u,p):p[me.key];if(typeof P!="string"||P.length===0)return yt?"No date":"#";if(yt)return P.slice(0,4);let H=P.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(H)?H:"#"}:void 0,qe=Qt?j.reduce((p,P)=>{let H=Qt(P);return p.at(-1)?.key===H?p.at(-1).nodes.push(P):p.push({key:H,nodes:[P]}),p},[]):void 0,ht=i==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",gap:12}:{margin:0,padding:0,listStyle:"none",display:"grid",gap:r&&i==="list"?6:0},Ve=p=>`list-at-${p.replace(/[^\p{L}\p{N}]/gu,"_")}`,Ue=m.map(p=>{let P=p.from===e?p.to:p.from,H=p.from===e?p.description:p.inverse??p.description;return{relation:p,far:P,words:H}}),Oa=new Set(Ue.map(p=>(p.words??"").toLowerCase()).filter((p,P,H)=>p&&H.indexOf(p)!==P));return(0,h.jsxs)(d?tr:U,{context:t,children:[(0,h.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,h.jsxs)("header",{style:{display:"grid",gap:4},children:[(0,h.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[(0,h.jsx)(ee,{kind:e,brand:l,schema:s.schema,size:8}),(0,h.jsx)(J,{context:t,children:ut})]}),a??u?.description?(0,h.jsx)("p",{style:{...Y,fontSize:"1.0625rem",lineHeight:1.4},children:a??u?.description}):null,Ue.length>0||ft.length>0?(0,h.jsxs)("p",{style:{...k,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[Ue.length>0?(0,h.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",Ue.map(({relation:p,far:P,words:H},oe)=>(0,h.jsxs)("span",{"data-relation":p.edgeKind,children:[oe>0?" \xB7 ":null,P==="*"?le(H??ie(p.edgeKind)):(0,h.jsx)(L,{to:`/${G(s.schema,P)}`,style:F,title:I(s,P),children:H&&Oa.has(H.toLowerCase())?`${le(H)}: ${I(s,P).toLowerCase()}`:le(H??I(s,P))})]},`${p.edgeKind}|${p.from}|${p.to}`))]}):null,ft.length>0?(0,h.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",ft.map((p,P)=>(0,h.jsxs)("span",{children:[P>0?" \xB7 ":null,(0,h.jsx)(L,{to:ge(t,p),style:F,children:p.title})]},Le(p)))]}):null]}):null]}),K.dropped.length>0?(0,h.jsxs)("p",{style:{...k,margin:0},"data-testid":"list-dropped",children:["This link asked for ",K.dropped.join(", "),", which ",ut.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,z.length>0?(0,h.jsx)(Kn,{schema:s.schema,graph:s.graph,kind:e,arrangement:N,onChange:La,kept:{shown:j.length,of:z.length},noun:{one:be(u,e),many:ut.toLowerCase()},...Fa?{}:{allow:!1},query:t.framed===!0&&t.barAbove!==!0}):null,j.length===0&&ae.words?(0,h.jsxs)("p",{style:{...Y,fontSize:"1.0625rem"},"data-testid":"none-yet",children:["Nothing here is called \u201C",ae.words,"\u201D."," ",(0,h.jsx)("span",{style:k,"data-testid":"list-searched",children:Ye(s.schema,{kinds:[e],past:Oe})})," ",(0,h.jsx)(L,{to:"?",style:F,children:"Show every one"})]}):j.length===0?(0,h.jsxs)("p",{style:{...Y,fontSize:"1.0625rem"},"data-testid":"none-yet",children:[N.filter?.length||N.query?"None of them.":"None yet",!N.filter?.length&&!N.query&&Ie.length>0?` \u2014 the first one starts below, with \u201C${Ie[0]?.mutation.title??Ie[0]?.mutation.name}\u201D.`:!N.filter?.length&&!N.query?".":"",N.filter?.length||N.query?(0,h.jsxs)(h.Fragment,{children:[" ",(0,h.jsx)(L,{to:"?",style:F,children:"Show every one"})]}):null]}):A.grouped&&Ut?(0,h.jsx)("div",{style:{display:"grid",gap:18},"data-testid":"records","data-grouped":Ut,children:A.groups.map(p=>(0,h.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,h.jsxs)("h2",{style:{...D,fontSize:"1.0625rem",marginBottom:4},children:[p.label," ",(0,h.jsx)("span",{style:k,children:p.nodes.length})]}),(0,h.jsx)("ul",{style:ht,"data-graview-rows":"",children:p.nodes.map(mt)})]},p.key||"-"))}):qe&&qe.length>1?(0,h.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":me?.type==="date"?"year":"letter",children:[(0,h.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...k,display:"flex",flexWrap:"wrap",gap:me?.type==="date"?"0 10px":"0 4px",fontSize:"0.8125rem",lineHeight:1.3},children:qe.map(p=>(0,h.jsx)("a",{href:`#${Ve(p.key)}`,onClick:P=>{P.preventDefault(),document.getElementById(Ve(p.key))?.scrollIntoView({block:"start"})},style:{...F,flex:"0 0 auto",minWidth:24,justifyContent:"center",textDecoration:"none"},children:p.key},p.key))}),qe.map(p=>(0,h.jsxs)("section",{"data-testid":"list-section","aria-labelledby":Ve(p.key),style:{display:"grid",gap:0},children:[(0,h.jsx)("h2",{id:Ve(p.key),style:{...D,fontSize:"0.9375rem",color:"var(--graview-ink-muted)",marginBottom:2,scrollMarginTop:64},children:p.key}),(0,h.jsx)("ul",{style:ht,"data-graview-rows":"",children:p.nodes.map(mt)})]},p.key))]}):(0,h.jsx)("ul",{style:ht,"data-testid":"records","data-graview-rows":"",children:j.map(mt)}),Vt>0?(0,h.jsxs)(L,{to:rr(c,"filter","is:any"),style:{...F,...k,justifySelf:"start"},"data-testid":"past-link",children:["+",Vt," past"]}):null,Ie.length>0?(0,h.jsx)("div",{style:{display:"grid",gap:6},"data-testid":"beginnings",children:Ie.map(({affordance:p,mutation:P})=>{let H=!!(Yt[P.name]&&j.length===0);return(0,h.jsx)(ir,{name:P.name,title:P.title??P.name,description:P.description,open:j.length===0,children:(0,h.jsx)(fe,{store:s,mutation:P,prefilled:p.args,open:p.open,...H?{initial:{[Yt[P.name]]:ae.words}}:{},...t.principal?{principal:t.principal}:{}},H?`${P.name}|${ae.words}`:P.name)},p.id)})}):null]}),_t.length>0?(0,h.jsx)("ul",{style:{..._,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},"data-testid":"withheld",children:_t.map(p=>(0,h.jsxs)("li",{style:k,children:[(0,h.jsx)("s",{children:p.label})," \u2014 ",p.refusal.message]},p.id))}):null]})}function tr({children:t}){return(0,h.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:t})}var nr=(t,e)=>e?{sort:{by:e,direction:"desc"}}:t?{sort:{by:"label",direction:"asc"}}:{};function ar(t,e,n){let r=pn({...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")}:{}}),i=[...r.filter??[]],a=t.get("by"),d=r.group??(a?{by:a}:void 0);for(let l of n){let o=t.get(l);o&&i.push({key:l,value:o})}let s=t.get("with");return s&&i.push({key:s,value:"*"}),t.get("past")==="1"&&!i.some(l=>l.key==="is")&&i.push({key:"is",value:"any"}),xt({...r.sort?{sort:r.sort}:{},...r.query?{query:r.query}:{},...i.length>0?{filter:i}:{},...d?{group:d}:{}},e)}function rr(t,e,n){let r=new URLSearchParams(t);return r.set(e,n),r.delete("past"),`?${r.toString()}`}function ir({name:t,title:e,description:n,open:r,children:i}){let[a,d]=(0,Fe.useState)(r),s=(0,Fe.useRef)(null),l=(0,Fe.useRef)(null),o=`begin-${(0,Fe.useId)().replace(/:/g,"")}`;return(0,h.jsxs)("div",{"data-testid":`act-${t}`,style:{display:"grid",gap:10},children:[(0,h.jsxs)("button",{ref:s,type:"button","data-testid":`act-open-${t}`,"aria-expanded":a,"aria-controls":o,onClick:()=>{d(!a),a||requestAnimationFrame(()=>l.current?.querySelector("input, select, textarea, button")?.focus())},style:{...X,justifySelf:"start",minHeight:32,padding:"0 2px",border:0,background:"none",font:"inherit",fontSize:"0.9375rem",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,h.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),e]}),(0,h.jsxs)("div",{ref:l,id:o,hidden:!a,onKeyDown:c=>{c.key==="Escape"&&(c.preventDefault(),d(!1),s.current?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,h.jsx)("p",{style:{...k,margin:0,maxWidth:"58ch"},children:n}):null,i]})]})}var ct=$(ve(),1);var Be=$(ve(),1);var M=$(B(),1);function Gt({context:t}){let{store:e,brand:n,invariantContext:r,principal:i}=t;V(e);let a=e.violations(r),d=e.allInvariants(),s=Qe(e,a),l=Ln(e.schema,d);return(0,M.jsxs)(U,{context:t,children:[(0,M.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,M.jsx)(J,{context:t,children:a.length===0?"All rules hold":"What is broken"}),(0,M.jsx)("p",{style:Y,"data-testid":"problems-count",children:a.length===0?"Every declared rule is satisfied by what is here.":on(a)})]}),(0,M.jsx)(ka,{context:t}),s.map((o,c)=>{let f=o.nodeIds[0],u=f?e.graph.getNode(f):void 0;return(0,M.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:[o.line?null:(0,M.jsx)(dt,{violation:o,schema:e.schema,...n?{brand:n}:{}}),u?(0,M.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,M.jsx)(ee,{kind:u.kind,brand:n,schema:e.schema,size:7}),(0,M.jsx)(L,{to:q(e.schema,u.kind,u.id),style:F,children:re(e.schema.tryDefinition(u.kind),u)})]}):null,o.line?(0,M.jsx)(dt,{violation:o,schema:e.schema,...n?{brand:n}:{}}):null,(0,M.jsx)(pt,{store:e,repairs:o.repairs,...i?{principal:i}:{}})]},c)}),d.length>0?(0,M.jsxs)("section",{style:{..._,display:"grid",gap:12},"data-testid":"rules",children:[(0,M.jsx)("h2",{style:D,children:"The rules"}),(0,M.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:d.map(o=>{let c=a.filter(g=>g.invariant===o.name).length,f=l.get(o.name),u=o.label??o.name;return(0,M.jsxs)("li",{"data-graview-rule":o.name,style:{display:"grid",gap:2},children:[(0,M.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[f?(0,M.jsx)(St,{line:f,schema:e.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,M.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:u}),(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem",color:c>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:c===0?"holds":`broken in ${c} ${c===1?"place":"places"}`})]}),f&&u.trim().length>0?(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem"},children:u}):null]},o.name)})})]}):null]})}function dt({violation:t,schema:e,brand:n}){if(!t.line)return(0,M.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:t.message});let r=Mn(t);return(0,M.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",title:Tn(t),children:[(0,M.jsx)(St,{line:t.line,schema:e,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)",fontSize:"1.0625rem"}}),r?(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem"},children:r}):null]})}function pt({store:t,repairs:e,principal:n}){let[r,i]=(0,Be.useState)(null),[a,d]=(0,Be.useState)(null),s=(0,Be.useRef)([]);if(e.length===0)return null;let l=r===null?null:e[r],o=l&&(l.missing??[]).length>0?t.allMutations().find(c=>c.name===l.mutation):void 0;return(0,M.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,M.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:e.map((c,f)=>{let u=(c.missing??[]).length>0,g=t.permits({name:c.mutation,args:{...c.args}},n);return g.ok?(0,M.jsx)("button",{ref:m=>{s.current[f]=m},type:"button","data-graview-repair":c.mutation,"data-graview-asks":u||void 0,"aria-expanded":u?r===f:void 0,onClick:()=>{if(d(null),u){i(r===f?null:f);return}i(null);try{t.apply({name:c.mutation,args:{...c.args}},n?{author:n}:{})}catch(m){d(Je(t.schema,t.allMutations(),m))}},style:tt,children:u?`${c.label} \u2026`:c.label},f):(0,M.jsxs)("p",{"data-testid":"withheld","data-withheld":g.refusal.wouldNeed.join(",")||"nobody",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,M.jsx)("s",{children:c.label})," \u2014 ",g.refusal.message]},f)})}),o&&l?(0,M.jsx)(fe,{store:t,mutation:o,prefilled:{...l.args},only:l.missing??[],label:l.label,onDone:()=>{let c=r;i(null),requestAnimationFrame(()=>{let f=c===null?null:s.current[c];if(f?.isConnected){f.focus();return}let u=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");u&&(u.hasAttribute("tabindex")||(u.tabIndex=-1),u.focus())})},...n?{principal:n}:{}}):null,l&&!o&&(l.missing??[]).length>0?(0,M.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:"0.875rem"},children:["\u201C",l.label,"\u201D names ",l.mutation,", which this app does not declare."]}):null,a?(0,M.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:"0.875rem"},children:a}):null]})}var w=$(B(),1),or=[];function qt({context:t}){let{store:e,brand:n,principal:r,invariantContext:i}=t;V(e);let a=se()!==null,d=ke(),s=decodeURIComponent(d.id??""),l=oa(e,s,{...r?{principal:r}:{},...i?{context:i}:{}}),o=Qe(e,l?.violations??or),[c,f]=(0,ct.useState)(null),u=(0,ct.useRef)(null);if(!l)return(0,w.jsx)(U,{context:t,children:(0,w.jsx)(J,{context:t,children:"Nothing lives at this address."})});let g=e.graph.getNode(s),m=e.schema.tryDefinition(l.kind),x=m?.describe&&g?Zt(m,g):null,E=[...e.log.all()].filter(y=>!sn(y)&&(y.writes.includes(s)||y.reads.includes(s))).slice(-8).reverse(),C=l.actions.affordances.filter(y=>y.provider!=="invariant"),K=t.views?.lookup(l.kind,{cardinality:"one",fidelity:"full"}),ue=K!==void 0&&!Ee(K)?K:void 0,Q=ue&&g?Xe(K,g,e.graph):void 0,we=Q?l.fields.filter(y=>!Q.fields.has(y.key)):l.fields,N=Q?l.links.flatMap(y=>{let A=y.targets.filter(j=>!Q.records.has(j.id));return A.length>0?[{...y,targets:A}]:[]}):l.links,ae=ue!==void 0&&Cn(K),Oe=a&&Fn(m).length>0;return(0,w.jsxs)(U,{context:t,children:[(0,w.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,w.jsxs)("p",{style:{...ne,display:"flex",alignItems:"center",gap:8},children:[(0,w.jsx)(ee,{kind:l.kind,brand:n,schema:e.schema,size:8}),(0,w.jsx)(L,{to:`/${G(e.schema,l.kind)}`,style:X,children:I(e,l.kind)})]}),(0,w.jsx)(J,{context:t,children:a&&g?.label===l.label?(0,w.jsx)(Pt,{nodeId:s,field:"label",value:l.label}):l.label}),x&&x!==l.label?(0,w.jsx)("p",{style:Y,children:x}):null,(0,w.jsx)(et,{context:t,stop:`#focus=${encodeURIComponent(s)}`,style:{...F,...k},"data-testid":"spatial-link"}),ce(t).some(y=>y.kind===l.kind||y.across===l.kind)?(0,w.jsxs)("p",{style:{...k,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",ce(t).filter(y=>y.kind===l.kind||y.across===l.kind).map((y,A)=>(0,w.jsxs)("span",{children:[A>0?" \xB7 ":null,(0,w.jsx)(L,{to:ge(t,y),style:F,children:y.title})," ",(0,w.jsx)(et,{context:t,stop:`#view=${encodeURIComponent(y.as)}`,style:{...F,...k,display:"inline-block",minWidth:24,textAlign:"center"},title:`${y.title}, in the scene`,children:"\u2197"})]},Le(y)))]}):null]}),ue&&g?(0,w.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,w.jsx)(Hn,{children:(0,w.jsx)(ue,{node:g,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...l.violations.length>0?{flagged:[s]}:{}})})}):null,l.violations.length>0?(0,w.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:o.map((y,A)=>(0,w.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,w.jsx)(dt,{violation:y,schema:e.schema,...n?{brand:n}:{}}),(0,w.jsx)(pt,{store:e,repairs:sa(l.actions,y.repairs),...r?{principal:r}:{}})]},A))}):null,!ae&&(we.length>0||Oe)?(0,w.jsxs)("section",{style:{..._,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,w.jsx)("h2",{style:D,children:"The facts"}),rn(m,we).map((y,A)=>{let j=(0,w.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:y.fields.map(z=>z.files?(0,w.jsx)(xe,{as:"field",read:!a,nodeId:s,field:z.key,label:z.label,files:z.files,labelStyle:{...ne,fontSize:"0.75rem"},style:{gap:4}},z.key):z.long?(0,w.jsx)(In,{nodeId:s,field:z.key,label:z.label,value:z.value,style:{gridColumn:"1 / -1",gap:4},labelStyle:{...ne,fontSize:"0.75rem"},valueStyle:{fontSize:"1.0625rem",lineHeight:1.6}},z.key):(0,w.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,w.jsx)("dt",{style:{...ne,fontSize:"0.75rem"},children:z.label}),(0,w.jsx)("dd",{style:{margin:0,fontSize:"1.125rem",overflowWrap:"anywhere",minWidth:0},children:a?(0,w.jsx)(Pt,{nodeId:s,field:z.key,value:z.value,stored:z.stored}):z.value})]},z.key))});return y.title?(0,w.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,w.jsx)("h3",{"data-graview-field-group":y.title,style:{...D,fontSize:"1.0625rem"},children:y.title}),j]},A):(0,w.jsx)("div",{children:j},A)}),Oe?(0,w.jsx)(xe,{as:"unfilled",nodeId:s,skip:[...Q?.fields??[]],labelStyle:{...ne,fontSize:"0.75rem"},style:{gap:4}}):null]}):null,(ae?[]:N).map(y=>(0,w.jsxs)("section",{style:{..._,display:"grid",gap:10},children:[(0,w.jsx)("p",{style:ne,children:Xn(e,y)}),y.description?(0,w.jsx)("h2",{style:D,children:le(y.description)}):(0,w.jsxs)("h2",{style:D,"aria-label":ie(y.edgeKind),children:[y.direction==="in"?"\u2190 ":"\u2192 ",ie(y.edgeKind)]}),(0,w.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:y.targets.map(A=>(0,w.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,w.jsx)(ee,{kind:A.kind,brand:n,schema:e.schema,size:7}),(0,w.jsxs)(L,{to:q(e.schema,A.kind,A.id),style:{...F,fontSize:"1.125rem"},children:[A.label,A.apart?(0,w.jsxs)("span",{style:k,children:[" \xB7 ",A.apart]}):null]})]},A.id))}),(y.direction==="out"&&e.schema.edge(y.edgeKind)?.cardinality==="one"?[]:[...new Set(y.targets.map(A=>A.kind))]).map(A=>(0,w.jsxs)(L,{to:`/${G(e.schema,A)}?${encodeURIComponent(y.edgeKind)}=${encodeURIComponent(s)}`,style:{...F,...k},"data-testid":"related-all",children:["Sort and filter ",y.description??`these ${I(e,A).toLowerCase()}`,y.targets.some(j=>j.kind!==A)?` (${I(e,A).toLowerCase()})`:""," \u2192"]},A))]},`${y.edgeKind}|${y.direction}|${y.description??""}`)),!ae&&(C.length>0||l.actions.withheld.length>0)?(0,w.jsxs)("section",{style:{..._,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,w.jsx)("h2",{style:D,ref:u,tabIndex:-1,children:"What can be done"}),(0,w.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:C.map(y=>{let A=c===y.id;return(0,w.jsx)("button",{type:"button","data-affordance":y.id,"data-rank":y.rank,"aria-expanded":A,onClick:()=>f(A?null:y.id),style:{...tt,...A?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:y.label},y.id)})}),C.map(y=>{if(c!==y.id)return null;let A=e.allMutations().find(j=>j.name===y.mutation);return A?(0,w.jsxs)("div",{style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,w.jsx)("h3",{style:{...D,fontSize:"1.1875rem"},children:y.label}),A.description?(0,w.jsx)("p",{style:{...k,margin:0},children:A.description}):null,(0,w.jsx)(fe,{store:e,mutation:A,prefilled:y.args,open:y.open,label:y.label,onDone:()=>{f(null);let j=y.id;requestAnimationFrame(()=>{(u.current?.parentElement?.querySelector(`[data-affordance="${j.replace(/["\\]/g,"\\$&")}"]`)??u.current)?.focus()})},...r?{principal:r}:{}})]},y.id):null}),l.actions.withheld.length>0?(0,w.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:l.actions.withheld.map(y=>(0,w.jsxs)("li",{style:k,children:[(0,w.jsx)("s",{children:y.label})," \u2014 ",y.refusal.message]},y.id))}):null]}):null,E.length>0?(0,w.jsxs)("section",{style:{..._,display:"grid",gap:10},"data-testid":"record-history",children:[(0,w.jsx)("h2",{style:D,children:"What has happened"}),(0,w.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:E.map(y=>(0,w.jsxs)("li",{style:k,children:[(0,w.jsx)("span",{style:{color:"var(--graview-ink)"},children:y.intent})," \u2014 ",nt(y,r,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},y.id))})]}):null]})}var v=$(B(),1),sr=(0,W.lazy)(()=>import("./chunk.V57P4LIZ.js").then(t=>({default:t.DraftPage})));function lr({context:t,children:e}){let n=he(),r=t.store.schema,i=(0,W.useMemo)(()=>({href:a=>q(r,a.kind,a.id),go:a=>n(q(r,a.kind,a.id))}),[r,n]);return(0,v.jsx)(zn.Provider,{value:i,children:(0,v.jsx)(Bn.Provider,{value:(t.titleLevel??(t.framed&&!t.barAbove?1:2))-1,children:e})})}function dr({steering:t}){let e=de(),n=he(),r=`${e.pathname}${e.search}`;return(0,W.useLayoutEffect)(()=>t.at(r),[r,t]),(0,W.useLayoutEffect)(()=>{let i=d=>{d!==r&&n(d)};t.go.current=i;let a=t.pending?.current;return a!==void 0&&(t.pending.current=void 0,i(a)),()=>{t.go.current===i&&(t.go.current=void 0)}},[r,n,t]),null}function pr({context:t,to:e}){let{pathname:n}=de(),r=se(),i=(e??r)?.sayWhere,a=cr(t,n);return(0,W.useEffect)(()=>(i?.(a),()=>i?.(null)),[i,a]),null}function cr(t,e){let[n="",r,i]=e.split("/").filter(Boolean).map(d=>{try{return decodeURIComponent(d)}catch{return d}});if(i!==void 0)return"#";if(n==="places"&&r!==void 0){if(r===kt)return"#overview=1";let d=t.views?.places().find(s=>s.as===r);return d?`#focus=${encodeURIComponent(He(d.kind))}&view=${encodeURIComponent(d.as)}`:"#"}let a=ye(t.store.schema,n);return a?`#focus=${encodeURIComponent(r??He(a))}`:"#"}function gr({onNavigate:t,path:e}){let n=de(),r=Rt(),i=he(),a=`${n.pathname}${n.search}`,d=(0,W.useRef)(t);d.current=t;let s=(0,W.useRef)(null);(0,W.useEffect)(()=>{let o=s.current;s.current=a,o!==null&&(a===o&&r!=="PUSH"||d.current?.(a,r==="POP"?"pop":r==="REPLACE"?"replace":"push"))},[n.key]);let l=(0,W.useRef)(e);return(0,W.useEffect)(()=>{e===void 0||e===l.current||(l.current=e,e!==a&&i(e))},[e]),null}function Ra({context:t,registry:e,page:n}){let r=ke(),i=ye(t.store.schema,r.slug??""),a=n==="list"?Bt:qt,s=(i?e?.lookup(i,n):void 0)??a;return(0,v.jsx)(s,{context:t})}function ur({context:t,registry:e,children:n}){let r=(0,W.useRef)(null);return Rn(r),(0,v.jsx)("div",{ref:r,"data-graview-face":"pages",style:{display:"contents"},children:(0,v.jsx)(ha,{context:t,registry:e,root:r,children:n})})}function mr(){let{pathname:t}=de(),e=Rt(),n=(0,W.useRef)(null);(0,W.useLayoutEffect)(()=>{if(e!=="POP"){for(let a=n.current?.parentElement;a;a=a.parentElement){let{overflowY:d}=getComputedStyle(a);if((d==="auto"||d==="scroll")&&a.scrollHeight>a.clientHeight){a.scrollTop=0;return}}window.scrollTo(0,0)}},[t]);let r=(0,W.useRef)(t),i=(0,W.useRef)(!1);return(0,W.useEffect)(()=>{if(!i.current&&t===r.current)return;i.current=!0;let a=document.activeElement;if(a!==null&&a!==document.body&&a!==document.documentElement)return;let d=n.current?.closest("main")??document.querySelector("main"),l=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??d?.querySelector("h1, h2")??null??d??null;l&&(l.hasAttribute("tabindex")||l.setAttribute("tabindex","-1"),l.focus({preventScroll:!0}))},[t]),(0,v.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function fr({context:t,children:e}){let n=he(),r=(0,W.useMemo)(()=>({record:i=>{let a=t.store.graph.getNode(i);a&&n(q(t.store.schema,a.kind,i))},place:i=>{let a=t.views?.places().find(d=>d.as===i);a&&n(ge(t,a))}}),[t,n]);return(0,v.jsx)(Pn.Provider,{value:r,children:e})}function yr({context:t,Home:e}){let i=de().key==="default"?hn(t.views?.arrangement?.()?.first,t.store.schema,t.views?.places()??[]):void 0,a=i?.to==="place"?ge(t,i.place):i?.to==="kind"?`/${G(t.store.schema,i.kind)}`:void 0;return a?(0,v.jsx)(At,{to:a,replace:!0}):(0,v.jsx)(e,{context:t})}function Aa({context:t,registry:e}){let n=e?.lookupSurface("shell"),r=n!==void 0,i=r&&(e?.without().has("bar")??!1),a=r&&!i&&!t.embedded?{...t,barAbove:!0}:t,d=m=>n===void 0?(0,v.jsx)(it,{context:t,children:m}):i?(0,v.jsx)(n,{context:t,children:m}):(0,v.jsx)(it,{context:t,children:(0,v.jsx)(n,{context:a,children:m})}),s=e?.lookupSurface("home")??Ht,l=e?.lookupSurface("problems")??Gt,o=r?{...a,framed:!0}:t,[c,f]=(0,W.useState)(null),u=(0,W.useMemo)(()=>({onFind:f,find:!(e?.without().has("find")??!1),places:!(e?.without().has("places")??!1)}),[e]),g=(0,v.jsx)(ur,{context:t,registry:e,children:(0,v.jsx)(fr,{context:t,children:d((0,v.jsx)(v.Fragment,{children:(0,v.jsxs)(lr,{context:o,children:[(0,v.jsx)(mr,{}),(0,v.jsxs)(na,{children:[(e?.routes()??[]).map(({path:m,component:x})=>(0,v.jsx)(pe,{path:m,element:(0,v.jsx)(x,{context:o})},m)),(0,v.jsx)(pe,{path:"/",element:(0,v.jsx)(yr,{context:o,Home:s})}),(0,v.jsx)(pe,{path:"/problems",element:(0,v.jsx)(l,{context:o})}),(0,v.jsx)(pe,{path:"/~draft",element:(0,v.jsx)(W.Suspense,{fallback:null,children:(0,v.jsx)(sr,{context:o})})}),(0,v.jsx)(pe,{path:"/search",element:(0,v.jsx)(zt,{context:o})}),(0,v.jsx)(pe,{path:"/map",element:(0,v.jsx)(Kt,{context:o})}),(0,v.jsx)(pe,{path:"/places",element:(0,v.jsx)(Dt,{context:o})}),ce(o).some(m=>m.as===kt)?null:(0,v.jsx)(pe,{path:yn,element:(0,v.jsx)(At,{to:"/",replace:!0})}),(0,v.jsx)(pe,{path:"/places/:as",element:(0,v.jsx)(It,{context:o})}),(0,v.jsx)(pe,{path:"/:slug",element:(0,v.jsx)(Ra,{context:o,registry:e,page:"list"})}),(0,v.jsx)(pe,{path:"/:slug/:id",element:(0,v.jsx)(Ra,{context:o,registry:e,page:"record"})})]})]})}))})});return t.embedded||!r||i?g:(0,v.jsx)(ia.Provider,{value:u,children:(0,v.jsx)($n.Provider,{value:c,children:g})})}function hr({context:t,registry:e,basename:n,initialPath:r,onNavigate:i,path:a,steering:d}){(0,W.useState)(()=>t.views?Vn(t.views,t.store.schema,Wn(t.brand,t.store.schema)):void 0);let s=se(),l=t.store.seenBy(t.principal??{kind:"human"}),o=l===t.store?t:{...t,store:l};bn(t.store,t.principal);let c=(0,v.jsxs)(v.Fragment,{children:[i||a!==void 0?(0,v.jsx)(gr,{onNavigate:i,path:a}):null,d?(0,v.jsx)(dr,{steering:d}):null,o.presence||s?(0,v.jsx)(pr,{context:o,to:s}):null,(0,v.jsx)(Aa,{context:o,...e?{registry:e}:{}})]}),f=o.views?(0,v.jsxs)(xn,{store:o.store,views:o.views,...o.principal?{principal:o.principal}:{},...o.brand?{brand:o.brand}:{},...o.settings?{settings:o.settings}:{},...o.presence&&!s?{presence:o.presence}:{},...o.people?{people:o.people}:{},...o.onKeepLens?{onKeepLens:o.onKeepLens}:{},...o.ai?{ai:o.ai}:{},...o.app?{app:o.app}:{},children:[c,(0,v.jsx)(ma,{context:o})]}):c,u=o.files?(0,v.jsx)(Sn.Provider,{value:o.files,children:f}):f;if(r!==void 0){let g=n===void 0?r:`${n.replace(/\/$/,"")}${r}`;return(0,v.jsx)(ta,{initialEntries:[g],...n===void 0?{}:{basename:n},children:u})}return(0,v.jsx)(aa,{...n===void 0?{}:{basename:n},children:u})}export{Ka as a,hr as b};
|
|
107
|
+
`;function Nt({context:t}){V(t.store);let e=Et(t);return e.length===0?null:(0,b.jsxs)("section",{style:ca,"data-testid":"gallery",children:[(0,b.jsx)("style",{children:Ga}),e.map(n=>(0,b.jsx)(Wt,{context:t,entry:n},n.key))]})}function Dt({context:t}){let{store:e}=t;V(e);let n=ce(t),r=Et(t);return(0,b.jsxs)(U,{context:t,style:Ne,children:[(0,b.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,b.jsx)("p",{style:ne,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,b.jsx)(J,{context:t,children:"Pictures"}),(0,b.jsx)("p",{style:Y,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."})]}),r.length>0?(0,b.jsx)("div",{style:ca,"data-testid":"places",children:r.map(i=>(0,b.jsx)(Wt,{context:t,entry:i},i.key))}):null]})}function It({context:t}){let{store:e,principal:n}=t;V(e);let r=ke(),i=he(),[a]=De(),d=decodeURIComponent(r.as??""),[s,l]=(0,Te.useState)(null),o=a.get("of"),f=ce(t).find(x=>x.as===d&&(!o||G(e.schema,x.kind)===o));if(!f)return(0,b.jsxs)(U,{context:t,children:[(0,b.jsx)(J,{context:t,children:"No picture is called that."}),(0,b.jsx)("p",{style:Y,children:(0,b.jsx)(L,{to:"/places",style:F,children:"The pictures there are \u2192"})})]});let u=I(e,f.kind),m=Re(e,f.kind,{...n?{principal:n}:{},...t.invariantContext?{context:t.invariantContext}:{}}).actions.affordances.map(x=>({affordance:x,mutation:e.allMutations().find(E=>E.name===x.mutation)})).filter(x=>x.mutation!==void 0);return(0,b.jsxs)(U,{context:t,style:Ne,children:[(0,b.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,b.jsx)(J,{context:t,children:f.title}),(0,b.jsxs)("p",{style:Y,"data-testid":"place-lede",children:[Ot(e,f.kind,f.across),"."]}),(0,b.jsx)("p",{style:{...k,margin:0},children:(0,b.jsxs)(L,{to:`/${G(e.schema,f.kind)}`,style:{...F,...k},"data-testid":"place-as-list",children:["All ",u.toLowerCase()," as a list \u2192"]})})]}),(0,b.jsx)("div",{"data-testid":"place-lens",style:{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:x=>{let E=x.target?.closest("[data-graview-pick]"),C=E?.getAttribute("data-graview-pick"),K=E?.getAttribute("data-graview-joins");if(K)try{let Q=JSON.parse(K);if(Array.isArray(Q)&&Q.every(we=>typeof we=="string")){x.preventDefault(),l({at:Le(f),ids:Q});return}}catch{}if(!C)return;let ue=e.graph.getNode(C);ue&&(x.preventDefault(),i(q(e.schema,ue.kind,C)))},children:(0,b.jsx)($t,{context:t,place:f,...s?.at===Le(f)?{chosen:s.ids}:{}})}),(0,b.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},children:m.map(({affordance:x,mutation:E})=>(0,b.jsxs)("section",{style:{..._,display:"grid",gap:14},children:[(0,b.jsx)("h2",{style:D,children:E.title??E.name}),E.description?(0,b.jsx)("p",{style:{...k,margin:0,maxWidth:"58ch"},children:E.description}):null,(0,b.jsx)(fe,{store:e,mutation:E,prefilled:x.args,open:x.open,label:x.label,...n?{principal:n}:{}})]},x.id))})]})}var W=$(ve(),1);var Me=$(ve(),1);function ga(t,e,n){let r=Math.max(0,t.left),i=Math.min(e.width,t.right),a=Math.max(0,t.top),d=Math.min(e.height,t.bottom);return{shown:d-a>=n.height+2*16&&i-r>=n.width+2*16,left:Math.round(r),top:Math.round(a),width:Math.round(Math.max(0,i-r)),height:Math.round(Math.max(0,d-a))}}function ua(t,e,n){let r=t.style;r.left=`${e.left}px`,r.top=`${e.top}px`,r.right="auto",r.bottom="auto",r.visibility=n?"":"hidden";let i=t.getBoundingClientRect();i.width!==0&&(r.left=`${Math.round(2*e.left-i.left)}px`,r.top=`${Math.round(2*e.top-i.top)}px`)}var Se=$(B(),1);function ma({context:t}){let e=he(),n=se(),{pathname:r}=de(),[,i,a]=r.split("/"),d=i==="places"&&a?decodeURIComponent(a):void 0,s=(0,Me.useRef)(null);return Va(s,n!==null),n?(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(Ua,{context:t}),(0,Se.jsx)("div",{ref:s,"data-testid":"page-seat",style:{position:"fixed",left:0,top:0,width:"100vw",height:"100dvh",pointerEvents:"none",zIndex:fn("rail"),containerType:"size"},children:(0,Se.jsx)(Un,{onPick:l=>{let o=t.store.graph.getNode(l);o&&e(q(t.store.schema,o.kind,l))},onMove:l=>{if(n.seatTalk.get().draft&&n.seatTalk.setDraft(null),l.to==="place"&&(l.face==="scene"||l.slug==="overview")){t.overview?t.overview("#"):t.embedded||window.location.assign(t.sceneHref??"/");return}e(l.address)},...d?{place:d}:{},onDraft:()=>{r!=="/~draft"&&e("/~draft")}})})]}):null}var qa={width:160,height:40};function Va(t,e){let{pathname:n}=de(),r=An(e);(0,Me.useLayoutEffect)(()=>{let i=t.current;if(!i)return;let a=i.parentElement?.closest("[data-embed-content]")??null,d=()=>a??document.querySelector("main")??null,s=()=>{let f=d(),u={width:document.documentElement.clientWidth||innerWidth,height:r??innerHeight},g=f?.getBoundingClientRect()??{left:0,top:0,right:u.width,bottom:u.height},m=ga(a?g:{left:g.left,right:g.right,top:g.top,bottom:Math.max(g.bottom,u.height)},u,qa);i.style.width=`${m.width}px`,i.style.height=`${m.height}px`,ua(i,m,m.shown)};s(),addEventListener("resize",s),addEventListener("scroll",s,!0);let l=0,o=typeof ResizeObserver=="function"?new ResizeObserver(()=>{cancelAnimationFrame(l),l=requestAnimationFrame(s)}):null,c=d();return c&&o?.observe(c),()=>{cancelAnimationFrame(l),o?.disconnect(),removeEventListener("resize",s),removeEventListener("scroll",s,!0)}},[t,e,n,r])}function Ua({context:t}){let{store:e}=t,n=se(),{pathname:r}=de(),i=(0,Me.useRef)(n?.setSelection);return i.current=n?.setSelection,(0,Me.useEffect)(()=>{let a=i.current;if(!a)return;let[,d,s]=r.split("/"),l=(()=>{if(d==="places"){let c=t.views?.places().find(f=>f.as===decodeURIComponent(s??""));return c?[He(c.kind)]:[]}let o=d?ye(e.schema,d):void 0;return o&&s?[decodeURIComponent(s)]:o?[vn(o)]:[]})();a(o=>o.length===l.length&&o.every((c,f)=>c===l[f])?o:l)},[r]),null}var te=$(ve(),1);var ya=$(Na(),1);var Z=$(B(),1);var ja=(0,te.lazy)(wn(()=>import("./chunk.VSXCXPK2.js").then(t=>({default:t.TakeBack}))));function _a({context:t,docked:e,at:n}){let{store:r}=t,i=V(r),[a]=(0,te.useState)(()=>r.batches().length),d=(0,te.useRef)(!1);return d.current||=i>0||!e&&a>0,d.current?(0,Z.jsx)(te.Suspense,{fallback:null,children:(0,Z.jsx)(ja,{context:t,docked:e,at:n,since:a})}):null}function Ya(t,e,n){let{store:r,principal:i,embedded:a}=t;(0,te.useEffect)(()=>{if(!n)return;let d=s=>{if(!Jn(s))return;let l=s.target,o=l instanceof Node&&e.current?.contains(l),c=l===document.body||l===document.documentElement||l===document;if(!(!o&&!(c&&!a))&&_n(r,i)){s.preventDefault();try{Yn(r,i)}catch{}}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[r,i,a,e,n])}function ha({context:t,registry:e,root:n,children:r}){let i=(0,te.useMemo)(ra,[]),a=e?.without()??new Set;return Ya(t,n,!a.has("undo")),(0,Z.jsxs)(Lt.Provider,{value:i,children:[(0,Z.jsx)(Ja,{context:t,placed:i,without:a}),r]})}function Ja({context:t,placed:e,without:n}){let[r,i]=(0,te.useState)(!1);(0,te.useLayoutEffect)(()=>i(!0),[]);let a=Tt(e,"find"),d=Tt(e,"undo"),s=de(),l=En();if(!r)return null;let o=s.pathname.split("/").filter(Boolean),f=(o.length===1?ye(t.store.schema,o[0]):void 0)!==void 0;return(0,Z.jsxs)(Z.Fragment,{children:[!a&&!n.has("find")&&l?(0,ya.createPortal)((0,Z.jsx)(fa,{context:t,narrowsLists:f}),l.slot):null,!a&&!n.has("find")&&!l?(0,Z.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,Z.jsx)(fa,{context:t,narrowsLists:f})}):null,!d&&!n.has("undo")?(0,Z.jsx)(_a,{context:t,docked:!0,at:s.pathname+s.search}):null,l?.own&&!n.has("undo")?(0,Z.jsx)(ea,{context:t,own:l.own}):null]})}function fa({context:t,narrowsLists:e}){return(0,Z.jsx)(Lt.Provider,{value:null,children:(0,Z.jsx)(Mt,{context:t,narrowsLists:e})})}var T=$(B(),1);function wa(t,e){return e==="*"?{label:"anything",path:null}:{label:I(t,e),path:`/${G(t.schema,e)}`}}function Qa({context:t,relation:e}){let{store:n}=t,r=wa(n,e.from),i=wa(n,e.to),a=d=>d.path?(0,T.jsx)(L,{to:d.path,style:{...X,fontWeight:550},children:d.label}):(0,T.jsx)("span",{children:d.label});return(0,T.jsxs)("li",{"data-testid":"relation","data-relation":e.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,T.jsx)(jn,{edgeKind:e.edgeKind,...t.brand?.kit?{kit:t.brand.kit}:{}}),(0,T.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,T.jsxs)("span",{children:[a(r)," ",(0,T.jsxs)("span",{style:k,"data-graview-speaks-ids":"",children:[ie(e.edgeKind)," \u2192"]})," ",a(i)]}),e.description||e.inverse?(0,T.jsxs)("span",{style:{...k,fontSize:"0.9375rem"},children:[e.description?le(e.description):null,e.description&&e.inverse?" \xB7 ":null,e.inverse?`from the other end, ${e.inverse}`:null]}):null]}),i.path?(0,T.jsx)(L,{to:`${i.path}?with=${encodeURIComponent(e.edgeKind)}`,style:{...F,...k,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${i.label.toLowerCase()} that have this`,children:e.count}):(0,T.jsx)("span",{style:{...k,fontVariantNumeric:"tabular-nums"},children:e.count})]})}function va({context:t,heading:e=!0}){let{store:n}=t,r=new Set(Ce(n,t.principal)),i=Ae(n).relations.filter(a=>r.has(a.from)&&(a.to==="*"||r.has(a.to)));return i.length===0?null:(0,T.jsxs)("section",{style:{..._,display:"grid",gap:12},"data-testid":"kind-map",children:[e?(0,T.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,T.jsx)("h2",{style:D,children:(0,T.jsx)(L,{to:"/map",style:X,children:"Connections"})}),(0,T.jsx)("span",{style:k,children:i.length===1?"1 relation":`${i.length} relations`})]}):null,(0,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:i.map(a=>(0,T.jsx)(Qa,{context:t,relation:a},`${a.edgeKind}|${a.from}|${a.to}`))})]})}function Kt({context:t}){let{store:e}=t;V(e);let n=new Set(Ce(e,t.principal)),r=Ae(e),i=r.relations.filter(a=>n.has(a.from));return(0,T.jsxs)(U,{context:t,children:[(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)("p",{style:ne,children:i.length===0?"No relations":`${i.length} ${i.length===1?"relation":"relations"}`}),(0,T.jsx)(J,{context:t,children:"Connections"}),(0,T.jsx)("p",{style:Y,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,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:r.kinds.filter(a=>n.has(a.kind)).map(a=>(0,T.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,T.jsx)(ee,{kind:a.kind,brand:t.brand,schema:e.schema,size:7}),(0,T.jsx)(L,{to:`/${G(e.schema,a.kind)}`,style:F,children:a.plural}),(0,T.jsx)("span",{style:k,children:a.count})]},a.kind))}),(0,T.jsx)(va,{context:t,heading:!1})]})}function ka({context:t}){let n=[...se()?.robots.values()??[]].filter(i=>i.mode==="asking"&&i.say);if(n.length===0)return null;let{store:r}=t;return(0,T.jsxs)("section",{style:{..._,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,T.jsx)("h2",{style:D,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(i=>{let a=i.at?r.graph.getNode(i.at):void 0;return(0,T.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,T.jsx)("span",{children:i.say}),a?(0,T.jsxs)(L,{to:q(r.schema,a.kind,a.id),style:{...F,...k},children:[re(r.schema.tryDefinition(a.kind),a)," \u2192"]}):null]},i.participant)})})]})}var O=$(B(),1);function Ht({context:t}){let{principal:e}=t,{store:n,brand:r,invariantContext:i}=t;V(n);let a=n.violations(i),d=`${a.length===1?"A rule is broken":"Rules are broken"} \u2014 see what, and what would fix it`,s=[...n.log.all()].slice(-5).reverse(),o=rt(t).map(C=>({kind:C,members:n.graph.nodesOfKind(C).filter(K=>$e(n.schema.tryDefinition(C),K))})),c=o.filter(C=>C.members.length>0),f=o.map(C=>({entry:C,creator:n.allMutations().find(K=>(K.creates??[]).includes(C.kind)&&n.permits({name:K.name,args:{}},t.principal).ok)})).find(C=>C.creator!==void 0),u=c.length===0?"Nothing here yet.":`${c.map(C=>`${C.members.length} ${C.members.length===1?C.kind:I(n,C.kind).toLowerCase()}`).join(", ").replace(/, ([^,]*)$/," and $1")}.`,g=t.views?.homeView?.(),m=n.schema.kinds.some(C=>n.graph.nodesOfKind(C).length>0);if(g&&m){let C=r?.subtitle?(0,O.jsx)("p",{style:{...k,margin:0},"data-testid":"app-subtitle",children:r.subtitle}):null,K=g[Symbol.for("graview.home-blocks")]===!0;return(0,O.jsx)(U,{context:t,style:Ne,children:(0,O.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[K?null:C,a.length>0?(0,O.jsx)(L,{to:"/problems",style:{...F,color:"var(--graview-warn)"},children:d}):null,(0,O.jsx)(Gn.Provider,{value:K?C:null,children:(0,O.jsx)(g,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})]})})}let x=new Set(Ce(n,t.principal)),E=Ae(n).relations.filter(C=>x.has(C.from)&&(C.to==="*"||x.has(C.to)));return(0,O.jsxs)(U,{context:t,style:Ne,children:[(0,O.jsxs)("header",{style:{display:"grid",gap:12},children:[r?.subtitle?(0,O.jsx)("p",{style:{...k,margin:0},"data-testid":"app-subtitle",children:r.subtitle}):null,(0,O.jsx)(J,{context:t,"data-testid":"standing",children:u}),(0,O.jsxs)("p",{style:{...Y,display:"grid",gap:4},"data-testid":"standing-card",children:[c.length===0&&f?(0,O.jsxs)("span",{children:["Begin with \u201C",f.creator?.title??f.creator?.name,"\u201D, under"," ",(0,O.jsx)(L,{to:`/${G(n.schema,f.entry.kind)}`,style:F,children:I(n,f.entry.kind)}),"."]}):null,a.length===0?(0,O.jsx)("span",{children:"All rules hold."}):(0,O.jsx)(L,{to:"/problems",style:{...F,color:"var(--graview-warn)"},children:d})]})]}),(0,O.jsx)(Nt,{context:t}),(0,O.jsxs)("section",{style:{..._,display:"grid",gap:14},"data-testid":"kinds",children:[(0,O.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,O.jsx)("h2",{style:D,children:"What is here"}),E.length>0?(0,O.jsxs)(L,{to:"/map",style:{...F,...k,marginLeft:"auto"},"data-testid":"map-link",children:["Connections \xB7 ",E.length===1?"1 relation":`${E.length} relations`," \u2192"]}):null]}),(0,O.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:o.map(({kind:C,members:K})=>(0,O.jsx)("li",{style:{maxWidth:"100%"},children:(0,O.jsxs)(L,{to:`/${G(n.schema,C)}`,style:{...X,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,O.jsx)(ee,{kind:C,brand:r,schema:n.schema,size:7}),(0,O.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:I(n,C)}),(0,O.jsx)("span",{style:{...k,fontVariantNumeric:"tabular-nums"},children:K.length===0?"none yet":K.length})]})},C))})]}),s.length>0?(0,O.jsxs)("section",{style:{..._,display:"grid",gap:10},children:[(0,O.jsx)("h2",{style:D,children:"Recently"}),(0,O.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:s.map(C=>(0,O.jsxs)("li",{style:k,children:[(0,O.jsx)("span",{style:{color:"var(--graview-ink)"},children:C.intent})," \u2014 ",nt(C,e,{graph:n.graph,schema:n.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},C.id))})]}):null]})}var Fe=$(ve(),1);var R=$(B(),1);function zt({context:t}){let{store:e,brand:n,principal:r,invariantContext:i}=t;V(e);let[a]=De(),d=a.get("q")??"",s=typeof i?.today=="string"?i.today:void 0,l=un(e,d,{...r?{principal:r}:{},places:ce(t),flagged:new Set(e.violations(i).flatMap(g=>g.nodeIds)),...s?{today:s}:{},limit:200}),o=l.hits.filter(g=>g.about==="node"),c=l.hits.filter(g=>g.about==="kind"||g.about==="place"||g.about==="rule"),f=[...new Set(o.map(g=>g.kind))],u=d.trim();return(0,R.jsxs)(U,{context:t,children:[(0,R.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,R.jsx)("p",{style:ne,children:"Search"}),(0,R.jsx)(J,{context:t,"data-testid":"search-heading",children:u.length===0?"Find anything by its name":l.hits.length===0?(0,R.jsxs)(R.Fragment,{children:["Nothing here is called \u201C",u,"\u201D."]}):(0,R.jsxs)(R.Fragment,{children:[Xa(e,l.byKind)," for \u201C",u,"\u201D"]})}),u.length>0?(0,R.jsxs)("p",{style:{...k,margin:0},"data-testid":"search-searched",children:[Ye(e.schema,l.searched),l.conditions.filter(g=>g.key!=="is"&&g.admittedBy.length<l.searched.kinds.length).map(g=>(0,R.jsxs)("span",{children:[" ",g.key,":",g.value," narrows"," ",g.admittedBy.length===0?"nothing here":g.admittedBy.map(m=>I(e,m).toLowerCase()).join(" and "),"."]},`${g.key}:${g.value}`))]}):(0,R.jsxs)("p",{style:Y,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,R.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,R.jsx)("code",{children:"is:any"})," includes what is past."]})]}),c.length>0?(0,R.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:c.map(g=>(0,R.jsx)("li",{"data-testid":"search-hit","data-about":g.about,children:g.about==="kind"?(0,R.jsxs)(L,{to:`/${G(e.schema,g.kind)}`,style:F,children:[g.label,g.count>0?(0,R.jsxs)("span",{style:k,children:[" \xB7 ",g.count," match"]}):null]}):g.about==="place"?(0,R.jsxs)(L,{to:ge(t,g),style:F,children:["Go to ",g.title]}):g.about==="rule"?(0,R.jsxs)(L,{to:"/problems",style:F,children:["The rule \u201C",g.label,"\u201D"]}):null},`${g.about}:${g.about==="rule"?g.name:g.about==="place"?g.as:g.kind}`))}):null,f.map(g=>(0,R.jsxs)("section",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:0,minWidth:0},"data-testid":"search-group","data-kind":g,children:[(0,R.jsxs)("h2",{style:{...D,fontSize:"1.0625rem",marginBottom:4,display:"flex",alignItems:"center",gap:8},children:[(0,R.jsx)(ee,{kind:g,brand:n,schema:e.schema,size:8}),(0,R.jsx)(L,{to:`/${G(e.schema,g)}?${new URLSearchParams({q:u}).toString()}`,style:F,"data-testid":"search-kind-link",children:I(e,g)}),(0,R.jsx)("span",{style:k,children:l.byKind[g]})]}),(0,R.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:0},children:o.filter(m=>m.kind===g).map(m=>(0,R.jsxs)("li",{"data-testid":"search-hit","data-about":"node",style:{display:"grid",gap:2,padding:"12px 0",minWidth:0,borderTop:"1px solid var(--graview-edge)"},children:[(0,R.jsxs)(L,{to:q(e.schema,g,m.id),style:{...X,fontFamily:Pe,fontSize:"1.1875rem",fontWeight:600,lineHeight:1.3,overflowWrap:"anywhere"},children:[m.flagged?(0,R.jsx)("span",{style:{color:"var(--graview-warn)"},children:"\u26A0 "}):null,m.label,m.apart?(0,R.jsxs)("span",{style:k,children:[" \xB7 ",m.apart]}):null,m.current?null:(0,R.jsx)("span",{style:k,children:" \xB7 past"})]}),(0,R.jsx)(st,{why:m.why})]},m.id))})]},g)),u.length>0?(0,R.jsx)(Za,{asked:u}):null,u.length>0&&l.hits.length===0?(0,R.jsx)(ba,{store:e,kinds:l.searched.kinds,words:l.words,...r?{principal:r}:{},...i?{invariantContext:i}:{}}):null]})}function st({why:t}){return t.field==="label"?null:(0,R.jsxs)("span",{style:k,"data-testid":"search-why",children:[t.reading,": ",t.fragment]})}function Xa(t,e){let n=Object.entries(e).map(([r,i])=>`${i} ${i===1?be(t.schema.tryDefinition(r),r):I(t,r).toLowerCase()}`);return n.length===0?"Found":n.length===1?le(n[0]):le(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function Sa(t,e,n={}){let r=[];for(let i of e){let a=Re(t,i,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let d of lt(t,i,a.actions.affordances))r.some(s=>s.mutation.name===d.mutation.name)||r.push(d)}return r}function lt(t,e,n){let r=t.schema.tryDefinition(e)?.fieldRoles?.label,i=[];for(let a of n){let d=t.allMutations().find(o=>o.name===a.mutation);if(!d||!d.creates?.includes(e)||i.some(o=>o.mutation.name===d.name))continue;let s=Ze(d.input).map(o=>o.name),l=s.includes("label")?"label":r&&s.includes(r)?r:void 0;!l||a.args[l]!==void 0||i.push({kind:e,affordance:a,mutation:d,arg:l})}return i}function ba({store:t,kinds:e,words:n,principal:r,invariantContext:i}){let a=Sa(t,e,{...r?{principal:r}:{},...i?{invariantContext:i}:{}});return a.length===0||n.trim().length===0?null:(0,R.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:a.map(({kind:d,affordance:s,mutation:l,arg:o})=>(0,R.jsxs)("section",{style:{..._,display:"grid",gap:14},children:[(0,R.jsxs)("h2",{style:D,children:[le(nn(be(t.schema.tryDefinition(d),d)))," called \u201C",n,"\u201D"]}),(0,R.jsx)(fe,{store:t,mutation:l,prefilled:s.args,open:s.open,initial:{[o]:n},...r?{principal:r}:{}})]},`${s.id}|${n}`))})}function Za({asked:t}){let e=se();return e?(0,R.jsx)(er,{asked:t,talk:e.seatTalk}):null}function er({asked:t,talk:e}){let{drawn:n}=kn(e);return n===0?null:(0,R.jsx)("p",{style:{margin:0},children:(0,R.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:()=>e.ask(t),style:{...F,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",t,"\u2019"]})})}var h=$(B(),1),xa=8,Pa=40;function Bt({context:t}){let e=ke(),n=ye(t.store.schema,e.slug??"");return n?(0,h.jsx)(Ca,{context:t,kind:n}):(0,h.jsx)(U,{context:t,children:(0,h.jsx)(J,{context:t,children:"No such kind of thing here."})})}function Ca({context:t,kind:e,opening:n,row:r,layout:i="list",description:a,bare:d}){let{store:s,brand:l,invariantContext:o}=t;V(s);let[c,f]=De(),u=s.schema.tryDefinition(e),g=s.graph.nodesOfKind(e),m=Ae(s).relations.filter(p=>p.from===e||p.to===e),x=new Set(s.violations(o).flatMap(p=>p.nodeIds)),E=dn(s.schema,e),C=m.map(p=>p.edgeKind),K=ar(c,E,C),ue=["sort","filter","group","q","by","with","past",...C].some(p=>c.has(p)),Q=g.length>=Pa,we=u?.fieldRoles?.when,N=ue?K.arrangement:xt(n??nr(Q,we),E).arrangement,ae=cn(N.query??""),Oe=[...N.filter??[],...ae.conditions].some(p=>p.key==="is"&&(p.value==="past"||p.value==="any"))||ln(u,[...N.filter??[],...ae.conditions]),y=Oe||!u?.lifecycle?N:{...N,filter:[...N.filter??[],{key:"is",value:"current"}]},A=Dn(g,y,{schema:s.schema,graph:s.graph,flagged:x,...typeof o?.today=="string"?{today:o.today}:{}}),j=A.nodes,z=u?.lifecycle&&!Oe?g.filter(p=>$e(u,p)):g,Vt=g.length-z.length,Ut=N.group?.by??null,La=p=>{let P=new URLSearchParams(c);for(let oe of["sort","filter","group","q","by","with","past",...m.map(je=>je.edgeKind)])P.delete(oe);let H=Nn(p);for(let oe of["sort","filter","group","q"])H[oe]&&P.set(oe,H[oe]);![...P.keys()].some(oe=>["sort","filter","group","q"].includes(oe))&&(n||Q||we)&&P.set("sort",""),f(P)},{principal:jt}=t,gt=Re(s,e,{...jt?{principal:jt}:{},...t.invariantContext?{context:t.invariantContext}:{}}),Ie=gt.actions.affordances.map(p=>({affordance:p,mutation:s.allMutations().find(P=>P.name===p.mutation)})).filter(p=>p.mutation!==void 0),_t=gt.actions.withheld,Yt=ae.words&&j.length===0?Object.fromEntries(lt(s,e,gt.actions.affordances).map(p=>[p.mutation.name,p.arg])):{},ut=I(s,e),Ge=t.views?.lookup(e,{cardinality:"one",fidelity:"glyph"}),Jt=Ge!==void 0&&!Ee(Ge)?Ge:void 0,mt=p=>{let P=re(u,p);if(r){let Ke=u?.computed?We(s.schema,s.graph,p):p;return(0,h.jsx)("li",{"data-testid":"record-row",style:{minWidth:0},children:r(p,{label:P,href:q(s.schema,e,p.id),flagged:x.has(p.id),glance:at(Ke,u,P)})},p.id)}if(Jt){let Ke=Xe(Ge,p,s.graph),$a=u?.computed?We(s.schema,s.graph,p):p,Ea=Object.fromEntries(Object.entries($a).filter(([Wa])=>!Ke?.fields.has(Wa))),Xt=Ke?at(Ea,u,Ke.title??P):"";return(0,h.jsxs)("li",{"data-testid":"record-row",style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,padding:"10px 0",borderTop:"1px solid var(--graview-edge)"},children:[(0,h.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,h.jsx)(Jt,{node:p,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...x.has(p.id)?{flagged:[p.id]}:{}})}),Xt?(0,h.jsx)("span",{style:{...k,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:Xt}):null,(0,h.jsx)(L,{to:q(s.schema,e,p.id),"aria-label":x.has(p.id)?`${P} \u2014 implicated in a problem`:P,style:{position:"absolute",inset:0,borderRadius:6}})]},p.id)}let H=u?.computed?We(s.schema,s.graph,p):p,oe=at(H,u,P),je=ae.words?gn(u,p,ae.words):void 0,wt=Q?void 0:On(p,u);return(0,h.jsxs)("li",{style:Q?{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:0,padding:"5px 0",borderTop:"1px solid var(--graview-edge)",overflowWrap:"anywhere"}:{display:"grid",gridTemplateColumns:wt?"auto minmax(0, 1fr)":"minmax(0, 1fr)",columnGap:14,gap:2,padding:"14px 0",borderTop:"1px solid var(--graview-edge)",overflowWrap:"anywhere"},children:[wt?(0,h.jsx)(xe,{as:"thumb",file:wt,style:{gridRow:"span 3"}}):null,(0,h.jsxs)(L,{to:q(s.schema,e,p.id),style:Q?{...X,flex:"1 1 14rem",minWidth:0,fontSize:"1rem",fontWeight:600,lineHeight:1.35}:{...X,fontFamily:Pe,fontSize:"1.25rem",fontWeight:600,lineHeight:1.3},children:[x.has(p.id)?(0,h.jsx)("span",{style:{color:"var(--graview-warn)"},children:"\u26A0 "}):null,P]}),oe?(0,h.jsx)("span",{style:Q?{...k,flex:"0 1 auto",minWidth:0,fontSize:"0.875rem"}:k,children:oe}):null,je?(0,h.jsx)(st,{why:je}):null]},p.id)},ft=ce(t).filter(p=>p.kind===e),Ta=(N.filter??[]).some(p=>p.key!=="is"||p.value!=="any"),Ma=!!(N.sort||N.group||N.query||Ta),Fa=z.length>=xa||ue&&Ma,me=N.sort?E.sorts.find(p=>p.key===N.sort.by):void 0,yt=me?.type==="date"||me!==void 0&&me.key===we,Qt=Q&&!A.grouped&&me&&(me.about==="label"||me.type==="text"||yt)?p=>{let P=me.about==="label"?re(u,p):p[me.key];if(typeof P!="string"||P.length===0)return yt?"No date":"#";if(yt)return P.slice(0,4);let H=P.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(H)?H:"#"}:void 0,qe=Qt?j.reduce((p,P)=>{let H=Qt(P);return p.at(-1)?.key===H?p.at(-1).nodes.push(P):p.push({key:H,nodes:[P]}),p},[]):void 0,ht=i==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",gap:12}:{margin:0,padding:0,listStyle:"none",display:"grid",gap:r&&i==="list"?6:0},Ve=p=>`list-at-${p.replace(/[^\p{L}\p{N}]/gu,"_")}`,Ue=m.map(p=>{let P=p.from===e?p.to:p.from,H=p.from===e?p.description:p.inverse??p.description;return{relation:p,far:P,words:H}}),Oa=new Set(Ue.map(p=>(p.words??"").toLowerCase()).filter((p,P,H)=>p&&H.indexOf(p)!==P));return(0,h.jsxs)(d?tr:U,{context:t,children:[(0,h.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,h.jsxs)("header",{style:{display:"grid",gap:4},children:[(0,h.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[(0,h.jsx)(ee,{kind:e,brand:l,schema:s.schema,size:8}),(0,h.jsx)(J,{context:t,children:ut})]}),a??u?.description?(0,h.jsx)("p",{style:{...Y,fontSize:"1.0625rem",lineHeight:1.4},children:a??u?.description}):null,Ue.length>0||ft.length>0?(0,h.jsxs)("p",{style:{...k,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[Ue.length>0?(0,h.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",Ue.map(({relation:p,far:P,words:H},oe)=>(0,h.jsxs)("span",{"data-relation":p.edgeKind,children:[oe>0?" \xB7 ":null,P==="*"?le(H??ie(p.edgeKind)):(0,h.jsx)(L,{to:`/${G(s.schema,P)}`,style:F,title:I(s,P),children:H&&Oa.has(H.toLowerCase())?`${le(H)}: ${I(s,P).toLowerCase()}`:le(H??I(s,P))})]},`${p.edgeKind}|${p.from}|${p.to}`))]}):null,ft.length>0?(0,h.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",ft.map((p,P)=>(0,h.jsxs)("span",{children:[P>0?" \xB7 ":null,(0,h.jsx)(L,{to:ge(t,p),style:F,children:p.title})]},Le(p)))]}):null]}):null]}),K.dropped.length>0?(0,h.jsxs)("p",{style:{...k,margin:0},"data-testid":"list-dropped",children:["This link asked for ",K.dropped.join(", "),", which ",ut.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,z.length>0?(0,h.jsx)(Kn,{schema:s.schema,graph:s.graph,kind:e,arrangement:N,onChange:La,kept:{shown:j.length,of:z.length},noun:{one:be(u,e),many:ut.toLowerCase()},...Fa?{}:{allow:!1},query:t.framed===!0&&t.barAbove!==!0}):null,j.length===0&&ae.words?(0,h.jsxs)("p",{style:{...Y,fontSize:"1.0625rem"},"data-testid":"none-yet",children:["Nothing here is called \u201C",ae.words,"\u201D."," ",(0,h.jsx)("span",{style:k,"data-testid":"list-searched",children:Ye(s.schema,{kinds:[e],past:Oe})})," ",(0,h.jsx)(L,{to:"?",style:F,children:"Show every one"})]}):j.length===0?(0,h.jsxs)("p",{style:{...Y,fontSize:"1.0625rem"},"data-testid":"none-yet",children:[N.filter?.length||N.query?"None of them.":"None yet",!N.filter?.length&&!N.query&&Ie.length>0?` \u2014 the first one starts below, with \u201C${Ie[0]?.mutation.title??Ie[0]?.mutation.name}\u201D.`:!N.filter?.length&&!N.query?".":"",N.filter?.length||N.query?(0,h.jsxs)(h.Fragment,{children:[" ",(0,h.jsx)(L,{to:"?",style:F,children:"Show every one"})]}):null]}):A.grouped&&Ut?(0,h.jsx)("div",{style:{display:"grid",gap:18},"data-testid":"records","data-grouped":Ut,children:A.groups.map(p=>(0,h.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,h.jsxs)("h2",{style:{...D,fontSize:"1.0625rem",marginBottom:4},children:[p.label," ",(0,h.jsx)("span",{style:k,children:p.nodes.length})]}),(0,h.jsx)("ul",{style:ht,"data-graview-rows":"",children:p.nodes.map(mt)})]},p.key||"-"))}):qe&&qe.length>1?(0,h.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":me?.type==="date"?"year":"letter",children:[(0,h.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...k,display:"flex",flexWrap:"wrap",gap:me?.type==="date"?"0 10px":"0 4px",fontSize:"0.8125rem",lineHeight:1.3},children:qe.map(p=>(0,h.jsx)("a",{href:`#${Ve(p.key)}`,onClick:P=>{P.preventDefault(),document.getElementById(Ve(p.key))?.scrollIntoView({block:"start"})},style:{...F,flex:"0 0 auto",minWidth:24,justifyContent:"center",textDecoration:"none"},children:p.key},p.key))}),qe.map(p=>(0,h.jsxs)("section",{"data-testid":"list-section","aria-labelledby":Ve(p.key),style:{display:"grid",gap:0},children:[(0,h.jsx)("h2",{id:Ve(p.key),style:{...D,fontSize:"0.9375rem",color:"var(--graview-ink-muted)",marginBottom:2,scrollMarginTop:64},children:p.key}),(0,h.jsx)("ul",{style:ht,"data-graview-rows":"",children:p.nodes.map(mt)})]},p.key))]}):(0,h.jsx)("ul",{style:ht,"data-testid":"records","data-graview-rows":"",children:j.map(mt)}),Vt>0?(0,h.jsxs)(L,{to:rr(c,"filter","is:any"),style:{...F,...k,justifySelf:"start"},"data-testid":"past-link",children:["+",Vt," past"]}):null,Ie.length>0?(0,h.jsx)("div",{style:{display:"grid",gap:6},"data-testid":"beginnings",children:Ie.map(({affordance:p,mutation:P})=>{let H=!!(Yt[P.name]&&j.length===0);return(0,h.jsx)(ir,{name:P.name,title:P.title??P.name,description:P.description,open:j.length===0,children:(0,h.jsx)(fe,{store:s,mutation:P,prefilled:p.args,open:p.open,...H?{initial:{[Yt[P.name]]:ae.words}}:{},...t.principal?{principal:t.principal}:{}},H?`${P.name}|${ae.words}`:P.name)},p.id)})}):null]}),_t.length>0?(0,h.jsx)("ul",{style:{..._,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},"data-testid":"withheld",children:_t.map(p=>(0,h.jsxs)("li",{style:k,children:[(0,h.jsx)("s",{children:p.label})," \u2014 ",p.refusal.message]},p.id))}):null]})}function tr({children:t}){return(0,h.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:t})}var nr=(t,e)=>e?{sort:{by:e,direction:"desc"}}:t?{sort:{by:"label",direction:"asc"}}:{};function ar(t,e,n){let r=pn({...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")}:{}}),i=[...r.filter??[]],a=t.get("by"),d=r.group??(a?{by:a}:void 0);for(let l of n){let o=t.get(l);o&&i.push({key:l,value:o})}let s=t.get("with");return s&&i.push({key:s,value:"*"}),t.get("past")==="1"&&!i.some(l=>l.key==="is")&&i.push({key:"is",value:"any"}),xt({...r.sort?{sort:r.sort}:{},...r.query?{query:r.query}:{},...i.length>0?{filter:i}:{},...d?{group:d}:{}},e)}function rr(t,e,n){let r=new URLSearchParams(t);return r.set(e,n),r.delete("past"),`?${r.toString()}`}function ir({name:t,title:e,description:n,open:r,children:i}){let[a,d]=(0,Fe.useState)(r),s=(0,Fe.useRef)(null),l=(0,Fe.useRef)(null),o=`begin-${(0,Fe.useId)().replace(/:/g,"")}`;return(0,h.jsxs)("div",{"data-testid":`act-${t}`,style:{display:"grid",gap:10},children:[(0,h.jsxs)("button",{ref:s,type:"button","data-testid":`act-open-${t}`,"aria-expanded":a,"aria-controls":o,onClick:()=>{d(!a),a||requestAnimationFrame(()=>l.current?.querySelector("input, select, textarea, button")?.focus())},style:{...X,justifySelf:"start",minHeight:32,padding:"0 2px",border:0,background:"none",font:"inherit",fontSize:"0.9375rem",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,h.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),e]}),(0,h.jsxs)("div",{ref:l,id:o,hidden:!a,onKeyDown:c=>{c.key==="Escape"&&(c.preventDefault(),d(!1),s.current?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,h.jsx)("p",{style:{...k,margin:0,maxWidth:"58ch"},children:n}):null,i]})]})}var ct=$(ve(),1);var Be=$(ve(),1);var M=$(B(),1);function Gt({context:t}){let{store:e,brand:n,invariantContext:r,principal:i}=t;V(e);let a=e.violations(r),d=e.allInvariants(),s=Qe(e,a),l=Ln(e.schema,d);return(0,M.jsxs)(U,{context:t,children:[(0,M.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,M.jsx)(J,{context:t,children:a.length===0?"All rules hold":"What is broken"}),(0,M.jsx)("p",{style:Y,"data-testid":"problems-count",children:a.length===0?"Every declared rule is satisfied by what is here.":on(a)})]}),(0,M.jsx)(ka,{context:t}),s.map((o,c)=>{let f=o.nodeIds[0],u=f?e.graph.getNode(f):void 0;return(0,M.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:[o.line?null:(0,M.jsx)(dt,{violation:o,schema:e.schema,...n?{brand:n}:{}}),u?(0,M.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,M.jsx)(ee,{kind:u.kind,brand:n,schema:e.schema,size:7}),(0,M.jsx)(L,{to:q(e.schema,u.kind,u.id),style:F,children:re(e.schema.tryDefinition(u.kind),u)})]}):null,o.line?(0,M.jsx)(dt,{violation:o,schema:e.schema,...n?{brand:n}:{}}):null,(0,M.jsx)(pt,{store:e,repairs:o.repairs,...i?{principal:i}:{}})]},c)}),d.length>0?(0,M.jsxs)("section",{style:{..._,display:"grid",gap:12},"data-testid":"rules",children:[(0,M.jsx)("h2",{style:D,children:"The rules"}),(0,M.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:d.map(o=>{let c=a.filter(g=>g.invariant===o.name).length,f=l.get(o.name),u=o.label??o.name;return(0,M.jsxs)("li",{"data-graview-rule":o.name,style:{display:"grid",gap:2},children:[(0,M.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[f?(0,M.jsx)(St,{line:f,schema:e.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,M.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:u}),(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem",color:c>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:c===0?"holds":`broken in ${c} ${c===1?"place":"places"}`})]}),f&&u.trim().length>0?(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem"},children:u}):null]},o.name)})})]}):null]})}function dt({violation:t,schema:e,brand:n}){if(!t.line)return(0,M.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:t.message});let r=Mn(t);return(0,M.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",title:Tn(t),children:[(0,M.jsx)(St,{line:t.line,schema:e,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)",fontSize:"1.0625rem"}}),r?(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem"},children:r}):null]})}function pt({store:t,repairs:e,principal:n}){let[r,i]=(0,Be.useState)(null),[a,d]=(0,Be.useState)(null),s=(0,Be.useRef)([]);if(e.length===0)return null;let l=r===null?null:e[r],o=l&&(l.missing??[]).length>0?t.allMutations().find(c=>c.name===l.mutation):void 0;return(0,M.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,M.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:e.map((c,f)=>{let u=(c.missing??[]).length>0,g=t.permits({name:c.mutation,args:{...c.args}},n);return g.ok?(0,M.jsx)("button",{ref:m=>{s.current[f]=m},type:"button","data-graview-repair":c.mutation,"data-graview-asks":u||void 0,"aria-expanded":u?r===f:void 0,onClick:()=>{if(d(null),u){i(r===f?null:f);return}i(null);try{t.apply({name:c.mutation,args:{...c.args}},n?{author:n}:{})}catch(m){d(Je(t.schema,t.allMutations(),m))}},style:tt,children:u?`${c.label} \u2026`:c.label},f):(0,M.jsxs)("p",{"data-testid":"withheld","data-withheld":g.refusal.wouldNeed.join(",")||"nobody",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,M.jsx)("s",{children:c.label})," \u2014 ",g.refusal.message]},f)})}),o&&l?(0,M.jsx)(fe,{store:t,mutation:o,prefilled:{...l.args},only:l.missing??[],label:l.label,onDone:()=>{let c=r;i(null),requestAnimationFrame(()=>{let f=c===null?null:s.current[c];if(f?.isConnected){f.focus();return}let u=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");u&&(u.hasAttribute("tabindex")||(u.tabIndex=-1),u.focus())})},...n?{principal:n}:{}}):null,l&&!o&&(l.missing??[]).length>0?(0,M.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:"0.875rem"},children:["\u201C",l.label,"\u201D names ",l.mutation,", which this app does not declare."]}):null,a?(0,M.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:"0.875rem"},children:a}):null]})}var w=$(B(),1),or=[];function qt({context:t}){let{store:e,brand:n,principal:r,invariantContext:i}=t;V(e);let a=se()!==null,d=ke(),s=decodeURIComponent(d.id??""),l=oa(e,s,{...r?{principal:r}:{},...i?{context:i}:{}}),o=Qe(e,l?.violations??or),[c,f]=(0,ct.useState)(null),u=(0,ct.useRef)(null);if(!l)return(0,w.jsx)(U,{context:t,children:(0,w.jsx)(J,{context:t,children:"Nothing lives at this address."})});let g=e.graph.getNode(s),m=e.schema.tryDefinition(l.kind),x=m?.describe&&g?Zt(m,g):null,E=[...e.log.all()].filter(y=>!sn(y)&&(y.writes.includes(s)||y.reads.includes(s))).slice(-8).reverse(),C=l.actions.affordances.filter(y=>y.provider!=="invariant"),K=t.views?.lookup(l.kind,{cardinality:"one",fidelity:"full"}),ue=K!==void 0&&!Ee(K)?K:void 0,Q=ue&&g?Xe(K,g,e.graph):void 0,we=Q?l.fields.filter(y=>!Q.fields.has(y.key)):l.fields,N=Q?l.links.flatMap(y=>{let A=y.targets.filter(j=>!Q.records.has(j.id));return A.length>0?[{...y,targets:A}]:[]}):l.links,ae=ue!==void 0&&Cn(K),Oe=a&&Fn(m).length>0;return(0,w.jsxs)(U,{context:t,children:[(0,w.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,w.jsxs)("p",{style:{...ne,display:"flex",alignItems:"center",gap:8},children:[(0,w.jsx)(ee,{kind:l.kind,brand:n,schema:e.schema,size:8}),(0,w.jsx)(L,{to:`/${G(e.schema,l.kind)}`,style:X,children:I(e,l.kind)})]}),(0,w.jsx)(J,{context:t,children:a&&g?.label===l.label?(0,w.jsx)(Pt,{nodeId:s,field:"label",value:l.label}):l.label}),x&&x!==l.label?(0,w.jsx)("p",{style:Y,children:x}):null,(0,w.jsx)(et,{context:t,stop:`#focus=${encodeURIComponent(s)}`,style:{...F,...k},"data-testid":"spatial-link"}),ce(t).some(y=>y.kind===l.kind||y.across===l.kind)?(0,w.jsxs)("p",{style:{...k,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",ce(t).filter(y=>y.kind===l.kind||y.across===l.kind).map((y,A)=>(0,w.jsxs)("span",{children:[A>0?" \xB7 ":null,(0,w.jsx)(L,{to:ge(t,y),style:F,children:y.title})," ",(0,w.jsx)(et,{context:t,stop:`#view=${encodeURIComponent(y.as)}`,style:{...F,...k,display:"inline-block",minWidth:24,textAlign:"center"},title:`${y.title}, in the scene`,children:"\u2197"})]},Le(y)))]}):null]}),ue&&g?(0,w.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,w.jsx)(Hn,{children:(0,w.jsx)(ue,{node:g,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...l.violations.length>0?{flagged:[s]}:{}})})}):null,l.violations.length>0?(0,w.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:o.map((y,A)=>(0,w.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,w.jsx)(dt,{violation:y,schema:e.schema,...n?{brand:n}:{}}),(0,w.jsx)(pt,{store:e,repairs:sa(l.actions,y.repairs),...r?{principal:r}:{}})]},A))}):null,!ae&&(we.length>0||Oe)?(0,w.jsxs)("section",{style:{..._,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,w.jsx)("h2",{style:D,children:"The facts"}),rn(m,we).map((y,A)=>{let j=(0,w.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:y.fields.map(z=>z.files?(0,w.jsx)(xe,{as:"field",read:!a,nodeId:s,field:z.key,label:z.label,files:z.files,labelStyle:{...ne,fontSize:"0.75rem"},style:{gap:4}},z.key):z.long?(0,w.jsx)(In,{nodeId:s,field:z.key,label:z.label,value:z.value,style:{gridColumn:"1 / -1",gap:4},labelStyle:{...ne,fontSize:"0.75rem"},valueStyle:{fontSize:"1.0625rem",lineHeight:1.6}},z.key):(0,w.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,w.jsx)("dt",{style:{...ne,fontSize:"0.75rem"},children:z.label}),(0,w.jsx)("dd",{style:{margin:0,fontSize:"1.125rem",overflowWrap:"anywhere",minWidth:0},children:a?(0,w.jsx)(Pt,{nodeId:s,field:z.key,value:z.value,stored:z.stored}):z.value})]},z.key))});return y.title?(0,w.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,w.jsx)("h3",{"data-graview-field-group":y.title,style:{...D,fontSize:"1.0625rem"},children:y.title}),j]},A):(0,w.jsx)("div",{children:j},A)}),Oe?(0,w.jsx)(xe,{as:"unfilled",nodeId:s,skip:[...Q?.fields??[]],labelStyle:{...ne,fontSize:"0.75rem"},style:{gap:4}}):null]}):null,(ae?[]:N).map(y=>(0,w.jsxs)("section",{style:{..._,display:"grid",gap:10},children:[(0,w.jsx)("p",{style:ne,children:Xn(e,y)}),y.description?(0,w.jsx)("h2",{style:D,children:le(y.description)}):(0,w.jsxs)("h2",{style:D,"aria-label":ie(y.edgeKind),children:[y.direction==="in"?"\u2190 ":"\u2192 ",ie(y.edgeKind)]}),(0,w.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:y.targets.map(A=>(0,w.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,w.jsx)(ee,{kind:A.kind,brand:n,schema:e.schema,size:7}),(0,w.jsxs)(L,{to:q(e.schema,A.kind,A.id),style:{...F,fontSize:"1.125rem"},children:[A.label,A.apart?(0,w.jsxs)("span",{style:k,children:[" \xB7 ",A.apart]}):null]})]},A.id))}),(y.direction==="out"&&e.schema.edge(y.edgeKind)?.cardinality==="one"?[]:[...new Set(y.targets.map(A=>A.kind))]).map(A=>(0,w.jsxs)(L,{to:`/${G(e.schema,A)}?${encodeURIComponent(y.edgeKind)}=${encodeURIComponent(s)}`,style:{...F,...k},"data-testid":"related-all",children:["Sort and filter ",y.description??`these ${I(e,A).toLowerCase()}`,y.targets.some(j=>j.kind!==A)?` (${I(e,A).toLowerCase()})`:""," \u2192"]},A))]},`${y.edgeKind}|${y.direction}|${y.description??""}`)),!ae&&(C.length>0||l.actions.withheld.length>0)?(0,w.jsxs)("section",{style:{..._,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,w.jsx)("h2",{style:D,ref:u,tabIndex:-1,children:"What can be done"}),(0,w.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:C.map(y=>{let A=c===y.id;return(0,w.jsx)("button",{type:"button","data-affordance":y.id,"data-rank":y.rank,"aria-expanded":A,onClick:()=>f(A?null:y.id),style:{...tt,...A?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:y.label},y.id)})}),C.map(y=>{if(c!==y.id)return null;let A=e.allMutations().find(j=>j.name===y.mutation);return A?(0,w.jsxs)("div",{style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,w.jsx)("h3",{style:{...D,fontSize:"1.1875rem"},children:y.label}),A.description?(0,w.jsx)("p",{style:{...k,margin:0},children:A.description}):null,(0,w.jsx)(fe,{store:e,mutation:A,prefilled:y.args,open:y.open,label:y.label,onDone:()=>{f(null);let j=y.id;requestAnimationFrame(()=>{(u.current?.parentElement?.querySelector(`[data-affordance="${j.replace(/["\\]/g,"\\$&")}"]`)??u.current)?.focus()})},...r?{principal:r}:{}})]},y.id):null}),l.actions.withheld.length>0?(0,w.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:l.actions.withheld.map(y=>(0,w.jsxs)("li",{style:k,children:[(0,w.jsx)("s",{children:y.label})," \u2014 ",y.refusal.message]},y.id))}):null]}):null,E.length>0?(0,w.jsxs)("section",{style:{..._,display:"grid",gap:10},"data-testid":"record-history",children:[(0,w.jsx)("h2",{style:D,children:"What has happened"}),(0,w.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:E.map(y=>(0,w.jsxs)("li",{style:k,children:[(0,w.jsx)("span",{style:{color:"var(--graview-ink)"},children:y.intent})," \u2014 ",nt(y,r,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},y.id))})]}):null]})}var v=$(B(),1),sr=(0,W.lazy)(()=>import("./chunk.MVNIKZIC.js").then(t=>({default:t.DraftPage})));function lr({context:t,children:e}){let n=he(),r=t.store.schema,i=(0,W.useMemo)(()=>({href:a=>q(r,a.kind,a.id),go:a=>n(q(r,a.kind,a.id))}),[r,n]);return(0,v.jsx)(zn.Provider,{value:i,children:(0,v.jsx)(Bn.Provider,{value:(t.titleLevel??(t.framed&&!t.barAbove?1:2))-1,children:e})})}function dr({steering:t}){let e=de(),n=he(),r=`${e.pathname}${e.search}`;return(0,W.useLayoutEffect)(()=>t.at(r),[r,t]),(0,W.useLayoutEffect)(()=>{let i=d=>{d!==r&&n(d)};t.go.current=i;let a=t.pending?.current;return a!==void 0&&(t.pending.current=void 0,i(a)),()=>{t.go.current===i&&(t.go.current=void 0)}},[r,n,t]),null}function pr({context:t,to:e}){let{pathname:n}=de(),r=se(),i=(e??r)?.sayWhere,a=cr(t,n);return(0,W.useEffect)(()=>(i?.(a),()=>i?.(null)),[i,a]),null}function cr(t,e){let[n="",r,i]=e.split("/").filter(Boolean).map(d=>{try{return decodeURIComponent(d)}catch{return d}});if(i!==void 0)return"#";if(n==="places"&&r!==void 0){if(r===kt)return"#overview=1";let d=t.views?.places().find(s=>s.as===r);return d?`#focus=${encodeURIComponent(He(d.kind))}&view=${encodeURIComponent(d.as)}`:"#"}let a=ye(t.store.schema,n);return a?`#focus=${encodeURIComponent(r??He(a))}`:"#"}function gr({onNavigate:t,path:e}){let n=de(),r=Rt(),i=he(),a=`${n.pathname}${n.search}`,d=(0,W.useRef)(t);d.current=t;let s=(0,W.useRef)(null);(0,W.useEffect)(()=>{let o=s.current;s.current=a,o!==null&&(a===o&&r!=="PUSH"||d.current?.(a,r==="POP"?"pop":r==="REPLACE"?"replace":"push"))},[n.key]);let l=(0,W.useRef)(e);return(0,W.useEffect)(()=>{e===void 0||e===l.current||(l.current=e,e!==a&&i(e))},[e]),null}function Ra({context:t,registry:e,page:n}){let r=ke(),i=ye(t.store.schema,r.slug??""),a=n==="list"?Bt:qt,s=(i?e?.lookup(i,n):void 0)??a;return(0,v.jsx)(s,{context:t})}function ur({context:t,registry:e,children:n}){let r=(0,W.useRef)(null);return Rn(r),(0,v.jsx)("div",{ref:r,"data-graview-face":"pages",style:{display:"contents"},children:(0,v.jsx)(ha,{context:t,registry:e,root:r,children:n})})}function mr(){let{pathname:t}=de(),e=Rt(),n=(0,W.useRef)(null);(0,W.useLayoutEffect)(()=>{if(e!=="POP"){for(let a=n.current?.parentElement;a;a=a.parentElement){let{overflowY:d}=getComputedStyle(a);if((d==="auto"||d==="scroll")&&a.scrollHeight>a.clientHeight){a.scrollTop=0;return}}window.scrollTo(0,0)}},[t]);let r=(0,W.useRef)(t),i=(0,W.useRef)(!1);return(0,W.useEffect)(()=>{if(!i.current&&t===r.current)return;i.current=!0;let a=document.activeElement;if(a!==null&&a!==document.body&&a!==document.documentElement)return;let d=n.current?.closest("main")??document.querySelector("main"),l=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??d?.querySelector("h1, h2")??null??d??null;l&&(l.hasAttribute("tabindex")||l.setAttribute("tabindex","-1"),l.focus({preventScroll:!0}))},[t]),(0,v.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function fr({context:t,children:e}){let n=he(),r=(0,W.useMemo)(()=>({record:i=>{let a=t.store.graph.getNode(i);a&&n(q(t.store.schema,a.kind,i))},place:i=>{let a=t.views?.places().find(d=>d.as===i);a&&n(ge(t,a))}}),[t,n]);return(0,v.jsx)(Pn.Provider,{value:r,children:e})}function yr({context:t,Home:e}){let i=de().key==="default"?hn(t.views?.arrangement?.()?.first,t.store.schema,t.views?.places()??[]):void 0,a=i?.to==="place"?ge(t,i.place):i?.to==="kind"?`/${G(t.store.schema,i.kind)}`:void 0;return a?(0,v.jsx)(At,{to:a,replace:!0}):(0,v.jsx)(e,{context:t})}function Aa({context:t,registry:e}){let n=e?.lookupSurface("shell"),r=n!==void 0,i=r&&(e?.without().has("bar")??!1),a=r&&!i&&!t.embedded?{...t,barAbove:!0}:t,d=m=>n===void 0?(0,v.jsx)(it,{context:t,children:m}):i?(0,v.jsx)(n,{context:t,children:m}):(0,v.jsx)(it,{context:t,children:(0,v.jsx)(n,{context:a,children:m})}),s=e?.lookupSurface("home")??Ht,l=e?.lookupSurface("problems")??Gt,o=r?{...a,framed:!0}:t,[c,f]=(0,W.useState)(null),u=(0,W.useMemo)(()=>({onFind:f,find:!(e?.without().has("find")??!1),places:!(e?.without().has("places")??!1)}),[e]),g=(0,v.jsx)(ur,{context:t,registry:e,children:(0,v.jsx)(fr,{context:t,children:d((0,v.jsx)(v.Fragment,{children:(0,v.jsxs)(lr,{context:o,children:[(0,v.jsx)(mr,{}),(0,v.jsxs)(na,{children:[(e?.routes()??[]).map(({path:m,component:x})=>(0,v.jsx)(pe,{path:m,element:(0,v.jsx)(x,{context:o})},m)),(0,v.jsx)(pe,{path:"/",element:(0,v.jsx)(yr,{context:o,Home:s})}),(0,v.jsx)(pe,{path:"/problems",element:(0,v.jsx)(l,{context:o})}),(0,v.jsx)(pe,{path:"/~draft",element:(0,v.jsx)(W.Suspense,{fallback:null,children:(0,v.jsx)(sr,{context:o})})}),(0,v.jsx)(pe,{path:"/search",element:(0,v.jsx)(zt,{context:o})}),(0,v.jsx)(pe,{path:"/map",element:(0,v.jsx)(Kt,{context:o})}),(0,v.jsx)(pe,{path:"/places",element:(0,v.jsx)(Dt,{context:o})}),ce(o).some(m=>m.as===kt)?null:(0,v.jsx)(pe,{path:yn,element:(0,v.jsx)(At,{to:"/",replace:!0})}),(0,v.jsx)(pe,{path:"/places/:as",element:(0,v.jsx)(It,{context:o})}),(0,v.jsx)(pe,{path:"/:slug",element:(0,v.jsx)(Ra,{context:o,registry:e,page:"list"})}),(0,v.jsx)(pe,{path:"/:slug/:id",element:(0,v.jsx)(Ra,{context:o,registry:e,page:"record"})})]})]})}))})});return t.embedded||!r||i?g:(0,v.jsx)(ia.Provider,{value:u,children:(0,v.jsx)($n.Provider,{value:c,children:g})})}function hr({context:t,registry:e,basename:n,initialPath:r,onNavigate:i,path:a,steering:d}){(0,W.useState)(()=>t.views?Vn(t.views,t.store.schema,Wn(t.brand,t.store.schema)):void 0);let s=se(),l=t.store.seenBy(t.principal??{kind:"human"}),o=l===t.store?t:{...t,store:l};bn(t.store,t.principal);let c=(0,v.jsxs)(v.Fragment,{children:[i||a!==void 0?(0,v.jsx)(gr,{onNavigate:i,path:a}):null,d?(0,v.jsx)(dr,{steering:d}):null,o.presence||s?(0,v.jsx)(pr,{context:o,to:s}):null,(0,v.jsx)(Aa,{context:o,...e?{registry:e}:{}})]}),f=o.views?(0,v.jsxs)(xn,{store:o.store,views:o.views,...o.principal?{principal:o.principal}:{},...o.brand?{brand:o.brand}:{},...o.settings?{settings:o.settings}:{},...o.presence&&!s?{presence:o.presence}:{},...o.people?{people:o.people}:{},...o.onKeepLens?{onKeepLens:o.onKeepLens}:{},...o.ai?{ai:o.ai}:{},...o.app?{app:o.app}:{},children:[c,(0,v.jsx)(ma,{context:o})]}):c,u=o.files?(0,v.jsx)(Sn.Provider,{value:o.files,children:f}):f;if(r!==void 0){let g=n===void 0?r:`${n.replace(/\/$/,"")}${r}`;return(0,v.jsx)(ta,{initialEntries:[g],...n===void 0?{}:{basename:n},children:u})}return(0,v.jsx)(aa,{...n===void 0?{}:{basename:n},children:u})}export{Ka as a,hr as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as a}from"./chunk.
|
|
1
|
+
import{g as a}from"./chunk.GE5EAN36.js";import{b as s}from"./chunk.337WDTG3.js";function f(e){let r=new Map;for(let i of e.kinds){let n=e.tryDefinition(i),o=a(n);r.set(i,{fields:new Set(Object.keys(n?.fields?.shape??{})),edges:new Map(Object.entries(n?.edges??{}).map(([d,p])=>[d,p.cardinality??"many"])),...o?{computed:o}:{}})}let t=a(e);return t&&r.set(s,{computed:t}),r}export{f as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Da as G,Ea as F,Fa as v,Ha as q,Ia as W,Ka as T,La as A,Ma as h,Na as k,P as x,Q as R,T as O,Xa as j,Ya as B}from"./chunk.MKNXV4TM.js";function L(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function V(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(o=>`${o.key}:${o.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function Y(e,r){let o=[],i={};if(e.query&&(i.query=e.query),e.sort&&(r.sorts.some(l=>l.key===e.sort.by)?i.sort=e.sort:o.push(`sort ${e.sort.by}`)),e.filter){let l=e.filter.filter(p=>r.filters.find(a=>a.key===p.key)?!0:(o.push(`filter ${p.key}`),!1));l.length>0&&(i.filter=l)}return e.group&&(r.groups.some(l=>l.key===e.group.by)?i.group=e.group:o.push(`group ${e.group.by}`)),{arrangement:i,dropped:o}}function N(e,r){return R(e.schema.tryDefinition(r.kind),A(r))}var z=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function I(e,r,o){if(o==="label")return N(e,r);let i=e.schema.tryDefinition(r.kind);return i&&o in(i.fields.shape??{})?T(r)[o]:h(e.graph,r.id,o).map(p=>N(e,p)).sort()[0]}var P=/^(\d{4})-(\d{2})-(\d{2})/;function U(e,r){let o=P.exec(e);if(!o)return;let[,i,l,p]=o;if(r==="day")return`${i}-${l}-${p}`;if(r==="month")return`${i}-${l}-01`;if(r==="year")return`${i}-01-01`;if(r==="decade")return`${String(Number(i)-Number(i)%10).padStart(4,"0")}-01-01`;let s=new Date(Date.UTC(Number(i),Number(l)-1,Number(p))),a=(s.getUTCDay()+6)%7;return s.setUTCDate(s.getUTCDate()-a),s.toISOString().slice(0,10)}var Q=["January","February","March","April","May","June","July","August","September","October","November","December"];function _(e,r){return r==="month"?`${Q[Number(e.slice(5,7))-1]} ${e.slice(0,4)}`:r==="week"?`Week of ${e}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:e}function K(e,r){let{words:o,conditions:i}=j(r);if(o.length===0&&i.length===0)return()=>!0;let l=new Map,p=s=>{let a=l.get(s);return a||(a=new Set(q(e.schema,s).filters.map(u=>u.key)),l.set(s,a)),a};return s=>{let a=p(s.kind),u=i.filter(g=>a.has(g.key));return u.every(g=>k(e,s,g))?o.length>0?B(e.schema.tryDefinition(s.kind),A(s),o)!==void 0:u.length>0:!1}}function X(e,r,o){let i=r.query?.trim(),l=i?e.filter(K(o,i)):e,p=r.filter?.length?l.filter(n=>r.filter.every(f=>k(o,n,f))):[...l],s=r.sort,a=s?p.map((n,f)=>({node:n,index:f,value:I(o,n,s.by)})).sort((n,f)=>{let t=z(n.value,f.value),d=s.direction==="desc"&&t!==0&&n.value!==void 0&&f.value!==void 0?-t:t;return d!==0?d:n.index-f.index}).map(n=>n.node):p,u=r.group;if(!u)return{nodes:a,groups:[{key:"",label:"",nodes:a}],grouped:!1};let g=new Map,c=(n,f,t)=>{let d=g.get(n)??{label:f,nodes:[]};d.nodes.push(t),g.set(n,d)},$=a[0],m=$?o.schema.tryDefinition($.kind):void 0,C=m?.fields.shape??{},E=m?G(m,u.by):O(u.by),b=u.by in C,y=b?F(C[u.by]):void 0,H=v(o.schema,$?.kind??"").find(n=>n.key===u.by)?.label,S=b?`No ${E.toLowerCase()}`:`Without ${(H??O(u.by)).toLowerCase()}`,M=b?new Map:x([...new Map(a.flatMap(n=>h(o.graph,n.id,u.by)).map(n=>[n.id,n])).values()].map(A),n=>o.schema.tryDefinition(n));for(let n of a){if(b){let t=T(n)[u.by];if(t==null||t==="")c("",S,n);else if(y==="date"){let d=u.bucket??"day",D=U(String(t),d);D?c(D,_(D,d),n):c("",S,n)}else if(y==="boolean")c(t?"1":"0",t?"Yes":"No",n);else{let d=m?.display?.format?.[u.by];c(String(t),d?d(t):String(t),n)}continue}let f=h(o.graph,n.id,u.by).map(t=>({id:t.id,label:M.has(t.id)?`${N(o,t)} \xB7 ${M.get(t.id)}`:N(o,t)})).sort((t,d)=>t.label.localeCompare(d.label));f.length===0?c("",S,n):c(f.map(t=>t.id).join(","),f.map(t=>t.label).join(", "),n)}let w=y==="choice"?W(C[u.by]):void 0,J=[...g.entries()].sort(([n,f],[t,d])=>n===""?1:t===""?-1:w?w.indexOf(n)-w.indexOf(t):y==="boolean"?t.localeCompare(n):y==="date"?n.localeCompare(t):f.label.localeCompare(d.label)).map(([n,f])=>({key:n,label:f.label,nodes:f.nodes}));return{nodes:a,groups:J,grouped:!0}}export{L as a,V as b,Y as c,X as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as F,Ca as j,Q as E,S as N,T as z,V,W as Q,Y as K,Z as U,_ as W,ya as X,za as x}from"./chunk.MKNXV4TM.js";function Y(){return{name:"insight",derive({store:n,nodes:s,kindSelection:i}){let l=[],k=d=>E(n.schema.tryDefinition(d.kind),d);for(let d of s){if([...n.schema.edgeKinds].reduce((y,e)=>y+n.graph.out(d.id,e).length+n.graph.in(d.id,e).length,0)===0){l.push({id:`insight:island:${d.id}`,text:`${k(d)} is connected to nothing yet`,nodeIds:[d.id]});continue}for(let y of n.schema.edgeKinds){let e=n.graph.in(d.id,y).length;if(e<3)continue;let t=[...n.graph.allEdges()].filter(o=>o.kind===y),f=t.length;f>=4&&e/f>.6&&l.push({id:`insight:load:${d.id}:${y}`,text:`${k(d)} ${cn(n,t,y,e)}`,nodeIds:[d.id]})}}for(let d of i){if(n.graph.nodesOfKind(d).length>0)continue;let w=n.schema.definitions.filter(y=>y.kind!==d).filter(y=>Object.values(y.edges).some(e=>e.to!=="*"&&e.to.includes(d))).map(y=>y.plural??`${y.kind}s`);w.length>0&&l.push({id:`insight:gap:${d}`,text:`Nothing here yet, though ${w.join(" and ")} expect to connect to these`,nodeIds:[]})}return{observations:l}}}}function cn(n,s,i,l){let k=new Set(s.map(t=>n.graph.getNode(t.from)?.kind).filter(t=>t!==void 0)),d=k.size===1?[...k][0]:void 0,w=s.length,y=K(n.schema,d??[...k][0]??"",i,"in"),e=t=>d?V(n.schema,d,t):String(t);return l===w?`${y}: all ${e(l)}`:`${y}: ${l} of the ${e(w)}`}function nn(n){let s=new Map;if(n.length===0)return s;let i=n.slice(-512),l=new Set;for(let d of i)d.undoes&&l.add(d.undoes);let k=n[n.length-1].seq;for(let d of i){if(!d.mutation||l.has(d.id))continue;let w=Math.pow(.5,(k-d.seq)/64);s.set(d.mutation.name,(s.get(d.mutation.name)??0)+w)}return s}function en(n){return 8*(n/(n+1))}var un=100;function tn(){return{name:"invariant",derive({store:n,selection:s,nodes:i,violations:l}){let k=t=>E(n.schema.tryDefinition(t.kind),t),d=new Set(s),w=l.filter(t=>t.nodeIds.some(f=>d.has(f))||t.subjectId!==void 0&&d.has(t.subjectId)),y=[],e=[];w.forEach((t,f)=>{e.push({id:`violation:${t.invariant}:${f}`,text:t.message,nodeIds:t.nodeIds}),t.repairs.forEach((o,g)=>{y.push({id:`invariant:${t.invariant}:${f}:${g}`,label:o.label,provider:"invariant",mutation:o.mutation,args:o.args??{},open:(o.missing??[]).map(a=>{let c=n.allMutations().find(u=>u.name===o.mutation);if(!c)return{name:a};let m=x(c.input).find(u=>u.name===a),v=m?m.kinds.includes("*")?n.graph.allNodes().map(u=>u.id):m.kinds.flatMap(u=>n.graph.nodesOfKind(u).map(p=>p.id)):void 0;return{name:a,shape:j(c.input,a),...m?{kinds:m.kinds}:{},...v?{candidates:v}:{}}}),score:un-g-(o.missing?.length??0),why:t.message,nodeIds:t.nodeIds,...t.subjectId===void 0?{}:{subjectId:t.subjectId}})})});for(let t of i){let f=n.allInvariants().filter(o=>{if(o.scope==="graph")return!1;let g=o.scope;return g.kind!==t.kind?!1:g.match?g.match(t):!0});f.length!==0&&(w.some(o=>o.subjectId===t.id||o.nodeIds.includes(t.id))||e.push({id:`holds:${t.id}`,text:`${k(t)} holds \u2014 nothing currently breaks ${f.length===1?"it":`any of its ${f.length} rules`}`,nodeIds:[t.id]}))}return{affordances:y,observations:e}}}}var B=40;function sn(){return{name:"schema",derive({store:n,selection:s,nodes:i,kindSelection:l,edgeSelection:k}){let d=[];if(i.length===0&&k.length>0){for(let e of k){let t=n.graph.getNode(e.from),f=n.graph.getNode(e.to);if(!(!t||!f))for(let o of n.allMutations()){let g=(o.connects??[]).includes(e.kind),a=(o.severs??[]).includes(e.kind);if(!g&&!a)continue;let c={},m=[],v=x(o.input);for(let p of v){let S=p.kinds.includes("*")||p.kinds.includes(t.kind),A=p.kinds.includes("*")||p.kinds.includes(f.kind),$=S&&!v.some(h=>h!==p&&(h.kinds.includes(t.kind)||h.kinds.includes("*")));S&&!A?c[p.name]=e.from:A&&!S?c[p.name]=e.to:S&&A&&$?c[p.name]=e.from:m.push({name:p.name,kinds:p.kinds,candidates:[e.from,e.to],shape:j(o.input,p.name)})}for(let p of _(o.input,""))p in c||m.some(S=>S.name===p)||m.push({name:p,shape:j(o.input,p)});m.every(p=>p.optional===!0?!0:p.kinds!==void 0?(p.candidates?.length??0)>0:(p.candidates?.length??0)>0||p.shape!==void 0&&p.shape.type!=="unknown")&&(g&&!a&&m.length===0||d.push({id:`schema:edge:${o.name}:${e.kind}:${e.from}:${e.to}`,label:N(o),provider:"schema",mutation:o.name,args:c,open:m,...o.destructive?{destructive:!0}:{},score:(a?62:58)-m.length,why:`this line is "${K(n.schema,n.graph.getNode(e.from)?.kind??"",e.kind,"out")}"`,nodeIds:[e.from,e.to]}))}}return{affordances:d}}if(i.length===0&&l.length>0){let e=new Set(l),t=[];for(let f of n.allMutations()){if(!(f.creates??[]).some(a=>e.has(a)))continue;let o=[];for(let a of x(f.input)){let c=a.kinds.includes("*")?n.graph.allNodes().map(m=>m.id):a.kinds.flatMap(m=>n.graph.nodesOfKind(m).map(v=>v.id));o.push({name:a.name,kinds:a.kinds,candidates:c,shape:j(f.input,a.name),...a.optional?{optional:!0}:{}})}for(let a of _(f.input,""))o.some(c=>c.name===a)||o.push({name:a,shape:j(f.input,a)});if(!o.every(a=>a.optional===!0?!0:a.kinds!==void 0?(a.candidates?.length??0)>0:(a.candidates?.length??0)>0||a.shape!==void 0&&a.shape.type!=="unknown")){let a=o.filter(c=>c.optional!==!0&&c.kinds!==void 0&&!c.kinds.includes("*")&&(c.candidates?.length??0)===0);if(a.length>0){let c=[...new Set(a.flatMap(m=>m.kinds??[]))].map(m=>W(F(n.schema.tryDefinition(m),m)));t.push({id:`schema:waits:${f.name}`,text:`"${f.title??f.name}" cannot begin until there is ${c.length===1?c[0]:`${c.slice(0,-1).join(", ")} and ${c[c.length-1]}`}.`,nodeIds:[]})}continue}d.push({id:`schema:add:${f.name}`,label:N(f),provider:"schema",mutation:f.name,args:{},open:o,score:B-o.length,why:`this makes ${(f.creates??[]).filter(a=>e.has(a)).map(a=>W(F(n.schema.tryDefinition(a),a))).join(", ")}`,nodeIds:[]})}return{affordances:d,observations:t}}if(i.length===0)return{};let w=new Set(i.map(e=>e.kind)),y=(e,t,f)=>{let o=[];for(let g of n.graph.allEdges()){if(!t.includes(g.kind))continue;let a=g.from===e?g.to:g.to===e?g.from:null;if(!a)continue;let c=n.graph.getNode(a);c&&(!f.includes("*")&&!f.includes(c.kind)||o.includes(a)||o.push(a))}return o};for(let e of n.allMutations()){let t=e.subject;if(!t||!(t.kinds==="*"?!0:[...w].every(u=>t.kinds.includes(u))))continue;let o=i.length===1?i[0].id:null,g=e.severs??[],a=e.connects??[];if(o&&g.length>0&&a.length===0&&y(o,g,["*"]).length===0)continue;let c=[];for(let u of x(e.input)){if(u.name===t.arg)continue;let p=u.kinds.includes("*")?n.graph.allNodes().map(S=>S.id):u.kinds.flatMap(S=>n.graph.nodesOfKind(S).map(A=>A.id));if(o&&a.length>0){let S=new Set(y(o,a,u.kinds));p=p.filter(A=>!S.has(A))}else o&&g.length>0&&(p=y(o,g,u.kinds));c.push({name:u.name,kinds:u.kinds,candidates:p.filter(S=>!s.includes(S)),shape:j(e.input,u.name),...u.optional?{optional:!0}:{}})}for(let u of _(e.input,t.arg))c.some(p=>p.name===u)||c.push({name:u,shape:j(e.input,u)});if(c.length===0&&o){let u=fn(e.input,t.arg);if(u.length>0&&!ln(n,e.name,{[t.arg]:o}))for(let p of u){let S=x(e.input).find(A=>A.name===p);c.push({name:p,optional:!0,...S?{kinds:S.kinds}:{},shape:j(e.input,p)})}}if(!c.every(u=>u.optional===!0?!0:u.kinds!==void 0?(u.candidates?.length??0)>0:(u.candidates?.length??0)>0||u.shape!==void 0&&u.shape.type!=="unknown"))continue;let v=i.map(u=>({[t.arg]:u.id}));c.length===0&&!v.some(u=>n.wouldChange({name:e.name,args:u}))||d.push({id:`schema:${e.name}`,label:i.length>1?`${N(e)} (${i.length})`:N(e),provider:"schema",mutation:e.name,args:v[0]??{},open:c,...e.destructive?{destructive:!0}:{},...g.length>0||a.length>0?{ties:!0}:{},...i.length>1?{batch:v}:{},score:B-c.length,why:i.length>1?`all ${i.length} selected nodes are ${[...w].map(u=>Q(n.schema,u).toLowerCase()).join(" or ")}`:`this is ${W(F(n.schema.tryDefinition(i[0].kind),i[0].kind))}`,nodeIds:i.map(u=>u.id)})}if(i.length===1){let e=i[0];for(let t of n.allMutations()){let f=t.subject,o=t.severs??[],g=t.connects??[];if(!f||o.length===0&&g.length===0)continue;let a=f.kinds==="*"?"*":f.kinds;if(a==="*"||a.includes(e.kind))continue;let c=x(t.input),m=c.find(h=>h.name!==f.arg&&(h.kinds.includes("*")||h.kinds.includes(e.kind)));if(!m)continue;let v=a,u=v.includes("*")?n.graph.allNodes().map(h=>h.id):v.flatMap(h=>n.graph.nodesOfKind(h).map(O=>O.id)),p=new Set(y(e.id,g.length>0?g:o,v)),S=g.length>0?u.filter(h=>!p.has(h)):u.filter(h=>p.has(h));if(S.length===0)continue;let A=[{name:f.arg,kinds:v,candidates:S,shape:j(t.input,f.arg)}];for(let h of c){if(h.name===m.name||h.name===f.arg)continue;let O=h.kinds.includes("*")?n.graph.allNodes().map(I=>I.id):h.kinds.flatMap(I=>n.graph.nodesOfKind(I).map(R=>R.id));A.push({name:h.name,kinds:h.kinds,candidates:O,shape:j(t.input,h.name),...h.optional?{optional:!0}:{}})}for(let h of _(t.input,m.name))h===f.arg||A.some(O=>O.name===h)||A.push({name:h,shape:j(t.input,h)});A.every(h=>h.optional===!0?!0:h.kinds!==void 0?(h.candidates?.length??0)>0:(h.candidates?.length??0)>0||h.shape!==void 0&&h.shape.type!=="unknown")&&d.push({id:`schema:tie:${t.name}:${e.id}`,label:t.fromTheOtherEnd??N(t),provider:"schema",mutation:t.name,args:{[m.name]:e.id},open:A,ties:!0,...t.destructive?{destructive:!0}:{},score:B-A.length+2,why:`${o.length>0?"this one is on":"this one could join"} ${A[0].candidates.length===1?"it":"one of these"}`,nodeIds:[e.id]})}}return{affordances:d}}}}function fn(n,s){let i=n.shape;return i?Object.entries(i).filter(([l,k])=>l!==s&&k.safeParse(void 0).success).map(([l])=>l):[]}function ln(n,s,i){try{return n.preview({name:s,args:i}),!0}catch{return!1}}function _(n,s){let i=n.shape;return i?Object.entries(i).filter(([l,k])=>l!==s&&!k.safeParse(void 0).success).map(([l])=>l):[]}var hn=70,gn=80,pn=new Set(["id","kind"]);function on(){return{name:"structure",derive({store:n,nodes:s}){let i=e=>E(n.schema.tryDefinition(e.kind),e);if(s.length<2)return{};let l=[],k=[],d=s.map(e=>e.id);for(let e of n.schema.edgeKinds){let t=mn(s.map(o=>new Set([...n.graph.out(o.id,e).map(g=>g.id),...n.graph.in(o.id,e).map(g=>g.id)])));for(let o of t){let g=n.graph.getNode(o);g&&l.push({id:`shared:${e}:${o}`,text:`all ${s.length} share "${i(g)}" (${z(e).toLowerCase()})`,nodeIds:[...d,o]})}let f=new Map;for(let o of s)for(let g of[...n.graph.out(o.id,e),...n.graph.in(o.id,e)])f.set(g.id,(f.get(g.id)??0)+1);for(let[o,g]of f){if(g!==s.length-1||s.length<3)continue;let a=n.graph.getNode(o);if(!a)continue;let c=s.find(m=>![...n.graph.out(m.id,e),...n.graph.in(m.id,e)].some(v=>v.id===o));if(c){l.push({id:`near-shared:${e}:${o}`,text:`all but "${i(c)}" share "${i(a)}" (${z(e).toLowerCase()})`,nodeIds:[...d,o]});for(let m of n.allMutations()){let v=m.subject;if(!v||v.kinds!=="*"&&!v.kinds.includes(c.kind))continue;let u=kn(m.input,a.kind);u&&k.push({id:`structure:join:${m.name}:${c.id}:${o}`,label:`${N(m)}: bring "${i(c)}" in line with the others`,provider:"structure",mutation:m.name,args:{[v.arg]:c.id,[u]:o},open:[],score:hn,why:`every other selected node is connected to "${i(a)}"`,nodeIds:[c.id,o]})}}}}let w=new Set;for(let e of s)for(let t of Object.keys(e))pn.has(t)||w.add(t);let y=e=>n.schema.definitions.find(t=>t.kind===e);for(let e of[...w].sort()){let t=y(s[0].kind),f=U(t,e).toLowerCase(),o=t?.display?.format?.[e],g=$=>{if(!o)return $;try{return String(o(JSON.parse($)))}catch{return $}},a=s.map($=>$[e]),c=new Map;if(a.forEach(($,h)=>{let O=JSON.stringify($??null),I=c.get(O);I?I.push(s[h]):c.set(O,[s[h]])}),c.size===1){let $=[...c.keys()][0];if($==="null")continue;l.push({id:`agree:${e}`,text:`all ${s.length} share the ${f} ${g($)}`,nodeIds:d});continue}if(s.length<3||c.size!==2)continue;let m=[...c.entries()].sort(($,h)=>h[1].length-$[1].length),[v,u]=m[0],[,p]=m[1];if(p.length!==1||v==="null")continue;let S=p[0],A=JSON.parse(v);l.push({id:`odd-one-out:${e}`,text:`${u.length} share the ${f} ${g(v)}; "${i(S)}" does not`,nodeIds:d});for(let $ of n.allMutations()){let h=$.subject;if(!h||h.kinds!=="*"&&!h.kinds.includes(S.kind))continue;let O=rn($.input);if(!O||!(e in O))continue;let I={[h.arg]:S.id,[e]:A},R=!0;for(let[M,J]of Object.entries(O)){if(M in I||J.safeParse(void 0).success)continue;let D=S[M];if(D===void 0){R=!1;break}I[M]=D}R&&k.push({id:`structure:align:${$.name}:${e}:${S.id}`,label:`Align the ${f} of "${i(S)}" with the other ${u.length}`,provider:"structure",mutation:$.name,args:I,open:[],score:gn,why:`${u.length} of ${s.length} share the ${f} ${g(v)}`,nodeIds:d})}}return{affordances:k,observations:l}}}}function mn(n){if(n.length===0)return[];let[s,...i]=n;return[...s].filter(l=>i.every(k=>k.has(l))).sort()}function rn(n){return n.shape??null}function kn(n,s){let i=rn(n);if(!i)return null;for(let[l]of Object.entries(i)){let k=X(i[l]);if(k&&(k.includes("*")||k.includes(s)))return l}return null}function yn(){return[tn(),on(),sn(),Y()]}function Kn(n,s,i={}){let l=an(),k=i.providers??yn(),d=s.map(r=>n.graph.getNode(r)).filter(r=>r!==void 0),w={store:n,selection:s,nodes:d,kindSelection:i.kindSelection??[],edgeSelection:i.edgeSelection??[],violations:n.violations(i.context),context:i.context??{}},y=[],e=[];for(let r of k){let b=r.derive(w);y.push(...b.affordances??[]),e.push(...b.observations??[])}let t=new Set(n.allMutations().filter(r=>r.pinned).map(r=>r.name)),f=new Set(i.pins?.pinned??[]),o=new Set(i.pins?.unpinned??[]),g=r=>f.has(r.mutation)?"user":t.has(r.mutation)&&!o.has(r.mutation)?"declared":void 0,a=r=>{let b=g(r);return b?{...r,pinned:b}:r},c=new Map;for(let[r,b]of nn(n.log.all()))c.set(r,en(b));let m=r=>r.pinned==="user"?0:r.pinned==="declared"?1:2,v=r=>r.score+(c.get(r.mutation)??0),u=new Map(n.allMutations().map(r=>[r.name,r])),p=new Map,S=r=>{let b=u.get(r.mutation);if(!b)return[];let P=p.get(r.mutation);P||(P=x(b.input).map(T=>T.name),p.set(r.mutation,P));let C=[];for(let T of r.batch??[r.args])for(let H of P){let Z=T[H]??r.args[H];typeof Z=="string"&&C.push(Z)}return C},A=i.focus,$=4,h=r=>r.open.length>0?1:0,O=r=>{if(A===void 0)return $;let b=S(r);return b.length>0?b.includes(A)?I(r,0):$:r.nodeIds.includes(A)||r.subjectId===A?I(r,1):$},I=(r,b)=>r.provider==="invariant"?b:2+h(r),R=bn(y).map(a),M=new Map(R.map((r,b)=>[r,b])),J=R.sort((r,b)=>{let P=Number(r.destructive??!1)-Number(b.destructive??!1);if(P!==0)return P;let C=O(r)-O(b);return C!==0?C:O(r)<2?M.get(r)-M.get(b):+(b.provider==="invariant")-+(r.provider==="invariant")||m(r)-m(b)||v(b)-v(r)||r.id.localeCompare(b.id)}),D=i.principal??{kind:"human"},L=[],G=[];for(let r of J){let b=n.permits({name:r.mutation,args:{...r.args,...r.batch?.[0]??{}}},D);if(b.ok)L.push(r);else{let P=Sn(n,r,D);if(P==="done")continue;P?L.push(P):G.push({...r,refusal:b.refusal})}}let q=L.map((r,b)=>({...r,rank:b})),dn=G.map((r,b)=>({...r,rank:L.length+b}));return{affordances:i.limit===void 0?q:q.slice(0,i.limit),withheld:dn,observations:vn(e),ms:an()-l}}function bn(n){let s=new Map;for(let i of n){let l=[i.mutation,JSON.stringify(i.args),JSON.stringify(i.batch??null)].join("|"),k=s.get(l);(!k||i.score>k.score)&&s.set(l,i)}return[...s.values()]}function vn(n){let s=new Map;for(let i of n)s.set(i.text,i);return[...s.values()]}function an(){return typeof performance<"u"?performance.now():Date.now()}function Wn(n,s,i={},l={}){let k=(s.batch??[s.args]).map(w=>({name:s.mutation,args:{...s.args,...w,...i}})),d=n.allMutations().find(w=>w.name===s.mutation);return n.applyAll(k,{...d?.describe?{}:{intent:s.label},...l.author?{author:l.author}:{}})}function Fn(n,s,i={}){return n.preview({name:s.mutation,args:{...s.args,...i}})}function Sn(n,s,i){let l=n.allMutations().find(t=>t.name===s.mutation)?.subject,k=l!==void 0&&s.args[l.arg]===void 0,d=k?s.open.find(t=>t.name===l.arg):s.open.find(t=>t.name!==l?.arg&&t.candidates);if(!d?.candidates)return;let w=t=>n.permits({name:s.mutation,args:{...s.args,...s.batch?.[0]??{},[d.name]:t}},i).ok,y=d.candidates.filter(w),e=i.id===void 0?void 0:n.graph.getNode(i.id);if(y.length===0){let t=k?l.kinds:"*";return e!==void 0&&(t==="*"||t.includes(e.kind))&&w(e.id)?"done":void 0}return y.length===1&&y[0]===i.id?{...s,args:{...s.args,[d.name]:i.id},open:s.open.filter(t=>t!==d)}:{...s,open:s.open.map(t=>t===d?{...t,candidates:y}:t)}}export{Kn as a,Wn as b,Fn as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as n}from"./chunk.RZLNDVGN.js";import"./chunk.4TUNX4WM.js";import"./chunk.7S22MBNN.js";import"./chunk.ONDILMIX.js";import{f as s}from"./chunk.J6CBMLGR.js";import"./chunk.TBG2QBOS.js";import"./chunk.BCBH6WJF.js";import"./chunk.A73BXXE4.js";import"./chunk.N7HCALRK.js";import"./chunk.IKT7JQUW.js";import"./chunk.ISRS7GOT.js";import"./chunk.DCIC3YHX.js";import"./chunk.WHTNSETN.js";import"./chunk.WVUJXDXZ.js";import"./chunk.46KUPBQC.js";import"./chunk.N2WTNKEV.js";import"./chunk.SBHVVJY7.js";import"./chunk.GE5EAN36.js";import"./chunk.337WDTG3.js";import"./chunk.PWHJHFC4.js";import"./chunk.EYF6ONTA.js";import"./chunk.Q3HVA6L4.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.2GBQJXJH.js";import"./chunk.ZJDRD6PO.js";import"./chunk.SNBIZ3B6.js";import"./chunk.6LJ66MB7.js";import"./chunk.NRRUGG22.js";import"./chunk.MKNXV4TM.js";import{a as y,b as i}from"./chunk.MRK6QJV5.js";import{b as r}from"./chunk.AJZBJBMO.js";var c=r(y(),1),e=r(i(),1);function v({store:d,views:t,as:a,scope:o}){let l=(0,c.useMemo)(()=>s({scope:`.${o}`}),[o]);return(0,e.jsxs)("div",{"data-testid":"embed-picture","data-embed-content":"",tabIndex:0,"aria-label":t.places().find(m=>m.as===a)?.title??"The picture",style:{flex:"1 1 auto",minHeight:0,display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)"},children:[(0,e.jsx)("style",{children:l}),(0,e.jsx)(n,{store:d,views:t,as:a})]})}export{v as PictureFace};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as L}from"./chunk.
|
|
1
|
+
import{d as L}from"./chunk.7S22MBNN.js";import{a as R,b as O,c as v,d as P}from"./chunk.ONDILMIX.js";import"./chunk.J6CBMLGR.js";import"./chunk.A73BXXE4.js";import"./chunk.N7HCALRK.js";import"./chunk.ISRS7GOT.js";import{a as E,b as T}from"./chunk.DCIC3YHX.js";import"./chunk.WHTNSETN.js";import"./chunk.WVUJXDXZ.js";import"./chunk.46KUPBQC.js";import"./chunk.N2WTNKEV.js";import"./chunk.SBHVVJY7.js";import"./chunk.GE5EAN36.js";import"./chunk.337WDTG3.js";import"./chunk.PWHJHFC4.js";import"./chunk.EYF6ONTA.js";import"./chunk.Q3HVA6L4.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.2GBQJXJH.js";import"./chunk.ZJDRD6PO.js";import"./chunk.SNBIZ3B6.js";import"./chunk.6LJ66MB7.js";import{wa as x}from"./chunk.NRRUGG22.js";import{Hb as k}from"./chunk.MKNXV4TM.js";import{a as D,b as C}from"./chunk.MRK6QJV5.js";import{b as S}from"./chunk.AJZBJBMO.js";var o=S(D(),1);var i=S(C(),1);function W(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let r=c??document,a=r.querySelector("main")??r.querySelector("[data-graview-page]")??null,n=r.querySelector("[data-graview-page-title]")??a?.querySelector("h1, h2")??a;n instanceof HTMLElement&&(n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus({preventScroll:!0}))}var H=1500;function z(c,e,r){let{store:a,principal:n}=c,u=L(a),l=(0,o.useMemo)(()=>R(a,n),[a,n,u]),b=(0,o.useRef)(r),[p,m]=(0,o.useState)(),[s,f]=(0,o.useState)("");(0,o.useEffect)(()=>{let t=O(a,n,b.current);b.current=a.batches().length,t&&(m({batch:t.batch,at:e,when:Date.now()}),f(""))},[a,n,u]),(0,o.useEffect)(()=>{m(t=>!t||t.at===e?t:Date.now()-t.when<H?{...t,at:e}:void 0)},[e]);let[g,h]=(0,o.useState)(null),y=(0,o.useCallback)(()=>{m(void 0),h(null)},[]),w=(0,o.useCallback)(()=>{h(null);try{let t=P(a,n);t&&f(`Took back \u201C${t.intent}\u201D`)}catch(t){h(t instanceof Error?t.message:String(t))}},[a,n]),d=l&&p?.batch===l.batch&&p.at===e?l:void 0;return{change:l,offered:d,close:y,takeBack:w,refused:g,said:s}}function Y({context:c,docked:e,at:r,since:a}){let{change:n,offered:u,close:l,takeBack:b,refused:p,said:m}=z(c,r,a),s=e?u:n,f=(0,o.useRef)(null),g=e&&(s!==void 0||p!==null);B(f,g),(0,o.useEffect)(()=>{if(!g)return;let d,t=()=>d=setTimeout(()=>f.current?.matches(":hover, :focus-within")?t():l(),1e4);return t(),()=>clearTimeout(d)},[g,s?.batch,p,l]);let h=m||(e&&s?v(s):""),y=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:k("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...g?{}:{display:"none"}}:{},w=s?(0,i.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${v(s)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");b(),requestAnimationFrame(()=>W(t))},style:e?I:A,children:[(0,i.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),(0,i.jsx)("span",{style:e?j:F,children:v(s)})]}):null;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{role:"status","aria-live":"polite",style:N,children:h}),(0,i.jsxs)("div",{ref:f,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",style:{display:"grid",justifyItems:"end",gap:4,maxWidth:"100%",minWidth:0,...y},children:[e&&s?(0,i.jsxs)("div",{"data-testid":"page-undo-notice",style:_,children:[w,(0,i.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${v(s)}`,title:"Dismiss",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");l(),requestAnimationFrame(()=>W(t))},style:q,children:"\xD7"})]}):w,p?(0,i.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",background:e?"var(--graview-float)":void 0,padding:e?"4px 8px":void 0,borderRadius:6},children:p}):null]})]})}function B(c,e){(0,o.useLayoutEffect)(()=>{let r=c.current;if(!r||!e)return;if(typeof r.showPopover=="function"&&!x(r))try{r.showPopover()}catch{}let a=()=>r.parentElement?.closest("[data-embed-content]")??null,n=()=>{T(r,a()),dispatchEvent(new Event(E))};n(),addEventListener("resize",n),addEventListener("scroll",n,!0);let u=typeof ResizeObserver=="function"?new ResizeObserver(n):null;return u?.observe(r),()=>{if(u?.disconnect(),removeEventListener("resize",n),removeEventListener("scroll",n,!0),r.isConnected&&x(r))try{r.hidePopover()}catch{}dispatchEvent(new Event(E))}},[c,e])}var A={display:"inline-flex",alignItems:"center",gap:6,minHeight:36,maxWidth:"100%",minWidth:0,padding:"0 14px",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",font:"inherit",fontSize:"0.875rem",cursor:"pointer"},I={...A,textAlign:"start",lineHeight:1.4,padding:"8px 4px 8px 14px",border:"none",background:"none",color:"inherit"},_={display:"flex",alignItems:"center",gap:2,maxWidth:"100%",minWidth:0,paddingRight:6,borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},q={flex:"0 0 auto",minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"1rem",cursor:"pointer"},F={minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},j={minWidth:0,overflow:"hidden",overflowWrap:"anywhere",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:4},N={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};export{Y as TakeBack};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as B}from"./chunk.
|
|
1
|
+
import{e as B}from"./chunk.Q3HVA6L4.js";import{A as M,da as _,h as q}from"./chunk.NRRUGG22.js";import{$ as T,P as H,Q as L,T as R,Y as K,bb as j}from"./chunk.MKNXV4TM.js";import{a as J,b as G}from"./chunk.MRK6QJV5.js";import{b as $}from"./chunk.AJZBJBMO.js";var i=$(J(),1),a=$(G(),1);function ae({affordance:r,onApply:o,onCancel:u}){let{store:l}=_(),[y,m]=(0,i.useState)({}),[f,x]=(0,i.useState)(""),[A,F]=(0,i.useState)(U),W=(0,i.useId)(),O=(0,i.useRef)(null),v=r.open.filter(e=>!(e.name in y)),s=v[0];if((0,i.useEffect)(()=>x(""),[s?.name]),(0,i.useEffect)(()=>{O.current?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[s?.name]),(0,i.useLayoutEffect)(()=>{let e=O.current,n=typeof document>"u"?null:document.activeElement;if(!e||n&&n!==document.body&&!e.contains(n))return;let p=e.querySelector("form input, [role=group] button:not([disabled])");p&&p!==n&&p.focus()},[s?.name]),!s)return null;let h=e=>{let n={...y,[s.name]:e};if(r.open.filter(c=>!(c.name in n)).length===0){let c=o(Object.fromEntries(Object.entries(n).filter(([,E])=>E!==void 0)));c&&c.length>0&&m(Object.fromEntries(Object.entries(n).filter(([E])=>!c.includes(E))))}else m(n)},N=s.optional?(0,a.jsx)("button",{type:"button",onClick:()=>h(void 0),style:{fontSize:"0.8125rem"},children:"Skip"}):null,t=s.shape??{type:"unknown"},d=Q(s,t),g=j(l.schema,l.allMutations().find(e=>e.name===r.mutation),s.name),[z,V]=(0,i.useState)(""),I=(0,i.useMemo)(()=>{let e=d.map(n=>l.graph.getNode(n)).filter(n=>n!==void 0);return H(e,n=>l.schema.tryDefinition(n))},[d,l]),C=e=>{let n=Z(l,t,e),p=t.type==="choice"||t.type==="several"&&t.of.type==="choice"?g.option(e):n,c=I.get(e);return c?`${p} \xB7 ${c}`:p},w=(0,i.useMemo)(()=>{let e=z.trim().toLowerCase();return e===""?d:d.filter(n=>C(n).toLowerCase().includes(e))},[d,z,l,t,I]),b=t.type==="several",P=t.type==="file"?t:t.type==="several"&&t.of.type==="file"?t.of:void 0,D=b&&d.length===0,k=s.kinds&&s.kinds.length>0&&!s.kinds.includes("*")?s.kinds.map(e=>R(T(l.schema.tryDefinition(e),e))).join(" or "):g.label,Y=r.open.length>1?`${k} \xB7 ${r.open.length-v.length+1} of ${r.open.length}`:k;return(0,a.jsxs)("div",{ref:O,"data-graview-asking":r.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:4,padding:"5px 0 2px"},children:[r.open.length>1||d.length>0?(0,a.jsx)("span",{id:W,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:Y}):null,d.length>S?(0,a.jsx)("input",{type:"search",value:z,onChange:e=>V(e.target.value),placeholder:`Filter ${d.length}\u2026`,"aria-label":`Filter ${k}`,"data-testid":"ask-filter",style:{font:"inherit",fontSize:"0.8125rem",minWidth:0,padding:"3px 7px"}}):null,P?(0,a.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,a.jsx)(B,{as:"control",value:void 0,onChange:h,several:b,image:P.image===!0,label:g.label}),N]}):d.length>0?(0,a.jsxs)("div",{role:"group","aria-labelledby":W,style:{display:"flex",flexWrap:"wrap",gap:4},children:[w.slice(0,S).map(e=>{let n=A.includes(e);return(0,a.jsx)("button",{type:"button","aria-label":`${k}: ${C(e)}`,...b?{"aria-pressed":n}:{},style:{padding:"3px 9px",fontSize:"0.8125rem",...n?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},onClick:()=>b?F(p=>p.includes(e)?p.filter(c=>c!==e):[...p,e]):h(t.type==="boolean"?e==="yes":e),children:C(e)},e)}),w.length>S?(0,a.jsxs)("span",{"data-testid":"ask-more",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:[w.length-S," more \u2014 type to narrow"]}):null,w.length===0?(0,a.jsxs)("span",{"data-testid":"ask-none",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["None of the ",d.length," match that."]}):null,b?(0,a.jsx)("button",{type:"button",disabled:A.length===0,style:{fontSize:"0.8125rem"},onClick:()=>{let e=A;F(U),h(e)},children:v.length>1?"Next":"Apply"}):null,N]}):(0,a.jsxs)("form",{style:{display:"flex",flexWrap:"wrap",gap:4},onSubmit:e=>{if(e.preventDefault(),D){h(f.split(/[,\n]/).map(n=>n.trim()).filter(Boolean));return}f.trim().length!==0&&h(t.type==="number"?Number(f):f)},children:[t.type==="text"&&t.long?(0,a.jsx)("textarea",{autoFocus:!0,name:s.name,"aria-label":g.label,placeholder:g.label,value:f,rows:4,onChange:e=>x(e.target.value),onKeyDown:e=>{e.key==="Escape"?u():e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},style:{flex:"1 1 100%",minWidth:0,font:"inherit",fontSize:"0.875rem",lineHeight:1.45,padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",resize:"vertical",fieldSizing:"content",minHeight:"5.5em",maxHeight:"40vh"}}):(0,a.jsx)("input",{autoFocus:!0,type:t.type==="date"?t.time?"datetime-local":"date":t.type==="number"?"number":"text",name:s.name,"aria-label":g.label,placeholder:D?`${g.label}, separated by commas`:g.label,value:f,...t.type==="number"&&t.min!==void 0?{min:t.min}:{},...t.type==="number"&&t.max!==void 0?{max:t.max}:{},...t.type==="number"&&t.step!==void 0?{step:t.step}:{},onChange:e=>x(e.target.value),onKeyDown:e=>{e.key==="Escape"&&u()},style:{flex:1,minWidth:0,font:"inherit",fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}),(0,a.jsx)("button",{type:"submit",disabled:!D&&f.trim().length===0,style:{fontSize:"0.8125rem"},children:v.length>1?"Next":"Apply"}),N]})]})}var U=[],S=10;function Q(r,o){return r.candidates&&r.candidates.length>0?r.candidates:o.type==="choice"?o.options:o.type==="several"&&o.of.type==="choice"?o.of.options:o.type==="boolean"?X:[]}var X=["yes","no"];function Z(r,o,u){return o.type==="boolean"||o.type==="choice"||o.type==="several"&&o.of.type==="choice"?u:ee(r,u)}function ee(r,o){let u=q(o);if(u){let m=K(r.schema,r.graph.getNode(u.from)?.kind??"",u.kind,"out");return m.charAt(0).toUpperCase()+m.slice(1)}let l=M(o);if(l.length>0)return l.map(m=>r.schema.tryDefinition(m)?.plural??`${m}s`).join(" + ");let y=r.graph.getNode(o);return y?L(r.schema.tryDefinition(y.kind),y):o}export{ae as a,ee as b};
|