graview 0.1.26 → 0.1.27
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.OBQ4DIFO.js → chunk.4JXWQO6Y.js} +1 -1
- package/dist/preview/{chunk.564EIRAT.js → chunk.4R7LDCDO.js} +1 -1
- package/dist/preview/{chunk.XNYBOKLW.js → chunk.4W24TPMR.js} +1 -1
- package/dist/preview/{chunk.PKFL2AR4.js → chunk.5BN2ARQ2.js} +1 -1
- package/dist/preview/{chunk.2GFB5FOK.js → chunk.7CO6VP6F.js} +1 -1
- package/dist/preview/{chunk.KXWRS6LY.js → chunk.7QTBDACG.js} +1 -1
- package/dist/preview/{chunk.BK2MJOUN.js → chunk.7SVIRYBB.js} +1 -1
- package/dist/preview/chunk.7THQFY52.js +1 -0
- package/dist/preview/{chunk.YXQCEXZX.js → chunk.AS35X6KA.js} +1 -1
- package/dist/preview/{chunk.4INXWGIT.js → chunk.ATLUMYAJ.js} +1 -1
- package/dist/preview/{chunk.NQP3DWME.js → chunk.CW7BMVBG.js} +1 -1
- package/dist/preview/{chunk.VW7U4CT5.js → chunk.DG2UE7PJ.js} +1 -1
- package/dist/preview/{chunk.YOMW4MKD.js → chunk.DG2WKNMX.js} +1 -1
- package/dist/preview/{chunk.XD4Q4FI2.js → chunk.DQ5OWYLQ.js} +1 -1
- package/dist/preview/{chunk.UEEXBS2U.js → chunk.DY2FFBWF.js} +1 -1
- package/dist/preview/chunk.E3SZ7T75.js +1 -0
- package/dist/preview/{chunk.NIEQZOHX.js → chunk.EVTZE2OZ.js} +1 -1
- package/dist/preview/{chunk.QFJRXAU3.js → chunk.FS5K4AVA.js} +2 -2
- package/dist/preview/{chunk.5CXMUC6R.js → chunk.FTBKJ5RZ.js} +1 -1
- package/dist/preview/{chunk.LLUZMOBZ.js → chunk.GHMICJIB.js} +1 -1
- package/dist/preview/chunk.HO6JR7VY.js +1 -0
- package/dist/preview/{chunk.DRIWJRQW.js → chunk.HPD3DSTP.js} +1 -1
- package/dist/preview/chunk.I5KD54S6.js +1 -0
- package/dist/preview/chunk.IXVSJJQH.js +20 -0
- package/dist/preview/{chunk.ZOWWWRYA.js → chunk.IZDKEFPJ.js} +1 -1
- package/dist/preview/chunk.J36GTQTV.js +1 -0
- package/dist/preview/{chunk.I5U42VDK.js → chunk.KAKX5TZN.js} +2 -2
- package/dist/preview/{chunk.UUMXYMOX.js → chunk.LHAAZQNQ.js} +1 -1
- package/dist/preview/{chunk.HFFEOCYY.js → chunk.LQZ2VQWN.js} +2 -2
- package/dist/preview/chunk.MHJJEGQO.js +1 -0
- package/dist/preview/chunk.MNPNW4BQ.js +1 -0
- package/dist/preview/{chunk.XXNC2AFL.js → chunk.NKIFVPS3.js} +1 -1
- package/dist/preview/{chunk.XOC5BRPU.js → chunk.NQNQPPPM.js} +1 -1
- package/dist/preview/{chunk.OBGG4SYF.js → chunk.OA5BVKJH.js} +1 -1
- package/dist/preview/chunk.OHGJ5BZ4.js +2 -0
- package/dist/preview/{chunk.SVL6I37U.js → chunk.OYULDOQP.js} +1 -1
- package/dist/preview/{chunk.D3XF643V.js → chunk.PHY3AH3L.js} +1 -1
- package/dist/preview/{chunk.ECG7RM6L.js → chunk.Q7544RCB.js} +1 -1
- package/dist/preview/{chunk.NLFLFIDS.js → chunk.QZWN46V6.js} +1 -1
- package/dist/preview/chunk.RUC4HFVC.js +1 -0
- package/dist/preview/chunk.S5JWZIVE.js +1 -0
- package/dist/preview/chunk.SHDYLMZE.js +2 -0
- package/dist/preview/{chunk.ECRZZ3U4.js → chunk.T2EZ5MTH.js} +1 -1
- package/dist/preview/chunk.TMPV4HLQ.js +1 -0
- package/dist/preview/{chunk.LHIYFAN5.js → chunk.TX2GOL65.js} +1 -1
- package/dist/preview/{chunk.AAVCTGAE.js → chunk.U5ZUXGWM.js} +1 -1
- package/dist/preview/chunk.UMMN5Z6V.js +1 -0
- package/dist/preview/chunk.UPGDSOBY.js +1 -0
- package/dist/preview/{chunk.MLQQR57X.js → chunk.V57P4LIZ.js} +1 -1
- package/dist/preview/{chunk.KSEKVHJJ.js → chunk.VD6FJ6KJ.js} +1 -1
- package/dist/preview/{chunk.4MAYBFPU.js → chunk.VFICMX5G.js} +1 -1
- package/dist/preview/chunk.VMD4PDYJ.js +1 -0
- package/dist/preview/chunk.VMEX2KZ4.js +8 -0
- package/dist/preview/{chunk.LEVR7WLB.js → chunk.XDHBV5K5.js} +1 -1
- package/dist/preview/{chunk.AKWBAWQF.js → chunk.YO7UFBJP.js} +1 -1
- package/dist/preview/{chunk.24X6LFD3.js → chunk.YV2RTNPU.js} +1 -1
- package/dist/preview/chunk.ZD5HGRPR.js +1 -0
- package/dist/preview/chunk.ZKM4P7US.js +1 -0
- package/dist/preview/{chunk.3RT463XY.js → chunk.ZMMMKTAG.js} +1 -1
- package/dist/preview/{chunk.CL7GGNEK.js → chunk.ZNIJONZN.js} +1 -1
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.4YY54TMR.js +0 -1
- package/dist/preview/chunk.6GJF3F7L.js +0 -2
- package/dist/preview/chunk.6MZBFEXW.js +0 -1
- package/dist/preview/chunk.7OOKA2DK.js +0 -1
- package/dist/preview/chunk.7ZJPJARU.js +0 -1
- package/dist/preview/chunk.IQLDOIWD.js +0 -1
- package/dist/preview/chunk.JIWB6VGT.js +0 -2
- package/dist/preview/chunk.LCFCU3I3.js +0 -1
- package/dist/preview/chunk.LUUT2ZWF.js +0 -20
- package/dist/preview/chunk.P7YN4Z3K.js +0 -8
- package/dist/preview/chunk.PQ2IIC27.js +0 -1
- package/dist/preview/chunk.REODVRPZ.js +0 -1
- package/dist/preview/chunk.RH6VRP76.js +0 -1
- package/dist/preview/chunk.TAW67PZU.js +0 -1
- package/dist/preview/chunk.TUYKH4FG.js +0 -1
- package/dist/preview/chunk.WWWZZAHE.js +0 -1
- package/dist/preview/chunk.YIZ3DJO3.js +0 -1
- package/dist/preview/chunk.ZLPA5BAW.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.TX2GOL65.js";import{b as et,d as V}from"./chunk.T2EZ5MTH.js";import{a as _n,d as Yn,e as Jn}from"./chunk.ONDILMIX.js";import{a as Un,e as jn}from"./chunk.AS35X6KA.js";import{a as Ct}from"./chunk.I5KD54S6.js";import{a as Ze,b as qn}from"./chunk.NQNQPPPM.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.KAKX5TZN.js";import{a as Na}from"./chunk.IKT7JQUW.js";import{h as $n,i as En}from"./chunk.CW7BMVBG.js";import{e as Wn,i as Vn}from"./chunk.IZDKEFPJ.js";import{o as bt}from"./chunk.XDHBV5K5.js";import{c as Fn,d as On,j as We}from"./chunk.UMMN5Z6V.js";import{a as Qe,b as Ln,c as Tn,e as St,f as Mn}from"./chunk.7QTBDACG.js";import{e as xe}from"./chunk.4W24TPMR.js";import{f as Kn}from"./chunk.LHAAZQNQ.js";import{b as Nn,c as xt,d as Dn}from"./chunk.QZWN46V6.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.OYULDOQP.js";import{$ as an,$a as Ye,$b as hn,Fa as ln,Ga as dn,Gb as fn,Ia as pn,N as $e,O as _e,P as re,Q as Zt,S as ie,U as en,W as tn,Wa as cn,Wb as kt,Xa as gn,Xb as yn,Z as nn,Za as un,_ as be,aa as rn,ab as mn,cb as Je,ka as vt,la as on,qa as sn}from"./chunk.VMEX2KZ4.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.AKWBAWQF.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.MLQQR57X.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.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as _e,c as ae,d as We,e as ne,g as he,h as He,m as Je,o as te}from"./chunk.OHGJ5BZ4.js";import{A as Me,Ab as Ze,D as me,E as Pe,L as ge,M as Te,S as Ne,Z as Fe,a as Oe,b as Re,c as xe,d as ee,da as Ce,db as Le,ea as Ve,f as pe,h as B,ha as ye,i as Ae,ia as Ie,j as je,k as se,l as Se,m as Ee,o as ze,p as De,pb as qe,q as fe,ra as Z,v as Ge,wa as Ke,x as ue,y as $e,zb as Be}from"./chunk.VMEX2KZ4.js";function un(n,l){let e=n.brand??{},o=e.accent?Ze(e.accent):void 0;o&&!o.ok&&l.push(He("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${o.why}`,"pick a color further from orange-red, or a darker one"));let g=typeof e.logo=="string"?{src:e.logo}:e.logo,c=e.name??n.name,O=e.typography?Object.fromEntries(Object.entries(e.typography).filter(([,A])=>typeof A=="string"&&!/url\(|@import|[;{}<>\\]/i.test(A)).map(([A,N])=>[A,Be(N)])):void 0;return{name:c,schemes:o?.ok?o.schemes:qe,...e.currency?{currency:e.currency}:{},...e.locale?{locale:e.locale}:{},...g?{logo:g.src,logoAlt:g.alt??c}:{},...e.favicon?{favicon:e.favicon}:{},...n.description?{subtitle:n.description}:{},...O?{typography:O}:{},...e.shape?{shape:e.shape}:{},...e.accents?{accents:e.accents}:{},...e.scheme?{scheme:e.scheme}:{}}}function Ue(n){let{currency:l,locale:e}=n.brand??{};return{...l?{currency:l}:{},...e?{locale:e}:{}}}var tn=new WeakMap;function Ye(n,l){tn.set(n,l)}var rn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],T=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function Qe(n,l=rn){if(!T(n))return{document:n,respelled:[]};let e=[],o=n;for(let g of l)o=we(o,g.where.split("."),g,"",e);return{document:o,respelled:e}}function we(n,l,e,o,g){if(l.length===0){if(!T(n)||!Object.hasOwn(n,e.was))return n;g.push(`${o}${e.was}`);let{[e.was]:V,...$}=n;return Object.hasOwn(n,e.now)?$:{...$,[e.now]:V}}if(!T(n))return n;let[c,...O]=l,A=c.endsWith("[]"),N=A?c.slice(0,-2):c,z=n[N],D=z;if(!A)D=we(z,O,e,`${o}${N}.`,g);else if(Array.isArray(z)){let V=z.map(($,W)=>we($,O,e,`${o}${N}.${W}.`,g));D=V.some(($,W)=>$!==z[W])?V:z}return D===z?n:{...n,[N]:D}}var Xe="graview-compiled@1",_="id",de=n=>typeof n=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(n)?n.slice(1):void 0;function on(n){let l=Object.entries(n.fields);return l.find(([,e])=>e.required&&(e.type==="string"||e.type==="text"))?.[0]??l.find(([,e])=>e.type==="string")?.[0]}function en(n,l){let e;switch(n.type){case"string":e=B().check(ee(500));break;case"text":e=B().check(ee(2e4));break;case"number":case"integer":{let o=[...n.type==="integer"?[Se()]:[],...n.min===void 0?[]:[Re(n.min)],...n.max===void 0?[]:[Oe(n.max)],...n.step===void 0?[]:[xe(n.step)]];e=o.length>0?se().check(...o):se();break}case"boolean":e=Ee();break;case"date":e=B().check(pe(me,"a date like 2026-10-02"));break;case"datetime":e=B().check($e(o=>!Number.isNaN(Date.parse(o)),"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":e=Ge(n.options);break;case"list":e=De(n.of==="number"?se():n.of==="date"?B().check(pe(me)):n.of==="image"||n.of==="file"?ge(n.of):B().check(ee(500))).check(ee(200));break;case"image":case"file":e=ge(n.type);break;case"url":e=je();break;case"email":e=Ae();break}return n.description&&(e=e.check(Me(n.description))),l?ue(e):e}var re=n=>{throw new Z(`there is no record "${n}"`,"invalid")},sn=n=>"field"in n?en(n.field,n.optional):"ref"in n?Ke(n.ref):ue(ze()),an=new WeakMap;var ke=(n,l)=>T(l)&&Object.keys(n??{}).length===Object.keys(l).length&&Object.keys(n??{}).every(e=>Object.hasOwn(l,e));function zn(n,l={}){let e=T(n)?n.format:void 0;if(e!==Xe)return{ok:!1,findings:[he("compiled-format","format",e===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(e)}, and this build reads ${Xe}`,"compile the document instead")]};let o=n,g=Qe(o.document).document,c=g===o.document?o:{...o,document:g},O=T(g)&&typeof g.name=="string"&&T(g.kinds)&&ke(g.kinds,c.kinds)&&ke(g.acts,c.acts)&&ke(g.rules,c.rules)&&Array.isArray(c.edges)&&Array.isArray(c.findings),A={ok:!1,findings:[he("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!O)return A;try{return dn(c,l)}catch{return A}}function dn(n,l={}){let{document:e}=n,o=l.today??Pe,g=new Map(n.edges.map(([u,t])=>[u,t])),c=new Map;for(let[u,t]of Object.entries(e.kinds)){let R=n.kinds[u]?.computed;c.set(u,{fields:new Set(Object.keys(t.fields)),edges:new Map(Object.entries(t.edges??{}).map(([b,E])=>[b,E.cardinality??"many"])),...R?{computed:new Map(R)}:{}})}n.facts&&c.set(_e,{computed:new Map(n.facts)});let O=Ue(e),A=new Map,N=Object.entries(e.kinds).map(([u,t])=>{let R={};for(let[i,h]of Object.entries(t.fields))R[i]=en(h,!h.required);let{label:b,describe:E}=n.kinds[u]??{},F=Object.entries(t.computed??{}).map(([i,h])=>[i,typeof h=="string"?{expr:h}:h]),M=Object.fromEntries([...Object.entries(t.fields).filter(([,i])=>i.label).map(([i,h])=>[i,h.label]),...F.filter(([,i])=>i.label).map(([i,h])=>[i,h.label])]),I=Object.keys(M).length>0,C=Object.fromEntries(Object.entries(t.fields).filter(([,i])=>i.default!==void 0).map(([i,h])=>[i,h.default]));A.set(u,C);let j=Object.fromEntries(Object.entries(t.edges??{}).map(([i,{renamedFrom:h,...H}])=>[i,H])),p=i=>t[i]?{[i]:t[i]}:{};return Te(u,{fields:fe(R),edges:j,...p("plural"),...p("noun"),...p("description"),...b?{label:i=>te(b,{node:i,kinds:c,today:o(),money:O})||i.id}:{},...E?{describe:i=>te(E,{node:i,kinds:c,today:o(),money:O})}:{},...p("lifecycle"),...p("figure"),...p("fieldRoles"),...p("people"),...t.computed&&Object.keys(t.computed).length>0?{computed:t.computed}:{},...I||t.glance||t.page?{display:{...I?{labels:M}:{},...t.glance?{glance:[...t.glance]}:{},...t.page?{page:t.page}:{}}}:{},...Object.keys(C).length>0?{defaults:C}:{}})}),z=Ce(N,e.computed);function D(u){return z.tryDefinition(u.kind)?.label?.(u)??u.id}let V=u=>({id:"",kind:u,...A.get(u)}),$=[];for(let[u,t]of Object.entries(e.acts??{})){let R=n.acts[u],{title:b,effects:E,guard:F,refusal:M,destructive:I,idempotent:C,creates:j,connects:p,severs:i,writes:h,writesOther:H,sets:v}=R,J=new Map(R.args),K={};for(let[a,x]of J)K[a]=sn(x);let U=[t.on??[]].flat(),oe=new Map(R.exprs),G=E.find(a=>"create"in a),L=(a,x,y,w=null)=>{if(T(a)&&"expr"in a)return ne(oe.get(a.expr),{graph:y,subject:w,kinds:c,bindings:x,today:o()});let m=de(a);return m===void 0?typeof a=="string"&&a.startsWith("$$")?a.slice(1):a:m==="now"?new Date().toISOString():m==="today"?o():x[m]},nn=(a,x)=>{if(!G)return"";let y=e.kinds[G.create].fields,w=V(G.create),m=[];for(let[k,X]of Object.entries(G.set??{})){try{w[k]=L(X,a,x)??w[k]}catch{}let Y=de(X);Y&&a[Y]!==void 0&&m.push(k)}let P=D(w).trim(),q=m.filter(k=>w[k]!==!1&&y[k].type!=="text"&&D({...w,[k]:void 0}).trim()===P).map(k=>w[k]===!0?y[k].label??Ne(k):Je(w[k],y[k].format,o(),[],O));return P&&q.length>0?`${P} (${q.join(", ")})`:P};$.push(Le(u,{input:fe(K),title:b,...t.description?{description:t.description}:{},...t.fromTheOtherEnd?{fromTheOtherEnd:t.fromTheOtherEnd}:{},...J.has(_)?{subject:{kinds:U.length>0?U:"*",arg:_}}:{},...I?{destructive:!0}:{},...C?{idempotent:!0}:{},...j.length>0?{creates:j}:{},...p.length>0?{connects:p}:{},...i.length>0?{severs:i}:{},writes:h,...Object.keys(H).length>0?{writesOther:H}:{},...Object.keys(v).length>0?{sets:v}:{},describe:(a,x)=>{let y=typeof a[_]=="string"?x.getNode(a[_]):void 0,w=y?D(y):nn(a,x);return w?`${b}: ${w}`:b},apply(a,x){let y=a.graph,w=typeof x[_]=="string"?x[_]:void 0,m=w?y.getNode(w):void 0;if(w&&!m&&re(w),m&&U.length>0&&!U.includes(m.kind))throw new Z(`"${b}" acts on ${U.join(" or ")}, not on ${Fe(m.kind)}`,"invalid");let P={};for(let[r,s]of Object.entries(x))s!==void 0&&(P[r]=s);if(F&&m){let r;try{r=ne(F,{graph:y,subject:m,kinds:c,bindings:P,today:o()})}catch(s){throw s instanceof ae?new Z(`"${b}" could not be judged: ${s.sentence}`):s}if(r!==!0)throw new Z(M?te(M,{node:m,kinds:c,graph:y,bindings:P,today:o(),money:O}):`"${b}" is not allowed for ${D(m)} right now`)}let q=new Map,k=r=>y.has(r)||[...q.values()].includes(r),X=new Set,Y=r=>{let s=Ve(r);X.has(s)||(X.add(s),a.removeEdge(r))},Q=(r,s)=>{let d=de(r);if(d==="subject")return w;if(d==="me"){let f=a.me;if(f&&e.kinds[y.getNode(f)?.kind]?.people)return f;throw new Z(`"${b}" is done as you, and you have no record here`)}if(q.has(d))return q.get(d);try{return L(r,P,y,s??m??null)}catch(f){throw f instanceof ae?new Z(`"${b}" could not work out a value: ${f.sentence}`):f}};for(let r of E)if("create"in r){let s=e.kinds[r.create],d=V(r.create);for(let[le,ie]of Object.entries(r.set??{})){let ve=Q(ie,void 0);ve!==void 0&&(d[le]=ve)}let f=on(s),S=a.freshId(String((f&&d[f])??r.create),r.create);a.addNode({...d,id:S}),r.as&&q.set(r.as,S)}else if("connect"in r||"sever"in r){let s="connect"in r?r.connect:r.sever,d=String(Q(r.from,void 0)??""),f=String(Q(r.to,void 0)??"");if(k(d)||re(d),k(f)||re(f),"connect"in r){if(g.get(s)?.cardinality==="one")for(let S of y.out(d,s))S.id!==f&&Y({kind:s,from:d,to:S.id});y.out(d,s).some(S=>S.id===f)||a.addEdge({kind:s,from:d,to:f})}else Y({kind:s,from:d,to:f})}else if("set"in r){let s=String(Q(r.target??"$subject",void 0)??""),d=y.getNode(s);!d&&!k(s)&&re(s);let f={};for(let[S,le]of Object.entries(r.set)){let ie=Q(le,d);ie!==void 0&&(f[S]=ie)}Object.keys(f).length>0&&a.patchNode(s,f)}else if("remove"in r){let s=String(Q(r.remove,void 0)??"");y.has(s)||re(s),a.removeNode(s)}else if("replace"in r&&m){let s=x.to;for(let d of r.replace){let f=g.get(d)?.from.includes(m.kind)??!0;for(let S of f?y.out(m.id,d):y.in(m.id,d))d===r.keep&&S.id===s||Y(f?{kind:d,from:m.id,to:S.id}:{kind:d,from:S.id,to:m.id})}}}}))}let W=[];for(let[u,t]of Object.entries(e.rules??{})){let{title:R,require:b,when:E,says:F}=n.rules[u],M=t.repairs??[],I=(j,p)=>{let i={graph:j,subject:p,kinds:c,today:o()},h;try{if(E&&ne(E,i)!==!0)return[];h=ne(b,i)===!0}catch(v){throw v instanceof We?new Ie(v.sentence):v instanceof ae?new Error(v.sentence):v}if(h)return[];let H=M.flatMap(v=>{let J=e.acts?.[v.act],K={};p&&(J?.on||/^(edit|remove)-/.test(v.act))&&(K[_]=p.id);for(let[G,L]of Object.entries(v.args??{}))K[G]=de(L)==="subject"?p?.id:L;let oe=(J?n.acts[v.act].args:[]).filter(([G,L])=>L.required&&K[G]===void 0).map(([G])=>G);return[{mutation:v.act,label:v.label??J?.title??v.act.replace(/-/g," "),args:K,...oe.length>0?{missing:oe}:{}}]});return[{invariant:u,...p?{subjectId:p.id}:{},label:R,message:F?te(F,{node:p,kinds:c,graph:j,today:o(),money:O}):p?`${D(p)}: ${R}`:R,nodeIds:p?[p.id]:[],repairs:H}]},C={label:R,shape:{over:t.over,require:b,when:E,says:F,declared:e.kinds,money:O,kinds:c,today:o},judgment:{require:t.require,...t.when?{when:t.when}:{},...t.says?{says:t.says}:{}},...t.description?{description:t.description}:{},...M.length>0?{repairs:M.map(j=>j.act)}:{}};W.push(t.over==="graph"?ye(u,{scope:"graph",...C,evaluate:({graph:j})=>I(j,null)}):ye(u,{scope:{kind:t.over},...C,evaluate:({graph:j,subject:p})=>I(j,p)}))}let be=e.policy&&{...e.policy,...e.roles?{roles:e.roles}:{}},ce={name:e.name,schema:z,mutations:$,invariants:W,...be?{policy:be}:{},...n.brand?{brand:n.brand}:{},...e.modules?{modules:e.modules}:{},...e.lenses?{lenses:e.lenses}:{},...e.pages?{pages:e.pages}:{},...e.settings?{settings:e.settings}:{},...n.viewSpecs?{viewSpecs:n.viewSpecs}:{},...n.home?{home:n.home}:{},version:e.version??1};return Ye(ce,e),an.set(ce,n),{ok:!0,app:ce,document:e,findings:n.findings,sights:e.policy?.sees,kinds:c}}export{Qe as a,un as b,Xe as c,_ as d,de as e,on as f,zn as g,dn as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as G}from"./chunk.I5KD54S6.js";import{Aa as W,Lb as V,Na as j,R as B,Za as F,ba as C,eb as U,fb as q,g as z,sa as L,ya as x}from"./chunk.VMEX2KZ4.js";function K(e){return z(e,{io:"input",unrepresentable:"any",override:ae})}var re={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"};function ae(e){let n=e.zodSchema._zod?.def;if(!n||n.type!=="string"||typeof n.format!="string"||n.format==="regex")return;let t=e.jsonSchema,f=(n.checks??[]).map(s=>s._zod?.def).filter(s=>s?.format==="regex"&&s.pattern instanceof RegExp).map(s=>s.pattern.source);delete t.pattern;let l=t.allOf;Array.isArray(l)&&l.every(s=>typeof s=="object"&&s!==null&&Object.keys(s).length===1&&"pattern"in s)&&delete t.allOf,t.format=re[n.format]??n.format,f.length===1?t.pattern=f[0]:f.length>1&&(t.allOf=f.map(s=>({pattern:s})))}function _(e){let n=x(e.input),t=K(e.input),f=t.properties??{};if(U(e)){let l=e.creates.join(" | ");f.id={type:"string",minLength:1,description:`Optional: the id for the ${l} this makes. Refused if the graph already has it; left out, one is minted from the label.`},t.properties=f}q(e)&&(t.additionalProperties=!1);for(let l of n){let s=f[l.name];if(!s)continue;let k=l.kinds.includes("*")?"any node kind":l.kinds.join(" | ");s.description=[s.description,`Id of a node (${k}).`].filter(Boolean).join(" ")}return{name:e.name,...e.title===void 0?{}:{title:e.title},description:e.description??e.title??e.name,inputSchema:t,nodeRefs:n}}function Z(e){let n=new Set;for(let t=e;t;t=t.onBehalfOf)t.id!==void 0&&n.add(`${t.kind}:${t.id}`);return n}function O(e,n){let t=Z(n),f=y=>{if(y.kind==="rule")return!1;let m=Z(y);if(m.size===0)return!1;for(let h of m)if(t.has(h))return!1;return!0},l,s=()=>{if(l)return l;l=new Map;for(let y of e.log.live()){if(y.undoes!==void 0)continue;let m=f(y.author)?y.author:void 0;for(let h of y.primitives){h.op==="remove-node"&&l.delete(h.node.id);let i=h.op==="add-node"?h.node.id:h.op==="patch-node"?h.id:void 0;if(i===void 0)continue;let r=h.op==="add-node"?Object.keys(h.node):Object.keys(h.after),c=l.get(i);(h.op==="add-node"||!c)&&l.set(i,c=new Map);for(let p of r)p==="id"||p==="kind"||(m?c.set(p,m):c.delete(p))}}return l},k=e.schema,g=new Map,v=(y,m)=>{let h=`${y}\0${m}`,i=g.get(h);if(i===void 0){let r=k.tryDefinition(y)?.fields?.shape;i=r!==void 0&&m in r&&W(r[m]).type==="text",g.set(h,i)}return i},b=y=>e.graph.getNode(y)?.kind;return{prose:v,say:y=>C(y,{graph:e.graph,schema:k}),fieldBy(y,m){let h=b(y);if(!(h===void 0||!v(h,m)))return s().get(y)?.get(m)},recordBy(y){let m=b(y),h=s().get(y);if(m===void 0||!h)return;let i;for(let[r,c]of h)v(m,r)&&(i=c);return i}}}var D=(e,n,t)=>({untrusted:!0,authoredBy:t.say(n),text:e});function I(e,n){return{...e,hits:e.hits.map(t=>{if(t.about!=="node")return t;let f=n.recordBy(t.id);if(!f)return t;let l=n.prose(t.kind,t.why.field)?n.fieldBy(t.id,t.why.field):f;return{...t,label:D(t.label,f,n),...t.apart!==void 0?{apart:D(t.apart,f,n)}:{},why:l?{...t.why,fragment:D(t.why.fragment,l,n)}:t.why}})}}var J=e=>{let n;return()=>n??=e().catch(t=>{throw n=void 0,t})},se=J(()=>import("./chunk.ZKM4P7US.js")),de=()=>import("./chunk.VMD4PDYJ.js").catch(()=>{}),le=async()=>{(await de())?.judgeWithLines()},R=J(()=>import("./chunk.E3SZ7T75.js")),ce=J(()=>import("./chunk.YV2RTNPU.js")),S=e=>({title:e,readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}),M={type:"number",description:"Where the page starts; 0 when unsaid."},P=[{name:"search_graph",title:"Find by name",description:"Find things by name: records whose name or readable fields carry the words, and the kinds, places and rules the words name \u2014 each with why it matched. Reach for this before get_graph when you know what something is called. Words match the start of words, case and accents aside; key:value tokens narrow as a list's filter does (done:false, is:any for past records, kind:<kind>). Pass subject (a node id) to get the acts you may run on it as hits too.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Words, with optional key:value conditions."},limit:{type:"number",description:"Most hits to return; at most 20."},subject:{type:"string",description:"A node id whose acts to include."}},required:["query"],additionalProperties:!1},mutating:!1,annotations:S("Find by name")},{name:"get_graph",title:"Read the graph",description:"Read the graph, 25 nodes a page: their fields, the edges out of them, and how many more. Start here when you need the shape of the domain rather than one thing in it.",inputSchema:{type:"object",properties:{offset:M},additionalProperties:!1},mutating:!1,annotations:S("Read the graph")},{name:"get_node",title:"Read one node",description:"Read one node: its fields, its links (id, kind and label, 20 each way a page), the violations that implicate it, and its computed values: read-only fields worked out from what you can see, which no act sets. Use this to check a thing before you change it.",inputSchema:{type:"object",properties:{id:{type:"string",description:"A node's id, or its name."},offset:M},required:["id"],additionalProperties:!1},mutating:!1,annotations:S("Read one node")},{name:"get_violations",title:"List the problems",description:"List the invariant violations the graph currently has, 20 a page, with the repairs that would resolve each one. Read this before proposing work: a rule that is already broken is more urgent than anything you could add.",inputSchema:{type:"object",properties:{offset:M,context:{type:"object",description:"Evaluation context, e.g. { weekStart }."}},additionalProperties:!1},mutating:!1,annotations:S("List the problems")},{name:"get_affordances",title:"Ask what can be done",description:"Ask what can legally be done with a selection, ranked. Prefer these over composing a mutation by hand: they are derived from the schema, the invariants and the shape of the graph, so they cannot name an action that does not exist.",inputSchema:{type:"object",properties:{selection:{type:"array",items:{type:"string"},description:"Node ids."},context:{type:"object"}},required:["selection"],additionalProperties:!1},mutating:!1,annotations:S("Ask what can be done")},{name:"describe_place",title:"Say what a place shows",description:`Say what one place of the app shows you, as a person in your seat would see it: its headings, its figures as drawn, its lists with each record's title and what its card or row says, the headings a list is grouped under, what an empty list says, and any block that could not be worked out. Pass a place's slug ("home", a lens's address like "the-offers", a kind's like "offers") or a record's id, and width 390 for a phone. Use it after a change to check what somebody now sees, instead of guessing.`,inputSchema:{type:"object",properties:{place:{type:"string",description:`"home", a place's slug, or a record's id.`},width:{type:"number",description:"The screen's width in CSS pixels; 390 is a phone, 1440 when unsaid."}},required:["place"],additionalProperties:!1},mutating:!1,annotations:S("Say what a place shows")},{name:"preview_mutation",title:"Try an act without applying it",description:"Try a mutation without applying it: get back the diff it would produce and any invariant it would break. Do this when you are unsure, rather than applying and undoing.",inputSchema:{type:"object",properties:{mutation:{type:"string"},args:{type:"object"}},required:["mutation","args"],additionalProperties:!1},mutating:!1,annotations:S("Try an act without applying it")},{name:"undo_batch",title:"Undo a batch",description:"Undo one batch of operations. Fails, naming the blocking operation, when a later operation read what it wrote.",inputSchema:{type:"object",properties:{batch:{type:"string"},include:{type:"array",items:{type:"string"}}},required:["batch"],additionalProperties:!1},mutating:!0,annotations:{title:"Undo a batch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}}],N={type:"object",description:"A lens, as draft_view returns one.",properties:{title:{type:"string"},lens:{type:"string"},on:{type:"string"},bindings:{type:"object"},options:{type:"object"}},required:["title","lens","on"]},$={name:"draft_view",title:"Draw a view",description:'Draw a view of the data from words ("a board of tasks by status", "who covers what") as a lens the app could keep; or check a lens you wrote (lens); or change the one on screen (current, with ask: "only this month"). Returns the lens and its add-lens edit, or one sentence saying why not. Writes nothing.',inputSchema:{type:"object",properties:{ask:{type:"string",description:"What to see, in words."},lens:N,current:N},additionalProperties:!1},mutating:!1,annotations:S("Draw a view")},Y={name:"keep_lens",title:"Keep a view as a lens",description:"Keep a lens draft_view drew as one of the app's places: checked again, then written as the add-lens edit. Returns the remove-lens edit that takes it back.",inputSchema:{...N,additionalProperties:!1},mutating:!0,annotations:{title:"Keep a view as a lens",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}};function ue(e,n){return e===void 0?[]:e==="keep"&&!n?[$,Y]:[$]}var fe="An argument that names a record takes its id or its name.",Q=[...P.map(e=>e.name),$.name,Y.name],ee=64;function T(e){let{line:n,...t}=e;return t}function X(e){return{...e,...e.introduces?{introduces:e.introduces.map(T)}:{},...e.resolves?{resolves:e.resolves.map(T)}:{},...e.violationsAfter?{violationsAfter:e.violationsAfter.map(T)}:{}}}function pe(e){let n=e.normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^A-Za-z0-9_-]/g,"_");return n.length===0&&(n="act"),/^[A-Za-z_]/.test(n)||(n=`act_${n}`),n.slice(0,ee)}function he(e){let n=new Set(Q),t=new Map;for(let f of e){let l=pe(f),s=l;for(let k=2;n.has(s);k+=1)s=`${l.slice(0,ee-`_${k}`.length)}_${k}`;n.add(s),t.set(f,s)}return t}function ye(e,n){let t=_(e),f=B(e),l=t.nodeRefs.length>0?`${t.description}${/[.!?]$/.test(t.description)?"":"."} ${fe}`:t.description;return{name:n,title:f,description:l,inputSchema:t.inputSchema,mutating:!0,annotations:{title:f,readOnlyHint:!1,destructiveHint:e.destructive===!0||(e.severs?.length??0)>0,idempotentHint:e.idempotent===!0,openWorldHint:!1},act:e.name}}function H(e){if(e===null||typeof e!="object")return JSON.stringify(e)??"null";if(Array.isArray(e))return`[${e.map(H).join(",")}]`;let n=e;return`{${Object.keys(n).filter(t=>n[t]!==void 0).sort().map(t=>`${JSON.stringify(t)}:${H(n[t])}`).join(",")}}`}function me(e){return`sha256:${V(H(e))}`}function ge(e,n,t,f){let l=he(e.map(g=>g.name)),s=ue(f,t);return{definitions:t?[...P.filter(g=>!g.mutating),...s]:[...P,...s,...e.filter(g=>n.has(g.name)).map(g=>ye(g,l.get(g.name)))],names:l}}function Fe(e,n={}){let t=n.author??{kind:"agent"},f=e.allMutations(),l=new Set(e.permittedMutations(t).map(i=>i.name)),{definitions:s,names:k}=ge(f,l,n.readOnly===!0,n.drafts?n.drafts.keep?"keep":"draw":void 0),g=me(s),v=i=>{if(!Q.includes(i)){for(let[r,c]of k)if(c===i)return r;return k.has(i)?i:void 0}},b=(i,r)=>{let c=f.find(a=>a.name===i);if(!c)return{args:r,resolved:[]};let p={...r},o=[];for(let a of x(c.input)){let d=p[a.name];if(typeof d!="string"||d.trim()==="")continue;let u=e.resolveRef(a,d,t);if(!u.ok){let w=u.reason==="none"?` Nothing was changed. Use search_graph to look it up, then pass its id as ${a.name}.`:" Nothing was changed.";return{ok:!1,error:`${u.message}${w}`,argument:a.name,candidates:u.candidates}}u.by!=="id"&&(p[a.name]=u.id,o.push({argument:a.name,given:d,id:u.id,label:u.label}))}return{args:p,resolved:o}},y=async(i,r)=>{try{await le();let c=s.find(o=>o.name===i)??s.find(o=>o.act===i);if(!c){let o=v(i);if(o){let a=e.permits({name:o,args:r},t);if(!a.ok)return{ok:!1,error:a.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${i}". Available: ${s.map(a=>a.name).join(", ")}`}}if(c.mutating&&n.readOnly)return{ok:!1,error:`"${i}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(c.act!==void 0){let o=b(c.act,r);if("ok"in o)return o;let a=j(e,t,e.apply({name:c.act,args:o.args},{...n.author?{author:n.author}:{},...we(n.via)}));return{ok:!0,data:{batch:a.batch,intent:a.intent,introduces:a.introduces.map(T),resolves:a.resolves.map(T),...o.resolved.length>0?{resolved:o.resolved}:{}},diff:a.diff}}let p=e.seenBy(t);switch(c.name){case"search_graph":{let o=typeof n.places=="function"?n.places():n.places,a=typeof r.subject=="string"?r.subject:void 0,d=F(p,String(r.query??""),{principal:t,limit:typeof r.limit=="number"&&r.limit>0?Math.min(r.limit,20):20,...o?{places:o}:{},...a?{subject:a,from:[a]}:{}});return{ok:!0,data:(await R()).searchRead(d,I(d,O(p,t))),reads:d.hits.flatMap(u=>u.about==="node"?[u.id]:[])}}case"get_graph":return{ok:!0,...(await R()).graphRead(p,O(p,t),r)};case"get_node":{let o=String(r.id??""),a=o,d;if(!p.graph.getNode(o)){let w=o.trim()===""?void 0:e.resolveRef({name:"id",kinds:["*"]},o,t);if(w?.ok)a=w.id,d={argument:"id",given:o,id:a,label:w.label};else return w?.reason==="ambiguous"?{ok:!1,error:w.message,argument:"id",candidates:w.candidates}:{ok:!1,error:`No node "${o}".`}}let u=(await R()).nodeRead(p,O(p,t),a,r);return{ok:!0,data:d?{...u.data,resolved:[d]}:u.data,reads:u.reads}}case"describe_place":{let o=n.app??{name:"",schema:e.schema},a=typeof r.width=="number"&&Number.isFinite(r.width)&&r.width>0?r.width:1440,{describePlace:d}=await se(),u=d(e,t,String(r.place??""),{app:o,width:a});if(!u.ok)return{ok:!1,error:`${u.error} The places are: ${u.places.join(", ")}.`};let w=new Set,A=ne=>{for(let te of ne)for(let oe of te.groups??[])for(let E of oe.items)w.add(E.id),A(E.parts)};return A(u.description.parts),{ok:!0,data:u.description,reads:[...w]}}case"draft_view":case"keep_lens":{let o=n.app??{name:"",schema:e.schema};return(await ce()).runDraftTool(c.name,r,{app:o,principal:t,...n.drafts?{drafts:n.drafts}:{}})}case"get_violations":{let o=p.violations(r.context);return{ok:!0,...(await R()).violationsRead(o,r)}}case"get_affordances":{let o=r.selection??[];return{ok:!0,data:G(p,o,{...typeof n.derive=="function"?n.derive():n.derive,...n.author?{principal:n.author}:{},...r.context?{context:r.context}:{}}),reads:o.filter(d=>p.graph.has(d))}}case"preview_mutation":{let o=String(r.mutation),a=v(o)??o,d=b(a,r.args??{});if("ok"in d)return d;let u=e.missingFor({name:a,args:d.args},t);if(u)return{ok:!1,error:u.message,reason:"missing"};let w=j(e,t,e.preview({name:a,args:d.args},void 0,{author:t})),A=X(w);return{ok:!0,data:d.resolved.length>0?{...A,resolved:d.resolved}:A}}case"undo_batch":{let o=String(r.batch),a=r.include??[],d=p.canUndo([o,...a]);if(!d.ok)return{ok:!1,error:d.message};let u=j(e,t,e.undo([o,...a],{...n.author?{author:n.author}:{}}));return{ok:!0,data:X(u),diff:u.diff}}default:return{ok:!1,error:`Unknown tool "${i}".`}}}catch(c){let{reason:p,wouldNeed:o}=L(c);return{ok:!1,error:c instanceof Error?c.message:String(c),reason:p,...o?{wouldNeed:o}:{}}}},m=new Set,h=i=>{for(let r of m)r(i)};return{definitions:s,hash:g,...n.author?{author:n.author}:{},onDiff(i){return e.subscribe(i)},onCall(i){return m.add(i),()=>m.delete(i)},async call(i,r){let c=(s.find(d=>d.name===i)??s.find(d=>d.act===i))?.mutating??!1,p={name:i,args:r,mutating:c,at:new Date().toISOString()};h({...p,phase:"running"});let o=d=>(h(d.ok?{...p,phase:"ok",...!c&&d.reads?{reads:d.reads}:{}}:{...p,phase:"failed",error:d.error}),d),a=await y(i,r);return o(a.ok&&!c?{...a,data:(await R()).withinReadChars(i,a.data)}:a)}}}function we(e){let n=typeof e=="function"?e():e;return n?{via:n}:{}}export{H as a,Fe as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as U}from"./chunk.
|
|
1
|
+
import{a as U}from"./chunk.7SVIRYBB.js";import{c as J}from"./chunk.ZMMMKTAG.js";import{a as T,c as K,f as W,g as D,k as _,l as j,m as X}from"./chunk.CW7BMVBG.js";import{e as Q,g as Y,i as Z}from"./chunk.IZDKEFPJ.js";import{c as z}from"./chunk.6LJ66MB7.js";import{da as G,fa as I,na as V,ua as q}from"./chunk.OYULDOQP.js";import{Ob as N,nb as L,xb as M,yb as O}from"./chunk.VMEX2KZ4.js";import{a as ae,b as $}from"./chunk.MRK6QJV5.js";import{b as F}from"./chunk.AJZBJBMO.js";var o=F(ae(),1);function se(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],n=[];for(let a of t){let r=a?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!r||O(r)||r.toLowerCase()!==L.toLowerCase()&&(n.includes(r)||n.push(r))}return n}function ee(e){let t=se(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(a=>`family=${encodeURIComponent(a).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var u=F($(),1);function ge(e,t){let{app:n}=e;return(0,o.useMemo)(()=>{let a=Y(t(n.schema,n.viewSpecs),n),r=e.views?V(a,e.views(n.schema,a)):a;return Z(r,n.schema,Q(e.brand??n.brand,n.schema)),r},[e.views,n.schema,n.viewSpecs,n.lenses,n.pages,n.home])}function ie(e,t){return new N({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.intelligence?{intelligence:e.intelligence}:{}})}function ne(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ce(e,t){let[n,a]=(0,o.useState)(()=>ne(t));return(0,o.useEffect)(()=>{if(!e||typeof document>"u")return;let r=()=>a(ne(t));r();let i=new MutationObserver(r);i.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let d=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return d?.addEventListener?.("change",r),()=>{i.disconnect(),d?.removeEventListener?.("change",r)}},[e,t]),n}var A=e=>e?e.getBoundingClientRect().height:0;function be(e,t,n){let a=(0,o.useRef)(n);a.current=n;let r=n!==void 0;(0,o.useLayoutEffect)(()=>{let i=e.current;if(!i||!r)return;let d=()=>{let l=[...i.children],b=l.find(v=>v.hasAttribute("data-graview-app-bar")),p=l.find(v=>v.hasAttribute("data-embed-content")),h=p?.querySelector("[data-embed-measure]")??null,c=l.find(v=>v.hasAttribute("data-graview-place-line"));return{strip:b,line:c,content:p,measure:h}},s=-1,f=()=>{let{strip:l,line:b,content:p,measure:h}=d(),c=Math.ceil(A(l)+A(b)+A(h||p));c!==s&&(s=c,a.current?.(c))};if(f(),typeof ResizeObserver>"u")return;let m=new ResizeObserver(f),E=()=>{m.disconnect();let{strip:l,line:b,content:p,measure:h}=d();for(let c of[i,l,b,p,h])c&&m.observe(c)};E();let g=new MutationObserver(()=>{E(),f()});return g.observe(i,{childList:!0}),()=>{m.disconnect(),g.disconnect()}},[e,t,r])}var ve=480,de=0;function Se(e){let{app:t,seed:n,scheme:a="auto",brand:r=t.brand,fonts:i=!0,height:d="100%",label:s}=e,f=(0,o.useRef)(null);q(f);let m=d==="viewport"?"100dvh":d,E=z(typeof m=="string"&&/vh\b/.test(m)),g=(0,o.useMemo)(()=>`graview-embed-${++de}`,[]),l=(0,o.useMemo)(()=>e.store??e.remote?.store??ie(t,n),[e.store,e.remote,t,n]),b=e.presence??e.remote?.presence,p=e.hostContext?.theme,h=ce(a==="auto"&&p===void 0,r?.scheme),c=a==="auto"?p??h:a,v=(0,o.useMemo)(()=>T(c,r,{scope:`.${g}`}),[c,r,g]);K(e.favicon?M(r):void 0),(0,o.useEffect)(()=>{if(!i||typeof document>"u")return;let w=ee(r);if(!w||document.querySelector(`link[href="${w}"]`))return;let y=document.createElement("link");y.rel="stylesheet",y.href=w,document.head.appendChild(y)},[r,i]);let C=(0,o.useRef)(void 0);(0,o.useLayoutEffect)(()=>{let w=f.current,y=C.current;if(C.current=s,!w||!s)return;let oe=S=>{let x=S.getAttribute("aria-label")??"",R=y&&y!==s?x.startsWith(`${y} \xB7 `)?x.slice(y.length+3):x===y?"":x:x;R===s&&(S.getAttribute("role")==="region"||S.tagName==="SECTION"&&!S.hasAttribute("role"))&&S.setAttribute("role","group");let H=R.startsWith(`${s} \xB7 `)||R===s?R:R?`${s} \xB7 ${R}`:s;H!==x&&S.setAttribute("aria-label",H)},B=()=>w.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(S=>{S.hasAttribute("data-graview-named-by-lens")||oe(S)});B();let P=new MutationObserver(B);return P.observe(w,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>P.disconnect()},[s]);let re=E?`${m}`.replace(/([\d.]+)[sdl]?vh\b/g,(w,y)=>`${+y*E/100}px`):m;return{rootRef:f,scope:g,css:v,scheme:c,store:l,presence:b,brand:r,auto:d==="auto",height:re}}function we({rootRef:e,board:t}){let n=(0,o.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]);return(0,u.jsx)(J,{board:t,anchor:n})}function Ee(e,t,n){return{brand:n,principal:e.principal,seats:e.seats,presence:t,people:e.people,memory:e.memory,presenceTtlMs:e.presenceTtlMs,onKeepLens:e.onKeepLens,ai:e.ai,files:e.files,app:e.app}}function xe({name:e,heading:t,faces:n,at:a,without:r,home:i,reach:d,standing:s,hostActions:f,keeping:m,onFind:E,switch:g}){let{brand:l,store:b,principal:p,views:h}=G();I();let c=r?.has("places")?[]:W({store:b,principal:p,views:h}),v=U();return(0,u.jsx)(_,{brand:l,name:e,description:l?.subtitle,heading:t,faces:n,home:i,places:c,current:a===null?null:D(c,a),reach:d,onFind:E,...g?{switch:g}:{},...n?{scenePlaces:v}:{},tools:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(X,{clean:s}),(0,u.jsx)(j,{...f?{hostActions:f}:{},...m?{keeping:m}:{}})]})})}var Re=e=>e===!1?2:Math.min(e+1,6);function Ae(e){let[t,n]=(0,o.useState)(e),a=(0,o.useRef)(void 0),r=(0,o.useRef)(void 0),i=(0,o.useMemo)(()=>({go:a,at:n,pending:r}),[]),d=(0,o.useCallback)(s=>{if(a.current){a.current(s);return}r.current=s,n(s)},[]);return{at:t,setAt:n,steering:i,steer:d}}function le(e){let t=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof t=="string"&&t.length>0?t:typeof e=="object"?"Error":typeof e}}var k=()=>typeof performance<"u"?performance.now():Date.now();function Fe(e,t){let n=(0,o.useRef)({onError:e,face:t});return n.current={onError:e,face:t},(0,o.useCallback)((a,r)=>n.current.onError?.(le(a),{module:r.module,face:n.current.face}),[])}function ke(e,t){let n=(0,o.useRef)(null);n.current===null&&(n.current=k());let a=(0,o.useRef)({onReady:e,face:t});a.current={onReady:e,face:t};let r=(0,o.useRef)(!1);return(0,o.useCallback)(i=>{r.current||(r.current=!0,a.current.onReady?.({ms:Math.max(0,k()-(n.current??k())),face:i}))},[])}var te=class extends o.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t,n){console.error(`[graview] ${this.props.module} threw while rendering`,t,n.componentStack),this.props.report(t,{module:this.props.module})}render(){return this.state.failed?(0,u.jsxs)("div",{role:"alert","data-graview-face-error":this.props.module,...this.props.content?{"data-embed-content":""}:{},style:this.props.content?{flex:"1 1 auto",display:"grid",alignContent:"center",justifyItems:"center",gap:8,padding:24,background:"var(--graview-ground)",color:"var(--graview-ink)",fontSize:"0.9375rem"}:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,u.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,u.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{ge as a,ie as b,be as c,ve as d,Se as e,we as f,Ee as g,xe as h,Re as i,Ae as j,Fe as k,ke as l,te as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as s,
|
|
1
|
+
import{Aa as w,B as s,K as k,xa as x,za as p}from"./chunk.VMEX2KZ4.js";var j=e=>e.safeParse?.(void 0).success??!1,O=e=>p(e).shape,m=e=>{let r=p(e);if(s(r)?.type!=="literal")return;let o=s(r)?.values;return o&&o.length===1&&typeof o[0]=="string"?o[0]:void 0};function u(e,r){let o=j(r),n=p(r),i=s(n)?.type,g=x(r);if(g)return{control:"node",name:e,optional:o,kinds:g};if(i==="boolean")return{control:"boolean",name:e,optional:o};let b=k(n);if(b)return{control:"file",name:e,optional:o,...b==="image"?{image:!0}:{}};if(i==="object"){let a=n.shape??{};return{control:"group",name:e,optional:o,fields:Object.entries(a).map(([d,c])=>u(d,c))}}if(i==="union"){let a=s(n)?.options??[],d=a.map(l=>O(l));if(d.every(l=>l!==void 0)){let l=Object.keys(d[0]??{}).find(F=>d.every(f=>m(f?.[F])!==void 0));if(l)return{control:"variant",name:e,optional:o,tag:l,options:a.map((F,f)=>({value:m(d[f]?.[l])??"",fields:Object.entries(d[f]??{}).filter(([y])=>y!==l).map(([y,v])=>u(y,v))}))}}let c=a.map(l=>m(l));return c.every(l=>l!==void 0)?{control:"choice",name:e,optional:o,options:c}:{control:"opaque",name:e,optional:o}}if(i==="array"){let a=s(n)?.element;return a!==void 0?{control:"list",name:e,optional:o,item:u(e,a)}:{control:"opaque",name:e,optional:o}}let t=w(r);return t.type==="text"?{control:"text",name:e,optional:o,...t.long?{long:!0}:{}}:t.type==="date"?{control:"date",name:e,optional:o,...t.time?{time:!0}:{}}:t.type==="number"?{control:"number",name:e,optional:o,...t.min===void 0?{}:{min:t.min},...t.max===void 0?{}:{max:t.max},...t.step===void 0?{}:{step:t.step}}:t.type==="choice"?{control:"choice",name:e,optional:o,options:t.options}:{control:"opaque",name:e,optional:o}}function R(e){let r=e.shape;return r?Object.entries(r).map(([o,n])=>u(o,n)):[]}function h(e,r){let o={...r};for(let n of e){let i=r[n.name];i===void 0&&!n.optional&&(n.control==="list"||n.control==="boolean")&&(o[n.name]=n.control==="list"?[]:!1),n.control==="group"&&i!==void 0&&typeof i=="object"&&i!==null&&(o[n.name]=h(n.fields,i))}return o}export{R as a,h as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Y}from"./chunk.
|
|
1
|
+
import{a as Y}from"./chunk.4R7LDCDO.js";import"./chunk.TMPV4HLQ.js";import{a as E,c as H,e as V,f as _}from"./chunk.7QTBDACG.js";import"./chunk.5BN2ARQ2.js";import"./chunk.4W24TPMR.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.6LJ66MB7.js";import{D as W,c as M,da as w,va as G,ya as B}from"./chunk.OYULDOQP.js";import{P as L,S as O,W as T}from"./chunk.VMEX2KZ4.js";import{a as U,b as k}from"./chunk.MRK6QJV5.js";import{b as y}from"./chunk.AJZBJBMO.js";function A(t){return{minHeight:24,padding:"3px 10px",borderRadius:6,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:t?"transparent":"var(--graview-edge)",color:t?"var(--graview-ink)":"var(--graview-ink-muted)",fontWeight:t?600:400,background:t?"color-mix(in srgb, var(--graview-accent) 16%, transparent)":"transparent"}}var P=y(k(),1);function j(){let{seats:t,principal:r,takeSeat:i}=w();return t.length<2?null:(0,P.jsxs)("div",{role:"group","aria-label":"Seat","data-testid":"seats",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,rowGap:4},children:[(0,P.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"As"}),t.map(a=>{let l=q(r,a.principal);return(0,P.jsx)("button",{type:"button","aria-pressed":l,"data-testid":`seat-${a.principal.id??a.label}`,title:`Sit down as ${a.label}: the acts, the kinds and the pages narrow to what this seat may do`,onClick:()=>i(a.principal),style:{...A(l),whiteSpace:"nowrap"},children:a.label},a.principal.id??a.label)})]})}function q(t,r){return t.kind===r.kind&&t.id===r.id}var z=y(U(),1),o=y(k(),1),J=`
|
|
2
2
|
.graview-here{display:flex;flex:none}
|
|
3
3
|
.graview-here>button{display:inline-flex;align-items:center;gap:4px;height:30px;margin:0;padding:0 4px;border:1px solid transparent;border-radius:8px;background:none;box-shadow:none;font:inherit;font-size:.75rem;color:var(--graview-ink-muted);cursor:pointer}
|
|
4
4
|
.graview-here-mark{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:24px;height:24px;border-radius:50%;border:1.5px solid hsl(var(--graview-hue) 50% 48%);background:var(--graview-panel-muted);color:var(--graview-ink);font-size:.75rem;font-weight:600;box-shadow:0 0 0 2px var(--graview-bar)}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{D as U,E as F,F as D,Z as _}from"./chunk.VMEX2KZ4.js";var B=1e4,g=class{constructor(i){this.nodes=i}},J="",c=class extends Error{constructor(f,l){super(f);this.sentence=f;this.at=l}},C=class extends c{},V=t=>t!==null&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof g)&&typeof t.id=="string",P=t=>{let i=new Set;return new g(t.filter(f=>!i.has(f.id)&&i.add(f.id)))},p=t=>t===null?"nothing":t instanceof g?"a set of records":Array.isArray(t)?"a list":V(t)?"a record":typeof t=="string"?"a word":typeof t;function W(t,i){let f=i.budget??B,l=(n,s)=>{if(f-=n,f<0)throw new C("this rule looks at too much of the graph to judge in one go",s)},b=i.today??F(),A=i.now??new Date().toISOString(),w=new Map,T=new Set,G=i.bindings,I=(n,s,e,o)=>{let u=`${n?.id}\0${s}`;if(w.has(u))return w.get(u);if(T.has(u))throw new c(`"${s}"${n?` of ${_(n.kind)}`:""} depends on itself`,o);T.add(u);let r=G;G=void 0;try{let a=h(e,n);return w.set(u,a),a}finally{G=r,T.delete(u)}},M=(n,s,e)=>{l(1,e);let o=i.kinds.get(n.kind),u=o?.computed?.get(s);if(u)return I(n,s,u,e);let r=Object.hasOwn(n,s);if(o?.fields.has(s)||r){let d=r?n[s]:void 0;return d===void 0?null:d}let a=o?.edges.get(s);if(a){let d=i.graph.out(n.id,s);return l(d.length,e),a==="one"?d[0]??null:new g(d)}if(s==="id")return n.id;throw new c(`${_(n.kind)} has no field or relation called "${s}"`,e)},x=(n,s,e)=>{if(n instanceof g)return n;if(n===null)return new g([]);if(V(n))return new g([n]);throw new c(`${e}(\u2026) needs a set of records, and was given ${p(n)}`,s)},k=(n,s,e)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new c(`${e}(\u2026) needs a word, and was given ${p(n)}`,s)},O=(n,s,e)=>{let o=k(n,s,e);if(o===null)return null;let u=Date.parse(o.length===10?`${o}T00:00:00Z`:o);if(Number.isNaN(u))throw new c(`${e}(\u2026) needs a date, and "${o}" is not one`,s);return u},E=(n,s)=>V(n)&&V(s)?n.id===s.id:V(n)&&typeof s=="string"?n.id===s:typeof n=="string"&&V(s)?n===s.id:Array.isArray(n)&&Array.isArray(s)?n.length===s.length&&n.every((e,o)=>E(e,s[o])):n===s,N=(n,s,e)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new c(`${e} must be true or false, and was ${p(n)}`,s)},R=(n,s)=>h(s,n);function h(n,s){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(e=>h(e,s));case"ident":{let e=G&&Object.hasOwn(G,n.name)?G[n.name]:void 0;if(e!==void 0)return e;if(s)return M(s,n.name,n.at);throw new c(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let e=h(n.object,s);if(e===null)return null;if(V(e))return M(e,n.name,n.at);throw new c(`".${n.name}" needs a record before it, and was given ${p(e)}`,n.at)}case"unary":{let e=h(n.operand,s);if(n.op==="!")return!N(e,n.at,"what follows not");if(e===null)return null;if(typeof e!="number")throw new c(`"-" needs a number, and was given ${p(e)}`,n.at);return-e}case"where":{let e=x(h(n.set,s),n.at,"where");return l(e.nodes.length,n.at),new g(e.nodes.filter(o=>N(R(o,n.filter),n.at,"a where condition")))}case"binary":return H(n,s);case"call":return Y(n,s)}}function H(n,s){if(n.op==="&&")return N(h(n.left,s),n.at,"each side of and")&&N(h(n.right,s),n.at,"each side of and");if(n.op==="||")return N(h(n.left,s),n.at,"each side of or")||N(h(n.right,s),n.at,"each side of or");let e=h(n.left,s),o=h(n.right,s);if(n.op==="&"||n.op==="|"||n.op==="-"&&(e instanceof g||o instanceof g)){let u=x(e,n.at,n.op).nodes,r=x(o,n.at,n.op).nodes;l(u.length+r.length,n.at);let a=new Set(r.map(d=>d.id));return P(n.op==="|"?[...u,...r]:u.filter(d=>a.has(d.id)===(n.op==="&")))}switch(n.op){case"==":return E(e,o);case"!=":return!E(e,o);case"in":{if(o===null)return!1;if(o instanceof g)return o.nodes.some(u=>E(e,u));if(Array.isArray(o))return o.some(u=>E(e,u));if(typeof o=="string"&&typeof e=="string")return o.includes(e);throw new c(`"in" needs a list or a set on its right, and was given ${p(o)}`,n.at)}case"<":case"<=":case">":case">=":{if(e===null||o===null)return!1;if(!(typeof e=="number"&&typeof o=="number"||typeof e=="string"&&typeof o=="string"))throw new c(`cannot compare ${p(e)} with ${p(o)}`,n.at);return n.op==="<"?e<o:n.op==="<="?e<=o:n.op===">"?e>o:e>=o}default:{if(e===null||o===null)return null;if(n.op==="+"&&(typeof e=="string"||typeof o=="string")){let u=`${k(e,n.at,"+")}${k(o,n.at,"+")}`;if(u.length>1e4)throw new c("that makes a word too long",n.at);return u}if(typeof e!="number"||typeof o!="number")throw new c(`"${n.op}" needs numbers, and was given ${p(e)} and ${p(o)}`,n.at);return(n.op==="/"||n.op==="%")&&o===0?null:n.op==="+"?e+o:n.op==="-"?e-o:n.op==="*"?e*o:n.op==="/"?e/o:e%o}}}function Y(n,s){let e=(r,a=r)=>{if(n.args.length<r||n.args.length>a)throw new c(`${n.fn}(\u2026) takes ${r===a?r:`${r} to ${a}`} argument${a===1?"":"s"}`,n.at)},o=r=>h(n.args[r],s),u=r=>{let a=o(r);if(typeof a!="string")throw new c(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return a};switch(n.fn){case"out":case"in":{e(1,2);let r=($,m)=>n.fn==="out"?i.graph.out($,m):i.graph.in($,m);if(n.args.length===2){let $=x(o(0),n.at,n.fn).nodes,m=u(1);return P($.flatMap(y=>{let S=r(y.id,m);return l(S.length+1,n.at),S}))}let a=u(0);if(!s)throw new c(`${n.fn}('${a}') needs a record to start from`,n.at);let d=r(s.id,a);return l(d.length,n.at),new g(d)}case"all":{e(1);let r=i.graph.nodesOfKind(u(0));return l(r.length,n.at),new g(r)}case"count":return e(1),x(o(0),n.at,"count").nodes.length;case"exists":return e(1),x(o(0),n.at,"exists").nodes.length>0;case"every":case"some":{e(2);let r=x(o(0),n.at,n.fn);l(r.nodes.length,n.at);let a=d=>N(R(d,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(a):r.nodes.some(a)}case"sum":case"min":case"max":{e(2);let r=x(o(0),n.at,n.fn);l(r.nodes.length,n.at);let a=n.args[1],d=a.t==="lit"&&typeof a.value=="string"?a.value:void 0,$=a.t==="ident"?`'${a.name}'`:d!==void 0?`'${d}'`:"\u2026",m=r.nodes.map(y=>a.t==="ident"?M(y,a.name,n.at):d!==void 0?M(y,d,n.at):R(y,a)).filter(y=>{if(y===null)return!1;if(typeof y!="number")throw new c(`${n.fn}(\u2026, ${$}) needs a number for each member, and found ${p(y)}`,n.at);return!0});return n.fn==="sum"?m.reduce((y,S)=>y+S,0):m.length===0?null:n.fn==="min"?Math.min(...m):Math.max(...m)}case"fact":{e(1);let r=u(0),a=i.kinds.get(J)?.computed?.get(r);if(!a)throw new c(`no fact is called "${r}"`,n.at);return I(null,r,a,n.at)}case"first":return e(1),x(o(0),n.at,"first").nodes[0]??null;case"sort":{e(2,3);let r=x(o(0),n.at,"sort"),a=n.args.length===3?o(2):"asc";if(a!=="asc"&&a!=="desc")throw new c("sort(\u2026) goes 'asc' or 'desc'",n.at);let d=r.nodes.length;l(d+d*Math.ceil(Math.log2(d+1)),n.at);let $=r.nodes.map((y,S)=>({node:y,i:S,key:R(y,n.args[1])})),m=a==="desc"?-1:1;return $.sort((y,S)=>L(y.key,S.key,m,n.at)||y.i-S.i),new g($.map(y=>y.node))}case"either":{if(n.args.length<1)throw new c("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let a=o(r);if(a!==null&&!(a instanceof g&&a.nodes.length===0))return a}return null}case"present":{e(1);let r=o(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof g?r.nodes.length>0:!0}case"len":{e(1);let r=o(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof g)return r.nodes.length;throw new c(`len(\u2026) needs a word or a list, and was given ${p(r)}`,n.at)}case"contains":case"startsWith":{e(2);let r=o(0),a=o(1);if(r===null||a===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(m=>E(m,a));let d=k(r,n.at,n.fn),$=k(a,n.at,n.fn);return n.fn==="contains"?d.toLowerCase().includes($.toLowerCase()):d.startsWith($)}case"lower":{e(1);let r=k(o(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"today":return e(0),b;case"now":return e(0),A;case"date":{e(1);let r=O(o(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{e(2);let r=O(o(0),n.at,n.fn),a=O(o(1),n.at,n.fn);if(r===null||a===null)return null;let d=(a-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(d):d}case"if":return e(3),N(o(0),n.at,"the condition in if(\u2026)")?o(1):o(2);default:throw new c(`"${n.fn}" is not a function the rule language knows`,n.at)}}function L(n,s,e,o){if(n===null||s===null)return n===s?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(s)){for(let r=0;r<Math.max(n.length,s.length);r++){let a=L(n[r]??null,s[r]??null,e,o);if(a!==0)return a}return 0}let u=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:p(r);if(u(n)!==u(s)||typeof n=="object"||typeof s=="object")throw new c(`sort(\u2026) cannot put ${p(n)} and ${p(s)} in order`,o);return typeof n=="string"?e*(n<s?-1:n>s?1:0):e*(Number(n)-Number(s))}return h(t,i.subject)}var rn=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact"];var sn=(t,i,f,l)=>({severity:"error",code:t,path:i,message:f,...l?{fix:l}:{}}),an=(t,i,f,l)=>({severity:"warning",code:t,path:i,message:f,...l?{fix:l}:{}}),ln=t=>t.some(i=>i.severity==="error");function un(t){return t.map(i=>`${i.severity==="error"?"\u2717":i.severity==="warning"?"!":"\xB7"} ${i.path||"(document)"}: ${i.message}${i.fix?` \u2014 ${i.fix}`:""}`).join(`
|
|
2
|
+
`)}var gn=["money","percent","date","relative","upper","lower","count","words","and","plural"],Q={getNode:()=>{},allNodes:()=>[],allEdges:()=>[],nodesOfKind:()=>[],edgesOfKind:()=>[],out:()=>[],in:()=>[],neighbors:()=>[],has:()=>!1};function yn(t,i,f,l=[],b){return K(t,i,f,l,b)}function X(t,i={}){let f=Number.isInteger(t),l={maximumFractionDigits:f?0:2,minimumFractionDigits:f?0:2};try{return new Intl.NumberFormat(i.locale??"en-US",i.currency?{style:"currency",currency:i.currency,...l}:l).format(t)}catch{return t.toLocaleString("en-US",l)}}var q=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],Z=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function v(t){return!Number.isInteger(t)||t<0||t>99?t.toLocaleString("en-US",{maximumFractionDigits:2}):t<20?q[t]:t%10===0?Z[t/10]:`${Z[Math.floor(t/10)]}-${q[t%10]}`}function z(t){return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function nn(t){return/[^aeiou]y$/i.test(t)?`${t.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/i.test(t)?`${t}es`:`${t}s`}var j=t=>String(t.name??t.title??t.label??t.id);function K(t,i,f,l=[],b){if(i==="plural"){let A=t instanceof g?t.nodes.length:Array.isArray(t)?t.length:typeof t=="number"?t:null;return A===null||l[0]===void 0?"\u2014":A===1?l[0]:l[1]??nn(l[0])}if(t===null)return"\u2014";if(t instanceof g)return i==="count"?String(t.nodes.length):i==="and"?z(t.nodes.map(j)):t.nodes.map(j).join(", ");if(Array.isArray(t)){if(i==="count")return String(t.length);let A=t.map(w=>K(w,void 0,f,[],b));return i==="and"?z(A):A.join(", ")}if(typeof t=="object")return j(t);switch(i){case"words":return typeof t=="number"?v(t):String(t);case"money":return typeof t=="number"?X(t,b):String(t);case"percent":return typeof t=="number"?`${Math.round(t*100)}%`:String(t);case"upper":return String(t).toUpperCase();case"lower":return String(t).toLowerCase();case"date":return D(String(t).slice(0,10));case"relative":{let A=Date.parse(String(t).length===10?`${t}T00:00:00Z`:String(t));if(Number.isNaN(A))return String(t);let w=Math.round((A-Date.parse(`${f}T00:00:00Z`))/864e5);return w===0?"today":w===1?"tomorrow":w===-1?"yesterday":w>0?`in ${w} days`:`${-w} days ago`}default:return typeof t=="string"&&U.test(t)?D(t):String(t)}}function pn(t,i){let f=i.today??F();return t.map(l=>{if(l.text!==void 0)return l.text;try{let b=W(l.expr,{graph:i.graph??Q,subject:i.node,kinds:i.kinds,today:f,budget:i.budget??500,...i.bindings?{bindings:i.bindings}:{}});return K(b,l.format,f,l.formatArgs,i.money)}catch(b){if(b instanceof c)return"\u2014";throw b}}).join("")}export{g as a,J as b,c,C as d,W as e,rn as f,sn as g,an as h,ln as i,un as j,gn as k,Q as l,yn as m,X as n,pn as o};
|