graview 0.1.36 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/preview/{chunk.T47DLH5Z.js → chunk.24E4R4ZH.js} +1 -1
- package/dist/preview/{chunk.DSP62QYK.js → chunk.2JF254FO.js} +1 -1
- package/dist/preview/chunk.2TDB4D6Y.js +1 -0
- package/dist/preview/{chunk.YNE5QR7Q.js → chunk.3IVVXVG7.js} +1 -1
- package/dist/preview/{chunk.WJ2TWU2I.js → chunk.3KJQXYCA.js} +1 -1
- package/dist/preview/chunk.3V2M3S4U.js +1 -0
- package/dist/preview/{chunk.WHTQHU3M.js → chunk.4NCXMVPY.js} +1 -1
- package/dist/preview/chunk.57XTDW57.js +1 -0
- package/dist/preview/chunk.5CLFTXP3.js +1 -0
- package/dist/preview/chunk.5EXYDBAL.js +88 -0
- package/dist/preview/chunk.5JPRRV47.js +1 -0
- package/dist/preview/{chunk.ZVMIHXVK.js → chunk.67PVRVAC.js} +1 -1
- package/dist/preview/{chunk.FERBNBDE.js → chunk.6DYZBDWT.js} +1 -1
- package/dist/preview/chunk.6SK2K72G.js +1 -0
- package/dist/preview/{chunk.TGEF6TMM.js → chunk.74DXEKUV.js} +1 -1
- package/dist/preview/chunk.76QUEWYD.js +1 -0
- package/dist/preview/{chunk.QDHUDLJB.js → chunk.7MMNMZLF.js} +1 -1
- package/dist/preview/chunk.7OLVQ2FZ.js +1 -0
- package/dist/preview/{chunk.MXJS67W4.js → chunk.7UQOXYJX.js} +1 -1
- package/dist/preview/{chunk.ER5ILWKY.js → chunk.AHC4EXLW.js} +2 -2
- package/dist/preview/{chunk.ZWZ5SEXT.js → chunk.AWRS6TUN.js} +1 -1
- package/dist/preview/{chunk.H4T56OXM.js → chunk.AZ333RB3.js} +1 -1
- package/dist/preview/{chunk.HZPTBPJY.js → chunk.BA3REPV5.js} +1 -1
- package/dist/preview/{chunk.5PU3RWYY.js → chunk.BRBY5WJT.js} +2 -2
- package/dist/preview/{chunk.6KMXLUOS.js → chunk.BXWO6ILK.js} +1 -1
- package/dist/preview/chunk.CGQLE7JW.js +1 -0
- package/dist/preview/chunk.CV4CBHFT.js +1 -0
- package/dist/preview/chunk.CYPTJNES.js +1 -0
- package/dist/preview/{chunk.ACXA55GW.js → chunk.D2ILIAND.js} +1 -1
- package/dist/preview/chunk.DLCFCMKX.js +1 -0
- package/dist/preview/chunk.DMUUYZ37.js +1 -0
- package/dist/preview/chunk.DNNL7F3P.js +25 -0
- package/dist/preview/chunk.EHT4HBH5.js +35 -0
- package/dist/preview/chunk.EKUAI5YL.js +1 -0
- package/dist/preview/chunk.ELY2RMGE.js +19 -0
- package/dist/preview/{chunk.6ZZZBDEG.js → chunk.ENEOGGFM.js} +1 -1
- package/dist/preview/chunk.ENJKCSNX.js +1 -0
- package/dist/preview/chunk.FEPYKPZE.js +1 -0
- package/dist/preview/{chunk.ET76FISZ.js → chunk.FFW6XWHB.js} +1 -1
- package/dist/preview/{chunk.ZEW2OOZ5.js → chunk.FGYCYLUS.js} +1 -1
- package/dist/preview/{chunk.ITXIFDQ7.js → chunk.G7S7GLDK.js} +1 -1
- package/dist/preview/chunk.GMZAQGH7.js +1 -0
- package/dist/preview/chunk.GXPBRYSR.js +1 -0
- package/dist/preview/{chunk.42WJ6VJZ.js → chunk.H4LFJPDV.js} +1 -1
- package/dist/preview/chunk.HBBVVALN.js +5 -0
- package/dist/preview/{chunk.NWYOLGQ3.js → chunk.HCK4Y6C5.js} +1 -1
- package/dist/preview/chunk.HSRGYZOR.js +1 -0
- package/dist/preview/chunk.HYAKRLPT.js +4 -0
- package/dist/preview/chunk.IHBIRAC4.js +2 -0
- package/dist/preview/chunk.IWK5QL6P.js +1 -0
- package/dist/preview/{chunk.WQBDTLPZ.js → chunk.J2CR4RRH.js} +1 -1
- package/dist/preview/chunk.J2HQEUYA.js +1 -0
- package/dist/preview/{chunk.R45BF6JV.js → chunk.JBRXGPPM.js} +1 -1
- package/dist/preview/chunk.JDRM6XXD.js +2 -0
- package/dist/preview/chunk.JFLUVZNW.js +1 -0
- package/dist/preview/chunk.KAWP4RNR.js +1 -0
- package/dist/preview/{chunk.OF34OZ4V.js → chunk.KSXB4LDF.js} +1 -1
- package/dist/preview/{chunk.FUR4IHWG.js → chunk.LJE5J3JK.js} +1 -1
- package/dist/preview/chunk.LPJY6V5D.js +1 -0
- package/dist/preview/chunk.LVLAS5GL.js +1 -0
- package/dist/preview/{chunk.7CO7S6QM.js → chunk.LVNAB2BW.js} +1 -1
- package/dist/preview/{chunk.XRCGADKC.js → chunk.LYJXX6BU.js} +1 -1
- package/dist/preview/{chunk.CUCNT7MG.js → chunk.MJLUAGEV.js} +1 -1
- package/dist/preview/chunk.MKPJKZAP.js +1 -0
- package/dist/preview/chunk.MMBMVHIG.js +1 -0
- package/dist/preview/chunk.NNNVB6RV.js +1 -0
- package/dist/preview/chunk.NOZEHLWG.js +2 -0
- package/dist/preview/{chunk.SG23JC6D.js → chunk.NV6IZJKA.js} +1 -1
- package/dist/preview/{chunk.RKHEZ6KZ.js → chunk.NWHFFOXW.js} +1 -1
- package/dist/preview/chunk.NZJZIYDK.js +1 -0
- package/dist/preview/chunk.O6KNGFWH.js +1 -0
- package/dist/preview/chunk.PMK73A53.js +1 -0
- package/dist/preview/chunk.PQPZZ7ZW.js +117 -0
- package/dist/preview/{chunk.Y3IJDWNS.js → chunk.QJYALCIW.js} +1 -1
- package/dist/preview/chunk.QMZUKAPJ.js +1 -0
- package/dist/preview/{chunk.GUDKPK42.js → chunk.QNGFBJWP.js} +1 -1
- package/dist/preview/{chunk.LMVCWYYG.js → chunk.QOXTBRKE.js} +1 -1
- package/dist/preview/{chunk.BZ5VLPKB.js → chunk.QXARGANF.js} +6 -6
- package/dist/preview/{chunk.P75TPZWT.js → chunk.QYWBQ5NX.js} +1 -1
- package/dist/preview/{chunk.EDSPYKR4.js → chunk.RPOYSIVQ.js} +1 -1
- package/dist/preview/{chunk.HPX3F7XX.js → chunk.SNKOPWAD.js} +1 -1
- package/dist/preview/{chunk.EBLKEQ7O.js → chunk.SZMWJHU2.js} +1 -1
- package/dist/preview/{chunk.KU6NIMQX.js → chunk.TN4GY6LW.js} +1 -1
- package/dist/preview/{chunk.O3OALXCI.js → chunk.TRLVFHFT.js} +2 -2
- package/dist/preview/chunk.TSI4O3GH.js +1 -0
- package/dist/preview/chunk.TX5QIZEP.js +1 -0
- package/dist/preview/{chunk.UJR3Y7MP.js → chunk.TXS4I326.js} +1 -1
- package/dist/preview/chunk.U4URQDC5.js +1 -0
- package/dist/preview/chunk.UCVZG7S4.js +1 -0
- package/dist/preview/{chunk.LA7535VO.js → chunk.UPBUF7KR.js} +1 -1
- package/dist/preview/{chunk.DANDYIB5.js → chunk.UR5TT4JH.js} +1 -1
- package/dist/preview/{chunk.OREMUXB5.js → chunk.UV2TSAB4.js} +1 -1
- package/dist/preview/{chunk.IMRCAU4T.js → chunk.UVLPVHID.js} +1 -1
- package/dist/preview/chunk.VUKHDZNI.js +1 -0
- package/dist/preview/{chunk.S6GJGTJE.js → chunk.VW6WGFL6.js} +1 -1
- package/dist/preview/chunk.VX7MGVP5.js +1 -0
- package/dist/preview/{chunk.WGI5G6NM.js → chunk.WLV2QYTS.js} +1 -1
- package/dist/preview/{chunk.GOCUBIRW.js → chunk.WNKRXL3O.js} +1 -1
- package/dist/preview/chunk.WNMLA4YW.js +1 -0
- package/dist/preview/{chunk.T2CN7UTZ.js → chunk.WVEKYJSI.js} +2 -2
- package/dist/preview/{chunk.2B4WVCVV.js → chunk.X2OLXTRL.js} +1 -1
- package/dist/preview/{chunk.J3TEJBI5.js → chunk.XS3SAH6U.js} +1 -1
- package/dist/preview/chunk.XWJ2MRQF.js +1 -0
- package/dist/preview/{chunk.D6RDTUX3.js → chunk.Y44TR4WG.js} +1 -1
- package/dist/preview/{chunk.OXZRGP53.js → chunk.YAXOIJVH.js} +1 -1
- package/dist/preview/chunk.YFW5BF6J.js +1 -0
- package/dist/preview/chunk.YNJOLOFG.js +1 -0
- package/dist/preview/{chunk.6QDFBCV4.js → chunk.YW2BZ2LH.js} +2 -2
- package/dist/preview/chunk.YX354FRV.js +1 -0
- package/dist/preview/{chunk.QTITRX5Q.js → chunk.ZB7GV3IT.js} +1 -1
- package/dist/preview/{chunk.KBJG5SI2.js → chunk.ZOT4V66Q.js} +1 -1
- package/dist/preview/chunk.ZYPCE2LZ.js +1 -0
- package/dist/preview/index.html +42 -42
- package/dist/preview/page.js +5 -5
- package/package.json +6 -6
- package/dist/preview/chunk.272ZJXQP.js +0 -1
- package/dist/preview/chunk.27TLAVRR.js +0 -19
- package/dist/preview/chunk.2A2DLMT3.js +0 -1
- package/dist/preview/chunk.3PT55HXT.js +0 -1
- package/dist/preview/chunk.3SM2CHKF.js +0 -1
- package/dist/preview/chunk.3ZIOAPI5.js +0 -1
- package/dist/preview/chunk.4B73P2WA.js +0 -2
- package/dist/preview/chunk.4GXXD4NG.js +0 -1
- package/dist/preview/chunk.4Q56V7GS.js +0 -1
- package/dist/preview/chunk.4STIUIT6.js +0 -1
- package/dist/preview/chunk.53IKY7UP.js +0 -1
- package/dist/preview/chunk.56BPXB6E.js +0 -1
- package/dist/preview/chunk.64MJ5FRL.js +0 -1
- package/dist/preview/chunk.6II4BONS.js +0 -25
- package/dist/preview/chunk.6W7J76TK.js +0 -1
- package/dist/preview/chunk.7G3B5QPH.js +0 -1
- package/dist/preview/chunk.7TBSVQSH.js +0 -1
- package/dist/preview/chunk.7YQYWOZR.js +0 -1
- package/dist/preview/chunk.AAZFVCSP.js +0 -2
- package/dist/preview/chunk.ACEYGWMO.js +0 -1
- package/dist/preview/chunk.CE3NOADH.js +0 -1
- package/dist/preview/chunk.CNJENUPC.js +0 -1
- package/dist/preview/chunk.CRPT3ZT3.js +0 -1
- package/dist/preview/chunk.E77K6KBX.js +0 -1
- package/dist/preview/chunk.EQIGKXIG.js +0 -1
- package/dist/preview/chunk.F5BCCGFK.js +0 -5
- package/dist/preview/chunk.FQKH67BP.js +0 -1
- package/dist/preview/chunk.FWBQVPMI.js +0 -1
- package/dist/preview/chunk.GXLAZGYT.js +0 -1
- package/dist/preview/chunk.GZLYTPE7.js +0 -1
- package/dist/preview/chunk.IB32NOV5.js +0 -2
- package/dist/preview/chunk.JLXQ6ZLI.js +0 -1
- package/dist/preview/chunk.JZMA2AV7.js +0 -1
- package/dist/preview/chunk.K5NJTE3F.js +0 -35
- package/dist/preview/chunk.LNNFNJKN.js +0 -1
- package/dist/preview/chunk.M4FQ7SSM.js +0 -1
- package/dist/preview/chunk.NJ62C2GU.js +0 -1
- package/dist/preview/chunk.NNCTJSD3.js +0 -1
- package/dist/preview/chunk.O6ROFVFD.js +0 -88
- package/dist/preview/chunk.OFJH7LDC.js +0 -1
- package/dist/preview/chunk.OH5BBE2B.js +0 -1
- package/dist/preview/chunk.OZR5NI4J.js +0 -1
- package/dist/preview/chunk.PWOVXARZ.js +0 -1
- package/dist/preview/chunk.Q63RPNUS.js +0 -1
- package/dist/preview/chunk.QEALNWWL.js +0 -117
- package/dist/preview/chunk.QLMUGC7R.js +0 -1
- package/dist/preview/chunk.R7LRJS6B.js +0 -4
- package/dist/preview/chunk.SSRP5SBR.js +0 -1
- package/dist/preview/chunk.VHWUGSFW.js +0 -1
- package/dist/preview/chunk.W42P7NOL.js +0 -1
- package/dist/preview/chunk.XBTZXWJX.js +0 -1
- package/dist/preview/chunk.ZDNJK2SX.js +0 -1
- package/dist/preview/chunk.ZNS3LYJU.js +0 -1
- package/dist/preview/chunk.ZSSOTIFL.js +0 -1
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as $t,f as Ht,g as mn}from"./chunk.Y3IJDWNS.js";import{h as Fr}from"./chunk.ZDNJK2SX.js";import{e as Hr,p as Nn,q as Dr}from"./chunk.ZSSOTIFL.js";import{a as Pe,b as So,c as Zt,d as jr,e as Mo}from"./chunk.ZWZ5SEXT.js";import{b as yn}from"./chunk.FQKH67BP.js";import{a as $r}from"./chunk.LA7535VO.js";import{a as Cr,b as Nr,c as Br}from"./chunk.7YQYWOZR.js";import{b as Rr,d as Er}from"./chunk.UT6642FC.js";import{a as Or,b as xo,c as bo,f as wo,g as vo,h as ko,i as Ar,j as Xt,k as qt,o as Bt,p as Qt,q as Tr,r as Pr}from"./chunk.PWOVXARZ.js";import{a as Lr,b as Ir}from"./chunk.SG23JC6D.js";import{A as Sr,f as fr,g as Kt,h as mr,i as yr,j as gr,k as pr,m as Cn,n as hn,o as fn,p as Ut,q as po,v as xr,w as br,x as wr,y as vr,z as kr}from"./chunk.OJGHDWI6.js";import{c as Mr}from"./chunk.IMRCAU4T.js";import{B as at,C as co,D as cn,F as Te,J as gt,Q as Le,R as uo,V as ho,W as Pn,X as Pt,Y as pe,_ as Ct,a as zt,b as oo,c as ro,d as io,e as lr,f as cr,fa as _t,g as In,ha as hr,i as It,k as mt,l as ao,m as Tn,n as dn,oa as fo,pa as mo,q as so,qa as Nt,s as we,sa as yo,t as Oe,u as ur,v as ln,w as Ae,wa as go,x as Tt,xa as un,y as yt,z as lo}from"./chunk.6II4BONS.js";import{$ as Lt,Mb as sn,Rc as ar,Uc as sr,W as rr,X as Ln,Z as rn,Zc as dr,_ as Gt,aa as an,ea as ir,ec as Be}from"./chunk.F5BCCGFK.js";import{b as se}from"./chunk.AJZBJBMO.js";var Wr={width:1200,height:760,focusSize:{width:1200,height:420},relationSize:{width:240,height:140},contextSize:{width:300,height:104},gap:16,unit:16};var Vr=(e,t)=>e?`${e.edgeKind}|${e.direction}`:`raised|${t}`,Dt=(e,t,n)=>`${co}${e}|${t}|${n}`;function Bn(e,t){let n=e.map(()=>0),r=e.map((i,l)=>({size:i,index:l})).sort((i,l)=>i.size-l.size||i.index-l.index),o=Math.max(t,e.length),a=e.length;for(let{size:i,index:l}of r){let c=Math.max(1,Math.floor(o/a));n[l]=Math.min(i,c),o-=n[l],a-=1}return n}function Eo(e){return Vr(e.via,e.node.kind)}function $n(e,t){let n=[],r=0;return e.forEach((o,a)=>{if(o<=0)return;if(n.length>0&&o<=r){for(let l=0;l<o;l++)n[n.length-1].push(a);r-=o;return}let i=o;for(;i>0;){let l=Math.min(t,i);n.push(Array.from({length:l},()=>a)),i-=l,r=t-l}}),n}function Oo(e,t,n){let r=Bn(e,t*n);for(;$n(r,t).length>n;){let o=-1;if(r.forEach((a,i)=>{a>1&&(o<0||a>r[o])&&(o=i)}),o<0)break;r[o]=r[o]-1}return r}function ga(e,t,n){let r=o=>[t.chosen?.has(o.id)?0:1,t.hits?.has(o.id)?0:1,t.flagged?.has(o.id)?0:1,-(t.touched?.get(o.id)??0),-n.neighbors(o.id).length];return e.map((o,a)=>({node:o,index:a,key:r(o)})).sort((o,a)=>{for(let i=0;i<o.key.length;i++)if(o.key[i]!==a.key[i])return o.key[i]-a.key[i];return o.index-a.index}).map(o=>o.node)}var pa=5,xa=(e,t)=>{for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n];return!1};function Yr(e,t,n){if(e.length===0||t<2)return;let r=e[0].kind,o={schema:n.schema,graph:n.graph,...n.today?{today:n.today}:{}},a=[];for(let l of Hr(n.schema,r).groups)if(l.key!==n.exclude)if(l.buckets)for(let c of["decade","year","month"])a.push({by:l.key,bucket:c});else a.push({by:l.key});let i;return a.forEach((l,c)=>{let s=Fr(e,{group:l},o).groups;if(s.length<2||s.length>t)return;let h=s.filter(w=>w.key!=="").reduce((w,f)=>w+f.nodes.length,0)/e.length;if(h<.5||s.some(w=>w.nodes.length>e.length*.75))return;let g=[-Math.round(h*100),Math.abs(s.length-pa),c];(!i||xa(g,i.score))&&(i={grouping:{by:l.by,...l.bucket?{bucket:l.bucket}:{},groups:s},score:g})}),i?.grouping}function Ao(e,t){let n=f=>({id:f.node.id,kind:f.node.kind,node:f.node,...f.via?{via:f.via}:{}});if(e.length<=t.budget)return e.map(n);let r={...t.relevance,chosen:new Set([...t.relevance?.chosen??[],...t.selection??[]])},o=new Map;for(let f of e){let x=Vr(f.via,f.node.kind),v=o.get(x);v?v.push(f):o.set(x,[f])}let a=[...o.entries()].map(([f,x])=>({key:f,run:x,via:x[0].via,kinds:[...new Set(x.map(v=>v.node.kind))],members:[],whole:!1,extra:0})),i=Bn(a.map(f=>f.run.length),t.budget);a.forEach((f,x)=>f.whole=f.run.length<=i[x]);let l=a.filter(f=>!f.whole),c=a.filter(f=>f.whole).reduce((f,x)=>f+x.run.length,0),d=Math.max(l.length,t.budget-c);for(let f of l){f.members=ga(f.run.map(v=>v.node),r,t.graph);let x=d-(l.length-1);f.kinds.length>1&&f.kinds.length<=x?f.byKind=!0:f.kinds.length===1&&(f.grouping=Yr(f.members,x,{schema:t.schema,graph:t.graph,...f.via?{exclude:f.via.edgeKind}:{},...t.today?{today:t.today}:{}}))}let s=f=>f.byKind?f.kinds.length:f.grouping?f.grouping.groups.length:1;for(;l.reduce((f,x)=>f+s(x),0)>d;){let f=[...l].filter(x=>s(x)>1).sort((x,v)=>s(v)-s(x))[0];if(!f)break;f.grouping=void 0,f.byKind=!1}d-=l.reduce((f,x)=>f+s(x),0);let u=f=>f.byKind?f.kinds.some(x=>t.expanded.has(Dt(x,f.key,"kind"))):f.grouping?.groups.some(x=>t.expanded.has(Dt(f.kinds[0],f.key,Ro(f.grouping,x.key)))),h=l.filter(f=>!f.grouping&&!f.byKind?!0:u(f)),g=Bn(h.map(f=>f.members.length),Math.max(0,d));h.forEach((f,x)=>f.extra=d>0?g[x]:0);let w=[];for(let f of a){let{key:x,via:v}=f;if(f.whole){w.push(...f.run.map(n));continue}let y=p=>({id:p.id,kind:p.kind,node:p,...v?{via:v}:{}}),E=new Map(f.run.map((p,S)=>[p.node.id,S])),I=(p,S,L)=>{let O=[...p.slice(0,S)].sort((G,V)=>E.get(G.id)-E.get(V.id));w.push(...O.map(y));let H=p.slice(S);if(H.length===0)return;let T=H[0].kind;w.push({id:Dt(T,x,L?`more:${L}`:"more"),kind:T,...v?{via:v}:{},aggregate:{kind:T,memberIds:H.map(G=>G.id),label:S>0?`${H.length} more ${t.plural(T).toLowerCase()}`:`${H.length} ${t.plural(T).toLowerCase()}`,opens:{in:"picture",focus:Ae(T),within:L?{filter:L}:{}}}})},W=v&&t.focusId?`${v.edgeKind}:${t.focusId}`:void 0;if(f.byKind){let p=f.kinds.find(S=>t.expanded.has(Dt(S,x,"kind")));for(let S of f.kinds){let L=f.members.filter(O=>O.kind===S);if(S===p){let O=f.extra+1;L.length<=O?w.push(...L.map(y)):I(L,O-1,W);continue}w.push({id:Dt(S,x,"kind"),kind:S,...v?{via:v}:{},aggregate:{kind:S,memberIds:L.map(O=>O.id),label:t.plural(S),opens:{in:"place"}}})}continue}let F=f.grouping;if(!F){I(f.members,f.extra,W);continue}let ee=f.kinds[0],z=F.groups.find(p=>t.expanded.has(Dt(ee,x,Ro(F,p.key))));for(let p of F.groups){if(p===z){let S=f.members.filter(O=>p.nodes.includes(O)),L=f.extra+1;if(S.length<=L)w.push(...S.map(y));else{let O=p.key!==""&&!p.key.includes(",")&&!F.bucket,H=[W,O?`${F.by}:${p.key}`:void 0].filter(Boolean).join(",")||void 0;I(S,L-1,H)}continue}w.push({id:Dt(ee,x,Ro(F,p.key)),kind:ee,...v?{via:v}:{},aggregate:{kind:ee,memberIds:f.members.filter(S=>p.nodes.includes(S)).map(S=>S.id),label:p.label.charAt(0).toUpperCase()+p.label.slice(1),opens:{in:"place"}}})}}return w}var Ro=(e,t)=>`${e.by}${e.bucket?`:${e.bucket}`:""}=${t||"none"}`;function zr(e,t,n,r,o=1){let a=l=>String(l).length*7.4,i=e.length*8.6+6+a(t)+14+(n>0?22+a(n):0);return{width:Math.max(i,r?184:0)*o,height:(r?38:22)*o,short:{width:i*o,height:22*o}}}function Ft(e,t,n=6){return e.x<t.x+t.width+n&&t.x<e.x+e.width+n&&e.y<t.y+t.height+n&&t.y<e.y+e.height+n}var Lo=(e,t,n,r)=>{let o=Math.max(e.x,Math.min(t.x,e.x+e.width)),a=Math.max(e.y,Math.min(t.y,e.y+e.height));return Math.abs(o-t.x)/n+Math.abs(a-t.y)/r<.92},gn=4,Gr=.45;function Io(e,t,n,r={},o={}){let a={};for(let b of e)a[b.kind]=b.count;let i={x:(r.left??0)+8,y:(r.top??0)+8,width:n.width-(r.left??0)-(r.right??0)-16,height:n.height-(r.top??0)-(r.bottom??0)-16},l=o.avoid??[],c=o.tilt??.5,d=b=>b.nameplate??{width:120,height:34,short:{width:90,height:20}},s=b=>e.map(R=>{let A=b.get(R.kind);return{card:R,plot:A,center:Zt(A.col+A.side/2,A.row+A.side/2,1,c)}}),u=(b,R)=>{let A=1/0,M=-1/0,N=1/0,P=-1/0;for(let{card:B,plot:te,center:K}of b){let j=K.x*R,J=K.y*R,X=te.side*R/2,fe=B.opened>0?d(B).width:d(B).short.width;A=Math.min(A,j-Math.max(X+(B.count>12?30:0),fe/2)),M=Math.max(M,j+Math.max(X,fe/2)),N=Math.min(N,J-X*c-R*Gr),P=Math.max(P,J+X*c+gn+d(B).short.height)}return{minX:A,maxX:M,minY:N,maxY:P}},h=b=>{let R=4,A=160;for(let M=0;M<24;M++){let N=(R+A)/2,P=u(b,N);P.maxX-P.minX<=i.width&&P.maxY-P.minY<=i.height?R=N:A=N}return R},g=b=>{let R={...o.order?{order:o.order}:{},counts:a,...o.plots?{plots:o.plots}:{},pitch:b},A=So(t,R),M=So(t,{...R,upright:!0}),N=h(s(A)),P=h(s(M)),B=n.height>n.width&&P>=N?M:A;return{map:B,fitted:B===M?P:N}},w=[],f=new Map,x=0,v=(b,R={x:0,y:0})=>{let A=u(w,b),M=i.x+i.width/2-(A.minX+A.maxX)/2+R.x,N=i.y+i.height/2-(A.minY+A.maxY)/2+R.y;return{originX:M,originY:N,cell:b}},y=b=>{let{originX:R,originY:A,cell:M}=b,N=w.map(({center:te})=>te.y),P=Math.max(...N),B=Math.min(...N);return w.map(({card:te,plot:K,center:j})=>{let J=R+j.x*M,X=A+j.y*M,fe=K.side*M/2,ie=fe*c,ve=P===B?.5:(j.y-B)/(P-B);return{card:te,plot:K,x:J,y:X,halfW:fe,halfH:ie,depth:1-ve*.65}})},E=(b,R=!0)=>{let A=[];return[...b].sort((N,P)=>(P.card.weight??P.card.count)-(N.card.weight??N.card.count)||e.indexOf(N.card)-e.indexOf(P.card)).filter(N=>[d(N.card),d(N.card).short].some(P=>{let B=F(N,P),te=(!R||B.x>=0&&B.y>=0&&B.x+B.width<=n.width&&B.y+B.height<=n.height)&&!A.some(K=>Ft(B,K,4))&&!b.some(K=>K!==N&&Lo(B,K,K.halfW,K.halfH))&&!l.some(K=>Ft(B,K,0));return te&&A.push(B),te})).length},I=b=>b.card.marquee?{x:b.x-b.card.marquee.width/2,y:b.y+b.halfH+gn+d(b.card).height,width:b.card.marquee.width,height:b.card.marquee.height}:null,W=(b,R,A)=>A.some(M=>{if(M===R)return!1;let N=I(M);return N!==null&&Ft(b,N,4)}),F=(b,R,A="under")=>A==="aside"?{x:b.x+b.halfW+gn,y:b.y-R.height/2,width:R.width,height:R.height}:A==="above"?{x:b.x-R.width/2,y:b.y-b.halfH-gn-Gr*S.cell-R.height,width:R.width,height:R.height}:{x:b.x-R.width/2,y:b.y+b.halfH+gn,width:R.width,height:R.height},ee=b=>b.some(R=>l.some(A=>Lo(A,R,R.halfW,R.halfH)||Ft(A,F(R,d(R.card).short),0))),z=b=>b.every(R=>{let A=F(R,d(R.card).short);return R.x-R.halfW>=0&&R.x+R.halfW<=n.width&&R.y-R.halfH>=0&&A.x>=0&&A.x+A.width<=n.width&&A.y+A.height<=n.height}),p={pitch:Pe,said:-1};for(let b of[Pe,Pe+1,Pe+2,Pe+3,Pe+5,Pe+7]){({map:f,fitted:x}=g(b)),w=s(f);let R=E(y(v(x)));if(R>p.said&&(p={pitch:b,said:R}),R===e.length)break}(p.pitch!==Pe+7||p.said!==e.length)&&({map:f,fitted:x}=g(p.pitch),w=s(f));let S=v(x);if(l.length>0&&ee(y(S))){let b;for(let R=1;R>=.3&&!b;R-=.05){let A=x*R,M=Math.max(...l.map(P=>P.width))/2+A,N=Math.max(...l.map(P=>P.height))/2+A/2;for(let P of[0,.5,.75,1,1.25]){for(let[B,te]of[[1,0],[-1,0],[0,1],[0,-1],[1,1],[-1,1],[1,-1],[-1,-1]]){let K=v(A,{x:B*M*P,y:te*N*P}),j=y(K);if(!ee(j)&&z(j)){b=K;break}if(P===0)break}if(b)break}}b&&(S=b)}let L=(b,R)=>{let A={x:n.width/2,y:n.height/2};return{cell:b.cell*R,originX:A.x+(b.originX-A.x)*R,originY:A.y+(b.originY-A.y)*R}},O=1;if(E(y(S))<e.length){let b={said:E(y(S),!1),area:1/0,pitch:-1,by:1},R={map:f,shape:w,fitted:x,where:S};for(let M of[Pe,Pe+1,Pe+2,Pe+3,Pe+5,Pe+7]){({map:f,fitted:x}=g(M)),w=s(f);let N=v(x);for(let P=1;P<=3.001;P+=.1){let B=E(y(L(N,P)),!1),te=u(w,x*P),K=(te.maxX-te.minX)*(te.maxY-te.minY);if((B>b.said||B===b.said&&K<b.area)&&(b={said:B,area:K,pitch:M,by:P}),B===e.length)break}}b.pitch<0?{map:f,shape:w,fitted:x,where:S}=R:({map:f,fitted:x}=g(b.pitch),w=s(f),O=b.by,S=L(v(x),O));let A=y(S).filter(M=>o.keep?.includes(M.card.kind));if(A.length>0){let M=A.flatMap(j=>[{x:j.x-j.halfW,y:j.y-j.halfH,width:j.halfW*2,height:j.halfH*2},F(j,d(j.card))]),N=Math.min(...M.map(j=>j.x)),P=Math.max(...M.map(j=>j.x+j.width)),B=Math.min(...M.map(j=>j.y)),te=Math.max(...M.map(j=>j.y+j.height)),K=(j,J,X)=>J-j>X-16?X/2-(j+J)/2:j<8?8-j:J>X-8?X-8-J:0;S={...S,originX:S.originX+K(N,P,n.width),originY:S.originY+K(B,te,n.height)}}}let H=o.zoom&&o.zoom!==1?o.zoom:1;H!==1&&(S=L(S,H));let T=y(S),G=[],V=new Map,Y=new Map,k=[...T].sort((b,R)=>(R.card.weight??R.card.count)-(b.card.weight??b.card.count)||e.indexOf(b.card)-e.indexOf(R.card));for(let b of k){let R=[["full",d(b.card),"under"],["short",d(b.card).short,"under"]],A="none",M=b===k[0],N=(B,te)=>R.filter(([K])=>K.startsWith(te)).map(([K,j,J])=>[K,j,J,B]),P=M?[...N(!1,"full"),...N(!1,"short"),...N(!0,"full"),...N(!0,"short")]:R.map(([B,te,K])=>[B,te,K,!1]);for(let[B,te,K,j]of P){let J=F(b,te,K);if((H!==1||O!==1||J.x>=0&&J.y>=0&&J.x+J.width<=n.width&&J.y+J.height<=n.height)&&!G.some(ie=>Ft(J,ie,4))&&(j||!T.some(ie=>ie!==b&&Lo(J,ie,ie.halfW,ie.halfH)))&&!W(J,b,T)&&!l.some(ie=>Ft(J,ie,0))){A=B,G.push(J),Y.set(b.card.id,J);break}}V.set(b.card.id,A)}let $=T.map(b=>({id:b.card.id,x:b.x-b.halfW,y:b.y-b.halfH,width:b.halfW*2,height:b.halfH*2+(b.card.opened>0?Math.max(b.card.openedMin??0,b.card.opened):0),depth:b.depth,plot:b.plot,nameplate:V.get(b.card.id)??"none"})),q=u(w,S.cell),_={cell:S.cell,originX:S.originX,originY:S.originY,pan:o.pan??{x:0,y:0},extent:{x:S.originX+q.minX,y:S.originY+q.minY,width:q.maxX-q.minX,height:q.maxY-q.minY},openedShare:1,...c!==.5?{tilt:c}:{},...Y.size>0?{nameplates:T.flatMap(b=>{let R=Y.get(b.card.id);return R?[{id:b.card.id,x:R.x-(b.x-b.halfW),y:R.y-(b.y-b.halfH),width:R.width,height:R.height}]:[]})}:{},...T.some(b=>b.card.marquee)?{showings:T.flatMap(b=>{let R=I(b);return R?[{id:b.card.id,x:R.x-(b.x-b.halfW),y:R.y-(b.y-b.halfH),width:R.width,height:R.height}]:[]})}:{}};return{placed:$,frame:_,map:f}}function pt(e){let{width:t,height:n}=e.visible??e,r={x:t*.45,y:n*.45};if(!e.city)return r;let{extent:o}=e.city,a=24;return{x:Math.max(r.x,o.x+o.width-t+a,-o.x+a),y:Math.max(r.y,o.y+o.height-n+a,-o.y+a)}}var Hn=48;function To(e){if(!e.city)return[];let{width:t,height:n}=e.visible??e,r=[];for(let o of e.nodes){if(!o.id.startsWith("kind:")||Math.round(o.plane)!==2)continue;let a=o.x+o.width/2,i=o.y+o.height/2,l=a<0?"left":a>t?"right":i<0?"top":i>n?"bottom":null;if(!l)continue;let c=l==="left"||l==="right",d=c?Math.max(0,Math.min(n,i)):Math.max(0,Math.min(t,a)),s=(g,w)=>g<w/4?w/4-g:g>w*3/4?w*3/4-g:0,u=(g,w)=>g<Hn?Hn-g:g>w-Hn?w-Hn-g:0,h=c?{x:s(a,t),y:u(i,n)}:{x:u(a,t),y:s(i,n)};r.push({id:o.id,kind:o.id.slice(5),side:l,along:d,by:h})}return r}function Po(e,t,n,r,o){return{x:e.x+(n.x-e.x-t.x-r.x)*(1-o),y:e.y+(n.y-e.y-t.y-r.y)*(1-o)}}var ba={rankOf:()=>{},parentOf:()=>{}};function _r(e,t){if(t.size===0)return ba;let n=e.kinds,r=new Map,o=(d,s)=>{d!==s&&((r.get(d)??r.set(d,new Set).get(d)).add(s),(r.get(s)??r.set(s,new Set).get(s)).add(d))};for(let d of n){let s=e.tryDefinition(d);if(s)for(let u of Object.values(s.edges??{})){let h=u.to==="*"?n:u.to;for(let g of h)o(d,g)}}let a=new Map,i=new Map,l=[...t].filter(d=>n.includes(d));for(let d of l)a.set(d,0);let c=0;for(;l.length>0;){c+=1;let d=[];for(let s of[...l].sort((u,h)=>n.indexOf(u)-n.indexOf(h)))for(let u of[...r.get(s)??[]].sort((h,g)=>n.indexOf(h)-n.indexOf(g)))a.has(u)||(a.set(u,c),c===2&&i.set(u,s),d.push(u));l=d}return{rankOf:d=>{let s=a.get(d);if(s!==0)return s===1?"primary":"secondary"},parentOf:d=>i.get(d)}}function Kr(e,t,n,r,o={}){if(n){let a=new Map;for(let i of e.allEdges()){if(r&&i.kind!==r)continue;let l=i.from===n.id?i.to:i.to===n.id?i.from:null;if(l===null||l===n.id)continue;let c=e.getNode(l);if(!c||a.has(l))continue;let d=i.from===n.id?"out":"in",s=d==="out"?n.kind:c.kind,u=wa(t,s,i.kind,d);a.set(l,{node:c,via:{edgeKind:i.kind,direction:d,...u?{description:u}:{}}})}if(a.size>0){let i=l=>`${l.via.edgeKind}|${l.via.description??""}`;return[...a.values()].sort((l,c)=>(i(l)<i(c)?-1:i(l)>i(c)?1:0)||at(l.node,c.node))}}if(n){let a=o[n.id]??[],i=new Set,l=[];for(let c of a){if(c===n.id||i.has(c))continue;let d=e.getNode(c);d&&(r&&r!=="judges"&&d.kind!==r||(i.add(c),l.push({node:d,via:{edgeKind:"judges",direction:"out",description:"what it finds wrong"}})))}if(l.length>0)return l.sort((c,d)=>at(c.node,d.node))}return r?e.allNodes().filter(a=>a.kind===r).sort(at).map(a=>({node:a})):[]}function wa(e,t,n,r){let a=e.tryDefinition(t)?.edges?.[n];return r==="out"?a?.description:a?.inverse}function Ur(e,t,n){let r=new Map,o=[...t.values()].sort((d,s)=>d.plane-s.plane);for(let d of o)for(let s of d.aggregate?.memberIds??[])!t.has(s)&&!r.has(s)&&r.set(s,d.id);let a=d=>t.get(d)??t.get(r.get(d)??""),i=new Map,l=new Map,c=new Map;for(let d of e.allEdges()){let s=a(d.from),u=a(d.to);if(!s||!u||s.id===u.id&&!(n.overview&&s.aggregate&&s.plane===2))continue;let h=`${d.kind}:${s.id}:${u.id}`,g=i.get(h);if(g){let w=`${d.from}
|
|
2
|
-
${d.to}`,f=l.get(h);if(f.has(w))continue;if(f.add(w),c.get(h).push({from:d.from,to:d.to}),g.single){let{single:x,...v}=g;i.set(h,v)}continue}l.set(h,new Set([`${d.from}
|
|
3
|
-
${d.to}`])),c.set(h,[{from:d.from,to:d.to}]),i.set(h,{id:h,kind:d.kind,from:s.id,to:u.id,edges:[{from:d.from,to:d.to}],single:{from:d.from,to:d.to},...s.id===u.id?{loop:!0}:{},x1:s.x+s.width/2,y1:s.y+s.height/2,x2:u.x+u.width/2,y2:u.y+u.height/2})}return[...i.values()].map(d=>({...d,edges:c.get(d.id)})).sort(at)}var qr=.85,Xr=60,Co=160;function va(e,t,n,r,o,a=qr){let i=e*t.width+Math.max(0,e-1)*n,l=Math.max(n,(r-i)/2);return Array.from({length:e},(c,d)=>({x:l+d*(t.width+n),y:o,depth:a}))}function ka(e,t,n,r,o){let a=e*t.width+Math.max(0,e-1)*n,i=Math.max(n,(r-a)/2);return Array.from({length:e},(l,c)=>({x:i+c*(t.width+n),y:o}))}function Dn(e,t,n,r={}){let o={...Wr,...r},a=Math.max(8,o.unit??16)/16,i=o.inset?.left??0,l=n.overview?Math.max(0,o.dock?.right??0):0,c=n.overview?Math.max(0,o.dock?.bottom??0):0,d=o.width-l-i-(o.inset?.right??0),s=[],u=new Map,h=m=>n.past===!0||rr(t.tryDefinition(m.kind),m,o.today),g=new Set(r.hiddenKinds??[]),w=m=>!g.has(m.kind),f=n.focusId?yt(n.focusId).filter(m=>t.tryDefinition(m)!==void 0).filter(m=>!g.has(m)):[];n.focusId&&yt(n.focusId).length>0&&f.length===0&&(n={...n,focusId:null});let x=n.focusId?e.getNode(n.focusId):void 0;x&&!w(x)&&(n={...n,focusId:null},f=[]);let v=f.length>0?[...e.allNodes()].filter(m=>f.includes(m.kind)).sort(at):[],y=v.filter(w).filter(h),E=v.length-y.length,I=n.focusId&&f.length===0?e.getNode(n.focusId):void 0,W=n.zoom===!0&&!n.overview&&n.focusId!==null,F=Math.max(56,o.height*.062),ee=Math.min(o.height*.895,o.height-F),z=W?I!==void 0?{focusY:o.height*.03,focusH:o.height*.58,relationY:o.height*.645,relationH:o.height*.2,contextY:ee,contextH:F}:{focusY:o.height*.03,focusH:o.height*.71,relationY:o.height*.765,relationH:o.height*.1,contextY:ee,contextH:F}:I===void 0?{focusY:o.height*.045,focusH:o.height*.62,relationY:o.height*.68,relationH:o.height*.2,contextY:o.height*.918,contextH:o.height*.082}:(()=>{let m=o.height,D=m*.04,U=Math.max(m*.42,Math.min(m*.56,300)),ne=D+U+m*.06;return{focusY:D,focusH:U,relationY:ne,relationH:Math.max(m*.12,m*.878-m*.068-ne),contextY:m*.878,contextH:m*.092}})(),p=Math.min(o.headroom??0,z.focusY+z.focusH*.2),S=p>z.focusY?{...z,focusY:p,focusH:z.focusH-(p-z.focusY)}:z,L=m=>Math.min(o.gap*m,Math.round(d*.1)),O=W?Math.min(880,d-L(5)):Math.min(700,d-L(6)),H=W?d-L(5):Math.min(o.focusSize.width,d-L(6)),T=(m,D,U)=>({width:m===0?D:Math.min(D,(d-o.gap*(m+1))/m),height:U}),G=(m,D,U)=>{let ne=T(m,D,U),be=Math.min(D,Co*a,d-o.gap*2);return ne.width>=be?ne:{width:be,height:U}},V=m=>Math.max(1,Math.floor((d-o.gap)/(Math.min(m,Co*a,d-o.gap*2)+o.gap))),Y=new Set(n.expanded),k=n.overview?[]:Kr(e,t,I,n.relation,o.judged).filter(m=>w(m.node)).filter(m=>h(m.node)),$=n.overview?0:Math.max(0,Xr*a-S.contextH),q=k.length>0?S.focusH:S.contextY-S.focusY-o.gap*2-$,_=H,b=o.height,R=Math.min(d*.5/_,o.height*.48/b),A=_*R,M=b*R,N=new Set(r.plainGroups??[]),P=n.overview&&!I&&f.length>0&&n.focusId!==null,B=P&&f.length>0&&f.every(m=>N.has(m));if(P)for(let m of f)B&&r.besideTheMap!==!0?Y.add(we(m)):Y.delete(we(m));let te=P&&!B&&f.length===1?f[0]:void 0,K=te!==void 0&&(r.screens?.[te]?.length??0)>0,j,J=n.overview===!0&&I!==void 0&&r.besideTheMap===!0;n.overview&&(I||f.length>0)&&n.focusId&&!B&&!K&&!(P&&r.besideTheMap===!0)&&!J?(j={x:i+(d-A)/2,y:o.height*.53-M/2,width:A,height:M},on({id:n.focusId,kind:I?I.kind:f[0],plane:0,x:j.x,y:j.y,width:A,height:M,natural:{width:_,height:b},...I?{}:{aggregate:{kind:f.join("+"),memberIds:y.map(m=>m.id),label:r.plurals?.[n.focusId]??f.map(m=>Lt(t,m)).join(" and "),...E>0?{retired:E}:{}}}})):n.overview||(I?on({id:I.id,kind:I.kind,plane:0,x:i+(d-O)/2,y:S.focusY,width:O,height:q}):f.length>0&&n.focusId&&on({id:n.focusId,kind:f[0],plane:0,x:i+(d-H)/2,y:S.focusY,width:H,height:q,aggregate:{kind:f.join("+"),memberIds:y.map(m=>m.id),label:r.plurals?.[n.focusId]??f.map(m=>Lt(t,m)).join(" and "),...E>0?{retired:E}:{}}}));let X=26,fe=52,ie=22,ve=Math.round(o.relationSize.width*.75),ke=Math.max(1,Math.floor((d-o.gap)/(ve+o.gap))),$e=o.unit/16,ae=Math.max(2,Math.floor((S.relationH+o.gap)/(X*$e+o.gap))),Se=k.length>ke*ae,ot={schema:t,graph:e,focusId:I?.id,expanded:Y,...o.relevance?{relevance:o.relevance}:{},...n.selection?{selection:n.selection}:{},plural:m=>Lt(t,m),...o.today?{today:o.today}:{}},oe=Se?Math.max(o.gap,ie*$e):o.gap,Ge,Ze;if(!Se)Ge=k.map(m=>({id:m.node.id,kind:m.node.kind,node:m.node,...m.via?{via:m.via}:{}})),Ze=Array.from({length:Math.max(1,Math.ceil(Ge.length/ke))},(m,D)=>Array.from({length:Math.min(ke,Ge.length-D*ke)},(U,ne)=>D*ke+ne));else{let m=Math.max(1,Math.floor((S.relationH+oe)/(fe*$e+oe))),D=new Map;for(let me of k){let Ee=Eo(me),At=D.get(Ee);At?At.push(me):D.set(Ee,[me])}let U=Oo([...D.values()].map(me=>me.length),ke,m),ne=[...D.values()].map((me,Ee)=>Ao(me,{...ot,budget:U[Ee]}));Ge=ne.flat();let be=ne.map((me,Ee)=>ne.slice(0,Ee).reduce((At,no)=>At+no.length,0)),Ue=ne.map(()=>0);Ze=$n(ne.map(me=>me.length),ke).map(me=>me.map(Ee=>be[Ee]+Ue[Ee]++))}let kt=Ze.length,Je=kt===1?S.relationH:(S.relationH-oe*(kt-1))/kt,Ce=T(Math.max(...Ze.map(m=>m.length),1),Ge.length<=2?Math.round(o.relationSize.width*1.35):o.relationSize.width,Je),lt=[];Ze.forEach((m,D)=>{let U=ka(m.length,Ce,o.gap,d,S.relationY+D*(Je+oe));m.forEach((ne,be)=>lt[ne]={...U[be],x:U[be].x+i})}),Ge.forEach((m,D)=>{let U=lt[D];on({id:m.id,kind:m.kind,plane:1,x:U.x,y:U.y,width:Ce.width,height:Ce.height,...m.via?{via:m.via}:{},...m.aggregate?{aggregate:m.aggregate}:{},...Se&&!m.aggregate?{compact:!0}:{}})});let rt=new Set(u.keys());for(let m of y)rt.add(m.id);let je=new Map;for(let m of e.allNodes()){let D=je.get(m.kind);D?D.push(m):je.set(m.kind,[m])}let Ne=new Set(f.length>0?f:I?[I.kind]:[]),We=[];for(let m of t.kinds){if(g.has(m))continue;let D=je.get(m)??[],U=D.filter(h);We.push({id:we(m),kind:m,members:U.sort(at),retired:D.length-U.length,...Ne.has(m)?{focused:!0}:{}})}for(let m of We)m.kind===n.relation&&(m.raised=!0);We.sort(at);let ze=_r(t,Ne),_e=!n.overview&&t.kinds.some(m=>ze.rankOf(m)==="primary"),Ve=[];for(let m of We)if(!n.overview&&Y.has(m.id)&&m.members.length>0)for(let D of m.members)Ve.push({id:D.id,kind:D.kind});else{let D=_e?ze.rankOf(m.kind):void 0,U=D==="secondary"?ze.parentOf(m.kind):void 0;Ve.push({id:m.id,kind:m.kind,...m.raised?{raised:!0}:{},...m.focused?{focused:!0}:{},...n.overview&&Y.has(m.id)?{opened:!0}:{},...D?{rank:D}:{},...U&&!Y.has(we(U))?{nestedUnder:we(U)}:{},aggregate:{kind:m.kind,memberIds:m.members.map(ne=>ne.id),label:r.plurals?.[m.kind]??Lt(t,m.kind),...m.retired>0?{retired:m.retired}:{}}})}let ct=2;if(Ve.length<=V((W?240:o.contextSize.width)*a))for(let m of Ve)delete m.nestedUnder;let ut=new Map;for(let m of Ve){if(m.nestedUnder===void 0)continue;let D=ut.get(m.nestedUnder)??0;D>=ct?delete m.nestedUnder:ut.set(m.nestedUnder,D+1)}let et=Ve.filter(m=>m.nestedUnder!==void 0),re=Ve.filter(m=>m.nestedUnder===void 0),Me=V((W?240:o.contextSize.width)*a),it=!n.overview&&re.length>Me,Mt=Math.max(0,Me-1),ht=m=>m.focused?0:m.raised?1:2,ft=new Set([...re].map((m,D)=>({item:m,at:D})).sort((m,D)=>ht(m.item)-ht(D.item)||m.at-D.at).slice(0,Mt).map(({item:m})=>m.id)),Ie=new Set(it?re.filter(m=>!ft.has(m.id)).map(m=>m.id):[]),nn=et.filter(m=>!Ie.has(m.nestedUnder)),Rn=et.filter(m=>Ie.has(m.nestedUnder)),Rt=it?[...re.filter(m=>ft.has(m.id)),{id:ur,kind:"",beyond:[...re.filter(m=>Ie.has(m.id)),...Rn].map(m=>m.kind)}]:re,Ke=n.overview?{width:Math.min(220,d/6.5),height:Math.min(92,o.height*.125)}:G(Rt.length,(W?240:o.contextSize.width)*a,S.contextH),C=o.relevance?.flagged,he=(m,D)=>{let U=Mo(t,m);if(!U)return{};let ne=U.values.map(()=>0),be=0;for(let Ue of D){let me=U.values.indexOf(e.getNode(Ue)?.[U.field]);me<0?be++:ne[me]++}return{states:{field:U.field,values:[...U.values.map((Ue,me)=>({value:Ue,tier:U.tiers[me],count:ne[me]})),...be>0?[{value:null,tier:"waiting",count:be}]:[]]}}},ce=n.overview?Io(Rt.map(m=>{let D=m.aggregate?.memberIds??[],U=C?D.filter(ne=>C.has(ne)).length:0;return{id:m.id,kind:m.kind,count:D.length,opened:Y.has(m.id)?qt(Xt(D.length))*a:0,openedMin:Y.has(m.id)?qt(Math.min(ko,Xt(D.length)))*a:0,nameplate:zr(m.aggregate?.label??Lt(t,m.kind),D.length,U,Mo(t,m.kind)!==void 0,a),weight:U*1e3+D.length,...f.includes(m.kind)&&(r.screens?.[m.kind]?.length??0)>0?{marquee:{width:bo+12,height:wo(r.screens[m.kind].map(ne=>ne.title),bo,r.nameWidth)+8}}:{}}}),t,{width:o.width-l,height:o.height-c},o.chrome?{...o.inset,right:Math.min(o.inset?.right??0,8)}:o.inset??{},{...o.cityOrder?{order:o.cityOrder}:{},...o.plots?{plots:o.plots}:{},...r.cityZoom&&r.cityZoom!==1?{zoom:r.cityZoom}:{},keep:[...n.selection??[],...n.focusId?[n.focusId]:[]].flatMap(m=>m.startsWith("kind:")?[m.slice(5)]:m.startsWith("aggregate:")&&!m.includes("|")?[m.slice(10)]:J&&m===I?.id?[I.kind]:[]),...r.tilt!==void 0?{tilt:r.tilt}:{},pan:{x:n.pan?.x??0,y:n.pan?.y??0},...j||o.chrome?.length?{avoid:[...j?[j]:[],...o.chrome??[]]}:{}}):null,Re=new Map(ce?.placed.map(m=>[m.id,m.plot])??[]),tt=new Map(ce?.placed.map(m=>[m.id,m.nameplate])??[]),Et=ce?ce.placed.map(({x:m,y:D,depth:U,width:ne,height:be})=>({x:m,y:D,depth:U,width:ne,height:be})):va(Rt.length,Ke,o.gap,d,S.contextY,W?.97:qr).map(m=>({...m,x:m.x+i})),En=.74,Ot=.8,Zn=52*a,Jn=86*a,Yt=(m,D)=>Math.min(1,m+(1-m)*D),eo=new Map;Rt.forEach((m,D)=>{let U=Et[D],ne=U.width??Ke.width,be=U.height??Ke.height,Ue=m.rank==="secondary"?En:1,me=ce?ne:Math.max(Math.min(ne,Co*a),ne*Ue),Ee=ce?be:Math.max(Xr*a,be*Ue);eo.set(m.id,{x:U.x+(ne-me)/2,y:U.y+(be-Ee),depth:m.rank==="secondary"?Yt(U.depth,.5):U.depth,width:me,height:Ee})});let On=[],An=Et[Et.length-1],to=new Map;for(let m of nn)to.set(m.nestedUnder,(to.get(m.nestedUnder)??0)+1);let or=new Map;for(let m of nn){let D=eo.get(m.nestedUnder);if(D){let U=to.get(m.nestedUnder)??1,ne=or.get(m.nestedUnder)??0;or.set(m.nestedUnder,ne+1);let be=.98,Ue=Ke.width*Ot,me=Math.max(Jn,Math.min(Ue,D.width/(be*(U-1)+1))),Ee=Math.max(Zn,Ke.height*Ot*(me/Ue)),At=me*be,no=(U-1)*At+me;On.push({...m,x:D.x+(D.width-no)/2+ne*At,y:Math.max(0,D.y-Ee+Math.min(Ee*.5,16)),width:me,height:Ee,depth:Yt(D.depth,.8)})}else if(An){let U=Ke.width*Ot,ne=Ke.height*Ot;On.push({...m,x:An.x,y:An.y,width:U,height:ne,depth:Yt(An.depth??1,.8)})}}for(let m of Rt)On.push({...m,...eo.get(m.id)});return On.forEach(m=>{on({id:m.id,kind:m.kind,plane:2,x:m.x,y:m.y,width:m.width,height:m.height,...m.aggregate?{aggregate:m.aggregate}:{},...m.raised?{raised:!0}:{},...m.focused?{focused:!0}:{},...m.opened?{opened:!0}:{},...m.opened?{openedRows:Math.max(1,Math.floor((Math.max(qt(Math.min(ko,Xt(m.aggregate?.memberIds.length??0))),qt(Xt(m.aggregate?.memberIds.length??0))*(ce?.frame.openedShare??1))-Ar)/vo))}:{},...m.rank?{rank:m.rank}:{},...m.nestedUnder?{nestedUnder:m.nestedUnder}:{},...m.beyond?{beyond:m.beyond}:{},...Re.has(m.id)?{plot:Re.get(m.id)}:{},...tt.has(m.id)?{nameplate:tt.get(m.id)}:{},...ce&&m.aggregate?he(m.kind,m.aggregate.memberIds):{},depth:m.depth})}),{nodes:s,connectors:Ur(e,u,n),width:o.width,height:o.height,...ce?{city:ce.frame}:{},...l>0||c>0?{visible:{width:o.width-l,height:o.height-c}}:{}};function on(m){let D=n.overview&&Oe(m.id)!==null?void 0:n.pins[m.id],U=D?{...m,x:D.x,y:D.y,pinned:!0}:{...m,pinned:!1},ne=n.pan?{...U,x:U.x+n.pan.x,y:U.y+n.pan.y}:U;s.push(ne),u.set(ne.id,ne)}}function No(e,t,n){let r=e.nodes.find(l=>l.id===t);if(!r||r.screenOf!==void 0)return null;let o={...r,x:n.x,y:n.y,pinned:!0},a=o.x+o.width/2,i=o.y+o.height/2;return{...e,nodes:e.nodes.map(l=>l.id===t?o:l),connectors:e.connectors.map(l=>l.from===t?{...l,x1:a,y1:i}:l.to===t?{...l,x2:a,y2:i}:l)}}function Bo(e,t){return t.x===0&&t.y===0?e:{...e,nodes:e.nodes.map(n=>({...n,x:n.x+t.x,y:n.y+t.y})),connectors:e.connectors.map(n=>({...n,x1:n.x1+t.x,y1:n.y1+t.y,x2:n.x2+t.x,y2:n.y2+t.y})),...e.city?{city:{...e.city,pan:{x:t.x,y:t.y}}}:{}}}var xe=(e,t,n)=>e+(t-e)*n;function Qr(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}var Zr=new WeakMap;function Sa(e){let t=Zr.get(e);if(t)return t;let n=new Map,r=new Map;for(let o of e.nodes){n.set(o.id,o);for(let a of o.aggregate?.memberIds??[]){let i=r.get(a);i?i.push(o):r.set(a,[o])}}return t={byId:n,groupsOf:r},Zr.set(e,t),t}var Jr=new WeakMap;function ei(e,t){let n=Jr.get(t);if(n||Jr.set(t,n=new WeakMap),n.has(e))return n.get(e);let r=Ma(e,t);return n.set(e,r),r}function Ma(e,t){let{byId:n,groupsOf:r}=Sa(t);if(e.screenOf!==void 0){let i=n.get(we(e.screenOf));if(i)return{...e,x:i.x,y:i.y,width:i.width,height:i.height}}if(Tt(e.id)||Oe(e.id)!==null){let i=(e.aggregate?.memberIds??[]).map(s=>n.get(s)).filter(s=>s!==void 0);if(i.length===0)return null;let l=i.map(Qr),c=l.reduce((s,u)=>s+u.x,0)/l.length,d=l.reduce((s,u)=>s+u.y,0)/l.length;return{...e,x:c-e.width/2,y:d-e.height/2}}let o=r.get(e.id)?.find(i=>i.id===we(e.kind)||i.id===Ae(e.kind));if(!o)return null;let a=Qr(o);return{...e,x:a.x-e.width/2,y:a.y-e.height/2}}function jt(e,t,n){let r=Math.max(0,Math.min(1,n)),o=new Map(e.nodes.map(s=>[s.id,s])),a=new Map(t.nodes.map(s=>[s.id,s])),i=[];for(let[s,u]of o){let h=a.get(s);if(h){i.push($o(u,h,r,1));continue}let g=ei(u,t)??u;i.push($o(u,g,r,1-r))}for(let[s,u]of a){if(o.has(s))continue;let h=ei(u,e)??u;i.push($o(h,u,r,r))}let l=new Map(e.connectors.map(s=>[s.id,s])),c=new Map(t.connectors.map(s=>[s.id,s])),d=[];for(let[s,u]of l){let h=c.get(s);d.push(h?{...Ra(u,h,r),opacity:1}:{...u,opacity:1-r})}for(let[s,u]of c)l.has(s)||d.push({...u,opacity:r});return{nodes:i.filter(s=>s.opacity>0).sort((s,u)=>s.id<u.id?-1:s.id>u.id?1:0),connectors:d.filter(s=>s.opacity>0).sort((s,u)=>s.id<u.id?-1:s.id>u.id?1:0),width:xe(e.width,t.width,r),height:xe(e.height,t.height,r),t:r,...ti(e.city,t.city,r)?{city:ti(e.city,t.city,r)}:{}}}function ti(e,t,n){return e?t?{cell:xe(e.cell,t.cell,n),...e.tilt!==void 0||t.tilt!==void 0?{tilt:xe(e.tilt??.5,t.tilt??.5,n)}:{},originX:xe(e.originX,t.originX,n),originY:xe(e.originY,t.originY,n),pan:{x:xe(e.pan.x,t.pan.x,n),y:xe(e.pan.y,t.pan.y,n)},extent:{x:xe(e.extent.x,t.extent.x,n),y:xe(e.extent.y,t.extent.y,n),width:xe(e.extent.width,t.extent.width,n),height:xe(e.extent.height,t.extent.height,n)}}:e:t}function $o(e,t,n,r){return{id:t.id,kind:t.kind,plane:xe(e.plane,t.plane,n),x:xe(e.x,t.x,n),y:xe(e.y,t.y,n),width:xe(e.width,t.width,n),height:xe(e.height,t.height,n),pinned:t.pinned,opacity:r,...t.aggregate?{aggregate:t.aggregate}:{},...t.via?{via:t.via}:{},...t.raised?{raised:!0}:{},...t.focused?{focused:!0}:{},...t.opened?{opened:!0}:{},...t.openedRows!==void 0?{openedRows:t.openedRows}:{},...t.compact?{compact:!0}:{},...t.rank?{rank:t.rank}:{},...t.nestedUnder?{nestedUnder:t.nestedUnder}:{},...t.beyond?{beyond:t.beyond}:{},...t.plot?{plot:t.plot}:{},...t.nameplate?{nameplate:t.nameplate}:{},...t.states?{states:t.states}:{},...t.screenOf?{screenOf:t.screenOf}:{},...t.depth===void 0?{}:{depth:xe(e.depth??1,t.depth,n)},...t.natural?{natural:t.natural}:{}}}function Ra(e,t,n){return{...t,x1:xe(e.x1,t.x1,n),y1:xe(e.y1,t.y1,n),x2:xe(e.x2,t.x2,n),y2:xe(e.y2,t.y2,n)}}function Fn(e){let t=Math.max(0,Math.min(1,e));return t<.5?4*t*t*t:1-(-2*t+2)**3/2}function Ea(e,t){let n=[];for(let o=0;o<e.length;o+=1){let a=e[o],i=e[(o+1)%e.length];if(a.y===i.y)continue;let l=Math.min(a.y,i.y),c=Math.max(a.y,i.y);t<l||t>=c||n.push(a.x+(t-a.y)/(i.y-a.y)*(i.x-a.x))}n.sort((o,a)=>o-a);let r={x0:0,x1:0};for(let o=0;o+1<n.length;o+=2){let a={x0:n[o],x1:n[o+1]};a.x1-a.x0>r.x1-r.x0&&(r=a)}return r}function Oa(e){let t=1/0,n=-1/0;for(let r of e)r.y<t&&(t=r.y),r.y>n&&(n=r.y);return{top:t,bottom:n}}function Aa(e){let t=0;for(let n=0;n<e.length;n+=1){let r=e[n],o=e[(n+1)%e.length];t+=r.x*o.y-o.x*r.y}return Math.abs(t)/2}function La(e){let t=0,n=0,r=0;for(let o=0;o<e.length;o+=1){let a=e[o],i=e[(o+1)%e.length],l=a.x*i.y-i.x*a.y;t+=l,n+=(a.x+i.x)*l,r+=(a.y+i.y)*l}if(Math.abs(t)<1e-9){let o=e.reduce((a,i)=>({x:a.x+i.x,y:a.y+i.y}),{x:0,y:0});return{x:o.x/e.length,y:o.y/e.length}}return{x:n/(3*t),y:r/(3*t)}}function Ia(e,t){let{room:n,height:r,size:o,floor:a,measure:i=xo,lines:l=2}=t,c=(f,x)=>f.every(v=>i(v,x)<=n)&&f.length*x*1.15<=r;if(c([e],o))return{lines:[e],fontSize:o,whole:!0};let d=e.split(/\s+/);if(l>1&&d.length>1){let f=1,x=1/0,v=0;for(let E=0;E<d.length-1;E+=1){v+=d[E].length+1;let I=Math.abs(v-e.length/2);I<x&&(x=I,f=E+1)}let y=[d.slice(0,f).join(" "),d.slice(f).join(" ")];if(c(y,o))return{lines:y,fontSize:o,whole:!0};for(let E=o;E>=a;E-=o*.06)if(c(y,E))return{lines:y,fontSize:E,whole:!0}}for(let f=o;f>=a;f-=o*.06)if(c([e],f))return{lines:[e],fontSize:f,whole:!0};let s=i(e,a)/Math.max(1,e.length),u=Math.floor(n/s)-1;if(u<4||a*1.15>r)return null;let h=e.slice(0,u),g=h.lastIndexOf(" ");return{lines:[`${g>3?h.slice(0,g):h}\u2026`],fontSize:a,whole:!1}}var Ta=(e,t)=>e.x0<t.x1&&t.x0<e.x1&&e.y0<t.y1&&t.y0<e.y1;var Q=se(Te(),1);var xt=se(Te(),1);function ni(e){let[t,n]=(0,xt.useState)(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(e).matches);return(0,xt.useEffect)(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;let r=window.matchMedia(e),o=()=>n(r.matches);return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[e]),t}function Pa(){let e=()=>typeof document>"u"?null:document.documentElement.getAttribute("data-graview-motion"),[t,n]=(0,xt.useState)(e);return(0,xt.useEffect)(()=>{if(typeof document>"u"||typeof MutationObserver>"u")return;let r=new MutationObserver(()=>n(e()));return r.observe(document.documentElement,{attributes:!0,attributeFilter:["data-graview-motion"]}),n(e()),()=>r.disconnect()},[]),t}function oi(e){let t=ni("(prefers-reduced-motion: reduce)"),n=ni("(prefers-reduced-transparency: reduce)"),r=Pa();return kr({off:!e,reducedMotion:r==="reduce"||r!=="full"&&t,reducedTransparency:n})}var Ca=xr*1.5,Na=30;function ri(e,t){let[n,r]=(0,xt.useState)(!1),o=e&&!n;return(0,xt.useEffect)(()=>{if(!o||!t||typeof requestAnimationFrame>"u")return;let a=[],i=0,l=0,c=d=>{if(i>0&&a.push(d-i),i=d,a.length>=Na){if(!Sr(a,Ca)){r(!0);return}a.length=0}l=requestAnimationFrame(c)};return l=requestAnimationFrame(c),()=>cancelAnimationFrame(l)},[o,t]),o}var He=se(Te(),1);var Ba=520;function $a(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function ii(e,t={}){let n=t.duration??Ba,r=(t.enabled??!0)&&!$a(),o=(0,He.useRef)(e),[a,i]=(0,He.useState)(()=>jt(e,e,1)),l=(0,He.useRef)(a),c=(0,He.useRef)(null),d=(0,He.useRef)(null);return(0,He.useEffect)(()=>{if(!r||typeof requestAnimationFrame>"u"){o.current=e;let x=jt(e,e,1);if(l.current=x,i(x),typeof requestAnimationFrame>"u")return;let v=requestAnimationFrame(()=>{let y=jt(e,e,1);l.current=y,i(y)});return()=>cancelAnimationFrame(v)}let s=performance.now(),h=d.current!==null&&l.current.t<1&&s-d.current<n?d.current:s;d.current=h;let g=Fn(Math.min(1,(s-h)/n)),w=o.current,f=x=>{let v=Math.min(1,(x-h)/n),y=g>=1?1:(Fn(v)-g)/(1-g),E=jt(w,e,Math.max(0,y));l.current=E,i(E),v<1?c.current=requestAnimationFrame(f):(d.current=null,o.current=e,c.current=requestAnimationFrame(()=>{let I=jt(e,e,1);l.current=I,i(I),c.current=null}))};return c.current=requestAnimationFrame(f),()=>{c.current!==null&&cancelAnimationFrame(c.current);let x=l.current;o.current={...e,...x.city?{city:x.city}:{},nodes:x.nodes.map(v=>({...v,plane:Math.round(v.plane)})),connectors:x.connectors}}},[e,n,r]),a}function ai(e=1100){let{store:t}=pe(),[n,r]=(0,He.useState)(()=>new Set);return(0,He.useEffect)(()=>{let o=null,a=t.subscribe(i=>{r(new Set(i.touched)),o&&clearTimeout(o),o=setTimeout(()=>r(new Set),e)});return()=>{a(),o&&clearTimeout(o)}},[t,e]),n}var Ha={marks:new Map,acts:[]};function si(e=4e3){let{store:t}=pe(),[n,r]=(0,He.useState)(Ha);return(0,He.useEffect)(()=>{let o=null,a=t.subscribe((i,l)=>{r(c=>{let d=new Map(c.marks),s=[...c.acts];for(let u of l){if(u.undoes!==void 0){let w=s.find(x=>x.batch===u.undoes||x.wrote.length>0),f=s.filter(x=>u.writes.some(v=>x.wrote.includes(v)));for(let x of f.length>0?f:w?[w]:[]){for(let v of x.wrote)d.delete(v);s=s.filter(v=>v.batch!==x.batch)}continue}if(u.author.kind!=="agent")continue;let h=u.author.id??"the seat";for(let w of u.writes)d.set(w,h);s.find(w=>w.batch===u.batch)?s=s.map(w=>w.batch===u.batch?{...w,wrote:[...new Set([...w.wrote,...u.writes])]}:w):s=[{batch:u.batch,who:h,intent:u.batchIntent??u.intent,at:u.at,wrote:[...u.writes]},...s].slice(0,12)}return d.size===c.marks.size&&s===c.acts&&d.size===0?c:{marks:d,acts:s}}),o&&clearTimeout(o),o=setTimeout(()=>r(c=>c.marks.size===0?c:{...c,marks:new Map}),e)});return()=>{a(),o&&clearTimeout(o)}},[t,e]),n}var Wt=se(Le(),1),Xe=16;function di({marks:e,questions:t=[],whereIs:n,stageRef:r,width:o,height:a}){if(e.size===0&&t.length===0)return null;let i=r.current,l=i?.getBoundingClientRect()??null,c=[];for(let[s,u]of e){let h=null;if(i&&l&&typeof CSS<"u"){let x=i.querySelector(`[data-graview-pick="${CSS.escape(s)}"]`)?.getBoundingClientRect();x&&x.width>0&&x.height>0&&(h={x:x.left-l.left,y:x.top-l.top,width:x.width,height:x.height})}if(h??=n(s),!h)continue;let g=Math.min(Math.max(h.x+h.width-Xe/2,Xe/2),o-Xe/2),w=Math.min(Math.max(h.y-Xe/4,Xe/2),a-Xe/2);c.push({id:s,who:u,x:g,y:w})}let d=[];for(let s of t){let u=n(s.id);u&&d.push({...s,x:Math.min(Math.max(u.x+u.width/2,Xe),o-Xe),y:Math.min(Math.max(u.y-Xe/2,Xe),a-Xe)})}return c.length===0&&d.length===0?null:(0,Wt.jsxs)("div",{className:"graview-seat-marks","data-testid":"seat-marks","data-graview-seat-marks":c.length,children:[c.map(({id:s,who:u,x:h,y:g})=>(0,Wt.jsx)("span",{className:"graview-seat-mark","data-testid":"seat-mark","data-graview-seat-mark":s,"data-graview-seat-who":u,title:`${u} just changed this`,"aria-hidden":"true",style:{left:h,top:g,"--graview-hue":sn(u)},children:"\u25C6"},s)),d.map(s=>(0,Wt.jsxs)("span",{className:"graview-seat-asking","data-testid":"seat-question","data-graview-seat-asking":s.id,title:s.asks,style:{left:s.x,top:s.y},children:[(0,Wt.jsx)("span",{"aria-hidden":"true",children:"?"}),(0,Wt.jsx)("span",{className:"graview-seat-asking-said",children:s.asks})]},`asking:${s.id}`))]})}var Z=se(Le(),1);function Da({hue:e,mode:t}){let n=t==="docked";return(0,Z.jsxs)("svg",{viewBox:"0 0 32 38","aria-hidden":"true",children:[(0,Z.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",strokeLinecap:"round",children:[(0,Z.jsx)("line",{x1:"16",y1:"3.5",x2:"16",y2:"7"}),(0,Z.jsx)("circle",{cx:"16",cy:"2.6",r:"1.5",fill:"none"}),(0,Z.jsx)("path",{d:"M8 16 V12.5 C8 8.5 11.5 7 16 7 C20.5 7 24 8.5 24 12.5 V16 Z",fill:"currentColor",fillOpacity:"0.1"}),t==="refused"?(0,Z.jsx)("line",{x1:"11",y1:"12.5",x2:"21",y2:"12.5",strokeWidth:"2"}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("rect",{x:"10.2",y:"10.2",width:"11.6",height:"4.6",rx:"2.3",fill:"currentColor",fillOpacity:"0.14",strokeWidth:"1"}),(0,Z.jsx)("circle",{cx:"13.4",cy:"12.5",r:"1.25",fill:"currentColor",stroke:"none",opacity:n?.45:1}),(0,Z.jsx)("circle",{cx:"18.6",cy:"12.5",r:"1.25",fill:"currentColor",stroke:"none",opacity:n?.45:1}),t==="reading"?(0,Z.jsx)("line",{x1:"10.2",y1:"12.5",x2:"21.8",y2:"12.5",strokeWidth:"0.8",opacity:"0.7"}):null]}),(0,Z.jsx)("line",{x1:"16",y1:"16",x2:"16",y2:"18.5"}),(0,Z.jsx)("polygon",{points:"16,18.5 24,22.5 16,26.5 8,22.5",fill:"currentColor",fillOpacity:"0.22"}),(0,Z.jsx)("polygon",{points:"8,22.5 16,26.5 16,33.5 8,29.5",fill:"currentColor",fillOpacity:"0.08"}),(0,Z.jsx)("polygon",{points:"24,22.5 16,26.5 16,33.5 24,29.5",fill:"currentColor",fillOpacity:"0.3"}),t==="writing"?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("polyline",{points:"24,24 28.5,20.5"}),(0,Z.jsx)("line",{x1:"27.5",y1:"19",x2:"30",y2:"21.5",strokeWidth:"1.8"})]}):(0,Z.jsx)("line",{x1:"24",y1:"24",x2:"26.5",y2:"29"}),(0,Z.jsx)("line",{x1:"8",y1:"24",x2:"5.5",y2:"29"}),(0,Z.jsx)("path",{d:"M9.5 33.5 v2.2 h4"}),(0,Z.jsx)("path",{d:"M22.5 33.5 v2.2 h-4"})]}),(0,Z.jsx)("title",{children:`robot, ${t}`})]})}function Fa({hue:e}){return(0,Z.jsxs)("svg",{viewBox:"0 0 22 24","aria-hidden":"true",style:{color:`hsl(${Math.round(e)} 50% 48%)`},children:[(0,Z.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",strokeLinecap:"round",children:[(0,Z.jsx)("circle",{cx:"11",cy:"6",r:"4.2"}),(0,Z.jsx)("path",{d:"M3 23 C3 15.5 6 13 11 13 C16 13 19 15.5 19 23"})]}),(0,Z.jsx)("title",{children:"somebody"})]})}function li({width:e,whereIs:t}){let{who:n,following:r,follow:o}=pe(),a=Tr([...n.values()],t,e);return a.length===0?null:(0,Z.jsx)("div",{className:"graview-occupants","data-testid":"occupants","data-graview-occupants":a.length,children:a.map((i,l)=>{if(i.kind==="over")return(0,Z.jsx)("div",{className:"graview-presence-over","data-testid":"presence-over","data-graview-over-by":i.presence.participant,style:{left:i.box.x-3,top:i.box.y-3,width:i.box.width+6,height:i.box.height+6,"--graview-hue":i.presence.hue}},`over:${i.presence.participant}`);if(i.kind==="count")return(0,Z.jsxs)("span",{className:"graview-figure-count","data-testid":"presence-count","data-graview-at":i.at,style:{left:i.point.x,top:i.point.y},title:`${i.n} more here`,children:["+",i.n]},`count:${i.at}:${l}`);let c=i.presence.hue,d=dr(i.presence)||"somebody";if(i.kind==="edge")return(0,Z.jsxs)("button",{type:"button",className:"graview-figure-edge","data-testid":"presence-edge","data-graview-person":i.presence.participant,style:{right:`calc(${Math.max(8,e-i.point.x)}px + var(--graview-dock, 0px))`,top:i.point.y},onClick:()=>o(i.presence.participant),"aria-label":`${d} is somewhere else \u2014 press to go where they are`,children:["\u2192 ",d]},`edge:${i.presence.participant}`);if(i.kind==="robot")return(0,Z.jsxs)("div",{className:"graview-figure","data-graview-figure":`theirs:${i.presence.participant}`,"data-graview-theirs":"","data-graview-mode":i.mode,"data-graview-at":i.presence.robot?.at??"",style:{transform:`translate(${i.point.x.toFixed(1)}px, ${i.point.y.toFixed(1)}px)`,"--graview-hue":c},children:[(0,Z.jsx)("span",{className:"graview-figure-body",role:"img","aria-label":`${d}'s agent \u2014 ${i.mode}`,style:{cursor:"default"},children:(0,Z.jsx)(Da,{hue:c,mode:i.mode})}),(0,Z.jsxs)("span",{className:"graview-figure-name",children:[d,"'s agent"]})]},`robot:${i.presence.participant}`);let s=r?.participant===i.presence.participant;return(0,Z.jsxs)("div",{className:"graview-figure","data-graview-figure":i.presence.participant,"data-graview-person":"","data-graview-at":i.at,"data-graview-audience":i.audience?"":void 0,"data-graview-followed":s?"":void 0,style:{transform:`translate(${i.point.x.toFixed(1)}px, ${i.point.y.toFixed(1)}px)`,"--graview-hue":c},children:[(0,Z.jsx)("button",{type:"button",className:"graview-figure-body","aria-label":`${d} is here${s?". Press to stop following":". Press to go where they go"}`,"aria-pressed":s,onClick:u=>{u.stopPropagation(),o(s?null:i.presence.participant)},onPointerDown:u=>u.stopPropagation(),children:(0,Z.jsx)(Fa,{hue:c})}),(0,Z.jsx)("span",{className:"graview-figure-name",children:d})]},`person:${i.presence.participant}`)})})}var Wn=se(Te(),1),bn=se(Le(),1),ci={left:"\u2190",right:"\u2192",top:"\u2191",bottom:"\u2193"},Ho=36,xn=56;function ui({result:e,schema:t,chrome:n=[],onGo:r}){let o=To(e);if(o.length===0)return null;let a=s=>(s??[]).flatMap(u=>{let h=e.nodes.find(g=>g.id===u.id);return h?[{left:h.x+u.x,top:h.y+u.y,right:h.x+u.x+u.width,bottom:h.y+u.y+u.height}]:[]}),i=a(e.city?.showings),l=a(e.city?.nameplates),c=[...i,...l,...n.map(s=>({left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height}))],d=[];for(let s of["left","right","top","bottom"]){let u=e.visible??e,h=s==="left"||s==="right"?u.height:u.width,g=s==="left"||s==="right",w=s==="bottom"?Va:s==="top"?xn:Ya+xn/2,f=-1/0,x=[],v=o.filter(y=>y.side===s).sort((y,E)=>y.along-E.along);for(let y of v){let E=an(t,y.kind),I=ja(E),W=g?jn:I/2,F=h-w-(g?0:W),ee=Math.max(xn,y.along,f+W+Wa);if(ee>F)continue;let{at:z,inset:p}=Ga([...c,...x],s,ee,I,u,h);if(z>F+.5)continue;f=z+W,x.push(hi(s,z,I,u,p));let S=s==="left"?{left:p,top:z,transform:"translateY(-50%)"}:s==="right"?{right:`calc(${p}px + var(--graview-dock, 0px))`,top:z,transform:"translateY(-50%)"}:s==="top"?{top:p,left:z,transform:"translateX(-50%)"}:{bottom:`calc(${p}px + var(--graview-scene-foot, var(--graview-sheet, 0px)))`,left:z,transform:"translateX(-50%)"};d.push((0,bn.jsx)("button",{type:"button",className:"graview-edge-sign","data-graview-past-edge":y.id,"aria-label":`${E}, past the ${s} edge \u2014 bring it into view`,title:`${E} is past the ${s} edge`,tabIndex:-1,onPointerDown:L=>L.stopPropagation(),onClick:L=>{L.stopPropagation(),r(y.by)},style:{...za,...S},children:s==="right"||s==="bottom"?`${E} ${ci[s]}`:`${ci[s]} ${E}`},y.id))}}return(0,bn.jsx)(bn.Fragment,{children:d})}var ja=e=>(e.length+2)*7.4+22,jn=Ho/2,pn=6,Wa=6,Va=236,Ya=56;function hi(e,t,n,r,o=pn){return e==="left"||e==="right"?{left:e==="left"?o:r.width-o-n,right:e==="left"?o+n:r.width-o,top:t-jn,bottom:t+jn}:{left:t-n/2,right:t+n/2,top:e==="top"?o:r.height-o-Ho,bottom:e==="top"?o+Ho:r.height-o}}function Ga(e,t,n,r,o,a){let i=t==="left"||t==="right",l=f=>hi(t,f,r,o),c=f=>e.find(x=>{let v=l(f);return v.left<x.right&&x.left<v.right&&v.top<x.bottom&&x.top<v.bottom}),d=c(n);if(!d)return{at:n,inset:pn};let s=i?jn:r/2,u=f=>{let x=n;for(let v=0;v<12;v++){let y=c(x);if(!y)return x;if(x=f>0?(i?y.bottom:y.right)+s+4:(i?y.top:y.left)-s-4,x>a-xn||x<xn)return null}return null},h=u(1);if(h!==null)return{at:h,inset:pn};let g=u(-1);if(g!==null)return{at:g,inset:pn};let w=t==="left"?d.right:t==="right"?o.width-d.left:t==="top"?d.bottom:o.height-d.top;return{at:n,inset:Math.max(pn,w+4)}}var za={position:"absolute",zIndex:Be.lines,minHeight:28,maxWidth:"40%",padding:"3px 10px",font:"inherit",fontSize:"0.75rem",letterSpacing:"0.04em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:6,boxShadow:"0 2px 8px rgb(0 0 0 / 0.12)",cursor:"pointer"};function fi(e){let[t,n]=(0,Wn.useState)(null);return(0,Wn.useLayoutEffect)(()=>{let r=e.current,o=null;for(let l=r?.parentElement??null,c=0;l&&!o&&c<4;l=l.parentElement,c++)o=l.querySelector(":scope > [data-graview-scene-trail]");if(!r||!o)return;let a=()=>{let l=r.getBoundingClientRect(),c=o.getBoundingClientRect(),d=c.width>0&&c.height>0?{x:c.left-l.left,y:c.top-l.top,width:c.width,height:c.height}:null;n(s=>s===d||s&&d&&s.x===d.x&&s.y===d.y&&s.width===d.width&&s.height===d.height?s:d)};if(a(),typeof ResizeObserver>"u")return;let i=new ResizeObserver(a);return i.observe(o),()=>i.disconnect()},[e]),t}var bt=se(Te(),1),_a=180;function mi({view:e,result:t,frame:n,panned:r,closer:o,screenId:a,setCamera:i}){let l=(0,bt.useRef)(new Map),c=Math.round((t.nodes.find(u=>u.id===a)?.height??0)/16),d=(0,bt.useRef)(e.overview??!1),s=(0,bt.useRef)(null);if((0,bt.useEffect)(()=>{if(!e.overview||!a||!t.city){if(d.current&&!e.overview)return;i(F=>F.x===0&&F.y===0?F:{x:0,y:0});return}let u=t.nodes.find(F=>F.id===a);if(!u)return;let h=o>1&&u.screenOf?t.nodes.find(F=>F.id===we(u.screenOf)):void 0,g=h?{x:Math.min(u.x,h.x),y:Math.min(u.y,h.y),width:Math.max(u.x+u.width,h.x+h.width)-Math.min(u.x,h.x),height:Math.max(u.y+u.height,h.y+h.height)-Math.min(u.y,h.y)}:u;if(g.x>=0&&g.y>=0&&g.x+g.width<=t.width&&g.y+g.height<=t.height&&!h)return;let f=24,x=(F,ee,z)=>F<f?f-F:F+ee>z-f?z-f-(F+ee):0,v=pt(t),y=e.pan??{x:0,y:0},E=h?r.x+(t.width/2-(g.x+g.width/2)):r.x+x(g.x,g.width,t.width),I=t.height/2-(g.y+g.height/2),W=h?r.y+(u.y+I<f?f-u.y:I):r.y+x(g.y,g.height,t.height);i({x:(h?E:Math.max(-v.x,Math.min(v.x,E)))-y.x,y:(h?W:Math.max(-v.y,Math.min(v.y,W)))-y.y})},[a,e.overview,o,e.within?.view,c]),n.city){let u=new Map;for(let h of n.nodes){if(!h.plot||Math.round(h.plane)!==2)continue;let g=Zt(h.plot.col+h.plot.side/2,h.plot.row+h.plot.side/2,n.city.cell,n.city.tilt);u.set(h.id,{x:n.city.originX+r.x+g.x,y:n.city.originY+r.y+g.y})}l.current=u}return(0,bt.useEffect)(()=>{let u=e.overview??!1,h=d.current&&!u;if(d.current=u,u&&s.current&&(clearTimeout(s.current),s.current=null),!h)return;let g=e.focusId?yt(e.focusId)[0]:void 0,w=g?l.current.get(we(g)):void 0,f=t.nodes.find(x=>x.id===e.focusId);if(!w||!f){i({x:0,y:0});return}i({x:w.x-(f.x+f.width/2),y:w.y-(f.y+f.height/2)}),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{s.current=null,i({x:0,y:0})},_a)},[e.overview]),(0,bt.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),{gliding:()=>s.current!==null}}var Yn=se(Te(),1),Vn="[data-graview-view]";function Ka(e,t){let n=null;for(let r=e?.closest(Vn)??null;r&&t.contains(r);r=r.parentElement?.closest(Vn)??null)n=r;return n}function yi(e,t){let n=e.getBoundingClientRect();return{left:n.left,top:n.top,right:n.right-t.right,bottom:n.bottom-t.bottom,box:n}}function gi(e,t,n){let r=(0,Yn.useRef)({dock:t,reveal:n});r.current={dock:t,reveal:n},(0,Yn.useEffect)(()=>{let o=e.current;if(!o)return;let a=c=>{let{dock:d}=r.current;if(c.key!=="Tab"||c.defaultPrevented||d.right<=0&&d.bottom<=0)return;let s=yi(o,d),u=[];for(let h of o.querySelectorAll(Vn)){if(h.parentElement?.closest(Vn)||h.inert||h.contains(document.activeElement))continue;let g=h.getBoundingClientRect(),w=Math.max(g.left,s.box.left),f=Math.min(g.right,s.box.right),x=Math.max(g.top,s.box.top),v=Math.min(g.bottom,s.box.bottom);f<=w||v<=x||!(d.right>0&&w>=s.right-1||d.bottom>0&&x>=s.bottom-1)||(h.inert=!0,u.push(h))}u.length!==0&&setTimeout(()=>{for(let h of u)h.inert=!1},0)},i=c=>{let d=c.target,s=Ka(d,o);if(!s)return;let u=!0;try{u=d?.matches(":focus-visible")??!0}catch{}requestAnimationFrame(()=>{for(let h=s.parentElement;h;h=h===o?null:h.parentElement)h.scrollTop!==0&&(h.scrollTop=0),h.scrollLeft!==0&&(h.scrollLeft=0);u&&s.isConnected&&l(s)})},l=c=>{let d=yi(o,r.current.dock),s=c.getBoundingClientRect(),u=12,h=(f,x,v,y)=>y-v>x-f-2*u||v<f+u?f+u-v:y>x-u?x-u-y:0,g=h(d.left,d.right,s.left,s.right),w=h(d.top,d.bottom,s.top,s.bottom);(Math.abs(g)>=1||Math.abs(w)>=1)&&r.current.reveal(Math.round(g),Math.round(w))};return document.addEventListener("keydown",a,!0),o.addEventListener("focusin",i),()=>{document.removeEventListener("keydown",a,!0),o.removeEventListener("focusin",i)}},[e])}var de=se(Te(),1);function pi(){let e=(0,de.useRef)(null),[t,n]=(0,de.useState)({right:0,bottom:0});return(0,de.useLayoutEffect)(()=>{let r=e.current;if(!r)return;let o=()=>{let i=r.getBoundingClientRect(),l={right:Math.round(i.width),bottom:Math.round(i.height)};n(c=>c.right===l.right&&c.bottom===l.bottom?c:l)};if(o(),typeof ResizeObserver>"u")return;let a=new ResizeObserver(o);return a.observe(r),()=>a.disconnect()},[]),{probe:e,dock:t}}function xi(){let[e,t]=(0,de.useState)(null),n=(0,de.useRef)(null),r=(0,de.useRef)(0),o=(0,de.useCallback)(i=>{n.current=i,r.current===0&&(r.current=requestAnimationFrame(()=>{r.current=0,t(n.current)}))},[]),a=(0,de.useCallback)(()=>{r.current!==0&&cancelAnimationFrame(r.current),r.current=0;let i=n.current;return n.current=null,i&&t(null),i},[]);return{held:e,place:o,release:a}}function bi({stage:e,pan:t,setView:n,settled:r}){let o=(0,de.useRef)({x:0,y:0}),a=(0,de.useRef)(0),i=(0,de.useRef)(!1),l=(0,de.useRef)(r);l.current=r;let c=(0,de.useCallback)(()=>[...e.current?.querySelectorAll("[data-graview-world]")??[]],[e]),d=(0,de.useCallback)(()=>{a.current===0&&(a.current=requestAnimationFrame(()=>{a.current=0;let{x:w,y:f}=o.current,x=w===0&&f===0?"":`translate3d(${w}px, ${f}px, 0)`;for(let v of c())v.style.transform=x}))},[c]),s=(0,de.useCallback)(()=>{i.current=!1;for(let w of c())w.style.transform="";l.current()},[c]),u=(0,de.useCallback)((w,f)=>{o.current={x:w.x-f.x,y:w.y-f.y},d()},[d]),h=(0,de.useCallback)(()=>{let{x:w,y:f}=o.current;return w===0&&f===0?!1:(o.current={x:0,y:0},i.current=!0,n(x=>{let v=x.pan??{x:0,y:0};return Ht(x,{x:v.x+w,y:v.y+f})}),window.setTimeout(()=>{i.current&&s()},300),!0)},[n,s]);(0,de.useLayoutEffect)(()=>{i.current&&s()},[t,s]);let g=(0,de.useCallback)(()=>o.current,[]);return{shiftTo:u,settle:h,settling:i,offset:g}}var Ua=4;function wi({view:e,panned:t,limit:n,panWithin:r,moveByTransform:o,setView:a,setDragging:i,noteMoved:l,shift:c,district:d}){let s=(0,de.useRef)(!1),u=(0,de.useRef)(null),h=v=>{let y=e.pan??{x:0,y:0};u.current={kind:"pan",fromX:v.clientX,fromY:v.clientY,baseX:y.x,baseY:y.y,moved:!1}};return{onGroundDown:v=>{v.button===0&&(v.target.closest("[data-graview-view]")||h(v))},onCardDown:(v,y)=>{if(y.button===0){if(v.screenOf!==void 0&&!y.target.closest("[data-graview-grip]")){h(y);return}if(e.overview&&Oe(v.id)!==null){h(y);return}u.current={kind:"card",id:v.id,fromX:y.clientX,fromY:y.clientY,baseX:v.x-t.x,baseY:v.y-t.y,moved:!1}}},onDragMove:v=>{let y=u.current;if(!y)return;let E=v.clientX-y.fromX,I=v.clientY-y.fromY;if(!y.moved){if(Math.hypot(E,I)<Ua)return;y.moved=!0,i(!0),v.currentTarget.setPointerCapture(v.pointerId)}if(y.kind==="pan"){let W=r(n(),{x:y.baseX+E,y:y.baseY+I});o?c.shiftTo(W,e.pan??{x:0,y:0}):a(F=>Ht(F,W))}else y.id&&d.place({id:y.id,x:y.baseX+E,y:y.baseY+I})},onDragUp:()=>{c.settle();let v=d.release();v&&a(y=>mn(y,v.id,{x:v.x,y:v.y})),u.current?.moved&&(s.current=!0,setTimeout(()=>s.current=!1,0),l()),u.current=null,!c.settling.current&&i(!1)},swallow:s}}function vi({stage:e,view:t,setView:n}){let r=(0,de.useRef)({view:t,charge:0,coolUntil:0,lastScale:1});r.current.view=t;let o=(0,de.useRef)(()=>{}),a=(0,de.useRef)(()=>{});return(0,de.useEffect)(()=>{let i=e.current;if(!i)return;let l=(u,h)=>{let g=r.current;if(h<g.coolUntil)return;let w=g.view.overview??!1;u!==w&&(g.coolUntil=h+600,g.charge=0,n(dn(g.view,u)))},c=u=>{let h=r.current,g=h.view.overview??!1;if(u.ctrlKey){if(u.preventDefault(),!g){if(h.charge+=u.deltaY,Math.abs(h.charge)<60)return;h.charge>0?l(!0,performance.now()):h.charge=0;return}o.current(Math.exp(-u.deltaY*.004),u.clientX,u.clientY);return}!g||u.target?.closest("[data-graview-view], .graview-scroll, [data-graview-overlay], .graview-zoom")||(u.preventDefault(),a.current(-u.deltaX,-u.deltaY))},d=u=>{u.preventDefault(),r.current.lastScale=1},s=u=>{u.preventDefault();let h=r.current,g=u.scale??1;if(!(h.view.overview??!1)){g<.72&&l(!0,performance.now());return}let w=g/(h.lastScale||1);h.lastScale=g;let f=u;o.current(w,f.clientX,f.clientY)};return i.addEventListener("wheel",c,{passive:!1}),i.addEventListener("gesturestart",d),i.addEventListener("gesturechange",s),()=>{i.removeEventListener("wheel",c),i.removeEventListener("gesturestart",d),i.removeEventListener("gesturechange",s)}},[n,e]),{zoomAbout:o,panBy:a}}var ki={directed:"You",autonomous:"An agent","co-edited":"You and an agent",rule:"A rule"};function Do(e,t){let n=new Set(e.map(o=>o.id)),r=new Set;for(let o of t){if(n.has(o)){r.add(o);continue}let a=e.find(i=>i.aggregate?.memberIds.includes(o));a&&r.add(a.id)}return r}function Fo(e){return e.emphasized?e.stressed?.95:.08:e.anyChosen?e.mine?.9:.12:e.touches?Math.max(.34,.9-.09*Math.max(0,(e.siblings??1)-1)):.12}function jo(e){return e.edgeChosen?.9:e.lit?.78:e.own*(e.anyLit?e.kit.dim:e.kit.rest)}function nt(e,t){if(!e)return null;let n=Math.max(0,Math.min(2,Math.floor(e.plane))),r=Math.max(0,Math.min(2,Math.ceil(e.plane))),{scale:o}=n===r?Kt(n,t):mr(Kt(n,t),Kt(r,t),e.plane-n);return{x:e.x,y:e.y,width:e.width*o,height:e.height*o}}function Jt(e,t){if(typeof getComputedStyle>"u"||getComputedStyle(e).visibility==="hidden")return null;let n=-1/0,r=-1/0,o=1/0,a=1/0,i=e.getBoundingClientRect();n=Math.max(n,i.left),r=Math.max(r,i.top),o=Math.min(o,i.right),a=Math.min(a,i.bottom);let l=e.parentElement;for(;l&&l!==t;){let d=getComputedStyle(l);if(d.overflowX!=="visible"||d.overflowY!=="visible"){let s=l.getBoundingClientRect();d.overflowX!=="visible"&&(n=Math.max(n,s.left),o=Math.min(o,s.right)),d.overflowY!=="visible"&&(r=Math.max(r,s.top),a=Math.min(a,s.bottom))}l=l.parentElement}if(o-n<=2||a-r<=2)return null;let c=t.getBoundingClientRect();return{x:n-c.left,y:r-c.top,width:o-n,height:a-r}}function De(e,t,n,r=!1){if(!e||typeof document>"u")return null;let o=e.querySelector(`[data-graview-view="${CSS.escape(t)}"]`);if(!o)return null;let a=(n?o.querySelector(".graview-kind-block"):null)??o.querySelector('[data-graview-primitive="panel"], .graview-kind-face, .graview-kind-card')??(r?null:o.querySelector(':scope > [data-graview-primitive="chip"]'))??o;return Jt(a,e)}function Gn(e,t,n,r,o){let a=d=>e.nodes.find(s=>s.id===d);if(o.startsWith("screen:")){let d=e.nodes.find(s=>s.id===we(o.slice(7)));return d?De(t,d.id,!0)??nt(d,n):null}let i=a(o),l=Oe(o);if(!i&&l!==null&&(i=a(Ae(l))),!i&&Tt(o)){let[d]=yt(o);d&&(i=a(we(d)))}if(!i){let d=r.places().find(s=>s.as===o);d&&(i=a(Ae(d.kind))??a(we(d.kind)))}if(i||(i=[...e.nodes].filter(d=>d.aggregate?.memberIds.includes(o)).sort((d,s)=>d.plane-s.plane)[0]),!i)return null;let c=e.city!==void 0;return De(t,i.id,c&&i.aggregate!==void 0&&Math.round(i.plane)===2)??nt(i,n)}var st=se(Te(),1);var le=se(Le(),1);function Mi({kinds:e}){let{store:t}=pe(),{view:n,go:r}=mo(),o=(0,st.useRef)(null),a=go("districts",{align:"start"}),i=a.open,l=h=>an(t.schema,h),c=h=>t.graph.allNodes().filter(g=>g.kind===h).length,d=h=>!n.overview&&n.focusId===Ae(h),s=e.filter(h=>!d(h)),u=h=>{a.setOpen(!1);let g=o.current?.querySelector(".graview-beyond-more")??null;d(h)||r(mt(n,Ae(h))),g?.focus({preventScroll:!0});let w=`[data-graview-view="${Ae(h)}"][tabindex], [data-graview-view="${we(h)}"][tabindex]`,f=40,x=()=>{let v=document.querySelector(w);v?v.focus({preventScroll:!0}):--f>0&&requestAnimationFrame(x)};requestAnimationFrame(x)};return(0,le.jsxs)("div",{ref:o,className:"graview-beyond","data-graview-beyond":e.length,"data-graview-beyond-open":i?"":void 0,children:[(0,le.jsxs)("button",{type:"button",className:"graview-beyond-more","data-testid":"beyond-more",...a.trigger,"aria-haspopup":"menu",title:`${s.length} more district${s.length===1?"":"s"} \u2014 press to see them`,onPointerDown:h=>h.stopPropagation(),onClick:h=>{h.stopPropagation(),a.toggle()},children:[(0,le.jsxs)("span",{className:"graview-beyond-count",children:["+",s.length]}),(0,le.jsx)("span",{className:"graview-beyond-word",children:"more"}),(0,le.jsx)("span",{className:"graview-beyond-chevron","aria-hidden":"true",children:i?"\u25BE":"\u25B4"})]}),i?(0,le.jsx)("ul",{...a.pane,className:"graview-beyond-list",role:"menu","aria-label":"The other districts","data-testid":"beyond-list",style:yo,onPointerDown:h=>h.stopPropagation(),children:e.map(h=>(0,le.jsx)("li",{role:"none",children:(0,le.jsxs)("button",{type:"button",role:"menuitem","data-graview-pick":we(h),"aria-current":d(h)?"location":void 0,title:d(h)?`${l(h)} \u2014 where you are`:`Go to ${l(h)}`,onPointerDown:g=>g.stopPropagation(),onClick:g=>{g.stopPropagation(),u(h)},children:[(0,le.jsx)("span",{className:"graview-beyond-name",children:l(h)}),(0,le.jsx)("span",{className:"graview-beyond-tally",children:d(h)?"here":c(h)})]})},h))}):null]})}function Xa(e,t){if(e===t)return!0;let n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(r=>r==="x"||r==="y"||Vo(e[r],t[r]))}function Vo(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)!==Array.isArray(t)||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==Array.prototype)return!1;if(Array.isArray(e)){let o=t;if(e.length!==o.length)return!1;for(let a=0;a<e.length;a++)if(!Vo(e[a],o[a]))return!1;return!0}let r=Object.keys(e);return r.length!==Object.keys(t).length?!1:r.every(o=>Vo(e[o],t[o]))}var Ri=(0,st.memo)(Ei,(e,t)=>e.mode===t.mode&&e.selected===t.selected&&e.fidelity===t.fidelity&&Xa(e.node,t.node));function Ei({node:e,mode:t,selected:n,fidelity:r}){let{store:o,views:a,view:i}=pe(),l=Ct(),c=Ir(),d=Lr(),s=e.aggregate||Tt(e.id)||Oe(e.id)!==null?"many":"one",u={cardinality:s,fidelity:r??fr[Qa(e.plane)].fidelity},h=s==="many"&&e.id===i.focusId?i.within?.view:void 0,g=a.resolve(e.kind,u,h),w=g?.view,f=a.resolve(e.kind,{cardinality:"many",fidelity:"full"})?.view,x=f!==void 0&&f.generic!==!0,v=e.aggregate?.memberIds,y=(0,st.useMemo)(()=>(v??[]).map(W=>o.graph.getNode(W)).filter(W=>W!==void 0),[v,o,l]),E={...e.aggregate?{nodes:y,label:g?.title??e.aggregate.label}:{node:o.graph.getNode(e.id)},fidelity:u.fidelity,cardinality:u.cardinality,mode:t,selected:n,implicated:c,flagged:d,...e.raised?{raised:!0}:{},...e.focused?{focused:!0}:{},...e.opened?{opened:!0}:{},...e.openedRows!==void 0?{openedRows:e.openedRows}:{},...e.plot?{plot:e.plot}:{},...e.nameplate?{nameplate:e.nameplate}:{},...e.states?{states:e.states}:{},...e.aggregate?.retired?{retired:e.aggregate.retired}:{},...e.rank?{rank:e.rank}:{},...e.nestedUnder?{nestedUnder:e.nestedUnder}:{},...x?{hasOwnView:!0}:{}};if(!w)return(0,le.jsx)(Za,{node:e,props:E});let I=[e.id,g?.title??"",u.fidelity,u.cardinality,t,n,e.raised??!1,e.focused??!1,e.opened??!1,e.openedRows??"",e.rank??"",e.nestedUnder??"",e.plot?`${e.plot.col},${e.plot.row},${e.plot.side}`:"",e.nameplate??"",e.states?e.states.values.map(W=>W.count).join(","):"",e.aggregate?Wo(e.aggregate.memberIds):"",e.aggregate?.retired??"",c?Wo(c):"",d?Wo(d):"",x].join("|");return(0,le.jsx)(uo,{mode:t,children:(0,le.jsx)(Pr,{kind:E.label??e.kind,...g?.title?{view:g.title}:{},children:(0,le.jsx)(qa,{signature:I,graph:l,draw:()=>(0,le.jsx)(w,{...E})})},`${e.id}|${g?.title??""}`)})}var qa=(0,st.memo)(function({draw:t}){return(0,le.jsx)(le.Fragment,{children:t()})},(e,t)=>e.signature===t.signature&&e.graph===t.graph);function Qa(e){return Math.max(0,Math.min(2,Math.round(e)))}function Za({node:e,props:t}){return(0,le.jsxs)("div",{style:{padding:8,font:"13px/1.4 system-ui",overflow:"hidden"},children:[(0,le.jsx)("strong",{children:t.label??e.kind}),t.nodes?(0,le.jsxs)("div",{children:[t.nodes.length," items"]}):(0,le.jsx)("div",{children:e.id})]})}var Oi=(0,st.memo)(function({node:t}){let{store:n}=pe(),r=Pt(),o=t.aggregate,a=o.opens,i=o.memberIds.length,l=Gt(n.schema,o.kind,i),c=o.memberIds.slice(0,3).map(h=>{let g=n.graph.getNode(h),w=g?n.schema.tryDefinition(g.kind):void 0;return g?w?.label?w.label(g):String(g.label??h):h}),d=o.memberIds,s=(0,st.useMemo)(()=>{let h=r?Pn(r):null;return h?d.filter(g=>h.has(g)).length:0},[r,d]),u=a.in==="picture";return(0,le.jsxs)("div",{className:"graview-band-group","data-graview-band":a.in,"data-graview-band-count":i,"data-graview-emphasis":r?s>0?"lit":"dimmed":void 0,title:u?`${o.label} \u2014 press twice to see them all, arranged`:`${o.label}: ${l} \u2014 press twice to open`,children:[(0,le.jsxs)("span",{className:"graview-band-group-head",children:[(0,le.jsx)("span",{className:"graview-band-group-name",children:o.label}),(0,le.jsx)("span",{className:"graview-band-group-open","aria-hidden":"true",children:u?"\u2197":"\u25BE"})]}),(0,le.jsxs)("span",{className:"graview-band-group-names",children:[u?null:(0,le.jsxs)("span",{className:"graview-band-group-count",children:[l,s>0?` \xB7 ${s} match`:""," \xB7 "]}),c.join(" \xB7 "),i>c.length?" \u2026":""]})]})}),Si=new WeakMap;function Wo(e){let t=Si.get(e);if(t!==void 0)return t;let n=2166136261;for(let o of e){for(let a=0;a<o.length;a++)n=Math.imul(n^o.charCodeAt(a),16777619);n=Math.imul(n^44,16777619)}let r=`${e.length}:${(n>>>0).toString(36)}`;return Si.set(e,r),r}var wt=se(Te(),1);function Yo(e,t,n){let r=e.aggregate?[...e.aggregate.memberIds]:[e.id];return n?r.every(a=>t.includes(a))?t.filter(a=>!r.includes(a)):[...t,...r.filter(a=>!t.includes(a))]:r}function Ai(){let[e,t]=(0,wt.useState)(16);return(0,wt.useEffect)(()=>{if(typeof window>"u")return;let n=document.documentElement,r=()=>{let a=parseFloat(getComputedStyle(n).fontSize);Number.isFinite(a)&&t(i=>Math.abs(i-a)<.5?i:a)};r();let o=new MutationObserver(r);return o.observe(n,{attributes:!0,attributeFilter:["style"]}),window.addEventListener("resize",r),()=>{o.disconnect(),window.removeEventListener("resize",r)}},[]),e}function Li(e){let[t,n]=(0,wt.useState)(null);return(0,wt.useLayoutEffect)(()=>{let r=e.current?.getBoundingClientRect();!r||r.width===0||r.height===0||n(o=>o??{width:Math.round(r.width),height:Math.round(r.height)})},[e]),(0,wt.useEffect)(()=>{let r=e.current;if(!r||typeof ResizeObserver>"u")return;let o=l=>{!l||l.width===0||l.height===0||n(c=>{let d={width:Math.round(l.width),height:Math.round(l.height)};return c&&c.width===d.width&&c.height===d.height?c:d})},a=new ResizeObserver(l=>o(l[0]?.contentRect)),i=()=>o(r.getBoundingClientRect());return a.observe(r),addEventListener("resize",i),()=>{a.disconnect(),removeEventListener("resize",i)}},[e]),t}function Go(e,t){if(t==="dark")return`0 ${(10*e).toFixed(1)}px ${(34*e).toFixed(1)}px rgba(0,0,0,${(e+.12).toFixed(2)})`;let n=`0 ${(1+2*e).toFixed(1)}px ${(2+5*e).toFixed(1)}px rgba(20,30,32,${(.03+.06*e).toFixed(3)})`,r=`0 ${(6+26*e).toFixed(1)}px ${(18+60*e).toFixed(1)}px -${(10+10*e).toFixed(1)}px rgba(20,30,32,${(.1+.3*e).toFixed(3)})`;return`${n}, ${r}`}function Ii(e){return`matrix3d(${e.join(",")})`}var ye=se(Te(),1);var zo=(e,t)=>t.some(n=>e.x>n.x&&e.x<n.x+n.width&&e.y>n.y&&e.y<n.y+n.height);function _o(e,t){let n=[],r=[];for(let a=0;a<e.length-1;a++){let i=e[a],l=e[a+1],c=!zo(i,t);c&&r.length===0&&r.push(i);for(let d=1;d<=48;d++){let s=d/48,u={x:i.x+(l.x-i.x)*s,y:i.y+(l.y-i.y)*s},h=!zo(u,t);if(h===c)continue;let g=(d-1)/48,w=s;for(let v=0;v<10;v++){let y=(g+w)/2,E={x:i.x+(l.x-i.x)*y,y:i.y+(l.y-i.y)*y};!zo(E,t)===c?g=y:w=y}let f=(g+w)/2,x={x:i.x+(l.x-i.x)*f,y:i.y+(l.y-i.y)*f};h?r=[x]:(r.push(x),r.length>=2&&n.push(r),r=[]),c=h}c&&r.push(l)}return r.length>=2&&n.push(r),n}function wn(e,t){let n=Math.abs(t.x-e.x);if(Math.abs(t.y-e.y)>n){if(n<2)return[e,t];let a=(e.y+t.y)/2;return[e,{x:e.x,y:a},{x:t.x,y:a},t]}let o=(e.x+t.x)/2;return Math.abs(t.x-e.x)<2?[e,t]:[e,{x:o,y:e.y},{x:o,y:t.y},t]}var Ye=e=>Math.round(e*100)/100,vt=e=>e.map(t=>t.map((n,r)=>`${r===0?"M":"L"} ${Ye(n.x)} ${Ye(n.y)}`).join(" ")).join(" ");function Ko(e,t){if(e.length<3)return vt([e]);let n=[`M ${Ye(e[0].x)} ${Ye(e[0].y)}`];for(let o=1;o<e.length-1;o++){let a=e[o-1],i=e[o],l=e[o+1],c=Math.hypot(i.x-a.x,i.y-a.y),d=Math.hypot(l.x-i.x,l.y-i.y),s=Math.min(t,c/2,d/2),u={x:i.x+(a.x-i.x)/(c||1)*s,y:i.y+(a.y-i.y)/(c||1)*s},h={x:i.x+(l.x-i.x)/(d||1)*s,y:i.y+(l.y-i.y)/(d||1)*s};n.push(`L ${Ye(u.x)} ${Ye(u.y)} Q ${Ye(i.x)} ${Ye(i.y)} ${Ye(h.x)} ${Ye(h.y)}`)}let r=e[e.length-1];return n.push(`L ${Ye(r.x)} ${Ye(r.y)}`),n.join(" ")}function Ti(e,t){return t==="orthogonal"?vt([e]):Ko(e,10)}function Pi(e,t,n){if(e==="orthogonal"){let l=wn(t.p0,t.p1),c=l.slice(1).map((u,h)=>Math.hypot(u.x-l[h].x,u.y-l[h].y)),d=c.reduce((u,h)=>u+h,0)||1,s=n*d;for(let u=0;u<c.length;u++){let h=c[u];if(s<=h||u===c.length-1){let g=h===0?0:Math.min(1,s/h),w=l[u],f=l[u+1];return{x:w.x+(f.x-w.x)*g,y:w.y+(f.y-w.y)*g}}s-=h}return t.p1}let r=e==="straight"?{x:(t.p0.x+t.p1.x)/2,y:(t.p0.y+t.p1.y)/2}:t.c,o=(1-n)*(1-n),a=2*(1-n)*n,i=n*n;return{x:o*t.p0.x+a*r.x+i*t.p1.x,y:o*t.p0.y+a*r.y+i*t.p1.y}}function zn(e,t){return e!=="straight"?t:{...t,c:{x:(t.p0.x+t.p1.x)/2,y:(t.p0.y+t.p1.y)/2}}}function Ci(e,t){let n=t.x-e.x,r=t.y-e.y,o=(n/2+r)/2,a=(r-n/2)/2;if(Math.abs(o)<1||Math.abs(a)<1)return[e,t];let i={x:e.x+2*o,y:e.y+o};return[e,i,t]}function Ni(e){let t=[...e].sort((r,o)=>r.y-o.y||r.x-o.x),n=[];for(let r of t){let o=n.find(a=>r.y<a.bottom+3&&r.y+r.height>a.top-3);o?(o.boxes.push(r),o.top=Math.min(o.top,r.y),o.bottom=Math.max(o.bottom,r.y+r.height)):n.push({top:r.y,bottom:r.y+r.height,boxes:[r]})}for(let r of n)r.boxes.sort((o,a)=>o.x-a.x);return n.sort((r,o)=>r.top-o.top)}var vn=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Xo=(e,t)=>e.findIndex(n=>n.boxes.some(r=>vn(r,t)));function Bi(e,t,n){return t<0?e[0].top-12*2:n>=e.length?e[e.length-1].bottom+12*2:(e[t].bottom+e[n].top)/2}function Qo(e,t){let n=[{from:-1/0,to:1/0}];for(let a of e){let i=[],l=-1/0;for(let d of a.boxes)i.push({from:l,to:d.x-12}),l=Math.max(l,d.x+d.width+12);i.push({from:l,to:1/0});let c=[];for(let d of n)for(let s of i){let u=Math.max(d.from,s.from),h=Math.min(d.to,s.to);h-u>=0&&c.push({from:u,to:h})}n=c}let r=t,o=1/0;for(let a of n){let i=Math.min(Math.max(t,a.from),a.to),l=a.from===-1/0||a.to===1/0,c=Math.abs(i-t)+(l?60:0);c<o&&(o=c,r=i)}return r}var qe=e=>({x:e.x,y:-(e.y+e.height),width:e.width,height:e.height}),_n=e=>e.map(t=>({x:t.x,y:-t.y}));function qo(e){let t=(r,o)=>Math.abs(r-o)<.5,n=e.filter((r,o)=>o===0||!(t(r.x,e[o-1].x)&&t(r.y,e[o-1].y)));return n.filter((r,o)=>{let a=n[o-1],i=n[o+1];return!a||!i||!(t(a.x,r.x)&&t(r.x,i.x)||t(a.y,r.y)&&t(r.y,i.y))})}function Zo(e,t,n){let r=e.boxes.filter(d=>!vn(d,t)&&d.y+d.height<=t.y+1&&d.x<t.x+t.width&&d.x+d.width>t.x),o=[{from:t.x+6,to:t.x+t.width-6}];for(let d of r)o=o.flatMap(s=>[{from:s.from,to:Math.min(s.to,d.x-12/2)},{from:Math.max(s.from,d.x+d.width+12/2),to:s.to}]).filter(s=>s.to>=s.from);let a=null;for(let d of o){let s=Math.min(Math.max(n,d.from),d.to);(a===null||Math.abs(s-n)<Math.abs(a-n))&&(a=s)}if(a!==null)return{x:a,tail:[{x:a,y:t.y}]};let i=n<t.x+t.width/2,l=Qo([e],i?t.x-12:t.x+t.width+12),c=t.y+t.height/2;return{x:l,tail:[{x:l,y:c},{x:l<t.x?t.x:t.x+t.width,y:c}]}}function Uo(e,t,n){let r=Zo({top:-e.bottom,bottom:-e.top,boxes:e.boxes.map(qe)},qe(t),n);return{x:r.x,head:_n(r.tail).reverse()}}function $i(e,t,n,r){let o=t;for(;o>r&&!e[o-1].boxes.some(a=>n>a.x-12/2&&n<a.x+a.width+12/2);)o--;return o}var Hi=(e,t)=>(e%3-1)*Math.max(0,Math.min(4,t/2-3));function Di(e,t,n,r,o,a,i,l){let c=f=>f<0?e[0].top-n:e[f+1].top-e[f].bottom,d=f=>(f<0?(n+e[0].top)/2:Bi(e,f,f+1))+Hi(l,c(f)),s=Zo(e[a],o,i),u=$i(e,a,s.x,t+1),h=d(t);if(u===t+1)return qo([...r.head,{x:r.x,y:h},{x:s.x,y:h},...s.tail]);let g=Qo(e.slice(t+1,u),s.x),w=d(u-1);return qo([...r.head,{x:r.x,y:h},{x:g,y:h},{x:g,y:w},{x:s.x,y:w},...s.tail])}function en(e,t,n,r=0){let o=Ni(n.some(s=>vn(s,e))&&n.some(s=>vn(s,t))?n:[...n,e,t]),a=Xo(o,e),i=Xo(o,t),l=e.x+e.width/2,c=t.x+t.width/2;if(a===i){if(!(a<o.length-1||o.length===1))return _n(en(qe(e),qe(t),n.map(qe),r));let u=Bi(o,a,a+1)+Hi(r,a<o.length-1?o[a+1].top-o[a].bottom:2*12),h=Uo(o[a],e,c),g=Uo(o[a],t,l);return qo([...h.head,{x:h.x,y:u},{x:g.x,y:u},...[...g.head].reverse()])}if(i<a)return _n(en(qe(e),qe(t),n.map(qe),r));let d=Uo(o[a],e,c);return Di(o,a,o[a].bottom,d,t,i,l,r)}function Jo(e,t,n,r=0){if(t.y+t.height<=e.y){let g=Jo(qe(e),qe(t),n.map(qe),r);return g?_n(g):null}let o=e.y+e.height;if(t.y<o)return null;let a=Ni([...n.filter(g=>g.y>=o&&!vn(g,t)),t]),i=Xo(a,t),l=t.x+t.width/2,c=Zo(a[i],t,l),d=$i(a,i,c.x,0),s=d===0?c.x:Qo(a.slice(0,d),c.x),u=Math.min(12,e.width/2),h=Math.min(Math.max(s,e.x+u),e.x+e.width-u);return Di(a,-1,o,{x:h,head:[{x:h,y:o}]},t,i,l,r)}function Fi(e,t=16){let n=new Map;for(let o of e){let a=o.a<o.b?`${o.a}\0${o.b}`:`${o.b}\0${o.a}`,i=n.get(a);i?i.push(o.key):n.set(a,[o.key])}let r=new Map;for(let o of n.values())o.forEach((a,i)=>r.set(a,(i-(o.length-1)/2)*t));return r}var Fe=se(Le(),1);function Un(e,t){let n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),r=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n>0&&r>0)return null;let o=n>.5*Math.min(e.width,t.width),a=!o&&r>.5*Math.min(e.height,t.height);if(o){let w={x:e.x+e.width,y:e.y+e.height/2},f={x:t.x+t.width,y:t.y+t.height/2};return{from:w,to:f,control:{x:Math.max(w.x,f.x)+18,y:(w.y+f.y)/2},mode:"stacked"}}if(a){let w={x:e.x+e.width/2,y:e.y},f={x:t.x+t.width/2,y:t.y};return{from:w,to:f,control:{x:(w.x+f.x)/2,y:Math.min(w.y,f.y)-18},mode:"abreast"}}let i={x:t.x+t.width/2,y:t.y+t.height/2},l={x:e.x+e.width/2,y:e.y+e.height/2},c=Kn(e,i),d=Kn(t,l),s=Math.hypot(d.x-c.x,d.y-c.y);if(s<8)return null;let u=Math.min(36,s*.12),h=-(d.y-c.y)/s,g=(d.x-c.x)/s;return{from:c,to:d,control:{x:(c.x+d.x)/2+h*u,y:(c.y+d.y)/2+g*u},mode:"direct"}}function Kn(e,t){let n=e.x+e.width/2,r=e.y+e.height/2,o=t.x-n,a=t.y-r;if(o===0&&a===0)return{x:n,y:r};let i=o===0?1/0:e.width/2/Math.abs(o),l=a===0?1/0:e.height/2/Math.abs(a),c=Math.min(i,l),d=Math.max(0,c*.98);return{x:n+o*d,y:r+a*d}}function Ja(e,t,n){let r=t.get(e.from),o=t.get(e.to);if(!r||!o)return!1;if(n)return!0;let a=Math.round(r.plane)===1||Math.round(o.plane)===1,i=l=>!!l.aggregate&&Math.round(l.plane)===2;return a&&!i(r)&&!i(o)}var es=()=>({clips:new Map,members:new Map,marks:new Map});function Wi(e,t){let n=t.marks.get(e);if(n)return n;n=new Map;for(let r of e.querySelectorAll("[data-graview-pick], [data-graview-slot]"))for(let o of new Set([r.getAttribute("data-graview-pick"),r.getAttribute("data-graview-slot")])){if(o===null)continue;let a=n.get(o);a?a.push(r):n.set(o,[r])}return t.marks.set(e,n),n}function ts(e,t){let n=t.clips.get(e);if(n===void 0){let r=getComputedStyle(e);n=r.overflow!=="visible"||r.overflowX!=="visible"||r.overflowY!=="visible"?e.getBoundingClientRect():null,t.clips.set(e,n)}return n}function ns(e,t,n){let r=e.parentElement;for(;r!==null;){let o=ts(r,n);if(o&&!(t.right>o.left+1&&t.left<o.right-1&&t.bottom>o.top+1&&t.top<o.bottom-1))return!1;if(r.hasAttribute("data-graview-view"))break;r=r.parentElement}return!0}function kn(e,t,n,r){if(!e||!t||typeof document>"u")return[];let o=r.members.get(t);o||r.members.set(t,o=new Map);let a=o.get(n);if(a)return a;let i=e.getBoundingClientRect(),l=[];for(let c of Wi(t,r).get(n)??[]){if(c.closest("[data-graview-offstage]"))continue;let d=c.getBoundingClientRect();d.width<=2||d.height<=2||ns(c,d,r)&&l.push({x:d.left-i.left,y:d.top-i.top,width:d.width,height:d.height})}return l.sort((c,d)=>c.width*c.height-d.width*d.height),o.set(n,l),l}function Xn(e,t,n,r,o){let a=new Map(e.map(y=>[y.id,y])),i=es(),l=new Map,c=y=>{if(!n||typeof document>"u")return null;let E=l.get(y);return E===void 0&&(E=n.querySelector(`[data-graview-view="${CSS.escape(y)}"]`),l.set(y,E)),E},d=new Map;for(let y of e){let E=De(n,y.id,r)??nt(y,o);E&&d.set(y.id,E)}let s=new Map;if(n&&typeof document<"u"){let y=n.getBoundingClientRect();for(let E of n.querySelectorAll("[data-graview-pick], [data-graview-slot]")){if(E.closest("[data-graview-offstage]"))continue;let I=E.getAttribute("data-graview-pick")??E.getAttribute("data-graview-slot");if(I===null)continue;let W=E.getBoundingClientRect();if(W.width<=2||W.height<=2||W.width>y.width*.6&&W.height>y.height*.6)continue;let F=s.get(I),ee={x:W.left-y.left,y:W.top-y.top,width:W.width,height:W.height};F?F.push(ee):s.set(I,[ee])}}let u=(y,E)=>{let I=[];for(let[W,F]of d)W!==y&&W!==E&&I.push(F);for(let[W,F]of s)W!==y&&W!==E&&I.push(...F);return I},h=y=>Math.round(a.get(y)?.plane??-1)===1,g=[];for(let y of e){let E=d.get(y.id);E&&Math.round(y.plane)===1&&g.push(E)}if(!r&&n&&typeof document<"u"){let y=n.getBoundingClientRect();for(let E of n.querySelectorAll("[data-graview-relation] > span")){let I=E.getBoundingClientRect();I.width>0&&I.height>0&&g.push({x:I.left-y.left,y:I.top-y.top,width:I.width,height:I.height})}}let w=(y,E)=>!r&&h(y)&&h(E)?g:void 0,f=r?void 0:e.find(y=>Math.round(y.plane)===0&&!y.aggregate),x=(y,E,I,W)=>{if(!f)return{};let F=y.to===f.id&&I===f.id;if(!F&&!(y.from===f.id&&E===f.id))return{};let ee=F?y.from:y.to,z=d.get(f.id),p=d.get(ee);if(ee===f.id||!h(ee)||!z||!p)return{};let S=c(f.id),L=T=>S!==null&&Wi(S,i).get(T)?.some(G=>!G.closest("[data-graview-offstage]"))===!0,O=W.map(T=>T.from===f.id?T.to:T.from),H=O.length>0&&O.every(L);return{band:g,tie:{card:z,chip:p,cardIsTo:F,toward:ee,holds:a.get(ee)?.aggregate?.memberIds??[ee]},...H?{said:O}:{}}},v=[];for(let y of t){if(!Ja(y,a,r))continue;let E=d.get(y.from),I=d.get(y.to);if(!E||!I)continue;let W=u(y.from,y.to),F=y.edges,ee=r&&F.some(S=>S.from!==y.from&&kn(n,c(y.from),S.from,i).length>0||S.to!==y.to&&kn(n,c(y.to),S.to,i).length>0),z=w(y.from,y.to);if(r&&!ee||y.loop||F.length===0){v.push({key:y.id,connector:y,edges:F,fromBox:E,toBox:I,fromAnchor:y.from,toAnchor:y.to,obstacles:W,hosts:[],...z?{band:z}:{},...x(y,y.from,y.to,F)});continue}let p=new Map;for(let S of F){let L=S.from===y.from?[]:kn(n,c(y.from),S.from,i),O=S.to===y.to?[]:kn(n,c(y.to),S.to,i),H=[y.from,y.to].find(A=>Math.round(a.get(A)?.plane??-1)===0);if(!r&&H!==void 0&&(H===y.from?S.from!==y.from:S.to!==y.to)&&kn(n,c(H),H===y.from?S.to:S.from,i).length>0)continue;let T=H!==void 0?a.get(H):void 0;if(!r&&T?.aggregate&&n&&(H===y.from?S.from!==y.from&&L.length===0:S.to!==y.to&&O.length===0))continue;let G=L.length>0?S.from:y.from,V=O.length>0?S.to:y.to,Y=`${y.id}|${G}|${V}`,k=p.get(Y);if(k){k.edges.push(S);continue}let $=L.length>0?L:[E],q=O.length>0?O:[I],_=$[0],b=q[0],R=1/0;for(let A of $)for(let M of q){let N=Math.hypot(A.x+A.width/2-(M.x+M.width/2),A.y+A.height/2-(M.y+M.height/2));N<R&&(R=N,_=A,b=M)}p.set(Y,{edges:[S],fromBox:_,toBox:b,fromAnchor:G,toAnchor:V})}for(let[S,L]of p)v.push({key:S,connector:y,obstacles:W,hosts:[...L.fromAnchor!==y.from?[E]:[],...L.toAnchor!==y.to?[I]:[]],...z?{band:z}:{},...L,...x(y,L.fromAnchor,L.toAnchor,L.edges)})}return v}function Vi(e,t,n){let r=new Map(t.map(i=>[i.id,i])),o=new Map;for(let i of n){let l=r.get(i.id);l&&(l.x!==i.x||l.y!==i.y)&&o.set(i.id,{x:i.x-l.x,y:i.y-l.y})}if(o.size===0)return[...e];let a=(i,l)=>{let c=o.get(l);return c?{...i,x:i.x+c.x,y:i.y+c.y}:i};return e.map(i=>{let{from:l,to:c}=i.connector;if(!o.has(l)&&!o.has(c))return i;let d=a(i.fromBox,l),s=a(i.toBox,c),u=i.tie&&{...i.tie,card:a(i.tie.card,i.tie.cardIsTo?c:l),chip:a(i.tie.chip,i.tie.toward)},h=g=>g===i.fromBox?d:g===i.toBox?s:i.tie&&g===i.tie.chip?u.chip:g;return{...i,fromBox:d,toBox:s,...u?{tie:u}:{},...i.band?{band:i.band.map(h)}:{}}})}function er(e,t){let n=(1-t)*(1-t),r=2*(1-t)*t,o=t*t;return{x:n*e.p0.x+r*e.c.x+o*e.p1.x,y:n*e.p0.y+r*e.c.y+o*e.p1.y}}function ji(e,t,n){let r=(1-t)*(1-n),o=(1-t)*n+t*(1-n),a=t*n;return{p0:er(e,t),c:{x:r*e.p0.x+o*e.c.x+a*e.p1.x,y:r*e.p0.y+o*e.c.y+a*e.p1.y},p1:er(e,n)}}function Sn(e,t){let n=d=>t.some(s=>d.x>s.x&&d.x<s.x+s.width&&d.y>s.y&&d.y<s.y+s.height),r=d=>!n(er(e,d)),a=(d,s,u)=>{for(let h=0;h<10;h++){let g=(d+s)/2;r(g)===u?d=g:s=g}return(d+s)/2},i=[],l=null,c=r(0);c&&(l=0);for(let d=1;d<=64;d++){let s=d/64,u=r(s);if(u===c)continue;let h=a((d-1)/64,s,c);u?l=h:l!==null&&(h-l>.001&&i.push(ji(e,l,h)),l=null),c=u}return l!==null&&1-l>.001&&i.push(ji(e,l,1)),i}function Yi({strands:e,result:t,scheme:n,overview:r,selection:o,emphasis:a,stageRef:i,liveOf:l,onPickEdge:c,provisional:d,pointed:s=null}){let u=Bt(),h=new Set(t.nodes.filter(p=>p.plot!==void 0&&Math.round(p.plane)===2).map(p=>p.id)),g=p=>r&&t.city!==void 0&&h.has(p.from)&&h.has(p.to),w=Do(t.nodes,o),f=p=>w.size===0||w.has(p.from)||w.has(p.to),x=new Set(o.filter(p=>It(p)===null)),v=r?t.nodes.find(p=>Math.round(p.plane)===0):void 0,y=v?De(i.current,v.id,!1)??nt(v,n):null;if(e.length===0)return null;let E=p=>p.edges.some(S=>x.has(S.from)||x.has(S.to)),I=x.size>0&&e.some(E),W=new Map;for(let p of e)W.set(p.connector.id,(W.get(p.connector.id)??0)+1);let F=Fi(e.map(p=>({key:p.key,a:p.fromAnchor,b:p.toAnchor}))),ee=new Set,z=e.map((p,S)=>{let{connector:L,fromBox:O,toBox:H}=p,T={x:O.x+O.width/2,y:O.y+O.height/2},G={x:H.x+H.width/2,y:H.y+H.height/2},V=r?Kn(O,G):T,Y=r?Kn(H,T):G,k=L.loop===!0,{connector:$,style:q}=Qt(u,L.kind);if(!$.visible)return null;let _=k?Math.max(22,Math.min(O.width,O.height)*.3):0,b=k?{x:T.x+O.width*.22,y:T.y-O.height/2-_+7}:V,R=(V.x+Y.x)/2,A=(V.y+Y.y)/2,M=Math.hypot(Y.x-V.x,Y.y-V.y),N=Math.min(r?40:90,M*(r?.09:.16)),P=0,B=0;if(M>0){P=-(Y.y-V.y)/M,B=(Y.x-V.x)/M;let re=R-t.width/2,Me=A-t.height/2;if(y&&!k){let it=y.x+y.width/2,Mt=y.y+y.height/2;re=R-it,Me=A-Mt;let ht=Math.abs(P*(it-V.x)+B*(Mt-V.y)),ft=Math.hypot(y.width/2,y.height/2)*.85+24,Ie=((it-V.x)*(Y.x-V.x)+(Mt-V.y)*(Y.y-V.y))/(M*M);ht<ft&&Ie>.1&&Ie<.9&&(N=Math.min(180,Math.max(N,(ft-ht)*2)))}P*re+B*Me<0&&(P=-P,B=-B)}N+=2*(F.get(p.key)??0);let te=zn($.route,{p0:V,c:{x:R+P*N,y:A+B*N},p1:Y}),K=g(L),j=$.route==="orthogonal"||K,J=(re,Me)=>K?Ci(re,Me):wn(re,Me),X=!k&&p.tie?Jo(p.tie.card,p.tie.chip,p.band??[],S):null,fe=X?p.tie.cardIsTo?X.reverse():X:!k&&p.band?en(O,H,p.band,S):null,ie=k||j||fe?[]:Sn(te,[O,H,...p.obstacles]),ve=fe?[fe]:!k&&j?_o(J(V,Y),[O,H,...p.obstacles]):[];if(!k&&ie.length===0&&ve.length===0)return null;let ke=ve[ve.length-1],$e=j||fe?ve[0]?.[0]:ie[0]?.p0,ae=j||fe?ke?.[ke.length-1]:ie[ie.length-1]?.p1,Se=re=>re.map(Me=>`M ${Me.p0.x} ${Me.p0.y} Q ${Me.c.x} ${Me.c.y} ${Me.p1.x} ${Me.p1.y}`).join(" "),ot=`M ${b.x-_} ${b.y} A ${_} ${_} 0 1 1 ${b.x+_} ${b.y} A ${_} ${_} 0 0 1 ${b.x-_} ${b.y}`,oe=k?ot:fe?Ti(fe,$.route):j?vt(ve):Se(ie),Ge=re=>({x:re.x-8,y:re.y-8,width:re.width+16,height:re.height+16}),Ze=[O,H,...p.hosts,...p.obstacles].map(Ge),kt=k?ot:fe?vt(ve):j?vt(_o(J(V,Y),Ze)):Se(Sn(te,Ze)),Je=p.edges.length===1?p.edges[0]:null,Ce=Je?$t(L.kind,Je.from,Je.to):null,lt=Ce!==null&&o.includes(Ce),rt=Ce!==null?d?.get(Ce):void 0,je=p.edges.some(re=>x.has(re.from)||x.has(re.to)),Ne=p.tie?.toward??"",We=p.tie!==void 0&&(s!==null&&(Ne===s||p.tie.holds.includes(s)||p.said?.includes(s)===!0)||x.has(Ne))&&!ee.has(Ne);We&&ee.add(Ne);let ze=!r&&x.size>0&&je||We,_e=a!==null&&L.kind===a||lt,Ve=l?.(L)!==void 0;if(r&&!Ve||!r&&!Ve&&x.size>0&&!je&&!_e&&!We||p.said!==void 0&&!We&&!p.said.some(re=>x.has(re))&&!_e)return null;let ct=r?Fo({emphasized:a!==null,stressed:_e,anyChosen:I,mine:je,touches:f(L),siblings:W.get(L.id)??1}):jo({edgeChosen:lt,lit:ze,anyLit:I||a!==null,own:q.opacity,kit:u.emphasis}),St=ze&&$e&&ae?p.tie?p.tie.cardIsTo?$e:ae:p.edges.some(re=>x.has(re.from))?ae:$e:null,ut=(0,Fe.jsxs)("g",{children:[(0,Fe.jsx)("path",{"data-graview-connector":L.kind,"data-graview-edges":p.edges.length,"data-graview-from":p.fromAnchor,"data-graview-to":p.toAnchor,"data-graview-lit":ze||void 0,"data-graview-activity":l?.(L)?.manner,"data-graview-provisional":rt!==void 0||void 0,opacity:ct*(L.opacity??1)*(rt!==void 0?fn:1),d:oe,fill:"none",stroke:Ut(q),strokeWidth:(ze?Math.max(1.6,po(q,r)):po(q,r))+(_e?.6:0),strokeDasharray:rt!==void 0?hn:Cn[q.pattern],strokeLinecap:"round"}),St?(0,Fe.jsx)("circle",{cx:St.x,cy:St.y,r:2.6,fill:Ut(q),opacity:ct}):null,k&&r?(0,Fe.jsx)("text",{x:b.x,y:b.y-_-5,textAnchor:"middle",opacity:ct,style:{font:"9px var(--graview-font-body, system-ui)",letterSpacing:"0.09em",textTransform:"uppercase",fill:"var(--graview-ink-faint)"},children:rn(L.kind).toLowerCase()}):null]},p.key),et=null;return Ce&&c&&!k&&ct>=.2&&(et=(0,Fe.jsx)("path",{"data-graview-edge":Ce,className:"graview-edge-hit",d:kt,fill:"none",pathLength:1,strokeDasharray:"0.86",strokeDashoffset:-.07,stroke:"transparent",strokeWidth:14,style:{pointerEvents:"stroke",cursor:"pointer"},onClick:re=>{re.stopPropagation(),c(Ce,{x:re.clientX,y:re.clientY})},onContextMenu:re=>{re.preventDefault(),re.stopPropagation(),c(Ce,{x:re.clientX,y:re.clientY})},children:rt!==void 0?(0,Fe.jsx)("title",{children:rt}):null},`hit:${p.key}`)),{key:p.key,line:ut,hit:et}});return(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)("svg",{"aria-hidden":"true","data-graview-world":"",width:t.width,height:t.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:Be.ties},children:z.map(p=>p?.line)}),z.some(p=>p?.hit)?(0,Fe.jsx)("svg",{"data-graview-world":"",width:t.width,height:t.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:Be.tieLabels},children:z.map(p=>p?.hit)}):null]})}var os=e=>e.length*8.4+16;function Gi(e,t){let n=new Map;for(let a of e){let i=n.get(a.key);i?i.push(a):n.set(a.key,[a])}let r=[...n.values()].map(a=>{let i=Math.min(...a.map(c=>c.top)),l=a.filter(c=>c.top-i<=12);return{key:a[0].key,text:a[0].text,left:Math.min(...l.map(c=>c.left)),right:Math.max(...l.map(c=>c.right)),top:i}});r.sort((a,i)=>a.top-i.top||a.left-i.left);let o=r.map(a=>{let i=Math.max(a.right-a.left,Math.min(300,os(a.text))),l=(a.left+a.right)/2;return{left:l-i/2,right:l+i/2}});return r.map((a,i)=>{let l=r.map((v,y)=>({other:v,at:y})).filter(({other:v})=>v!==a&&Math.abs(v.top-a.top)<=12),c=l.filter(({other:v})=>v.right<=a.left).map(({other:v,at:y})=>o[y].right+8<=(v.right+a.left)/2?o[y].right+8:(v.right+a.left+8)/2),d=l.filter(({other:v})=>v.left>=a.right).map(({other:v,at:y})=>o[y].left-8>=(a.right+v.left)/2?o[y].left-8:(a.right+v.left-8)/2),s=Math.max(t.left,...c),u=Math.min(t.right,...d),h=a.right-a.left,g=o[i].right-o[i].left,w=Math.max(h,Math.min(g,u-s)),f=(a.left+a.right)/2,x=h>=w?a.left:Math.max(s,Math.min(f-w/2,u-w));return{key:a.key,text:a.text,left:x,width:w,top:a.top}})}function qn(e){return e<640?{left:8,right:56}:{left:8,right:Math.round(Math.min(128,e*.107))}}function rs(e){return Math.min(260,16+e.length*6.6)}var Mn=(e,t)=>Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));function _i(e,t,n){let r=new Map;for(let i of e){let l=r.get(i.said);l?l.push(i):r.set(i.said,[i])}let o=[],a=[];for(let[i,l]of r){let c=l[0],d=rs(i),{end:s,far:u}=c,h=x=>Math.max(0,Math.min(n.width-d,x)),g=[{x:h(s.x-d/2),y:u.y-22-6,width:d,height:22},{x:h(s.x-d/2),y:u.y+u.height+6,width:d,height:22},{x:u.x+u.width+6,y:s.y-22/2,width:d,height:22},{x:u.x-d-6,y:s.y-22/2,width:d,height:22}],w=g[0],f=1/0;for(let x of g){let y=x.x<0||x.y<0||x.x+x.width>n.width||x.y+x.height>n.height?1e9:0;for(let E of t)y+=Mn(x,E.title)*100+Mn(x,E.box);for(let E of o)y+=Mn(x,E)*100;if(y<f&&(f=y,w=x),y===0)break}o.push(w),a.push({said:i,keys:l.map(x=>x.key),...w})}return a}var zi=(e,t,n=2)=>t.x>=e.x-n&&t.x<=e.x+e.width+n&&t.y>=e.y-n&&t.y<=e.y+e.height+n;function tr(e,t){let n=new Set;for(let r of e)(t.edgeId&&r.edgeId===t.edgeId||t.point&&(zi(r.fromBox,t.point)||zi(r.toBox,t.point))||t.ids?.some(o=>r.ids.includes(o))||t.box&&(Mn(t.box,r.fromBox)>0||Mn(t.box,r.toBox)>0))&&n.add(r.key);return n}var ge=se(Le(),1);function Ui(e){let t=Er(e);return t.length>0?new Map(t.map(n=>[$t(n.edge.kind,n.edge.from,n.edge.to),Rr(n)])):void 0}function Xi({frame:e,width:t,height:n,scheme:r,overview:o,selection:a,emphasis:i,stageRef:l,store:c,graphNodes:d,onPickEdge:s,liveOf:u,holding:h=!1,provisional:g,focusId:w=null,beside:f=!1}){let[x,v]=(0,ye.useState)(0),[y,E]=(0,ye.useState)(null),I=e.t<1,W=(0,ye.useRef)(""),F=(0,ye.useRef)([]),ee=()=>[...l.current?.querySelectorAll("[data-graview-relation] > span")??[]].map(T=>{let G=T.getBoundingClientRect();return`${Math.round(G.left)},${Math.round(G.top)},${Math.round(G.width)}`}).join(" ");(0,ye.useLayoutEffect)(()=>{I||h||(W.current=ee(),F.current=e.nodes,E(Xn(e.nodes,e.connectors,l.current,o,r)))},[e,I,h,a,o,d,r,x,l]),(0,ye.useEffect)(()=>{if(I||h||o||typeof requestAnimationFrame>"u")return;let T=requestAnimationFrame(()=>{ee()!==W.current&&v(G=>G+1)});return()=>cancelAnimationFrame(T)},[y]);let z=e.nodes.map(T=>T.id).join(`
|
|
4
|
-
`);(0,ye.useLayoutEffect)(()=>{let T=l.current;if(T===null||typeof window>"u")return;let G=0,V=()=>{G===0&&(G=requestAnimationFrame(()=>{G=0,v(k=>k+1)}))};T.addEventListener("scroll",V,{capture:!0,passive:!0}),window.addEventListener("resize",V,{passive:!0});let Y=typeof ResizeObserver>"u"?null:new ResizeObserver(V);if(Y){Y.observe(T);for(let k of T.querySelectorAll("[data-graview-view]"))Y.observe(k)}return()=>{G!==0&&cancelAnimationFrame(G),T.removeEventListener("scroll",V,{capture:!0}),window.removeEventListener("resize",V),Y?.disconnect()}},[l,z]);let[p,S]=(0,ye.useState)(null),L=(y??[]).some(T=>T.tie!==void 0);if((0,ye.useEffect)(()=>{let T=l.current;if(!L||T===null)return;let G=Y=>{let k=Y.target?.closest?.("[data-graview-pick], [data-graview-view]");S(k?.getAttribute("data-graview-pick")??k?.getAttribute("data-graview-view")??null)},V=()=>S(null);return T.addEventListener("pointerover",G),T.addEventListener("focusin",G),T.addEventListener("pointerleave",V),T.addEventListener("focusout",V),()=>{T.removeEventListener("pointerover",G),T.removeEventListener("focusin",G),T.removeEventListener("pointerleave",V),T.removeEventListener("focusout",V)}},[L,l]),I)return null;let O=(y&&h?Vi(y,F.current,e.nodes):y)??Xn(e.nodes,e.connectors,null,o,r),H=new Set;for(let T of O){if(T.edges.length!==1)continue;let G=T.edges[0];H.add(`${T.connector.kind}|${G.from}|${G.to}`)}return(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(Yi,{strands:O,result:e,scheme:r,overview:o,selection:a,emphasis:i,stageRef:l,onPickEdge:s,liveOf:u,pointed:p,...g?{provisional:g}:{}}),o&&yn(a,{overview:o,focusId:w,beside:f},T=>c.graph.getNode(T)?.kind).records.length>0?(0,ge.jsx)(ye.Suspense,{fallback:null,children:(0,ge.jsx)(as,{frame:e,width:t,height:n,stageRef:l,tick:x,store:c,graphVersion:d,selection:a,view:{overview:o,focusId:w,beside:f},rulers:g?{...Ki,unsureOf:(T,G,V)=>g.get($t(T,G,V))}:Ki})}):null,o?null:(0,ge.jsx)(ds,{...g?{provisional:g}:{},stageRef:l,nodes:e.nodes,scheme:r,selection:a,store:c,graphNodes:d,overview:o,width:t,height:n,onPickEdge:s,alreadyDrawn:H,tick:x})]})}var Ki={visibleRect:Jt,clipQuadratic:Sn,unsureDash:hn,unsureOpacity:fn},is=un(zt(()=>(__graviewPreload(import.meta.url,["./chunk.FQKH67BP.js","./chunk.GZLYTPE7.js","./chunk.4B73P2WA.js","./chunk.IMRCAU4T.js","./chunk.6II4BONS.js","./chunk.F5BCCGFK.js","./chunk.AJZBJBMO.js"]),import("./chunk.KBJG5SI2.js")))),as=is.part((e,t)=>(0,ge.jsx)(e.RecordLinks,{...t}),{what:"The links",quiet:!0}),ss=44;function ds({stageRef:e,nodes:t,scheme:n,selection:r,store:o,graphNodes:a,overview:i,width:l,height:c,onPickEdge:d,alreadyDrawn:s,tick:u,provisional:h}){let g=Bt(),w=(0,ye.useMemo)(()=>{if(r.length===0||r.length>4)return[];let p=new Set(r),S=[];for(let O of r){let H=It(O);H&&S.push({kind:H.kind,self:H.from,other:H.to})}for(let O of o.graph.allEdges()){let H=p.has(O.from)?O.from:p.has(O.to)?O.to:null;if(!H)continue;let T=H===O.from?O.to:O.from;p.has(T)||S.push({kind:O.kind,self:H,other:T})}if(S.length<=14)return S;let L=new Set(t.map(O=>O.id));return S.map((O,H)=>({tie:O,index:H,real:L.has(O.other)?0:1})).sort((O,H)=>O.real-H.real||O.index-H.index).slice(0,14).map(({tie:O})=>O)},[o,r,a,t]),f=()=>{if(w.length===0||typeof document>"u")return[];let p=e.current?.getBoundingClientRect();if(!p)return[];let S=[...e.current?.querySelectorAll("[data-graview-joins]")??[]].find(k=>{if(k.closest("[data-graview-offstage]"))return!1;try{let $=JSON.parse(k.getAttribute("data-graview-joins")??"[]");return $.length===r.length&&$.every(q=>r.includes(q))}catch{return!1}});if(S){let k=Jt(S,e.current);if(!k)return[];let $=[];for(let q of r){let _=t.find(M=>M.id===q);if(!_)continue;let b=De(e.current,_.id,i)??nt(_,n),R=b?Un(k,b):null;if(!b||!R)continue;let A=[...o.graph.allEdges()].find(M=>M.from===q&&r.includes(M.to)||M.to===q&&r.includes(M.from));$.push({key:`join:${q}`,self:q,other:"",others:1,kind:A?.kind??"",endX:R.to.x,endY:R.to.y,...R,fromBox:k,toBox:b,proxy:!1,edgeId:A?$t(A.kind,A.from,A.to):null})}return $}let L=(k,$)=>{let q=e.current?.querySelectorAll(`[data-graview-pick="${CSS.escape(k)}"], [data-graview-slot="${CSS.escape(k)}"]`),_=[];for(let b of q??[]){if(b.closest("[data-graview-offstage]")||$(b)||b.closest("[data-graview-mark]"))continue;let R=Jt(b,e.current);R&&_.push(R)}return _.sort((b,R)=>b.width*b.height-R.width*R.height)},O=k=>t.find($=>$.id===k)??t.find($=>$.aggregate?.memberIds.includes(k)),H=k=>`[data-graview-pick="${CSS.escape(k)}"], [data-graview-slot="${CSS.escape(k)}"]`,T=(k,$)=>{let q=e.current;if(!q)return!1;for(let _ of q.querySelectorAll("[data-graview-view]")){let b=_.querySelector(H(k));if(b===null||b.closest("[data-graview-offstage]"))continue;let R=_.querySelector(H($));if(R!==null&&!R.closest("[data-graview-offstage]"))return!0}return!1},G=[];if(!i&&e.current){for(let k of t){if(Math.round(k.plane)!==1)continue;let $=De(e.current,k.id,!1);$&&G.push($)}for(let k of e.current.querySelectorAll("[data-graview-relation] > span")){let $=k.getBoundingClientRect();$.width>0&&$.height>0&&G.push({x:$.left-p.left,y:$.top-p.top,width:$.width,height:$.height})}}let V=new Map,Y=[];for(let k of w){if(T(k.self,k.other))continue;let $=O(k.self),q=$?e.current?.querySelector(`[data-graview-view="${CSS.escape($.id)}"]`):null,_=!i&&$?.id===k.self&&Math.round($.plane)===1?De(e.current,$.id,!1):null,b=_?[_]:L(k.self,()=>!1);if(!(b.length>0)&&$){let ae=De(e.current,$.id,!1)??nt($,n);ae&&b.push(ae)}let A=t.find(ae=>ae.id===k.other),M=[],N=!1;if(A){let ae=De(e.current,A.id,i)??nt(A,n);ae&&M.push(ae)}else if(M.push(...L(k.other,ae=>q?q.contains(ae):!1)),M.length===0){let ae=O(k.other);if(ae&&(!$||ae.id!==$.id)){let Se=De(e.current,ae.id,i)??nt(ae,n);Se&&(M.push(Se),N=!0)}}if(b.length===0||M.length===0||N&&i)continue;let P=b[0],B=M[0],te=1/0;for(let ae of b)for(let Se of M){let ot=Math.hypot(ae.x+ae.width/2-(Se.x+Se.width/2),ae.y+ae.height/2-(Se.y+Se.height/2));ot<te&&(te=ot,P=ae,B=Se)}if(s?.has(`${k.kind}|${k.self}|${k.other}`)||s?.has(`${k.kind}|${k.other}|${k.self}`))continue;let K=`${k.kind}:${Math.round(P.x)},${Math.round(P.y)}:${Math.round(B.x)},${Math.round(B.y)}`,j=V.get(K);if(j){j.others+=1;continue}let J=Un(P,B);if(!J)continue;let{from:X,control:fe}=J,ie=_&&P===_?en(P,B,G,Y.length):void 0,ve=ie?ie[ie.length-1]:J.to,ke=[...o.graph.allEdges()].find(ae=>ae.kind===k.kind&&(ae.from===k.self&&ae.to===k.other||ae.from===k.other&&ae.to===k.self)),$e={key:`${k.kind}:${k.self}:${k.other}`,self:k.self,other:k.other,others:1,kind:k.kind,endX:ve.x,endY:ve.y,from:X,to:ve,control:fe,fromBox:P,toBox:B,...ie?{points:ie}:{},proxy:N,edgeId:ke?$t(ke.kind,ke.from,ke.to):null};V.set(K,$e),Y.push($e)}for(let k of Y){let $=[...o.graph.allEdges()].find(A=>A.kind===k.kind&&(A.from===k.self&&A.to===k.other||A.from===k.other&&A.to===k.self)),q=o.graph.getNode(k.self),_=o.graph.getNode(k.other);if(!$||!q||!_)continue;let b=$.from===k.self?"out":"in",R=Mr(o.schema,b==="out"?q.kind:_.kind,k.kind,b);k.said=k.proxy?`${R}: ${Gt(o.schema,_.kind,k.others)}`:`${R}: ${Ln(o.schema.tryDefinition(_.kind),_)}`}return Y},[x,v]=(0,ye.useState)([]),[y,E]=(0,ye.useState)([]);(0,ye.useLayoutEffect)(()=>{let p=f();v(p),E(p.some(S=>S.said)?I(p):[])},[w,t,i,n,l,c,s,u,e]);let I=p=>{let S=e.current;if(!S)return[];let L=[];for(let O of S.querySelectorAll("[data-graview-view]")){let H=[...O.children].find(G=>!G.classList.contains("graview-kind-tag")),T=H?Jt(H,S):null;T&&L.push({box:T,title:{...T,height:Math.min(T.height,ss)}})}return _i(p.flatMap(O=>O.said?[{key:O.key,said:O.said,end:{x:O.endX,y:O.endY},far:O.toBox}]:[]),L,{width:l,height:c})},[W,F]=(0,ye.useState)(()=>new Set),ee=(0,ye.useRef)([]);ee.current=x.map(p=>({key:p.key,fromBox:p.fromBox,toBox:p.toBox,ids:[p.self,p.other],edgeId:p.edgeId}));let z=y.length>0;return(0,ye.useEffect)(()=>{let p=e.current;if(!p||!z)return;let S=k=>F($=>$.size===k.size&&[...k].every(q=>$.has(q))?$:k),L=0,O=null,H=()=>{if(L=0,!O)return;let k=p.getBoundingClientRect(),$=O.target instanceof Element?O.target:null;S(tr(ee.current,{point:{x:O.clientX-k.left,y:O.clientY-k.top},edgeId:$?.closest("[data-graview-edge]")?.getAttribute("data-graview-edge")??null}))},T=k=>{O=k,L||(L=requestAnimationFrame(H))},G=()=>{O=null,S(new Set)},V=k=>{let $=k.target instanceof Element?k.target:null;if(!$)return;let q=p.getBoundingClientRect(),_=$.getBoundingClientRect(),b=$.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??$.closest("[data-graview-view]")?.getAttribute("data-graview-view");S(tr(ee.current,{...b?{ids:[b]}:{},box:{x:_.left-q.left,y:_.top-q.top,width:_.width,height:_.height}}))},Y=k=>{k.relatedTarget instanceof Node&&p.contains(k.relatedTarget)||S(new Set)};return p.addEventListener("pointermove",T,{passive:!0}),p.addEventListener("pointerleave",G),p.addEventListener("focusin",V),p.addEventListener("focusout",Y),()=>{L&&cancelAnimationFrame(L),p.removeEventListener("pointermove",T),p.removeEventListener("pointerleave",G),p.removeEventListener("focusin",V),p.removeEventListener("focusout",Y)}},[e,z]),x.length===0?null:(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)("svg",{"aria-hidden":x.some(p=>p.edgeId)?void 0:!0,"data-graview-ties":x.length,"data-graview-world":"",width:l,height:c,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:Be.lines},children:x.map(p=>{let{connector:S,style:L}=Qt(g,p.kind);if(!S.visible)return null;let O=p.edgeId?h?.get(p.edgeId):void 0,H={p0:p.from,c:p.control,p1:p.to},T=p.points?Ko(p.points,10):S.route==="orthogonal"?vt([wn(p.from,p.to)]):(({p0:V,c:Y,p1:k})=>`M ${V.x} ${V.y} Q ${Y.x} ${Y.y} ${k.x} ${k.y}`)(zn(S.route,H)),G=null;if(p.edgeId&&d&&!p.proxy){let V=(k,$)=>$.x>=k.x&&$.x<=k.x+k.width&&$.y>=k.y&&$.y<=k.y+k.height,Y=p.points?[...p.points]:[];for(let k=0;k<=(p.points?-1:40);k++){let $=Pi(S.route,H,k/40);V(p.fromBox,$)||V(p.toBox,$)||Y.push($)}Y.length>=2&&(G=(0,ge.jsx)("path",{"data-graview-edge":p.edgeId,className:"graview-edge-hit",d:`M ${Y[0].x} ${Y[0].y} ${Y.slice(1).map(k=>`L ${k.x} ${k.y}`).join(" ")}`,fill:"none",pathLength:1,strokeDasharray:"0.86",strokeDashoffset:-.07,stroke:"transparent",strokeWidth:14,style:{pointerEvents:"stroke",cursor:"pointer"},onClick:k=>{k.stopPropagation(),d(p.edgeId,{x:k.clientX,y:k.clientY})},onContextMenu:k=>{k.preventDefault(),k.stopPropagation(),d(p.edgeId,{x:k.clientX,y:k.clientY})},children:O!==void 0?(0,ge.jsx)("title",{children:O}):null}))}return(0,ge.jsxs)("g",{opacity:(p.proxy?.32:.72)*(O!==void 0?fn:1),children:[(0,ge.jsx)("path",{"data-graview-tie":p.kind,"data-graview-tie-proxy":p.proxy||void 0,"data-graview-provisional":O!==void 0||void 0,d:T,fill:"none",stroke:Ut(L),strokeWidth:p.proxy?1.1:1.6,strokeDasharray:O!==void 0?hn:Cn[L.pattern],strokeLinecap:"round"}),(0,ge.jsx)("circle",{cx:p.endX,cy:p.endY,r:p.proxy?2:2.6,fill:Ut(L)}),G]},p.key)})}),(0,ge.jsx)("div",{"aria-hidden":"true","data-graview-world":"",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:Be.tieLabels},children:y.map(p=>{let S=x.find(L=>L.key===p.keys[0]);return(0,ge.jsx)("span",{className:"graview-record-link-said","data-graview-link-said":S?.kind,"data-graview-lands":S?.proxy?"district":"record","data-graview-said-for":p.keys.length,"data-graview-tie-said":p.keys.some(L=>W.has(L))?"shown":"waiting",style:{position:"absolute",left:p.x,top:p.y,transform:`translateX(min(0px, calc(${Math.round(l-p.x-8)}px - 100%)))`},children:p.said},p.said)})})]})}function qi({nodes:e,scheme:t,width:n,stageRef:r,moving:o=!1,holding:a=!1}){let i=Bt(),[l,c]=(0,ye.useState)([]);(0,ye.useLayoutEffect)(()=>{o||a||c(d())},[e,o,a,t,n,r]);function d(){let s=[];for(let h of e){if(!h.via||Math.round(h.plane)!==1)continue;let g=De(r.current,h.id,!1,!0),{scale:w}=Kt(1,t);s.push({key:`${h.via.edgeKind}|${h.via.direction}`,text:h.via.description??`${h.via.direction==="in"?"\u2190":"\u2192"} ${rn(h.via.edgeKind).toLowerCase()}`,left:g?.x??h.x,right:g?g.x+g.width:h.x+h.width*w,top:g?.y??h.y})}let u=qn(n);return Gi(s,{left:u.left,right:n-u.right})}return l.length===0||!i.captions.visible||o?null:(0,ge.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:Be.lines},children:l.map(s=>{let{left:u,width:h}=s;return(0,ge.jsx)("div",{"data-graview-relation":s.key,title:s.text,style:{position:"absolute",left:u,width:h,textAlign:"center",top:Math.max(0,s.top-19),fontSize:"0.75rem",letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,ge.jsx)("span",{style:{background:"var(--graview-ground)",padding:"1px 7px",borderRadius:4},children:s.text})},s.key)})})}var Vt=se(Te(),1);var cs=new Set;function Zi(e,t,n,r,o,a,i=0,l=0){let{store:c,views:d,hiddenKinds:s}=pe(),u=Pt(),h=(0,Vt.useContext)(_t),g=fo(),w=(0,Vt.useMemo)(()=>{let v={};for(let y of g){if(y.subjectId===void 0)continue;let E=v[y.subjectId]??=[];for(let I of y.nodeIds)I!==y.subjectId&&!E.includes(I)&&E.push(I)}return v},[g]),f=(0,Vt.useMemo)(()=>({flagged:new Set(g.flatMap(v=>v.nodeIds)),touched:Nn(c.log.all())}),[g,c,a]),x=(0,Vt.useMemo)(()=>({hits:u?Pn(u):cs,...f}),[u,f]);return(0,Vt.useMemo)(()=>({...e,cityZoom:r,...h?{besideTheMap:!0}:{},...s.size>0?{hiddenKinds:[...s].sort()}:{},...Object.keys(w).length>0?{judged:w}:{},relevance:x,inset:{...qn((t?.width??1200)-o.right),top:8,bottom:0},chrome:[{x:(t?.width??1200)-o.right-176,y:0,width:176,height:100},us(t,o)],...o.right>0||o.bottom>0?{dock:o}:{},...i>0?{headroom:i}:{},unit:n,plainGroups:c.schema.kinds.filter(v=>hr(d.lookup(v,{cardinality:"many",fidelity:"full"}))),cityOrder:sr($r({name:"scene",schema:c.schema,mutations:c.allMutations().filter(v=>!v.derived)}).order.map(v=>v.kind),d.arrangement?.()?.order),screens:d.places().reduce((v,y)=>((v[y.kind]??=[]).push({as:y.as,title:y.title,...y.across?{across:y.across}:{}}),v),{}),...t?{width:t.width,height:Math.max(0,t.height-Math.max(64,l))}:{}}),[e,t,n,c,d,s,w,x,r,h,o.right,o.bottom,i,l])}var Qi=224;function us(e,t){let n=e?.width??1200,r=e?.height??800,o=58;return{x:n-t.right-Qi,y:r-t.bottom-o,width:Qi,height:o}}var dt=se(Te(),1);var Ji=se(Te(),1);function Qn(e){let t=e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-joins");if(!t)return null;try{let n=JSON.parse(t);return Array.isArray(n)&&n.length>0&&n.every(r=>typeof r=="string")?n:null}catch{return null}}function ea(e){(0,Ji.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{for(let a of t.querySelectorAll("[data-graview-pick]"))a.getAttribute("tabindex")===null&&a.setAttribute("tabindex","0"),a.getAttribute("role")===null&&fs(a)&&a.setAttribute("role","button")};if(n(),typeof MutationObserver>"u")return;let r=0,o=new MutationObserver(()=>{r===0&&(r=typeof requestAnimationFrame>"u"?0:requestAnimationFrame(()=>{r=0,n()}),r===0&&n())});return o.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-graview-pick"]}),()=>{o.disconnect(),r!==0&&cancelAnimationFrame(r)}},[e])}var hs=new Set(["div","span","p","figure","img","td","output","b","i","em","strong","small","canvas","g","polygon","circle","rect","path","ellipse","polyline","line","use"]);function fs(e){return hs.has(e.localName.toLowerCase())}var tn=se(Le(),1);function ta({node:e,useDom:t,blur:n,touched:r,frontY:o,centerY:a,screen:i,onDrawnHeight:l,crowded:c,activity:d,scheme:s,canvasWidth:u,canvasHeight:h,selected:g,onSelect:w,onPick:f,onTravel:x,onMenu:v,selection:y,onJackIn:E,onDragStart:I,onDragMove:W,onDragEnd:F,swallowClick:ee,children:z}){let{brand:p,store:S,actsDoor:L}=pe(),O=e.beyond?`${e.beyond.length} more district${e.beyond.length===1?"":"s"}`:e.aggregate?.opens?.in==="place"?`${e.aggregate.label}, ${Gt(S.schema,e.aggregate.kind,e.aggregate.memberIds.length)}`:e.aggregate?e.aggregate.label:(()=>{let M=S.graph.getNode(e.id);return M?Ln(S.schema.tryDefinition(e.kind),M):e.id})(),[H,T]=(0,dt.useState)(null),G=Math.round(e.plane)===0&&!e.aggregate;(0,dt.useLayoutEffect)(()=>{if(!G)return;let M=q.current;if(!M)return;let N=()=>{let B=[...M.children].find(X=>X.dataset.graviewKindtag===void 0);if(!B)return;let te=M.getBoundingClientRect(),K=B.getBoundingClientRect(),j=M.offsetWidth>0?te.width/M.offsetWidth:1,J={top:Math.round((K.top-te.top)/j)-9,right:Math.round((te.right-K.right)/j)+14};T(X=>X&&X.top===J.top&&X.right===J.right?X:J)};if(typeof ResizeObserver>"u"){N();return}let P=new ResizeObserver(N);P.observe(M);for(let B of M.children)P.observe(B);return()=>P.disconnect()},[G,e.id]);let V=gr({plane:e.plane,...e.depth!==void 0?{depth:e.depth}:{},onPlot:o!==void 0},s),Y=V.style,k=yr(Y,e.x,e.y,u,h),$=n?V.blur:0,q=(0,dt.useRef)(null);ea(q);let _=e.natural,b=_?Math.min(e.width/_.width,e.height/_.height):1,R=(0,dt.useRef)(null);(0,dt.useEffect)(()=>{if(!i||!l)return;let M=R.current;if(!M||typeof ResizeObserver>"u")return;let N=()=>{let j=0,J=0;for(let X of M.children)if(!(!(X instanceof HTMLElement)||X.classList.contains("graview-screen-fullscreen"))){j=Math.max(j,X.offsetTop+X.offsetHeight);for(let fe of[X,...X.querySelectorAll("*")]){let ie=getComputedStyle(fe).overflowY;(ie==="auto"||ie==="scroll")&&(J+=fe.scrollHeight-fe.clientHeight)}}l(j+J)},P=0,B=()=>{P||(P=requestAnimationFrame(()=>{P=0,N()}))};N();let te=new ResizeObserver(B);te.observe(M);for(let j of M.children)te.observe(j);let K=new MutationObserver(B);return K.observe(M,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>{P&&cancelAnimationFrame(P),te.disconnect(),K.disconnect(),l(void 0)}},[i,l,e.id]);let A=t?{transform:Ii(k),transformOrigin:"0 0",filter:$>0?`blur(${$}px)`:void 0,opacity:pr(Y)*(e.opacity??1),"--graview-lift-low":Go(Y.shadow,s),...o!==void 0?{"--graview-front-y":`${o.toFixed(1)}px`}:{},...a!==void 0?{"--graview-center-y":`${a.toFixed(1)}px`}:{}}:{"--graview-lift-low":Go(Y.shadow,s)};return(0,tn.jsxs)("div",{ref:q,"data-graview-view":e.id,...t?{}:{drawable:""},"data-graview-plane":Math.round(e.plane),"data-graview-selected":g||void 0,"data-graview-touched":r||void 0,"data-graview-plot":o!==void 0?"":void 0,"data-graview-screen":i?"":void 0,"data-graview-record-focus":Math.round(e.plane)===0&&!e.aggregate&&!_&&!i?"":void 0,"data-graview-nested":e.nestedUnder??void 0,"data-graview-crowded":c||void 0,"data-graview-pinned":e.pinned||void 0,"data-graview-activity":d?d.manner:void 0,"data-graview-wrote":d?.wrote||void 0,"data-graview-read":d&&!d.wrote?!0:void 0,"data-graview-broke":d?.broke||void 0,title:d?`${ki[d.manner]} ${d.wrote?"changed this":"read this"}: ${d.intent}`:e.aggregate&&Math.round(e.plane)!==0?`Open ${e.aggregate.label}`:void 0,role:"group","aria-label":O,"aria-keyshortcuts":L&&!e.beyond?L.key:void 0,tabIndex:0,onPointerDown:I,onPointerMove:W,onPointerUp:F,onPointerCancel:F,onClick:M=>{if(ee.current)return;let N=M.target?.closest("input, textarea, select, button, a[href], [contenteditable='true']");if(N&&!N.hasAttribute("data-graview-pick"))return;let P=M.metaKey||M.shiftKey,B=gt(M.target);if(B&&B!==e.id){M.stopPropagation(),f(B,P,Qn(M.target)??void 0);return}w(P)},onKeyDown:M=>{if(L&&!e.beyond&&M.key.toLowerCase()===L.key.toLowerCase()&&!M.metaKey&&!M.ctrlKey&&!M.altKey&&!M.target?.closest("input, textarea, select, [contenteditable='true']")){M.preventDefault(),M.stopPropagation();let K=gt(M.target)??e.id;y.includes(K)||f(K,!1),L.open(M.target instanceof HTMLElement?M.target:M.currentTarget);return}if(M.key!=="Enter"&&M.key!==" "||M.target?.closest("input, textarea, select, button, [contenteditable='true']"))return;let P=gt(M.target);if(M.preventDefault(),M.stopPropagation(),!P||P===e.id){y.length===1&&y[0]===e.id&&!M.metaKey&&!M.shiftKey?E():w(M.metaKey||M.shiftKey);return}let B=Qn(M.target);(B?y.length===B.length&&B.every(K=>y.includes(K)):y.length===1&&y[0]===P)&&!M.metaKey&&!M.shiftKey?x(P):f(P,M.metaKey||M.shiftKey,B??void 0)},onContextMenu:M=>{let N=gt(M.target);M.preventDefault(),M.stopPropagation();let P=N&&N!==e.id?N:e.id;f(P,!1,(P===N?Qn(M.target):null)??void 0),v({x:M.clientX,y:M.clientY,on:P})},onDoubleClick:M=>{let N=gt(M.target);if(N&&N!==e.id){M.stopPropagation(),x(N);return}E()},style:{position:"absolute",...t?{}:{pointerEvents:"none"},zIndex:e.opened?Be.opened:Be.card-Math.round(e.plane),left:t?0:Math.round(e.x),top:t?0:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height),boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",...A},children:[_?(0,tn.jsx)("div",{ref:R,"data-graview-natural":`${Math.round(_.width)}x${Math.round(_.height)}`,style:{position:"absolute",left:"50%",top:"50%",width:_.width,height:_.height,transform:`translate(-50%, -50%) scale(${b})`,transformOrigin:"50% 50%",display:"flex",flexDirection:"column"},children:z}):z,Math.round(e.plane)===0&&!e.aggregate?(0,tn.jsxs)("span",{"data-graview-kindtag":"",className:"graview-kind-tag","aria-hidden":"true",style:{...H??{},"--graview-hue":Math.round(sn(e.kind,p?.accents))},children:[(0,tn.jsx)("span",{style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",background:`hsl(${Math.round(sn(e.kind,p?.accents))} 55% var(--graview-tint-lightness) / 0.9)`}}),ir(S.schema.tryDefinition(e.kind),e.kind)]}):null]})}var ue=se(Le(),1);ho({search:Dr,touchWeights:Nn});var ms=e=>e?{activity:e}:{},ys=e=>`${Math.round(e.x)} ${Math.round(e.y)}`,na=e=>e.stopPropagation(),aa=.6,sa=3,gs=80,oa=e=>Math.round(e.plane)===1&&(e.compact===!0||e.width<175||e.height<gs);function ps(e){let[t,n]=(0,Q.useState)(1),r=(0,Q.useRef)(1);return(0,Q.useEffect)(()=>{e||(r.current=1,n(1))},[e]),[t,r,n]}function xs(e){let[t,n]=(0,Q.useState)({x:0,y:0}),r=(0,Q.useMemo)(()=>({x:(e.pan?.x??0)+t.x,y:(e.pan?.y??0)+t.y}),[e.pan,t]),o=(0,Q.useMemo)(()=>t.x===0&&t.y===0?e:Ht(e,r),[e,t,r]),a=(0,Q.useRef)(t);a.current=t;let i=(0,Q.useCallback)((l,c)=>{let d=a.current,s=(u,h,g)=>Math.max(Math.min(-u,h),Math.min(Math.max(u,h),g+h))-h;return{x:s(l.x,d.x,c.x),y:s(l.y,d.y,c.y)}},[]);return[r,o,i,a,n]}function bs(e,t,n,r,o,a){let i=n!==null&&!t.overview,l=i?null:n,c=(0,Q.useMemo)(()=>{let h=t.pan?{...t,pan:void 0}:t;return l?mn(h,l.id,{x:l.x,y:l.y}):h},[t,l]),d=(0,Q.useMemo)(()=>Dn(e.graph,e.schema,c,r),[e,c,r,o]),s=(0,Q.useMemo)(()=>n&&i?No(d,n.id,{x:n.x,y:n.y})??Dn(e.graph,e.schema,mn(c,n.id,{x:n.x,y:n.y}),r):d,[d,n,i,e,c,r]);return[(0,Q.useMemo)(()=>Bo(s,a??{x:0,y:0}),[s,a]),i]}function ws(){let[e,t]=(0,Q.useState)(!1),[n,r]=(0,Q.useState)(!1),o=(0,Q.useRef)(null),a=(0,Q.useRef)(()=>!1),i=(0,Q.useCallback)(()=>{r(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{o.current=null,!a.current()&&r(!1)},160)},[]);return[e,n,t,i,a,()=>{t(!1),r(!1)}]}function vs(e){let t=(0,Q.useRef)(!1),n=e!==null&&!t.current;return(0,Q.useEffect)(()=>{e!==null&&(t.current=!0)},[e]),n}function ks({registerScene:e,scheme:t,views:n},r,o){let a=(0,Q.useRef)(r);a.current=r,(0,Q.useEffect)(()=>(e({whereIs:i=>Gn(a.current,o.current,t,n,i)}),()=>e(null)),[e,t,n])}function Ss(e,t){(0,Q.useEffect)(()=>{let n;return e.onActive(r=>{let o=t.current;if(!o)return;let a=l=>{let c=o.getBoundingClientRect();e.set({x:l.clientX-c.left,y:l.clientY-c.top})},i=()=>e.set(null);r?(o.addEventListener("pointermove",a),o.addEventListener("pointerleave",i),n=()=>{o.removeEventListener("pointermove",a),o.removeEventListener("pointerleave",i)}):(n?.(),n=void 0)})},[e])}function Ms(e,t,n,r,o,a,i,l){(0,Q.useEffect)(()=>{let c=t.current;if(!c||!e)return;let d=new Set;for(let u of n.nodes)(r.has(u.id)||u.aggregate?.memberIds.some(h=>r.has(h)))&&d.add(u.id);let s=e({canvas:c,layout:n,dirty:d,hostOf:u=>(c.parentElement??c).querySelector(`[data-graview-view="${CSS.escape(u)}"]`),drawOnDom:o,blur:a,scheme:i,fallBack:l});return()=>{s?.()}},[e,n,r,o,a,i,l])}var Rs=zt(()=>(__graviewPreload(import.meta.url,["./chunk.OJGHDWI6.js","./chunk.F5BCCGFK.js","./chunk.AJZBJBMO.js"]),import("./chunk.R45BF6JV.js")));function Es(e,t){let[n]=(0,Q.useState)(()=>{let s=br();return t?e==="dom"||e==="auto"&&s==="dom"?"dom":"gpu":vr(e,{operator:s,present:wr()})}),[r,o]=(0,Q.useState)(!1),a=(0,Q.useCallback)(()=>o(!0),[]),[i,l]=(0,Q.useState)(null),c=n==="gpu"&&!t&&!r&&i===null;return(0,Q.useEffect)(()=>{if(!c)return;let s=!0;return Rs().then(u=>{s&&l(()=>u.attachGpu())},()=>{s&&o(!0)}),()=>{s=!1}},[c]),{attach:(n==="gpu"&&!r?t??i:null)??null,fallBack:a}}function Os(){let[e,t]=(0,Q.useState)(()=>new Set),n=(0,Q.useCallback)(r=>{t(o=>o.size===r.size&&[...r].every(a=>o.has(a))?o:new Set(r))},[]);return[e,n]}function As(){let e=Or();return t=>{let n=t?e.get(t.id):void 0,r=t?.aggregate?.memberIds??[];if(!n&&r.length===0)return;let o=n,a=n?.wrote??!1,i=n?.read??!1,l=n?.broke??!1;for(let c of r){let d=e.get(c);d&&(a||=d.wrote,i||=d.read,l||=d.broke,(!o||d.at>o.at||d.at===o.at&&d.wrote&&!o.wrote)&&(o=d))}return o?{...o,wrote:a,read:i,broke:l}:void 0}}var ra=(e,t)=>e.includes(t)?e.filter(n=>n!==t):[...e,t];function Ls(){let{views:e,view:t,setView:n,setSelection:r}=pe(),o=Pt(),a=(0,Q.useContext)(_t),i=l=>{if(Oe(l.id)===null&&!l.aggregate)return!1;let c=e.resolve(l.kind,{cardinality:"many",fidelity:"full"})?.view;return c!==void 0&&c.generic!==!0};return l=>({onSelect:c=>{if(cn(l.id)){r(s=>c?ra(s,l.id):[l.id]);return}let d=l.aggregate?ln(l.id):[];if(t.overview){r(s=>c?[...new Set([...s,l.id])]:[l.id]);return}if(d.length===1&&!c&&Math.round(l.plane)!==0){let s=d[0];n(u=>ao(u,u.relation===s?null:s));return}r(s=>Yo(l,s,c))},onPick:(c,d,s)=>r(u=>s?d?[...new Set([...u,...s])]:[...s]:d?ra(u,c):[c]),onTravel:c=>{n(d=>({...mt(d,c),relation:null})),r([c])},onJackIn:()=>{let c=l.aggregate?.opens;if(c){c.in==="place"?n(u=>so(u,l.id)):n(u=>Object.entries(c.within).reduce((h,[g,w])=>Tn(h,g,w),mt(dn(u,!1),c.focus))),r([]);return}let d=Oe(l.id),s=d!==null&&(o?.byKind[d]??0)>0;if(a&&d!==null&&t.overview&&!i(l)&&!(s&&t.q)){n(u=>Tn({...mt(u,`aggregate:${d}`),relation:null},"view",null)),r([]);return}n(u=>lo(u,l.id,{ownPicture:i(l),...s&&u.q?{carry:u.q}:{}})),r(l.aggregate?[]:[l.id])}})}var Is=un(zt(()=>(__graviewPreload(import.meta.url,["./chunk.XDYAG276.js","./chunk.HJCQ6I3S.js","./chunk.ZWZ5SEXT.js","./chunk.FQKH67BP.js","./chunk.GZLYTPE7.js","./chunk.4B73P2WA.js","./chunk.IMRCAU4T.js","./chunk.6II4BONS.js","./chunk.F5BCCGFK.js","./chunk.AJZBJBMO.js"]),import("./chunk.S6GJGTJE.js")))),Ts=Is.part((e,t)=>(0,ue.jsx)(e.Ribbons,{...t}),{what:"The relations",quiet:!0}),ia="graview:map-from-above";function Ps(){let[e,t]=(0,Q.useState)(()=>{try{return globalThis.localStorage?.getItem(ia)==="1"}catch{return!1}}),n=(0,Q.useCallback)(r=>{t(r);try{globalThis.localStorage?.setItem(ia,r?"1":"0")}catch{}},[]);return[e,n]}var Cs=un(zt(()=>(__graviewPreload(import.meta.url,["./chunk.XDYAG276.js","./chunk.ZWZ5SEXT.js","./chunk.SG23JC6D.js","./chunk.6II4BONS.js","./chunk.F5BCCGFK.js","./chunk.AJZBJBMO.js"]),import("./chunk.EDSPYKR4.js")))),Ns=Cs.part((e,t)=>(0,ue.jsx)(e.Plots,{...t}),{quiet:!0});function Bs({zoom:e,zoomBy:t,above:n,setAbove:r}){let o=(a,i,l,c)=>(0,ue.jsx)("button",{type:"button",className:"graview-zoom-button","data-testid":`zoom-${a}`,"aria-label":`Zoom ${a}`,title:`Zoom ${a} \u2014 or pinch, or ctrl+wheel`,disabled:c,onClick:()=>t(l),children:i});return(0,ue.jsxs)("div",{className:"graview-zoom","data-graview-foot":"",role:"group","aria-label":"Zoom",onPointerDown:na,onClick:na,children:[o("out","\u2212",1/1.25,e<=aa+1e-6),(0,ue.jsxs)("span",{className:"graview-zoom-level","data-testid":"zoom-level","aria-live":"polite",children:[Math.round(e*100),"%"]}),o("in","+",1.25,e>=sa-1e-6),(0,ue.jsx)("button",{type:"button",className:"graview-zoom-button graview-zoom-above","data-testid":"from-above","aria-pressed":n,title:n?"See the city at an angle again":"See the city from straight above",onClick:()=>r(!n),children:"From above"})]})}function $s({options:e,renderer:t="auto",attachRenderer:n,blur:r=!0,className:o,style:a,animate:i=!0,children:l}){let c=pe(),{store:d,scheme:s,views:u,view:h,setView:g,selection:w,setSelection:f,setMenuAt:x,emphasis:v,brand:y,noteMoved:E,robots:I,motion:W}=c,F=(0,Q.useContext)(_t),ee=(0,Q.useRef)(null),z=(0,Q.useRef)(null),p=Li(z),S=Ai(),{zoomAbout:L,panBy:O}=vi({stage:z,view:h,setView:g}),H=Ct(),T=1,[G,V,Y]=ps(h.overview),[k,$]=Ps(),q=(0,Q.useMemo)(()=>k?{...e,tilt:jr}:e,[e,k]),{probe:_,dock:b}=pi(),R=!h.overview&&(h.zoom||h.past||h.relation)?Math.ceil(14+34*S/16+6):0,A=Zi(q,p,S,T*G,b,H,R,h.overview?0:b.bottom),M=fi(z),[N,P,B,te,K]=xs(h),j=(0,Q.useMemo)(()=>new Set(Object.keys(h.pins).filter(C=>Oe(C)===null)),[h.pins]),J=xi(),[X,fe]=bs(d,h,J.held,A,H,P.pan),[ie,ve,ke,$e,ae,Se]=ws(),ot=vs(p),oe=ii(X,{enabled:i&&!ie&&!ve&&p!==null&&!ot});(0,Q.useEffect)(()=>W.set(ie||ve||oe.t<1),[W,ie,ve,oe]);let Ge=ai(),Ze=si(),kt=mi({view:h,result:X,frame:oe,panned:N,closer:T,screenId:null,setCamera:K});ks(c,oe,z),Ss(c.pointer,z);let[Je,Ce]=Os(),{attach:lt,fallBack:rt}=Es(t,n),je=oi(r);Ms(lt,ee,oe,Ge,Ce,je,s,rt);let Ne=lt===null,We=ri(je&&Ne,ie||ve||oe.t<1),ze=As(),_e=bi({stage:z,pan:h.pan,setView:g,settled:Se});ae.current=_e.settle;let{onGroundDown:Ve,onCardDown:ct,onDragMove:St,onDragUp:ut,swallow:et}=wi({view:h,panned:N,limit:()=>pt(X),panWithin:B,moveByTransform:!0,setView:g,setDragging:ke,noteMoved:E,shift:_e,district:J});L.current=(C,he,ce)=>{if(!h.overview)return;ae.current();let Re=V.current,tt=Math.max(aa,Math.min(sa,Re*C));if(Math.abs(tt-Re)<1e-4)return;V.current=tt,$e(),Y(tt);let Et=z.current?.getBoundingClientRect(),En=X.visible??X,Ot={x:En.width/2,y:En.height/2},Zn=Et&&he!==void 0&&ce!==void 0?{x:he-Et.left,y:ce-Et.top}:Ot,Jn=tt/Re;g(Yt=>Ht(Yt,Po(Yt.pan??{x:0,y:0},te.current,Zn,Ot,Jn))),E()};let re=(C,he,ce=pt(X))=>g(Re=>Ht(Re,B(ce,{x:(Re.pan?.x??0)+C,y:(Re.pan?.y??0)+he})));gi(z,b,(C,he)=>re(C,he)),O.current=(C,he)=>{$e();let ce=pt(X),Re=h.pan??{x:0,y:0},tt=_e.offset();_e.shiftTo(B(ce,{x:Re.x+tt.x+C,y:Re.y+tt.y+he}),Re),E()};let Me=Ls(),it=Bt(),Mt=(0,Q.useCallback)(C=>Qt(it,C).connector.visible,[it]),ht=C=>ze(oe.nodes.find(he=>he.id===C)),ft=(C,he,ce,Re)=>C.originY+N.y+Zt(ce.col+ce.side/Re,ce.row+ce.side/Re,C.cell,C.tilt).y-he.y,Ie={width:X.width,height:X.height},nn={position:"relative",zIndex:Be.stage,...Ie},Rn=C=>Gn(oe,z.current,s,u,C),Rt=C=>Ne||Je.has(C),Ke=oe.nodes.filter(C=>C.screenOf===void 0).map(C=>(0,ue.jsx)(ta,{node:C,crowded:oa(C),useDom:Rt(C.id),blur:We||!Ne&&je,...C.plot&&oe.city&&Math.round(C.plane)===2?{frontY:ft(oe.city,C,C.plot,1),centerY:ft(oe.city,C,C.plot,2)}:{},touched:Ge.has(C.id),...ms(ze(C)),scheme:s,canvasWidth:X.width,canvasHeight:X.height,selected:w.includes(C.id),...Me(C),onMenu:x,selection:w,onDragStart:he=>ct(C,he),onDragMove:St,onDragEnd:ut,swallowClick:et,children:C.beyond?(0,ue.jsx)(Mi,{kinds:C.beyond}):C.aggregate?.opens?(0,ue.jsx)(Oi,{node:C}):(0,ue.jsx)(Ri,{node:C,mode:"scene",selected:w.includes(C.id),...oa(C)?{fidelity:"glyph"}:{}})},C.id));return(0,ue.jsxs)("div",{ref:z,className:`graview-ground${o?` ${o}`:""}`,"data-graview-altitude":h.overview?"":void 0,"data-graview-reach":oe.city?ys(pt(X)):void 0,"data-graview-settled":oe.t>=1&&!kt.gliding()?"":void 0,"data-graview-box":p?`${p.width}x${p.height}`:void 0,"data-graview-renderer":Ne?"dom":"gpu","data-graview-blur":(Ne?We:je)?"":void 0,onPointerDown:Ve,onPointerMove:St,onPointerUp:ut,onPointerCancel:ut,onClick:C=>{et.current||C.target.closest("[data-graview-view], button, aside, section[aria-label], [data-graview-offstage], a, input, select")||(f([]),x(null))},style:{position:"relative",width:"100%",height:"100%",cursor:ie?"grabbing":"grab",touchAction:"none","--graview-altitude":h.overview?1:0,...oe.city?{"--graview-lattice-cell":`${oe.city.cell.toFixed(2)}px`,"--graview-lattice-tilt":(oe.city.tilt??.5).toFixed(3),"--graview-lattice-x":`${(oe.city.originX+oe.city.pan.x).toFixed(1)}px`,"--graview-lattice-y":`${(oe.city.originY+oe.city.pan.y).toFixed(1)}px`}:{},...ie?{userSelect:"none"}:{},overflow:"hidden",...a},children:[h.overview&&oe.city?(0,ue.jsx)(Q.Suspense,{fallback:null,children:(0,ue.jsx)(Ts,{frame:oe,...Ie,pan:oe.city.pan,store:d,graphVersion:H,selection:w,view:{overview:h.overview,focusId:h.focusId,beside:F},emphasis:v,hiddenKinds:c.hiddenKinds,drawn:Mt})}):null,(0,ue.jsx)("div",{ref:_,"aria-hidden":"true",style:{position:"absolute",top:0,right:0,width:"var(--graview-dock, 0px)",height:"var(--graview-sheet, 0px)",visibility:"hidden",pointerEvents:"none"}}),oe.city?(0,ue.jsx)(Q.Suspense,{fallback:null,children:(0,ue.jsx)(Ns,{frame:oe,...Ie,pan:oe.city?oe.city.pan:N,brand:y,pinned:j,close:T*G>1.2,swallowed:et,...h.overview?{chosen:yn(w,{overview:h.overview,focusId:h.focusId,beside:F},C=>d.graph.getNode(C)?.kind).records}:{},onFocus:C=>{let he=Oe(C);he!==null&&g(ce=>mt(ce,Ae(he)))}})}):null,Ne?(0,ue.jsx)("div",{"data-graview-stage":"dom","data-graview-world":"",style:{...nn,overflow:"hidden"},children:Ke}):(0,ue.jsxs)("div",{"data-graview-world":"",style:nn,children:[(0,ue.jsx)("div",{"data-graview-stage":"dom","data-graview-under-canvas":"",style:{position:"absolute",left:0,top:0,...Ie,overflow:"hidden"},children:Ke.filter(C=>Je.has(String(C.key)))}),(0,ue.jsx)("canvas",{ref:ee,"data-graview-stage":"gpu",content:"drawable",layoutsubtree:"",...Ie,style:{display:"block",position:"relative",...Ie},children:Ke.filter(C=>!Je.has(String(C.key)))})]}),h.overview&&!ie?(0,ue.jsx)(ui,{result:X,schema:d.schema,chrome:M?[...A.chrome??[],M]:A.chrome??[],onGo:C=>{re(C.x,C.y),E()}}):null,h.overview?(0,ue.jsx)(Bs,{zoom:G,zoomBy:C=>L.current(C),above:k,setAbove:$}):null,(0,ue.jsx)(Xi,{frame:oe,focusId:h.focusId,beside:F,holding:fe,...Ie,scheme:s,overview:!!h.overview,selection:w,emphasis:v,stageRef:z,store:d,graphNodes:H,...(C=>C?{provisional:C}:{})(Ui(d)),onPickEdge:(C,he)=>{et.current||(f([C]),x(he?{...he,on:C}:null))},liveOf:C=>{let he=ht(C.from),ce=ht(C.to);return he?.wrote&&ce?.wrote?he.at>ce.at?he:ce:void 0}}),(0,ue.jsx)(li,{width:X.width,whereIs:Rn}),(0,ue.jsx)(di,{marks:Ze.marks,questions:[...I.values()].filter(C=>C.mode==="asking"&&C.at!==null&&C.say).map(C=>({id:C.at,who:C.who,asks:C.say})),whereIs:Rn,stageRef:z,...Ie}),(0,ue.jsx)(qi,{nodes:oe.nodes,moving:oe.t<1,holding:fe,scheme:s,width:X.width,stageRef:z}),l]})}var Qe=se(Te(),1);function Hs(){return ua(),null}var ca=()=>window.location.pathname.endsWith(ar),da=()=>(ca()?lr:io)(window.location.hash),Ds=e=>(ca()?cr:ro)(e);function ua(){let{view:e,setView:t,views:n,principal:r}=pe(),o=JSON.stringify(r),a=(0,Qe.useCallback)(s=>{let u=s.within?.view;if(u===void 0||s.focusId)return s;let h=n.places().find(g=>g.as===u);return h?{...s,focusId:Ae(h.kind)}:s},[n]),i=(0,Qe.useRef)(!1);(0,Qe.useEffect)(()=>{if(typeof window>"u")return;let s=a(da());!In(s,oo)&&!In(s,e)&&(i.current=!0,t(s))},[]),(0,Qe.useEffect)(()=>{if(typeof window>"u")return;let s=()=>t(a(da()));return window.addEventListener("popstate",s),window.addEventListener("hashchange",s),()=>{window.removeEventListener("popstate",s),window.removeEventListener("hashchange",s)}},[t,a]);let l=(0,Qe.useRef)(!1),c=(0,Qe.useRef)(null),d=(0,Qe.useRef)(o);(0,Qe.useEffect)(()=>{if(typeof window>"u")return;if(i.current){i.current=!1;return}let s=d.current!==o;d.current=o;let u=Ds(e),h=u||`${window.location.pathname}${window.location.search}`;if((window.location.hash||(window.location.href.includes("#")?"#":""))===u){l.current=!0,c.current=e;return}if(!l.current){l.current=!0,c.current=e,window.history.replaceState({graview:Nt.at},"",h);return}if(s||ha(c.current,e)){window.history.replaceState({graview:Nt.at},"",h),c.current=e;return}c.current=e,window.history.pushState({graview:++Nt.at},"",h),Nt.depth=Nt.at,Nt.tell()},[e,o])}function ha(e,t){return e?e.focusId===t.focusId&&e.relation===t.relation&&(e.overview??!1)===(t.overview??!1)&&(e.zoom??!1)===(t.zoom??!1)&&(e.past??!1)===(t.past??!1)&&e.expanded.join(",")===t.expanded.join(",")&&(e.shown??[]).join(",")===(t.shown??[]).join(",")&&Fs(e.within,t.within):!1}function Fs(e,t){let n=r=>Object.entries(r??{}).sort(([o],[a])=>o.localeCompare(a)).map(([o,a])=>`${o}=${a}`).join("&");return n(la(e))===n(la(t))}function la(e){if(!e||!("q"in e))return e;let{q:t,...n}=e;return n}var nr=se(Te(),1);var fa=new WeakMap,js=64,ma=new WeakMap,Ws=0,Vs=e=>{if(e===void 0)return 0;let t=ma.get(e);return t===void 0&&ma.set(e,t=Ws+=1),t};function ya(e,t,n,r={}){let o=()=>{let d=[...new Set(t.flatMap(u=>ln(u)))],s=t.map(u=>It(u)).filter(u=>u!==null);return Cr(e,t,{...n.principal?{principal:n.principal}:{},kindSelection:d,edgeSelection:s,...n.providers?{providers:n.providers}:{},...n.pins?{pins:n.pins}:{},...n.focus!==void 0?{focus:n.focus}:{},...r})};if(Object.keys(r).length>0)return o();let a=fa.get(e);if(!a){let d={kept:new Map,at:e.log.length};fa.set(e,a=d),e.subscribe(()=>d.kept.clear())}a.at!==e.log.length&&(a.kept.clear(),a.at=e.log.length);let i=JSON.stringify([t,n.principal??null,Vs(n.providers),n.pins??null,n.focus??null]),l=a.kept.get(i);if(l)return l;let c=o();return a.kept.set(i,c),a.kept.size>js&&a.kept.delete(a.kept.keys().next().value),c}function Ys(e,t,n={}){return ya(e,t,n)}function Gs(e={}){let{store:t,selection:n,principal:r,providers:o}=pe(),{about:a,principal:i=r,providers:l=o,pins:c,focus:d,...s}=e,u=a??n,h=Ct();return(0,nr.useMemo)(()=>ya(t,u,{principal:i,providers:l,pins:c,focus:d},s),[t,u,e,h,i,l])}function zs(){let{store:e,principal:t}=pe();return(0,nr.useMemo)(()=>({preview:(n,r)=>Br(e,n,r??{}),apply:(n,r)=>Nr(e,n,r??{},{author:t})}),[e,t])}export{Ea as a,Oa as b,Aa as c,La as d,Ia as e,Ta as f,$s as g,Hs as h,Ys as i,Gs as j,zs as k};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as n}from"./chunk.4STIUIT6.js";import"./chunk.WHTQHU3M.js";import"./chunk.KU6NIMQX.js";import"./chunk.Y3IJDWNS.js";import"./chunk.OFJH7LDC.js";import"./chunk.5PU3RWYY.js";import"./chunk.OREMUXB5.js";import"./chunk.ZDNJK2SX.js";import"./chunk.ZSSOTIFL.js";import"./chunk.CUCNT7MG.js";import"./chunk.2A2DLMT3.js";import"./chunk.E77K6KBX.js";import"./chunk.WVUJXDXZ.js";import{d as p}from"./chunk.VHWUGSFW.js";import"./chunk.P75TPZWT.js";import"./chunk.6W7J76TK.js";import"./chunk.FUR4IHWG.js";import"./chunk.2B4WVCVV.js";import"./chunk.AAZFVCSP.js";import"./chunk.GZHZLJBF.js";import"./chunk.PWOVXARZ.js";import"./chunk.SG23JC6D.js";import"./chunk.OJGHDWI6.js";import"./chunk.GZLYTPE7.js";import"./chunk.4B73P2WA.js";import"./chunk.IMRCAU4T.js";import"./chunk.BZ5VLPKB.js";import{Q as m}from"./chunk.6II4BONS.js";import"./chunk.F5BCCGFK.js";import{b as t}from"./chunk.AJZBJBMO.js";var i=t(m(),1),a=new WeakMap;function s(o){let e=a.get(o);if(!e){let r=p(o);e=c=>c.mode==="fullscreen"?(0,i.jsx)(n,{blocks:r,slot:"home",heading:2,firstHeading:1}):(0,i.jsx)(n,{blocks:r,slot:"home",heading:3,firstHeading:2}),a.set(o,e)}return e}export{s as homeView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as M}from"./chunk.P75TPZWT.js";import{a as te,b as oe,c as ae,d as ie,e as C,f as L,g as de}from"./chunk.6W7J76TK.js";import{a as se}from"./chunk.FUR4IHWG.js";import{c as j,e as re}from"./chunk.2B4WVCVV.js";import{a as O,b as Z,c as q,d as Q,f as T,m as ee,n as b,o as ne,p as E}from"./chunk.AAZFVCSP.js";import{b as B,d as le,e as ue,g as ye,h as fe,i as pe}from"./chunk.IMRCAU4T.js";import{B as P,H as W,L as H,N as v,T as $,X as K,ca as x,ea as X,ia as G,ja as A,ka as F,rb as J,sa as z,sb as Y,tb as N}from"./chunk.F5BCCGFK.js";var V=e=>e.caption?.trim()||e.name;function je(e){let n=e?.fields?.shape??{};return Object.keys(n).filter(o=>{let r=P(n[o]);for(;r?.innerType;)r=P(r.innerType);return F(n[o])!==void 0||r?.type==="array"&&F(r.element)!==void 0})}function ze(e,n){for(let o of je(n)){let r=A(e[o]).find(G);if(r)return r}}var R=e=>{try{return e()}catch{return null}},we=e=>typeof e=="string"&&te.includes(e);function Ge(e){if(e!==void 0)return we(e)?e:e&&typeof e=="object"&&typeof e.expr=="string"?{expr:R(()=>j(e.expr))}:"neutral"}var Te=4;function Ee(e){let n=typeof e.list=="string"?R(()=>j(e.list)):null,o=e.sort,r=typeof o=="string"?o:o&&typeof o=="object"&&typeof o.by=="string"?o.by:void 0,t=o&&typeof o=="object"?o.direction:void 0,a=n,d;if(n&&r!==void 0)if(t==="choices")d=r;else{let f=R(()=>j(r));a=f?{t:"call",fn:"sort",args:[n,f,{t:"lit",value:t==="desc"?"desc":"asc",at:0}],at:0}:null}let l=typeof e.limit=="number"&&Number.isInteger(e.limit)&&e.limit>=1?Math.min(e.limit,C):void 0,i=e.group,s=typeof i=="string"?i:i&&typeof i=="object"&&typeof i.by=="string"?i.by:void 0,y=i&&typeof i=="object"&&i.headings&&typeof i.headings=="object"?i.headings:{};return{t:"list",source:a,...d?{choiceOrder:d}:{},...l?{limit:l}:{},...s?{group:{by:s,headings:Object.fromEntries(Object.entries(y).filter(f=>typeof f[1]=="string"))}}:{},...typeof e.empty=="string"?{empty:e.empty}:{},as:e.as==="card"?"card":"row"}}function me(e,n=1,o=""){if(!Array.isArray(e)||n>Te)return[];let r={};return e.flatMap(t=>{if(!t||typeof t!="object"||Array.isArray(t))return[];let a=t,d=p=>typeof p=="string"?R(()=>re(p)):null,l=p=>typeof p=="string"?R(()=>j(p)):null,i=Ge(a.tone),s=typeof a.label=="string"?a.label:void 0,y=p=>Object.hasOwn(a,p),f=typeof a.currency=="string"&&/^[A-Z]{3}$/.test(a.currency)?a.currency:void 0,u=y("list")?"list":y("headline")?"headline":typeof a.figure=="string"?"number":Be.find(y);if(!u)return[];let m=r[u]=(r[u]??0)+1,c=a.key,S=typeof c=="string"&&c?c:`${o}${u}.${m}`;return[{...(()=>{switch(u){case"list":return Ee(a);case"number":{let p=ae.includes(a.as)?a.as:void 0,U=ie.includes(a.emphasis)?a.emphasis:void 0;return{t:u,value:l(a.figure),...p?{as:p}:{},...f?{currency:f}:{},...s?{label:d(s)}:{},...U?{emphasis:U}:{}}}case"headline":case"title":return{t:u,parts:d(a[u])};case"text":case"badge":return{t:u,parts:d(a[u]),...i?{tone:i}:{}};case"field":{let p=oe.includes(a.as)?a.as:void 0;return{t:u,field:String(a.field),...p?{as:p}:{},...f?{currency:f}:{},...s?{label:s}:{}}}case"image":return{t:u,field:String(a.image),as:a.as==="gallery"?"gallery":"thumb",...s?{label:s}:{}};case"progress":{let p=a.progress??{};return{t:u,value:l(p.value),max:l(p.max),...s?{label:d(s)}:{}}}case"group":return{t:u,blocks:me(a.group,n+1,`${S}.`),direction:a.direction==="row"?"row":"column"};case"when":return{t:u,when:l(a.when),show:me(a.show,n+1,`${S}.`)};default:return{t:u}}})(),key:S}]})}var Be=["title","text","badge","field","image","progress","group","when","divider","figure"],g="\u2014",Pe=500;function w(e,n){if(!e)return{ok:!1,problem:"an expression that does not parse"};try{return{ok:!0,value:T(e,{graph:n.graph??ee,subject:n.node,kinds:n.kinds,today:n.today,budget:n.budget??Pe})}}catch(o){return{ok:!1,problem:o instanceof Error?o.message:String(o)}}}var ve=(e,n,o)=>!e.format&&e.expr?.t==="ident"&&typeof o=="string"&&n.fields[e.expr.name]?.format==="markdown";function k(e,n,o){if(!e)return{text:g,problem:"a template that does not parse"};let r,t;return{text:e.map(d=>{if(d.text!==void 0)return d.text;let l=w(d.expr??null,n);if(!l.ok)return r??=`{${d.source??""}}: ${l.problem}`,g;if(ve(d,n,l.value))return n.glance?le(l.value,{markdown:!0}):o&&e.length===1?(t=!0,l.value):ue(l.value);let i=!d.format&&d.expr?.t==="ident"&&typeof l.value=="number"?ke(n,d.expr.name):void 0;return ne(d,i?N(l.value,i):b(l.value,d.format,n.today,d.formatArgs,n.money,E(n.schema)))}).join(""),...r?{problem:r}:{},...t?{markdown:t}:{}}}function ce(e,n){if(e===void 0)return;if(typeof e=="string")return e;let o=w(e.expr,n);return o.ok&&we(o.value)?o.value:"neutral"}function xe(e){if(typeof e=="string")try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"?n.href:void 0}catch{return}}var Se=(e,n)=>{let o=e.fields[n]?.type;return o==="phone"||o==="place"||o==="duration"?o:ye(e.definition,n)},ke=(e,n)=>J(e.definition?.fields?.shape?.[n]);function Fe(e,n,o,r,t){if(n==null||n==="")return g;if(typeof n=="boolean")return n?"yes":"no";if(r)return b(n,r,o.today,[],t?{...o.money,currency:t}:o.money);let a=o.fields[e];if(o.definition?.display?.format?.[e])return B(o.definition,e,n);let d=fe(Se(o,e),n,o.money?.locale);if(d!==void 0)return d;if(a?.type==="date")return b(n,"date",o.today,[],o.money);if(a?.type==="datetime"&&typeof n=="string")return H(n,o.money?.locale);if(a?.type==="enum"&&typeof n=="string")return B(o.definition,e,n);let l=typeof n=="number"?ke(o,e):void 0;if(l)return N(n,l);if(typeof n=="number")return v(n,o.money?.locale,{});let i=A(n);return i[0]?i.map(V).join(", "):Array.isArray(n)?n.map(s=>String(s)).join(", "):typeof n=="object"?g:String(n)}function Ne(e,n,o,r,t){return typeof e!="number"?String(e):n==="money"?Y(e,o?{...t,currency:o}:t):n==="percent"?b(e,n,r,[],t):v(e,t?.locale)}var h=(e,n)=>n?{...e,problem:n}:e;function ge(e){return e.firstHeading===void 0?e:{...e,firstHeading:void 0}}function Ce(e,n,o){switch(e.t){case"title":{let r=k(e.parts,n);return h({t:"title",text:r.text},r.problem)}case"text":{let r=k(e.parts,n,!0),t=ce(e.tone,n);return h({t:"text",text:r.text,...t?{tone:t}:{},...r.markdown?{markdown:r.markdown}:{}},r.problem)}case"badge":{let r=k(e.parts,n);return h({t:"badge",text:r.text,tone:ce(e.tone,n)??"neutral"},r.problem)}case"field":{let r=e.label??x(n.definition,e.field);if(!n.node)return{t:"field",field:e.field,label:r,text:g,problem:`"${e.field}" names a field, and these blocks are about no one record`};let t=e.as===void 0?n.kinds.get(n.node.kind)?.linked?.get(e.field):void 0;if(t){let f=z(Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0,t);return{t:"field",field:e.field,label:r,text:f.length>0?"linked record":g,...f.length>0?{linked:{relation:t,refs:f}}:{}}}let a=n.kinds.get(n.node.kind)?.computed?.has(e.field),d,l;if(a){let f=w({t:"ident",name:e.field,at:0},n);f.ok?d=f.value!==null&&typeof f.value=="object"?b(f.value,void 0,n.today,[],n.money,E(n.schema)):f.value:l=f.problem}else d=Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0;let i=e.as!==void 0?void 0:n.fields[e.field]?.type==="url"?xe(d):pe(Se(n,e.field),d),s=R(()=>Fe(e.field,d,n,e.as,e.currency))??g,y=n.fields[e.field]?.type==="app-link"&&e.as===void 0&&typeof d=="string"?d:void 0;return h({t:"field",field:e.field,label:r,text:s,...i?{href:i}:{},...y?{app:y}:{}},l)}case"image":{let r=A(n.node&&Object.hasOwn(n.node,e.field)?n.node[e.field]:null),t=e.as==="gallery"?r:r.filter(G).slice(0,1);return{t:"image",field:e.field,label:e.label??x(n.definition,e.field),as:e.as,files:t,text:t.map(V).join(", ")||g}}case"progress":{let r=w(e.value,n),t=w(e.max,n),a=e.label?k(e.label,n):{text:"Progress"},d=a.text,l=r.ok?t.ok?a.problem:t.problem:r.problem;return r.ok&&t.ok&&typeof r.value=="number"&&typeof t.value=="number"&&Number.isFinite(r.value)&&Number.isFinite(t.value)&&t.value>0?h({t:"progress",label:d,value:r.value,max:t.value,text:`${b(r.value,void 0,n.today)} of ${b(t.value,void 0,n.today)}`},l):h({t:"progress",label:d,text:g},l)}case"group":return{t:"group",direction:e.direction,blocks:he(e.blocks,ge(n))};case"when":{let r=w(e.when,n),t=r.ok&&r.value===!0;return h({t:"when",shown:t,blocks:t?he(e.show,ge(n)):[]},r.ok?void 0:r.problem)}case"divider":return{t:"divider"};case"figure":return{t:"figure"};case"headline":{let r=k(e.parts,n),t=Math.min(6,Math.max(1,(o?n.firstHeading:void 0)??n.heading??3));return h({t:"headline",level:t,text:r.text},r.problem)}case"number":{let r=w(e.value,n),t=!r.ok||r.value===null||typeof r.value=="object"?g:Ne(r.value,e.as,e.currency,n.today,n.money),a=e.label?k(e.label,n):void 0;return h({t:"number",text:t,...a?{label:a.text}:{},...e.emphasis?{emphasis:e.emphasis}:{}},r.ok?a?.problem:r.problem)}case"list":return Me(e,n)}}function he(e,n){let o=e.findIndex(r=>r.t==="headline");return e.map((r,t)=>({...Ce(r,n,t===o),key:r.key}))}var Le=new Set(["every","some","sum","min","max","sort"]);function cn(e,n){let o=new Set,r=new Set,t=i=>{if(i)switch(i.t){case"ident":o.add(i.name);return;case"list":i.items.forEach(t);return;case"member":return t(i.object);case"unary":return t(i.operand);case"binary":return t(i.left),t(i.right);case"where":return t(i.set);case"call":i.args.forEach((s,y)=>{y===1&&Le.has(i.fn)||t(s)});return;default:return}},a=i=>{for(let s of i??[])t(s.expr)},d=(i,s)=>{i.forEach((y,f)=>{let u=s[f];if(u)switch(y.t){case"field":case"image":o.add(y.field);return;case"title":case"text":case"badge":case"headline":a(y.parts);return;case"number":t(y.value),a(y.label);return;case"progress":t(y.value),t(y.max);return;case"group":u.t==="group"&&d(y.blocks,u.blocks);return;case"when":u.t==="when"&&u.shown&&d(y.show,u.blocks);return;case"list":if(u.t==="list")for(let m of u.members)r.add(m.id);return;default:return}})};d(e,n);let l=n[0];return{fields:o,records:r,...e[0]?.t==="title"&&l?.t==="title"?{title:l.text}:{}}}function Me(e,n){let o=Math.min(6,(n.heading??3)+1),r=w(e.source,n);if(!r.ok)return{t:"list",as:e.as,failed:!0,members:[],headingLevel:o,more:0,problem:r.problem};let t=r.value,a=t instanceof O?t.nodes:t!==null&&typeof t=="object"&&!Array.isArray(t)?[t]:[];e.choiceOrder&&n.schema&&(a=Ve(a,e.choiceOrder,n.schema));let d=a.length,l=a.slice(0,e.limit??C),i=l.slice(0,L),s=l.slice(L),y=(e.limit===void 0?d:l.length)-i.length,f=c=>e.group&&n.schema&&c.length>0?_e(c,e.group,n.schema,n.graph):void 0,u=f(i),m=s.length>0?f(l):void 0;return{t:"list",as:e.as,failed:!1,members:i,...s.length>0?{rest:s}:{},...u?{groups:u}:{},...m?{everyGroup:m}:{},headingLevel:o,...i.length===0&&e.empty?{empty:e.empty}:{},more:y,total:d}}function _(e,n,o){let r=e.tryDefinition(n)?.fields?.shape,t=r&&Object.hasOwn(r,o)?M(r[o]):void 0;return t?.type==="enum"?t.options??[]:[]}var I=(e,n)=>Object.hasOwn(e,n)?e[n]:void 0;function Ve(e,n,o){let r=t=>{let a=_(o,t.kind,n).indexOf(String(I(t,n)));return a<0?Number.MAX_SAFE_INTEGER:a};return e.map((t,a)=>({node:t,i:a,rank:r(t)})).sort((t,a)=>t.rank-a.rank||t.i-a.i).map(t=>t.node)}function _e(e,n,o,r){let t=e.some(i=>_(o,i.kind,n.by).length>0)?void 0:de(n.by);if(t&&r)return Ie(e,t,n.headings,o,r);let a=[];for(let i of e)for(let s of _(o,i.kind,n.by))a.includes(s)||a.push(s);let d=[];for(let i of a){let s=e.filter(f=>I(f,n.by)===i);if(s.length===0)continue;let y=o.tryDefinition(s[0].kind);d.push({value:i,heading:n.headings[i]??$(B(y,n.by,i)),members:s})}let l=e.filter(i=>!a.includes(String(I(i,n.by))));return l.length>0&&d.push({value:null,members:l}),d}function Ie(e,n,o,r,t){let a=u=>n.way??(Object.hasOwn(r.tryDefinition(u.kind)?.edges??{},n.edge)?"out":"in"),d=new Map,l=[],i=E(r),s;for(let u of e){let m=a(u)==="out"?t.out(u.id,n.edge):t.in(u.id,n.edge);m.length===0&&l.push(u);for(let c of m){s??=c.kind;let S=d.get(c.id)??{node:c,members:[]};S.members.push(u),d.set(c.id,S)}}let y=[...d.values()].map(({node:u,members:m})=>({value:u.id,heading:o[u.id]??i(u),members:m})).sort((u,m)=>u.heading.localeCompare(m.heading,void 0,{numeric:!0}));!s&&e[0]&&a(e[0])==="out"&&(s=(r.tryDefinition(e[0].kind)?.edges??{})[n.edge]?.to?.[0]);let f=s&&s!=="*"?X(r.tryDefinition(s),s):void 0;return l.length>0&&y.push({value:null,...f?{heading:`No ${f}`}:{},members:l}),y}function be(e){return e.t==="list"||e.t==="headline"||e.t==="number"||e.t==="image"&&e.as==="gallery"?!0:e.t==="group"?e.blocks.some(be):e.t==="when"?e.show.some(be):!1}function Re(e,n){let o=e.tryDefinition(n)?.fields?.shape??{},r={};for(let[t,a]of Object.entries(o)){let d=M(a);d&&(r[t]=d)}return r}var Ae=new WeakMap;function D(e){let n=Ae.get(e);return n||Ae.set(e,n=se(e)),n}function De(e,n,o,r={}){let t=D(e),a={},d={},l=i=>{if(i instanceof O)return i.nodes.map(s=>l(s));if(Array.isArray(i))return i.map(s=>l(s));if(i!==null&&typeof i=="object"){let s=i;return{id:s.id,kind:s.kind,label:K(e.tryDefinition(s.kind),s)}}return i};for(let[i,s]of t.get(o?o.kind:q)?.computed??[])try{let y=[],f=T(s,{graph:n,subject:o,kinds:t,...r.today?{today:r.today}:{},...r.budget?{budget:r.budget}:{},...r.linked?{linked:r.linked}:{},onUnread:u=>y.push(u)});y.length>0&&(f===null||f instanceof O&&f.nodes.length===0)?d[i]=Z(y[0]):a[i]=l(f)}catch(y){if(!(y instanceof Q))throw y;d[i]=y.sentence}return{values:a,refused:d}}function Sn(e,n,o){let{values:r}=De(e,n,o);if(Object.keys(r).length===0)return o;let t=a=>Array.isArray(a)?a.map(t):a!==null&&typeof a=="object"?a.label:a;return{...o,...Object.fromEntries(Object.entries(r).map(([a,d])=>[a,t(d)]))}}var Ue=500,We=2e4,Oe=new WeakMap;function He(e,n){let o=Oe.get(e);o||Oe.set(e,o=new Map);let r=o.get(n);return r||o.set(n,r=Re(e,n)),r}function jn(e,n,o,r={}){if(n&&typeof e.seenBy!="function")throw new TypeError("blockContextFor: a seat is read from a store (its `seenBy`); a bare { graph, schema } is read as it is handed, with no principal");let t=n?e.seenBy(n):e,a=n&&o?t.graph.getNode(o.id)??null:o,d=t.schema,l=a&&d.tryDefinition(a.kind),i=!a||(r.slot??"page")==="page",{money:s,firstHeading:y}=r;return{node:a,graph:t.graph,schema:d,kinds:D(d),fields:a?He(d,a.kind):{},definition:l||void 0,today:r.today??t.today?.()??W(),money:s,heading:r.heading??(i?2:3),firstHeading:y,budget:r.budget??(i?We:Ue),...i?{}:{glance:!0}}}export{V as a,je as b,ze as c,me as d,he as e,cn as f,be as g,De as h,Sn as i,jn as j};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk.WVUJXDXZ.js";import{h as x}from"./chunk.VHWUGSFW.js";import"./chunk.P75TPZWT.js";import"./chunk.6W7J76TK.js";import"./chunk.FUR4IHWG.js";import"./chunk.2B4WVCVV.js";import"./chunk.AAZFVCSP.js";import"./chunk.IMRCAU4T.js";import{Na as f,Pa as N,X as S}from"./chunk.F5BCCGFK.js";import"./chunk.AJZBJBMO.js";var k=(n,r,t)=>({untrusted:!0,authoredBy:t.say(r),text:n});function O(n,r){let t;for(let[a,e]of Object.entries(n)){if(typeof e!="string"||a==="id"||a==="kind")continue;let o=r.fieldBy(n.id,a);o&&(t??={...n},t[a]=k(e,o,r))}return t??n}function L(n,r,t){let a=e=>{if(Array.isArray(e))return e.map(a);if(e!==null&&typeof e=="object"&&"id"in e&&"label"in e){let o=e,i=t.recordBy(o.id);return i?{...o,label:k(o.label,i,t)}:o}if(typeof e=="string"){let o=t.recordBy(n);return o?k(e,o,t):e}return e};return Object.fromEntries(Object.entries(r).map(([e,o])=>[e,a(o)]))}function $(n,r){return n.map(t=>{let a=r.recordBy(t.id);return a?{...t,label:k(t.label,a,r)}:t})}function D(n,r){return{...n,nodes:n.nodes.map(t=>O(t,r))}}var E=n=>(JSON.stringify(n)??"null").length,R=n=>typeof n=="number"&&Number.isFinite(n)&&n>0?Math.floor(n):0;function w(n,r,t,a,e,o=""){let i=n-r-t;return i>0?`and ${i} more ${e}: call ${a} with ${o}offset ${r+t} for the next page.`:void 0}var j=({line:n,...r})=>r;function T(n){let r;for(let[t,a]of Object.entries(n))typeof a!="string"||a.length<=600||(r??={...n},r[t]=`${a.slice(0,600)}\u2026 (cut at ${600} of ${a.length} characters)`);return r??n}function B(n,r,t,a){let e=Math.min(t,Math.max(0,n.length-r)),o=n.slice(r,r+e),i=a(o);for(;e>1&&E(i)>8e3;)e=Math.max(1,Math.floor(e*.75)),o=n.slice(r,r+e),i=a(o);return{page:o,answer:i}}function C(n,r){let t=JSON.stringify(r)??"null";if(t.length<=8e3)return r;let a=`This answer was ${t.length} characters, more than the ${8e3} one read answers, so it is cut. Ask ${n} for less, or use search_graph and get_node to read one thing.`;for(let e=8e3-a.length-40;;){let o={cut:a,partial:t.slice(0,e)},i=E(o)-8e3;if(i<=0)return o;e=Math.max(0,e-i-8)}}function I(n,r){let{matched:t,later:a,...e}=r,o=n.hits.filter(i=>i.about==="node").length;return n.total>o?{...e,more:`and ${n.total-o} more records match: narrow the words, or add kind:<kind>.`}:e}function P(n,r,t){let a=N(t.archived),e={nodes:n.graph.allNodes({archived:a}),edges:n.graph.allEdges({archived:"all"})},o=R(t.offset),i=e.nodes.length,{page:h,answer:u}=B(e.nodes,o,25,d=>{let g=new Set(d.map(s=>s.id)),l=new Set(d.map(s=>s.id)),c=w(i,o,d.length,"get_graph","nodes"),p=s=>l.has(s)||(a==="all"?n.graph.has(s):n.graph.has(s)&&f(n.graph.getNode(s))===a);return{...D({nodes:d.map(T),edges:e.edges.filter(s=>g.has(s.from)&&p(s.to))},r),total:i,...c?{more:c}:{}}});return{data:u,reads:h.map(d=>d.id)}}function U(n,r,t,a){let e=n.graph.getNode(t),o=R(a.offset),i=n.graph.outEdges(t),h=n.graph.inEdges(t),u=i.slice(o,o+20),d=h.slice(o,o+20),g=(s,A)=>{let m=n.graph.getNode(A);return{kind:s,id:A,label:m?S(n.schema.tryDefinition(m.kind),m):A,...f(m)?{archived:!0}:{}}},l=x(n.schema,n.graph,e),c=n.violations().filter(s=>s.nodeIds.includes(t)),p=[w(i.length,o,u.length,"get_node","links out",`id "${t}" and `),w(h.length,o,d.length,"get_node","links in",`id "${t}" and `),c.length>20?`and ${c.length-20} more problems: get_violations lists them.`:void 0].filter(Boolean);return{data:{node:O(T(e),r),...f(e)?{archived:!0}:{},...Object.keys(l.values).length>0?{computed:L(t,l.values,r)}:{},...Object.keys(l.refused).length>0?{uncomputed:l.refused}:{},out:$(u.map(s=>g(s.kind,s.to)),r),in:$(d.map(s=>g(s.kind,s.from)),r),violations:c.slice(0,20).map(j),...p.length>0?{more:p.join(" ")}:{}},reads:[t,...u.map(s=>s.to),...d.map(s=>s.from)]}}function F(n,r){let t=R(r.offset),{page:a,answer:e}=B(n,t,20,o=>{let i=w(n.length,t,o.length,"get_violations","problems");return{violations:o.map(j),total:n.length,...i?{more:i}:{}}});return{data:e,reads:[...new Set(a.flatMap(o=>o.nodeIds))]}}export{P as graphRead,U as nodeRead,I as searchRead,F as violationsRead,C as withinReadChars};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as R}from"./chunk.OFJH7LDC.js";import"./chunk.5PU3RWYY.js";import"./chunk.E77K6KBX.js";import"./chunk.WVUJXDXZ.js";import"./chunk.VHWUGSFW.js";import"./chunk.P75TPZWT.js";import"./chunk.6W7J76TK.js";import"./chunk.FUR4IHWG.js";import"./chunk.2B4WVCVV.js";import"./chunk.AAZFVCSP.js";import"./chunk.GZHZLJBF.js";import{n as x}from"./chunk.PWOVXARZ.js";import"./chunk.SG23JC6D.js";import"./chunk.OJGHDWI6.js";import"./chunk.GZLYTPE7.js";import"./chunk.4B73P2WA.js";import"./chunk.IMRCAU4T.js";import"./chunk.BZ5VLPKB.js";import{F as k,Q as v,Z as g}from"./chunk.6II4BONS.js";import{ca as m,fc as A,ga as c}from"./chunk.F5BCCGFK.js";import{b as u}from"./chunk.AJZBJBMO.js";var f=u(k(),1);var S=u(k(),1),L=(0,S.createContext)(void 0);var i=u(v(),1),W=new WeakMap,y=new WeakMap,P=(e,n)=>`${n.kind}\0${n.id??""}\0${e}`;function C(e,n,r){let o=P(n,r),p=W.get(e);p||W.set(e,p=new Map);let t=p.get(o);return t||(t=Promise.resolve().then(()=>e(n,r)).then(a=>b(a)?a:null,()=>null).then(a=>{let s=y.get(e);return s||y.set(e,s=new Map),s.set(o,a),a}),p.set(o,t)),t}function b(e){if(e===null)return!0;if(typeof e!="object"||e===void 0)return!1;if(e.denied===!0)return!0;let n=e;return typeof n.name=="string"&&n.name.trim()!==""&&typeof n.href=="string"}function h(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}}var N=e=>h(e)??(c(e)?e:void 0),E=e=>h(e)??(e.startsWith("/")&&c(e)?e:void 0),I={kind:"human"},w={color:"var(--graview-ink-muted)"};function M({icon:e}){if(!e)return null;let n=E(e);if(n)return(0,i.jsx)("img",{src:n,alt:"",width:20,height:20,"data-graview-app-icon":"",style:{width:20,height:20,borderRadius:5,objectFit:"cover",flex:"0 0 auto"}});let r=[...e.trim()].slice(0,2).join("");return r?(0,i.jsx)("span",{"aria-hidden":"true","data-graview-app-icon":"",style:{flex:"0 0 auto",lineHeight:"20px"},children:r}):null}function V(e){let n=g(),r=(0,f.useContext)(L)??n?.resolveApp,o=n?.principal??I,p=()=>r?y.get(r)?.get(P(e,o))??"asking":null,[t,a]=(0,f.useState)(p);return(0,f.useEffect)(()=>{let s=p();if(a(s),s!=="asking"||!r)return;let l=!0;return C(r,e,o).then(d=>l&&a(d)),()=>{l=!1}},[r,e,o.kind,o.id]),t}function D({address:e,as:n="chip",nodeId:r,field:o,style:p}){let t=V(e),a={position:"relative",zIndex:A.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%",...p},s;if(t==="asking")s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"asking","aria-busy":"true",style:{...w,...a},children:"Linked app"});else if(t&&"denied"in t)s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"denied",style:{...w,fontStyle:"italic",...a},children:"linked app (no access)"});else if(t){let l=N(t.href),d=n==="record"?t.headline?.trim():void 0;s=(0,i.jsxs)(l?"a":"span",{"data-graview-app-link":"","data-graview-app-state":"found",...l?{href:l}:{},...!d&&t.headline?{title:t.headline}:{},style:{display:"inline-flex",alignItems:d?"flex-start":"center",minHeight:24,gap:8,color:"inherit",textUnderlineOffset:3,...a},children:[(0,i.jsx)(M,{icon:t.icon}),(0,i.jsxs)("span",{style:{display:"grid",minWidth:0},children:[(0,i.jsx)("span",{"data-graview-app-name":"",style:{fontWeight:600},children:t.name}),d?(0,i.jsx)("span",{"data-graview-app-headline":"",style:{...w,fontSize:"0.8125em",fontWeight:400},children:d}):null]})]})}else{let l=h(e);s=l?(0,i.jsx)("a",{"data-graview-app-link":"","data-graview-app-state":"plain",href:l,rel:"noopener noreferrer",target:"_blank",style:{color:"var(--graview-accent)",display:"inline-flex",alignItems:"center",minHeight:24,...a},children:e}):(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"plain",style:a,children:e})}return r&&o?(0,i.jsx)(H,{nodeId:r,field:o,address:e,drawn:s}):s}function H({nodeId:e,field:n,address:r,drawn:o}){let p=x(e).fields.some(s=>s.field===n),t=g()?.store;if(!p)return o;let a=m(t?t.schema.tryDefinition(String(t.graph.getNode(e)?.kind)):void 0,n).toLowerCase();return(0,i.jsxs)("span",{style:{display:"inline-flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px",maxWidth:"100%",minWidth:0},children:[o,(0,i.jsx)("span",{style:{fontSize:"0.8125rem"},children:(0,i.jsx)(R,{nodeId:e,field:n,value:"Change",stored:r,said:`Change the ${a}`})})]})}var _=e=>(0,i.jsx)(D,{...e});export{D as AppLink,_ as drawAppLink};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as H,b as I,c as j,e as R,h as V,i as D,j as A,k,l as x,n as Y,o as Z}from"./chunk.ZSSOTIFL.js";import{b as U}from"./chunk.4B73P2WA.js";import{H as C,K as G,La as T,Oa as B,Q as M,X as W,Z as F}from"./chunk.F5BCCGFK.js";function re(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function te(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.archived!==void 0&&e.archived!==!1&&(r.archived=String(e.archived)),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(n=>`${n.key}:${n.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function ne(e,r){let n=[],s={};if(e.query&&(s.query=e.query),e.archived!==void 0&&e.archived!==!1&&(s.archived=e.archived),e.sort&&(r.sorts.some(u=>u.key===e.sort.by)?s.sort=e.sort:n.push(`sort ${e.sort.by}`)),e.filter){let u=e.filter.filter(c=>r.filters.find(l=>l.key===c.key)?!0:(n.push(`filter ${c.key}`),!1));u.length>0&&(s.filter=u)}return e.group&&(r.groups.some(u=>u.key===e.group.by)?s.group=e.group:n.push(`group ${e.group.by}`)),{arrangement:s,dropped:n}}function S(e,r){return W(e.schema.tryDefinition(r.kind),A(r))}var oe=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function ie(e,r,n){if(n==="label")return S(e,r);let s=e.schema.tryDefinition(r.kind);return s&&n in(s.fields.shape??{})?T(D(r),n,e.today??C()):s?.computed?.[n]!==void 0?e.read?.(r,n):k(e.graph,r.id,n).map(c=>S(e,c)).sort()[0]}var se=/^(\d{4})-(\d{2})-(\d{2})/;function _(e,r){let n=se.exec(e);if(!n)return;let[,s,u,c]=n;if(r==="day")return`${s}-${u}-${c}`;if(r==="month")return`${s}-${u}-01`;if(r==="year")return`${s}-01-01`;if(r==="decade")return`${String(Number(s)-Number(s)%10).padStart(4,"0")}-01-01`;let a=new Date(Date.UTC(Number(s),Number(u)-1,Number(c))),l=(a.getUTCDay()+6)%7;return a.setUTCDate(a.getUTCDate()-l),a.toISOString().slice(0,10)}function de(e,r){return r==="month"?M(e):r==="week"?`Week of ${G(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:G(e)}function ue(e,r,n){return z(e,n)(r)}function z(e,r){let{words:n,conditions:s}=Y(r);if(n.length===0&&s.length===0)return()=>!0;let u=new Map,c=a=>{let l=u.get(a);return l||(l=new Set(R(e.schema,a).filters.map(d=>d.key)),u.set(a,l)),l};return a=>{let l=c(a.kind),d=s.filter(i=>l.has(i.key));return d.every(i=>x(e,a,i))?n.length>0?Z(e.schema.tryDefinition(a.kind),A(a),n)!==void 0:d.length>0:!1}}function ae(e,r,n){let s=r.query?.trim(),u=r.archived===void 0?e:e.filter(t=>B(t,r.archived)),c=s?u.filter(z(n,s)):u,a=r.filter?.length?c.filter(t=>r.filter.every(f=>x(n,t,f))):[...c],l=[];for(let t=r.sort;t&&l.length<4;t=t.then)l.push(t);let d=l.length>0?a.map((t,f)=>({node:t,index:f,values:l.map(o=>ie(n,t,o.by))})).sort((t,f)=>{for(let[o,p]of l.entries()){let[h,K]=[t.values[o],f.values[o]],v=oe(h,K),E=p.direction==="desc"&&v!==0&&h!==void 0&&K!==void 0?-v:v;if(E!==0)return E}return t.index-f.index}).map(t=>t.node):a,i=r.group;if(!i)return{nodes:d,groups:[{key:"",label:"",nodes:d}],grouped:!1};let y=new Map,g=(t,f,o)=>{let p=y.get(t)??{label:f,nodes:[]};p.nodes.push(o),y.set(t,p)},N=d[0],m=N?n.schema.tryDefinition(N.kind):void 0,O=m?.fields.shape??{},J=m?H(m,i.by):F(i.by),$=i.by in O,b=$?I(O[i.by]):void 0,X=j(n.schema,N?.kind??"").find(t=>t.key===i.by)?.label,L=$?`No ${J.toLowerCase()}`:`Without ${(X??F(i.by)).toLowerCase()}`,q=$?new Map:U([...new Map(d.flatMap(t=>k(n.graph,t.id,i.by)).map(t=>[t.id,t])).values()].map(A),t=>n.schema.tryDefinition(t));for(let t of d){if($){let o=T(D(t),i.by,n.today??C());if(o==null||o==="")g("",L,t);else if(b==="date"){let p=i.bucket??"day",h=_(String(o),p);h?g(h,de(h,p),t):g("",L,t)}else if(b==="boolean")g(o?"1":"0",o?"Yes":"No",t);else{let p=m?.display?.format?.[i.by];g(String(o),p?p(o):String(o),t)}continue}let f=k(n.graph,t.id,i.by).map(o=>({id:o.id,label:q.has(o.id)?`${S(n,o)} \xB7 ${q.get(o.id)}`:S(n,o)})).sort((o,p)=>o.label.localeCompare(p.label));f.length===0?g("",L,t):g(f.map(o=>o.id).join(","),f.map(o=>o.label).join(", "),t)}let w=b==="choice"?V(O[i.by]):void 0,ee=[...y.entries()].sort(([t,f],[o,p])=>t===""?1:o===""?-1:w?w.indexOf(t)-w.indexOf(o):b==="boolean"?o.localeCompare(t):b==="date"?t.localeCompare(o):f.label.localeCompare(p.label)).map(([t,f])=>({key:t,label:f.label,nodes:f.nodes}));return{nodes:d,groups:ee,grouped:!0}}function P(e){if(e===void 0)return;if(typeof e=="string")return{by:e,direction:"asc"};let r=e.then===void 0?void 0:typeof e.then=="string"?{by:e.then,direction:"asc"}:{by:e.then.by,direction:e.then.direction??"asc"};return{by:e.by,direction:e.direction??"asc",...r?{then:r}:{}}}function Q(e){if(e!==void 0)return typeof e=="string"?{by:e}:e}function le(e){let r=P(e?.sort),n=Q(e?.group);if(!(!r&&!n))return{...r?{sort:r}:{},...n?{group:{by:n.by}}:{}}}var fe=(e,r)=>r?e==="1"?"true":"false":e;function ce(e,r,n){let s=n.type==="boolean",u=s?["true","false"]:n.options??[],c=[...new Set([...(r.order??[]).filter(d=>u.includes(d)),...u])],a=r.closed??[],l=d=>{if(d.key==="")return[1,0];let i=fe(d.key,s);if(a.includes(i))return[2,a.indexOf(i)];let y=c.indexOf(i);return[0,y<0?c.length:y]};return e.map((d,i)=>({group:d,at:i,rank:l(d)})).sort((d,i)=>d.rank[0]-i.rank[0]||d.rank[1]-i.rank[1]||d.at-i.at).map(({group:d,rank:i})=>({...d,closed:i[0]===2}))}export{Q as a,le as b,ce as c,re as d,te as e,ne as f,ue as g,ae as h};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk.7CO7S6QM.js";import"./chunk.6QDFBCV4.js";import"./chunk.R7LRJS6B.js";import"./chunk.IB32NOV5.js";import"./chunk.4STIUIT6.js";import"./chunk.WHTQHU3M.js";import"./chunk.KU6NIMQX.js";import"./chunk.Y3IJDWNS.js";import"./chunk.OFJH7LDC.js";import"./chunk.5PU3RWYY.js";import"./chunk.27TLAVRR.js";import"./chunk.OREMUXB5.js";import"./chunk.ZDNJK2SX.js";import"./chunk.ZSSOTIFL.js";import"./chunk.HJCQ6I3S.js";import"./chunk.ZWZ5SEXT.js";import"./chunk.FQKH67BP.js";import"./chunk.LA7535VO.js";import"./chunk.ZEW2OOZ5.js";import"./chunk.7YQYWOZR.js";import"./chunk.CUCNT7MG.js";import"./chunk.2A2DLMT3.js";import"./chunk.E77K6KBX.js";import"./chunk.UT6642FC.js";import"./chunk.EBLKEQ7O.js";import"./chunk.WVUJXDXZ.js";import"./chunk.VHWUGSFW.js";import"./chunk.P75TPZWT.js";import"./chunk.6W7J76TK.js";import"./chunk.FUR4IHWG.js";import"./chunk.2B4WVCVV.js";import"./chunk.AAZFVCSP.js";import"./chunk.GZHZLJBF.js";import"./chunk.PWOVXARZ.js";import"./chunk.SG23JC6D.js";import"./chunk.OJGHDWI6.js";import"./chunk.GZLYTPE7.js";import"./chunk.4B73P2WA.js";import"./chunk.IMRCAU4T.js";import"./chunk.BZ5VLPKB.js";import"./chunk.6II4BONS.js";import"./chunk.F5BCCGFK.js";import"./chunk.AJZBJBMO.js";export{b as declaredLensView,a as formatFor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as ae}from"./chunk.GZLYTPE7.js";import{b as Ce,d as $e}from"./chunk.4B73P2WA.js";import{e as Te}from"./chunk.IMRCAU4T.js";import{$ as we,Ac as Re,Cc as De,Ec as We,Fc as Me,H as ke,Jb as ie,La as Se,Na as H,T as R,U as xe,W as E,X as K,Xc as je,Y as Ae,Z as v,aa as Ne,ic as oe,mc as ve,nc as Oe}from"./chunk.F5BCCGFK.js";function se(n,e){return n.display?.labels?.[e]??v(e)}function de(n){let e=ae(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Je(n,e){let t=new Map,r=n.tryDefinition(e);for(let[a,i]of Object.entries(r?.edges??{}))t.set(a,{key:a,label:i.description?R(i.description):v(a),about:"edge",far:i.to==="*"?[...n.kinds]:[...i.to]});for(let a of n.definitions)if(a.kind!==e)for(let[i,d]of Object.entries(a.edges??{}))t.has(i)||d.to!=="*"&&!d.to.includes(e)||t.set(i,{key:i,label:d.inverse?R(d.inverse):v(i),about:"edge",far:[a.kind]});return[...t.values()]}var Ze=["current","past","any","flagged","clear"];function Fe(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let r=t.retired.map(String);return e.some(a=>a.key===t.field&&r.includes(a.value))}function Be(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let r=new Set(t.display?.hide??[]),a=t.fields.shape??{},i=[{key:"label",label:"Name",about:"label",type:"text"}],d=[],f=[];for(let[g,p]of Object.entries(a)){if(g==="id"||g==="kind"||g==="label"||r.has(g))continue;let A=de(p);if(!A)continue;let O=se(t,g),w=A==="choice"?Le(p):A==="boolean"?["true","false"]:void 0,N={key:g,label:O,about:"field",type:A,...w?{options:w}:{}};i.push(N),d.push(N),(A==="boolean"||A==="choice")&&f.push(N),A==="date"&&f.push({...N,buckets:["day","week","month","year","decade"]})}for(let g of Je(n,e))i.push(g),d.push(g),f.push(g);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Ze]:["flagged","clear"]};d.push(l);let y=t.fieldRoles?.order,u=y&&(y in a||y==="label")?{by:y,direction:"asc"}:void 0;return{kind:e,sorts:i,filters:d,groups:f,...u?{natural:u}:{}}}function On(n,e){let t=[];for(let a of e.filters){let i=a.about==="edge"&&a.far?.length===1?n.tryDefinition(a.far[0]):void 0;if(!(!i||i.kind===e.kind))for(let[d,f]of Object.entries(i.fields.shape??{}))de(f)!=="choice"||i.display?.hide?.includes(d)||t.push({key:`${a.key}.${d}`,label:`${a.label} \xB7 ${se(i,d)}`,about:"via",type:"choice",options:Le(f),far:[i.kind]})}if(t.length===0)return e;let r=e.filters.filter(a=>a.about!=="is");return{...e,filters:[...r,...t,...e.filters.filter(a=>a.about==="is")]}}function Rn(n,e){let t=n.tryDefinition(e.kind),r=Object.entries(t?.computed??{});if(!t||r.length===0)return e;let a=r.filter(([i])=>!e.sorts.some(d=>d.key===i)).map(([i,d])=>({key:i,label:(typeof d=="object"?d.label:void 0)??se(t,i),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...a]}}function Le(n){let e=ae(n);return e.type==="choice"?e.options:[]}var Ie=n=>n,Pe=n=>n;function en(n,e,t){let r=new Map;for(let a of[...n.out(e,t),...n.in(e,t)])r.set(a.id,a);return[...r.values()]}function le(n,e,t){let r=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return E(r,Pe(e),n.today);case"past":return!E(r,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let a=r?.fields.shape??{};if(t.key in a){let l=Se(Ie(e),t.key,n.today??ke()),y=de(a[t.key]);if(y==="date"){let[u,g]=t.value.split(":");if(typeof l!="string"||!g)return!1;let p=l.slice(0,10);return u==="before"?p<g:u==="after"?p>g:p===g}if(y==="boolean")return String(l)===t.value;if(y==="number"){let u=t.value.lastIndexOf(":"),g=u>0?t.value.slice(0,u):"",p=Number(t.value.slice(u+1));if(g==="at-most"||g==="at-least")return typeof l!="number"||!Number.isFinite(p)?!1:g==="at-most"?l<=p:l>=p}return String(l)===t.value}let[i,d]=t.key.split("."),f=en(n.graph,e.id,i);return d?f.some(l=>String(Ie(l)[d])===t.value):t.value==="*"?f.length>0:t.value==="none"?f.length===0:f.some(l=>l.id===t.value)}var nn=5;function ze(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function ce(n){return ze(n).replace(/ /g,"")}var z=new Map,tn=5e4;function _(n){let e=z.get(n);if(e===void 0){z.size>=tn&&z.clear();let t=ze(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},z.set(n,e)}return e}var D=n=>[..._(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:r}=_(n),a=e.join("");if(t.length===0)return;if(t===a)return"exact";if(e.every(d=>r.some(f=>f.startsWith(d))))return t.startsWith(a)?"prefix":e.every(d=>r.includes(d))?"word":"part"}function Q(n,e,t=48){let r=n.replace(/\s+/g," ").trim();if(r.length<=t)return r;let a=e[0],i=r.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),d=a?i.search(new RegExp(`(^|[^\\p{L}\\p{N}])${rn(a)}`,"u")):-1,f=d<0?0:d+(i[d]&&/[\p{L}\p{N}]/u.test(i[d])?0:1),l=Math.max(0,f-Math.floor(t/3));if(l>0){let u=r.lastIndexOf(" ",l);l=u<0?0:u+1}let y=Math.min(r.length,l+t);if(y<r.length){let u=r.indexOf(" ",y);y=u<0||u-y>16?y:u}return`${l>0?"\u2026":""}${r.slice(l,y).trim()}${y<r.length?"\u2026":""}`}var rn=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),on=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function an(n){let e=[],t=[];for(let r of n.trim().split(/\s+/).filter(Boolean)){let a=on.exec(r);a?t.push({key:a[1],value:a[2]}):e.push(r)}return{words:e.join(" "),conditions:t}}var Ee=new WeakMap;function q(n,e){let t=Ee.get(e);if(t&&t.definition===n)return t.texts;let r=sn(n,e);return Ee.set(e,{definition:n,texts:r}),r}function sn(n,e){let t=K(n,e),r=[{field:"label",reading:"Name",text:t}];for(let a of $e(e,n,{limit:Number.POSITIVE_INFINITY}))a.key==="label"||a.value===t||typeof e[a.key]!="boolean"&&r.push({field:a.key,reading:a.label,text:a.markdown?Te(a.value):a.value});return r}var T={exact:0,prefix:1,word:2,part:3,field:4,near:5},Ge=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ke(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function He(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let r=[],a=Array.from({length:e.length+1},(i,d)=>d);for(let i=1;i<=n.length;i++){let d=[i],f=i;for(let l=1;l<=e.length;l++){let y=Math.min(a[l]+1,d[l-1]+1,a[l-1]+(n[i-1]===e[l-1]?0:1));i>1&&l>1&&n[i-1]===e[l-2]&&n[i-2]===e[l-1]&&(y=Math.min(y,r[l-2]+1)),d[l]=y,y<f&&(f=y)}if(f>t)return t+1;r=a,a=d}return a[e.length]}var G=new Map;function dn(n,e){let t=G.get(n);t||(G.size>=64&&G.clear(),G.set(n,t=new Map));let r=t.get(e);return r===void 0&&(r=ln(n,e)??null,t.set(e,r)),r??void 0}function ln(n,e){if(/\d/.test(n))return;let t=Ke(n);if(t.length>=3&&(Ke(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let r=n.length<4?0:n.length<=7?1:2;if(r!==0){if(He(n,e,r)<=r)return"spelling";if(n.length>=5){for(let a=n.length-r;a<=n.length+r;a++)if(a<e.length&&He(n,e.slice(0,a),r)<=r)return"spelling"}}}function cn(n,e){let t=e.length>1?e.filter(a=>!Ge.has(a)):e;if(t.length===0)return;let r;for(let a of t){let i;for(let d of n){for(let f of _(d.text).tokens){if(f.startsWith(a)){i={text:d,matched:f};break}let l=i?void 0:dn(a,f);l&&(i={text:d,matched:f,by:l})}if(i&&!i.by)break}if(!i)return;i.by&&!r&&(r={text:i.text,asked:a,matched:i.matched,by:i.by})}if(r)return{field:r.text.field,reading:r.text.reading,fragment:Q(r.text.text,[r.matched]),strength:"near",asked:r.asked,matched:r.matched,by:r.by}}var fn=80;function un(n,e,t){let r=D(e).filter(d=>!Ge.has(d)).join(" ")||e,a=t===void 0?[]:D(t),i=a.length>0&&n.find(d=>a.every(f=>_(d.text).tokens.some(l=>l.startsWith(f))))||n[0];return{field:i.field,reading:i.reading,fragment:Q(i.text,a),strength:"near",asked:r,matched:(t??i.text).slice(0,fn),by:"meaning"}}function _e(n,e,t){let r=D(t);if(r.length===0)return;let a=q(n,e),[i,...d]=a,f=j(i.text,r);if(f)return{field:"label",reading:i.reading,fragment:Q(i.text,r),strength:f};let l=p=>A=>_(A.text).tokens.some(O=>O.startsWith(p));if(!r.every(p=>a.some(l(p))))return;let y=D(i.text),u=r.find(p=>!y.some(A=>A.startsWith(p)))??r[0],g=d.find(l(u));return{field:g.field,reading:g.reading,fragment:Q(g.text,[u]),strength:"field"}}var gn=512,yn=64;function hn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-gn),r=n[n.length-1].seq;for(let a of t){let i=Math.pow(.5,(r-a.seq)/yn);for(let d of a.writes)e.set(d,(e.get(d)??0)+i)}return e}var ue=(n,e)=>we({tryDefinition:()=>n},e),fe=(n,e)=>De({tryDefinition:()=>n},e);function pn(n,e,t){let r=n.tryDefinition(e),a=[{field:"plural",text:ue(r,e)},{field:"kind",text:v(e)},...r?.noun?[{field:"noun",text:r.noun}]:[]],i;for(let d of a){let f=j(d.text,t);f&&(!i||T[f]<T[i.strength])&&(i={strength:f,...d})}return i}var mn,bn=(n,e)=>(mn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),qe=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||bn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function Kn(n,e,t={}){let r=n.schema,a=an(e),i=D(a.words),d=t.principal??{kind:"human"},f=n.kindsKeptFrom(d),l=n.modules.disabledKinds,y=a.conditions.filter(o=>o.key==="kind").map(o=>o.value),u=a.conditions.filter(o=>o.key==="is").map(o=>o.value),g=u.includes("any")||u.includes("past"),p=u.includes("past")&&!u.includes("any")&&!u.includes("current"),A=u.includes("archived")?!0:t.archived??"all",O=(o,s)=>{let c=ce(s),h=r.tryDefinition(o);return ce(o)===c||ce(ue(h,o))===c},w=r.kinds.filter(o=>!f.has(o)&&!l.has(o)&&(t.kinds===void 0||t.kinds.includes(o))&&(y.length===0||y.some(s=>O(o,s)))),W=a.conditions.filter(o=>o.key!=="kind").map(o=>({...o,admittedBy:w.filter(s=>Be(r,s).filters.some(c=>c.key===o.key))})),U=W.filter(o=>o.key!=="is"),C=u.filter(o=>o==="flagged"||o==="clear"||o==="past"||o==="archived"),V={kinds:w,past:g},Qe={hits:[],words:a.words,conditions:W,searched:V,byKind:{},total:0,matched:[]};if(i.length===0&&U.length===0&&C.length===0)return Qe;let X=t.today,$=t.flagged??new Set(n.violations().flatMap(o=>o.nodeIds)),Ue=t.touched??hn(n.log.all()),Y=new Set;for(let o of t.from??[]){Y.add(o);for(let s of n.graph.neighbors(o))Y.add(s.id)}let ge=ve(n,d)?Oe(n,d):void 0,J=oe.keptFrom?.(n,d)&&n.seenBy(d).graph,Z=o=>je(o,t.basePath===void 0?{}:{basePath:t.basePath}),ye={schema:r,graph:n.graph,flagged:$,...X?{today:X}:{}},S=[],I={},P=[],F=[],B=(o,s,c,h,m,b)=>{let x=K(c,o);I[s]=(I[s]??0)+1,S.push({hit:{about:"node",id:o.id,kind:s,label:x,why:m,current:h,flagged:$.has(o.id),address:Z(`${fe(c,s)}/${encodeURIComponent(o.id)}`),...b===void 0?{}:{near:!0},...H(o)?{archived:!0}:{}},...b===void 0?{}:{nearly:2-b},tier:T[m.strength],inKind:s===t.inKind?0:1,near:Y.has(o.id)?0:1,past:h?0:1,archived:H(o)?1:0,touched:-(Ue.get(o.id)??0),flagged:$.has(o.id)?0:1,name:x,id:o.id})};for(let o of w){let s=r.tryDefinition(o),c=W.filter(m=>m.key!=="is"&&m.admittedBy.includes(o));if(i.length===0&&c.length===0&&C.length===0)continue;let h=Fe(s,c);for(let m of n.graph.nodesOfKind(o,{archived:A})){if(ge&&!ge(m.id))continue;let b=J?J.getNode(m.id):m;if(!b)continue;let x=E(s,b,X);if(!g&&!h&&!x){if(i.length>0&&u.length===0&&c.every(k=>le(ye,b,k))){let k=_e(s,b,a.words);k&&F.push({node:b,kind:o,definition:s,why:k})}continue}if(p&&x||!c.every(k=>le(ye,b,k))||u.includes("flagged")&&!$.has(b.id)||u.includes("clear")&&$.has(b.id))continue;let M=i.length>0?_e(s,b,a.words):c[0]?{field:c[0].key,reading:v(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${C[0]}`,strength:"field"};M?B(b,o,s,x,M):i.length>0&&P.push({node:b,kind:o,definition:s,current:x})}}let ee=o=>o.strength!=="field",ne=!1;if(F.length>0&&S.length===0){ne=!0;for(let o of F)B(o.node,o.kind,o.definition,!1,o.why)}else if(F.some(o=>ee(o.why))&&!S.some(o=>ee(o.hit.why))){ne=!0;for(let o of F)ee(o.why)&&B(o.node,o.kind,o.definition,!1,o.why)}let he=t.near!==!1&&i.length>0&&S.length<nn&&P.length>0,te=new Set;if(he)for(let o of P){let s=cn(q(o.definition,o.node),i);s&&(te.add(o.node.id),B(o.node,o.kind,o.definition,o.current,s,s.by==="stem"?.9:.8))}let Ve=o=>o==="exact"||o==="prefix"?-1:T[o],re=(o,s,c,h)=>({hit:o,tier:Ve(s),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(i.length>0){for(let s of w){let c=pn(r,s,i);if(!c)continue;let h=Ne(r,s),m={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};S.push(re({about:"kind",kind:s,label:h,why:m,count:I[s]??0,address:Z(fe(r.tryDefinition(s),s))},c.strength,h,`kind:${s}`))}let o=t.places??[];for(let s of Re(o.filter(c=>w.includes(c.kind)))){if(s.across&&f.has(s.across))continue;let c=j(s.title,i);if(!c)continue;let h={field:"title",reading:"Title",fragment:s.title,strength:c},m=Me(s,o)?fe(r.tryDefinition(s.kind),s.kind).slice(1):void 0,b=Z(We(s.as,m));S.push(re({about:"place",kind:s.kind,title:s.title,as:s.as,why:h,address:b},c,s.title,`place:${s.kind}:${s.as}`))}for(let s of n.allInvariants()){let c=s.scope==="graph"?void 0:s.scope.kind;if(c&&!w.includes(c))continue;let h=s.label??v(s.name),m=j(h,i),b=m?void 0:j(v(s.name),i),x=m??b;if(!x)continue;let M={field:m?"label":"name",reading:m?"Rule":"Name",fragment:m?h:s.name,strength:x};S.push(re({about:"rule",name:s.name,label:h,...c?{kind:c}:{},why:M},x,h,`rule:${s.name}`))}}let pe=()=>{S.sort(qe);let o=t.limit??50,s=S.slice(0,o).map(k=>k.hit),c=s.flatMap(k=>k.about==="node"?[(J||n.graph).getNode(k.id)]:[]).filter(Boolean),h=Ce(c,k=>r.tryDefinition(k)),m=s.map(k=>k.about==="node"&&h.has(k.id)?{...k,apart:h.get(k.id)}:k),b=Object.values(I).reduce((k,Ye)=>k+Ye,0),x=S.flatMap(k=>k.hit.about==="node"?[k.hit.id]:[]),M=t.subject&&w.includes(String(n.graph.getNode(t.subject)?.kind))?kn(n,t.subject,a.words,{principal:d}):[];return{hits:[...m,...M],words:a.words,conditions:W,searched:ne?{...V,past:!0}:V,byKind:{...I},total:b,matched:x}},L=pe(),me=t.rank;if(!he||!me)return L;let be=P.filter(o=>!te.has(o.node.id)).map(({node:o,kind:s,definition:c})=>({id:o.id,kind:s,label:K(c,o),texts:q(c,o)}));if(be.length===0)return L;let Xe=(async()=>{let o;try{o=await me(a.words,be)}catch{return L}let s=new Map(P.filter(h=>!te.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:m,matched:b}of Array.isArray(o)?o:[]){let x=s.get(h);!x||!(m>0)||(s.delete(h),c=!0,B(x.node,x.kind,x.definition,x.current,un(q(x.definition,x.node),a.words,typeof b=="string"?b:void 0),Math.min(1,m)))}return c?pe():L})();return{...L,later:Xe}}function kn(n,e,t,r={}){let a=r.principal??{kind:"human"},i=(oe.keptFrom?.(n,a)?n.seenBy(a):n).graph.getNode(e);if(!i)return[];if(n.kindsKeptFrom(a).has(i.kind))return[];let d=D(t),f=K(n.schema.tryDefinition(i.kind),i),l=[];for(let u of n.allMutations()){let g=u.subject;if(!g||g.kinds!=="*"&&!g.kinds.includes(i.kind))continue;let p=u.derived?.act;if((p==="archive"||p==="merge")&&H(i)||p==="unarchive"&&!H(i)||p==="leave-alone"&&ie(i)||p==="allow-tidying"&&!ie(i)||!n.permits({name:u.name,args:{[g.arg]:i.id}},a).ok)continue;let A=Ae(u),O=D(A),w=d.filter(U=>O.some(C=>C.startsWith(U))),N=w.length>0?j(A,w):void 0,W=N?{field:"title",reading:"Act",fragment:A,strength:N}:{field:"subject",reading:"On",fragment:f,strength:"field"};l.push({hit:{about:"act",name:u.name,title:A,subject:i.id,why:W,destructive:u.destructive===!0},tier:N?T[N]:T.field+1,inKind:0,near:0,past:u.destructive?1:0,touched:0,flagged:u.pinned?0:1,name:A,id:`act:${u.name}`})}l.sort(qe);let y=l.map(u=>u.hit);return r.limit===void 0?y:y.slice(0,r.limit)}function Hn(n,e){let t=e.kinds.map((i,d)=>{let f=ue(n.tryDefinition(i),i);return d===0?f:f.toLowerCase()}),r=xe(t)||"Nothing";return e.kinds.some(i=>n.tryDefinition(i)?.lifecycle)?e.past?`${R(r)}, past ones included.`:`${R(r)}, current ones; add is:any for past ones.`:`${R(r)}.`}export{se as a,de as b,Je as c,Fe as d,Be as e,On as f,Rn as g,Le as h,Ie as i,Pe as j,en as k,le as l,ce as m,an as n,_e as o,hn as p,Kn as q,kn as r,Hn as s};
|