graview 0.1.38 → 0.1.40
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.XHWL7QBF.js → chunk.242EUAPE.js} +1 -1
- package/dist/preview/chunk.2CF2XKOS.js +1 -0
- package/dist/preview/chunk.2FGYWAID.js +1 -0
- package/dist/preview/{chunk.MWZK3HVG.js → chunk.2FLPDPEL.js} +1 -1
- package/dist/preview/{chunk.6IHXTT6Z.js → chunk.2GDXNTY5.js} +1 -1
- package/dist/preview/chunk.2JB4Y2ET.js +1 -0
- package/dist/preview/chunk.2NXH7VAI.js +1 -0
- package/dist/preview/chunk.2OSNYF5C.js +1 -0
- package/dist/preview/{chunk.GR5Q4HTW.js → chunk.2RVUDRRY.js} +1 -1
- package/dist/preview/chunk.2WACBAUN.js +9 -0
- package/dist/preview/chunk.35PHXNOC.js +1 -0
- package/dist/preview/chunk.3Q75TIGL.js +1 -0
- package/dist/preview/chunk.42XSBKPO.js +1 -0
- package/dist/preview/chunk.47KHZCNG.js +1 -0
- package/dist/preview/{chunk.Z3ZKYSPN.js → chunk.4QPVS2ZM.js} +1 -1
- package/dist/preview/{chunk.WERYQENC.js → chunk.4VG2KN7G.js} +1 -1
- package/dist/preview/{chunk.ZRQI5VJF.js → chunk.5RABSIF7.js} +1 -1
- package/dist/preview/{chunk.2VIGF4FO.js → chunk.67WWRC6Y.js} +1 -1
- package/dist/preview/chunk.6AVZWLRF.js +1 -0
- package/dist/preview/chunk.6CRRPXKP.js +1 -0
- package/dist/preview/{chunk.FUJM7GDV.js → chunk.6FNMDAX5.js} +1 -1
- package/dist/preview/chunk.6J37UQKG.js +1 -0
- package/dist/preview/chunk.6JEU3ZNE.js +1 -0
- package/dist/preview/chunk.6PSWHBL2.js +1 -0
- package/dist/preview/chunk.74NOI7QN.js +1 -0
- package/dist/preview/chunk.7LIKEE5Z.js +1 -0
- package/dist/preview/chunk.7WPCP2LZ.js +1 -0
- package/dist/preview/{chunk.JWJQ2VXS.js → chunk.ACBUAIDF.js} +1 -1
- package/dist/preview/{chunk.IEDXW36H.js → chunk.AKQXF7GW.js} +1 -1
- package/dist/preview/chunk.AUBGUDO5.js +1 -0
- package/dist/preview/chunk.AVKDWISO.js +1 -0
- package/dist/preview/{chunk.36SQJMEE.js → chunk.AWX7GP72.js} +1 -1
- package/dist/preview/chunk.BFNVG5JE.js +1 -0
- package/dist/preview/chunk.BNVMMOOY.js +1 -0
- package/dist/preview/{chunk.7H5KVW2F.js → chunk.BSAXZQSY.js} +1 -1
- package/dist/preview/{chunk.V2NBJDAX.js → chunk.BXT6FDT4.js} +1 -1
- package/dist/preview/{chunk.TKSGC6XH.js → chunk.C2PECN4C.js} +1 -1
- package/dist/preview/chunk.CL2ZS5EQ.js +1 -0
- package/dist/preview/chunk.CN5WAKHJ.js +5 -0
- package/dist/preview/{chunk.LF7PU77M.js → chunk.CNFL5IN5.js} +1 -1
- package/dist/preview/chunk.D25XEVKO.js +1 -0
- package/dist/preview/chunk.DL26BKT7.js +1 -0
- package/dist/preview/chunk.DPZTW24D.js +1 -0
- package/dist/preview/chunk.ESSSNLEO.js +1 -0
- package/dist/preview/chunk.ETOGQE2V.js +1 -0
- package/dist/preview/chunk.FDE3TSTK.js +1 -0
- package/dist/preview/chunk.FFZBOP65.js +1 -0
- package/dist/preview/chunk.FOQZADMA.js +25 -0
- package/dist/preview/chunk.G6VZNRQ5.js +1 -0
- package/dist/preview/chunk.GAFYE37S.js +3 -0
- package/dist/preview/{chunk.KNJZ2YNJ.js → chunk.GT2BITLW.js} +1 -1
- package/dist/preview/{chunk.ZLXPIEUC.js → chunk.GTV2VZAS.js} +2 -2
- package/dist/preview/{chunk.AZCFXPEL.js → chunk.GY6RYJHM.js} +1 -1
- package/dist/preview/chunk.GZIVMOY4.js +117 -0
- package/dist/preview/{chunk.VKHKYK5L.js → chunk.H5ADMSE7.js} +1 -1
- package/dist/preview/chunk.H5HWN7A2.js +1 -0
- package/dist/preview/chunk.H6XKMLDQ.js +1 -0
- package/dist/preview/chunk.H7POIT3V.js +1 -0
- package/dist/preview/{chunk.SGB6IMWN.js → chunk.HB7ELBVK.js} +1 -1
- package/dist/preview/chunk.HFYUAK5Z.js +6 -0
- package/dist/preview/{chunk.MCVY6RRS.js → chunk.HPAGOEZG.js} +1 -1
- package/dist/preview/{chunk.EUGWV3S6.js → chunk.I7XSDXQ3.js} +1 -1
- package/dist/preview/chunk.IDUPJMJO.js +1 -0
- package/dist/preview/chunk.IFTWVUJO.js +2 -0
- package/dist/preview/{chunk.RZVZG2BQ.js → chunk.ISXFH3CK.js} +1 -1
- package/dist/preview/chunk.J4IULZFD.js +1 -0
- package/dist/preview/chunk.JACGQ2PR.js +4 -0
- package/dist/preview/{chunk.67WL7BGF.js → chunk.JDRLSVOI.js} +1 -1
- package/dist/preview/chunk.JLDBFX6O.js +1 -0
- package/dist/preview/{chunk.RVJYEOFN.js → chunk.JQEYZB5I.js} +1 -1
- package/dist/preview/chunk.L3A6YLMT.js +21 -0
- package/dist/preview/chunk.LLEFYJPJ.js +344 -0
- package/dist/preview/chunk.LOZJQ5ZX.js +1 -0
- package/dist/preview/chunk.LPBM5AES.js +19 -0
- package/dist/preview/chunk.LPE4FLC6.js +6 -0
- package/dist/preview/{chunk.SZWX56WR.js → chunk.MIM2QLF5.js} +2 -2
- package/dist/preview/{chunk.FMVWXSQ7.js → chunk.N2K25KH3.js} +1 -1
- package/dist/preview/{chunk.2EJAIT33.js → chunk.N6MVK3KD.js} +1 -1
- package/dist/preview/{chunk.33GN2NUT.js → chunk.NGDXH66B.js} +1 -1
- package/dist/preview/chunk.O5JKDFDH.js +1 -0
- package/dist/preview/chunk.O6F3K6CU.js +1 -0
- package/dist/preview/{chunk.V5ZT5NSJ.js → chunk.OW7NSJ4H.js} +1 -1
- package/dist/preview/chunk.P5ODICND.js +32 -0
- package/dist/preview/{chunk.YPY5BOEI.js → chunk.PPG2SEIY.js} +1 -1
- package/dist/preview/chunk.PXQVXBNG.js +1 -0
- package/dist/preview/chunk.PYNYHNDS.js +1 -0
- package/dist/preview/{chunk.MVNUWK5Y.js → chunk.Q4TZHWQX.js} +1 -1
- package/dist/preview/chunk.QCWZSSNC.js +1 -0
- package/dist/preview/chunk.QIV65FWE.js +1 -0
- package/dist/preview/chunk.R5WY567U.js +88 -0
- package/dist/preview/{chunk.VNBR4DHD.js → chunk.RCM7NOPF.js} +2 -1
- package/dist/preview/chunk.S2U5CEP4.js +1 -0
- package/dist/preview/chunk.S356ACK2.js +1 -0
- package/dist/preview/chunk.SDO3U72B.js +1 -0
- package/dist/preview/chunk.SHNYYBNW.js +1 -0
- package/dist/preview/{chunk.DL637Q3W.js → chunk.SIGC3G7S.js} +1 -1
- package/dist/preview/chunk.STI447YW.js +1 -0
- package/dist/preview/chunk.T3TYD7QI.js +1 -0
- package/dist/preview/chunk.T73RB7LC.js +1 -0
- package/dist/preview/chunk.TD2LNFUB.js +1 -0
- package/dist/preview/{chunk.5XJEGXDO.js → chunk.TGVUIFKD.js} +1 -1
- package/dist/preview/chunk.TIH2PDFH.js +1 -0
- package/dist/preview/chunk.TKUNRFDE.js +1 -0
- package/dist/preview/{chunk.74RMHUCX.js → chunk.TNESS3LQ.js} +1 -1
- package/dist/preview/chunk.UHI3D7JC.js +1 -0
- package/dist/preview/{chunk.TOWYHWPB.js → chunk.UOPKRN55.js} +1 -1
- package/dist/preview/{chunk.BUVAMSOZ.js → chunk.UTCB3CE7.js} +2 -2
- package/dist/preview/{chunk.3D5T3XIE.js → chunk.UUBYFBPN.js} +1 -1
- package/dist/preview/{chunk.YUJG5SN5.js → chunk.UWW6ZEPY.js} +2 -2
- package/dist/preview/chunk.V5MYKNL7.js +5 -0
- package/dist/preview/{chunk.6UCRL4OF.js → chunk.VDAMCTNL.js} +1 -1
- package/dist/preview/chunk.VF7P3ZVZ.js +35 -0
- package/dist/preview/chunk.VIYECFKZ.js +6 -0
- package/dist/preview/{chunk.5MSO3KRO.js → chunk.VJXXCUKS.js} +1 -1
- package/dist/preview/{chunk.GZ3IXNA4.js → chunk.VNUHESMZ.js} +1 -1
- package/dist/preview/chunk.VZYCILPJ.js +1 -0
- package/dist/preview/chunk.W4HBRXMY.js +1 -0
- package/dist/preview/chunk.W7R2GFBW.js +47 -0
- package/dist/preview/chunk.WBLHCH5M.js +1 -0
- package/dist/preview/{chunk.NPX7SPXM.js → chunk.WVDKYUF3.js} +1 -1
- package/dist/preview/{chunk.LHO7L3CS.js → chunk.XEKLEHC3.js} +1 -1
- package/dist/preview/{chunk.IM7LXLIB.js → chunk.XFZKP4IF.js} +1 -1
- package/dist/preview/chunk.XQHDP5C3.js +1 -0
- package/dist/preview/chunk.XQTMO5PW.js +1 -0
- package/dist/preview/{chunk.UXIFQIHA.js → chunk.XRYTJNA7.js} +1 -1
- package/dist/preview/chunk.YO24NALN.js +1 -0
- package/dist/preview/{chunk.B5ILKGEF.js → chunk.YWNHCZQ5.js} +1 -1
- package/dist/preview/chunk.YWVOACSX.js +5 -0
- package/dist/preview/chunk.YYFLTMNN.js +1 -0
- package/dist/preview/chunk.YYIKSH2F.js +3 -0
- package/dist/preview/{chunk.QYRPELLU.js → chunk.Z5AB2DBF.js} +1 -1
- package/dist/preview/{chunk.6ONRWFA6.js → chunk.Z7LDT55A.js} +1 -1
- package/dist/preview/chunk.ZGCRMNER.js +1 -0
- package/dist/preview/{chunk.OE4QOBJF.js → chunk.ZHLQWMV5.js} +1 -1
- package/dist/preview/{chunk.ROGYDMES.js → chunk.ZJMDLRC5.js} +1 -1
- package/dist/preview/chunk.ZK3X23EU.js +1 -0
- package/dist/preview/chunk.ZOR6FKNI.js +1 -0
- package/dist/preview/chunk.ZRLXVYPG.js +1 -0
- package/dist/preview/index.html +47 -43
- package/dist/preview/page.js +8 -8
- package/package.json +6 -6
- package/dist/preview/chunk.2HFRVWWM.js +0 -1
- package/dist/preview/chunk.3FW4QNGV.js +0 -1
- package/dist/preview/chunk.3RT2GUZ5.js +0 -1
- package/dist/preview/chunk.3ZRHHB7X.js +0 -1
- package/dist/preview/chunk.4DEUD66C.js +0 -6
- package/dist/preview/chunk.4EQSP7I3.js +0 -1
- package/dist/preview/chunk.4Y6BCHV2.js +0 -1
- package/dist/preview/chunk.5VBBQ6Z3.js +0 -1
- package/dist/preview/chunk.6CKBIY7L.js +0 -1
- package/dist/preview/chunk.6XJP7F3I.js +0 -1
- package/dist/preview/chunk.7RSZMIAL.js +0 -1
- package/dist/preview/chunk.AFY35RJP.js +0 -1
- package/dist/preview/chunk.BRHRAVU2.js +0 -3
- package/dist/preview/chunk.DFVVS6C5.js +0 -1
- package/dist/preview/chunk.DQJAEU4V.js +0 -1
- package/dist/preview/chunk.ESSQAMPM.js +0 -1
- package/dist/preview/chunk.EV553KRT.js +0 -1
- package/dist/preview/chunk.EZP4FHDX.js +0 -35
- package/dist/preview/chunk.F6PIK2J2.js +0 -1
- package/dist/preview/chunk.FTJBW25J.js +0 -1
- package/dist/preview/chunk.FYIQZMVF.js +0 -1
- package/dist/preview/chunk.HUSFMFXH.js +0 -1
- package/dist/preview/chunk.HVTGPEVW.js +0 -1
- package/dist/preview/chunk.I3SQJ2L2.js +0 -1
- package/dist/preview/chunk.IU6ISXXC.js +0 -1
- package/dist/preview/chunk.K5KEECHL.js +0 -88
- package/dist/preview/chunk.L34FY7QQ.js +0 -1
- package/dist/preview/chunk.L73VUBXN.js +0 -4
- package/dist/preview/chunk.L7JKEEMM.js +0 -1
- package/dist/preview/chunk.LAW5PQEM.js +0 -1
- package/dist/preview/chunk.LDD3QX7G.js +0 -1
- package/dist/preview/chunk.LU5LSXSW.js +0 -1
- package/dist/preview/chunk.MQ7FNHXG.js +0 -25
- package/dist/preview/chunk.NH5TDAB2.js +0 -1
- package/dist/preview/chunk.NORRCKGN.js +0 -1
- package/dist/preview/chunk.NQQHOSOK.js +0 -1
- package/dist/preview/chunk.NWWMUOZM.js +0 -1
- package/dist/preview/chunk.OEF3GPRM.js +0 -1
- package/dist/preview/chunk.OS3L4ZOF.js +0 -2
- package/dist/preview/chunk.OTL3Z345.js +0 -1
- package/dist/preview/chunk.P3UPCI23.js +0 -1
- package/dist/preview/chunk.PGKIEDYV.js +0 -9
- package/dist/preview/chunk.PKUWET2F.js +0 -1
- package/dist/preview/chunk.POHEWJKZ.js +0 -1
- package/dist/preview/chunk.PUBG2L6F.js +0 -117
- package/dist/preview/chunk.QT4XGC5Z.js +0 -344
- package/dist/preview/chunk.QTTBZJ6W.js +0 -1
- package/dist/preview/chunk.RJDZOF2L.js +0 -1
- package/dist/preview/chunk.SGLJTSTD.js +0 -1
- package/dist/preview/chunk.SITFEJES.js +0 -1
- package/dist/preview/chunk.UF3L6FJO.js +0 -1
- package/dist/preview/chunk.VSYHU5MA.js +0 -1
- package/dist/preview/chunk.VTWFVPKD.js +0 -19
- package/dist/preview/chunk.VV4BPOIK.js +0 -1
- package/dist/preview/chunk.W2HCJQVK.js +0 -32
- package/dist/preview/chunk.WG5NIR23.js +0 -47
- package/dist/preview/chunk.WLPTY4BF.js +0 -5
- package/dist/preview/chunk.XDYAG276.js +0 -1
- package/dist/preview/chunk.XM3NPZLP.js +0 -1
- package/dist/preview/chunk.YAXZNQY6.js +0 -1
- package/dist/preview/chunk.YG423NEB.js +0 -1
- package/dist/preview/chunk.YVR3ZMTV.js +0 -1
- package/dist/preview/chunk.YXH3IWNR.js +0 -1
- package/dist/preview/chunk.ZYCNEOAQ.js +0 -1
|
@@ -1 +1 @@
|
|
|
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.6UCRL4OF.js";import{h as Ie,i as qe,j as Ve}from"./chunk.6XJP7F3I.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.OE4QOBJF.js";import{c as Me,h as g,i as Te,j as me}from"./chunk.74RMHUCX.js";import{Ea as De,Fa as ee,Ga as fe,Ib as ue,Jb 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,xa as Fe,y as U,z as Re}from"./chunk.WLPTY4BF.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
|
+
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as c}from"./chunk.GZIVMOY4.js";import"./chunk.W7R2GFBW.js";import"./chunk.CN5WAKHJ.js";import"./chunk.UGFDSE37.js";import{l as m}from"./chunk.PYNYHNDS.js";import"./chunk.LPE4FLC6.js";import"./chunk.XEKLEHC3.js";import"./chunk.VZYCILPJ.js";import"./chunk.4QPVS2ZM.js";import"./chunk.RCM7NOPF.js";import"./chunk.Z7LDT55A.js";import"./chunk.PXQVXBNG.js";import"./chunk.47KHZCNG.js";import"./chunk.XQHDP5C3.js";import"./chunk.BFNVG5JE.js";import"./chunk.ZJMDLRC5.js";import"./chunk.2GDXNTY5.js";import"./chunk.ETOGQE2V.js";import"./chunk.O5JKDFDH.js";import"./chunk.YYIKSH2F.js";import"./chunk.LPBM5AES.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.LLEFYJPJ.js";import{G as S,R as g}from"./chunk.FOQZADMA.js";import"./chunk.SDO3U72B.js";import{od as n}from"./chunk.V5MYKNL7.js";import{b as t}from"./chunk.AJZBJBMO.js";var y=t(S(),1),a=t(g(),1);function E({store:h,auto:f,brand:i,views:u,presence:o,steering:r,overview:s,scope:d,titleLevel:v=2,quickAsk:l,props:e}){let b=(0,y.useMemo)(()=>m({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:f?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:b}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(c,{context:{store:h,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...s?{overview:s}:{},titleLevel:v,views:u,settings:e.app.settings??[],...o?{presence:o}:{},...i?{brand:i}:{},...e.locale?{locale:e.locale}:{},...e.timeZone?{timeZone:e.timeZone}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{},...e.subscriptions?{subscriptions:e.subscriptions}:{},...e.signIn?{signIn:e.signIn}:{},...l!==void 0?{quickAsk:l}:{}},...e.pages?{registry:e.pages}:{},...r?{steering:r}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{E as PagesContent};
|
|
@@ -0,0 +1 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
import{B as $,Cb as M,D as h,G as E,K as N,L as S,M as W,O as R,P as I,T as p,da as D,ia as T,sa as j,tb as v,zb as O}from"./chunk.WLPTY4BF.js";function z(e,n,t){let o=[...n?.creates??[],...n?.subject&&n.subject.kinds!=="*"?n.subject.kinds:[]];for(let r of o){let i=e.tryDefinition(r),u=i?.fields?.shape??{};if(!i||!(t in u))continue;let a=i.display?.format?.[t];return{label:i.display?.labels?.[t]??T(i,t),option:d=>a?a(d):D(d)}}return{label:T(void 0,t),option:r=>D(r)}}function K(e,n,t){if(t instanceof v){let o=n.find(i=>i.name===t.mutation);return`Not yet: ${t.issues.map(i=>{let u=i.path.length>0?z(e,o,String(i.path[0])).label:void 0;return u?`${u} \u2014 ${i.message.replace(/^./,a=>a.toLowerCase())}`:i.message}).join("; ")}.`}return t instanceof Error?t.message:String(t)}var x=864e5,X=/^(\d{4})-(\d{2})-(\d{2})/,g=e=>String(e).padStart(2,"0"),_=e=>new Date(e).toISOString().slice(0,10),m=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),b=(e,n)=>_(m(e)+n*x),C=e=>new Date(m(e)).getUTCDay();function l(e,n,t){if(!(n>=1&&n<=12&&t>=1&&t<=31))return;let o=`${String(e).padStart(4,"0")}-${g(n)}-${g(t)}`;return _(m(o))===o?o:void 0}function L(e=new Date){let n=S();return n?R(e.getTime(),n):{day:`${e.getFullYear()}-${g(e.getMonth()+1)}-${g(e.getDate())}`,minutes:e.getHours()*60+e.getMinutes()}}var w=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e);function y(e){if(typeof e!="string")return;if(w(e)){let o=new Date(e);return Number.isNaN(o.getTime())?void 0:L(o)}let n=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!n||!l(Number(n[1]),Number(n[2]),Number(n[3])))return;let t=e.slice(0,10);return n[4]===void 0?{day:t}:{day:t,minutes:Number(n[4])*60+Number(n[5])}}function F(e,n){if(!n.time)return e.day;let t=e.minutes??9*60;if(!n.instant)return`${e.day}T${g(Math.floor(t/60))}:${g(t%60)}`;let o=S(),[,r,i,u]=X.exec(e.day);return(o?new Date(I(e.day,t,o)):new Date(Number(r),Number(i)-1,Number(u),Math.floor(t/60),t%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function V(e,n=new Date){let t=W(),o=t;try{o=new Intl.DateTimeFormat(e??h,{timeZoneName:"short",timeZone:t}).formatToParts(n).find(r=>r.type==="timeZoneName")?.value??t}catch{o=t}return{zone:t,short:o}}function q(e,n,t,o){let r=y(n);if(!r)return t;let i=e===void 0?void 0:y(e),u=t===void 0?void 0:y(t),a=d=>m(d.day)+(d.minutes??0)*6e4,c=(d,s)=>{let f=a(d)+s;return{day:_(f),...o.time?{minutes:Math.round(f%x/6e4)}:{}}};return i&&u?F(c(u,a(r)-a(i)),o):u&&a(u)>=a(r)?t:o.time?F(c(r,36e5),o):t}var J=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,Q=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function ee(e,n={}){let t=(n.start&&e.includes(n.start)?n.start:void 0)??e.find(r=>J.test(r)),o=(n.end&&e.includes(n.end)?n.end:void 0)??e.find(r=>r!==t&&Q.test(r));return t&&o?{start:t,end:o}:void 0}var ne=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],te=["sun","mon","tue","wed","thu","fri","sat"],B="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",U="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",re=e=>ne.indexOf(e.slice(0,3))+1,Y=e=>e===void 0?void 0:e.length===2?2e3+Number(e):Number(e);function oe(e){try{let n=new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}).formatToParts(0).map(t=>t.type);return n.indexOf("month")<n.indexOf("day")}catch{return!0}}function ie(e){let n=(r,i)=>({minutes:i,rest:`${e.slice(0,r.index)} ${e.slice(r.index+r[0].length)}`}),t=/\b(noon|midday)\b/.exec(e);if(t)return n(t,12*60);if(t=/\bmidnight\b/.exec(e),t)return n(t,0);if(t=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(e),t){let r=Number(t[1]),i=Number(t[2]??0);return r<1||r>12||i>59?{rest:e,bad:!0}:n(t,(r%12+(t[3]==="p"?12:0))*60+i)}if(t=/\b(\d{1,2}):(\d{2})\b/.exec(e),t){let r=Number(t[1]),i=Number(t[2]);return r>23||i>59?{rest:e,bad:!0}:n(t,r*60+i)}if(t=/\bat\s+(\d{1,2})\b/.exec(e),t){let r=Number(t[1]);return r>23?{rest:e,bad:!0}:n(t,(r>=1&&r<=7?r+12:r)*60)}let o=/\b(morning|afternoon|evening|tonight)\b/.exec(e);return o?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[o[1]]*60,rest:o[1]==="tonight"?`${e.slice(0,o.index)} today ${e.slice(o.index+o[0].length)}`:`${e.slice(0,o.index)} ${e.slice(o.index+o[0].length)}`}:{rest:e}}function ue(e,n,t){let o=e.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(o==="")return null;if(o==="today"||o==="now")return n;if(o==="tomorrow"||o==="tmrw"||o==="tmr")return b(n,1);if(o==="yesterday")return b(n,-1);if(o==="next week")return b(n,7);let r=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(o);if(r)return b(n,Number(r[1])*(r[2].startsWith("week")?7:1));if(r=new RegExp(`^(next )?${U}$`).exec(o),r){let d=(te.indexOf(r[2].slice(0,3))-C(n)+7)%7;return b(n,r[1]&&d===0?7:d)}if(r=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(o),r)return l(Number(r[1]),Number(r[2]),Number(r[3]));let i=o.replace(new RegExp(`^${U} `),"");r=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${B}(?: (\\d{4}))?$`).exec(i);let u=r?{date:r[1],month:r[2],year:r[3]}:void 0;r=new RegExp(`^${B} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(i);let a=u??(r?{date:r[2],month:r[1],year:r[3]}:void 0);if(a)return Z(n,Y(a.year),re(a.month),Number(a.date));if(r=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(i),r){let[c,d]=[Number(r[1]),Number(r[2])],[s,f]=oe(t)?[c,d]:[d,c];return Z(n,Y(r[3]),s,f)}}function Z(e,n,t,o){if(n!==void 0)return l(n,t,o);let r=Number(e.slice(0,4)),i=l(r,t,o);return i===void 0?l(r+1,t,o):m(e)-m(i)>183*x?l(r+1,t,o):i}function de(e,n){let t=e.trim();if(w(t)){let a=y(t);if(a)return n.time?a:{day:a.day}}let o=e.toLowerCase().replace(/,/g," ").replace(/(\d{4}-\d{2}-\d{2})t(\d\d:\d\d)(:\d\d(\.\d+)?)?/,"$1 $2").replace(/\s+/g," ").trim();if(o==="")return;let r=ie(o);if(r.bad)return;let i=ue(r.rest,n.today,n.locale??h);if(i===void 0||i===null&&r.minutes===void 0)return;let u=i??n.base?.day??n.today;return n.time?{day:u,minutes:r.minutes??n.base?.minutes??9*60}:{day:u}}var ae=e=>/^[A-Z]{3}$/.test(e??"");function P(e){let{format:n,unit:t,currency:o,locale:r}=e,i=ae(t),u=n==="money"||!n&&i,a=u?i?t:o:void 0;return{...u?{format:"money"}:n?{format:n}:{},...t&&!(u&&i)?{unit:t}:{},...a?{currency:a}:{},...r?{locale:r}:{}}}function Te(e){switch(e.format){case"money":return e.currency?`An amount of money in ${e.currency}: a plain number, 1250.5 for 1,250.50 ${e.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return e.unit?`A number of ${e.unit}.`:"A number."}}function H(e){let n=$(e)?.innerType;return n===void 0?e:H(n)}var se={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ce=e=>(e?._zod?.def?.checks??[]).map(n=>n._zod?.def).filter(n=>n!==void 0);function k(e){let n=H(e),t=$(n),o=t?.type,r=ce(n);if(o==="enum")return{type:"choice",options:Object.keys(t?.entries??{})};let i=j(n);if(i)return i==="image"?{type:"file",image:!0}:i==="video"?{type:"file",video:!0}:{type:"file"};if(o==="boolean")return{type:"boolean"};if(o==="array"){let u=k(t?.element);return u.type==="unknown"?{type:"unknown"}:{type:"several",of:u}}if(o==="number"){let u,a,c;for(let d of r){d.check==="multiple_of"&&typeof d.value=="number"?c=d.value:d.check==="number_format"&&(d.format==="safeint"||d.format==="int32"||d.format==="uint32")&&(c??=1);let s=d.check==="number_format"&&d.format?se[d.format]:void 0,f=s?s[0]:d.check==="greater_than"&&d.inclusive&&typeof d.value=="number"?d.value:void 0,A=s?s[1]:d.check==="less_than"&&d.inclusive&&typeof d.value=="number"?d.value:void 0;f!==void 0&&(u=u===void 0?f:Math.max(u,f)),A!==void 0&&(a=a===void 0?A:Math.min(a,A))}return{type:"number",...u===void 0?{}:{min:u},...a===void 0?{}:{max:a},...c===void 0?{}:{step:c},...M(n)==="duration"?{duration:!0}:{},...O(e)?{amount:P(O(e))}:{}}}if(o==="string"){if(r.some(s=>s.fn===E||s.format==="datetime")||t?.format==="datetime")return{type:"date",time:!0,instant:!0};let a=[t?.pattern,...r.map(s=>s.pattern)].filter(s=>s instanceof RegExp).map(s=>s.source);if(a.some(s=>s.includes("\\d{4}")))return a.some(s=>s.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:{type:"date"};let c=r.some(s=>s.check==="max_length"&&typeof s.maximum=="number"&&s.maximum>500),d=M(n);return c?{type:"text",long:!0}:d==="phone"||d==="place"?{type:"text",holds:d}:{type:"text"}}return{type:"unknown"}}function fe(e,n){let t=e?.shape;return!t||!(n in t)?{type:"unknown"}:k(t[n])}function me(e){if(e===void 0||e==="web"||e.startsWith("ai:")||e.startsWith("app:"))return;if(e==="api")return"via the API";if(e==="cli")return"via the command line";let[n,...t]=e.split(":"),o=t.join(":");return(n==="mcp"||n==="view")&&o?`via ${o}`:n==="mcp"?"via an agent's tools":`via ${e}`}var G=e=>{if(!e.currency)return{before:!0};try{let n=N(e.locale),t=new Intl.NumberFormat(n,{style:"currency",currency:e.currency}).formatToParts(1),o=t.findIndex(u=>u.type==="currency"),r=t.findIndex(u=>u.type==="integer"),i;try{i=new Intl.DisplayNames([n],{type:"currency"}).of(e.currency)}catch{}return{...o>=0?{symbol:t[o].value}:{},before:o<r,...i?{name:i}:{}}}catch{return{symbol:e.currency,before:!0}}};function le(e){let n=e.locale;if(e.format==="money"){let{symbol:t,before:o,name:r}=G(e),i=p(1250,n,{minimumFractionDigits:2,maximumFractionDigits:2});return{...t?o?{prefix:t}:{suffix:t}:{},placeholder:i,hint:r?`in ${r}`:e.currency?`in ${e.currency}`:"an amount of money"}}return e.format==="percent"?{suffix:"%",placeholder:p(15,n),hint:"as a percent"}:{...e.unit?{suffix:e.unit}:{},placeholder:"",hint:e.unit?`in ${e.unit}`:"a number"}}function pe(e,n){return e===void 0||!Number.isFinite(e)?"":n.format==="money"?p(e,n.locale,Number.isInteger(e)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):n.format==="percent"?p(e*100,n.locale,{maximumFractionDigits:4}):p(e,n.locale,{maximumFractionDigits:6})}function ye(e){try{let n=new Intl.NumberFormat(N(e)).formatToParts(12345.6);return{group:n.find(t=>t.type==="group")?.value??",",decimal:n.find(t=>t.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function ge(e,n){let{group:t,decimal:o}=ye(n),r=e.replace(/[\s ']/g,"").replace(/[−–]/g,"-");if(o!=="."&&!r.includes(o)&&/^-?\d+\.\d{1,2}$/.test(r))return Number(r);if(t&&(r=r.split(t).join("")),o!=="."&&(r=r.replace(o,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(r))return;let i=Number(r);return Number.isFinite(i)?i:void 0}function be(e,n){let t=e.trim();if(t==="")return;let o=n?.format==="money"&&n.currency?G(n).symbol:void 0,r=t;o&&(r=r.split(o).join("")),n?.currency&&(r=r.replace(new RegExp(n.currency,"gi"),"")),r=r.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(r)&&(r=r.replace(/%\s*$/,"")),n?.unit&&n.format!=="money"&&(r=r.replace(new RegExp(`\\s*${n.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let u=ge(r,n?.locale);if(u!==void 0)return n?.format==="percent"?u/100:u}export{P as a,Te as b,H as c,k as d,fe as e,z as f,K as g,me as h,le as i,pe as j,be as k,L as l,w as m,y as n,F as o,V as p,q,ee as r,de as s};
|
|
1
|
+
import{B as $,Bb as O,D as h,Eb as M,G as E,K as N,L as S,M as W,O as R,P as I,T as p,da as D,ia as T,ta as j,vb as v}from"./chunk.V5MYKNL7.js";function z(e,n,t){let o=[...n?.creates??[],...n?.subject&&n.subject.kinds!=="*"?n.subject.kinds:[]];for(let r of o){let i=e.tryDefinition(r),u=i?.fields?.shape??{};if(!i||!(t in u))continue;let a=i.display?.format?.[t];return{label:i.display?.labels?.[t]??T(i,t),option:d=>a?a(d):D(d)}}return{label:T(void 0,t),option:r=>D(r)}}function K(e,n,t){if(t instanceof v){let o=n.find(i=>i.name===t.mutation);return`Not yet: ${t.issues.map(i=>{let u=i.path.length>0?z(e,o,String(i.path[0])).label:void 0;return u?`${u} \u2014 ${i.message.replace(/^./,a=>a.toLowerCase())}`:i.message}).join("; ")}.`}return t instanceof Error?t.message:String(t)}var x=864e5,X=/^(\d{4})-(\d{2})-(\d{2})/,g=e=>String(e).padStart(2,"0"),_=e=>new Date(e).toISOString().slice(0,10),m=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),b=(e,n)=>_(m(e)+n*x),C=e=>new Date(m(e)).getUTCDay();function l(e,n,t){if(!(n>=1&&n<=12&&t>=1&&t<=31))return;let o=`${String(e).padStart(4,"0")}-${g(n)}-${g(t)}`;return _(m(o))===o?o:void 0}function L(e=new Date){let n=S();return n?R(e.getTime(),n):{day:`${e.getFullYear()}-${g(e.getMonth()+1)}-${g(e.getDate())}`,minutes:e.getHours()*60+e.getMinutes()}}var w=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e);function y(e){if(typeof e!="string")return;if(w(e)){let o=new Date(e);return Number.isNaN(o.getTime())?void 0:L(o)}let n=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!n||!l(Number(n[1]),Number(n[2]),Number(n[3])))return;let t=e.slice(0,10);return n[4]===void 0?{day:t}:{day:t,minutes:Number(n[4])*60+Number(n[5])}}function F(e,n){if(!n.time)return e.day;let t=e.minutes??9*60;if(!n.instant)return`${e.day}T${g(Math.floor(t/60))}:${g(t%60)}`;let o=S(),[,r,i,u]=X.exec(e.day);return(o?new Date(I(e.day,t,o)):new Date(Number(r),Number(i)-1,Number(u),Math.floor(t/60),t%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function V(e,n=new Date){let t=W(),o=t;try{o=new Intl.DateTimeFormat(e??h,{timeZoneName:"short",timeZone:t}).formatToParts(n).find(r=>r.type==="timeZoneName")?.value??t}catch{o=t}return{zone:t,short:o}}function q(e,n,t,o){let r=y(n);if(!r)return t;let i=e===void 0?void 0:y(e),u=t===void 0?void 0:y(t),a=d=>m(d.day)+(d.minutes??0)*6e4,c=(d,s)=>{let f=a(d)+s;return{day:_(f),...o.time?{minutes:Math.round(f%x/6e4)}:{}}};return i&&u?F(c(u,a(r)-a(i)),o):u&&a(u)>=a(r)?t:o.time?F(c(r,36e5),o):t}var J=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,Q=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function ee(e,n={}){let t=(n.start&&e.includes(n.start)?n.start:void 0)??e.find(r=>J.test(r)),o=(n.end&&e.includes(n.end)?n.end:void 0)??e.find(r=>r!==t&&Q.test(r));return t&&o?{start:t,end:o}:void 0}var ne=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],te=["sun","mon","tue","wed","thu","fri","sat"],B="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",U="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",re=e=>ne.indexOf(e.slice(0,3))+1,Y=e=>e===void 0?void 0:e.length===2?2e3+Number(e):Number(e);function oe(e){try{let n=new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}).formatToParts(0).map(t=>t.type);return n.indexOf("month")<n.indexOf("day")}catch{return!0}}function ie(e){let n=(r,i)=>({minutes:i,rest:`${e.slice(0,r.index)} ${e.slice(r.index+r[0].length)}`}),t=/\b(noon|midday)\b/.exec(e);if(t)return n(t,12*60);if(t=/\bmidnight\b/.exec(e),t)return n(t,0);if(t=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(e),t){let r=Number(t[1]),i=Number(t[2]??0);return r<1||r>12||i>59?{rest:e,bad:!0}:n(t,(r%12+(t[3]==="p"?12:0))*60+i)}if(t=/\b(\d{1,2}):(\d{2})\b/.exec(e),t){let r=Number(t[1]),i=Number(t[2]);return r>23||i>59?{rest:e,bad:!0}:n(t,r*60+i)}if(t=/\bat\s+(\d{1,2})\b/.exec(e),t){let r=Number(t[1]);return r>23?{rest:e,bad:!0}:n(t,(r>=1&&r<=7?r+12:r)*60)}let o=/\b(morning|afternoon|evening|tonight)\b/.exec(e);return o?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[o[1]]*60,rest:o[1]==="tonight"?`${e.slice(0,o.index)} today ${e.slice(o.index+o[0].length)}`:`${e.slice(0,o.index)} ${e.slice(o.index+o[0].length)}`}:{rest:e}}function ue(e,n,t){let o=e.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(o==="")return null;if(o==="today"||o==="now")return n;if(o==="tomorrow"||o==="tmrw"||o==="tmr")return b(n,1);if(o==="yesterday")return b(n,-1);if(o==="next week")return b(n,7);let r=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(o);if(r)return b(n,Number(r[1])*(r[2].startsWith("week")?7:1));if(r=new RegExp(`^(next )?${U}$`).exec(o),r){let d=(te.indexOf(r[2].slice(0,3))-C(n)+7)%7;return b(n,r[1]&&d===0?7:d)}if(r=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(o),r)return l(Number(r[1]),Number(r[2]),Number(r[3]));let i=o.replace(new RegExp(`^${U} `),"");r=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${B}(?: (\\d{4}))?$`).exec(i);let u=r?{date:r[1],month:r[2],year:r[3]}:void 0;r=new RegExp(`^${B} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(i);let a=u??(r?{date:r[2],month:r[1],year:r[3]}:void 0);if(a)return Z(n,Y(a.year),re(a.month),Number(a.date));if(r=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(i),r){let[c,d]=[Number(r[1]),Number(r[2])],[s,f]=oe(t)?[c,d]:[d,c];return Z(n,Y(r[3]),s,f)}}function Z(e,n,t,o){if(n!==void 0)return l(n,t,o);let r=Number(e.slice(0,4)),i=l(r,t,o);return i===void 0?l(r+1,t,o):m(e)-m(i)>183*x?l(r+1,t,o):i}function de(e,n){let t=e.trim();if(w(t)){let a=y(t);if(a)return n.time?a:{day:a.day}}let o=e.toLowerCase().replace(/,/g," ").replace(/(\d{4}-\d{2}-\d{2})t(\d\d:\d\d)(:\d\d(\.\d+)?)?/,"$1 $2").replace(/\s+/g," ").trim();if(o==="")return;let r=ie(o);if(r.bad)return;let i=ue(r.rest,n.today,n.locale??h);if(i===void 0||i===null&&r.minutes===void 0)return;let u=i??n.base?.day??n.today;return n.time?{day:u,minutes:r.minutes??n.base?.minutes??9*60}:{day:u}}var ae=e=>/^[A-Z]{3}$/.test(e??"");function P(e){let{format:n,unit:t,currency:o,locale:r}=e,i=ae(t),u=n==="money"||!n&&i,a=u?i?t:o:void 0;return{...u?{format:"money"}:n?{format:n}:{},...t&&!(u&&i)?{unit:t}:{},...a?{currency:a}:{},...r?{locale:r}:{}}}function Te(e){switch(e.format){case"money":return e.currency?`An amount of money in ${e.currency}: a plain number, 1250.5 for 1,250.50 ${e.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return e.unit?`A number of ${e.unit}.`:"A number."}}function H(e){let n=$(e)?.innerType;return n===void 0?e:H(n)}var se={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ce=e=>(e?._zod?.def?.checks??[]).map(n=>n._zod?.def).filter(n=>n!==void 0);function k(e){let n=H(e),t=$(n),o=t?.type,r=ce(n);if(o==="enum")return{type:"choice",options:Object.keys(t?.entries??{})};let i=j(n);if(i)return i==="image"?{type:"file",image:!0}:i==="video"?{type:"file",video:!0}:{type:"file"};if(o==="boolean")return{type:"boolean"};if(o==="array"){let u=k(t?.element);return u.type==="unknown"?{type:"unknown"}:{type:"several",of:u}}if(o==="number"){let u,a,c;for(let d of r){d.check==="multiple_of"&&typeof d.value=="number"?c=d.value:d.check==="number_format"&&(d.format==="safeint"||d.format==="int32"||d.format==="uint32")&&(c??=1);let s=d.check==="number_format"&&d.format?se[d.format]:void 0,f=s?s[0]:d.check==="greater_than"&&d.inclusive&&typeof d.value=="number"?d.value:void 0,A=s?s[1]:d.check==="less_than"&&d.inclusive&&typeof d.value=="number"?d.value:void 0;f!==void 0&&(u=u===void 0?f:Math.max(u,f)),A!==void 0&&(a=a===void 0?A:Math.min(a,A))}return{type:"number",...u===void 0?{}:{min:u},...a===void 0?{}:{max:a},...c===void 0?{}:{step:c},...M(n)==="duration"?{duration:!0}:{},...O(e)?{amount:P(O(e))}:{}}}if(o==="string"){if(r.some(s=>s.fn===E||s.format==="datetime")||t?.format==="datetime")return{type:"date",time:!0,instant:!0};let a=[t?.pattern,...r.map(s=>s.pattern)].filter(s=>s instanceof RegExp).map(s=>s.source);if(a.some(s=>s.includes("\\d{4}")))return a.some(s=>s.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:{type:"date"};let c=r.some(s=>s.check==="max_length"&&typeof s.maximum=="number"&&s.maximum>500),d=M(n);return c?{type:"text",long:!0}:d==="phone"||d==="place"?{type:"text",holds:d}:{type:"text"}}return{type:"unknown"}}function fe(e,n){let t=e?.shape;return!t||!(n in t)?{type:"unknown"}:k(t[n])}function me(e){if(e===void 0||e==="web"||e.startsWith("ai:")||e.startsWith("app:"))return;if(e==="api")return"via the API";if(e==="cli")return"via the command line";let[n,...t]=e.split(":"),o=t.join(":");return(n==="mcp"||n==="view")&&o?`via ${o}`:n==="mcp"?"via an agent's tools":`via ${e}`}var G=e=>{if(!e.currency)return{before:!0};try{let n=N(e.locale),t=new Intl.NumberFormat(n,{style:"currency",currency:e.currency}).formatToParts(1),o=t.findIndex(u=>u.type==="currency"),r=t.findIndex(u=>u.type==="integer"),i;try{i=new Intl.DisplayNames([n],{type:"currency"}).of(e.currency)}catch{}return{...o>=0?{symbol:t[o].value}:{},before:o<r,...i?{name:i}:{}}}catch{return{symbol:e.currency,before:!0}}};function le(e){let n=e.locale;if(e.format==="money"){let{symbol:t,before:o,name:r}=G(e),i=p(1250,n,{minimumFractionDigits:2,maximumFractionDigits:2});return{...t?o?{prefix:t}:{suffix:t}:{},placeholder:i,hint:r?`in ${r}`:e.currency?`in ${e.currency}`:"an amount of money"}}return e.format==="percent"?{suffix:"%",placeholder:p(15,n),hint:"as a percent"}:{...e.unit?{suffix:e.unit}:{},placeholder:"",hint:e.unit?`in ${e.unit}`:"a number"}}function pe(e,n){return e===void 0||!Number.isFinite(e)?"":n.format==="money"?p(e,n.locale,Number.isInteger(e)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):n.format==="percent"?p(e*100,n.locale,{maximumFractionDigits:4}):p(e,n.locale,{maximumFractionDigits:6})}function ye(e){try{let n=new Intl.NumberFormat(N(e)).formatToParts(12345.6);return{group:n.find(t=>t.type==="group")?.value??",",decimal:n.find(t=>t.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function ge(e,n){let{group:t,decimal:o}=ye(n),r=e.replace(/[\s ']/g,"").replace(/[−–]/g,"-");if(o!=="."&&!r.includes(o)&&/^-?\d+\.\d{1,2}$/.test(r))return Number(r);if(t&&(r=r.split(t).join("")),o!=="."&&(r=r.replace(o,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(r))return;let i=Number(r);return Number.isFinite(i)?i:void 0}function be(e,n){let t=e.trim();if(t==="")return;let o=n?.format==="money"&&n.currency?G(n).symbol:void 0,r=t;o&&(r=r.split(o).join("")),n?.currency&&(r=r.replace(new RegExp(n.currency,"gi"),"")),r=r.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(r)&&(r=r.replace(/%\s*$/,"")),n?.unit&&n.format!=="money"&&(r=r.replace(new RegExp(`\\s*${n.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let u=ge(r,n?.locale);if(u!==void 0)return n?.format==="percent"?u/100:u}export{P as a,Te as b,H as c,k as d,fe as e,z as f,K as g,me as h,le as i,pe as j,be as k,L as l,w as m,y as n,F as o,V as p,q,ee as r,de as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m}from"./chunk.
|
|
1
|
+
import{m}from"./chunk.LLEFYJPJ.js";import{G as N,R as f,U as y}from"./chunk.FOQZADMA.js";import{b as g}from"./chunk.AJZBJBMO.js";var p=g(N(),1);var a=g(f(),1);var R={default:{background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)"},muted:{background:"var(--graview-panel-muted, #f7f5f1)",color:"var(--graview-ink, #1a1a1a)"},warning:{background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)"}},T={color:"var(--graview-ink-muted, #55514a)"},C={color:"var(--graview-ink-faint, #625d55)"};function H(e){let[l,o]=(0,p.useState)(z);return(0,p.useEffect)(()=>{let r=e.current;if(!r||typeof ResizeObserver>"u")return;let t=()=>{let i=W(r,parseFloat(getComputedStyle(r).paddingBottom)||0);o(s=>s.overflowing===i.overflowing&&s.above===i.above&&s.below===i.below?s:i)};t();let d=new ResizeObserver(t);d.observe(r);for(let i of r.children)d.observe(i);return r.addEventListener("scroll",t,{passive:!0}),()=>{d.disconnect(),r.removeEventListener("scroll",t)}}),l}var z={overflowing:!1,above:!1,below:!1};function W(e,l=0){let o=e.scrollHeight>e.clientHeight+1,r=e.scrollWidth>e.clientWidth+1;return{overflowing:o||r,above:o&&e.scrollTop>1,below:o&&e.scrollTop+e.clientHeight<e.scrollHeight-l-1}}var A=(0,p.createContext)(null),I=(0,p.createContext)(null);function O({level:e,said:l=!0,style:o,children:r}){if(e===void 0)return(0,a.jsx)("strong",{style:o,...l?{}:{"aria-hidden":!0},children:r});let t=`h${e}`;return(0,a.jsx)(t,{style:{margin:0,...o},children:r})}function E({title:e,subtitle:l,meta:o,selected:r,tone:t="default",children:d,style:i,fit:s=!1,variant:w,heading:b}){let c=(0,p.useRef)(null),{overflowing:v,above:x,below:S}=H(c),P=y(),n=(w??(P==="fullscreen"?"page":"card"))==="page",k=(0,p.useContext)(A),u=(0,p.useContext)(I);return(0,a.jsxs)("div",{"data-graview-primitive":"panel","data-graview-variant":n?"page":"card","data-selected":r||void 0,style:{display:"flex",flexDirection:"column",gap:n?12:"var(--graview-gap, 7px)",height:n||s?"auto":"100%",maxHeight:n?"none":"100%",padding:n?0:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:n?0:"var(--graview-radius, 12px)",border:n?"none":`1px solid ${r?"var(--graview-accent, #2f6f5e)":"var(--graview-edge, #e4e0d8)"}`,boxShadow:n?"none":r?"0 0 0 1px var(--graview-accent-dim), var(--graview-lift-low)":"var(--graview-lift-low)",overflow:n?"visible":"hidden",...R[t],...n?{background:"transparent"}:{},...i},children:[t==="warning"?(0,a.jsx)("span",{"data-graview-broken":"",style:m,children:"Implicated in a problem."}):null,e===void 0||e===k?null:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0},children:[t==="warning"?(0,a.jsx)("span",{"aria-hidden":"true",title:"Implicated in a problem",style:{color:"var(--graview-warn)",flex:"0 0 auto"},children:"\u26A0"}):null,(0,a.jsx)(O,{level:b,said:u===null||e!==u,style:{fontFamily:"var(--graview-font-display, inherit)",fontSize:n?"1.5625rem":"0.9375rem",lineHeight:n?1.15:1.25,fontWeight:n?600:560,letterSpacing:n?"-0.012em":"0.005em",minWidth:0,overflowWrap:"anywhere"},children:e}),o===void 0?null:(0,a.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",letterSpacing:"0.08em",textTransform:"uppercase",minWidth:0,overflowWrap:"anywhere",...C},children:o})]}),l===void 0?null:(0,a.jsx)("div",{style:{fontSize:n?"0.90625rem":"0.8125rem",lineHeight:1.5,...T},children:l}),(0,a.jsx)("div",{ref:c,className:n?void 0:"graview-scroll",...v&&!n?{tabIndex:0,role:"region",...typeof e=="string"?{"aria-label":e}:{}}:{},style:{display:"flex",flexDirection:"column",gap:n?22:"var(--graview-gap, 7px)",flex:"1 1 auto",...n?{overflow:"visible"}:{marginBottom:"calc(-1 * var(--graview-pad, 15px))",paddingBottom:"var(--graview-pad, 15px)"},...!n&&!v?{overflow:"hidden"}:{}},"data-graview-more-above":x&&!n?"":void 0,"data-graview-more-below":S&&!n?"":void 0,children:d})]})}function h({label:e,hue:l,selected:o,title:r,pickId:t,emphasis:d}){let i=typeof e=="string"?e:void 0,s=l===void 0?void 0:Math.round(l);return(0,a.jsxs)("span",{"data-graview-primitive":"chip","data-selected":o||void 0,"data-graview-pick":t,"data-graview-emphasis":d,title:r??i,style:{cursor:t?"pointer":void 0,display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",maxWidth:"min(28ch, 100%)",overflow:"hidden",letterSpacing:"0.01em",border:`1px solid ${o?"var(--graview-accent)":s===void 0?"var(--graview-edge)":`hsl(${s} 55% var(--graview-tint-lightness) / 0.45)`}`,background:s===void 0?"var(--graview-panel-muted)":`hsl(${s} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * 0.65))`,color:"var(--graview-ink, #1a1a1a)",boxShadow:o?"0 0 14px -4px var(--graview-accent)":void 0},children:[s===void 0?null:(0,a.jsx)("span",{"aria-hidden":"true",style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",marginRight:6,background:`hsl(${s} 55% var(--graview-tint-lightness) / 0.9)`}}),(0,a.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function L({items:e,max:l=8,selectedIds:o=[],pick:r=!1}){let t=e.slice(0,l),d=e.length-t.length;return(0,a.jsxs)("div",{"data-graview-primitive":"roster",style:{display:"flex",flexWrap:"wrap",gap:6,alignContent:"flex-start"},children:[t.map(i=>(0,a.jsx)(h,{label:i.label,...i.hue===void 0?{}:{hue:i.hue},...r?{pickId:i.id}:{},...i.emphasis===void 0?{}:{emphasis:i.emphasis},selected:o.includes(i.id)},i.id)),d>0?(0,a.jsx)(h,{label:`+${d} more`}):null]})}function F({label:e,count:l,items:o,onExpand:r,flagged:t,problems:d}){return(0,a.jsx)(E,{title:e,meta:d?(0,a.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[d,(0,a.jsx)("span",{children:l})]}):l,tone:t?"warning":"muted",style:r?{cursor:"zoom-in"}:void 0,children:o&&o.length>0?(0,a.jsx)(L,{items:o,max:6,pick:!0}):null})}export{A as a,I as b,E as c,h as d,L as e,F as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.2FLPDPEL.js";import"./chunk.UUBYFBPN.js";import{b as m}from"./chunk.2RVUDRRY.js";import"./chunk.LLEFYJPJ.js";import{R as p}from"./chunk.FOQZADMA.js";import"./chunk.SDO3U72B.js";import{T as l}from"./chunk.V5MYKNL7.js";import{b as f}from"./chunk.AJZBJBMO.js";var a=f(p(),1);function N({states:e,definition:v}){let s=e.values.reduce((t,n)=>t+n.count,0),u=t=>t===null?"with none":m(v,e.field,t).toLowerCase(),c=e.values.filter(t=>t.count>0).map(t=>`${l(t.count)} ${u(t.value)}`).join(", ");return s===0?null:(0,a.jsx)("div",{className:"graview-district-states",role:"img","aria-label":c,title:c,children:e.values.map((t,n)=>{if(t.count===0)return null;let y=e.values.filter(r=>r.count>0).length,w=t.count/s*(168-(y-1)),o=l(t.count),i=`${o} ${u(t.value)}`,d=r=>r.length*6.2+8<=w;return(0,a.jsx)("span",{"data-graview-tier":t.tier,style:{flexGrow:t.count},title:i,children:d(i)?i:d(o)?o:""},n)})})}export{N as StatesBar};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk.7WPCP2LZ.js";import"./chunk.XQHDP5C3.js";import"./chunk.AKQXF7GW.js";import"./chunk.6JEU3ZNE.js";import"./chunk.BFNVG5JE.js";import"./chunk.2GDXNTY5.js";import"./chunk.O5JKDFDH.js";import"./chunk.UT6642FC.js";import{b as n}from"./chunk.PPG2SEIY.js";import"./chunk.H5ADMSE7.js";import"./chunk.TI4OSTQV.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.LLEFYJPJ.js";import{R as i}from"./chunk.FOQZADMA.js";import"./chunk.SDO3U72B.js";import"./chunk.V5MYKNL7.js";import{b as o}from"./chunk.AJZBJBMO.js";var e=o(i(),1);function g({entries:d,style:l,headingStyle:p,className:r}){return(0,e.jsxs)("section",{...r?{className:r}:{},"data-testid":"record-ai","aria-label":"What AI did here",style:{display:"grid",gap:10,...l},children:[(0,e.jsx)("h2",{style:p??{margin:0,fontSize:"1rem"},children:"What AI did here"}),(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,fontSize:"0.875rem"},children:d.slice(0,8).map(t=>(0,e.jsx)(n,{entry:t,undo:s=>(0,e.jsx)(a,{batch:s})},t.id))})]})}export{g as RecordInteractions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as a,k as o}from"./chunk.VZYCILPJ.js";import"./chunk.4QPVS2ZM.js";import"./chunk.RCM7NOPF.js";import"./chunk.Z7LDT55A.js";import"./chunk.ZJMDLRC5.js";import"./chunk.2GDXNTY5.js";import"./chunk.ETOGQE2V.js";import"./chunk.O5JKDFDH.js";import"./chunk.YYIKSH2F.js";import"./chunk.5RABSIF7.js";import"./chunk.NGDXH66B.js";import"./chunk.67WWRC6Y.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.LLEFYJPJ.js";import{ma as n}from"./chunk.FOQZADMA.js";import"./chunk.SDO3U72B.js";import"./chunk.V5MYKNL7.js";import"./chunk.AJZBJBMO.js";var w=new WeakMap;function s(e,i){let t=w.get(e);t||w.set(e,t=new Map);let r=t.get(i);return r||t.set(i,r=a(o(e,n(e)),e,i)),r}export{s as frameworkViews};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{B as y,
|
|
1
|
+
import{B as y,Eb as $,Ib as x,K as h,T as g,da as m}from"./chunk.V5MYKNL7.js";function B(n,e,t){let o=n?.display?.format?.[e];return o?o(t):typeof t=="string"?m(t):String(t)}function G(n,e,t,o){let s=n.tryDefinition(e)?.edges,i=s&&Object.hasOwn(s,t)?s[t]:void 0;return(o==="out"?i?.description:i?.inverse)??m(t).toLowerCase()}var O=Symbol.for("@graview/core:markdown");function S(n){let e=y(n);return!!e&&(e[O]===1||S(e.innerType))}var w=/^ {0,3}#{1,6}(?:[ \t]+|$)/,b=/^[ \t]*(?:[-*+•]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/,k=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,R=/^ {0,3}(?:`{3,}|~{3,})/,F=/^ {0,3}(?:>[ \t]?)+/,A=/^\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)*\|?$/,_={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'",nbsp:" "};function E(n){return n.replace(/!?\[([^\]\n]{0,500})\]\([^)\n]{0,500}\)/g,"$1").replace(/<((?:https?:|mailto:)[^>\s]*)>/gi,"$1").replace(/<\/?[A-Za-z][^<>\n]*>/g,"").replace(/`+([^`\n]*)`+/g,"$1").replace(/(\*\*|__|~~)(?=\S)([^\n]{0,500}?\S)\1/g,"$2").replace(/(^|[^\w*])\*(?=\S)([^*\n]{0,500}?\S)\*(?![\w*])/g,"$1$2").replace(/(^|\W)_(?=\S)([^_\n]{0,500}?\S)_(?!\w)/g,"$1$2").replace(/\\([\\`*_{}[\]()#+\-.!>|~])/g,"$1").replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(e,t)=>_[t]??"")}function N(n,e,t){let o=n.replace(/\r\n?/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),s=[],i=[],c=0,d=!1,u=()=>{let r=i.join(" ").replace(/\s+/g," ").trim();r&&(s.push(r),c+=r.length),i=[]},a=0;for(;a<o.length&&c<=t;){let r=o[a++];if(e&&R.test(r)){d=!d,d||u();continue}if(!d&&(r.trim().length===0||e&&(k.test(r)||A.test(r.trim())))){u();continue}let f=!d&&e&&w.test(r),l=!d&&b.test(r);if((f||l)&&u(),e&&!d?(r=r.replace(F,""),f&&(r=r.replace(w,"").replace(/[ \t]+#+[ \t]*$/,"")),l&&(r=r.replace(b,"")),r.includes("|")&&(r=r.replace(/^[ \t]*\||\|[ \t]*$/g,"").split("|").map(p=>p.trim()).filter(Boolean).join(" \xB7 ")),r=E(Number.isFinite(t)?r.slice(0,t*2+200):r)):l&&(r=r.replace(b,"")),i.push(r),f&&u(),i.reduce((p,T)=>p+T.length,0)>t)break}return u(),{blocks:s,more:o.slice(a).some(r=>r.trim().length>0&&!(e&&(R.test(r)||k.test(r))))}}function M(n,e){return`${(n.slice(0,e+1).replace(/\s+\S*$/,"")||n.slice(0,e)).replace(/[\s,;:.—-]+$/,"")}\u2026`}function Z(n,e={}){let t=e.most??160,{blocks:o,more:s}=N(n,e.markdown===!0,t),i=o[0]??"";if(i.length<=t)return(s||o.length>1)&&i.length>0&&!/[.!?…:]$/.test(i)?`${i}\u2026`:i;let c=x(i);return c&&c.length<=t?c:M(i,t)}var J=n=>N(n,!0,Number.POSITIVE_INFINITY).blocks.join(" ");var j={d:1440,h:60,m:1};function ne(n){if(typeof n=="number")return Number.isFinite(n)&&n>=0?Math.round(n):void 0;if(typeof n!="string")return;let e=n.trim().toLowerCase();if(/^\d+$/.test(e))return Number(e);let t=/^(\d+):([0-5]\d)(?::([0-5]\d))?$/.exec(e);if(t)return Number(t[1])*60+Number(t[2])+Math.round(Number(t[3]??0)/60);let o=0,s=!1,i=e.replace(/(\d*[.,]?\d+) *(days?|d|hours?|hrs?|hr|h|minutes?|mins?|min|m)(?![a-z])/g,(c,d,u)=>(s=!0,o+=Number(d.replace(",","."))*j[u[0]]," "));return s&&/^[\s,+]*(?:and[\s,+]*)*$/.test(i)?Math.round(o):void 0}function I(n,e){if(!Number.isFinite(n))return String(n);let t=Math.round(Math.abs(n)),o=Math.floor(t/60),s=t%60,i=[o?`${g(o,e)} h`:"",s||!o?`${g(s,e)} min`:""].filter(Boolean).join(" ");return n<0?`\u2212${i}`:i}var D=/^(\+?1[ .-]?)?\(?([2-9]\d\d)\)?[ .-]?(\d{3})[ .-]?(\d{4})(?: *(?:ext\.?|x|#) *(\d+))?$/i;function W(n,e){let t=n.trim(),o=/[-_](US|CA)\b/i.test(h(e))?D.exec(t):null;if(!o)return t;let[,s,i,c,d,u]=o;return`${s?.startsWith("+")?"+1 ":""}(${i}) ${c}-${d}${u?` ext. ${u}`:""}`}function P(n){let[,e="",t]=/^(.*?)(?: *(?:ext\.?|x|#) *(\d+))?$/i.exec(n.trim())??[],o=e.replace(/\D/g,"");return o.length<3?void 0:`tel:${e.startsWith("+")?"+":""}${o}${t?`;ext=${t}`:""}`}var L=()=>/Mac|iPhone|iPad|iPod/.test(globalThis.navigator?.userAgent??"");function q(n,e=L()){let t=encodeURIComponent(n.trim());return e?`https://maps.apple.com/?q=${t}`:`https://www.google.com/maps/search/?api=1&query=${t}`}var C=n=>n?.fields?.shape??{},U=(n,e)=>{let t=C(n);return Object.hasOwn(t,e)?$(t[e]):void 0},H=(n,e)=>{let t=n.computed,o=t&&Object.hasOwn(t,e)?t[e]:void 0;return typeof o=="object"?o.as:void 0};function te(n,e){return U(n,e)??(n&&H(n,e)==="duration"?"duration":void 0)}function re(n,e,t){return n==="duration"?typeof e=="number"?I(e,t):void 0:n==="phone"?typeof e=="string"?W(e,t):void 0:n==="place"&&typeof e=="string"?e.trim():void 0}function oe(n,e){if(!(typeof e!="string"||!e.trim()))return n==="phone"?P(e):n==="place"?q(e):void 0}export{S as a,B as b,G as c,Z as d,J as e,ne as f,te as g,re as h,oe as i};
|
|
@@ -0,0 +1,9 @@
|
|
|
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{b as ae}from"./chunk.7WPCP2LZ.js";import{a as Y,c as H,d as X,e as J}from"./chunk.47KHZCNG.js";import"./chunk.XQHDP5C3.js";import"./chunk.AKQXF7GW.js";import"./chunk.6JEU3ZNE.js";import"./chunk.BFNVG5JE.js";import"./chunk.ZJMDLRC5.js";import"./chunk.2GDXNTY5.js";import"./chunk.O5JKDFDH.js";import"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.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.LLEFYJPJ.js";import{Da as K,F as V,G as q,Ha as U,R as x,S as F,_ as b,c as W,ua as z,x as j}from"./chunk.FOQZADMA.js";import{a as N}from"./chunk.SDO3U72B.js";import{Va as _,ba as I,da as G,ga as B,pb as D}from"./chunk.V5MYKNL7.js";import{b as w}from"./chunk.AJZBJBMO.js";var re=w(q(),1);function P(e){return{minHeight:24,padding:"3px 10px",borderRadius:6,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:e?"transparent":"var(--graview-edge)",color:e?"var(--graview-ink)":"var(--graview-ink-muted)",fontWeight:e?600:400,background:e?"color-mix(in srgb, var(--graview-accent) 16%, transparent)":"transparent"}}var M=w(x(),1);function Q(){let{seats:e,principal:t,takeSeat:i}=b();return e.length<2?null:(0,M.jsxs)("div",{role:"group","aria-label":"Seat","data-testid":"seats",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,rowGap:4},children:[(0,M.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"As"}),e.map(a=>{let l=ie(t,a.principal);return(0,M.jsx)("button",{type:"button","aria-pressed":l,"data-testid":`seat-${a.principal.id??a.label}`,title:`Sit down as ${a.label}: the acts, the kinds and the pages narrow to what this seat may do`,onClick:()=>i(a.principal),style:{...P(l),whiteSpace:"nowrap"},children:a.label},a.principal.id??a.label)})]})}function ie(e,t){return e.kind===t.kind&&e.id===t.id}var L=w(q(),1),c=w(x(),1),oe=`
|
|
2
|
+
.graview-here{display:flex;flex:none}
|
|
3
|
+
.graview-here>button{display:inline-flex;align-items:center;gap:4px;height:30px;margin:0;padding:0 4px;border:1px solid transparent;border-radius:8px;background:none;box-shadow:none;font:inherit;font-size:.75rem;color:var(--graview-ink-muted);cursor:pointer}
|
|
4
|
+
.graview-here-mark{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:24px;height:24px;border-radius:50%;border:1.5px solid hsl(var(--graview-hue) 50% 48%);background:var(--graview-panel-muted);color:var(--graview-ink);font-size:.75rem;font-weight:600;box-shadow:0 0 0 2px var(--graview-bar)}
|
|
5
|
+
.graview-here-mark+.graview-here-mark{margin-left:-10px}
|
|
6
|
+
.graview-here-mark[data-agent]{border-radius:5px}
|
|
7
|
+
.graview-here-mark[data-counted]{--graview-hue:0;border-color:var(--graview-edge)}
|
|
8
|
+
.graview-here small{display:block;font-size:.75rem;color:var(--graview-ink-muted)}
|
|
9
|
+
.graview-bar[data-finding] .graview-here{display:none}`,se={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function le(e,t){let i=t.id===void 0?null:`${t.kind}:${t.id}`,a=new Map;for(let l of e.values()){let d=l.participant.slice(0,l.participant.lastIndexOf(":"));if(d===i)continue;let s=d.endsWith(":")?l.participant:d,o=a.get(s);(!o||o.at<l.at)&&a.set(s,l)}return[...a.values()]}var Z=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",ee=e=>e===1?"1 viewer":`${e} viewers`;function de(e){let t=e.map(Z).filter(Boolean),i=t.length<e.length?[...t,ee(e.length-t.length)]:t,a=i.pop();return`${i.length>0?`${i.join(", ")} and ${a}`:a} ${e.length===1?"is":"are"} here`}function pe(e,t){let{store:i,hidden:a,pictures:l}=t,d=W(e),s=i.kindsKeptFrom(t.principal),o=u=>!a.has(u)&&!s.has(u)&&!i.modules.disabledKinds.has(u),g=l.find(u=>u.as===d.within?.view&&o(u.kind));if(g)return g.title;if(!d.focusId)return d.overview?"the whole thing":null;let p=j(d.focusId);if(p.length>0)return p.every(o)?p.map(u=>B(i.schema,u)).join(" and "):null;let h=i.graph.getNode(d.focusId);return h&&o(h.kind)?I(i.schema.tryDefinition(h.kind),h):null}function ce(e,t){let i=o=>o.id!==void 0&&(o.id===t.principal.id||o.onBehalfOf?.id===t.principal.id),a=e.filter(o=>!D(o)&&o.author.kind!=="system"&&!i(o.author)),l=a[0];if(!l)return null;let d=_(l.author,{graph:t.store.graph,schema:t.store.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),s=[...new Set(a.map(o=>o.intent))].join("; ");return`${d}: ${s}`}function ue(e,t,i){let a=ce(e,t);a&&(i(""),setTimeout(()=>i(a),50))}function ge({scene:e,compact:t}){let{who:i,principal:a,store:l,views:d,hiddenKinds:s,follow:o}=b(),g=U("here"),p=le(i,a),h=p.length===0?"":de(p),[u,S]=(0,L.useState)("");if((0,L.useEffect)(()=>S(h),[h]),p.length===0)return null;let f=p.filter(r=>r.name),y=f.slice(0,t?2:3),m=p.length-y.length,k=p.length-f.length,T=d.places();return(0,c.jsxs)("div",{className:"graview-here","data-testid":"here",children:[(0,c.jsx)("style",{children:oe}),(0,c.jsx)("span",{role:"status","aria-live":"polite",style:se,children:u}),(0,c.jsxs)("button",{type:"button","data-testid":"here-open",...g.trigger,onClick:g.toggle,"aria-label":`${h} \u2014 who and where`,title:h,children:[y.length>0?(0,c.jsx)("span",{style:{display:"flex"},children:y.map(r=>(0,c.jsx)(E,{one:r},r.participant))}):(0,c.jsx)(E,{count:m}),y.length>0&&m>0?(0,c.jsxs)("span",{"aria-hidden":"true",children:["+",m]}):null]}),(0,c.jsxs)("ul",{...g.pane,"aria-label":"Who is here","data-testid":"here-list",hidden:!g.open,className:"graview-bar-list",style:K,children:[f.map(r=>{let v=pe(r.stop,{store:l,principal:a,hidden:s,pictures:T}),A=Z(r);return(0,c.jsx)("li",{children:(0,c.jsxs)(e?"button":"span",{className:"graview-bar-item","data-testid":"here-one",...e?{type:"button",title:`Go where ${A} is`,onClick:()=>{g.setOpen(!1),o(r.participant)}}:{style:{cursor:"default"}},children:[(0,c.jsx)(E,{one:r}),(0,c.jsxs)("span",{children:[A,v?(0,c.jsxs)("small",{children:["On ",v]}):null]})]})},r.participant)}),k>0?(0,c.jsx)("li",{children:(0,c.jsxs)("span",{className:"graview-bar-item","data-testid":"here-viewers",style:{cursor:"default"},children:[(0,c.jsx)(E,{count:k}),(0,c.jsxs)("span",{children:[ee(k),(0,c.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function E({one:e,count:t}){return(0,c.jsx)("span",{className:"graview-here-mark","aria-hidden":"true",...e?{style:{"--graview-hue":Math.round(e.hue)}}:{"data-counted":""},...e?.kind==="agent"?{"data-agent":""}:{},children:e?(e.name??"").trim().charAt(0).toUpperCase():t})}function he(e){let t=/^(?:place|scene):([^:]+):(.+)$/.exec(e.key);return t?{place:t[2],about:[`aggregate:${t[1]}`],title:e.label}:{about:e.group==="lists"&&e.kind?[`aggregate:${e.kind}`]:[],title:e.label}}function O(e,t,i,a,l,d){let s=he(t),o=e.getBoundingClientRect(),g={...s,face:i?"scene":"pages",x:Math.round(l??o.left+Math.min(16,o.width/2)),y:Math.round(d??Math.min(o.bottom,o.top+36)),returnTo:e},p=i?null:e.closest("[data-graview-embed], [data-graview-shell]")?.querySelector("[data-graview-face='pages']")??document.querySelector("[data-graview-face='pages']");p?p.dispatchEvent(new CustomEvent(F,{detail:g})):a(g)}var R={on:null,at:0},te=500,me=10;function ye(e,t,i,a,l,d,s){let o=t.getAttribute("data-testid")??"",g=o==="app-places-open"?a:o.slice(10),p=i.find(m=>m.key===g);if(!p)return;if(e.type==="keydown")return R={on:t,at:Date.now()},O(t,p,l,d);let{clientX:h,clientY:u}=e;if(e.type==="contextmenu")return R.on===t&&Date.now()-R.at<700?void 0:h===0&&u===0?O(t,p,l,d):O(t,p,l,d,h,u);let S=Date.now()-Math.max(0,performance.now()-e.timeStamp),f=!1,y=m=>{Math.hypot(m.clientX-h,m.clientY-u)>me&&(f=!0)};document.addEventListener("pointermove",y),setTimeout(()=>{document.removeEventListener("pointermove",y),!(f||s.at!==0&&s.at-S<te)&&(R={on:t,at:Date.now()},t.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,once:!0}),O(t,p,l,d,h,u))},Math.max(0,te-(Date.now()-S)))}var n=w(x(),1),Ie=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.LLEFYJPJ.js","./chunk.FOQZADMA.js","./chunk.SDO3U72B.js","./chunk.V5MYKNL7.js","./chunk.AJZBJBMO.js"]),import("./chunk.CNFL5IN5.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),fe=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.FOQZADMA.js","./chunk.SDO3U72B.js","./chunk.V5MYKNL7.js","./chunk.AJZBJBMO.js"]),import("./chunk.IDUPJMJO.js")))).part((e,t)=>(0,n.jsx)(e.HoverChipsSwitch,{...t}),{quiet:!0});function Be({violations:e,pick:t}){let{store:i,brand:a,setMenuAt:l}=b(),d=Y(i,e);return(0,n.jsx)(n.Fragment,{children:d.map((s,o)=>{let g=J(s),p=s.repairs.length>0?`${s.repairs.length} ${s.repairs.length===1?"way":"ways"} to fix`:"";return(0,n.jsx)("li",{style:{borderTop:o===0?"none":"1px solid var(--graview-edge)"},children:(0,n.jsxs)("button",{type:"button",onClick:h=>{let u=h.currentTarget.closest("ol").getBoundingClientRect();t(s),l({x:u.left,y:u.top,on:s.subjectId})},...H(s)!==void 0?{title:H(s)}:{},style:{width:"100%",textAlign:"left",fontSize:"0.8125rem",lineHeight:1.4,padding:"7px 8px",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7},children:[s.line?(0,n.jsx)(X,{line:s.line,schema:i.schema,...a?{brand:a}:{},stacked:!0,style:{display:"block",color:"var(--graview-ink)"}}):(0,n.jsx)("span",{style:{display:"block",color:"var(--graview-ink)"},children:s.message}),g||p?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:[g,p].filter(Boolean).join(" \xB7 ")}):null]})},`${s.invariant}:${o}`)})})}function _e({name:e,me:t,scheme:i,onScheme:a,profileHref:l,hostActions:d,close:s,part:o,signature:g=!1}){let{principal:p,seats:h,settings:u,settingValues:S,chooseSetting:f,sharing:y,ai:m}=b(),k=p.roles??[],T={setOpen:r=>s()};return(0,n.jsx)(n.Fragment,{children:o==="top"?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{display:"grid",gap:3},children:[(0,n.jsx)("span",{style:$,children:"Signed in as"}),(0,n.jsx)("strong",{style:{fontSize:"1rem",fontWeight:550},children:e}),(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:k.length>0?k.map(r=>G(r)).join(", "):t===void 0?"This app has no sign-in; everything here is yours.":"No role in particular"}),t!==void 0&&l!==void 0?(0,n.jsx)("a",{href:l(t.id),"data-testid":"profile-record",style:{display:"inline-flex",alignItems:"center",minHeight:24,justifySelf:"start",fontSize:"0.875rem",color:"var(--graview-accent)"},children:"Your record \u2197"}):null,y?(0,n.jsxs)("span",{"data-testid":"profile-seen-as",style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["Seen by others as ",y.name]}):null]}),d.length>0?(0,n.jsx)("ul",{role:"list","aria-label":"From the host","data-testid":"host-actions",style:{...C,margin:0,paddingLeft:0,listStyle:"none",display:"grid",gap:2},children:d.map(r=>(0,n.jsx)("li",{children:r.href!==void 0?(0,n.jsx)("a",{href:r.href,"data-testid":"host-action",className:"graview-host-action",...r.target?{target:r.target,rel:"noopener"}:{},onClick:()=>{r.onSelect?.(),T.setOpen(!1)},style:ne,children:r.label}):(0,n.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{T.setOpen(!1),r.onSelect?.()},style:{...ne,width:"100%",textAlign:"left",border:"none",background:"none",boxShadow:"none",font:"inherit",cursor:"pointer"},children:r.label})},r.label))}):null]}):(0,n.jsxs)(n.Fragment,{children:[h.length>1?(0,n.jsxs)("div",{style:{display:"grid",gap:6,...C},children:[(0,n.jsx)("span",{style:$,children:"Sit as somebody else"}),(0,n.jsx)(Q,{})]}):null,u.length>0?(0,n.jsx)("div",{style:{display:"grid",gap:10,...C},children:u.map(r=>(0,n.jsxs)("fieldset",{"data-testid":`setting-${r.name}`,style:{border:0,margin:0,padding:0,display:"grid",gap:5},children:[(0,n.jsx)("legend",{style:{...$,padding:0},children:r.title}),r.description?(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:r.description}):null,(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:r.options.map(v=>{let A=(S[r.name]??r.initial)===v.value;return(0,n.jsx)("button",{type:"button","aria-pressed":A,"data-testid":`setting-${r.name}-${v.value}`,onClick:()=>f(r.name,v.value),style:P(A),children:v.label},v.value)})})]},r.name))}):null,V(m)?(0,n.jsx)(re.Suspense,{fallback:null,children:(0,n.jsx)(fe,{legend:$,style:C,choice:P})}):null,i!==void 0&&a!==void 0?(0,n.jsxs)("div",{style:{display:"grid",gap:5,...C},children:[(0,n.jsx)("span",{style:$,children:"Scheme"}),(0,n.jsx)("div",{style:{display:"flex",gap:4},children:["light","dark"].map(r=>(0,n.jsx)("button",{type:"button","aria-pressed":i===r,"data-testid":`profile-scheme-${r}`,onClick:()=>a(r),style:P(i===r),children:r==="light"?"\u2600 Light":"\u263E Dark"},r))})]}):null,g?(0,n.jsxs)("p",{"data-testid":"graview-signature",style:{...C,margin:0,display:"flex",alignItems:"center",gap:6,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["Built with",(0,n.jsxs)("a",{href:"https://graview.dev",target:"_blank",rel:"noopener",style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,color:"var(--graview-ink-muted)",fontWeight:600,textDecoration:"none"},children:[(0,n.jsx)("span",{"data-testid":"graview-mark",style:{display:"inline-flex",lineHeight:0},dangerouslySetInnerHTML:{__html:ve}}),"Graview"]})]}):null]})})}var ve='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="14" height="14" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round"><path d="M13 11 L3 8 L14 3 H29 L21 9"/><path d="M10 18 L3 23 L16.5 28 L29 21 L22 19"/><path d="M16.5 18.5 V23.5" stroke-linecap="round"/></g><circle cx="16.5" cy="13.5" r="2" fill="var(--graview-mark-point, currentColor)"/></svg>',ne={display:"flex",alignItems:"center",minHeight:28,padding:"2px 8px",borderRadius:7,fontSize:"0.875rem",color:"var(--graview-ink)",textDecoration:"none"},$={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},C={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};export{ae as ActivityRail,ge as Here,Be as ProblemRows,_e as ProfilePane,Ie as TidyFoot,ye as placeGesture,ue as sayTheirChange};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as J,C as Q,E as X,I as Y,K as ee,N as ne,a as I,i as q,l as Z,p as z,s as W,t as j,x as _,y as U}from"./chunk.LLEFYJPJ.js";import{Ca as D,G as se,R as N,_ as T,aa as $,na as G,va as K}from"./chunk.FOQZADMA.js";import{$b as V,Nc as O,ic as M,kc as P}from"./chunk.V5MYKNL7.js";import{b as F}from"./chunk.AJZBJBMO.js";var a=F(se(),1);function ce(e){let n=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],t=[];for(let r of n){let o=r?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!o||P(o)||o.toLowerCase()!==V.toLowerCase()&&(t.includes(o)||t.push(o))}return t}function te(e){let n=ce(e);return n.length===0?null:`https://fonts.googleapis.com/css2?${n.map(r=>`family=${encodeURIComponent(r).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var u=F(N(),1),ve=e=>typeof e=="object"?e:{};function we({rootRef:e,firstLook:n,app:t}){let r=(0,a.useCallback)(()=>e.current,[e]);return n?(0,u.jsx)(ne,{firstLook:n,root:r,app:t}):null}function Ee(e,n,t){let{app:r}=e,o=(0,a.useMemo)(()=>{let i=Y(n(r.schema,r.viewSpecs),r),c=t?de(i,t):i,s=e.views?e.views(r.schema,c):i,d=s===c?i:G(i,s);return ee(d,r.schema,Q(e.brand??r.brand,r.schema)),t?t.register(d):d},[e.views,r.schema,r.viewSpecs,r.lenses,r.pages,r.home,t]);return K(o,e.keptViews)}function de(e,n){let t={...e,register(r,o,i,c){return c?.name!==n.name&&e.register(r,o,i,c),t},...e.home?{home:r=>(n.home||e.home(r),t)}:{}};return t}function le(e,n){return new O({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...n?{snapshot:n}:{},...e.policy?{policy:e.policy}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function re(e){if(typeof document>"u")return e==="dark"?"dark":"light";let n=document.documentElement.dataset.theme;return n==="dark"||n==="light"?n:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ue(e,n){let[t,r]=(0,a.useState)(()=>re(n));return(0,a.useEffect)(()=>{if(!e||typeof document>"u")return;let o=()=>r(re(n));o();let i=new MutationObserver(o);i.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let c=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return c?.addEventListener?.("change",o),()=>{i.disconnect(),c?.removeEventListener?.("change",o)}},[e,n]),t}var A=e=>e?e.getBoundingClientRect().height:0;function Re(e,n,t){let r=(0,a.useRef)(t);r.current=t;let o=t!==void 0;(0,a.useLayoutEffect)(()=>{let i=e.current;if(!i||!o)return;let c=()=>{let y=[...i.children],h=y.find(b=>b.hasAttribute("data-graview-app-bar")),p=y.find(b=>b.hasAttribute("data-embed-content")),g=p?.querySelector("[data-embed-measure]")??null,l=y.find(b=>b.hasAttribute("data-graview-place-line"));return{strip:h,line:l,content:p,measure:g}},s=-1,d=()=>{let{strip:y,line:h,content:p,measure:g}=c(),l=Math.ceil(A(y)+A(h)+A(g||p));l!==s&&(s=l,r.current?.(l))};if(d(),typeof ResizeObserver>"u")return;let m=new ResizeObserver(d),E=()=>{m.disconnect();let{strip:y,line:h,content:p,measure:g}=c();for(let l of[i,y,h,p,g])l&&m.observe(l)};E();let S=new MutationObserver(()=>{E(),d()});return S.observe(i,{childList:!0}),()=>{m.disconnect(),S.disconnect()}},[e,n,o])}var xe=480,me=0;function ke(e){let{app:n,seed:t,scheme:r="auto",brand:o=n.brand,fonts:i=!0,height:c="100%",label:s}=e,d=(0,a.useRef)(null);D(d);let m=c==="viewport"?"100dvh":c,E=Z(typeof m=="string"&&/vh\b/.test(m)),S=(0,a.useMemo)(()=>`graview-embed-${++me}`,[]),y=(0,a.useMemo)(()=>e.store??e.remote?.store??le(n,t),[e.store,e.remote,n,t]),h=e.presence??e.remote?.presence,p=e.hostContext?.theme,g=ue(r==="auto"&&p===void 0,o?.scheme),l=r==="auto"?p??g:r,b=(0,a.useMemo)(()=>I(l,o,{scope:`.${S}`}),[l,o,S]);q(e.favicon?M(o):void 0),(0,a.useEffect)(()=>{if(!i||typeof document>"u")return;let w=te(o);if(!w||document.querySelector(`link[href="${w}"]`))return;let f=document.createElement("link");f.rel="stylesheet",f.href=w,document.head.appendChild(f)},[o,i]);let k=(0,a.useRef)(void 0);(0,a.useLayoutEffect)(()=>{let w=d.current,f=k.current;if(k.current=s,!w||!s)return;let ie=v=>{let R=v.getAttribute("aria-label")??"",x=f&&f!==s?R.startsWith(`${f} \xB7 `)?R.slice(f.length+3):R===f?"":R:R;x===s&&(v.getAttribute("role")==="region"||v.tagName==="SECTION"&&!v.hasAttribute("role"))&&v.setAttribute("role","group");let C=x.startsWith(`${s} \xB7 `)||x===s?x:x?`${s} \xB7 ${x}`:s;C!==R&&v.setAttribute("aria-label",C)},B=()=>w.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(v=>{v.hasAttribute("data-graview-named-by-lens")||ie(v)});B();let H=new MutationObserver(B);return H.observe(w,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>H.disconnect()},[s]);let ae=E?`${m}`.replace(/([\d.]+)[sdl]?vh\b/g,(w,f)=>`${+f*E/100}px`):m;return{rootRef:d,scope:S,css:b,scheme:l,store:y,presence:h,brand:o,auto:c==="auto",height:ae}}function Ae({rootRef:e,board:n}){let t=(0,a.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]);return(0,u.jsx)(z,{board:n,anchor:t})}function Fe(e,n,t){return{brand:t,locale:e.locale,timeZone:e.timeZone,principal:e.principal,seats:e.seats,presence:n,people:e.people,memory:e.memory,presenceTtlMs:e.presenceTtlMs,onKeepLens:e.onKeepLens,ai:e.ai,files:e.files,resolveApp:e.resolveApp,history:e.history,linkedRecords:e.linkedRecords,subscriptions:e.subscriptions,keptViews:e.keptViews,signIn:e.signIn,menuSections:e.menuSections,app:e.app}}function Le({name:e,heading:n,faces:t,at:r,without:o,home:i,reach:c,standing:s,hostActions:d,keeping:m,onFind:E,switch:S,named:y=!0}){let{brand:h,store:p,principal:g,views:l}=T();$();let b=o?.has("places")?[]:W({store:p,principal:g,views:l}),k=J();return(0,u.jsx)(_,{brand:h,name:e,named:y,description:h?.subtitle,heading:n,faces:t,home:i,places:b,current:r===null?null:j(b,r),reach:c,onFind:E,...S?{switch:S}:{},...t||r===null?{scenePlaces:k}:{},tools:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(X,{clean:s}),(0,u.jsx)(U,{...d?{hostActions:d}:{},...m?{keeping:m}:{}})]})})}var Be=e=>e===!1?2:Math.min(e+1,6);function He(e){let[n,t]=(0,a.useState)(e),r=(0,a.useRef)(void 0),o=(0,a.useRef)(void 0),i=(0,a.useMemo)(()=>({go:r,at:t,pending:o}),[]),c=(0,a.useCallback)(s=>{if(r.current){r.current(s);return}o.current=s,t(s)},[]);return{at:n,setAt:t,steering:i,steer:c}}function ye(e){let n=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof n=="string"&&n.length>0?n:typeof e=="object"?"Error":typeof e}}var L=()=>typeof performance<"u"?performance.now():Date.now();function Ce(e,n){let t=(0,a.useRef)({onError:e,face:n});return t.current={onError:e,face:n},(0,a.useCallback)((r,o)=>t.current.onError?.(ye(r),{module:o.module,face:t.current.face}),[])}function Ve(e,n){let t=(0,a.useRef)(null);t.current===null&&(t.current=L());let r=(0,a.useRef)({onReady:e,face:n});r.current={onReady:e,face:n};let o=(0,a.useRef)(!1);return(0,a.useCallback)(i=>{o.current||(o.current=!0,r.current.onReady?.({ms:Math.max(0,L()-(t.current??L())),face:i}))},[])}var oe=class extends a.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(n,t){console.error(`[graview] ${this.props.module} threw while rendering`,n,t.componentStack),this.props.report(n,{module:this.props.module})}render(){return this.state.failed?(0,u.jsxs)("div",{role:"alert","data-graview-face-error":this.props.module,...this.props.content?{"data-embed-content":""}:{},style:this.props.content?{flex:"1 1 auto",display:"grid",alignContent:"center",justifyItems:"center",gap:8,padding:24,background:"var(--graview-ground)",color:"var(--graview-ink)",fontSize:"0.9375rem"}:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,u.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,u.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{ve as a,we as b,Ee as c,le as d,Re as e,xe as f,ke as g,Ae as h,Fe as i,Le as j,Be as k,He as l,Ce as m,Ve as n,oe as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.WVUJXDXZ.js";import{b as C}from"./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.2RVUDRRY.js";import{na as $,pa as E,qa as b,ra as k}from"./chunk.V5MYKNL7.js";import"./chunk.AJZBJBMO.js";function M(r,l,t){let p=r.getAttribute("data-record")??"",g=r.getAttribute("data-field")??"",e=Number(r.getAttribute("data-index")??"0"),c=[...l?.node?[l.node]:[],...l?.nodes??[]].find(a=>a.id===p);if(!p||!c)return{why:p?`names a record it was not shown ("${p.slice(0,80)}")`:"names no record (data-record)"};let s=g&&Object.hasOwn(c,g)?c[g]:void 0,o=(Array.isArray(s)?s:[s]).filter($),u=Number.isInteger(e)&&e>=0?o[e]:void 0,n=c.label?`"${c.label}"`:"a record";return g?u?(t==="video"?!b(u):!b(u)&&!E(u))?{why:`names "${u.name}" on ${n}, which is not ${t==="video"?"a video":"a picture or a video"}`}:{file:u,on:c}:{why:o.length===0?`names "${g}" on ${n}, which holds no file it was shown`:`names file ${r.getAttribute("data-index")} of "${g}" on ${n}, which holds ${o.length}`}:{why:`names no field of ${n} (data-field)`}}var A=r=>`${r.caption?.trim()||r.name}, ${k(r)}`;function T(r,l,t,p,g){let e=r.createElement("video");e.setAttribute("data-graview-video",""),e.setAttribute("controls",""),e.setAttribute("preload","metadata"),e.setAttribute("playsinline",""),e.setAttribute("aria-label",A(t));let c=t.poster?p(t.poster):void 0;c&&e.setAttribute("poster",c),t.width&&t.height?(e.setAttribute("width",String(t.width)),e.setAttribute("height",String(t.height)),e.style.aspectRatio=`${t.width} / ${t.height}`):e.style.aspectRatio="16 / 9",e.style.cssText+=";display:block;width:100%;height:auto;max-height:80vh;background:#000;border-radius:var(--graview-radius, 8px)";let s=t.captions?p(t.captions):void 0;if(s){let o=r.createElement("track");o.setAttribute("kind","captions"),o.setAttribute("src",s),o.setAttribute("srclang","en"),o.setAttribute("label","Captions"),o.setAttribute("default",""),e.appendChild(o)}return t.duration===void 0&&e.addEventListener("loadedmetadata",()=>Number.isFinite(e.duration)&&e.duration>0&&e.setAttribute("aria-label",A({...t,duration:e.duration}))),e.setAttribute("src",g),l.appendChild(e),e}function N(r,l){let t=r.document,p=new Set,g=n=>{p.has(n)||(p.add(n),l.onProblem?.(n))},e=n=>{let a=l.file?l.file(n):n;if(a!==void 0)try{let h=new r.URL(a,t.baseURI);return h.origin===r.location.origin&&/^https?:$/.test(h.protocol)?a:void 0}catch{return}},c=new WeakMap,s,o=n=>{if(typeof n.close=="function")return n.close();n.removeAttribute("open"),n.dispatchEvent(new r.Event("close"))},u=(n,a)=>g(`The ${n} in the view ${l.view} was not drawn: it ${a}.`);return{refresh(n){let a=l.shown();for(let h of Array.from(n.querySelectorAll("graview-video"))){let d=h.shadowRoot??h.attachShadow({mode:"open"});if(!l.pictures){c.delete(h),d.replaceChildren(),u("video",`asks for no pictures: a view places a record's video where its manifest says "pictures": true`);continue}let f=M(h,a,"video"),i="file"in f?JSON.stringify(f.file):"";if(c.get(h)===i&&d.childNodes.length>0)continue;if(c.set(h,i),d.replaceChildren(),"why"in f){u("video",f.why);continue}let m=e(f.file.href);if(!m){u("video",`names "${f.file.name}", which this host does not say it serves on this page`);continue}let w=t.createElement("style");w.textContent=":host { display: block; min-width: 0; }",d.appendChild(w),T(t,d,f.file,e,m)}},open(n){if(!l.pictures)return u("full-screen viewer",`asks for no pictures: a view opens a record's picture or video full screen where its manifest says "pictures": true`),!1;let a=M(n,l.shown(),"any");if("why"in a)return u("full-screen viewer",a.why),!1;let h=e(a.file.href);if(!h)return u("full-screen viewer",`names "${a.file.name}", which this host does not say it serves on this page`),!1;s&&o(s);let d=a.file,f=d.caption?.trim()||d.name,i=t.createElement("dialog");i.setAttribute("data-graview-lightbox",""),i.setAttribute("aria-label",b(d)?A(d):f),i.style.cssText="padding:0;border:0;border-radius:var(--graview-radius, 8px);max-width:min(96vw, 1600px);max-height:94vh;background:var(--graview-panel, Canvas);color:var(--graview-ink, CanvasText)";let m=t.createElement("figure");if(m.style.cssText="margin:0;display:grid;gap:8px;padding:10px",b(d))T(t,m,d,e,h);else{let v=t.createElement("img");v.setAttribute("src",h),v.setAttribute("alt",f),v.style.cssText="max-width:100%;max-height:80vh;object-fit:contain;display:block;margin:0 auto",m.appendChild(v)}let w=t.createElement("figcaption");w.style.cssText="display:flex;gap:12px;align-items:center;justify-content:space-between";let x=t.createElement("span");x.textContent=b(d)&&d.duration!==void 0?`${f} \xB7 ${C(d.duration)}`:f;let y=t.createElement("button");return y.type="button",y.textContent="Close",y.addEventListener("click",()=>o(i)),w.append(x,y),m.appendChild(w),i.appendChild(m),i.addEventListener("click",v=>v.target===i&&o(i)),i.addEventListener("close",()=>{i.remove(),s===i&&(s=void 0),n.focus?.()}),t.body.appendChild(i),s=i,typeof i.showModal=="function"?i.showModal():i.setAttribute("open",""),y.focus(),!0},dispose(){s&&o(s),s?.remove(),s=void 0}}}export{N as createGuestMedia,M as namedFile};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as O}from"./chunk.OJGHDWI6.js";import{e as C}from"./chunk.2FLPDPEL.js";import{$ as I,G as x,R as M,_ as w,aa as W,c as V,x as B,xa as G}from"./chunk.FOQZADMA.js";import{B as D,Hb as F,Nb as N,pc as _,qc as L,wc as j}from"./chunk.V5MYKNL7.js";import{b as m}from"./chunk.AJZBJBMO.js";function H(t,e){let n=t.graph.getNode(e);if(!n)return[];let i=n.kind,a=t.schema.tryDefinition(i);if(!a)return[];let c=t.seenFor,u=c?j.keptFrom?.(t,c)?.(n):void 0,o=new Map;for(let r of t.allMutations()){let s=r.subject;if(!s||!(s.kinds==="*"||s.kinds.includes(i)))continue;let l=r.input.shape??{};for(let d of N(r,a)){if(u?.(d))continue;let b=d in l,k=[];for(let h of Object.keys(l)){if(h===s.arg||h===d||X(l[h]))continue;let v=F(r.input).find(S=>S.name===h);k.push({name:h,...v?{kinds:v.kinds}:{},...v?{candidates:v.kinds.includes("*")?t.graph.allNodes().map(S=>S.id):v.kinds.flatMap(S=>t.graph.nodesOfKind(S).map(J=>J.id))}:{},shape:C(r.input,h)})}let Q={field:d,mutation:r.name,title:r.title??r.name,shape:b?C(r.input,d):{type:"unknown"},takesValue:b,alternatives:[],open:k,call:h=>({name:r.name,args:b?{[s.arg]:e,[d]:h}:{[s.arg]:e}})};o.set(d,[...o.get(d)??[],Q])}}return[...o.values()].map(r=>{let s=[...r.filter(d=>d.takesValue),...r.filter(d=>!d.takesValue)],[f,...l]=s;return{...f,alternatives:l}})}function X(t){let e=D(t)?.type;return e==="optional"||e==="default"||e==="nullable"}var R=m(x(),1);function be(t){let{store:e,principal:n}=w(),i=W(),a=(0,R.useMemo)(()=>t===null?[]:H(e,t),[e,t,i]),c=(0,R.useCallback)((u,o,r={})=>{let s=u.call(o);e.apply({name:s.name,args:{...s.args,...r}},{author:n})},[e,n]);return{fields:a,commit:c}}var K=m(x(),1);function Qe(){let{brand:t}=w(),e=t?.kit;return(0,K.useMemo)(()=>_(e),[e])}function Je(t,e){let n=L(t,e),i={...n.color!==void 0?{color:n.color}:{},...n.pattern!==void 0?{pattern:n.pattern}:{},...n.width!==void 0?{width:n.width}:{},...n.cap!==void 0?{cap:n.cap}:{},...n.opacity!==void 0?{opacity:n.opacity}:{}};return{connector:n,style:O(e,{[e]:i})}}var $=m(x(),1);var g=m(M(),1);function Z(t){let e=t?.hint;return typeof e=="string"&&e.length>0?e:void 0}function ee(t){if(t instanceof Error&&t.message)return t.message;let e=String(t);return e==="[object Object]"?"The view threw without a message.":e}var U=class extends $.Component{static contextType=G;state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,n){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,e,n.componentStack),this.context?.(e,{module:"@graview/react"})}render(){let{error:e}=this.state;if(!e)return this.props.children;let n=Z(e);return(0,g.jsxs)("div",{role:"alert","data-graview-view-error":this.props.kind,style:{display:"flex",flexDirection:"column",gap:"0.375rem",padding:"var(--graview-pad, 12px)",height:"100%",overflow:"auto",boxSizing:"border-box",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)",font:"var(--graview-font-body, 13px/1.45 system-ui)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,g.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.kind}),(0,g.jsx)("span",{children:ee(e)}),n?(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:n}):null]})}};var y=m(x(),1);var q=m(M(),1),A=(0,y.createContext)([]);function nt({sections:t,children:e}){let n=(0,y.useContext)(A),i=(0,y.useMemo)(()=>[...n,...t.filter(a=>!n.includes(a))],[n,t]);return(0,q.jsx)(A.Provider,{value:i,children:e})}function z(){let t=(0,y.useContext)(A),e=I()?.menuSections;return(0,y.useMemo)(()=>e?[...t,...e.filter(n=>!t.includes(n))]:t,[t,e])}function rt(){let t=z();return(0,y.useCallback)(e=>{for(let n of t)try{n(e)?.prepare?.()}catch{}},[t])}function ot(t){let e=z();if(t===null||e.length===0)return{start:[],end:[]};let n=e.flatMap(i=>{try{let a=i(t);return a&&((a.items?.length??0)>0||a.render)?[a]:[]}catch{return[]}});return{start:n.filter(i=>i.at==="start"),end:n.filter(i=>i.at!=="start")}}var te=m(x(),1);function st(){return w().activity}var P=(t,e)=>t.length*e*.58;var ne=156,re=2,E=ne-18,oe=7.1,ie=16;function ae(t,e){let n=0,i=E;for(let a of t.split(" ")){let c=e(a),u=i+e(" ")+c;if(u<=E)i=u;else{let o=Math.ceil(c/E)||1;n+=o,i=c-(o-1)*E}}return n}var se=16.25,Y=27,ce=(t,e)=>{let n=Math.ceil(t.length*oe/E);return e?Math.max(Y,Math.ceil(Math.max(n,ae(t,e))*se)+6):Math.max(Y,n*ie+6)};function ut(t,e,n){return t.length===0?0:10+t.reduce((i,a)=>i+ce(a,n),0)+(t.length-1)*re}var de=27,ue=8,lt=4,le=64,pt=t=>Math.max(1,Math.min(ue,t)),ft=t=>t*de+le;var p=m(x(),1);function gt(t,{units:e,target:n=0,legibleAt:i=260}){let[a,c]=(0,p.useState)(e);(0,p.useEffect)(()=>{let o=t.current;if(o===null||typeof ResizeObserver>"u")return;let r=new ResizeObserver(([s])=>{let f=s?.contentRect.width??0;f>0&&c(f)});return r.observe(o),()=>r.disconnect()},[t]);let u=a/e;return{scale:u,width:a,touchable:u*n>=24,legible:a>=i}}function xt(t="--graview-font-body",e="sans-serif"){let n=(0,p.useRef)(void 0),i=(0,p.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return e;let a=getComputedStyle(document.documentElement).getPropertyValue(t).trim();return a.length>0?a:e},[t,e]);return(0,p.useMemo)(()=>{n.current===void 0&&(n.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let a=n.current;return a===null?P:(c,u)=>{a.font=`${u}px ${i}`;let o=a.measureText(c).width;return o>0?o:P(c,u)}},[i])}var wt=(0,p.createContext)(void 0);var T=3;function pe(t){let e=V(t),n=e.focusId;if(!n)return null;if(e.within?.view){let[a]=B(n);if(a)return{at:`screen:${a}`,audience:!0}}return{at:n,audience:!1}}var fe=102,me=32;function St(t,e,n){let i=[],a=new Map,c=new Map,u=0;for(let o of t){let r=pe(o.stop),s=r?e(r.at):null;if(!r||!s){o.name&&i.push({kind:"edge",presence:o,point:{x:n-8,y:fe+u++*me}});continue}if(!o.name){let k=c.get(r.at);c.set(r.at,{n:(k?.n??0)+1,box:s});continue}let f=a.get(r.at)??[];if(f.push(o),a.set(r.at,f),f.length>T)continue;let l=s,d=f.length-1,b=r.audience?{x:l.x+l.width*.5+(d-1)*26,y:l.y+Math.min(l.height,24)}:{x:l.x+l.width*.5-26-d*26,y:l.y+l.height-4};i.push({kind:"person",presence:o,point:b,at:r.at,index:d,of:f.length,audience:r.audience})}for(let[o,r]of a){if(r.length<=T)continue;let s=e(o);s&&i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+2*26+18,y:s.y+s.height-4},n:r.length-T})}for(let[o,{n:r,box:s}]of c)i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+40,y:s.y+s.height-4},n:r});for(let o of t)if(o.name){if(o.robot?.at&&o.robot.mode!=="docked"){let r=e(o.robot.at);r&&i.push({kind:"robot",presence:o,point:{x:r.x+r.width/2+22,y:r.y+r.height-4},mode:o.robot.mode})}if(o.over){let r=e(o.over);r&&i.push({kind:"over",presence:o,box:r})}}return i}export{st as a,P as b,ne as c,re as d,Y as e,ut as f,de as g,lt as h,le as i,pt as j,ft as k,gt as l,xt as m,be as n,Qe as o,Je as p,St as q,U as r,nt as s,rt as t,ot as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as y}from"./chunk.ZJMDLRC5.js";import{m as g}from"./chunk.LLEFYJPJ.js";import{G as R,R as c,ua as m}from"./chunk.FOQZADMA.js";import{a as f}from"./chunk.SDO3U72B.js";import{ka as p}from"./chunk.V5MYKNL7.js";import{b as u}from"./chunk.AJZBJBMO.js";var o=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>(__graviewPreload(import.meta.url,["./chunk.BXT6FDT4.js","./chunk.WVDKYUF3.js","./chunk.ZHLQWMV5.js","./chunk.TNESS3LQ.js","./chunk.V5MYKNL7.js","./chunk.AJZBJBMO.js"]),import("./chunk.OW7NSJ4H.js"))));function L(e){let[n,t]=(0,o.useState)(()=>h().current);return(0,o.useEffect)(()=>{if(!e||n)return;let i=!0;return h().load().then(a=>i&&t(a),()=>{}),()=>{i=!1}},[e,n]),n}function D(e,n){let t=L(n.length>0);return(0,o.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,o.useMemo)(()=>{let i=new Map;if(!t)return i;for(let a of n){let l=t.ruleLine(a,e);l&&i.set(a.name,l)}return i},[t,e,n])}function M(e){let n=e.line;if(!(!n||e.message.endsWith(` \u2014 ${n.text}`)||e.message===b(e)))return e.message}function b(e){let n=e.line;return n?n.record!==void 0?`${n.record} \u2014 ${n.text}`:n.text:e.message}var P={name:{},op:{color:"var(--graview-ink-muted)",fontWeight:500},value:{fontWeight:600,fontVariantNumeric:"tabular-nums"},word:{color:"var(--graview-ink-muted)"},open:{color:"var(--graview-ink-faint)"},close:{color:"var(--graview-ink-faint)"}};function w({parts:e}){return(0,r.jsx)(r.Fragment,{children:e.map((n,t)=>(0,r.jsxs)("span",{children:[n.space?" ":"",(0,r.jsx)("span",{"data-graview-rule-part":n.as,style:P[n.as],children:n.text})]},t))})}function x(e,n){let t=p(e?.tryDefinition(n),n);return t.charAt(0).toUpperCase()+t.slice(1)}function C({line:e,schema:n,brand:t,lead:i=e.record===void 0?"kind":"record",stacked:a=!1,style:l}){let d=e.kind,s=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&s?`${s}: ${e.said}`:i==="record"&&s?`${s} \u2014 ${e.said}`:e.said;return(0,r.jsxs)("span",{"data-graview-rule-line":"",style:{overflowWrap:"anywhere",...l},children:[(0,r.jsx)("span",{style:g,children:k}),(0,r.jsxs)("span",{"aria-hidden":"true",children:[i!=="none"&&d?(0,r.jsx)("span",{style:{display:"inline-flex",verticalAlign:"-0.1em",marginRight:"0.4em"},children:(0,r.jsx)(y,{kind:d,...n?{schema:n}:{},...t?{brand:t}:{},size:13})}):null,s?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[s,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&s?(0,r.jsx)("br",{}):null,(0,r.jsx)(w,{parts:e.parts}),e.when&&e.when.length>0?(0,r.jsxs)("span",{"data-graview-rule-when":"",style:{color:"var(--graview-ink-faint)"},children:[", when ",(0,r.jsx)(w,{parts:e.when})]}):null]})]})}function z(e){return e.line?e.label&&e.label.trim().length>0?e.label:void 0:e.label&&e.label!==e.message&&!e.message.startsWith(e.label)?e.label:void 0}export{D as a,I as b,M as c,C as d,z as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Aa as k,R as w,j as c,l as h,m as b,r as f,ya as y}from"./chunk.FOQZADMA.js";import{T as i}from"./chunk.V5MYKNL7.js";import{b as g}from"./chunk.AJZBJBMO.js";var s=null,a=new Set,v=e=>{s={kind:e,n:(s?.n??0)+1};for(let t of a)t()},A=()=>s,C=e=>(a.add(e),()=>a.delete(e)),V=()=>{s=null};var d=g(w(),1);function T(e,t){if(e.length===0||t.length===0)return[];let o=new Set(t.map(n=>n.id));return e.filter(n=>n.nodeIds.some(l=>o.has(l)))}var x=(e,t)=>`${i(e)} ${e===1?"problem":"problems"} in ${t}`;function q({kind:e,plural:t,problems:o,flag:n,listed:l=!1}){let{view:p,go:P}=k(),{set:$}=y();if(o.length===0)return null;let u=x(o.length,t),m=o.length===1?"it":"them";return(0,d.jsx)("button",{type:"button",className:"graview-district-problems","data-testid":`district-problems-${e}`,"data-graview-problems":o.length,"aria-expanded":l,"aria-label":u,title:`${u} \u2014 ${o[0].message}${o.length>1?` (and ${i(o.length-1)} more)`:""}. Press to see ${m} and how to fix ${m}.`,onClick:r=>{r.stopPropagation(),p.overview||P(h(c(b(p,!0),null),"view",null)),$([f(e)]),v(e)},onDoubleClick:r=>r.stopPropagation(),onPointerDown:r=>r.stopPropagation(),children:(0,d.jsx)("span",{"aria-hidden":"true",children:`${n} ${i(o.length)}`})})}export{A as a,C as b,V as c,T as d,x as e,q as f};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./chunk.
|
|
1
|
+
import"./chunk.LLEFYJPJ.js";import{R as o,_ as n}from"./chunk.FOQZADMA.js";import"./chunk.SDO3U72B.js";import"./chunk.V5MYKNL7.js";import{b as t}from"./chunk.AJZBJBMO.js";var a=t(o(),1),d=[["waiting","Waiting"],["active","Under way: darker and taller"],["done","Done: flat and pale"],["flagged","A problem, or past its due date"],["recent","Changed since you were last here"],["own","Yours"]],g=i=>{let e=r=>`color-mix(in oklab,var(--graview-ink) ${r}%,var(--graview-panel))`;return`.graview-map-key{display:grid;gap:4px;padding:2px 4px 8px;margin-bottom:6px;border-bottom:1px solid var(--graview-edge);font-size:.8125rem;color:var(--graview-ink-muted)}
|
|
2
2
|
.graview-map-key>div{display:flex;align-items:center;gap:8px}
|
|
3
3
|
.graview-map-key>div:first-child{color:var(--graview-ink)}
|
|
4
4
|
.graview-map-key i{flex:none;width:14px;height:10px;border-radius:2px;background:${e(i?34:42)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as a}from"./chunk.
|
|
1
|
+
import{e as a}from"./chunk.NGDXH66B.js";import{l as i}from"./chunk.FOQZADMA.js";import{$c as o}from"./chunk.V5MYKNL7.js";function p(t){let r=t.within??{};return o({...r.sort?{sort:r.sort}:{},...r.filter?{filter:r.filter}:{},...r.group?{group:r.group}:{},...r.q?{q:r.q}:{},...r.archived?{archived:r.archived}:{}})}function c(t,r){let m=a(r),e=t;for(let n of["sort","filter","group","q","archived"])e=i(e,n,m[n]??null);return e}export{p as a,c as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as ae}from"./chunk.MWZK3HVG.js";import{b as Ce,d as $e}from"./chunk.3D5T3XIE.js";import{e as Te}from"./chunk.GR5Q4HTW.js";import{H as ke,Oc as Re,Qc as De,Sc as We,Ta as Se,Tb as ie,Tc as Me,Va as G,Z as M,_ as xe,aa as _,ba as z,ca as Ae,da as W,fa as we,ga as Ne,kd as je,sc as oe,wc as ve,xc as Oe}from"./chunk.WLPTY4BF.js";function se(n,e){return n.display?.labels?.[e]??W(e)}function de(n){let e=ae(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Je(n,e){let t=new Map,o=n.tryDefinition(e);for(let[r,a]of Object.entries(o?.edges??{}))t.set(r,{key:r,label:a.description?M(a.description):W(r),about:"edge",far:a.to==="*"?[...n.kinds]:[...a.to]});for(let r of n.definitions)if(r.kind!==e)for(let[a,d]of Object.entries(r.edges??{}))t.has(a)||d.to!=="*"&&!d.to.includes(e)||t.set(a,{key:a,label:d.inverse?M(d.inverse):W(a),about:"edge",far:[r.kind]});return[...t.values()]}var Ze=["current","past","any","flagged","clear"];function Fe(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let o=t.retired.map(String);return e.some(r=>r.key===t.field&&o.includes(r.value))}function Be(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let o=new Set(t.display?.hide??[]),r=t.fields.shape??{},a=[{key:"label",label:"Name",about:"label",type:"text"}],d=[],f=[];for(let[y,x]of Object.entries(r)){if(y==="id"||y==="kind"||y==="label"||o.has(y))continue;let p=de(x);if(!p)continue;let O=se(t,y),w=p==="choice"?Le(x):p==="boolean"?["true","false"]:void 0,N={key:y,label:O,about:"field",type:p,...w?{options:w}:{}};a.push(N),d.push(N),(p==="boolean"||p==="choice")&&f.push(N),p==="date"&&f.push({...N,buckets:["day","week","month","year","decade"]})}for(let y of Je(n,e))a.push(y),d.push(y),f.push(y);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Ze]:["flagged","clear"]};d.push(l);let u=t.fieldRoles?.order,g=u&&(u in r||u==="label")?{by:u,direction:"asc"}:void 0;return{kind:e,sorts:a,filters:d,groups:f,...g?{natural:g}:{}}}function vn(n,e){let t=[];for(let r of e.filters){let a=r.about==="edge"&&r.far?.length===1?n.tryDefinition(r.far[0]):void 0;if(!(!a||a.kind===e.kind))for(let[d,f]of Object.entries(a.fields.shape??{}))de(f)!=="choice"||a.display?.hide?.includes(d)||t.push({key:`${r.key}.${d}`,label:`${r.label} \xB7 ${se(a,d)}`,about:"via",type:"choice",options:Le(f),far:[a.kind]})}if(t.length===0)return e;let o=e.filters.filter(r=>r.about!=="is");return{...e,filters:[...o,...t,...e.filters.filter(r=>r.about==="is")]}}function On(n,e){let t=n.tryDefinition(e.kind),o=Object.entries(t?.computed??{});if(!t||o.length===0)return e;let r=o.filter(([a])=>!e.sorts.some(d=>d.key===a)).map(([a,d])=>({key:a,label:(typeof d=="object"?d.label:void 0)??se(t,a),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...r]}}function Le(n){let e=ae(n);return e.type==="choice"?e.options:[]}var Ie=n=>n,Pe=n=>n;function en(n,e,t){let o=new Map;for(let r of[...n.out(e,t),...n.in(e,t)])o.set(r.id,r);return[...o.values()]}function le(n,e,t){let o=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return _(o,Pe(e),n.today);case"past":return!_(o,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let r=o?.fields.shape??{};if(t.key in r){let l=Se(Ie(e),t.key,n.today??ke()),u=de(r[t.key]);if(u==="date"){let[g,y]=t.value.split(":");if(typeof l!="string"||!y)return!1;let x=l.slice(0,10);return g==="before"?x<y:g==="after"?x>y:x===y}if(u==="boolean")return String(l)===t.value;if(u==="number"){let g=t.value.lastIndexOf(":"),y=g>0?t.value.slice(0,g):"",x=Number(t.value.slice(g+1));if(y==="at-most"||y==="at-least")return typeof l!="number"||!Number.isFinite(x)?!1:y==="at-most"?l<=x:l>=x}return String(l)===t.value}let[a,d]=t.key.split("."),f=en(n.graph,e.id,a);return d?f.some(l=>String(Ie(l)[d])===t.value):t.value==="*"?f.length>0:t.value==="none"?f.length===0:f.some(l=>l.id===t.value)}var nn=5;function ze(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function ce(n){return ze(n).replace(/ /g,"")}var U=new Map,tn=5e4;function $(n){let e=U.get(n);if(e===void 0){U.size>=tn&&U.clear();let t=ze(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},U.set(n,e)}return e}var T=n=>[...$(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:o}=$(n),r=e.join("");if(t.length===0)return;if(t===r)return"exact";if(e.every(d=>o.some(f=>f.startsWith(d))))return t.startsWith(r)?"prefix":e.every(d=>o.includes(d))?"word":"part"}function q(n,e,t=48){let o=n.replace(/\s+/g," ").trim();if(o.length<=t)return o;let r=e[0],a=o.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),d=r?a.search(new RegExp(`(^|[^\\p{L}\\p{N}])${rn(r)}`,"u")):-1,f=d<0?0:d+(a[d]&&/[\p{L}\p{N}]/u.test(a[d])?0:1),l=Math.max(0,f-Math.floor(t/3));if(l>0){let g=o.lastIndexOf(" ",l);l=g<0?0:g+1}let u=Math.min(o.length,l+t);if(u<o.length){let g=o.indexOf(" ",u);u=g<0||g-u>16?u:g}return`${l>0?"\u2026":""}${o.slice(l,u).trim()}${u<o.length?"\u2026":""}`}var rn=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),on=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function an(n){let e=[],t=[];for(let o of n.trim().split(/\s+/).filter(Boolean)){let r=on.exec(o);r?t.push({key:r[1],value:r[2]}):e.push(o)}return{words:e.join(" "),conditions:t}}var Ee=new WeakMap;function Q(n,e){let t=Ee.get(e);if(t&&t.definition===n)return t.texts;let o=sn(n,e);return Ee.set(e,{definition:n,texts:o}),o}function sn(n,e){let t=z(n,e),o=[{field:"label",reading:"Name",text:t}];for(let r of $e(e,n,{limit:Number.POSITIVE_INFINITY}))r.key==="label"||r.value===t||typeof e[r.key]!="boolean"&&o.push({field:r.key,reading:r.label,text:r.markdown?Te(r.value):r.value});return o}var I={exact:0,prefix:1,word:2,part:3,field:4,near:5},Ge=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ke(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function He(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let o=[],r=Array.from({length:e.length+1},(a,d)=>d);for(let a=1;a<=n.length;a++){let d=[a],f=a;for(let l=1;l<=e.length;l++){let u=Math.min(r[l]+1,d[l-1]+1,r[l-1]+(n[a-1]===e[l-1]?0:1));a>1&&l>1&&n[a-1]===e[l-2]&&n[a-2]===e[l-1]&&(u=Math.min(u,o[l-2]+1)),d[l]=u,u<f&&(f=u)}if(f>t)return t+1;o=r,r=d}return r[e.length]}var V=new Map;function dn(n,e){let t=V.get(n);t||(V.size>=64&&V.clear(),V.set(n,t=new Map));let o=t.get(e);return o===void 0&&(o=ln(n,e)??null,t.set(e,o)),o??void 0}function ln(n,e){if(/\d/.test(n))return;let t=Ke(n);if(t.length>=3&&(Ke(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let o=n.length<4?0:n.length<=7?1:2;if(o!==0){if(He(n,e,o)<=o)return"spelling";if(n.length>=5){for(let r=n.length-o;r<=n.length+o;r++)if(r<e.length&&He(n,e.slice(0,r),o)<=o)return"spelling"}}}function cn(n,e){let t=e.length>1?e.filter(r=>!Ge.has(r)):e;if(t.length===0)return;let o;for(let r of t){let a;for(let d of n){for(let f of $(d.text).tokens){if(f.startsWith(r)){a={text:d,matched:f};break}let l=a?void 0:dn(r,f);l&&(a={text:d,matched:f,by:l})}if(a&&!a.by)break}if(!a)return;a.by&&!o&&(o={text:a.text,asked:r,matched:a.matched,by:a.by})}if(o)return{field:o.text.field,reading:o.text.reading,fragment:q(o.text.text,[o.matched]),strength:"near",asked:o.asked,matched:o.matched,by:o.by}}var fn=80;function gn(n,e,t){let o=T(e).filter(d=>!Ge.has(d)).join(" ")||e,r=t===void 0?[]:T(t),a=r.length>0&&n.find(d=>r.every(f=>$(d.text).tokens.some(l=>l.startsWith(f))))||n[0];return{field:a.field,reading:a.reading,fragment:q(a.text,r),strength:"near",asked:o,matched:(t??a.text).slice(0,fn),by:"meaning"}}function _e(n,e,t,o){let r=T(t);if(r.length===0)return;if(o){let p=Q(n,e),O=o.includes("label")||o.some(v=>typeof e[v]=="string"&&e[v]===p[0].text),w=p.filter((v,D)=>D===0?O:o.includes(v.field)),N=v=>D=>$(D.text).tokens.some(P=>P.startsWith(v));if(!r.every(v=>w.some(N(v))))return;let S=w.find(N(r[0]));return{field:S.field,reading:S.reading,fragment:q(S.text,r),strength:S.field==="label"?j(S.text,r)??"field":"field"}}let a=Q(n,e),[d,...f]=a,l=j(d.text,r);if(l)return{field:"label",reading:d.reading,fragment:q(d.text,r),strength:l};let u=p=>O=>$(O.text).tokens.some(w=>w.startsWith(p));if(!r.every(p=>a.some(u(p))))return;let g=T(d.text),y=r.find(p=>!g.some(O=>O.startsWith(p)))??r[0],x=f.find(u(y));return{field:x.field,reading:x.reading,fragment:q(x.text,[y]),strength:"field"}}var un=512,yn=64;function hn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-un),o=n[n.length-1].seq;for(let r of t){let a=Math.pow(.5,(o-r.seq)/yn);for(let d of r.writes)e.set(d,(e.get(d)??0)+a)}return e}var ge=(n,e)=>we({tryDefinition:()=>n},e),fe=(n,e)=>De({tryDefinition:()=>n},e);function pn(n,e,t){let o=n.tryDefinition(e),r=[{field:"plural",text:ge(o,e)},{field:"kind",text:W(e)},...o?.noun?[{field:"noun",text:o.noun}]:[]],a;for(let d of r){let f=j(d.text,t);f&&(!a||I[f]<I[a.strength])&&(a={strength:f,...d})}return a}var mn,bn=(n,e)=>(mn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),qe=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||bn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function Ln(n,e,t={}){let o=n.schema,r=an(e),a=T(r.words),d=t.principal??{kind:"human"},f=n.kindsKeptFrom(d),l=n.modules.disabledKinds,u=r.conditions.filter(i=>i.key==="kind").map(i=>i.value),g=r.conditions.filter(i=>i.key==="is").map(i=>i.value),y=g.includes("any")||g.includes("past"),x=g.includes("past")&&!g.includes("any")&&!g.includes("current"),p=g.includes("archived")?!0:t.archived??"all",O=(i,s)=>{let c=ce(s),h=o.tryDefinition(i);return ce(i)===c||ce(ge(h,i))===c},w=o.kinds.filter(i=>!f.has(i)&&!l.has(i)&&(t.kinds===void 0||t.kinds.includes(i))&&(u.length===0||u.some(s=>O(i,s)))),S=r.conditions.filter(i=>i.key!=="kind").map(i=>({...i,admittedBy:w.filter(s=>Be(o,s).filters.some(c=>c.key===i.key))})),v=S.filter(i=>i.key!=="is"),D=g.filter(i=>i==="flagged"||i==="clear"||i==="past"||i==="archived"),P={kinds:w,past:y},Qe={hits:[],words:r.words,conditions:S,searched:P,byKind:{},total:0,matched:[]};if(a.length===0&&v.length===0&&D.length===0)return Qe;let X=t.today,F=t.flagged??new Set(n.violations().flatMap(i=>i.nodeIds)),Ue=t.touched??hn(n.log.all()),Y=new Set;for(let i of t.from??[]){Y.add(i);for(let s of n.graph.neighbors(i))Y.add(s.id)}let ue=ve(n,d)?Oe(n,d):void 0,J=oe.keptFrom?.(n,d)&&n.seenBy(d).graph,Z=i=>je(i,t.basePath===void 0?{}:{basePath:t.basePath}),ye={schema:o,graph:n.graph,flagged:F,...X?{today:X}:{}},R=[],B={},L=[],E=[],K=(i,s,c,h,m,b)=>{let A=z(c,i);B[s]=(B[s]??0)+1,R.push({hit:{about:"node",id:i.id,kind:s,label:A,why:m,current:h,flagged:F.has(i.id),address:Z(`${fe(c,s)}/${encodeURIComponent(i.id)}`),...b===void 0?{}:{near:!0},...G(i)?{archived:!0}:{}},...b===void 0?{}:{nearly:2-b},tier:I[m.strength],inKind:s===t.inKind?0:1,near:Y.has(i.id)?0:1,past:h?0:1,archived:G(i)?1:0,touched:-(Ue.get(i.id)??0),flagged:F.has(i.id)?0:1,name:A,id:i.id})};for(let i of w){let s=o.tryDefinition(i),c=S.filter(m=>m.key!=="is"&&m.admittedBy.includes(i));if(a.length===0&&c.length===0&&D.length===0)continue;let h=Fe(s,c);for(let m of n.graph.nodesOfKind(i,{archived:p})){if(ue&&!ue(m.id))continue;let b=J?J.getNode(m.id):m;if(!b)continue;let A=_(s,b,X);if(!y&&!h&&!A){if(a.length>0&&g.length===0&&c.every(k=>le(ye,b,k))){let k=_e(s,b,r.words);k&&E.push({node:b,kind:i,definition:s,why:k})}continue}if(x&&A||!c.every(k=>le(ye,b,k))||g.includes("flagged")&&!F.has(b.id)||g.includes("clear")&&F.has(b.id))continue;let C=a.length>0?_e(s,b,r.words):c[0]?{field:c[0].key,reading:W(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${D[0]}`,strength:"field"};C?K(b,i,s,A,C):a.length>0&&L.push({node:b,kind:i,definition:s,current:A})}}let ee=i=>i.strength!=="field",ne=!1;if(E.length>0&&R.length===0){ne=!0;for(let i of E)K(i.node,i.kind,i.definition,!1,i.why)}else if(E.some(i=>ee(i.why))&&!R.some(i=>ee(i.hit.why))){ne=!0;for(let i of E)ee(i.why)&&K(i.node,i.kind,i.definition,!1,i.why)}let he=t.near!==!1&&a.length>0&&R.length<nn&&L.length>0,te=new Set;if(he)for(let i of L){let s=cn(Q(i.definition,i.node),a);s&&(te.add(i.node.id),K(i.node,i.kind,i.definition,i.current,s,s.by==="stem"?.9:.8))}let Ve=i=>i==="exact"||i==="prefix"?-1:I[i],re=(i,s,c,h)=>({hit:i,tier:Ve(s),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(a.length>0){for(let s of w){let c=pn(o,s,a);if(!c)continue;let h=Ne(o,s),m={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};R.push(re({about:"kind",kind:s,label:h,why:m,count:B[s]??0,address:Z(fe(o.tryDefinition(s),s))},c.strength,h,`kind:${s}`))}let i=t.places??[];for(let s of Re(i.filter(c=>w.includes(c.kind)))){if(s.across&&f.has(s.across))continue;let c=j(s.title,a);if(!c)continue;let h={field:"title",reading:"Title",fragment:s.title,strength:c},m=Me(s,i)?fe(o.tryDefinition(s.kind),s.kind).slice(1):void 0,b=Z(We(s.as,m));R.push(re({about:"place",kind:s.kind,title:s.title,as:s.as,why:h,address:b},c,s.title,`place:${s.kind}:${s.as}`))}for(let s of n.allInvariants()){let c=s.scope==="graph"?void 0:s.scope.kind;if(c&&!w.includes(c))continue;let h=s.label??W(s.name),m=j(h,a),b=m?void 0:j(W(s.name),a),A=m??b;if(!A)continue;let C={field:m?"label":"name",reading:m?"Rule":"Name",fragment:m?h:s.name,strength:A};R.push(re({about:"rule",name:s.name,label:h,...c?{kind:c}:{},why:C},A,h,`rule:${s.name}`))}}let pe=()=>{R.sort(qe);let i=t.limit??50,s=R.slice(0,i).map(k=>k.hit),c=s.flatMap(k=>k.about==="node"?[(J||n.graph).getNode(k.id)]:[]).filter(Boolean),h=Ce(c,k=>o.tryDefinition(k)),m=s.map(k=>k.about==="node"&&h.has(k.id)?{...k,apart:h.get(k.id)}:k),b=Object.values(B).reduce((k,Ye)=>k+Ye,0),A=R.flatMap(k=>k.hit.about==="node"?[k.hit.id]:[]),C=t.subject&&w.includes(String(n.graph.getNode(t.subject)?.kind))?kn(n,t.subject,r.words,{principal:d}):[];return{hits:[...m,...C],words:r.words,conditions:S,searched:ne?{...P,past:!0}:P,byKind:{...B},total:b,matched:A}},H=pe(),me=t.rank;if(!he||!me)return H;let be=L.filter(i=>!te.has(i.node.id)).map(({node:i,kind:s,definition:c})=>({id:i.id,kind:s,label:z(c,i),texts:Q(c,i)}));if(be.length===0)return H;let Xe=(async()=>{let i;try{i=await me(r.words,be)}catch{return H}let s=new Map(L.filter(h=>!te.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:m,matched:b}of Array.isArray(i)?i:[]){let A=s.get(h);!A||!(m>0)||(s.delete(h),c=!0,K(A.node,A.kind,A.definition,A.current,gn(Q(A.definition,A.node),r.words,typeof b=="string"?b:void 0),Math.min(1,m)))}return c?pe():H})();return{...H,later:Xe}}function kn(n,e,t,o={}){let r=o.principal??{kind:"human"},a=(oe.keptFrom?.(n,r)?n.seenBy(r):n).graph.getNode(e);if(!a)return[];if(n.kindsKeptFrom(r).has(a.kind))return[];let d=T(t),f=z(n.schema.tryDefinition(a.kind),a),l=[];for(let g of n.allMutations()){let y=g.subject;if(!y||y.kinds!=="*"&&!y.kinds.includes(a.kind))continue;let x=g.derived?.act;if((x==="archive"||x==="merge")&&G(a)||x==="unarchive"&&!G(a)||x==="leave-alone"&&ie(a)||x==="allow-tidying"&&!ie(a)||!n.permits({name:g.name,args:{[y.arg]:a.id}},r).ok)continue;let p=Ae(g),O=T(p),w=d.filter(v=>O.some(D=>D.startsWith(v))),N=w.length>0?j(p,w):void 0,S=N?{field:"title",reading:"Act",fragment:p,strength:N}:{field:"subject",reading:"On",fragment:f,strength:"field"};l.push({hit:{about:"act",name:g.name,title:p,subject:a.id,why:S,destructive:g.destructive===!0},tier:N?I[N]:I.field+1,inKind:0,near:0,past:g.destructive?1:0,touched:0,flagged:g.pinned?0:1,name:p,id:`act:${g.name}`})}l.sort(qe);let u=l.map(g=>g.hit);return o.limit===void 0?u:u.slice(0,o.limit)}function En(n,e){let t=e.kinds.map((a,d)=>{let f=ge(n.tryDefinition(a),a);return d===0?f:f.toLowerCase()}),o=xe(t)||"Nothing";return e.kinds.some(a=>n.tryDefinition(a)?.lifecycle)?e.past?`${M(o)}, past ones included.`:`${M(o)}, current ones; add is:any for past ones.`:`${M(o)}.`}export{se as a,de as b,Je as c,Fe as d,Be as e,vn as f,On as g,Le as h,Ie as i,Pe as j,en as k,le as l,ce as m,an as n,_e as o,hn as p,Ln as q,kn as r,En as s};
|
|
1
|
+
import{d as ae}from"./chunk.2FLPDPEL.js";import{b as Ce,d as $e}from"./chunk.UUBYFBPN.js";import{e as Te}from"./chunk.2RVUDRRY.js";import{Ac as ve,Bc as Oe,H as ke,Tc as Re,Ua as Se,Vc as De,Wa as G,Xb as ie,Xc as We,Yc as Me,Z as M,_ as xe,aa as _,ba as z,ca as Ae,da as W,fa as we,ga as Ne,pd as je,wc as oe}from"./chunk.V5MYKNL7.js";function se(n,e){return n.display?.labels?.[e]??W(e)}function de(n){let e=ae(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Je(n,e){let t=new Map,o=n.tryDefinition(e);for(let[r,a]of Object.entries(o?.edges??{}))t.set(r,{key:r,label:a.description?M(a.description):W(r),about:"edge",far:a.to==="*"?[...n.kinds]:[...a.to]});for(let r of n.definitions)if(r.kind!==e)for(let[a,d]of Object.entries(r.edges??{}))t.has(a)||d.to!=="*"&&!d.to.includes(e)||t.set(a,{key:a,label:d.inverse?M(d.inverse):W(a),about:"edge",far:[r.kind]});return[...t.values()]}var Ze=["current","past","any","flagged","clear"];function Fe(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let o=t.retired.map(String);return e.some(r=>r.key===t.field&&o.includes(r.value))}function Be(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let o=new Set(t.display?.hide??[]),r=t.fields.shape??{},a=[{key:"label",label:"Name",about:"label",type:"text"}],d=[],f=[];for(let[y,x]of Object.entries(r)){if(y==="id"||y==="kind"||y==="label"||o.has(y))continue;let p=de(x);if(!p)continue;let O=se(t,y),w=p==="choice"?Le(x):p==="boolean"?["true","false"]:void 0,N={key:y,label:O,about:"field",type:p,...w?{options:w}:{}};a.push(N),d.push(N),(p==="boolean"||p==="choice")&&f.push(N),p==="date"&&f.push({...N,buckets:["day","week","month","year","decade"]})}for(let y of Je(n,e))a.push(y),d.push(y),f.push(y);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Ze]:["flagged","clear"]};d.push(l);let u=t.fieldRoles?.order,g=u&&(u in r||u==="label")?{by:u,direction:"asc"}:void 0;return{kind:e,sorts:a,filters:d,groups:f,...g?{natural:g}:{}}}function vn(n,e){let t=[];for(let r of e.filters){let a=r.about==="edge"&&r.far?.length===1?n.tryDefinition(r.far[0]):void 0;if(!(!a||a.kind===e.kind))for(let[d,f]of Object.entries(a.fields.shape??{}))de(f)!=="choice"||a.display?.hide?.includes(d)||t.push({key:`${r.key}.${d}`,label:`${r.label} \xB7 ${se(a,d)}`,about:"via",type:"choice",options:Le(f),far:[a.kind]})}if(t.length===0)return e;let o=e.filters.filter(r=>r.about!=="is");return{...e,filters:[...o,...t,...e.filters.filter(r=>r.about==="is")]}}function On(n,e){let t=n.tryDefinition(e.kind),o=Object.entries(t?.computed??{});if(!t||o.length===0)return e;let r=o.filter(([a])=>!e.sorts.some(d=>d.key===a)).map(([a,d])=>({key:a,label:(typeof d=="object"?d.label:void 0)??se(t,a),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...r]}}function Le(n){let e=ae(n);return e.type==="choice"?e.options:[]}var Ie=n=>n,Pe=n=>n;function en(n,e,t){let o=new Map;for(let r of[...n.out(e,t),...n.in(e,t)])o.set(r.id,r);return[...o.values()]}function le(n,e,t){let o=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return _(o,Pe(e),n.today);case"past":return!_(o,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let r=o?.fields.shape??{};if(t.key in r){let l=Se(Ie(e),t.key,n.today??ke()),u=de(r[t.key]);if(u==="date"){let[g,y]=t.value.split(":");if(typeof l!="string"||!y)return!1;let x=l.slice(0,10);return g==="before"?x<y:g==="after"?x>y:x===y}if(u==="boolean")return String(l)===t.value;if(u==="number"){let g=t.value.lastIndexOf(":"),y=g>0?t.value.slice(0,g):"",x=Number(t.value.slice(g+1));if(y==="at-most"||y==="at-least")return typeof l!="number"||!Number.isFinite(x)?!1:y==="at-most"?l<=x:l>=x}return String(l)===t.value}let[a,d]=t.key.split("."),f=en(n.graph,e.id,a);return d?f.some(l=>String(Ie(l)[d])===t.value):t.value==="*"?f.length>0:t.value==="none"?f.length===0:f.some(l=>l.id===t.value)}var nn=5;function ze(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function ce(n){return ze(n).replace(/ /g,"")}var U=new Map,tn=5e4;function $(n){let e=U.get(n);if(e===void 0){U.size>=tn&&U.clear();let t=ze(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},U.set(n,e)}return e}var T=n=>[...$(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:o}=$(n),r=e.join("");if(t.length===0)return;if(t===r)return"exact";if(e.every(d=>o.some(f=>f.startsWith(d))))return t.startsWith(r)?"prefix":e.every(d=>o.includes(d))?"word":"part"}function q(n,e,t=48){let o=n.replace(/\s+/g," ").trim();if(o.length<=t)return o;let r=e[0],a=o.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),d=r?a.search(new RegExp(`(^|[^\\p{L}\\p{N}])${rn(r)}`,"u")):-1,f=d<0?0:d+(a[d]&&/[\p{L}\p{N}]/u.test(a[d])?0:1),l=Math.max(0,f-Math.floor(t/3));if(l>0){let g=o.lastIndexOf(" ",l);l=g<0?0:g+1}let u=Math.min(o.length,l+t);if(u<o.length){let g=o.indexOf(" ",u);u=g<0||g-u>16?u:g}return`${l>0?"\u2026":""}${o.slice(l,u).trim()}${u<o.length?"\u2026":""}`}var rn=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),on=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function an(n){let e=[],t=[];for(let o of n.trim().split(/\s+/).filter(Boolean)){let r=on.exec(o);r?t.push({key:r[1],value:r[2]}):e.push(o)}return{words:e.join(" "),conditions:t}}var Ee=new WeakMap;function Q(n,e){let t=Ee.get(e);if(t&&t.definition===n)return t.texts;let o=sn(n,e);return Ee.set(e,{definition:n,texts:o}),o}function sn(n,e){let t=z(n,e),o=[{field:"label",reading:"Name",text:t}];for(let r of $e(e,n,{limit:Number.POSITIVE_INFINITY}))r.key==="label"||r.value===t||typeof e[r.key]!="boolean"&&o.push({field:r.key,reading:r.label,text:r.markdown?Te(r.value):r.value});return o}var I={exact:0,prefix:1,word:2,part:3,field:4,near:5},Ge=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ke(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function He(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let o=[],r=Array.from({length:e.length+1},(a,d)=>d);for(let a=1;a<=n.length;a++){let d=[a],f=a;for(let l=1;l<=e.length;l++){let u=Math.min(r[l]+1,d[l-1]+1,r[l-1]+(n[a-1]===e[l-1]?0:1));a>1&&l>1&&n[a-1]===e[l-2]&&n[a-2]===e[l-1]&&(u=Math.min(u,o[l-2]+1)),d[l]=u,u<f&&(f=u)}if(f>t)return t+1;o=r,r=d}return r[e.length]}var V=new Map;function dn(n,e){let t=V.get(n);t||(V.size>=64&&V.clear(),V.set(n,t=new Map));let o=t.get(e);return o===void 0&&(o=ln(n,e)??null,t.set(e,o)),o??void 0}function ln(n,e){if(/\d/.test(n))return;let t=Ke(n);if(t.length>=3&&(Ke(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let o=n.length<4?0:n.length<=7?1:2;if(o!==0){if(He(n,e,o)<=o)return"spelling";if(n.length>=5){for(let r=n.length-o;r<=n.length+o;r++)if(r<e.length&&He(n,e.slice(0,r),o)<=o)return"spelling"}}}function cn(n,e){let t=e.length>1?e.filter(r=>!Ge.has(r)):e;if(t.length===0)return;let o;for(let r of t){let a;for(let d of n){for(let f of $(d.text).tokens){if(f.startsWith(r)){a={text:d,matched:f};break}let l=a?void 0:dn(r,f);l&&(a={text:d,matched:f,by:l})}if(a&&!a.by)break}if(!a)return;a.by&&!o&&(o={text:a.text,asked:r,matched:a.matched,by:a.by})}if(o)return{field:o.text.field,reading:o.text.reading,fragment:q(o.text.text,[o.matched]),strength:"near",asked:o.asked,matched:o.matched,by:o.by}}var fn=80;function gn(n,e,t){let o=T(e).filter(d=>!Ge.has(d)).join(" ")||e,r=t===void 0?[]:T(t),a=r.length>0&&n.find(d=>r.every(f=>$(d.text).tokens.some(l=>l.startsWith(f))))||n[0];return{field:a.field,reading:a.reading,fragment:q(a.text,r),strength:"near",asked:o,matched:(t??a.text).slice(0,fn),by:"meaning"}}function _e(n,e,t,o){let r=T(t);if(r.length===0)return;if(o){let p=Q(n,e),O=o.includes("label")||o.some(v=>typeof e[v]=="string"&&e[v]===p[0].text),w=p.filter((v,D)=>D===0?O:o.includes(v.field)),N=v=>D=>$(D.text).tokens.some(P=>P.startsWith(v));if(!r.every(v=>w.some(N(v))))return;let S=w.find(N(r[0]));return{field:S.field,reading:S.reading,fragment:q(S.text,r),strength:S.field==="label"?j(S.text,r)??"field":"field"}}let a=Q(n,e),[d,...f]=a,l=j(d.text,r);if(l)return{field:"label",reading:d.reading,fragment:q(d.text,r),strength:l};let u=p=>O=>$(O.text).tokens.some(w=>w.startsWith(p));if(!r.every(p=>a.some(u(p))))return;let g=T(d.text),y=r.find(p=>!g.some(O=>O.startsWith(p)))??r[0],x=f.find(u(y));return{field:x.field,reading:x.reading,fragment:q(x.text,[y]),strength:"field"}}var un=512,yn=64;function hn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-un),o=n[n.length-1].seq;for(let r of t){let a=Math.pow(.5,(o-r.seq)/yn);for(let d of r.writes)e.set(d,(e.get(d)??0)+a)}return e}var ge=(n,e)=>we({tryDefinition:()=>n},e),fe=(n,e)=>De({tryDefinition:()=>n},e);function pn(n,e,t){let o=n.tryDefinition(e),r=[{field:"plural",text:ge(o,e)},{field:"kind",text:W(e)},...o?.noun?[{field:"noun",text:o.noun}]:[]],a;for(let d of r){let f=j(d.text,t);f&&(!a||I[f]<I[a.strength])&&(a={strength:f,...d})}return a}var mn,bn=(n,e)=>(mn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),qe=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||bn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function Ln(n,e,t={}){let o=n.schema,r=an(e),a=T(r.words),d=t.principal??{kind:"human"},f=n.kindsKeptFrom(d),l=n.modules.disabledKinds,u=r.conditions.filter(i=>i.key==="kind").map(i=>i.value),g=r.conditions.filter(i=>i.key==="is").map(i=>i.value),y=g.includes("any")||g.includes("past"),x=g.includes("past")&&!g.includes("any")&&!g.includes("current"),p=g.includes("archived")?!0:t.archived??"all",O=(i,s)=>{let c=ce(s),h=o.tryDefinition(i);return ce(i)===c||ce(ge(h,i))===c},w=o.kinds.filter(i=>!f.has(i)&&!l.has(i)&&(t.kinds===void 0||t.kinds.includes(i))&&(u.length===0||u.some(s=>O(i,s)))),S=r.conditions.filter(i=>i.key!=="kind").map(i=>({...i,admittedBy:w.filter(s=>Be(o,s).filters.some(c=>c.key===i.key))})),v=S.filter(i=>i.key!=="is"),D=g.filter(i=>i==="flagged"||i==="clear"||i==="past"||i==="archived"),P={kinds:w,past:y},Qe={hits:[],words:r.words,conditions:S,searched:P,byKind:{},total:0,matched:[]};if(a.length===0&&v.length===0&&D.length===0)return Qe;let X=t.today,F=t.flagged??new Set(n.violations().flatMap(i=>i.nodeIds)),Ue=t.touched??hn(n.log.all()),Y=new Set;for(let i of t.from??[]){Y.add(i);for(let s of n.graph.neighbors(i))Y.add(s.id)}let ue=ve(n,d)?Oe(n,d):void 0,J=oe.keptFrom?.(n,d)&&n.seenBy(d).graph,Z=i=>je(i,t.basePath===void 0?{}:{basePath:t.basePath}),ye={schema:o,graph:n.graph,flagged:F,...X?{today:X}:{}},R=[],B={},L=[],E=[],K=(i,s,c,h,m,b)=>{let A=z(c,i);B[s]=(B[s]??0)+1,R.push({hit:{about:"node",id:i.id,kind:s,label:A,why:m,current:h,flagged:F.has(i.id),address:Z(`${fe(c,s)}/${encodeURIComponent(i.id)}`),...b===void 0?{}:{near:!0},...G(i)?{archived:!0}:{}},...b===void 0?{}:{nearly:2-b},tier:I[m.strength],inKind:s===t.inKind?0:1,near:Y.has(i.id)?0:1,past:h?0:1,archived:G(i)?1:0,touched:-(Ue.get(i.id)??0),flagged:F.has(i.id)?0:1,name:A,id:i.id})};for(let i of w){let s=o.tryDefinition(i),c=S.filter(m=>m.key!=="is"&&m.admittedBy.includes(i));if(a.length===0&&c.length===0&&D.length===0)continue;let h=Fe(s,c);for(let m of n.graph.nodesOfKind(i,{archived:p})){if(ue&&!ue(m.id))continue;let b=J?J.getNode(m.id):m;if(!b)continue;let A=_(s,b,X);if(!y&&!h&&!A){if(a.length>0&&g.length===0&&c.every(k=>le(ye,b,k))){let k=_e(s,b,r.words);k&&E.push({node:b,kind:i,definition:s,why:k})}continue}if(x&&A||!c.every(k=>le(ye,b,k))||g.includes("flagged")&&!F.has(b.id)||g.includes("clear")&&F.has(b.id))continue;let C=a.length>0?_e(s,b,r.words):c[0]?{field:c[0].key,reading:W(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${D[0]}`,strength:"field"};C?K(b,i,s,A,C):a.length>0&&L.push({node:b,kind:i,definition:s,current:A})}}let ee=i=>i.strength!=="field",ne=!1;if(E.length>0&&R.length===0){ne=!0;for(let i of E)K(i.node,i.kind,i.definition,!1,i.why)}else if(E.some(i=>ee(i.why))&&!R.some(i=>ee(i.hit.why))){ne=!0;for(let i of E)ee(i.why)&&K(i.node,i.kind,i.definition,!1,i.why)}let he=t.near!==!1&&a.length>0&&R.length<nn&&L.length>0,te=new Set;if(he)for(let i of L){let s=cn(Q(i.definition,i.node),a);s&&(te.add(i.node.id),K(i.node,i.kind,i.definition,i.current,s,s.by==="stem"?.9:.8))}let Ve=i=>i==="exact"||i==="prefix"?-1:I[i],re=(i,s,c,h)=>({hit:i,tier:Ve(s),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(a.length>0){for(let s of w){let c=pn(o,s,a);if(!c)continue;let h=Ne(o,s),m={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};R.push(re({about:"kind",kind:s,label:h,why:m,count:B[s]??0,address:Z(fe(o.tryDefinition(s),s))},c.strength,h,`kind:${s}`))}let i=t.places??[];for(let s of Re(i.filter(c=>w.includes(c.kind)))){if(s.across&&f.has(s.across))continue;let c=j(s.title,a);if(!c)continue;let h={field:"title",reading:"Title",fragment:s.title,strength:c},m=Me(s,i)?fe(o.tryDefinition(s.kind),s.kind).slice(1):void 0,b=Z(We(s.as,m));R.push(re({about:"place",kind:s.kind,title:s.title,as:s.as,why:h,address:b},c,s.title,`place:${s.kind}:${s.as}`))}for(let s of n.allInvariants()){let c=s.scope==="graph"?void 0:s.scope.kind;if(c&&!w.includes(c))continue;let h=s.label??W(s.name),m=j(h,a),b=m?void 0:j(W(s.name),a),A=m??b;if(!A)continue;let C={field:m?"label":"name",reading:m?"Rule":"Name",fragment:m?h:s.name,strength:A};R.push(re({about:"rule",name:s.name,label:h,...c?{kind:c}:{},why:C},A,h,`rule:${s.name}`))}}let pe=()=>{R.sort(qe);let i=t.limit??50,s=R.slice(0,i).map(k=>k.hit),c=s.flatMap(k=>k.about==="node"?[(J||n.graph).getNode(k.id)]:[]).filter(Boolean),h=Ce(c,k=>o.tryDefinition(k)),m=s.map(k=>k.about==="node"&&h.has(k.id)?{...k,apart:h.get(k.id)}:k),b=Object.values(B).reduce((k,Ye)=>k+Ye,0),A=R.flatMap(k=>k.hit.about==="node"?[k.hit.id]:[]),C=t.subject&&w.includes(String(n.graph.getNode(t.subject)?.kind))?kn(n,t.subject,r.words,{principal:d}):[];return{hits:[...m,...C],words:r.words,conditions:S,searched:ne?{...P,past:!0}:P,byKind:{...B},total:b,matched:A}},H=pe(),me=t.rank;if(!he||!me)return H;let be=L.filter(i=>!te.has(i.node.id)).map(({node:i,kind:s,definition:c})=>({id:i.id,kind:s,label:z(c,i),texts:Q(c,i)}));if(be.length===0)return H;let Xe=(async()=>{let i;try{i=await me(r.words,be)}catch{return H}let s=new Map(L.filter(h=>!te.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:m,matched:b}of Array.isArray(i)?i:[]){let A=s.get(h);!A||!(m>0)||(s.delete(h),c=!0,K(A.node,A.kind,A.definition,A.current,gn(Q(A.definition,A.node),r.words,typeof b=="string"?b:void 0),Math.min(1,m)))}return c?pe():H})();return{...H,later:Xe}}function kn(n,e,t,o={}){let r=o.principal??{kind:"human"},a=(oe.keptFrom?.(n,r)?n.seenBy(r):n).graph.getNode(e);if(!a)return[];if(n.kindsKeptFrom(r).has(a.kind))return[];let d=T(t),f=z(n.schema.tryDefinition(a.kind),a),l=[];for(let g of n.allMutations()){let y=g.subject;if(!y||y.kinds!=="*"&&!y.kinds.includes(a.kind))continue;let x=g.derived?.act;if((x==="archive"||x==="merge")&&G(a)||x==="unarchive"&&!G(a)||x==="leave-alone"&&ie(a)||x==="allow-tidying"&&!ie(a)||!n.permits({name:g.name,args:{[y.arg]:a.id}},r).ok)continue;let p=Ae(g),O=T(p),w=d.filter(v=>O.some(D=>D.startsWith(v))),N=w.length>0?j(p,w):void 0,S=N?{field:"title",reading:"Act",fragment:p,strength:N}:{field:"subject",reading:"On",fragment:f,strength:"field"};l.push({hit:{about:"act",name:g.name,title:p,subject:a.id,why:S,destructive:g.destructive===!0},tier:N?I[N]:I.field+1,inKind:0,near:0,past:g.destructive?1:0,touched:0,flagged:g.pinned?0:1,name:p,id:`act:${g.name}`})}l.sort(qe);let u=l.map(g=>g.hit);return o.limit===void 0?u:u.slice(0,o.limit)}function En(n,e){let t=e.kinds.map((a,d)=>{let f=ge(n.tryDefinition(a),a);return d===0?f:f.toLowerCase()}),o=xe(t)||"Nothing";return e.kinds.some(a=>n.tryDefinition(a)?.lifecycle)?e.past?`${M(o)}, past ones included.`:`${M(o)}, current ones; add is:any for past ones.`:`${M(o)}.`}export{se as a,de as b,Je as c,Fe as d,Be as e,vn as f,On as g,Le as h,Ie as i,Pe as j,en as k,le as l,ce as m,an as n,_e as o,hn as p,Ln as q,kn as r,En as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{l as k,n as M,o as I,p as B,s as P}from"./chunk.2FLPDPEL.js";import"./chunk.UUBYFBPN.js";import"./chunk.2RVUDRRY.js";import"./chunk.LLEFYJPJ.js";import{G as te,R as W,ua as q}from"./chunk.FOQZADMA.js";import{a as L}from"./chunk.SDO3U72B.js";import"./chunk.V5MYKNL7.js";import{b as h}from"./chunk.AJZBJBMO.js";var r=h(te(),1);var A=h(W(),1),U=q(L(()=>(__graviewPreload(import.meta.url,["./chunk.LLEFYJPJ.js","./chunk.FOQZADMA.js","./chunk.SDO3U72B.js","./chunk.V5MYKNL7.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZGCRMNER.js")))),v={Part:U.part((n,t)=>(0,A.jsx)(n.WhenMonth,{...t}),{quiet:!0}),prefetch:()=>U.prefetch()};var o=h(W(),1),z="try \u201Ctomorrow 3pm\u201D, \u201CFri 10:30\u201D or \u201C17 Oct\u201D";function K(n,t,d,p=!1){let S=Date.UTC(+n.day.slice(0,4),+n.day.slice(5,7)-1,+n.day.slice(8,10),0,t?n.minutes??0:0),g={weekday:p?"long":"short",year:"numeric",month:p?"long":"short",day:"numeric",...t?{hour:"numeric",minute:"2-digit"}:{},timeZone:"UTC"},m;try{m=new Intl.DateTimeFormat(d??"en-US",g)}catch{m=new Intl.DateTimeFormat("en-US",g)}return m.format(S).replace(/ /g," ")}function ce({value:n,time:t,instant:d=!1,label:p,name:S,required:g,autoFocus:m,autoSelect:H,locale:s,onChange:j,onLeave:_,onCancel:V,inputRef:w,boxStyle:Z}){let x=(0,r.useId)(),u=(0,r.useRef)(null),D=(0,r.useRef)(null),b=e=>{let a=M(e);return a?K(a,t,s):e??""},[T,C]=(0,r.useState)(()=>b(n)),[F,y]=(0,r.useState)(!1),[G,E]=(0,r.useState)(n),[J,Q]=(0,r.useState)(n);n!==J&&(Q(n),n!==G&&(E(n),C(b(n)))),(0,r.useEffect)(()=>{H&&(u.current?.focus(),u.current?.select())},[H]);let i=t&&d?B(s):void 0,N=T===b(n),l=M(n),c=N?l:P(T,{today:k().day,time:t,...l?{base:l}:{},...s?{locale:s}:{}}),X=N?n:c?I(c,{time:t,instant:d}):void 0,$=T.trim()==="",f=!$&&c===void 0;(0,r.useEffect)(()=>{u.current?.setCustomValidity(f?`Not a date this reads \u2014 ${z}`:"")},[f]);let O=e=>{E(e),j(e)},Y=e=>{C(e);let a=e.trim()===""?void 0:P(e,{today:k().day,time:t,...l?{base:l}:{},...s?{locale:s}:{}});O(a?I(a,{time:t,instant:d}):void 0)},ee=e=>{let a=t?{day:e,minutes:c?.minutes??l?.minutes??540}:{day:e},R=I(a,{time:t,instant:d});C(b(R)),O(R),y(!1),requestAnimationFrame(()=>{u.current?.focus(),u.current?.select()})},ne=$?`Type a date, or pick one \u2014 ${z}`:f?`Not a date this reads \u2014 ${z}`:c?`${K(c,t,s,!0)}${i?` ${i.short}`:""}`:"";return(0,o.jsxs)("span",{"data-graview-when":t?d?"instant":"moment":"day",style:{display:"inline-flex",flex:"1 1 14rem",flexWrap:"wrap",alignItems:"center",gap:"4px 6px",maxWidth:"100%",minWidth:0},onBlur:e=>{let a=e.relatedTarget;a&&e.currentTarget.contains(a)||!a&&typeof document<"u"&&!document.hasFocus()||(y(!1),_?.(X))},children:[(0,o.jsx)("input",{ref:e=>{u.current=e,typeof w=="function"?w(e):w&&(w.current=e)},type:"text",name:S,required:g,autoFocus:m,"aria-label":p,"aria-describedby":`${x}-said`,"aria-invalid":f||void 0,autoComplete:"off",spellCheck:!1,enterKeyHint:"done",placeholder:t?"tomorrow 3pm":"17 Oct",value:T,"data-graview-part":"control",onChange:e=>Y(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),V?.()):e.key==="ArrowDown"&&e.altKey&&(e.preventDefault(),y(!0))},style:{flex:"1 1 12ch",minWidth:"10ch",maxWidth:"100%",boxSizing:"border-box",font:"inherit",...Z}}),(0,o.jsx)("button",{ref:D,type:"button","aria-label":`Pick a date for ${p}`,"aria-expanded":F,"aria-controls":`${x}-month`,"data-graview-part":"when-pick",onClick:()=>y(e=>!e),onPointerEnter:()=>v.prefetch(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:32,minHeight:32,padding:0,borderRadius:6},children:(0,o.jsxs)("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,o.jsx)("rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}),(0,o.jsx)("path",{d:"M2 6.5h12M5.5 1.5v3M10.5 1.5v3"})]})}),(0,o.jsxs)("span",{id:`${x}-said`,"aria-live":"polite","data-graview-part":"when-said",...i?{"data-graview-zone":i.zone,title:`Times are in ${i.zone.replace(/_/g," ")} (${i.short})`}:{},style:{flexBasis:"100%",fontSize:"0.75rem",color:f?"var(--graview-bad)":"var(--graview-ink-faint)"},children:[ne,i&&!f&&!$?(0,o.jsx)("span",{"data-graview-part":"when-zone",children:` \xB7 ${(i.zone.split("/").at(-1)??i.zone).replace(/_/g," ")} time`}):null]}),F?(0,o.jsx)(r.Suspense,{fallback:null,children:(0,o.jsx)(v.Part,{id:`${x}-month`,label:p,selected:c?.day??l?.day,today:k().day,locale:s,onPick:ee,onClose:()=>{y(!1),D.current?.focus()}})}):null]})}export{ce as WhenInput,K as wallAsRead};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{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};
|