graview 0.1.41 → 0.1.42
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.22QEYFWI.js +1 -0
- package/dist/preview/{chunk.YWNHCZQ5.js → chunk.27P37343.js} +1 -1
- package/dist/preview/{chunk.D25XEVKO.js → chunk.2ZGICECC.js} +1 -1
- package/dist/preview/{chunk.2GQPLTV3.js → chunk.35FR36BQ.js} +1 -1
- package/dist/preview/chunk.36LP3I7Z.js +21 -0
- package/dist/preview/{chunk.JDRLSVOI.js → chunk.37NF3YXZ.js} +1 -1
- package/dist/preview/chunk.3JATXDSP.js +1 -0
- package/dist/preview/{chunk.VCX3HEIE.js → chunk.3K2KBIRG.js} +1 -1
- package/dist/preview/chunk.3SKUJWFC.js +1 -0
- package/dist/preview/{chunk.BQRAIU5R.js → chunk.3WABA2WQ.js} +1 -1
- package/dist/preview/{chunk.FFZBOP65.js → chunk.4NBB44YU.js} +1 -1
- package/dist/preview/chunk.4QEDYRES.js +349 -0
- package/dist/preview/{chunk.BELCPW66.js → chunk.4YBP552Z.js} +2 -2
- package/dist/preview/{chunk.57R2GXXN.js → chunk.4YRCKOX2.js} +1 -1
- package/dist/preview/{chunk.WVDKYUF3.js → chunk.57R4ZUMM.js} +1 -1
- package/dist/preview/{chunk.VNUHESMZ.js → chunk.5FHH5NR6.js} +1 -1
- package/dist/preview/{chunk.DMF35E7D.js → chunk.5NDYYTT4.js} +1 -1
- package/dist/preview/{chunk.RQGTHRRJ.js → chunk.6HUS5UHZ.js} +1 -1
- package/dist/preview/{chunk.YYFLTMNN.js → chunk.6MLAJKYM.js} +1 -1
- package/dist/preview/{chunk.F2MQJH6Y.js → chunk.6NF32PAT.js} +1 -1
- package/dist/preview/chunk.6WB24MS3.js +1 -0
- package/dist/preview/{chunk.Z7LDT55A.js → chunk.7EB6SDUQ.js} +1 -1
- package/dist/preview/chunk.7HZVCW3Q.js +1 -0
- package/dist/preview/{chunk.4Q7XJJZY.js → chunk.7MJM3OVC.js} +1 -1
- package/dist/preview/chunk.7OSL64QH.js +1 -0
- package/dist/preview/chunk.7XDNCCLG.js +6 -0
- package/dist/preview/{chunk.XOYJ26YB.js → chunk.7Z2GTKA4.js} +1 -1
- package/dist/preview/{chunk.GT2BITLW.js → chunk.AOC2KUFE.js} +1 -1
- package/dist/preview/{chunk.6FNMDAX5.js → chunk.AQTCN7KQ.js} +1 -1
- package/dist/preview/{chunk.5RABSIF7.js → chunk.ARTJL3X2.js} +1 -1
- package/dist/preview/{chunk.7YIFF6BF.js → chunk.AWSUMY3D.js} +1 -1
- package/dist/preview/{chunk.3ZILIZZ6.js → chunk.B65HPL4I.js} +1 -1
- package/dist/preview/{chunk.4QPVS2ZM.js → chunk.B6DKKNVR.js} +1 -1
- package/dist/preview/{chunk.W3FTEJH5.js → chunk.B7DCQJXV.js} +1 -1
- package/dist/preview/chunk.BBLIT7S7.js +1 -0
- package/dist/preview/chunk.BJET6KOG.js +1 -0
- package/dist/preview/{chunk.I7XSDXQ3.js → chunk.BZ4VZ6WQ.js} +1 -1
- package/dist/preview/{chunk.67WWRC6Y.js → chunk.CAZX6OPN.js} +1 -1
- package/dist/preview/{chunk.TN5PYGU7.js → chunk.CSWX7YGI.js} +1 -1
- package/dist/preview/chunk.D3ELYLME.js +1 -0
- package/dist/preview/{chunk.5P556A7W.js → chunk.DNMBZONP.js} +1 -1
- package/dist/preview/{chunk.5QXWMC6C.js → chunk.DXAUXGNN.js} +1 -1
- package/dist/preview/{chunk.C4TSM4W5.js → chunk.EC2T2UVH.js} +2 -2
- package/dist/preview/chunk.EHMCRUYR.js +1 -0
- package/dist/preview/{chunk.BK6RWVRE.js → chunk.EQIQPY4O.js} +1 -1
- package/dist/preview/{chunk.53CDFJNM.js → chunk.ETWOZQWL.js} +1 -1
- package/dist/preview/{chunk.6YPLZNVT.js → chunk.EVHXF7LZ.js} +1 -1
- package/dist/preview/{chunk.EQ4UAWRB.js → chunk.FFRWSODT.js} +1 -1
- package/dist/preview/chunk.G4AY6NGN.js +1 -0
- package/dist/preview/{chunk.DGCMEDQA.js → chunk.GN2SZEFH.js} +1 -1
- package/dist/preview/{chunk.B5724ULM.js → chunk.GXWOEOUY.js} +1 -1
- package/dist/preview/{chunk.ISXFH3CK.js → chunk.HAY22FPJ.js} +1 -1
- package/dist/preview/{chunk.42XSBKPO.js → chunk.HG2IO5NS.js} +1 -1
- package/dist/preview/{chunk.EAH47SCN.js → chunk.HOTOH7ZB.js} +1 -1
- package/dist/preview/chunk.HQMGTPDC.js +117 -0
- package/dist/preview/{chunk.C2PECN4C.js → chunk.I7QCXRP7.js} +1 -1
- package/dist/preview/{chunk.O75JKQPF.js → chunk.IGA7OD3L.js} +1 -1
- package/dist/preview/{chunk.HKCK3JI4.js → chunk.ILPD5CZG.js} +1 -1
- package/dist/preview/chunk.IQ3LUSD6.js +6 -0
- package/dist/preview/chunk.IWLVZGW5.js +1 -0
- package/dist/preview/chunk.IXS5XBG6.js +1 -0
- package/dist/preview/{chunk.ZHLQWMV5.js → chunk.J7ZMNAWB.js} +1 -1
- package/dist/preview/{chunk.UEXIKCLF.js → chunk.JCTT2LAK.js} +1 -1
- package/dist/preview/{chunk.FOQZADMA.js → chunk.JE4QQEJE.js} +1 -1
- package/dist/preview/{chunk.LPYVOBWB.js → chunk.JEBB3WM7.js} +1 -1
- package/dist/preview/{chunk.OW7NSJ4H.js → chunk.JPD2I4Z7.js} +1 -1
- package/dist/preview/{chunk.LPNIEPYI.js → chunk.K63BUJBF.js} +2 -2
- package/dist/preview/{chunk.HI7X6PLZ.js → chunk.KMGGP6XT.js} +2 -2
- package/dist/preview/{chunk.OF34OZ4V.js → chunk.KSXB4LDF.js} +1 -1
- package/dist/preview/{chunk.PMGXASFI.js → chunk.KZDLDXLB.js} +1 -1
- package/dist/preview/{chunk.BFNVG5JE.js → chunk.L6HKDIZB.js} +1 -1
- package/dist/preview/{chunk.2FLPDPEL.js → chunk.LFJH6X6O.js} +1 -1
- package/dist/preview/{chunk.M4T377LG.js → chunk.LKGDN25E.js} +1 -1
- package/dist/preview/{chunk.HEVC6HHP.js → chunk.LMUFLZYT.js} +1 -1
- package/dist/preview/chunk.LQGXUMUX.js +1 -0
- package/dist/preview/{chunk.ZRYSVOLA.js → chunk.LWAZ6ZO6.js} +2 -2
- package/dist/preview/{chunk.33KXSD6F.js → chunk.LZH65VSN.js} +1 -1
- package/dist/preview/{chunk.H5HWN7A2.js → chunk.MUBZIU6F.js} +1 -1
- package/dist/preview/chunk.MZ6I2Q4E.js +1 -0
- package/dist/preview/{chunk.UWW6ZEPY.js → chunk.NS3Z7QNP.js} +1 -1
- package/dist/preview/{chunk.7LIKEE5Z.js → chunk.NTJNBKWC.js} +1 -1
- package/dist/preview/chunk.O7VHAKSA.js +2 -0
- package/dist/preview/{chunk.Q4TZHWQX.js → chunk.OMCXJGDI.js} +1 -1
- package/dist/preview/chunk.OTHGZPUC.js +1 -0
- package/dist/preview/{chunk.PMDNFN7Z.js → chunk.P6FGIYWP.js} +1 -1
- package/dist/preview/{chunk.C7JKMOFC.js → chunk.P6J6VFF5.js} +1 -1
- package/dist/preview/{chunk.LOCSF3BR.js → chunk.P7ISPJAQ.js} +1 -1
- package/dist/preview/{chunk.HB7ELBVK.js → chunk.PACJFDDU.js} +1 -1
- package/dist/preview/{chunk.2RVUDRRY.js → chunk.PCTVLNOS.js} +1 -1
- package/dist/preview/{chunk.BXT6FDT4.js → chunk.PH5ITX3N.js} +1 -1
- package/dist/preview/chunk.PYFQGBU3.js +1 -0
- package/dist/preview/{chunk.L4STJLUV.js → chunk.QHLD4TZW.js} +1 -1
- package/dist/preview/{chunk.AIZQBPGU.js → chunk.QHP7AJUV.js} +1 -1
- package/dist/preview/{chunk.AKQXF7GW.js → chunk.QXMTGLHR.js} +1 -1
- package/dist/preview/{chunk.MSP73H5Z.js → chunk.RFCTUGMU.js} +1 -1
- package/dist/preview/chunk.ROHM3ETN.js +49 -0
- package/dist/preview/{chunk.SIGC3G7S.js → chunk.RR4RZH4S.js} +1 -1
- package/dist/preview/chunk.RRCPEHM4.js +1 -0
- package/dist/preview/{chunk.LOSMUESM.js → chunk.S5K4FLLG.js} +1 -1
- package/dist/preview/{chunk.ZRLXVYPG.js → chunk.SUQU4AXG.js} +1 -1
- package/dist/preview/{chunk.TIH2PDFH.js → chunk.SZKVNPEF.js} +1 -1
- package/dist/preview/chunk.T3F6BKIO.js +1 -0
- package/dist/preview/{chunk.V3V47QRE.js → chunk.U3MQUIJL.js} +1 -1
- package/dist/preview/{chunk.H5ADMSE7.js → chunk.U6YOAS4X.js} +1 -1
- package/dist/preview/chunk.UG727PEE.js +5 -0
- package/dist/preview/{chunk.NGDXH66B.js → chunk.V3K32XD7.js} +1 -1
- package/dist/preview/{chunk.QIV65FWE.js → chunk.V5VQCANB.js} +1 -1
- package/dist/preview/{chunk.RCM7NOPF.js → chunk.VEP4EJ2N.js} +1 -1
- package/dist/preview/chunk.VKJAGZNU.js +2 -0
- package/dist/preview/{chunk.N2K25KH3.js → chunk.VMBIFUYX.js} +1 -1
- package/dist/preview/{chunk.MUKDKVVC.js → chunk.VO6DBVZR.js} +1 -1
- package/dist/preview/{chunk.UUBYFBPN.js → chunk.VTUMPH4Z.js} +1 -1
- package/dist/preview/{chunk.3Q75TIGL.js → chunk.VXZFW52D.js} +1 -1
- package/dist/preview/{chunk.USZPOOLZ.js → chunk.VYPR2MZO.js} +1 -1
- package/dist/preview/chunk.W77OH637.js +1 -0
- package/dist/preview/{chunk.HPAGOEZG.js → chunk.WERBD5ZR.js} +1 -1
- package/dist/preview/{chunk.WUKHYLQT.js → chunk.WODEO2JF.js} +2 -2
- package/dist/preview/{chunk.JACGQ2PR.js → chunk.WUQOSVQU.js} +2 -2
- package/dist/preview/{chunk.N6MVK3KD.js → chunk.WVN62OMH.js} +1 -1
- package/dist/preview/{chunk.Z5AB2DBF.js → chunk.WZEA2UK6.js} +1 -1
- package/dist/preview/{chunk.VJXXCUKS.js → chunk.X2M7IOQA.js} +1 -1
- package/dist/preview/chunk.X5WIS4BC.js +1 -0
- package/dist/preview/{chunk.UHI3D7JC.js → chunk.XDPIS7RS.js} +1 -1
- package/dist/preview/{chunk.VIYECFKZ.js → chunk.XNW7PUAF.js} +1 -1
- package/dist/preview/chunk.XPML6T3P.js +1 -0
- package/dist/preview/{chunk.XEKLEHC3.js → chunk.Y2QDZLSY.js} +1 -1
- package/dist/preview/{chunk.2NB7U4EW.js → chunk.YJM23BJL.js} +1 -1
- package/dist/preview/chunk.YLGSXLXF.js +1 -0
- package/dist/preview/chunk.YLI6I6XP.js +1 -0
- package/dist/preview/chunk.YRYEWVNP.js +1 -0
- package/dist/preview/chunk.Z2TYCMBT.js +5 -0
- package/dist/preview/chunk.ZAFIZXGX.js +1 -0
- package/dist/preview/{chunk.I4JBWTZM.js → chunk.ZBYLAC3B.js} +1 -1
- package/dist/preview/chunk.ZOS5APMD.js +1 -0
- package/dist/preview/{chunk.TGVUIFKD.js → chunk.ZQCGDTQ3.js} +1 -1
- package/dist/preview/chunk.ZRIDKFTV.js +1 -0
- package/dist/preview/index.html +45 -45
- package/dist/preview/page.js +3 -3
- package/package.json +6 -6
- package/dist/preview/chunk.242EUAPE.js +0 -1
- package/dist/preview/chunk.2FGYWAID.js +0 -1
- package/dist/preview/chunk.4EEWBCT2.js +0 -1
- package/dist/preview/chunk.6CRRPXKP.js +0 -1
- package/dist/preview/chunk.6RID3OWK.js +0 -1
- package/dist/preview/chunk.A4UIM35E.js +0 -1
- package/dist/preview/chunk.DL26BKT7.js +0 -1
- package/dist/preview/chunk.H7POIT3V.js +0 -1
- package/dist/preview/chunk.HFYUAK5Z.js +0 -6
- package/dist/preview/chunk.HPUN5DKZ.js +0 -117
- package/dist/preview/chunk.J2CR4RRH.js +0 -1
- package/dist/preview/chunk.J4IULZFD.js +0 -1
- package/dist/preview/chunk.JHEVGLKB.js +0 -345
- package/dist/preview/chunk.JLBGJSCZ.js +0 -1
- package/dist/preview/chunk.JYJ4LZJJ.js +0 -5
- package/dist/preview/chunk.L3A6YLMT.js +0 -21
- package/dist/preview/chunk.LOZJQ5ZX.js +0 -1
- package/dist/preview/chunk.MUPO5S2A.js +0 -47
- package/dist/preview/chunk.O6F3K6CU.js +0 -1
- package/dist/preview/chunk.OVTCW3AI.js +0 -1
- package/dist/preview/chunk.QHYXXZRD.js +0 -1
- package/dist/preview/chunk.S2U5CEP4.js +0 -1
- package/dist/preview/chunk.SADG5RMV.js +0 -1
- package/dist/preview/chunk.SCYQSXW4.js +0 -1
- package/dist/preview/chunk.T3BWINOF.js +0 -1
- package/dist/preview/chunk.TNESS3LQ.js +0 -2
- package/dist/preview/chunk.UTWPZULC.js +0 -1
- package/dist/preview/chunk.V4KLBSC4.js +0 -1
- package/dist/preview/chunk.V5MYKNL7.js +0 -5
- package/dist/preview/chunk.VDAMCTNL.js +0 -1
- package/dist/preview/chunk.W4HBRXMY.js +0 -1
- package/dist/preview/chunk.XFZKP4IF.js +0 -2
- package/dist/preview/chunk.XQTMO5PW.js +0 -1
- package/dist/preview/chunk.Z7BCIYDW.js +0 -1
- package/dist/preview/chunk.ZOR6FKNI.js +0 -1
- package/dist/preview/chunk.ZTMEESII.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graview",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.42",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Graview command line: start a product, check its declaration, write its agent docs, serve its store, preview a document with no product and photograph its places, say whether a product is on one release, host it for an agent over MCP, apply an act to it, sync its seed, install the authoring skills. The tool; @graview/* is the framework.",
|
|
6
6
|
"keywords": [
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@graview/
|
|
33
|
-
"@graview/
|
|
34
|
-
"@graview/
|
|
35
|
-
"@graview/
|
|
36
|
-
"@graview/tools": "0.1.
|
|
32
|
+
"@graview/ship": "0.1.42",
|
|
33
|
+
"@graview/skills": "0.1.42",
|
|
34
|
+
"@graview/guest": "0.1.42",
|
|
35
|
+
"@graview/core": "0.1.42",
|
|
36
|
+
"@graview/tools": "0.1.42"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=22"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Se,b as Pe,c as Ge,d as ge,e as F,f as Ce,h as Ne}from"./chunk.VDAMCTNL.js";import{h as Ie,i as qe,j as Ve}from"./chunk.UHI3D7JC.js";import{a as se,b as re,c as Z,d as _e,e as Y,g as ne,h as Be}from"./chunk.ZHLQWMV5.js";import{c as Me,h as g,i as Te,j as me}from"./chunk.TNESS3LQ.js";import{Fa as De,Ga as ee,Ha as fe,Kb as ue,Lb as Ke,b as L,c as q,e as xe,f as Ee,g as C,h as j,k as T,l as X,m as G,n as Ae,o as V,p as K,r as k,s as Q,t as E,u as R,v as I,w as P,x as n,y as U,ya as Fe,z as Re}from"./chunk.V5MYKNL7.js";var ln=e=>Object.entries(e).map(([o,s])=>[o,Object.keys(ee(s?.edges))]),ze=(e,o)=>Ke(e,ln(o));var ye="graview-document",be=1,ke=256*1024,he=64*1024,$e=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,we=/^[a-z][A-Za-z0-9]*$/,pn=new Set(["id","kind"]),fn=e=>e in Object.prototype,Ze=U(e=>!fn(e),"every object already has this name \u2014 choose another"),Ye=(e,o)=>[...e===void 0?[]:[Ee(e)],...o===void 0?[]:[xe(o)]],h=(e,o)=>j().check(...Ye(e,o)),v=(e,o,s)=>K(e).check(...Ye(o,s)),D=e=>j().check(C($e,`${e} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),un=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,W=j().check(C(un,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),Ze),N=j().check(C(we,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),U(e=>!pn.has(e),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),Ze),B=h(1,500),H=h(1,2e3),ae=h(1,300),mn=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"],Je=k({type:I(mn),required:n(G()),description:n(B),label:n(h(1,60)),options:n(v(h(1,80),1,100)),of:n(I(["string","number","date","image","video","file"])),default:n(V()),unit:n(h(void 0,12)),format:n(I(["money","percent","duration","markdown"])),min:n(T()),max:n(T()),step:n(T()),renamedFrom:n(j().check(C(we))),repeats:n(G())}).check(Re((e,o)=>{e.type==="enum"&&!e.options&&o.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),e.type!=="enum"&&e.options&&o.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),e.type!=="list"&&e.of&&o.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),e.repeats&&e.type!=="date"&&e.type!=="datetime"&&o.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),gn=j().check(C(new RegExp(`${$e.source}|${Fe.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),zn=k({to:E([v(gn,1),P("*")]),cardinality:n(I(["one","many"])),description:n(B),inverse:n(h(1,80)),appendOnly:n(G()),renamedFrom:n(j()),tidying:n(P("never"))}),He=E([H,k({expr:H,label:n(h(1,60)),description:n(B)})]),hn=k({noun:n(h(1,40)),plural:n(h(1,40)),description:n(B),fields:R(N,Je).check(U(e=>Object.keys(e).length>0,"a kind has at least one field")),label:n(ae),describe:n(ae),lifecycle:n(k({field:N,retired:v(E([j(),T(),G()]),1)})),figure:n(h(void 0,2e4)),glance:n(v(N,1,20)),page:n(k({fields:n(v(N,1,40)),groups:n(v(k({title:h(1,60),fields:v(N,1,40)}),1,12))})),edges:n(R(W,zn)),computed:n(R(j(),He).check(U(e=>Object.keys(e).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:n(R(j(),j())),renamedFrom:n(j().check(C($e))),people:n(G()),archives:n(P(!1)),tidying:n(I(["never","no-links"]))}),te=E([j(),T(),G(),Ae(),K(V()),k({expr:H})]),J=j().check(C(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),yn=E([k({create:D("kind"),as:n(j().check(C(we))),set:n(R(N,te))}),k({set:R(N,te),target:n(J)}),k({connect:W,from:J,to:J}),k({sever:W,from:J,to:J}),k({remove:J})]),bn=k({title:n(h(1,80)),description:n(B),fromTheOtherEnd:n(h(1,80)),on:n(E([D("kind"),v(D("kind"),1)])),creates:n(D("kind")),sets:n(R(N,te)),writes:n(v(N,1)),connects:n(W),severs:n(W),setsOther:n(R(N,te)),replaces:n(E([P(!0),v(W,1,10)])),removes:n(P(!0)),args:n(R(N,Je)),effects:n(v(yn,1,20)),allowedWhen:n(H),refusal:n(ae),destructive:n(G())}),kn=k({act:D("act"),label:n(h(1,80)),args:n(R(j(),te))}),$n=k({title:n(h(1,120)),description:n(B),over:E([P("graph"),D("kind")]),when:n(H),require:H,says:n(ae),repairs:n(v(kn,void 0,10))}),wn=k({roles:E([v(D("role"),1),P("*")]),mutations:E([v(D("act"),1),P("*")]),kinds:n(E([K(D("kind")),P("*")])),describe:n(B),self:n(G()),ownEnd:n(G())}),Le=n(v(D("field"),1)),jn=k({roles:E([v(D("role"),1),P("*")]),kinds:v(D("kind"),1),own:n(G()),via:n(W),fields:Le,hide:Le}),On=k({grants:K(wn),sees:n(K(jn))}),vn=k({accent:n(j().check(C(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),name:n(h(1,60)),currency:n(j().check(C(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(h(2,35)),timeZone:n(h(1,64)),logo:n(E([h(1,he),k({src:h(1,he),alt:n(h(1,120))})])),favicon:n(E([h(1,he),k({emoji:j()})])),typography:n(k({display:n(h(1,200)),body:n(h(1,200)),mono:n(h(1,200))})),shape:n(k({radius:n(T().check(q(0),L(32))),density:n(T().check(q(.75),L(1.5)))})),accents:n(R(j(),T().check(q(0),L(360)))),scheme:n(I(["light","dark","auto"]))}),ie=R(j(),V()),Ue=E([h(1,120),k({by:h(1,120),direction:n(I(["asc","desc"]))})]),We=T().check(X(),q(1),L(9999)),Sn=Q({create:n(G()),options:n(Q({sort:n(Ue),columnSort:n(Ue),search:n(v(h(1,120),void 0,40)),filters:n(v(h(1,120),void 0,40)),horizon:n(E([T().check(X(),q(1),L(200)),Q({years:T().check(X(),q(1),L(200)),title:h(1,80),from:n(We),to:n(We)})]))}))}),xn=k({card:n(K(V())),row:n(K(V())),page:n(K(V()))}),En=()=>{let e=n(I(["asc","desc"]));return E([h(1,120),k({by:h(1,120),direction:e,then:n(E([h(1,120),k({by:h(1,120),direction:e})]))})])},An=()=>E([h(1,120),k({by:h(1,120),order:n(v(h(1,80),void 0,40)),closed:n(v(h(1,80),void 0,40))})]),Rn=Q({order:n(K(j())),hide:n(K(j())),first:n(j()),primary:n(v(h(1,80),void 0,40)),scene:n(h(1,40)),pages:n(h(1,40)),lists:n(R(j(),k({filters:n(v(h(1,120),void 0,40)),sort:n(En()),group:n(An())})))}),Xe=k({$schema:n(j()),format:P(ye),formatVersion:P(be),name:h(1,80),description:n(B),version:n(T().check(X(),q(1))),kinds:R(D("kind"),hn).check(U(e=>Object.keys(e).length>0,"a document declares at least one kind"),U(e=>Object.keys(e).length<=40,"a document declares at most 40 kinds")),computed:n(R(j(),He)),acts:n(R(D("act"),bn)),rules:n(R(D("rule"),$n)),roles:n(K(D("role"))),policy:n(On),modules:n(ie),lenses:n(K(Sn)),pages:n(Rn),views:n(R(j(),E([xn,K(V())]))),brand:n(vn),settings:n(K(ie)),migrations:n(K(ie)),connections:n(R(D("connection"),ie))});var Fn={};function Qe(e,o=Fn,s=be){let{document:a,respelled:l}=Se(e),p=l.length>0?{respelled:l}:{};if(!a||typeof a!="object"||Array.isArray(a))return{document:a};let u=a;if(u.format!==ye||typeof u.formatVersion!="number"||u.formatVersion>=s)return{document:a,...p};let z=u.formatVersion,$=structuredClone(u);for(let r=z;r<s;r++){let t=o[r];if(!t)throw new Error(`there is no upgrade from format ${r} to ${r+1}`);$={...t($),formatVersion:r+1}}return{document:$,from:z,...p}}function en(e,o,s){let a=Object.keys(e).filter(z=>e[z].edges?.[o]!==void 0);if(a.length===0)return;let l=a.map(z=>e[z].edges[o].to),p=l.some(z=>z==="*")?"*":[...new Set(l.flatMap(z=>z))];if(s.length===0||s.some(z=>a.includes(z)))return{reversed:!1,kinds:p};let u=a.filter(z=>{let $=e[z].edges[o].to;return $==="*"||s.every(r=>$.includes(r))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:p}}var on=(e,o)=>{let s=e?.fields[o];return s!==void 0&&(s.type==="duration"||(s.type==="number"||s.type==="integer")&&s.format==="duration")};function nn(e,o,s,a){if(a==="out"){let l=e[o]?.edges?.[s]?.to;return l===void 0?[]:l==="*"?Object.keys(e):l}return Object.entries(e).filter(([,l])=>{let p=l.edges?.[s]?.to;return p!==void 0&&(p==="*"||p.includes(o))}).map(([l])=>l)}function je(e,o,s){if(s.t==="ident")return e[o]?.edges?.[s.name]?nn(e,o,s.name,"out"):void 0;if(s.t==="where")return je(e,o,s.set);if(s.t==="call"&&(s.fn==="out"||s.fn==="in")&&s.args[0]?.t==="lit"&&typeof s.args[0].value=="string")return nn(e,o,s.args[0].value,s.fn)}var tn=(e,o,s)=>{let a=o.filter(l=>e[l]?.fields[s]!==void 0);return a.length>0&&a.every(l=>on(e[l],s))};function sn(e,o,s){let a=e.kinds,l=a[o],p=new Map(s),u=new Map,z=(r,t)=>{if(t>8)return!1;switch(r.t){case"ident":return on(l,r.name)||$(r.name,t+1);case"member":{let d=je(a,o,r.object);return d!==void 0&&tn(a,d,r.name)}case"call":{if(r.fn!=="sum"&&r.fn!=="min"&&r.fn!=="max")return!1;let[d,w]=r.args,f=d&&je(a,o,d);return f!==void 0&&w?.t==="ident"&&tn(a,f,w.name)}case"binary":return(r.op==="+"||r.op==="-")&&z(r.left,t)&&z(r.right,t);case"unary":return r.op==="-"&&z(r.operand,t);default:return!1}},$=(r,t)=>{if(l?.computed?.[r]===void 0)return!1;if(u.has(r))return u.get(r);u.set(r,!1);let d=p.get(r),w=d!==void 0&&z(d,t);return u.set(r,w),w};return s.map(([r])=>r).filter(r=>$(r,0))}function rn(e,o,s=`kinds.${e}.page`){let a=o.page;if(!a)return[];let l=[],p=[...Object.keys(o.fields),...Object.keys(o.computed??{})],u=new Set,z=(r,t)=>{p.includes(r)?u.has(r)&&l.push(g("page-field-twice",t,`"${r}" is on ${e}'s page twice; name each field once`)):l.push(g("page-field",t,`${e}'s page is to show "${r}", and ${e} has no field or computed field called that`,`use one of: ${p.join(", ")}`)),u.add(r)};(a.fields??[]).forEach((r,t)=>z(r,`${s}.fields.${t}`));let $=new Set;return(a.groups??[]).forEach((r,t)=>{let d=r.title.trim().toLowerCase();$.has(d)&&l.push(g("page-group-twice",`${s}.groups.${t}.title`,`${e}'s page has two groups called "${r.title}"; give each its own title`)),$.add(d),r.fields.forEach((w,f)=>z(w,`${s}.groups.${t}.fields.${f}`))}),l}var Dn=new Set(["subject","now","today","me"]);function Kn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>ke)return{findings:[g("too-large","",`a document may be at most ${ke/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(a){return{findings:[g("not-json","",`this is not JSON: ${a.message}`)]}}try{e=Qe(e).document}catch(a){return{findings:[g("format","formatVersion",a.message)]}}let o=Xe.safeParse(e);if(!o.success)return{findings:o.error.issues.map(a=>{let l=a.path.map(String).join(".");if(a.code==="unrecognized_keys")return g("unknown-key",l,`${a.keys.map(p=>`"${p}"`).join(", ")} ${a.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(a.code==="invalid_union"&&/\.effects\.\d+$/.test(l))return g("effect-shape",l,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(a.code==="invalid_key"){let p=a.issues?.[0]?.message;return g("shape",l,`the name "${String(a.path.at(-1))}" is not allowed here${p?`: ${p}`:""}`)}return g("shape",l,a.message)})};let s=o.data;return{document:s,findings:Mn(s)}}var de=e=>[e??[]].flat();function an(e){let o=new Map;for(let[s,a]of Object.entries(e.kinds))for(let[l,p]of Object.entries(ee(a.edges))){let u=o.get(l);o.set(l,{name:l,from:[...u?.from??[],s],to:p.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...p.to])],cardinality:p.cardinality??"many"})}return o}function ht(e){let o=new Map;for(let[a,l]of Object.entries(e.kinds)){let p=ne(l),u=fe(l.edges);o.set(a,{fields:new Set([...Object.keys(l.fields),...u.keys()]),edges:new Map(Object.entries(ee(l.edges)).map(([z,$])=>[z,$.cardinality??"many"])),...p?{computed:p}:{},...u.size>0?{linked:u}:{}})}let s=ne(e);return s&&o.set(Me,{computed:s}),o}function cn(e,o){let s=[],a=de(e.on),l=(p,u)=>{let z=en(o.kinds,p,a)?.reversed===!0,[$,r]=z?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:p,from:$,to:r}:{sever:p,from:$,to:r}};if(e.creates){let p=o.kinds[e.creates],u={};for(let z of Object.keys(p?.fields??{}))u[z]=`$${z}`;for(let z of e.effects??[])"set"in z&&!("create"in z)&&F(z.target)==="new"&&Object.assign(u,z.set);s.push({create:e.creates,as:"new",set:u})}return e.sets&&s.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&s.push({set:Object.fromEntries(e.writes.map(p=>[p,`$${p}`]))}),e.connects&&(e.replaces&&s.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),s.push(l(e.connects,"connect"))),e.severs&&s.push(l(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&s.push({set:e.setsOther,target:"$to"}),e.removes&&s.push({remove:"$subject"}),e.effects&&s.push(...e.effects.filter(p=>!(e.creates&&"set"in p&&!("create"in p)&&F(p.target)==="new"))),s}function Oe(e,o,s){try{let a=Z(e),l=se(a);for(let p of l.unknownFunctions)s.push(g("unknown-function",o,`"${p}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return a}catch(a){if(a instanceof re){s.push(g("expression",o,a.sentence+` (at character ${a.at+1})`));return}throw a}}function ve(e,o,s){try{return Y(e)}catch(a){if(a instanceof _e||a instanceof re){s.push(g("template",o,(a instanceof re,a.sentence)));return}throw a}}function Mn(e){let o=[],s=new Set(Object.keys(e.kinds)),a=an(e),l=e.acts??{},p=new Set(e.roles??[]),u=(r,t)=>fe(e.kinds[r]?.edges).has(t),z=r=>Object.keys(e.kinds).some(t=>u(t,r));for(let[r,t]of Object.entries(e.kinds)){let d=`kinds.${r}`;for(let[f,c]of Object.entries(t.edges??{})){if(!De(c)&&c.to!=="*")for(let i of c.to)s.has(i)||o.push(g("edge-target",`${d}.edges.${f}.to`,`"${i}" is not a kind this document declares`));t.fields[f]&&o.push(g("edge-field-clash",`${d}.edges.${f}`,`"${f}" is both a field and a relation of ${r}`,"rename one of them"))}t.lifecycle&&!t.fields[t.lifecycle.field]&&o.push(g("lifecycle-field",`${d}.lifecycle.field`,`${r} has no field "${t.lifecycle.field}"`));let w=f=>t.computed!==void 0&&Object.hasOwn(t.computed,f);for(let f of t.glance??[])!t.fields[f]&&!w(f)&&o.push(g("glance-field",`${d}.glance`,`a glance at ${r} is to say "${f}", and ${r} has no field or computed field called that`,`use one of: ${[...Object.keys(t.fields),...Object.keys(t.computed??{})].join(", ")}`));o.push(...rn(r,t));for(let f of["label","describe"]){let c=t[f];if(!c)continue;let i=ve(c,`${d}.${f}`,o);for(let A of i??[])if(A.expr){for(let y of se(A.expr).names)if(!t.fields[y]){if(w(y)){Be(t,y)||o.push(g("template-field",`${d}.${f}`,`${r}'s ${y} is worked out from beyond the record, and a ${f} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${r}'s own fields`));continue}o.push(g("template-field",`${d}.${f}`,`${r} has no field "${y}" for its ${f} to show`,f==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[f,c]of Object.entries(t.fields)){c.default!==void 0&&c.type==="enum"&&!c.options?.includes(String(c.default))&&o.push(g("default-option",`${d}.fields.${f}.default`,`"${String(c.default)}" is not one of ${f}'s options`));let i=`${f}Repeat`;c.repeats&&(t.fields[i]||t.edges?.[i]||t.computed?.[i])&&o.push(g("repeat-clash",`${d}.fields.${f}.repeats`,`${r} already has "${i}", where how ${f} repeats is kept`))}}for(let[r,t]of Object.entries(l)){let d=`acts.${r}`;for(let i of de(t.on))s.has(i)||o.push(g("act-kind",`${d}.on`,`"${i}" is not a kind this document declares`));let w=de(t.on),f=cn(t,e);if(t.creates&&t.on===void 0&&t.writes&&s.has(t.creates)){for(let i of t.writes)if(!e.kinds[t.creates].fields[i])if(e.kinds[t.creates].computed?.[i]!==void 0)o.push(g("computed-written",`${d}.writes`,`${t.creates}'s ${i} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(t.creates,i))continue;o.push(g("act-field",`${d}.writes`,`${t.creates} has no field "${i}"`))}}f.length===0&&o.push(g("act-empty",d,`"${r}" does nothing`,"give it effects or a shorthand such as sets or creates"));let c=new Map;f.forEach((i,A)=>{let y=f.length-(t.effects?.length??0),O=t.effects&&A>=y?`${d}.effects.${A-y}`:d;if("create"in i){if(!s.has(i.create))o.push(g("act-kind",`${O}.create`,`"${i.create}" is not a kind this document declares`));else for(let b of Object.keys(i.set??{}))e.kinds[i.create].fields[b]||(e.kinds[i.create].computed?.[b]!==void 0?o.push(g("computed-written",`${O}.set.${b}`,`${i.create}'s ${b} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):o.push(g("act-field",`${O}.set.${b}`,`${i.create} has no field "${b}"`)));i.as&&c.set(i.as,i.create)}else if("connect"in i||"sever"in i){let b="connect"in i?i.connect:i.sever;!a.has(b)&&!z(b)&&o.push(g("act-edge",`${O}.${"connect"in i?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),F(i.from)==="subject"&&w.length===0&&o.push(g("act-subject",`${d}.on`,`"${r}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in i){let b=F(i.target??"$subject"),le=b==="subject"?w:c.has(b??"")?[c.get(b)]:[];b==="subject"&&w.length===0&&o.push(g("act-subject",`${d}.on`,`"${r}" changes "$subject" but does not say which kinds it is "on"`));for(let _ of Object.keys(i.set))for(let m of le)if(!(!s.has(m)||e.kinds[m].fields[_]))if(e.kinds[m].computed?.[_]!==void 0)o.push(g("computed-written",`${O}.set.${_}`,`${m}'s ${_} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(m,_))continue;o.push(g("act-field",`${O}.set.${_}`,`${m} has no field "${_}"`))}}else"remove"in i&&F(i.remove)==="subject"&&w.length===0&&o.push(g("act-subject",`${d}.on`,`"${r}" removes "$subject" but does not say which kinds it is "on"`));("set"in i&&i.set?Object.values(i.set):[]).forEach(b=>{b&&typeof b=="object"&&!Array.isArray(b)&&"expr"in b&&Oe(b.expr,`${O}.set`,o)})}),t.allowedWhen&&Oe(t.allowedWhen,`${d}.allowedWhen`,o),t.refusal&&ve(t.refusal,`${d}.refusal`,o)}for(let[r,t]of Object.entries(e.rules??{})){let d=`rules.${r}`;t.over!=="graph"&&!s.has(t.over)&&o.push(g("rule-kind",`${d}.over`,`"${t.over}" is not a kind this document declares`));let w=t.over==="graph"?void 0:e.kinds[t.over];for(let f of["when","require"]){let c=t[f];if(!c)continue;let i=Oe(c,`${d}.${f}`,o);if(!i)continue;let A=se(i);for(let y of A.names)if(t.over==="graph")o.push(g("rule-name",`${d}.${f}`,`"${y}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(w&&!w.fields[y]&&!w.edges?.[y]&&w.computed?.[y]===void 0){let O=Object.keys(w.edges??{}).find(S=>S.includes("-")&&S.split("-").includes(y));o.push(g("rule-name",`${d}.${f}`,`${t.over} has no field or relation called "${y}"`,O?`"${O}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${O.replace(/-([a-z0-9])/g,(S,b)=>b.toUpperCase())}"`:void 0))}for(let y of A.edges)!a.has(y)&&!z(y)&&o.push(g("rule-edge",`${d}.${f}`,`"${y}" is not a relation any kind declares`));for(let y of A.sweeps)s.has(y)?t.over!=="graph"&&o.push(Te("rule-cost",`${d}.${f}`,`this rule looks at every ${y} for every ${t.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):o.push(g("rule-kind",`${d}.${f}`,`"${y}" is not a kind this document declares`))}t.says&&ve(t.says,`${d}.says`,o),(t.repairs??[]).forEach((f,c)=>{!l[f.act]&&!ue(f.act)&&!ze(f.act,e.kinds)&&o.push(g("repair-act",`${d}.repairs.${c}.act`,`"${f.act}" is not an act this document declares`))})}let $=e.policy;return $&&($.grants.forEach((r,t)=>{if(r.roles!=="*"&&p.size>0)for(let d of r.roles)p.has(d)||o.push(g("grant-role",`policy.grants.${t}.roles`,`"${d}" is not one of the document's roles`));if(r.mutations!=="*")for(let d of r.mutations)!l[d]&&!ue(d)&&!ze(d,e.kinds)&&o.push(g("grant-act",`policy.grants.${t}.mutations`,`"${d}" is not an act this document declares`))}),($.sees??[]).forEach((r,t)=>{for(let d of r.kinds)s.has(d)||o.push(g("sight-kind",`policy.sees.${t}.kinds`,`"${d}" is not a kind this document declares`));if(r.roles!=="*"&&p.size>0)for(let d of r.roles)p.has(d)||o.push(g("sight-role",`policy.sees.${t}.roles`,`"${d}" is not one of the document's roles`))})),o.push(...Ve(e)),o}function Tn(e,o,s,a){let l=new Map,p=de(e.on),u=new Map,z=new Map;(p.length>0||o.some(c=>"remove"in c&&F(c.remove)==="subject"||"from"in c&&(F(c.from)==="subject"||F(c.to)==="subject")||"set"in c&&!("create"in c)&&F(c.target??"$subject")==="subject"))&&l.set(ge,{ref:p.length>0?p:"*",required:!0});let r=e.args??{},t=e.writes?.length===1,d=(c,i)=>i&&c.type===i.type&&c.min===void 0&&c.max===void 0&&c.step===void 0?{...c,...i.min===void 0?{}:{min:i.min},...i.max===void 0?{}:{max:i.max},...i.step===void 0?{}:{step:i.step}}:c,w=(c,i)=>i&&c.type===i.type&&c.format===void 0&&c.unit===void 0?{...d(c,i),...i.format?{format:i.format}:{},...i.unit?{unit:i.unit}:{}}:d(c,i),f=(c,i,A)=>{if(c===ge||Dn.has(c)||u.has(c)||l.has(c))return;let y=r[c]?w(r[c],A):void 0;l.set(c,y?{field:y,optional:!y.required,required:!!y.required}:i())};for(let c of o)if("create"in c){let i=s.kinds[c.create];for(let[A,y]of Object.entries(c.set??{})){let O=F(y),S=i?.fields[A];if(O&&S){let b=!!S.required&&S.default===void 0;f(O,()=>({field:S,optional:!b,required:b}),S)}}c.as&&u.set(c.as,c.create)}else if("connect"in c||"sever"in c){let i=a.get("connect"in c?c.connect:c.sever);for(let[A,y]of[["from",c.from],["to",c.to]]){let O=F(y);if(!O)continue;let S=A==="to"?i?.to??"*":i?.from??"*";S!=="*"&&!z.has(O)&&z.set(O,S),f(O,()=>({ref:S,required:!0}))}}else if("set"in c){let i=F(c.target??"$subject"),A=i==="subject"?p[0]:u.get(i??"")??z.get(i??"")?.[0];i&&i!=="subject"&&!u.has(i)&&f(i,()=>({ref:"*",required:!0}));for(let[y,O]of Object.entries(c.set)){let S=F(O);if(!S)continue;let b=A?s.kinds[A]?.fields[y]:void 0;f(S,()=>b?{field:b,optional:!t,required:t}:{any:!0,required:!1},b)}}else if("remove"in c){let i=F(c.remove);i&&f(i,()=>({ref:"*",required:!0}))}for(let[c,i]of Object.entries(r))l.has(c)||l.set(c,{field:i,optional:!i.required,required:!!i.required});return l}function yt(e,o={}){let s=Kn(e);if(!s.document||me(s.findings))return{ok:!1,findings:s.findings};let a=s.document,l=[...s.findings];o.previous&&l.push(...Gn(a,o.previous));let p=Pn(a,l);return me(p.findings)?{ok:!1,findings:p.findings}:Ne(p,o)}function ce(e,o){return e.map(s=>{let a=!s.format&&s.expr?.t==="ident"?o?.[s.expr.name]?.format:void 0;return a==="money"||a==="percent"?{...s,format:a}:s})}function Pn(e,o){let s=an(e),a={};for(let[r,t]of Object.entries(e.kinds)){let d=Ce(t),w=t.label??(d?`{${d}}`:void 0),f=ne(t),c=f?sn(e,r,[...f]):[];a[r]={...w?{label:ce(Y(w),t.fields)}:{},...t.describe?{describe:ce(Y(t.describe),t.fields)}:{},...f?{computed:[...f]}:{},...c.length>0?{durations:c}:{}}}let l={};for(let[r,t]of Object.entries(e.acts??{})){let d=cn(t,e),w=Tn(t,d,e,s),f=t.destructive??d.some(m=>"remove"in m||"sever"in m||"replace"in m),c=[...new Set(d.flatMap(m=>"create"in m?[m.create]:[]))],i=[...new Set(d.flatMap(m=>"connect"in m?[m.connect]:[]))],A=[...new Set(d.flatMap(m=>"sever"in m?[m.sever]:"replace"in m?m.replace:[]))],y=[...new Set(d.flatMap(m=>"set"in m&&!("create"in m)&&F(m.target??"$subject")==="subject"?Object.keys(m.set):[]))],O=new Map;for(let m of d){if(!("connect"in m)&&!("sever"in m))continue;let x=s.get("connect"in m?m.connect:m.sever);for(let[M,dn]of[["from",m.from],["to",m.to]]){let oe=F(dn),pe=M==="to"?x?.to:x?.from;oe&&oe!=="subject"&&pe&&pe!=="*"&&O.set(oe,[...new Set([...O.get(oe)??[],...pe])])}}let S={};for(let m of d){if(!("set"in m)||"create"in m)continue;let x=F(m.target??"$subject");for(let M of x&&x!=="subject"&&O.get(x)||[])S[M]=[...new Set([...S[M]??[],...Object.keys(m.set)])]}let b={};for(let m of d)if(!(!("set"in m)||"create"in m||F(m.target??"$subject")!=="subject"))for(let[x,M]of Object.entries(m.set??{}))typeof M=="string"&&F(M)===void 0||typeof M=="number"||typeof M=="boolean"?b[x]=typeof M=="string"&&M.startsWith("$$")?M.slice(1):M:delete b[x];let le=c.length===0&&d.every(m=>!("set"in m)||!m.set||Object.values(m.set).every(x=>!(x&&typeof x=="object"&&!Array.isArray(x)&&"expr"in x))),_=new Map;for(let m of d)if(!(!("set"in m)||!m.set))for(let x of Object.values(m.set))x&&typeof x=="object"&&!Array.isArray(x)&&"expr"in x&&_.set(x.expr,Z(x.expr));l[r]={title:t.title??r.replace(/-/g," "),effects:d,args:[...w],...t.allowedWhen?{guard:Z(t.allowedWhen)}:{},...t.refusal?{refusal:ce(Y(t.refusal),e.kinds[[t.on??[]].flat()[0]??""]?.fields)}:{},exprs:[..._],destructive:f,idempotent:le,creates:c,connects:i,severs:A,writes:y,writesOther:S,sets:b}}let p={};for(let[r,t]of Object.entries(e.rules??{}))p[r]={title:t.title??r.replace(/-/g," "),require:Z(t.require),...t.when?{when:Z(t.when)}:{},...t.says?{says:ce(Y(t.says),e.kinds[t.over]?.fields)}:{}};let u=Pe(e,o),z=Ie(e),$=qe(e);return{format:Ge,document:e,findings:o,kinds:a,...e.computed?{facts:[...ne(e)??[]]}:{},edges:[...s].map(([r,{from:t,to:d,cardinality:w}])=>[r,{from:t,to:d,cardinality:w}]),acts:l,rules:p,brand:u,...Object.keys(z).length>0?{viewSpecs:z}:{},...$?{home:$}:{}}}function bt(e,o,s){let a=/^defineNode\("([^"]+)"\)/.exec(o)?.[1],l=a?s.kinds[a]:void 0;if(!a||!l)return e;let p=Object.keys(l.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${a}.glance`,fix:`Say which: "glance": [${p.map(u=>`"${u}"`).join(", ")}] on kinds.${a} \u2014 the facts a person compares one by, at a glance.`}}function Gn(e,o){let s=[],a=new Set(Object.values(o.kinds).flatMap(l=>Object.keys(l.edges??{})));for(let[l,p]of Object.entries(e.kinds)){let u=p.renamedFrom;u&&!o.kinds[u]&&s.push(g("renamed-from-nothing",`kinds.${l}.renamedFrom`,`${l} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let z=o.kinds[u??l];for(let[$,r]of Object.entries(p.fields)){let t=r.renamedFrom;t&&!z?.fields[t]&&s.push(g("renamed-from-nothing",`kinds.${l}.fields.${$}.renamedFrom`,`${$} says it was ${t}, and the previous ${u??l} has no field called ${t}`,"name the field it was, or drop renamedFrom"))}for(let[$,r]of Object.entries(p.edges??{})){let t=r.renamedFrom;t&&!a.has(t)&&s.push(g("renamed-from-nothing",`kinds.${l}.edges.${$}.renamedFrom`,`${$} says it was ${t}, and the previous version has no relation called ${t}`,"name the relation it was, or drop renamedFrom"))}}return s}export{Kn as a,ht as b,cn as c,yt as d,bt as e};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as b,b as c,c as d,d as e,e as f}from"./chunk.242EUAPE.js";import"./chunk.VDAMCTNL.js";import"./chunk.UHI3D7JC.js";import"./chunk.ZHLQWMV5.js";import"./chunk.TNESS3LQ.js";import{tb as a}from"./chunk.V5MYKNL7.js";import"./chunk.AJZBJBMO.js";export{a as ActRefusal,e as compileDocumentWithoutCheck,d as effectsOf,f as inDocumentWords,c as kindShapes,b as readDocument};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as l,K as p,R as k,S as y,c}from"./chunk.MUPO5S2A.js";import"./chunk.JYJ4LZJJ.js";import"./chunk.UGFDSE37.js";import{b as m}from"./chunk.USZPOOLZ.js";import"./chunk.C4TSM4W5.js";import"./chunk.XEKLEHC3.js";import"./chunk.53CDFJNM.js";import"./chunk.4QPVS2ZM.js";import"./chunk.RCM7NOPF.js";import"./chunk.Z7LDT55A.js";import"./chunk.BQRAIU5R.js";import"./chunk.57R2GXXN.js";import"./chunk.BFNVG5JE.js";import"./chunk.AIZQBPGU.js";import"./chunk.V3V47QRE.js";import"./chunk.5P556A7W.js";import"./chunk.QHYXXZRD.js";import"./chunk.BELCPW66.js";import"./chunk.6YPLZNVT.js";import"./chunk.5RABSIF7.js";import"./chunk.NGDXH66B.js";import"./chunk.67WWRC6Y.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.N6MVK3KD.js";import"./chunk.I7XSDXQ3.js";import"./chunk.UHI3D7JC.js";import"./chunk.WVDKYUF3.js";import"./chunk.ZHLQWMV5.js";import"./chunk.TNESS3LQ.js";import"./chunk.GZHZLJBF.js";import"./chunk.42XSBKPO.js";import"./chunk.OJGHDWI6.js";import"./chunk.6FNMDAX5.js";import"./chunk.2FLPDPEL.js";import"./chunk.UUBYFBPN.js";import"./chunk.2RVUDRRY.js";import"./chunk.JHEVGLKB.js";import{$ as g,G as S,H as s,I as d,R as f}from"./chunk.FOQZADMA.js";import"./chunk.SDO3U72B.js";import"./chunk.V5MYKNL7.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as t}from"./chunk.SDO3U72B.js";var d=t(()=>(__graviewPreload(import.meta.url,["./chunk.HFYUAK5Z.js","./chunk.GAFYE37S.js","./chunk.ZRLXVYPG.js","./chunk.S2U5CEP4.js","./chunk.H7POIT3V.js","./chunk.W4HBRXMY.js","./chunk.D25XEVKO.js","./chunk.PXQVXBNG.js","./chunk.SDO3U72B.js","./chunk.V5MYKNL7.js","./chunk.AJZBJBMO.js"]),import("./chunk.L3A6YLMT.js")));function v(i,r){let e=!1,n=()=>{window.removeEventListener("online",n),e||o()},o=()=>void i().then(m=>{e||r(m)},()=>{e||window.addEventListener("online",n)});return o(),()=>{e=!0,window.removeEventListener("online",n)}}export{d as a,v as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as n}from"./chunk.HPUN5DKZ.js";import"./chunk.MUPO5S2A.js";import"./chunk.JYJ4LZJJ.js";import"./chunk.UGFDSE37.js";import{l as s}from"./chunk.USZPOOLZ.js";import"./chunk.C4TSM4W5.js";import"./chunk.XEKLEHC3.js";import"./chunk.53CDFJNM.js";import"./chunk.4QPVS2ZM.js";import"./chunk.RCM7NOPF.js";import"./chunk.Z7LDT55A.js";import"./chunk.PXQVXBNG.js";import"./chunk.BQRAIU5R.js";import"./chunk.57R2GXXN.js";import"./chunk.BFNVG5JE.js";import"./chunk.AIZQBPGU.js";import"./chunk.V3V47QRE.js";import"./chunk.5P556A7W.js";import"./chunk.QHYXXZRD.js";import"./chunk.BELCPW66.js";import"./chunk.6YPLZNVT.js";import"./chunk.5RABSIF7.js";import"./chunk.NGDXH66B.js";import"./chunk.67WWRC6Y.js";import"./chunk.QIV65FWE.js";import"./chunk.UT6642FC.js";import"./chunk.ISXFH3CK.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.N6MVK3KD.js";import"./chunk.I7XSDXQ3.js";import"./chunk.UHI3D7JC.js";import"./chunk.WVDKYUF3.js";import"./chunk.ZHLQWMV5.js";import"./chunk.TNESS3LQ.js";import"./chunk.GZHZLJBF.js";import"./chunk.42XSBKPO.js";import"./chunk.OJGHDWI6.js";import"./chunk.6FNMDAX5.js";import"./chunk.2FLPDPEL.js";import"./chunk.UUBYFBPN.js";import"./chunk.2RVUDRRY.js";import"./chunk.JHEVGLKB.js";import{G as y,R as i}from"./chunk.FOQZADMA.js";import"./chunk.SDO3U72B.js";import"./chunk.V5MYKNL7.js";import{b as r}from"./chunk.AJZBJBMO.js";var c=r(y(),1),e=r(i(),1);function v({store:d,views:t,as:a,scope:o}){let l=(0,c.useMemo)(()=>s({scope:`.${o}`}),[o]);return(0,e.jsxs)("div",{"data-testid":"embed-picture","data-embed-content":"",tabIndex:0,"aria-label":t.places().find(m=>m.as===a)?.title??"The picture",style:{flex:"1 1 auto",minHeight:0,display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)"},children:[(0,e.jsx)("style",{children:l}),(0,e.jsx)(n,{store:d,views:t,as:a})]})}export{v as PictureFace};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk.W3FTEJH5.js";import"./chunk.H5ADMSE7.js";import"./chunk.JHEVGLKB.js";import"./chunk.FOQZADMA.js";import"./chunk.SDO3U72B.js";import"./chunk.V5MYKNL7.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as q,b as z}from"./chunk.HFYUAK5Z.js";import{a as $,e as K}from"./chunk.ZRLXVYPG.js";import{e as L,f as E,g as N}from"./chunk.S2U5CEP4.js";import{a as D,b as j}from"./chunk.6CRRPXKP.js";import"./chunk.W4HBRXMY.js";import{$ as b,G as B,M as F,O as P,R as A,ga as x,ja as V,ka as T,wa as G}from"./chunk.FOQZADMA.js";import"./chunk.SDO3U72B.js";import"./chunk.V5MYKNL7.js";import{b as W}from"./chunk.AJZBJBMO.js";var s=W(B(),1);var i=W(A(),1),J=e=>({...e.node?{node:{id:e.node.id}}:{},...e.nodes?{nodes:e.nodes.map(t=>({id:t.id}))}:{},...e.label!==void 0?{label:e.label}:{},fidelity:e.fidelity,cardinality:e.cardinality,mode:e.mode,selected:e.selected,...e.implicated?{implicated:e.implicated}:{},...e.flagged?{flagged:e.flagged}:{}});function H(e){let t=P(),r=t?.past?.seq,a=t?.host?.viewAt,n=(0,s.useMemo)(()=>r===void 0||!a||e.draft?void 0:a(e.manifest.name,r),[a,r,e]);return(0,s.useMemo)(()=>n===null?null:n===void 0?e:{...e,worker:n},[n,e])}function I({definition:e,store:t,principal:r,input:a,goTo:n,places:o,scheme:l,brand:u,onFailure:d,drawsItsOwn:m,tick:w}){let p=(0,s.useRef)(null),f=(0,s.useRef)(null),y=F(),c=(0,s.useRef)({input:a,goTo:n,places:o,onFailure:d,brand:u,hostFiles:y});c.current={input:a,goTo:n,places:o,onFailure:d,brand:u,hostFiles:y},(0,s.useEffect)(()=>{let S=p.current;if(!S)return;let C=e.file??(c.current.hostFiles?.src?g=>c.current.hostFiles?.src?.(g)??g:void 0),M=j(D,({mountWorkerView:g})=>{f.current=g(S,{manifest:e.manifest,worker:e.worker,store:t,principal:r,input:()=>c.current.input?.()??{},goTo:()=>c.current.goTo,places:()=>c.current.places?.()??[],brand:()=>c.current.brand,onFailure:(R,O)=>c.current.onFailure(R,O),...m?{fallback:!1}:{},...e.limits?{limits:e.limits}:{},...e.author?{author:e.author}:{},...e.onProblem?{onProblem:e.onProblem}:{},...e.asset?{asset:e.asset}:{},...C?{file:C}:{},...e.images?{images:e.images}:{},files:()=>c.current.hostFiles})});return()=>{M(),f.current?.dispose(),f.current=null}},[e,t,r]),(0,s.useEffect)(()=>f.current?.update(),[l,u,w]);let k=(0,i.jsx)("div",{ref:p,"data-worker-view-place":e.manifest.name});if(!e.draft)return k;let h=e.manifest.title??e.manifest.name;return(0,i.jsxs)("div",{role:"group","aria-label":`Draft: ${h}`,"data-graview-draft-view":e.manifest.name,style:{display:"grid",gap:8,alignContent:"start",minWidth:0},children:[(0,i.jsxs)("p",{"data-testid":"draft-view-line",style:_,children:[(0,i.jsxs)("span",{children:["Draft \u2014 ",(0,i.jsx)("span",{style:{color:"var(--graview-ink)",fontWeight:600},children:h})]}),(0,i.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,i.jsx)("span",{children:"Not kept"})]}),k]})}var _={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};function v(e,t={}){let r=t.fallback,a=e.manifest.replaces==="page";function n(o){let l=b(),u=x(),d=(0,s.useContext)(G),[m,w]=(0,s.useState)(null),p=(0,s.useRef)(o);p.current=o;let f=H(e);if(!l)return null;if(f===null)return r&&!(d&&V(r)&&!a)?(0,i.jsx)(r,{...o}):null;if(m&&r)return d&&V(r)&&!a?null:(0,i.jsx)(r,{...o});let y=t.beside&&!(d&&V(t.beside))?t.beside:void 0,c=(0,i.jsx)(I,{definition:f,store:l.store,principal:l.principal,input:()=>J(p.current),goTo:u,places:()=>l.views.places(),scheme:l.scheme,brand:l.brand,tick:o,drawsItsOwn:r!==void 0,onFailure:(k,h)=>{w(k),e.onFailure?.(k,h)}});return y?(0,i.jsxs)("div",{"data-worker-view-beside":e.manifest.name,style:{display:"grid",gap:12,minWidth:0},children:[c,(0,i.jsx)(y,{...o})]}):c}return n.displayName=`WorkerView(${e.manifest.name})`,n}function Q(e,t){let{manifest:r}=t;if(r.attach==="home"){if(!e.home)throw new Error(`The worker view "${r.name}" is the home's body: draw it with workerHome, on the home.`);let d=t.draft?void 0:e.homeView?.();return e.home(v(t,d?{fallback:d}:{})),e}let a={cardinality:r.cardinality,fidelity:"full"},n=e.lookup(r.attach,a)??e.resolve(r.attach,a)?.view,o=r.cardinality==="one",l=t.draft===!0,u=v(t,{...n&&!l?{fallback:n}:{},...o&&r.replaces!=="page"&&n?{beside:n}:{}});return e.register(r.attach,a,o&&r.replaces==="page"?T(u):u,r.title?{title:r.title,...l?{}:{name:r.name},lens:"view",...r.reads?.kinds?.length?{reads:r.reads.kinds}:{}}:void 0),e}function U(e,t={}){let r=t.fallback;function a({context:n}){let o=b(),l=x(),[u,d]=(0,s.useState)(null),m=H(e);return(u||m===null)&&r?(0,i.jsx)(r,{context:n}):m===null?null:(0,i.jsx)(I,{definition:m,store:n.store,principal:n.principal??o?.principal??{kind:"human"},goTo:l,...o?{places:()=>o.views.places(),scheme:o.scheme,brand:o.brand}:{},drawsItsOwn:r!==void 0,onFailure:(w,p)=>{d(w),e.onFailure?.(w,p)}})}return a.displayName=`WorkerHome(${e.manifest.name})`,a}export{E as checkManifest,q as checkViewSource,K as judgeCodeAct,L as manifestActs,Q as registerWorkerView,$ as sightIsTotal,z as viewScript,U as workerHome,v as workerView,N as workerViewProps};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{gc as p}from"./chunk.V5MYKNL7.js";var b=1,v="allow-scripts",G="null";function w(e){return typeof e=="object"&&e!==null&&e.graview==="guest-ready"}function x(){let e=new Uint8Array(16);return globalThis.crypto.getRandomValues(e),Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function T(e,r){if(!e)return;let o={..."filter"in r&&r.filter?{filter:r.filter}:{},...r.section?{section:r.section}:{}};"record"in r?e.record(r.record,o):"list"in r?e.list(r.list,o):e.place(r.place,o)}var h=[["accent","--graview-accent"],["ground","--graview-ground"],["panel","--graview-panel"],["ink","--graview-ink"],["inkMuted","--graview-ink-muted"],["edge","--graview-edge"],["fontBody","--graview-font-body"],["fontDisplay","--graview-font-display"],["fontMono","--graview-font-mono"],["radius","--graview-radius"]];function O(e){let r=e.ownerDocument.defaultView,o=r.getComputedStyle(e),a=e.closest("[data-graview-scheme]")?.getAttribute("data-graview-scheme"),d={scheme:a==="dark"||a==="light"?a:/\bdark\b/.test(o.colorScheme??"")?"dark":/\blight\b/.test(o.colorScheme??"")?"light":r.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"};for(let[y,u]of h)d[y]=o.getPropertyValue(u).trim();return d}function P(e,r){let o=e.defaultView;if(!o||typeof o.MutationObserver!="function")return()=>{};let a=new o.MutationObserver(r);a.observe(e.documentElement,{attributes:!0,subtree:!0,attributeFilter:["data-graview-scheme","data-theme"]});let s=o.matchMedia?.("(prefers-color-scheme: dark)");return s?.addEventListener?.("change",r),()=>{a.disconnect(),s?.removeEventListener?.("change",r)}}function A(e,r,o){let a=r?.(),s=o.url(a?.logo);return{...e(),...a?.name?{name:a.name}:{},...s?{logo:s}:{}}}function H(e,r,o){let a,s,d=t=>{t?.startsWith("blob:")&&e.URL.revokeObjectURL(t)},y=async t=>{if(t.startsWith("<"))return p(t)===null?new e.Blob([t],{type:"image/svg+xml"}):void 0;if(/\\|%2e/i.test(t)||t.split(/[?#]/)[0].split("/").some(c=>c==="."||c===".."))return;let n=new e.URL(t,e.document.baseURI);if(n.origin!==e.location.origin||!/^https?:$/.test(n.protocol))return;let i=await e.fetch(n.href,{credentials:"same-origin"}),l=(i.headers.get("content-type")??"").split(";")[0].trim();return i.ok&&l.startsWith("image/")?new e.Blob([await i.arrayBuffer()],{type:l}):void 0},u=t=>new Promise(n=>{let i=new e.Image;i.onload=()=>n(!0),i.onerror=()=>n(!1),e.setTimeout(()=>n(!1),2e3),i.src=t}),f=t=>new Promise((n,i)=>{let l=new e.FileReader;l.onload=()=>n(String(l.result)),l.onerror=i,l.readAsDataURL(t)}),m=async t=>{if(/^data:image\//i.test(t))return t;let n=await y(t);if(!(!n||a!==t)){if(o==="blob"){let i=e.URL.createObjectURL(n);if(await u(i))return i;e.URL.revokeObjectURL(i)}return f(n)}},g=(t,n)=>{if(a!==t)return d(n);n!==s&&(d(s),s=n,r())};return{url(t){let n=t?.trim()||void 0;return n!==a&&(a=n,n?m(n).then(i=>g(n,i),()=>g(n,void 0)):(d(s),s=void 0)),s},dispose(){a=void 0,d(s),s=void 0}}}export{b as a,v as b,G as c,w as d,x as e,T as f,O as g,P as h,A as i,H as j};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};function r(t){let i=[];return typeof t!="string"?["A view's source is text."]:(/\bimport\b/.test(t)&&i.push("It says import: a view loads nothing, so the word may not appear in it at all, even in a string or a comment."),/\bimportScripts\b/.test(t)&&i.push("It names importScripts: a view loads nothing."),/^\s*export\b/m.test(t)&&i.push("It exports something: a view is a plain script that draws through the graview global, not a module."),/\brequire\s*\(/.test(t)&&i.push("It calls require(): a view has no modules to require."),i)}var e,n=()=>e??=(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.XQTMO5PW.js")).catch(t=>{throw e=void 0,t});async function o(t){let{VIEW_RUNTIME:i}=await n();return`${i}
|
|
2
|
-
;(function () {
|
|
3
|
-
"use strict";
|
|
4
|
-
${t}
|
|
5
|
-
})();
|
|
6
|
-
`}export{r as a,o as b};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{A as Vt,B as Pe,C as Nn,D as Ke,E as Ue,F as ni,G as $n,H as Le,I as ai,J as ri,K as F,L as ct,M as On,N as ii,O as Fn,P as Ut,Q as oi,R as ae,S as ie,T as In,a as Y,b as $e,c as Z,d as Qr,e as Mn,f as En,g as dt,h as J,i as ke,j as re,k as C,l as te,m as K,n as Se,o as Kt,p as xe,q as fe,r as Jr,s as ft,t as qt,u as Q,v as Ve,w as ei,x as Bt,y as Re,z as ti}from"./chunk.MUPO5S2A.js";import{b as Tn,c as Zr,d as Xr,e as Gt,g as ne}from"./chunk.JYJ4LZJJ.js";import{a as zr,d as _r,e as Yr}from"./chunk.UGFDSE37.js";import{a as qr,c as Br,f as Gr,g as Vr,i as Ur,j as jr}from"./chunk.USZPOOLZ.js";import{a as Nr,b as $r,c as Or,d as Ln}from"./chunk.C4TSM4W5.js";import{b as Er}from"./chunk.XEKLEHC3.js";import{a as Fr,b as Ir,d as It,e as Wr,f as Dr,i as Wt}from"./chunk.53CDFJNM.js";import{a as Dt,b as Ht}from"./chunk.PXQVXBNG.js";import{a as Lt,b as qa,c as Ba,d as Tt,e as Ga}from"./chunk.BQRAIU5R.js";import{b as er,c as dr,e as cr,f as Pn}from"./chunk.57R2GXXN.js";import{a as Ot,b as Ft,c as Lr,e as Tr}from"./chunk.5P556A7W.js";import{a as Ge,b as rr,c as ir,d as or,e as sr,f as lr}from"./chunk.QHYXXZRD.js";import{m as Mr}from"./chunk.6YPLZNVT.js";import{a as fr,b as yr,c as hr,e as Rr,f as Rn,h as $t}from"./chunk.NGDXH66B.js";import{d as br,e as kr,f as Sr,g as xr,n as Pr,o as Ar,q as Cr,s as Nt}from"./chunk.67WWRC6Y.js";import{a as An}from"./chunk.QIV65FWE.js";import{a as Sn,b as Xa,c as Ja}from"./chunk.UT6642FC.js";import{a as Et,b as pr,c as ur,d as gr,e as mr}from"./chunk.ISXFH3CK.js";import{c as tr,d as nr,j as mt}from"./chunk.N6MVK3KD.js";import{r as xn,s as ar}from"./chunk.42XSBKPO.js";import{f as za,g as lt,i as _a,j as Ya,k as kn,q as Qa,r as Za}from"./chunk.2FLPDPEL.js";import{b as Mt,c as Va,d as Ua,e as ja}from"./chunk.UUBYFBPN.js";import{C as Cn,K as Hr,N as Kr,e as Ha,f as Ka,j as ji,u as vr,v as wr}from"./chunk.JHEVGLKB.js";import{$ as ce,Ca as Da,G as Ie,L as La,N as Ta,Q as Ma,R as j,S as bn,V as Ea,W as Na,_ as $a,ca as Oa,da as Fa,fa as Ia,ja as st,la as Wa,oa as Rt,r as Ra,v as Fe}from"./chunk.FOQZADMA.js";import{a as Ca}from"./chunk.SDO3U72B.js";import{$c as Ct,I as ca,T as gt,Tc as vn,Vb as va,Wa as fa,Ya as ya,Yb as wa,Yc as Sa,Zb as ba,Zc as xa,aa as it,ba as me,da as be,ea as Pt,ga as ot,gb as hn,hb as ha,ia as pa,id as wn,ja as ua,jd as Pa,ka as He,nd as Aa,pb as At,tc as ka,va as ga,wa as ma}from"./chunk.V5MYKNL7.js";import{b as W}from"./chunk.AJZBJBMO.js";function si(t,e,n={}){let a=t.graph.getNode(e);if(!a)return;let r=t.schema.tryDefinition(a.kind),i=l=>me(t.schema.tryDefinition(l.kind),l),o=new Map;for(let l of t.graph.allEdges()){let d=l.from===e?"out":l.to===e?"in":null;if(!d)continue;let c=d==="out"?l.to:l.from,p=t.graph.getNode(c);if(!p)continue;let f=(d==="out"?r:t.schema.tryDefinition(p.kind))?.edges?.[l.kind],u=d==="in"?f?.inverse??f?.description:f?.description,k=`${l.kind}|${d}|${u??""}`;(o.get(k)??(()=>{let h={edgeKind:l.kind,direction:d,...u?{description:u}:{},targets:[]};return o.set(k,h),h})()).targets.push({id:p.id,kind:p.kind,label:i(p)})}return{id:e,kind:a.kind,label:i(a),fields:Ua(mt(t.schema,t.graph,a),r),violations:hn(t.violations(n.context),[e]),actions:An(t,[e],{focus:e,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...o.values()].map(l=>{let d=Mt(l.targets.flatMap(c=>{let p=t.graph.getNode(c.id);return p?[p]:[]}),c=>t.schema.tryDefinition(c));return{...l,targets:[...l.targets].map(c=>d.has(c.id)?{...c,apart:d.get(c.id)}:c).sort((c,p)=>c.label.localeCompare(p.label))}})}}function Ye(t,e,n={}){return{kind:e,members:t.graph.nodesOfKind(e),actions:An(t,[],{kindSelection:[e],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function li(t,e){let n=(i,o)=>`${i}|${JSON.stringify(o)}`,a=new Map;for(let i of[...t.affordances,...t.withheld]){if(i.provider!=="invariant")continue;let o=n(i.mutation,i.args);a.has(o)||a.set(o,i.rank??Number.MAX_SAFE_INTEGER)}let r=Number.MAX_SAFE_INTEGER;return[...e].map((i,o)=>({repair:i,declared:o})).sort((i,o)=>(a.get(n(i.repair.mutation,i.repair.args??{}))??r)-(a.get(n(o.repair.mutation,o.repair.args??{}))??r)||i.declared-o.declared).map(i=>i.repair)}function Qe(t){let e=t.schema.kinds.map(r=>({kind:r,plural:ot(t.schema,r),count:t.graph.nodesOfKind(r).length})),n=new Map;for(let r of t.graph.allEdges()){let i=t.graph.getNode(r.from),o=t.graph.getNode(r.to);if(!i||!o)continue;let l=`${r.kind}|${i.kind}|${o.kind}`;n.set(l,(n.get(l)??0)+1)}let a=[];for(let{kind:r}of e){let i=t.schema.tryDefinition(r)?.edges??{};for(let[o,l]of Object.entries(i)){let d=l.to==="*"||l.to===void 0?(()=>{let c=[...n.keys()].filter(p=>p.startsWith(`${o}|${r}|`)).map(p=>p.split("|")[2]);return c.length>0?c:["*"]})():l.to;for(let c of d)a.push({edgeKind:o,from:r,to:c,...l.description?{description:l.description}:{},...l.inverse?{inverse:l.inverse}:{},count:n.get(`${o}|${r}|${c}`)??0})}}return{kinds:e,relations:a}}var qe=W(Ie(),1);var Ze=W(Ie(),1),x=W(j(),1),zi=`
|
|
2
|
-
form:where([data-graview-part="form"]) {
|
|
3
|
-
/* A grid item of the section above it and a grid container for the
|
|
4
|
-
fields below: both halves are allowed to be narrower than what is in
|
|
5
|
-
them, or a big enough text size pushes the page sideways. See the note
|
|
6
|
-
on \`column\` in pages.tsx. */
|
|
7
|
-
display: grid;
|
|
8
|
-
grid-template-columns: minmax(0, 1fr);
|
|
9
|
-
min-width: 0;
|
|
10
|
-
gap: 12px;
|
|
11
|
-
}
|
|
12
|
-
label:where([data-graview-part="field"]),
|
|
13
|
-
div:where([data-graview-part="field"][data-graview-field="date"]) {
|
|
14
|
-
display: grid;
|
|
15
|
-
/* A track the width it was given: see the note on \`column\` in pages.tsx. */
|
|
16
|
-
grid-template-columns: minmax(0, 1fr);
|
|
17
|
-
min-width: 0;
|
|
18
|
-
gap: 4px;
|
|
19
|
-
}
|
|
20
|
-
label:where([data-graview-part="field"][data-graview-field="boolean"]) {
|
|
21
|
-
grid-auto-flow: column;
|
|
22
|
-
justify-content: start;
|
|
23
|
-
align-items: center;
|
|
24
|
-
}
|
|
25
|
-
span:where([data-graview-part="label"]),
|
|
26
|
-
legend:where([data-graview-part="label"]),
|
|
27
|
-
p:where([data-graview-part="unasked"]) {
|
|
28
|
-
font-size: 0.8125rem;
|
|
29
|
-
color: var(--graview-ink-muted);
|
|
30
|
-
}
|
|
31
|
-
p:where([data-graview-part="unasked"]) { margin: 0; }
|
|
32
|
-
input:where([data-graview-part="control"]:not([type="checkbox"])),
|
|
33
|
-
select:where([data-graview-part="control"]) {
|
|
34
|
-
font: inherit;
|
|
35
|
-
/* A TARGET IN EVERY ENGINE, not only in the one it was measured in.
|
|
36
|
-
Padding and line height alone came to 24 in Chromium and to 22 in
|
|
37
|
-
WebKit, which has its own intrinsic metrics for a \`select\` and rounds
|
|
38
|
-
nothing up for anybody. So every picker on the routed face was under
|
|
39
|
-
the WCAG 2.2 minimum in the browser iOS ships, and the check that says
|
|
40
|
-
so (\`verify-pages\`' \`bigEnoughToHit\`) only ever ran there through
|
|
41
|
-
\`pnpm engines\`. */
|
|
42
|
-
min-height: 24px;
|
|
43
|
-
/* NEVER WIDER THAN ITS FIELD. A select is as wide as its longest option,
|
|
44
|
-
and a picker over 320 vehicles ("2027 Mercedes-Benz GLE AMG 53 4MATIC+
|
|
45
|
-
Coupe") was 618 pixels on a 390 phone, and the whole page scrolled
|
|
46
|
-
sideways. It shrinks to its track and cuts the option inside its box. */
|
|
47
|
-
min-width: 0;
|
|
48
|
-
max-width: 100%;
|
|
49
|
-
text-overflow: ellipsis;
|
|
50
|
-
box-sizing: border-box;
|
|
51
|
-
padding: 7px 10px;
|
|
52
|
-
border-radius: 8px;
|
|
53
|
-
border: 1px solid var(--graview-edge);
|
|
54
|
-
background: var(--graview-panel);
|
|
55
|
-
color: var(--graview-ink);
|
|
56
|
-
}
|
|
57
|
-
/* A PICKER THAT STILL LOOKS LIKE ONE.
|
|
58
|
-
WebKit ignores an author's padding and minimum height on a \`select\`
|
|
59
|
-
while the native appearance is on \u2014 so every picker on the routed face
|
|
60
|
-
came out 22 pixels tall in the browser iOS ships, under the 24 WCAG 2.2
|
|
61
|
-
asks for, while the same element measured 35 in Chromium. Turning the
|
|
62
|
-
appearance off is what makes the box the size it was asked to be, and it
|
|
63
|
-
takes the platform's chevron with it; the chevron is put back, in the ink
|
|
64
|
-
the scheme is already using. */
|
|
65
|
-
span:where([data-graview-part="picker"]) {
|
|
66
|
-
position: relative;
|
|
67
|
-
display: grid;
|
|
68
|
-
min-width: 0;
|
|
69
|
-
}
|
|
70
|
-
span:where([data-graview-part="picker"]) > select:where([data-graview-part="control"]) {
|
|
71
|
-
appearance: none;
|
|
72
|
-
padding-right: 28px;
|
|
73
|
-
}
|
|
74
|
-
span:where([data-graview-part="chevron"]) {
|
|
75
|
-
position: absolute;
|
|
76
|
-
right: 10px;
|
|
77
|
-
top: 50%;
|
|
78
|
-
transform: translateY(-50%);
|
|
79
|
-
font-size: 0.75rem;
|
|
80
|
-
line-height: 1;
|
|
81
|
-
color: var(--graview-ink-muted);
|
|
82
|
-
pointer-events: none;
|
|
83
|
-
}
|
|
84
|
-
fieldset:where([data-graview-part="group"]) {
|
|
85
|
-
display: grid;
|
|
86
|
-
gap: 10px;
|
|
87
|
-
border: 1px solid var(--graview-edge);
|
|
88
|
-
border-radius: 10px;
|
|
89
|
-
padding: 12px;
|
|
90
|
-
}
|
|
91
|
-
fieldset:where([data-graview-part="group"][data-graview-field="list"]) { gap: 8px; }
|
|
92
|
-
div:where([data-graview-part="item"]) {
|
|
93
|
-
display: flex;
|
|
94
|
-
gap: 8px;
|
|
95
|
-
align-items: end;
|
|
96
|
-
}
|
|
97
|
-
button:where([data-graview-part="add"]),
|
|
98
|
-
button:where([data-graview-part="submit"]) { justify-self: start; }
|
|
99
|
-
p:where([data-graview-part="refused"]) {
|
|
100
|
-
margin: 0;
|
|
101
|
-
color: var(--graview-warn);
|
|
102
|
-
font-size: 0.875rem;
|
|
103
|
-
}
|
|
104
|
-
`;function _i({title:t,name:e,optional:n,amount:a,value:r,onChange:i}){let o=_a(a),[l,d]=(0,Ze.useState)(()=>typeof r=="number"?Ya(r,a):""),c=l.trim()!==""&&kn(l,a)===void 0;return(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":"number","data-graview-amount":a.format??"unit",children:[(0,x.jsx)("span",{"data-graview-part":"label",children:t}),(0,x.jsxs)("span",{"data-graview-part":"amount",style:{display:"flex",alignItems:"center",gap:6},children:[o.prefix?(0,x.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:o.prefix}):null,(0,x.jsx)("input",{type:"text",inputMode:"decimal",name:e,required:!n,placeholder:o.placeholder,title:o.hint,"aria-invalid":c||void 0,value:l,onChange:p=>{d(p.target.value),i(kn(p.target.value,a))},"data-graview-part":"control",style:{flex:1,minWidth:0}}),o.suffix?(0,x.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:o.suffix}):null]}),c?(0,x.jsxs)("span",{"data-graview-part":"hint",role:"status",children:["Not an amount ",o.hint,": write it like ",o.prefix??"",o.placeholder,o.suffix?` ${o.suffix}`:""]}):null]})}function di({children:t}){return(0,x.jsxs)("span",{"data-graview-part":"picker",children:[t,(0,x.jsx)("span",{"aria-hidden":"true","data-graview-part":"chevron",children:"\u25BE"})]})}var Yi=t=>({label:be(t),option:e=>e}),Qi={phone:"+1 555 123 4567",place:"An address or a place's name",duration:"1h 30m, 90 or 1:30"};function jt({store:t,spec:e,value:n,onChange:a,prefilled:r,open:i,words:o=Yi,values:l}){if(e.name in r&&e.control!=="group"&&e.control!=="variant")return null;let d=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(m=>be(He(t.schema.tryDefinition(m),m))).join(" or "):o(e.name).label,c=!(e.optional||e.control==="boolean"),p=c?(0,x.jsxs)(x.Fragment,{children:[d,(0,x.jsx)("span",{"aria-hidden":"true",children:" *"})]}):d;switch(e.control){case"text":case"date":return e.control==="text"&&e.long?(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":"text",children:[(0,x.jsxs)("span",{"data-graview-part":"label",children:[p,e.markdown?(0,x.jsx)("span",{style:{fontWeight:"normal",color:"var(--graview-ink-faint)"},children:" \xB7 Markdown"}):null]}),(0,x.jsx)("textarea",{name:e.name,required:!e.optional,rows:6,value:typeof n=="string"?n:"",onChange:m=>a(m.target.value),"data-graview-part":"control",style:{fieldSizing:"content",minHeight:"7.5em",resize:"vertical",font:"inherit",lineHeight:1.5}})]}):e.control==="date"?(0,x.jsxs)("div",{"data-graview-part":"field","data-graview-field":"date",children:[(0,x.jsx)("span",{"data-graview-part":"label",children:p}),(0,x.jsx)(lr,{name:e.name,label:o(e.name).label,required:!e.optional,value:typeof n=="string"&&n!==""?n:void 0,time:e.time===!0,instant:e.instant===!0,onChange:a})]}):(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control==="text"&&e.holds?e.holds:e.control,children:[(0,x.jsx)("span",{"data-graview-part":"label",children:p}),(0,x.jsx)("input",{type:e.control==="text"&&e.holds==="phone"?"tel":"text",name:e.name,required:!e.optional,...e.control==="text"&&e.app?{placeholder:"@owner/app or https://\u2026"}:{},...e.control==="text"&&e.holds?{placeholder:Qi[e.holds]}:{},...e.control==="text"&&e.holds==="phone"?{autoComplete:"tel"}:{},value:typeof n=="string"?n:typeof n=="number"?String(n):"",onChange:m=>a(m.target.value),"data-graview-part":"control"})]});case"number":return e.amount?(0,x.jsx)(_i,{title:p,name:e.name,optional:e.optional,amount:e.amount,value:n,onChange:a}):(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,x.jsx)("span",{"data-graview-part":"label",children:p}),(0,x.jsx)("input",{type:"number",name:e.name,required:!e.optional,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},value:typeof n=="number"?n:"",onChange:m=>a(m.target.value===""?void 0:Number(m.target.value)),"data-graview-part":"control"})]});case"boolean":return(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":"boolean",children:[(0,x.jsx)("input",{type:"checkbox",name:e.name,checked:n===!0,onChange:m=>a(m.target.checked),"data-graview-part":"control"}),(0,x.jsx)("span",{"data-graview-part":"label",children:p})]});case"choice":return(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,x.jsx)("span",{"data-graview-part":"label",children:p}),(0,x.jsx)(di,{children:(0,x.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:m=>a(m.target.value||void 0),"data-graview-part":"control",children:[(0,x.jsx)("option",{value:"",children:"\u2014"}),(e.options??[]).map(m=>(0,x.jsx)("option",{value:m,children:o(e.name).option(m)},m))]})})]});case"node":{let m=i.find(h=>h.name===e.name)?.candidates,f=new Set(Object.values(r).filter(h=>typeof h=="string")),u=(e.kinds.includes("*")?[...t.graph.allNodes()]:e.kinds.flatMap(h=>t.graph.nodesOfKind(h))).filter(h=>!f.has(h.id)),k=m?m.map(h=>t.graph.getNode(h)).filter(h=>h!==void 0):u,B=Mt(k,h=>t.schema.tryDefinition(h));return(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,x.jsx)("span",{"data-graview-part":"label",children:p}),(0,x.jsx)(di,{children:(0,x.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:h=>a(h.target.value||void 0),"data-graview-part":"control",children:[(0,x.jsx)("option",{value:"",children:"\u2014"}),k.map(h=>{let R=B.get(h.id);return(0,x.jsxs)("option",{value:h.id,children:[me(t.schema.tryDefinition(h.kind),h),R?` \xB7 ${R}`:""]},h.id)})]})})]})}case"group":{let m=n??{};return(0,x.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,x.jsx)("legend",{"data-graview-part":"label",children:p}),e.fields.map(f=>(0,x.jsx)(jt,{store:t,spec:f,value:m[f.name],onChange:u=>a({...m,[f.name]:u}),prefilled:r,open:i,words:o},f.name))]})}case"variant":{let m=n??{},f=typeof m[e.tag]=="string"?m[e.tag]:"",u=e.options.find(k=>k.value===f);return(0,x.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,x.jsx)("legend",{"data-graview-part":"label",children:p}),(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":"choice",children:[(0,x.jsx)("span",{"data-graview-part":"label",children:be(e.tag)}),(0,x.jsxs)("select",{value:f,onChange:k=>a({[e.tag]:k.target.value}),"data-graview-part":"control",children:[(0,x.jsx)("option",{value:"",children:"\u2014"}),e.options.map(k=>(0,x.jsx)("option",{value:k.value,children:be(k.value)},k.value))]})]}),u?.fields.map(k=>(0,x.jsx)(jt,{store:t,spec:k,value:m[k.name],onChange:B=>a({...m,[k.name]:B}),prefilled:r,open:i,words:o},k.name))]})}case"file":case"list":{let m=e.control==="file"?e:e.item.control==="file"?e.item:void 0;if(m||e.control==="file")return(0,x.jsx)(Ge,{as:"control",title:c?`${d} *`:d,value:n,onChange:a,several:m!==e,image:m?.image===!0,video:m?.video===!0,label:d});let f=Array.isArray(n)?n:[];return(0,x.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":"list",children:[(0,x.jsx)("legend",{"data-graview-part":"label",children:p}),f.map((u,k)=>(0,x.jsxs)("div",{"data-graview-part":"item",children:[(0,x.jsx)("div",{style:{flex:1},children:(0,x.jsx)(jt,{store:t,spec:{...e.item,optional:!1},value:u,onChange:B=>a(f.map((h,R)=>R===k?B:h)),prefilled:r,open:i,words:o})}),(0,x.jsx)("button",{type:"button","data-graview-part":"remove",onClick:()=>a(f.filter((B,h)=>h!==k)),children:"remove"})]},k)),(0,x.jsx)("button",{type:"button","data-graview-part":"add",onClick:()=>a([...f,void 0]),children:"add another"})]})}case"linked":return(0,x.jsx)("div",{"data-graview-part":"field","data-graview-field":"linked",children:(0,x.jsx)(ir,{relation:e.relation,value:n,onChange:a,label:d})});case"repeat":return(0,x.jsx)(or,{value:n,onChange:a,start:e.of?l?.[e.of]:void 0,label:`${e.of?o(e.of).label:d} repeats`,name:e.name});case"opaque":return(0,x.jsxs)("p",{"data-graview-part":"unasked",children:["\u201C",be(e.name),"\u201D needs a structured answer this form cannot ask for yet."]})}}function We({store:t,mutation:e,prefilled:n={},open:a=[],onDone:r,principal:i,initial:o,label:l,only:d}){let c=()=>ur(e,t.graph,n),[p,m]=(0,Ze.useState)(c),[f,u]=(0,Ze.useState)(()=>({...p,...o})),[k,B]=(0,Ze.useState)(null),h=i??t.seenFor,R=e.subject&&n[e.subject.arg],G=h?mr(t,h,e,typeof R=="string"?R:void 0):void 0,M=Et(e.input).filter(I=>(d===void 0||d.includes(I.name))&&!G?.has(I.name)),V=I=>za(t.schema,e,I),z=Za(M.filter(I=>I.control==="date").map(I=>I.name)),se=(0,Ze.useRef)(void 0),ue=(I,_)=>u(oe=>{let we={...oe,[I.name]:_};if(z&&I.name===z.start&&I.control==="date"){let le=w=>typeof w=="string"&&w!==""?w:void 0,ge=le(oe[z.start])??se.current;if(le(_)){se.current=le(_);let w=Qa(ge,le(_),le(oe[z.end]),{time:I.time===!0,instant:I.instant===!0});w!==void 0&&(we[z.end]=w)}}return we});return(0,x.jsxs)("form",{"data-testid":`form-${e.name}`,onSubmit:I=>{I.preventDefault();try{t.apply({name:e.name,args:{...gr(pr(M,f),p),...n}},i?{author:i}:{}),B(null);let _=c();m(_),u({..._}),r?.()}catch(_){B(lt(t.schema,t.allMutations(),_))}},"data-graview-part":"form",children:[(0,x.jsx)("style",{children:zi}),M.map(I=>(0,x.jsx)(jt,{store:t,spec:I,value:f[I.name],values:f,onChange:_=>ue(I,_),prefilled:n,open:a,words:V},I.name)),k?(0,x.jsx)("p",{"data-testid":"refused","data-graview-part":"refused",role:"alert",children:k}):null,(0,x.jsx)("button",{type:"submit","data-graview-part":"submit",children:l??e.title??e.name})]})}var T=W(j(),1);function Te(t){let e=t.views;if(!e)return[];let n=new Set(Ve(t.store,t.principal));return e.places().filter(a=>n.has(a.kind))}function zt(t,e){if(!e.over)return[e.kind];let n=new Set(Ve(t.store,t.principal));return e.over.filter(a=>a===e.kind||n.has(a))}var Xe=t=>`place:${t.kind}:${t.as}`;function ye(t,e){return Qr(e.as,Sa(e,t.views?.places()??[])?Y(t.store.schema,e.kind):void 0)}function yt(t,e){let n=t.schema.tryDefinition(e);return t.graph.nodesOfKind(e).filter(a=>it(n,a))}function Wn(t,e,n){let a=(i,o)=>Pt(t.schema,o,i),r=(typeof e=="string"?[e]:e).map(i=>a(yt(t,i).length,i)).join(" and ");return n?`${r} across ${a(yt(t,n).length,n)}`:r}function Dn({context:t,place:e,chosen:n,filter:a}){let{store:r,views:i,invariantContext:o}=t,d=i?.resolve(e.kind,{cardinality:"many",fidelity:"full"},e.as)?.view,c=[...new Set(r.violations(o).flatMap(f=>f.nodeIds))],p=zt(t,e).flatMap(f=>yt(r,f));if(!d)return null;let m=Zi(r,p,a,c);return(0,T.jsx)(xn,{kind:e.kind,view:e.title,children:(0,T.jsx)(d,{nodes:m,label:e.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...c.length>0?{flagged:c}:{}})})}function Zi(t,e,n,a){let r=n?Ct({filter:n}).filter??[]:[];return r.length===0?e:$t(e,{filter:r},{schema:t.schema,graph:t.graph,flagged:new Set(a)}).nodes}function Xi({store:t,views:e,as:n,invariantContext:a}){ne(t);let r={store:t,views:e,...a?{invariantContext:a}:{}},i=e.places().find(o=>o.as===n);return i?(0,T.jsx)(Dn,{context:r,place:i}):null}function Ji({context:t,kind:e}){let{store:n,views:a,invariantContext:r}=t,i=yt(n,e),o=n.schema.tryDefinition(e),l=Q(n,e),c=a?.resolve(e,{cardinality:"many",fidelity:"full"})?.view,p=[...new Set(n.violations(r).flatMap(k=>k.nodeIds))];if(c&&!st(c))return(0,T.jsx)(xn,{kind:e,children:(0,T.jsx)(c,{nodes:i,label:l,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...p.length>0?{flagged:p}:{}})});let m=a?.resolve(e,{cardinality:"one",fidelity:"summary"})?.view,f=8,u=i.slice(0,f);return(0,T.jsxs)("div",{"data-testid":"kind-sheet",style:m?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gridAutoRows:"max-content",alignContent:"center",gap:12,padding:24}:{display:"flex",flexWrap:"wrap",alignContent:"center",justifyContent:"center",gap:10,padding:24},children:[u.map(k=>m?(0,T.jsx)(m,{node:k,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...p.includes(k.id)?{flagged:[k.id]}:{}},k.id):(0,T.jsx)("span",{style:{padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:me(o,k)},k.id)),i.length>f?(0,T.jsxs)("span",{style:{...C,alignSelf:"center",padding:"0 6px"},children:["+",i.length-f," more ",l.toLowerCase()]}):null]})}function Hn(t){let{store:e}=t,n=ei(t),a=Te(t),r=vn([...a].sort((o,l)=>n.indexOf(o.kind)-n.indexOf(l.kind))).filter(o=>!o.hidden),i=new Set(r.flatMap(o=>o.over??[o.kind]));return[...r.map(o=>({key:Xe(o),kind:o.kind,title:xa(o,a,e.schema),to:ye(t,o),place:o})),...Bt(t).filter(o=>!i.has(o)).map(o=>({key:`kind:${o}`,kind:o,title:Q(e,o),to:`/${Y(e.schema,o)}`}))]}var ci=.72,eo=540,pi=16/10;function to(t){let e=(0,qe.useRef)(null),[n,a]=(0,qe.useState)(t);return(0,qe.useLayoutEffect)(()=>{let r=e.current;if(!r||typeof ResizeObserver>"u")return;let i=()=>{let l=r.getBoundingClientRect().width;l>0&&a(d=>Math.abs(d-l)<.5?d:l)};i();let o=new ResizeObserver(i);return o.observe(r),()=>o.disconnect()},[]),{ref:e,width:n}}function no(t){for(let e=t.parentElement;e;e=e.parentElement)if(/(auto|scroll)/.test(getComputedStyle(e).overflowY))return e;return null}function ao(t){let[e,n]=(0,qe.useState)(()=>typeof IntersectionObserver>"u");return(0,qe.useLayoutEffect)(()=>{let a=t.current;if(e||!a)return;let r=new IntersectionObserver(i=>{i.some(o=>o.isIntersecting)&&(r.disconnect(),n(!0))},{root:no(a),rootMargin:"50% 0px"});return r.observe(a),()=>r.disconnect()},[e,t]),e}function Kn({context:t,entry:e}){let{store:n,brand:a,principal:r}=t,{ref:i,width:o}=to(eo),l=ao(i),d=o/ci,c=yt(n,e.kind),p=n.schema.tryDefinition(e.kind),m=c.length===0?Ye(n,e.kind,{...r?{principal:r}:{},...t.invariantContext?{context:t.invariantContext}:{}}).actions.affordances[0]:void 0,f=e.place!==void 0;return(0,T.jsxs)(F,{to:e.to,"data-testid":f?"place-card":"kind-card",className:"graview-gallery-card",style:{...Se,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,T.jsxs)("span",{ref:i,"data-testid":f?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${pi}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,T.jsx)("span",{style:{position:"absolute",left:0,top:0,width:d,height:d/pi,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${ci})`,transformOrigin:"0 0"},children:l?(0,T.jsx)(It.Provider,{value:null,children:e.place?(0,T.jsx)(Dn,{context:t,place:e.place}):(0,T.jsx)(Ji,{context:t,kind:e.kind})}):null}),c.length===0?(0,T.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,T.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,T.jsxs)("span",{style:{fontFamily:En,fontWeight:"var(--graview-weight-display)"},children:["No ",Q(n,e.kind).toLowerCase()," yet"]}),m?(0,T.jsxs)("span",{style:C,children:["Begin with \u201C",m.label,"\u201D"]}):null]})}):null]}),(0,T.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,T.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[f?null:(0,T.jsx)(fe,{kind:e.kind,brand:a,schema:n.schema,size:8}),(0,T.jsx)("span",{style:{fontFamily:En,fontSize:"var(--graview-text-heading)",fontWeight:"var(--graview-weight-display)",lineHeight:1.3,overflowWrap:"anywhere",textWrap:"balance"},children:e.title})]}),(0,T.jsxs)("span",{style:C,children:[e.place?Wn(n,zt(t,e.place),e.place.across):Wn(n,e.kind),!f&&p?.description?` \xB7 ${p.description}`:null]})]})]})}var ui={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},ro=`
|
|
105
|
-
.graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
|
|
106
|
-
.graview-gallery-card:hover > span:first-child,
|
|
107
|
-
.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); }
|
|
108
|
-
`;function qn({context:t}){ne(t.store);let e=Hn(t);return e.length===0?null:(0,T.jsxs)("section",{style:ui,"data-testid":"gallery",children:[(0,T.jsx)("style",{children:ro}),e.map(n=>(0,T.jsx)(Kn,{context:t,entry:n},n.key))]})}function Bn({context:t}){let{store:e}=t;ne(e);let n=vn(Te(t)).filter(r=>!r.hidden),a=Hn(t);return(0,T.jsxs)(ae,{context:t,style:dt,children:[(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)("p",{style:ke,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,T.jsx)(ie,{context:t,children:"Pictures"}),(0,T.jsx)("p",{style:re,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,T.jsx)("div",{style:ui,"data-testid":"places",children:a.map(r=>(0,T.jsx)(Kn,{context:t,entry:r},r.key))}):null]})}function Gn({context:t}){let{store:e,principal:n}=t;ne(e);let a=Ue(),r=Ke(),[i]=ct(),o=decodeURIComponent(a.as??""),[l,d]=(0,qe.useState)(null),c=i.get("of"),p=i.get("filter"),f=Te(t).find(M=>M.as===o&&(!c||Y(e.schema,M.kind)===c));if(!f)return(0,T.jsxs)(ae,{context:t,children:[(0,T.jsx)(ie,{context:t,children:"No picture is called that."}),(0,T.jsx)("p",{style:re,children:(0,T.jsxs)(F,{to:"/places",style:K,children:["The pictures there are ",(0,T.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]})})]});let u=Q(e,f.kind),k=t.views?.resolve(f.kind,{cardinality:"many",fidelity:"full"},f.as)?.view,B=k?.flows===!0,h=k?.creates!==!1,R=Ye(e,f.kind,{...n?{principal:n}:{},...t.invariantContext?{context:t.invariantContext}:{}}),G=h?R.actions.affordances.map(M=>({affordance:M,mutation:e.allMutations().find(V=>V.name===M.mutation)})).filter(M=>M.mutation!==void 0):[];return(0,T.jsxs)(ae,{context:t,style:dt,children:[(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)(ie,{context:t,children:f.title}),(0,T.jsxs)("p",{style:re,"data-testid":"place-lede",children:[Wn(e,zt(t,f),f.across),"."]}),p&&!B?(0,T.jsxs)("p",{style:{...C,margin:0},"data-testid":"place-narrowed",children:[`Only those where ${p.split(",").map(M=>M.replace(":"," is ")).join(" and ")}. `,(0,T.jsx)(F,{to:`?${(()=>{let M=new URLSearchParams(i);return M.delete("filter"),M.toString()})()}`,style:{...K,...C},children:"Show all"})]}):null,(0,T.jsx)("p",{style:{...C,margin:0,display:"flex",flexWrap:"wrap",gap:"4px 16px"},children:zt(t,f).map((M,V)=>(0,T.jsxs)(F,{to:`/${Y(e.schema,M)}`,style:{...K,...C},...V===0?{"data-testid":"place-as-list"}:{},children:["All ",(M===f.kind?u:Q(e,M)).toLowerCase()," as a list ",(0,T.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]},M))})]}),(0,T.jsx)("div",{"data-testid":"place-lens","data-flows":B?"":void 0,style:B?{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:M=>{let V=M.target?.closest("[data-graview-pick]"),z=V?.getAttribute("data-graview-pick"),se=V?.getAttribute("data-graview-joins");if(se)try{let I=JSON.parse(se);if(Array.isArray(I)&&I.every(_=>typeof _=="string")){M.preventDefault(),d({at:Xe(f),ids:I});return}}catch{}if(!z)return;let ue=e.graph.getNode(z);ue&&(M.preventDefault(),r(Z(e.schema,ue.kind,z)))},children:(0,T.jsx)(Dn,{context:t,place:f,filter:p,...l?.at===Xe(f)?{chosen:l.ids}:{}})}),G.length>0?(0,T.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},"data-testid":"place-creators",children:G.map(({affordance:M,mutation:V})=>(0,T.jsxs)("section",{style:{...te,display:"grid",gap:14},children:[(0,T.jsx)("h2",{style:J,children:V.title??V.name}),V.description?(0,T.jsx)("p",{style:{...C,margin:0,maxWidth:"58ch"},children:V.description}):null,(0,T.jsx)(We,{store:e,mutation:V,prefilled:M.args,open:M.open,label:M.label,...n?{principal:n}:{}})]},M.id))}):null]})}function io(t,e=document){let n=Dt(t);if(!n)return null;let a=[e,...[...e.querySelectorAll("[data-worker-view]")].flatMap(r=>r.shadowRoot?[r.shadowRoot]:[])];for(let r of a)for(let i of r.querySelectorAll("[id], [data-section]")){let o=i.getAttribute("data-section")??i.id;if(o===t||Dt(o)===n)return i}for(let r of a)for(let i of r.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=heading]"))if(Dt(i.textContent??"")===n)return i;return null}function gi(t,e={}){if(typeof document>"u"||typeof requestAnimationFrame>"u")return()=>{};let n=e.frames??120,a=0,r=()=>{let i=io(t,e.root??document);if(i){i.hasAttribute("tabindex")||i.setAttribute("tabindex","-1"),i.scrollIntoView?.({block:"start"}),i.focus({preventScroll:!0});return}n-=1,n>0&&(a=requestAnimationFrame(r))};return a=requestAnimationFrame(()=>{a=requestAnimationFrame(r)}),()=>cancelAnimationFrame(a)}var U=W(Ie(),1);var _t=W(Ie(),1);var Je=W(j(),1);function mi({context:t}){return ce()?(0,Je.jsxs)(Je.Fragment,{children:[(0,Je.jsx)(oo,{context:t}),(0,Je.jsx)(Br,{face:"pages",on:t.quickAsk??!0})]}):null}function oo({context:t}){let{store:e}=t,n=ce(),{pathname:a}=Pe(),r=(0,_t.useRef)(n?.setSelection);return r.current=n?.setSelection,(0,_t.useEffect)(()=>{let i=r.current;if(!i)return;let[,o,l]=a.split("/"),d=(()=>{if(o==="places"){let p=t.views?.places().find(m=>m.as===decodeURIComponent(l??""));return p?[Fe(p.kind)]:[]}let c=o?$e(e.schema,o):void 0;return c&&l?[decodeURIComponent(l)]:c?[Ra(c)]:[]})();i(c=>c.length===d.length&&c.every((p,m)=>p===d[m])?c:d)},[a]),null}var he=W(Ie(),1);var yi=W(ji(),1);var pe=W(j(),1);var so=(0,he.lazy)(Rt(Ca(()=>(__graviewPreload(import.meta.url,["./chunk.JYJ4LZJJ.js","./chunk.UGFDSE37.js","./chunk.USZPOOLZ.js","./chunk.C4TSM4W5.js","./chunk.XEKLEHC3.js","./chunk.53CDFJNM.js","./chunk.4QPVS2ZM.js","./chunk.RCM7NOPF.js","./chunk.Z7LDT55A.js","./chunk.BQRAIU5R.js","./chunk.57R2GXXN.js","./chunk.BFNVG5JE.js","./chunk.AIZQBPGU.js","./chunk.V3V47QRE.js","./chunk.5P556A7W.js","./chunk.QHYXXZRD.js","./chunk.BELCPW66.js","./chunk.6YPLZNVT.js","./chunk.5RABSIF7.js","./chunk.NGDXH66B.js","./chunk.67WWRC6Y.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.N6MVK3KD.js","./chunk.I7XSDXQ3.js","./chunk.UHI3D7JC.js","./chunk.WVDKYUF3.js","./chunk.ZHLQWMV5.js","./chunk.TNESS3LQ.js","./chunk.GZHZLJBF.js","./chunk.42XSBKPO.js","./chunk.OJGHDWI6.js","./chunk.6FNMDAX5.js","./chunk.2FLPDPEL.js","./chunk.UUBYFBPN.js","./chunk.2RVUDRRY.js","./chunk.JHEVGLKB.js","./chunk.FOQZADMA.js","./chunk.SDO3U72B.js","./chunk.V5MYKNL7.js","./chunk.AJZBJBMO.js"]),import("./chunk.Z7BCIYDW.js")).then(t=>({default:t.TakeBack})))));function lo({context:t,docked:e,at:n}){let{store:a}=t,r=ne(a),[i]=(0,he.useState)(()=>a.batches().length),o=(0,he.useRef)(!1);return o.current||=r>0||!e&&i>0,o.current?(0,pe.jsx)(he.Suspense,{fallback:null,children:(0,pe.jsx)(so,{context:t,docked:e,at:n,since:i})}):null}function co(t,e,n){let{store:a,principal:r,embedded:i}=t;(0,he.useEffect)(()=>{if(!n)return;let o=l=>{if(!Yr(l))return;let d=l.target,c=d instanceof Node&&e.current?.contains(d),p=d===document.body||d===document.documentElement||d===document;if(!(!c&&!(p&&!i))&&zr(a,r)){l.preventDefault();try{_r(a,r)}catch{}}};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[a,r,i,e,n])}function hi({context:t,registry:e,root:n,children:a}){let r=(0,he.useMemo)(ii,[]),i=e?.without()??new Set;return co(t,n,!i.has("undo")),(0,pe.jsxs)(On.Provider,{value:r,children:[(0,pe.jsx)(po,{context:t,placed:r,without:i}),a]})}function po({context:t,placed:e,without:n}){let[a,r]=(0,he.useState)(!1);(0,he.useLayoutEffect)(()=>r(!0),[]);let i=Fn(e,"find"),o=Fn(e,"undo"),l=Pe(),d=wr();if(!a)return null;let c=l.pathname.split("/").filter(Boolean),m=(c.length===1?$e(t.store.schema,c[0]):void 0)!==void 0;return(0,pe.jsxs)(pe.Fragment,{children:[!i&&!n.has("find")&&d?(0,yi.createPortal)((0,pe.jsx)(fi,{context:t,narrowsLists:m}),d.slot):null,!i&&!n.has("find")&&!d?(0,pe.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,pe.jsx)(fi,{context:t,narrowsLists:m})}):null,!o&&!n.has("undo")?(0,pe.jsx)(lo,{context:t,docked:!0,at:l.pathname+l.search}):null,d?.own&&!n.has("undo")?(0,pe.jsx)(ti,{context:t,own:d.own}):null]})}function fi({context:t,narrowsLists:e}){return(0,pe.jsx)(On.Provider,{value:null,children:(0,pe.jsx)(In,{context:t,narrowsLists:e})})}var X=W(Ie(),1);var Ae=W(j(),1),uo=500,go=10;function Yt(t){return t instanceof HTMLElement?t.isContentEditable||t.tagName==="TEXTAREA"||t.tagName==="SELECT"?!0:t.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(t.type):!1}function mo(t){let e=typeof getSelection=="function"?getSelection():null;return e!==null&&!e.isCollapsed&&e.containsNode(t,!0)}function vi(t){let e=t.closest('a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])');if(e)return e;let n=document.activeElement;return n instanceof HTMLElement&&n!==document.body?n:null}function wi({context:t,root:e,children:n}){return ce()===null?(0,Ae.jsx)(Ae.Fragment,{children:n}):(0,Ae.jsx)(fo,{context:t,root:e,children:n})}function fo({context:t,root:e,children:n}){let{setMenuAt:a}=$a(),{store:r}=t,i=r.schema,o=Ke(),{pathname:l,search:d}=Pe(),c=Vt("/").replace(/\/$/,""),p=(0,X.useCallback)((w,y)=>t.views?.places().find(L=>L.as===w&&(y===null||L.kind===y)),[t.views]),m=(0,X.useCallback)((w,y)=>{let[L="",$,g]=w.split("/").filter(Boolean).map(O=>{try{return decodeURIComponent(O)}catch{return O}});if(g!==void 0)return null;if(L==="places"&&$!==void 0){let O=p($,new URLSearchParams(y).get("of"));return O?{face:"pages",place:O.as,about:[Fe(O.kind)],title:O.title}:null}let A=$e(i,L);return A?$===void 0?{face:"pages",about:[Fe(A)],title:ot(i,A)}:r.graph.getNode($)?{face:"pages",on:$,about:[$]}:null:null},[i,r,p]),f=(0,X.useCallback)(w=>{let y=w.href;try{let L=new URL(y,location.href);if(L.origin===location.origin&&(c===""||L.pathname===c||L.pathname.startsWith(`${c}/`))){let $=m(L.pathname.slice(c.length),L.search);if($)return{...$,href:y}}}catch{}return{face:"pages",about:[],href:y}},[c,m]),u=(0,X.useCallback)(()=>m(l,d)??{face:"pages",about:[]},[m,l,d]),k=(0,X.useCallback)(w=>{let y=u(),L=w.closest("[data-graview-field]")?.getAttribute("data-graview-field");if(L&&y.on!==void 0&&w.closest("[data-graview-pick], a[href]")===null)return{...y,field:L};let $=w.closest("[data-graview-act]")?.getAttribute("data-graview-act");if($)return{...y,act:$};let g=w.closest("a[href]"),A=w.closest("[data-graview-listed]"),O=[w.closest("[data-graview-pick]")?.getAttribute("data-graview-pick"),A&&(!g||A.contains(g)&&g.classList.contains("graview-spec-item-link"))?A.getAttribute("data-graview-listed"):null].map(De=>De?r.graph.getNode(De):void 0).find(Boolean);if(O)return{face:"pages",on:O.id,about:[O.id],href:`${c}${Z(i,O.kind,O.id)}`};if(g)return f(g);let ee=w.closest("[data-graview-record]")?.getAttribute("data-graview-record");return ee&&r.graph.getNode(ee)?{face:"pages",on:ee,about:[ee]}:y},[u,f,r,i,c]),B=(0,X.useCallback)(w=>{let y=e.current;if(y===null||!y.contains(w)||Yt(w)||w.closest("[data-graview-popover]"))return null;let L=k(w);return{face:"pages",on:L.on,about:L.about??[],field:L.field,place:L.place,href:L.href,act:L.act,element:vi(w)}},[k,e]),h=(0,X.useCallback)((w,y,L)=>{let $=k(w);a({...$,x:Math.round(y),y:Math.round(L),returnTo:vi(w)})},[k,a]),R=(0,X.useCallback)(w=>{let y=w.getBoundingClientRect();h(w,y.left+Math.min(16,y.width/2),Math.min(y.bottom,y.top+36))},[h]),G=(0,X.useRef)(0),M=(0,X.useRef)(null),V=(0,X.useRef)(!1),z=()=>{M.current&&clearTimeout(M.current.timer),M.current=null};(0,X.useEffect)(()=>z,[]),(0,X.useEffect)(()=>{let w=y=>{if(y.defaultPrevented||!(y.key==="ContextMenu"||y.key==="F10"&&y.shiftKey))return;let L=e.current,$=y.target instanceof Element?y.target:null,g=$===null||$===document.body||$===document.documentElement,A=L!==null&&$!==null&&L.contains($);if(!A&&!(g&&document.querySelector("[data-graview-face='pages']")===L)||Yt($)||$?.closest("[data-graview-popover]"))return;y.preventDefault(),G.current=Date.now();let O=A&&$ instanceof HTMLElement?$:L?.querySelector("[data-graview-page-title], main h1, main")??null;O&&R(O)};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[e,R]),(0,X.useEffect)(()=>{let w=e.current;if(!w)return;let y=L=>{let $=L.detail;$&&a({...$,face:"pages"})};return w.addEventListener(bn,y),()=>w.removeEventListener(bn,y)},[e,a]);let se=(0,X.useMemo)(()=>w=>{if(w.face!=="pages")return null;let y=[],L=w.on===void 0?void 0:r.graph.getNode(w.on),$=w.place===void 0?void 0:t.views?.places().find(Ee=>Ee.as===w.place),g=L?void 0:w.about.length===1&&w.about[0].startsWith("aggregate:")&&!$?yo(w.about[0]):void 0,A=L?Z(i,L.kind,L.id):$?ye(t,$):g?`/${Y(i,g)}`:void 0,O=A!==void 0&&l===A.split("?")[0];A!==void 0&&!O&&y.push({id:"open",label:"Open",run:()=>o(A)});let ee=A!==void 0?`${c}${A}`:w.href;ee!==void 0&&y.push({id:"open-in-a-new-tab",label:"Open in a new tab",run:()=>void window.open(ee,"_blank","noopener")});let De=L?`#focus=${encodeURIComponent(L.id)}`:$?`#focus=${encodeURIComponent(Fe($.kind))}&view=${encodeURIComponent($.as)}`:g?`#focus=${encodeURIComponent(Fe(g))}`:void 0;if(De!==void 0&&(t.overview||!t.embedded)){let Ee=t.overview;y.push({id:"in-the-scene",label:"Show in the scene",run:()=>Ee?Ee(De):location.assign(`${t.sceneHref??"/"}${De}`)})}return L===void 0&&w.href===void 0&&y.push({id:"find",label:"Find\u2026",run:()=>{let Ee=e.current?.querySelector('[data-testid="nav-find"]')??document.querySelector('[data-testid="nav-find"]');Ee&&Ee.offsetParent!==null?Ee.focus():o("/search")}}),y.length>0?{id:"pages",items:y}:null},[r,i,t,l,c,o,e]),ue=(0,X.useMemo)(()=>w=>{if(w.face!=="pages"||w.field===void 0||w.on===void 0)return null;let y=r.graph.getNode(w.on),L=w.element?.closest("[data-graview-field]")??e.current?.querySelector(`[data-graview-field="${CSS.escape(w.field)}"]`);return!y||!(L instanceof HTMLElement)||!L.hasAttribute("data-graview-editable")?null:{id:"field",at:"start",items:[{id:"change-field",label:`Change \u201C${pa(i.tryDefinition(y.kind),w.field)}\u201D`,run:()=>L.click()}]}},[r,i,e]),I=Vr(),_=dr(),oe=Er(),we=(0,X.useCallback)((w,y)=>{l===ye(t,w).split("?")[0]&&o(y?ye(t,y):"/")},[l,t,o]),le=jr(we),ge=(0,X.useMemo)(()=>[ue,oe,se,...le?[le]:[],..._?[_]:[],...I?[I]:[]],[ue,oe,se,le,_,I]);return(0,Ae.jsxs)(ar,{sections:ge,children:[(0,Ae.jsx)("div",{"data-graview-menu-ground":"",style:{display:"contents"},onContextMenu:w=>{let y=w.target;w.shiftKey||Yt(y)||mo(y)||(w.preventDefault(),!y.closest("[data-graview-popover]")&&(Date.now()-G.current<700||(w.clientX===0&&w.clientY===0&&y instanceof HTMLElement?R(y):h(y,w.clientX,w.clientY))))},onPointerDown:w=>{if(V.current=!1,w.pointerType==="mouse"||!w.isPrimary)return;let y=w.target;if(Yt(y)||y.closest("[data-graview-choose], [data-graview-popover]"))return;z();let{clientX:L,clientY:$}=w;M.current={x:L,y:$,timer:setTimeout(()=>{M.current=null,V.current=!0,G.current=Date.now(),h(y,L,$)},uo)}},onPointerMove:w=>{let y=M.current;y&&Math.hypot(w.clientX-y.x,w.clientY-y.y)>go&&z()},onPointerUp:z,onPointerCancel:z,onClickCapture:w=>{V.current&&(V.current=!1,w.preventDefault(),w.stopPropagation())},children:n}),(0,Ae.jsx)(ho,{openAt:R,readyAt:B}),(0,Ae.jsx)(Ur,{placement:"page"}),(0,Ae.jsx)(cr,{})]})}function yo(t){let e=t.slice(10).split("+");return e.length===1&&e[0]?e[0]:void 0}function ho({openAt:t,readyAt:e}){return(0,Ae.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,Ae.jsx)(qr,{placement:"menu",openActs:t,aimAt:e})})}var H=W(j(),1);function bi(t,e){return e==="*"?{label:"anything",path:null}:{label:Q(t,e),path:`/${Y(t.schema,e)}`}}function vo({context:t,relation:e}){let{store:n}=t,a=bi(n,e.from),r=bi(n,e.to),i=o=>o.path?(0,H.jsx)(F,{to:o.path,style:{...Se,fontWeight:550},children:o.label}):(0,H.jsx)("span",{children:o.label});return(0,H.jsxs)("li",{"data-testid":"relation","data-relation":e.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,H.jsx)(Gr,{edgeKind:e.edgeKind,...t.brand?.kit?{kit:t.brand.kit}:{}}),(0,H.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,H.jsxs)("span",{children:[i(a)," ",(0,H.jsxs)("span",{style:C,"data-graview-speaks-ids":"",children:[be(e.edgeKind)," \u2192"]})," ",i(r)]}),e.description||e.inverse?(0,H.jsxs)("span",{style:C,children:[e.description?Re(e.description):null,e.description&&e.inverse?" \xB7 ":null,e.inverse?`from the other end, ${e.inverse}`:null]}):null]}),r.path?(0,H.jsx)(F,{to:`${r.path}?with=${encodeURIComponent(e.edgeKind)}`,style:{...K,...C,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${r.label.toLowerCase()} that have this`,children:e.count}):(0,H.jsx)("span",{style:{...C,fontVariantNumeric:"tabular-nums"},children:e.count})]})}function ki({context:t,heading:e=!0}){let{store:n}=t,a=new Set(Ve(n,t.principal)),r=Qe(n).relations.filter(i=>a.has(i.from)&&(i.to==="*"||a.has(i.to)));return r.length===0?null:(0,H.jsxs)("section",{style:{...te,display:"grid",gap:12},"data-testid":"kind-map",children:[e?(0,H.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,H.jsx)("h2",{style:J,children:(0,H.jsx)(F,{to:"/map",style:Se,children:"Connections"})}),(0,H.jsx)("span",{style:C,children:r.length===1?"1 relation":`${r.length} relations`})]}):null,(0,H.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:r.map(i=>(0,H.jsx)(vo,{context:t,relation:i},`${i.edgeKind}|${i.from}|${i.to}`))})]})}function Vn({context:t}){let{store:e}=t;ne(e);let n=new Set(Ve(e,t.principal)),a=Qe(e),r=a.relations.filter(i=>n.has(i.from));return(0,H.jsxs)(ae,{context:t,children:[(0,H.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,H.jsx)("p",{style:ke,children:r.length===0?"No relations":`${r.length} ${r.length===1?"relation":"relations"}`}),(0,H.jsx)(ie,{context:t,children:"Connections"}),(0,H.jsx)("p",{style:re,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,H.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:a.kinds.filter(i=>n.has(i.kind)).map(i=>(0,H.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,H.jsx)(fe,{kind:i.kind,brand:t.brand,schema:e.schema,size:7}),(0,H.jsx)(F,{to:`/${Y(e.schema,i.kind)}`,style:K,children:i.plural}),(0,H.jsx)("span",{style:C,children:i.count})]},i.kind))}),(0,H.jsx)(ki,{context:t,heading:!1})]})}function Si({context:t}){let n=[...ce()?.robots.values()??[]].filter(r=>r.mode==="asking"&&r.say);if(n.length===0)return null;let{store:a}=t;return(0,H.jsxs)("section",{style:{...te,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,H.jsx)("h2",{style:J,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,H.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(r=>{let i=r.at?a.graph.getNode(r.at):void 0;return(0,H.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,H.jsx)("span",{children:r.say}),i?(0,H.jsxs)(F,{to:Z(a.schema,i.kind,i.id),style:{...K,...C},children:[me(a.schema.tryDefinition(i.kind),i)," \u2192"]}):null]},r.participant)})})]})}var q=W(j(),1);function Un({context:t}){let{principal:e}=t,{store:n,brand:a,invariantContext:r}=t;ne(n);let i=n.violations(r),o=`${i.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=Bt(t).map(R=>({kind:R,members:n.graph.nodesOfKind(R).filter(G=>it(n.schema.tryDefinition(R),G))})),p=c.filter(R=>R.members.length>0),m=c.map(R=>({entry:R,creator:n.allMutations().find(G=>(G.creates??[]).includes(R.kind)&&n.permits({name:G.name,args:{}},t.principal).ok)})).find(R=>R.creator!==void 0),f=p.length===0?"Nothing here yet.":`${p.map(R=>Pt(n.schema,R.kind,R.members.length)).join(", ").replace(/, ([^,]*)$/," and $1")}.`,u=t.views?.homeView?.(),k=n.schema.kinds.some(R=>n.graph.nodesOfKind(R).length>0);if(u&&k){let R=a?.subtitle?(0,q.jsx)("p",{style:{...C,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,G=u[Symbol.for("graview.home-blocks")]===!0;return(0,q.jsx)(ae,{context:t,style:dt,children:(0,q.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[G?null:R,i.length>0?(0,q.jsx)(F,{to:"/problems",style:{...K,color:"var(--graview-warn)"},children:o}):null,(0,q.jsx)(Dr.Provider,{value:G?R:null,children:(0,q.jsx)(u,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})]})})}let B=new Set(Ve(n,t.principal)),h=Qe(n).relations.filter(R=>B.has(R.from)&&(R.to==="*"||B.has(R.to)));return(0,q.jsxs)(ae,{context:t,style:dt,children:[(0,q.jsxs)("header",{style:{display:"grid",gap:12},children:[a?.subtitle?(0,q.jsx)("p",{style:{...C,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,(0,q.jsx)(ie,{context:t,"data-testid":"standing",children:f}),(0,q.jsxs)("p",{style:{...re,display:"grid",gap:4},"data-testid":"standing-card",children:[p.length===0&&m?(0,q.jsxs)("span",{children:["Begin with \u201C",m.creator?.title??m.creator?.name,"\u201D, under"," ",(0,q.jsx)(F,{to:`/${Y(n.schema,m.entry.kind)}`,style:K,children:Q(n,m.entry.kind)}),"."]}):null,i.length===0?(0,q.jsx)("span",{children:"All rules hold."}):(0,q.jsx)(F,{to:"/problems",style:{...K,color:"var(--graview-warn)"},children:o})]})]}),(0,q.jsx)(qn,{context:t}),(0,q.jsxs)("section",{style:{...te,display:"grid",gap:14},"data-testid":"kinds",children:[(0,q.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,q.jsx)("h2",{style:J,children:"What is here"}),h.length>0?(0,q.jsxs)(F,{to:"/map",style:{...K,...C,marginLeft:"auto"},"data-testid":"map-link",children:["Connections \xB7 ",h.length===1?"1 relation":`${h.length} relations`," ",(0,q.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]}):null]}),(0,q.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:c.map(({kind:R,members:G})=>(0,q.jsx)("li",{style:{maxWidth:"100%"},children:(0,q.jsxs)(F,{to:`/${Y(n.schema,R)}`,style:{...Se,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,q.jsx)(fe,{kind:R,brand:a,schema:n.schema,size:7}),(0,q.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:Q(n,R)}),(0,q.jsx)("span",{style:{...C,fontVariantNumeric:"tabular-nums"},children:G.length===0?"none yet":gt(G.length)})]})},R))})]}),l.length>0?(0,q.jsxs)("section",{style:{...te,display:"grid",gap:10},children:[(0,q.jsx)("h2",{style:J,children:"Recently"}),(0,q.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:l.map(R=>(0,q.jsxs)("li",{style:C,children:[(0,q.jsx)("span",{style:{color:"var(--graview-ink)"},children:R.intent})," \u2014 ",ft(R,e,{graph:n.graph,schema:n.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},R.id))})]}):null]})}var Me=W(Ie(),1);var et=W(j(),1);function Qt({context:t,withheld:e,style:n,testId:a}){let r=ce(),i=ba(e,t.signIn??r?.signIn);return i?(0,et.jsx)("p",{style:{...n,margin:0},children:(0,et.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>i.run(),style:xe,children:i.label})}):e.length===0?null:(0,et.jsx)("ul",{style:{...n,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},...a?{"data-testid":a}:{},children:e.map(o=>(0,et.jsxs)("li",{style:C,children:[(0,et.jsx)("s",{children:o.label})," \u2014 ",o.refusal.message]},o.id))})}var E=W(j(),1);function jn({context:t}){let{store:e,brand:n,principal:a,invariantContext:r}=t;ne(e);let[i]=ct(),o=i.get("q")??"",l=typeof r?.today=="string"?r.today:void 0,d=Cr(e,o,{...a?{principal:a}:{},places:Te(t),flagged:new Set(e.violations(r).flatMap(u=>u.nodeIds)),...l?{today:l}:{},limit:200}),c=d.hits.filter(u=>u.about==="node"),p=d.hits.filter(u=>u.about==="kind"||u.about==="place"||u.about==="rule"),m=[...new Set(c.map(u=>u.kind))],f=o.trim();return(0,E.jsxs)(ae,{context:t,children:[(0,E.jsx)("style",{children:Kt}),(0,E.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,E.jsx)("p",{style:ke,children:"Search"}),(0,E.jsx)(ie,{context:t,"data-testid":"search-heading",children:f.length===0?"Find anything by its name":d.hits.length===0?(0,E.jsxs)(E.Fragment,{children:["Nothing here is called \u201C",f,"\u201D."]}):(0,E.jsxs)(E.Fragment,{children:[wo(e,d.byKind)," for \u201C",f,"\u201D"]})}),f.length>0?(0,E.jsxs)("p",{style:{...C,margin:0},"data-testid":"search-searched",children:[Nt(e.schema,d.searched),d.conditions.filter(u=>u.key!=="is"&&u.admittedBy.length<d.searched.kinds.length).map(u=>(0,E.jsxs)("span",{children:[" ",u.key,":",u.value," narrows"," ",u.admittedBy.length===0?"nothing here":u.admittedBy.map(k=>Q(e,k).toLowerCase()).join(" and "),"."]},`${u.key}:${u.value}`))]}):(0,E.jsxs)("p",{style:re,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,E.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,E.jsx)("code",{children:"is:any"})," includes what is past."]})]}),p.length>0?(0,E.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:p.map(u=>(0,E.jsx)("li",{"data-testid":"search-hit","data-about":u.about,children:u.about==="kind"?(0,E.jsxs)(F,{to:`/${Y(e.schema,u.kind)}`,style:K,children:[u.label,u.count>0?(0,E.jsxs)("span",{style:C,children:[" \xB7 ",u.count," match"]}):null]}):u.about==="place"?(0,E.jsxs)(F,{to:ye(t,u),style:K,children:["Go to ",u.title]}):u.about==="rule"?(0,E.jsxs)(F,{to:"/problems",style:K,children:["The rule \u201C",u.label,"\u201D"]}):null},`${u.about}:${u.about==="rule"?u.name:u.about==="place"?u.as:u.kind}`))}):null,m.map(u=>(0,E.jsxs)("section",{className:"graview-list",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",minWidth:0},"data-testid":"search-group","data-kind":u,children:[(0,E.jsxs)("h2",{className:"graview-group-head",style:{alignItems:"center"},children:[(0,E.jsx)(fe,{kind:u,brand:n,schema:e.schema,size:8}),(0,E.jsx)(F,{to:`/${Y(e.schema,u)}?${new URLSearchParams({q:f}).toString()}`,style:K,"data-testid":"search-kind-link",children:Q(e,u)}),(0,E.jsx)("span",{children:d.byKind[u]})]}),(0,E.jsx)("ul",{className:"graview-rows",children:c.filter(k=>k.kind===u).map(k=>(0,E.jsxs)("li",{"data-testid":"search-hit","data-about":"node",className:"graview-row",children:[(0,E.jsxs)(F,{to:Z(e.schema,u,k.id),className:"graview-row-title",...k.label.length>60?{title:k.label}:{},children:[k.flagged?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,k.label]}),k.apart||!k.current?(0,E.jsx)("span",{className:"graview-row-glance",children:[k.apart,k.current?"":"past"].filter(Boolean).join(" \xB7 ")}):null,(0,E.jsx)(Zt,{why:k.why})]},k.id))})]},u)),f.length>0?(0,E.jsx)(bo,{asked:f}):null,f.length>0&&d.hits.length===0?(0,E.jsx)(Pi,{store:e,kinds:d.searched.kinds,words:d.words,...a?{principal:a}:{},...r?{invariantContext:r}:{}}):null]})}function Zt({why:t}){return t.strength==="near"?(0,E.jsxs)("span",{style:C,"data-testid":"search-why","data-near":"",children:["Near \u201C",t.asked,"\u201D",t.field==="label"?"":` \u2014 ${t.reading}: ${t.fragment}`]}):t.field==="label"?null:(0,E.jsxs)("span",{style:C,"data-testid":"search-why",children:[t.reading,": ",t.fragment]})}function wo(t,e){let n=Object.entries(e).map(([a,r])=>`${r} ${r===1?He(t.schema.tryDefinition(a),a):Q(t,a).toLowerCase()}`);return n.length===0?"Found":n.length===1?Re(n[0]):Re(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function xi(t,e,n={}){let a=[];for(let r of e){let i=Ye(t,r,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let o of Xt(t,r,i.actions.affordances))a.some(l=>l.mutation.name===o.mutation.name)||a.push(o)}return a}function Xt(t,e,n){let a=t.schema.tryDefinition(e)?.fieldRoles?.label,r=[];for(let i of n){let o=t.allMutations().find(c=>c.name===i.mutation);if(!o||!o.creates?.includes(e)||r.some(c=>c.mutation.name===o.name))continue;let l=Et(o.input).map(c=>c.name),d=l.includes("label")?"label":a&&l.includes(a)?a:void 0;!d||i.args[d]!==void 0||r.push({kind:e,affordance:i,mutation:o,arg:d})}return r}function Pi({store:t,kinds:e,words:n,principal:a,invariantContext:r}){let i=xi(t,e,{...a?{principal:a}:{},...r?{invariantContext:r}:{}});return i.length===0||n.trim().length===0?null:(0,E.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:i.map(({kind:o,affordance:l,mutation:d,arg:c})=>(0,E.jsxs)("section",{style:{...te,display:"grid",gap:14},children:[(0,E.jsxs)("h2",{style:J,children:[Re(ua(He(t.schema.tryDefinition(o),o)))," called \u201C",n,"\u201D"]}),(0,E.jsx)(We,{store:t,mutation:d,prefilled:l.args,open:l.open,initial:{[c]:n},...a?{principal:a}:{}})]},`${l.id}|${n}`))})}function bo({asked:t}){let e=ce();return e?(0,E.jsx)(ko,{asked:t,desk:e.aiDesk}):null}function ko({asked:t,desk:e}){return Ka(e)?(0,E.jsx)("p",{style:{margin:0},children:(0,E.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:a=>Ha(e,{pointed:{about:[]},asked:t,returnTo:a.currentTarget}),style:{...K,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",t,"\u2019"]})}):null}var b=W(j(),1),Ci=8,Ri=40;function So(t,e){let n=e?.fields?.shape??{},a=Object.keys(n).find(r=>ma(n[r])&&ga(t[r]));return a===void 0?void 0:t[a]}function zn({context:t}){let e=Ue(),n=$e(t.store.schema,e.slug??"");return n?(0,b.jsx)(Li,{context:t,kind:n}):(0,b.jsx)(ae,{context:t,children:(0,b.jsx)(ie,{context:t,children:"No such kind of thing here."})})}function Li({context:t,kind:e,opening:n,row:a,layout:r="list",description:i,bare:o}){let{store:l,brand:d,invariantContext:c}=t;ne(l);let[p,m]=ct(),f=`list-${(0,Me.useId)().replace(/:/g,"")}`,u=l.schema.tryDefinition(e),k=ya(p.get("archived")),B=l.graph.nodesOfKind(e,{archived:k}),h=Qe(l).relations.filter(s=>s.from===e||s.to===e),R=new Set(l.violations(c).flatMap(s=>s.nodeIds)),G=xr(l.schema,Sr(l.schema,kr(l.schema,e))),M=h.map(s=>s.edgeKind),V=Lo(p,G,M),z=["sort","filter","group","q","by","with","past","archived",...M].some(s=>p.has(s)),se=B.length>=Ri,ue=u?.fieldRoles?.when,I=t.views?.arrangement?.()?.lists?.[e],_=yr(I),oe=fr(I?.group),we=Ro(se,ue),le=n??(_?{...we,..._}:we),ge=z?V.arrangement:Rn(le,G).arrangement,w=_?.sort,y=ge.sort&&w?.then&&ge.sort.by===w.by&&ge.sort.direction===w.direction?{...ge,sort:w}:ge,L=Pr(y.query??""),$=[...y.filter??[],...L.conditions].some(s=>s.key==="is"&&(s.value==="past"||s.value==="any"))||br(u,[...y.filter??[],...L.conditions]),g=$||!u?.lifecycle?y:{...y,filter:[...y.filter??[],{key:"is",value:"current"}]},A=new Map,O=$t(B,g,{schema:l.schema,graph:l.graph,flagged:R,...typeof c?.today=="string"?{today:c.today}:{},read:(s,v)=>{let N=A.get(s.id);return N||A.set(s.id,N=mt(l.schema,l.graph,s)),N[v]}}),ee=oe&&y.group?.by===oe.by&&!y.group.bucket?G.groups.find(s=>s.key===oe.by):void 0,De=oe&&ee&&(ee.type==="choice"||ee.type==="boolean")?hr(O.groups,oe,{type:ee.type,...ee.options?{options:ee.options}:{}}):O.groups.map(s=>({...s,closed:!1})),Ee=new Set((p.get("open")??"").split(",").filter(Boolean)),Oi=!!y.query||(y.filter??[]).some(s=>s.key===oe?.by),Zn=s=>ee?.type==="boolean"?s==="1"?"true":"false":s,Xn=s=>s.closed&&!Oi&&!Ee.has(Zn(s.key)),Fi=s=>{let v=new URLSearchParams(p),N=new Set(Ee);N.has(s)?N.delete(s):N.add(s),N.size>0?v.set("open",[...N].join(",")):v.delete("open"),m(v,{replace:!0})},Ce=O.nodes,nt=u?.lifecycle&&!$?B.filter(s=>it(u,s)):B,Jn=B.length-nt.length,tn=y.group?.by??null,Ii=s=>{let v=new URLSearchParams(p);for(let de of["sort","filter","group","q","by","with","past","archived",...h.map(St=>St.edgeKind)])v.delete(de);let N=Rr(s);for(let de of["sort","filter","group","q","archived"])N[de]&&v.set(de,N[de]);![...v.keys()].some(de=>["sort","filter","group","q"].includes(de))&&(n||_||se||ue)&&v.set("sort",""),m(v)},{principal:at}=t,nn=Ye(l,e,{...at?{principal:at}:{},...t.invariantContext?{context:t.invariantContext}:{}}),Be=nn.actions.affordances.map(s=>({affordance:s,mutation:l.allMutations().find(v=>v.name===s.mutation)})).filter(s=>s.mutation!==void 0),Wi=nn.actions.withheld,an=()=>new Set(Ce.length===0?Be.map(({mutation:s})=>s.name):[]),[rn,ea]=(0,Me.useState)(()=>({kind:e,open:an()}));rn.kind!==e&&ea({kind:e,open:an()});let ta=s=>(rn.kind===e?rn.open:an()).has(s),na=(s,v)=>ea(N=>{let de=new Set(N.open);return v?de.add(s):de.delete(s),{kind:N.kind,open:de}}),aa=`begin-${(0,Me.useId)().replace(/:/g,"")}`,ra=L.words&&Ce.length===0?Object.fromEntries(Xt(l,e,nn.actions.affordances).map(s=>[s.mutation.name,s.arg])):{},ze=Q(l,e),vt=t.views?.lookup(e,{cardinality:"one",fidelity:"glyph"}),on=vt!==void 0&&!st(vt)?vt:void 0,sn=(y.group?.bucket??"day")==="day"?y.group?.by:void 0,ln=(y.filter??[]).map(s=>s.key),Di=ln.filter(s=>ln.indexOf(s)===ln.lastIndexOf(s)&&/choice|boolean/.test(G.filters.find(v=>v.key===s)?.type??"")),dn=s=>{let v={...u?.computed?mt(l.schema,l.graph,s):s};sn&&!String(v[sn]).includes("T")&&delete v[sn];for(let N of Di)delete v[N];return v},wt=s=>{let v=me(u,s);if(a)return(0,b.jsxs)("li",{"data-testid":"record-row","data-graview-record":s.id,style:{minWidth:0},...fn(s.id),children:[mn(s,v),a(s,{label:v,href:Z(l.schema,e,s.id),flagged:R.has(s.id),glance:qt(dn(s),u,v)})]},s.id);if(on){let yn=Wt(vt,s,l.graph),Vi=Object.fromEntries(Object.entries(dn(s)).filter(([Ui])=>!yn?.fields.has(Ui))),da=yn?qt(Vi,u,yn.title??v):"";return(0,b.jsxs)("li",{"data-testid":"record-row","data-graview-record":s.id,style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,paddingBlock:10,borderTop:"1px solid var(--graview-edge)"},...fn(s.id),children:[mn(s,v),(0,b.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,b.jsx)(on,{node:s,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...R.has(s.id)?{flagged:[s.id]}:{}})}),da?(0,b.jsx)("span",{style:{...C,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:da}):null,(0,b.jsx)(Eo,{to:Z(l.schema,e,s.id),label:R.has(s.id)?`${v} \u2014 implicated in a problem`:v})]},s.id)}let N=qt(dn(s),u,v),de=L.words?Ar(u,s,L.words):void 0,St=se?void 0:nr(s,u),xt=So(s,u),la=(0,b.jsxs)(F,{to:Z(l.schema,e,s.id),className:"graview-row-title",...v.length>60?{title:v}:{},children:[R.has(s.id)?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,v]});return(0,b.jsxs)("li",{className:"graview-row","data-graview-record":s.id,...fn(s.id),children:[mn(s,v),St?(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:14,minWidth:0},children:[(0,b.jsx)(Ge,{as:"thumb",file:St}),la]}):la,N||xt?(0,b.jsxs)("span",{className:"graview-row-glance",children:[N,N&&xt?" \xB7 ":null,xt?(0,b.jsx)(Ot,{address:xt}):null]}):null,de?(0,b.jsx)(Zt,{why:de}):null]},s.id)},cn=Te(t).filter(s=>s.kind===e),ia=I?.filters,Hi=(y.filter??[]).some(s=>s.key!=="is"||s.value!=="any"),Ki=!!(y.sort||y.group||y.query||Hi),qi=nt.length>=Ci||z&&Ki,Oe=y.sort?G.sorts.find(s=>s.key===y.sort.by):void 0,pn=Oe?.type==="date"||Oe!==void 0&&Oe.key===ue,oa=se&&!O.grouped&&Oe&&(Oe.about==="label"||Oe.type==="text"||pn)?s=>{let v=Oe.about==="label"?me(u,s):s[Oe.key];if(typeof v!="string"||v.length===0)return pn?"No date":"#";if(pn)return v.slice(0,4);let N=v.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(N)?N:"#"}:void 0,_e=oa?Ce.reduce((s,v)=>{let N=oa(v);return s.at(-1)?.key===N?s.at(-1).nodes.push(v):s.push({key:N,nodes:[v]}),s},[]):void 0,sa=O.grouped&&tn?De.flatMap(s=>Xn(s)?[]:s.nodes):_e&&_e.length>1?_e.flatMap(s=>s.nodes):Ce,un=(0,Me.useMemo)(()=>sa.map(s=>s.id),[sa.map(s=>s.id).join(`
|
|
109
|
-
`)]),Ne=Nr(un),gn=(0,Me.useId)(),pt=(at?l.permittedMutations(at):l.permittedMutations()).some(s=>{let v=s.subject?.kinds;return v!==void 0&&(v==="*"||v.includes(e))}),mn=(s,v)=>pt?(0,b.jsx)("span",{className:"graview-choose-at",children:(0,b.jsx)("input",{...Ne.boxProps(s.id,v),onPointerEnter:Ln,onFocus:Ln})}):null,fn=s=>pt?{"data-graview-choose":s}:{},Bi=(0,Me.useCallback)(s=>{Ne.choose(s),requestAnimationFrame(()=>{let v=Ne.list.current;((s[0]===void 0?null:v?.querySelector(`[data-graview-choose-box="${CSS.escape(s[0])}"]`))??v)?.focus({preventScroll:!0})})},[Ne]),rt=r==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",alignItems:"start",gap:12}:a||on?{margin:0,padding:0,listStyle:"none",display:"grid",gap:a&&r==="list"?6:0}:void 0,bt=rt?void 0:"graview-rows",ut=s=>`list-at-${s.replace(/[^\p{L}\p{N}]/gu,"_")}`,kt=h.map(s=>{let v=s.from===e?s.to:s.from,N=s.from===e?s.description:s.inverse??s.description;return{relation:s,far:v,words:N}}),Gi=new Set(kt.map(s=>(s.words??"").toLowerCase()).filter((s,v,N)=>s&&N.indexOf(s)!==v));return(0,b.jsxs)(o?Co:ae,{context:t,children:[(0,b.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,b.jsxs)("header",{style:{display:"grid",gap:4},children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",columnGap:10,rowGap:4,minWidth:0},children:[(0,b.jsx)(fe,{kind:e,brand:d,schema:l.schema,size:8}),(0,b.jsx)(ie,{context:t,children:ze}),Be.length>0?(0,b.jsx)("span",{style:{marginLeft:"auto",display:"flex",flexWrap:"wrap",columnGap:14,rowGap:8},"data-testid":"beginnings-open",children:Be.map(({affordance:s,mutation:v})=>(0,b.jsx)(To,{name:v.name,title:v.title??v.name,panel:`${aa}-${v.name}`,open:ta(v.name),onOpen:N=>na(v.name,N)},s.id))}):null]}),Ce.length>0?(0,b.jsx)(Zr,{place:"here",to:[{label:`Skip to the ${Ce.length===1?He(u,e):`${Ce.length} ${ze.toLowerCase()}`}`,testid:"records",go:()=>{let s=document.querySelector(`[data-graview-skip-target="${CSS.escape(gn)}"]`);Tn(s?.querySelector('[data-graview-choose-box][tabindex="0"]')??s)}},...nt.length>0?[{label:"Skip to arranging them",testid:"arranging",go:()=>{let s=document.querySelector(`[data-graview-skip-target="${CSS.escape(gn)}"]`)?.parentElement?.querySelector('[role="group"][aria-label="Arrange"]');Tn(s?.querySelector('button[data-testid$="-add"], button[data-testid$="-all"]')??s)}}]:[]]}):null,i??u?.description?(0,b.jsx)("p",{style:re,children:i??u?.description}):null,kt.length>0||cn.length>0?(0,b.jsxs)("p",{style:{...C,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[kt.length>0?(0,b.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",kt.map(({relation:s,far:v,words:N},de)=>(0,b.jsxs)("span",{"data-relation":s.edgeKind,children:[de>0?(0,b.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,v==="*"?Re(N??be(s.edgeKind)):(0,b.jsx)(F,{to:`/${Y(l.schema,v)}`,style:K,title:Q(l,v),children:N&&Gi.has(N.toLowerCase())?`${Re(N)}: ${Q(l,v).toLowerCase()}`:Re(N??Q(l,v))})]},`${s.edgeKind}|${s.from}|${s.to}`))]}):null,cn.length>0?(0,b.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",cn.map((s,v)=>(0,b.jsxs)("span",{children:[v>0?(0,b.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,b.jsx)(F,{to:ye(t,s),style:K,children:s.title})]},Xe(s)))]}):null]}):null]}),Be.length>0?(0,b.jsx)("div",{style:{display:"contents"},"data-testid":"beginnings",children:Be.map(({affordance:s,mutation:v})=>{let N=!!(ra[v.name]&&Ce.length===0);return(0,b.jsx)(Mo,{name:v.name,id:`${aa}-${v.name}`,description:v.description,open:ta(v.name),onClose:()=>na(v.name,!1),children:(0,b.jsx)(We,{store:l,mutation:v,prefilled:s.args,open:s.open,...N?{initial:{[ra[v.name]]:L.words}}:{},...t.principal?{principal:t.principal}:{}},N?`${v.name}|${L.words}`:v.name)},s.id)})}):null,V.dropped.length>0?(0,b.jsxs)("p",{style:{...C,margin:0},"data-testid":"list-dropped",children:["This link asked for ",V.dropped.join(", "),", which ",ze.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,nt.length>0?(0,b.jsx)(Mr,{schema:l.schema,graph:l.graph,kind:e,arrangement:y,onChange:Ii,kept:{shown:Ce.length,of:nt.length},noun:{one:He(u,e),many:ze.toLowerCase()},...qi?{}:{allow:!1},...ia?{filters:ia}:{},offers:G,chips:{nodes:nt,flagged:R,...typeof c?.today=="string"?{today:c.today}:{}},query:t.framed===!0&&t.barAbove!==!0}):null,(0,b.jsx)("style",{children:Kt}),pt?(0,b.jsx)("style",{children:$r+Ao}):null,(0,b.jsx)("div",{className:"graview-list","data-graview-skip-target":gn,...pt?{...Ne.listProps,ref:Ne.list,tabIndex:-1,"data-graview-choosable":"","aria-label":Ne.chosen.length>0?`${ze}, ${Ne.chosen.length} chosen`:ze,role:"group"}:{},children:Ce.length===0&&L.words?(0,b.jsxs)("p",{style:re,"data-testid":"none-yet",children:["Nothing here is called \u201C",L.words,"\u201D."," ",(0,b.jsx)("span",{style:C,"data-testid":"list-searched",children:Nt(l.schema,{kinds:[e],past:$})})," ",(0,b.jsx)(F,{to:"?",style:K,children:"Show every one"})]}):Ce.length===0?(0,b.jsxs)("p",{style:re,"data-testid":"none-yet",children:[y.filter?.length||y.query?"None of them.":"None yet",!y.filter?.length&&!y.query&&Be.length>0?` \u2014 the first one starts above, with \u201C${Be[0]?.mutation.title??Be[0]?.mutation.name}\u201D.`:!y.filter?.length&&!y.query?".":"",y.filter?.length||y.query?(0,b.jsxs)(b.Fragment,{children:[" ",(0,b.jsx)(F,{to:"?",style:K,children:"Show every one"})]}):null]}):O.grouped&&tn?(0,b.jsx)("div",{style:{display:"grid",gap:"1rem"},"data-testid":"records","data-grouped":tn,children:De.map(s=>{if(!s.closed)return(0,b.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,b.jsxs)("h2",{className:"graview-group-head",children:[s.label," ",(0,b.jsx)("span",{children:s.nodes.length})]}),(0,b.jsx)("ul",{style:rt,className:bt,"data-graview-rows":"",children:s.nodes.map(wt)})]},s.key||"-");let v=Xn(s),N=`${f}-${ut(s.key||"none")}`;return(0,b.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group","data-closed":v?"shut":"open",children:[(0,b.jsx)("h2",{className:"graview-group-head",children:(0,b.jsxs)("button",{type:"button",className:"graview-group-toggle","aria-expanded":!v,"aria-controls":N,"data-testid":"list-group-toggle",onClick:()=>Fi(Zn(s.key)),children:[(0,b.jsx)("span",{"aria-hidden":"true",children:v?"\u25B8":"\u25BE"}),s.label," ",(0,b.jsxs)("span",{children:["\xB7 ",s.nodes.length]}),(0,b.jsxs)("span",{style:xo,children:[" ",s.nodes.length===1?He(u,e):ze.toLowerCase()]})]})}),(0,b.jsx)("ul",{id:N,style:v?{...rt,display:"none"}:rt,className:bt,"data-graview-rows":"",hidden:v,children:v?null:s.nodes.map(wt)})]},s.key||"-")})}):_e&&_e.length>1?(0,b.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":Oe?.type==="date"?"year":"letter",children:[(0,b.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...C,display:"flex",flexWrap:"wrap",gap:Oe?.type==="date"?"0 10px":"0 4px",lineHeight:1.3},children:_e.map(s=>(0,b.jsx)("a",{href:`#${ut(s.key)}`,onClick:v=>{v.preventDefault(),document.getElementById(ut(s.key))?.scrollIntoView({block:"start"})},style:{...Se,minWidth:24,justifyContent:"center"},children:s.key},s.key))}),_e.map(s=>(0,b.jsxs)("section",{"data-testid":"list-section","aria-labelledby":ut(s.key),style:{display:"grid",gap:0},children:[(0,b.jsx)("h2",{id:ut(s.key),className:"graview-group-head",children:s.key}),(0,b.jsx)("ul",{style:rt,className:bt,"data-graview-rows":"",children:s.nodes.map(wt)})]},s.key))]}):(0,b.jsx)("ul",{style:rt,className:bt,"data-testid":"records","data-graview-rows":"",children:Ce.map(wt)})}),pt?(0,b.jsx)(Or,{store:l,chosen:Ne.chosen,...at?{principal:at}:{},...c?{context:c}:{},anchor:Po,of:un.length,onChooseAll:()=>Ne.choose(un),onClear:Ne.clear,onActed:Bi}):null,Jn>0?(0,b.jsxs)(F,{to:Ai(p,"filter","is:any"),style:{...K,...C,justifySelf:"start"},"data-testid":"past-link",children:["+",Jn," past"]}):null,k===!1&&l.graph.count(e,{archived:!0})>0?(0,b.jsxs)(F,{to:Ai(p,"archived","true"),style:{...K,...C,justifySelf:"start"},"data-testid":"archived-link",children:["+",l.graph.count(e,{archived:!0})," archived"]}):null]}),(0,b.jsx)(Qt,{context:t,withheld:Wi,style:te,testId:"withheld"})]})}var xo={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Po=()=>document.querySelector("[data-graview-choosable]")?.closest("[data-embed-content]")??null,Ao=`
|
|
110
|
-
.graview-list[data-graview-choosable]{outline:none}
|
|
111
|
-
.graview-list [data-graview-choose]{position:relative;padding-left:34px}
|
|
112
|
-
.graview-choose-at{position:absolute;left:2px;top:0;bottom:0;z-index:${ka.raised};display:flex;align-items:center}
|
|
113
|
-
@media (pointer: coarse){
|
|
114
|
-
.graview-list:not([data-graview-choosing]) [data-graview-choose]{padding-left:0}
|
|
115
|
-
.graview-list:not([data-graview-choosing]) .graview-choose-at{display:none}
|
|
116
|
-
}
|
|
117
|
-
`;function Co({children:t}){return(0,b.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:t})}var Ro=(t,e)=>e?{sort:{by:e,direction:"desc"}}:t?{sort:{by:"label",direction:"asc"}}:{};function Lo(t,e,n){let a=Ct({...t.get("sort")?{sort:t.get("sort")}:{},...t.get("filter")?{filter:t.get("filter")}:{},...t.get("group")?{group:t.get("group")}:{},...t.get("q")?{q:t.get("q")}:{},...t.get("archived")?{archived:t.get("archived")}:{}}),r=[...a.filter??[]],i=t.get("by"),o=a.group??(i?{by:i}:void 0);for(let d of n){let c=t.get(d);c&&r.push({key:d,value:c})}let l=t.get("with");return l&&r.push({key:l,value:"*"}),t.get("past")==="1"&&!r.some(d=>d.key==="is")&&r.push({key:"is",value:"any"}),Rn({...a.sort?{sort:a.sort}:{},...a.query?{query:a.query}:{},...r.length>0?{filter:r}:{},...o?{group:o}:{},...a.archived!==void 0?{archived:a.archived}:{}},e)}function Ai(t,e,n){let a=new URLSearchParams(t);return a.set(e,n),a.delete("past"),`?${a.toString()}`}function To({name:t,title:e,panel:n,open:a,onOpen:r}){return(0,b.jsxs)("button",{type:"button","data-testid":`act-open-${t}`,"data-graview-act":t,"aria-expanded":a,"aria-controls":n,onClick:()=>{r(!a),a||requestAnimationFrame(()=>document.getElementById(n)?.querySelector("input, select, textarea, button")?.focus())},style:{...Se,minHeight:28,margin:"-4px 0",padding:"0 2px",border:0,background:"none",font:"inherit",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,b.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),e]})}function Mo({name:t,id:e,description:n,open:a,onClose:r,children:i}){return(0,b.jsxs)("div",{"data-testid":`act-${t}`,id:e,hidden:!a,onKeyDown:o=>{o.key==="Escape"&&(o.preventDefault(),r(),document.querySelector(`[aria-controls="${e}"]`)?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,b.jsx)("p",{style:{...C,margin:0,maxWidth:"58ch"},children:n}):null,i]})}function Eo({to:t,label:e}){let n=(0,Me.useRef)(null);return Fr(n),(0,b.jsx)(F,{ref:n,to:t,"aria-label":e,style:{position:"absolute",inset:0,borderRadius:6}})}var tt=W(Ie(),1);var ht=W(Ie(),1);var D=W(j(),1);function _n({context:t}){let{store:e,brand:n,invariantContext:a,principal:r}=t;ne(e);let i=e.violations(a),o=e.allInvariants(),l=Lt(e,i),d=qa(e.schema,o);return(0,D.jsxs)(ae,{context:t,children:[(0,D.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,D.jsx)(ie,{context:t,children:i.length===0?"All rules hold":"What is broken"}),(0,D.jsx)("p",{style:re,"data-testid":"problems-count",children:i.length===0?"Every declared rule is satisfied by what is here.":ha(i)})]}),(0,D.jsx)(Si,{context:t}),l.map((c,p)=>{let m=c.nodeIds[0],f=m?e.graph.getNode(m):void 0;return(0,D.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,D.jsx)(Jt,{violation:c,schema:e.schema,...n?{brand:n}:{}}),f?(0,D.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,D.jsx)(fe,{kind:f.kind,brand:n,schema:e.schema,size:7}),(0,D.jsx)(F,{to:Z(e.schema,f.kind,f.id),style:K,children:me(e.schema.tryDefinition(f.kind),f)})]}):null,c.line?(0,D.jsx)(Jt,{violation:c,schema:e.schema,...n?{brand:n}:{}}):null,(0,D.jsx)(en,{store:e,repairs:c.repairs,...r?{principal:r}:{}})]},p)}),o.length>0?(0,D.jsxs)("section",{style:{...te,display:"grid",gap:12},"data-testid":"rules",children:[(0,D.jsx)("h2",{style:J,children:"The rules"}),(0,D.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:o.map(c=>{let p=i.filter(u=>u.invariant===c.name).length,m=d.get(c.name),f=c.label??c.name;return(0,D.jsxs)("li",{"data-graview-rule":c.name,style:{display:"grid",gap:2},children:[(0,D.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[m?(0,D.jsx)(Tt,{line:m,schema:e.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,D.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:f}),(0,D.jsx)("span",{style:{...C,color:p>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:p===0?"holds":`broken in ${p} ${p===1?"place":"places"}`})]}),m&&f.trim().length>0?(0,D.jsx)("span",{style:C,children:f}):null]},c.name)})})]}):null]})}function Jt({violation:t,schema:e,brand:n}){if(!t.line)return(0,D.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:t.message});let a=Ga(t),r=Ba(t);return r?(0,D.jsxs)("div",{style:{display:"grid",gap:4},"data-testid":"problem-line",children:[(0,D.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},"data-testid":"problem-says",children:r}),a?(0,D.jsx)("span",{style:C,children:a}):null,(0,D.jsxs)("details",{"data-testid":"problem-judged",style:C,children:[(0,D.jsx)("summary",{style:{cursor:"pointer",width:"fit-content",minHeight:24},children:"How it is judged"}),(0,D.jsx)(Tt,{line:t.line,schema:e,...n?{brand:n}:{},lead:"none"})]})]}):(0,D.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",children:[(0,D.jsx)(Tt,{line:t.line,schema:e,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)"}}),a?(0,D.jsx)("span",{style:C,children:a}):null]})}function en({store:t,repairs:e,principal:n}){let[a,r]=(0,ht.useState)(null),[i,o]=(0,ht.useState)(null),l=(0,ht.useRef)([]);if(e.length===0)return null;let d=a===null?null:e[a],c=d&&(d.missing??[]).length>0?t.allMutations().find(p=>p.name===d.mutation):void 0;return(0,D.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,D.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:e.map((p,m)=>{let f=(p.missing??[]).length>0,u=t.permits({name:p.mutation,args:{...p.args}},n);return u.ok?(0,D.jsx)("button",{ref:k=>{l.current[m]=k},type:"button","data-graview-repair":p.mutation,"data-graview-asks":f||void 0,"aria-expanded":f?a===m:void 0,onClick:()=>{if(o(null),f){r(a===m?null:m);return}r(null);try{t.apply({name:p.mutation,args:{...p.args}},n?{author:n}:{})}catch(k){o(lt(t.schema,t.allMutations(),k))}},style:xe,children:f?`${p.label} \u2026`:p.label},m):(0,D.jsxs)("p",{"data-testid":"withheld","data-withheld":u.refusal.wouldNeed.join(",")||"nobody",style:{...C,margin:0},children:[(0,D.jsx)("s",{children:p.label})," \u2014 ",u.refusal.message]},m)})}),c&&d?(0,D.jsx)(We,{store:t,mutation:c,prefilled:{...d.args},only:d.missing??[],label:d.label,onDone:()=>{let p=a;r(null),requestAnimationFrame(()=>{let m=p===null?null:l.current[p];if(m?.isConnected){m.focus();return}let f=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");f&&(f.hasAttribute("tabindex")||(f.tabIndex=-1),f.focus())})},...n?{principal:n}:{}}):null,d&&!c&&(d.missing??[]).length>0?(0,D.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:Mn},children:["\u201C",d.label,"\u201D names ",d.mutation,", which this app does not declare."]}):null,i?(0,D.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:Mn},children:i}):null]})}var Yn=W(Ie(),1);var je=W(j(),1);function Ti({store:t,link:e,principal:n}){let[a,r]=(0,Yn.useState)(!1),[i,o]=(0,Yn.useState)(null),l=Xa(e);return(0,je.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,je.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,je.jsxs)("span",{style:{...C,display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,je.jsx)("span",{children:l}),(0,je.jsx)("button",{type:"button",style:{...xe,padding:"4px 10px"},onClick:()=>{try{t.apply({name:va,args:{kind:e.edge.kind,from:e.edge.from,to:e.edge.to}},n?{author:n}:{}),r(!1)}catch(d){o(lt(t.schema,t.allMutations(),d))}},children:"Keep this link"}),i?(0,je.jsx)("span",{role:"alert",children:i}):null]}):null]})}var ve=W(j(),1);function Mi({nodeId:t,node:e,field:n,inPlace:a,labelStyle:r=ke}){return n.files?(0,ve.jsx)(Ge,{as:"field",read:!a,nodeId:t,field:n.key,label:n.label,files:n.files,labelStyle:r,style:{gap:4}}):n.long?(0,ve.jsx)(Tr,{nodeId:t,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,ve.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,ve.jsx)("dt",{style:r,children:n.label}),(0,ve.jsx)("dd",{style:{margin:0,overflowWrap:"anywhere",minWidth:0},children:n.linked?(0,ve.jsx)(rr,{relation:n.linked.relation,refs:n.linked.refs,...a?{nodeId:t,field:n.key}:{}}):n.app?(0,ve.jsx)(Ot,{address:n.app,as:"record",...a?{nodeId:t,field:n.key}:{}}):n.href?(0,ve.jsx)(Lr,{href:n.href,field:n.key,value:n.value,stored:n.stored,...a?{nodeId:t}:{}}):a?(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(Ft,{nodeId:t,field:n.key,value:n.value,stored:n.stored}),n.repeats?(0,ve.jsx)(sr,{nodeId:t,field:n.key,start:e?.[n.key],value:e?.[`${n.key}Repeat`],label:`${n.label} repeats`}):null]}):n.value})]})}var S=W(j(),1),No=[];function Qn({context:t}){let{store:e,brand:n,principal:a,invariantContext:r}=t;ne(e);let i=ce()!==null,o=Ue(),l=decodeURIComponent(o.id??""),d=si(e,l,{...a?{principal:a}:{},...r?{context:r}:{}}),c=Lt(e,d?.violations??No),[p,m]=(0,tt.useState)(null),[f,u]=(0,tt.useState)(!1),[k,B]=(0,tt.useState)(null),h=(0,tt.useRef)(null),R=(0,tt.useRef)(null),G=g=>{(h.current?.parentElement?.querySelector(`[data-affordance="${g.replace(/["\\]/g,"\\$&")}"]`)??h.current)?.focus()};if(!d)return(0,S.jsx)(ae,{context:t,children:(0,S.jsx)(ie,{context:t,children:"Nothing lives at this address."})});let M=e.graph.getNode(l),V=e.schema.tryDefinition(d.kind),z=V?.describe&&M?Va(V,M):null,se=[...e.log.all()].filter(g=>!At(g)&&(g.writes.includes(l)||g.reads.includes(l))).slice(-8).reverse(),ue=e.log.all().find(g=>!At(g)&&g.undoes===void 0&&g.primitives.some(A=>A.op==="add-node"&&A.node.id===l)),I=d.actions.affordances.filter(g=>g.provider!=="invariant"),_=I.filter(g=>g.destructive||g.setsAside),oe=f||_.length<2?I:I.filter(g=>!_.includes(g)),we=t.views?.lookup(d.kind,{cardinality:"one",fidelity:"full"}),le=we!==void 0&&!st(we)?we:void 0,ge=le&&M?Wt(we,M,e.graph):void 0,w=ge?d.fields.filter(g=>!ge.fields.has(g.key)):d.fields,y=ge?d.links.flatMap(g=>{let A=g.targets.filter(O=>!ge.records.has(O.id));return A.length>0?[{...g,targets:A}]:[]}):d.links,L=le!==void 0&&Wa(we),$=i&&tr(V).length>0;return(0,S.jsxs)(ae,{context:t,children:[(0,S.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,S.jsxs)("p",{style:{...ke,display:"flex",alignItems:"center",gap:8},children:[(0,S.jsx)(fe,{kind:d.kind,brand:n,schema:e.schema,size:8}),(0,S.jsx)(F,{to:`/${Y(e.schema,d.kind)}`,style:Se,children:Q(e,d.kind)})]}),(0,S.jsx)(ie,{context:t,children:i&&M?.label===d.label?(0,S.jsx)(Ft,{nodeId:l,field:"label",value:d.label,said:d.label}):d.label}),z&&z!==d.label?(0,S.jsx)("p",{style:re,children:z}):null,ue?.lineage?(0,S.jsxs)("p",{style:{...C,margin:0},"data-testid":"record-lineage",children:["Made by ",ft(ue,a,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),", ",Sn(ue.lineage)]}):null,(0,S.jsx)(Gt,{context:t,stop:`#focus=${encodeURIComponent(l)}`,style:{...K,...C},"data-testid":"spatial-link"}),i&&M?(0,S.jsx)(Pn,{choices:[{on:"changed",record:l},{on:"act",record:l},{on:"reaches",kind:d.kind,condition:"",record:l}],label:"Notify me when this changes",testId:"record-notify",style:{...xe,...C,justifySelf:"start"}}):null,Te(t).some(g=>g.kind===d.kind||g.across===d.kind)?(0,S.jsxs)("p",{style:{...C,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",Te(t).filter(g=>g.kind===d.kind||g.across===d.kind).map((g,A)=>(0,S.jsxs)("span",{children:[A>0?(0,S.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,S.jsx)(F,{to:ye(t,g),style:K,children:g.title})," ",(0,S.jsx)(Gt,{context:t,stop:`#view=${encodeURIComponent(g.as)}`,style:{...K,...C,display:"inline-block",minWidth:24,textAlign:"center"},title:`${g.title}, in the scene`,label:`${g.title}, in the scene`,children:(0,S.jsx)("span",{"aria-hidden":"true",children:"\u2197"})})]},Xe(g)))]}):null]}),M&&fa(M)?(0,S.jsx)(Oo,{context:t,id:l,kind:d.kind}):null,M&&wa(e,l)?(0,S.jsx)($o,{context:t,id:l,kind:d.kind}):null,le&&M?(0,S.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,S.jsx)(Ir,{children:(0,S.jsx)(le,{node:M,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...d.violations.length>0?{flagged:[l]}:{}})})}):null,d.violations.length>0?(0,S.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((g,A)=>(0,S.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,S.jsx)(Jt,{violation:g,schema:e.schema,...n?{brand:n}:{}}),(0,S.jsx)(en,{store:e,repairs:li(d.actions,g.repairs),...a?{principal:a}:{}})]},A))}):null,!L&&(w.length>0||$)?(0,S.jsxs)("section",{style:{...te,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,S.jsx)("h2",{style:J,children:"The facts"}),ja(V,w).map((g,A)=>{let O=(0,S.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:g.fields.map(ee=>(0,S.jsx)(Mi,{nodeId:l,node:M,field:ee,inPlace:i},ee.key))});return g.title?(0,S.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,S.jsx)("h3",{"data-graview-field-group":g.title,style:{...J,fontSize:"inherit"},children:g.title}),O]},A):(0,S.jsx)("div",{children:O},A)}),$?(0,S.jsx)(Ge,{as:"unfilled",nodeId:l,skip:[...ge?.fields??[]],labelStyle:ke,style:{gap:4}}):null]}):null,(L?[]:y).map(g=>(0,S.jsxs)("section",{style:{...te,display:"grid",gap:10},children:[(0,S.jsx)("p",{style:ke,children:Jr(e,g)}),g.description?(0,S.jsx)("h2",{style:J,children:Re(g.description)}):(0,S.jsxs)("h2",{style:J,"aria-label":be(g.edgeKind),children:[g.direction==="in"?"\u2190 ":"\u2192 ",be(g.edgeKind)]}),(0,S.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:g.targets.map(A=>{let O=Ja(e,g.direction==="in"?{kind:g.edgeKind,from:A.id,to:l}:{kind:g.edgeKind,from:l,to:A.id});return(0,S.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,S.jsx)(fe,{kind:A.kind,brand:n,schema:e.schema,size:7}),(0,S.jsxs)(F,{to:Z(e.schema,A.kind,A.id),style:K,children:[A.label,A.apart?(0,S.jsxs)("span",{style:C,children:[" \xB7 ",A.apart]}):null]}),O?.provisional?(0,S.jsx)(Ti,{store:e,link:O,...a?{principal:a}:{}}):null]},A.id)})}),(g.direction==="out"&&e.schema.edge(g.edgeKind)?.cardinality==="one"?[]:[...new Set(g.targets.map(A=>A.kind))]).map(A=>(0,S.jsxs)(F,{to:`/${Y(e.schema,A)}?${encodeURIComponent(g.edgeKind)}=${encodeURIComponent(l)}`,style:{...K,...C},"data-testid":"related-all",children:["Sort and filter ",g.description??`these ${Q(e,A).toLowerCase()}`,g.targets.some(O=>O.kind!==A)?` (${Q(e,A).toLowerCase()})`:""," ",(0,S.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]},A))]},`${g.edgeKind}|${g.direction}|${g.description??""}`)),!L&&(I.length>0||d.actions.withheld.length>0)?(0,S.jsxs)("section",{style:{...te,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,S.jsx)("h2",{style:J,ref:h,tabIndex:-1,children:"What can be done"}),(0,S.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[oe.map(g=>{let A=p===g.id;return(0,S.jsx)("button",{type:"button","data-affordance":g.id,"data-rank":g.rank,"data-graview-act":g.mutation,autoFocus:f&&g===_[0],"aria-expanded":A,onClick:()=>{m(A?null:g.id),A||requestAnimationFrame(()=>R.current?.querySelector("input:not([type=hidden]), select, textarea, button")?.focus())},style:{...xe,...A?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:g.label},g.id)}),oe.length<I.length?(0,S.jsxs)("button",{type:"button","aria-expanded":!1,onClick:()=>u(!0),style:{...xe,...C},"data-testid":"record-actions-more",children:["Show ",I.length-oe.length," more"]}):null]}),I.map(g=>{if(p!==g.id)return null;let A=e.allMutations().find(O=>O.name===g.mutation);return A?(0,S.jsxs)("div",{ref:R,onKeyDown:O=>{if(O.key!=="Escape"||O.defaultPrevented)return;O.preventDefault(),m(null);let ee=g.id;requestAnimationFrame(()=>G(ee))},style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,S.jsx)("h3",{style:J,children:g.label}),A.description?(0,S.jsx)("p",{style:{...C,margin:0},children:A.description}):null,(0,S.jsx)(We,{store:e,mutation:A,prefilled:g.args,open:g.open,label:g.label,onDone:()=>{m(null),B(g.mutation);let O=g.id;requestAnimationFrame(()=>G(O))},...a?{principal:a}:{}})]},g.id):null}),i&&k!==null&&p===null?(0,S.jsx)(Pn,{choices:[{on:"act",act:k,record:l},{on:"act",act:k}],label:"Notify me when someone else does this",testId:"notify-after-act",style:{...xe,...C,justifySelf:"start"}}):null,(0,S.jsx)(Qt,{context:t,withheld:d.actions.withheld})]}):null,i?(0,S.jsx)(Xr,{id:l,style:te,headingStyle:J}):null,se.length>0?(0,S.jsxs)("section",{style:{...te,display:"grid",gap:10},"data-testid":"record-history",children:[(0,S.jsx)("h2",{style:J,children:"What has happened"}),(0,S.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:se.map(g=>(0,S.jsxs)("li",{style:C,children:[(0,S.jsx)("span",{style:{color:"var(--graview-ink)"},children:g.intent}),g.lineage?(0,S.jsxs)("span",{"data-graview-lineage":"",children:[" \xB7 ",Sn(g.lineage)]}):null," \u2014 ",ft(g,a,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},g.id))})]}):null]})}function $o({context:t,id:e,kind:n}){let{store:a,principal:r}=t,i={name:`allow-tidying-${n}`,args:{id:e}},o=a.allMutations().some(l=>l.name===i.name)&&a.permits(i,r).ok;return(0,S.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,S.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,S.jsx)("strong",{children:"Left alone."})," Nothing automated changes it; tidying passes it by."]}),o?(0,S.jsx)("button",{type:"button",style:xe,"data-testid":"allow-tidying",onClick:()=>a.apply(i,r?{author:r}:{}),children:"Allow tidying again"}):null]})}function Oo({context:t,id:e,kind:n}){let{store:a,principal:r}=t,i={name:`unarchive-${n}`,args:{id:e}},o=a.allMutations().some(c=>c.name===i.name)&&a.permits(i,r).ok,l=[...a.log.all()].reverse().find(c=>!At(c)&&c.mergedInto!==void 0&&c.writes.includes(e)),d=l?.mergedInto!==void 0?a.graph.getNode(l.mergedInto):void 0;return(0,S.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,S.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,S.jsx)("strong",{children:"Archived."})," Kept with its ties and history, and out of lists, counts and rules.",d?(0,S.jsxs)(S.Fragment,{children:[" ","Merged into ",(0,S.jsx)(F,{to:Z(a.schema,d.kind,d.id),style:K,children:me(a.schema.tryDefinition(d.kind),d)}),"."]}):null]}),o?(0,S.jsx)("button",{type:"button",style:xe,"data-testid":"bring-it-back",onClick:()=>a.apply(i,r?{author:r}:{}),children:"Bring it back"}):null]})}var P=W(j(),1),Fo=(0,U.lazy)(Rt(()=>(__graviewPreload(import.meta.url,["./chunk.MUPO5S2A.js","./chunk.JYJ4LZJJ.js","./chunk.UGFDSE37.js","./chunk.USZPOOLZ.js","./chunk.C4TSM4W5.js","./chunk.XEKLEHC3.js","./chunk.53CDFJNM.js","./chunk.4QPVS2ZM.js","./chunk.RCM7NOPF.js","./chunk.Z7LDT55A.js","./chunk.BQRAIU5R.js","./chunk.57R2GXXN.js","./chunk.BFNVG5JE.js","./chunk.AIZQBPGU.js","./chunk.V3V47QRE.js","./chunk.5P556A7W.js","./chunk.QHYXXZRD.js","./chunk.BELCPW66.js","./chunk.6YPLZNVT.js","./chunk.5RABSIF7.js","./chunk.NGDXH66B.js","./chunk.67WWRC6Y.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.N6MVK3KD.js","./chunk.I7XSDXQ3.js","./chunk.UHI3D7JC.js","./chunk.WVDKYUF3.js","./chunk.ZHLQWMV5.js","./chunk.TNESS3LQ.js","./chunk.GZHZLJBF.js","./chunk.42XSBKPO.js","./chunk.OJGHDWI6.js","./chunk.6FNMDAX5.js","./chunk.2FLPDPEL.js","./chunk.UUBYFBPN.js","./chunk.2RVUDRRY.js","./chunk.JHEVGLKB.js","./chunk.FOQZADMA.js","./chunk.SDO3U72B.js","./chunk.V5MYKNL7.js","./chunk.AJZBJBMO.js"]),import("./chunk.4EEWBCT2.js")).then(t=>({default:t.DraftPage})))),Io={kind:"human"};function Wo({list:t,store:e}){let n=new Set(t.members.map(o=>o.kind)),a=t.total-t.members.length,r=n.size===1?[...n][0]:void 0;if(!r)return(0,P.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${a} more`});let i=ot(e.schema,r).toLowerCase();return(0,P.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,P.jsx)(F,{to:`/${Y(e.schema,r)}`,className:"graview-spec-link graview-spec-see-all","data-testid":"see-all",children:t.total===e.graph.nodesOfKind(r).length?`See all ${gt(t.total)} ${i}`:`${gt(a)} more \xB7 all ${i}`})})}function Do({context:t,children:e}){let n=Ke(),a=t.store.schema,r=Vt("/").replace(/\/$/,""),i=(0,U.useMemo)(()=>({href:o=>`${r}${Z(a,o.kind,o.id)}`,go:o=>n(Z(a,o.kind,o.id)),more:o=>(0,P.jsx)(Wo,{list:o,store:t.store})}),[r,a,n,t.store]);return(0,P.jsx)(It.Provider,{value:i,children:(0,P.jsx)(Wr.Provider,{value:(t.titleLevel??(t.framed&&!t.barAbove?1:2))-1,children:e})})}function Ho({steering:t}){let e=Pe(),n=Ke(),a=`${e.pathname}${e.search}`;return(0,U.useLayoutEffect)(()=>t.at(a),[a,t]),(0,U.useLayoutEffect)(()=>{let r=o=>{o!==a&&n(o)};t.go.current=r;let i=t.pending?.current;return i!==void 0&&(t.pending.current=void 0,r(i)),()=>{t.go.current===r&&(t.go.current=void 0)}},[a,n,t]),null}function Ko({context:t,to:e}){let{pathname:n}=Pe(),a=ce(),r=(e??a)?.sayWhere,i=qo(t,n);return(0,U.useEffect)(()=>(r?.(i),()=>r?.(null)),[r,i]),null}function qo(t,e){let[n="",a,r]=e.split("/").filter(Boolean).map(o=>{try{return decodeURIComponent(o)}catch{return o}});if(r!==void 0)return"#";if(n==="places"&&a!==void 0){if(a===wn)return"#overview=1";let o=t.views?.places().find(l=>l.as===a);return o?`#focus=${encodeURIComponent(Fe(o.kind))}&view=${encodeURIComponent(o.as)}`:"#"}let i=$e(t.store.schema,n);return i?`#focus=${encodeURIComponent(a??Fe(i))}`:"#"}function Bo({onNavigate:t,path:e}){let n=Pe(),a=Nn(),r=Ke(),i=n.hash&&!n.hash.includes("=")?n.hash:"",o=`${n.pathname}${n.search}${i}`,l=(0,U.useRef)(t);l.current=t;let d=(0,U.useRef)(null);(0,U.useEffect)(()=>{let p=d.current;d.current=o,p!==null&&(o===p&&a!=="PUSH"||l.current?.(o,a==="POP"?"pop":a==="REPLACE"?"replace":"push"))},[n.key]);let c=(0,U.useRef)(e);return(0,U.useEffect)(()=>{e===void 0||e===c.current||(c.current=e,e!==o&&r(e))},[e]),null}function Ei({context:t,registry:e,page:n}){let a=Ue(),r=$e(t.store.schema,a.slug??""),i=n==="list"?zn:Qn,l=(r?e?.lookup(r,n):void 0)??i;return(0,P.jsx)(l,{context:t})}function Go({context:t,registry:e,children:n}){let a=(0,U.useRef)(null);return Da(a),(0,P.jsx)("div",{ref:a,"data-graview-face":"pages",style:{display:"contents"},children:(0,P.jsx)(hi,{context:t,registry:e,root:a,children:(0,P.jsx)(wi,{context:t,root:a,children:n})})})}function Vo(t){return t instanceof HTMLElement?t.isContentEditable||t.tagName==="TEXTAREA"||t.tagName==="SELECT"?!0:t.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(t.type):!1}function Uo(){let{pathname:t}=Pe(),e=Nn(),n=(0,U.useRef)(null);(0,U.useLayoutEffect)(()=>{if(e!=="POP"){for(let i=n.current?.parentElement;i;i=i.parentElement){let{overflowY:o}=getComputedStyle(i);if((o==="auto"||o==="scroll")&&i.scrollHeight>i.clientHeight){i.scrollTop=0;return}}window.scrollTo(0,0)}},[t]);let a=(0,U.useRef)(t),r=(0,U.useRef)(!1);return(0,U.useEffect)(()=>{if(!r.current&&t===a.current)return;r.current=!0;let i=document.activeElement;if(Vo(i))return;let o=n.current?.closest("main")??document.querySelector("main"),d=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??o?.querySelector("h1, h2")??null??o??null;d&&(d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1"),d.focus({preventScroll:!0}))},[t]),(0,P.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function Ni({context:t,children:e}){let n=Ke(),a=(0,U.useMemo)(()=>({record:(r,i)=>{let o=t.store.graph.getNode(r);o&&n(Ht(Z(t.store.schema,o.kind,r),{section:i?.section}))},place:(r,i)=>{let o=t.views?.places().find(l=>l.as===r);o&&n(Ht(ye(t,o),i))},list:(r,i)=>{t.store.schema.tryDefinition(r)&&n(Ht(`/${Y(t.store.schema,r)}`,i))},draft:()=>n("/~draft")}),[t,n]);return(0,P.jsx)(Ia.Provider,{value:a,children:e})}function jo(){let{pathname:t,search:e,hash:n}=Pe();return(0,U.useEffect)(()=>{let a=decodeURIComponent(n.replace(/^#/,""));if(!(!a||a.includes("=")))return gi(a)},[t,e,n]),null}function zo({context:t,Home:e}){let n=Pe(),a=t.views,r=n.key==="default"&&!(a&&Oa(a));(0,U.useEffect)(()=>{a&&Fa(a)},[a]);let i=r?Aa(t.views?.arrangement?.()?.first,t.store.schema,t.views?.places()??[]):void 0,o=i?.to==="place"?ye(t,i.place):i?.to==="kind"?`/${Y(t.store.schema,i.kind)}`:void 0;return o?(0,P.jsx)($n,{to:o,replace:!0}):(0,P.jsx)(e,{context:t})}function $i({context:t,registry:e}){let n=e?.lookupSurface("shell"),a=n!==void 0,r=a&&(e?.without().has("bar")??!1),i=a&&!r&&!t.embedded?{...t,barAbove:!0}:t,o=k=>n===void 0?(0,P.jsx)(Ut,{context:t,children:k}):r?(0,P.jsx)(n,{context:t,children:k}):(0,P.jsx)(Ut,{context:t,children:(0,P.jsx)(n,{context:i,children:k})}),l=e?.lookupSurface("home")??Un,d=e?.lookupSurface("problems")??_n,c=a?{...i,framed:!0}:t,[p,m]=(0,U.useState)(null),f=(0,U.useMemo)(()=>({onFind:m,find:!(e?.without().has("find")??!1),places:!(e?.without().has("places")??!1)}),[e]),u=(0,P.jsx)(Ni,{context:t,children:(0,P.jsx)(Go,{context:t,registry:e,children:o((0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(er,{face:"pages"}),(0,P.jsxs)(Do,{context:c,children:[(0,P.jsx)(Uo,{}),(0,P.jsx)(jo,{}),(0,P.jsxs)(ai,{children:[(e?.routes()??[]).map(({path:k,component:B})=>(0,P.jsx)(Le,{path:k,element:(0,P.jsx)(B,{context:c})},k)),(0,P.jsx)(Le,{path:"/",element:(0,P.jsx)(zo,{context:c,Home:l})}),(0,P.jsx)(Le,{path:"/problems",element:(0,P.jsx)(d,{context:c})}),(0,P.jsx)(Le,{path:"/~draft",element:(0,P.jsx)(U.Suspense,{fallback:null,children:(0,P.jsx)(Fo,{context:c})})}),(0,P.jsx)(Le,{path:"/search",element:(0,P.jsx)(jn,{context:c})}),(0,P.jsx)(Le,{path:"/map",element:(0,P.jsx)(Vn,{context:c})}),(0,P.jsx)(Le,{path:"/places",element:(0,P.jsx)(Bn,{context:c})}),Te(c).some(k=>k.as===wn)?null:(0,P.jsx)(Le,{path:Pa,element:(0,P.jsx)($n,{to:"/",replace:!0})}),(0,P.jsx)(Le,{path:"/places/:as",element:(0,P.jsx)(Gn,{context:c})}),(0,P.jsx)(Le,{path:"/:slug",element:(0,P.jsx)(Ei,{context:c,registry:e,page:"list"})}),(0,P.jsx)(Le,{path:"/:slug/:id",element:(0,P.jsx)(Ei,{context:c,registry:e,page:"record"})})]})]})]}))})});return t.embedded||!a||r?u:(0,P.jsx)(oi.Provider,{value:f,children:(0,P.jsx)(vr.Provider,{value:p,children:u})})}var _o=()=>typeof document>"u"?null:document.body;function Yo({context:t,registry:e,basename:n,initialPath:a,onNavigate:r,path:i,steering:o,firstLook:l}){let[d,c]=(0,U.useState)(void 0),p=d!==void 0&&d.from===t.principal?{...t,principal:d.seat}:t;(0,U.useState)(()=>p.views?Hr(p.views,p.store.schema,Cn(p.brand,p.store.schema)):void 0);let m=ce();ca({reader:p.locale??m?.locale,app:p.brand?.locale??p.app?.brand?.locale,readerTimeZone:p.timeZone??m?.timeZone,appTimeZone:p.brand?.timeZone??p.app?.brand?.timeZone});let f=p.principal??Io,u=Ma(p.store,f,p.history),B=(u.past&&u.live===p.store?u.past.store:p.store).seenBy(f),h=B===p.store?p:{...p,store:B};Ea(p.store,p.principal);let R=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Bo,{onNavigate:r,path:i}),o?(0,P.jsx)(Ho,{steering:o}):null,h.presence||m?(0,P.jsx)(Ko,{context:h,to:m}):null,(0,P.jsx)($i,{context:h,...e?{registry:e}:{}}),l?(0,P.jsx)(Kr,{firstLook:l,root:_o,app:Cn(p.brand,p.store.schema)}):null]}),G=h.views?(0,P.jsxs)(Na,{store:h.store,views:h.views,...h.principal?{principal:h.principal}:{},...h.brand?{brand:h.brand}:{},...h.locale?{locale:h.locale}:{},...h.timeZone?{timeZone:h.timeZone}:{},...h.settings?{settings:h.settings}:{},...h.presence&&!m?{presence:h.presence}:{},...h.people?{people:h.people}:{},...h.seats?{seats:h.seats}:{},onSeat:z=>m?m.takeSeat(z):c({from:t.principal,seat:z}),...h.onKeepLens?{onKeepLens:h.onKeepLens}:{},...h.ai?{ai:h.ai}:{},...h.subscriptions?{subscriptions:h.subscriptions}:{},...h.signIn?{signIn:h.signIn}:{},resolveApp:h.resolveApp??m?.resolveApp,linkedRecords:h.linkedRecords??m?.linkedRecords,...h.app?{app:h.app}:{},...h.menuSections?{menuSections:h.menuSections}:{},children:[R,(0,P.jsx)(Ni,{context:h,children:(0,P.jsx)(mi,{context:h})})]}):R,M=(0,P.jsx)(Ta.Provider,{value:u,children:G}),V=h.files?(0,P.jsx)(La.Provider,{value:h.files,children:M}):M;if(a!==void 0){let z=n===void 0?a:`${n.replace(/\/$/,"")}${a}`;return(0,P.jsx)(ni,{initialEntries:[z],...n===void 0?{}:{basename:n},children:V})}return(0,P.jsx)(ri,{...n===void 0?{}:{basename:n},children:V})}export{Xi as a,Yo as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as w}from"./chunk.TI4OSTQV.js";import"./chunk.AJZBJBMO.js";function G(e,n){let i;for(let r of[...e??[]].sort((a,d)=>a.seq-d.seq)){if(r.seq>n)break;r.declaration&&(i=r.declaration)}return i}var P=new WeakMap;function K(e,n){let i=G(e?.declarations,n),r=e?.declarationAt,a=[...e?.declarations??[]].filter(t=>t.seq<=n).sort((t,l)=>t.seq-l.seq).at(-1);if(!r||!a||a.declaration)return{declaration:i};let d=P.get(r);d||P.set(r,d=new Map);let s=d.get(a.seq);if(!s){let t={settled:!0,declaration:void 0,waiting:Promise.resolve()};try{let l=r(a.seq);l instanceof Promise?(t.settled=!1,t.waiting=l.then(c=>void Object.assign(t,{settled:!0,declaration:c}),()=>void(t.settled=!0))):t.declaration=l}catch{}d.set(a.seq,s=t)}return s.settled?{declaration:s.declaration??i}:{waiting:s.waiting}}var $=e=>e,x=new WeakMap,j=new WeakMap;function N(e,n){let i=typeof n=="string"?Date.parse(n):n.getTime();if(Number.isNaN(i))throw new RangeError(`\u201C${String(n)}\u201D is not a time`);let a=e.log.all().findIndex(d=>Date.parse(d.at)>i);return a===-1?e.log.length:e.log.horizon+a}function H(e,n,i={}){let r=w(e);if(r)return H(r.store,n,i).seenBy(r.principal);let a=$(e),d=e.log,s=d.horizon,t=typeof n=="number"?n:N(e,n);if(!Number.isInteger(t)||t<s||t>d.length)throw new RangeError(`No moment at seq ${t}: this store holds seqs ${s} to ${d.length}${s>0?"; what is before its horizon is in the archive":""}`);let l=d.all(),c=i.declaration,h=c?.schema??e.schema,g=d.epochs().filter(o=>o.seq<=t),S=g.at(-1),b=S?.seq??s,q=o=>o>s?l[o-1-s]?.id:void 0,f=(x.get(e)??[]).filter(o=>o.seq<=d.length&&q(o.seq)===o.id);x.set(e,f);let A=[...f].reverse().find(o=>o.seq>=b&&o.seq<=t),y=A?.seq??b,k=A?.base??S?.base??R(e),D=e.graph.constructor,m;try{m=D.from(h,k,{validate:a.validate})}catch{m=D.from(h,k,{validate:!1})}let M=e.pastEvery,O=(o,p)=>{f.some(v=>v.seq===o)||(f.push({seq:o,id:p,base:m.snapshot()}),f.sort((v,z)=>v.seq-z.seq))};for(let o=y;o<t;o++){let p=l[o-s];try{W(m,p)}catch{}(o+1)%M===0&&o+1<t&&O(o+1,p.id)}t-y>=M&&O(t,q(t));let I=l[t-1-s]?.at??S?.at,u=(o,p)=>p===void 0?{}:{[o]:p},E=e.constructor;return new E({schema:h,invariants:c?.invariants??a.invariants,invariantOptions:a.invariantOptions,...u("policy",c?c.policy:e.policy),...u("modules",c?.modules??a.declaredModules),...u("enabledModules",a.startingModules),...u("timeZone",e.timeZone),intelligence:e.intelligence,principal:a.by,log:l.slice(0,t-s),epochs:g,...s>0&&!g.some(o=>o.horizon)?{horizon:s}:{},snapshot:m.snapshot(),validate:!1,now:a.now,past:{seq:t,...u("at",I),foldedFrom:y,folded:t-y}})}function R(e){let n=e.log.all(),i=e.log.horizon,r=n[0]?.id,a=j.get(e);if(a&&a.firstId===r)return a.base;let d=e.log.epochs().find(l=>l.seq>i),s=e.graph.constructor.from(e.schema,d?.base??e.graph.snapshot(),{validate:!1});for(let l=(d?.seq??e.log.length)-1;l>=i;l--)try{s.applyPrimitives(n[l-i].inverse,{restoring:!0})}catch{}let t=s.snapshot();return j.set(e,{firstId:r,base:t}),t}function B(e,n,i={}){let r=typeof n=="number"?n:N(e,n),a=K(i,r);return H(e,r,{declaration:"declaration"in a?a.declaration:G(i.declarations,r)})}function W(e,n){if(n.undoes!==void 0){e.applyPrimitives(n.primitives,{restoring:!0});return}try{e.applyPrimitives(n.primitives)}catch{e.applyPrimitives(n.primitives,{restoring:!0})}}export{K as askDeclaration,G as declarationAt,B as pastAt,H as pastOf,N as seqAt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk.JDRLSVOI.js";import"./chunk.G4JJXA63.js";import"./chunk.VJXXCUKS.js";import"./chunk.Z5AB2DBF.js";import"./chunk.HPAGOEZG.js";import"./chunk.ISXFH3CK.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.242EUAPE.js";import"./chunk.VDAMCTNL.js";import"./chunk.BXT6FDT4.js";import"./chunk.WVUJXDXZ.js";import"./chunk.N6MVK3KD.js";import"./chunk.I7XSDXQ3.js";import"./chunk.UHI3D7JC.js";import"./chunk.WVDKYUF3.js";import"./chunk.ZHLQWMV5.js";import"./chunk.TNESS3LQ.js";import"./chunk.2FLPDPEL.js";import"./chunk.UUBYFBPN.js";import"./chunk.2RVUDRRY.js";import"./chunk.V5MYKNL7.js";import"./chunk.AJZBJBMO.js";export{i as draftAnswer,h as draftFromLens,b as draftSight,l as draftView,a as isDraftFailure,c as judgeLens,d as lensEditOf,f as lensFromSpec,j as recipeDraft,g as recipeOfLens,m as refineDraft,o as runDraftTool,e as takeBackEditOf,k as templateDraft,n as withReaderLenses};
|