graview 0.1.30 → 0.1.33
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.26LLZN3C.js +1 -0
- package/dist/preview/chunk.2NIOHEMX.js +1 -0
- package/dist/preview/chunk.2WPZXIRP.js +2 -0
- package/dist/preview/{chunk.XRJBLH4N.js → chunk.3AGY4QVS.js} +1 -1
- package/dist/preview/chunk.3HXN4BOY.js +1 -0
- package/dist/preview/{chunk.2CIBWZJG.js → chunk.3K6YSVHC.js} +1 -1
- package/dist/preview/chunk.3NDH3EDN.js +47 -0
- package/dist/preview/{chunk.FWCOJDOD.js → chunk.3TVXGJTU.js} +1 -1
- package/dist/preview/{chunk.NDADLJE6.js → chunk.3TY5NFLY.js} +1 -1
- package/dist/preview/{chunk.UWGWXFWZ.js → chunk.47STJVRV.js} +1 -1
- package/dist/preview/{chunk.X37L5TN5.js → chunk.4HNG4UXT.js} +1 -1
- package/dist/preview/{chunk.34ZMMURV.js → chunk.4HRAQNJO.js} +6 -6
- package/dist/preview/{chunk.QTMWHE5O.js → chunk.4HZ7QTXZ.js} +1 -1
- package/dist/preview/{chunk.3JGGBLRB.js → chunk.4MERAWS2.js} +1 -1
- package/dist/preview/chunk.52W7WYME.js +1 -0
- package/dist/preview/chunk.5A4AOFOA.js +1 -0
- package/dist/preview/chunk.5H4VXLZF.js +88 -0
- package/dist/preview/{chunk.XS7YFNDU.js → chunk.5T5XGILP.js} +1 -1
- package/dist/preview/chunk.5UL7YDUD.js +1 -0
- package/dist/preview/chunk.63GXY2ME.js +1 -0
- package/dist/preview/chunk.67TPUXAY.js +1 -0
- package/dist/preview/chunk.6QWV5MVH.js +25 -0
- package/dist/preview/{chunk.PAVR5TK5.js → chunk.6UGEYZAC.js} +1 -1
- package/dist/preview/chunk.6YCBYL2Y.js +2 -0
- package/dist/preview/{chunk.ZYKAS4BT.js → chunk.7GKUVQVF.js} +1 -1
- package/dist/preview/{chunk.T3VPD7JQ.js → chunk.7T7NZZTC.js} +1 -1
- package/dist/preview/chunk.AKFKM4SW.js +3 -0
- package/dist/preview/chunk.AOSMJKLH.js +1 -0
- package/dist/preview/{chunk.DT7LHWU2.js → chunk.AR3DCDHU.js} +1 -1
- package/dist/preview/{chunk.D3IECJ2S.js → chunk.ASCLIM2P.js} +1 -1
- package/dist/preview/chunk.B2GLDIAS.js +1 -0
- package/dist/preview/chunk.BHXGM3PV.js +1 -0
- package/dist/preview/chunk.BNV77BQZ.js +4 -0
- package/dist/preview/chunk.BQ3JHEHV.js +1 -0
- package/dist/preview/chunk.CAVBSL27.js +1 -0
- package/dist/preview/{chunk.YLQB3KBA.js → chunk.CDP2XL66.js} +1 -1
- package/dist/preview/chunk.CIPS2OGR.js +1 -0
- package/dist/preview/chunk.CN3UEF5N.js +90 -0
- package/dist/preview/{chunk.6XMEU2Q2.js → chunk.COQKECUH.js} +1 -1
- package/dist/preview/{chunk.QTA4ROAK.js → chunk.CWHRDBOF.js} +1 -1
- package/dist/preview/chunk.CX3KL2C5.js +1 -0
- package/dist/preview/{chunk.AK3IHFCF.js → chunk.D75KC3LL.js} +1 -1
- package/dist/preview/chunk.DAZ2VSRD.js +1 -0
- package/dist/preview/{chunk.3ADPAGPY.js → chunk.DYSPCGXX.js} +1 -1
- package/dist/preview/chunk.E2YEOMPH.js +1 -0
- package/dist/preview/chunk.EBGAYL32.js +1 -0
- package/dist/preview/chunk.EF3XNU4O.js +1 -0
- package/dist/preview/chunk.EJPI3ST6.js +1 -0
- package/dist/preview/chunk.EKPRNDUV.js +1 -0
- package/dist/preview/chunk.ERIT3R6N.js +1 -0
- package/dist/preview/chunk.EYTBDMTW.js +1 -0
- package/dist/preview/{chunk.HHPGWJDO.js → chunk.FWTIUYXH.js} +1 -1
- package/dist/preview/{chunk.6T2Q6NLO.js → chunk.G5NZVPJU.js} +1 -1
- package/dist/preview/chunk.GBRRGTIH.js +1 -0
- package/dist/preview/{chunk.VG56IUIQ.js → chunk.GO4XBWJO.js} +1 -1
- package/dist/preview/chunk.GV2CQVKV.js +1 -0
- package/dist/preview/chunk.GYICGZMG.js +3 -0
- package/dist/preview/chunk.H7BST3XO.js +1 -0
- package/dist/preview/chunk.H7EPE74C.js +1 -0
- package/dist/preview/{chunk.26CZTUY4.js → chunk.HAIG6NVX.js} +1 -1
- package/dist/preview/{chunk.V7BDAGDE.js → chunk.HLTRQU4Y.js} +1 -1
- package/dist/preview/{chunk.VS7K3SCD.js → chunk.I6FPNX43.js} +1 -1
- package/dist/preview/chunk.IDVAR5HM.js +1 -0
- package/dist/preview/{chunk.3URFMWXZ.js → chunk.IWQCOGHW.js} +2 -2
- package/dist/preview/chunk.J25KOSNW.js +1 -0
- package/dist/preview/chunk.JDUJDAGA.js +1 -0
- package/dist/preview/chunk.JOOQUWLT.js +341 -0
- package/dist/preview/{chunk.4SJUTBDV.js → chunk.JQU5GEU3.js} +1 -1
- package/dist/preview/chunk.K5ME5GCG.js +1 -0
- package/dist/preview/chunk.KSES5U5B.js +1 -0
- package/dist/preview/chunk.KSXB4LDF.js +1 -0
- package/dist/preview/chunk.LR3VDXPI.js +1 -0
- package/dist/preview/{chunk.WYTIOLPP.js → chunk.LXBOVRFI.js} +1 -1
- package/dist/preview/{chunk.42YX6NOY.js → chunk.MAF7C3VM.js} +1 -1
- package/dist/preview/chunk.MNP4JI33.js +5 -0
- package/dist/preview/{chunk.O2LK2AO7.js → chunk.MWGGV7DE.js} +1 -1
- package/dist/preview/chunk.N6OX4NEQ.js +1 -0
- package/dist/preview/chunk.NRAYZY3X.js +1 -0
- package/dist/preview/chunk.NTF7FVB2.js +1 -0
- package/dist/preview/{chunk.DZRTOURR.js → chunk.OC6IWRQ3.js} +1 -1
- package/dist/preview/chunk.OJGHDWI6.js +1 -0
- package/dist/preview/chunk.OKRNJXTV.js +1 -0
- package/dist/preview/chunk.PBSMLINK.js +1 -0
- package/dist/preview/chunk.PHKSMUIA.js +1 -0
- package/dist/preview/{chunk.JN7DIFR3.js → chunk.PIP6Z563.js} +1 -1
- package/dist/preview/chunk.QVVJRSRM.js +1 -0
- package/dist/preview/{chunk.L6OMEYL6.js → chunk.QYZNAUIR.js} +1 -1
- package/dist/preview/chunk.R6K6GF5R.js +1 -0
- package/dist/preview/{chunk.JTNWD2CN.js → chunk.RCKTBOY2.js} +1 -1
- package/dist/preview/{chunk.QNGWEV47.js → chunk.RIJUCHP4.js} +1 -1
- package/dist/preview/chunk.SHTJZ6UX.js +1 -0
- package/dist/preview/{chunk.PKK6FRZR.js → chunk.SYAEBGDC.js} +1 -1
- package/dist/preview/chunk.T5VG5A6V.js +1 -0
- package/dist/preview/{chunk.ERXSYPYL.js → chunk.TAQ764IQ.js} +1 -1
- package/dist/preview/{chunk.RIEHYQLK.js → chunk.TMVCTBAD.js} +50 -24
- package/dist/preview/{chunk.HHI65WFZ.js → chunk.UATVTXZY.js} +1 -1
- package/dist/preview/{chunk.XSTXV6FP.js → chunk.UBFNZMUX.js} +2 -2
- package/dist/preview/{chunk.WAFDCOOG.js → chunk.UGFJKSHU.js} +1 -1
- package/dist/preview/chunk.UHUGOTUU.js +19 -0
- package/dist/preview/chunk.ULRW47RP.js +1 -0
- package/dist/preview/chunk.UNL2HIF2.js +1 -0
- package/dist/preview/chunk.UVR2Z5ZC.js +1 -0
- package/dist/preview/chunk.UZGRRDHD.js +1 -0
- package/dist/preview/{chunk.BPWNWE7N.js → chunk.VG3O4LWB.js} +1 -1
- package/dist/preview/chunk.WAZ7OGBD.js +1 -0
- package/dist/preview/{chunk.3JNMSOFG.js → chunk.XANVHJQ4.js} +1 -1
- package/dist/preview/chunk.XBJYQNVE.js +1 -0
- package/dist/preview/chunk.XKABS745.js +1 -0
- package/dist/preview/chunk.XMC7YDWT.js +1 -0
- package/dist/preview/chunk.XNJEFUF7.js +3 -0
- package/dist/preview/chunk.Y2SFUALD.js +117 -0
- package/dist/preview/chunk.Y6ZNFQK3.js +6 -0
- package/dist/preview/{chunk.J2ITFGN3.js → chunk.YIR7PPF3.js} +1 -1
- package/dist/preview/index.html +51 -0
- package/dist/preview/page.js +6 -6
- package/package.json +6 -6
- package/dist/preview/chunk.2EXGG6BB.js +0 -1
- package/dist/preview/chunk.2NBYNZRD.js +0 -1
- package/dist/preview/chunk.2XAONC66.js +0 -1
- package/dist/preview/chunk.3R4W2P5X.js +0 -1
- package/dist/preview/chunk.3SKKIHU3.js +0 -4
- package/dist/preview/chunk.3VL5WECB.js +0 -1
- package/dist/preview/chunk.4ALKPNXM.js +0 -1
- package/dist/preview/chunk.4HP7UWA2.js +0 -1
- package/dist/preview/chunk.5U5J3ISK.js +0 -1
- package/dist/preview/chunk.6V2RG5JG.js +0 -5
- package/dist/preview/chunk.7BWT5L2L.js +0 -1
- package/dist/preview/chunk.C5CYZNSJ.js +0 -1
- package/dist/preview/chunk.CM6LOIQE.js +0 -88
- package/dist/preview/chunk.FDELO7NY.js +0 -116
- package/dist/preview/chunk.FGVKJWNS.js +0 -6
- package/dist/preview/chunk.GFF2FB2J.js +0 -25
- package/dist/preview/chunk.GLBHQFJ2.js +0 -1
- package/dist/preview/chunk.HSCTWAUV.js +0 -1
- package/dist/preview/chunk.INZUEWC5.js +0 -1
- package/dist/preview/chunk.JH6MU6TX.js +0 -2
- package/dist/preview/chunk.JISMMIMX.js +0 -1
- package/dist/preview/chunk.JPHNKWTY.js +0 -1
- package/dist/preview/chunk.K75FUIZI.js +0 -1
- package/dist/preview/chunk.K776HO42.js +0 -2
- package/dist/preview/chunk.KN3ULTGF.js +0 -1
- package/dist/preview/chunk.KOB6N3SL.js +0 -1
- package/dist/preview/chunk.KQT7WAQE.js +0 -1
- package/dist/preview/chunk.L4DECHXR.js +0 -327
- package/dist/preview/chunk.LQ7V6KEE.js +0 -1
- package/dist/preview/chunk.MD74YVRN.js +0 -3
- package/dist/preview/chunk.MGNP4LAM.js +0 -1
- package/dist/preview/chunk.NCTOBUCT.js +0 -1
- package/dist/preview/chunk.NO52VON3.js +0 -1
- package/dist/preview/chunk.OAF7TUMI.js +0 -1
- package/dist/preview/chunk.OQ4KFN6W.js +0 -1
- package/dist/preview/chunk.OQDETV4X.js +0 -1
- package/dist/preview/chunk.OXQMNIRO.js +0 -1
- package/dist/preview/chunk.OZNW5W4Z.js +0 -1
- package/dist/preview/chunk.QIAKO27D.js +0 -1
- package/dist/preview/chunk.R26DREVU.js +0 -1
- package/dist/preview/chunk.RI3PYG5T.js +0 -19
- package/dist/preview/chunk.RRVIXV7W.js +0 -1
- package/dist/preview/chunk.RYT5U3QM.js +0 -1
- package/dist/preview/chunk.SE5SKFQH.js +0 -1
- package/dist/preview/chunk.SOBC3CTN.js +0 -47
- package/dist/preview/chunk.SOD3PBJM.js +0 -1
- package/dist/preview/chunk.UDSEJKCY.js +0 -1
- package/dist/preview/chunk.UZWWDAGM.js +0 -14
- package/dist/preview/chunk.V5ZYUVMH.js +0 -1
- package/dist/preview/chunk.VOAZBHCG.js +0 -1
- package/dist/preview/chunk.VSZQXB4Q.js +0 -3
- package/dist/preview/chunk.W3S6UXNA.js +0 -1
- package/dist/preview/chunk.Y4UXEL6Y.js +0 -1
- package/dist/preview/chunk.YJUB4OD7.js +0 -1
- package/dist/preview/chunk.YNQDVGZM.js +0 -1
- package/dist/preview/chunk.YV2LJFGS.js +0 -1
- package/dist/preview/chunk.Z2YUYZT4.js +0 -1
- /package/dist/preview/{chunk.EYZ7MHBZ.js → chunk.GZHZLJBF.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.5A4AOFOA.js";import"./chunk.KSXB4LDF.js";import"./chunk.R6K6GF5R.js";import"./chunk.3AGY4QVS.js";import{a as L,b as R,c as E}from"./chunk.2NIOHEMX.js";import{b as T}from"./chunk.4HRAQNJO.js";import"./chunk.Y6ZNFQK3.js";import"./chunk.BNV77BQZ.js";import"./chunk.SYAEBGDC.js";import"./chunk.NRAYZY3X.js";import"./chunk.RIJUCHP4.js";import"./chunk.TAQ764IQ.js";import"./chunk.YIR7PPF3.js";import"./chunk.3HXN4BOY.js";import"./chunk.GYICGZMG.js";import"./chunk.UHUGOTUU.js";import"./chunk.47STJVRV.js";import"./chunk.EBGAYL32.js";import"./chunk.DAZ2VSRD.js";import"./chunk.HJCQ6I3S.js";import"./chunk.MWGGV7DE.js";import"./chunk.JQU5GEU3.js";import"./chunk.HAIG6NVX.js";import"./chunk.UZGRRDHD.js";import"./chunk.XANVHJQ4.js";import"./chunk.OKRNJXTV.js";import"./chunk.CAVBSL27.js";import"./chunk.COQKECUH.js";import"./chunk.EJPI3ST6.js";import"./chunk.CWHRDBOF.js";import"./chunk.3K6YSVHC.js";import"./chunk.SHTJZ6UX.js";import"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.G5NZVPJU.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ULRW47RP.js";import"./chunk.PBSMLINK.js";import"./chunk.3TY5NFLY.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import"./chunk.GZHZLJBF.js";import{r as x}from"./chunk.XMC7YDWT.js";import"./chunk.6UGEYZAC.js";import"./chunk.OJGHDWI6.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import"./chunk.JOOQUWLT.js";import{F as S,H as $,Q as p,Y as C,_ as A}from"./chunk.6QWV5MVH.js";import{W as h,ec as k}from"./chunk.MNP4JI33.js";import{b as i}from"./chunk.AJZBJBMO.js";var o=i(S(),1);var l=i(S(),1);var g=i(p(),1);var m={font:"inherit",fontSize:"0.875rem",minHeight:24,padding:0,border:0,borderRadius:2,background:"transparent",boxShadow:"none",color:"var(--graview-accent)",textDecoration:"underline",textUnderlineOffset:3,textAlign:"start",cursor:"pointer"};var e=i(p(),1);function I({page:r=!1,go:D,onPick:y,onDiscard:M}){let{store:d,seatTalk:c}=C(),u=$(c),N=E(),b=D??N,{keep:P}=L(b),[H,f]=(0,o.useState)(!1);A();let t=u.draft;(0,o.useEffect)(()=>f(!1),[t]),(0,o.useEffect)(()=>{r||R(!1)},[r]);let v=(0,o.useRef)(null),w=t!==null&&!r;if((0,o.useLayoutEffect)(()=>{let s=v.current;if(!w||!s?.parentElement)return;let n=[];for(let a=s.previousElementSibling;a;a=a.previousElementSibling)a instanceof HTMLElement&&!a.inert&&a.tagName!=="STYLE"&&(a.inert=!0,n.push(a));return()=>{for(let a of n)a.inert=!1}},[w]),!t)return null;let G=T(t.drawn),F=d.schema.tryDefinition(t.kind),q=d.graph.nodesOfKind(t.kind).filter(s=>h(F,s)),z=()=>{c.setDraft(null),M?.()};return(0,e.jsxs)("section",{ref:v,"data-testid":"draft-frame","aria-label":`Draft: ${t.title}`,style:r?{display:"grid",gap:12,minWidth:0}:{position:"absolute",inset:0,zIndex:k("rail"),display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",background:"var(--graview-ground, var(--graview-panel))",minHeight:0},children:[(0,e.jsxs)("p",{"data-testid":"draft-line",style:{...K,...r?{}:{padding:"10px 16px"}},children:[r?(0,e.jsx)("span",{children:"Draft"}):(0,e.jsxs)("span",{children:["Draft \u2014 ",(0,e.jsx)("span",{"data-testid":"draft-title",style:{color:"var(--graview-ink)",fontWeight:600},children:t.title})]}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-keep",disabled:H,title:`Keep \u201C${t.title}\u201D as a lens: a place of its own`,onClick:()=>{f(!0),P(t).finally(()=>f(!1))},style:m,children:"Keep as a lens"}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-discard",onClick:z,style:m,children:"Discard"})]}),u.draftNote?(0,e.jsx)("p",{"data-testid":"draft-note",role:"status",style:{margin:0,padding:r?0:"0 16px 8px",fontSize:"0.8125rem",color:"var(--graview-warn)"},children:u.draftNote}):(0,e.jsx)("span",{}),(0,e.jsx)("div",{"data-testid":"draft-lens","data-graview-draft":t.lens.name,style:r?{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",scrollbarGutter:"stable",border:"1px solid var(--graview-edge)",borderRadius:12,background:"var(--graview-panel)"}:{minHeight:0,overflow:"auto",scrollbarGutter:"stable",display:"grid",gridTemplateRows:"minmax(0, 1fr)"},onClick:s=>{let n=s.target?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(!n||!d.graph.getNode(n))return;s.preventDefault();let a=d.graph.getNode(n);y?(c.setDraft(null),y(n)):b({to:"record",id:n,kind:a.kind,label:n,address:"",said:""})},children:(0,e.jsx)(x,{kind:t.kind,view:t.title,children:(0,e.jsx)(G,{nodes:q,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})]})}var K={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};export{I as DraftFrame};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as v,C,D as S,J as G,y as O}from"./chunk.JOOQUWLT.js";import{A as E,F as I,Y as m,d as V,k as y,m as p,n as g,o as u,p as D,w as B}from"./chunk.6QWV5MVH.js";import{Ac as k,Cc as R,Dc as T,aa as M,zc as P}from"./chunk.MNP4JI33.js";import{b as A}from"./chunk.AJZBJBMO.js";var W=A(I(),1);function j(e,t){try{t.length===0?localStorage.removeItem(v(e)):localStorage.setItem(v(e),JSON.stringify(t))}catch{}}function F(e,t){j(e,[...S(e).filter(n=>n.title!==t.title),t])}function H(e,t){j(e,S(e).filter(n=>n.title!==t))}function J(e,t){for(let n of e.places().filter(o=>o.title===t))e.forget?.(n.kind,n.as)}var U=e=>e===!0?{written:!0}:typeof e=="object"&&e!==null?{written:e.kept===!0,...e.said?{said:e.said}:{}}:{written:!1},N=e=>({title:e.title,lens:e.lens,on:e.on,...e.bindings?{bindings:e.bindings}:{},...e.options?{options:e.options}:{}});function Z(e,t){let n=o=>t.some(r=>r.title===o||r.as===P(o));if(!n(e))return e;for(let o=2;;o++)if(!n(`${e} ${o}`))return`${e} ${o}`}function ie(e){let{store:t,views:n,brand:o,seatTalk:r,onKeepLens:d}=m(),h=(0,W.useContext)(O),L=C(o,t.schema),b=async f=>{let{edit:i}=f;if(f.written&&d)try{await d({op:"remove-lens",title:i.title,on:i.on})}catch{}H(L,i.title),J(n,i.title),h?.dismiss(`kept:${i.title}`),r.setTurns(l=>[...l.map(s=>s.kept&&s.kept.edit.title===i.title&&!s.kept.taken?{...s,kept:{...s.kept,taken:!0}}:s),{role:"seat",text:`Took \u201C${i.title}\u201D back out of the places.`}]);let a=M(t.schema,i.on);e({to:"kind",kind:i.on,title:a,address:k(t.schema,i.on),said:`Went to ${a}.`})};return{keep:async f=>{let i=Z(f.edit.title,n.places()),a={...f.edit,title:i},l=!1,s;if(d)try{({written:l,said:s}=U(await d(a)))}catch{l=!1}l||F(L,N(a)),G(n,t.schema,[N(a)]);let K=n.places(),c=K.find(w=>w.title===i),x=s??(l?`Kept \u201C${i}\u201D as a lens: it is in the places now.`:d?`Kept \u201C${i}\u201D as your own lens. Ask the owner to keep it for everyone.`:`Kept \u201C${i}\u201D as your own lens.`),$={edit:a,written:l};r.setDraft(null),r.setTurns(w=>[...w,{role:"seat",text:x,kept:$}]),h?.notify({kind:"toast",id:`kept:${i}`,sentence:x,timeout:1e4,action:{label:"Take back",onSelect:()=>void b($)}}),c&&e({to:"picture",kind:c.kind,as:c.as,title:i,address:R(c.as,T(c,K)?k(t.schema,c.kind).slice(1):void 0),said:`Went to ${i}.`})},takeBack:b}}var q=A(I(),1);function _(e,t){switch(t.to){case"place":return{view:V("#")};case"picture":return{view:u(E(p(e,"filter",null),t.kind,t.as),[])};case"kind":{let n=D(g({...y(e,B(t.kind)),relation:null},!1),!0);return{view:u(p(p(n,"view",null),"filter",t.filter??null),[])}}case"record":return{view:u(y(g(p(p(e,"view",null),"filter",null),!1),t.id),[t.id])};case"problems":return{pane:"problems"}}}function z(e){let t=typeof document>"u"?null:document.querySelector('[data-testid="standing"]');t&&t.getAttribute("aria-expanded")==="true"!==e&&t.click()}function ae(){let{setView:e,seatTalk:t}=m();return(0,q.useCallback)(n=>{t.get().draft&&t.setDraft(null),z(n.to==="problems"),n.to!=="problems"&&e(o=>{let r=_(o,n);return"view"in r?r.view:o})},[e,t])}export{ie as a,z as b,ae as c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as Pe,b as $e}from"./chunk.5A4AOFOA.js";import"./chunk.KSXB4LDF.js";import"./chunk.R6K6GF5R.js";import"./chunk.3AGY4QVS.js";import{i as Ee,j as He}from"./chunk.BNV77BQZ.js";import"./chunk.SYAEBGDC.js";import"./chunk.YIR7PPF3.js";import"./chunk.EBGAYL32.js";import"./chunk.DAZ2VSRD.js";import"./chunk.HJCQ6I3S.js";import"./chunk.MWGGV7DE.js";import"./chunk.JQU5GEU3.js";import"./chunk.HAIG6NVX.js";import"./chunk.UZGRRDHD.js";import"./chunk.XANVHJQ4.js";import"./chunk.OKRNJXTV.js";import"./chunk.CAVBSL27.js";import"./chunk.COQKECUH.js";import{a as ze,b as x}from"./chunk.EJPI3ST6.js";import"./chunk.3K6YSVHC.js";import"./chunk.SHTJZ6UX.js";import{b as Te,c as Me}from"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.G5NZVPJU.js";import"./chunk.ULRW47RP.js";import"./chunk.PBSMLINK.js";import"./chunk.3TY5NFLY.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import{t as Ce}from"./chunk.XMC7YDWT.js";import"./chunk.6UGEYZAC.js";import"./chunk.OJGHDWI6.js";import{g as Ae}from"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import{c as Se}from"./chunk.UGFJKSHU.js";import{m as ke}from"./chunk.JOOQUWLT.js";import{F as Ge,Q as we,Y as W,i as ve,na as Q,sa as be,v as ye,wa as xe}from"./chunk.6QWV5MVH.js";import{Jb as me,da as K,ea as L,ec as fe,kb as he}from"./chunk.MNP4JI33.js";import{b as Y}from"./chunk.AJZBJBMO.js";var a=Y(Ge(),1);var n=Y(we(),1);function dt({placement:d="float",chosen:o=!0}={}){let{menuAt:r}=W();return d==="menu"&&r===null?o?(0,n.jsx)(Je,{}):null:(0,n.jsx)(Xe,{placement:d})}function Je(){let{store:d,setMenuAt:o,view:r}=W(),{selection:f}=Q(),h=(0,a.useRef)(null),[p,k]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let v=h.current?.offsetParent??h.current?.parentElement;if(!v)return;let w=Math.round(v.getBoundingClientRect().width);w!==p&&k(w)});let S=f.length===1&&!r.overview?d.graph.getNode(f[0]):void 0;return!S||p===null||p>=Re?(0,n.jsx)("span",{ref:h,hidden:!0}):(0,n.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${x(d,S.id)}`,"aria-haspopup":"menu",onClick:v=>{let w=v.currentTarget.getBoundingClientRect();o({x:Math.round(w.right),y:Math.round(w.bottom+4),on:S.id})},style:{position:"absolute",right:"calc(14px + var(--graview-dock, 0px))",top:98,zIndex:"var(--graview-layer-overview, 10)",minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var Re=564;function Xe({placement:d}){let{store:o,menuAt:r,setMenuAt:f,view:h}=W(),p=(0,a.useRef)(null),k=(0,a.useRef)(null),S=(0,a.useRef)(null),v=(0,a.useRef)(null);r?.returnTo&&(v.current=r.returnTo);let w=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),t=e.getAttribute("data-pin-for"),g=i??e.getAttribute("data-affordance")??(t===null?null:`pin:${t}`)??e.getAttribute("data-menu-item");k.current=g===null?null:{key:g,element:e}};(0,a.useEffect)(()=>{let e=p.current,i=k.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let t=i.key;if(!e){k.current=null;let H=v.current;v.current=null,(H?.isConnected?H:S.current)?.focus();return}((t.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(t.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(t)}"]:not([disabled])`)??e).focus()});let[Le,We]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let e=p.current?.offsetParent??p.current?.parentElement;if(e instanceof HTMLElement&&(S.current=e),!e)return;let i=e.getBoundingClientRect();We(t=>t&&t.left===i.left&&t.top===i.top&&t.width===i.width&&t.height===i.height?t:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Ne,set:De,clear:Oe}=Q(),s=r?.about??Ne,[N,Fe]=(0,a.useState)(()=>Pe()),D=r?.on??s[s.length-1],O=r?.about,qe=(0,a.useMemo)(()=>({pins:N,...D===void 0?{}:{focus:D},...O?{about:O}:{}}),[N,D,O]),Be=(0,a.useMemo)(()=>new Set(o.allMutations().filter(e=>e.pinned).map(e=>e.name)),[o]),{affordances:c,withheld:m,observations:G}=Ee(qe),je=r===null?null:{face:r.face??"scene",on:r.on,about:s,field:r.field,place:r.place,href:r.href,act:r.act,element:r.returnTo},J=Ce(je),X=G.some(e=>e.id.startsWith("schema:waits:")),{apply:Ue,preview:_e}=He(),[C,z]=(0,a.useState)(null),[Ve,Z]=(0,a.useState)(!1),[ee,te]=(0,a.useState)(!1),[P,$]=(0,a.useState)(""),[ne,F]=(0,a.useState)(null),q=(0,a.useRef)([]),B=(e,i)=>{try{return _e(e,i),Ue(e,i),F(null),f(null),q.current=[],!0}catch(t){return F(Ae(o.schema,o.allMutations(),t)),q.current=t instanceof he?t.issues.map(g=>String(g.path[0]??"")).filter(Boolean):[],!1}},I=[...new Set(s.flatMap(e=>{let i=o.graph.getNode(e);return i?[i.kind]:[]}))],b=I.length>0?I:[...new Set(s.flatMap(e=>ye(e)))],u=s.length===1?ve(s[0]):null,j=u?{from:o.graph.getNode(u.from),to:o.graph.getNode(u.to)}:null,ie=u?Me(o,u):void 0,re=ie?.provisional?ie:void 0,ae=u?(()=>{let e=o.schema.tryDefinition(o.graph.getNode(u.from)?.kind??"")?.edges?.[u.kind],i=o.graph.getNode(u.to);return e?.inverse&&i?`From ${x(o,i.id)}: ${e.inverse}`:null})():null;(0,a.useEffect)(()=>{z(null),Z(!1),te(!1),F(null),$("")},[s,r?.about]);let l=r!==null,Ye=d==="menu"&&!l,A=(0,a.useRef)(r);A.current=r;let oe=xe("acts",{open:l&&d==="menu",onOpenChange:e=>{e||f(null)},at:()=>A.current?{x:A.current.x,y:A.current.y}:null,returnTo:()=>{let e=A.current?.returnTo;if(e?.isConnected)return e;let i=A.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),le=(Le?.width??Number.POSITIVE_INFINITY)<Re;if((0,a.useLayoutEffect)(()=>{let e=p.current?.offsetParent;if(!e||!le||l)return;let i=p.current?.getBoundingClientRect().height??0,t=`${Math.round(i)+20}px`;if(e.style.paddingBottom===t)return;let g=e.style.paddingBottom;return e.style.paddingBottom=t,()=>{e.style.paddingBottom=g}}),s.length===0&&!l)return null;let se=r?.title!==void 0||s.length>0&&!(s.length===1&&s[0]===h.focusId),de=Math.max(1,Math.min(9,c.length)),T=[...c.filter(e=>e.provider==="invariant"&&!e.destructive),...c.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...c.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...c.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...c.filter(e=>e.destructive)],ue=T.length>de&&!l,pe=P.trim().toLowerCase(),y=ue&&pe.length>0?T.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(pe)):null,U=y??(Ve||l?T:T.slice(0,de)),ce=y?0:T.length-U.length,R=[];for(let e of U){let i=!l&&e.provider==="invariant",t=!l&&!i&&e.pinned!==void 0&&!e.destructive,g=!l&&!i&&!t&&e.ties===!0&&!e.destructive,H=i?e.why:t?"pinned":g?"its ties":null,Qe=i?"violation":t||g?"ties":null,V=R[R.length-1];V&&V.heading===H?V.items.push(e):R.push({heading:H,tone:Qe,items:[e]})}let _=c.find(e=>e.id===C),E=s.length===1?x(o,s[0]):null,ge=e=>{if(!E)return e;let i=e.startsWith(`"${E}"`)?e.slice(E.length+2):e.startsWith(E)?e.slice(E.length):null;if(i===null)return e;let t=i.trimStart();return t.length===0?e:t[0].toUpperCase()+t.slice(1)},Ke=new Set(l?[]:U.filter(e=>e.provider==="invariant").map(e=>e.why)),M=G.filter(e=>!Ke.has(e.text)).map(e=>({...e,text:ge(e.text)}));return Ye?null:(0,n.jsxs)("section",{...l?oe.pane:{},ref:e=>{p.current=e,l&&oe.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":l?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>w(e.target),onBlur:e=>{e.relatedTarget!==null&&(k.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...l?be:{position:"absolute",zIndex:fe("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...l?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:le?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:h.overview?"min(296px, 38cqh)":44,width:236,maxHeight:h.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,n.jsx)("h2",{style:{...ke,margin:0},children:"Inspector"}),(0,n.jsxs)("div",{style:{display:se||!l?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:l?0:24},children:[se?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:r?.title??(s.length===1?x(o,s[0]):`${s.length} selected`)}),I.length>0||u?(0,n.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:u?"relation":I.map(e=>L(o.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,s.length===1&&!u&&r?.face!=="pages"?(0,n.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:h.expanded.includes(s[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,n.jsx)("span",{style:{flex:"1 1 auto"}})]}),l?null:(0,n.jsx)("button",{type:"button",onClick:()=>{f(null),Oe()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),u&&j?(0,n.jsxs)("div",{style:{display:"grid",gap:6},children:[ae?(0,n.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:ae}):null,re?(0,n.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:Te(re)}):null,(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",j.from],["to",j.to]].map(([e,i],t)=>(0,n.jsxs)(a.Fragment,{children:[t===1?(0,n.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,n.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>De([i.id]),title:`Select ${x(o,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:x(o,i.id)}):(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!u&&s.length===1&&me(o,s[0])?(0,n.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,M.length>0?(0,n.jsx)("div",{"data-testid":"observations",title:M.map(e=>e.text).join(`
|
|
2
|
+
`),style:{display:"grid",gap:3},children:M.slice(0,2).map(e=>(0,n.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===M[1]&&M.length>2?(0,n.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",M.length-2]}):null]},e.id))}):null,l?J.start.map(e=>(0,n.jsx)(Ie,{section:e,close:()=>f(null)},e.id)):null,ne?(0,n.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:ne}):null,ue?(0,n.jsx)("input",{"data-testid":"action-filter",value:P,onChange:e=>$(e.target.value),placeholder:`Filter ${T.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),P.length>0?$(""):e.currentTarget.blur();return}if(e.key==="Enter"&&y?.length===1){let i=y[0];if(i.destructive)return;i.open.length>0?z(i.id):B(i)&&$("")}},style:{font:"inherit",fontSize:"0.875rem",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,y!==null&&y.length===0?(0,n.jsxs)("p",{"data-testid":"no-matches",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing offered here matches \u201C",P.trim(),"\u201D."]}):null,c.length===0&&!X&&s.length===0?null:c.length===0&&!X?(0,n.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:m.length>0?`Nothing you may do with ${u?"this relation":b.length===1?K(L(o.schema.tryDefinition(b[0]),b[0])):"this mix of kinds"} \u2014 ${m.length} action${m.length===1?"":"s"} withheld.`:u?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${Se(o.schema,o.graph.getNode(u.from)?.kind??"",u.kind,"out")}\u201D.`:`Nothing can be done with ${b.length===1?K(L(o.schema.tryDefinition(b[0]),b[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${b.length===1?"it":"them"}.`}):(0,n.jsxs)("ol",{"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[R.map((e,i)=>(0,n.jsxs)(a.Fragment,{children:[e.heading?(0,n.jsxs)("li",{"data-graview-heading":e.tone,style:{fontSize:"0.75rem",lineHeight:1.4,color:e.tone==="violation"?"var(--graview-warn)":"var(--graview-ink-faint)",...e.tone!=="violation"?{letterSpacing:"0.12em",textTransform:"uppercase",fontSize:"0.75rem"}:{},padding:"2px 2px 1px",marginTop:i>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?ge(e.heading):e.heading]}):i>0?(0,n.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(t=>(0,n.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},children:[(0,n.jsxs)("button",{type:"button","data-affordance":t.id,"data-rank":t.rank,"data-graview-destructive":t.destructive||void 0,"aria-pressed":C===t.id,title:t.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:C===t.id?"var(--graview-accent)":l?"transparent":"var(--graview-edge)",background:l?"none":"var(--graview-panel)",boxShadow:"none",...t.destructive?{color:"var(--graview-warn)"}:{},...C===t.id?{color:"var(--graview-accent)"}:{}},onClick:()=>{if(t.open.length>0){z(C===t.id?null:t.id);return}B(t)},children:[t.label,t.open.length>0?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,y?.length===1&&y[0]?.id===t.id&&!t.destructive?(0,n.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,n.jsx)("button",{type:"button","data-testid":"pin-toggle","data-pin-for":t.mutation,"aria-pressed":t.pinned!==void 0,"aria-label":t.pinned!==void 0?`Unpin ${t.label}`:`Pin ${t.label}`,title:t.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":t.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>Fe($e(N,t.mutation,Be.has(t.mutation))),style:{flex:"0 0 auto",width:24,minHeight:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.75rem",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7,color:t.pinned==="user"?"var(--graview-accent)":t.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:t.pinned!==void 0?"\u2605":"\u2606"})]},t.id))]},`${e.heading??"plain"}-${i}`)),ce>0?(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",onClick:()=>Z(!0),title:`Show all ${c.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",ce," more"]})}):null]}),m.length>0?(0,n.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[m.slice(0,l||ee?m.length:3).map(e=>(0,n.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,n.jsx)("button",{type:"button",disabled:!0,"data-affordance":e.id,"data-rank":e.rank,"data-withheld":e.refusal.wouldNeed.join(",")||"nobody",style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8,borderStyle:"dashed",width:"100%",textAlign:"left",background:"none"},children:(0,n.jsx)("s",{children:e.label})}),(0,n.jsx)("span",{"data-testid":"withheld-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:e.refusal.message})]},e.id)),!l&&!ee&&m.length>3?(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>te(!0),title:`Show all ${m.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",m.length-3," more withheld"]})}):null]}):null,l?J.end.map(e=>(0,n.jsx)(Ie,{section:e,close:()=>f(null)},e.id)):null,_?(0,n.jsx)(ze,{affordance:_,onApply:e=>{if(B(_,e))z(null);else return q.current},onCancel:()=>z(null)}):null]})}function Ie({section:d,close:o}){return(0,n.jsxs)("div",{"data-menu-section":d.id,...d.heading?{role:"group","aria-label":d.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[d.heading?(0,n.jsx)("p",{"aria-hidden":"true",style:{margin:0,padding:"2px 2px 1px",fontSize:"0.75rem",lineHeight:1.4,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:d.heading}):null,d.items&&d.items.length>0?(0,n.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:d.items.map(r=>(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-menu-item":r.id,onClick:()=>{o(),r.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},children:[r.label,r.hint?(0,n.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",r.hint]}):null]})},r.id))}):null,d.render?.(o)]})}export{dt as InspectorPane};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{d as $}from"./chunk.SYAEBGDC.js";import{a as C}from"./chunk.XANVHJQ4.js";import{g as M}from"./chunk.B2GLDIAS.js";import{X as k,Y as v,_ as j,jb as x}from"./chunk.MNP4JI33.js";function N(a,s){let c=a.tryDefinition(s),r=Object.keys(c?.fields?.shape??{}),m=[c?.lifecycle?.field,...r.filter(l=>/^(status|stage|state|phase)$/i.test(l))].filter(l=>l!==void 0&&r.includes(l));return[...new Set(m)].slice(0,1)}function P(a,s){return a.tryDefinition(s)?.fieldRoles?.title??"label"}function V(a,s,c={}){let r=s.map(e=>a.graph.getNode(e)).filter(e=>e!==void 0);if(r.length===0)return{acts:[],withheld:[]};let u=c.principal??{kind:"human"},m=C(a,r.map(e=>e.id),{...c.derive,principal:u,...c.context?{context:c.context}:{}}),l=new Map(a.allMutations().map(e=>[e.name,e])),g=[...new Set(r.map(e=>e.kind))],p=new Set(g.map(e=>P(a.schema,e))),h=new Set(m.affordances.filter(e=>e.provider==="schema").map(e=>e.mutation)),o=e=>{let n=l.get(e.mutation);if(!n?.subject)return;let t=r.length===1&&e.provider==="invariant"&&!h.has(e.mutation)&&e.args[n.subject.arg]===r[0].id;if(!(e.provider!=="schema"&&!t)&&!(r.length>1&&e.batch?.length!==r.length)&&n.derived?.act!=="edit"&&!e.open.some(i=>p.has(i.name)))return n},y=[],b=new Set;for(let e of m.affordances){let n=o(e);if(!n||b.has(n.name))continue;b.add(n.name);let{[n.subject.arg]:t,...i}=e.args;y.push({id:e.id,label:v(n),mutation:n.name,subject:n.subject.arg,args:i,open:e.open,...e.destructive||e.setsAside?{more:!0}:{},...e.destructive?{destructive:!0}:{},affordance:{...e,label:v(n)}})}if(g.length===1){let e=g[0];for(let n of N(a.schema,e))for(let t of $(a.schema,[...l.values()],e,n)){if(t.by==="none"||r.every(d=>d[n]===t.value))continue;let i=r.find(d=>d[n]!==t.value),f=t.acts.find(d=>{let D=t.by==="step"?{[d.subject.arg]:i.id}:{[d.subject.arg]:i.id,[n]:t.value};return a.permits({name:d.name,args:D},u).ok});if(!f)continue;let w=t.by==="step"?{}:{[n]:t.value};if(t.by==="step"&&y.some(d=>d.mutation===f.name))continue;let R=t.by==="step"?v(f):`Move to ${t.label}`,O=`set:${n}:${t.value}`;y.push({id:O,label:R,mutation:f.name,subject:f.subject.arg,args:w,open:[],affordance:{id:O,label:R,provider:"schema",mutation:f.name,args:{[f.subject.arg]:i.id,...w},open:[],score:0,why:`every one is ${e}`,nodeIds:r.map(d=>d.id)}})}}let S=[...y.filter(e=>!e.more),...y.filter(e=>e.more)],A=m.withheld.filter(e=>{let n=l.get(e.mutation);return n?.subject!==void 0&&n.derived?.act!=="edit"&&(r.length===1||e.batch?.length===r.length)}).map(e=>({label:v(l.get(e.mutation)),message:e.refusal.message}));return{acts:S,withheld:A}}function _(a,s,c,r={}){let u=r.author,m=a.allMutations().find(e=>e.name===s.mutation),l=e=>M(a.schema,a.allMutations(),e),g=e=>{let n=a.graph.getNode(e);return n?k(a.schema.tryDefinition(n.kind),n):e},p=[],h=[],o=[];for(let e of[...new Set(c)]){let n={name:s.mutation,args:{...s.args,[s.subject]:e}};if(!m){p.push({id:e,label:g(e),message:`There is no act \u201C${s.mutation}\u201D.`,reason:"invalid"});continue}let t=a.permits(n,u);if(!t.ok){p.push({id:e,label:g(e),message:t.refusal.message,reason:"forbidden"});continue}if(!a.wouldChange(n,u)){h.push(e);continue}o.push({id:e,call:n})}let y=e=>a.previewAll(e,{...u?{author:u}:{},...r.context?{context:r.context}:{}});for(let e=0;o.length>0;e+=1)try{y(o.map(n=>n.call));break}catch(n){let t=[];for(let i of o)try{y([i.call]),t.push(i)}catch(f){p.push({id:i.id,label:g(i.id),message:l(f),reason:x(f).reason})}if(t.length===o.length||e>o.length){for(let i of t)p.push({id:i.id,label:g(i.id),message:l(n),reason:x(n).reason});o=[];break}o=t}if(o.length===0)return{applied:[],unchanged:h,refused:p};let b=s.label??(m?v(m):s.mutation),S=[...new Set(o.map(e=>a.graph.getNode(e.id)?.kind))],A=`${b} \u2014 ${S.length===1&&S[0]?j(a.schema,S[0],o.length):`${o.length} records`}`;try{let e=a.applyAll(o.map(n=>n.call),{intent:A,...u?{author:u}:{},...r.via?{via:r.via}:{}});return{batch:e.batch,intent:A,applied:o.map(n=>n.id),unchanged:h,refused:p,result:e}}catch(e){let n=l(e),t=x(e).reason;return{applied:[],unchanged:h,refused:[...p,...o.map(i=>({id:i.id,label:g(i.id),message:n,reason:t}))],allOrNothing:!0}}}export{V as a,_ as b};
|
|
@@ -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{b as j}from"./chunk.GYICGZMG.js";import{a as _,b as de,e as pe,f as ue,g as me}from"./chunk.SHTJZ6UX.js";import{b as le}from"./chunk.ULRW47RP.js";import{n as B}from"./chunk.XMC7YDWT.js";import{i as x,j as re,k as ie,q as oe,r as se}from"./chunk.B2GLDIAS.js";import{d as ne,e as ae}from"./chunk.6YCBYL2Y.js";import{b as ee,f as te}from"./chunk.UGFJKSHU.js";import{$ as U,F as fe,Q as X,Y as O,Z as Y,a as Q,xa as Z}from"./chunk.6QWV5MVH.js";import{Z as W,ca as J}from"./chunk.MNP4JI33.js";import{b as D}from"./chunk.AJZBJBMO.js";var p=D(fe(),1);var he=Z(Q(()=>(__graviewPreload(import.meta.url,["./chunk.3HXN4BOY.js","./chunk.GYICGZMG.js","./chunk.SHTJZ6UX.js","./chunk.WVUJXDXZ.js","./chunk.ULRW47RP.js","./chunk.PBSMLINK.js","./chunk.3TY5NFLY.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.GZHZLJBF.js","./chunk.XMC7YDWT.js","./chunk.6UGEYZAC.js","./chunk.OJGHDWI6.js","./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.CX3KL2C5.js")))),ce=he.part((i,a)=>i.drawAppLink(a),{quiet:!0});var e=D(X(),1);function G({nodeId:i,field:a,value:l,stored:s=l,said:c}){let{fields:m,commit:o}=B(i),t=m.find(r=>r.field===a),{store:y,principal:E}=O(),u=y.graph.getNode(i)?.kind,g=y.schema.definitions.find(r=>r.kind===u),k=J(g,a),b=k.toLowerCase(),n=c??`${k.charAt(0).toUpperCase()}${k.slice(1)}: ${l}`,[w,I]=(0,p.useState)(!1),d=t?.shape.type==="number"?t.shape.amount:void 0,f=d&&s!==""&&Number.isFinite(Number(s))?re(Number(s),d):s,[v,M]=(0,p.useState)(f),C=(0,p.useRef)(null),K=(0,p.useRef)(null),z=(0,p.useRef)(!1),S=r=>{z.current=r,I(!1)};(0,p.useEffect)(()=>M(f),[f,w]);let q=t?.shape.type==="date";if((0,p.useEffect)(()=>{q&&me()},[q]),(0,p.useEffect)(()=>{w?C.current?.focus():z.current&&(z.current=!1,K.current?.focus())},[w]),!t)return(0,e.jsx)("span",{"data-graview-field":a,"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${b}`,style:{color:"var(--graview-ink)",cursor:"default",overflowWrap:"anywhere"},children:l});if(!w)return(0,e.jsx)("button",{ref:K,type:"button","data-graview-field":a,"data-graview-editable":t.mutation,...n===l?{}:{"aria-label":n},title:`${t.title} \u2014 changes the ${b}, and can be undone`,onClick:()=>I(!0),style:{all:"unset",cursor:"text",display:"inline-flex",alignItems:"flex-end",minHeight:24,minWidth:24,maxWidth:"100%",overflowWrap:"anywhere",paddingBottom:1,borderBottom:"1px dashed var(--graview-edge-bright)",color:"var(--graview-ink)"},children:l});let R=(r,{left:h=!1}={})=>{S(!h),!(r===s||r===""||r===void 0)&&(t.shape.type==="date"&&typeof r=="string"&&ge(r)||o(t,r))},ge=r=>{if(t.shape.type!=="date")return!1;let h=m.filter(L=>L.shape.type==="date"&&L.takesValue),T=se(h.map(L=>L.field),g?.fieldRoles??{}),A=T?.start===a?h.find(L=>L.field===T.end):void 0,N=y.graph.getNode(i)?.[T?.end??""];if(!A||typeof N!="string")return!1;let F=oe(s===""?void 0:s,r,N,{time:t.shape.time===!0,instant:t.shape.instant===!0});if(F===void 0||F===N)return!1;let $=t.call(r),V=A.call(F);return y.applyAll($.name===V.name?[{name:$.name,args:{...$.args,...V.args}}]:[$,V],{author:E}),!0};if(!t.takesValue){let r=[t,...t.alternatives];return(0,e.jsx)("span",{role:"group","aria-label":`Change ${W(a).toLowerCase()}`,"data-graview-field":a,style:{display:"inline-flex",gap:6,alignItems:"center",flexWrap:"wrap"},onKeyDown:h=>{h.key==="Escape"&&S(!0)},children:r.map((h,T)=>(0,e.jsx)("button",{type:"button",ref:T===0?C:void 0,"data-graview-act":h.mutation,onClick:()=>{S(!0),o(h,void 0)},onBlur:A=>{let H=A.relatedTarget;(!H||!A.currentTarget.parentElement?.contains(H))&&S(!1)},style:{padding:"2px 9px",fontSize:"0.8125rem",borderRadius:999},children:h.title},h.mutation))})}return(0,e.jsxs)("form",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,maxWidth:"100%"},onSubmit:r=>{r.preventDefault(),R(ye(t,v))},children:[t.shape.type==="choice"?(0,e.jsx)("select",{ref:C,"aria-label":W(a),"data-graview-field":a,value:v,onChange:r=>R(r.target.value),onBlur:()=>S(!1),style:{font:"inherit",fontSize:"inherit"},children:t.shape.options.map(r=>(0,e.jsx)("option",{value:r,children:ee(g,a,r)},r))}):t.shape.type==="date"?(0,e.jsx)(ue,{inputRef:C,label:W(a),value:v===""?void 0:v,time:t.shape.time===!0,instant:t.shape.instant===!0,onChange:r=>M(r??""),onLeave:r=>R(r,{left:!0}),onCancel:()=>S(!0),autoSelect:!0,boxStyle:{fontSize:"inherit",minHeight:24,padding:"0 3px"}}):(0,e.jsxs)(e.Fragment,{children:[d&&x(d).prefix?(0,e.jsx)("span",{"aria-hidden":"true",children:x(d).prefix}):null,(0,e.jsx)("input",{ref:C,"aria-label":d?`${W(a)}, ${x(d).hint}`:W(a),"data-graview-field":a,...d?{inputMode:"decimal",placeholder:x(d).placeholder,"data-graview-amount":d.format??"unit"}:{},type:d?"text":t.shape.type==="number"&&!t.shape.duration?"number":"text",...t.shape.type==="number"&&t.shape.duration?{placeholder:"1h 30m"}:{},...t.shape.type==="text"&&t.shape.holds==="phone"?{inputMode:"tel",autoComplete:"tel"}:{},...t.shape.type==="number"&&t.shape.min!==void 0&&!d?{min:t.shape.min}:{},...t.shape.type==="number"&&t.shape.max!==void 0&&!d?{max:t.shape.max}:{},...t.shape.type==="number"&&t.shape.step!==void 0&&!d?{step:t.shape.step}:{},value:v,onChange:r=>M(r.target.value),onBlur:()=>R(ye(t,v),{left:!0}),onKeyDown:r=>{r.key==="Escape"&&S(!0)},style:{font:"inherit",fontSize:"inherit",width:`min(${Math.max(6,v.length+1)}ch, 100%)`,maxWidth:"100%",minWidth:0,boxSizing:"border-box",minHeight:24,display:"inline-flex",alignItems:"center",padding:"0 3px"}}),d&&x(d).suffix?(0,e.jsx)("span",{"aria-hidden":"true",children:x(d).suffix}):null]}),t.open.length>0?(0,e.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["also needs ",t.open.map(r=>r.name).join(", ")]}):null]})}function ye(i,a){return i.shape.type==="number"&&i.shape.amount?ie(a,i.shape.amount):i.shape.type==="number"?i.shape.duration?te(a)??a:Number(a):i.shape.type==="text"&&i.shape.holds?a.trim():a}function ke({href:i,field:a,value:l,stored:s,nodeId:c}){let m=i.startsWith("tel:"),o=(t,y)=>(0,e.jsx)("a",{href:i,"data-graview-link":a,...y?{"aria-label":y}:{},...m?{}:{target:"_blank",rel:"noopener noreferrer"},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,maxWidth:"100%",overflowWrap:"anywhere",color:"var(--graview-accent)"},children:t});return c===void 0?o(l):(0,e.jsxs)("span",{style:{display:"inline-flex",flexWrap:"wrap",alignItems:"center",gap:"0 10px",maxWidth:"100%"},children:[(0,e.jsx)(G,{nodeId:c,field:a,value:l,...s===void 0?{}:{stored:s}}),o(m?"Call":"Map",m?`Call ${l}`:`Open ${l} in maps`)]})}function Ve({id:i,hide:a=[],limit:l=10,labels:s={},shown:c=[]}){let{store:m}=O(),o=U(i);if(!o)return null;let t=m.schema.tryDefinition(o.kind),y=ne(o,t,{limit:l,said:c}).filter(u=>!a.includes(u.key)),E=le(t).length>0;return y.length===0&&!E?null:(0,e.jsxs)("div",{"data-graview-fields":o.id,style:{display:"grid",gap:14,alignContent:"start",minWidth:0,fontSize:"0.875rem"},children:[ae(t,y).map((u,g)=>{let k=(0,e.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto 1fr",gap:"5px 16px",alignContent:"start",minWidth:0},children:u.fields.map(n=>n.files?(0,e.jsx)(_,{as:"field",nodeId:o.id,field:n.key,label:s[n.key]??n.label,files:n.files,labelStyle:P,style:{marginTop:6}},n.key):n.long?(0,e.jsx)(be,{nodeId:o.id,field:n.key,label:s[n.key]??n.label,value:n.value,markdown:n.markdown,labelStyle:P,style:{gridColumn:"1 / -1",marginTop:6}},n.key):(0,e.jsxs)("div",{style:{display:"contents"},children:[(0,e.jsx)("dt",{style:{...P,whiteSpace:"nowrap"},children:s[n.key]??n.label}),(0,e.jsxs)("dd",{style:{margin:0,minWidth:0},children:[n.linked?(0,e.jsx)(de,{relation:n.linked.relation,refs:n.linked.refs,nodeId:o.id,field:n.key}):n.app?(0,e.jsx)(ce,{address:n.app,as:"record",nodeId:o.id,field:n.key}):n.href?(0,e.jsx)(ke,{href:n.href,field:n.key,value:n.value,stored:n.stored,nodeId:o.id}):(0,e.jsx)(G,{nodeId:o.id,field:n.key,value:n.value,stored:n.stored}),n.repeats?(0,e.jsx)(pe,{nodeId:o.id,field:n.key,start:o[n.key],value:o[`${n.key}Repeat`],label:`${s[n.key]??n.label} repeats`}):null]})]},n.key))});if(!u.title)return(0,e.jsx)("div",{children:k},g);let b=`graview-field-group-${o.id}-${g}`;return(0,e.jsxs)("div",{role:"group","aria-labelledby":b,style:{display:"grid",gap:6,minWidth:0},children:[(0,e.jsx)("p",{id:b,"data-graview-field-group":u.title,style:ve,children:u.title}),k]},g)}),E?(0,e.jsx)(_,{as:"unfilled",nodeId:o.id,skip:a,labels:s,labelStyle:P}):null]})}var P={color:"var(--graview-ink-faint)",fontSize:"0.8125rem"},ve={margin:0,fontSize:"0.75rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)",fontWeight:560};function be(i){return Y()?(0,e.jsx)(Se,{...i}):(0,e.jsx)(we,{...i})}function we({field:i,label:a,value:l,labelStyle:s,valueStyle:c,style:m,markdown:o}){return(0,e.jsxs)("div",{"data-graview-long":i,style:{display:"grid",gap:6,minWidth:0,...m},children:[(0,e.jsx)("dt",{style:s,children:a}),(0,e.jsx)("dd",{style:{margin:0,minWidth:0,...c},children:(0,e.jsx)("div",{"data-graview-field":i,children:(0,e.jsx)(j,{text:l,markdown:o})})})]})}function Se({nodeId:i,field:a,label:l,value:s,labelStyle:c,valueStyle:m,style:o,markdown:t}){let{fields:y,commit:E}=B(i),u=y.find(f=>f.field===a&&f.takesValue),[g,k]=(0,p.useState)(!1),b=(0,p.useRef)(null),n=(0,p.useRef)(!1);(0,p.useEffect)(()=>{!g&&n.current&&(n.current=!1,b.current?.focus())},[g]);let w=f=>{n.current=f,k(!1)},I=l.toLowerCase(),d=(0,e.jsx)(j,{text:s,markdown:t});return(0,e.jsxs)("div",{"data-graview-long":a,style:{display:"grid",gap:6,minWidth:0,...o},children:[(0,e.jsxs)("dt",{style:{display:"flex",alignItems:"baseline",gap:10,...c},children:[(0,e.jsx)("span",{children:l}),u&&!g?(0,e.jsx)("button",{ref:b,type:"button","data-graview-editable":u.mutation,"aria-label":`Edit the ${I}`,title:`${u.title} \u2014 changes the ${I}, and can be undone`,onClick:()=>k(!0),style:Ee,children:"Edit"}):null]}),(0,e.jsx)("dd",{style:{margin:0,minWidth:0,...m},children:g&&u?(0,e.jsx)(p.Suspense,{fallback:d,children:(0,e.jsx)(xe,{field:a,label:l,value:s,...t?{markdown:!0}:{},onCancel:()=>w(!0),onSave:(f,v)=>{w(!v),f!==s&&E(u,f)}})}):(0,e.jsx)("div",{"data-graview-field":a,...u?{}:{"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${I}`},...u?{onClick:()=>k(!0)}:{},style:{cursor:u?"text":"default",minWidth:0},children:d})})]})}var xe=(0,p.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.GYICGZMG.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.3TVXGJTU.js"))),Ee={all:"unset",cursor:"pointer",fontSize:"0.75rem",letterSpacing:"normal",textTransform:"none",color:"var(--graview-accent)",borderBottom:"1px dashed currentColor",minHeight:24,minWidth:24,display:"inline-flex",alignItems:"flex-end"};function De({nodeId:i,children:a}){let{fields:l}=B(i),s=U(i);if(!s)return(0,e.jsx)(e.Fragment,{children:a});let c=l.find(m=>{let o=s[m.field];return typeof o=="string"&&o===a});return c?(0,e.jsx)(G,{nodeId:i,field:c.field,value:a,said:a}):(0,e.jsx)(e.Fragment,{children:a})}export{ce as a,G as b,ke as c,Ve as d,be as e,De as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{m as y}from"./chunk.JOOQUWLT.js";import{F as N,Q as u,S as f}from"./chunk.6QWV5MVH.js";import{b as g}from"./chunk.AJZBJBMO.js";var p=g(N(),1);var n=g(u(),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,a]=(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);a(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 a=e.scrollHeight>e.clientHeight+1,r=e.scrollWidth>e.clientWidth+1;return{overflowing:a||r,above:a&&e.scrollTop>1,below:a&&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:a,children:r}){if(e===void 0)return(0,n.jsx)("strong",{style:a,...l?{}:{"aria-hidden":!0},children:r});let t=`h${e}`;return(0,n.jsx)(t,{style:{margin:0,...a},children:r})}function E({title:e,subtitle:l,meta:a,selected:r,tone:t="default",children:d,style:i,fit:s=!1,variant:h,heading:w}){let c=(0,p.useRef)(null),{overflowing:b,above:x,below:S}=H(c),P=f(),o=(h??(P==="fullscreen"?"page":"card"))==="page",k=(0,p.useContext)(A),v=(0,p.useContext)(I);return(0,n.jsxs)("div",{"data-graview-primitive":"panel","data-graview-variant":o?"page":"card","data-selected":r||void 0,style:{display:"flex",flexDirection:"column",gap:o?12:"var(--graview-gap, 7px)",height:o||s?"auto":"100%",maxHeight:o?"none":"100%",padding:o?0:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:o?0:"var(--graview-radius, 12px)",border:o?"none":`1px solid ${r?"var(--graview-accent, #2f6f5e)":"var(--graview-edge, #e4e0d8)"}`,boxShadow:o?"none":r?"0 0 0 1px var(--graview-accent-dim), var(--graview-lift-low)":"var(--graview-lift-low)",overflow:o?"visible":"hidden",...R[t],...o?{background:"transparent"}:{},...i},children:[t==="warning"?(0,n.jsx)("span",{"data-graview-broken":"",style:y,children:"Implicated in a problem."}):null,e===void 0||e===k?null:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0},children:[t==="warning"?(0,n.jsx)("span",{"aria-hidden":"true",title:"Implicated in a problem",style:{color:"var(--graview-warn)",flex:"0 0 auto"},children:"\u26A0"}):null,(0,n.jsx)(O,{level:w,said:v===null||e!==v,style:{fontFamily:"var(--graview-font-display, inherit)",fontSize:o?"1.5625rem":"0.9375rem",lineHeight:o?1.15:1.25,fontWeight:o?600:560,letterSpacing:o?"-0.012em":"0.005em",minWidth:0,overflowWrap:"anywhere"},children:e}),a===void 0?null:(0,n.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",letterSpacing:"0.08em",textTransform:"uppercase",minWidth:0,overflowWrap:"anywhere",...C},children:a})]}),l===void 0?null:(0,n.jsx)("div",{style:{fontSize:o?"0.90625rem":"0.8125rem",lineHeight:1.5,...T},children:l}),(0,n.jsx)("div",{ref:c,className:o?void 0:"graview-scroll",...b&&!o?{tabIndex:0,role:"region",...typeof e=="string"?{"aria-label":e}:{}}:{},style:{display:"flex",flexDirection:"column",gap:o?22:"var(--graview-gap, 7px)",flex:"1 1 auto",...o?{overflow:"visible"}:{marginBottom:"calc(-1 * var(--graview-pad, 15px))",paddingBottom:"var(--graview-pad, 15px)"}},"data-graview-more-above":x&&!o?"":void 0,"data-graview-more-below":S&&!o?"":void 0,children:d})]})}function m({label:e,hue:l,selected:a,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,n.jsxs)("span",{"data-graview-primitive":"chip","data-selected":a||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 ${a?"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:a?"0 0 14px -4px var(--graview-accent)":void 0},children:[s===void 0?null:(0,n.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,n.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function L({items:e,max:l=8,selectedIds:a=[],pick:r=!1}){let t=e.slice(0,l),d=e.length-t.length;return(0,n.jsxs)("div",{"data-graview-primitive":"roster",style:{display:"flex",flexWrap:"wrap",gap:6,alignContent:"flex-start"},children:[t.map(i=>(0,n.jsx)(m,{label:i.label,...i.hue===void 0?{}:{hue:i.hue},...r?{pickId:i.id}:{},...i.emphasis===void 0?{}:{emphasis:i.emphasis},selected:a.includes(i.id)},i.id)),d>0?(0,n.jsx)(m,{label:`+${d} more`}):null]})}function F({label:e,count:l,items:a,onExpand:r,flagged:t,problems:d}){return(0,n.jsx)(E,{title:e,meta:d?(0,n.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[d,(0,n.jsx)("span",{children:l})]}):l,tone:t?"warning":"muted",style:r?{cursor:"zoom-in"}:void 0,children:a&&a.length>0?(0,n.jsx)(L,{items:a,max:6,pick:!0}):null})}export{A as a,I as b,E as c,m as d,L as e,F as f};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import{a as xt,d as Pt,e as re}from"./chunk.63GXY2ME.js";import{k as Et}from"./chunk.67TPUXAY.js";import{g as pt}from"./chunk.LR3VDXPI.js";import{a as ft}from"./chunk.CWHRDBOF.js";import{d as mt}from"./chunk.6YCBYL2Y.js";import{d as ht}from"./chunk.UGFJKSHU.js";import{F as St,G as bt,i as dt,j as Lr,o as yt,p as gt,s as vt,t as Rt,u as wt}from"./chunk.JOOQUWLT.js";import{F as O,N as ut,Q as Z,Z as ct}from"./chunk.6QWV5MVH.js";import{Ac as at,Bc as nt,Cc as ot,La as et,Qc as it,Rc as lt,Sc as st,Ub as tt,Z as be,aa as le,dc as rt}from"./chunk.MNP4JI33.js";import{b as D}from"./chunk.AJZBJBMO.js";function Dr(e,t){return at(e,t).slice(1)}function Ee(e,t){return e.kinds.find(r=>Dr(e,r)===t)}function Rn(e,t,r){return nt(e,t,r)}function wn(e,t){return ot(e,t)}var A=D(O(),1),g=D(O(),1),E=D(O(),1),ze=D(O(),1),lr=D(O(),1),b=D(O(),1),Xa=D(O(),1),Qa=D(O(),1),Za=D(O(),1),v=D(O(),1),Rr=D(O(),1);var Te=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Ot=/^[\\/]{2}/;function Fr(e,t){return t+e.replace(/\\/g,"/")}var Ct="popstate";function fe(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function At(e={}){let{initialEntries:t=["/"],initialIndex:r,v5Compat:a=!1}=e,n;n=t.map((f,y)=>c(f,typeof f=="string"?null:f.state,y===0?"default":void 0,typeof f=="string"?void 0:f.mask));let o=s(r??n.length-1),i="POP",l=null;function s(f){return Math.min(Math.max(f,0),n.length-1)}function u(){return n[o]}function c(f,y=null,m,h){let S=he(n?u().pathname:"/",f,y,m,h);return T(S.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(f)}`),S}function d(f){return typeof f=="string"?f:z(f)}return{get index(){return o},get action(){return i},get location(){return u()},createHref:d,createURL(f){return new URL(d(f),"http://localhost")},encodeLocation(f){let y=typeof f=="string"?V(f):f;return{pathname:y.pathname||"",search:y.search||"",hash:y.hash||""}},push(f,y){i="PUSH";let m=fe(f)?f:c(f,y);o+=1,n.splice(o,n.length,m),a&&l&&l({action:i,location:m,delta:1})},replace(f,y){i="REPLACE";let m=fe(f)?f:c(f,y);n[o]=m,a&&l&&l({action:i,location:m,delta:0})},go(f){i="POP";let y=s(o+f),m=n[y];o=y,l&&l({action:i,location:m,delta:f})},listen(f){return l=f,()=>{l=null}}}}function _t(e={}){function t(a,n){let o=n.state?.masked,{pathname:i,search:l,hash:s}=o||a.location;return he("",{pathname:i,search:l,hash:s},n.state&&n.state.usr||null,n.state&&n.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,n){return typeof n=="string"?n:z(n)}return Tr(t,r,null,e)}function P(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function T(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function kr(){return Math.random().toString(36).substring(2,10)}function Lt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function he(e,t,r=null,a,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?V(t):t,state:r,key:t&&t.key||a||kr(),mask:n}}function z({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function V(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function Tr(e,t,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,l="POP",s=null,u=c();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function c(){return(i.state||{idx:null}).idx}function d(){l="POP";let h=c(),S=h==null?null:h-u;u=h,s&&s({action:l,location:m.location,delta:S})}function p(h,S){l="PUSH";let R=fe(h)?h:he(m.location,h,S);r&&r(R,h),u=c()+1;let w=Lt(R,u),L=m.createHref(R.mask||R);try{i.pushState(w,"",L)}catch(x){if(x instanceof DOMException&&x.name==="DataCloneError")throw x;n.location.assign(L)}o&&s&&s({action:l,location:m.location,delta:1})}function f(h,S){l="REPLACE";let R=fe(h)?h:he(m.location,h,S);r&&r(R,h),u=c();let w=Lt(R,u),L=m.createHref(R.mask||R);i.replaceState(w,"",L),o&&s&&s({action:l,location:m.location,delta:0})}function y(h){return Nr(n,h)}let m={get action(){return l},get location(){return e(n,i)},listen(h){if(s)throw new Error("A history only accepts one active listener");return n.addEventListener(Ct,d),s=h,()=>{n.removeEventListener(Ct,d),s=null}},createHref(h){return t(n,h)},createURL:y,encodeLocation(h){let S=y(h);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:p,replace:f,go(h){return i.go(h)}};return m}function Nr(e,t,r=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),P(a,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:z(t);return n=n.replace(/ $/,"%20"),!r&&Ot.test(n)&&(n=a+n),new URL(n,a)}var Mr;Mr=new WeakMap;function Ne(e,t,r="/"){return Or(e,t,r,!1)}function Or(e,t,r,a,n){let o=typeof t=="string"?V(t):t,i=U(o.pathname||"/",r);if(i==null)return null;let l=n??_r(e),s=null,u=Jr(i);for(let c=0;s==null&&c<l.length;++c)s=Vr(l[c],u,a);return s}function Ar(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function _r(e){let t=$t(e);return $r(t),t}function $t(e,t=[],r=[],a="",n=!1){let o=(i,l,s=n,u)=>{let c={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(c.relativePath.startsWith("/")){if(!c.relativePath.startsWith(a)&&s)return;P(c.relativePath.startsWith(a),`Absolute route path "${c.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(a.length)}let d=I([a,c.relativePath]),p=r.concat(c);i.children&&i.children.length>0&&(P(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),$t(i.children,t,p,d,s)),!(i.path==null&&!i.index)&&t.push({path:d,score:Wr(d,i.index),routesMeta:p.map((f,y)=>{let[m,h]=Ut(f.relativePath,f.caseSensitive,y===p.length-1);return{...f,matcher:m,compiledParams:h}})})};return e.forEach((i,l)=>{if(i.path===""||!i.path?.includes("?"))o(i,l);else for(let s of It(i.path))o(i,l,!0,s)}),t}function It(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=It(a.join("/")),l=[];return l.push(...i.map(s=>s===""?o:[o,s].join("/"))),n&&l.push(...i),l.map(s=>e.startsWith("/")&&s===""?"/":s)}function $r(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Yr(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Ir=/^:[\w-]+$/,Hr=3,Ur=2,jr=1,zr=10,Br=-2,Dt=e=>e==="*";function Wr(e,t){let r=e.split("/"),a=r.length;return r.some(Dt)&&(a+=Br),t&&(a+=Ur),r.filter(n=>!Dt(n)).reduce((n,o)=>n+(Ir.test(o)?Hr:o===""?jr:zr),a)}function Yr(e,t){return e.length===t.length&&e.slice(0,-1).every((a,n)=>a===t[n])?e[e.length-1]-t[t.length-1]:0}function Vr(e,t,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let l=0;l<a.length;++l){let s=a[l],u=l===a.length-1,c=o==="/"?t:t.slice(o.length)||"/",d={path:s.relativePath,caseSensitive:s.caseSensitive,end:u},p=s.matcher&&s.compiledParams?Ht(d,c,s.matcher,s.compiledParams):ne(d,c),f=s.route;if(!p&&u&&r&&!a[a.length-1].route.index&&(p=ne({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},c)),!p)return null;Object.assign(n,p.params),i.push({params:n,pathname:I([o,p.pathname]),pathnameBase:Gr(I([o,p.pathnameBase])),route:f}),p.pathnameBase!=="/"&&(o=I([o,p.pathnameBase]))}return i}function ne(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Ut(e.path,e.caseSensitive,e.end);return Ht(e,t,r,a)}function Ht(e,t,r,a){let n=t.match(r);if(!n)return null;let o=n[0],i=q(o,1),l=n.slice(1);return{params:a.reduce((u,{paramName:c,isOptional:d},p)=>{if(c==="*"){let y=l[p]||"";i=q(o.slice(0,o.length-y.length),1)}let f=l[p];return d&&!f?u[c]=void 0:u[c]=(f||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Ut(e,t=!1,r=!0){T(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,s,u,c)=>{if(a.push({paramName:l,isOptional:s!=null}),s){let d=c.charAt(u+i.length);return d&&d!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function Jr(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return T(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function U(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function jt(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?V(e):e,o;return r?(r=zt(r),r.startsWith("/")||r.startsWith("\\")?o=Ft(r.substring(1),"/"):o=Ft(r,t)):o=t,{pathname:o,search:Xr(a),hash:Qr(n)}}function Ft(e,t){let r=q(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function xe(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Kr(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Me(e){let t=Kr(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function ye(e,t,r,a=!1){let n;typeof e=="string"?n=V(e):(n={...e},P(!n.pathname||!n.pathname.includes("?"),xe("?","pathname","search",n)),P(!n.pathname||!n.pathname.includes("#"),xe("#","pathname","hash",n)),P(!n.search||!n.search.includes("#"),xe("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,l;if(i==null)l=r;else{let d=t.length-1;if(!a&&i.startsWith("..")){let p=i.split("/");for(;p[0]==="..";)p.shift(),d-=1;n.pathname=p.join("/")}l=d>=0?t[d]:"/"}let s=jt(n,l),u=i&&i!=="/"&&i.endsWith("/"),c=(o||i===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(u||c)&&(s.pathname+="/"),s}var zt=e=>e.replace(/[\\/]{2,}/g,"/"),I=e=>zt(e.join("/"));function q(e,t=0){let r=e.length;for(;r>t&&e.charCodeAt(r-1)===47;)r--;return r===e.length?e:e.slice(0,r)}var Gr=e=>q(e).replace(/^\/*/,"/"),Xr=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Qr=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var Bt=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Wt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Zr(e){let t=e.map(r=>r.route.path).filter(Boolean);return I(t)||"/"}var Yt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Vt(e,t){let r=e;if(typeof r!="string"||!Te.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(Yt)try{let o=new URL(window.location.href),i=Ot.test(r)?new URL(Fr(r,o.protocol)):new URL(r),l=U(i.pathname,t);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{T(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:n,to:r}}var bn=Symbol("Uninstrumented");var En=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var kt=new URL("http://localhost");function Oe(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),kt)}catch{return kt}}function Pe(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function qr(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return e.toLowerCase().startsWith(r)?t.host===""||e.slice(r.length).startsWith("//"):!1}function Ae(e,t,r,a){let n=null;try{n=e==null?null:new URL(e,r)}catch{}let o=new URL(t,r),i=n!=null&&!Pe(n,r),l=!Pe(o,r);if(a==="reject"){if(i||l)throw new Error("External navigation is not allowed")}else if(l&&(n==null||!qr(e,n)||!Pe(n,o)))throw new Error("External navigation is not allowed")}var Jt=["POST","PUT","PATCH","DELETE"],xn=new Set(Jt),ea=["GET",...Jt],Pn=new Set(ea);var Cn=Symbol("ResetLoaderData"),ta,ra,aa,na;ta=new WeakMap;ra=new WeakMap;aa=new WeakMap;na=new WeakMap;var oa=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function ia(e){try{return oa.includes(new URL(e).protocol)}catch{return!1}}var K=A.createContext(null);K.displayName="DataRouter";var ee=A.createContext(null);ee.displayName="DataRouterState";var Kt=A.createContext(!1);function la(){return A.useContext(Kt)}var _e=A.createContext({isTransitioning:!1});_e.displayName="ViewTransition";var Gt=A.createContext(new Map);Gt.displayName="Fetchers";var sa=A.createContext(null);sa.displayName="Await";var k=A.createContext(null);k.displayName="Navigation";var G=A.createContext(null);G.displayName="Location";var $=A.createContext({outlet:null,matches:[],isDataRoute:!1});$.displayName="Route";var $e=A.createContext(null);$e.displayName="RouteError";var De=!0,Xt="REACT_ROUTER_ERROR",ua="REDIRECT",ca="ROUTE_ERROR_RESPONSE";function da(e){if(e.startsWith(`${Xt}:${ua}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function fa(e){if(e.startsWith(`${Xt}:${ca}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Bt(t.status,t.statusText,t.data)}catch{}}function ge(e,{relative:t}={}){P(X(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=g.useContext(k),{hash:n,pathname:o,search:i}=te(e,{relative:t}),l=o;return r!=="/"&&(l=o==="/"?r:I([r,o])),a.createHref({pathname:l,search:i,hash:n})}function X(){return g.useContext(G)!=null}function F(){return P(X(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(G).location}function ha(){return g.useContext(G).navigationType}var Qt="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Zt(e){g.useContext(k).static||g.useLayoutEffect(e)}function Q(){let{isDataRoute:e}=g.useContext($);return e?xa():ma()}function ma(){P(X(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(K),{basename:t,navigator:r}=g.useContext(k),{matches:a}=g.useContext($),{pathname:n}=F(),o=JSON.stringify(Me(a)),i=g.useRef(!1);return Zt(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(T(i.current,Qt),!i.current)return;if(typeof s=="number"){r.go(s);return}let c=ye(s,JSON.parse(o),n,u.relative==="path");e==null&&t!=="/"&&(c.pathname=c.pathname==="/"?t:I([t,c.pathname])),Ae(typeof s=="string"?s:z(s),r.createHref(c),Oe(r),"reject"),(u.replace?r.replace:r.push)(c,u.state,u)},[t,r,o,n,e])}var Ln=g.createContext(null);function pa(){let{matches:e}=g.useContext($);return e[e.length-1]?.params??{}}function te(e,{relative:t}={}){let{matches:r}=g.useContext($),{pathname:a}=F(),n=JSON.stringify(Me(r));return g.useMemo(()=>ye(e,JSON.parse(n),a,t==="path"),[e,n,a,t])}function qt(e,t){return er(e,t)}function er(e,t,r){P(X(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=g.useContext(k),{matches:n}=g.useContext($),o=n[n.length-1],i=o?o.params:{},l=o?o.pathname:"/",s=o?o.pathnameBase:"/",u=o&&o.route;if(De){let h=u&&u.path||"";nr(l,!u||h.endsWith("*")||h.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${h}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
2
|
+
|
|
3
|
+
Please change the parent <Route path="${h}"> to <Route path="${h==="/"?"*":`${h}/*`}">.`)}let c=F(),d;if(t){let h=typeof t=="string"?V(t):t;P(s==="/"||h.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${h.pathname}" was given in the \`location\` prop.`),d=h}else d=c;let p=d.pathname||"/",f=p;if(s!=="/"){let h=s.replace(/^\//,"").split("/");f="/"+p.replace(/^\//,"").split("/").slice(h.length).join("/")}let y=r&&r.state.matches.length?r.state.matches.map(h=>Object.assign(h,{route:r.manifest[h.route.id]||h.route})):Ne(e,{pathname:f});De&&(T(u||y!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),T(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`));let m=wa(y&&y.map(h=>Object.assign({},h,{params:Object.assign({},i,h.params),pathname:I([s,a.encodeLocation?a.encodeLocation(h.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?s:I([s,a.encodeLocation?a.encodeLocation(h.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathnameBase])})),n,r);return t&&m?g.createElement(G.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:"POP"}},m):m}function ya(){let e=ar(),t=Wt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},i=null;return De&&(console.error("Error handled by React Router default ErrorBoundary:",e),i=g.createElement(g.Fragment,null,g.createElement("p",null,"\u{1F4BF} Hey developer \u{1F44B}"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:o},"ErrorBoundary")," or"," ",g.createElement("code",{style:o},"errorElement")," prop on your route."))),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),r?g.createElement("pre",{style:n},r):null,i)}var ga=g.createElement(ya,null),tr=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=fa(e.digest);r&&(e=r)}let t=e!==void 0?g.createElement($.Provider,{value:this.props.routeContext},g.createElement($e.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(va,{error:e},t):t}};tr.contextType=Kt;var Ce=new WeakMap;function va({children:e,error:t}){let{basename:r,navigator:a}=g.useContext(k);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=da(t.digest);if(n){let o=Ce.get(t);if(o)throw o;let i=Vt(n.location,r),l=i.absoluteURL||i.to;if(Ae(n.location,l,Oe(a),"allow-explicit"),ia(l))throw new Error("Invalid redirect location");if(Yt&&!Ce.get(t))if(i.isExternal||n.reloadDocument)window.location.href=l;else{let s=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:n.replace}));throw Ce.set(t,s),s}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l}`})}}return e}function Ra({routeContext:e,match:t,children:r}){let a=g.useContext(K);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement($.Provider,{value:e},r)}function wa(e,t=[],r){let a=r?.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let n=e,o=a?.errors;if(o!=null){let c=n.findIndex(d=>d.route.id&&o?.[d.route.id]!==void 0);P(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),n=n.slice(0,Math.min(n.length,c+1))}let i=!1,l=-1;if(r&&a){i=a.renderFallback;for(let c=0;c<n.length;c++){let d=n[c];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(l=c),d.route.id){let{loaderData:p,errors:f}=a,y=d.route.loader&&!p.hasOwnProperty(d.route.id)&&(!f||f[d.route.id]===void 0);if(d.route.lazy||y){r.isStatic&&(i=!0),l>=0?n=n.slice(0,l+1):n=[n[0]];break}}}}let s=r?.onError,u=a&&s?(c,d)=>{s(c,{location:a.location,params:a.matches?.[0]?.params??{},pattern:Zr(a.matches),errorInfo:d})}:void 0;return n.reduceRight((c,d,p)=>{let f,y=!1,m=null,h=null;a&&(f=o&&d.route.id?o[d.route.id]:void 0,m=d.route.errorElement||ga,i&&(l<0&&p===0?(nr("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,h=null):l===p&&(y=!0,h=d.route.hydrateFallbackElement||null)));let S=t.concat(n.slice(0,p+1)),R=()=>{let w;return f?w=m:y?w=h:d.route.Component?w=g.createElement(d.route.Component,null):d.route.element?w=d.route.element:w=c,g.createElement(Ra,{match:d,routeContext:{outlet:c,matches:S,isDataRoute:a!=null},children:w})};return a&&(d.route.ErrorBoundary||d.route.errorElement||p===0)?g.createElement(tr,{location:a.location,revalidation:a.revalidation,component:m,error:f,children:R(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:u}):R()},null)}function Ie(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Sa(e){let t=g.useContext(K);return P(t,Ie(e)),t}function He(e){let t=g.useContext(ee);return P(t,Ie(e)),t}function ba(e){let t=g.useContext($);return P(t,Ie(e)),t}function Ue(e){let t=ba(e),r=t.matches[t.matches.length-1];return P(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function Ea(){return Ue("useRouteId")}function rr(){let e=He("useNavigation");return g.useMemo(()=>{let{matches:t,historyAction:r,...a}=e.navigation;return a},[e.navigation])}function je(){let{matches:e,loaderData:t}=He("useMatches");return g.useMemo(()=>e.map(r=>Ar(r,t)),[e,t])}function ar(){let e=g.useContext($e),t=He("useRouteError"),r=Ue("useRouteError");return e!==void 0?e:t.errors?.[r]}function xa(){let{router:e}=Sa("useNavigate"),t=Ue("useNavigate"),r=g.useRef(!1);return Zt(()=>{r.current=!0}),g.useCallback(async(n,o={})=>{T(r.current,Qt),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}var Tt={};function nr(e,t,r){!t&&!Tt[e]&&(Tt[e]=!0,T(!1,r))}var Pa="useOptimistic",Dn=E[Pa];var Fn=E.memo(Ca);function Ca({routes:e,manifest:t,future:r,state:a,isStatic:n,onError:o}){return er(e,void 0,{manifest:t,state:a,isStatic:n,onError:o,future:r})}function La({basename:e,children:t,initialEntries:r,initialIndex:a,useTransitions:n}){let o=E.useRef();o.current==null&&(o.current=At({initialEntries:r,initialIndex:a,v5Compat:!0}));let i=o.current,[l,s]=E.useState({action:i.action,location:i.location}),u=E.useCallback(c=>{n===!1?s(c):E.startTransition(()=>s(c))},[n]);return E.useLayoutEffect(()=>i.listen(u),[i,u]),E.createElement(ve,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:i,useTransitions:n})}function Da({to:e,replace:t,state:r,relative:a}){P(X(),"<Navigate> may be used only in the context of a <Router> component.");let{static:n,navigator:o}=E.useContext(k);T(!n,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=E.useContext($),{pathname:l}=F(),s=Q(),u=ye(e,Me(i),l,a==="path");Ae(typeof e=="string"?e:z(e),o.createHref(u),Oe(o),"reject");let c=JSON.stringify(u);return E.useEffect(()=>{s(JSON.parse(c),{replace:t,state:r,relative:a})},[s,c,a,t,r]),null}function or(e){P(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function ve({basename:e="/",children:t=null,location:r,navigationType:a="POP",navigator:n,static:o=!1,useTransitions:i}){P(!X(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),s=E.useMemo(()=>({basename:l,navigator:n,static:o,useTransitions:i,future:{}}),[l,n,o,i]);typeof r=="string"&&(r=V(r));let{pathname:u="/",search:c="",hash:d="",state:p=null,key:f="default",mask:y}=r,m=E.useMemo(()=>{let h=U(u,l);return h==null?null:{location:{pathname:h,search:c,hash:d,state:p,key:f,mask:y},navigationType:a}},[l,u,c,d,p,f,a,y]);return T(m!=null,`<Router basename="${l}"> is not able to match the URL "${u}${c}${d}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:E.createElement(k.Provider,{value:s},E.createElement(G.Provider,{children:t,value:m}))}function Fa({children:e,location:t}){return qt(me(e),t)}function me(e,t=[]){let r=[];return E.Children.forEach(e,(a,n)=>{if(!E.isValidElement(a))return;let o=[...t,n];if(a.type===E.Fragment){r.push.apply(r,me(a.props.children,o));return}P(a.type===or,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),P(!a.props.index||!a.props.children,"An index route cannot have child routes.");let i={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(i.children=me(a.props.children,o)),r.push(i)}),r}var ce="get",de="application/x-www-form-urlencoded";function Re(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function ka(e){return Re(e)&&e.tagName.toLowerCase()==="button"}function Ta(e){return Re(e)&&e.tagName.toLowerCase()==="form"}function Na(e){return Re(e)&&e.tagName.toLowerCase()==="input"}function Ma(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Oa(e,t){return e.button===0&&(!t||t==="_self")&&!Ma(e)}function pe(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let a=e[r];return t.concat(Array.isArray(a)?a.map(n=>[r,n]):[[r,a]])},[]))}function Aa(e,t){let r=pe(e);return t&&t.forEach((a,n)=>{r.has(n)||t.getAll(n).forEach(o=>{r.append(n,o)})}),r}var se=null;function _a(){if(se===null)try{new FormData(document.createElement("form"),0),se=!1}catch{se=!0}return se}var $a=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Le(e){return e!=null&&!$a.has(e)?(T(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${de}"`),null):e}function Ia(e,t){let r,a,n,o,i;if(Ta(e)){let l=e.getAttribute("action");a=l?U(l,t):null,r=e.getAttribute("method")||ce,n=Le(e.getAttribute("enctype"))||de,o=new FormData(e)}else if(ka(e)||Na(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||l.getAttribute("action");if(a=s?U(s,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||ce,n=Le(e.getAttribute("formenctype"))||Le(l.getAttribute("enctype"))||de,o=new FormData(l,e),!_a()){let{name:u,type:c,value:d}=e;if(c==="image"){let p=u?`${u}.`:"";o.append(`${p}x`,"0"),o.append(`${p}y`,"0")}else u&&o.append(u,d)}}else{if(Re(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ce,a=null,n=de,i=e}return o&&n==="text/plain"&&(i=o,o=void 0),{action:a,method:r.toLowerCase(),encType:n,formData:o,body:i}}var kn=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ha={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},Ua=/[&><\u2028\u2029]/g;function Nt(e){return e.replace(Ua,t=>Ha[t])}function Be(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}var ja=Symbol("SingleFetchRedirect");function ir(e,t,r,a){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?n.pathname.endsWith("/")?n.pathname=`${n.pathname}_.${a}`:n.pathname=`${n.pathname}.${a}`:n.pathname==="/"?n.pathname=`_root.${a}`:t&&U(n.pathname,t)==="/"?n.pathname=`${q(t)}/_root.${a}`:n.pathname=`${q(n.pathname)}.${a}`,n}async function za(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){if(console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode&&import.meta.hot)throw r;return window.location.reload(),new Promise(()=>{})}}function Ba(e){return e!=null&&typeof e.page=="string"}function Wa(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Ya(e,t,r){let a=await Promise.all(e.map(async n=>{let o=t.routes[n.route.id];if(o){let i=await za(o,r);return i.links?i.links():[]}return[]}));return Ga(a.flat(1).filter(Wa).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function Mt(e,t,r,a,n,o){let i=(s,u)=>r[u]?s.route.id!==r[u].route.id:!0,l=(s,u)=>r[u].pathname!==s.pathname||r[u].route.path?.endsWith("*")&&r[u].params["*"]!==s.params["*"];return o==="assets"?t.filter((s,u)=>i(s,u)||l(s,u)):o==="data"?t.filter((s,u)=>{let c=a.routes[s.route.id];if(!c||!c.hasLoader)return!1;if(i(s,u)||l(s,u))return!0;if(s.route.shouldRevalidate){let d=s.route.shouldRevalidate({currentUrl:new URL(n.pathname+n.search+n.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:s.params,defaultShouldRevalidate:!0});if(typeof d=="boolean")return d}return!0}):[]}function Va(e,t,{includeHydrateFallback:r}={}){return Ja(e.map(a=>{let n=t.routes[a.route.id];if(!n)return[];let o=[n.module];return n.clientActionModule&&(o=o.concat(n.clientActionModule)),n.clientLoaderModule&&(o=o.concat(n.clientLoaderModule)),r&&n.hydrateFallbackModule&&(o=o.concat(n.hydrateFallbackModule)),n.imports&&(o=o.concat(n.imports)),o}).flat(1))}function Ja(e){return[...new Set(e)]}function Ka(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function Ga(e,t){let r=new Set,a=new Set(t);return e.reduce((n,o)=>{if(t&&!Ba(o)&&o.as==="script"&&o.href&&a.has(o.href))return n;let l=JSON.stringify(Ka(o));return r.has(l)||(r.add(l),n.push({key:l,link:o})),n},[])}function We(){let e=b.useContext(K);return Be(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function qa(){let e=b.useContext(ee);return Be(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var oe=b.createContext(void 0);oe.displayName="FrameworkContext";function we(){let e=b.useContext(oe);return Be(e,"You must render this element inside a <HydratedRouter> element"),e}function en(e,t){let r=b.useContext(oe),[a,n]=b.useState(!1),[o,i]=b.useState(!1),{onFocus:l,onBlur:s,onMouseEnter:u,onMouseLeave:c,onTouchStart:d}=t,p=b.useRef(null);b.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let m=S=>{S.forEach(R=>{i(R.isIntersecting)})},h=new IntersectionObserver(m,{threshold:.5});return p.current&&h.observe(p.current),()=>{h.disconnect()}}},[e]),b.useEffect(()=>{if(a){let m=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(m)}}},[a]);let f=()=>{n(!0)},y=()=>{n(!1),i(!1)};return r?e!=="intent"?[o,p,{}]:[o,p,{onFocus:ae(l,f),onBlur:ae(s,y),onMouseEnter:ae(u,f),onMouseLeave:ae(c,y),onTouchStart:ae(d,f)}]:[!1,p,{}]}function ae(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function sr({page:e,...t}){let r=la(),{nonce:a}=we(),{router:n}=We(),o=b.useMemo(()=>Ne(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?(t.nonce==null&&a&&(t={...t,nonce:a}),r?b.createElement(rn,{page:e,matches:o,...t}):b.createElement(an,{page:e,matches:o,...t})):null}function tn(e){let{manifest:t,routeModules:r}=we(),[a,n]=b.useState([]);return b.useEffect(()=>{let o=!1;return Ya(e,t,r).then(i=>{o||n(i)}),()=>{o=!0}},[e,t,r]),a}function rn({page:e,matches:t,...r}){let a=F(),{future:n}=we(),{basename:o}=We(),i=b.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let l=ir(e,o,n.v8_trailingSlashAwareDataRequests,"rsc"),s=!1,u=[];for(let c of t)typeof c.route.shouldRevalidate=="function"?s=!0:u.push(c.route.id);return s&&u.length>0&&l.searchParams.set("_routes",u.join(",")),[l.pathname+l.search]},[o,n.v8_trailingSlashAwareDataRequests,e,a,t]);return b.createElement(b.Fragment,null,i.map(l=>b.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...r})))}function an({page:e,matches:t,...r}){let a=F(),{future:n,manifest:o,routeModules:i}=we(),{basename:l}=We(),{loaderData:s,matches:u}=qa(),c=b.useMemo(()=>Mt(e,t,u,o,a,"data"),[e,t,u,o,a]),d=b.useMemo(()=>Mt(e,t,u,o,a,"assets"),[e,t,u,o,a]),p=b.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let m=new Set,h=!1;if(t.forEach(R=>{let w=o.routes[R.route.id];!w||!w.hasLoader||(!c.some(L=>L.route.id===R.route.id)&&R.route.id in s&&i[R.route.id]?.shouldRevalidate||w.hasClientLoader?h=!0:m.add(R.route.id))}),m.size===0)return[];let S=ir(e,l,n.v8_trailingSlashAwareDataRequests,"data");return h&&m.size>0&&S.searchParams.set("_routes",t.filter(R=>m.has(R.route.id)).map(R=>R.route.id).join(",")),[S.pathname+S.search]},[l,n.v8_trailingSlashAwareDataRequests,s,a,o,c,t,e,i]),f=b.useMemo(()=>Va(d,o),[d,o]),y=tn(d);return b.createElement(b.Fragment,null,p.map(m=>b.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...r})),f.map(m=>b.createElement("link",{key:m,rel:"modulepreload",href:m,...r})),y.map(({key:m,link:h})=>b.createElement("link",{key:m,nonce:r.nonce,...h,crossOrigin:h.crossOrigin??r.crossOrigin})))}function nn(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var on=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{on&&(window.__reactRouterVersion="7.18.3")}catch{}function ln({basename:e,children:t,useTransitions:r,window:a}){let n=v.useRef();n.current==null&&(n.current=_t({window:a,v5Compat:!0}));let o=n.current,[i,l]=v.useState({action:o.action,location:o.location}),s=v.useCallback(u=>{r===!1?l(u):v.startTransition(()=>l(u))},[r]);return v.useLayoutEffect(()=>o.listen(s),[o,s]),v.createElement(ve,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,useTransitions:r})}function ur({basename:e,children:t,history:r,useTransitions:a}){let[n,o]=v.useState({action:r.action,location:r.location}),i=v.useCallback(l=>{a===!1?o(l):v.startTransition(()=>o(l))},[a]);return v.useLayoutEffect(()=>r.listen(i),[r,i]),v.createElement(ve,{basename:e,children:t,location:n.location,navigationType:n.action,navigator:r,useTransitions:a})}ur.displayName="unstable_HistoryRouter";var ie=v.forwardRef(function({onClick:t,discover:r="render",prefetch:a="none",relative:n,reloadDocument:o,replace:i,mask:l,state:s,target:u,to:c,preventScrollReset:d,viewTransition:p,defaultShouldRevalidate:f,...y},m){let{basename:h,navigator:S,useTransitions:R}=v.useContext(k),w=typeof c=="string"&&Te.test(c),L=Vt(c,h);c=L.to;let x=ge(c,{relative:n}),M=F(),H=null;if(l){let Y=ye(l,[],M.mask?M.mask.pathname:"/",!0);h!=="/"&&(Y.pathname=Y.pathname==="/"?h:I([h,Y.pathname])),H=S.createHref(Y)}let[_,B,W]=en(a,y),Se=mr(c,{replace:i,mask:l,state:s,target:u,preventScrollReset:d,relative:n,viewTransition:p,defaultShouldRevalidate:f,useTransitions:R});function Cr(Y){t&&t(Y),Y.defaultPrevented||Se(Y)}let Ze=!(L.isExternal||o),qe=v.createElement("a",{...y,...W,href:(Ze?H:void 0)||L.absoluteURL||x,onClick:Ze?Cr:t,ref:nn(m,B),target:u,"data-discover":!w&&r==="render"?"true":void 0});return _&&!w?v.createElement(v.Fragment,null,qe,v.createElement(sr,{page:x})):qe});ie.displayName="Link";var cr=v.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:a="",end:n=!1,style:o,to:i,viewTransition:l,children:s,...u},c){let d=te(i,{relative:u.relative}),p=F(),f=v.useContext(ee),{navigator:y,basename:m}=v.useContext(k),h=f!=null&&vr(d)&&l===!0,S=y.encodeLocation?y.encodeLocation(d).pathname:d.pathname,R=p.pathname,w=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;r||(R=R.toLowerCase(),w=w?w.toLowerCase():null,S=S.toLowerCase()),w&&m&&(w=U(w,m)||w);let L=S!=="/"&&S.endsWith("/")?S.length-1:S.length,x=R===S||!n&&R.startsWith(S)&&R.charAt(L)==="/",M=w!=null&&(w===S||!n&&w.startsWith(S)&&w.charAt(S.length)==="/"),H={isActive:x,isPending:M,isTransitioning:h},_=x?t:void 0,B;typeof a=="function"?B=a(H):B=[a,x?"active":null,M?"pending":null,h?"transitioning":null].filter(Boolean).join(" ");let W=typeof o=="function"?o(H):o;return v.createElement(ie,{...u,"aria-current":_,className:B,ref:c,style:W,to:i,viewTransition:l},typeof s=="function"?s(H):s)});cr.displayName="NavLink";var dr=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:a,replace:n,state:o,method:i=ce,action:l,onSubmit:s,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:p,...f},y)=>{let{useTransitions:m}=v.useContext(k),h=pr(),S=yr(l,{relative:u}),R=i.toLowerCase()==="get"?"get":"post",w=typeof l=="string"&&Te.test(l);return v.createElement("form",{ref:y,method:R,action:S,onSubmit:a?s:x=>{if(s&&s(x),x.defaultPrevented)return;x.preventDefault();let M=x.nativeEvent.submitter,H=M?.getAttribute("formmethod")||i,_=()=>h(M||x.currentTarget,{fetcherKey:t,method:H,navigate:r,replace:n,state:o,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:p});m&&r!==!1?v.startTransition(()=>_()):_()},...f,"data-discover":!w&&e==="render"?"true":void 0})});dr.displayName="Form";function fr({getKey:e,storageKey:t,...r}){let a=v.useContext(oe),{basename:n}=v.useContext(k),o=F(),i=je();gr({getKey:e,storageKey:t});let l=v.useMemo(()=>{if(!a||!e)return null;let u=ke(o,i,n,e);return u!==o.key?u:null},[]);if(!a||a.isSpaMode)return null;let s=((u,c)=>{if(!window.history.state||!window.history.state.key){let d=Math.random().toString(32).slice(2);window.history.replaceState({key:d},"")}try{let p=JSON.parse(sessionStorage.getItem(u)||"{}")[c||window.history.state.key];typeof p=="number"&&window.scrollTo(0,p)}catch(d){console.error(d),sessionStorage.removeItem(u)}}).toString();return r.nonce==null&&a?.nonce&&(r.nonce=a.nonce),v.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${s})(${Nt(JSON.stringify(t||Fe))}, ${Nt(JSON.stringify(l))})`}})}fr.displayName="ScrollRestoration";function hr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ye(e){let t=v.useContext(K);return P(t,hr(e)),t}function sn(e){let t=v.useContext(ee);return P(t,hr(e)),t}function mr(e,{target:t,replace:r,mask:a,state:n,preventScrollReset:o,relative:i,viewTransition:l,defaultShouldRevalidate:s,useTransitions:u}={}){let c=Q(),d=F(),p=te(e,{relative:i});return v.useCallback(f=>{if(Oa(f,t)){f.preventDefault();let y=r!==void 0?r:z(d)===z(p),m=()=>c(e,{replace:y,mask:a,state:n,preventScrollReset:o,relative:i,viewTransition:l,defaultShouldRevalidate:s});u?v.startTransition(()=>m()):m()}},[d,c,p,r,a,n,t,e,o,i,l,s,u])}function Ve(e){T(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=v.useRef(pe(e)),r=v.useRef(!1),a=F(),n=v.useMemo(()=>Aa(a.search,r.current?null:t.current),[a.search]),o=Q(),i=v.useCallback((l,s)=>{let u=pe(typeof l=="function"?l(new URLSearchParams(n)):l);r.current=!0,o("?"+u,s)},[o,n]);return[n,i]}var un=0,cn=()=>`__${String(++un)}__`;function pr(){let{router:e}=Ye("useSubmit"),{basename:t}=v.useContext(k),r=Ea(),a=e.fetch,n=e.navigate;return v.useCallback(async(o,i={})=>{let{action:l,method:s,encType:u,formData:c,body:d}=Ia(o,t);if(i.navigate===!1){let p=i.fetcherKey||cn();await a(p,r,i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:c,body:d,formMethod:i.method||s,formEncType:i.encType||u,flushSync:i.flushSync})}else await n(i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:c,body:d,formMethod:i.method||s,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:r,flushSync:i.flushSync,viewTransition:i.viewTransition})},[a,n,t,r])}function yr(e,{relative:t}={}){let{basename:r}=v.useContext(k),a=v.useContext($);P(a,"useFormAction must be used inside a RouteContext");let[n]=a.matches.slice(-1),o={...te(e||".",{relative:t})},i=F();if(e==null){o.search=i.search;let l=new URLSearchParams(o.search),s=l.getAll("index");if(s.some(c=>c==="")){l.delete("index"),s.filter(d=>d).forEach(d=>l.append("index",d));let c=l.toString();o.search=c?`?${c}`:""}}return(!e||e===".")&&n.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:I([r,o.pathname])),z(o)}var Fe="react-router-scroll-positions",ue={};function ke(e,t,r,a){let n=null;return a&&(r!=="/"?n=a({...e,pathname:U(e.pathname,r)||e.pathname},t):n=a(e,t)),n==null&&(n=e.key),n}function gr({getKey:e,storageKey:t}={}){let{router:r}=Ye("useScrollRestoration"),{restoreScrollPosition:a,preventScrollReset:n}=sn("useScrollRestoration"),{basename:o}=v.useContext(k),i=F(),l=je(),s=rr();v.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),dn(v.useCallback(()=>{if(s.state==="idle"){let u=ke(i,l,o,e);ue[u]=window.scrollY}try{sessionStorage.setItem(t||Fe,JSON.stringify(ue))}catch(u){T(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${u}).`)}window.history.scrollRestoration="auto"},[s.state,e,o,i,l,t])),typeof document<"u"&&(v.useLayoutEffect(()=>{try{let u=sessionStorage.getItem(t||Fe);u&&(ue=JSON.parse(u))}catch{}},[t]),v.useLayoutEffect(()=>{let u=r?.enableScrollRestoration(ue,()=>window.scrollY,e?(c,d)=>ke(c,d,o,e):void 0);return()=>u&&u()},[r,o,e]),v.useLayoutEffect(()=>{if(a!==!1){if(typeof a=="number"){window.scrollTo(0,a);return}try{if(i.hash){let u=document.getElementById(decodeURIComponent(i.hash.slice(1)));if(u){u.scrollIntoView();return}}}catch{T(!1,`"${i.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}n!==!0&&window.scrollTo(0,0)}},[i,a,n]))}function dn(e,t){let{capture:r}=t||{};v.useEffect(()=>{let a=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,a),()=>{window.removeEventListener("pagehide",e,a)}},[e,r])}function vr(e,{relative:t}={}){let r=v.useContext(_e);P(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Ye("useViewTransitionState"),n=te(e,{relative:t});if(!r.isTransitioning)return!1;let o=U(r.currentLocation.pathname,a)||r.currentLocation.pathname,i=U(r.nextLocation.pathname,a)||r.nextLocation.pathname;return ne(n.pathname,i)!=null||ne(n.pathname,o)!=null}var Je=D(O(),1),wr=D(Lr(),1);var j=D(Z(),1);function Sr({context:e,own:t}){re(e.store);let r=ct(),a=ut()?.live??e.store;re(a);let n=pt();if(!r||a.batches().length===0&&n===0)return null;let o=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Je.Suspense,{fallback:null,children:(0,j.jsx)(Et,{})}),(0,j.jsx)(Je.Suspense,{fallback:null,children:(0,j.jsx)(xt,{})})]});return t?(0,wr.createPortal)(o,t):(0,j.jsx)("div",{className:"graview-bar-own",children:o})}var N=D(O(),1);var J=D(O(),1),fn=(0,J.createContext)(null);function Go(){let e=new Map,t=new Set,r=()=>{for(let a of t)a()};return{count:a=>e.get(a)??0,place(a){return e.set(a,(e.get(a)??0)+1),r(),()=>{e.set(a,(e.get(a)??1)-1),r()}},subscribe(a){return t.add(a),()=>t.delete(a)}}}function br(e){let t=(0,J.useContext)(fn);(0,J.useLayoutEffect)(()=>t?.place(e),[t,e])}function Xo(e,t){return(0,J.useSyncExternalStore)(e.subscribe,()=>e.count(t)>0,()=>!1)}var Pr=D(Z(),1),Ke="var(--graview-text-small)",Ge="var(--graview-text-body)",ri="var(--graview-font-display, var(--graview-font-body, system-ui))",Xe={maxWidth:760,margin:"0 auto",padding:"40px 20px max(96px, calc(var(--graview-foot-room, 0px) + env(safe-area-inset-bottom, 0px)))",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40},Qe=1160,ai={...Xe,maxWidth:Qe},Er={margin:0,fontSize:"var(--graview-text-title)",lineHeight:1.2,letterSpacing:"-0.012em",overflowWrap:"anywhere",textWrap:"balance"},ni={margin:0,fontSize:"var(--graview-text-heading)",lineHeight:1.3,textWrap:"balance"},oi={margin:0,fontSize:Ke,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},ii={margin:0,fontSize:Ge,color:"var(--graview-ink-muted)",maxWidth:"60ch"},xr={color:"var(--graview-ink-muted)",fontSize:Ke},li={borderTop:"1px solid var(--graview-edge)",paddingTop:24},si={color:"var(--graview-accent)",textDecorationColor:"color-mix(in srgb, currentColor 50%, transparent)",textDecorationThickness:1,textUnderlineOffset:"0.2em",display:"inline-flex",alignItems:"center",minHeight:24},ui={color:"inherit",textDecoration:"none",display:"inline-flex",alignItems:"center",minHeight:24},ci=`.graview-list{container-type:inline-size}
|
|
4
|
+
.graview-rows{display:grid;grid-template-columns:minmax(0,1fr);column-gap:1.5rem;margin:0;padding:0;list-style:none;border-top:1px solid var(--graview-edge)}
|
|
5
|
+
.graview-row{grid-column:1/-1;display:grid;grid-template-columns:subgrid;align-items:baseline;align-content:center;position:relative;box-sizing:border-box;min-height:2.75rem;padding:.5rem 0;border-bottom:1px solid var(--graview-edge);overflow-wrap:anywhere}
|
|
6
|
+
.graview-row-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;min-height:24px;color:inherit;text-decoration:none;font-size:var(--graview-text-body);font-weight:500;line-height:1.3;text-wrap:pretty;hyphens:manual}
|
|
7
|
+
.graview-row-title::after{content:"";position:absolute;inset:0}
|
|
8
|
+
.graview-row-title:focus-visible{outline:0}
|
|
9
|
+
.graview-row-title:focus-visible::after{outline:2px solid var(--graview-accent);outline-offset:-2px;border-radius:var(--graview-radius-sm)}
|
|
10
|
+
.graview-row:hover .graview-row-title{text-decoration:underline 1px color-mix(in srgb,currentColor 50%,transparent);text-underline-offset:.2em}
|
|
11
|
+
.graview-row:active .graview-row-title{color:var(--graview-accent)}
|
|
12
|
+
.graview-row :is(a,button):not(.graview-row-title){position:relative}
|
|
13
|
+
.graview-row-glance,.graview-row>[data-testid=search-why]{font-size:var(--graview-text-small);line-height:1.5;color:var(--graview-ink-muted)}
|
|
14
|
+
.graview-row>[data-testid=search-why]{grid-column:1/-1}
|
|
15
|
+
.graview-row-glance{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
|
|
16
|
+
.graview-group-head{display:flex;gap:.5em;align-items:baseline;margin:0;padding:.375rem 0;font-family:var(--graview-font-body);font-size:var(--graview-text-small);font-weight:var(--graview-weight-label);line-height:1.3;letter-spacing:.02em;scroll-margin-top:4rem}
|
|
17
|
+
.graview-group-head>span{color:var(--graview-ink-muted);font-weight:var(--graview-weight-body)}
|
|
18
|
+
.graview-group-toggle{display:inline-flex;gap:.5em;align-items:center;min-height:2.75rem;margin:-.375rem 0;padding:0 .5rem 0 0;border:0;background:none;color:inherit;font:inherit;letter-spacing:inherit;text-align:start;cursor:pointer;border-radius:var(--graview-radius-sm)}
|
|
19
|
+
.graview-group-toggle:focus-visible{outline:2px solid var(--graview-accent);outline-offset:2px}
|
|
20
|
+
.graview-group-toggle>span{color:var(--graview-ink-muted);font-weight:var(--graview-weight-body)}
|
|
21
|
+
@container (min-width:36rem){.graview-rows{grid-template-columns:minmax(0,1fr) fit-content(40%)}.graview-group-head:has(+.graview-rows){position:sticky;top:0;z-index:${rt.raised};background:var(--graview-ground)}}`,di={font:"inherit",fontSize:Ke,padding:"8px 14px",borderRadius:"var(--graview-radius-sm, 8px)",border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)",color:"var(--graview-ink)",cursor:"pointer"};function fi({kind:e,brand:t,size:r=10,schema:a}){return(0,Pr.jsx)(ft,{kind:e,...a?{schema:a}:{},...t?{brand:t}:{},size:Math.round(r*1.6)})}function hi(e,t){let a=[...new Set(t.targets.map(n=>n.kind))].map(n=>e.schema.tryDefinition(n)?.plural??be(n));return a.length>0?a.join(" and "):be(t.edgeKind)}function mi(e,t,r){return e.author.kind==="human"&&(e.author.id===void 0||t?.id===void 0||e.author.id===t.id)?"you":r?et(e.author,r):e.author.kind==="agent"?e.author.id??"an agent":e.author.id??e.author.kind}function pi(e,t,r){return mt(e,t,{limit:3,said:[r],glance:!0}).map(a=>a.long?ht(a.stored,{markdown:a.markdown,most:100}):a.alone).join(" \xB7 ")}var yi=(e,t)=>le(e.schema,t),hn=(e,t)=>{let r=e.kindsKeptFrom(t);return e.schema.kinds.filter(a=>!e.modules.disabledKinds.has(a)&&!r.has(a))},mn=e=>st(hn(e.store,e.principal),e.views?.arrangement?.()?.order),gi=e=>{let t=new Set(e.views?.arrangement?.()?.hide??[]);return mn(e).filter(r=>!t.has(r))},vi=e=>e.charAt(0).toUpperCase()+e.slice(1);var C=D(Z(),1);function Di({context:e,children:t}){let{store:r,brand:a}=e;return re(r),dt(e.embedded?void 0:tt(a)),(0,C.jsxs)("div",{style:{...e.embedded?{}:{minHeight:"100vh"},display:"flex",flexDirection:"column",background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:Ge,lineHeight:1.5},children:[e.embedded?null:(0,C.jsx)(yn,{context:e}),(0,C.jsx)("div",{style:{flex:1},children:t}),e.remembers?(0,C.jsx)("footer",{style:{borderTop:"1px solid var(--graview-edge)",padding:"14px 20px max(20px, calc(var(--graview-foot-room, 0px) + env(safe-area-inset-bottom, 0px)))",...xr},children:(0,C.jsx)("div",{style:{maxWidth:Qe,margin:"0 auto",display:"flex",gap:14,flexWrap:"wrap",alignItems:"center",justifyContent:"flex-end"},children:(0,C.jsxs)("span",{"data-testid":"remembered",children:["Remembered in this browser \xB7 ",(0,C.jsx)(Pt,{})]})})}):null]})}var pn=(0,N.createContext)(null);function yn({context:e}){let{store:t,brand:r,sceneHref:a="/",invariantContext:n}=e,o=F(),i=Q(),l=ge("/").replace(/\/$/,""),s=(0,N.useContext)(pn),u=s?.places===!1?[]:yt({store:t,principal:e.principal,views:e.views}),c=e.views?.arrangement?.(),d=`${o.pathname}${o.search}`,p=t.violations(n),f=p.length,y=St(p,"All rules hold");return(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(Rt,{brand:r,name:r?.name??"Graview",description:r?.subtitle,home:{href:`${l}/`,go:()=>i("/"),current:o.pathname==="/"},faces:{scene:{label:it(c),current:!1,go:()=>window.location.assign(a)},pages:{label:lt(c),current:!0,go:()=>{}}},places:u,current:gt(u,d),reach:{href:m=>`${l}${m}`,go:m=>i(m.path)},...s?{onFind:s.onFind,find:s.find}:{findBox:(0,C.jsx)(gn,{context:e})},tools:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(ie,{to:"/problems","data-testid":"standing-link","aria-label":y,title:y,style:{...vt,padding:f===0?0:"0 8px",textDecoration:"none",fontWeight:600,fontVariantNumeric:"tabular-nums",color:f===0?"var(--graview-ink-muted)":"var(--graview-warn)"},children:[(0,C.jsx)(bt,{tone:f===0?"var(--graview-good)":"var(--graview-warn)"}),f>0?(0,C.jsx)("span",{"aria-hidden":"true",children:f}):null]}),s?null:(0,C.jsx)(Sr,{context:e}),e.views?(0,C.jsx)(wt,{...e.signature?{signature:!0}:{}}):null]})})})}function Fi({context:e,style:t,children:r,...a}){let n=e.embedded||e.framed?"section":"main";return(0,C.jsx)(n,{style:{...Xe,...t},...a,children:r})}function ki({context:e,children:t,...r}){let a=`h${e.titleLevel??(e.framed&&!e.barAbove?1:2)}`;return(0,C.jsx)(a,{style:Er,"data-graview-page-title":"",...r,children:t})}function gn({context:e,narrowsLists:t=!0}){br("find");let r=F(),a=Q(),[n,o]=Ve(),i=r.pathname.split("/").filter(Boolean),l=t&&i.length===1&&Ee(e.store.schema,i[0])!==void 0,s=r.pathname==="/search",u=l||s?n.get("q")??"":"",c=l?`Narrow ${le(e.store.schema,Ee(e.store.schema,i[0])).toLowerCase()}\u2026`:"",[d,p]=(0,N.useState)(!0);(0,N.useLayoutEffect)(()=>{let R=m.current;if(!R||!c||typeof ResizeObserver>"u")return;let w=()=>{let x=getComputedStyle(R),M=document.createElement("canvas").getContext("2d");M&&(M.font=`${x.fontWeight} ${x.fontSize} ${x.fontFamily}`,p(M.measureText(c).width<=R.clientWidth-parseFloat(x.paddingLeft)-parseFloat(x.paddingRight)))};w();let L=new ResizeObserver(w);return L.observe(R),()=>L.disconnect()},[c]);let[f,y]=(0,N.useState)(u),m=(0,N.useRef)(null);(0,N.useEffect)(()=>{let R=w=>{if(w.defaultPrevented||w.altKey)return;let L=!w.shiftKey&&(w.metaKey||w.ctrlKey)&&w.key.toLowerCase()==="k",x=document.activeElement,M=x instanceof HTMLInputElement||x instanceof HTMLTextAreaElement||x instanceof HTMLSelectElement||x instanceof HTMLElement&&x.isContentEditable,H=w.key==="/"&&!w.metaKey&&!w.ctrlKey&&!M;if(!L&&!H)return;let _=m.current,B=_?.closest("[data-graview-embed]"),W=w.target,Se=W===document.body||W===document.documentElement;!_||!(Se||!B||W instanceof Node&&B.contains(W))||(w.preventDefault(),_.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),requestAnimationFrame(()=>{_.focus(),_.select()}))};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[]);let h=(0,N.useRef)(new Set([u]));(0,N.useEffect)(()=>{h.current.has(u)||(h.current=new Set([u]),y(u))},[u]);let S=R=>{if(y(R),h.current.add(R),l){let L=new URLSearchParams(n);R.trim()?L.set("q",R):L.delete("q"),o(L,{replace:!0});return}let w=R.trim()?`/search?${new URLSearchParams({q:R}).toString()}`:"/search";a(w,{replace:s})};return(0,C.jsx)("form",{role:"search","aria-label":l?"Narrow this list":"Find anything",style:{display:"flex",minWidth:0,flex:"1 1 auto"},onSubmit:R=>{R.preventDefault(),l&&f.trim()&&a(`/search?${new URLSearchParams({q:f}).toString()}`)},children:(0,C.jsx)("input",{ref:m,type:"search","data-testid":"nav-find",value:f,onChange:R=>S(R.target.value),placeholder:l?d?c:"Narrow\u2026":"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K","aria-label":l?"Narrow this list":"Find anything",style:{width:"100%",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-ground)",border:"1px solid var(--graview-edge)",borderRadius:8}})})}export{Dr as a,Ee as b,Rn as c,wn as d,Ke as e,ri as f,ai as g,ni as h,oi as i,ii as j,xr as k,li as l,si as m,ui as n,ci as o,di as p,fi as q,hi as r,mi as s,pi as t,yi as u,hn as v,mn as w,gi as x,vi as y,Sr as z,ge as A,F as B,ha as C,Q as D,pa as E,La as F,Da as G,or as H,Fa as I,ln as J,ie as K,Ve as L,fn as M,Go as N,Xo as O,Di as P,pn as Q,Fi as R,ki as S,gn as T};
|
|
22
|
+
/*! Bundled license information:
|
|
23
|
+
|
|
24
|
+
react-router/dist/development/chunk-BV7QT456.mjs:
|
|
25
|
+
(**
|
|
26
|
+
* react-router v7.18.3
|
|
27
|
+
*
|
|
28
|
+
* Copyright (c) Remix Software Inc.
|
|
29
|
+
*
|
|
30
|
+
* This source code is licensed under the MIT license found in the
|
|
31
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
32
|
+
*
|
|
33
|
+
* @license MIT
|
|
34
|
+
*)
|
|
35
|
+
|
|
36
|
+
react-router/dist/development/index.mjs:
|
|
37
|
+
(**
|
|
38
|
+
* react-router v7.18.3
|
|
39
|
+
*
|
|
40
|
+
* Copyright (c) Remix Software Inc.
|
|
41
|
+
*
|
|
42
|
+
* This source code is licensed under the MIT license found in the
|
|
43
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
44
|
+
*
|
|
45
|
+
* @license MIT
|
|
46
|
+
*)
|
|
47
|
+
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as y}from"./chunk.
|
|
1
|
+
import{b as y}from"./chunk.GYICGZMG.js";import"./chunk.JOOQUWLT.js";import{F as w,Q as c}from"./chunk.6QWV5MVH.js";import"./chunk.MNP4JI33.js";import{b as l}from"./chunk.AJZBJBMO.js";var r=l(w(),1);var t=l(c(),1);function x({field:d,label:p,value:m,markdown:b,onSave:n,onCancel:u}){let[a,v]=(0,r.useState)(m),[i,h]=(0,r.useState)(!1),o=(0,r.useRef)(null);return(0,r.useEffect)(()=>o.current?.focus(),[i]),(0,r.useLayoutEffect)(()=>{let e=o.current;if(!e||i||typeof CSS<"u"&&CSS.supports?.("field-sizing","content"))return;let f=()=>{e.style.height="auto";let g=getComputedStyle(e);e.style.height=`${e.scrollHeight+parseFloat(g.borderTopWidth)+parseFloat(g.borderBottomWidth)}px`};f();let S=requestAnimationFrame(f);return()=>cancelAnimationFrame(S)},[a,i]),(0,t.jsxs)("form",{style:{display:"grid",gap:8,minWidth:0},onSubmit:e=>{e.preventDefault(),n(a,!1)},children:[i?(0,t.jsx)("div",{"data-graview-preview":d,"aria-label":`${p}, as it will read`,role:"region",style:C,children:(0,t.jsx)(y,{text:a,markdown:!0})}):(0,t.jsx)("textarea",{ref:o,"aria-label":p,"data-graview-field":d,value:a,rows:3,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),u()):e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),n(a,!1))},onBlur:e=>{e.relatedTarget instanceof Node&&e.currentTarget.form?.contains(e.relatedTarget)||n(a,!0)},style:E}),(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,t.jsx)("button",{type:"submit",style:s,children:"Save"}),(0,t.jsx)("button",{type:"button",onClick:u,style:s,children:"Cancel"}),b?(0,t.jsx)("button",{type:"button","aria-pressed":i,onClick:()=>h(!i),style:s,children:i?"Write":"Preview"}):null,(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Ctrl or \u2318 Enter saves \xB7 Esc puts it back"})]})]})}var C={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},s={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},E={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)",borderRadius:6};export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as S,b as $,c as w,d as R,e as V}from"./chunk.HHPGWJDO.js";import{h as l,i as F}from"./chunk.42YX6NOY.js";import{va as b,wa as A}from"./chunk.6V2RG5JG.js";var O=["card","row","page"],E=["good","warn","bad","neutral","accent"],P=["money","percent","date","relative","count"],_=4,T=40,I=120,L=["number","money","percent"],B=["large"],H=["card","row"],M=1e3,ue=100;function U(e){let n=/^\s*(out|in)\(\s*['"]([A-Za-z][A-Za-z0-9_-]*)['"]\s*\)\s*$/.exec(e);return n?{edge:n[2],way:n[1]}:/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?{edge:e}:void 0}var v={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label","emphasis"]},C=Object.keys(v),G=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?, "emphasis"?: "large"}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,Z=e=>/^(image|file)$/.test(e?.of??e?.type??"");function fe(e){return Object.fromEntries(Object.entries(e.views??{}).filter(([,n])=>!Array.isArray(n)))}function ce(e){let n=e.views?.home;return Array.isArray(n)?n:void 0}var X={field:()=>!1,relation:()=>!1,figure:!1},Y=e=>e.kind??"the home",p=(e,n)=>e!==void 0&&Object.hasOwn(e,n),g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function z(e,n,o){let t=S(e);for(let d of t.unknownFunctions)o.findings.push(l("unknown-function",n,`"${d}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let d of t.names){if(o.kind===null){o.findings.push(l("view-name",n,`"${d}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}d==="id"||o.spec.field(d)||o.spec.relation(d)||o.findings.push(l("view-name",n,`${o.kind} has no field or relation called "${d}"`))}for(let d of t.edges)o.edges.has(d)||o.findings.push(l("view-edge",n,`"${d}" is not a relation any kind declares`));for(let d of t.sweeps)o.kinds.has(d)||o.findings.push(l("view-kind",n,`"${d}" is not a kind this document declares`))}function k(e,n,o){if(typeof e!="string"||e.length===0||e.length>2e3){o.findings.push(l("view-expression",n,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{z(w(e),n,o)}catch(t){if(!(t instanceof $))throw t;o.findings.push(l("expression",n,`${t.sentence} (at character ${t.at+1})`))}}function j(e,n,o,t=!1){if(typeof e!="string"||e.length===0||e.length>300){o.findings.push(l("view-template",n,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let d;try{d=V(e)}catch(a){if(a instanceof R||a instanceof $){o.findings.push(l("template",n,a.sentence));return}throw a}for(let a of d)if(a.expr&&(z(a.expr,n,o),t&&!a.format&&a.expr.t==="ident"&&(o.slot==="card"||o.slot==="row")&&o.spec.prose?.(a.expr.name))){let r=a.expr.name;o.findings.push(F("view-whole-text",n,`${o.kind} ${o.slot} shows ${r} whole; it will be clamped. Use {${r}|excerpt} or move it to the page.`,`write {${r}|excerpt}, or {${r}|excerpt: 80} for fewer characters`))}}function q(e,n,o){if(typeof e=="string"){E.includes(e)||o.findings.push(l("view-tone",n,`"${e}" is not a tone`,`use one of ${E.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(g(e)&&Object.keys(e).length===1&&"expr"in e){k(e.expr,`${n}.expr`,o);return}o.findings.push(l("view-tone",n,'a tone is a word or {"expr": \u2026}',`one of ${E.join(", ")}`))}function x(e,n,o,t){if(!Array.isArray(e)){t.findings.push(l("view-shape",n,"a view is a list of blocks"));return}if(o>_){t.findings.push(l("view-depth",n,`blocks nest at most ${_} deep`,"flatten a group or a condition"));return}e.forEach((d,a)=>J(d,`${n}.${a}`,o,t))}function J(e,n,o,t){if(o===1&&t.count++,t.all++,!g(e)){t.findings.push(l("view-block",n,"a block is an object naming what it shows",`one of ${G}`));return}let d=Object.keys(e),a=d.filter(s=>C.includes(s)&&!(s==="group"&&d.includes("list")));if(a.length===0){t.findings.push(l("view-block",n,`${d.length>0?d.map(s=>`"${s}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${G}`));return}if(a.length>1){t.findings.push(l("view-block",n,`a block is one thing, and this says ${a.map(s=>`"${s}"`).join(" and ")}`,"split it into two blocks"));return}let r=a[0];for(let s of d)s!==r&&s!="key"&&!v[r].includes(s)&&t.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" is not part of a ${r} block`,v[r].length>0?`a ${r} block may also say ${v[r].map(u=>`"${u}"`).join(", ")}`:`a ${r} block says nothing else`));let i=e[r];switch(r){case"title":case"headline":case"text":case"badge":j(i,`${n}.${r}`,t,r==="text"),"tone"in e&&q(e.tone,`${n}.tone`,t);return;case"image":case"field":{let s=r==="image";if(typeof i!="string"||!(s?t.spec.files?.(i):t.spec.field(i))){let f=typeof i=="string"&&t.spec.relation(i);t.findings.push(l(`view-${r}`,`${n}.${r}`,`${t.kind} has no ${s?"image or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,f?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let u=s?["thumb","gallery"]:P;"as"in e&&!u.includes(e.as)&&t.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to show ${s?"pictures":"a field"}`,`use one of ${u.join(", ")}`)),s||N(e,n,t,"field"),"label"in e&&ie(e.label,`${n}.label`,t);return}case"progress":{!g(i)||Object.keys(i).some(s=>s!=="value"&&s!=="max")||!("value"in i)||!("max"in i)?t.findings.push(l("view-progress",`${n}.progress`,'progress is {"value": expression, "max": expression}')):(k(i.value,`${n}.progress.value`,t),k(i.max,`${n}.progress.max`,t)),"label"in e&&j(e.label,`${n}.label`,t);return}case"group":"direction"in e&&e.direction!=="row"&&e.direction!=="column"&&t.findings.push(l("view-direction",`${n}.direction`,`a group runs "row" or "column", not "${String(e.direction)}"`)),x(i,`${n}.group`,o+1,t);return;case"when":k(i,`${n}.when`,t),"show"in e?x(e.show,`${n}.show`,o+1,t):t.findings.push(l("view-when",n,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return Q(e,n,t);for(let s of["as","currency","label","emphasis"])s in e&&t.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?t.findings.push(l("view-block",`${n}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):t.spec.figure||t.findings.push(l("view-figure",`${n}.figure`,`${Y(t)} has no figure to show`,t.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return ne(e,n,t);case"divider":i!==!0&&t.findings.push(l("view-block",`${n}.${r}`,`write {"${r}": true}`));return}}function Q(e,n,o){k(e.figure,`${n}.figure`,o),"as"in e&&!L.includes(e.as)&&o.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to say a figure`,`use one of ${L.join(", ")}`)),N(e,n,o,"figure"),"label"in e&&j(e.label,`${n}.label`,o),"emphasis"in e&&!B.includes(e.emphasis)&&o.findings.push(l("view-emphasis",`${n}.emphasis`,`"${String(e.emphasis)}" is not how loudly a figure is said`,`use ${B.map(t=>`"${t}"`).join(", ")}, or leave it out for the figure's own size`))}function N(e,n,o,t){"currency"in e&&(typeof e.currency!="string"||!/^[A-Z]{3}$/.test(e.currency)?o.findings.push(l("view-currency",`${n}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):e.as!=="money"&&o.findings.push(l("view-currency",`${n}.currency`,`a currency belongs on a ${t} shown as money`,'add "as": "money"')))}function ee(e,n){let o=[...n.kinds],t=(a,r)=>{let i=new Set;for(let s of a){let u=n.vocabulary.namesOf(s)?.targets?.(r);if(u==="*")return o;for(let f of u??[])i.add(f)}return i.size>0?[...i]:void 0},d=a=>{switch(a.t){case"ident":return n.kind!==null&&n.spec.relation(a.name)?t([n.kind],a.name):void 0;case"member":{let r=d(a.object);return r?t(r,a.name):void 0}case"where":return d(a.set);case"call":{let r=a.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(a.fn==="all")return i!==void 0&&n.kinds.has(i)?[i]:void 0;let s=a.args.length===2&&a.args[1]?.t==="lit"&&typeof a.args[1].value=="string"?a.args[1].value:void 0;if(a.fn==="out"&&s!==void 0){let u=d(r);return u?t(u,s):void 0}if(a.fn==="out")return i!==void 0&&n.kind!==null?t([n.kind],i):void 0;if(a.fn==="in"){let u=s??i,f=s!==void 0?d(r):n.kind!==null?[n.kind]:void 0,c=u!==void 0?n.vocabulary.sources(u).filter(m=>{let y=n.vocabulary.namesOf(m)?.targets?.(u);return!f||y==="*"||f.some(h=>y?.includes(h))}):[];return c.length>0?c:void 0}if((a.fn==="sort"||a.fn==="first")&&r)return d(r);if(a.fn==="either"){let u=a.args.map(d);return u.every(f=>f!==void 0)?[...new Set(u.flatMap(f=>f??[]))]:void 0}return}default:return}};return d(e)}function K(e,n,o,t){let d;try{d=w(e)}catch(r){if(!(r instanceof $))throw r;t.findings.push(l("expression",n,`${r.sentence} (at character ${r.at+1})`));return}let a=S(d);for(let r of a.unknownFunctions)t.findings.push(l("unknown-function",n,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of a.edges)t.edges.has(r)||t.findings.push(l("view-edge",n,`"${r}" is not a relation any kind declares`));if(o)for(let r of a.names)r==="id"||o.some(i=>t.vocabulary.namesOf(i)?.field(r)||t.vocabulary.namesOf(i)?.relation(r))||t.findings.push(l("view-name",n,`${o.join(" and ")} ${o.length===1?"has":"have"} no field or relation called "${r}"`))}function ne(e,n,o){let t=e.list;k(t,`${n}.list`,o);let d;if(typeof t=="string")try{d=ee(w(t),o)}catch{d=void 0}let a=i=>{if(!d)return[...o.kinds].map(u=>o.vocabulary.namesOf(u)?.choices?.(i)).find(u=>u!==void 0);let s=d.map(u=>o.vocabulary.namesOf(u)?.choices?.(i));return s.every(u=>u!==void 0)?[...new Set(s.flatMap(u=>u??[]))]:void 0},r=d?d.join(" and "):"any kind";if("sort"in e){let i=e.sort;if(typeof i=="string")K(i,`${n}.sort`,d,o);else if(g(i)&&typeof i.by=="string"&&Object.keys(i).every(s=>s==="by"||s==="direction")){let s=i.direction;s!==void 0&&s!=="asc"&&s!=="desc"&&s!=="choices"?o.findings.push(l("list-sort",`${n}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(s)}"`,'"choices" puts a choice field in the order its choices are declared')):s==="choices"?a(i.by)===void 0&&o.findings.push(l("list-sort",`${n}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):K(i.by,`${n}.sort.by`,d,o)}else o.findings.push(l("list-sort",`${n}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in e){let i=e.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>M)&&o.findings.push(l("list-limit",`${n}.limit`,`a limit is a whole number from 1 to ${M}`))}if("group"in e){let i=e.group,s=typeof i=="string"?i:g(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||g(i)&&Object.keys(i).every(f=>f==="by"||f==="headings"))||s===void 0)o.findings.push(l("list-group",`${n}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}} \u2014 or a relation, like "inGenre", a heading per linked record'));else{let f=a(s),c=f===void 0?U(s):void 0,m=c!==void 0&&(c.way!==void 0?o.edges.has(c.edge):d?d.every(y=>o.vocabulary.namesOf(y)?.relation(c.edge)):o.edges.has(c.edge));if(f===void 0&&!m&&o.findings.push(l("list-group",`${n}.group`,`"${s}" is not a choice field or a relation of ${r}, so it has nothing to group by`,'group by a field whose type is enum, or by a relation of the kind listed, like "inGenre"')),g(i)&&"headings"in i){let y=i.headings;if(!g(y)||Object.values(y).some(h=>typeof h!="string"||h.length===0||h.length>80))o.findings.push(l("list-group",`${n}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(f)for(let h of Object.keys(y))f.includes(h)||o.findings.push(l("list-group",`${n}.group.headings.${h}`,`"${h}" is not one of ${s}'s choices`,`use ${f.join(", ")}`))}}}"empty"in e&&(typeof e.empty!="string"||e.empty.length===0||e.empty.length>200)&&o.findings.push(l("list-empty",`${n}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in e&&!H.includes(e.as)&&o.findings.push(l("list-as",`${n}.as`,`a list draws each record as its "card" or its "row", not "${String(e.as)}"`))}function ie(e,n,o){(typeof e!="string"||e.length===0||e.length>60)&&o.findings.push(l("view-label",n,"a label is a few words, at most 60 characters"))}function W(e,n,o,t,d,a,r){let i={kind:null,spec:X,kinds:t,edges:d,vocabulary:o,findings:a,count:0,all:0};Array.isArray(e)&&e.length===0&&a.push(l("view-shape",n,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),x(e,n,1,i),D(i,n,r,"show less")}function D(e,n,o,t){e.count>T?e.findings.push(l("view-size",n,`${o} has ${e.count} blocks at its top; a view has at most ${T} there, a group or a condition counting as one`,`${t}, or gather some into a group`)):e.all>I&&e.findings.push(l("view-size",n,`${o} has ${e.all} blocks counting the ones inside its groups and conditions; a view has at most ${I} in all`,t))}function oe(e,n,o,t,d){Array.isArray(e)&&e.forEach((a,r)=>{if(!g(a)||a.name!=="blocks"||!g(a.options)||!("blocks"in a.options))return;let i=[];W(a.options.blocks,`lenses.${r}.options.blocks`,n,o,t,i,`the lens "${String(a.title??r)}"`);for(let s of i)d.push({...s,severity:"warning"})})}function te(e,n,o,t,d,a,r){let i=[];if(e===void 0)return i;if(!g(e))return i.push(l("view-shape",n,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[s,u]of Object.entries(e)){if(s==="home"&&Array.isArray(u)){W(u,`${n}.home`,r,t,d,i,"the home");continue}let f=o(s);if(!f){i.push(l("view-kind",`${n}.${s}`,`"${s}" is not a kind this ${a} declares`));continue}if(!g(u)){i.push(l("view-shape",`${n}.${s}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(u))O.includes(c)||i.push(l("view-slot",`${n}.${s}.${c}`,`"${c}" is not a place a view is drawn`,`use ${O.map(m=>`"${m}"`).join(", ")}`));for(let c of O){let m=u[c];if(m===void 0)continue;let y={kind:s,spec:f,kinds:t,edges:d,vocabulary:r,findings:i,count:0,all:0,slot:c};x(m,`${n}.${s}.${c}`,1,y),D(y,`${n}.${s}.${c}`,`this ${c}`,"show less, or move detail to the page")}}return i}function ge(e){let n=new Set(Object.keys(e.kinds)),o=new Set(Object.values(e.kinds).flatMap(r=>Object.keys(b(r.edges)))),t=r=>{let i=p(e.kinds,r)?e.kinds[r]:void 0;return i?{field:s=>p(i.fields,s)||p(i.computed,s)||A(i.edges).has(s),relation:s=>p(b(i.edges),s),figure:i.figure!==void 0,files:s=>p(i.fields,s)&&Z(i.fields[s]),choices:s=>p(i.fields,s)&&i.fields[s].type==="enum"?i.fields[s].options:void 0,targets:s=>p(b(i.edges),s)?i.edges[s].to:void 0,prose:s=>p(i.fields,s)&&i.fields[s].type==="text"}:void 0},d={namesOf:t,sources:r=>Object.keys(e.kinds).filter(i=>p(e.kinds[i].edges,r))},a=te(e.views,"views",t,n,o,"document",d);return oe(e.lenses,d,n,o,a),a}export{E as a,P as b,L as c,B as d,M as e,ue as f,U as g,fe as h,ce as i,ge as j};
|
|
1
|
+
import{a as S,b as $,c as w,d as R,e as V}from"./chunk.FWTIUYXH.js";import{h as l,i as F}from"./chunk.MAF7C3VM.js";import{wa as b,xa as A}from"./chunk.MNP4JI33.js";var O=["card","row","page"],E=["good","warn","bad","neutral","accent"],P=["money","percent","date","relative","count"],_=4,T=40,I=120,L=["number","money","percent"],B=["large"],H=["card","row"],M=1e3,ue=100;function U(e){let n=/^\s*(out|in)\(\s*['"]([A-Za-z][A-Za-z0-9_-]*)['"]\s*\)\s*$/.exec(e);return n?{edge:n[2],way:n[1]}:/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?{edge:e}:void 0}var v={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label","emphasis"]},C=Object.keys(v),G=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?, "emphasis"?: "large"}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,Z=e=>/^(image|file)$/.test(e?.of??e?.type??"");function fe(e){return Object.fromEntries(Object.entries(e.views??{}).filter(([,n])=>!Array.isArray(n)))}function ce(e){let n=e.views?.home;return Array.isArray(n)?n:void 0}var X={field:()=>!1,relation:()=>!1,figure:!1},Y=e=>e.kind??"the home",p=(e,n)=>e!==void 0&&Object.hasOwn(e,n),g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function z(e,n,o){let t=S(e);for(let d of t.unknownFunctions)o.findings.push(l("unknown-function",n,`"${d}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let d of t.names){if(o.kind===null){o.findings.push(l("view-name",n,`"${d}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}d==="id"||o.spec.field(d)||o.spec.relation(d)||o.findings.push(l("view-name",n,`${o.kind} has no field or relation called "${d}"`))}for(let d of t.edges)o.edges.has(d)||o.findings.push(l("view-edge",n,`"${d}" is not a relation any kind declares`));for(let d of t.sweeps)o.kinds.has(d)||o.findings.push(l("view-kind",n,`"${d}" is not a kind this document declares`))}function k(e,n,o){if(typeof e!="string"||e.length===0||e.length>2e3){o.findings.push(l("view-expression",n,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{z(w(e),n,o)}catch(t){if(!(t instanceof $))throw t;o.findings.push(l("expression",n,`${t.sentence} (at character ${t.at+1})`))}}function j(e,n,o,t=!1){if(typeof e!="string"||e.length===0||e.length>300){o.findings.push(l("view-template",n,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let d;try{d=V(e)}catch(a){if(a instanceof R||a instanceof $){o.findings.push(l("template",n,a.sentence));return}throw a}for(let a of d)if(a.expr&&(z(a.expr,n,o),t&&!a.format&&a.expr.t==="ident"&&(o.slot==="card"||o.slot==="row")&&o.spec.prose?.(a.expr.name))){let r=a.expr.name;o.findings.push(F("view-whole-text",n,`${o.kind} ${o.slot} shows ${r} whole; it will be clamped. Use {${r}|excerpt} or move it to the page.`,`write {${r}|excerpt}, or {${r}|excerpt: 80} for fewer characters`))}}function q(e,n,o){if(typeof e=="string"){E.includes(e)||o.findings.push(l("view-tone",n,`"${e}" is not a tone`,`use one of ${E.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(g(e)&&Object.keys(e).length===1&&"expr"in e){k(e.expr,`${n}.expr`,o);return}o.findings.push(l("view-tone",n,'a tone is a word or {"expr": \u2026}',`one of ${E.join(", ")}`))}function x(e,n,o,t){if(!Array.isArray(e)){t.findings.push(l("view-shape",n,"a view is a list of blocks"));return}if(o>_){t.findings.push(l("view-depth",n,`blocks nest at most ${_} deep`,"flatten a group or a condition"));return}e.forEach((d,a)=>J(d,`${n}.${a}`,o,t))}function J(e,n,o,t){if(o===1&&t.count++,t.all++,!g(e)){t.findings.push(l("view-block",n,"a block is an object naming what it shows",`one of ${G}`));return}let d=Object.keys(e),a=d.filter(s=>C.includes(s)&&!(s==="group"&&d.includes("list")));if(a.length===0){t.findings.push(l("view-block",n,`${d.length>0?d.map(s=>`"${s}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${G}`));return}if(a.length>1){t.findings.push(l("view-block",n,`a block is one thing, and this says ${a.map(s=>`"${s}"`).join(" and ")}`,"split it into two blocks"));return}let r=a[0];for(let s of d)s!==r&&s!="key"&&!v[r].includes(s)&&t.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" is not part of a ${r} block`,v[r].length>0?`a ${r} block may also say ${v[r].map(u=>`"${u}"`).join(", ")}`:`a ${r} block says nothing else`));let i=e[r];switch(r){case"title":case"headline":case"text":case"badge":j(i,`${n}.${r}`,t,r==="text"),"tone"in e&&q(e.tone,`${n}.tone`,t);return;case"image":case"field":{let s=r==="image";if(typeof i!="string"||!(s?t.spec.files?.(i):t.spec.field(i))){let f=typeof i=="string"&&t.spec.relation(i);t.findings.push(l(`view-${r}`,`${n}.${r}`,`${t.kind} has no ${s?"image or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,f?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let u=s?["thumb","gallery"]:P;"as"in e&&!u.includes(e.as)&&t.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to show ${s?"pictures":"a field"}`,`use one of ${u.join(", ")}`)),s||N(e,n,t,"field"),"label"in e&&ie(e.label,`${n}.label`,t);return}case"progress":{!g(i)||Object.keys(i).some(s=>s!=="value"&&s!=="max")||!("value"in i)||!("max"in i)?t.findings.push(l("view-progress",`${n}.progress`,'progress is {"value": expression, "max": expression}')):(k(i.value,`${n}.progress.value`,t),k(i.max,`${n}.progress.max`,t)),"label"in e&&j(e.label,`${n}.label`,t);return}case"group":"direction"in e&&e.direction!=="row"&&e.direction!=="column"&&t.findings.push(l("view-direction",`${n}.direction`,`a group runs "row" or "column", not "${String(e.direction)}"`)),x(i,`${n}.group`,o+1,t);return;case"when":k(i,`${n}.when`,t),"show"in e?x(e.show,`${n}.show`,o+1,t):t.findings.push(l("view-when",n,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return Q(e,n,t);for(let s of["as","currency","label","emphasis"])s in e&&t.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?t.findings.push(l("view-block",`${n}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):t.spec.figure||t.findings.push(l("view-figure",`${n}.figure`,`${Y(t)} has no figure to show`,t.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return ne(e,n,t);case"divider":i!==!0&&t.findings.push(l("view-block",`${n}.${r}`,`write {"${r}": true}`));return}}function Q(e,n,o){k(e.figure,`${n}.figure`,o),"as"in e&&!L.includes(e.as)&&o.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to say a figure`,`use one of ${L.join(", ")}`)),N(e,n,o,"figure"),"label"in e&&j(e.label,`${n}.label`,o),"emphasis"in e&&!B.includes(e.emphasis)&&o.findings.push(l("view-emphasis",`${n}.emphasis`,`"${String(e.emphasis)}" is not how loudly a figure is said`,`use ${B.map(t=>`"${t}"`).join(", ")}, or leave it out for the figure's own size`))}function N(e,n,o,t){"currency"in e&&(typeof e.currency!="string"||!/^[A-Z]{3}$/.test(e.currency)?o.findings.push(l("view-currency",`${n}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):e.as!=="money"&&o.findings.push(l("view-currency",`${n}.currency`,`a currency belongs on a ${t} shown as money`,'add "as": "money"')))}function ee(e,n){let o=[...n.kinds],t=(a,r)=>{let i=new Set;for(let s of a){let u=n.vocabulary.namesOf(s)?.targets?.(r);if(u==="*")return o;for(let f of u??[])i.add(f)}return i.size>0?[...i]:void 0},d=a=>{switch(a.t){case"ident":return n.kind!==null&&n.spec.relation(a.name)?t([n.kind],a.name):void 0;case"member":{let r=d(a.object);return r?t(r,a.name):void 0}case"where":return d(a.set);case"call":{let r=a.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(a.fn==="all")return i!==void 0&&n.kinds.has(i)?[i]:void 0;let s=a.args.length===2&&a.args[1]?.t==="lit"&&typeof a.args[1].value=="string"?a.args[1].value:void 0;if(a.fn==="out"&&s!==void 0){let u=d(r);return u?t(u,s):void 0}if(a.fn==="out")return i!==void 0&&n.kind!==null?t([n.kind],i):void 0;if(a.fn==="in"){let u=s??i,f=s!==void 0?d(r):n.kind!==null?[n.kind]:void 0,c=u!==void 0?n.vocabulary.sources(u).filter(m=>{let y=n.vocabulary.namesOf(m)?.targets?.(u);return!f||y==="*"||f.some(h=>y?.includes(h))}):[];return c.length>0?c:void 0}if((a.fn==="sort"||a.fn==="first")&&r)return d(r);if(a.fn==="either"){let u=a.args.map(d);return u.every(f=>f!==void 0)?[...new Set(u.flatMap(f=>f??[]))]:void 0}return}default:return}};return d(e)}function K(e,n,o,t){let d;try{d=w(e)}catch(r){if(!(r instanceof $))throw r;t.findings.push(l("expression",n,`${r.sentence} (at character ${r.at+1})`));return}let a=S(d);for(let r of a.unknownFunctions)t.findings.push(l("unknown-function",n,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of a.edges)t.edges.has(r)||t.findings.push(l("view-edge",n,`"${r}" is not a relation any kind declares`));if(o)for(let r of a.names)r==="id"||o.some(i=>t.vocabulary.namesOf(i)?.field(r)||t.vocabulary.namesOf(i)?.relation(r))||t.findings.push(l("view-name",n,`${o.join(" and ")} ${o.length===1?"has":"have"} no field or relation called "${r}"`))}function ne(e,n,o){let t=e.list;k(t,`${n}.list`,o);let d;if(typeof t=="string")try{d=ee(w(t),o)}catch{d=void 0}let a=i=>{if(!d)return[...o.kinds].map(u=>o.vocabulary.namesOf(u)?.choices?.(i)).find(u=>u!==void 0);let s=d.map(u=>o.vocabulary.namesOf(u)?.choices?.(i));return s.every(u=>u!==void 0)?[...new Set(s.flatMap(u=>u??[]))]:void 0},r=d?d.join(" and "):"any kind";if("sort"in e){let i=e.sort;if(typeof i=="string")K(i,`${n}.sort`,d,o);else if(g(i)&&typeof i.by=="string"&&Object.keys(i).every(s=>s==="by"||s==="direction")){let s=i.direction;s!==void 0&&s!=="asc"&&s!=="desc"&&s!=="choices"?o.findings.push(l("list-sort",`${n}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(s)}"`,'"choices" puts a choice field in the order its choices are declared')):s==="choices"?a(i.by)===void 0&&o.findings.push(l("list-sort",`${n}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):K(i.by,`${n}.sort.by`,d,o)}else o.findings.push(l("list-sort",`${n}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in e){let i=e.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>M)&&o.findings.push(l("list-limit",`${n}.limit`,`a limit is a whole number from 1 to ${M}`))}if("group"in e){let i=e.group,s=typeof i=="string"?i:g(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||g(i)&&Object.keys(i).every(f=>f==="by"||f==="headings"))||s===void 0)o.findings.push(l("list-group",`${n}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}} \u2014 or a relation, like "inGenre", a heading per linked record'));else{let f=a(s),c=f===void 0?U(s):void 0,m=c!==void 0&&(c.way!==void 0?o.edges.has(c.edge):d?d.every(y=>o.vocabulary.namesOf(y)?.relation(c.edge)):o.edges.has(c.edge));if(f===void 0&&!m&&o.findings.push(l("list-group",`${n}.group`,`"${s}" is not a choice field or a relation of ${r}, so it has nothing to group by`,'group by a field whose type is enum, or by a relation of the kind listed, like "inGenre"')),g(i)&&"headings"in i){let y=i.headings;if(!g(y)||Object.values(y).some(h=>typeof h!="string"||h.length===0||h.length>80))o.findings.push(l("list-group",`${n}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(f)for(let h of Object.keys(y))f.includes(h)||o.findings.push(l("list-group",`${n}.group.headings.${h}`,`"${h}" is not one of ${s}'s choices`,`use ${f.join(", ")}`))}}}"empty"in e&&(typeof e.empty!="string"||e.empty.length===0||e.empty.length>200)&&o.findings.push(l("list-empty",`${n}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in e&&!H.includes(e.as)&&o.findings.push(l("list-as",`${n}.as`,`a list draws each record as its "card" or its "row", not "${String(e.as)}"`))}function ie(e,n,o){(typeof e!="string"||e.length===0||e.length>60)&&o.findings.push(l("view-label",n,"a label is a few words, at most 60 characters"))}function W(e,n,o,t,d,a,r){let i={kind:null,spec:X,kinds:t,edges:d,vocabulary:o,findings:a,count:0,all:0};Array.isArray(e)&&e.length===0&&a.push(l("view-shape",n,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),x(e,n,1,i),D(i,n,r,"show less")}function D(e,n,o,t){e.count>T?e.findings.push(l("view-size",n,`${o} has ${e.count} blocks at its top; a view has at most ${T} there, a group or a condition counting as one`,`${t}, or gather some into a group`)):e.all>I&&e.findings.push(l("view-size",n,`${o} has ${e.all} blocks counting the ones inside its groups and conditions; a view has at most ${I} in all`,t))}function oe(e,n,o,t,d){Array.isArray(e)&&e.forEach((a,r)=>{if(!g(a)||a.name!=="blocks"||!g(a.options)||!("blocks"in a.options))return;let i=[];W(a.options.blocks,`lenses.${r}.options.blocks`,n,o,t,i,`the lens "${String(a.title??r)}"`);for(let s of i)d.push({...s,severity:"warning"})})}function te(e,n,o,t,d,a,r){let i=[];if(e===void 0)return i;if(!g(e))return i.push(l("view-shape",n,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[s,u]of Object.entries(e)){if(s==="home"&&Array.isArray(u)){W(u,`${n}.home`,r,t,d,i,"the home");continue}let f=o(s);if(!f){i.push(l("view-kind",`${n}.${s}`,`"${s}" is not a kind this ${a} declares`));continue}if(!g(u)){i.push(l("view-shape",`${n}.${s}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(u))O.includes(c)||i.push(l("view-slot",`${n}.${s}.${c}`,`"${c}" is not a place a view is drawn`,`use ${O.map(m=>`"${m}"`).join(", ")}`));for(let c of O){let m=u[c];if(m===void 0)continue;let y={kind:s,spec:f,kinds:t,edges:d,vocabulary:r,findings:i,count:0,all:0,slot:c};x(m,`${n}.${s}.${c}`,1,y),D(y,`${n}.${s}.${c}`,`this ${c}`,"show less, or move detail to the page")}}return i}function ge(e){let n=new Set(Object.keys(e.kinds)),o=new Set(Object.values(e.kinds).flatMap(r=>Object.keys(b(r.edges)))),t=r=>{let i=p(e.kinds,r)?e.kinds[r]:void 0;return i?{field:s=>p(i.fields,s)||p(i.computed,s)||A(i.edges).has(s),relation:s=>p(b(i.edges),s),figure:i.figure!==void 0,files:s=>p(i.fields,s)&&Z(i.fields[s]),choices:s=>p(i.fields,s)&&i.fields[s].type==="enum"?i.fields[s].options:void 0,targets:s=>p(b(i.edges),s)?i.edges[s].to:void 0,prose:s=>p(i.fields,s)&&i.fields[s].type==="text"}:void 0},d={namesOf:t,sources:r=>Object.keys(e.kinds).filter(i=>p(e.kinds[i].edges,r))},a=te(e.views,"views",t,n,o,"document",d);return oe(e.lenses,d,n,o,a),a}export{E as a,P as b,L as c,B as d,M as e,ue as f,U as g,fe as h,ce as i,ge as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as a}from"./chunk.
|
|
1
|
+
import{e as a}from"./chunk.EBGAYL32.js";import{m as i}from"./chunk.6QWV5MVH.js";import{Gc as o}from"./chunk.MNP4JI33.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};
|