graview 0.1.46 → 0.1.47
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.L2PI7V4R.js → chunk.24OZGU7J.js} +1 -1
- package/dist/preview/{chunk.FGR7KCI6.js → chunk.2CLANQHZ.js} +1 -1
- package/dist/preview/{chunk.P4O5DGLN.js → chunk.2L3VFGHX.js} +1 -1
- package/dist/preview/chunk.2MCZ4CU5.js +1 -0
- package/dist/preview/{chunk.R2AG4NHQ.js → chunk.2W22AWSL.js} +1 -1
- package/dist/preview/chunk.3LDYUO77.js +1 -0
- package/dist/preview/{chunk.6OPI4WWO.js → chunk.47RTA6M3.js} +1 -1
- package/dist/preview/{chunk.N7VNEUJR.js → chunk.4YS7547F.js} +1 -1
- package/dist/preview/{chunk.W45NKVSV.js → chunk.4YXJPKXD.js} +1 -1
- package/dist/preview/{chunk.UNCS63AM.js → chunk.52VGZBO3.js} +1 -1
- package/dist/preview/{chunk.X25KXCWI.js → chunk.57ZSMK3R.js} +1 -1
- package/dist/preview/{chunk.6MADC6DM.js → chunk.5AGW4NRZ.js} +1 -1
- package/dist/preview/chunk.5G53VDOC.js +1 -0
- package/dist/preview/chunk.5M4TMZXC.js +1 -0
- package/dist/preview/{chunk.GEPNIMXW.js → chunk.5TM5VA2H.js} +1 -1
- package/dist/preview/{chunk.Y5ARSVH4.js → chunk.63MS2LOP.js} +1 -1
- package/dist/preview/{chunk.LKVXSC5O.js → chunk.6QVXXQCW.js} +1 -1
- package/dist/preview/{chunk.RNBPDB37.js → chunk.6TIEX67B.js} +1 -1
- package/dist/preview/{chunk.JF3GD4H5.js → chunk.76GF5US2.js} +1 -1
- package/dist/preview/{chunk.55D33E5A.js → chunk.7ELB37JU.js} +1 -1
- package/dist/preview/chunk.7N2GXZYI.js +3 -0
- package/dist/preview/{chunk.ATDU5Y7V.js → chunk.7NNI7YH4.js} +1 -1
- package/dist/preview/{chunk.MWONSI3P.js → chunk.A3RNSSUQ.js} +1 -1
- package/dist/preview/{chunk.CICGAEBW.js → chunk.A7RKTSOH.js} +2 -2
- package/dist/preview/{chunk.T7O6K3IN.js → chunk.AWXDZUKH.js} +1 -1
- package/dist/preview/{chunk.FXTBMW3S.js → chunk.BBS5C2BY.js} +1 -1
- package/dist/preview/{chunk.IJABD7SI.js → chunk.C3NHNYA6.js} +1 -1
- package/dist/preview/{chunk.S5MQVPLF.js → chunk.C44MC5X3.js} +1 -1
- package/dist/preview/{chunk.O24DD2VF.js → chunk.CMOXKRWT.js} +1 -1
- package/dist/preview/{chunk.HBD7FBZS.js → chunk.COYLGLTI.js} +1 -1
- package/dist/preview/{chunk.6SOUQNXR.js → chunk.CTQULC5F.js} +1 -1
- package/dist/preview/{chunk.PLWVLW22.js → chunk.DNROW6LX.js} +1 -1
- package/dist/preview/{chunk.JLEC3USG.js → chunk.DQS7D2W2.js} +1 -1
- package/dist/preview/{chunk.UR3XYOQ6.js → chunk.ETPKXUAN.js} +1 -1
- package/dist/preview/{chunk.XXEYRHRG.js → chunk.ETR6AV47.js} +1 -1
- package/dist/preview/{chunk.6QYJ2K6K.js → chunk.EUPSAYEI.js} +1 -1
- package/dist/preview/{chunk.I3GP5JW7.js → chunk.EYI3Y2DY.js} +1 -1
- package/dist/preview/chunk.F2VMMCVK.js +1 -0
- package/dist/preview/{chunk.SS27NH5O.js → chunk.F67F6QZ6.js} +1 -1
- package/dist/preview/chunk.FOJDVK2Q.js +1 -0
- package/dist/preview/{chunk.VC3BX2ZF.js → chunk.FOQ27RAR.js} +1 -1
- package/dist/preview/{chunk.EPUBSKKL.js → chunk.FWSCBHZ5.js} +1 -1
- package/dist/preview/chunk.G446PWV6.js +1 -0
- package/dist/preview/{chunk.WP5W44Y4.js → chunk.GCKZ2YRJ.js} +2 -2
- package/dist/preview/{chunk.WO3DDFFY.js → chunk.GQHAAKJG.js} +1 -1
- package/dist/preview/{chunk.F37DHXA2.js → chunk.I6JLOEJU.js} +1 -1
- package/dist/preview/chunk.IJNOT4S4.js +4 -0
- package/dist/preview/{chunk.ONEYVLC2.js → chunk.IPAZOKMQ.js} +1 -1
- package/dist/preview/{chunk.5ESCD57M.js → chunk.IQ2HKGJS.js} +1 -1
- package/dist/preview/{chunk.DEUTHHGI.js → chunk.IROYMLER.js} +1 -1
- package/dist/preview/chunk.ISNEX772.js +1 -0
- package/dist/preview/{chunk.R4OU7O6C.js → chunk.IXOQQBJE.js} +1 -1
- package/dist/preview/{chunk.NWA7Q6CI.js → chunk.IYIN6VSN.js} +1 -1
- package/dist/preview/{chunk.FO5BOBYV.js → chunk.JUWWRRHA.js} +1 -1
- package/dist/preview/{chunk.JNIGZEOF.js → chunk.K2NCGPCL.js} +1 -1
- package/dist/preview/{chunk.4KNEBLB7.js → chunk.KSM6NVAT.js} +1 -1
- package/dist/preview/{chunk.BFKV4GKP.js → chunk.L4YNDNX7.js} +1 -1
- package/dist/preview/{chunk.A5VGTO3E.js → chunk.MBETS27C.js} +1 -1
- package/dist/preview/{chunk.3OSGN463.js → chunk.MCB26YCQ.js} +1 -1
- package/dist/preview/chunk.MCCUVGTE.js +1 -0
- package/dist/preview/{chunk.BCWPV4WR.js → chunk.MF73YBJL.js} +1 -1
- package/dist/preview/{chunk.UOXFALRL.js → chunk.N7JT6MG2.js} +1 -1
- package/dist/preview/{chunk.V5Z2OED6.js → chunk.NDWW5EER.js} +1 -1
- package/dist/preview/{chunk.LVEFQLGQ.js → chunk.NEEOVRB7.js} +1 -1
- package/dist/preview/{chunk.NMIXBH37.js → chunk.NFIGGSMJ.js} +1 -1
- package/dist/preview/{chunk.JBW3DI7E.js → chunk.O2WWYZI7.js} +1 -1
- package/dist/preview/{chunk.XSNAG4JT.js → chunk.O4WEJ47H.js} +3 -3
- package/dist/preview/{chunk.LUNATPAB.js → chunk.OCTOGZVJ.js} +2 -2
- package/dist/preview/{chunk.BAMPYMUE.js → chunk.OJGUIWDD.js} +1 -1
- package/dist/preview/{chunk.VDVJCLGS.js → chunk.OONCUAOH.js} +1 -1
- package/dist/preview/{chunk.VBPK6ARF.js → chunk.P4KCZRIG.js} +1 -1
- package/dist/preview/{chunk.4Y6VGQVQ.js → chunk.PBKO5CKD.js} +1 -1
- package/dist/preview/{chunk.JLYNMAME.js → chunk.PYE3WZM7.js} +1 -1
- package/dist/preview/{chunk.F5PBK4TF.js → chunk.QGG6ZRJ5.js} +2 -2
- package/dist/preview/{chunk.LETJC5TD.js → chunk.QZEZHCOI.js} +1 -1
- package/dist/preview/{chunk.DQOCBKC3.js → chunk.R6V37SR7.js} +1 -1
- package/dist/preview/{chunk.NGIPVTTE.js → chunk.RBJAPOZ3.js} +1 -1
- package/dist/preview/{chunk.RZXPBOGT.js → chunk.RG6WNOBW.js} +1 -1
- package/dist/preview/{chunk.LKN734RR.js → chunk.RUPRZDN3.js} +1 -1
- package/dist/preview/{chunk.S6WHA4CW.js → chunk.RVJXO5GG.js} +1 -1
- package/dist/preview/chunk.RX2M4C5W.js +2 -0
- package/dist/preview/{chunk.EAJB2PJZ.js → chunk.RZF3QM4E.js} +1 -1
- package/dist/preview/{chunk.JLIUUFK2.js → chunk.S5IQFZ5Z.js} +1 -1
- package/dist/preview/{chunk.TOZJZXWQ.js → chunk.SD6N4DGF.js} +1 -1
- package/dist/preview/{chunk.URO2EGY7.js → chunk.SGKK4UKP.js} +1 -1
- package/dist/preview/{chunk.OHSJQYJN.js → chunk.SWWAEOZ7.js} +1 -1
- package/dist/preview/chunk.SZR3Z43B.js +1 -0
- package/dist/preview/{chunk.RTI3FEDD.js → chunk.T42S2WMB.js} +1 -1
- package/dist/preview/chunk.T7RJCEJB.js +18 -0
- package/dist/preview/{chunk.3MMLRSRC.js → chunk.TCXKPILZ.js} +1 -1
- package/dist/preview/{chunk.TFVFJFXC.js → chunk.TJEV5ZAM.js} +3 -3
- package/dist/preview/{chunk.Z5IGHCZX.js → chunk.UV3YU64Z.js} +1 -1
- package/dist/preview/{chunk.WQONZBA3.js → chunk.V7XHNRQM.js} +2 -2
- package/dist/preview/{chunk.M5GJHVWZ.js → chunk.VC3UGFHY.js} +1 -1
- package/dist/preview/{chunk.NIVTK2W5.js → chunk.VSNHCGKC.js} +1 -1
- package/dist/preview/{chunk.UVNVDLV5.js → chunk.VXVWUIGO.js} +1 -1
- package/dist/preview/chunk.W6COSBO2.js +21 -0
- package/dist/preview/{chunk.3VFYSXMQ.js → chunk.WHEUTAXA.js} +1 -1
- package/dist/preview/{chunk.ITYQUSZI.js → chunk.WJS6P7GI.js} +1 -1
- package/dist/preview/chunk.X5G7FOPY.js +12 -0
- package/dist/preview/{chunk.6WA6ASQB.js → chunk.XYEFZ2OO.js} +1 -1
- package/dist/preview/chunk.Y4ZUJUUT.js +25 -0
- package/dist/preview/{chunk.HZCA3UWJ.js → chunk.YHH4TWZ2.js} +1 -1
- package/dist/preview/{chunk.4RJZVTW7.js → chunk.YVONXFKE.js} +1 -1
- package/dist/preview/{chunk.5R2R364Q.js → chunk.Z4UM4CMT.js} +1 -1
- package/dist/preview/{chunk.4HYJHGI4.js → chunk.ZCYGUP3I.js} +1 -1
- package/dist/preview/{chunk.FVOJCVRX.js → chunk.ZL7ZBJUU.js} +1 -1
- package/dist/preview/{chunk.JT3IZIU5.js → chunk.ZQY6ODXC.js} +1 -1
- package/dist/preview/{chunk.SL2FZ54V.js → chunk.ZWVN75EY.js} +1 -1
- package/dist/preview/index.html +33 -33
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2JJYGYT2.js +0 -1
- package/dist/preview/chunk.5K6KX3UC.js +0 -1
- package/dist/preview/chunk.6BDM2XRX.js +0 -1
- package/dist/preview/chunk.6UIW664O.js +0 -6
- package/dist/preview/chunk.AQQZY6OY.js +0 -3
- package/dist/preview/chunk.GVY5UQTJ.js +0 -1
- package/dist/preview/chunk.JHIUG25Q.js +0 -1
- package/dist/preview/chunk.JQLR6KO2.js +0 -1
- package/dist/preview/chunk.NITU5H4J.js +0 -1
- package/dist/preview/chunk.UPQZU7UO.js +0 -21
- package/dist/preview/chunk.V3QUTJR2.js +0 -2
- package/dist/preview/chunk.WM2LWHTJ.js +0 -1
- package/dist/preview/chunk.WSTBCWW7.js +0 -4
- package/dist/preview/chunk.X233NILF.js +0 -1
- package/dist/preview/chunk.XWAMQPUM.js +0 -25
- package/dist/preview/chunk.XXDBZQNY.js +0 -18
- package/dist/preview/chunk.ZTIF23VF.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,b as m,d as k,e as y}from"./chunk.UGFDSE37.js";import"./chunk.
|
|
1
|
+
import{a as r,b as m,d as k,e as y}from"./chunk.UGFDSE37.js";import"./chunk.O4WEJ47H.js";import"./chunk.Y4ZUJUUT.js";import"./chunk.SDO3U72B.js";import"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";var i="way-back",b='[data-testid="notices-toasts"]';function g(t){let o=document.activeElement;o!==null&&o!==document.body&&!o.closest(b)||(t??document).querySelector('[data-graview-app-bar] [data-testid="app-home"]')?.focus({preventScroll:!0})}function w(t,o,a,d,h){if(t.past)return a?.dismiss(i),()=>{};let c=h?.closest("[data-graview-embed]"),s,f=e=>{if(e!==void 0&&r(t,o)?.batch!==e)return!1;try{let n=k(t,o);return n&&a?.notify({kind:"toast",id:i,sentence:`Took back \u201C${n.intent}\u201D`}),n!==void 0}catch(n){return a?.notify({kind:"toast",id:i,tone:"warn",sentence:n instanceof Error?n.message:String(n)}),!0}},u=()=>{let e=m(t,o,d);if(d=t.batches().length,e){let n=s=e.batch;a?.notify({kind:"toast",id:i,sentence:e.intent,timeout:1e4,action:{label:"Take back",keys:"Meta+Z Control+Z",onSelect:()=>(g(c),f(n))}})}else s&&r(t,o)?.batch!==s&&(s=void 0,a?.dismiss(i))},l=e=>{y(e)&&(!c||c.contains(e.target))&&f()&&e.preventDefault()};u();let p=t.subscribe(u);return document.addEventListener("keydown",l),(e=!1)=>{p(),document.removeEventListener("keydown",l),e&&s&&a?.dismiss(i)}}export{w as sceneWay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.HDRD33II.js";import"./chunk.DX357TZ3.js";import{b as m}from"./chunk.H7KCWCB4.js";import"./chunk.
|
|
1
|
+
import"./chunk.HDRD33II.js";import"./chunk.DX357TZ3.js";import{b as m}from"./chunk.H7KCWCB4.js";import"./chunk.O4WEJ47H.js";import{R as p}from"./chunk.Y4ZUJUUT.js";import"./chunk.SDO3U72B.js";import{U as l}from"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import{b as f}from"./chunk.AJZBJBMO.js";var a=f(p(),1);function N({states:e,definition:v}){let s=e.values.reduce((t,n)=>t+n.count,0),u=t=>t===null?"with none":m(v,e.field,t).toLowerCase(),c=e.values.filter(t=>t.count>0).map(t=>`${l(t.count)} ${u(t.value)}`).join(", ");return s===0?null:(0,a.jsx)("div",{className:"graview-district-states",role:"img","aria-label":c,title:c,children:e.values.map((t,n)=>{if(t.count===0)return null;let y=e.values.filter(r=>r.count>0).length,w=t.count/s*(168-(y-1)),o=l(t.count),i=`${o} ${u(t.value)}`,d=r=>r.length*6.2+8<=w;return(0,a.jsx)("span",{"data-graview-tier":t.tier,style:{flexGrow:t.count},title:i,children:d(i)?i:d(o)?o:""},n)})})}export{N as StatesBar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk.
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk.RX2M4C5W.js";import"./chunk.FOQ27RAR.js";import"./chunk.ZIEHF67C.js";import"./chunk.UHX4WTM7.js";import"./chunk.IKX4VDTW.js";import"./chunk.RNEJYIQ7.js";import"./chunk.TBQOSI4J.js";import"./chunk.KWQ7QOHD.js";import"./chunk.DX357TZ3.js";import"./chunk.H7KCWCB4.js";import"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";export{g as columnActs,d as columnChoices,c as columnMoves,b as columnOf,e as columnReach,f as columnSteps,j as describePlace,k as placeText,h as resolveFor,i as shadowedPageSlots,a as statusColumns};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as p}from"./chunk.
|
|
1
|
+
import{h as p}from"./chunk.O4WEJ47H.js";import{R as c}from"./chunk.Y4ZUJUUT.js";import{$b as u}from"./chunk.AS4CQBOQ.js";import{b as h}from"./chunk.AJZBJBMO.js";var s={person:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="11.6" cy="5.4" r="2.5"/><path d="M7.9 12.4c0-2.1 1.7-3.8 3.7-3.8s3.7 1.7 3.7 3.8v3.2H7.9z"/><path d="M8 12.6 6.4 17.2"/><path d="M15.2 12.6 16.8 17.2"/><path d="M9.8 15.6v5"/><path d="M13.4 15.6v5"/></svg>',plot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.6 9.4 12 4.6l9.4 4.8-9.4 4.8z"/><path d="M2.6 9.4v4.4l9.4 4.8 9.4-4.8V9.4"/><path d="M12 14.2v4.4"/><path d="M7 11.9v3"/><path d="M17 11.9v3"/></svg>',box:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 7.9 12 3.6l8.6 4.3-8.6 4.3z"/><path d="M3.4 7.9v8.2L12 20.4l8.6-4.3V7.9"/><path d="M12 12.2v8.2"/></svg>',task:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 6.6 12 2.9l7.6 3.7v9.5L12 19.8 4.4 16.1z"/><path d="M12 12.4v7.4"/><path d="M4.4 6.6 12 10.3l7.6-3.7"/><path d="M8 9.6l2.4 2.4L16 8.4"/></svg>',shift:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.2 8.2 12 4l8.8 4.2-8.8 4.2z"/><path d="M3.2 8.2v7.2L12 19.6l8.8-4.2V8.2"/><path d="M12 12.4v7.2"/><path d="M6.6 10.8v3.4"/><path d="M9.3 12v3.4"/></svg>',list:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 10.4 12 6l9.2 4.4-9.2 4.4z"/><path d="M2.8 10.4v3.2L12 18l9.2-4.4v-3.2"/><path d="M6.6 8.6 15.8 13"/><path d="M9.4 7.2 18.6 11.6"/></svg>',vehicle:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 14.2 5 9.4l8.6-1.6 5.4 3-1 3.6z"/><path d="M2.8 14.2v2.2h2.4"/><path d="M18 16.4h1.9l.1-2.2"/><circle cx="7.6" cy="16.6" r="1.9"/><circle cx="16.1" cy="16.6" r="1.9"/><path d="M8.6 8.2 9.8 12l7.2-1"/></svg>',rule:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 19.4V6.6l12 12.8z"/><path d="M5.4 6.6 7.6 5.5l12 12.8-2.2 1.1"/><path d="M5.4 19.4 7.6 18.3h12"/><path d="M5.4 10.1h1.7"/><path d="M5.4 13.3h1.7"/><path d="M5.4 16.5h1.7"/></svg>',note:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.2 6.2 14.8 10.5v9L6.2 15.2z"/><path d="M12.4 9.3 14.8 10.5l-.6 2.3"/><path d="M8.2 10.6 12.8 12.9"/><path d="M8.2 13.2 11.4 14.8"/></svg>'},v=Object.keys(s);function i(e){if(e)return s[e]??(e.trimStart().startsWith("<svg")?e:void 0)}var a=h(c(),1);function A({kind:e,schema:o,brand:n,size:r=16,title:t}){let f=o?.tryDefinition?.(e)?.figure,d=i(n?.figures?.[e]??f),l=Math.round(u(e,n?.accents)),g=p(d);return d?(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"figure",dangerouslySetInnerHTML:g,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,flex:"0 0 auto",color:`hsl(${l} 55% 52%)`,"--graview-figure-size":`${r}px`}}):(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"dot",style:{display:"inline-block",width:Math.round(r*.8),height:Math.round(r*.5),flex:"0 0 auto",background:`hsl(${l} 55% 52%)`,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)"}})}function C(e,o,n){return i(n?.figures?.[e]??o?.tryDefinition?.(e)?.figure)!==void 0}export{A as a,C as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as P,c as m,d as k}from"./chunk.7ELB37JU.js";import"./chunk.F2VMMCVK.js";import"./chunk.NFIGGSMJ.js";import{b as v,c as w,d as S,e as x,f as M}from"./chunk.G446PWV6.js";import"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";var O=new Set(["input","select","textarea"]),g=r=>r.namespaceURI==="http://www.w3.org/1999/xhtml"&&O.has(r.localName),N=r=>r.localName==="select"||r.type==="checkbox"||r.type==="radio",E=r=>r.type==="checkbox"||r.type==="radio"?!r.checked:r.localName!=="select"&&r.value==="";function h(r){return r.type==="checkbox"||r.type==="radio"?`checked:${r.checked}`:r.localName==="select"&&r.multiple?`selected:${[...r.selectedOptions].map(n=>n.value).join("\0")}`:`value:${r.value}`}function F(r=n=>n.isTrusted){let n=new WeakMap,d=new WeakSet,o=new WeakMap,i={heard(e,t){if(!(!g(t)||!r(e))&&(e.type==="input"||e.type==="change"&&N(t))&&((N(t)||E(t))&&d.delete(t),E(t)&&o.delete(t),n.set(t,h(t)),t.type==="radio"&&t.name)){let c=t.getRootNode();for(let u of c.querySelectorAll?.('input[type="radio"]')??[])u.name===t.name&&n.set(u,h(u))}},filled(e){n.delete(e),o.delete(e),g(e)&&!E(e)?d.add(e):d.delete(e)},press(e,t,c){if(!r(e))return;let u=t.closest("[data-act]");if(!u||!w(u))return;let l=e.type==="keydown"?e.key:void 0;if(!(e.type!=="click"&&!((l==="Enter"||l===" ")&&t===u&&!v(u))))return i.collect(u,c)},collect(e,t){if(!e.hasAttribute("data-act")||!t.contains(e))return;let c=e.closest("[data-record]"),u=e.closest("fieldset, [role='group']")??t,l=[];for(let a of u.querySelectorAll("input[name], select[name], textarea[name]")){let s=a,f=!d.has(s)&&n.get(s)===h(s);if(s.type==="radio"){if(!s.checked)continue;l.push({name:s.name,value:s.value,typed:f,empty:!1,chosen:!0});continue}if(s.localName==="select"){l.push({name:s.name,value:s.value,typed:f,empty:s.value===""&&!f,chosen:!0});continue}if(s.type==="checkbox"){l.push({name:s.name,value:s.checked,typed:f,empty:!s.checked&&!d.has(s)&&!f});continue}let R=(s.type==="number"||s.type==="range")&&s.value!==""&&Number.isFinite(s.valueAsNumber)?s.valueAsNumber:s.value,A=f?o.get(s):void 0;l.push({name:s.name,value:R,typed:f,empty:s.value===""&&!f,...A?{from:A}:{}})}return{as:e.getAttribute("data-act")??"",...c&&t.contains(c)?{record:c.getAttribute("data-record")}:{},fields:l}},prefilled(e,t){d.delete(e),o.set(e,t),n.set(e,h(e))}};return i}var b=new WeakMap,L=(r,n)=>{n.tab&&r.removeAttribute("tabindex"),n.role&&r.getAttribute("role")==="button"&&r.removeAttribute("role"),r.removeAttribute("data-graview-press"),b.delete(r)};function W(r){for(let n of r.querySelectorAll("[data-act], [data-graview-press], [role], [aria-pressed], [aria-expanded]")){let d=b.get(n),o=w(n)&&!v(n)&&!g(n),i=!o&&S(n,d?.role?null:n.getAttribute("role"));if(d&&(d.bound!==o||!(o||i))&&L(n,d),(o||i)&&!b.has(n)){let e=!x(n),t=o&&M(n);e&&n.setAttribute("tabindex","0"),t&&n.setAttribute("role","button"),n.setAttribute("data-graview-press",""),b.set(n,{tab:e,role:t,bound:o})}}}var y=new WeakSet;function V(r){for(let n of r.querySelectorAll("svg")){let d=n.hasAttribute("role")||n.hasAttribute("aria-label")||n.hasAttribute("aria-labelledby")||[...n.children].some(e=>e.localName==="title"),o=n.hasAttribute("tabindex")||n.hasAttribute("data-graview-link")||n.hasAttribute("data-graview-press")||n.querySelector("[tabindex], [data-graview-link], [data-graview-press], a")!==null,i=!d&&!o;i&&!y.has(n)&&!n.hasAttribute("aria-hidden")?(n.setAttribute("aria-hidden","true"),y.add(n)):!i&&y.has(n)&&(n.removeAttribute("aria-hidden"),y.delete(n))}}var j=1e3;function I(r){let n=r.getAttribute("data-debounce")?.trim(),d=n?Number(n):Number.NaN;return Number.isFinite(d)?Math.min(1e4,Math.max(250,Math.round(d))):j}function B(r){let n=r.trusted??(e=>e.isTrusted),d=r.timers??{set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e)},o=new Map,i=(e,t)=>{let c=o.get(e);c&&d.clear(c.handle),o.delete(e);let u=r.reader.collect(e,t);u&&r.save(u,e)};return{heard(e,t,c){if(!g(t)||!n(e)||!t.hasAttribute("data-act"))return;let u=t.getAttribute("data-save");if(e.type==="input"&&u==="input"){let l=o.get(t);l&&d.clear(l.handle),o.set(t,{root:c,handle:d.set(()=>i(t,c),I(t))})}else e.type==="change"&&(u==="change"||u==="input"&&o.has(t))&&i(t,c)},flush(){for(let[e,{root:t}]of[...o])i(e,t)},get waiting(){return o.size}}}var H=new Set(["text","search","email","url","tel","number"]);function D(r,n,d,o){for(let i of r.querySelectorAll("input[data-prefill], textarea[data-prefill]")){let e=i;if(d.has(e))continue;let t=e.getAttribute("data-prefill")??"";if(t===""||e.getAttribute("name")!==t||e.localName==="input"&&!H.has(e.type))continue;if(e.value!==""){d.add(e);continue}let u=[...(e.closest("fieldset, [role='group']")??r).querySelectorAll("[data-act]")],l=e.closest("[data-record]"),a=new Set(u.map(p=>p.closest("[data-record]")?.getAttribute("data-record")).filter(p=>typeof p=="string")),s=l&&r.contains(l)?l.getAttribute("data-record"):a.size===1?[...a][0]:void 0;if(!s)continue;let f=o({record:s,field:t,acts:u.map(p=>p.getAttribute("data-act")??"")});if(f!==void 0){if(e.value=f,d.add(e),e.value!==f){e.value="";continue}n.prefilled(e,{record:s,field:t,value:f})}}}function _(r,n,d,o){let i=k(n,o.as);if(!i)return m("undeclared",`This view may not ask for \u201C${o.as}\u201D: its manifest does not name it.`);let e=r.allMutations().find(a=>a.name===i.act);if(!e)return m("unknown-act","There is no act by that name here.");let t={};if(o.record!==void 0){let a=i.record??e.subject?.arg;if(!a)return m("unbound",`\u201C${o.as}\u201D is not done to a record.`);if(!d.has(o.record))return m("unbound","That press is bound to a record this view was not shown.");t[a]=o.record}for(let[a,s]of Object.entries(i.constants??{})){if(a in t)return m("malformed",`\u201C${a}\u201D is both the bound record and a constant.`);t[a]=s}let c=e.input?.shape??{},u=new Set(Object.keys(c)),l=new Set;for(let a of o.fields)if(!(!u.has(a.name)||a.name in t)){if(l.has(a.name))return m("malformed",`Two fields here are called \u201C${a.name}\u201D.`);if(l.add(a.name),a.typed&&a.chosen){let s=P(c[a.name])?.find(f=>String(f)===String(a.value));if(s!==void 0)t[a.name]=s;else if(typeof a.value=="string"&&d.has(a.value))t[a.name]=a.value;else return m("untyped",`\u201C${a.name}\u201D was a choice among the view's own words, not one this app declares, so it was not sent.`)}else{if(a.typed&&a.from&&!(o.record===a.from.record&&a.name===a.from.field&&T(r,i,a.from.record,a.from.field)))return m("untyped",`\u201C${a.name}\u201D was filled in from a record for an act that writes it back there, not for this one, so it was not sent.`);if(a.typed&&a.from&&String(a.value)===a.from.value)t[a.name]=r.graph.getNode(a.from.record)?.[a.name]??a.value;else if(a.typed)t[a.name]=a.value;else if(!a.empty)return m("untyped",`\u201C${a.name}\u201D was filled in by the view, not typed by you, so it was not sent.`)}}return{ok:!0,name:i.act,args:t}}function T(r,n,d,o){let i=r.allMutations().find(u=>u.name===n.act),e=i?.subject;if(!i||!e||(n.record??e.arg)!==e.arg||o===e.arg||Object.hasOwn(n.constants??{},o)||!Object.hasOwn(i.input.shape??{},o)||Object.keys(i.writesOther??{}).length>0)return!1;let t=r.graph.getNode(d)?.kind,c=t===void 0?void 0:r.schema.tryDefinition(t);return!c||e.kinds!=="*"&&!e.kinds.includes(t)||!Object.hasOwn(c.fields.shape??{},o)?!1:i.writes?.includes(o)??!1}function C(r,n,d,o,i){if(!o.has(i.record))return;let e=r.seenBy(n).graph.getNode(i.record);if(!e||!i.acts.some(u=>{let l=k(d,u);if(!l||!T(r,l,i.record,i.field))return!1;let a=r.allMutations().find(s=>s.name===l.act).subject;return r.permits({name:l.act,args:{[a.arg]:i.record}},n).ok}))return;let c=e[i.field];return typeof c=="string"?c:typeof c=="number"&&Number.isFinite(c)?String(c):void 0}export{j as SAVE_DEBOUNCE_MS,F as createPressReader,B as createSaver,D as fillPrefills,_ as judgePress,W as markPresses,C as prefillOf,V as quietPictures,I as saveDebounceOf,T as writesBack};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.
|
|
1
|
+
import"./chunk.O4WEJ47H.js";import{$ as H,G as U,O as N,P as I,R as B}from"./chunk.Y4ZUJUUT.js";import"./chunk.SDO3U72B.js";import{R as W,Wa as z,wc as $}from"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import{b as O}from"./chunk.AJZBJBMO.js";function x(n,t){return n.kind==="agent"?"agent":n.kind!=="human"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var X=n=>n.ops.filter(t=>t.withheld!==!0);function L(n,t={}){let r=n.batches().map(e=>{let o=e.ops[0],l=e.ops.at(-1),c=X(e).length===0;return{seq:l.seq+1,from:o.seq,at:l.at,batch:e.id,maker:c?"person":x(e.author,t.me),author:c?void 0:e.author,said:e.intent,declaration:!1,withheld:c}}),s=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of s){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let o=r.findIndex(l=>l.seq===e.seq);if(o>=0&&!r[o].withheld){r[o]={...r[o],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?x(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,o)=>e.seq-o.seq||+(e.batch!==void 0)-+(o.batch!==void 0))}function V(n,t){let r=n.log.all(),s=new Map(r.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(o=>o.undoes!==void 0&&(s.get(o.undoes)??-1)>=t)).map(e=>e.id)}function _(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?z(n.author,t):"the app"}var d=O(U(),1);var i=O(B(),1),J={kind:"human"},Q=[1,2,4,8],Z=900,T={you:"You",person:"A person",agent:"An agent",app:"The app"},F={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function ee(n,t,r){let s=r?Array.from({length:t},(e,o)=>o):[];return[...new Set([...s,t,...n.map(e=>e.seq)])].sort((e,o)=>e-o)}function te(n,t){let r=n.withheld===!0;return{seq:n.seq+1,from:n.seq,at:n.at,batch:n.batch,maker:r?"person":x(n.author,t),author:r?void 0:n.author,said:n.batchIntent??n.intent,declaration:!1,withheld:r}}function ne(n,t){let r=0;for(let s=0;s<n.length;s++)n[s]<=t&&(r=s);return r}function ae(n,t,r){let s=V(n,t);if(s.length===0)return null;let e=n.canUndo(s);if(!e.ok)return null;let o=new Set(n.permittedMutations(r).map(l=>l.name));return e.ops.every(l=>l.mutation!==null&&o.has(l.mutation.name))?s:null}function ce({face:n}){let t=N(),r=H(),s=r?.principal??J,e=I(t.live,s),o=e.log.length,l=(0,d.useMemo)(()=>L(e,{me:s,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,s,t.host,o]),c=e.log.horizon,b=c>0&&t.host?.archived!==void 0,h=(0,d.useMemo)(()=>ee(l,c,b),[l,c,b]),f=t.archive,p=f?.seq??t.past?.seq??o,v=ne(h,p),m=h.length-1,D=p<c&&t.past?.seq===p?t.past.store.log.all().at(-1):void 0,w=D?te(D,s):p<c?void 0:[...l].reverse().find(a=>a.seq<=p&&a.seq>(h[v-1]??-1))??[...l].reverse().find(a=>a.seq<=p),[k,P]=(0,d.useState)(!1),[q,K]=(0,d.useState)(1),[R,M]=(0,d.useState)(null);(0,d.useEffect)(()=>{if(!k)return;if(v>=m){P(!1);return}let a=setTimeout(()=>t.show(h[v+1]),Z/q);return()=>clearTimeout(a)},[k,v,m,q,h,t]);let E=(0,d.useMemo)(()=>t.past&&!f&&p>=c?ae(e,p,s):null,[t.past,f,e,p,c,s,o]),j=a=>_(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),y=t.past?t.past.at?W(t.past.at,r?.locale):"the start":null,A=f?f.refused?"The archive could not be read":"Reading the older changes from the archive\u2026":w?`${j(w)==="you"?"You":j(w)}: ${w.said}`:"Nothing had happened yet",C=(0,d.useRef)(null);(0,d.useLayoutEffect)(()=>{let a=C.current,g=a?.parentElement;if(n!=="scene"||!a||!g)return;let u=()=>g.style.setProperty("--graview-sheet",`${Math.ceil(a.getBoundingClientRect().height)+24}px`);u();let S=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return S?.observe(a),()=>{S?.disconnect(),g.style.removeProperty("--graview-sheet")}},[n]);let Y=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:$("rail")}:{position:"sticky",top:0,zIndex:$("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,i.jsxs)("section",{ref:C,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...Y,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,i.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:f?"Archived changes":y?`As of ${y}`:"Now"}),(0,i.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:A}),y?(0,i.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,i.jsxs)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:[b?(0,i.jsx)("span",{"data-testid":"timeline-archived",title:"Changes read from the archive as you scrub back",style:{position:"absolute",left:0,bottom:0,height:6,width:`${m===0?0:h.indexOf(c)/m*100}%`,borderRadius:2,background:"var(--graview-edge)"}}):null,h.slice(1).map((a,g)=>{let u=[...l].reverse().find(G=>G.seq===a);if(!u)return null;let S=m===0?0:(g+1)/m*100;return(0,i.jsx)("span",{"data-graview-tick":a,"data-maker":u.maker,...u.declaration?{"data-declaration":""}:{},title:`${T[u.maker]}: ${u.said}`,style:{position:"absolute",left:`calc(${S}% - 1px)`,bottom:0,width:u.declaration?4:2,height:u.declaration?22:12,borderRadius:2,background:u.declaration?"var(--graview-ink)":F[u.maker],opacity:a<=p?1:.45}},`${a}:${u.batch??"declaration"}`)})]}),(0,i.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:m,step:1,value:v,"aria-valuetext":y?`As of ${y}. ${A}`:`Now. ${A}`,onChange:a=>{P(!1),t.show(h[Number(a.currentTarget.value)]??o)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,i.jsx)("button",{type:"button","data-testid":"play","aria-pressed":k,onClick:()=>{!k&&v>=m&&t.show(h[0]),P(!k)},style:{minHeight:28,minWidth:64},children:k?"Pause":"Play"}),(0,i.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,i.jsx)("select",{"data-testid":"speed",value:q,onChange:a=>K(Number(a.currentTarget.value)),style:{minHeight:28},children:Q.map(a=>(0,i.jsxs)("option",{value:a,children:[a,"\xD7"]},a))})]}),(0,i.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(T).filter(a=>l.some(g=>g.maker===a)).map(a=>(0,i.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,i.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:F[a]}}),T[a]]},a))}),(0,i.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[E?(0,i.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{M(null);try{e.undo([...E],{author:s,intent:y?`Restore to ${y}`:"Restore"}),t.show(null)}catch(a){M(a instanceof Error?a.message:String(a))}},style:{minHeight:28},children:"Restore to here"}):null,(0,i.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),R?(0,i.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:R}):null,f?.refused?(0,i.jsx)("span",{role:"alert","data-testid":"archive-refused",style:{color:"var(--graview-warn)"},children:f.refused}):null,c>0&&!b?(0,i.jsx)("span",{"data-testid":"timeline-horizon",style:{color:"var(--graview-ink-faint)"},children:"The changes before the timeline's start were archived."}):null]})}export{ce as Timeline};
|
|
@@ -0,0 +1,18 @@
|
|
|
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 zt,B as Ae,C as ro,D as Ze,E as ue,F as Wn,G as De,H as Ue,I as oo,J as Kn,K as Re,L as io,M as so,N as O,O as pt,P as wt,Q as lo,R as vt,S as Qt,T as co,U as ee,V as Zt,W as re,X as Bn,a as V,b as we,c as _,d as jt,e as Hn,f as In,g as ct,h as Z,i as he,j as ae,k as A,l as J,m as q,n as qe,o as ve,p as _t,q as Se,r as le,s as to,t as ht,u as no,v as Fn,w as Dn,x as z,y as Fe,z as ao}from"./chunk.76GF5US2.js";import{a as Ie}from"./chunk.ETPKXUAN.js";import{a as Qe,b as Yt,d as Y}from"./chunk.IPAZOKMQ.js";import{b as Nn,c as Jr,d as eo}from"./chunk.V7XHNRQM.js";import{a as Qr,d as Zr,e as Xr}from"./chunk.UGFDSE37.js";import{a as Ur,c as Vr,f as jr,g as _r,i as zr,j as Yr}from"./chunk.IYIN6VSN.js";import{a as Nr,b as Hr,c as Ir,d as On}from"./chunk.GCKZ2YRJ.js";import{b as Or}from"./chunk.VC3UGFHY.js";import{a as Fr,b as Dr,d as Gt,e as Wr,f as Kr,g as Br,j as qt}from"./chunk.YHH4TWZ2.js";import{a as Ut,b as Vt}from"./chunk.PXQVXBNG.js";import{a as Ht,b as za,c as Ya,d as It,e as Qa}from"./chunk.EUPSAYEI.js";import{b as ar,c as mr,e as fr,f as Tn}from"./chunk.TCXKPILZ.js";import{a as Ln,b as gr}from"./chunk.R6V37SR7.js";import{a as Kt,b as Bt,c as Mr,e as Er}from"./chunk.FWSCBHZ5.js";import{a as dt,b as pr,e as ur}from"./chunk.7NNI7YH4.js";import{m as $r}from"./chunk.MF73YBJL.js";import{a as hr,b as wr,c as vr,e as Tr,f as $n,h as Wt}from"./chunk.PKUDIWIF.js";import{d as br,e as xr,f as Pr,g as Cr,n as Ar,o as Rr,q as Lr,s as Dt}from"./chunk.VW2VCPJX.js";import{a as Mn}from"./chunk.UKAPFIPJ.js";import{a as An,b as tr,c as nr}from"./chunk.UT6642FC.js";import{a as yr}from"./chunk.IW7YFPGG.js";import{c as or,d as ir,e as sr,f as lr,j as yt,k as dr}from"./chunk.ZIEHF67C.js";import{a as rr}from"./chunk.UHX4WTM7.js";import{r as Rn,s as cr}from"./chunk.5AGW4NRZ.js";import{g as Ft}from"./chunk.HDRD33II.js";import{b as Za,c as Xa,d as Ja,e as er}from"./chunk.DX357TZ3.js";import{C as En,K as Gr,N as qr,e as ja,f as _a,j as Xo,u as Sr,v as kr}from"./chunk.O4WEJ47H.js";import{$ as se,G as He,L as Ha,N as Ia,Na as Va,Q as Fa,R as G,S as Cn,V as Da,W as Wa,_ as Ka,ca as Ba,da as Ga,fa as qa,ja as lt,la as Ua,na as Ot,r as Na,v as Ne,ya as Nt}from"./chunk.Y4ZUJUUT.js";import{a as Oa}from"./chunk.SDO3U72B.js";import{$c as Ma,J as wa,U as ft,Vc as xn,Wb as Aa,Xa as xa,Za as Pa,Zb as Ra,_b as La,_c as Et,ba as st,bd as $t,ca as pe,ea as ze,fa as Tt,gb as bn,ha as Ge,hb as Ca,ja as va,ka as Sa,kd as Pn,la as Ye,ld as Ea,qb as Mt,qd as $a,vc as Ta,wa as ka,xa as ba}from"./chunk.AS4CQBOQ.js";import{b as H}from"./chunk.AJZBJBMO.js";function po(e,t,n={}){let a=e.graph.getNode(t);if(!a)return;let r=e.schema.tryDefinition(a.kind),o=l=>pe(e.schema.tryDefinition(l.kind),l),d=new Map;for(let l of e.graph.allEdges()){let s=l.from===t?"out":l.to===t?"in":null;if(!s)continue;let c=s==="out"?l.to:l.from,m=e.graph.getNode(c);if(!m)continue;let w=(s==="out"?r:e.schema.tryDefinition(m.kind))?.edges?.[l.kind],g=s==="in"?w?.inverse??w?.description:w?.description,P=`${l.kind}|${s}|${g??""}`;(d.get(P)??(()=>{let U={edgeKind:l.kind,direction:s,...g?{description:g}:{},targets:[]};return d.set(P,U),U})()).targets.push({id:m.id,kind:m.kind,label:o(m)})}return{id:t,kind:a.kind,label:o(a),fields:Ja(yt(e.schema,e.graph,a),r),violations:bn(e.violations(n.context),[t]),actions:Mn(e,[t],{focus:t,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...d.values()].map(l=>{let s=Za(l.targets.flatMap(c=>{let m=e.graph.getNode(c.id);return m?[m]:[]}),c=>e.schema.tryDefinition(c));return{...l,targets:[...l.targets].map(c=>s.has(c.id)?{...c,apart:s.get(c.id)}:c).sort((c,m)=>c.label.localeCompare(m.label))}})}}function Xe(e,t,n={}){return{kind:t,members:e.graph.nodesOfKind(t),actions:Mn(e,[],{kindSelection:[t],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function uo(e,t){let n=(o,d)=>`${o}|${JSON.stringify(d)}`,a=new Map;for(let o of[...e.affordances,...e.withheld]){if(o.provider!=="invariant")continue;let d=n(o.mutation,o.args);a.has(d)||a.set(d,o.rank??Number.MAX_SAFE_INTEGER)}let r=Number.MAX_SAFE_INTEGER;return[...t].map((o,d)=>({repair:o,declared:d})).sort((o,d)=>(a.get(n(o.repair.mutation,o.repair.args??{}))??r)-(a.get(n(d.repair.mutation,d.repair.args??{}))??r)||o.declared-d.declared).map(o=>o.repair)}function Je(e){let t=e.schema.kinds.map(r=>({kind:r,plural:Ge(e.schema,r),count:e.graph.nodesOfKind(r).length})),n=new Map;for(let r of e.graph.allEdges()){let o=e.graph.getNode(r.from),d=e.graph.getNode(r.to);if(!o||!d)continue;let l=`${r.kind}|${o.kind}|${d.kind}`;n.set(l,(n.get(l)??0)+1)}let a=[];for(let{kind:r}of t){let o=e.schema.tryDefinition(r)?.edges??{};for(let[d,l]of Object.entries(o)){let s=l.to==="*"||l.to===void 0?(()=>{let c=[...n.keys()].filter(m=>m.startsWith(`${d}|${r}|`)).map(m=>m.split("|")[2]);return c.length>0?c:["*"]})():l.to;for(let c of s)a.push({edgeKind:d,from:r,to:c,...l.description?{description:l.description}:{},...l.inverse?{inverse:l.inverse}:{},count:n.get(`${d}|${r}|${c}`)??0})}}return{kinds:t,relations:a}}var We=H(He(),1);var St=H(He(),1);var Le=H(G(),1),ei={problems:"Problems",search:"Search",map:"Connections",places:"Pictures","~draft":"A view drawn"},ti=e=>{try{return decodeURIComponent(e)}catch{return e}};function ni(e,t,n={}){let{store:a}=e,r=a.schema,o=(n.base??"").replace(/\/$/,""),[d="/",l=""]=t.split("#")[0].split("?"),s=(u,M,j)=>({label:u,href:`${o}${M}`,path:M,...j?{current:j}:{}}),c=u=>{let M=n.registry?.sectionOf(u);return M?[M.path===void 0?{label:M.label}:s(M.label,M.path)]:[]},m=u=>n.registry?.sectionOf(u)?.label,v=u=>{let M=m(u);return M===void 0?{}:{section:M}},[w,g,...P]=d.split("/").filter(Boolean).map(ti);if(w===void 0)return{as:"home",label:"Home",trail:[s("Home","/",!0)]};if(w==="places"&&g!==void 0&&P.length===0){let u=new URLSearchParams(l).get("of"),M=new Set(Fe(a,e.principal)),j=e.views?.places()??[],C=j.find(D=>M.has(D.kind)&&D.as===g&&(!u||V(r,D.kind)===u));if(C){let D=jt(C.as,Et(C,j)?V(r,C.kind):void 0);return{as:"place",kind:C.kind,label:C.title,...v(C.kind),trail:[...c(C.kind),s(C.title,D,!0)]}}}let N=P.length===0?we(r,w):void 0;if(N!==void 0){let u=s(Ge(r,N),`/${V(r,N)}`);if(g===void 0)return{as:"list",kind:N,label:u.label,...v(N),trail:[...c(N),{...u,current:!0}]};let M=a.graph.getNode(g),j=M&&M.kind===N?pe(r.tryDefinition(N),M):"Nothing lives here";return{as:"record",kind:N,id:g,label:j,...v(N),trail:[...c(N),u,s(j,_(r,N,g),!0)]}}let U=ei[w]??ai((P.at(-1)??g??w).replace(/[-_]+/g," "));return{as:"page",label:U,trail:[s(U,d,!0)]}}var ai=e=>e.charAt(0).toUpperCase()+e.slice(1),Gn=(0,St.createContext)(null);function ri(e){let t=ue(),n=Ze("/");return Y(e.context.store),ni(e.context,`${t.pathname}${t.search}`,{registry:e.registry,base:n})}var oi={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},go={display:"flex",alignItems:"center",gap:6,minWidth:0},mo={display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,lineHeight:"24px"};function ut({context:e,style:t}){let n=(0,St.useContext)(Gn),a=(0,St.useContext)(wt);return vt(a??si,"trail")||n?.registry?.without().has("trail")?null:(0,Le.jsx)(ii,{root:n??{context:e,registry:void 0},context:e,...t?{style:t}:{}})}function ii({root:e,context:t,style:n}){let a=ri(e);return a.trail.length<2?null:(0,Le.jsx)(li,{here:a,mark:a.as==="record"?{kind:a.kind,context:t}:void 0,...n?{style:n}:{},"data-testid":"page-trail"})}var si={count:()=>0,place:()=>()=>{},subscribe:()=>()=>{}};function li({here:e,mark:t,style:n,...a}){let r=e.as==="record"?e.trail.length-2:-1;return(0,Le.jsx)("nav",{"aria-label":"You are here","data-graview-trail":"",style:{minWidth:0,...n},...a,children:(0,Le.jsx)("ol",{style:{...he,listStyle:"none",padding:0,display:"flex",alignItems:"center",gap:6,minWidth:0,overflow:"hidden"},children:e.trail.map((o,d)=>(0,Le.jsxs)("li",{style:o.current?oi:{...go,flexShrink:d===e.trail.length-2?0:1,maxWidth:"100%"},...o.current?{"aria-current":"page"}:{},children:[d>0&&!o.current?(0,Le.jsx)("span",{"aria-hidden":"true",children:"\u203A"}):null,o.current?o.label:o.path!==void 0?(0,Le.jsxs)(O,{to:o.path,style:{...ve,...go},...d===r?{"data-testid":"trail-list"}:{},children:[d===r&&t?(0,Le.jsx)(le,{kind:t.kind,brand:t.context.brand,schema:t.context.store.schema,size:8}):null,(0,Le.jsx)("span",{style:mo,children:o.label})]}):(0,Le.jsx)("span",{style:mo,children:o.label})]},`${d}:${o.label}`))})})}var R=H(G(),1);function Te(e){let t=e.views;if(!t)return[];let n=new Set(Fe(e.store,e.principal));return t.places().filter(a=>n.has(a.kind))}function Xt(e,t){if(!t.over)return[t.kind];let n=new Set(Fe(e.store,e.principal));return t.over.filter(a=>a===t.kind||n.has(a))}var et=e=>`place:${e.kind}:${e.as}`;function ge(e,t){return jt(t.as,Et(t,e.views?.places()??[])?V(e.store.schema,t.kind):void 0)}function kt(e,t){let n=e.schema.tryDefinition(t);return e.graph.nodesOfKind(t).filter(a=>st(n,a))}function qn(e,t,n){let a=(o,d)=>Tt(e.schema,d,o),r=(typeof t=="string"?[t]:t).map(o=>a(kt(e,o).length,o)).join(" and ");return n?`${r} across ${a(kt(e,n).length,n)}`:r}function Un({context:e,place:t,chosen:n,filter:a}){let{store:r,views:o,invariantContext:d}=e,s=o?.resolve(t.kind,{cardinality:"many",fidelity:"full"},t.as)?.view,c=[...new Set(r.violations(d).flatMap(w=>w.nodeIds))],m=Xt(e,t).flatMap(w=>kt(r,w));if(!s)return null;let v=di(r,m,a,c);return(0,R.jsx)(Rn,{kind:t.kind,view:t.title,children:(0,R.jsx)(s,{nodes:v,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...c.length>0?{flagged:c}:{}})})}function di(e,t,n,a){let r=n?$t({filter:n}).filter??[]:[];return r.length===0?t:Wt(t,{filter:r},{schema:e.schema,graph:e.graph,flagged:new Set(a)}).nodes}function ci({store:e,views:t,as:n,invariantContext:a}){Y(e);let r={store:e,views:t,...a?{invariantContext:a}:{}},o=t.places().find(d=>d.as===n);return o?(0,R.jsx)(Un,{context:r,place:o}):null}function pi({context:e,kind:t}){let{store:n,views:a,invariantContext:r}=e,o=kt(n,t),d=n.schema.tryDefinition(t),l=z(n,t),c=a?.resolve(t,{cardinality:"many",fidelity:"full"})?.view,m=[...new Set(n.violations(r).flatMap(P=>P.nodeIds))];if(c&&!lt(c))return(0,R.jsx)(Rn,{kind:t,children:(0,R.jsx)(c,{nodes:o,label:l,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...m.length>0?{flagged:m}:{}})});let v=a?.resolve(t,{cardinality:"one",fidelity:"summary"})?.view,w=8,g=o.slice(0,w);return(0,R.jsxs)("div",{"data-testid":"kind-sheet",style:v?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gridAutoRows:"max-content",alignContent:"center",gap:12,padding:24}:{display:"flex",flexWrap:"wrap",alignContent:"center",justifyContent:"center",gap:10,padding:24},children:[g.map(P=>v?(0,R.jsx)(v,{node:P,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...m.includes(P.id)?{flagged:[P.id]}:{}},P.id):(0,R.jsx)("span",{style:{padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:pe(d,P)},P.id)),o.length>w?(0,R.jsxs)("span",{style:{...A,alignSelf:"center",padding:"0 6px"},children:["+",o.length-w," more ",l.toLowerCase()]}):null]})}function Vn(e){let{store:t}=e,n=ao(e),a=Te(e),r=e.views?.arrangement?.()?.order??[],o=s=>{let c=s.name===void 0?-1:r.indexOf(`view:${s.name}`);return c>=0?c-r.length:n.indexOf(s.kind)},d=xn([...a].sort((s,c)=>o(s)-o(c))).filter(s=>!s.hidden),l=new Set(d.flatMap(s=>s.over??[s.kind]));return[...d.map(s=>({key:et(s),kind:s.kind,title:Ma(s,a,t.schema),to:ge(e,s),place:s})),...zt(e).filter(s=>!l.has(s)).map(s=>({key:`kind:${s}`,kind:s,title:z(t,s),to:`/${V(t.schema,s)}`}))]}var fo=.72,ui=540,yo=16/10;function gi(e){let t=(0,We.useRef)(null),[n,a]=(0,We.useState)(e);return(0,We.useLayoutEffect)(()=>{let r=t.current;if(!r||typeof ResizeObserver>"u")return;let o=()=>{let l=r.getBoundingClientRect().width;l>0&&a(s=>Math.abs(s-l)<.5?s:l)};o();let d=new ResizeObserver(o);return d.observe(r),()=>d.disconnect()},[]),{ref:t,width:n}}function mi(e){for(let t=e.parentElement;t;t=t.parentElement)if(/(auto|scroll)/.test(getComputedStyle(t).overflowY))return t;return null}function fi(e){let[t,n]=(0,We.useState)(()=>typeof IntersectionObserver>"u");return(0,We.useLayoutEffect)(()=>{let a=e.current;if(t||!a)return;let r=new IntersectionObserver(o=>{o.some(d=>d.isIntersecting)&&(r.disconnect(),n(!0))},{root:mi(a),rootMargin:"50% 0px"});return r.observe(a),()=>r.disconnect()},[t,e]),t}function jn({context:e,entry:t}){let{store:n,brand:a,principal:r}=e,{ref:o,width:d}=gi(ui),l=fi(o),s=d/fo,c=kt(n,t.kind),m=n.schema.tryDefinition(t.kind),v=c.length===0?Xe(n,t.kind,{...r?{principal:r}:{},...e.invariantContext?{context:e.invariantContext}:{}}).actions.affordances[0]:void 0,w=t.place!==void 0;return(0,R.jsxs)(O,{to:t.to,"data-testid":w?"place-card":"kind-card",className:"graview-gallery-card",style:{...ve,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,R.jsxs)("span",{ref:o,"data-testid":w?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${yo}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,R.jsx)("span",{style:{position:"absolute",left:0,top:0,width:s,height:s/yo,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${fo})`,transformOrigin:"0 0"},children:l?(0,R.jsx)(Gt.Provider,{value:null,children:t.place?(0,R.jsx)(Un,{context:e,place:t.place}):(0,R.jsx)(pi,{context:e,kind:t.kind})}):null}),c.length===0?(0,R.jsx)("span",{"data-testid":"picture-empty",style:{position:"absolute",inset:0,display:"grid",placeContent:"center",justifyItems:"center",gap:2,padding:20,textAlign:"center"},children:(0,R.jsxs)("span",{style:{display:"grid",gap:2,padding:"10px 16px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:[(0,R.jsxs)("span",{style:{fontFamily:In,fontWeight:"var(--graview-weight-display)"},children:["No ",z(n,t.kind).toLowerCase()," yet"]}),v?(0,R.jsxs)("span",{style:A,children:["Begin with \u201C",v.label,"\u201D"]}):null]})}):null]}),(0,R.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,R.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[w?null:(0,R.jsx)(le,{kind:t.kind,brand:a,schema:n.schema,size:8}),(0,R.jsx)("span",{style:{fontFamily:In,fontSize:"var(--graview-text-heading)",fontWeight:"var(--graview-weight-display)",lineHeight:1.3,overflowWrap:"anywhere",textWrap:"balance"},children:t.title})]}),(0,R.jsxs)("span",{style:A,children:[t.place?qn(n,Xt(e,t.place),t.place.across):qn(n,t.kind),!w&&m?.description?` \xB7 ${m.description}`:null]})]})]})}var ho={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},yi=`
|
|
2
|
+
.graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
|
|
3
|
+
.graview-gallery-card:hover > span:first-child,
|
|
4
|
+
.graview-gallery-card:focus-visible > span:first-child { border-color: var(--graview-edge-bright); box-shadow: 0 1px 0 var(--graview-edge), 0 10px 30px -18px var(--graview-ink); }
|
|
5
|
+
`;function _n({context:e}){Y(e.store);let t=Vn(e);return t.length===0?null:(0,R.jsxs)("section",{style:ho,"data-testid":"gallery",children:[(0,R.jsx)("style",{children:yi}),t.map(n=>(0,R.jsx)(jn,{context:e,entry:n},n.key))]})}function zn({context:e}){let{store:t}=e;Y(t);let n=xn(Te(e)).filter(r=>!r.hidden),a=Vn(e);return(0,R.jsxs)(ee,{context:e,style:ct,children:[(0,R.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,R.jsx)("p",{style:he,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,R.jsx)(re,{context:e,children:"Pictures"}),(0,R.jsx)("p",{style:ae,children:n.length===0?"Nothing here has a picture of its own yet, so each kind is drawn as the scene draws it. Title a group view and it appears here by name.":"The ways this installation looks at what it holds \u2014 each one the same picture the scene shows, here as a page."})]}),a.length>0?(0,R.jsx)("div",{style:ho,"data-testid":"places",children:a.map(r=>(0,R.jsx)(jn,{context:e,entry:r},r.key))}):null]})}var hi={lede:!0},wi={lede:!1},vi={...ae,textWrap:"pretty"};function Si(e,t){if(t===void 0)return;let[n]=lr(sr([t]),dr(e.store,null,null,e.brand?{money:e.brand}:{}));return n?.t==="headline"&&!n.problem&&n.text.trim()!==""?n.text:void 0}function Yn({context:e}){let{store:t,principal:n}=e;Y(t);let a=Ue(),r=De(),[o]=pt(),d=decodeURIComponent(a.as??""),[l,s]=(0,We.useState)(null),c=o.get("of"),m=o.get("filter"),w=Te(e).find(C=>C.as===d&&(!c||V(t.schema,C.kind)===c));if(!w)return(0,R.jsxs)(ee,{context:e,children:[(0,R.jsx)(re,{context:e,children:"No picture is called that."}),(0,R.jsx)("p",{style:ae,children:(0,R.jsx)(O,{to:"/places",style:qe,children:(0,R.jsx)(Qe,{children:"The pictures there are"})})})]});let g=z(t,w.kind),P=e.views?.resolve(w.kind,{cardinality:"many",fidelity:"full"},w.as)?.view,N=P?.flows===!0,U=P?.creates!==!1,u=Si(e,P?.lede),M=Xe(t,w.kind,{...n?{principal:n}:{},...e.invariantContext?{context:e.invariantContext}:{}}),j=U?M.actions.affordances.map(C=>({affordance:C,mutation:t.allMutations().find(D=>D.name===C.mutation)})).filter(C=>C.mutation!==void 0):[];return(0,R.jsxs)(ee,{context:e,style:{...ct,gap:"var(--graview-space-6, 32px)"},children:[(0,R.jsxs)("header",{style:{display:"grid",gap:"var(--graview-space-2, 8px)"},children:[(0,R.jsx)(ut,{context:e}),(0,R.jsx)(re,{context:e,children:w.title}),(0,R.jsx)("p",{style:vi,"data-testid":"place-lede",...u!==void 0?{"data-graview-lede":"headline"}:{},children:u??`${qn(t,Xt(e,w),w.across)}.`}),m&&!N?(0,R.jsxs)("p",{style:{...A,margin:0},"data-testid":"place-narrowed",children:[`Only those where ${m.split(",").map(C=>C.replace(":"," is ")).join(" and ")}. `,(0,R.jsx)(O,{to:`?${(()=>{let C=new URLSearchParams(o);return C.delete("filter"),C.toString()})()}`,style:{...q,...A},children:"Show all"})]}):null,(0,R.jsx)("p",{style:{...A,margin:0,display:"flex",flexWrap:"wrap",gap:"4px 16px"},children:Xt(e,w).map((C,D)=>(0,R.jsx)(O,{to:`/${V(t.schema,C)}`,style:{...qe,...A},...D===0?{"data-testid":"place-as-list"}:{},children:(0,R.jsxs)(Qe,{children:["All ",(C===w.kind?g:z(t,C)).toLowerCase()," as a list"]})},C))})]}),(0,R.jsx)("div",{"data-testid":"place-lens","data-flows":N?"":void 0,...N?{}:{role:"group","aria-label":w.title,tabIndex:0},style:N?{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",maxWidth:"100%"}:{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",maxWidth:"100%",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},onClick:C=>{let D=C.target?.closest("[data-graview-pick]"),ne=D?.getAttribute("data-graview-pick"),oe=D?.getAttribute("data-graview-joins");if(oe)try{let X=JSON.parse(oe);if(Array.isArray(X)&&X.every(ce=>typeof ce=="string")){C.preventDefault(),s({at:et(w),ids:X});return}}catch{}if(!ne)return;let fe=t.graph.getNode(ne);fe&&(C.preventDefault(),r(_(t.schema,fe.kind,ne)))},children:(0,R.jsx)(Br.Provider,{value:u!==void 0?hi:wi,children:(0,R.jsx)(Un,{context:e,place:w,filter:m,...l?.at===et(w)?{chosen:l.ids}:{}})})}),j.length>0?(0,R.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},"data-testid":"place-creators",children:j.map(({affordance:C,mutation:D})=>(0,R.jsxs)("section",{style:{...J,display:"grid",gap:14},children:[(0,R.jsx)("h2",{style:Z,children:D.title??D.name}),D.description?(0,R.jsx)("p",{style:{...A,margin:0,maxWidth:"58ch"},children:D.description}):null,(0,R.jsx)(Ie,{store:t,mutation:D,prefilled:C.args,open:C.open,label:C.label,...n?{principal:n}:{}})]},C.id))}):null]})}function ki(e,t=document){let n=Ut(e);if(!n)return null;let a=[t,...[...t.querySelectorAll("[data-worker-view]")].flatMap(r=>r.shadowRoot?[r.shadowRoot]:[])];for(let r of a)for(let o of r.querySelectorAll("[id], [data-section]")){let d=o.getAttribute("data-section")??o.id;if(d===e||Ut(d)===n)return o}for(let r of a)for(let o of r.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=heading]"))if(Ut(o.textContent??"")===n)return o;return null}function wo(e,t={}){if(typeof document>"u"||typeof requestAnimationFrame>"u")return()=>{};let n=t.frames??120,a=0,r=()=>{let o=ki(e,t.root??document);if(o){o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.scrollIntoView?.({block:"start"}),o.focus({preventScroll:!0});return}n-=1,n>0&&(a=requestAnimationFrame(r))};return a=requestAnimationFrame(()=>{a=requestAnimationFrame(r)}),()=>cancelAnimationFrame(a)}var K=H(He(),1);var Jt=H(He(),1);var tt=H(G(),1);function vo({context:e}){return se()?(0,tt.jsxs)(tt.Fragment,{children:[(0,tt.jsx)(bi,{context:e}),(0,tt.jsx)(Vr,{face:"pages",on:e.quickAsk??!0})]}):null}function bi({context:e}){let{store:t}=e,n=se(),{pathname:a}=ue(),r=(0,Jt.useRef)(n?.setSelection);return r.current=n?.setSelection,(0,Jt.useEffect)(()=>{let o=r.current;if(!o)return;let[,d,l]=a.split("/"),s=(()=>{if(d==="places"){let m=e.views?.places().find(v=>v.as===decodeURIComponent(l??""));return m?[Ne(m.kind)]:[]}let c=d?we(t.schema,d):void 0;return c&&l?[decodeURIComponent(l)]:c?[Na(c)]:[]})();o(c=>c.length===s.length&&c.every((m,v)=>m===s[v])?c:s)},[a]),null}var ke=H(He(),1);var ko=H(Xo(),1);var de=H(G(),1);var xi=Nt(Oa(()=>(__graviewPreload(import.meta.url,["./chunk.IPAZOKMQ.js","./chunk.V7XHNRQM.js","./chunk.UGFDSE37.js","./chunk.IYIN6VSN.js","./chunk.GCKZ2YRJ.js","./chunk.VC3UGFHY.js","./chunk.YHH4TWZ2.js","./chunk.O2WWYZI7.js","./chunk.AGIO2GRV.js","./chunk.VSNHCGKC.js","./chunk.EUPSAYEI.js","./chunk.TCXKPILZ.js","./chunk.R6V37SR7.js","./chunk.SWWAEOZ7.js","./chunk.IROYMLER.js","./chunk.FWSCBHZ5.js","./chunk.7NNI7YH4.js","./chunk.7N2GXZYI.js","./chunk.MF73YBJL.js","./chunk.63MS2LOP.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.ZIEHF67C.js","./chunk.UHX4WTM7.js","./chunk.IKX4VDTW.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.GZHZLJBF.js","./chunk.5AGW4NRZ.js","./chunk.OJGHDWI6.js","./chunk.DQS7D2W2.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.WJS6P7GI.js")).then(e=>({default:e.TakeBack}))));function Pi({context:e,docked:t,at:n,...a}){let{store:r}=e,o=Y(r),[d]=(0,ke.useState)(()=>r.batches().length),l=(0,ke.useRef)(!1);return l.current||=o>0||!t&&d>0,l.current?(0,de.jsx)(ke.Suspense,{fallback:null,children:(0,de.jsx)(xi,{context:e,docked:t,at:n,since:d,...a})}):null}function Ci(e,t,n){let{store:a,principal:r,embedded:o}=e;(0,ke.useEffect)(()=>{if(!n)return;let d=l=>{if(!Xr(l))return;let s=l.target,c=s instanceof Node&&t.current?.contains(s),m=s===document.body||s===document.documentElement||s===document;if(!(!c&&!(m&&!o))&&Qr(a,r)){l.preventDefault();try{Zr(a,r)}catch{}}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[a,r,o,t,n])}function bo({context:e,registry:t,root:n,children:a}){let r=(0,ke.useMemo)(lo,[]),o=t?.without()??new Set;return Ci(e,n,!o.has("undo")),(0,de.jsxs)(wt.Provider,{value:r,children:[(0,de.jsx)(Ai,{context:e,placed:r,without:o}),a]})}function Ai({context:e,placed:t,without:n}){let[a,r]=(0,ke.useState)(!1);(0,ke.useLayoutEffect)(()=>r(!0),[]);let o=vt(t,"find"),d=vt(t,"undo"),l=ue(),s=kr();if(!a)return null;let c=l.pathname.split("/").filter(Boolean),v=(c.length===1?we(e.store.schema,c[0]):void 0)!==void 0;return(0,de.jsxs)(de.Fragment,{children:[!o&&!n.has("find")&&s?(0,ko.createPortal)((0,de.jsx)(So,{context:e,narrowsLists:v}),s.slot):null,!o&&!n.has("find")&&!s?(0,de.jsx)("div",{"data-testid":"face-find-bar",style:{display:"flex",alignItems:"center",padding:"8px 16px",borderBottom:"1px solid var(--graview-edge)",background:"var(--graview-bar)",minWidth:0},children:(0,de.jsx)(So,{context:e,narrowsLists:v})}):null,!d&&!n.has("undo")?(0,de.jsx)(Pi,{context:e,docked:!0,at:l.pathname+l.search}):null,s?.own&&!n.has("undo")?(0,de.jsx)(ro,{context:e,own:s.own}):null]})}function So({context:e,narrowsLists:t}){return(0,de.jsx)(wt.Provider,{value:null,children:(0,de.jsx)(Bn,{context:e,narrowsLists:t})})}var Q=H(He(),1);var be=H(G(),1),Ri=500,Li=10;function en(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function Ti(e){let t=typeof getSelection=="function"?getSelection():null;return t!==null&&!t.isCollapsed&&t.containsNode(e,!0)}function xo(e){let t=e.closest('a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])');if(t)return t;let n=document.activeElement;return n instanceof HTMLElement&&n!==document.body?n:null}function Po({context:e,root:t,children:n}){return se()===null?(0,be.jsx)(be.Fragment,{children:n}):(0,be.jsx)(Mi,{context:e,root:t,children:n})}function Mi({context:e,root:t,children:n}){let{setMenuAt:a}=Ka(),{store:r}=e,o=r.schema,d=De(),{pathname:l,search:s}=ue(),c=Ze("/").replace(/\/$/,""),m=(0,Q.useCallback)((S,f)=>e.views?.places().find(L=>L.as===S&&(f===null||L.kind===f)),[e.views]),v=(0,Q.useCallback)((S,f)=>{let[L="",E,te]=S.split("/").filter(Boolean).map(x=>{try{return decodeURIComponent(x)}catch{return x}});if(te!==void 0)return null;if(L==="places"&&E!==void 0){let x=m(E,new URLSearchParams(f).get("of"));return x?{face:"pages",place:x.as,about:[Ne(x.kind)],title:x.title}:null}let p=we(o,L);return p?E===void 0?{face:"pages",about:[Ne(p)],title:Ge(o,p)}:r.graph.getNode(E)?{face:"pages",on:E,about:[E]}:null:null},[o,r,m]),w=(0,Q.useCallback)(S=>{let f=S.href;try{let L=new URL(f,location.href);if(L.origin===location.origin&&(c===""||L.pathname===c||L.pathname.startsWith(`${c}/`))){let E=v(L.pathname.slice(c.length),L.search);if(E)return{...E,href:f}}}catch{}return{face:"pages",about:[],href:f}},[c,v]),g=(0,Q.useCallback)(()=>v(l,s)??{face:"pages",about:[]},[v,l,s]),P=(0,Q.useCallback)(S=>{let f=g(),L=S.closest("[data-graview-field]")?.getAttribute("data-graview-field");if(L&&f.on!==void 0&&S.closest("[data-graview-pick], a[href]")===null)return{...f,field:L};let E=S.closest("[data-graview-act]")?.getAttribute("data-graview-act");if(E)return{...f,act:E};let te=S.closest("a[href]"),p=S.closest("[data-graview-listed]"),x=[S.closest("[data-graview-pick]")?.getAttribute("data-graview-pick"),p&&(!te||p.contains(te)&&te.classList.contains("graview-spec-item-link"))?p.getAttribute("data-graview-listed"):null].map(ye=>ye?r.graph.getNode(ye):void 0).find(Boolean);if(x)return{face:"pages",on:x.id,about:[x.id],href:`${c}${_(o,x.kind,x.id)}`};if(te)return w(te);let B=S.closest("[data-graview-record]")?.getAttribute("data-graview-record");return B&&r.graph.getNode(B)?{face:"pages",on:B,about:[B]}:f},[g,w,r,o,c]),N=(0,Q.useCallback)(S=>{let f=t.current;if(f===null||!f.contains(S)||en(S)||S.closest("[data-graview-popover]"))return null;let L=P(S);return{face:"pages",on:L.on,about:L.about??[],field:L.field,place:L.place,href:L.href,act:L.act,element:xo(S)}},[P,t]),U=(0,Q.useCallback)((S,f,L)=>{let E=P(S);a({...E,x:Math.round(f),y:Math.round(L),returnTo:xo(S)})},[P,a]),u=(0,Q.useCallback)(S=>{let f=S.getBoundingClientRect();U(S,f.left+Math.min(16,f.width/2),Math.min(f.bottom,f.top+36))},[U]),M=(0,Q.useRef)(0),j=(0,Q.useRef)(null),C=(0,Q.useRef)(!1),D=()=>{j.current&&clearTimeout(j.current.timer),j.current=null};(0,Q.useEffect)(()=>D,[]),(0,Q.useEffect)(()=>{let S=f=>{if(f.defaultPrevented||!(f.key==="ContextMenu"||f.key==="F10"&&f.shiftKey))return;let L=t.current,E=f.target instanceof Element?f.target:null,te=E===null||E===document.body||E===document.documentElement,p=L!==null&&E!==null&&L.contains(E);if(!p&&!(te&&document.querySelector("[data-graview-face='pages']")===L)||en(E)||E?.closest("[data-graview-popover]"))return;f.preventDefault(),M.current=Date.now();let x=p&&E instanceof HTMLElement?E:L?.querySelector("[data-graview-page-title], main h1, main")??null;x&&u(x)};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[t,u]),(0,Q.useEffect)(()=>{let S=t.current;if(!S)return;let f=L=>{let E=L.detail;E&&a({...E,face:"pages"})};return S.addEventListener(Cn,f),()=>S.removeEventListener(Cn,f)},[t,a]);let ne=(0,Q.useMemo)(()=>S=>{if(S.face!=="pages")return null;let f=[],L=S.on===void 0?void 0:r.graph.getNode(S.on),E=S.place===void 0?void 0:e.views?.places().find(Ee=>Ee.as===S.place),te=L?void 0:S.about.length===1&&S.about[0].startsWith("aggregate:")&&!E?Ei(S.about[0]):void 0,p=L?_(o,L.kind,L.id):E?ge(e,E):te?`/${V(o,te)}`:void 0,x=p!==void 0&&l===p.split("?")[0];p!==void 0&&!x&&f.push({id:"open",label:"Open",run:()=>d(p)});let B=p!==void 0?`${c}${p}`:S.href;B!==void 0&&f.push({id:"open-in-a-new-tab",label:"Open in a new tab",run:()=>void window.open(B,"_blank","noopener")});let ye=L?`#focus=${encodeURIComponent(L.id)}`:E?`#focus=${encodeURIComponent(Ne(E.kind))}&view=${encodeURIComponent(E.as)}`:te?`#focus=${encodeURIComponent(Ne(te))}`:void 0;if(ye!==void 0&&(e.overview||!e.embedded)){let Ee=e.overview;f.push({id:"in-the-scene",label:"Show in the scene",run:()=>Ee?Ee(ye):location.assign(`${e.sceneHref??"/"}${ye}`)})}return L===void 0&&S.href===void 0&&f.push({id:"find",label:"Find\u2026",run:()=>{let Ee=t.current?.querySelector('[data-testid="nav-find"]')??document.querySelector('[data-testid="nav-find"]');Ee&&Ee.offsetParent!==null?Ee.focus():d("/search")}}),f.length>0?{id:"pages",items:f}:null},[r,o,e,l,c,d,t]),oe=(0,Q.useMemo)(()=>S=>{if(S.face!=="pages"||S.field===void 0||S.on===void 0)return null;let f=r.graph.getNode(S.on),L=S.element?.closest("[data-graview-field]")??t.current?.querySelector(`[data-graview-field="${CSS.escape(S.field)}"]`);return!f||!(L instanceof HTMLElement)||!L.hasAttribute("data-graview-editable")?null:{id:"field",at:"start",items:[{id:"change-field",label:`Change \u201C${va(o.tryDefinition(f.kind),S.field)}\u201D`,run:()=>L.click()}]}},[r,o,t]),fe=_r(),X=mr(),ce=Or(),Ke=(0,Q.useCallback)((S,f)=>{l===ge(e,S).split("?")[0]&&d(f?ge(e,f):"/")},[l,e,d]),xe=Yr(Ke),Pe=(0,Q.useMemo)(()=>[oe,ce,ne,...xe?[xe]:[],...X?[X]:[],...fe?[fe]:[]],[oe,ce,ne,xe,X,fe]);return(0,be.jsxs)(cr,{sections:Pe,children:[(0,be.jsx)("div",{"data-graview-menu-ground":"",style:{display:"contents"},onContextMenu:S=>{let f=S.target;S.shiftKey||en(f)||Ti(f)||(S.preventDefault(),!f.closest("[data-graview-popover]")&&(Date.now()-M.current<700||(S.clientX===0&&S.clientY===0&&f instanceof HTMLElement?u(f):U(f,S.clientX,S.clientY))))},onPointerDown:S=>{if(C.current=!1,S.pointerType==="mouse"||!S.isPrimary)return;let f=S.target;if(en(f)||f.closest("[data-graview-choose], [data-graview-popover]"))return;D();let{clientX:L,clientY:E}=S;j.current={x:L,y:E,timer:setTimeout(()=>{j.current=null,C.current=!0,M.current=Date.now(),U(f,L,E)},Ri)}},onPointerMove:S=>{let f=j.current;f&&Math.hypot(S.clientX-f.x,S.clientY-f.y)>Li&&D()},onPointerUp:D,onPointerCancel:D,onClickCapture:S=>{C.current&&(C.current=!1,S.preventDefault(),S.stopPropagation())},children:n}),(0,be.jsx)($i,{openAt:u,readyAt:N}),(0,be.jsx)(zr,{placement:"page"}),(0,be.jsx)(fr,{})]})}function Ei(e){let t=e.slice(10).split("+");return t.length===1&&t[0]?t[0]:void 0}function $i({openAt:e,readyAt:t}){return(0,be.jsx)("span",{"data-graview-menu-home":"",tabIndex:-1,onFocus:n=>{if(n.target!==n.currentTarget)return;let a=n.currentTarget.closest("[data-graview-face]"),r=a?.querySelector("[data-graview-page-title]")??a?.querySelector("main h1, main")??null;r&&(r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0}))},style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:(0,be.jsx)(Ur,{placement:"menu",openActs:e,aimAt:t})})}var F=H(G(),1);function Co(e,t){return t==="*"?{label:"anything",path:null}:{label:z(e,t),path:`/${V(e.schema,t)}`}}function Oi({context:e,relation:t}){let{store:n}=e,a=Co(n,t.from),r=Co(n,t.to),o=d=>d.path?(0,F.jsx)(O,{to:d.path,style:{...ve,fontWeight:550},children:d.label}):(0,F.jsx)("span",{children:d.label});return(0,F.jsxs)("li",{"data-testid":"relation","data-relation":t.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,F.jsx)(jr,{edgeKind:t.edgeKind,...e.brand?.kit?{kit:e.brand.kit}:{}}),(0,F.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,F.jsxs)("span",{children:[o(a)," ",(0,F.jsxs)("span",{style:A,"data-graview-speaks-ids":"",children:[ze(t.edgeKind)," \u2192"]})," ",o(r)]}),t.description||t.inverse?(0,F.jsxs)("span",{style:A,children:[t.description?Ae(t.description):null,t.description&&t.inverse?" \xB7 ":null,t.inverse?`from the other end, ${t.inverse}`:null]}):null]}),r.path?(0,F.jsx)(O,{to:`${r.path}?with=${encodeURIComponent(t.edgeKind)}`,style:{...q,...A,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${r.label.toLowerCase()} that have this`,children:t.count}):(0,F.jsx)("span",{style:{...A,fontVariantNumeric:"tabular-nums"},children:t.count})]})}function Ao({context:e,heading:t=!0}){let{store:n}=e,a=new Set(Fe(n,e.principal)),r=Je(n).relations.filter(o=>a.has(o.from)&&(o.to==="*"||a.has(o.to)));return r.length===0?null:(0,F.jsxs)("section",{style:{...J,display:"grid",gap:12},"data-testid":"kind-map",children:[t?(0,F.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,F.jsx)("h2",{style:Z,children:(0,F.jsx)(O,{to:"/map",style:ve,children:"Connections"})}),(0,F.jsx)("span",{style:A,children:r.length===1?"1 relation":`${r.length} relations`})]}):null,(0,F.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:r.map(o=>(0,F.jsx)(Oi,{context:e,relation:o},`${o.edgeKind}|${o.from}|${o.to}`))})]})}function Qn({context:e}){let{store:t}=e;Y(t);let n=new Set(Fe(t,e.principal)),a=Je(t),r=a.relations.filter(o=>n.has(o.from));return(0,F.jsxs)(ee,{context:e,children:[(0,F.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,F.jsx)("p",{style:he,children:r.length===0?"No relations":`${r.length} ${r.length===1?"relation":"relations"}`}),(0,F.jsx)(re,{context:e,children:"Connections"}),(0,F.jsx)("p",{style:ae,children:r.length===0?"Nothing here is declared to relate to anything else yet.":"The kinds this installation holds, and the relations declared between them \u2014 each in the declaration's own words, with how many of it there are."})]}),(0,F.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:a.kinds.filter(o=>n.has(o.kind)).map(o=>(0,F.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,F.jsx)(le,{kind:o.kind,brand:e.brand,schema:t.schema,size:7}),(0,F.jsx)(O,{to:`/${V(t.schema,o.kind)}`,style:q,children:o.plural}),(0,F.jsx)("span",{style:A,children:o.count})]},o.kind))}),(0,F.jsx)(Ao,{context:e,heading:!1})]})}function Ro({context:e}){let n=[...se()?.robots.values()??[]].filter(r=>r.mode==="asking"&&r.say);if(n.length===0)return null;let{store:a}=e;return(0,F.jsxs)("section",{style:{...J,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,F.jsx)("h2",{style:Z,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,F.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(r=>{let o=r.at?a.graph.getNode(r.at):void 0;return(0,F.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,F.jsx)("span",{children:r.say}),o?(0,F.jsxs)(O,{to:_(a.schema,o.kind,o.id),style:{...q,...A},children:[pe(a.schema.tryDefinition(o.kind),o)," \u2192"]}):null]},r.participant)})})]})}var W=H(G(),1);function Zn({context:e}){let{principal:t}=e,{store:n,brand:a,invariantContext:r}=e;Y(n);let o=n.violations(r),d=`${o.length===1?"A rule is broken":"Rules are broken"} \u2014 see what, and what would fix it`,l=[...n.log.all()].slice(-5).reverse(),c=zt(e).map(u=>({kind:u,members:n.graph.nodesOfKind(u).filter(M=>st(n.schema.tryDefinition(u),M))})),m=c.filter(u=>u.members.length>0),v=c.map(u=>({entry:u,creator:n.allMutations().find(M=>(M.creates??[]).includes(u.kind)&&n.permits({name:M.name,args:{}},e.principal).ok)})).find(u=>u.creator!==void 0),w=m.length===0?"Nothing here yet.":`${m.map(u=>Tt(n.schema,u.kind,u.members.length)).join(", ").replace(/, ([^,]*)$/," and $1")}.`,g=e.views?.homeView?.(),P=n.schema.kinds.some(u=>n.graph.nodesOfKind(u).length>0);if(g&&P){let u=a?.subtitle&&a.subtitleDrawn!==!1?(0,W.jsx)("p",{style:{...A,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,M=g[Symbol.for("graview.home-blocks")]===!0;return(0,W.jsx)(ee,{context:e,style:ct,children:(0,W.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[M?null:u,o.length>0?(0,W.jsx)(O,{to:"/problems",style:{...q,color:"var(--graview-warn)"},children:d}):null,(0,W.jsx)(Kr.Provider,{value:M?u:null,children:(0,W.jsx)(Zt,{when:Ot(g),children:(0,W.jsx)(g,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})})]})})}let N=new Set(Fe(n,e.principal)),U=Je(n).relations.filter(u=>N.has(u.from)&&(u.to==="*"||N.has(u.to)));return(0,W.jsxs)(ee,{context:e,style:ct,children:[(0,W.jsxs)("header",{style:{display:"grid",gap:12},children:[a?.subtitle&&a.subtitleDrawn!==!1?(0,W.jsx)("p",{style:{...A,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,(0,W.jsx)(re,{context:e,"data-testid":"standing",children:w}),(0,W.jsxs)("p",{style:{...ae,display:"grid",gap:4},"data-testid":"standing-card",children:[m.length===0&&v?(0,W.jsxs)("span",{children:["Begin with \u201C",v.creator?.title??v.creator?.name,"\u201D, under"," ",(0,W.jsx)(O,{to:`/${V(n.schema,v.entry.kind)}`,style:q,children:z(n,v.entry.kind)}),"."]}):null,o.length===0?(0,W.jsx)("span",{children:"All rules hold."}):(0,W.jsx)(O,{to:"/problems",style:{...q,color:"var(--graview-warn)"},children:d})]})]}),(0,W.jsx)(_n,{context:e}),(0,W.jsxs)("section",{style:{...J,display:"grid",gap:14},"data-testid":"kinds",children:[(0,W.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,W.jsx)("h2",{style:Z,children:"What is here"}),U.length>0?(0,W.jsx)(O,{to:"/map",style:{...qe,...A,marginLeft:"auto"},"data-testid":"map-link",children:(0,W.jsxs)(Qe,{children:["Connections \xB7 ",U.length===1?"1 relation":`${U.length} relations`]})}):null]}),(0,W.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:c.map(({kind:u,members:M})=>(0,W.jsx)("li",{style:{maxWidth:"100%"},children:(0,W.jsxs)(O,{to:`/${V(n.schema,u)}`,style:{...ve,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,W.jsx)(le,{kind:u,brand:a,schema:n.schema,size:7}),(0,W.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:z(n,u)}),(0,W.jsx)("span",{style:{...A,fontVariantNumeric:"tabular-nums"},children:M.length===0?"none yet":ft(M.length)})]})},u))})]}),l.length>0?(0,W.jsxs)("section",{style:{...J,display:"grid",gap:10},children:[(0,W.jsx)("h2",{style:Z,children:"Recently"}),(0,W.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:l.map(u=>(0,W.jsxs)("li",{style:A,children:[(0,W.jsx)("span",{style:{color:"var(--graview-ink)"},children:u.intent})," \u2014 ",ht(u,t,{graph:n.graph,schema:n.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},u.id))})]}):null]})}var Me=H(He(),1);var nt=H(G(),1);function tn({context:e,withheld:t,style:n,testId:a}){let r=se(),o=La(t,e.signIn??r?.signIn);return o?(0,nt.jsx)("p",{style:{...n,margin:0},children:(0,nt.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>o.run(),style:Se,children:o.label})}):t.length===0?null:(0,nt.jsx)("ul",{style:{...n,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},...a?{"data-testid":a}:{},children:t.map(d=>(0,nt.jsxs)("li",{style:A,children:[(0,nt.jsx)("s",{children:d.label})," \u2014 ",d.refusal.message]},d.id))})}var T=H(G(),1);function Xn({context:e}){let{store:t,brand:n,principal:a,invariantContext:r}=e;Y(t);let[o]=pt(),d=o.get("q")??"",l=typeof r?.today=="string"?r.today:void 0,s=Lr(t,d,{...a?{principal:a}:{},places:Te(e),flagged:new Set(t.violations(r).flatMap(g=>g.nodeIds)),...l?{today:l}:{},limit:200}),c=s.hits.filter(g=>g.about==="node"),m=s.hits.filter(g=>g.about==="kind"||g.about==="place"||g.about==="rule"),v=[...new Set(c.map(g=>g.kind))],w=d.trim();return(0,T.jsxs)(ee,{context:e,children:[(0,T.jsx)("style",{children:_t}),(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)("p",{style:he,children:"Search"}),(0,T.jsx)(re,{context:e,"data-testid":"search-heading",children:w.length===0?"Find anything by its name":s.hits.length===0?(0,T.jsxs)(T.Fragment,{children:["Nothing here is called \u201C",w,"\u201D."]}):(0,T.jsxs)(T.Fragment,{children:[Ni(t,s.byKind)," for \u201C",w,"\u201D"]})}),w.length>0?(0,T.jsxs)("p",{style:{...A,margin:0},"data-testid":"search-searched",children:[Dt(t.schema,s.searched),s.conditions.filter(g=>g.key!=="is"&&g.admittedBy.length<s.searched.kinds.length).map(g=>(0,T.jsxs)("span",{children:[" ",g.key,":",g.value," narrows"," ",g.admittedBy.length===0?"nothing here":g.admittedBy.map(P=>z(t,P).toLowerCase()).join(" and "),"."]},`${g.key}:${g.value}`))]}):(0,T.jsxs)("p",{style:ae,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,T.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,T.jsx)("code",{children:"is:any"})," includes what is past."]})]}),m.length>0?(0,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:m.map(g=>(0,T.jsx)("li",{"data-testid":"search-hit","data-about":g.about,children:g.about==="kind"?(0,T.jsxs)(O,{to:`/${V(t.schema,g.kind)}`,style:q,children:[g.label,g.count>0?(0,T.jsxs)("span",{style:A,children:[" \xB7 ",g.count," match"]}):null]}):g.about==="place"?(0,T.jsxs)(O,{to:ge(e,g),style:q,children:["Go to ",g.title]}):g.about==="rule"?(0,T.jsxs)(O,{to:"/problems",style:q,children:["The rule \u201C",g.label,"\u201D"]}):null},`${g.about}:${g.about==="rule"?g.name:g.about==="place"?g.as:g.kind}`))}):null,v.map(g=>(0,T.jsxs)("section",{className:"graview-list",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",minWidth:0},"data-testid":"search-group","data-kind":g,children:[(0,T.jsxs)("h2",{className:"graview-group-head",style:{alignItems:"center"},children:[(0,T.jsx)(le,{kind:g,brand:n,schema:t.schema,size:8}),(0,T.jsx)(O,{to:`/${V(t.schema,g)}?${new URLSearchParams({q:w}).toString()}`,style:q,"data-testid":"search-kind-link",children:z(t,g)}),(0,T.jsx)("span",{children:s.byKind[g]})]}),(0,T.jsx)("ul",{className:"graview-rows",children:c.filter(P=>P.kind===g).map(P=>(0,T.jsxs)("li",{"data-testid":"search-hit","data-about":"node",className:"graview-row",children:[(0,T.jsxs)(O,{to:_(t.schema,g,P.id),className:"graview-row-title",...P.label.length>60?{title:P.label}:{},children:[P.flagged?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,P.label]}),P.apart||!P.current?(0,T.jsx)("span",{className:"graview-row-glance",children:[P.apart,P.current?"":"past"].filter(Boolean).join(" \xB7 ")}):null,(0,T.jsx)(nn,{why:P.why})]},P.id))})]},g)),w.length>0?(0,T.jsx)(Hi,{asked:w}):null,w.length>0&&s.hits.length===0?(0,T.jsx)(To,{store:t,kinds:s.searched.kinds,words:s.words,...a?{principal:a}:{},...r?{invariantContext:r}:{}}):null]})}function nn({why:e}){return e.strength==="near"?(0,T.jsxs)("span",{style:A,"data-testid":"search-why","data-near":"",children:["Near \u201C",e.asked,"\u201D",e.field==="label"?"":` \u2014 ${e.reading}: ${e.fragment}`]}):e.field==="label"?null:(0,T.jsxs)("span",{style:A,"data-testid":"search-why",children:[e.reading,": ",e.fragment]})}function Ni(e,t){let n=Object.entries(t).map(([a,r])=>`${r} ${r===1?Ye(e.schema.tryDefinition(a),a):z(e,a).toLowerCase()}`);return n.length===0?"Found":n.length===1?Ae(n[0]):Ae(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function Lo(e,t,n={}){let a=[];for(let r of t){let o=Xe(e,r,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let d of an(e,r,o.actions.affordances))a.some(l=>l.mutation.name===d.mutation.name)||a.push(d)}return a}function an(e,t,n){let a=e.schema.tryDefinition(t)?.fieldRoles?.label,r=[];for(let o of n){let d=e.allMutations().find(c=>c.name===o.mutation);if(!d||!d.creates?.includes(t)||r.some(c=>c.mutation.name===d.name))continue;let l=yr(d.input).map(c=>c.name),s=l.includes("label")?"label":a&&l.includes(a)?a:void 0;!s||o.args[s]!==void 0||r.push({kind:t,affordance:o,mutation:d,arg:s})}return r}function To({store:e,kinds:t,words:n,principal:a,invariantContext:r}){let o=Lo(e,t,{...a?{principal:a}:{},...r?{invariantContext:r}:{}});return o.length===0||n.trim().length===0?null:(0,T.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:o.map(({kind:d,affordance:l,mutation:s,arg:c})=>(0,T.jsxs)("section",{style:{...J,display:"grid",gap:14},children:[(0,T.jsxs)("h2",{style:Z,children:[Ae(Sa(Ye(e.schema.tryDefinition(d),d)))," called \u201C",n,"\u201D"]}),(0,T.jsx)(Ie,{store:e,mutation:s,prefilled:l.args,open:l.open,initial:{[c]:n},...a?{principal:a}:{}})]},`${l.id}|${n}`))})}function Hi({asked:e}){let t=se();return t?(0,T.jsx)(Ii,{asked:e,desk:t.aiDesk}):null}function Ii({asked:e,desk:t}){return _a(t)?(0,T.jsx)("p",{style:{margin:0},children:(0,T.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:a=>ja(t,{pointed:{about:[]},asked:e,returnTo:a.currentTarget}),style:{...q,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",e,"\u2019"]})}):null}var h=H(G(),1),Eo=8,$o=40;function Fi(e,t){let n=t?.fields?.shape??{},a=Object.keys(n).find(r=>ba(n[r])&&ka(e[r]));return a===void 0?void 0:e[a]}function Jn({context:e}){let t=Ue(),n=we(e.store.schema,t.slug??"");return n?(0,h.jsx)(Oo,{context:e,kind:n}):(0,h.jsx)(ee,{context:e,children:(0,h.jsx)(re,{context:e,children:"No such kind of thing here."})})}function Oo({context:e,kind:t,opening:n,row:a,layout:r="list",description:o,bare:d}){let{store:l,brand:s,invariantContext:c}=e;Y(l);let[m,v]=pt(),w=`list-${(0,Me.useId)().replace(/:/g,"")}`,g=l.schema.tryDefinition(t),P=Pa(m.get("archived")),N=l.graph.nodesOfKind(t,{archived:P}),U=Je(l).relations.filter(i=>i.from===t||i.to===t),u=new Set(l.violations(c).flatMap(i=>i.nodeIds)),M=Cr(l.schema,Pr(l.schema,xr(l.schema,t))),j=U.map(i=>i.edgeKind),C=qi(m,M,j),D=["sort","filter","group","q","by","with","past","archived",...j].some(i=>m.has(i)),ne=N.length>=$o,oe=g?.fieldRoles?.when,fe=e.views?.arrangement?.()?.lists?.[t],X=wr(fe),ce=hr(fe?.group),Ke=Gi(ne,oe),xe=n??(X?{...Ke,...X}:Ke),Pe=D?C.arrangement:$n(xe,M).arrangement,S=X?.sort,f=Pe.sort&&S?.then&&Pe.sort.by===S.by&&Pe.sort.direction===S.direction?{...Pe,sort:S}:Pe,L=Ar(f.query??""),E=[...f.filter??[],...L.conditions].some(i=>i.key==="is"&&(i.value==="past"||i.value==="any"))||br(g,[...f.filter??[],...L.conditions]),te=E||!g?.lifecycle?f:{...f,filter:[...f.filter??[],{key:"is",value:"current"}]},p=new Map,x=Wt(N,te,{schema:l.schema,graph:l.graph,flagged:u,...typeof c?.today=="string"?{today:c.today}:{},read:(i,y)=>{let $=p.get(i.id);return $||p.set(i.id,$=yt(l.schema,l.graph,i)),$[y]}}),B=ce&&f.group?.by===ce.by&&!f.group.bucket?M.groups.find(i=>i.key===ce.by):void 0,ye=ce&&B&&(B.type==="choice"||B.type==="boolean")?vr(x.groups,ce,{type:B.type,...B.options?{options:B.options}:{}}):x.groups.map(i=>({...i,closed:!1})),Ee=new Set((m.get("open")??"").split(",").filter(Boolean)),Ko=!!f.query||(f.filter??[]).some(i=>i.key===ce?.by),aa=i=>B?.type==="boolean"?i==="1"?"true":"false":i,ra=i=>i.closed&&!Ko&&!Ee.has(aa(i.key)),Bo=i=>{let y=new URLSearchParams(m),$=new Set(Ee);$.has(i)?$.delete(i):$.add(i),$.size>0?y.set("open",[...$].join(",")):y.delete("open"),v(y,{replace:!0})},Ce=x.nodes,rt=g?.lifecycle&&!E?N.filter(i=>st(g,i)):N,oa=N.length-rt.length,sn=f.group?.by??null,Go=i=>{let y=new URLSearchParams(m);for(let ie of["sort","filter","group","q","by","with","past","archived",...U.map(Rt=>Rt.edgeKind)])y.delete(ie);let $=Tr(i);for(let ie of["sort","filter","group","q","archived"])$[ie]&&y.set(ie,$[ie]);![...y.keys()].some(ie=>["sort","filter","group","q"].includes(ie))&&(n||X||ne||oe)&&y.set("sort",""),v(y)},{principal:ot}=e,ln=Xe(l,t,{...ot?{principal:ot}:{},...e.invariantContext?{context:e.invariantContext}:{}}),Be=ln.actions.affordances.map(i=>({affordance:i,mutation:l.allMutations().find(y=>y.name===i.mutation)})).filter(i=>i.mutation!==void 0),qo=ln.actions.withheld,dn=()=>new Set(Ce.length===0?Be.map(({mutation:i})=>i.name):[]),[cn,ia]=(0,Me.useState)(()=>({kind:t,open:dn()}));cn.kind!==t&&ia({kind:t,open:dn()});let sa=i=>(cn.kind===t?cn.open:dn()).has(i),la=(i,y)=>ia($=>{let ie=new Set($.open);return y?ie.add(i):ie.delete(i),{kind:$.kind,open:ie}}),da=`begin-${(0,Me.useId)().replace(/:/g,"")}`,ca=L.words&&Ce.length===0?Object.fromEntries(an(l,t,ln.actions.affordances).map(i=>[i.mutation.name,i.arg])):{},je=z(l,t),xt=e.views?.lookup(t,{cardinality:"one",fidelity:"glyph"}),pn=xt!==void 0&&!lt(xt)?xt:void 0,un=(f.group?.bucket??"day")==="day"?f.group?.by:void 0,gn=(f.filter??[]).map(i=>i.key),Uo=gn.filter(i=>gn.indexOf(i)===gn.lastIndexOf(i)&&/choice|boolean/.test(M.filters.find(y=>y.key===i)?.type??"")),mn=i=>{let y={...g?.computed?yt(l.schema,l.graph,i):i};un&&!String(y[un]).includes("T")&&delete y[un];for(let $ of Uo)delete y[$];return y},pa=i=>rr(g?.fields?.shape?.[i])?.type==="enum",Pt=i=>{let y=pe(g,i);if(a)return(0,h.jsxs)("li",{"data-testid":"record-row","data-graview-record":i.id,style:{minWidth:0},...Sn(i.id),children:[vn(i,y),a(i,{label:y,href:_(l.schema,t,i.id),flagged:u.has(i.id),glance:no(mn(i),g,y)})]},i.id);if(pn){let kn=qt(xt,i,l.graph),Qo=Object.fromEntries(Object.entries(mn(i)).filter(([Zo])=>!kn?.fields.has(Zo))),ha=kn?Fn(Qo,g,kn.title??y,pa):[];return(0,h.jsxs)("li",{"data-testid":"record-row","data-graview-record":i.id,style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,paddingBlock:10,borderTop:"1px solid var(--graview-edge)"},...Sn(i.id),children:[vn(i,y),(0,h.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,h.jsx)(pn,{node:i,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...u.has(i.id)?{flagged:[i.id]}:{}})}),ha.length>0?(0,h.jsx)("span",{style:{...A,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:(0,h.jsx)(Dn,{runs:ha})}):null,(0,h.jsx)(ji,{to:_(l.schema,t,i.id),label:u.has(i.id)?`${y} \u2014 implicated in a problem`:y})]},i.id)}let $=Fn(mn(i),g,y,pa),ie=$.length>0,Rt=L.words?Rr(g,i,L.words):void 0,fa=ne?void 0:ir(i,g),Lt=Fi(i,g),ya=(0,h.jsxs)(O,{to:_(l.schema,t,i.id),className:"graview-row-title",...y.length>60?{title:y}:{},children:[u.has(i.id)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,y]});return(0,h.jsxs)("li",{className:"graview-row","data-graview-record":i.id,...Sn(i.id),children:[vn(i,y),fa?(0,h.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:14,minWidth:0},children:[(0,h.jsx)(dt,{as:"thumb",file:fa}),ya]}):ya,ie||Lt?(0,h.jsxs)("span",{className:"graview-row-glance",children:[(0,h.jsx)(Dn,{runs:$}),ie&&Lt?" \xB7 ":null,Lt?(0,h.jsx)(Kt,{address:Lt}):null]}):null,Rt?(0,h.jsx)(nn,{why:Rt}):null]},i.id)},fn=Te(e).filter(i=>i.kind===t),ua=fe?.filters,Vo=(f.filter??[]).some(i=>i.key!=="is"||i.value!=="any"),jo=!!(f.sort||f.group||f.query||Vo),_o=rt.length>=Eo||D&&jo,Oe=f.sort?M.sorts.find(i=>i.key===f.sort.by):void 0,yn=Oe?.type==="date"||Oe!==void 0&&Oe.key===oe,ga=ne&&!x.grouped&&Oe&&(Oe.about==="label"||Oe.type==="text"||yn)?i=>{let y=Oe.about==="label"?pe(g,i):i[Oe.key];if(typeof y!="string"||y.length===0)return yn?"No date":"#";if(yn)return y.slice(0,4);let $=y.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test($)?$:"#"}:void 0,_e=ga?Ce.reduce((i,y)=>{let $=ga(y);return i.at(-1)?.key===$?i.at(-1).nodes.push(y):i.push({key:$,nodes:[y]}),i},[]):void 0,ma=x.grouped&&sn?ye.flatMap(i=>ra(i)?[]:i.nodes):_e&&_e.length>1?_e.flatMap(i=>i.nodes):Ce,hn=(0,Me.useMemo)(()=>ma.map(i=>i.id),[ma.map(i=>i.id).join(`
|
|
6
|
+
`)]),$e=Nr(hn),wn=(0,Me.useId)(),gt=(ot?l.permittedMutations(ot):l.permittedMutations()).some(i=>{let y=i.subject?.kinds;return y!==void 0&&(y==="*"||y.includes(t))}),vn=(i,y)=>gt?(0,h.jsx)("span",{className:"graview-choose-at",children:(0,h.jsx)("input",{...$e.boxProps(i.id,y),onPointerEnter:On,onFocus:On})}):null,Sn=i=>gt?{"data-graview-choose":i}:{},zo=(0,Me.useCallback)(i=>{$e.choose(i),requestAnimationFrame(()=>{let y=$e.list.current;((i[0]===void 0?null:y?.querySelector(`[data-graview-choose-box="${CSS.escape(i[0])}"]`))??y)?.focus({preventScroll:!0})})},[$e]),it=r==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",alignItems:"start",gap:12}:a||pn?{margin:0,padding:0,listStyle:"none",display:"grid",gap:a&&r==="list"?6:0}:void 0,Ct=it?void 0:"graview-rows",mt=i=>`list-at-${i.replace(/[^\p{L}\p{N}]/gu,"_")}`,At=U.map(i=>{let y=i.from===t?i.to:i.from,$=i.from===t?i.description:i.inverse??i.description;return{relation:i,far:y,words:$}}),Yo=new Set(At.map(i=>(i.words??"").toLowerCase()).filter((i,y,$)=>i&&$.indexOf(i)!==y));return(0,h.jsxs)(d?Bi:ee,{context:e,children:[(0,h.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,h.jsxs)("header",{style:{display:"grid",gap:4},children:[d?null:(0,h.jsx)(ut,{context:e}),(0,h.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",columnGap:10,rowGap:4,minWidth:0},children:[(0,h.jsx)(le,{kind:t,brand:s,schema:l.schema,size:8}),(0,h.jsx)(re,{context:e,children:je}),Be.length>0?(0,h.jsx)("span",{style:{marginLeft:"auto",display:"flex",flexWrap:"wrap",columnGap:14,rowGap:8},"data-testid":"beginnings-open",children:Be.map(({affordance:i,mutation:y})=>(0,h.jsx)(Ui,{name:y.name,title:y.title??y.name,panel:`${da}-${y.name}`,open:sa(y.name),onOpen:$=>la(y.name,$)},i.id))}):null]}),Ce.length>0?(0,h.jsx)(Jr,{place:"here",to:[{label:`Skip to the ${Ce.length===1?Ye(g,t):`${Ce.length} ${je.toLowerCase()}`}`,testid:"records",go:()=>{let i=document.querySelector(`[data-graview-skip-target="${CSS.escape(wn)}"]`);Nn(i?.querySelector('[data-graview-choose-box][tabindex="0"]')??i)}},...rt.length>0?[{label:"Skip to arranging them",testid:"arranging",go:()=>{let i=document.querySelector(`[data-graview-skip-target="${CSS.escape(wn)}"]`)?.parentElement?.querySelector('[role="group"][aria-label="Arrange"]');Nn(i?.querySelector('button[data-testid$="-add"], button[data-testid$="-all"]')??i)}}]:[]]}):null,o??g?.description?(0,h.jsx)("p",{style:ae,children:o??g?.description}):null,At.length>0||fn.length>0?(0,h.jsxs)("p",{style:{...A,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[At.length>0?(0,h.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",At.map(({relation:i,far:y,words:$},ie)=>(0,h.jsxs)("span",{"data-relation":i.edgeKind,children:[ie>0?(0,h.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,y==="*"?Ae($??ze(i.edgeKind)):(0,h.jsx)(O,{to:`/${V(l.schema,y)}`,style:q,title:z(l,y),children:$&&Yo.has($.toLowerCase())?`${Ae($)}: ${z(l,y).toLowerCase()}`:Ae($??z(l,y))})]},`${i.edgeKind}|${i.from}|${i.to}`))]}):null,fn.length>0?(0,h.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",fn.map((i,y)=>(0,h.jsxs)("span",{children:[y>0?(0,h.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,h.jsx)(O,{to:ge(e,i),style:q,children:i.title})]},et(i)))]}):null]}):null]}),Be.length>0?(0,h.jsx)("div",{style:{display:"contents"},"data-testid":"beginnings",children:Be.map(({affordance:i,mutation:y})=>{let $=!!(ca[y.name]&&Ce.length===0);return(0,h.jsx)(Vi,{name:y.name,id:`${da}-${y.name}`,description:y.description,open:sa(y.name),onClose:()=>la(y.name,!1),children:(0,h.jsx)(Ie,{store:l,mutation:y,prefilled:i.args,open:i.open,...$?{initial:{[ca[y.name]]:L.words}}:{},...e.principal?{principal:e.principal}:{}},$?`${y.name}|${L.words}`:y.name)},i.id)})}):null,C.dropped.length>0?(0,h.jsxs)("p",{style:{...A,margin:0},"data-testid":"list-dropped",children:["This link asked for ",C.dropped.join(", "),", which ",je.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,rt.length>0?(0,h.jsx)($r,{schema:l.schema,graph:l.graph,kind:t,arrangement:f,onChange:Go,kept:{shown:Ce.length,of:rt.length},noun:{one:Ye(g,t),many:je.toLowerCase()},..._o?{}:{allow:!1},...ua?{filters:ua}:{},offers:M,chips:{nodes:rt,flagged:u,...typeof c?.today=="string"?{today:c.today}:{}},query:e.framed===!0&&e.barAbove!==!0}):null,(0,h.jsx)("style",{children:_t}),gt?(0,h.jsx)("style",{children:Hr+Ki}):null,(0,h.jsx)("div",{className:"graview-list","data-graview-skip-target":wn,...gt?{...$e.listProps,ref:$e.list,tabIndex:-1,"data-graview-choosable":"","aria-label":$e.chosen.length>0?`${je}, ${$e.chosen.length} chosen`:je,role:"group"}:{},children:Ce.length===0&&L.words?(0,h.jsxs)("p",{style:ae,"data-testid":"none-yet",children:["Nothing here is called \u201C",L.words,"\u201D."," ",(0,h.jsx)("span",{style:A,"data-testid":"list-searched",children:Dt(l.schema,{kinds:[t],past:E})})," ",(0,h.jsx)(O,{to:"?",style:q,children:"Show every one"})]}):Ce.length===0?(0,h.jsxs)("p",{style:ae,"data-testid":"none-yet",children:[f.filter?.length||f.query?"None of them.":"None yet",!f.filter?.length&&!f.query&&Be.length>0?` \u2014 the first one starts above, with \u201C${Be[0]?.mutation.title??Be[0]?.mutation.name}\u201D.`:!f.filter?.length&&!f.query?".":"",f.filter?.length||f.query?(0,h.jsxs)(h.Fragment,{children:[" ",(0,h.jsx)(O,{to:"?",style:q,children:"Show every one"})]}):null]}):x.grouped&&sn?(0,h.jsx)("div",{style:{display:"grid",gap:"1rem"},"data-testid":"records","data-grouped":sn,children:ye.map(i=>{if(!i.closed)return(0,h.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,h.jsxs)("h2",{className:"graview-group-head",children:[i.label," ",(0,h.jsx)("span",{children:i.nodes.length})]}),(0,h.jsx)("ul",{style:it,className:Ct,"data-graview-rows":"",children:i.nodes.map(Pt)})]},i.key||"-");let y=ra(i),$=`${w}-${mt(i.key||"none")}`;return(0,h.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group","data-closed":y?"shut":"open",children:[(0,h.jsx)("h2",{className:"graview-group-head",children:(0,h.jsxs)("button",{type:"button",className:"graview-group-toggle","aria-expanded":!y,"aria-controls":$,"data-testid":"list-group-toggle",onClick:()=>Bo(aa(i.key)),children:[(0,h.jsx)("span",{"aria-hidden":"true",children:y?"\u25B8":"\u25BE"}),i.label," ",(0,h.jsxs)("span",{children:["\xB7 ",i.nodes.length]}),(0,h.jsxs)("span",{style:Di,children:[" ",i.nodes.length===1?Ye(g,t):je.toLowerCase()]})]})}),(0,h.jsx)("ul",{id:$,style:y?{...it,display:"none"}:it,className:Ct,"data-graview-rows":"",hidden:y,children:y?null:i.nodes.map(Pt)})]},i.key||"-")})}):_e&&_e.length>1?(0,h.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":Oe?.type==="date"?"year":"letter",children:[(0,h.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...A,display:"flex",flexWrap:"wrap",gap:Oe?.type==="date"?"0 10px":"0 4px",lineHeight:1.3},children:_e.map(i=>(0,h.jsx)("a",{href:`#${mt(i.key)}`,onClick:y=>{y.preventDefault(),document.getElementById(mt(i.key))?.scrollIntoView({block:"start"})},style:{...ve,minWidth:24,justifyContent:"center"},children:i.key},i.key))}),_e.map(i=>(0,h.jsxs)("section",{"data-testid":"list-section","aria-labelledby":mt(i.key),style:{display:"grid",gap:0},children:[(0,h.jsx)("h2",{id:mt(i.key),className:"graview-group-head",children:i.key}),(0,h.jsx)("ul",{style:it,className:Ct,"data-graview-rows":"",children:i.nodes.map(Pt)})]},i.key))]}):(0,h.jsx)("ul",{style:it,className:Ct,"data-testid":"records","data-graview-rows":"",children:Ce.map(Pt)})}),gt?(0,h.jsx)(Ir,{store:l,chosen:$e.chosen,...ot?{principal:ot}:{},...c?{context:c}:{},anchor:Wi,of:hn.length,onChooseAll:()=>$e.choose(hn),onClear:$e.clear,onActed:zo}):null,oa>0?(0,h.jsxs)(O,{to:Mo(m,"filter","is:any"),style:{...q,...A,justifySelf:"start"},"data-testid":"past-link",children:["+",oa," past"]}):null,P===!1&&l.graph.count(t,{archived:!0})>0?(0,h.jsxs)(O,{to:Mo(m,"archived","true"),style:{...q,...A,justifySelf:"start"},"data-testid":"archived-link",children:["+",l.graph.count(t,{archived:!0})," archived"]}):null]}),(0,h.jsx)(tn,{context:e,withheld:qo,style:J,testId:"withheld"})]})}var Di={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Wi=()=>document.querySelector("[data-graview-choosable]")?.closest("[data-embed-content]")??null,Ki=`
|
|
7
|
+
.graview-list[data-graview-choosable]{outline:none}
|
|
8
|
+
.graview-list [data-graview-choose]{position:relative;padding-left:34px}
|
|
9
|
+
.graview-choose-at{position:absolute;left:2px;top:0;bottom:0;z-index:${Ta.raised};display:flex;align-items:center}
|
|
10
|
+
@media (min-width: 900px) and (pointer: fine){
|
|
11
|
+
.graview-list [data-graview-choose]{padding-left:0}
|
|
12
|
+
.graview-choose-at{left:-34px}
|
|
13
|
+
}
|
|
14
|
+
@media (pointer: coarse){
|
|
15
|
+
.graview-list:not([data-graview-choosing]) [data-graview-choose]{padding-left:0}
|
|
16
|
+
.graview-list:not([data-graview-choosing]) .graview-choose-at{display:none}
|
|
17
|
+
}
|
|
18
|
+
`;function Bi({children:e}){return(0,h.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:e})}var Gi=(e,t)=>t?{sort:{by:t,direction:"desc"}}:e?{sort:{by:"label",direction:"asc"}}:{};function qi(e,t,n){let a=$t({...e.get("sort")?{sort:e.get("sort")}:{},...e.get("filter")?{filter:e.get("filter")}:{},...e.get("group")?{group:e.get("group")}:{},...e.get("q")?{q:e.get("q")}:{},...e.get("archived")?{archived:e.get("archived")}:{}}),r=[...a.filter??[]],o=e.get("by"),d=a.group??(o?{by:o}:void 0);for(let s of n){let c=e.get(s);c&&r.push({key:s,value:c})}let l=e.get("with");return l&&r.push({key:l,value:"*"}),e.get("past")==="1"&&!r.some(s=>s.key==="is")&&r.push({key:"is",value:"any"}),$n({...a.sort?{sort:a.sort}:{},...a.query?{query:a.query}:{},...r.length>0?{filter:r}:{},...d?{group:d}:{},...a.archived!==void 0?{archived:a.archived}:{}},t)}function Mo(e,t,n){let a=new URLSearchParams(e);return a.set(t,n),a.delete("past"),`?${a.toString()}`}function Ui({name:e,title:t,panel:n,open:a,onOpen:r}){return(0,h.jsxs)("button",{type:"button","data-testid":`act-open-${e}`,"data-graview-act":e,"aria-expanded":a,"aria-controls":n,onClick:()=>{r(!a),a||requestAnimationFrame(()=>document.getElementById(n)?.querySelector("input, select, textarea, button")?.focus())},style:{...ve,minHeight:28,margin:"-4px 0",padding:"0 2px",border:0,background:"none",font:"inherit",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,h.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),t]})}function Vi({name:e,id:t,description:n,open:a,onClose:r,children:o}){return(0,h.jsxs)("div",{"data-testid":`act-${e}`,id:t,hidden:!a,onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),r(),document.querySelector(`[aria-controls="${t}"]`)?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,h.jsx)("p",{style:{...A,margin:0,maxWidth:"58ch"},children:n}):null,o]})}function ji({to:e,label:t}){let n=(0,Me.useRef)(null);return Fr(n),(0,h.jsx)(O,{ref:n,to:e,"aria-label":t,style:{position:"absolute",inset:0,borderRadius:6}})}var at=H(He(),1);var bt=H(He(),1);var I=H(G(),1);function ea({context:e}){let{store:t,brand:n,invariantContext:a,principal:r}=e;Y(t);let o=t.violations(a),d=t.allInvariants(),l=Ht(t,o),s=za(t.schema,d);return(0,I.jsxs)(ee,{context:e,children:[(0,I.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,I.jsx)(re,{context:e,children:o.length===0?"All rules hold":"What is broken"}),(0,I.jsx)("p",{style:ae,"data-testid":"problems-count",children:o.length===0?"Every declared rule is satisfied by what is here.":Ca(o)})]}),(0,I.jsx)(Ro,{context:e}),l.map((c,m)=>{let v=c.nodeIds[0],w=v?t.graph.getNode(v):void 0;return(0,I.jsxs)("section",{style:{display:"grid",gap:10,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:[c.line?null:(0,I.jsx)(rn,{violation:c,schema:t.schema,...n?{brand:n}:{}}),w?(0,I.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,I.jsx)(le,{kind:w.kind,brand:n,schema:t.schema,size:7}),(0,I.jsx)(O,{to:_(t.schema,w.kind,w.id),style:q,children:pe(t.schema.tryDefinition(w.kind),w)})]}):null,c.line?(0,I.jsx)(rn,{violation:c,schema:t.schema,...n?{brand:n}:{}}):null,(0,I.jsx)(on,{store:t,repairs:c.repairs,...r?{principal:r}:{}})]},m)}),d.length>0?(0,I.jsxs)("section",{style:{...J,display:"grid",gap:12},"data-testid":"rules",children:[(0,I.jsx)("h2",{style:Z,children:"The rules"}),(0,I.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:d.map(c=>{let m=o.filter(g=>g.invariant===c.name).length,v=s.get(c.name),w=c.label??c.name;return(0,I.jsxs)("li",{"data-graview-rule":c.name,style:{display:"grid",gap:2},children:[(0,I.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[v?(0,I.jsx)(It,{line:v,schema:t.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,I.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:w}),(0,I.jsx)("span",{style:{...A,color:m>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:m===0?"holds":`broken in ${m} ${m===1?"place":"places"}`})]}),v&&w.trim().length>0?(0,I.jsx)("span",{style:A,children:w}):null]},c.name)})})]}):null]})}function rn({violation:e,schema:t,brand:n}){if(!e.line)return(0,I.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:e.message});let a=Qa(e),r=Ya(e);return r?(0,I.jsxs)("div",{style:{display:"grid",gap:4},"data-testid":"problem-line",children:[(0,I.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},"data-testid":"problem-says",children:r}),a?(0,I.jsx)("span",{style:A,children:a}):null,(0,I.jsxs)("details",{"data-testid":"problem-judged",style:A,children:[(0,I.jsx)("summary",{style:{cursor:"pointer",width:"fit-content",minHeight:24},children:"How it is judged"}),(0,I.jsx)(It,{line:e.line,schema:t,...n?{brand:n}:{},lead:"none"})]})]}):(0,I.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",children:[(0,I.jsx)(It,{line:e.line,schema:t,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)"}}),a?(0,I.jsx)("span",{style:A,children:a}):null]})}function on({store:e,repairs:t,principal:n}){let[a,r]=(0,bt.useState)(null),[o,d]=(0,bt.useState)(null),l=(0,bt.useRef)([]);if(t.length===0)return null;let s=a===null?null:t[a],c=s&&(s.missing??[]).length>0?e.allMutations().find(m=>m.name===s.mutation):void 0;return(0,I.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,I.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:t.map((m,v)=>{let w=(m.missing??[]).length>0,g=e.permits({name:m.mutation,args:{...m.args}},n);return g.ok?(0,I.jsx)("button",{ref:P=>{l.current[v]=P},type:"button","data-graview-repair":m.mutation,"data-graview-asks":w||void 0,"aria-expanded":w?a===v:void 0,onClick:()=>{if(d(null),w){r(a===v?null:v);return}r(null);try{e.apply({name:m.mutation,args:{...m.args}},n?{author:n}:{})}catch(P){d(Ft(e.schema,e.allMutations(),P))}},style:Se,children:w?`${m.label} \u2026`:m.label},v):(0,I.jsxs)("p",{"data-testid":"withheld","data-withheld":g.refusal.wouldNeed.join(",")||"nobody",style:{...A,margin:0},children:[(0,I.jsx)("s",{children:m.label})," \u2014 ",g.refusal.message]},v)})}),c&&s?(0,I.jsx)(Ie,{store:e,mutation:c,prefilled:{...s.args},only:s.missing??[],label:s.label,autoFocus:!0,onDone:()=>{let m=a;r(null),requestAnimationFrame(()=>{let v=m===null?null:l.current[m];if(v?.isConnected){v.focus();return}let w=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");w&&(w.hasAttribute("tabindex")||(w.tabIndex=-1),w.focus())})},...n?{principal:n}:{}}):null,s&&!c&&(s.missing??[]).length>0?(0,I.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:Hn},children:["\u201C",s.label,"\u201D names ",s.mutation,", which this app does not declare."]}):null,o?(0,I.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:Hn},children:o}):null]})}var ta=H(He(),1);var Ve=H(G(),1);function No({store:e,link:t,principal:n}){let[a,r]=(0,ta.useState)(!1),[o,d]=(0,ta.useState)(null),l=tr(t);return(0,Ve.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,Ve.jsx)("button",{type:"button","data-graview-provisional":"",title:l,"aria-label":`Unsure link: ${l}`,"aria-expanded":a,onClick:()=>r(!a),style:{border:"1px dashed var(--graview-ink-muted)",borderRadius:999,background:"transparent",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.75rem",lineHeight:1,padding:"2px 6px",cursor:"pointer"},children:"unsure"}),a?(0,Ve.jsxs)("span",{style:{...A,display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,Ve.jsx)("span",{children:l}),(0,Ve.jsx)("button",{type:"button",style:{...Se,padding:"4px 10px"},onClick:()=>{try{e.apply({name:Aa,args:{kind:t.edge.kind,from:t.edge.from,to:t.edge.to}},n?{author:n}:{}),r(!1)}catch(s){d(Ft(e.schema,e.allMutations(),s))}},children:"Keep this link"}),o?(0,Ve.jsx)("span",{role:"alert",children:o}):null]}):null]})}var me=H(G(),1);function Ho({nodeId:e,node:t,field:n,inPlace:a,labelStyle:r=he}){return n.files?(0,me.jsx)(dt,{as:"field",read:!a,nodeId:e,field:n.key,label:n.label,files:n.files,labelStyle:r,style:{gap:4}}):n.long?(0,me.jsx)(Er,{nodeId:e,field:n.key,label:n.label,value:n.value,markdown:n.markdown,style:{gridColumn:"1 / -1",gap:4},labelStyle:r,valueStyle:{lineHeight:1.6}}):(0,me.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,me.jsx)("dt",{style:r,children:n.label}),(0,me.jsx)("dd",{style:{margin:0,overflowWrap:"anywhere",minWidth:0},children:n.linked?(0,me.jsx)(pr,{relation:n.linked.relation,refs:n.linked.refs,...a?{nodeId:e,field:n.key}:{}}):n.app?(0,me.jsx)(Kt,{address:n.app,as:"record",...a?{nodeId:e,field:n.key}:{}}):n.href?(0,me.jsx)(Mr,{href:n.href,field:n.key,value:n.value,stored:n.stored,...a?{nodeId:e}:{}}):a?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Bt,{nodeId:e,field:n.key,value:n.value,stored:n.stored}),n.repeats?(0,me.jsx)(ur,{nodeId:e,field:n.key,start:t?.[n.key],value:t?.[`${n.key}Repeat`],label:`${n.label} repeats`}):null]}):n.value})]})}var k=H(G(),1),_i=[];function na({context:e}){let{store:t,brand:n,principal:a,invariantContext:r}=e;Y(t);let o=se()!==null,d=Ue(),l=decodeURIComponent(d.id??""),s=po(t,l,{...a?{principal:a}:{},...r?{context:r}:{}}),c=Ht(t,s?.violations??_i),[m,v]=(0,at.useState)(null),[w,g]=(0,at.useState)(!1),[P,N]=(0,at.useState)(null),U=(0,at.useRef)(null),u=(0,at.useRef)(null),M=gr({flow:"both",letters:!0}),j=p=>{(U.current?.parentElement?.querySelector(`[data-affordance="${p.replace(/["\\]/g,"\\$&")}"]`)??U.current)?.focus()};if(!s)return(0,k.jsx)(ee,{context:e,children:(0,k.jsx)(re,{context:e,children:"Nothing lives at this address."})});let C=t.graph.getNode(l),D=t.schema.tryDefinition(s.kind),ne=D?.describe&&C?Xa(D,C):null,oe=[...t.log.all()].filter(p=>!Mt(p)&&(p.writes.includes(l)||p.reads.includes(l))).slice(-8).reverse(),fe=t.log.all().find(p=>!Mt(p)&&p.undoes===void 0&&p.primitives.some(x=>x.op==="add-node"&&x.node.id===l)),X=s.actions.affordances.filter(p=>p.provider!=="invariant"),ce=X.filter(p=>p.destructive||p.setsAside),Ke=w||ce.length<2?X:X.filter(p=>!ce.includes(p)),xe=e.views?.lookup(s.kind,{cardinality:"one",fidelity:"full"}),Pe=xe!==void 0&&!lt(xe)?xe:void 0,S=Pe&&C?qt(xe,C,t.graph):void 0,f=S?s.fields.filter(p=>!S.fields.has(p.key)):s.fields,L=S?s.links.flatMap(p=>{let x=p.targets.filter(B=>!S.records.has(B.id));return x.length>0?[{...p,targets:x}]:[]}):s.links,E=Pe!==void 0&&Ua(xe),te=o&&or(D).length>0;return(0,k.jsxs)(ee,{context:e,children:[(0,k.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,k.jsx)(ut,{context:e}),(0,k.jsx)(re,{context:e,children:o&&C?.label===s.label?(0,k.jsx)(Bt,{nodeId:l,field:"label",value:s.label,said:s.label}):s.label}),ne&&ne!==s.label?(0,k.jsx)("p",{style:ae,children:ne}):null,fe?.lineage?(0,k.jsxs)("p",{style:{...A,margin:0},"data-testid":"record-lineage",children:["Made by ",ht(fe,a,{graph:t.graph,schema:t.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}}),", ",An(fe.lineage)]}):null,(0,k.jsx)(Yt,{context:e,stop:`#focus=${encodeURIComponent(l)}`,style:{...qe,...A},"data-testid":"spatial-link"}),o&&C?(0,k.jsx)(Tn,{choices:[{on:"changed",record:l},{on:"act",record:l},{on:"reaches",kind:s.kind,condition:"",record:l}],label:"Notify me when this changes",testId:"record-notify",style:{...Se,...A,justifySelf:"start"}}):null,Te(e).some(p=>p.kind===s.kind||p.across===s.kind)?(0,k.jsxs)("p",{style:{...A,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",Te(e).filter(p=>p.kind===s.kind||p.across===s.kind).map((p,x)=>(0,k.jsxs)("span",{children:[x>0?(0,k.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,k.jsx)(O,{to:ge(e,p),style:q,children:p.title})," ",(0,k.jsx)(Yt,{context:e,stop:`#view=${encodeURIComponent(p.as)}`,style:{...q,...A,display:"inline-block",minWidth:24,textAlign:"center"},title:`${p.title}, in the scene`,label:`${p.title}, in the scene`,children:(0,k.jsx)("span",{"aria-hidden":"true",children:"\u2197"})})]},et(p)))]}):null]}),C&&xa(C)?(0,k.jsx)(Yi,{context:e,id:l,kind:s.kind}):null,C&&Ra(t,l)?(0,k.jsx)(zi,{context:e,id:l,kind:s.kind}):null,Pe&&C?(0,k.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,k.jsx)(Dr,{children:(0,k.jsx)(Zt,{when:Ot(xe),children:(0,k.jsx)(Pe,{node:C,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...s.violations.length>0?{flagged:[l]}:{}})})})}):null,s.violations.length>0?(0,k.jsx)("section",{"data-testid":"record-violations",style:{display:"grid",gap:12,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:c.map((p,x)=>(0,k.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,k.jsx)(rn,{violation:p,schema:t.schema,...n?{brand:n}:{}}),(0,k.jsx)(on,{store:t,repairs:uo(s.actions,p.repairs),...a?{principal:a}:{}})]},x))}):null,!E&&(f.length>0||te)?(0,k.jsxs)("section",{style:{...J,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,k.jsx)("h2",{style:Z,children:"The facts"}),er(D,f).map((p,x)=>{let B=(0,k.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:p.fields.map(ye=>(0,k.jsx)(Ho,{nodeId:l,node:C,field:ye,inPlace:o},ye.key))});return p.title?(0,k.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,k.jsx)("h3",{"data-graview-field-group":p.title,style:{...Z,fontSize:"inherit"},children:p.title}),B]},x):(0,k.jsx)("div",{children:B},x)}),te?(0,k.jsx)(dt,{as:"unfilled",nodeId:l,skip:[...S?.fields??[]],labelStyle:he,style:{gap:4}}):null]}):null,(E?[]:L).map(p=>(0,k.jsxs)("section",{style:{...J,display:"grid",gap:10},children:[(0,k.jsx)("p",{style:he,children:to(t,p)}),p.description?(0,k.jsx)("h2",{style:Z,children:Ae(p.description)}):(0,k.jsxs)("h2",{style:Z,"aria-label":ze(p.edgeKind),children:[p.direction==="in"?"\u2190 ":"\u2192 ",ze(p.edgeKind)]}),(0,k.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:p.targets.map(x=>{let B=nr(t,p.direction==="in"?{kind:p.edgeKind,from:x.id,to:l}:{kind:p.edgeKind,from:l,to:x.id});return(0,k.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,k.jsx)(le,{kind:x.kind,brand:n,schema:t.schema,size:7}),(0,k.jsxs)(O,{to:_(t.schema,x.kind,x.id),style:q,children:[x.label,x.apart?(0,k.jsxs)("span",{style:A,children:[" \xB7 ",x.apart]}):null]}),B?.provisional?(0,k.jsx)(No,{store:t,link:B,...a?{principal:a}:{}}):null]},x.id)})}),(p.direction==="out"&&t.schema.edge(p.edgeKind)?.cardinality==="one"?[]:[...new Set(p.targets.map(x=>x.kind))]).map(x=>(0,k.jsx)(O,{to:`/${V(t.schema,x)}?${encodeURIComponent(p.edgeKind)}=${encodeURIComponent(l)}`,style:{...qe,...A},"data-testid":"related-all",children:(0,k.jsxs)(Qe,{children:["Sort and filter ",p.description??`these ${z(t,x).toLowerCase()}`,p.targets.some(B=>B.kind!==x)?` (${z(t,x).toLowerCase()})`:""]})},x))]},`${p.edgeKind}|${p.direction}|${p.description??""}`)),!E&&(X.length>0||s.actions.withheld.length>0)?(0,k.jsxs)("section",{style:{...J,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,k.jsx)("h2",{style:Z,ref:U,tabIndex:-1,children:"What can be done"}),(0,k.jsxs)("div",{role:"toolbar","aria-label":"What can be done",...M,style:{display:"flex",flexWrap:"wrap",gap:8},children:[Ke.map(p=>{let x=m===p.id;return(0,k.jsx)("button",{type:"button","data-affordance":p.id,"data-rank":p.rank,"data-graview-act":p.mutation,[Ln]:"",autoFocus:w&&p===ce[0],"aria-expanded":x,onClick:()=>v(x?null:p.id),style:{...Se,...x?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:p.label},p.id)}),Ke.length<X.length?(0,k.jsxs)("button",{type:"button","aria-expanded":!1,onClick:()=>g(!0),style:{...Se,...A},"data-testid":"record-actions-more",[Ln]:"",children:["Show ",X.length-Ke.length," more"]}):null]}),X.map(p=>{if(m!==p.id)return null;let x=t.allMutations().find(B=>B.name===p.mutation);return x?(0,k.jsxs)("div",{ref:u,onKeyDown:B=>{if(B.key!=="Escape"||B.defaultPrevented)return;B.preventDefault(),v(null);let ye=p.id;requestAnimationFrame(()=>j(ye))},style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,k.jsx)("h3",{style:Z,children:p.label}),x.description?(0,k.jsx)("p",{style:{...A,margin:0},children:x.description}):null,(0,k.jsx)(Ie,{store:t,mutation:x,prefilled:p.args,open:p.open,label:p.label,autoFocus:!0,onDone:()=>{v(null),N(p.mutation);let B=p.id;requestAnimationFrame(()=>j(B))},...a?{principal:a}:{}})]},p.id):null}),o&&P!==null&&m===null?(0,k.jsx)(Tn,{choices:[{on:"act",act:P,record:l},{on:"act",act:P}],label:"Notify me when someone else does this",testId:"notify-after-act",style:{...Se,...A,justifySelf:"start"}}):null,(0,k.jsx)(tn,{context:e,withheld:s.actions.withheld})]}):null,o?(0,k.jsx)(eo,{id:l,style:J,headingStyle:Z}):null,oe.length>0?(0,k.jsxs)("section",{style:{...J,display:"grid",gap:10},"data-testid":"record-history",children:[(0,k.jsx)("h2",{style:Z,children:"What has happened"}),(0,k.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:oe.map(p=>(0,k.jsxs)("li",{style:A,children:[(0,k.jsx)("span",{style:{color:"var(--graview-ink)"},children:p.intent}),p.lineage?(0,k.jsxs)("span",{"data-graview-lineage":"",children:[" \xB7 ",An(p.lineage)]}):null," \u2014 ",ht(p,a,{graph:t.graph,schema:t.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},p.id))})]}):null]})}function zi({context:e,id:t,kind:n}){let{store:a,principal:r}=e,o={name:`allow-tidying-${n}`,args:{id:t}},d=a.allMutations().some(l=>l.name===o.name)&&a.permits(o,r).ok;return(0,k.jsxs)("section",{"data-testid":"record-left-alone",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,k.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,k.jsx)("strong",{children:"Left alone."})," Nothing automated changes it; tidying passes it by."]}),d?(0,k.jsx)("button",{type:"button",style:Se,"data-testid":"allow-tidying",onClick:()=>a.apply(o,r?{author:r}:{}),children:"Allow tidying again"}):null]})}function Yi({context:e,id:t,kind:n}){let{store:a,principal:r}=e,o={name:`unarchive-${n}`,args:{id:t}},d=a.allMutations().some(c=>c.name===o.name)&&a.permits(o,r).ok,l=[...a.log.all()].reverse().find(c=>!Mt(c)&&c.mergedInto!==void 0&&c.writes.includes(t)),s=l?.mergedInto!==void 0?a.graph.getNode(l.mergedInto):void 0;return(0,k.jsxs)("section",{"data-testid":"record-archived",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,k.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,k.jsx)("strong",{children:"Archived."})," Kept with its ties and history, and out of lists, counts and rules.",s?(0,k.jsxs)(k.Fragment,{children:[" ","Merged into ",(0,k.jsx)(O,{to:_(a.schema,s.kind,s.id),style:q,children:pe(a.schema.tryDefinition(s.kind),s)}),"."]}):null]}),d?(0,k.jsx)("button",{type:"button",style:Se,"data-testid":"bring-it-back",onClick:()=>a.apply(o,r?{author:r}:{}),children:"Bring it back"}):null]})}var b=H(G(),1),Qi=Nt(()=>(__graviewPreload(import.meta.url,["./chunk.76GF5US2.js","./chunk.IPAZOKMQ.js","./chunk.V7XHNRQM.js","./chunk.UGFDSE37.js","./chunk.IYIN6VSN.js","./chunk.GCKZ2YRJ.js","./chunk.VC3UGFHY.js","./chunk.YHH4TWZ2.js","./chunk.O2WWYZI7.js","./chunk.AGIO2GRV.js","./chunk.VSNHCGKC.js","./chunk.EUPSAYEI.js","./chunk.TCXKPILZ.js","./chunk.R6V37SR7.js","./chunk.SWWAEOZ7.js","./chunk.IROYMLER.js","./chunk.FWSCBHZ5.js","./chunk.7NNI7YH4.js","./chunk.7N2GXZYI.js","./chunk.MF73YBJL.js","./chunk.63MS2LOP.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.ZIEHF67C.js","./chunk.UHX4WTM7.js","./chunk.IKX4VDTW.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.GZHZLJBF.js","./chunk.5AGW4NRZ.js","./chunk.OJGHDWI6.js","./chunk.DQS7D2W2.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.A3RNSSUQ.js")).then(e=>({default:e.DraftPage}))),Zi={kind:"human"};function Xi({list:e,store:t}){let n=new Set(e.members.map(d=>d.kind)),a=e.total-e.members.length,r=n.size===1?[...n][0]:void 0;if(!r)return(0,b.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${a} more`});let o=Ge(t.schema,r).toLowerCase();return(0,b.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,b.jsx)(O,{to:`/${V(t.schema,r)}`,className:"graview-spec-link graview-spec-see-all","data-testid":"see-all",children:e.total===t.graph.nodesOfKind(r).length?`See all ${ft(e.total)} ${o}`:`${ft(a)} more \xB7 all ${o}`})})}function Ji({context:e,children:t}){let n=De(),a=e.store.schema,r=Ze("/").replace(/\/$/,""),o=(0,K.useMemo)(()=>({href:d=>`${r}${_(a,d.kind,d.id)}`,go:d=>n(_(a,d.kind,d.id)),more:d=>(0,b.jsx)(Xi,{list:d,store:e.store})}),[r,a,n,e.store]);return(0,b.jsx)(Gt.Provider,{value:o,children:(0,b.jsx)(Wr.Provider,{value:(e.titleLevel??(e.framed&&!e.barAbove?1:2))-1,children:t})})}var Fo=(0,K.createContext)(void 0);function es({steering:e}){let t=ue(),n=De(),a=`${t.pathname}${t.search}`;return(0,K.useLayoutEffect)(()=>e.at(a),[a,e]),(0,K.useLayoutEffect)(()=>{let r=d=>{d!==a&&n(d)};e.go.current=r;let o=e.pending?.current;return o!==void 0&&(e.pending.current=void 0,r(o)),()=>{e.go.current===r&&(e.go.current=void 0)}},[a,n,e]),null}function ts({context:e,to:t}){let{pathname:n}=ue(),a=se(),r=(t??a)?.sayWhere,o=ns(e,n);return(0,K.useEffect)(()=>(r?.(o),()=>r?.(null)),[r,o]),null}function ns(e,t){let[n="",a,r]=t.split("/").filter(Boolean).map(d=>{try{return decodeURIComponent(d)}catch{return d}});if(r!==void 0)return"#";if(n==="places"&&a!==void 0){if(a===Pn)return"#overview=1";let d=e.views?.places().find(l=>l.as===a);return d?`#focus=${encodeURIComponent(Ne(d.kind))}&view=${encodeURIComponent(d.as)}`:"#"}let o=we(e.store.schema,n);return o?`#focus=${encodeURIComponent(a??Ne(o))}`:"#"}function as({onNavigate:e,path:t}){let n=ue(),a=Wn(),r=De(),o=n.hash&&!n.hash.includes("=")?n.hash:"",d=`${n.pathname}${n.search}${o}`,l=(0,K.useRef)(e);l.current=e;let s=(0,K.useRef)(null);(0,K.useEffect)(()=>{let m=s.current;s.current=d,m!==null&&(d===m&&a!=="PUSH"||l.current?.(d,a==="POP"?"pop":a==="REPLACE"?"replace":"push"))},[n.key]);let c=(0,K.useRef)(t);return(0,K.useEffect)(()=>{t===void 0||t===c.current||(c.current=t,t!==d&&r(t))},[t]),null}function Io({context:e,registry:t,page:n}){let a=Ue(),r=we(e.store.schema,a.slug??""),o=n==="list"?Jn:na,l=(r?t?.lookup(r,n):void 0)??o;return(0,b.jsx)(l,{context:e})}function rs({context:e,registry:t,children:n}){let a=(0,K.useRef)(null);return Va(a),(0,b.jsx)("div",{ref:a,"data-graview-face":"pages",style:{display:"contents"},children:(0,b.jsx)(bo,{context:e,registry:t,root:a,children:(0,b.jsx)(Po,{context:e,root:a,children:n})})})}function os(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function is(){let{pathname:e}=ue(),t=Wn(),n=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{if(t!=="POP"){for(let o=n.current?.parentElement;o;o=o.parentElement){let{overflowY:d}=getComputedStyle(o);if((d==="auto"||d==="scroll")&&o.scrollHeight>o.clientHeight){o.scrollTop=0;return}}window.scrollTo(0,0)}},[e]);let a=(0,K.useRef)(e),r=(0,K.useRef)(!1);return(0,K.useEffect)(()=>{if(!r.current&&e===a.current)return;r.current=!0;let o=document.activeElement;if(os(o))return;let d=n.current?.closest("main")??document.querySelector("main"),s=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??d?.querySelector("h1, h2")??null??d??null;s&&(s.hasAttribute("tabindex")||s.setAttribute("tabindex","-1"),s.focus({preventScroll:!0}))},[e]),(0,b.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function Do({context:e,children:t}){let n=De(),a=Ze("/").replace(/\/$/,""),r=(0,K.useContext)(Fo),o=(0,K.useMemo)(()=>{let d=(s,c)=>{if("record"in s){let m=e.store.graph.getNode(s.record);return m?Vt(_(e.store.schema,m.kind,s.record),{section:c?.section}):void 0}if("place"in s){let m=e.views?.places().find(v=>v.as===s.place);return m?Vt(ge(e,m),c):void 0}return e.store.schema.tryDefinition(s.list)?Vt(`/${V(e.store.schema,s.list)}`,c):void 0},l=s=>{s!==void 0&&n(s)};return{record:(s,c)=>l(d({record:s},c)),place:(s,c)=>l(d({place:s},c)),list:(s,c)=>l(d({list:s},c)),draft:()=>n("/~draft"),href:(s,c)=>{let m=r===!1?void 0:d(s,c);if(m!==void 0)return r?r(m):`${a}${m}`}}},[e,n,a,r]);return(0,b.jsx)(qa.Provider,{value:o,children:t})}function ss(){let{pathname:e,search:t,hash:n}=ue();return(0,K.useEffect)(()=>{let a=decodeURIComponent(n.replace(/^#/,""));if(!(!a||a.includes("=")))return wo(a)},[e,t,n]),null}function ls({context:e,Home:t}){let n=ue(),a=e.views,r=n.key==="default"&&!(a&&Ba(a));(0,K.useEffect)(()=>{a&&Ga(a)},[a]);let o=r?$a(e.views?.arrangement?.()?.first,e.store.schema,e.views?.places()??[]):void 0,d=o?.to==="place"?ge(e,o.place):o?.to==="kind"?`/${V(e.store.schema,o.kind)}`:void 0;return d?(0,b.jsx)(Kn,{to:d,replace:!0}):(0,b.jsx)(t,{context:e})}function Wo({context:e,registry:t}){let n=t?.lookupSurface("shell"),a=n!==void 0,r=a&&(t?.without().has("bar")??!1),o=a&&!r&&!e.embedded?{...e,barAbove:!0}:e,d=N=>n===void 0?(0,b.jsx)(Qt,{context:e,children:N}):r?(0,b.jsx)(n,{context:e,children:N}):(0,b.jsx)(Qt,{context:e,children:(0,b.jsx)(n,{context:o,children:N})}),l=t?.lookupSurface("home")??Zn,s=t?.lookupSurface("problems")??ea,c=a?{...o,framed:!0}:e,[m,v]=(0,K.useState)(null),w=(0,K.useMemo)(()=>({context:c,registry:t}),[c,t]),g=(0,K.useMemo)(()=>({onFind:v,find:!(t?.without().has("find")??!1),places:!(t?.without().has("places")??!1)}),[t]),P=(0,b.jsx)(Gn.Provider,{value:w,children:(0,b.jsx)(Do,{context:e,children:(0,b.jsx)(rs,{context:e,registry:t,children:d((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ar,{face:"pages"}),(0,b.jsxs)(Ji,{context:c,children:[(0,b.jsx)(is,{}),(0,b.jsx)(ss,{}),(0,b.jsxs)(io,{children:[(t?.routes()??[]).map(({path:N,component:U})=>(0,b.jsx)(Re,{path:N,element:(0,b.jsx)(U,{context:c})},N)),(0,b.jsx)(Re,{path:"/",element:(0,b.jsx)(ls,{context:c,Home:l})}),(0,b.jsx)(Re,{path:"/problems",element:(0,b.jsx)(s,{context:c})}),(0,b.jsx)(Re,{path:"/~draft",element:(0,b.jsx)(K.Suspense,{fallback:null,children:(0,b.jsx)(Qi,{context:c})})}),(0,b.jsx)(Re,{path:"/search",element:(0,b.jsx)(Xn,{context:c})}),(0,b.jsx)(Re,{path:"/map",element:(0,b.jsx)(Qn,{context:c})}),(0,b.jsx)(Re,{path:"/places",element:(0,b.jsx)(zn,{context:c})}),Te(c).some(N=>N.as===Pn)?null:(0,b.jsx)(Re,{path:Ea,element:(0,b.jsx)(Kn,{to:"/",replace:!0})}),(0,b.jsx)(Re,{path:"/places/:as",element:(0,b.jsx)(Yn,{context:c})}),(0,b.jsx)(Re,{path:"/:slug",element:(0,b.jsx)(Io,{context:c,registry:t,page:"list"})}),(0,b.jsx)(Re,{path:"/:slug/:id",element:(0,b.jsx)(Io,{context:c,registry:t,page:"record"})})]})]})]}))})})});return e.embedded||!a||r?P:(0,b.jsx)(co.Provider,{value:g,children:(0,b.jsx)(Sr.Provider,{value:m,children:P})})}var ds=()=>typeof document>"u"?null:document.body;function cs({context:e,registry:t,basename:n,initialPath:a,onNavigate:r,path:o,steering:d,firstLook:l,hrefOf:s}){let[c,m]=(0,K.useState)(void 0),v=c!==void 0&&c.from===e.principal?{...e,principal:c.seat}:e;(0,K.useState)(()=>v.views?Gr(v.views,v.store.schema,En(v.brand,v.store.schema)):void 0);let w=se();wa({reader:v.locale??w?.locale,app:v.brand?.locale??v.app?.brand?.locale,readerTimeZone:v.timeZone??w?.timeZone,appTimeZone:v.brand?.timeZone??v.app?.brand?.timeZone});let g=v.principal??Zi,P=Fa(v.store,g,v.history),U=(P.past&&P.live===v.store?P.past.store:v.store).seenBy(g),u=U===v.store?v:{...v,store:U};Da(v.store,v.principal);let M=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(as,{onNavigate:r,path:o}),d?(0,b.jsx)(es,{steering:d}):null,u.presence||w?(0,b.jsx)(ts,{context:u,to:w}):null,(0,b.jsx)(Wo,{context:u,...t?{registry:t}:{}}),l?(0,b.jsx)(qr,{firstLook:l,root:ds,app:En(v.brand,v.store.schema)}):null]}),j=u.views?(0,b.jsxs)(Wa,{store:u.store,views:u.views,...u.principal?{principal:u.principal}:{},...u.brand?{brand:u.brand}:{},...u.locale?{locale:u.locale}:{},...u.timeZone?{timeZone:u.timeZone}:{},...u.settings?{settings:u.settings}:{},...u.presence&&!w?{presence:u.presence}:{},...u.people?{people:u.people}:{},...u.seats?{seats:u.seats}:{},onSeat:oe=>w?w.takeSeat(oe):m({from:e.principal,seat:oe}),...u.onKeepLens?{onKeepLens:u.onKeepLens}:{},...u.ai?{ai:u.ai}:{},...u.subscriptions?{subscriptions:u.subscriptions}:{},...u.signIn?{signIn:u.signIn}:{},resolveApp:u.resolveApp??w?.resolveApp,linkedRecords:u.linkedRecords??w?.linkedRecords,...u.app?{app:u.app}:{},...u.menuSections?{menuSections:u.menuSections}:{},children:[M,(0,b.jsx)(Do,{context:u,children:(0,b.jsx)(vo,{context:u})})]}):M,C=(0,b.jsx)(Ia.Provider,{value:P,children:j}),D=u.files?(0,b.jsx)(Ha.Provider,{value:u.files,children:C}):C,ne=s===void 0?D:(0,b.jsx)(Fo.Provider,{value:s,children:D});if(a!==void 0){let oe=n===void 0?a:`${n.replace(/\/$/,"")}${a}`;return(0,b.jsx)(oo,{initialEntries:[oe],...n===void 0?{}:{basename:n},children:ne})}return(0,b.jsx)(so,{...n===void 0?{}:{basename:n},children:ne})}export{ci as a,cs as b};
|
|
@@ -1 +1 @@
|
|
|
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{s as P}from"./chunk.
|
|
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{s as P}from"./chunk.5AGW4NRZ.js";import{$ as I,Da as S,G as M,O as w,R as y,_ as m,s as b,w as T,x as A}from"./chunk.Y4ZUJUUT.js";import{a as p}from"./chunk.SDO3U72B.js";import{b as f}from"./chunk.AJZBJBMO.js";var C=f(M(),1),h=f(y(),1),x=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.T42S2WMB.js")))),O=x.part((e,n)=>(0,h.jsx)(e.Timeline,{...n}),{what:"The timeline"}),q=()=>x.prefetch();function K({face:e}){return w()?.open?(0,h.jsx)(C.Suspense,{fallback:null,children:(0,h.jsx)(O,{face:e})}):null}var i=f(M(),1),u=f(y(),1),v=new WeakMap,D=e=>{let n=v.get(e);return n||v.set(e,n={ask:null,doors:[],listeners:new Set}),n},k=e=>{for(let n of e.listeners)n()};function g(e,n){let t=D(e);t.ask=n,k(t)}var N=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.Z6TMIAAB.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.DNROW6LX.js")))),B=N.part((e,n)=>{let t=e.NotifySheet;return(0,u.jsx)(t,{...n})},{what:"Notify me"}),W=N.part((e,n)=>{let t=e.NotifiedList;return(0,u.jsx)(t,{...n})},{quiet:!0}),E=(e,n)=>n===void 0&&(e.onBehalfOf??e).id!==void 0;function F(e,n,t){let c=d=>t.tryDefinition(d)?.noun??d.replace(/[-_]+/g," "),o=e.on!==void 0?e.on:e.about.length===1?e.about[0]:void 0;if(e.act!==void 0){let d=o!==void 0&&n(o)!==void 0?o:void 0;return{label:"Notify me when someone does this\u2026",choices:[{on:"act",act:e.act,...d!==void 0?{record:d}:{}},...d!==void 0?[{on:"act",act:e.act}]:[]]}}if(o===void 0)return null;let s=n(o);if(s!==void 0)return{label:"Notify me when this changes\u2026",choices:[{on:"changed",record:o},{on:"act",record:o},{on:"reaches",kind:s,condition:"",record:o}]};let r=b(o)!==null?[b(o)]:T(o)?A(o):[];if(r.length!==1||!t.kinds.includes(r[0]))return null;let l=r[0],a=c(l);return{label:`Notify me when ${/^[aeiou]/i.test(a)?"an":"a"} ${a} is added\u2026`,choices:[{on:"created",kind:l},{on:"changed",kind:l},{on:"reaches",kind:l,condition:""}]}}function L(){let{store:e,principal:n,subscriptions:t,signIn:c}=m(),o=E(n,c);return(0,i.useMemo)(()=>o?s=>{let r=F(s,a=>e.graph.getNode(a)?.kind,e.schema);return r?{id:"notify",items:[{id:"notify-me",label:r.label,run:()=>g(t,{choices:r.choices,returnTo:s.element??null})}],prepare:()=>N.prefetch()}:null}:null,[o,e,t])}var z=[];function U({children:e}){let n=L(),t=(0,i.useMemo)(()=>n?[n]:z,[n]);return(0,u.jsx)(P,{sections:t,children:e})}function V(){let{subscriptions:e}=m(),n=(0,i.useId)(),t=D(e);(0,i.useEffect)(()=>(t.doors.push(n),k(t),()=>{t.doors.splice(t.doors.indexOf(n),1),k(t)}),[t,n]);let c=(0,i.useMemo)(()=>r=>(t.listeners.add(r),()=>void t.listeners.delete(r)),[t]),o=(0,i.useSyncExternalStore)(c,()=>t.ask,()=>null),s=(0,i.useSyncExternalStore)(c,()=>t.doors[0]===n,()=>!1);return!o||!s?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(B,{ask:o,close:()=>g(e,null)})})}function X({choices:e,label:n="Notify me",style:t,className:c,testId:o="notify-me"}){let{principal:s,subscriptions:r,signIn:l}=m();return E(s,l)?(0,u.jsx)("button",{type:"button","data-testid":o,className:c,onClick:a=>g(r,{choices:e,returnTo:a.currentTarget}),style:t,children:n}):null}function G(){let e=I(),n=e?.subscriptions,t=e?(e.principal.onBehalfOf??e.principal).id:void 0,[c,o]=(0,i.useState)(0);return(0,i.useEffect)(()=>{if(t===void 0||!n)return;let s=!0,r=()=>void Promise.resolve(n.list(t)).then(a=>s&&o(a.length),()=>s&&o(0));r();let l=n.onChange?.(r);return()=>{s=!1,l?.()}},[n,t]),c}function Y({style:e}){return G()===0?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(W,{...e?{style:e}:{}})})}export{q as a,K as b,L as c,U as d,V as e,X as f,G as g,Y as h};
|