graview 0.1.21 → 0.1.22
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/README.md +22 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/preview/chunk.2F7OKRDK.js +9 -0
- package/dist/preview/chunk.3HEJZPJM.js +1040 -0
- package/dist/preview/chunk.3MLQ3Q5X.js +1 -0
- package/dist/preview/chunk.4CDEIDKB.js +1 -0
- package/dist/preview/chunk.4HGBVU5B.js +1 -0
- package/dist/preview/chunk.4JSMCNF7.js +1 -0
- package/dist/preview/chunk.4UQLZ7VW.js +1 -0
- package/dist/preview/chunk.5JNXQHN4.js +1 -0
- package/dist/preview/chunk.5MAMCKVU.js +1 -0
- package/dist/preview/chunk.6C7SJJQO.js +1 -0
- package/dist/preview/chunk.6CLHFNDM.js +321 -0
- package/dist/preview/chunk.6KJSFIO7.js +1 -0
- package/dist/preview/chunk.75WDSWXL.js +20 -0
- package/dist/preview/chunk.7YC34AIK.js +1 -0
- package/dist/preview/chunk.7YCQZJGB.js +1 -0
- package/dist/preview/chunk.ACZGK7LQ.js +1 -0
- package/dist/preview/chunk.AHDOKM4O.js +1 -0
- package/dist/preview/chunk.AJZBJBMO.js +1 -0
- package/dist/preview/chunk.AZG6V3PF.js +1 -0
- package/dist/preview/chunk.AZYJTNSM.js +107 -0
- package/dist/preview/chunk.BQV62QEL.js +61 -0
- package/dist/preview/chunk.CJQL7AHT.js +3 -0
- package/dist/preview/chunk.DAKED3WK.js +1 -0
- package/dist/preview/chunk.DJ26NOOW.js +1 -0
- package/dist/preview/chunk.DN4D4HGX.js +1 -0
- package/dist/preview/chunk.DO4P2UK4.js +1 -0
- package/dist/preview/chunk.ELEHYYCN.js +1 -0
- package/dist/preview/chunk.ENMNLR73.js +2 -0
- package/dist/preview/chunk.EQOU4POV.js +1 -0
- package/dist/preview/chunk.FLDFRFDH.js +23 -0
- package/dist/preview/chunk.FLJP3BGP.js +1 -0
- package/dist/preview/chunk.G4JJXA63.js +1 -0
- package/dist/preview/chunk.HCK6IHGP.js +1 -0
- package/dist/preview/chunk.IKT7JQUW.js +14 -0
- package/dist/preview/chunk.JE4VH767.js +16 -0
- package/dist/preview/chunk.K7UJG5II.js +1 -0
- package/dist/preview/chunk.KFLY4MAT.js +1 -0
- package/dist/preview/chunk.KWYU5NPM.js +1 -0
- package/dist/preview/chunk.L5G5DTFX.js +1 -0
- package/dist/preview/chunk.LGUV2J6Q.js +1 -0
- package/dist/preview/chunk.LSLFKW4M.js +1 -0
- package/dist/preview/chunk.LZQZP2PD.js +2 -0
- package/dist/preview/chunk.M4XNUM2A.js +6 -0
- package/dist/preview/chunk.MRK6QJV5.js +25 -0
- package/dist/preview/chunk.NOXC454O.js +1 -0
- package/dist/preview/chunk.ONDILMIX.js +1 -0
- package/dist/preview/chunk.OR6ZWN76.js +1 -0
- package/dist/preview/chunk.PC6FAJF5.js +1 -0
- package/dist/preview/chunk.Q5WEOX3Q.js +1 -0
- package/dist/preview/chunk.Q7WQ5UIE.js +1 -0
- package/dist/preview/chunk.R5K7NK4U.js +1 -0
- package/dist/preview/chunk.SCLIBKLS.js +1 -0
- package/dist/preview/chunk.SQD7ZPEJ.js +1 -0
- package/dist/preview/chunk.THBP5EES.js +1 -0
- package/dist/preview/chunk.UNRYIETM.js +1 -0
- package/dist/preview/chunk.VNC6H6IM.js +1 -0
- package/dist/preview/chunk.VRXWNUDR.js +1 -0
- package/dist/preview/chunk.VVZ2Z7OS.js +29 -0
- package/dist/preview/chunk.WGNF4E67.js +1 -0
- package/dist/preview/chunk.WTF3CP76.js +1 -0
- package/dist/preview/chunk.WWRWXFYR.js +0 -0
- package/dist/preview/chunk.XEJS2VS5.js +8 -0
- package/dist/preview/chunk.XYZ7KAMZ.js +1 -0
- package/dist/preview/chunk.Y235YZSZ.js +8 -0
- package/dist/preview/chunk.YAONM74M.js +19 -0
- package/dist/preview/chunk.YSYT3ASK.js +1 -0
- package/dist/preview/chunk.YU64JSAL.js +1 -0
- package/dist/preview/chunk.ZFUQA3KT.js +1 -0
- package/dist/preview/chunk.ZKUXPS44.js +2 -0
- package/dist/preview/chunk.ZQZ557VR.js +1 -0
- package/dist/preview/index.html +13 -0
- package/dist/preview/page.js +34 -0
- package/package.json +7 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as W}from"./chunk.AZG6V3PF.js";import{C as R,b as A,c as T,d as v,e as f,f as x,j as I,m as b,ra as k}from"./chunk.4JSMCNF7.js";import{Lb as s,wa as y,xa as r}from"./chunk.Y235YZSZ.js";import{a as H}from"./chunk.MRK6QJV5.js";import{b as B}from"./chunk.AJZBJBMO.js";var u=B(H(),1),L=e=>typeof e=="object"&&e!==null&&"idx"in e;function E(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":L(window.history.state)?"pages":null}function J(e){let n=e.face??(e.stop&&v(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:E(e.basePath)??n}function K(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&E(e.basePath)===null}function Q(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?T(f(window.location.hash)):void 0}function X({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:U,places:w,opens:$}){let{view:F,go:p}=k(),g=(0,u.useRef)({shown:t,view:F,onFace:i});g.current={shown:t,view:F,onFace:i};let S=(0,u.useRef)(n??"/"),M=()=>{S.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:N,onFace:V}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",y(c??S.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){M();let m=a===void 0?N:j(v(a),w),h=Y(m)?q($):m,O=h!==m&&h.overview?"graview":o,P=_(O,h,U);p(P),window.history.pushState(null,"",`${y(s,{basePath:e})}${x(P)}`),V?.(O);return}V?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=E(e)??"pages",{shown:a,onFace:d}=g.current;if(c==="pages"){a!=="pages"&&d?.("pages");return}a==="pages"&&(p(j(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function j(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:R(i.kind)}:e}function _(e,n,t){return e==="graview"?b(n,!0):n.overview?I(b(n,!1),W(n,t)):n}function Y(e){return e.focusId===null&&e.overview!==!0}function q(e){return e??{...A,overview:!0}}export{J as a,K as b,Q as c,X as d,j as e,_ as f,Y as g,q as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Aa as y,Z as m}from"./chunk.4JSMCNF7.js";import{a as k,b as g}from"./chunk.MRK6QJV5.js";import{b as c}from"./chunk.AJZBJBMO.js";var p=c(k(),1);var i=c(g(),1);var h={default:{background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)"},muted:{background:"var(--graview-panel-muted, #f7f5f1)",color:"var(--graview-ink, #1a1a1a)"},warning:{background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)"}},N={color:"var(--graview-ink-muted, #55514a)"},T={color:"var(--graview-ink-faint, #625d55)"};function E(e){let[r,n]=(0,p.useState)(!1);return(0,p.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>"u")return;let a=()=>n(t.scrollHeight>t.clientHeight+1||t.scrollWidth>t.clientWidth+1);a();let d=new ResizeObserver(a);d.observe(t);for(let l of t.children)d.observe(l);return()=>d.disconnect()}),r}function A({level:e,style:r,children:n}){if(e===void 0)return(0,i.jsx)("strong",{style:r,children:n});let t=`h${e}`;return(0,i.jsx)(t,{style:{margin:0,...r},children:n})}function L({title:e,subtitle:r,meta:n,selected:t,tone:a="default",children:d,style:l,fit:s=!1,variant:M,heading:R}){let u=(0,p.useRef)(null),f=E(u),C=m(),o=(M??(C==="fullscreen"?"page":"card"))==="page";return(0,i.jsxs)("div",{"data-graview-primitive":"panel","data-graview-variant":o?"page":"card","data-selected":t||void 0,style:{display:"flex",flexDirection:"column",gap:o?12:"var(--graview-gap, 7px)",height:o||s?"auto":"100%",maxHeight:o?"none":"100%",padding:o?0:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:o?0:"var(--graview-radius, 12px)",border:o?"none":`1px solid ${t?"var(--graview-accent, #2f6f5e)":"var(--graview-edge, #e4e0d8)"}`,boxShadow:o?"none":t?"0 0 0 1px var(--graview-accent-dim), var(--graview-lift-low)":"var(--graview-lift-low)",overflow:o?"visible":"hidden",...h[a],...o?{background:"transparent"}:{},"--graview-panel-bg":h[a].background,...l},children:[a==="warning"?(0,i.jsx)("span",{"data-graview-broken":"",style:y,children:"Implicated in a problem."}):null,e===void 0?null:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0},children:[a==="warning"?(0,i.jsx)("span",{"aria-hidden":"true",title:"Implicated in a problem",style:{color:"var(--graview-warn)",flex:"0 0 auto"},children:"\u26A0"}):null,(0,i.jsx)(A,{level:R,style:{fontFamily:"var(--graview-font-display, inherit)",fontSize:o?"1.5625rem":"0.9375rem",lineHeight:o?1.15:1.25,fontWeight:o?600:560,letterSpacing:o?"-0.012em":"0.005em",minWidth:0,overflowWrap:"anywhere"},children:e}),n===void 0?null:(0,i.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",letterSpacing:"0.08em",textTransform:"uppercase",minWidth:0,overflowWrap:"anywhere",...T},children:n})]}),r===void 0?null:(0,i.jsx)("div",{style:{fontSize:o?"0.90625rem":"0.8125rem",lineHeight:1.5,...N},children:r}),(0,i.jsx)("div",{ref:u,className:o?void 0:"graview-scroll",...f&&!o?{tabIndex:0,role:"region",...typeof e=="string"?{"aria-label":e}:{}}:{},style:{display:"flex",flexDirection:"column",gap:o?22:"var(--graview-gap, 7px)",flex:"1 1 auto",...o?{overflow:"visible"}:{}},"data-graview-overflowing":f&&!o?"":void 0,children:d})]})}function v({label:e,hue:r,selected:n,title:t,pickId:a,emphasis:d}){let l=typeof e=="string"?e:void 0,s=r===void 0?void 0:Math.round(r);return(0,i.jsxs)("span",{"data-graview-primitive":"chip","data-selected":n||void 0,"data-graview-pick":a,"data-graview-emphasis":d,title:t??l,style:{cursor:a?"pointer":void 0,display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",maxWidth:"min(28ch, 100%)",overflow:"hidden",letterSpacing:"0.01em",border:`1px solid ${n?"var(--graview-accent)":s===void 0?"var(--graview-edge)":`hsl(${s} 55% var(--graview-tint-lightness) / 0.45)`}`,background:s===void 0?"var(--graview-panel-muted)":`hsl(${s} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * 0.65))`,color:"var(--graview-ink, #1a1a1a)",boxShadow:n?"0 0 14px -4px var(--graview-accent)":void 0},children:[s===void 0?null:(0,i.jsx)("span",{"aria-hidden":"true",style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",marginRight:6,background:`hsl(${s} 55% var(--graview-tint-lightness) / 0.9)`}}),(0,i.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function D({items:e,max:r=8,selectedIds:n=[],pick:t=!1}){let a=e.slice(0,r),d=e.length-a.length;return(0,i.jsxs)("div",{"data-graview-primitive":"roster",style:{display:"flex",flexWrap:"wrap",gap:6,alignContent:"flex-start"},children:[a.map(l=>(0,i.jsx)(v,{label:l.label,...l.hue===void 0?{}:{hue:l.hue},...t?{pickId:l.id}:{},...l.emphasis===void 0?{}:{emphasis:l.emphasis},selected:n.includes(l.id)},l.id)),d>0?(0,i.jsx)(v,{label:`+${d} more`}):null]})}function B({label:e,count:r,items:n,onExpand:t,flagged:a}){return(0,i.jsx)(L,{title:e,meta:a?`\u26A0 ${r}`:r,tone:a?"warning":"muted",style:t?{cursor:"zoom-in"}:void 0,children:n&&n.length>0?(0,i.jsx)(D,{items:n,max:6,pick:!0}):null})}var x=["solid","dashed","dotted","double","tapered"],b=["arrow","none","dot","bar"];function H(e){let r=2166136261;for(let n=0;n<e.length;n++)r^=e.charCodeAt(n),r=Math.imul(r,16777619);return r>>>0}function O(e,r={}){let n=H(e);return{...{pattern:x[n%x.length],width:1.5+(n>>>3)%3*.75,cap:b[(n>>>7)%b.length],hue:(n>>>11)%360,opacity:.85},...r[e]}}var W={solid:void 0,dashed:"7 5",dotted:"1 5",double:"12 3",tapered:"10 3 3 3"};function z(e){return e.color??`hsl(${Math.round(e.hue)} 55% 62%)`}function _(e,r){return r?Math.max(1.6,e.width):Math.min(1.4,e.width)}function w(e,r,n){return[e,0,0,0,0,e,0,0,0,0,1,0,r,n,0,1]}var S={0:{scale:1,blur:0,falloff:0,shadow:.16,fidelity:"full"},1:{scale:.95,blur:.3,falloff:.26,shadow:.12,fidelity:"summary"},2:{scale:.9,blur:.3,falloff:.34,shadow:.07,fidelity:"glyph"}},P={0:{scale:1,blur:0,falloff:0,shadow:.34,fidelity:"full"},1:{scale:.95,blur:.45,falloff:.18,shadow:.24,fidelity:"summary"},2:{scale:.9,blur:.45,falloff:.26,shadow:.14,fidelity:"glyph"}};function $(e,r="dark"){let n=Math.max(0,Math.min(2,Math.round(e)));return(r==="light"?S:P)[n]}function F(e,r,n){let t=Math.max(0,Math.min(1,n)),a=(d,l)=>d+(l-d)*t;return{scale:a(e.scale,r.scale),blur:a(e.blur,r.blur),falloff:a(e.falloff,r.falloff),shadow:a(e.shadow,r.shadow),fidelity:t<.5?e.fidelity:r.fidelity}}function Y(e,r,n,t,a){return w(e.scale,r,n)}export{P as a,$ as b,F as c,Y as d,O as e,W as f,z as g,_ as h,L as i,v as j,D as k,B as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as r}from"./chunk.MRK6QJV5.js";import{b as d}from"./chunk.AJZBJBMO.js";var n=d(r(),1);function u(e){return(0,n.useMemo)(()=>e===void 0||e===""?void 0:{__html:e},[e])}export{u as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);var l=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&f(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b};var n=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:!0}):c,b));export{m as a,n as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as l}from"./chunk.6CLHFNDM.js";import{C as f,G as E,a as P,b as h,ca as O,f as V,ia as v,l as B,la as L,m as A,ra as R,ya as _,z as x}from"./chunk.4JSMCNF7.js";import{Lb as g}from"./chunk.Y235YZSZ.js";import{a as C,b as T}from"./chunk.MRK6QJV5.js";import{b as S}from"./chunk.AJZBJBMO.js";var k=S(C(),1);var H="The whole thing",y=e=>`scene:${e.kind}:${e.as}`;function D(e){let{view:t}=e,i=new Set,n=e.places.filter(r=>e.hidden.has(r.kind)||i.has(y(r))?!1:(i.add(y(r)),!0)),a=(r,p)=>{if(r===l)return B(A(p,!0),"view",null);let w=n.find(N=>y(N)===r);return w?E(p,w.kind,w.as):null},o=[{key:l,label:H,path:`${g}${V(a(l,h))}`,group:"home"},...n.map(r=>({key:y(r),label:r.title,path:`${g}${V(a(y(r),h))}`,group:"pictures",kind:r.kind}))],s=t.within?.view,d=r=>t.focusId===f(r.kind)&&(s===void 0?n.filter(p=>p.kind===r.kind).at(-1)===r:s===r.as),c=n.find(r=>d(r)&&(s!==void 0||!t.overview));return{places:o,current:c?y(c):l,to:a}}function I(){let{views:e,hiddenKinds:t}=O(),{view:i,go:n}=R(),a=e.places(),o=(0,k.useMemo)(()=>D({places:a,hidden:t,view:i}),[a,t,i]),s=(0,k.useMemo)(()=>({go:d=>{let c=o.to(d.key,i);c&&n(c)}}),[o,i,n]);return{places:o.places,current:o.current,reach:s}}function W(e,t,i=[]){if(e.focusId)return e.focusId;let a=(e.selection??[]).map(x).find(o=>o!==null)??i.find(o=>t.includes(o))??t[0]??null;return a===null?null:f(a)}var m=S(T(),1),u=_(P(()=>import("./chunk.PC6FAJF5.js")));function G(){return u.load().then(()=>{})}var K=[{cardinality:"one",fidelity:"full",slot:"page"},{cardinality:"one",fidelity:"summary",slot:"card"},{cardinality:"one",fidelity:"glyph",slot:"row"},{cardinality:"many",fidelity:"full"},{cardinality:"many",fidelity:"summary"},{cardinality:"many",fidelity:"glyph"}];function M({schema:e,specs:t,kind:i,view:n}){let a=u.current.frameworkViews(e,t).lookup(i,{cardinality:n.cardinality,fidelity:n.fidelity});return a?(0,m.jsx)(a,{...n}):null}var b=u.part((e,t)=>(0,m.jsx)(M,{...t}),{what:"This view"});function F(e,t,i){for(let n of t.kinds){let a=i?.[n];for(let o of K){let s=c=>(0,m.jsx)(b,{schema:t,specs:i,kind:n,view:c}),d=o.slot!==void 0&&a?.[o.slot]!==void 0;d&&(s.says=(c,r)=>u.current?.frameworkViews(t,i).lookup(n,{cardinality:o.cardinality,fidelity:o.fidelity})?.says?.(c,r)),e.register(n,{cardinality:o.cardinality,fidelity:o.fidelity},d?s:v(s))}}return e}function $(e,t){return F(L(e),e,t)}export{I as a,W as b,G as c,$ as d};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import{A as he,B as ke,C as Yn,D as Pt,E as pe,F as Jn,G as Qn,H as A,I as Ne,J as Ct,K as Xn,L as Rt,M as rt,N as Zn,O as U,P as Y,Q as At,a as G,b as fe,c as q,d as Vn,e as xe,f as Fe,g as D,h as se,i as _,j as k,k as j,l as $,m as J,n as et,o as ee,p as Un,q as tt,r as nt,s as I,t as Pe,u as jn,v as at,w as le,x as _n,y as de,z as xt}from"./chunk.VVZ2Z7OS.js";import{a as Ze,c as V}from"./chunk.EQOU4POV.js";import{a as Bn,d as Gn,e as qn}from"./chunk.ONDILMIX.js";import{a as Hn,e as zn}from"./chunk.NOXC454O.js";import{a as bt}from"./chunk.DJ26NOOW.js";import{a as Ma}from"./chunk.IKT7JQUW.js";import{h as An,i as Ln}from"./chunk.6CLHFNDM.js";import{e as Tn,i as Kn}from"./chunk.R5K7NK4U.js";import{a as Qe,b as Pn,c as Cn,e as vt,f as Rn}from"./chunk.HCK6IHGP.js";import{f as Fn}from"./chunk.YAONM74M.js";import{a as En,b as On,d as Nn,f as Wn,g as Dn,h as In,k as Xe}from"./chunk.CJQL7AHT.js";import{o as St}from"./chunk.DAKED3WK.js";import{f as Oe}from"./chunk.ZFUQA3KT.js";import{b as Mn,c as kt,d as $n}from"./chunk.LGUV2J6Q.js";import{$ as kn,C as Ie,W as wn,_ as vn,a as fn,da as oe,ha as Sn,ja as Ee,ka as bn,ta as xn,y as hn}from"./chunk.4JSMCNF7.js";import{Ba as on,Ca as sn,Ea as ln,G as $e,H as je,I as ae,J as Jt,Kb as wt,L as re,Lb as un,N as Qt,P as Xt,Pb as mn,Ra as dn,S as Zt,Sa as pn,Sb as Je,T as be,Tb as yn,U as en,Ua as cn,V as tn,Wa as Ye,_ as nn,aa as _e,ma as ht,na as an,sa as rn,ub as gn}from"./chunk.Y235YZSZ.js";import{a as ve,b as z}from"./chunk.MRK6QJV5.js";import{b as O}from"./chunk.AJZBJBMO.js";function ea(e,t,n={}){let a=e.graph.getNode(t);if(!a)return;let i=e.schema.tryDefinition(a.kind),r=s=>ae(e.schema.tryDefinition(s.kind),s),d=new Map;for(let s of e.graph.allEdges()){let l=s.from===t?"out":s.to===t?"in":null;if(!l)continue;let o=l==="out"?s.to:s.from,u=e.graph.getNode(o);if(!u)continue;let c=(l==="out"?i:e.schema.tryDefinition(u.kind))?.edges?.[s.kind],g=l==="in"?c?.inverse??c?.description:c?.description,y=`${s.kind}|${l}|${g??""}`;(d.get(y)??(()=>{let F={edgeKind:s.kind,direction:l,...g?{description:g}:{},targets:[]};return d.set(y,F),F})()).targets.push({id:u.id,kind:u.kind,label:r(u)})}return{id:t,kind:a.kind,label:r(a),fields:en(Oe(e.schema,e.graph,a),i),violations:ht(e.violations(n.context),[t]),actions:bt(e,[t],{focus:t,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...d.values()].map(s=>{let l=je(s.targets.flatMap(o=>{let u=e.graph.getNode(o.id);return u?[u]:[]}),o=>e.schema.tryDefinition(o));return{...s,targets:[...s.targets].map(o=>l.has(o.id)?{...o,apart:l.get(o.id)}:o).sort((o,u)=>o.label.localeCompare(u.label))}})}}function Ce(e,t,n={}){return{kind:t,members:e.graph.nodesOfKind(t),actions:bt(e,[],{kindSelection:[t],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function ta(e,t){let n=(r,d)=>`${r}|${JSON.stringify(d)}`,a=new Map;for(let r of[...e.affordances,...e.withheld]){if(r.provider!=="invariant")continue;let d=n(r.mutation,r.args);a.has(d)||a.set(d,r.rank??Number.MAX_SAFE_INTEGER)}let i=Number.MAX_SAFE_INTEGER;return[...t].map((r,d)=>({repair:r,declared:d})).sort((r,d)=>(a.get(n(r.repair.mutation,r.repair.args??{}))??i)-(a.get(n(d.repair.mutation,d.repair.args??{}))??i)||r.declared-d.declared).map(r=>r.repair)}function Re(e){let t=e.schema.kinds.map(i=>({kind:i,plural:Xt(e.schema,i),count:e.graph.nodesOfKind(i).length})),n=new Map;for(let i of e.graph.allEdges()){let r=e.graph.getNode(i.from),d=e.graph.getNode(i.to);if(!r||!d)continue;let s=`${i.kind}|${r.kind}|${d.kind}`;n.set(s,(n.get(s)??0)+1)}let a=[];for(let{kind:i}of t){let r=e.schema.tryDefinition(i)?.edges??{};for(let[d,s]of Object.entries(r)){let l=s.to==="*"||s.to===void 0?(()=>{let o=[...n.keys()].filter(u=>u.startsWith(`${d}|${i}|`)).map(u=>u.split("|")[2]);return o.length>0?o:["*"]})():s.to;for(let o of l)a.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:t,relations:a}}var Le=O(ve(),1);var Lt=O(ve(),1),S=O(z(),1),$a=`
|
|
2
|
+
form:where([data-graview-part="form"]) {
|
|
3
|
+
/* A grid item of the section above it and a grid container for the
|
|
4
|
+
fields below: both halves are allowed to be narrower than what is in
|
|
5
|
+
them, or a big enough text size pushes the page sideways. See the note
|
|
6
|
+
on \`column\` in pages.tsx. */
|
|
7
|
+
display: grid;
|
|
8
|
+
grid-template-columns: minmax(0, 1fr);
|
|
9
|
+
min-width: 0;
|
|
10
|
+
gap: 12px;
|
|
11
|
+
}
|
|
12
|
+
label:where([data-graview-part="field"]) {
|
|
13
|
+
display: grid;
|
|
14
|
+
/* A track the width it was given: see the note on \`column\` in pages.tsx. */
|
|
15
|
+
grid-template-columns: minmax(0, 1fr);
|
|
16
|
+
min-width: 0;
|
|
17
|
+
gap: 4px;
|
|
18
|
+
}
|
|
19
|
+
label:where([data-graview-part="field"][data-graview-field="boolean"]) {
|
|
20
|
+
grid-auto-flow: column;
|
|
21
|
+
justify-content: start;
|
|
22
|
+
align-items: center;
|
|
23
|
+
}
|
|
24
|
+
span:where([data-graview-part="label"]),
|
|
25
|
+
legend:where([data-graview-part="label"]),
|
|
26
|
+
p:where([data-graview-part="unasked"]) {
|
|
27
|
+
font-size: 0.8125rem;
|
|
28
|
+
color: var(--graview-ink-muted);
|
|
29
|
+
}
|
|
30
|
+
p:where([data-graview-part="unasked"]) { margin: 0; }
|
|
31
|
+
input:where([data-graview-part="control"]:not([type="checkbox"])),
|
|
32
|
+
select:where([data-graview-part="control"]) {
|
|
33
|
+
font: inherit;
|
|
34
|
+
/* A TARGET IN EVERY ENGINE, not only in the one it was measured in.
|
|
35
|
+
Padding and line height alone came to 24 in Chromium and to 22 in
|
|
36
|
+
WebKit, which has its own intrinsic metrics for a \`select\` and rounds
|
|
37
|
+
nothing up for anybody. So every picker on the routed face was under
|
|
38
|
+
the WCAG 2.2 minimum in the browser iOS ships, and the check that says
|
|
39
|
+
so (\`verify-pages\`' \`bigEnoughToHit\`) only ever ran there through
|
|
40
|
+
\`pnpm engines\`. */
|
|
41
|
+
min-height: 24px;
|
|
42
|
+
/* NEVER WIDER THAN ITS FIELD. A select is as wide as its longest option,
|
|
43
|
+
and a picker over 320 vehicles ("2027 Mercedes-Benz GLE AMG 53 4MATIC+
|
|
44
|
+
Coupe") was 618 pixels on a 390 phone, and the whole page scrolled
|
|
45
|
+
sideways. It shrinks to its track and cuts the option inside its box. */
|
|
46
|
+
min-width: 0;
|
|
47
|
+
max-width: 100%;
|
|
48
|
+
text-overflow: ellipsis;
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
padding: 7px 10px;
|
|
51
|
+
border-radius: 8px;
|
|
52
|
+
border: 1px solid var(--graview-edge);
|
|
53
|
+
background: var(--graview-panel);
|
|
54
|
+
color: var(--graview-ink);
|
|
55
|
+
}
|
|
56
|
+
/* A PICKER THAT STILL LOOKS LIKE ONE.
|
|
57
|
+
WebKit ignores an author's padding and minimum height on a \`select\`
|
|
58
|
+
while the native appearance is on \u2014 so every picker on the routed face
|
|
59
|
+
came out 22 pixels tall in the browser iOS ships, under the 24 WCAG 2.2
|
|
60
|
+
asks for, while the same element measured 35 in Chromium. Turning the
|
|
61
|
+
appearance off is what makes the box the size it was asked to be, and it
|
|
62
|
+
takes the platform's chevron with it; the chevron is put back, in the ink
|
|
63
|
+
the scheme is already using. */
|
|
64
|
+
span:where([data-graview-part="picker"]) {
|
|
65
|
+
position: relative;
|
|
66
|
+
display: grid;
|
|
67
|
+
min-width: 0;
|
|
68
|
+
}
|
|
69
|
+
span:where([data-graview-part="picker"]) > select:where([data-graview-part="control"]) {
|
|
70
|
+
appearance: none;
|
|
71
|
+
padding-right: 28px;
|
|
72
|
+
}
|
|
73
|
+
span:where([data-graview-part="chevron"]) {
|
|
74
|
+
position: absolute;
|
|
75
|
+
right: 10px;
|
|
76
|
+
top: 50%;
|
|
77
|
+
transform: translateY(-50%);
|
|
78
|
+
font-size: 0.75rem;
|
|
79
|
+
line-height: 1;
|
|
80
|
+
color: var(--graview-ink-muted);
|
|
81
|
+
pointer-events: none;
|
|
82
|
+
}
|
|
83
|
+
fieldset:where([data-graview-part="group"]) {
|
|
84
|
+
display: grid;
|
|
85
|
+
gap: 10px;
|
|
86
|
+
border: 1px solid var(--graview-edge);
|
|
87
|
+
border-radius: 10px;
|
|
88
|
+
padding: 12px;
|
|
89
|
+
}
|
|
90
|
+
fieldset:where([data-graview-part="group"][data-graview-field="list"]) { gap: 8px; }
|
|
91
|
+
div:where([data-graview-part="item"]) {
|
|
92
|
+
display: flex;
|
|
93
|
+
gap: 8px;
|
|
94
|
+
align-items: end;
|
|
95
|
+
}
|
|
96
|
+
button:where([data-graview-part="add"]),
|
|
97
|
+
button:where([data-graview-part="submit"]) { justify-self: start; }
|
|
98
|
+
p:where([data-graview-part="refused"]) {
|
|
99
|
+
margin: 0;
|
|
100
|
+
color: var(--graview-warn);
|
|
101
|
+
font-size: 0.875rem;
|
|
102
|
+
}
|
|
103
|
+
`;function na({children:e}){return(0,S.jsxs)("span",{"data-graview-part":"picker",children:[e,(0,S.jsx)("span",{"aria-hidden":"true","data-graview-part":"chevron",children:"\u25BE"})]})}var Ea=e=>({label:re(e),option:t=>t});function it({store:e,spec:t,value:n,onChange:a,prefilled:i,open:r,words:d=Ea}){if(t.name in i&&t.control!=="group"&&t.control!=="variant")return null;let l=(t.control==="node"&&!t.kinds.includes("*")?t.kinds.map(o=>re(be(e.schema.tryDefinition(o),o))).join(" or "):d(t.name).label)+(t.optional?"":" *");switch(t.control){case"text":case"date":return t.control==="text"&&t.long?(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"text",children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)("textarea",{name:t.name,required:!t.optional,rows:6,value:typeof n=="string"?n:"",onChange:o=>a(o.target.value),"data-graview-part":"control",style:{fieldSizing:"content",minHeight:"7.5em",resize:"vertical",font:"inherit",lineHeight:1.5}})]}):(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":t.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)("input",{type:t.control==="date"?t.time?"datetime-local":"date":"text",name:t.name,required:!t.optional,value:typeof n=="string"?n:"",onChange:o=>a(o.target.value),"data-graview-part":"control"})]});case"number":return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":t.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)("input",{type:"number",name:t.name,required:!t.optional,...t.min===void 0?{}:{min:t.min},...t.max===void 0?{}:{max:t.max},...t.step===void 0?{}:{step:t.step},value:typeof n=="number"?n:"",onChange:o=>a(o.target.value===""?void 0:Number(o.target.value)),"data-graview-part":"control"})]});case"boolean":return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"boolean",children:[(0,S.jsx)("input",{type:"checkbox",name:t.name,checked:n===!0,onChange:o=>a(o.target.checked),"data-graview-part":"control"}),(0,S.jsx)("span",{"data-graview-part":"label",children:l})]});case"choice":return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":t.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)(na,{children:(0,S.jsxs)("select",{name:t.name,required:!t.optional,value:typeof n=="string"?n:"",onChange:o=>a(o.target.value||void 0),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),(t.options??[]).map(o=>(0,S.jsx)("option",{value:o,children:d(t.name).option(o)},o))]})})]});case"node":{let o=r.find(y=>y.name===t.name)?.candidates,u=new Set(Object.values(i).filter(y=>typeof y=="string")),m=(t.kinds.includes("*")?[...e.graph.allNodes()]:t.kinds.flatMap(y=>e.graph.nodesOfKind(y))).filter(y=>!u.has(y.id)),c=o?o.map(y=>e.graph.getNode(y)).filter(y=>y!==void 0):m,g=je(c,y=>e.schema.tryDefinition(y));return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":t.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)(na,{children:(0,S.jsxs)("select",{name:t.name,required:!t.optional,value:typeof n=="string"?n:"",onChange:y=>a(y.target.value||void 0),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),c.map(y=>{let P=g.get(y.id);return(0,S.jsxs)("option",{value:y.id,children:[ae(e.schema.tryDefinition(y.kind),y),P?` \xB7 ${P}`:""]},y.id)})]})})]})}case"group":{let o=n??{};return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":t.control,children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:l}),t.fields.map(u=>(0,S.jsx)(it,{store:e,spec:u,value:o[u.name],onChange:m=>a({...o,[u.name]:m}),prefilled:i,open:r,words:d},u.name))]})}case"variant":{let o=n??{},u=typeof o[t.tag]=="string"?o[t.tag]:"",m=t.options.find(c=>c.value===u);return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":t.control,children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:l}),(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"choice",children:[(0,S.jsx)("span",{"data-graview-part":"label",children:re(t.tag)}),(0,S.jsxs)("select",{value:u,onChange:c=>a({[t.tag]:c.target.value}),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),t.options.map(c=>(0,S.jsx)("option",{value:c.value,children:re(c.value)},c.value))]})]}),m?.fields.map(c=>(0,S.jsx)(it,{store:e,spec:c,value:o[c.name],onChange:g=>a({...o,[c.name]:g}),prefilled:i,open:r,words:d},c.name))]})}case"list":{let o=Array.isArray(n)?n:[];return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":"list",children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:l}),o.map((u,m)=>(0,S.jsxs)("div",{"data-graview-part":"item",children:[(0,S.jsx)("div",{style:{flex:1},children:(0,S.jsx)(it,{store:e,spec:{...t.item,optional:!1},value:u,onChange:c=>a(o.map((g,y)=>y===m?c:g)),prefilled:i,open:r,words:d})}),(0,S.jsx)("button",{type:"button","data-graview-part":"remove",onClick:()=>a(o.filter((c,g)=>g!==m)),children:"remove"})]},m)),(0,S.jsx)("button",{type:"button","data-graview-part":"add",onClick:()=>a([...o,void 0]),children:"add another"})]})}case"opaque":return(0,S.jsxs)("p",{"data-graview-part":"unasked",children:["\u201C",re(t.name),"\u201D needs a structured answer this form cannot ask for yet."]})}}function ye({store:e,mutation:t,prefilled:n={},open:a=[],onDone:i,principal:r,initial:d,label:s,only:l}){let[o,u]=(0,Lt.useState)(()=>({...d})),[m,c]=(0,Lt.useState)(null),g=Je(t.input).filter(P=>l===void 0||l.includes(P.name)),y=P=>nn(e.schema,t,P);return(0,S.jsxs)("form",{"data-testid":`form-${t.name}`,onSubmit:P=>{P.preventDefault();try{e.apply({name:t.name,args:{...yn(g,o),...n}},r?{author:r}:{}),c(null),u({}),i?.()}catch(F){c(_e(e.schema,e.allMutations(),F))}},"data-graview-part":"form",children:[(0,S.jsx)("style",{children:$a}),g.map(P=>(0,S.jsx)(it,{store:e,spec:P,value:o[P.name],onChange:F=>u(C=>({...C,[P.name]:F})),prefilled:n,open:a,words:y},P.name)),m?(0,S.jsx)("p",{"data-testid":"refused","data-graview-part":"refused",role:"alert",children:m}):null,(0,S.jsx)("button",{type:"submit","data-graview-part":"submit",children:s??t.title??t.name})]})}var b=O(z(),1);function ce(e){let t=e.views;if(!t)return[];let n=new Set(Pe(e.store,e.principal));return t.places().filter(a=>n.has(a.kind))}var Ae=e=>`place:${e.kind}:${e.as}`;function ge(e,t){let n=(e.views?.places()??[]).some(a=>a.as===t.as&&a.kind!==t.kind);return Vn(t.as,n?G(e.store.schema,t.kind):void 0)}function Ke(e,t){let n=e.schema.tryDefinition(t);return e.graph.nodesOfKind(t).filter(a=>$e(n,a))}function Tt(e,t,n){let a=(r,d)=>Qt(e.schema,d,r),i=a(Ke(e,t).length,t);return n?`${i} across ${a(Ke(e,n).length,n)}`:i}function Mt({context:e,place:t,chosen:n}){let{store:a,views:i,invariantContext:r}=e,s=i?.resolve(t.kind,{cardinality:"many",fidelity:"full"},t.as)?.view;if(!s)return null;let l=Ke(a,t.kind),o=[...new Set(a.violations(r).flatMap(u=>u.nodeIds))];return(0,b.jsx)(St,{kind:t.kind,view:t.title,children:(0,b.jsx)(s,{nodes:l,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...o.length>0?{flagged:o}:{}})})}function Oa({store:e,views:t,as:n,invariantContext:a}){V(e);let i={store:e,views:t,...a?{invariantContext:a}:{}},r=t.places().find(d=>d.as===n);return r?(0,b.jsx)(Mt,{context:i,place:r}):null}function Fa({context:e,kind:t}){let{store:n,views:a,invariantContext:i}=e,r=Ke(n,t),d=n.schema.tryDefinition(t),s=I(n,t),o=a?.resolve(t,{cardinality:"many",fidelity:"full"})?.view,u=[...new Set(n.violations(i).flatMap(y=>y.nodeIds))];if(o&&!Ee(o))return(0,b.jsx)(St,{kind:t,children:(0,b.jsx)(o,{nodes:r,label:s,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...u.length>0?{flagged:u}:{}})});let m=a?.resolve(t,{cardinality:"one",fidelity:"summary"})?.view,c=8,g=r.slice(0,c);return(0,b.jsxs)("div",{"data-testid":"kind-sheet",style:m?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gridAutoRows:"max-content",alignContent:"center",gap:12,padding:24}:{display:"flex",flexWrap:"wrap",alignContent:"center",justifyContent:"center",gap:10,padding:24},children:[g.map(y=>m?(0,b.jsx)(m,{node:y,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...u.includes(y.id)?{flagged:[y.id]}:{}},y.id):(0,b.jsx)("span",{style:{fontSize:"1.0625rem",padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:ae(d,y)},y.id)),r.length>c?(0,b.jsxs)("span",{style:{...k,alignSelf:"center",padding:"0 6px"},children:["+",r.length-c," more ",s.toLowerCase()]}):null]})}function $t(e){let{store:t}=e,n=jn(e),a=[...ce(e)].sort((r,d)=>n.indexOf(r.kind)-n.indexOf(d.kind)),i=new Set(a.map(r=>r.kind));return[...a.map(r=>({key:Ae(r),kind:r.kind,title:r.title,to:ge(e,r),place:r})),...at(e).filter(r=>!i.has(r)).map(r=>({key:`kind:${r}`,kind:r,title:I(t,r),to:`/${G(t.schema,r)}`}))]}var aa=.72,Na=540,ra=16/10;function Wa(e){let t=(0,Le.useRef)(null),[n,a]=(0,Le.useState)(e);return(0,Le.useLayoutEffect)(()=>{let i=t.current;if(!i||typeof ResizeObserver>"u")return;let r=()=>{let s=i.getBoundingClientRect().width;s>0&&a(l=>Math.abs(l-s)<.5?l:s)};r();let d=new ResizeObserver(r);return d.observe(i),()=>d.disconnect()},[]),{ref:t,width:n}}function Et({context:e,entry:t}){let{store:n,brand:a,principal:i}=e,{ref:r,width:d}=Wa(Na),s=d/aa,l=Ke(n,t.kind),o=n.schema.tryDefinition(t.kind),u=l.length===0?Ce(n,t.kind,{...i?{principal:i}:{},...e.invariantContext?{context:e.invariantContext}:{}}).actions.affordances[0]:void 0,m=t.place!==void 0;return(0,b.jsxs)(A,{to:t.to,"data-testid":m?"place-card":"kind-card",className:"graview-gallery-card",style:{...J,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,b.jsxs)("span",{ref:r,"data-testid":m?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${ra}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,b.jsx)("span",{style:{position:"absolute",left:0,top:0,width:s,height:s/ra,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${aa})`,transformOrigin:"0 0"},children:t.place?(0,b.jsx)(Mt,{context:e,place:t.place}):(0,b.jsx)(Fa,{context:e,kind:t.kind})}),l.length===0?(0,b.jsx)("span",{"data-testid":"picture-empty",style:{position:"absolute",inset:0,display:"grid",placeContent:"center",justifyItems:"center",gap:2,padding:20,textAlign:"center"},children:(0,b.jsxs)("span",{style:{display:"grid",gap:2,padding:"10px 16px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:[(0,b.jsxs)("span",{style:{fontFamily:xe,fontWeight:600,fontSize:"1.0625rem"},children:["No ",I(n,t.kind).toLowerCase()," yet"]}),u?(0,b.jsxs)("span",{style:k,children:["Begin with \u201C",u.label,"\u201D"]}):null]})}):null]}),(0,b.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,b.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[m?null:(0,b.jsx)(ee,{kind:t.kind,brand:a,schema:n.schema,size:8}),(0,b.jsx)("span",{style:{fontFamily:xe,fontSize:"1.25rem",fontWeight:600,lineHeight:1.3,overflowWrap:"anywhere"},children:t.title})]}),(0,b.jsxs)("span",{style:k,children:[t.place?Tt(n,t.place.kind,t.place.across):Tt(n,t.kind),!m&&o?.description?` \xB7 ${o.description}`:null]})]})]})}var ia={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},Da=`
|
|
104
|
+
.graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
|
|
105
|
+
.graview-gallery-card:hover > span:first-child,
|
|
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 Ot({context:e}){V(e.store);let t=$t(e);return t.length===0?null:(0,b.jsxs)("section",{style:ia,"data-testid":"gallery",children:[(0,b.jsx)("style",{children:Da}),t.map(n=>(0,b.jsx)(Et,{context:e,entry:n},n.key))]})}function Ft({context:e}){let{store:t}=e;V(t);let n=ce(e),a=$t(e);return(0,b.jsxs)(U,{context:e,style:Fe,children:[(0,b.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,b.jsx)("p",{style:se,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,b.jsx)(Y,{context:e,children:"Pictures"}),(0,b.jsx)("p",{style:_,children:n.length===0?"Nothing here has a picture of its own yet, so each kind is drawn as the scene draws it. Title a group view and it appears here by name.":"The ways this installation looks at what it holds \u2014 each one the same picture the scene shows, here as a page."})]}),a.length>0?(0,b.jsx)("div",{style:ia,"data-testid":"places",children:a.map(i=>(0,b.jsx)(Et,{context:e,entry:i},i.key))}):null]})}function Nt({context:e}){let{store:t,principal:n}=e;V(t);let a=ke(),i=he(),[r]=Ne(),d=decodeURIComponent(a.as??""),[s,l]=(0,Le.useState)(null),o=r.get("of"),m=ce(e).find(P=>P.as===d&&(!o||G(t.schema,P.kind)===o));if(!m)return(0,b.jsxs)(U,{context:e,children:[(0,b.jsx)(Y,{context:e,children:"No picture is called that."}),(0,b.jsx)("p",{style:_,children:(0,b.jsx)(A,{to:"/places",style:$,children:"The pictures there are \u2192"})})]});let c=I(t,m.kind),y=Ce(t,m.kind,{...n?{principal:n}:{},...e.invariantContext?{context:e.invariantContext}:{}}).actions.affordances.map(P=>({affordance:P,mutation:t.allMutations().find(F=>F.name===P.mutation)})).filter(P=>P.mutation!==void 0);return(0,b.jsxs)(U,{context:e,style:Fe,children:[(0,b.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,b.jsx)(Y,{context:e,children:m.title}),(0,b.jsxs)("p",{style:_,"data-testid":"place-lede",children:[Tt(t,m.kind,m.across),"."]}),(0,b.jsx)("p",{style:{...k,margin:0},children:(0,b.jsxs)(A,{to:`/${G(t.schema,m.kind)}`,style:{...$,...k},"data-testid":"place-as-list",children:["All ",c.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:P=>{let F=P.target?.closest("[data-graview-pick]"),C=F?.getAttribute("data-graview-pick"),K=F?.getAttribute("data-graview-joins");if(K)try{let X=JSON.parse(K);if(Array.isArray(X)&&X.every(we=>typeof we=="string")){P.preventDefault(),l({at:Ae(m),ids:X});return}}catch{}if(!C)return;let ue=t.graph.getNode(C);ue&&(P.preventDefault(),i(q(t.schema,ue.kind,C)))},children:(0,b.jsx)(Mt,{context:e,place:m,...s?.at===Ae(m)?{chosen:s.ids}:{}})}),(0,b.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},children:y.map(({affordance:P,mutation:F})=>(0,b.jsxs)("section",{style:{...j,display:"grid",gap:14},children:[(0,b.jsx)("h2",{style:D,children:F.title??F.name}),F.description?(0,b.jsx)("p",{style:{...k,margin:0,maxWidth:"58ch"},children:F.description}):null,(0,b.jsx)(ye,{store:t,mutation:F,prefilled:P.args,open:P.open,label:P.label,...n?{principal:n}:{}})]},P.id))})]})}var N=O(ve(),1);var Te=O(ve(),1);function oa(e,t,n){let a=Math.max(0,e.left),i=Math.min(t.width,e.right),r=Math.max(0,e.top),d=Math.min(t.height,e.bottom);return{shown:d-r>=n.height+2*16&&i-a>=n.width+2*16,left:Math.round(a),top:Math.round(r),width:Math.round(Math.max(0,i-a)),height:Math.round(Math.max(0,d-r))}}function sa(e,t,n){let a=e.style;a.left=`${t.left}px`,a.top=`${t.top}px`,a.right="auto",a.bottom="auto",a.visibility=n?"":"hidden";let i=e.getBoundingClientRect();i.width!==0&&(a.left=`${Math.round(2*t.left-i.left)}px`,a.top=`${Math.round(2*t.top-i.top)}px`)}var Se=O(z(),1);function la({context:e}){let t=he(),n=oe(),{pathname:a}=de(),[,i,r]=a.split("/"),d=i==="places"&&r?decodeURIComponent(r):void 0,s=(0,Te.useRef)(null);return Ka(s,n!==null),n?(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(Ha,{context:e}),(0,Se.jsx)("div",{ref:s,"data-testid":"page-seat",style:{position:"fixed",left:0,top:0,width:"100vw",height:"100dvh",pointerEvents:"none",zIndex:gn("rail"),containerType:"size"},children:(0,Se.jsx)(Hn,{onPick:l=>{let o=e.store.graph.getNode(l);o&&t(q(e.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")){e.overview?e.overview("#"):e.embedded||window.location.assign(e.sceneHref??"/");return}t(l.address)},...d?{place:d}:{},onDraft:()=>{a!=="/~draft"&&t("/~draft")}})})]}):null}var Ia={width:160,height:40};function Ka(e,t){let{pathname:n}=de();(0,Te.useLayoutEffect)(()=>{let a=e.current;if(!a)return;let i=a.parentElement?.closest("[data-embed-content]")??null,r=()=>i??document.querySelector("main")??null,d=()=>{let u=r(),m={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},c=u?.getBoundingClientRect()??{left:0,top:0,right:m.width,bottom:m.height},g=oa(i?c:{left:c.left,right:c.right,top:c.top,bottom:Math.max(c.bottom,m.height)},m,Ia);a.style.width=`${g.width}px`,a.style.height=`${g.height}px`,sa(a,g,g.shown)};d(),addEventListener("resize",d),addEventListener("scroll",d,!0);let s=0,l=typeof ResizeObserver=="function"?new ResizeObserver(()=>{cancelAnimationFrame(s),s=requestAnimationFrame(d)}):null,o=r();return o&&l?.observe(o),()=>{cancelAnimationFrame(s),l?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0)}},[e,t,n])}function Ha({context:e}){let{store:t}=e,n=oe(),{pathname:a}=de(),i=(0,Te.useRef)(n?.setSelection);return i.current=n?.setSelection,(0,Te.useEffect)(()=>{let r=i.current;if(!r)return;let[,d,s]=a.split("/"),l=(()=>{if(d==="places"){let u=e.views?.places().find(m=>m.as===decodeURIComponent(s??""));return u?[Ie(u.kind)]:[]}let o=d?fe(t.schema,d):void 0;return o&&s?[decodeURIComponent(s)]:o?[hn(o)]:[]})();r(o=>o.length===l.length&&o.every((u,m)=>u===l[m])?o:l)},[a]),null}var te=O(ve(),1);var pa=O(Ma(),1);var Q=O(z(),1);var za=(0,te.lazy)(fn(()=>import("./chunk.ZQZ557VR.js").then(e=>({default:e.TakeBack}))));function Ba({context:e,docked:t,at:n}){let{store:a}=e,i=V(a),[r]=(0,te.useState)(()=>a.batches().length),d=(0,te.useRef)(!1);return d.current||=i>0||!t&&r>0,d.current?(0,Q.jsx)(te.Suspense,{fallback:null,children:(0,Q.jsx)(za,{context:e,docked:t,at:n,since:r})}):null}function Ga(e,t,n){let{store:a,principal:i,embedded:r}=e;(0,te.useEffect)(()=>{if(!n)return;let d=s=>{if(!qn(s))return;let l=s.target,o=l instanceof Node&&t.current?.contains(l),u=l===document.body||l===document.documentElement||l===document;if(!(!o&&!(u&&!r))&&Bn(a,i)){s.preventDefault();try{Gn(a,i)}catch{}}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[a,i,r,t,n])}function ca({context:e,registry:t,root:n,children:a}){let i=(0,te.useMemo)(Xn,[]),r=t?.without()??new Set;return Ga(e,n,!r.has("undo")),(0,Q.jsxs)(Ct.Provider,{value:i,children:[(0,Q.jsx)(qa,{context:e,placed:i,without:r}),a]})}function qa({context:e,placed:t,without:n}){let[a,i]=(0,te.useState)(!1);(0,te.useLayoutEffect)(()=>i(!0),[]);let r=Rt(t,"find"),d=Rt(t,"undo"),s=de(),l=Ln();if(!a)return null;let o=s.pathname.split("/").filter(Boolean),m=(o.length===1?fe(e.store.schema,o[0]):void 0)!==void 0;return(0,Q.jsxs)(Q.Fragment,{children:[!r&&!n.has("find")&&l?(0,pa.createPortal)((0,Q.jsx)(da,{context:e,narrowsLists:m}),l.slot):null,!r&&!n.has("find")&&!l?(0,Q.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,Q.jsx)(da,{context:e,narrowsLists:m})}):null,!d&&!n.has("undo")?(0,Q.jsx)(Ba,{context:e,docked:!0,at:s.pathname+s.search}):null,l?.own&&!n.has("undo")?(0,Q.jsx)(_n,{context:e,own:l.own}):null]})}function da({context:e,narrowsLists:t}){return(0,Q.jsx)(Ct.Provider,{value:null,children:(0,Q.jsx)(At,{context:e,narrowsLists:t})})}var T=O(z(),1);function ga(e,t){return t==="*"?{label:"anything",path:null}:{label:I(e,t),path:`/${G(e.schema,t)}`}}function Va({context:e,relation:t}){let{store:n}=e,a=ga(n,t.from),i=ga(n,t.to),r=d=>d.path?(0,T.jsx)(A,{to:d.path,style:{...J,fontWeight:550},children:d.label}):(0,T.jsx)("span",{children:d.label});return(0,T.jsxs)("li",{"data-testid":"relation","data-relation":t.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,T.jsx)(zn,{edgeKind:t.edgeKind,...e.brand?.kit?{kit:e.brand.kit}:{}}),(0,T.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,T.jsxs)("span",{children:[r(a)," ",(0,T.jsxs)("span",{style:k,"data-graview-speaks-ids":"",children:[re(t.edgeKind)," \u2192"]})," ",r(i)]}),t.description||t.inverse?(0,T.jsxs)("span",{style:{...k,fontSize:"0.9375rem"},children:[t.description?le(t.description):null,t.description&&t.inverse?" \xB7 ":null,t.inverse?`from the other end, ${t.inverse}`:null]}):null]}),i.path?(0,T.jsx)(A,{to:`${i.path}?with=${encodeURIComponent(t.edgeKind)}`,style:{...$,...k,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${i.label.toLowerCase()} that have this`,children:t.count}):(0,T.jsx)("span",{style:{...k,fontVariantNumeric:"tabular-nums"},children:t.count})]})}function ua({context:e,heading:t=!0}){let{store:n}=e,a=new Set(Pe(n,e.principal)),i=Re(n).relations.filter(r=>a.has(r.from)&&(r.to==="*"||a.has(r.to)));return i.length===0?null:(0,T.jsxs)("section",{style:{...j,display:"grid",gap:12},"data-testid":"kind-map",children:[t?(0,T.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,T.jsx)("h2",{style:D,children:(0,T.jsx)(A,{to:"/map",style:J,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(r=>(0,T.jsx)(Va,{context:e,relation:r},`${r.edgeKind}|${r.from}|${r.to}`))})]})}function Wt({context:e}){let{store:t}=e;V(t);let n=new Set(Pe(t,e.principal)),a=Re(t),i=a.relations.filter(r=>n.has(r.from));return(0,T.jsxs)(U,{context:e,children:[(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)("p",{style:se,children:i.length===0?"No relations":`${i.length} ${i.length===1?"relation":"relations"}`}),(0,T.jsx)(Y,{context:e,children:"Connections"}),(0,T.jsx)("p",{style:_,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:a.kinds.filter(r=>n.has(r.kind)).map(r=>(0,T.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,T.jsx)(ee,{kind:r.kind,brand:e.brand,schema:t.schema,size:7}),(0,T.jsx)(A,{to:`/${G(t.schema,r.kind)}`,style:$,children:r.plural}),(0,T.jsx)("span",{style:k,children:r.count})]},r.kind))}),(0,T.jsx)(ua,{context:e,heading:!1})]})}function ma({context:e}){let n=[...oe()?.robots.values()??[]].filter(i=>i.mode==="asking"&&i.say);if(n.length===0)return null;let{store:a}=e;return(0,T.jsxs)("section",{style:{...j,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 r=i.at?a.graph.getNode(i.at):void 0;return(0,T.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,T.jsx)("span",{children:i.say}),r?(0,T.jsxs)(A,{to:q(a.schema,r.kind,r.id),style:{...$,...k},children:[ae(a.schema.tryDefinition(r.kind),r)," \u2192"]}):null]},i.participant)})})]})}var E=O(z(),1);function Dt({context:e}){let{principal:t}=e,{store:n,brand:a,invariantContext:i}=e;V(n);let r=n.violations(i),d=`${r.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=at(e).map(C=>({kind:C,members:n.graph.nodesOfKind(C).filter(K=>$e(n.schema.tryDefinition(C),K))})),u=o.filter(C=>C.members.length>0),m=o.map(C=>({entry:C,creator:n.allMutations().find(K=>(K.creates??[]).includes(C.kind)&&n.permits({name:K.name,args:{}},e.principal).ok)})).find(C=>C.creator!==void 0),c=u.length===0?"Nothing here yet.":`${u.map(C=>`${C.members.length} ${C.members.length===1?C.kind:I(n,C.kind).toLowerCase()}`).join(", ").replace(/, ([^,]*)$/," and $1")}.`,g=e.views?.homeView?.(),y=n.schema.kinds.some(C=>n.graph.nodesOfKind(C).length>0);if(g&&y){let C=a?.subtitle?(0,E.jsx)("p",{style:{...k,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,K=g[Symbol.for("graview.home-blocks")]===!0;return(0,E.jsx)(U,{context:e,style:Fe,children:(0,E.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[K?null:C,r.length>0?(0,E.jsx)(A,{to:"/problems",style:{...$,color:"var(--graview-warn)"},children:d}):null,(0,E.jsx)(In.Provider,{value:K?C:null,children:(0,E.jsx)(g,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})]})})}let P=new Set(Pe(n,e.principal)),F=Re(n).relations.filter(C=>P.has(C.from)&&(C.to==="*"||P.has(C.to)));return(0,E.jsxs)(U,{context:e,style:Fe,children:[(0,E.jsxs)("header",{style:{display:"grid",gap:12},children:[a?.subtitle?(0,E.jsx)("p",{style:{...k,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,(0,E.jsx)(Y,{context:e,"data-testid":"standing",children:c}),(0,E.jsxs)("p",{style:{..._,display:"grid",gap:4},"data-testid":"standing-card",children:[u.length===0&&m?(0,E.jsxs)("span",{children:["Begin with \u201C",m.creator?.title??m.creator?.name,"\u201D, under"," ",(0,E.jsx)(A,{to:`/${G(n.schema,m.entry.kind)}`,style:$,children:I(n,m.entry.kind)}),"."]}):null,r.length===0?(0,E.jsx)("span",{children:"All rules hold."}):(0,E.jsx)(A,{to:"/problems",style:{...$,color:"var(--graview-warn)"},children:d})]})]}),(0,E.jsx)(Ot,{context:e}),(0,E.jsxs)("section",{style:{...j,display:"grid",gap:14},"data-testid":"kinds",children:[(0,E.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,E.jsx)("h2",{style:D,children:"What is here"}),F.length>0?(0,E.jsxs)(A,{to:"/map",style:{...$,...k,marginLeft:"auto"},"data-testid":"map-link",children:["Connections \xB7 ",F.length===1?"1 relation":`${F.length} relations`," \u2192"]}):null]}),(0,E.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:o.map(({kind:C,members:K})=>(0,E.jsx)("li",{children:(0,E.jsxs)(A,{to:`/${G(n.schema,C)}`,style:{...J,gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,E.jsx)(ee,{kind:C,brand:a,schema:n.schema,size:7}),(0,E.jsx)("span",{style:{fontWeight:550},children:I(n,C)}),(0,E.jsx)("span",{style:{...k,fontVariantNumeric:"tabular-nums"},children:K.length===0?"none yet":K.length})]})},C))})]}),s.length>0?(0,E.jsxs)("section",{style:{...j,display:"grid",gap:10},children:[(0,E.jsx)("h2",{style:D,children:"Recently"}),(0,E.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:s.map(C=>(0,E.jsxs)("li",{style:k,children:[(0,E.jsx)("span",{style:{color:"var(--graview-ink)"},children:C.intent})," \u2014 ",tt(C,t,{graph:n.graph,schema:n.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},C.id))})]}):null]})}var Me=O(ve(),1);var R=O(z(),1);function It({context:e}){let{store:t,brand:n,principal:a,invariantContext:i}=e;V(t);let[r]=Ne(),d=r.get("q")??"",s=typeof i?.today=="string"?i.today:void 0,l=cn(t,d,{...a?{principal:a}:{},places:ce(e),flagged:new Set(t.violations(i).flatMap(g=>g.nodeIds)),...s?{today:s}:{},limit:200}),o=l.hits.filter(g=>g.about==="node"),u=l.hits.filter(g=>g.about==="kind"||g.about==="place"||g.about==="rule"),m=[...new Set(o.map(g=>g.kind))],c=d.trim();return(0,R.jsxs)(U,{context:e,children:[(0,R.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,R.jsx)("p",{style:se,children:"Search"}),(0,R.jsx)(Y,{context:e,"data-testid":"search-heading",children:c.length===0?"Find anything by its name":l.hits.length===0?(0,R.jsxs)(R.Fragment,{children:["Nothing here is called \u201C",c,"\u201D."]}):(0,R.jsxs)(R.Fragment,{children:[Ua(t,l.byKind)," for \u201C",c,"\u201D"]})}),c.length>0?(0,R.jsxs)("p",{style:{...k,margin:0},"data-testid":"search-searched",children:[Ye(t.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(y=>I(t,y).toLowerCase()).join(" and "),"."]},`${g.key}:${g.value}`))]}):(0,R.jsxs)("p",{style:_,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."]})]}),u.length>0?(0,R.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:u.map(g=>(0,R.jsx)("li",{"data-testid":"search-hit","data-about":g.about,children:g.about==="kind"?(0,R.jsxs)(A,{to:`/${G(t.schema,g.kind)}`,style:$,children:[g.label,g.count>0?(0,R.jsxs)("span",{style:k,children:[" \xB7 ",g.count," match"]}):null]}):g.about==="place"?(0,R.jsxs)(A,{to:ge(e,g),style:$,children:["Go to ",g.title]}):g.about==="rule"?(0,R.jsxs)(A,{to:"/problems",style:$,children:["The rule \u201C",g.label,"\u201D"]}):null},`${g.about}:${g.about==="rule"?g.name:g.about==="place"?g.as:g.kind}`))}):null,m.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:t.schema,size:8}),(0,R.jsx)(A,{to:`/${G(t.schema,g)}?${new URLSearchParams({q:c}).toString()}`,style:$,"data-testid":"search-kind-link",children:I(t,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(y=>y.kind===g).map(y=>(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)(A,{to:q(t.schema,g,y.id),style:{...J,fontFamily:xe,fontSize:"1.1875rem",fontWeight:600,lineHeight:1.3,overflowWrap:"anywhere"},children:[y.flagged?(0,R.jsx)("span",{style:{color:"var(--graview-warn)"},children:"\u26A0 "}):null,y.label,y.apart?(0,R.jsxs)("span",{style:k,children:[" \xB7 ",y.apart]}):null,y.current?null:(0,R.jsx)("span",{style:k,children:" \xB7 past"})]}),(0,R.jsx)(ot,{why:y.why})]},y.id))})]},g)),c.length>0?(0,R.jsx)(ja,{asked:c}):null,c.length>0&&l.hits.length===0?(0,R.jsx)(fa,{store:t,kinds:l.searched.kinds,words:l.words,...a?{principal:a}:{},...i?{invariantContext:i}:{}}):null]})}function ot({why:e}){return e.field==="label"?null:(0,R.jsxs)("span",{style:k,"data-testid":"search-why",children:[e.reading,": ",e.fragment]})}function Ua(e,t){let n=Object.entries(t).map(([a,i])=>`${i} ${i===1?be(e.schema.tryDefinition(a),a):I(e,a).toLowerCase()}`);return n.length===0?"Found":n.length===1?le(n[0]):le(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function ya(e,t,n={}){let a=[];for(let i of t){let r=Ce(e,i,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let d of st(e,i,r.actions.affordances))a.some(s=>s.mutation.name===d.mutation.name)||a.push(d)}return a}function st(e,t,n){let a=e.schema.tryDefinition(t)?.fieldRoles?.label,i=[];for(let r of n){let d=e.allMutations().find(o=>o.name===r.mutation);if(!d||!d.creates?.includes(t)||i.some(o=>o.mutation.name===d.name))continue;let s=Je(d.input).map(o=>o.name),l=s.includes("label")?"label":a&&s.includes(a)?a:void 0;!l||r.args[l]!==void 0||i.push({kind:t,affordance:r,mutation:d,arg:l})}return i}function fa({store:e,kinds:t,words:n,principal:a,invariantContext:i}){let r=ya(e,t,{...a?{principal:a}:{},...i?{invariantContext:i}:{}});return r.length===0||n.trim().length===0?null:(0,R.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:r.map(({kind:d,affordance:s,mutation:l,arg:o})=>(0,R.jsxs)("section",{style:{...j,display:"grid",gap:14},children:[(0,R.jsxs)("h2",{style:D,children:[le(Zt(be(e.schema.tryDefinition(d),d)))," called \u201C",n,"\u201D"]}),(0,R.jsx)(ye,{store:e,mutation:l,prefilled:s.args,open:s.open,initial:{[o]:n},...a?{principal:a}:{}})]},`${s.id}|${n}`))})}function ja({asked:e}){let t=oe();return t?(0,R.jsx)(_a,{asked:e,talk:t.seatTalk}):null}function _a({asked:e,talk:t}){let{drawn:n}=wn(t);return n===0?null:(0,R.jsx)("p",{style:{margin:0},children:(0,R.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:()=>t.ask(e),style:{...$,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",e,"\u2019"]})})}var h=O(z(),1),ha=8,wa=40;function Kt({context:e}){let t=ke(),n=fe(e.store.schema,t.slug??"");return n?(0,h.jsx)(va,{context:e,kind:n}):(0,h.jsx)(U,{context:e,children:(0,h.jsx)(Y,{context:e,children:"No such kind of thing here."})})}function va({context:e,kind:t,opening:n,row:a,layout:i="list",description:r,bare:d}){let{store:s,brand:l,invariantContext:o}=e;V(s);let[u,m]=Ne(),c=s.schema.tryDefinition(t),g=s.graph.nodesOfKind(t),y=Re(s).relations.filter(p=>p.from===t||p.to===t),P=new Set(s.violations(o).flatMap(p=>p.nodeIds)),F=sn(s.schema,t),C=y.map(p=>p.edgeKind),K=Qa(u,F,C),ue=["sort","filter","group","q","by","with","past",...C].some(p=>u.has(p)),X=g.length>=wa,we=c?.fieldRoles?.when,W=ue?K.arrangement:kt(n??Ja(X,we),F).arrangement,ne=dn(W.query??""),f=[...W.filter??[],...ne.conditions].some(p=>p.key==="is"&&(p.value==="past"||p.value==="any"))||on(c,[...W.filter??[],...ne.conditions]),L=f||!c?.lifecycle?W:{...W,filter:[...W.filter??[],{key:"is",value:"current"}]},Z=$n(g,L,{schema:s.schema,graph:s.graph,flagged:P,...typeof o?.today=="string"?{today:o.today}:{}}),B=Z.nodes,ze=c?.lifecycle&&!f?g.filter(p=>$e(c,p)):g,Bt=g.length-ze.length,Gt=W.group?.by??null,ba=p=>{let x=new URLSearchParams(u);for(let ie of["sort","filter","group","q","by","with","past",...y.map(Ue=>Ue.edgeKind)])x.delete(ie);let H=Mn(p);for(let ie of["sort","filter","group","q"])H[ie]&&x.set(ie,H[ie]);![...x.keys()].some(ie=>["sort","filter","group","q"].includes(ie))&&(n||X||we)&&x.set("sort",""),m(x)},{principal:qt}=e,ct=Ce(s,t,{...qt?{principal:qt}:{},...e.invariantContext?{context:e.invariantContext}:{}}),We=ct.actions.affordances.map(p=>({affordance:p,mutation:s.allMutations().find(x=>x.name===p.mutation)})).filter(p=>p.mutation!==void 0),Vt=ct.actions.withheld,Ut=ne.words&&B.length===0?Object.fromEntries(st(s,t,ct.actions.affordances).map(p=>[p.mutation.name,p.arg])):{},gt=I(s,t),Be=e.views?.lookup(t,{cardinality:"one",fidelity:"glyph"}),jt=Be!==void 0&&!Ee(Be)?Be:void 0,ut=p=>{let x=ae(c,p);if(a){let De=c?.computed?Oe(s.schema,s.graph,p):p;return(0,h.jsx)("li",{"data-testid":"record-row",style:{minWidth:0},children:a(p,{label:x,href:q(s.schema,t,p.id),flagged:P.has(p.id),glance:nt(De,c,x)})},p.id)}if(jt){let De=Xe(Be,p,s.graph),Aa=c?.computed?Oe(s.schema,s.graph,p):p,La=Object.fromEntries(Object.entries(Aa).filter(([Ta])=>!De?.fields.has(Ta))),Yt=De?nt(La,c,De.title??x):"";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,...P.has(p.id)?{flagged:[p.id]}:{}})}),Yt?(0,h.jsx)("span",{style:{...k,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:Yt}):null,(0,h.jsx)(A,{to:q(s.schema,t,p.id),"aria-label":P.has(p.id)?`${x} \u2014 implicated in a problem`:x,style:{position:"absolute",inset:0,borderRadius:6}})]},p.id)}let H=c?.computed?Oe(s.schema,s.graph,p):p,ie=nt(H,c,x),Ue=ne.words?pn(c,p,ne.words):void 0;return(0,h.jsxs)("li",{style:X?{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:0,padding:"5px 0",borderTop:"1px solid var(--graview-edge)",overflowWrap:"anywhere"}:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:2,padding:"14px 0",borderTop:"1px solid var(--graview-edge)",overflowWrap:"anywhere"},children:[(0,h.jsxs)(A,{to:q(s.schema,t,p.id),style:X?{...J,flex:"1 1 14rem",minWidth:0,fontSize:"1rem",fontWeight:600,lineHeight:1.35}:{...J,fontFamily:xe,fontSize:"1.25rem",fontWeight:600,lineHeight:1.3},children:[P.has(p.id)?(0,h.jsx)("span",{style:{color:"var(--graview-warn)"},children:"\u26A0 "}):null,x]}),ie?(0,h.jsx)("span",{style:X?{...k,flex:"0 1 auto",minWidth:0,fontSize:"0.875rem"}:k,children:ie}):null,Ue?(0,h.jsx)(ot,{why:Ue}):null]},p.id)},mt=ce(e).filter(p=>p.kind===t),xa=(W.filter??[]).some(p=>p.key!=="is"||p.value!=="any"),Pa=!!(W.sort||W.group||W.query||xa),Ca=ze.length>=ha||ue&&Pa,me=W.sort?F.sorts.find(p=>p.key===W.sort.by):void 0,yt=me?.type==="date"||me!==void 0&&me.key===we,_t=X&&!Z.grouped&&me&&(me.about==="label"||me.type==="text"||yt)?p=>{let x=me.about==="label"?ae(c,p):p[me.key];if(typeof x!="string"||x.length===0)return yt?"No date":"#";if(yt)return x.slice(0,4);let H=x.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(H)?H:"#"}:void 0,Ge=_t?B.reduce((p,x)=>{let H=_t(x);return p.at(-1)?.key===H?p.at(-1).nodes.push(x):p.push({key:H,nodes:[x]}),p},[]):void 0,ft=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:a&&i==="list"?6:0},qe=p=>`list-at-${p.replace(/[^\p{L}\p{N}]/gu,"_")}`,Ve=y.map(p=>{let x=p.from===t?p.to:p.from,H=p.from===t?p.description:p.inverse??p.description;return{relation:p,far:x,words:H}}),Ra=new Set(Ve.map(p=>(p.words??"").toLowerCase()).filter((p,x,H)=>p&&H.indexOf(p)!==x));return(0,h.jsxs)(d?Ya:U,{context:e,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:t,brand:l,schema:s.schema,size:8}),(0,h.jsx)(Y,{context:e,children:gt})]}),r??c?.description?(0,h.jsx)("p",{style:{..._,fontSize:"1.0625rem",lineHeight:1.4},children:r??c?.description}):null,Ve.length>0||mt.length>0?(0,h.jsxs)("p",{style:{...k,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[Ve.length>0?(0,h.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",Ve.map(({relation:p,far:x,words:H},ie)=>(0,h.jsxs)("span",{"data-relation":p.edgeKind,children:[ie>0?" \xB7 ":null,x==="*"?le(H??re(p.edgeKind)):(0,h.jsx)(A,{to:`/${G(s.schema,x)}`,style:$,title:I(s,x),children:H&&Ra.has(H.toLowerCase())?`${le(H)}: ${I(s,x).toLowerCase()}`:le(H??I(s,x))})]},`${p.edgeKind}|${p.from}|${p.to}`))]}):null,mt.length>0?(0,h.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",mt.map((p,x)=>(0,h.jsxs)("span",{children:[x>0?" \xB7 ":null,(0,h.jsx)(A,{to:ge(e,p),style:$,children:p.title})]},Ae(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 ",gt.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,ze.length>0?(0,h.jsx)(Fn,{schema:s.schema,graph:s.graph,kind:t,arrangement:W,onChange:ba,kept:{shown:B.length,of:ze.length},noun:{one:be(c,t),many:gt.toLowerCase()},...Ca?{}:{allow:!1},query:e.framed===!0&&e.barAbove!==!0}):null,B.length===0&&ne.words?(0,h.jsxs)("p",{style:{..._,fontSize:"1.0625rem"},"data-testid":"none-yet",children:["Nothing here is called \u201C",ne.words,"\u201D."," ",(0,h.jsx)("span",{style:k,"data-testid":"list-searched",children:Ye(s.schema,{kinds:[t],past:f})})," ",(0,h.jsx)(A,{to:"?",style:$,children:"Show every one"})]}):B.length===0?(0,h.jsxs)("p",{style:{..._,fontSize:"1.0625rem"},"data-testid":"none-yet",children:[W.filter?.length||W.query?"None of them.":"None yet",!W.filter?.length&&!W.query&&We.length>0?` \u2014 the first one starts below, with \u201C${We[0]?.mutation.title??We[0]?.mutation.name}\u201D.`:!W.filter?.length&&!W.query?".":"",W.filter?.length||W.query?(0,h.jsxs)(h.Fragment,{children:[" ",(0,h.jsx)(A,{to:"?",style:$,children:"Show every one"})]}):null]}):Z.grouped&&Gt?(0,h.jsx)("div",{style:{display:"grid",gap:18},"data-testid":"records","data-grouped":Gt,children:Z.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:ft,"data-graview-rows":"",children:p.nodes.map(ut)})]},p.key||"-"))}):Ge&&Ge.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:Ge.map(p=>(0,h.jsx)("a",{href:`#${qe(p.key)}`,onClick:x=>{x.preventDefault(),document.getElementById(qe(p.key))?.scrollIntoView({block:"start"})},style:{...$,flex:"0 0 auto",minWidth:24,justifyContent:"center",textDecoration:"none"},children:p.key},p.key))}),Ge.map(p=>(0,h.jsxs)("section",{"data-testid":"list-section","aria-labelledby":qe(p.key),style:{display:"grid",gap:0},children:[(0,h.jsx)("h2",{id:qe(p.key),style:{...D,fontSize:"0.9375rem",color:"var(--graview-ink-muted)",marginBottom:2,scrollMarginTop:64},children:p.key}),(0,h.jsx)("ul",{style:ft,"data-graview-rows":"",children:p.nodes.map(ut)})]},p.key))]}):(0,h.jsx)("ul",{style:ft,"data-testid":"records","data-graview-rows":"",children:B.map(ut)}),Bt>0?(0,h.jsxs)(A,{to:Xa(u,"filter","is:any"),style:{...$,...k,justifySelf:"start"},"data-testid":"past-link",children:["+",Bt," past"]}):null,We.length>0?(0,h.jsx)("div",{style:{display:"grid",gap:6},"data-testid":"beginnings",children:We.map(({affordance:p,mutation:x})=>{let H=!!(Ut[x.name]&&B.length===0);return(0,h.jsx)(Za,{name:x.name,title:x.title??x.name,description:x.description,open:B.length===0,children:(0,h.jsx)(ye,{store:s,mutation:x,prefilled:p.args,open:p.open,...H?{initial:{[Ut[x.name]]:ne.words}}:{},...e.principal?{principal:e.principal}:{}},H?`${x.name}|${ne.words}`:x.name)},p.id)})}):null]}),Vt.length>0?(0,h.jsx)("ul",{style:{...j,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},"data-testid":"withheld",children:Vt.map(p=>(0,h.jsxs)("li",{style:k,children:[(0,h.jsx)("s",{children:p.label})," \u2014 ",p.refusal.message]},p.id))}):null]})}function Ya({children:e}){return(0,h.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:e})}var Ja=(e,t)=>t?{sort:{by:t,direction:"desc"}}:e?{sort:{by:"label",direction:"asc"}}:{};function Qa(e,t,n){let a=ln({...e.get("sort")?{sort:e.get("sort")}:{},...e.get("filter")?{filter:e.get("filter")}:{},...e.get("group")?{group:e.get("group")}:{},...e.get("q")?{q:e.get("q")}:{}}),i=[...a.filter??[]],r=e.get("by"),d=a.group??(r?{by:r}:void 0);for(let l of n){let o=e.get(l);o&&i.push({key:l,value:o})}let s=e.get("with");return s&&i.push({key:s,value:"*"}),e.get("past")==="1"&&!i.some(l=>l.key==="is")&&i.push({key:"is",value:"any"}),kt({...a.sort?{sort:a.sort}:{},...a.query?{query:a.query}:{},...i.length>0?{filter:i}:{},...d?{group:d}:{}},t)}function Xa(e,t,n){let a=new URLSearchParams(e);return a.set(t,n),a.delete("past"),`?${a.toString()}`}function Za({name:e,title:t,description:n,open:a,children:i}){let[r,d]=(0,Me.useState)(a),s=(0,Me.useRef)(null),l=(0,Me.useRef)(null),o=`begin-${(0,Me.useId)().replace(/:/g,"")}`;return(0,h.jsxs)("div",{"data-testid":`act-${e}`,style:{display:"grid",gap:10},children:[(0,h.jsxs)("button",{ref:s,type:"button","data-testid":`act-open-${e}`,"aria-expanded":r,"aria-controls":o,onClick:()=>{d(!r),r||requestAnimationFrame(()=>l.current?.querySelector("input, select, textarea, button")?.focus())},style:{...J,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:r?"\u2212":"+"}),t]}),(0,h.jsxs)("div",{ref:l,id:o,hidden:!r,onKeyDown:u=>{u.key==="Escape"&&(u.preventDefault(),d(!1),s.current?.focus())},style:r?{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 pt=O(ve(),1);var He=O(ve(),1);var M=O(z(),1);function Ht({context:e}){let{store:t,brand:n,invariantContext:a,principal:i}=e;V(t);let r=t.violations(a),d=t.allInvariants(),s=Qe(t,r),l=Pn(t.schema,d);return(0,M.jsxs)(U,{context:e,children:[(0,M.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,M.jsx)(Y,{context:e,children:r.length===0?"All rules hold":"What is broken"}),(0,M.jsx)("p",{style:_,"data-testid":"problems-count",children:r.length===0?"Every declared rule is satisfied by what is here.":an(r)})]}),(0,M.jsx)(ma,{context:e}),s.map((o,u)=>{let m=o.nodeIds[0],c=m?t.graph.getNode(m):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)(lt,{violation:o,schema:t.schema,...n?{brand:n}:{}}),c?(0,M.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,M.jsx)(ee,{kind:c.kind,brand:n,schema:t.schema,size:7}),(0,M.jsx)(A,{to:q(t.schema,c.kind,c.id),style:$,children:ae(t.schema.tryDefinition(c.kind),c)})]}):null,o.line?(0,M.jsx)(lt,{violation:o,schema:t.schema,...n?{brand:n}:{}}):null,(0,M.jsx)(dt,{store:t,repairs:o.repairs,...i?{principal:i}:{}})]},u)}),d.length>0?(0,M.jsxs)("section",{style:{...j,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 u=r.filter(g=>g.invariant===o.name).length,m=l.get(o.name),c=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:[m?(0,M.jsx)(vt,{line:m,schema:t.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,M.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:c}),(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem",color:u>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:u===0?"holds":`broken in ${u} ${u===1?"place":"places"}`})]}),m&&c.trim().length>0?(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem"},children:c}):null]},o.name)})})]}):null]})}function lt({violation:e,schema:t,brand:n}){if(!e.line)return(0,M.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:e.message});let a=Rn(e);return(0,M.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",title:Cn(e),children:[(0,M.jsx)(vt,{line:e.line,schema:t,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)",fontSize:"1.0625rem"}}),a?(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem"},children:a}):null]})}function dt({store:e,repairs:t,principal:n}){let[a,i]=(0,He.useState)(null),[r,d]=(0,He.useState)(null),s=(0,He.useRef)([]);if(t.length===0)return null;let l=a===null?null:t[a],o=l&&(l.missing??[]).length>0?e.allMutations().find(u=>u.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:t.map((u,m)=>{let c=(u.missing??[]).length>0,g=e.permits({name:u.mutation,args:{...u.args}},n);return g.ok?(0,M.jsx)("button",{ref:y=>{s.current[m]=y},type:"button","data-graview-repair":u.mutation,"data-graview-asks":c||void 0,"aria-expanded":c?a===m:void 0,onClick:()=>{if(d(null),c){i(a===m?null:m);return}i(null);try{e.apply({name:u.mutation,args:{...u.args}},n?{author:n}:{})}catch(y){d(_e(e.schema,e.allMutations(),y))}},style:et,children:c?`${u.label} \u2026`:u.label},m):(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:u.label})," \u2014 ",g.refusal.message]},m)})}),o&&l?(0,M.jsx)(ye,{store:e,mutation:o,prefilled:{...l.args},only:l.missing??[],label:l.label,onDone:()=>{let u=a;i(null),requestAnimationFrame(()=>{let m=u===null?null:s.current[u];if(m?.isConnected){m.focus();return}let c=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");c&&(c.hasAttribute("tabindex")||(c.tabIndex=-1),c.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,r?(0,M.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:"0.875rem"},children:r}):null]})}var w=O(z(),1),er=[];function zt({context:e}){let{store:t,brand:n,principal:a,invariantContext:i}=e;V(t);let r=oe()!==null,d=ke(),s=decodeURIComponent(d.id??""),l=ea(t,s,{...a?{principal:a}:{},...i?{context:i}:{}}),o=Qe(t,l?.violations??er),[u,m]=(0,pt.useState)(null),c=(0,pt.useRef)(null);if(!l)return(0,w.jsx)(U,{context:e,children:(0,w.jsx)(Y,{context:e,children:"Nothing lives at this address."})});let g=t.graph.getNode(s),y=t.schema.tryDefinition(l.kind),P=y?.describe&&g?Jt(y,g):null,F=[...t.log.all()].filter(f=>!rn(f)&&(f.writes.includes(s)||f.reads.includes(s))).slice(-8).reverse(),C=l.actions.affordances.filter(f=>f.provider!=="invariant"),K=e.views?.lookup(l.kind,{cardinality:"one",fidelity:"full"}),ue=K!==void 0&&!Ee(K)?K:void 0,X=ue&&g?Xe(K,g,t.graph):void 0,we=X?l.fields.filter(f=>!X.fields.has(f.key)):l.fields,W=X?l.links.flatMap(f=>{let L=f.targets.filter(Z=>!X.records.has(Z.id));return L.length>0?[{...f,targets:L}]:[]}):l.links,ne=ue!==void 0&&bn(K);return(0,w.jsxs)(U,{context:e,children:[(0,w.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,w.jsxs)("p",{style:{...se,display:"flex",alignItems:"center",gap:8},children:[(0,w.jsx)(ee,{kind:l.kind,brand:n,schema:t.schema,size:8}),(0,w.jsx)(A,{to:`/${G(t.schema,l.kind)}`,style:J,children:I(t,l.kind)})]}),(0,w.jsx)(Y,{context:e,children:l.label}),P&&P!==l.label?(0,w.jsx)("p",{style:_,children:P}):null,(0,w.jsx)(Ze,{context:e,stop:`#focus=${encodeURIComponent(s)}`,style:{...$,...k},"data-testid":"spatial-link"}),ce(e).some(f=>f.kind===l.kind||f.across===l.kind)?(0,w.jsxs)("p",{style:{...k,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",ce(e).filter(f=>f.kind===l.kind||f.across===l.kind).map((f,L)=>(0,w.jsxs)("span",{children:[L>0?" \xB7 ":null,(0,w.jsx)(A,{to:ge(e,f),style:$,children:f.title})," ",(0,w.jsx)(Ze,{context:e,stop:`#view=${encodeURIComponent(f.as)}`,style:{...$,...k},title:`${f.title}, in the scene`,children:"\u2197"})]},Ae(f)))]}):null]}),ue&&g?(0,w.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,w.jsx)(Nn,{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((f,L)=>(0,w.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,w.jsx)(lt,{violation:f,schema:t.schema,...n?{brand:n}:{}}),(0,w.jsx)(dt,{store:t,repairs:ta(l.actions,f.repairs),...a?{principal:a}:{}})]},L))}):null,!ne&&we.length>0?(0,w.jsxs)("section",{style:{...j,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,w.jsx)("h2",{style:D,children:"The facts"}),tn(y,we).map((f,L)=>{let Z=(0,w.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:f.fields.map(B=>B.long?(0,w.jsx)(On,{nodeId:s,field:B.key,label:B.label,value:B.value,style:{gridColumn:"1 / -1",gap:4},labelStyle:{...se,fontSize:"0.75rem"},valueStyle:{fontSize:"1.0625rem",lineHeight:1.6}},B.key):(0,w.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,w.jsx)("dt",{style:{...se,fontSize:"0.75rem"},children:B.label}),(0,w.jsx)("dd",{style:{margin:0,fontSize:"1.125rem",overflowWrap:"anywhere",minWidth:0},children:r?(0,w.jsx)(En,{nodeId:s,field:B.key,value:B.value,stored:B.stored}):B.value})]},B.key))});return f.title?(0,w.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,w.jsx)("h3",{"data-graview-field-group":f.title,style:{...D,fontSize:"1.0625rem"},children:f.title}),Z]},L):(0,w.jsx)("div",{children:Z},L)})]}):null,(ne?[]:W).map(f=>(0,w.jsxs)("section",{style:{...j,display:"grid",gap:10},children:[(0,w.jsx)("p",{style:se,children:Un(t,f)}),f.description?(0,w.jsx)("h2",{style:D,children:le(f.description)}):(0,w.jsxs)("h2",{style:D,"aria-label":re(f.edgeKind),children:[f.direction==="in"?"\u2190 ":"\u2192 ",re(f.edgeKind)]}),(0,w.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:f.targets.map(L=>(0,w.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,w.jsx)(ee,{kind:L.kind,brand:n,schema:t.schema,size:7}),(0,w.jsxs)(A,{to:q(t.schema,L.kind,L.id),style:{...$,fontSize:"1.125rem"},children:[L.label,L.apart?(0,w.jsxs)("span",{style:k,children:[" \xB7 ",L.apart]}):null]})]},L.id))}),(f.direction==="out"&&t.schema.edge(f.edgeKind)?.cardinality==="one"?[]:[...new Set(f.targets.map(L=>L.kind))]).map(L=>(0,w.jsxs)(A,{to:`/${G(t.schema,L)}?${encodeURIComponent(f.edgeKind)}=${encodeURIComponent(s)}`,style:{...$,...k},"data-testid":"related-all",children:["Sort and filter ",f.description??`these ${I(t,L).toLowerCase()}`,f.targets.some(Z=>Z.kind!==L)?` (${I(t,L).toLowerCase()})`:""," \u2192"]},L))]},`${f.edgeKind}|${f.direction}|${f.description??""}`)),!ne&&(C.length>0||l.actions.withheld.length>0)?(0,w.jsxs)("section",{style:{...j,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,w.jsx)("h2",{style:D,ref:c,tabIndex:-1,children:"What can be done"}),(0,w.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:C.map(f=>{let L=u===f.id;return(0,w.jsx)("button",{type:"button","data-affordance":f.id,"data-rank":f.rank,"aria-expanded":L,onClick:()=>m(L?null:f.id),style:{...et,...L?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:f.label},f.id)})}),C.map(f=>{if(u!==f.id)return null;let L=t.allMutations().find(Z=>Z.name===f.mutation);return L?(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:f.label}),L.description?(0,w.jsx)("p",{style:{...k,margin:0},children:L.description}):null,(0,w.jsx)(ye,{store:t,mutation:L,prefilled:f.args,open:f.open,label:f.label,onDone:()=>{m(null);let Z=f.id;requestAnimationFrame(()=>{(c.current?.parentElement?.querySelector(`[data-affordance="${Z.replace(/["\\]/g,"\\$&")}"]`)??c.current)?.focus()})},...a?{principal:a}:{}})]},f.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(f=>(0,w.jsxs)("li",{style:k,children:[(0,w.jsx)("s",{children:f.label})," \u2014 ",f.refusal.message]},f.id))}):null]}):null,F.length>0?(0,w.jsxs)("section",{style:{...j,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:F.map(f=>(0,w.jsxs)("li",{style:k,children:[(0,w.jsx)("span",{style:{color:"var(--graview-ink)"},children:f.intent})," \u2014 ",tt(f,a,{graph:t.graph,schema:t.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},f.id))})]}):null]})}var v=O(z(),1),tr=(0,N.lazy)(()=>import("./chunk.VNC6H6IM.js").then(e=>({default:e.DraftPage})));function nr({context:e,children:t}){let n=he(),a=e.store.schema,i=(0,N.useMemo)(()=>({href:r=>q(a,r.kind,r.id),go:r=>n(q(a,r.kind,r.id))}),[a,n]);return(0,v.jsx)(Wn.Provider,{value:i,children:(0,v.jsx)(Dn.Provider,{value:(e.titleLevel??(e.framed&&!e.barAbove?1:2))-1,children:t})})}function ar({steering:e}){let t=de(),n=he(),a=`${t.pathname}${t.search}`;return(0,N.useLayoutEffect)(()=>e.at(a),[a,e]),(0,N.useLayoutEffect)(()=>{let i=d=>{d!==a&&n(d)};e.go.current=i;let r=e.pending?.current;return r!==void 0&&(e.pending.current=void 0,i(r)),()=>{e.go.current===i&&(e.go.current=void 0)}},[a,n,e]),null}function rr({context:e,to:t}){let{pathname:n}=de(),a=oe(),i=(t??a)?.sayWhere,r=ir(e,n);return(0,N.useEffect)(()=>(i?.(r),()=>i?.(null)),[i,r]),null}function ir(e,t){let[n="",a,i]=t.split("/").filter(Boolean).map(d=>{try{return decodeURIComponent(d)}catch{return d}});if(i!==void 0)return"#";if(n==="places"&&a!==void 0){if(a===wt)return"#overview=1";let d=e.views?.places().find(s=>s.as===a);return d?`#focus=${encodeURIComponent(Ie(d.kind))}&view=${encodeURIComponent(d.as)}`:"#"}let r=fe(e.store.schema,n);return r?`#focus=${encodeURIComponent(a??Ie(r))}`:"#"}function or({onNavigate:e,path:t}){let n=de(),a=xt(),i=he(),r=`${n.pathname}${n.search}`,d=(0,N.useRef)(e);d.current=e;let s=(0,N.useRef)(null);(0,N.useEffect)(()=>{let o=s.current;s.current=r,o!==null&&(r===o&&a!=="PUSH"||d.current?.(r,a==="POP"?"pop":a==="REPLACE"?"replace":"push"))},[n.key]);let l=(0,N.useRef)(t);return(0,N.useEffect)(()=>{t===void 0||t===l.current||(l.current=t,t!==r&&i(t))},[t]),null}function ka({context:e,registry:t,page:n}){let a=ke(),i=fe(e.store.schema,a.slug??""),r=n==="list"?Kt:zt,s=(i?t?.lookup(i,n):void 0)??r;return(0,v.jsx)(s,{context:e})}function sr({context:e,registry:t,children:n}){let a=(0,N.useRef)(null);return xn(a),(0,v.jsx)("div",{ref:a,"data-graview-face":"pages",style:{display:"contents"},children:(0,v.jsx)(ca,{context:e,registry:t,root:a,children:n})})}function lr(){let{pathname:e}=de(),t=xt(),n=(0,N.useRef)(null);(0,N.useLayoutEffect)(()=>{if(t!=="POP"){for(let r=n.current?.parentElement;r;r=r.parentElement){let{overflowY:d}=getComputedStyle(r);if((d==="auto"||d==="scroll")&&r.scrollHeight>r.clientHeight){r.scrollTop=0;return}}window.scrollTo(0,0)}},[e]);let a=(0,N.useRef)(e),i=(0,N.useRef)(!1);return(0,N.useEffect)(()=>{if(!i.current&&e===a.current)return;i.current=!0;let r=document.activeElement;if(r!==null&&r!==document.body&&r!==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}))},[e]),(0,v.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function dr({context:e,children:t}){let n=he(),a=(0,N.useMemo)(()=>({record:i=>{let r=e.store.graph.getNode(i);r&&n(q(e.store.schema,r.kind,i))},place:i=>{let r=e.views?.places().find(d=>d.as===i);r&&n(ge(e,r))}}),[e,n]);return(0,v.jsx)(Sn.Provider,{value:a,children:t})}function pr({context:e,Home:t}){let i=de().key==="default"?mn(e.views?.arrangement?.()?.first,e.store.schema,e.views?.places()??[]):void 0,r=i?.to==="place"?ge(e,i.place):i?.to==="kind"?`/${G(e.store.schema,i.kind)}`:void 0;return r?(0,v.jsx)(Pt,{to:r,replace:!0}):(0,v.jsx)(t,{context:e})}function Sa({context:e,registry:t}){let n=t?.lookupSurface("shell"),a=n!==void 0,i=a&&(t?.without().has("bar")??!1),r=a&&!i&&!e.embedded?{...e,barAbove:!0}:e,d=y=>n===void 0?(0,v.jsx)(rt,{context:e,children:y}):i?(0,v.jsx)(n,{context:e,children:y}):(0,v.jsx)(rt,{context:e,children:(0,v.jsx)(n,{context:r,children:y})}),s=t?.lookupSurface("home")??Dt,l=t?.lookupSurface("problems")??Ht,o=a?{...r,framed:!0}:e,[u,m]=(0,N.useState)(null),c=(0,N.useMemo)(()=>({onFind:m,find:!(t?.without().has("find")??!1),places:!(t?.without().has("places")??!1)}),[t]),g=(0,v.jsx)(sr,{context:e,registry:t,children:(0,v.jsx)(dr,{context:e,children:d((0,v.jsx)(v.Fragment,{children:(0,v.jsxs)(nr,{context:o,children:[(0,v.jsx)(lr,{}),(0,v.jsxs)(Jn,{children:[(t?.routes()??[]).map(({path:y,component:P})=>(0,v.jsx)(pe,{path:y,element:(0,v.jsx)(P,{context:o})},y)),(0,v.jsx)(pe,{path:"/",element:(0,v.jsx)(pr,{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)(N.Suspense,{fallback:null,children:(0,v.jsx)(tr,{context:o})})}),(0,v.jsx)(pe,{path:"/search",element:(0,v.jsx)(It,{context:o})}),(0,v.jsx)(pe,{path:"/map",element:(0,v.jsx)(Wt,{context:o})}),(0,v.jsx)(pe,{path:"/places",element:(0,v.jsx)(Ft,{context:o})}),ce(o).some(y=>y.as===wt)?null:(0,v.jsx)(pe,{path:un,element:(0,v.jsx)(Pt,{to:"/",replace:!0})}),(0,v.jsx)(pe,{path:"/places/:as",element:(0,v.jsx)(Nt,{context:o})}),(0,v.jsx)(pe,{path:"/:slug",element:(0,v.jsx)(ka,{context:o,registry:t,page:"list"})}),(0,v.jsx)(pe,{path:"/:slug/:id",element:(0,v.jsx)(ka,{context:o,registry:t,page:"record"})})]})]})}))})});return e.embedded||!a||i?g:(0,v.jsx)(Zn.Provider,{value:c,children:(0,v.jsx)(An.Provider,{value:u,children:g})})}function cr({context:e,registry:t,basename:n,initialPath:a,onNavigate:i,path:r,steering:d}){(0,N.useState)(()=>e.views?Kn(e.views,e.store.schema,Tn(e.brand,e.store.schema)):void 0);let s=oe(),l=e.store.seenBy(e.principal??{kind:"human"}),o=l===e.store?e:{...e,store:l};vn(e.store,e.principal);let u=(0,v.jsxs)(v.Fragment,{children:[i||r!==void 0?(0,v.jsx)(or,{onNavigate:i,path:r}):null,d?(0,v.jsx)(ar,{steering:d}):null,o.presence||s?(0,v.jsx)(rr,{context:o,to:s}):null,(0,v.jsx)(Sa,{context:o,...t?{registry:t}:{}})]}),m=o.views?(0,v.jsxs)(kn,{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}:{},children:[u,(0,v.jsx)(la,{context:o})]}):u;if(a!==void 0){let c=n===void 0?a:`${n.replace(/\/$/,"")}${a}`;return(0,v.jsx)(Yn,{initialEntries:[c],...n===void 0?{}:{basename:n},children:m})}return(0,v.jsx)(Qn,{...n===void 0?{}:{basename:n},children:m})}export{Oa as a,cr as b};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import{tb as e}from"./chunk.Y235YZSZ.js";var a=`
|
|
2
|
+
.graview-spec { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--graview-ink); }
|
|
3
|
+
|
|
4
|
+
.graview-spec-row { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; box-sizing: border-box; max-width: 100%; padding: 5px 10px; border: 1px solid var(--graview-edge); border-radius: var(--graview-radius-sm, 8px); background: var(--graview-panel); font-size: 0.875rem; }
|
|
5
|
+
.graview-spec-row[data-selected] { border-color: var(--graview-accent); }
|
|
6
|
+
.graview-spec-row > * { flex: 0 0 auto; min-width: 0; max-width: 100%; }
|
|
7
|
+
.graview-spec-row > .graview-spec-title, .graview-spec-row > .graview-spec-text { flex: 1 1 9rem; overflow-wrap: anywhere; }
|
|
8
|
+
.graview-spec-row > .graview-spec-title { font-size: 0.9375rem; }
|
|
9
|
+
.graview-spec-row > .graview-spec-progress { grid-template-columns: auto minmax(3rem, 5rem) auto; align-items: center; column-gap: 6px; }
|
|
10
|
+
.graview-spec-list[data-as="row"] .graview-spec-row { border-width: 0 0 1px; border-radius: 0; background: transparent; padding: 6px 2px; }
|
|
11
|
+
[data-graview-rows] .graview-spec-row { border-width: 0; border-radius: 0; background: transparent; padding: 2px 0; }
|
|
12
|
+
[data-graview-rows] .graview-spec-row > .graview-spec-title { font-size: 1.0625rem; font-weight: 600; }
|
|
13
|
+
.graview-spec-page { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--graview-edge); }
|
|
14
|
+
.graview-spec-title { font-family: var(--graview-font-display, inherit); font-weight: 600; font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; }
|
|
15
|
+
.graview-spec-text { margin: 0; font-size: 0.875rem; line-height: 1.45; overflow-wrap: anywhere; }
|
|
16
|
+
.graview-spec-text[data-graview-tone] { color: var(--graview-spec-tone); }
|
|
17
|
+
|
|
18
|
+
.graview-spec-badge { align-self: flex-start; display: inline-block; max-width: 100%; box-sizing: border-box; padding: 1px 8px; border: 1px solid currentColor; border-radius: 999px; background: var(--graview-panel); color: var(--graview-spec-tone, var(--graview-ink-muted)); font-size: 0.8125rem; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
|
|
19
|
+
.graview-spec-row .graview-spec-badge, .graview-spec-group[data-direction="row"] .graview-spec-badge { align-self: center; }
|
|
20
|
+
.graview-spec [data-graview-tone="good"] { --graview-spec-tone: var(--graview-good); }
|
|
21
|
+
.graview-spec [data-graview-tone="bad"] { --graview-spec-tone: var(--graview-bad); }
|
|
22
|
+
.graview-spec [data-graview-tone="warn"] { --graview-spec-tone: var(--graview-warn); }
|
|
23
|
+
.graview-spec [data-graview-tone="accent"] { --graview-spec-tone: var(--graview-accent); }
|
|
24
|
+
.graview-spec [data-graview-tone="neutral"] { --graview-spec-tone: var(--graview-ink-muted); }
|
|
25
|
+
.graview-spec-field { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; min-width: 0; font-size: 0.875rem; line-height: 1.4; }
|
|
26
|
+
.graview-spec-label { color: var(--graview-ink-muted); }
|
|
27
|
+
.graview-spec-value { min-width: 0; color: var(--graview-ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
|
|
28
|
+
.graview-spec-link { position: relative; z-index: ${e.raised}; color: var(--graview-accent); text-decoration: underline; }
|
|
29
|
+
.graview-spec-progress { display: grid; gap: 4px; font-size: 0.8125rem; }
|
|
30
|
+
.graview-spec-progress > .graview-spec-label, .graview-spec-progress > .graview-spec-value { white-space: nowrap; }
|
|
31
|
+
.graview-spec-track { display: block; height: 6px; border-radius: 999px; background: var(--graview-edge); overflow: hidden; }
|
|
32
|
+
.graview-spec-fill { display: block; height: 100%; background: var(--graview-accent); }
|
|
33
|
+
.graview-spec-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
|
|
34
|
+
.graview-spec-group[data-direction="row"] { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
|
|
35
|
+
.graview-spec-row .graview-spec-group { flex: 1 1 9rem; }
|
|
36
|
+
.graview-spec-divider { width: 100%; margin: 2px 0; border: 0; border-top: 1px solid var(--graview-edge); }
|
|
37
|
+
.graview-spec-figure { display: inline-flex; width: 22px; height: 22px; }
|
|
38
|
+
.graview-spec-row[data-graview-tall] { flex-direction: column; flex-wrap: nowrap; align-items: stretch; border-radius: 10px; padding: 8px 12px; }
|
|
39
|
+
.graview-spec-row[data-graview-tall] .graview-spec-badge { align-self: flex-start; }
|
|
40
|
+
.graview-spec-home, .graview-spec-place { gap: 14px; }
|
|
41
|
+
.graview-spec-headline { margin: 0; font-family: var(--graview-font-display, inherit); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; overflow-wrap: anywhere; font-size: 1.125rem; }
|
|
42
|
+
.graview-spec-headline[data-level="1"] { font-size: clamp(1.75rem, 5vw, 2.75rem); line-height: 1.05; text-wrap: balance; }
|
|
43
|
+
.graview-spec-headline[data-level="2"] { font-size: clamp(1.25rem, 3vw, 1.625rem); margin-top: 8px; }
|
|
44
|
+
.graview-spec-number { display: grid; gap: 2px; justify-items: start; }
|
|
45
|
+
.graview-spec-number-value { font-family: var(--graview-font-display, inherit); font-weight: 600; font-size: 1.75rem; line-height: 1.05; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
|
|
46
|
+
.graview-spec-card .graview-spec-number-value, .graview-spec-row .graview-spec-number-value { font-size: 1.25rem; }
|
|
47
|
+
.graview-spec-number .graview-spec-label { font-size: 0.8125rem; }
|
|
48
|
+
.graview-spec-listing { display: grid; gap: 10px; min-width: 0; position: relative; z-index: ${e.raised}; }
|
|
49
|
+
.graview-spec-list-group { display: grid; gap: 8px; min-width: 0; }
|
|
50
|
+
.graview-spec-list-heading { margin: 6px 0 0; font-family: var(--graview-font-display, inherit); font-size: 1rem; font-weight: 600; padding-bottom: 4px; border-bottom: 1px solid var(--graview-edge-bright, var(--graview-edge)); }
|
|
51
|
+
.graview-spec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
|
|
52
|
+
.graview-spec-list[data-as="card"] { grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 10px; }
|
|
53
|
+
.graview-spec-list[data-as="names"] { display: flex; flex-wrap: wrap; gap: 4px 12px; }
|
|
54
|
+
.graview-spec-item { position: relative; min-width: 0; }
|
|
55
|
+
.graview-spec-item-name { font-size: 0.875rem; font-weight: 600; }
|
|
56
|
+
.graview-spec-item-link { all: unset; position: absolute; inset: 0; min-height: 24px; border-radius: 10px; cursor: pointer; }
|
|
57
|
+
.graview-spec-item-link:hover { background: color-mix(in srgb, var(--graview-accent) 6%, transparent); }
|
|
58
|
+
.graview-spec-item-link:focus-visible { outline: 2px solid var(--graview-accent); outline-offset: 2px; }
|
|
59
|
+
.graview-spec-item .graview-spec-listing { z-index: ${e.raised}; }
|
|
60
|
+
.graview-spec-empty, .graview-spec-more { color: var(--graview-ink-muted); }
|
|
61
|
+
`;export{a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{g as ot,h as ue,k as st,l as he}from"./chunk.DAKED3WK.js";import{a as ae,b as Q,c as ce,d as it,f as rt,g as ie}from"./chunk.ZFUQA3KT.js";import{a as ne,b as et}from"./chunk.SCLIBKLS.js";import{i as J,j,k as tt,l as nt}from"./chunk.ACZGK7LQ.js";import{a as lt,b as dt}from"./chunk.3MLQ3Q5X.js";import{d as at}from"./chunk.LGUV2J6Q.js";import{C as Fe,F as Ke,G as _e,P as je,Y as Ue,a as Ge,ba as qe,ca as N,da as Xe,ea as le,fa as me,ia as _,j as Ie,ja as Ye,l as He,la as de,m as Oe,na as Je,pa as fe,q as ze,qa as Qe,ra as ye,y as ge,ya as Ze}from"./chunk.4JSMCNF7.js";import{I as T,J as Ve,L as I,M as Be,Q as Le,R as De,T as Y,U as Z,V as Me,ab as ee,ma as We}from"./chunk.Y235YZSZ.js";import{a as te,b as D}from"./chunk.MRK6QJV5.js";import{b as A}from"./chunk.AJZBJBMO.js";var M=A(te(),1);var H=A(D(),1);function ct({id:e,max:t=8,empty:a,hide:n}){let{store:r}=N();le();let d=Et(r,e,r.violations()),i=n?d.flatMap(c=>{let p=c.ids.filter(u=>!n.has(u));return p.length>0?[{...c,ids:p}]:[]}):d;return i.length===0?a&&d.length===0?(0,H.jsx)("p",{style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-faint)"},children:a}):null:(0,H.jsx)("div",{"data-graview-primitive":"connections",style:{display:"flex",flexDirection:"column",gap:12},children:i.map(c=>{let p=c.ids.slice(0,t),u=c.ids.length-p.length;return(0,H.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,H.jsx)("h2",{...c.said?{"aria-label":c.said}:{},style:{margin:0,fontSize:"0.75rem",fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:c.label}),(0,H.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:[p.map(l=>{let o=r.graph.getNode(l);return o?(0,H.jsx)(j,{pickId:l,hue:ee(o.kind),title:`Go to the ${Y(r.schema.tryDefinition(o.kind),o.kind)}`,label:T(r.schema.tryDefinition(o.kind),o)},l):null}),u>0?(0,H.jsx)(j,{label:`+${u} more`}):null]})]},c.key)})})}function Et(e,t,a=[]){let n=e.graph.getNode(t);if(!n)return[];let r=new Map,d=[];for(let i of a)if(i.subjectId===t)for(let c of i.nodeIds)c!==t&&!d.includes(c)&&e.graph.has(c)&&d.push(c);d.length>0&&r.set("judges",{key:"judges",label:"what it finds wrong",ids:d});for(let i of e.graph.allEdges()){let c=i.from===t?i.to:i.to===t?i.from:null;if(c===null||c===t)continue;let p=e.graph.getNode(c);if(!p)continue;let u=i.from===t?"out":"in",l=u==="out"?n.kind:p.kind,o=Vt(e.schema,l,i.kind,u),w=`${i.kind}:${u}:${o.label}`,f=r.get(w)??{key:w,...o,ids:[]};f.ids.includes(c)||f.ids.push(c),r.set(w,f)}for(let i of r.values())i.ids.sort();return[...r.values()].sort((i,c)=>i.key<c.key?-1:i.key>c.key?1:0)}function Vt(e,t,a,n){let r=Le(e,t,a,n),d=I(a).toLowerCase();return r.trim().toLowerCase()!==d?{label:r}:n==="out"?{label:`\u2192 ${d}`,said:d}:{label:`\u2190 ${d}`,said:`${d}, pointing here`}}var P=A(te(),1);var W=A(D(),1),Bt=/^\s*(\d{1,6})[.)]\s+(.*)$/s,Lt=/^\s*[-*•]\s+(.*)$/s;function Dt(e){let t=[];for(let a of e.replace(/\r\n?/g,`
|
|
2
|
+
`).split(/\n[ \t]*\n+/)){let n=null,r=()=>{n&&(n.t==="p"?n.lines.length>0:n.items.length>0)&&t.push(n),n=null};for(let d of a.split(`
|
|
3
|
+
`)){let i=Bt.exec(d),c=i?null:Lt.exec(d);if(i)n?.t!=="ol"&&(r(),n={t:"ol",start:Number(i[1]),items:[]}),n.items.push(i[2]);else if(c)n?.t!=="ul"&&(r(),n={t:"ul",items:[]}),n.items.push(c[1]);else if(n&&n.t!=="p"&&/^\s+\S/.test(d)){let p=n.items;p[p.length-1]=`${p[p.length-1]} ${d.trim()}`}else d.trim().length>0&&(n?.t!=="p"&&(r(),n={t:"p",lines:[]}),n.lines.push(d.trim()))}r()}return t}function we(e){return/[\r\n]/.test(e)}var Mt={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},Wt={margin:0},ut={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"};function re({text:e,className:t,style:a}){return(0,W.jsx)("div",{"data-graview-text-body":"",...t?{className:t}:{},style:{...Mt,...a},children:Dt(e).map((n,r)=>n.t==="p"?(0,W.jsx)("p",{style:Wt,children:n.lines.map((d,i)=>(0,W.jsxs)("span",{children:[i>0?(0,W.jsx)("br",{}):null,d]},i))},r):n.t==="ol"?(0,W.jsx)("ol",{start:n.start,style:ut,children:n.items.map((d,i)=>(0,W.jsx)("li",{children:d},i))},r):(0,W.jsx)("ul",{style:ut,children:n.items.map((d,i)=>(0,W.jsx)("li",{children:d},i))},r))})}var y=A(D(),1);function mt({nodeId:e,field:t,value:a,stored:n=a}){let{fields:r,commit:d}=ue(e),i=r.find(h=>h.field===t),{store:c}=N(),p=c.graph.getNode(e)?.kind,u=c.schema.definitions.find(h=>h.kind===p),l=De(u,t).toLowerCase(),[o,w]=(0,P.useState)(!1),[f,v]=(0,P.useState)(n),S=(0,P.useRef)(null),b=(0,P.useRef)(null),k=(0,P.useRef)(!1),R=h=>{k.current=h,w(!1)};if((0,P.useEffect)(()=>v(n),[n,o]),(0,P.useEffect)(()=>{o?S.current?.focus():k.current&&(k.current=!1,b.current?.focus())},[o]),!i)return(0,y.jsx)("span",{"data-graview-field":t,"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${l}`,style:{color:"var(--graview-ink)",cursor:"default",overflowWrap:"anywhere"},children:a});if(!o)return(0,y.jsx)("button",{ref:b,type:"button","data-graview-field":t,"data-graview-editable":i.mutation,title:`${i.title} \u2014 changes the ${l}, and can be undone`,onClick:()=>w(!0),style:{all:"unset",cursor:"text",display:"inline-flex",alignItems:"flex-end",minHeight:24,minWidth:24,maxWidth:"100%",overflowWrap:"anywhere",paddingBottom:1,borderBottom:"1px dashed var(--graview-edge-bright)",color:"var(--graview-ink)"},children:a});let $=(h,{left:L=!1}={})=>{R(!L),!(h===n||h===""||h===void 0)&&d(i,h)};if(!i.takesValue){let h=[i,...i.alternatives];return(0,y.jsx)("span",{role:"group","aria-label":`Change ${I(t).toLowerCase()}`,"data-graview-field":t,style:{display:"inline-flex",gap:6,alignItems:"center",flexWrap:"wrap"},onKeyDown:L=>{L.key==="Escape"&&R(!0)},children:h.map((L,U)=>(0,y.jsx)("button",{type:"button",ref:U===0?S:void 0,"data-graview-act":L.mutation,onClick:()=>{R(!0),d(L,void 0)},onBlur:B=>{let O=B.relatedTarget;(!O||!B.currentTarget.parentElement?.contains(O))&&R(!1)},style:{padding:"2px 9px",fontSize:"0.8125rem",borderRadius:999},children:L.title},L.mutation))})}return(0,y.jsxs)("form",{style:{display:"inline-flex",gap:4},onSubmit:h=>{h.preventDefault(),$(pt(i,f))},children:[i.shape.type==="choice"?(0,y.jsx)("select",{ref:S,"aria-label":I(t),"data-graview-field":t,value:f,onChange:h=>$(h.target.value),onBlur:()=>R(!1),style:{font:"inherit",fontSize:"inherit"},children:i.shape.options.map(h=>(0,y.jsx)("option",{value:h,children:Be(u,t,h)},h))}):(0,y.jsx)("input",{ref:S,"aria-label":I(t),"data-graview-field":t,type:i.shape.type==="number"?"number":i.shape.type==="date"?i.shape.time?"datetime-local":"date":"text",...i.shape.type==="number"&&i.shape.min!==void 0?{min:i.shape.min}:{},...i.shape.type==="number"&&i.shape.max!==void 0?{max:i.shape.max}:{},...i.shape.type==="number"&&i.shape.step!==void 0?{step:i.shape.step}:{},value:f,onChange:h=>v(h.target.value),onBlur:()=>$(pt(i,f),{left:!0}),onKeyDown:h=>{h.key==="Escape"&&R(!0)},style:{font:"inherit",fontSize:"inherit",width:`${Math.max(6,f.length+1)}ch`,minHeight:24,display:"inline-flex",alignItems:"center",padding:"0 3px"}}),i.open.length>0?(0,y.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["also needs ",i.open.map(h=>h.name).join(", ")]}):null]})}function pt(e,t){return e.shape.type==="number"?Number(t):t}function ft({id:e,hide:t=[],limit:a=10,labels:n={},shown:r=[]}){let{store:d}=N(),i=me(e);if(!i)return null;let c=d.schema.tryDefinition(i.kind),p=Z(i,c,{limit:a,said:r}).filter(u=>!t.includes(u.key));return p.length===0?null:(0,y.jsx)("div",{"data-graview-fields":i.id,style:{display:"grid",gap:14,alignContent:"start",minWidth:0,fontSize:"0.875rem"},children:Me(c,p).map((u,l)=>{let o=(0,y.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto 1fr",gap:"5px 16px",alignContent:"start",minWidth:0},children:u.fields.map(f=>f.long?(0,y.jsx)(It,{nodeId:i.id,field:f.key,label:n[f.key]??f.label,value:f.value,labelStyle:gt,style:{gridColumn:"1 / -1",marginTop:6}},f.key):(0,y.jsxs)("div",{style:{display:"contents"},children:[(0,y.jsx)("dt",{style:{...gt,whiteSpace:"nowrap"},children:n[f.key]??f.label}),(0,y.jsx)("dd",{style:{margin:0,minWidth:0},children:(0,y.jsx)(mt,{nodeId:i.id,field:f.key,value:f.value,stored:f.stored})})]},f.key))});if(!u.title)return(0,y.jsx)("div",{children:o},l);let w=`graview-field-group-${i.id}-${l}`;return(0,y.jsxs)("div",{role:"group","aria-labelledby":w,style:{display:"grid",gap:6,minWidth:0},children:[(0,y.jsx)("p",{id:w,"data-graview-field-group":u.title,style:Gt,children:u.title}),o]},l)})})}var gt={color:"var(--graview-ink-faint)",fontSize:"0.8125rem"},Gt={margin:0,fontSize:"0.75rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)",fontWeight:560};function It(e){return Xe()?(0,y.jsx)(Ot,{...e}):(0,y.jsx)(Ht,{...e})}function Ht({field:e,label:t,value:a,labelStyle:n,valueStyle:r,style:d}){return(0,y.jsxs)("div",{"data-graview-long":e,style:{display:"grid",gap:6,minWidth:0,...d},children:[(0,y.jsx)("dt",{style:n,children:t}),(0,y.jsx)("dd",{style:{margin:0,minWidth:0,...r},children:(0,y.jsx)("div",{"data-graview-field":e,children:(0,y.jsx)(re,{text:a})})})]})}function Ot({nodeId:e,field:t,label:a,value:n,labelStyle:r,valueStyle:d,style:i}){let{fields:c,commit:p}=ue(e),u=c.find(k=>k.field===t&&k.takesValue),[l,o]=(0,P.useState)(!1),w=(0,P.useRef)(null),f=(0,P.useRef)(!1);(0,P.useEffect)(()=>{!l&&f.current&&(f.current=!1,w.current?.focus())},[l]);let v=k=>{f.current=k,o(!1)},S=a.toLowerCase(),b=(0,y.jsx)(re,{text:n});return(0,y.jsxs)("div",{"data-graview-long":t,style:{display:"grid",gap:6,minWidth:0,...i},children:[(0,y.jsxs)("dt",{style:{display:"flex",alignItems:"baseline",gap:10,...r},children:[(0,y.jsx)("span",{children:a}),u&&!l?(0,y.jsx)("button",{ref:w,type:"button","data-graview-editable":u.mutation,"aria-label":`Edit the ${S}`,title:`${u.title} \u2014 changes the ${S}, and can be undone`,onClick:()=>o(!0),style:Ft,children:"Edit"}):null]}),(0,y.jsx)("dd",{style:{margin:0,minWidth:0,...d},children:l&&u?(0,y.jsx)(P.Suspense,{fallback:b,children:(0,y.jsx)(zt,{field:t,label:a,value:n,onCancel:()=>v(!0),onSave:(k,R)=>{v(!R),k!==n&&p(u,k)}})}):(0,y.jsx)("div",{"data-graview-field":t,...u?{}:{"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${S}`},...u?{onClick:()=>o(!0)}:{},style:{cursor:u?"text":"default",minWidth:0},children:b})})]})}var zt=(0,P.lazy)(()=>import("./chunk.4HGBVU5B.js")),Ft={all:"unset",cursor:"pointer",fontSize:"0.75rem",letterSpacing:"normal",textTransform:"none",color:"var(--graview-accent)",borderBottom:"1px dashed currentColor",minHeight:24,minWidth:24,display:"inline-flex",alignItems:"flex-end"};function yt({nodeId:e,children:t}){let{fields:a}=ue(e),n=me(e);if(!n)return(0,y.jsx)(y.Fragment,{children:t});let r=a.find(d=>{let i=n[d.field];return typeof i=="string"&&i===t});return r?(0,y.jsx)(mt,{nodeId:e,field:r.field,value:t}):(0,y.jsx)(y.Fragment,{children:t})}var ht=A(te(),1),oe=(0,ht.createContext)(null);var g=A(D(),1),Kt=Ze(Ge(()=>import("./chunk.Q7WQ5UIE.js"))).part((e,t)=>(0,g.jsx)(e.ArrangeBar,{...t}),{what:"Arranging this list"});function ve(e){let{brand:t}=N();return ee(e,t?.accents)}function _t(e,t){if(!t.endsWith("\u2026")&&!t.endsWith("..."))return;let a=t.replace(/[…]|\.\.\.$/g,"").trim();if(!(a.length<12)){for(let n of Object.values(e))if(typeof n=="string"&&n.length>a.length&&n.startsWith(a))return n}}function jt(e,t){let n=Math.max(0,...e.slice(0,t*2).map(d=>d.length))*7.5+28<=212/2?2:1,r=t*n;return{columns:n,shown:Math.min(e.length,r)}}var Ut=8,wt=500,qt=12;function vt(e){return{x:e.clientX,y:e.clientY,pointerType:e.pointerType??""}}function Xt(e,t,a){let n=performance.now()+wt,r=["pointerdown","pointerup","mousedown","mouseup","dblclick"],d=o=>{if(performance.now()>n||!(o instanceof MouseEvent))return!1;let w=vt(o);return t.pointerType&&w.pointerType&&t.pointerType!==w.pointerType?!1:Math.hypot(w.x-t.x,w.y-t.y)<=qt},i=o=>{if(!d(o))return u();o.stopPropagation()},c=o=>{if(!d(o))return u();o.stopPropagation(),o.preventDefault(),e.removeEventListener("click",c,!0),setTimeout(u,50),a()},p=!1,u=()=>{if(!p){p=!0,clearTimeout(l),e.removeEventListener("click",c,!0);for(let o of r)e.removeEventListener(o,i,!0)}};for(let o of r)e.addEventListener(o,i,!0);e.addEventListener("click",c,!0);let l=setTimeout(u,wt)}function Yt({View:e,members:t,mode:a,flagged:n}){let{isSelected:r}=fe(),d=t.slice(0,Ut);return(0,g.jsxs)("div",{"data-graview-rows":"",style:{display:"grid",gap:4,minWidth:0},children:[d.map(i=>(0,g.jsx)("div",{"data-graview-pick":i.id,style:{minWidth:0,cursor:"pointer"},children:(0,g.jsx)(e,{node:i,cardinality:"one",fidelity:"glyph",mode:a,selected:r(i.id),...n?.includes(i.id)?{flagged:[i.id]}:{}})},i.id)),t.length>d.length?(0,g.jsx)(j,{label:`+${t.length-d.length} more`}):null]})}var Jt=11/15;function Qt({text:e,accent:t}){let a=(0,M.useRef)(null),n=(0,M.useRef)(null),[r,d]=(0,M.useState)(1),[i,c]=(0,M.useState)(!1),p=r<1?`${r}em`:void 0;return(0,M.useLayoutEffect)(()=>{let u=a.current,l=n.current;if(!u||!l)return;let o=()=>{let f=u.clientWidth,v=l.offsetWidth;if(f<=0||v<=0)return;let S=parseFloat(getComputedStyle(l).fontSize)/parseFloat(getComputedStyle(u).fontSize)||1,b=v/S,k=Math.max(Jt,Math.min(1,Math.floor(f/b*100)/100));d(R=>Math.abs(R-k)<.01?R:k),c(b*k>f+.5)};if(o(),typeof ResizeObserver>"u")return;let w=new ResizeObserver(o);return w.observe(u),()=>w.disconnect()},[e]),(0,g.jsx)("span",{ref:a,"data-graview-district-name":"",...r<1?{"data-graview-fitted":""}:{},...i?{title:e}:{},style:{display:"block",minWidth:0,fontSize:"0.9375rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:t?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,g.jsx)("span",{ref:n,style:{fontSize:p},children:e})})}function Zt(e,t){return!!e?.display?.page?.groups?.length||Z(t,e).some(a=>a.long)}function St(e,t=de(e)){for(let a of e.kinds){let n=e.tryDefinition(a),r=n?.plural??`${String(a)}s`,d=l=>{let o=l.node,w=Qe(),f=(0,M.useContext)(oe);if(!o)return null;let v=f?.nodeId===o.id?f:null,S=T(n,o),b=l.mode==="fullscreen"?_t(o,S)??S:S,k=We(w,[o.id]);return(0,g.jsxs)(J,{title:(0,g.jsx)(yt,{nodeId:o.id,children:v?.title??b}),...v?{}:{subtitle:n?.describe?Ve(n,o):n?.description??String(a)},selected:l.selected,...l.flagged?.includes(o.id)?{tone:"warning"}:{},fit:!0,children:[v?(0,g.jsx)(oe.Provider,{value:null,children:v.body}):null,(0,g.jsxs)("div",{style:{display:"grid",gridTemplateColumns:Zt(n,o)?"minmax(0, 1fr)":"minmax(200px, 1fr) minmax(220px, 1.4fr)",gap:"22px 34px",alignItems:"start"},children:[(0,g.jsx)(ft,{id:o.id,shown:[b,S,n?.description,v?.title],...v?{hide:[...v.fields]}:{}}),(0,g.jsx)(ct,{id:o.id,empty:`Nothing is connected to this ${Y(n,String(a))} yet.`,...v?{hide:v.records}:{}})]}),k.length>0?(0,g.jsx)("p",{"data-graview-broken":"",style:{margin:"14px 0 0",paddingTop:12,borderTop:"1px solid var(--graview-edge)",fontSize:"0.875rem",color:"var(--graview-warn)"},children:k.map(R=>R.message).join(" \xB7 ")}):null]})},i=l=>{let o=l.node;if(!o)return null;let{store:w}=N(),f=n?.computed?rt(w.schema,w.graph,o):o,v=Z(f,n,{limit:3,said:[T(n,o)],glance:!0}),S=ve(a);return(0,g.jsx)(J,{title:T(n,o),selected:l.selected,tone:l.flagged?.includes(o.id)?"warning":"muted",fit:!0,children:(0,g.jsx)(tt,{items:v.map(b=>({id:b.key,label:b.alone,hue:S})),max:3})})},c=l=>{let o=l.node,w=ve(a),f=he().marks.flag;if(!o)return null;let v=l.flagged?.includes(o.id)??!1;return(0,g.jsx)(j,{label:v?`${T(n,o)} ${f}`:T(n,o),hue:w,selected:l.selected,title:v?`${I(Y(n,String(a)))} \u2014 implicated in a problem`:I(Y(n,String(a)))})},p=l=>{let{brand:o,store:w,views:f}=N(),{view:v,go:S}=ye(),b=l.nodes??[],k=f.lookup(String(a),{cardinality:"one",fidelity:"glyph"}),R=k!==void 0&&!Ye(k)?k:void 0,$=lt(v),h=at(b,$,{schema:e,graph:w.graph,flagged:new Set(l.flagged??[])}),L=C=>({id:C.id,label:T(e.tryDefinition(C.kind),C),hue:ee(C.kind,o?.accents)}),U=l.fidelity==="full"&&b.length>1?(0,g.jsx)(M.Suspense,{fallback:null,children:(0,g.jsx)(Kt,{schema:e,graph:w.graph,kind:String(a),arrangement:$,onChange:C=>S(dt(v,C)),kept:{shown:h.nodes.length,of:b.length},style:{marginBottom:8}})}):null,B=C=>C.some(E=>l.flagged?.includes(E.id)),O=(C,E,q)=>R?(0,g.jsx)(J,{title:C,meta:B(E)?`\u26A0 ${E.length}`:E.length,tone:B(E)?"warning":"muted",children:(0,g.jsx)(Yt,{View:R,members:E,mode:l.mode,...l.flagged?{flagged:l.flagged}:{}})},q):(0,g.jsx)(nt,{label:C,count:E.length,flagged:B(E),items:E.map(L)},q);return h.grouped?(0,g.jsxs)("div",{style:{display:"grid",gap:8},"data-graview-grouped":$.group?.by,children:[U,h.groups.map(C=>O(`${l.label??r} \xB7 ${C.label}`,C.nodes,C.key||"-"))]}):(0,g.jsxs)("div",{style:{display:"grid",gap:4},children:[U,O(l.label??r,h.nodes)]})},u=l=>{let o=l.nodes??[],w=jt(o.map(m=>T(n,m)),l.openedRows??je(o.length)),f=ve(a),{brand:v}=N(),S=et(String(a),e,v),b=he().marks.flag,{selection:k}=fe(),{toggle:R,view:$,go:h}=ye(),{views:L,hiddenKinds:U}=N(),B=$.overview&&!U.has(String(a))?L.places().filter(m=>m.kind===String(a)):[],O=ot(),C=l.focused?$.within?.view??B[0]?.as:void 0,E=o.filter(m=>l.flagged?.includes(m.id)).length,q=E>0,z=l.focused||l.raised,$e=l.rank==="secondary"&&!z,V=l.nestedUnder!==void 0,Ae=new Set(k),At=st(),F=z?0:o.filter(m=>At.includes(m.id)&&!Ae.has(m.id)).length,pe=F>0&&!q,se=qe(),X=se&&!V?se.byKind[String(a)]??0:0,Tt=V?8:Math.min(46,10+Math.round(Math.sqrt(o.length)*8)),Te=V?(0,g.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:z?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.label??r}):(0,g.jsx)(Qt,{text:l.label??r,accent:!!z});return(0,g.jsxs)("div",{className:"graview-kind-card","data-graview-rank":l.rank,"data-graview-landmark":S||void 0,"data-graview-nested":V||void 0,"data-graview-tied":F||void 0,"data-graview-hits":se&&!V?X:void 0,"data-graview-emphasis":se&&!V?X>0?"lit":"dimmed":void 0,...n?.description||V?{title:V?[l.label??r,n?.description].filter(Boolean).join(" \u2014 "):n.description}:{},style:{position:"relative",height:"100%","--graview-hue":Math.round(f),"--graview-marquee-room":B.length>0&&O?`${O(B.map(m=>m.title))+(S?4:42)}px`:"0px"},children:[S?(0,g.jsx)("span",{className:"graview-kind-block graview-kind-landmark","data-graview-opened":l.opened||void 0,"aria-hidden":"true",style:{"--graview-rise":Tt},children:(0,g.jsx)(ne,{kind:String(a),schema:e,...v?{brand:v}:{},size:96})}):null,(0,g.jsxs)("div",{className:"graview-kind-face","data-graview-opened":l.opened||void 0,style:{display:"flex",flexDirection:"column",gap:V?1:3,padding:V?"5px 7px":"7px 10px",borderRadius:"var(--graview-radius-sm, 9px)",justifyContent:"center",position:"relative",height:"100%",overflow:"hidden",boxSizing:"border-box",border:z?"1px solid var(--graview-accent)":F>0?"1px solid var(--graview-accent-dim)":`1px solid hsl(${Math.round(f)} 55% var(--graview-tint-lightness) / 0.34)`,backgroundColor:"var(--graview-panel)",backgroundImage:`linear-gradient(hsl(${Math.round(f)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${z?1.1:$e?.28:.5})), hsl(${Math.round(f)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${z?1.1:$e?.28:.5})))`,boxShadow:z?"0 0 0 1px var(--graview-accent-dim)":void 0},children:[!V&&o.length>0?(0,g.jsx)("div",{"data-graview-tally":o.length,"data-graview-broken":E||void 0,"aria-hidden":"true",style:{position:"absolute",left:0,right:0,top:0,display:"flex",height:3,background:`hsl(${Math.round(f)} 55% var(--graview-tint-lightness) / 0.4)`},children:E>0?(0,g.jsx)("span",{style:{width:`${Math.max(6,Math.round(E/o.length*100))}%`,background:"var(--graview-warn)"}}):null}):null,S?(0,g.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:V?4:6},children:[(0,g.jsx)(ne,{kind:String(a),schema:e,...v?{brand:v}:{},size:V?14:18}),Te]}):Te,(0,g.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:5,fontSize:"0.875rem"},children:[(0,g.jsx)("span",{style:{fontVariantNumeric:"tabular-nums",color:q?"var(--graview-warn)":pe?"var(--graview-accent)":"var(--graview-ink-faint)"},children:o.length===0?"none yet":pe?F===o.length?`${F} tied`:`${F} of ${o.length} tied`:`${q?`${b} `:""}${o.length}`}),(l.retired??0)>0?(0,g.jsxs)("button",{type:"button",className:"graview-kind-past","data-graview-retired":l.retired,title:`${l.retired} retired ${r.toLowerCase()} \u2014 press to widen the view to the past`,onClick:m=>{m.stopPropagation(),h(ze($,!0))},onDoubleClick:m=>m.stopPropagation(),onPointerDown:m=>m.stopPropagation(),children:["+",l.retired," past"]}):null,X>0?(0,g.jsxs)("button",{type:"button",className:"graview-kind-hits","data-testid":`hits-${String(a)}`,title:`${X} ${X===1?"match":"matches"} for \u201C${$.q??""}\u201D \u2014 press to go in, narrowed`,onClick:m=>{m.stopPropagation(),h(Ke($,ge(String(a)),{ownPicture:!0,...$.q?{carry:$.q}:{}}))},onDoubleClick:m=>m.stopPropagation(),onPointerDown:m=>m.stopPropagation(),children:[X," match"]}):null,F>0&&!pe?(0,g.jsxs)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-accent)"},children:[F," tied"]}):null,l.hasOwnView?(0,g.jsx)("span",{title:`${r} has a view of its own`,"aria-label":"has its own view",style:{fontSize:"0.6875rem",color:"var(--graview-accent)"},children:"\u25C6"}):null,!V&&o.length>0&&!l.focused?(0,g.jsxs)("button",{type:"button",className:"graview-kind-open","data-testid":`open-${String(a)}`,"aria-expanded":l.opened??!1,title:l.opened?"Close it up":`See the ${r} in here`,onClick:m=>{m.stopPropagation(),R(ge(String(a)))},onDoubleClick:m=>m.stopPropagation(),onPointerDown:m=>m.stopPropagation(),children:[(0,g.jsx)("span",{className:"graview-kind-open-word",children:l.opened?"close":"open"})," ",l.opened?"\u25B4":"\u25BE"]}):null]}),l.opened?(0,g.jsxs)("div",{className:"graview-kind-members","data-graview-buildings":l.plot?.side??1,style:{display:"grid",gridTemplateColumns:`repeat(${w.columns}, minmax(0, 1fr))`,gap:3},children:[o.slice(0,w.shown).map(m=>{let K=l.flagged?.includes(m.id)??!1,G=T(n,m);return(0,g.jsx)(j,{pickId:m.id,label:K?`${G} ${b}`:G,title:K?`${G} \u2014 implicated in a problem`:void 0,hue:f,selected:Ae.has(m.id)},m.id)}),o.length>w.shown?(0,g.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",padding:"2px 4px",gridColumn:"1 / -1"},children:["+",o.length-w.shown," more \u2014 double-click to go in"]}):null]}):null]}),!V&&B.length>0?(0,g.jsx)("div",{className:"graview-drive-in","data-testid":`drive-in-${String(a)}`,"data-graview-showing":C,onPointerDown:m=>m.stopPropagation(),onDoubleClick:m=>m.stopPropagation(),children:(0,g.jsx)("div",{className:"graview-drive-in-marquee",role:"group","aria-label":`${r}: pictures`,"data-graview-thumbs":B.length===1?"one":"two",children:B.map(m=>{let K=C===m.as;return(0,g.jsxs)("div",{className:"graview-drive-in-thumb","data-graview-pressed":K||void 0,children:[(0,g.jsx)("span",{className:"graview-drive-in-thumb-title","aria-hidden":"true",children:m.title}),(0,g.jsx)("button",{type:"button",className:"graview-drive-in-thumb-press","data-testid":`showing-${m.as}`,"aria-label":`${r}: ${m.title}`,"aria-pressed":K,title:K?`${m.title} is showing \u2014 press again to open it`:`Show ${m.title} on the billboard \u2014 double-click to open it`,onClick:G=>{G.stopPropagation();let Ee=()=>h(_e($,String(a),m.as));if(G.detail>=2||K&&l.focused){Ee();return}h(He(Ie(Oe($,!0),Fe(String(a))),"view",m.as)),G.detail===1&&Xt(G.currentTarget.ownerDocument,vt(G.nativeEvent),Ee)}})]},m.as)})})}):null]})};p.generic=!0,u.generic=!0,t.register(a,{cardinality:"one",fidelity:"full"},_(d)).register(a,{cardinality:"one",fidelity:"summary"},_(i)).register(a,{cardinality:"one",fidelity:"glyph"},_(c)).register(a,{cardinality:"many",fidelity:"full"},_(p)).register(a,{cardinality:"many",fidelity:"summary"},_(p)).register(a,{cardinality:"many",fidelity:"glyph"},_(u))}return t}var x=A(te(),1);var Se=A(te(),1);var be=A(D(),1),kt=new WeakMap;function en(e){let t=kt.get(e);return t||kt.set(e,t=St(e,de(e))),t}var ke=Je;function bt(){return(0,Se.useContext)(ke)}function Kn({children:e}){return(0,be.jsx)(ke.Provider,{value:!0,children:e})}function xt(e){let t=(0,Se.useContext)(ke),{store:a}=N();if(t)return null;let n=e.kind??e.node?.kind??e.nodes?.[0]?.kind;if(!n)return null;let r=en(a.schema).lookup(n,{cardinality:e.cardinality,fidelity:e.fidelity});return r?(0,be.jsx)(r,{...e}):null}var s=A(D(),1),Nt=(0,x.createContext)(null),tn=(e,t)=>e.trim().toLowerCase().replace(/[_-]+/g," ")===t.trim().toLowerCase().replace(/[_-]+/g," "),nn=(0,x.createContext)(null),Re=(0,x.createContext)(null);function an({block:e}){let t=(0,x.useContext)(Re),a=t?.slots?.[e.key],n=(0,s.jsx)(rn,{block:e});return a?(0,s.jsx)(x.Suspense,{fallback:n,children:(0,s.jsx)(a,{block:e,node:t.node,drawn:n})}):n}function rn({block:e}){let t=(0,x.useContext)(Nt),a=(0,x.useContext)(ln),n=(0,x.useContext)(Ne);if(t&&e.t==="badge"&&t.values.some(r=>tn(r,e.text))||t&&e.t==="field"&&t.field!==void 0&&e.field===t.field)return null;switch(e.t){case"title":return(0,s.jsx)("strong",{className:"graview-spec-title",children:e.text});case"text":return we(e.text)?(0,s.jsx)("div",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},children:(0,s.jsx)(re,{text:e.text})}):(0,s.jsx)("p",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},children:e.text});case"badge":return(0,s.jsx)("span",{className:"graview-spec-badge","data-graview-tone":e.tone,children:e.text});case"field":return(0,s.jsxs)("span",{className:"graview-spec-field","data-graview-field":e.field,children:[(0,s.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,s.jsx)("span",{className:"graview-spec-value",...we(e.text)?{style:{whiteSpace:"pre-line"}}:{},children:e.href?(0,s.jsx)("a",{className:"graview-spec-link",href:e.href,rel:"noopener noreferrer",target:"_blank",children:e.text}):e.text})]});case"progress":return e.value===void 0||e.max===void 0?(0,s.jsxs)("span",{className:"graview-spec-progress",children:[(0,s.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,s.jsx)("span",{className:"graview-spec-value",children:e.text})]}):(0,s.jsxs)("span",{className:"graview-spec-progress",children:[(0,s.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,s.jsx)("span",{className:"graview-spec-track",role:"progressbar","aria-label":e.label,"aria-valuemin":0,"aria-valuemax":e.max,"aria-valuenow":Math.max(0,Math.min(e.value,e.max)),"aria-valuetext":e.text,children:(0,s.jsx)("span",{className:"graview-spec-fill",style:{width:`${Math.round(Math.max(0,Math.min(e.value,e.max))/e.max*100)}%`}})}),(0,s.jsx)("span",{className:"graview-spec-value",children:e.text})]});case"group":return(0,s.jsx)("span",{className:"graview-spec-group","data-direction":e.direction,children:(0,s.jsx)(xe,{blocks:e.blocks})});case"when":return e.shown?(0,s.jsx)(xe,{blocks:e.blocks}):null;case"divider":return(0,s.jsx)("hr",{className:"graview-spec-divider"});case"figure":return(0,s.jsx)(on,{});case"headline":{let r=`h${Math.min(6,e.level+a)}`,d=(0,s.jsx)(r,{className:"graview-spec-headline","data-level":e.level,children:e.text});return n!==null&&e.level===1?(0,s.jsxs)(s.Fragment,{children:[d,n]}):d}case"number":return(0,s.jsxs)("span",{className:"graview-spec-number",children:[(0,s.jsx)("span",{className:"graview-spec-number-value",children:e.text}),e.label?(0,s.jsx)("span",{className:"graview-spec-label",children:e.label}):null]});case"list":return(0,s.jsx)(cn,{list:e})}}function on(){let e=(0,x.useContext)(Re)?.figure;return e?(0,s.jsx)("span",{className:"graview-spec-figure","aria-hidden":"true",children:e()}):null}function xe({blocks:e}){return e.map((t,a)=>(0,s.jsx)(an,{block:t},a))}function Rt({blocks:e,ctx:t,view:a}){let n=(0,x.useContext)(nn)?.[a];return(0,s.jsx)(Re.Provider,{value:{figure:t.figure,slots:n,node:t.node},children:(0,s.jsx)(xe,{blocks:e})})}function Ce({blocks:e,ctx:t,view:a}){return(0,s.jsx)(Rt,{blocks:Q(e,t),ctx:t,view:a})}var Ct=3,Pt=(0,x.createContext)(0),sn=(0,x.createContext)(null),ln=(0,x.createContext)(0),Ne=(0,x.createContext)(null);function dn({node:e,as:t,depth:a,said:n=null}){let{store:r,views:d}=N(),i=T(r.schema.tryDefinition(e.kind),e),c=d.lookup(e.kind,{cardinality:"one",fidelity:t==="card"?"summary":"glyph"});return(0,s.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":t,children:[a<=Ct&&c?(0,s.jsx)(Ue,{mode:"scene",children:(0,s.jsx)(Pt.Provider,{value:a,children:(0,s.jsx)(Nt.Provider,{value:n,children:(0,s.jsx)(c,{node:e,cardinality:"one",fidelity:t==="card"?"summary":"glyph",mode:"scene",selected:!1})})})}):(0,s.jsx)("span",{className:"graview-spec-item-name",children:i}),(0,s.jsx)($t,{node:e,label:i})]})}function $t({node:e,label:t}){let a=(0,x.useContext)(sn);return a?(0,s.jsx)("a",{className:"graview-spec-item-link",href:a.href(e),"aria-label":t,onClick:n=>{n.metaKey||n.ctrlKey||n.shiftKey||n.button!==0||(n.preventDefault(),n.stopPropagation(),a.go(e))}}):(0,s.jsx)("button",{type:"button",className:"graview-spec-item-link","data-graview-pick":e.id,"aria-label":t})}function cn({list:e}){let t=(0,x.useContext)(Pt)+1,{store:a}=N();if(e.failed)return(0,s.jsx)("p",{className:"graview-spec-text",children:"\u2014"});if(e.members.length===0)return e.empty?(0,s.jsx)("p",{className:"graview-spec-text graview-spec-empty",children:e.empty}):null;let n=(i,c=null)=>t>Ct?(0,s.jsx)("ul",{className:"graview-spec-list","data-as":"names",children:i.map(p=>(0,s.jsxs)("li",{className:"graview-spec-item","data-graview-listed":p.id,"data-as":"name",children:[(0,s.jsx)("span",{className:"graview-spec-item-name",children:T(a.schema.tryDefinition(p.kind),p)}),(0,s.jsx)($t,{node:p,label:T(a.schema.tryDefinition(p.kind),p)})]},p.id))}):(0,s.jsx)("ul",{className:"graview-spec-list","data-as":e.as,children:i.map(p=>(0,s.jsx)(dn,{node:p,as:e.as,depth:t,said:c},p.id))}),r=e.more>0?(0,s.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${e.more} more`}):null;if(!e.groups)return(0,s.jsxs)("div",{className:"graview-spec-listing",children:[n(e.members),r]});let d=`h${e.headingLevel}`;return(0,s.jsxs)("div",{className:"graview-spec-listing",children:[e.groups.map(i=>(0,s.jsxs)("section",{className:"graview-spec-list-group","data-graview-group":i.value??"",children:[i.heading?(0,s.jsx)(d,{className:"graview-spec-list-heading",children:i.heading}):null,n(i.members,i.value!==null?{values:[i.value,...i.heading?[i.heading]:[]]}:null)]},i.value??"")),r]})}function na({blocks:e,heading:t=2,firstHeading:a,slot:n}){let{store:r,brand:d}=N();le();let i=ie(r,null,null,{heading:t,firstHeading:a,money:d}),c=(0,x.useContext)(Ne),p=e.some(u=>u.t==="headline");return(0,s.jsxs)("div",{className:`graview-spec graview-spec-${n}`,"data-graview-spec":n,children:[c!==null&&!p?c:null,(0,s.jsx)(Ne.Provider,{value:p?c:null,children:(0,s.jsx)(Ce,{blocks:e,ctx:i,view:n})})]})}function Pe(e,t="card"){let{store:a,brand:n}=N(),r=a.schema;return{...ie(a,null,e,{slot:t,money:n}),figure:()=>(0,s.jsx)(ne,{kind:e.kind,schema:r,...n?{brand:n}:{},size:22})}}function un({slot:e,blocks:t,node:a,selected:n}){let r=Pe(a,e);return(0,s.jsx)("div",{className:`graview-spec graview-spec-${e}`,"data-graview-spec":e,"data-graview-kind":a.kind,...e==="row"&&t.some(it)?{"data-graview-tall":""}:{},...n?{"data-selected":""}:{},children:(0,s.jsx)(Ce,{blocks:t,ctx:r,view:`${a.kind}.${e}`})})}function pn({blocks:e,node:t,selected:a,flagged:n}){let r=Pe(t),[d,...i]=e,c=d?.t==="title";return(0,s.jsx)(J,{...c?{title:Q([d],r)[0].text}:{},selected:a,tone:n?"warning":"muted",fit:!0,children:(0,s.jsx)("div",{className:"graview-spec graview-spec-card","data-graview-spec":"card","data-graview-kind":t.kind,children:(0,s.jsx)(Ce,{blocks:c?i:e,ctx:r,view:`${t.kind}.card`})})})}function gn({blocks:e,props:t}){let a=t.node,n=Pe(a,"page"),r=bt(),d=Q(e,n),i=ce(e,d),c=i.title!==void 0&&(!r||i.title===T(n.schema?.tryDefinition(a.kind),a)),p=(0,s.jsx)("div",{className:"graview-spec graview-spec-page","data-graview-spec":"page","data-graview-kind":a.kind,children:(0,s.jsx)(Rt,{blocks:c?d.slice(1):d,ctx:n,view:`${a.kind}.page`})});return r?p:(0,s.jsx)(oe.Provider,{value:{nodeId:a.id,...i.title!==void 0?{title:i.title}:{},body:p,fields:i.fields,records:i.records},children:(0,s.jsx)(xt,{...t})})}function aa(e,t,a){return typeof e=="function"?e.says?.(t,a):void 0}function mn({blocks:e,node:t,selected:a}){let{store:n}=N();return(0,s.jsx)("div",{title:T(n.schema.tryDefinition(t.kind),t),style:{minWidth:0,maxWidth:"100%"},children:(0,s.jsx)(un,{slot:"row",blocks:e,node:t,selected:a})})}function ia(e,t,a){if(!a)return e;let n=new Set(t.kinds);for(let[r,d]of Object.entries(a)){if(!n.has(r)||!d)continue;let i=r;if(d.card){let c=ae(d.card),p=u=>u.node?(0,s.jsx)(pn,{blocks:c,node:u.node,selected:u.selected,flagged:u.flagged?.includes(u.node.id)??!1}):null;e.register(i,{cardinality:"one",fidelity:"summary"},p)}if(d.row){let c=ae(d.row),p=u=>u.node?(0,s.jsx)(mn,{blocks:c,node:u.node,selected:u.selected}):null;p.says=(u,l)=>ce(c,Q(c,ie({graph:l,schema:t},null,u,{slot:"row"}))),e.register(i,{cardinality:"one",fidelity:"glyph"},p)}if(d.page){let c=ae(d.page),p=u=>u.node?(0,s.jsx)(gn,{blocks:c,props:u}):null;p.says=(u,l)=>ce(c,Q(c,ie({graph:l,schema:t},null,u))),e.register(i,{cardinality:"one",fidelity:"full"},p)}}return e}export{mt as a,It as b,St as c,Kn as d,Nt as e,sn as f,ln as g,Ne as h,$t as i,na as j,aa as k,ia as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as z}from"./chunk.ACZGK7LQ.js";import{E as N,R as O,ba as T,ca as m,d as B,ea as b,oa as V,qa as $}from"./chunk.4JSMCNF7.js";import{A,Ya as F,fa as D,ha as R,pb as P,qb as j}from"./chunk.Y235YZSZ.js";import{a as w,b as K}from"./chunk.MRK6QJV5.js";import{b as y}from"./chunk.AJZBJBMO.js";var G=y(w(),1);var g=y(K(),1);function L(n){let e=n?.hint;return typeof e=="string"&&e.length>0?e:void 0}function J(n){if(n instanceof Error&&n.message)return n.message;let e=String(n);return e==="[object Object]"?"The view threw without a message.":e}var C=class extends G.Component{static contextType=V;state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,e,t.componentStack),this.context?.(e,{module:"@graview/react"})}render(){let{error:e}=this.state;if(!e)return this.props.children;let t=L(e);return(0,g.jsxs)("div",{role:"alert","data-graview-view-error":this.props.kind,style:{display:"flex",flexDirection:"column",gap:"0.375rem",padding:"var(--graview-pad, 12px)",height:"100%",overflow:"auto",boxSizing:"border-box",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)",font:"var(--graview-font-body, 13px/1.45 system-ui)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,g.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.kind}),(0,g.jsx)("span",{children:J(e)}),t?(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:t}):null]})}};var I=y(w(),1);function Q(){return m().activity}function X(n){let{noteAttention:e,noteSeat:t}=m();(0,I.useEffect)(()=>n.onCall(r=>{let i=n.author??{kind:"agent"},s=r.args?.said;r.phase==="ok"&&typeof s=="string"&&s.length>0&&t({type:"said",author:i,say:s}),!(r.phase!=="ok"||!r.reads||r.reads.length===0)&&e({reads:r.reads,author:i,intent:`read ${r.name}`})}),[n,e,t])}var l=y(w(),1);function Y(n,{units:e,target:t=0,legibleAt:r=260}){let[i,s]=(0,l.useState)(e);(0,l.useEffect)(()=>{let o=n.current;if(o===null||typeof ResizeObserver>"u")return;let a=new ResizeObserver(([c])=>{let u=c?.contentRect.width??0;u>0&&s(u)});return a.observe(o),()=>a.disconnect()},[n]);let d=i/e;return{scale:d,width:i,touchable:d*t>=24,legible:i>=r}}function Z(n="--graview-font-body",e="sans-serif"){let t=(0,l.useRef)(void 0),r=(0,l.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return e;let i=getComputedStyle(document.documentElement).getPropertyValue(n).trim();return i.length>0?i:e},[n,e]);return(0,l.useMemo)(()=>{t.current===void 0&&(t.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let i=t.current;return i===null?O:(s,d)=>{i.font=`${d}px ${r}`;let o=i.measureText(s).width;return o>0?o:O(s,d)}},[r])}function me(n,e,t){let[r,i]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(document.fonts?.ready??Promise.resolve()).then(()=>i(!0))},[]),(0,l.useMemo)(()=>{let s=n.current,d=r&&s?document.createElement("canvas").getContext("2d"):null;if(d)return d.font=`600 ${.8125*e}px ${getComputedStyle(s).fontFamily}`,d.measureText("M").width>0?o=>d.measureText(o).width:void 0},[r,e,t])}var ee=(0,l.createContext)(void 0);function ne(){return(0,l.useContext)(ee)}function W(n,e){let t=n.graph.getNode(e);if(!t)return[];let r=t.kind,i=n.schema.tryDefinition(r);if(!i)return[];let s=new Map;for(let d of n.allMutations()){let o=d.subject;if(!o||!(o.kinds==="*"||o.kinds.includes(r)))continue;let c=d.input.shape??{};for(let u of F(d,i)){let p=u in c,h=[];for(let f of Object.keys(c)){if(f===o.arg||f===u||te(c[f]))continue;let x=D(d.input).find(v=>v.name===f);h.push({name:f,...x?{kinds:x.kinds}:{},...x?{candidates:x.kinds.includes("*")?n.graph.allNodes().map(v=>v.id):x.kinds.flatMap(v=>n.graph.nodesOfKind(v).map(H=>H.id))}:{},shape:R(d.input,f)})}let E={field:u,mutation:d.name,title:d.title??d.name,shape:p?R(d.input,u):{type:"unknown"},takesValue:p,alternatives:[],open:h,call:f=>({name:d.name,args:p?{[o.arg]:e,[u]:f}:{[o.arg]:e}})};s.set(u,[...s.get(u)??[],E])}}return[...s.values()].map(d=>{let o=[...d.filter(u=>u.takesValue),...d.filter(u=>!u.takesValue)],[a,...c]=o;return{...a,alternatives:c}})}function te(n){let e=A(n)?.type;return e==="optional"||e==="default"||e==="nullable"}var k=y(w(),1);function oe(n){let{store:e,principal:t}=m(),r=b(),i=(0,k.useMemo)(()=>n===null?[]:W(e,n),[e,n,r]),s=(0,k.useCallback)((d,o,a={})=>{let c=d.call(o);e.apply({name:c.name,args:{...c.args,...a}},{author:t})},[e,t]);return{fields:i,commit:s}}var S=y(w(),1);function re(){let n=$();return(0,S.useMemo)(()=>[...new Set(n.flatMap(e=>e.nodeIds))],[n])}function ie(){let n=U(),e=T();return(0,S.useMemo)(()=>{if(!e)return n;let t=e.matched;return t.length===0&&n.length===0?[q]:[...new Set([...n,...t])]},[e,n])}function U(){let{store:n,selection:e}=m(),t=b();return(0,S.useMemo)(()=>{if(e.length===0)return[];let r=new Set(e),i=new Set(r);for(let s of n.graph.allEdges())r.has(s.from)&&i.add(s.to),r.has(s.to)&&i.add(s.from);for(let s of n.violations())if(s.subjectId!==void 0&&r.has(s.subjectId))for(let d of s.nodeIds)i.add(d);return[...i]},[n,e,t])}var q="search:nothing";var _=y(w(),1);function ae(){let{brand:n}=m(),e=n?.kit;return(0,_.useMemo)(()=>P(e),[e])}function se(n,e){let t=j(n,e),r={...t.color!==void 0?{color:t.color}:{},...t.pattern!==void 0?{pattern:t.pattern}:{},...t.width!==void 0?{width:t.width}:{},...t.cap!==void 0?{cap:t.cap}:{},...t.opacity!==void 0?{opacity:t.opacity}:{}};return{connector:t,style:z(e,{[e]:r})}}var M=3;function de(n){let e=B(n),t=e.focusId;if(!t)return null;if(e.within?.view){let[i]=N(t);if(i)return{at:`screen:${i}`,audience:!0}}return{at:t,audience:!1}}function Ae(n,e,t){let r=[],i=new Map,s=new Map,d=0;for(let o of n){let a=de(o.stop),c=a?e(a.at):null;if(!a||!c){o.name&&r.push({kind:"edge",presence:o,point:{x:t-8,y:40+d++*28}});continue}if(!o.name){let f=s.get(a.at);s.set(a.at,{n:(f?.n??0)+1,box:c});continue}let u=i.get(a.at)??[];if(u.push(o),i.set(a.at,u),u.length>M)continue;let p=c,h=u.length-1,E=a.audience?{x:p.x+p.width*.5+(h-1)*26,y:p.y+Math.min(p.height,24)}:{x:p.x+p.width*.5-26-h*22,y:p.y+p.height-4};r.push({kind:"person",presence:o,point:E,at:a.at,index:h,of:u.length,audience:a.audience})}for(let[o,a]of i){if(a.length<=M)continue;let c=e(o);c&&r.push({kind:"count",at:o,point:{x:c.x+c.width*.5+2*26+18,y:c.y+c.height-4},n:a.length-M})}for(let[o,{n:a,box:c}]of s)r.push({kind:"count",at:o,point:{x:c.x+c.width*.5+40,y:c.y+c.height-4},n:a});for(let o of n)if(o.name){if(o.robot?.at&&o.robot.mode!=="docked"){let a=e(o.robot.at);a&&r.push({kind:"robot",presence:o,point:{x:a.x+a.width/2+22,y:a.y+a.height-4},mode:o.robot.mode})}if(o.over){let a=e(o.over);a&&r.push({kind:"over",presence:o,box:a})}}return r}export{Q as a,X as b,Y as c,Z as d,me as e,ee as f,ne as g,oe as h,re as i,ie as j,U as k,ae as l,se as m,Ae as n,C as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as ge}from"./chunk.ZFUQA3KT.js";import{I as _,Ja as G,K as M,L as J,N as re,O as se,Q as W,R as ae,S as B,T as K,Ua as pe,W as de,ea as ce,fa as P,ga as le,ha as j,ia as ue,ua as fe,zb as he}from"./chunk.Y235YZSZ.js";function me(e){let t=new Set;for(let n=e;n;n=n.onBehalfOf)n.id!==void 0&&t.add(`${n.kind}:${n.id}`);return t}function F(e,t){let n=me(t),u=p=>{if(p.kind==="rule")return!1;let d=me(p);if(d.size===0)return!1;for(let g of d)if(n.has(g))return!1;return!0},f,c=()=>{if(f)return f;f=new Map;for(let p of e.log.live()){if(p.undoes!==void 0)continue;let d=u(p.author)?p.author:void 0;for(let g of p.primitives){g.op==="remove-node"&&f.delete(g.node.id);let s=g.op==="add-node"?g.node.id:g.op==="patch-node"?g.id:void 0;if(s===void 0)continue;let a=g.op==="add-node"?Object.keys(g.node):Object.keys(g.after),h=f.get(s);(g.op==="add-node"||!h)&&f.set(s,h=new Map);for(let y of a)y==="id"||y==="kind"||(d?h.set(y,d):h.delete(y))}}return f},S=e.schema,v=new Map,i=(p,d)=>{let g=`${p}\0${d}`,s=v.get(g);if(s===void 0){let a=S.tryDefinition(p)?.fields?.shape;s=a!==void 0&&d in a&&le(a[d]).type==="text",v.set(g,s)}return s},l=p=>e.graph.getNode(p)?.kind;return{prose:i,say:p=>de(p,{graph:e.graph,schema:S}),fieldBy(p,d){let g=l(p);if(!(g===void 0||!i(g,d)))return c().get(p)?.get(d)},recordBy(p){let d=l(p),g=c().get(p);if(d===void 0||!g)return;let s;for(let[a,h]of g)i(d,a)&&(s=h);return s}}}var E=(e,t,n)=>({untrusted:!0,authoredBy:n.say(t),text:e});function z(e,t){let n;for(let[u,f]of Object.entries(e)){if(typeof f!="string"||u==="id"||u==="kind")continue;let c=t.fieldBy(e.id,u);c&&(n??={...e},n[u]=E(f,c,t))}return n??e}function ye(e,t,n){let u=f=>{if(Array.isArray(f))return f.map(u);if(f!==null&&typeof f=="object"&&"id"in f&&"label"in f){let c=f,S=n.recordBy(c.id);return S?{...c,label:E(c.label,S,n)}:c}if(typeof f=="string"){let c=n.recordBy(e);return c?E(f,c,n):f}return f};return Object.fromEntries(Object.entries(t).map(([f,c])=>[f,u(c)]))}function ke(e,t){return{...e,nodes:e.nodes.map(n=>z(n,t))}}function we(e,t){return{...e,hits:e.hits.map(n=>{if(n.about!=="node")return n;let u=t.recordBy(n.id);if(!u)return n;let f=t.prose(n.kind,n.why.field)?t.fieldBy(n.id,n.why.field):u;return{...n,label:E(n.label,u,t),...n.apart!==void 0?{apart:E(n.apart,u,t)}:{},why:f?{...n.why,fragment:E(n.why.fragment,f,t)}:n.why}})}}function be(){return{name:"insight",derive({store:e,nodes:t,kindSelection:n}){let u=[],f=c=>_(e.schema.tryDefinition(c.kind),c);for(let c of t){if([...e.schema.edgeKinds].reduce((v,i)=>v+e.graph.out(c.id,i).length+e.graph.in(c.id,i).length,0)===0){u.push({id:`insight:island:${c.id}`,text:`${f(c)} is connected to nothing yet`,nodeIds:[c.id]});continue}for(let v of e.schema.edgeKinds){let i=e.graph.in(c.id,v).length;if(i<3)continue;let l=[...e.graph.allEdges()].filter(d=>d.kind===v),p=l.length;p>=4&&i/p>.6&&u.push({id:`insight:load:${c.id}:${v}`,text:`${f(c)} ${Ee(e,l,v,i)}`,nodeIds:[c.id]})}}for(let c of n){if(e.graph.nodesOfKind(c).length>0)continue;let S=e.schema.definitions.filter(v=>v.kind!==c).filter(v=>Object.values(v.edges).some(i=>i.to!=="*"&&i.to.includes(c))).map(v=>v.plural??`${v.kind}s`);S.length>0&&u.push({id:`insight:gap:${c}`,text:`Nothing here yet, though ${S.join(" and ")} expect to connect to these`,nodeIds:[]})}return{observations:u}}}}function Ee(e,t,n,u){let f=new Set(t.map(l=>e.graph.getNode(l.from)?.kind).filter(l=>l!==void 0)),c=f.size===1?[...f][0]:void 0,S=t.length,v=W(e.schema,c??[...f][0]??"",n,"in"),i=l=>c?re(e.schema,c,l):String(l);return u===S?`${v}: all ${i(u)}`:`${v}: ${u} of the ${i(S)}`}function ve(e){let t=new Map;if(e.length===0)return t;let n=e.slice(-512),u=new Set;for(let c of n)c.undoes&&u.add(c.undoes);let f=e[e.length-1].seq;for(let c of n){if(!c.mutation||u.has(c.id))continue;let S=Math.pow(.5,(f-c.seq)/64);t.set(c.mutation.name,(t.get(c.mutation.name)??0)+S)}return t}function Se(e){return 8*(e/(e+1))}var Ce=100;function Ae(){return{name:"invariant",derive({store:e,selection:t,nodes:n,violations:u}){let f=l=>_(e.schema.tryDefinition(l.kind),l),c=new Set(t),S=u.filter(l=>l.nodeIds.some(p=>c.has(p))||l.subjectId!==void 0&&c.has(l.subjectId)),v=[],i=[];S.forEach((l,p)=>{i.push({id:`violation:${l.invariant}:${p}`,text:l.message,nodeIds:l.nodeIds}),l.repairs.forEach((d,g)=>{v.push({id:`invariant:${l.invariant}:${p}:${g}`,label:d.label,provider:"invariant",mutation:d.mutation,args:d.args??{},open:(d.missing??[]).map(s=>{let a=e.allMutations().find(o=>o.name===d.mutation);if(!a)return{name:s};let h=P(a.input).find(o=>o.name===s),y=h?h.kinds.includes("*")?e.graph.allNodes().map(o=>o.id):h.kinds.flatMap(o=>e.graph.nodesOfKind(o).map(r=>r.id)):void 0;return{name:s,shape:j(a.input,s),...h?{kinds:h.kinds}:{},...y?{candidates:y}:{}}}),score:Ce-g-(d.missing?.length??0),why:l.message,nodeIds:l.nodeIds,...l.subjectId===void 0?{}:{subjectId:l.subjectId}})})});for(let l of n){let p=e.allInvariants().filter(d=>{if(d.scope==="graph")return!1;let g=d.scope;return g.kind!==l.kind?!1:g.match?g.match(l):!0});p.length!==0&&(S.some(d=>d.subjectId===l.id||d.nodeIds.includes(l.id))||i.push({id:`holds:${l.id}`,text:`${f(l)} holds \u2014 nothing currently breaks ${p.length===1?"it":`any of its ${p.length} rules`}`,nodeIds:[l.id]}))}return{affordances:v,observations:i}}}}var Z=40;function $e(){return{name:"schema",derive({store:e,selection:t,nodes:n,kindSelection:u,edgeSelection:f}){let c=[];if(n.length===0&&f.length>0){for(let i of f){let l=e.graph.getNode(i.from),p=e.graph.getNode(i.to);if(!(!l||!p))for(let d of e.allMutations()){let g=(d.connects??[]).includes(i.kind),s=(d.severs??[]).includes(i.kind);if(!g&&!s)continue;let a={},h=[],y=P(d.input);for(let r of y){let w=r.kinds.includes("*")||r.kinds.includes(l.kind),b=r.kinds.includes("*")||r.kinds.includes(p.kind),A=w&&!y.some(k=>k!==r&&(k.kinds.includes(l.kind)||k.kinds.includes("*")));w&&!b?a[r.name]=i.from:b&&!w?a[r.name]=i.to:w&&b&&A?a[r.name]=i.from:h.push({name:r.name,kinds:r.kinds,candidates:[i.from,i.to],shape:j(d.input,r.name)})}for(let r of q(d.input,""))r in a||h.some(w=>w.name===r)||h.push({name:r,shape:j(d.input,r)});h.every(r=>r.optional===!0?!0:r.kinds!==void 0?(r.candidates?.length??0)>0:(r.candidates?.length??0)>0||r.shape!==void 0&&r.shape.type!=="unknown")&&(g&&!s&&h.length===0||c.push({id:`schema:edge:${d.name}:${i.kind}:${i.from}:${i.to}`,label:M(d),provider:"schema",mutation:d.name,args:a,open:h,...d.destructive?{destructive:!0}:{},score:(s?62:58)-h.length,why:`this line is "${W(e.schema,e.graph.getNode(i.from)?.kind??"",i.kind,"out")}"`,nodeIds:[i.from,i.to]}))}}return{affordances:c}}if(n.length===0&&u.length>0){let i=new Set(u),l=[];for(let p of e.allMutations()){if(!(p.creates??[]).some(s=>i.has(s)))continue;let d=[];for(let s of P(p.input)){let a=s.kinds.includes("*")?e.graph.allNodes().map(h=>h.id):s.kinds.flatMap(h=>e.graph.nodesOfKind(h).map(y=>y.id));d.push({name:s.name,kinds:s.kinds,candidates:a,shape:j(p.input,s.name),...s.optional?{optional:!0}:{}})}for(let s of q(p.input,""))d.some(a=>a.name===s)||d.push({name:s,shape:j(p.input,s)});if(!d.every(s=>s.optional===!0?!0:s.kinds!==void 0?(s.candidates?.length??0)>0:(s.candidates?.length??0)>0||s.shape!==void 0&&s.shape.type!=="unknown")){let s=d.filter(a=>a.optional!==!0&&a.kinds!==void 0&&!a.kinds.includes("*")&&(a.candidates?.length??0)===0);if(s.length>0){let a=[...new Set(s.flatMap(h=>h.kinds??[]))].map(h=>B(K(e.schema.tryDefinition(h),h)));l.push({id:`schema:waits:${p.name}`,text:`"${p.title??p.name}" cannot begin until there is ${a.length===1?a[0]:`${a.slice(0,-1).join(", ")} and ${a[a.length-1]}`}.`,nodeIds:[]})}continue}c.push({id:`schema:add:${p.name}`,label:M(p),provider:"schema",mutation:p.name,args:{},open:d,score:Z-d.length,why:`this makes ${(p.creates??[]).filter(s=>i.has(s)).map(s=>B(K(e.schema.tryDefinition(s),s))).join(", ")}`,nodeIds:[]})}return{affordances:c,observations:l}}if(n.length===0)return{};let S=new Set(n.map(i=>i.kind)),v=(i,l,p)=>{let d=[];for(let g of e.graph.allEdges()){if(!l.includes(g.kind))continue;let s=g.from===i?g.to:g.to===i?g.from:null;if(!s)continue;let a=e.graph.getNode(s);a&&(!p.includes("*")&&!p.includes(a.kind)||d.includes(s)||d.push(s))}return d};for(let i of e.allMutations()){let l=i.subject;if(!l||!(l.kinds==="*"?!0:[...S].every(o=>l.kinds.includes(o))))continue;let d=n.length===1?n[0].id:null,g=i.severs??[],s=i.connects??[];if(d&&g.length>0&&s.length===0&&v(d,g,["*"]).length===0)continue;let a=[];for(let o of P(i.input)){if(o.name===l.arg)continue;let r=o.kinds.includes("*")?e.graph.allNodes().map(w=>w.id):o.kinds.flatMap(w=>e.graph.nodesOfKind(w).map(b=>b.id));if(d&&s.length>0){let w=new Set(v(d,s,o.kinds));r=r.filter(b=>!w.has(b))}else d&&g.length>0&&(r=v(d,g,o.kinds));a.push({name:o.name,kinds:o.kinds,candidates:r.filter(w=>!t.includes(w)),shape:j(i.input,o.name),...o.optional?{optional:!0}:{}})}for(let o of q(i.input,l.arg))a.some(r=>r.name===o)||a.push({name:o,shape:j(i.input,o)});if(a.length===0&&d){let o=He(i.input,l.arg);if(o.length>0&&!Le(e,i.name,{[l.arg]:d}))for(let r of o){let w=P(i.input).find(b=>b.name===r);a.push({name:r,optional:!0,...w?{kinds:w.kinds}:{},shape:j(i.input,r)})}}if(!a.every(o=>o.optional===!0?!0:o.kinds!==void 0?(o.candidates?.length??0)>0:(o.candidates?.length??0)>0||o.shape!==void 0&&o.shape.type!=="unknown"))continue;let y=n.map(o=>({[l.arg]:o.id}));a.length===0&&!y.some(o=>e.wouldChange({name:i.name,args:o}))||c.push({id:`schema:${i.name}`,label:n.length>1?`${M(i)} (${n.length})`:M(i),provider:"schema",mutation:i.name,args:y[0]??{},open:a,...i.destructive?{destructive:!0}:{},...g.length>0||s.length>0?{ties:!0}:{},...n.length>1?{batch:y}:{},score:Z-a.length,why:n.length>1?`all ${n.length} selected nodes are ${[...S].map(o=>se(e.schema,o).toLowerCase()).join(" or ")}`:`this is ${B(K(e.schema.tryDefinition(n[0].kind),n[0].kind))}`,nodeIds:n.map(o=>o.id)})}if(n.length===1){let i=n[0];for(let l of e.allMutations()){let p=l.subject,d=l.severs??[],g=l.connects??[];if(!p||d.length===0&&g.length===0)continue;let s=p.kinds==="*"?"*":p.kinds;if(s==="*"||s.includes(i.kind))continue;let a=P(l.input),h=a.find(k=>k.name!==p.arg&&(k.kinds.includes("*")||k.kinds.includes(i.kind)));if(!h)continue;let y=s,o=y.includes("*")?e.graph.allNodes().map(k=>k.id):y.flatMap(k=>e.graph.nodesOfKind(k).map(R=>R.id)),r=new Set(v(i.id,g.length>0?g:d,y)),w=g.length>0?o.filter(k=>!r.has(k)):o.filter(k=>r.has(k));if(w.length===0)continue;let b=[{name:p.arg,kinds:y,candidates:w,shape:j(l.input,p.arg)}];for(let k of a){if(k.name===h.name||k.name===p.arg)continue;let R=k.kinds.includes("*")?e.graph.allNodes().map(x=>x.id):k.kinds.flatMap(x=>e.graph.nodesOfKind(x).map(O=>O.id));b.push({name:k.name,kinds:k.kinds,candidates:R,shape:j(l.input,k.name),...k.optional?{optional:!0}:{}})}for(let k of q(l.input,h.name))k===p.arg||b.some(R=>R.name===k)||b.push({name:k,shape:j(l.input,k)});b.every(k=>k.optional===!0?!0:k.kinds!==void 0?(k.candidates?.length??0)>0:(k.candidates?.length??0)>0||k.shape!==void 0&&k.shape.type!=="unknown")&&c.push({id:`schema:tie:${l.name}:${i.id}`,label:l.fromTheOtherEnd??M(l),provider:"schema",mutation:l.name,args:{[h.name]:i.id},open:b,ties:!0,...l.destructive?{destructive:!0}:{},score:Z-b.length+2,why:`${d.length>0?"this one is on":"this one could join"} ${b[0].candidates.length===1?"it":"one of these"}`,nodeIds:[i.id]})}}return{affordances:c}}}}function He(e,t){let n=e.shape;return n?Object.entries(n).filter(([u,f])=>u!==t&&f.safeParse(void 0).success).map(([u])=>u):[]}function Le(e,t,n){try{return e.preview({name:t,args:n}),!0}catch{return!1}}function q(e,t){let n=e.shape;return n?Object.entries(n).filter(([u,f])=>u!==t&&!f.safeParse(void 0).success).map(([u])=>u):[]}var We=70,Be=80,Ke=new Set(["id","kind"]);function Oe(){return{name:"structure",derive({store:e,nodes:t}){let n=i=>_(e.schema.tryDefinition(i.kind),i);if(t.length<2)return{};let u=[],f=[],c=t.map(i=>i.id);for(let i of e.schema.edgeKinds){let l=Ge(t.map(d=>new Set([...e.graph.out(d.id,i).map(g=>g.id),...e.graph.in(d.id,i).map(g=>g.id)])));for(let d of l){let g=e.graph.getNode(d);g&&u.push({id:`shared:${i}:${d}`,text:`all ${t.length} share "${n(g)}" (${J(i).toLowerCase()})`,nodeIds:[...c,d]})}let p=new Map;for(let d of t)for(let g of[...e.graph.out(d.id,i),...e.graph.in(d.id,i)])p.set(g.id,(p.get(g.id)??0)+1);for(let[d,g]of p){if(g!==t.length-1||t.length<3)continue;let s=e.graph.getNode(d);if(!s)continue;let a=t.find(h=>![...e.graph.out(h.id,i),...e.graph.in(h.id,i)].some(y=>y.id===d));if(a){u.push({id:`near-shared:${i}:${d}`,text:`all but "${n(a)}" share "${n(s)}" (${J(i).toLowerCase()})`,nodeIds:[...c,d]});for(let h of e.allMutations()){let y=h.subject;if(!y||y.kinds!=="*"&&!y.kinds.includes(a.kind))continue;let o=Fe(h.input,s.kind);o&&f.push({id:`structure:join:${h.name}:${a.id}:${d}`,label:`${M(h)}: bring "${n(a)}" in line with the others`,provider:"structure",mutation:h.name,args:{[y.arg]:a.id,[o]:d},open:[],score:We,why:`every other selected node is connected to "${n(s)}"`,nodeIds:[a.id,d]})}}}}let S=new Set;for(let i of t)for(let l of Object.keys(i))Ke.has(l)||S.add(l);let v=i=>e.schema.definitions.find(l=>l.kind===i);for(let i of[...S].sort()){let l=v(t[0].kind),p=ae(l,i).toLowerCase(),d=l?.display?.format?.[i],g=A=>{if(!d)return A;try{return String(d(JSON.parse(A)))}catch{return A}},s=t.map(A=>A[i]),a=new Map;if(s.forEach((A,k)=>{let R=JSON.stringify(A??null),x=a.get(R);x?x.push(t[k]):a.set(R,[t[k]])}),a.size===1){let A=[...a.keys()][0];if(A==="null")continue;u.push({id:`agree:${i}`,text:`all ${t.length} share the ${p} ${g(A)}`,nodeIds:c});continue}if(t.length<3||a.size!==2)continue;let h=[...a.entries()].sort((A,k)=>k[1].length-A[1].length),[y,o]=h[0],[,r]=h[1];if(r.length!==1||y==="null")continue;let w=r[0],b=JSON.parse(y);u.push({id:`odd-one-out:${i}`,text:`${o.length} share the ${p} ${g(y)}; "${n(w)}" does not`,nodeIds:c});for(let A of e.allMutations()){let k=A.subject;if(!k||k.kinds!=="*"&&!k.kinds.includes(w.kind))continue;let R=Re(A.input);if(!R||!(i in R))continue;let x={[k.arg]:w.id,[i]:b},O=!0;for(let[D,U]of Object.entries(R)){if(D in x||U.safeParse(void 0).success)continue;let C=w[D];if(C===void 0){O=!1;break}x[D]=C}O&&f.push({id:`structure:align:${A.name}:${i}:${w.id}`,label:`Align the ${p} of "${n(w)}" with the other ${o.length}`,provider:"structure",mutation:A.name,args:x,open:[],score:Be,why:`${o.length} of ${t.length} share the ${p} ${g(y)}`,nodeIds:c})}}return{affordances:f,observations:u}}}}function Ge(e){if(e.length===0)return[];let[t,...n]=e;return[...t].filter(u=>n.every(f=>f.has(u))).sort()}function Re(e){return e.shape??null}function Fe(e,t){let n=Re(e);if(!n)return null;for(let[u]of Object.entries(n)){let f=ce(n[u]);if(f&&(f.includes("*")||f.includes(t)))return u}return null}function qe(){return[Ae(),Oe(),$e(),be()]}function je(e,t,n={}){let u=xe(),f=n.providers??qe(),c=t.map(m=>e.graph.getNode(m)).filter(m=>m!==void 0),S={store:e,selection:t,nodes:c,kindSelection:n.kindSelection??[],edgeSelection:n.edgeSelection??[],violations:e.violations(n.context),context:n.context??{}},v=[],i=[];for(let m of f){let $=m.derive(S);v.push(...$.affordances??[]),i.push(...$.observations??[])}let l=new Set(e.allMutations().filter(m=>m.pinned).map(m=>m.name)),p=new Set(n.pins?.pinned??[]),d=new Set(n.pins?.unpinned??[]),g=m=>p.has(m.mutation)?"user":l.has(m.mutation)&&!d.has(m.mutation)?"declared":void 0,s=m=>{let $=g(m);return $?{...m,pinned:$}:m},a=new Map;for(let[m,$]of ve(e.log.all()))a.set(m,Se($));let h=m=>m.pinned==="user"?0:m.pinned==="declared"?1:2,y=m=>m.score+(a.get(m.mutation)??0),o=new Map(e.allMutations().map(m=>[m.name,m])),r=new Map,w=m=>{let $=o.get(m.mutation);if(!$)return[];let N=r.get(m.mutation);N||(N=P($.input).map(V=>V.name),r.set(m.mutation,N));let H=[];for(let V of m.batch??[m.args])for(let ie of N){let oe=V[ie]??m.args[ie];typeof oe=="string"&&H.push(oe)}return H},b=n.focus,A=4,k=m=>m.open.length>0?1:0,R=m=>{if(b===void 0)return A;let $=w(m);return $.length>0?$.includes(b)?x(m,0):A:m.nodeIds.includes(b)||m.subjectId===b?x(m,1):A},x=(m,$)=>m.provider==="invariant"?$:2+k(m),O=Ue(v).map(s),D=new Map(O.map((m,$)=>[m,$])),U=O.sort((m,$)=>{let N=Number(m.destructive??!1)-Number($.destructive??!1);if(N!==0)return N;let H=R(m)-R($);return H!==0?H:R(m)<2?D.get(m)-D.get($):+($.provider==="invariant")-+(m.provider==="invariant")||h(m)-h($)||y($)-y(m)||m.id.localeCompare($.id)}),C=n.principal??{kind:"human"},L=[],ne=[];for(let m of U){let $=e.permits({name:m.mutation,args:{...m.args,...m.batch?.[0]??{}}},C);if($.ok)L.push(m);else{let N=ze(e,m,C);if(N==="done")continue;N?L.push(N):ne.push({...m,refusal:$.refusal})}}let te=L.map((m,$)=>({...m,rank:$})),_e=ne.map((m,$)=>({...m,rank:L.length+$}));return{affordances:n.limit===void 0?te:te.slice(0,n.limit),withheld:_e,observations:Ve(i),ms:xe()-u}}function Ue(e){let t=new Map;for(let n of e){let u=[n.mutation,JSON.stringify(n.args),JSON.stringify(n.batch??null)].join("|"),f=t.get(u);(!f||n.score>f.score)&&t.set(u,n)}return[...t.values()]}function Ve(e){let t=new Map;for(let n of e)t.set(n.text,n);return[...t.values()]}function xe(){return typeof performance<"u"?performance.now():Date.now()}function Je(e,t,n={},u={}){let f=(t.batch??[t.args]).map(S=>({name:t.mutation,args:{...t.args,...S,...n}})),c=e.allMutations().find(S=>S.name===t.mutation);return e.applyAll(f,{...c?.describe?{}:{intent:t.label},...u.author?{author:u.author}:{}})}function Rn(e,t,n={}){return e.preview({name:t.mutation,args:{...t.args,...n}})}function ze(e,t,n){let u=e.allMutations().find(i=>i.name===t.mutation)?.subject;if(!u||t.args[u.arg]!==void 0)return;let f=t.open.find(i=>i.name===u.arg);if(!f?.candidates)return;let c=i=>e.permits({name:t.mutation,args:{...t.args,...t.batch?.[0]??{},[u.arg]:i}},n).ok,S=f.candidates.filter(c),v=n.id===void 0?void 0:e.graph.getNode(n.id);return S.length===0?v!==void 0&&(u.kinds==="*"||u.kinds.includes(v.kind))&&c(v.id)?"done":void 0:S.length===1&&S[0]===n.id?{...t,args:{...t.args,[u.arg]:n.id},open:t.open.filter(i=>i!==f)}:{...t,open:t.open.map(i=>i===f?{...i,candidates:S}:i)}}var Pe,Ze=()=>Pe??=import("./chunk.7YC34AIK.js").catch(e=>{throw Pe=void 0,e}),Xe=()=>import("./chunk.5MAMCKVU.js").catch(()=>{}),Ye=async()=>{(await Xe())?.judgeWithLines()},Ne,Qe=()=>Ne??=import("./chunk.M4XNUM2A.js").catch(e=>{throw Ne=void 0,e}),T=e=>({title:e,readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}),X=[{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; 20 when unsaid."},subject:{type:"string",description:"A node id whose acts to include."}},required:["query"],additionalProperties:!1},mutating:!1,annotations:T("Find by name")},{name:"get_graph",title:"Read the whole graph",description:"Read the whole graph: every node with its fields, and every edge. Start here when you need the shape of the domain rather than one thing in it.",inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:T("Read the whole graph")},{name:"get_node",title:"Read one node",description:"Read one node, its edges, and the violations that implicate it, with 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."}},required:["id"],additionalProperties:!1},mutating:!1,annotations:T("Read one node")},{name:"get_violations",title:"List the problems",description:"List every invariant violation the graph currently has, 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:{context:{type:"object",description:"Evaluation context, e.g. { weekStart }."}},additionalProperties:!1},mutating:!1,annotations:T("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:T("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:T("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:T("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}}],Y={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"]},Q={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:Y,current:Y},additionalProperties:!1},mutating:!1,annotations:T("Draw a view")},De={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:{...Y,additionalProperties:!1},mutating:!0,annotations:{title:"Keep a view as a lens",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}};function en(e,t){return e===void 0?[]:e==="keep"&&!t?[Q,De]:[Q]}var nn="An argument that names a record takes its id or its name.",Te=[...X.map(e=>e.name),Q.name,De.name],Ie=64;function I(e){let{line:t,...n}=e;return n}function Me(e){return{...e,...e.introduces?{introduces:e.introduces.map(I)}:{},...e.resolves?{resolves:e.resolves.map(I)}:{},...e.violationsAfter?{violationsAfter:e.violationsAfter.map(I)}:{}}}function tn(e){let t=e.normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^A-Za-z0-9_-]/g,"_");return t.length===0&&(t="act"),/^[A-Za-z_]/.test(t)||(t=`act_${t}`),t.slice(0,Ie)}function on(e){let t=new Set(Te),n=new Map;for(let u of e){let f=tn(u),c=f;for(let S=2;t.has(c);S+=1)c=`${f.slice(0,Ie-`_${S}`.length)}_${S}`;t.add(c),n.set(u,c)}return n}function rn(e,t){let n=ue(e),u=M(e),f=n.nodeRefs.length>0?`${n.description}${/[.!?]$/.test(n.description)?"":"."} ${nn}`:n.description;return{name:t,title:u,description:f,inputSchema:n.inputSchema,mutating:!0,annotations:{title:u,readOnlyHint:!1,destructiveHint:e.destructive===!0||(e.severs?.length??0)>0,idempotentHint:e.idempotent===!0,openWorldHint:!1},act:e.name}}function ee(e){if(e===null||typeof e!="object")return JSON.stringify(e)??"null";if(Array.isArray(e))return`[${e.map(ee).join(",")}]`;let t=e;return`{${Object.keys(t).filter(n=>t[n]!==void 0).sort().map(n=>`${JSON.stringify(n)}:${ee(t[n])}`).join(",")}}`}function sn(e){return`sha256:${he(ee(e))}`}function an(e,t,n,u){let f=on(e.map(v=>v.name)),c=en(u,n);return{definitions:n?[...X.filter(v=>!v.mutating),...c]:[...X,...c,...e.filter(v=>t.has(v.name)).map(v=>rn(v,f.get(v.name)))],names:f}}function Cn(e,t={}){let n=t.author??{kind:"agent"},u=e.allMutations(),f=new Set(e.permittedMutations(n).map(s=>s.name)),{definitions:c,names:S}=an(u,f,t.readOnly===!0,t.drafts?t.drafts.keep?"keep":"draw":void 0),v=sn(c),i=s=>{if(!Te.includes(s)){for(let[a,h]of S)if(h===s)return a;return S.has(s)?s:void 0}},l=(s,a)=>{let h=u.find(r=>r.name===s);if(!h)return{args:a,resolved:[]};let y={...a},o=[];for(let r of P(h.input)){let w=y[r.name];if(typeof w!="string"||w.trim()==="")continue;let b=e.resolveRef(r,w,n);if(!b.ok){let A=b.reason==="none"?` Nothing was changed. Use search_graph to look it up, then pass its id as ${r.name}.`:" Nothing was changed.";return{ok:!1,error:`${b.message}${A}`,argument:r.name,candidates:b.candidates}}b.by!=="id"&&(y[r.name]=b.id,o.push({argument:r.name,given:w,id:b.id,label:b.label}))}return{args:y,resolved:o}},p=async(s,a)=>{try{await Ye();let h=c.find(o=>o.name===s)??c.find(o=>o.act===s);if(!h){let o=i(s);if(o){let r=e.permits({name:o,args:a},n);if(!r.ok)return{ok:!1,error:r.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${s}". Available: ${c.map(r=>r.name).join(", ")}`}}if(h.mutating&&t.readOnly)return{ok:!1,error:`"${s}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(h.act!==void 0){let o=l(h.act,a);if("ok"in o)return o;let r=G(e,n,e.apply({name:h.act,args:o.args},{...t.author?{author:t.author}:{},...dn(t.via)}));return{ok:!0,data:{batch:r.batch,intent:r.intent,introduces:r.introduces.map(I),resolves:r.resolves.map(I),...o.resolved.length>0?{resolved:o.resolved}:{}},diff:r.diff}}let y=e.seenBy(n);switch(h.name){case"search_graph":{let o=typeof t.places=="function"?t.places():t.places,r=typeof a.subject=="string"?a.subject:void 0,w=pe(y,String(a.query??""),{principal:n,limit:typeof a.limit=="number"?a.limit:20,...o?{places:o}:{},...r?{subject:r,from:[r]}:{}});return{ok:!0,data:we(w,F(y,n)),reads:w.hits.flatMap(b=>b.about==="node"?[b.id]:[])}}case"get_graph":{let o=y.graph.snapshot();return{ok:!0,data:ke(o,F(y,n)),reads:o.nodes.map(r=>r.id)}}case"get_node":{let o=String(a.id??""),r=o,w;if(!y.graph.getNode(o)){let O=o.trim()===""?void 0:e.resolveRef({name:"id",kinds:["*"]},o,n);if(O?.ok)r=O.id,w={argument:"id",given:o,id:r,label:O.label};else return O?.reason==="ambiguous"?{ok:!1,error:O.message,argument:"id",candidates:O.candidates}:{ok:!1,error:`No node "${o}".`}}let b=y.graph.getNode(r),A=y.graph.outEdges(r),k=y.graph.inEdges(r),R=F(y,n),x=ge(y.schema,y.graph,b);return{ok:!0,data:{node:z(b,R),...Object.keys(x.values).length>0?{computed:ye(r,x.values,R)}:{},...Object.keys(x.refused).length>0?{uncomputed:x.refused}:{},out:A,in:k,violations:y.violations().filter(O=>O.nodeIds.includes(r)).map(I),...w?{resolved:[w]}:{}},reads:[r,...A.map(O=>O.to),...k.map(O=>O.from)]}}case"describe_place":{let o=t.app??{name:"",schema:e.schema},r=typeof a.width=="number"&&Number.isFinite(a.width)&&a.width>0?a.width:1440,{describePlace:w}=await Ze(),b=w(e,n,String(a.place??""),{app:o,width:r});if(!b.ok)return{ok:!1,error:`${b.error} The places are: ${b.places.join(", ")}.`};let A=new Set,k=R=>{for(let x of R)for(let O of x.groups??[])for(let D of O.items)A.add(D.id),k(D.parts)};return k(b.description.parts),{ok:!0,data:b.description,reads:[...A]}}case"draft_view":case"keep_lens":{let o=t.app??{name:"",schema:e.schema};return(await Qe()).runDraftTool(h.name,a,{app:o,principal:n,...t.drafts?{drafts:t.drafts}:{}})}case"get_violations":{let o=y.violations(a.context);return{ok:!0,data:o.map(I),reads:[...new Set(o.flatMap(r=>r.nodeIds))]}}case"get_affordances":{let o=a.selection??[];return{ok:!0,data:je(y,o,{...typeof t.derive=="function"?t.derive():t.derive,...t.author?{principal:t.author}:{},...a.context?{context:a.context}:{}}),reads:o.filter(w=>y.graph.has(w))}}case"preview_mutation":{let o=String(a.mutation),r=i(o)??o,w=l(r,a.args??{});if("ok"in w)return w;let b=e.missingFor({name:r,args:w.args},n);if(b)return{ok:!1,error:b.message,reason:"missing"};let A=G(e,n,e.preview({name:r,args:w.args},void 0,{author:n})),k=Me(A);return{ok:!0,data:w.resolved.length>0?{...k,resolved:w.resolved}:k}}case"undo_batch":{let o=String(a.batch),r=a.include??[],w=y.canUndo([o,...r]);if(!w.ok)return{ok:!1,error:w.message};let b=G(e,n,e.undo([o,...r],{...t.author?{author:t.author}:{}}));return{ok:!0,data:Me(b),diff:b.diff}}default:return{ok:!1,error:`Unknown tool "${s}".`}}}catch(h){let{reason:y,wouldNeed:o}=fe(h);return{ok:!1,error:h instanceof Error?h.message:String(h),reason:y,...o?{wouldNeed:o}:{}}}},d=new Set,g=s=>{for(let a of d)a(s)};return{definitions:c,hash:v,...t.author?{author:t.author}:{},onDiff(s){return e.subscribe(s)},onCall(s){return d.add(s),()=>d.delete(s)},async call(s,a){let h=(c.find(r=>r.name===s)??c.find(r=>r.act===s))?.mutating??!1,y={name:s,args:a,mutating:h,at:new Date().toISOString()};return g({...y,phase:"running"}),(r=>(g(r.ok?{...y,phase:"ok",...!h&&r.reads?{reads:r.reads}:{}}:{...y,phase:"failed",error:r.error}),r))(await p(s,a))}}}function dn(e){let t=typeof e=="function"?e():e;return t?{via:t}:{}}export{je as a,Je as b,Rn as c,Cn as d};
|