graview 0.1.28 → 0.1.29
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.2643W7FT.js +1 -0
- package/dist/preview/chunk.2CLPRG3I.js +1 -0
- package/dist/preview/chunk.2IZFIORK.js +1 -0
- package/dist/preview/chunk.2NCTM5K2.js +2 -0
- package/dist/preview/{chunk.EYF6ONTA.js → chunk.3G5MQFZK.js} +1 -1
- package/dist/preview/chunk.3JM2TNDD.js +2 -0
- package/dist/preview/chunk.44FVJOK4.js +28 -0
- package/dist/preview/chunk.4GGAPOMK.js +2 -0
- package/dist/preview/chunk.5AT4O4BN.js +1 -0
- package/dist/preview/chunk.5JXUAMKI.js +1 -0
- package/dist/preview/chunk.5R66YTET.js +2 -0
- package/dist/preview/chunk.64P76WK4.js +1 -0
- package/dist/preview/chunk.7D77HEIJ.js +1 -0
- package/dist/preview/chunk.7DNFXJH3.js +1 -0
- package/dist/preview/{chunk.SBHVVJY7.js → chunk.7PRFYYVM.js} +1 -1
- package/dist/preview/chunk.AE5GKL4C.js +1 -0
- package/dist/preview/chunk.ARR75WBP.js +35 -0
- package/dist/preview/chunk.AVUS5LMG.js +3 -0
- package/dist/preview/chunk.BKPGDEES.js +1 -0
- package/dist/preview/chunk.BZ5OJYHU.js +1 -0
- package/dist/preview/chunk.CK7QWLMX.js +1 -0
- package/dist/preview/chunk.COTG2IG5.js +1 -0
- package/dist/preview/chunk.D4GOVA25.js +1 -0
- package/dist/preview/chunk.DAA6XWLF.js +1 -0
- package/dist/preview/chunk.DKTCRFMS.js +1 -0
- package/dist/preview/chunk.DLGTFXGM.js +1 -0
- package/dist/preview/chunk.DN7SN6ZR.js +1 -0
- package/dist/preview/chunk.G4WQGTZR.js +3 -0
- package/dist/preview/chunk.GDA3G4U2.js +6 -0
- package/dist/preview/chunk.GS4T26WW.js +328 -0
- package/dist/preview/chunk.GZH6PTXN.js +1 -0
- package/dist/preview/chunk.HFKMHLJ3.js +1 -0
- package/dist/preview/chunk.HGAMNIST.js +1 -0
- package/dist/preview/chunk.HJCQ6I3S.js +1 -0
- package/dist/preview/chunk.HKBKH7EK.js +1 -0
- package/dist/preview/chunk.HLLWKSZB.js +5 -0
- package/dist/preview/chunk.HONUT6OG.js +1 -0
- package/dist/preview/chunk.HRWLR7T4.js +1 -0
- package/dist/preview/chunk.HV6I74DF.js +1 -0
- package/dist/preview/chunk.IPBXAAQV.js +17 -0
- package/dist/preview/chunk.IWYUFYDJ.js +1 -0
- package/dist/preview/chunk.IZW7DBK4.js +1 -0
- package/dist/preview/chunk.J46KDTEZ.js +10 -0
- package/dist/preview/chunk.JNGUSAWX.js +70 -0
- package/dist/preview/chunk.JU2ZVKMT.js +2 -0
- package/dist/preview/chunk.K4ZUVH2G.js +1 -0
- package/dist/preview/chunk.KC6UZHBM.js +1 -0
- package/dist/preview/chunk.KLITC55P.js +1 -0
- package/dist/preview/chunk.KZ2376BD.js +19 -0
- package/dist/preview/chunk.LYJAVUST.js +1 -0
- package/dist/preview/chunk.MB7LKKUD.js +1 -0
- package/dist/preview/chunk.MOUGB4H6.js +1 -0
- package/dist/preview/chunk.MYFWM572.js +1 -0
- package/dist/preview/chunk.N4FBDA2W.js +1 -0
- package/dist/preview/chunk.O42YET3W.js +1 -0
- package/dist/preview/chunk.O4QPITBD.js +9 -0
- package/dist/preview/{chunk.5BGA2VUS.js → chunk.OGXE2RHC.js} +4 -4
- package/dist/preview/chunk.OHE5AMHH.js +0 -0
- package/dist/preview/chunk.ONGVH3ZM.js +1076 -0
- package/dist/preview/chunk.OQDETV4X.js +1 -0
- package/dist/preview/chunk.OWBEV6FR.js +1 -0
- package/dist/preview/chunk.OWE6OJ4P.js +1 -0
- package/dist/preview/chunk.OYJSFO3A.js +1 -0
- package/dist/preview/chunk.P62SKNJS.js +27 -0
- package/dist/preview/chunk.PA5HYAEO.js +1 -0
- package/dist/preview/{chunk.IDI2BQ7Y.js → chunk.PMEDLEZY.js} +2 -2
- package/dist/preview/chunk.PTXQHHKF.js +1 -0
- package/dist/preview/chunk.Q5WEOX3Q.js +1 -0
- package/dist/preview/chunk.QNHECGMH.js +1 -0
- package/dist/preview/chunk.QSDT2RLY.js +1 -0
- package/dist/preview/chunk.R2D373VG.js +1 -0
- package/dist/preview/chunk.RB4RTBRZ.js +1 -0
- package/dist/preview/chunk.RCLJ4H52.js +116 -0
- package/dist/preview/chunk.RKRSRKF3.js +1 -0
- package/dist/preview/chunk.RWGLKDWH.js +1 -0
- package/dist/preview/chunk.SIL4KD3K.js +1 -0
- package/dist/preview/chunk.SS76EIMI.js +1 -0
- package/dist/preview/{chunk.IKT7JQUW.js → chunk.T4LY5QXO.js} +1 -1
- package/dist/preview/chunk.UIIVEQAT.js +1 -0
- package/dist/preview/chunk.UT6642FC.js +1 -0
- package/dist/preview/chunk.UTHHX2TJ.js +1 -0
- package/dist/preview/chunk.UWNYT7PF.js +1 -0
- package/dist/preview/chunk.V6TK4LHW.js +6 -0
- package/dist/preview/chunk.VNBO2RXD.js +1 -0
- package/dist/preview/chunk.VPPUTA74.js +1 -0
- package/dist/preview/chunk.WKXNBHTL.js +4 -0
- package/dist/preview/chunk.WLRTPFAC.js +1 -0
- package/dist/preview/chunk.X53HI436.js +1 -0
- package/dist/preview/chunk.XAXJHEMD.js +1 -0
- package/dist/preview/chunk.XDYAG276.js +1 -0
- package/dist/preview/chunk.XDZSTIS6.js +88 -0
- package/dist/preview/chunk.XXHNV24G.js +1 -0
- package/dist/preview/chunk.YCA7P5MK.js +1 -0
- package/dist/preview/chunk.YRQZZH5V.js +1 -0
- package/dist/preview/chunk.YUWRZWGX.js +1 -0
- package/dist/preview/chunk.Z2RGLFLS.js +1 -0
- package/dist/preview/chunk.Z56B2JR2.js +25 -0
- package/dist/preview/chunk.Z5V23DQN.js +3 -0
- package/dist/preview/chunk.ZBXOX3W3.js +1 -0
- package/dist/preview/chunk.ZEGSQCSD.js +1 -0
- package/dist/preview/chunk.ZEVVWWNA.js +44 -0
- package/dist/preview/chunk.ZS4DJ76C.js +1 -0
- package/dist/preview/chunk.ZSKP6UQS.js +3 -0
- package/dist/preview/page.js +6 -6
- package/package.json +6 -6
- package/dist/preview/chunk.22H4JXTH.js +0 -8
- package/dist/preview/chunk.25OYH6MY.js +0 -1
- package/dist/preview/chunk.2GBQJXJH.js +0 -19
- package/dist/preview/chunk.2VUG6EAN.js +0 -1
- package/dist/preview/chunk.337WDTG3.js +0 -2
- package/dist/preview/chunk.3HLLQ5CJ.js +0 -1
- package/dist/preview/chunk.46KUPBQC.js +0 -1
- package/dist/preview/chunk.4H7CQE56.js +0 -1
- package/dist/preview/chunk.4HGBVU5B.js +0 -1
- package/dist/preview/chunk.4RO5DA22.js +0 -1
- package/dist/preview/chunk.4TUNX4WM.js +0 -29
- package/dist/preview/chunk.6LJ66MB7.js +0 -1
- package/dist/preview/chunk.6R4EI47C.js +0 -1
- package/dist/preview/chunk.7S22MBNN.js +0 -1
- package/dist/preview/chunk.A73BXXE4.js +0 -3
- package/dist/preview/chunk.AHDOKM4O.js +0 -1
- package/dist/preview/chunk.ARE3MEDN.js +0 -1
- package/dist/preview/chunk.ASFZTYFO.js +0 -1
- package/dist/preview/chunk.BBJZ6O7J.js +0 -1
- package/dist/preview/chunk.BCBH6WJF.js +0 -1
- package/dist/preview/chunk.CAZAB352.js +0 -1
- package/dist/preview/chunk.CY7MDLRS.js +0 -1
- package/dist/preview/chunk.DAVRLRGB.js +0 -1
- package/dist/preview/chunk.DCIC3YHX.js +0 -1
- package/dist/preview/chunk.EW4JFOJY.js +0 -1
- package/dist/preview/chunk.FP27W5MU.js +0 -1
- package/dist/preview/chunk.G2OOBROL.js +0 -1040
- package/dist/preview/chunk.GCKSQ52O.js +0 -1
- package/dist/preview/chunk.GE5EAN36.js +0 -2
- package/dist/preview/chunk.HOPIZMJR.js +0 -2
- package/dist/preview/chunk.IBGO4BUF.js +0 -1
- package/dist/preview/chunk.IH42QTOM.js +0 -1
- package/dist/preview/chunk.ISRS7GOT.js +0 -321
- package/dist/preview/chunk.J6CBMLGR.js +0 -1
- package/dist/preview/chunk.JRCV6HVV.js +0 -1
- package/dist/preview/chunk.KWW3YHQ4.js +0 -23
- package/dist/preview/chunk.MKNXV4TM.js +0 -8
- package/dist/preview/chunk.MRK6QJV5.js +0 -25
- package/dist/preview/chunk.MVNIKZIC.js +0 -1
- package/dist/preview/chunk.N2WTNKEV.js +0 -1
- package/dist/preview/chunk.N7HCALRK.js +0 -61
- package/dist/preview/chunk.NRRUGG22.js +0 -1
- package/dist/preview/chunk.OGL4PHTY.js +0 -1
- package/dist/preview/chunk.PFQFPJ5L.js +0 -16
- package/dist/preview/chunk.PN2H6X7O.js +0 -1
- package/dist/preview/chunk.PWHJHFC4.js +0 -1
- package/dist/preview/chunk.Q3HVA6L4.js +0 -1
- package/dist/preview/chunk.RZLNDVGN.js +0 -107
- package/dist/preview/chunk.SNBIZ3B6.js +0 -1
- package/dist/preview/chunk.TBG2QBOS.js +0 -1
- package/dist/preview/chunk.VR735ZQL.js +0 -1
- package/dist/preview/chunk.VSXCXPK2.js +0 -1
- package/dist/preview/chunk.W3LDQ6B2.js +0 -1
- package/dist/preview/chunk.WCNONCTL.js +0 -6
- package/dist/preview/chunk.WHTNSETN.js +0 -1
- package/dist/preview/chunk.XG67BWH6.js +0 -1
- package/dist/preview/chunk.XRM6WXPW.js +0 -1
- package/dist/preview/chunk.Y5LPZLDE.js +0 -1
- package/dist/preview/chunk.YETBY2LM.js +0 -1
- package/dist/preview/chunk.YSYT3ASK.js +0 -1
- package/dist/preview/chunk.ZEUBAAVQ.js +0 -1
- package/dist/preview/chunk.ZJDRD6PO.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as je,j as Ve,l as Fe,m as Ie}from"./chunk.22H4JXTH.js";import{b as Be}from"./chunk.IH42QTOM.js";import{b as Ge,e as W,f as ve}from"./chunk.PN2H6X7O.js";import{b as qe}from"./chunk.OGL4PHTY.js";import{d as ge,e as We,f as ye,h as _e}from"./chunk.DCIC3YHX.js";import{b as De}from"./chunk.WHTNSETN.js";import{a as ze}from"./chunk.W3LDQ6B2.js";import{B as Ee,D as Ne,F as He,S as Ke,T as Oe,V as oe,c as Le,da as q,i as I,k as j,l as _,q as G,qa as re,r as Re,x as Pe,y as Me}from"./chunk.NRRUGG22.js";import{Q as $e,Qa as ne,Ra as me,Ta as Te,Ua as Ce,W as Ae,X as te}from"./chunk.MKNXV4TM.js";import{a as U,b as ae}from"./chunk.MRK6QJV5.js";import{b as O}from"./chunk.AJZBJBMO.js";var Je=O(U(),1);function Qe(e,t){try{t.length===0?localStorage.removeItem(ge(e)):localStorage.setItem(ge(e),JSON.stringify(t))}catch{}}function ct(e,t){Qe(e,[...ye(e).filter(r=>r.title!==t.title),t])}function pt(e,t){Qe(e,ye(e).filter(r=>r.title!==t))}function ut(e,t){for(let r of e.places().filter(a=>a.title===t))e.forget?.(r.kind,r.as)}var ft=e=>e===!0?{written:!0}:typeof e=="object"&&e!==null?{written:e.kept===!0,...e.said?{said:e.said}:{}}:{written:!1},Ue=e=>({title:e.title,lens:e.lens,on:e.on,...e.bindings?{bindings:e.bindings}:{},...e.options?{options:e.options}:{}});function mt(e,t){let r=a=>t.some(c=>c.title===a||c.as===ne(a));if(!r(e))return e;for(let a=2;;a++)if(!r(`${e} ${a}`))return`${e} ${a}`}function Ye(e){let{store:t,views:r,brand:a,seatTalk:c,onKeepLens:l}=q(),S=(0,Je.useContext)(qe),x=We(a,t.schema),M=async p=>{let{edit:u}=p;if(p.written&&l)try{await l({op:"remove-lens",title:u.title,on:u.on})}catch{}pt(x,u.title),ut(r,u.title),S?.dismiss(`kept:${u.title}`),c.setTurns(g=>[...g.map(h=>h.kept&&h.kept.edit.title===u.title&&!h.kept.taken?{...h,kept:{...h.kept,taken:!0}}:h),{role:"seat",text:`Took \u201C${u.title}\u201D back out of the places.`}]);let s=te(t.schema,u.on);e({to:"kind",kind:u.on,title:s,address:me(t.schema,u.on),said:`Went to ${s}.`})};return{keep:async p=>{let u=mt(p.edit.title,r.places()),s={...p.edit,title:u},g=!1,h;if(l)try{({written:g,said:h}=ft(await l(s)))}catch{g=!1}g||ct(x,Ue(s)),_e(r,t.schema,[Ue(s)]);let d=r.places(),f=d.find(w=>w.title===u),A=h??(g?`Kept \u201C${u}\u201D as a lens: it is in the places now.`:l?`Kept \u201C${u}\u201D as your own lens. Ask the owner to keep it for everyone.`:`Kept \u201C${u}\u201D as your own lens.`),T={edit:s,written:g};c.setDraft(null),c.setTurns(w=>[...w,{role:"seat",text:A,kept:T}]),c.get().open||S?.notify({kind:"toast",id:`kept:${u}`,sentence:A,timeout:1e4,action:{label:"Take back",onSelect:()=>void M(T)}}),f&&e({to:"picture",kind:f.kind,as:f.as,title:u,address:Te(f.as,Ce(f,d)?me(t.schema,f.kind).slice(1):void 0),said:`Went to ${u}.`})},takeBack:M}}var Ze=O(U(),1);function gt(e,t){switch(t.to){case"place":return{view:Le("#")};case"picture":return{view:G(He(j(e,"filter",null),t.kind,t.as),[])};case"kind":{let r=Re(_({...I(e,Ee(t.kind)),relation:null},!1),!0);return{view:G(j(j(r,"view",null),"filter",t.filter??null),[])}}case"record":return{view:G(I(_(j(j(e,"view",null),"filter",null),!1),t.id),[t.id])};case"problems":return{pane:"problems"}}}function yt(e){let t=typeof document>"u"?null:document.querySelector('[data-testid="standing"]');t&&t.getAttribute("aria-expanded")==="true"!==e&&t.click()}function Xe(){let{setView:e,seatTalk:t}=q();return(0,Ze.useCallback)(r=>{t.get().draft&&t.setDraft(null),yt(r.to==="problems"),r.to!=="problems"&&e(a=>{let c=gt(a,r);return"view"in c?c.view:a})},[e,t])}var se=O(U(),1),vt=220;function ht(e,t){if(!e||!t||typeof document>"u")return null;let r=e.getBoundingClientRect(),a=document.elementFromPoint(r.left+t.x,r.top+t.y),c=a?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");return c||(a?.closest("[data-graview-view]")?.getAttribute("data-graview-view")??null)}function et({hover:e=!0}={}){let{store:t,view:r,views:a,pointer:c}=q(),{selection:l}=re(),[S,x]=(0,se.useState)(null);(0,se.useEffect)(()=>{if(!e)return;let s=null,g=!1,h=()=>typeof document<"u"&&document.querySelector("[data-graview-reach]")!==null?document.querySelector("[data-graview-settled]")===null:!1,d=()=>{if(s&&clearTimeout(s),g)return;let w=c.snapshot();if(!w){x(R=>R===null?R:null);return}s=setTimeout(()=>{if(g||h()){d();return}let R=typeof document>"u"?null:document.querySelector("[data-graview-stage]"),b=ht(R,w);x(P=>P===b?P:b)},vt)},f=()=>{g=!0,s&&clearTimeout(s)},A=()=>{g=!1,d()},T=c.subscribe(d);return document.addEventListener("pointerdown",f,!0),document.addEventListener("pointerup",A,!0),document.addEventListener("pointercancel",A,!0),d(),()=>{T(),document.removeEventListener("pointerdown",f,!0),document.removeEventListener("pointerup",A,!0),document.removeEventListener("pointercancel",A,!0),s&&clearTimeout(s)}},[c,e]);let M=s=>{let g=t.graph.getNode(s);if(g)return $e(t.schema.tryDefinition(g.kind),g);let h=je(s,t.schema);if(h)return h;let d=Me(s);if(d)return te(t.schema,d);let f=Ne(s);if(f.length>0){let A=f.map(w=>Ae(t.schema,w)),T=A.length===1?A[0]:`${A.slice(0,-1).join(", ")} and ${A.at(-1)}`;return T.charAt(0).toUpperCase()+T.slice(1)}return null},E=l[l.length-1];if(E!==void 0){let s=M(E);if(s)return{id:E,name:l.length>1?`${s} and ${l.length-1} more`:s,because:"selection"}}if(S!=null){let s=M(S);if(s)return{id:S,name:s,because:"hover"}}let p=r.within?.view,u=p?a.places().find(s=>s.as===p||ne(s.title)===p):void 0;if(u)return{id:null,name:u.title,because:"place"};if(r.focusId){let s=M(r.focusId);if(s)return{id:r.focusId,name:s,because:"place"}}return{id:null,name:"the whole thing",because:"place"}}var L=O(U(),1);var D=O(U(),1),$=O(ae(),1),B=(e,t)=>`${e}:${t}`;function tt({answer:e,said:t,onReply:r,talk:a}){let[c]=(0,D.useState)(()=>Oe(null)),l=a??c,{turns:S,outcomes:x,busy:M}=oe(l),E=(0,D.useCallback)((u,s)=>l.settle(u,s),[l]);return{turns:S,outcomes:x,busy:M,send:async u=>{let s=u.trim();if(!s||l.get().busy)return;l.setBusy(!0);let g=l.get();l.setTurns(f=>[...f,{role:"person",text:s}]);let h=g.turns.map((f,A)=>{let T=(f.proposals??[]).map((w,R)=>{let b=g.outcomes.get(B(A,R));return b?.state==="refused"?`${t(w)} \u2014 refused: ${b.error}`:b?`${b.said} \u2014 ${b.state==="applied"?"applied":"set aside"}`:t(w)});return{role:f.role,text:T.length>0?`${f.text} [Offered beneath this answer: ${T.join("; ")}]`:f.text}}),d;try{d=await e(s,{history:h})}catch(f){d={say:`That couldn't be answered: ${f instanceof Error?f.message:String(f)}`,proposals:[]}}l.setTurns(f=>[...f,{role:"seat",text:d.say,proposals:d.proposals,...d.questions?{questions:d.questions}:{},...d.picks?.length?{picks:d.picks}:{},...d.moves?.length?{moves:d.moves}:{},...d.offer?{offer:d.offer}:{},...d.unsure?{unsure:!0}:{},...d.via?{via:d.via}:{}}]),r?.(d),l.setBusy(!1)},settle:E}}var wt=e=>{let t=/^([\s\S]*?)\s*(\((?:[^()]|\([^()]*\))*\))\s*$/.exec(e);return t&&t[1]?{said:t[1],aside:t[2]}:{said:e}};function nt({turns:e,outcomes:t,busy:r,testId:a,empty:c,minHeight:l=64,maxHeight:S="min(46cqh, 400px)",renderProposal:x,renderAfter:M,renderSaid:E,ready:p=()=>!0,onApplyAll:u,applyAllLabel:s="Apply all"}){let g=(0,D.useRef)(null);return(0,D.useEffect)(()=>{g.current?.scrollTo?.({top:g.current.scrollHeight})},[e]),e.length===0&&c===null&&!r?null:(0,$.jsxs)("ol",{ref:g,style:{margin:0,padding:10,listStyle:"none",display:"grid",gap:8,alignContent:"start",maxHeight:S,minHeight:l,overflowY:"auto"},children:[e.length===0?c===null?null:(0,$.jsx)("li",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)",lineHeight:1.5},children:c}):null,e.map((h,d)=>{let f=h.proposals??[],A=f.filter((w,R)=>{let b=B(d,R),P=t.get(b);return P?.state!=="applied"&&P?.state!=="declined"&&p(w,b)}),T=wt(h.text);return(0,$.jsxs)("li",{style:{display:"grid",gap:6,justifyItems:h.role==="person"?"end":"start"},children:[h.role==="person"?(0,$.jsx)("p",{style:{margin:0,maxWidth:"85%",padding:"6px 10px",borderRadius:"12px 12px 4px 12px",fontSize:"0.875rem",lineHeight:1.45,background:"var(--graview-panel-muted)",color:"var(--graview-ink)"},children:h.text}):(0,$.jsxs)("p",{style:{margin:0,fontSize:"0.875rem",lineHeight:1.5,color:"var(--graview-ink)"},children:[E?E(h,T.said):T.said,h.via?(0,$.jsx)("span",{"data-testid":`${a}-answered-with-ai`,style:{marginLeft:6,fontSize:"0.6875rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:Ke}):null,T.aside?(0,$.jsx)("span",{style:{display:"block",marginTop:2,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:T.aside}):null]}),M?.(h,d),f.map((w,R)=>{let b=B(d,R),P=t.get(b);return P?.state==="applied"||P?.state==="declined"?(0,$.jsx)(ie,{outcome:P,testId:a},b):(0,$.jsxs)("span",{style:{display:"grid",gap:4,justifySelf:"stretch",justifyItems:"start"},children:[x(w,{key:b,turn:d,at:R}),P?(0,$.jsx)(ie,{outcome:P,testId:a}):null]},b)}),u&&A.length>=2?(0,$.jsxs)("button",{type:"button","data-testid":`${a}-apply-all`,onClick:()=>u(d,f),title:"Take these in order; anything still missing is asked for",style:{fontSize:"0.8125rem",justifySelf:"start",fontWeight:600},children:[s," ",A.length]}):null]},d)}),r?(0,$.jsx)("li",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"thinking\u2026"}):null]})}function ie({outcome:e,testId:t}){if(e.state==="refused")return(0,$.jsxs)("span",{"data-testid":`${t}-refused`,style:{fontSize:"0.8125rem",color:"var(--graview-warn)"},children:["Refused: ",e.error]});let r=e.state==="applied";return(0,$.jsxs)("span",{"data-testid":`${t}-${e.state}`,style:{fontSize:"0.8125rem",color:r?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:[r?(0,$.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:"\u2713 "}):null,r?e.said:(0,$.jsx)("s",{children:e.said})]})}function ot({busy:e,placeholder:t,ariaLabel:r,testId:a,onSend:c}){let[l,S]=(0,D.useState)("");return(0,$.jsxs)("form",{onSubmit:x=>{x.preventDefault(),!(e||l.trim().length===0)&&(c(l),S(""))},style:{display:"flex",gap:6,padding:8,borderTop:"1px solid var(--graview-edge)"},children:[(0,$.jsx)("input",{value:l,onChange:x=>S(x.target.value),placeholder:t,"aria-label":r,"data-testid":`${a}-draft`,style:{flex:1,minWidth:0,font:"inherit",fontSize:"0.875rem",padding:"6px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}),(0,$.jsx)("button",{type:"submit","data-testid":`${a}-send`,disabled:e||l.trim().length===0,style:{fontSize:"0.875rem"},children:"Send"})]})}var v=O(ae(),1),bt=/\b(?:board|kanban|timeline|calendar|gantt|who covers|covers what|coverage|floor plan|layout|draw|chart|(?:list|table) of|as an? (?:list|table|board|calendar|timeline|grid))\b/i,kt=/\b(?:group(?:ed)? by|split by|sort(?:ed)? by|order(?:ed)? by|only|call it|name it|as an? (?:board|kanban|calendar|timeline|list|table|cards|rows|grid|plan|layout)|show all|all of them|clear the filter|no filter)\b/i,St=e=>e.charAt(0).toLowerCase()+e.slice(1),xt=e=>e.to==="record"?e.label:e.to==="problems"?"problems":e.title;function $t(e,t,r){let a=[],c=e;for(let l of t){let S=xt(l),x=S?c.toLowerCase().indexOf(S.toLowerCase()):-1;x<0||(a.push(c.slice(0,x),r(l,c.slice(x,x+S.length))),c=c.slice(x+S.length))}return a.length===0?e:[...a,c]}function Qt({respond:e,onCall:t,onPick:r,testId:a="chat",empty:c,shared:l=!1,composer:S=!0,onMove:x,place:M,onDraft:E}){let{store:p,views:u,view:s,principal:g,setView:h,seatWho:d,noteSeat:f,session:A,ai:T,seatTalk:w,brand:R,app:b}=q(),P=Xe(),le=x??P,{takeBack:rt}=Ye(le),{selection:de}=re(),he=et(),we=d??"chat",z=(0,L.useMemo)(()=>({kind:"agent",id:we,session:A}),[we,A]),ce=(0,L.useRef)(void 0),V=(0,L.useMemo)(()=>Be(p,{author:{...z,...g.roles?{roles:g.roles}:{}},derive:()=>({pins:Ve()}),places:()=>u.places(),via:()=>ce.current,...b?{app:b}:{}}),[p,g,z,u,b]),st=(0,L.useMemo)(()=>e??Ie(T),[e,T]);(0,L.useEffect)(()=>t?V.onCall(t):void 0,[V,t]),De(V);let be=(0,L.useMemo)(()=>({name:R?.name??"app",schema:p.schema,...p.policy?{policy:p.policy}:{}}),[p,R]),it=async n=>{let i=w.get().draft,o=i!==null&&kt.test(n);if(!o&&!bt.test(n))return;let m=await import("./chunk.WCNONCTL.js"),k=e?void 0:Fe(T),y={app:be,sight:m.draftSight(be,Y),...k?{complete:k}:{},...i?{lastGood:i}:{}},C=o&&i?await m.refineDraft(i,n,y):await m.draftView(n,y);if(m.isDraftFailure(C)){let K=C.lastGood??i;return K?(w.setDraft(K,C.failed),E?.(),{say:`${C.failed} The last view stays.`,proposals:[],grounded:!0}):{say:C.failed,proposals:[],grounded:!0}}return w.setDraft(C,null),E?.(),{say:`Here is ${St(C.said)} Ask to change it, or keep it as a lens.`,proposals:[],grounded:!0}},N=tt({...l?{talk:w}:{},said:n=>W(p,n),answer:async(n,i)=>{let o=await it(n);if(o)return o;let{placesFromViews:m}=await import("./chunk.ZEUBAAVQ.js"),k=M??s.within?.view,y=u.arrangement?.(),C=p.today();return st(p,n,{...i,selection:he.id?[he.id]:de,principal:{...z,...g.roles?{roles:g.roles}:{}},places:m(p.schema,u.places(),y?{pages:y}:{}),...k?{place:k}:{},...C?{today:C}:{},...b?{app:b}:{}})},onReply:n=>{let i=n.moves?.[0];i&&le(i);let o=n.questions?.[0];f(o?{type:"asking",author:z,where:o.nodeId??null,say:`${o.nodeLabel?`${o.nodeLabel}: `:""}${o.asks}`,confidence:o.confidence}:{type:"said",author:z,say:n.say});let m=n.proposals.find(k=>!ue(k));if(m){let k=p.permits({name:m.mutation,args:{...m.args}},Y);k.ok||f({type:"refused",author:z,where:Se(m.mutation),say:k.refusal.message})}}}),{outcomes:Q,settle:pe}=N,ke=oe(w);(0,L.useEffect)(()=>{if(!l||ke.pending===null||N.busy)return;let n=w.takePending();n&&N.send(n)},[l,ke.pending,N.busy]);let Y={...z,...g.roles?{roles:g.roles}:{}},ue=n=>p.permits({name:n.mutation,args:{...n.args}},Y).ok,Se=n=>{let i=p.allMutations().find(o=>o.name===n)?.subject?.kinds;return Array.isArray(i)&&i[0]?Pe(i[0]):null},[H,Z]=(0,L.useState)(null),X=async(n,i)=>{let o=Ge(p,n),m=W(p,o),k=V.definitions.find(C=>C.act===o.mutation)?.name??o.mutation;ce.current=N.turns[Number(i.split(":")[0])]?.via;let y=await V.call(k,{...o.args}).finally(()=>{ce.current=void 0});return y.ok?(pe(i,{state:"applied",said:m}),!0):(pe(i,{state:"refused",error:y.error}),f({type:"refused",author:z,where:Se(o.mutation),say:y.error}),!1)},lt=async(n,i)=>{for(let[o,m]of i.entries()){let k=B(n,o);if(Q.get(k)?.state==="applied"||!ue(m))continue;let y=ve(p,m);if(y.length>0){Z({proposal:m,open:y,key:k});return}if(!await X(m,k))return}},ee=(0,L.useRef)(null),fe=(0,L.useRef)(null);(0,L.useLayoutEffect)(()=>{let n=fe.current;if(!n||n.isConnected||document.activeElement!==document.body)return;fe.current=null,(ee.current?.querySelector(`[data-testid="${a}-apply"]:not([disabled])`)??ee.current?.querySelector(`[data-testid="${a}-draft"]`)??ee.current?.closest("[data-testid='seat']")?.querySelector("[data-testid='seat-field']"))?.focus()});let dt=(n,i,o,m)=>{let k=p.permits({name:o.mutation,args:{...o.args}},Y);if(!k.ok)return(0,v.jsxs)("span",{"data-testid":`${a}-withheld`,style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,v.jsx)("s",{children:W(p,o)})," \u2014 ",k.refusal.message]});let y=ve(p,o),C=(N.turns[n]?.proposals??[]).slice(0,i).filter((xe,F)=>Q.get(B(n,F))?.state!=="applied").find(xe=>y.some(F=>F.kinds&&typeof o.args[F.name]=="string"&&xe.args.label===o.args[F.name])),K=W(p,o);return(0,v.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 10px"},children:[(0,v.jsxs)("span",{style:{fontSize:"0.875rem",color:"var(--graview-ink)"},title:o.why,children:[K,y.length>0&&!C?" \u2026":""]}),(0,v.jsxs)("span",{style:{display:"inline-flex",gap:6},children:[(0,v.jsx)("button",{type:"button","data-testid":`${a}-apply`,"data-graview-asks":y.length>0?y.length:void 0,disabled:C!==void 0,"aria-label":`Do it: ${K}`,onClick:()=>y.length>0?Z({proposal:o,open:y,key:m}):void X(o,m),title:C?`After \u201C${W(p,C)}\u201D`:y.length>0?`${K} \u2014 it asks for ${y.length===1?"one more thing":`${y.length} more things`}`:K,style:J,children:"Do it"}),(0,v.jsx)("button",{type:"button","data-testid":`${a}-decline`,"aria-label":`Not now: ${K}`,onClick:()=>pe(m,{state:"declined",said:K}),style:{...J,color:"var(--graview-ink-muted)"},children:"Not now"})]})]})};return(0,v.jsxs)("div",{"data-testid":`${a}-panel`,ref:ee,onFocus:n=>{fe.current=n.target},style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",alignContent:"start",gap:8,minWidth:0,minHeight:0},children:[N.turns.length===0?c??null:null,(0,v.jsx)(nt,{turns:N.turns,outcomes:Q,busy:N.busy,testId:a,minHeight:0,maxHeight:"none",empty:c!==void 0?null:(0,v.jsxs)(v.Fragment,{children:["Ask what's wrong, ask about anything by name, or say a change in its own words.",de.length>0?" \u201CThis\u201D means what you have selected.":""]}),renderProposal:(n,{key:i,turn:o,at:m})=>dt(o,m,n,i),ready:n=>ue(n),onApplyAll:(n,i)=>void lt(n,i),applyAllLabel:"Do all",renderSaid:(n,i)=>n.moves?.length?$t(i,n.moves,(o,m)=>(0,v.jsx)("button",{type:"button","data-testid":`${a}-went`,title:`Go to ${m}`,onClick:()=>le(o),style:{...at,fontSize:"inherit"},children:m},`${o.address}:${m}`)):i,renderAfter:(n,i)=>[...n.offer?[(0,v.jsx)("button",{type:"button","data-testid":`${a}-offer`,onClick:()=>w.ask(`a list of ${n.offer.draft}`),style:{...J,justifySelf:"start"},children:n.offer.label},`${i}:offer`)]:[],...n.kept&&!n.kept.taken?[(0,v.jsx)("button",{type:"button","data-testid":`${a}-take-back`,onClick:()=>void rt(n.kept),style:{...J,justifySelf:"start"},children:"Take back"},`${i}:take-back`)]:[],...n.picks?.length?[(0,v.jsx)("p",{"data-testid":`${a}-picks`,style:{margin:0,display:"flex",flexWrap:"wrap",gap:"2px 12px"},children:n.picks.map(o=>(0,v.jsx)("button",{type:"button","data-testid":`${a}-pick`,"data-chat-pick":o.id,title:o.why.field==="label"?`Go to ${o.label}`:`${o.why.reading}: ${o.why.fragment}`,onClick:()=>r?r(o.id):h(m=>G(I(_(m,!1),o.id),[o.id])),style:at,children:o.label},o.id))},`${i}:picks`)]:[],...(n.questions??[]).map(o=>{let m=`${i}:q:${o.id}`,k=Q.get(m);return(0,v.jsxs)("div",{"data-testid":`${a}-question`,"data-chat-question-node":o.nodeId,style:{display:"grid",gap:4,justifySelf:"start"},children:[(0,v.jsxs)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[o.nodeLabel?(0,v.jsxs)("strong",{children:[o.nodeLabel,": "]}):null,o.asks,o.because==="split"?" (it could be either)":" (it was not sure)"]}),(0,v.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:o.options.map(y=>(0,v.jsxs)("button",{type:"button","data-testid":`${a}-option`,disabled:!y.call,title:y.call?y.call.why??"Take this answer":"Nothing to do for this answer",onClick:()=>y.call?void X(y.call,m):void 0,style:J,children:[y.value," ",Math.round(y.probability*100),"%"]},y.value))}),k?(0,v.jsx)(ie,{outcome:k,testId:a}):null]},o.id)})]}),H?(0,v.jsx)("div",{"data-testid":`${a}-asking`,children:(0,v.jsx)(ze,{affordance:{id:`chat:${H.proposal.mutation}`,mutation:H.proposal.mutation,label:W(p,H.proposal),provider:"llm",why:H.proposal.why??"Suggested in the conversation.",nodeIds:[],args:H.proposal.args,open:H.open,score:0},onApply:n=>{let i={...H.proposal,args:{...H.proposal.args,...n}};Z(null),X(i,H.key)},onCancel:()=>Z(null)})}):null,S?(0,v.jsx)(ot,{busy:N.busy,placeholder:de.length>0?"Ask about this\u2026":"Ask, or say a change\u2026",ariaLabel:"Ask",testId:a,onSend:n=>l?w.ask(n):void N.send(n)}):null]})}var J={font:"inherit",fontSize:"0.8125rem",minHeight:26,padding:"0 9px",borderRadius:6,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",boxShadow:"none",color:"var(--graview-ink)",cursor:"pointer"},at={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"};export{Ye as a,yt as b,Xe as c,et as d,Qt as e,J as f,at as g};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import{a as pt,c as yt,d as oe}from"./chunk.7S22MBNN.js";import{a as Sr}from"./chunk.IKT7JQUW.js";import{c as it,f as st,g as ut,j as ct,k as dt,l as ft,n as ht,o as mt}from"./chunk.ISRS7GOT.js";import{a as lt}from"./chunk.EYF6ONTA.js";import{ea as ot}from"./chunk.NRRUGG22.js";import{$b as nt,Ra as Ze,Sa as qe,T as Se,Ta as et,X as ne,Zb as rt,_b as at,aa as Xe,ca as Qe,yb as tt}from"./chunk.MKNXV4TM.js";import{a as O,b as G}from"./chunk.MRK6QJV5.js";import{b as D}from"./chunk.AJZBJBMO.js";function Er(e,t){return Ze(e,t).slice(1)}function Ee(e,t){return e.kinds.find(r=>Er(e,r)===t)}function hn(e,t,r){return qe(e,t,r)}function mn(e,t){return et(e,t)}var A=D(O(),1),g=D(O(),1),b=D(O(),1),je=D(O(),1),Zt=D(O(),1),E=D(O(),1),Wa=D(O(),1),Va=D(O(),1),Ya=D(O(),1),v=D(O(),1),cr=D(O(),1);var ke=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Pt=/^[\\/]{2}/;function br(e,t){return t+e.replace(/\\/g,"/")}var gt="popstate";function ce(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Ct(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=de(n?u().pathname:"/",f,y,m,h);return N(S.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(f)}`),S}function d(f){return typeof f=="string"?f:U(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"?z(f):f;return{pathname:y.pathname||"",search:y.search||"",hash:y.hash||""}},push(f,y){i="PUSH";let m=ce(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=ce(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 Lt(e={}){function t(a,n){let o=n.state?.masked,{pathname:i,search:l,hash:s}=o||a.location;return de("",{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:U(n)}return Pr(t,r,null,e)}function P(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function N(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function xr(){return Math.random().toString(36).substring(2,10)}function vt(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 de(e,t,r=null,a,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?z(t):t,state:r,key:t&&t.key||a||xr(),mask:n}}function U({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 z(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 Pr(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=ce(h)?h:de(m.location,h,S);r&&r(R,h),u=c()+1;let w=vt(R,u),x=m.createHref(R.mask||R);try{i.pushState(w,"",x)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;n.location.assign(x)}o&&s&&s({action:l,location:m.location,delta:1})}function f(h,S){l="REPLACE";let R=ce(h)?h:de(m.location,h,S);r&&r(R,h),u=c();let w=vt(R,u),x=m.createHref(R.mask||R);i.replaceState(w,"",x),o&&s&&s({action:l,location:m.location,delta:0})}function y(h){return Cr(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(gt,d),s=h,()=>{n.removeEventListener(gt,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 Cr(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:U(t);return n=n.replace(/ $/,"%20"),!r&&Pt.test(n)&&(n=a+n),new URL(n,a)}var Lr;Lr=new WeakMap;function Te(e,t,r="/"){return Dr(e,t,r,!1)}function Dr(e,t,r,a,n){let o=typeof t=="string"?z(t):t,i=H(o.pathname||"/",r);if(i==null)return null;let l=n??kr(e),s=null,u=jr(i);for(let c=0;s==null&&c<l.length;++c)s=Ur(l[c],u,a);return s}function Fr(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 kr(e){let t=Dt(e);return Tr(t),t}function Dt(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=$([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}".`),Dt(i.children,t,p,d,s)),!(i.path==null&&!i.index)&&t.push({path:d,score:Ir(d,i.index),routesMeta:p.map((f,y)=>{let[m,h]=Tt(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 Ft(i.path))o(i,l,!0,s)}),t}function Ft(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=Ft(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 Tr(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Hr(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Nr=/^:[\w-]+$/,Mr=3,Or=2,Ar=1,_r=10,$r=-2,Rt=e=>e==="*";function Ir(e,t){let r=e.split("/"),a=r.length;return r.some(Rt)&&(a+=$r),t&&(a+=Or),r.filter(n=>!Rt(n)).reduce((n,o)=>n+(Nr.test(o)?Mr:o===""?Ar:_r),a)}function Hr(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 Ur(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?kt(d,c,s.matcher,s.compiledParams):te(d,c),f=s.route;if(!p&&u&&r&&!a[a.length-1].route.index&&(p=te({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},c)),!p)return null;Object.assign(n,p.params),i.push({params:n,pathname:$([o,p.pathname]),pathnameBase:Br($([o,p.pathnameBase])),route:f}),p.pathnameBase!=="/"&&(o=$([o,p.pathnameBase]))}return i}function te(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Tt(e.path,e.caseSensitive,e.end);return kt(e,t,r,a)}function kt(e,t,r,a){let n=t.match(r);if(!n)return null;let o=n[0],i=X(o,1),l=n.slice(1);return{params:a.reduce((u,{paramName:c,isOptional:d},p)=>{if(c==="*"){let y=l[p]||"";i=X(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 Tt(e,t=!1,r=!0){N(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 N(!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 H(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 Nt(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?z(e):e,o;return r?(r=Mt(r),r.startsWith("/")||r.startsWith("\\")?o=wt(r.substring(1),"/"):o=wt(r,t)):o=t,{pathname:o,search:Wr(a),hash:Vr(n)}}function wt(e,t){let r=X(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function be(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 zr(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Ne(e){let t=zr(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function me(e,t,r,a=!1){let n;typeof e=="string"?n=z(e):(n={...e},P(!n.pathname||!n.pathname.includes("?"),be("?","pathname","search",n)),P(!n.pathname||!n.pathname.includes("#"),be("#","pathname","hash",n)),P(!n.search||!n.search.includes("#"),be("#","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=Nt(n,l),u=i&&i!=="/"&&i.endsWith("/"),c=(o||i===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(u||c)&&(s.pathname+="/"),s}var Mt=e=>e.replace(/[\\/]{2,}/g,"/"),$=e=>Mt(e.join("/"));function X(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 Br=e=>X(e).replace(/^\/*/,"/"),Wr=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Vr=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var Ot=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 At(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Yr(e){let t=e.map(r=>r.route.path).filter(Boolean);return $(t)||"/"}var _t=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $t(e,t){let r=e;if(typeof r!="string"||!ke.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(_t)try{let o=new URL(window.location.href),i=Pt.test(r)?new URL(br(r,o.protocol)):new URL(r),l=H(i.pathname,t);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{N(!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 yn=Symbol("Uninstrumented");var gn=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var St=new URL("http://localhost");function Me(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),St)}catch{return St}}function xe(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function Jr(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 Oe(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&&!xe(n,r),l=!xe(o,r);if(a==="reject"){if(i||l)throw new Error("External navigation is not allowed")}else if(l&&(n==null||!Jr(e,n)||!xe(n,o)))throw new Error("External navigation is not allowed")}var It=["POST","PUT","PATCH","DELETE"],vn=new Set(It),Kr=["GET",...It],Rn=new Set(Kr);var wn=Symbol("ResetLoaderData"),Gr,Xr,Qr,Zr;Gr=new WeakMap;Xr=new WeakMap;Qr=new WeakMap;Zr=new WeakMap;var qr=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function ea(e){try{return qr.includes(new URL(e).protocol)}catch{return!1}}var W=A.createContext(null);W.displayName="DataRouter";var Q=A.createContext(null);Q.displayName="DataRouterState";var Ht=A.createContext(!1);function ta(){return A.useContext(Ht)}var Ae=A.createContext({isTransitioning:!1});Ae.displayName="ViewTransition";var Ut=A.createContext(new Map);Ut.displayName="Fetchers";var ra=A.createContext(null);ra.displayName="Await";var T=A.createContext(null);T.displayName="Navigation";var V=A.createContext(null);V.displayName="Location";var _=A.createContext({outlet:null,matches:[],isDataRoute:!1});_.displayName="Route";var _e=A.createContext(null);_e.displayName="RouteError";var Le=!0,jt="REACT_ROUTER_ERROR",aa="REDIRECT",na="ROUTE_ERROR_RESPONSE";function oa(e){if(e.startsWith(`${jt}:${aa}:{`))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 ia(e){if(e.startsWith(`${jt}:${na}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ot(t.status,t.statusText,t.data)}catch{}}function pe(e,{relative:t}={}){P(Y(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=g.useContext(T),{hash:n,pathname:o,search:i}=Z(e,{relative:t}),l=o;return r!=="/"&&(l=o==="/"?r:$([r,o])),a.createHref({pathname:l,search:i,hash:n})}function Y(){return g.useContext(V)!=null}function k(){return P(Y(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(V).location}function la(){return g.useContext(V).navigationType}var zt="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Bt(e){g.useContext(T).static||g.useLayoutEffect(e)}function J(){let{isDataRoute:e}=g.useContext(_);return e?va():sa()}function sa(){P(Y(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(W),{basename:t,navigator:r}=g.useContext(T),{matches:a}=g.useContext(_),{pathname:n}=k(),o=JSON.stringify(Ne(a)),i=g.useRef(!1);return Bt(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(N(i.current,zt),!i.current)return;if(typeof s=="number"){r.go(s);return}let c=me(s,JSON.parse(o),n,u.relative==="path");e==null&&t!=="/"&&(c.pathname=c.pathname==="/"?t:$([t,c.pathname])),Oe(typeof s=="string"?s:U(s),r.createHref(c),Me(r),"reject"),(u.replace?r.replace:r.push)(c,u.state,u)},[t,r,o,n,e])}var Sn=g.createContext(null);function ua(){let{matches:e}=g.useContext(_);return e[e.length-1]?.params??{}}function Z(e,{relative:t}={}){let{matches:r}=g.useContext(_),{pathname:a}=k(),n=JSON.stringify(Ne(r));return g.useMemo(()=>me(e,JSON.parse(n),a,t==="path"),[e,n,a,t])}function Wt(e,t){return Vt(e,t)}function Vt(e,t,r){P(Y(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=g.useContext(T),{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(Le){let h=u&&u.path||"";Gt(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=k(),d;if(t){let h=typeof t=="string"?z(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})):Te(e,{pathname:f});Le&&(N(u||y!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),N(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=ma(y&&y.map(h=>Object.assign({},h,{params:Object.assign({},i,h.params),pathname:$([s,a.encodeLocation?a.encodeLocation(h.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?s:$([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(V.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:"POP"}},m):m}function ca(){let e=Kt(),t=At(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 Le&&(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 da=g.createElement(ca,null),Yt=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=ia(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(fa,{error:e},t):t}};Yt.contextType=Ht;var Pe=new WeakMap;function fa({children:e,error:t}){let{basename:r,navigator:a}=g.useContext(T);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=oa(t.digest);if(n){let o=Pe.get(t);if(o)throw o;let i=$t(n.location,r),l=i.absoluteURL||i.to;if(Oe(n.location,l,Me(a),"allow-explicit"),ea(l))throw new Error("Invalid redirect location");if(_t&&!Pe.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 Pe.set(t,s),s}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l}`})}}return e}function ha({routeContext:e,match:t,children:r}){let a=g.useContext(W);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 ma(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:Yr(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||da,i&&(l<0&&p===0?(Gt("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(ha,{match:d,routeContext:{outlet:c,matches:S,isDataRoute:a!=null},children:w})};return a&&(d.route.ErrorBoundary||d.route.errorElement||p===0)?g.createElement(Yt,{location:a.location,revalidation:a.revalidation,component:m,error:f,children:R(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:u}):R()},null)}function $e(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pa(e){let t=g.useContext(W);return P(t,$e(e)),t}function Ie(e){let t=g.useContext(Q);return P(t,$e(e)),t}function ya(e){let t=g.useContext(_);return P(t,$e(e)),t}function He(e){let t=ya(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 ga(){return He("useRouteId")}function Jt(){let e=Ie("useNavigation");return g.useMemo(()=>{let{matches:t,historyAction:r,...a}=e.navigation;return a},[e.navigation])}function Ue(){let{matches:e,loaderData:t}=Ie("useMatches");return g.useMemo(()=>e.map(r=>Fr(r,t)),[e,t])}function Kt(){let e=g.useContext(_e),t=Ie("useRouteError"),r=He("useRouteError");return e!==void 0?e:t.errors?.[r]}function va(){let{router:e}=pa("useNavigate"),t=He("useNavigate"),r=g.useRef(!1);return Bt(()=>{r.current=!0}),g.useCallback(async(n,o={})=>{N(r.current,zt),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}var Et={};function Gt(e,t,r){!t&&!Et[e]&&(Et[e]=!0,N(!1,r))}var Ra="useOptimistic",En=b[Ra];var bn=b.memo(wa);function wa({routes:e,manifest:t,future:r,state:a,isStatic:n,onError:o}){return Vt(e,void 0,{manifest:t,state:a,isStatic:n,onError:o,future:r})}function Sa({basename:e,children:t,initialEntries:r,initialIndex:a,useTransitions:n}){let o=b.useRef();o.current==null&&(o.current=Ct({initialEntries:r,initialIndex:a,v5Compat:!0}));let i=o.current,[l,s]=b.useState({action:i.action,location:i.location}),u=b.useCallback(c=>{n===!1?s(c):b.startTransition(()=>s(c))},[n]);return b.useLayoutEffect(()=>i.listen(u),[i,u]),b.createElement(ye,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:i,useTransitions:n})}function Ea({to:e,replace:t,state:r,relative:a}){P(Y(),"<Navigate> may be used only in the context of a <Router> component.");let{static:n,navigator:o}=b.useContext(T);N(!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}=b.useContext(_),{pathname:l}=k(),s=J(),u=me(e,Ne(i),l,a==="path");Oe(typeof e=="string"?e:U(e),o.createHref(u),Me(o),"reject");let c=JSON.stringify(u);return b.useEffect(()=>{s(JSON.parse(c),{replace:t,state:r,relative:a})},[s,c,a,t,r]),null}function Xt(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 ye({basename:e="/",children:t=null,location:r,navigationType:a="POP",navigator:n,static:o=!1,useTransitions:i}){P(!Y(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),s=b.useMemo(()=>({basename:l,navigator:n,static:o,useTransitions:i,future:{}}),[l,n,o,i]);typeof r=="string"&&(r=z(r));let{pathname:u="/",search:c="",hash:d="",state:p=null,key:f="default",mask:y}=r,m=b.useMemo(()=>{let h=H(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 N(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:b.createElement(T.Provider,{value:s},b.createElement(V.Provider,{children:t,value:m}))}function ba({children:e,location:t}){return Wt(fe(e),t)}function fe(e,t=[]){let r=[];return b.Children.forEach(e,(a,n)=>{if(!b.isValidElement(a))return;let o=[...t,n];if(a.type===b.Fragment){r.push.apply(r,fe(a.props.children,o));return}P(a.type===Xt,`[${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=fe(a.props.children,o)),r.push(i)}),r}var se="get",ue="application/x-www-form-urlencoded";function ge(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function xa(e){return ge(e)&&e.tagName.toLowerCase()==="button"}function Pa(e){return ge(e)&&e.tagName.toLowerCase()==="form"}function Ca(e){return ge(e)&&e.tagName.toLowerCase()==="input"}function La(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Da(e,t){return e.button===0&&(!t||t==="_self")&&!La(e)}function he(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 Fa(e,t){let r=he(e);return t&&t.forEach((a,n)=>{r.has(n)||t.getAll(n).forEach(o=>{r.append(n,o)})}),r}var ie=null;function ka(){if(ie===null)try{new FormData(document.createElement("form"),0),ie=!1}catch{ie=!0}return ie}var Ta=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ce(e){return e!=null&&!Ta.has(e)?(N(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ue}"`),null):e}function Na(e,t){let r,a,n,o,i;if(Pa(e)){let l=e.getAttribute("action");a=l?H(l,t):null,r=e.getAttribute("method")||se,n=Ce(e.getAttribute("enctype"))||ue,o=new FormData(e)}else if(xa(e)||Ca(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?H(s,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||se,n=Ce(e.getAttribute("formenctype"))||Ce(l.getAttribute("enctype"))||ue,o=new FormData(l,e),!ka()){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(ge(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=se,a=null,n=ue,i=e}return o&&n==="text/plain"&&(i=o,o=void 0),{action:a,method:r.toLowerCase(),encType:n,formData:o,body:i}}var xn=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ma={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},Oa=/[&><\u2028\u2029]/g;function bt(e){return e.replace(Oa,t=>Ma[t])}function ze(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}var Aa=Symbol("SingleFetchRedirect");function Qt(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&&H(n.pathname,t)==="/"?n.pathname=`${X(t)}/_root.${a}`:n.pathname=`${X(n.pathname)}.${a}`,n}async function _a(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 $a(e){return e!=null&&typeof e.page=="string"}function Ia(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 Ha(e,t,r){let a=await Promise.all(e.map(async n=>{let o=t.routes[n.route.id];if(o){let i=await _a(o,r);return i.links?i.links():[]}return[]}));return Ba(a.flat(1).filter(Ia).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function xt(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 Ua(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 za(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function Ba(e,t){let r=new Set,a=new Set(t);return e.reduce((n,o)=>{if(t&&!$a(o)&&o.as==="script"&&o.href&&a.has(o.href))return n;let l=JSON.stringify(za(o));return r.has(l)||(r.add(l),n.push({key:l,link:o})),n},[])}function Be(){let e=E.useContext(W);return ze(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Ja(){let e=E.useContext(Q);return ze(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var re=E.createContext(void 0);re.displayName="FrameworkContext";function ve(){let e=E.useContext(re);return ze(e,"You must render this element inside a <HydratedRouter> element"),e}function Ka(e,t){let r=E.useContext(re),[a,n]=E.useState(!1),[o,i]=E.useState(!1),{onFocus:l,onBlur:s,onMouseEnter:u,onMouseLeave:c,onTouchStart:d}=t,p=E.useRef(null);E.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]),E.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:ee(l,f),onBlur:ee(s,y),onMouseEnter:ee(u,f),onMouseLeave:ee(c,y),onTouchStart:ee(d,f)}]:[!1,p,{}]}function ee(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function qt({page:e,...t}){let r=ta(),{nonce:a}=ve(),{router:n}=Be(),o=E.useMemo(()=>Te(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?(t.nonce==null&&a&&(t={...t,nonce:a}),r?E.createElement(Xa,{page:e,matches:o,...t}):E.createElement(Qa,{page:e,matches:o,...t})):null}function Ga(e){let{manifest:t,routeModules:r}=ve(),[a,n]=E.useState([]);return E.useEffect(()=>{let o=!1;return Ha(e,t,r).then(i=>{o||n(i)}),()=>{o=!0}},[e,t,r]),a}function Xa({page:e,matches:t,...r}){let a=k(),{future:n}=ve(),{basename:o}=Be(),i=E.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let l=Qt(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 E.createElement(E.Fragment,null,i.map(l=>E.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...r})))}function Qa({page:e,matches:t,...r}){let a=k(),{future:n,manifest:o,routeModules:i}=ve(),{basename:l}=Be(),{loaderData:s,matches:u}=Ja(),c=E.useMemo(()=>xt(e,t,u,o,a,"data"),[e,t,u,o,a]),d=E.useMemo(()=>xt(e,t,u,o,a,"assets"),[e,t,u,o,a]),p=E.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(x=>x.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=Qt(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=E.useMemo(()=>Ua(d,o),[d,o]),y=Ga(d);return E.createElement(E.Fragment,null,p.map(m=>E.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...r})),f.map(m=>E.createElement("link",{key:m,rel:"modulepreload",href:m,...r})),y.map(({key:m,link:h})=>E.createElement("link",{key:m,nonce:r.nonce,...h,crossOrigin:h.crossOrigin??r.crossOrigin})))}function Za(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var qa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{qa&&(window.__reactRouterVersion="7.18.3")}catch{}function en({basename:e,children:t,useTransitions:r,window:a}){let n=v.useRef();n.current==null&&(n.current=Lt({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(ye,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,useTransitions:r})}function er({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(ye,{basename:e,children:t,location:n.location,navigationType:n.action,navigator:r,useTransitions:a})}er.displayName="unstable_HistoryRouter";var ae=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(T),w=typeof c=="string"&&ke.test(c),x=$t(c,h);c=x.to;let C=pe(c,{relative:n}),F=k(),I=null;if(l){let j=me(l,[],F.mask?F.mask.pathname:"/",!0);h!=="/"&&(j.pathname=j.pathname==="/"?h:$([h,j.pathname])),I=S.createHref(j)}let[K,q,we]=Ka(a,y),Rr=or(c,{replace:i,mask:l,state:s,target:u,preventScrollReset:d,relative:n,viewTransition:p,defaultShouldRevalidate:f,useTransitions:R});function wr(j){t&&t(j),j.defaultPrevented||Rr(j)}let Ke=!(x.isExternal||o),Ge=v.createElement("a",{...y,...we,href:(Ke?I:void 0)||x.absoluteURL||C,onClick:Ke?wr:t,ref:Za(m,q),target:u,"data-discover":!w&&r==="render"?"true":void 0});return K&&!w?v.createElement(v.Fragment,null,Ge,v.createElement(qt,{page:C})):Ge});ae.displayName="Link";var tr=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=Z(i,{relative:u.relative}),p=k(),f=v.useContext(Q),{navigator:y,basename:m}=v.useContext(T),h=f!=null&&ur(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=H(w,m)||w);let x=S!=="/"&&S.endsWith("/")?S.length-1:S.length,C=R===S||!n&&R.startsWith(S)&&R.charAt(x)==="/",F=w!=null&&(w===S||!n&&w.startsWith(S)&&w.charAt(S.length)==="/"),I={isActive:C,isPending:F,isTransitioning:h},K=C?t:void 0,q;typeof a=="function"?q=a(I):q=[a,C?"active":null,F?"pending":null,h?"transitioning":null].filter(Boolean).join(" ");let we=typeof o=="function"?o(I):o;return v.createElement(ae,{...u,"aria-current":K,className:q,ref:c,style:we,to:i,viewTransition:l},typeof s=="function"?s(I):s)});tr.displayName="NavLink";var rr=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:a,replace:n,state:o,method:i=se,action:l,onSubmit:s,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:p,...f},y)=>{let{useTransitions:m}=v.useContext(T),h=ir(),S=lr(l,{relative:u}),R=i.toLowerCase()==="get"?"get":"post",w=typeof l=="string"&&ke.test(l);return v.createElement("form",{ref:y,method:R,action:S,onSubmit:a?s:C=>{if(s&&s(C),C.defaultPrevented)return;C.preventDefault();let F=C.nativeEvent.submitter,I=F?.getAttribute("formmethod")||i,K=()=>h(F||C.currentTarget,{fetcherKey:t,method:I,navigate:r,replace:n,state:o,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:p});m&&r!==!1?v.startTransition(()=>K()):K()},...f,"data-discover":!w&&e==="render"?"true":void 0})});rr.displayName="Form";function ar({getKey:e,storageKey:t,...r}){let a=v.useContext(re),{basename:n}=v.useContext(T),o=k(),i=Ue();sr({getKey:e,storageKey:t});let l=v.useMemo(()=>{if(!a||!e)return null;let u=Fe(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})(${bt(JSON.stringify(t||De))}, ${bt(JSON.stringify(l))})`}})}ar.displayName="ScrollRestoration";function nr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function We(e){let t=v.useContext(W);return P(t,nr(e)),t}function tn(e){let t=v.useContext(Q);return P(t,nr(e)),t}function or(e,{target:t,replace:r,mask:a,state:n,preventScrollReset:o,relative:i,viewTransition:l,defaultShouldRevalidate:s,useTransitions:u}={}){let c=J(),d=k(),p=Z(e,{relative:i});return v.useCallback(f=>{if(Da(f,t)){f.preventDefault();let y=r!==void 0?r:U(d)===U(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){N(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(he(e)),r=v.useRef(!1),a=k(),n=v.useMemo(()=>Fa(a.search,r.current?null:t.current),[a.search]),o=J(),i=v.useCallback((l,s)=>{let u=he(typeof l=="function"?l(new URLSearchParams(n)):l);r.current=!0,o("?"+u,s)},[o,n]);return[n,i]}var rn=0,an=()=>`__${String(++rn)}__`;function ir(){let{router:e}=We("useSubmit"),{basename:t}=v.useContext(T),r=ga(),a=e.fetch,n=e.navigate;return v.useCallback(async(o,i={})=>{let{action:l,method:s,encType:u,formData:c,body:d}=Na(o,t);if(i.navigate===!1){let p=i.fetcherKey||an();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 lr(e,{relative:t}={}){let{basename:r}=v.useContext(T),a=v.useContext(_);P(a,"useFormAction must be used inside a RouteContext");let[n]=a.matches.slice(-1),o={...Z(e||".",{relative:t})},i=k();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:$([r,o.pathname])),U(o)}var De="react-router-scroll-positions",le={};function Fe(e,t,r,a){let n=null;return a&&(r!=="/"?n=a({...e,pathname:H(e.pathname,r)||e.pathname},t):n=a(e,t)),n==null&&(n=e.key),n}function sr({getKey:e,storageKey:t}={}){let{router:r}=We("useScrollRestoration"),{restoreScrollPosition:a,preventScrollReset:n}=tn("useScrollRestoration"),{basename:o}=v.useContext(T),i=k(),l=Ue(),s=Jt();v.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),nn(v.useCallback(()=>{if(s.state==="idle"){let u=Fe(i,l,o,e);le[u]=window.scrollY}try{sessionStorage.setItem(t||De,JSON.stringify(le))}catch(u){N(!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||De);u&&(le=JSON.parse(u))}catch{}},[t]),v.useLayoutEffect(()=>{let u=r?.enableScrollRestoration(le,()=>window.scrollY,e?(c,d)=>Fe(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{N(!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 nn(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 ur(e,{relative:t}={}){let r=v.useContext(Ae);P(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=We("useViewTransitionState"),n=Z(e,{relative:t});if(!r.isTransitioning)return!1;let o=H(r.currentLocation.pathname,a)||r.currentLocation.pathname,i=H(r.nextLocation.pathname,a)||r.nextLocation.pathname;return te(n.pathname,i)!=null||te(n.pathname,o)!=null}var dr=D(O(),1),fr=D(Sr(),1);var Re=D(G(),1);function hr({context:e,own:t}){if(oe(e.store),!ot()||e.store.batches().length===0)return null;let a=(0,Re.jsx)(dr.Suspense,{fallback:null,children:(0,Re.jsx)(pt,{})});return t?(0,fr.createPortal)(a,t):(0,Re.jsx)("div",{className:"graview-bar-own",children:a})}var M=D(O(),1);var B=D(O(),1),on=(0,B.createContext)(null);function Bo(){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 mr(e){let t=(0,B.useContext)(on);(0,B.useLayoutEffect)(()=>t?.place(e),[t,e])}function Wo(e,t){return(0,B.useSyncExternalStore)(e.subscribe,()=>e.count(t)>0,()=>!1)}var vr=D(G(),1),pr="var(--graview-font-display, var(--graview-font-body, system-ui))",Ye={maxWidth:760,margin:"0 auto",padding:"40px 20px max(96px, var(--graview-foot-room, 0px))",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40},Je=1160,Go={...Ye,maxWidth:Je},yr={margin:0,fontFamily:pr,fontSize:"clamp(30px, 4.6vw, 40px)",lineHeight:1.12,fontWeight:600,letterSpacing:"-0.012em",overflowWrap:"anywhere"},Xo={margin:0,fontFamily:pr,fontSize:"1.4375rem",lineHeight:1.25,fontWeight:600,letterSpacing:"-0.006em"},Qo={margin:0,fontSize:"0.8125rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Zo={margin:0,fontSize:"1.1875rem",lineHeight:1.5,color:"var(--graview-ink-muted)",maxWidth:"58ch"},gr={color:"var(--graview-ink-muted)",fontSize:"0.9375rem"},qo={borderTop:"1px solid var(--graview-edge)",paddingTop:24},ei={color:"inherit",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3,display:"inline-flex",alignItems:"center",minHeight:24},ti={color:"inherit",textDecoration:"none",display:"inline-flex",alignItems:"center",minHeight:24},ri={font:"inherit",fontSize:"0.9375rem",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 ai({kind:e,brand:t,size:r=10,schema:a}){return(0,vr.jsx)(lt,{kind:e,...a?{schema:a}:{},...t?{brand:t}:{},size:Math.round(r*1.6)})}function ni(e,t){let a=[...new Set(t.targets.map(n=>n.kind))].map(n=>e.schema.tryDefinition(n)?.plural??Se(n));return a.length>0?a.join(" and "):Se(t.edgeKind)}function oi(e,t,r){return e.author.kind==="human"&&(e.author.id===void 0||t?.id===void 0||e.author.id===t.id)?"you":r?Qe(e.author,r):e.author.kind==="agent"?e.author.id??"an agent":e.author.id??e.author.kind}function ii(e,t,r){return Xe(e,t,{limit:3,said:[r],glance:!0}).map(a=>a.alone).join(" \xB7 ")}var li=(e,t)=>ne(e.schema,t),ln=(e,t)=>{let r=e.kindsKeptFrom(t);return e.schema.kinds.filter(a=>!e.modules.disabledKinds.has(a)&&!r.has(a))},sn=e=>nt(ln(e.store,e.principal),e.views?.arrangement?.()?.order),si=e=>{let t=new Set(e.views?.arrangement?.()?.hide??[]);return sn(e).filter(r=>!t.has(r))},ui=e=>e.charAt(0).toUpperCase()+e.slice(1);var L=D(G(),1);function Ri({context:e,children:t}){let{store:r,brand:a}=e;return oe(r),it(e.embedded?void 0:tt(a)),(0,L.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:"1.0625rem",lineHeight:1.6},children:[e.embedded?null:(0,L.jsx)(cn,{context:e}),(0,L.jsx)("div",{style:{flex:1},children:t}),e.remembers?(0,L.jsx)("footer",{style:{borderTop:"1px solid var(--graview-edge)",padding:"14px 20px 20px",...gr,fontSize:"0.875rem"},children:(0,L.jsx)("div",{style:{maxWidth:Je,margin:"0 auto",display:"flex",gap:14,flexWrap:"wrap",alignItems:"center",justifyContent:"flex-end"},children:(0,L.jsxs)("span",{"data-testid":"remembered",children:["Remembered in this browser \xB7 ",(0,L.jsx)(yt,{})]})})}):null]})}var un=(0,M.createContext)(null);function cn({context:e}){let{store:t,brand:r,sceneHref:a="/",invariantContext:n}=e,o=k(),i=J(),l=pe("/").replace(/\/$/,""),s=(0,M.useContext)(un),u=s?.places===!1?[]:st({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=ht(p,"All rules hold");return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(dt,{brand:r,name:r?.name??"Graview",description:r?.subtitle,home:{href:`${l}/`,go:()=>i("/"),current:o.pathname==="/"},faces:{scene:{label:rt(c),current:!1,go:()=>window.location.assign(a)},pages:{label:at(c),current:!0,go:()=>{}}},places:u,current:ut(u,d),reach:{href:m=>`${l}${m}`,go:m=>i(m.path)},...s?{onFind:s.onFind,find:s.find}:{findBox:(0,L.jsx)(dn,{context:e})},tools:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(ae,{to:"/problems","data-testid":"standing-link","aria-label":y,title:y,style:{...ct,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,L.jsx)(mt,{tone:f===0?"var(--graview-good)":"var(--graview-warn)"}),f>0?(0,L.jsx)("span",{"aria-hidden":"true",children:f}):null]}),(0,L.jsx)(hr,{context:e}),e.views?(0,L.jsx)(ft,{...e.signature?{signature:!0}:{}}):null]})})})}function wi({context:e,style:t,children:r,...a}){let n=e.embedded||e.framed?"section":"main";return(0,L.jsx)(n,{style:{...Ye,...t},...a,children:r})}function Si({context:e,children:t,...r}){let a=`h${e.titleLevel??(e.framed&&!e.barAbove?1:2)}`;return(0,L.jsx)(a,{style:yr,"data-graview-page-title":"",...r,children:t})}function dn({context:e,narrowsLists:t=!0}){mr("find");let r=k(),a=J(),[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 ${ne(e.store.schema,Ee(e.store.schema,i[0])).toLowerCase()}\u2026`:"",[d,p]=(0,M.useState)(!0);(0,M.useLayoutEffect)(()=>{let R=m.current;if(!R||!c||typeof ResizeObserver>"u")return;let w=()=>{let C=getComputedStyle(R),F=document.createElement("canvas").getContext("2d");F&&(F.font=`${C.fontWeight} ${C.fontSize} ${C.fontFamily}`,p(F.measureText(c).width<=R.clientWidth-parseFloat(C.paddingLeft)-parseFloat(C.paddingRight)))};w();let x=new ResizeObserver(w);return x.observe(R),()=>x.disconnect()},[c]);let[f,y]=(0,M.useState)(u),m=(0,M.useRef)(null);(0,M.useEffect)(()=>{let R=w=>{if(w.defaultPrevented||w.altKey||w.shiftKey||!(w.metaKey||w.ctrlKey)||w.key.toLowerCase()!=="k")return;let x=m.current,C=x?.closest("[data-graview-embed]"),F=w.target,I=F===document.body||F===document.documentElement;!x||!(I||!C||F instanceof Node&&C.contains(F))||(w.preventDefault(),x.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),requestAnimationFrame(()=>{x.focus(),x.select()}))};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[]);let h=(0,M.useRef)(new Set([u]));(0,M.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 x=new URLSearchParams(n);R.trim()?x.set("q",R):x.delete("q"),o(x,{replace:!0});return}let w=R.trim()?`/search?${new URLSearchParams({q:R}).toString()}`:"/search";a(w,{replace:s})};return(0,L.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,L.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{Er as a,Ee as b,hn as c,mn as d,pr as e,Go as f,Xo as g,Qo as h,Zo as i,gr as j,qo as k,ei as l,ti as m,ri as n,ai as o,ni as p,oi as q,ii as r,li as s,ln as t,sn as u,si as v,ui as w,hr as x,k as y,la as z,J as A,ua as B,Sa as C,Ea as D,Xt as E,ba as F,en as G,ae as H,Ve as I,on as J,Bo as K,Wo as L,Ri as M,un as N,wi as O,Si as P,dn as Q};
|
|
4
|
-
/*! Bundled license information:
|
|
5
|
-
|
|
6
|
-
react-router/dist/development/chunk-BV7QT456.mjs:
|
|
7
|
-
(**
|
|
8
|
-
* react-router v7.18.3
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) Remix Software Inc.
|
|
11
|
-
*
|
|
12
|
-
* This source code is licensed under the MIT license found in the
|
|
13
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
14
|
-
*
|
|
15
|
-
* @license MIT
|
|
16
|
-
*)
|
|
17
|
-
|
|
18
|
-
react-router/dist/development/index.mjs:
|
|
19
|
-
(**
|
|
20
|
-
* react-router v7.18.3
|
|
21
|
-
*
|
|
22
|
-
* Copyright (c) Remix Software Inc.
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the MIT license found in the
|
|
25
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
26
|
-
*
|
|
27
|
-
* @license MIT
|
|
28
|
-
*)
|
|
29
|
-
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as m}from"./chunk.MRK6QJV5.js";import{b as f}from"./chunk.AJZBJBMO.js";function h(n){let r,i=!1,e,t,o=0;return()=>{if(i)return Promise.resolve(r);if(e)return e;let d=o>0&&t!==void 0?p(t):n();o+=1;let a=d.then(s=>(r=s,i=!0,e=void 0,s),s=>{throw e=void 0,t??=g(s),s});return e=a,a}}var c=0;function p(n){return c+=1,import(`${n}${n.includes("?")?"&":"?"}retry=${c}`)}function g(n,r=import.meta.url){let i=n instanceof Error?n.message:typeof n=="string"?n:"",e=/^(?:Failed to fetch|error loading) dynamically imported module: ([a-z]+:\/\/[^\s"'<>]+)/.exec(i)?.[1]?.replace(/[.,;:)\]]+$/,""),t=o=>o.split("/",3).join("/");return e&&t(e)===t(r)?e:void 0}var u=f(m(),1);function v(n){let[r,i]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let e=n.current;if(!e||typeof ResizeObserver>"u")return;let t=()=>i(Math.round(e.getBoundingClientRect().width));t();let o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[n]),r}function M(n=!0){let[r,i]=(0,u.useState)();return(0,u.useEffect)(()=>{if(!n)return i(void 0);let e=0,t=()=>i(innerHeight),o=()=>{t(),clearTimeout(e),e=window.setTimeout(t,300)},d=a=>{for(let[s,l]of[[window,"resize"],[window,"orientationchange"],[window.visualViewport,"resize"]])s?.[a](l,o)};return d("addEventListener"),t(),()=>{clearTimeout(e),d("removeEventListener")}},[n]),r}var b={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap"};export{h as a,v as b,M as c,b as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var l=["solid","dashed","dotted","double","tapered"],i=["arrow","none","dot","bar"];function p(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0}function m(e,t={}){let r=p(e);return{...{pattern:l[r%l.length],width:1.5+(r>>>3)%3*.75,cap:i[(r>>>7)%i.length],hue:(r>>>11)%360,opacity:.85},...t[e]}}var y={solid:void 0,dashed:"7 5",dotted:"1 5",double:"12 3",tapered:"10 3 3 3"};function h(e){return e.color??`hsl(${Math.round(e.hue)} 55% 62%)`}function x(e,t){return t?Math.max(1.6,e.width):Math.min(1.4,e.width)}function s(e,t,r){return[e,0,0,0,0,e,0,0,0,0,1,0,t,r,0,1]}var d={0:{scale:1,blur:0,falloff:0,shadow:.16,fidelity:"full"},1:{scale:.95,blur:.3,falloff:.26,shadow:.12,fidelity:"summary"},2:{scale:.9,blur:.3,falloff:.34,shadow:.07,fidelity:"glyph"}},c={0:{scale:1,blur:0,falloff:0,shadow:.34,fidelity:"full"},1:{scale:.95,blur:.45,falloff:.18,shadow:.24,fidelity:"summary"},2:{scale:.9,blur:.45,falloff:.26,shadow:.14,fidelity:"glyph"}};function b(e,t="dark"){let r=Math.max(0,Math.min(2,Math.round(e)));return(t==="light"?d:c)[r]}function S(e,t,r){let o=Math.max(0,Math.min(1,r)),n=(a,u)=>a+(u-a)*o;return{scale:n(e.scale,t.scale),blur:n(e.blur,t.blur),falloff:n(e.falloff,t.falloff),shadow:n(e.shadow,t.shadow),fidelity:o<.5?e.fidelity:t.fidelity}}function P(e,t,r,o,n){return s(e.scale,t,r)}export{c as a,b,S as c,P as d,m as e,y as f,h as g,x as h};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as f}from"./chunk.ISRS7GOT.js";import{Zb as c}from"./chunk.MKNXV4TM.js";import{a as S,b as s}from"./chunk.MRK6QJV5.js";import{b as a}from"./chunk.AJZBJBMO.js";var m=a(s(),1),u=f.part(e=>(0,m.jsx)(e.ActivityRail,{calls:[]}),{quiet:!0});var o=a(S(),1),l=a(s(),1);function Ye({context:e,stop:r,title:t,style:n,className:i,children:g,...p}){let d=c(e.views?.arrangement?.()),y=g??`In ${d==="Scene"?"the scene":d.replace(/^The /,"the ")} \u2197`;if(e.overview){let h=e.overview;return(0,l.jsx)("a",{href:r,...p,...t?{title:t}:{},style:n,...i?{className:i}:{},onClick:x=>{x.preventDefault(),h(r)},children:y})}return e.embedded?null:(0,l.jsx)("a",{href:`${e.sceneHref??"/"}${r}`,...p,...t?{title:t}:{},style:n,...i?{className:i}:{},children:y})}function qe(){return(0,l.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:e=>{e.preventDefault();let r=new URL(window.location.href);r.searchParams.set("fresh","1"),window.location.assign(r.toString())},style:{color:"inherit",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24},children:"Start fresh"})}function ze(e){let r=(0,o.useRef)(0),t=(0,o.useCallback)(n=>e.subscribe(()=>{r.current+=1,n()}),[e]);return(0,o.useSyncExternalStore)(t,()=>r.current,()=>0)}export{u as a,Ye as b,qe as c,ze as d};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{g as dt,h as pe,k as ct,l as ve}from"./chunk.WHTNSETN.js";import{c as rt,d as ot,e as ie,f as Z,g as ue,h as st,j as lt,k as re}from"./chunk.46KUPBQC.js";import{a as ae,b as nt}from"./chunk.EYF6ONTA.js";import{a as Q,b as j,c as at,d as it,e as U}from"./chunk.Q3HVA6L4.js";import{a as pt,b as gt}from"./chunk.ZJDRD6PO.js";import{d as ut}from"./chunk.SNBIZ3B6.js";import{a as Oe}from"./chunk.6LJ66MB7.js";import{B as _e,E as je,F as Ue,O as qe,Z as Xe,ca as Ye,da as N,ea as Je,fa as de,ga as ye,i as He,ja as _,k as ze,ka as Qe,l as Fe,ma as ce,oa as Ze,p as Ke,qa as he,ra as et,sa as we,x as fe,za as tt}from"./chunk.NRRUGG22.js";import{$ as J,Q as A,R as Le,T as G,U as De,Y as Me,Z as We,aa as ee,ba as Ie,la as Ge,nb as te}from"./chunk.MKNXV4TM.js";import{a as ne,b as D}from"./chunk.MRK6QJV5.js";import{b as T}from"./chunk.AJZBJBMO.js";var M=T(ne(),1);var O=T(D(),1);function mt({id:e,max:n=8,empty:a,hide:t}){let{store:o}=N();de();let d=Lt(o,e,o.violations()),i=t?d.flatMap(c=>{let p=c.ids.filter(u=>!t.has(u));return p.length>0?[{...c,ids:p}]:[]}):d;return i.length===0?a&&d.length===0?(0,O.jsx)("p",{style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-faint)"},children:a}):null:(0,O.jsx)("div",{"data-graview-primitive":"connections",style:{display:"flex",flexDirection:"column",gap:12},children:i.map(c=>{let p=c.ids.slice(0,n),u=c.ids.length-p.length;return(0,O.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,O.jsx)("h2",{...c.said?{"aria-label":c.said}:{},style:{margin:0,fontSize:"0.75rem",fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:c.label}),(0,O.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:[p.map(r=>{let s=o.graph.getNode(r);return s?(0,O.jsx)(j,{pickId:r,hue:te(s.kind),title:`Go to the ${J(o.schema.tryDefinition(s.kind),s.kind)}`,label:A(o.schema.tryDefinition(s.kind),s)},r):null}),u>0?(0,O.jsx)(j,{label:`+${u} more`}):null]})]},c.key)})})}function Lt(e,n,a=[]){let t=e.graph.getNode(n);if(!t)return[];let o=new Map,d=[];for(let i of a)if(i.subjectId===n)for(let c of i.nodeIds)c!==n&&!d.includes(c)&&e.graph.has(c)&&d.push(c);d.length>0&&o.set("judges",{key:"judges",label:"what it finds wrong",ids:d});for(let i of e.graph.allEdges()){let c=i.from===n?i.to:i.to===n?i.from:null;if(c===null||c===n)continue;let p=e.graph.getNode(c);if(!p)continue;let u=i.from===n?"out":"in",r=u==="out"?t.kind:p.kind,s=Dt(e.schema,r,i.kind,u),v=`${i.kind}:${u}:${s.label}`,h=o.get(v)??{key:v,...s,ids:[]};h.ids.includes(c)||h.ids.push(c),o.set(v,h)}for(let i of o.values())i.ids.sort();return[...o.values()].sort((i,c)=>i.key<c.key?-1:i.key>c.key?1:0)}function Dt(e,n,a,t){let o=Me(e,n,a,t),d=G(a).toLowerCase();return o.trim().toLowerCase()!==d?{label:o}:t==="out"?{label:`\u2192 ${d}`,said:d}:{label:`\u2190 ${d}`,said:`${d}, pointing here`}}var P=T(ne(),1);var W=T(D(),1),Mt=/^\s*(\d{1,6})[.)]\s+(.*)$/s,Wt=/^\s*[-*•]\s+(.*)$/s;function It(e){let n=[];for(let a of e.replace(/\r\n?/g,`
|
|
2
|
-
`).split(/\n[ \t]*\n+/)){let t=null,o=()=>{t&&(t.t==="p"?t.lines.length>0:t.items.length>0)&&n.push(t),t=null};for(let d of a.split(`
|
|
3
|
-
`)){let i=Mt.exec(d),c=i?null:Wt.exec(d);if(i)t?.t!=="ol"&&(o(),t={t:"ol",start:Number(i[1]),items:[]}),t.items.push(i[2]);else if(c)t?.t!=="ul"&&(o(),t={t:"ul",items:[]}),t.items.push(c[1]);else if(t&&t.t!=="p"&&/^\s+\S/.test(d)){let p=t.items;p[p.length-1]=`${p[p.length-1]} ${d.trim()}`}else d.trim().length>0&&(t?.t!=="p"&&(o(),t={t:"p",lines:[]}),t.lines.push(d.trim()))}o()}return n}function Se(e){return/[\r\n]/.test(e)}var Gt={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},Ot={margin:0},ft={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"};function oe({text:e,className:n,style:a}){return(0,W.jsx)("div",{"data-graview-text-body":"",...n?{className:n}:{},style:{...Gt,...a},children:It(e).map((t,o)=>t.t==="p"?(0,W.jsx)("p",{style:Ot,children:t.lines.map((d,i)=>(0,W.jsxs)("span",{children:[i>0?(0,W.jsx)("br",{}):null,d]},i))},o):t.t==="ol"?(0,W.jsx)("ol",{start:t.start,style:ft,children:t.items.map((d,i)=>(0,W.jsx)("li",{children:d},i))},o):(0,W.jsx)("ul",{style:ft,children:t.items.map((d,i)=>(0,W.jsx)("li",{children:d},i))},o))})}var y=T(D(),1);function ht({nodeId:e,field:n,value:a,stored:t=a}){let{fields:o,commit:d}=pe(e),i=o.find(w=>w.field===n),{store:c}=N(),p=c.graph.getNode(e)?.kind,u=c.schema.definitions.find(w=>w.kind===p),r=We(u,n).toLowerCase(),[s,v]=(0,P.useState)(!1),[h,m]=(0,P.useState)(t),k=(0,P.useRef)(null),b=(0,P.useRef)(null),S=(0,P.useRef)(!1),R=w=>{S.current=w,v(!1)};if((0,P.useEffect)(()=>m(t),[t,s]),(0,P.useEffect)(()=>{s?k.current?.focus():S.current&&(S.current=!1,b.current?.focus())},[s]),!i)return(0,y.jsx)("span",{"data-graview-field":n,"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${r}`,style:{color:"var(--graview-ink)",cursor:"default",overflowWrap:"anywhere"},children:a});if(!s)return(0,y.jsx)("button",{ref:b,type:"button","data-graview-field":n,"data-graview-editable":i.mutation,title:`${i.title} \u2014 changes the ${r}, and can be undone`,onClick:()=>v(!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:a});let $=(w,{left:L=!1}={})=>{R(!L),!(w===t||w===""||w===void 0)&&d(i,w)};if(!i.takesValue){let w=[i,...i.alternatives];return(0,y.jsx)("span",{role:"group","aria-label":`Change ${G(n).toLowerCase()}`,"data-graview-field":n,style:{display:"inline-flex",gap:6,alignItems:"center",flexWrap:"wrap"},onKeyDown:L=>{L.key==="Escape"&&R(!0)},children:w.map((L,q)=>(0,y.jsx)("button",{type:"button",ref:q===0?k:void 0,"data-graview-act":L.mutation,onClick:()=>{R(!0),d(L,void 0)},onBlur:B=>{let H=B.relatedTarget;(!H||!B.currentTarget.parentElement?.contains(H))&&R(!1)},style:{padding:"2px 9px",fontSize:"0.8125rem",borderRadius:999},children:L.title},L.mutation))})}return(0,y.jsxs)("form",{style:{display:"inline-flex",gap:4},onSubmit:w=>{w.preventDefault(),$(yt(i,h))},children:[i.shape.type==="choice"?(0,y.jsx)("select",{ref:k,"aria-label":G(n),"data-graview-field":n,value:h,onChange:w=>$(w.target.value),onBlur:()=>R(!1),style:{font:"inherit",fontSize:"inherit"},children:i.shape.options.map(w=>(0,y.jsx)("option",{value:w,children:De(u,n,w)},w))}):(0,y.jsx)("input",{ref:k,"aria-label":G(n),"data-graview-field":n,type:i.shape.type==="number"?"number":i.shape.type==="date"?i.shape.time?"datetime-local":"date":"text",...i.shape.type==="number"&&i.shape.min!==void 0?{min:i.shape.min}:{},...i.shape.type==="number"&&i.shape.max!==void 0?{max:i.shape.max}:{},...i.shape.type==="number"&&i.shape.step!==void 0?{step:i.shape.step}:{},value:h,onChange:w=>m(w.target.value),onBlur:()=>$(yt(i,h),{left:!0}),onKeyDown:w=>{w.key==="Escape"&&R(!0)},style:{font:"inherit",fontSize:"inherit",width:`${Math.max(6,h.length+1)}ch`,minHeight:24,display:"inline-flex",alignItems:"center",padding:"0 3px"}}),i.open.length>0?(0,y.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["also needs ",i.open.map(w=>w.name).join(", ")]}):null]})}function yt(e,n){return e.shape.type==="number"?Number(n):n}function wt({id:e,hide:n=[],limit:a=10,labels:t={},shown:o=[]}){let{store:d}=N(),i=ye(e);if(!i)return null;let c=d.schema.tryDefinition(i.kind),p=ee(i,c,{limit:a,said:o}).filter(r=>!n.includes(r.key)),u=rt(c).length>0;return p.length===0&&!u?null:(0,y.jsxs)("div",{"data-graview-fields":i.id,style:{display:"grid",gap:14,alignContent:"start",minWidth:0,fontSize:"0.875rem"},children:[Ie(c,p).map((r,s)=>{let v=(0,y.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto 1fr",gap:"5px 16px",alignContent:"start",minWidth:0},children:r.fields.map(m=>m.files?(0,y.jsx)(U,{as:"field",nodeId:i.id,field:m.key,label:t[m.key]??m.label,files:m.files,labelStyle:ge,style:{marginTop:6}},m.key):m.long?(0,y.jsx)(zt,{nodeId:i.id,field:m.key,label:t[m.key]??m.label,value:m.value,labelStyle:ge,style:{gridColumn:"1 / -1",marginTop:6}},m.key):(0,y.jsxs)("div",{style:{display:"contents"},children:[(0,y.jsx)("dt",{style:{...ge,whiteSpace:"nowrap"},children:t[m.key]??m.label}),(0,y.jsx)("dd",{style:{margin:0,minWidth:0},children:(0,y.jsx)(ht,{nodeId:i.id,field:m.key,value:m.value,stored:m.stored})})]},m.key))});if(!r.title)return(0,y.jsx)("div",{children:v},s);let h=`graview-field-group-${i.id}-${s}`;return(0,y.jsxs)("div",{role:"group","aria-labelledby":h,style:{display:"grid",gap:6,minWidth:0},children:[(0,y.jsx)("p",{id:h,"data-graview-field-group":r.title,style:Ht,children:r.title}),v]},s)}),u?(0,y.jsx)(U,{as:"unfilled",nodeId:i.id,skip:n,labels:t,labelStyle:ge}):null]})}var ge={color:"var(--graview-ink-faint)",fontSize:"0.8125rem"},Ht={margin:0,fontSize:"0.75rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)",fontWeight:560};function zt(e){return Je()?(0,y.jsx)(Kt,{...e}):(0,y.jsx)(Ft,{...e})}function Ft({field:e,label:n,value:a,labelStyle:t,valueStyle:o,style:d}){return(0,y.jsxs)("div",{"data-graview-long":e,style:{display:"grid",gap:6,minWidth:0,...d},children:[(0,y.jsx)("dt",{style:t,children:n}),(0,y.jsx)("dd",{style:{margin:0,minWidth:0,...o},children:(0,y.jsx)("div",{"data-graview-field":e,children:(0,y.jsx)(oe,{text:a})})})]})}function Kt({nodeId:e,field:n,label:a,value:t,labelStyle:o,valueStyle:d,style:i}){let{fields:c,commit:p}=pe(e),u=c.find(S=>S.field===n&&S.takesValue),[r,s]=(0,P.useState)(!1),v=(0,P.useRef)(null),h=(0,P.useRef)(!1);(0,P.useEffect)(()=>{!r&&h.current&&(h.current=!1,v.current?.focus())},[r]);let m=S=>{h.current=S,s(!1)},k=a.toLowerCase(),b=(0,y.jsx)(oe,{text:t});return(0,y.jsxs)("div",{"data-graview-long":n,style:{display:"grid",gap:6,minWidth:0,...i},children:[(0,y.jsxs)("dt",{style:{display:"flex",alignItems:"baseline",gap:10,...o},children:[(0,y.jsx)("span",{children:a}),u&&!r?(0,y.jsx)("button",{ref:v,type:"button","data-graview-editable":u.mutation,"aria-label":`Edit the ${k}`,title:`${u.title} \u2014 changes the ${k}, and can be undone`,onClick:()=>s(!0),style:jt,children:"Edit"}):null]}),(0,y.jsx)("dd",{style:{margin:0,minWidth:0,...d},children:r&&u?(0,y.jsx)(P.Suspense,{fallback:b,children:(0,y.jsx)(_t,{field:n,label:a,value:t,onCancel:()=>m(!0),onSave:(S,R)=>{m(!R),S!==t&&p(u,S)}})}):(0,y.jsx)("div",{"data-graview-field":n,...u?{}:{"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${k}`},...u?{onClick:()=>s(!0)}:{},style:{cursor:u?"text":"default",minWidth:0},children:b})})]})}var _t=(0,P.lazy)(()=>import("./chunk.4HGBVU5B.js")),jt={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 vt({nodeId:e,children:n}){let{fields:a}=pe(e),t=ye(e);if(!t)return(0,y.jsx)(y.Fragment,{children:n});let o=a.find(d=>{let i=t[d.field];return typeof i=="string"&&i===n});return o?(0,y.jsx)(ht,{nodeId:e,field:o.field,value:n}):(0,y.jsx)(y.Fragment,{children:n})}var St=T(ne(),1),se=(0,St.createContext)(null);var g=T(D(),1),Ut=tt(Oe(()=>import("./chunk.EW4JFOJY.js"))).part((e,n)=>(0,g.jsx)(e.ArrangeBar,{...n}),{what:"Arranging this list"});function ke(e){let{brand:n}=N();return te(e,n?.accents)}function qt(e,n){if(!n.endsWith("\u2026")&&!n.endsWith("..."))return;let a=n.replace(/[…]|\.\.\.$/g,"").trim();if(!(a.length<12)){for(let t of Object.values(e))if(typeof t=="string"&&t.length>a.length&&t.startsWith(a))return t}}function Xt(e,n){let t=Math.max(0,...e.slice(0,n*2).map(d=>d.length))*7.5+28<=212/2?2:1,o=n*t;return{columns:t,shown:Math.min(e.length,o)}}var Yt=8,kt=500,Jt=12;function bt(e){return{x:e.clientX,y:e.clientY,pointerType:e.pointerType??""}}function Qt(e,n,a){let t=performance.now()+kt,o=["pointerdown","pointerup","mousedown","mouseup","dblclick"],d=s=>{if(performance.now()>t||!(s instanceof MouseEvent))return!1;let v=bt(s);return n.pointerType&&v.pointerType&&n.pointerType!==v.pointerType?!1:Math.hypot(v.x-n.x,v.y-n.y)<=Jt},i=s=>{if(!d(s))return u();s.stopPropagation()},c=s=>{if(!d(s))return u();s.stopPropagation(),s.preventDefault(),e.removeEventListener("click",c,!0),setTimeout(u,50),a()},p=!1,u=()=>{if(!p){p=!0,clearTimeout(r),e.removeEventListener("click",c,!0);for(let s of o)e.removeEventListener(s,i,!0)}};for(let s of o)e.addEventListener(s,i,!0);e.addEventListener("click",c,!0);let r=setTimeout(u,kt)}function Zt({View:e,members:n,mode:a,flagged:t}){let{isSelected:o}=he(),d=n.slice(0,Yt);return(0,g.jsxs)("div",{"data-graview-rows":"",style:{display:"grid",gap:4,minWidth:0},children:[d.map(i=>(0,g.jsx)("div",{"data-graview-pick":i.id,style:{minWidth:0,cursor:"pointer"},children:(0,g.jsx)(e,{node:i,cardinality:"one",fidelity:"glyph",mode:a,selected:o(i.id),...t?.includes(i.id)?{flagged:[i.id]}:{}})},i.id)),n.length>d.length?(0,g.jsx)(j,{label:`+${n.length-d.length} more`}):null]})}var en=11/15;function tn({text:e,accent:n}){let a=(0,M.useRef)(null),t=(0,M.useRef)(null),[o,d]=(0,M.useState)(1),[i,c]=(0,M.useState)(!1),p=o<1?`${o}em`:void 0;return(0,M.useLayoutEffect)(()=>{let u=a.current,r=t.current;if(!u||!r)return;let s=()=>{let h=u.clientWidth,m=r.offsetWidth;if(h<=0||m<=0)return;let k=parseFloat(getComputedStyle(r).fontSize)/parseFloat(getComputedStyle(u).fontSize)||1,b=m/k,S=Math.max(en,Math.min(1,Math.floor(h/b*100)/100));d(R=>Math.abs(R-S)<.01?R:S),c(b*S>h+.5)};if(s(),typeof ResizeObserver>"u")return;let v=new ResizeObserver(s);return v.observe(u),()=>v.disconnect()},[e]),(0,g.jsx)("span",{ref:a,"data-graview-district-name":"",...o<1?{"data-graview-fitted":""}:{},...i?{title:e}:{},style:{display:"block",minWidth:0,fontSize:"0.9375rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,g.jsx)("span",{ref:t,style:{fontSize:p},children:e})})}function nn(e,n){return!!e?.display?.page?.groups?.length||ee(n,e).some(a=>a.long)}function xt(e,n=ce(e)){for(let a of e.kinds){let t=e.tryDefinition(a),o=t?.plural??`${String(a)}s`,d=r=>{let s=r.node,v=et(),h=(0,M.useContext)(se);if(!s)return null;let m=h?.nodeId===s.id?h:null,k=A(t,s),b=r.mode==="fullscreen"?qt(s,k)??k:k,S=Ge(v,[s.id]);return(0,g.jsxs)(Q,{title:(0,g.jsx)(vt,{nodeId:s.id,children:m?.title??b}),...m?{}:{subtitle:t?.describe?Le(t,s):t?.description??String(a)},selected:r.selected,...r.flagged?.includes(s.id)?{tone:"warning"}:{},fit:!0,children:[m?(0,g.jsx)(se.Provider,{value:null,children:m.body}):null,(0,g.jsxs)("div",{style:{display:"grid",gridTemplateColumns:nn(t,s)?"minmax(0, 1fr)":"minmax(200px, 1fr) minmax(220px, 1.4fr)",gap:"22px 34px",alignItems:"start"},children:[(0,g.jsx)(wt,{id:s.id,shown:[b,k,t?.description,m?.title],...m?{hide:[...m.fields]}:{}}),(0,g.jsx)(mt,{id:s.id,empty:`Nothing is connected to this ${J(t,String(a))} yet.`,...m?{hide:m.records}:{}})]}),S.length>0?(0,g.jsx)("p",{"data-graview-broken":"",style:{margin:"14px 0 0",paddingTop:12,borderTop:"1px solid var(--graview-edge)",fontSize:"0.875rem",color:"var(--graview-warn)"},children:S.map(R=>R.message).join(" \xB7 ")}):null]})},i=r=>{let s=r.node;if(!s)return null;let{store:v}=N(),h=t?.computed?lt(v.schema,v.graph,s):s,m=ee(h,t,{limit:3,said:[A(t,s)],glance:!0}),k=ke(a),b=ot(s,t);return(0,g.jsxs)(Q,{title:A(t,s),selected:r.selected,tone:r.flagged?.includes(s.id)?"warning":"muted",fit:!0,children:[b?(0,g.jsx)(U,{as:"thumb",file:b,size:64,style:{marginBottom:6}}):null,(0,g.jsx)(at,{items:m.map(S=>({id:S.key,label:S.alone,hue:k})),max:3})]})},c=r=>{let s=r.node,v=ke(a),h=ve().marks.flag;if(!s)return null;let m=r.flagged?.includes(s.id)??!1;return(0,g.jsx)(j,{label:m?`${A(t,s)} ${h}`:A(t,s),hue:v,selected:r.selected,title:m?`${G(J(t,String(a)))} \u2014 implicated in a problem`:G(J(t,String(a)))})},p=r=>{let{brand:s,store:v,views:h}=N(),{view:m,go:k}=we(),b=r.nodes??[],S=h.lookup(String(a),{cardinality:"one",fidelity:"glyph"}),R=S!==void 0&&!Qe(S)?S:void 0,$=pt(m),w=ut(b,$,{schema:e,graph:v.graph,flagged:new Set(r.flagged??[])}),L=C=>({id:C.id,label:A(e.tryDefinition(C.kind),C),hue:te(C.kind,s?.accents)}),q=r.fidelity==="full"&&b.length>1?(0,g.jsx)(M.Suspense,{fallback:null,children:(0,g.jsx)(Ut,{schema:e,graph:v.graph,kind:String(a),arrangement:$,onChange:C=>k(gt(m,C)),kept:{shown:w.nodes.length,of:b.length},style:{marginBottom:8}})}):null,B=C=>C.some(E=>r.flagged?.includes(E.id)),H=(C,E,X)=>R?(0,g.jsx)(Q,{title:C,meta:B(E)?`\u26A0 ${E.length}`:E.length,tone:B(E)?"warning":"muted",children:(0,g.jsx)(Zt,{View:R,members:E,mode:r.mode,...r.flagged?{flagged:r.flagged}:{}})},X):(0,g.jsx)(it,{label:C,count:E.length,flagged:B(E),items:E.map(L)},X);return w.grouped?(0,g.jsxs)("div",{style:{display:"grid",gap:8},"data-graview-grouped":$.group?.by,children:[q,w.groups.map(C=>H(`${r.label??o} \xB7 ${C.label}`,C.nodes,C.key||"-"))]}):(0,g.jsxs)("div",{style:{display:"grid",gap:4},children:[q,H(r.label??o,w.nodes)]})},u=r=>{let s=r.nodes??[],v=Xt(s.map(f=>A(t,f)),r.openedRows??qe(s.length)),h=ke(a),{brand:m}=N(),k=nt(String(a),e,m),b=ve().marks.flag,{selection:S}=he(),{toggle:R,view:$,go:w}=we(),{views:L,hiddenKinds:q}=N(),B=$.overview&&!q.has(String(a))?L.places().filter(f=>f.kind===String(a)):[],H=dt(),C=r.focused?$.within?.view??B[0]?.as:void 0,E=s.filter(f=>r.flagged?.includes(f.id)).length,X=E>0,z=r.focused||r.raised,Ae=r.rank==="secondary"&&!z,V=r.nestedUnder!==void 0,Ee=new Set(S),Vt=ct(),F=z?0:s.filter(f=>Vt.includes(f.id)&&!Ee.has(f.id)).length,me=F>0&&!X,le=Ye(),Y=le&&!V?le.byKind[String(a)]??0:0,Bt=V?8:Math.min(46,10+Math.round(Math.sqrt(s.length)*8)),Ve=V?(0,g.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:z?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r.label??o}):(0,g.jsx)(tn,{text:r.label??o,accent:!!z});return(0,g.jsxs)("div",{className:"graview-kind-card","data-graview-rank":r.rank,"data-graview-landmark":k||void 0,"data-graview-nested":V||void 0,"data-graview-tied":F||void 0,"data-graview-hits":le&&!V?Y:void 0,"data-graview-emphasis":le&&!V?Y>0?"lit":"dimmed":void 0,...t?.description||V?{title:V?[r.label??o,t?.description].filter(Boolean).join(" \u2014 "):t.description}:{},style:{position:"relative",height:"100%","--graview-hue":Math.round(h),"--graview-marquee-room":B.length>0&&H?`${H(B.map(f=>f.title))+(k?4:42)}px`:"0px"},children:[k?(0,g.jsx)("span",{className:"graview-kind-block graview-kind-landmark","data-graview-opened":r.opened||void 0,"aria-hidden":"true",style:{"--graview-rise":Bt},children:(0,g.jsx)(ae,{kind:String(a),schema:e,...m?{brand:m}:{},size:96})}):null,(0,g.jsxs)("div",{className:"graview-kind-face","data-graview-opened":r.opened||void 0,style:{display:"flex",flexDirection:"column",gap:V?1:3,padding:V?"5px 7px":"7px 10px",borderRadius:"var(--graview-radius-sm, 9px)",justifyContent:"center",position:"relative",height:"100%",overflow:"hidden",boxSizing:"border-box",border:z?"1px solid var(--graview-accent)":F>0?"1px solid var(--graview-accent-dim)":`1px solid hsl(${Math.round(h)} 55% var(--graview-tint-lightness) / 0.34)`,backgroundColor:"var(--graview-panel)",backgroundImage:`linear-gradient(hsl(${Math.round(h)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${z?1.1:Ae?.28:.5})), hsl(${Math.round(h)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${z?1.1:Ae?.28:.5})))`,boxShadow:z?"0 0 0 1px var(--graview-accent-dim)":void 0},children:[!V&&s.length>0?(0,g.jsx)("div",{"data-graview-tally":s.length,"data-graview-broken":E||void 0,"aria-hidden":"true",style:{position:"absolute",left:0,right:0,top:0,display:"flex",height:3,background:`hsl(${Math.round(h)} 55% var(--graview-tint-lightness) / 0.4)`},children:E>0?(0,g.jsx)("span",{style:{width:`${Math.max(6,Math.round(E/s.length*100))}%`,background:"var(--graview-warn)"}}):null}):null,k?(0,g.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:V?4:6},children:[(0,g.jsx)(ae,{kind:String(a),schema:e,...m?{brand:m}:{},size:V?14:18}),Ve]}):Ve,(0,g.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:5,fontSize:"0.875rem"},children:[(0,g.jsx)("span",{style:{fontVariantNumeric:"tabular-nums",color:X?"var(--graview-warn)":me?"var(--graview-accent)":"var(--graview-ink-faint)"},children:s.length===0?"none yet":me?F===s.length?`${F} tied`:`${F} of ${s.length} tied`:`${X?`${b} `:""}${s.length}`}),(r.retired??0)>0?(0,g.jsxs)("button",{type:"button",className:"graview-kind-past","data-graview-retired":r.retired,title:`${r.retired} retired ${o.toLowerCase()} \u2014 press to widen the view to the past`,onClick:f=>{f.stopPropagation(),w(Ke($,!0))},onDoubleClick:f=>f.stopPropagation(),onPointerDown:f=>f.stopPropagation(),children:["+",r.retired," past"]}):null,Y>0?(0,g.jsxs)("button",{type:"button",className:"graview-kind-hits","data-testid":`hits-${String(a)}`,title:`${Y} ${Y===1?"match":"matches"} for \u201C${$.q??""}\u201D \u2014 press to go in, narrowed`,onClick:f=>{f.stopPropagation(),w(je($,fe(String(a)),{ownPicture:!0,...$.q?{carry:$.q}:{}}))},onDoubleClick:f=>f.stopPropagation(),onPointerDown:f=>f.stopPropagation(),children:[Y," match"]}):null,F>0&&!me?(0,g.jsxs)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-accent)"},children:[F," tied"]}):null,r.hasOwnView?(0,g.jsx)("span",{title:`${o} has a view of its own`,"aria-label":"has its own view",style:{fontSize:"0.6875rem",color:"var(--graview-accent)"},children:"\u25C6"}):null,!V&&s.length>0&&!r.focused?(0,g.jsxs)("button",{type:"button",className:"graview-kind-open","data-testid":`open-${String(a)}`,"aria-expanded":r.opened??!1,title:r.opened?"Close it up":`See the ${o} in here`,onClick:f=>{f.stopPropagation(),R(fe(String(a)))},onDoubleClick:f=>f.stopPropagation(),onPointerDown:f=>f.stopPropagation(),children:[(0,g.jsx)("span",{className:"graview-kind-open-word",children:r.opened?"close":"open"})," ",r.opened?"\u25B4":"\u25BE"]}):null]}),r.opened?(0,g.jsxs)("div",{className:"graview-kind-members","data-graview-buildings":r.plot?.side??1,style:{display:"grid",gridTemplateColumns:`repeat(${v.columns}, minmax(0, 1fr))`,gap:3},children:[s.slice(0,v.shown).map(f=>{let K=r.flagged?.includes(f.id)??!1,I=A(t,f);return(0,g.jsx)(j,{pickId:f.id,label:K?`${I} ${b}`:I,title:K?`${I} \u2014 implicated in a problem`:void 0,hue:h,selected:Ee.has(f.id)},f.id)}),s.length>v.shown?(0,g.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",padding:"2px 4px",gridColumn:"1 / -1"},children:["+",s.length-v.shown," more \u2014 double-click to go in"]}):null]}):null]}),!V&&B.length>0?(0,g.jsx)("div",{className:"graview-drive-in","data-testid":`drive-in-${String(a)}`,"data-graview-showing":C,onPointerDown:f=>f.stopPropagation(),onDoubleClick:f=>f.stopPropagation(),children:(0,g.jsx)("div",{className:"graview-drive-in-marquee",role:"group","aria-label":`${o}: pictures`,"data-graview-thumbs":B.length===1?"one":"two",children:B.map(f=>{let K=C===f.as;return(0,g.jsxs)("div",{className:"graview-drive-in-thumb","data-graview-pressed":K||void 0,children:[(0,g.jsx)("span",{className:"graview-drive-in-thumb-title","aria-hidden":"true",children:f.title}),(0,g.jsx)("button",{type:"button",className:"graview-drive-in-thumb-press","data-testid":`showing-${f.as}`,"aria-label":`${o}: ${f.title}`,"aria-pressed":K,title:K?`${f.title} is showing \u2014 press again to open it`:`Show ${f.title} on the billboard \u2014 double-click to open it`,onClick:I=>{I.stopPropagation();let Be=()=>w(Ue($,String(a),f.as));if(I.detail>=2||K&&r.focused){Be();return}w(ze(He(Fe($,!0),_e(String(a))),"view",f.as)),I.detail===1&&Qt(I.currentTarget.ownerDocument,bt(I.nativeEvent),Be)}})]},f.as)})})}):null]})};p.generic=!0,u.generic=!0,n.register(a,{cardinality:"one",fidelity:"full"},_(d)).register(a,{cardinality:"one",fidelity:"summary"},_(i)).register(a,{cardinality:"one",fidelity:"glyph"},_(c)).register(a,{cardinality:"many",fidelity:"full"},_(p)).register(a,{cardinality:"many",fidelity:"summary"},_(p)).register(a,{cardinality:"many",fidelity:"glyph"},_(u))}return n}var x=T(ne(),1);var be=T(ne(),1);var Ne=T(D(),1),Nt=new WeakMap;function an(e){let n=Nt.get(e);return n||Nt.set(e,n=xt(e,ce(e))),n}var xe=Ze;function Rt(){return(0,be.useContext)(xe)}function Yn({children:e}){return(0,Ne.jsx)(xe.Provider,{value:!0,children:e})}function Ct(e){let n=(0,be.useContext)(xe),{store:a}=N();if(n)return null;let t=e.kind??e.node?.kind??e.nodes?.[0]?.kind;if(!t)return null;let o=an(a.schema).lookup(t,{cardinality:e.cardinality,fidelity:e.fidelity});return o?(0,Ne.jsx)(o,{...e}):null}var l=T(D(),1),Pt=(0,x.createContext)(null),rn=(e,n)=>e.trim().toLowerCase().replace(/[_-]+/g," ")===n.trim().toLowerCase().replace(/[_-]+/g," "),on=(0,x.createContext)(null),Pe=(0,x.createContext)(null);function sn({block:e}){let n=(0,x.useContext)(Pe),a=n?.slots?.[e.key],t=(0,l.jsx)(ln,{block:e});return a?(0,l.jsx)(x.Suspense,{fallback:t,children:(0,l.jsx)(a,{block:e,node:n.node,drawn:t})}):t}function ln({block:e}){let n=(0,x.useContext)(Pt),a=(0,x.useContext)(un),t=(0,x.useContext)(Ce);if(n&&e.t==="badge"&&n.values.some(o=>rn(o,e.text))||n&&e.t==="field"&&n.field!==void 0&&e.field===n.field)return null;switch(e.t){case"title":return(0,l.jsx)("strong",{className:"graview-spec-title",children:e.text});case"text":return Se(e.text)?(0,l.jsx)("div",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},children:(0,l.jsx)(oe,{text:e.text})}):(0,l.jsx)("p",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},children:e.text});case"badge":return(0,l.jsx)("span",{className:"graview-spec-badge","data-graview-tone":e.tone,children:e.text});case"field":return(0,l.jsxs)("span",{className:"graview-spec-field","data-graview-field":e.field,children:[(0,l.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,l.jsx)("span",{className:"graview-spec-value",...Se(e.text)?{style:{whiteSpace:"pre-line"}}:{},children:e.href?(0,l.jsx)("a",{className:"graview-spec-link",href:e.href,rel:"noopener noreferrer",target:"_blank",children:e.text}):e.text})]});case"image":return(0,l.jsx)(U,{as:"block",field:e.field,files:e.files,label:e.label,view:e.as});case"progress":return e.value===void 0||e.max===void 0?(0,l.jsxs)("span",{className:"graview-spec-progress",children:[(0,l.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,l.jsx)("span",{className:"graview-spec-value",children:e.text})]}):(0,l.jsxs)("span",{className:"graview-spec-progress",children:[(0,l.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,l.jsx)("span",{className:"graview-spec-track",role:"progressbar","aria-label":e.label,"aria-valuemin":0,"aria-valuemax":e.max,"aria-valuenow":Math.max(0,Math.min(e.value,e.max)),"aria-valuetext":e.text,children:(0,l.jsx)("span",{className:"graview-spec-fill",style:{width:`${Math.round(Math.max(0,Math.min(e.value,e.max))/e.max*100)}%`}})}),(0,l.jsx)("span",{className:"graview-spec-value",children:e.text})]});case"group":return(0,l.jsx)("span",{className:"graview-spec-group","data-direction":e.direction,children:(0,l.jsx)(Re,{blocks:e.blocks})});case"when":return e.shown?(0,l.jsx)(Re,{blocks:e.blocks}):null;case"divider":return(0,l.jsx)("hr",{className:"graview-spec-divider"});case"figure":return(0,l.jsx)(dn,{});case"headline":{let o=`h${Math.min(6,e.level+a)}`,d=(0,l.jsx)(o,{className:"graview-spec-headline","data-level":e.level,children:e.text});return t!==null&&e.level===1?(0,l.jsxs)(l.Fragment,{children:[d,t]}):d}case"number":return(0,l.jsxs)("span",{className:"graview-spec-number",children:[(0,l.jsx)("span",{className:"graview-spec-number-value",children:e.text}),e.label?(0,l.jsx)("span",{className:"graview-spec-label",children:e.label}):null]});case"list":return(0,l.jsx)(gn,{list:e})}}function dn(){let e=(0,x.useContext)(Pe)?.figure;return e?(0,l.jsx)("span",{className:"graview-spec-figure","aria-hidden":"true",children:e()}):null}function Re({blocks:e}){return e.map((n,a)=>(0,l.jsx)(sn,{block:n},a))}function $t({blocks:e,ctx:n,view:a}){let t=(0,x.useContext)(on)?.[a];return(0,l.jsx)(Pe.Provider,{value:{figure:n.figure,slots:t,node:n.node},children:(0,l.jsx)(Re,{blocks:e})})}function $e({blocks:e,ctx:n,view:a}){return(0,l.jsx)($t,{blocks:Z(e,n),ctx:n,view:a})}var Tt=3,At=(0,x.createContext)(0),cn=(0,x.createContext)(null),un=(0,x.createContext)(0),Ce=(0,x.createContext)(null);function pn({node:e,as:n,depth:a,said:t=null}){let{store:o,views:d}=N(),i=A(o.schema.tryDefinition(e.kind),e),c=d.lookup(e.kind,{cardinality:"one",fidelity:n==="card"?"summary":"glyph"});return(0,l.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":n,children:[a<=Tt&&c?(0,l.jsx)(Xe,{mode:"scene",children:(0,l.jsx)(At.Provider,{value:a,children:(0,l.jsx)(Pt.Provider,{value:t,children:(0,l.jsx)(c,{node:e,cardinality:"one",fidelity:n==="card"?"summary":"glyph",mode:"scene",selected:!1})})})}):(0,l.jsx)("span",{className:"graview-spec-item-name",children:i}),(0,l.jsx)(Et,{node:e,label:i})]})}function Et({node:e,label:n}){let a=(0,x.useContext)(cn);return a?(0,l.jsx)("a",{className:"graview-spec-item-link",href:a.href(e),"aria-label":n,onClick:t=>{t.metaKey||t.ctrlKey||t.shiftKey||t.button!==0||(t.preventDefault(),t.stopPropagation(),a.go(e))}}):(0,l.jsx)("button",{type:"button",className:"graview-spec-item-link","data-graview-pick":e.id,"aria-label":n})}function gn({list:e}){let n=(0,x.useContext)(At)+1,{store:a}=N();if(e.failed)return(0,l.jsx)("p",{className:"graview-spec-text",children:"\u2014"});if(e.members.length===0)return e.empty?(0,l.jsx)("p",{className:"graview-spec-text graview-spec-empty",children:e.empty}):null;let t=(i,c=null)=>n>Tt?(0,l.jsx)("ul",{className:"graview-spec-list","data-as":"names",children:i.map(p=>(0,l.jsxs)("li",{className:"graview-spec-item","data-graview-listed":p.id,"data-as":"name",children:[(0,l.jsx)("span",{className:"graview-spec-item-name",children:A(a.schema.tryDefinition(p.kind),p)}),(0,l.jsx)(Et,{node:p,label:A(a.schema.tryDefinition(p.kind),p)})]},p.id))}):(0,l.jsx)("ul",{className:"graview-spec-list","data-as":e.as,children:i.map(p=>(0,l.jsx)(pn,{node:p,as:e.as,depth:n,said:c},p.id))}),o=e.more>0?(0,l.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${e.more} more`}):null;if(!e.groups)return(0,l.jsxs)("div",{className:"graview-spec-listing",children:[t(e.members),o]});let d=`h${e.headingLevel}`;return(0,l.jsxs)("div",{className:"graview-spec-listing",children:[e.groups.map(i=>(0,l.jsxs)("section",{className:"graview-spec-list-group","data-graview-group":i.value??"",children:[i.heading?(0,l.jsx)(d,{className:"graview-spec-list-heading",children:i.heading}):null,t(i.members,i.value!==null?{values:[i.value,...i.heading?[i.heading]:[]]}:null)]},i.value??"")),o]})}function da({blocks:e,heading:n=2,firstHeading:a,slot:t,view:o=t}){let{store:d,brand:i}=N();de();let c=re(d,null,null,{heading:n,firstHeading:a,money:i}),p=(0,x.useContext)(Ce),u=e.some(r=>r.t==="headline");return(0,l.jsxs)("div",{className:`graview-spec graview-spec-${t}`,"data-graview-spec":t,children:[p!==null&&!u?p:null,(0,l.jsx)(Ce.Provider,{value:u?p:null,children:(0,l.jsx)($e,{blocks:e,ctx:c,view:o})})]})}function Te(e,n="card"){let{store:a,brand:t}=N(),o=a.schema;return{...re(a,null,e,{slot:n,money:t}),figure:()=>(0,l.jsx)(ae,{kind:e.kind,schema:o,...t?{brand:t}:{},size:22})}}function mn({slot:e,blocks:n,node:a,selected:t}){let o=Te(a,e);return(0,l.jsx)("div",{className:`graview-spec graview-spec-${e}`,"data-graview-spec":e,"data-graview-kind":a.kind,...e==="row"&&n.some(st)?{"data-graview-tall":""}:{},...t?{"data-selected":""}:{},children:(0,l.jsx)($e,{blocks:n,ctx:o,view:`${a.kind}.${e}`})})}function fn({blocks:e,node:n,selected:a,flagged:t}){let o=Te(n),[d,...i]=e,c=d?.t==="title";return(0,l.jsx)(Q,{...c?{title:Z([d],o)[0].text}:{},selected:a,tone:t?"warning":"muted",fit:!0,children:(0,l.jsx)("div",{className:"graview-spec graview-spec-card","data-graview-spec":"card","data-graview-kind":n.kind,children:(0,l.jsx)($e,{blocks:c?i:e,ctx:o,view:`${n.kind}.card`})})})}function yn({blocks:e,props:n}){let a=n.node,t=Te(a,"page"),o=Rt(),d=Z(e,t),i=ue(e,d),c=i.title!==void 0&&(!o||i.title===A(t.schema?.tryDefinition(a.kind),a)),p=(0,l.jsx)("div",{className:"graview-spec graview-spec-page","data-graview-spec":"page","data-graview-kind":a.kind,children:(0,l.jsx)($t,{blocks:c?d.slice(1):d,ctx:t,view:`${a.kind}.page`})});return o?p:(0,l.jsx)(se.Provider,{value:{nodeId:a.id,...i.title!==void 0?{title:i.title}:{},body:p,fields:i.fields,records:i.records},children:(0,l.jsx)(Ct,{...n})})}function ca(e,n,a){return typeof e=="function"?e.says?.(n,a):void 0}function hn({blocks:e,node:n,selected:a}){let{store:t}=N();return(0,l.jsx)("div",{title:A(t.schema.tryDefinition(n.kind),n),style:{minWidth:0,maxWidth:"100%"},children:(0,l.jsx)(mn,{slot:"row",blocks:e,node:n,selected:a})})}function ua(e,n,a){if(!a)return e;let t=new Set(n.kinds);for(let[o,d]of Object.entries(a)){if(!t.has(o)||!d)continue;let i=o;if(d.card){let c=ie(d.card),p=u=>u.node?(0,l.jsx)(fn,{blocks:c,node:u.node,selected:u.selected,flagged:u.flagged?.includes(u.node.id)??!1}):null;e.register(i,{cardinality:"one",fidelity:"summary"},p)}if(d.row){let c=ie(d.row),p=u=>u.node?(0,l.jsx)(hn,{blocks:c,node:u.node,selected:u.selected}):null;p.says=(u,r)=>ue(c,Z(c,re({graph:r,schema:n},null,u,{slot:"row"}))),e.register(i,{cardinality:"one",fidelity:"glyph"},p)}if(d.page){let c=ie(d.page),p=u=>u.node?(0,l.jsx)(yn,{blocks:c,props:u}):null;p.says=(u,r)=>ue(c,Z(c,re({graph:r,schema:n},null,u))),e.register(i,{cardinality:"one",fidelity:"full"},p)}}return e}export{ht as a,zt as b,xt as c,Yn as d,Pt as e,cn as f,un as g,Ce as h,Et as i,da as j,ca as k,ua as l};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as r}from"./chunk.MRK6QJV5.js";import{b as d}from"./chunk.AJZBJBMO.js";var n=d(r(),1);function u(e){return(0,n.useMemo)(()=>e===void 0||e===""?void 0:{__html:e},[e])}export{u as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk.KWW3YHQ4.js";import"./chunk.22H4JXTH.js";import"./chunk.HOPIZMJR.js";import"./chunk.2VUG6EAN.js";import"./chunk.IH42QTOM.js";import"./chunk.TBG2QBOS.js";import"./chunk.PN2H6X7O.js";import"./chunk.BCBH6WJF.js";import"./chunk.A73BXXE4.js";import"./chunk.N7HCALRK.js";import"./chunk.WHTNSETN.js";import"./chunk.WVUJXDXZ.js";import"./chunk.46KUPBQC.js";import"./chunk.N2WTNKEV.js";import"./chunk.SBHVVJY7.js";import"./chunk.GE5EAN36.js";import"./chunk.337WDTG3.js";import"./chunk.EYF6ONTA.js";import"./chunk.Q3HVA6L4.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.2GBQJXJH.js";import"./chunk.ZJDRD6PO.js";import"./chunk.SNBIZ3B6.js";import"./chunk.6LJ66MB7.js";import"./chunk.NRRUGG22.js";import"./chunk.MKNXV4TM.js";import"./chunk.MRK6QJV5.js";import"./chunk.AJZBJBMO.js";export{b as declaredLensView,a as formatFor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as n}from"./chunk.A73BXXE4.js";import"./chunk.N7HCALRK.js";import"./chunk.WHTNSETN.js";import"./chunk.WVUJXDXZ.js";import{e as p}from"./chunk.46KUPBQC.js";import"./chunk.N2WTNKEV.js";import"./chunk.SBHVVJY7.js";import"./chunk.GE5EAN36.js";import"./chunk.337WDTG3.js";import"./chunk.EYF6ONTA.js";import"./chunk.Q3HVA6L4.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.ZJDRD6PO.js";import"./chunk.SNBIZ3B6.js";import"./chunk.6LJ66MB7.js";import"./chunk.NRRUGG22.js";import"./chunk.MKNXV4TM.js";import{b as m}from"./chunk.MRK6QJV5.js";import{b as t}from"./chunk.AJZBJBMO.js";var i=t(m(),1),a=new WeakMap;function l(o){let e=a.get(o);if(!e){let r=p(o);e=c=>c.mode==="fullscreen"?(0,i.jsx)(n,{blocks:r,slot:"home",heading:2,firstHeading:1}):(0,i.jsx)(n,{blocks:r,slot:"home",heading:3,firstHeading:2}),a.set(o,e)}return e}export{l as homeView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as he,b as Oe,c as xe,d as ce,e as v,f as Ee,h as Fe}from"./chunk.CY7MDLRS.js";import{e as Re,f as De,g as Me}from"./chunk.N2WTNKEV.js";import{a as ne,b as te,c as L,d as Ae,e as W,g as X,h as Te}from"./chunk.GE5EAN36.js";import{b as Se,g as u,h as ve,i as ae}from"./chunk.337WDTG3.js";import{a as ee,b as Y,d as ye,e as $e,f as C,h as k,k as G,l as be,m as _,n as ke,o as q,p as F,r as w,s as we,sa as We,t as R,u as O,v as U,w as T,x as n,y as V,z as je}from"./chunk.MKNXV4TM.js";import"./chunk.AJZBJBMO.js";var le="graview-document",pe=1,fe=256*1024,de=64*1024,Pe=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ue=/^[a-z][A-Za-z0-9]*$/,Ze=new Set(["id","kind"]),Je=e=>e in Object.prototype,Ke=V(e=>!Je(e),"every object already has this name \u2014 choose another"),Ce=(e,t)=>[...e===void 0?[]:[$e(e)],...t===void 0?[]:[ye(t)]],b=(e,t)=>k().check(...Ce(e,t)),x=(e,t,i)=>F(e).check(...Ce(t,i)),A=e=>k().check(C(Pe,`${e} names are lower-case words joined by hyphens, like "booked-vendor"`)),Ye=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,B=k().check(C(Ye,'relation names are one camelCase word, like "tendedBy"'),Ke),P=k().check(C(ue,'field names are one word or camelCase, like "dueDate" \u2014 rules say them bare'),V(e=>!Ze.has(e),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),Ke),I=b(1,500),J=b(1,2e3),se=b(1,300),Xe=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","file"],Ge=w({type:U(Xe),required:n(_()),description:n(I),label:n(b(1,60)),options:n(x(b(1,80),1,100)),of:n(U(["string","number","date","image","file"])),default:n(q()),unit:n(b(void 0,12)),format:n(U(["money","percent","duration"])),min:n(G()),max:n(G()),step:n(G()),renamedFrom:n(k().check(C(ue)))}).check(je((e,t)=>{e.type==="enum"&&!e.options&&t.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),e.type!=="enum"&&e.options&&t.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),e.type!=="list"&&e.of&&t.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]})})),He=w({to:R([x(A("kind"),1),T("*")]),cardinality:n(U(["one","many"])),description:n(I),inverse:n(b(1,80)),appendOnly:n(_()),renamedFrom:n(k())}),_e=R([J,w({expr:J,label:n(b(1,60)),description:n(I)})]),Qe=w({noun:n(b(1,40)),plural:n(b(1,40)),description:n(I),fields:O(P,Ge).check(V(e=>Object.keys(e).length>0,"a kind has at least one field")),label:n(se),describe:n(se),lifecycle:n(w({field:P,retired:x(R([k(),G(),_()]),1)})),figure:n(b(void 0,2e4)),glance:n(x(P,1,20)),page:n(w({fields:n(x(P,1,40)),groups:n(x(w({title:b(1,60),fields:x(P,1,40)}),1,12))})),edges:n(O(B,He)),computed:n(O(k(),_e).check(V(e=>Object.keys(e).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:n(O(k(),k())),renamedFrom:n(k().check(C(Pe))),people:n(_())}),H=R([k(),G(),_(),ke(),F(q()),w({expr:J})]),Z=k().check(C(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),en=R([w({create:A("kind"),as:n(k().check(C(ue))),set:n(O(P,H))}),w({set:O(P,H),target:n(Z)}),w({connect:B,from:Z,to:Z}),w({sever:B,from:Z,to:Z}),w({remove:Z})]),nn=w({title:n(b(1,80)),description:n(I),fromTheOtherEnd:n(b(1,80)),on:n(R([A("kind"),x(A("kind"),1)])),creates:n(A("kind")),sets:n(O(P,H)),writes:n(x(P,1)),connects:n(B),severs:n(B),setsOther:n(O(P,H)),replaces:n(R([T(!0),x(B,1,10)])),removes:n(T(!0)),args:n(O(P,Ge)),effects:n(x(en,1,20)),allowedWhen:n(J),refusal:n(se),destructive:n(_())}),tn=w({act:A("act"),label:n(b(1,80)),args:n(O(k(),H))}),on=w({title:n(b(1,120)),description:n(I),over:R([T("graph"),A("kind")]),when:n(J),require:J,says:n(se),repairs:n(x(tn,void 0,10))}),sn=w({roles:R([x(A("role"),1),T("*")]),mutations:R([x(A("act"),1),T("*")]),kinds:n(R([F(A("kind")),T("*")])),describe:n(I),self:n(_()),ownEnd:n(_())}),rn=w({roles:R([x(A("role"),1),T("*")]),kinds:x(A("kind"),1),own:n(_()),via:n(B)}),an=w({grants:F(sn),sees:n(F(rn))}),cn=w({accent:n(k().check(C(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),name:n(b(1,60)),currency:n(k().check(C(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(b(2,35)),logo:n(R([b(1,de),w({src:b(1,de),alt:n(b(1,120))})])),favicon:n(b(1,de)),typography:n(w({display:n(b(1,200)),body:n(b(1,200)),mono:n(b(1,200))})),shape:n(w({radius:n(G().check(Y(0),ee(32))),density:n(G().check(Y(.75),ee(1.5)))})),accents:n(O(k(),G().check(Y(0),ee(360)))),scheme:n(U(["light","dark","auto"]))}),oe=O(k(),q()),dn=w({card:n(F(q())),row:n(F(q())),page:n(F(q()))}),ln=we({order:n(F(k())),hide:n(F(k())),first:n(k()),primary:n(x(b(1,80),void 0,40)),scene:n(b(1,40)),pages:n(b(1,40))}),qe=w({$schema:n(k()),format:T(le),formatVersion:T(pe),name:b(1,80),description:n(I),version:n(G().check(be(),Y(1))),kinds:O(A("kind"),Qe).check(V(e=>Object.keys(e).length>0,"a document declares at least one kind"),V(e=>Object.keys(e).length<=40,"a document declares at most 40 kinds")),computed:n(O(k(),_e)),acts:n(O(A("act"),nn)),rules:n(O(A("rule"),on)),roles:n(F(A("role"))),policy:n(an),modules:n(oe),lenses:n(F(oe)),pages:n(ln),views:n(O(k(),R([dn,F(q())]))),brand:n(cn),settings:n(F(oe)),migrations:n(F(oe))});var pn={};function Ie(e,t=pn,i=pe){let{document:a,respelled:p}=he(e),f=p.length>0?{respelled:p}:{};if(!a||typeof a!="object"||Array.isArray(a))return{document:a};let m=a;if(m.format!==le||typeof m.formatVersion!="number"||m.formatVersion>=i)return{document:a,...f};let c=m.formatVersion,r=structuredClone(m);for(let s=c;s<i;s++){let d=t[s];if(!d)throw new Error(`there is no upgrade from format ${s} to ${s+1}`);r={...d(r),formatVersion:s+1}}return{document:r,from:c,...f}}function Ne(e,t,i){let a=Object.keys(e).filter(c=>e[c].edges?.[t]!==void 0);if(a.length===0)return;let p=a.map(c=>e[c].edges[t].to),f=p.some(c=>c==="*")?"*":[...new Set(p.flatMap(c=>c))];if(i.length===0||i.some(c=>a.includes(c)))return{reversed:!1,kinds:f};let m=a.filter(c=>{let r=e[c].edges[t].to;return r==="*"||i.every(s=>r.includes(s))});return m.length>0?{reversed:!0,kinds:m}:{reversed:!1,kinds:f}}function Ve(e,t,i=`kinds.${e}.page`){let a=t.page;if(!a)return[];let p=[],f=[...Object.keys(t.fields),...Object.keys(t.computed??{})],m=new Set,c=(s,d)=>{f.includes(s)?m.has(s)&&p.push(u("page-field-twice",d,`"${s}" is on ${e}'s page twice; name each field once`)):p.push(u("page-field",d,`${e}'s page is to show "${s}", and ${e} has no field or computed field called that`,`use one of: ${f.join(", ")}`)),m.add(s)};(a.fields??[]).forEach((s,d)=>c(s,`${i}.fields.${d}`));let r=new Set;return(a.groups??[]).forEach((s,d)=>{let l=s.title.trim().toLowerCase();r.has(l)&&p.push(u("page-group-twice",`${i}.groups.${d}.title`,`${e}'s page has two groups called "${s.title}"; give each its own title`)),r.add(l),s.fields.forEach((y,o)=>c(y,`${i}.groups.${d}.fields.${o}`))}),p}var fn=new Set(["subject","now","today","me"]);function un(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>fe)return{findings:[u("too-large","",`a document may be at most ${fe/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(a){return{findings:[u("not-json","",`this is not JSON: ${a.message}`)]}}try{e=Ie(e).document}catch(a){return{findings:[u("format","formatVersion",a.message)]}}let t=qe.safeParse(e);if(!t.success)return{findings:t.error.issues.map(a=>{let p=a.path.map(String).join(".");if(a.code==="unrecognized_keys")return u("unknown-key",p,`${a.keys.map(f=>`"${f}"`).join(", ")} ${a.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(a.code==="invalid_union"&&/\.effects\.\d+$/.test(p))return u("effect-shape",p,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(a.code==="invalid_key"){let f=a.issues?.[0]?.message;return u("shape",p,`the name "${String(a.path.at(-1))}" is not allowed here${f?`: ${f}`:""}`)}return u("shape",p,a.message)})};let i=t.data;return{document:i,findings:mn(i)}}var re=e=>[e??[]].flat();function Be(e){let t=new Map;for(let[i,a]of Object.entries(e.kinds))for(let[p,f]of Object.entries(a.edges??{})){let m=t.get(p);t.set(p,{name:p,from:[...m?.from??[],i],to:f.to==="*"||m?.to==="*"?"*":[...new Set([...m?.to??[],...f.to])],cardinality:f.cardinality??"many"})}return t}function qn(e){let t=new Map;for(let[a,p]of Object.entries(e.kinds)){let f=X(p);t.set(a,{fields:new Set(Object.keys(p.fields)),edges:new Map(Object.entries(p.edges??{}).map(([m,c])=>[m,c.cardinality??"many"])),...f?{computed:f}:{}})}let i=X(e);return i&&t.set(Se,{computed:i}),t}function Ue(e,t){let i=[],a=re(e.on),p=(f,m)=>{let c=Ne(t.kinds,f,a)?.reversed===!0,[r,s]=c?["$to","$subject"]:["$subject","$to"];return m==="connect"?{connect:f,from:r,to:s}:{sever:f,from:r,to:s}};if(e.creates){let f=t.kinds[e.creates],m={};for(let c of Object.keys(f?.fields??{}))m[c]=`$${c}`;for(let c of e.effects??[])"set"in c&&!("create"in c)&&v(c.target)==="new"&&Object.assign(m,c.set);i.push({create:e.creates,as:"new",set:m})}return e.sets&&i.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&i.push({set:Object.fromEntries(e.writes.map(f=>[f,`$${f}`]))}),e.connects&&(e.replaces&&i.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),i.push(p(e.connects,"connect"))),e.severs&&i.push(p(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&i.push({set:e.setsOther,target:"$to"}),e.removes&&i.push({remove:"$subject"}),e.effects&&i.push(...e.effects.filter(f=>!(e.creates&&"set"in f&&!("create"in f)&&v(f.target)==="new"))),i}function me(e,t,i){try{let a=L(e),p=ne(a);for(let f of p.unknownFunctions)i.push(u("unknown-function",t,`"${f}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return a}catch(a){if(a instanceof te){i.push(u("expression",t,a.sentence+` (at character ${a.at+1})`));return}throw a}}function ge(e,t,i){try{return W(e)}catch(a){if(a instanceof Ae||a instanceof te){i.push(u("template",t,(a instanceof te,a.sentence)));return}throw a}}function mn(e){let t=[],i=new Set(Object.keys(e.kinds)),a=Be(e),p=e.acts??{},f=new Set(e.roles??[]);for(let[c,r]of Object.entries(e.kinds)){let s=`kinds.${c}`;for(let[l,y]of Object.entries(r.edges??{})){if(y.to!=="*")for(let o of y.to)i.has(o)||t.push(u("edge-target",`${s}.edges.${l}.to`,`"${o}" is not a kind this document declares`));r.fields[l]&&t.push(u("edge-field-clash",`${s}.edges.${l}`,`"${l}" is both a field and a relation of ${c}`,"rename one of them"))}r.lifecycle&&!r.fields[r.lifecycle.field]&&t.push(u("lifecycle-field",`${s}.lifecycle.field`,`${c} has no field "${r.lifecycle.field}"`));let d=l=>r.computed!==void 0&&Object.hasOwn(r.computed,l);for(let l of r.glance??[])!r.fields[l]&&!d(l)&&t.push(u("glance-field",`${s}.glance`,`a glance at ${c} is to say "${l}", and ${c} has no field or computed field called that`,`use one of: ${[...Object.keys(r.fields),...Object.keys(r.computed??{})].join(", ")}`));t.push(...Ve(c,r));for(let l of["label","describe"]){let y=r[l];if(!y)continue;let o=ge(y,`${s}.${l}`,t);for(let z of o??[])if(z.expr){for(let $ of ne(z.expr).names)if(!r.fields[$]){if(d($)){Te(r,$)||t.push(u("template-field",`${s}.${l}`,`${c}'s ${$} is worked out from beyond the record, and a ${l} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${c}'s own fields`));continue}t.push(u("template-field",`${s}.${l}`,`${c} has no field "${$}" for its ${l} to show`,l==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[l,y]of Object.entries(r.fields))y.default!==void 0&&y.type==="enum"&&!y.options?.includes(String(y.default))&&t.push(u("default-option",`${s}.fields.${l}.default`,`"${String(y.default)}" is not one of ${l}'s options`))}for(let[c,r]of Object.entries(p)){let s=`acts.${c}`;for(let o of re(r.on))i.has(o)||t.push(u("act-kind",`${s}.on`,`"${o}" is not a kind this document declares`));let d=re(r.on),l=Ue(r,e);if(r.creates&&r.on===void 0&&r.writes&&i.has(r.creates))for(let o of r.writes)e.kinds[r.creates].fields[o]||(e.kinds[r.creates].computed?.[o]!==void 0?t.push(u("computed-written",`${s}.writes`,`${r.creates}'s ${o} is worked out, not written: no act can set it`,"write the stored fields it is worked out from")):t.push(u("act-field",`${s}.writes`,`${r.creates} has no field "${o}"`)));l.length===0&&t.push(u("act-empty",s,`"${c}" does nothing`,"give it effects or a shorthand such as sets or creates"));let y=new Map;l.forEach((o,z)=>{let $=l.length-(r.effects?.length??0),j=r.effects&&z>=$?`${s}.effects.${z-$}`:s;if("create"in o){if(!i.has(o.create))t.push(u("act-kind",`${j}.create`,`"${o.create}" is not a kind this document declares`));else for(let h of Object.keys(o.set??{}))e.kinds[o.create].fields[h]||(e.kinds[o.create].computed?.[h]!==void 0?t.push(u("computed-written",`${j}.set.${h}`,`${o.create}'s ${h} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):t.push(u("act-field",`${j}.set.${h}`,`${o.create} has no field "${h}"`)));o.as&&y.set(o.as,o.create)}else if("connect"in o||"sever"in o){let h="connect"in o?o.connect:o.sever;a.has(h)||t.push(u("act-edge",`${j}.${"connect"in o?"connect":"sever"}`,`"${h}" is not a relation any kind declares`)),v(o.from)==="subject"&&d.length===0&&t.push(u("act-subject",`${s}.on`,`"${c}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in o){let h=v(o.target??"$subject"),M=h==="subject"?d:y.has(h??"")?[y.get(h)]:[];h==="subject"&&d.length===0&&t.push(u("act-subject",`${s}.on`,`"${c}" changes "$subject" but does not say which kinds it is "on"`));for(let K of Object.keys(o.set))for(let N of M)!i.has(N)||e.kinds[N].fields[K]||(e.kinds[N].computed?.[K]!==void 0?t.push(u("computed-written",`${j}.set.${K}`,`${N}'s ${K} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):t.push(u("act-field",`${j}.set.${K}`,`${N} has no field "${K}"`)))}else"remove"in o&&v(o.remove)==="subject"&&d.length===0&&t.push(u("act-subject",`${s}.on`,`"${c}" removes "$subject" but does not say which kinds it is "on"`));("set"in o&&o.set?Object.values(o.set):[]).forEach(h=>{h&&typeof h=="object"&&!Array.isArray(h)&&"expr"in h&&me(h.expr,`${j}.set`,t)})}),r.allowedWhen&&me(r.allowedWhen,`${s}.allowedWhen`,t),r.refusal&&ge(r.refusal,`${s}.refusal`,t)}for(let[c,r]of Object.entries(e.rules??{})){let s=`rules.${c}`;r.over!=="graph"&&!i.has(r.over)&&t.push(u("rule-kind",`${s}.over`,`"${r.over}" is not a kind this document declares`));let d=r.over==="graph"?void 0:e.kinds[r.over];for(let l of["when","require"]){let y=r[l];if(!y)continue;let o=me(y,`${s}.${l}`,t);if(!o)continue;let z=ne(o);for(let $ of z.names)if(r.over==="graph")t.push(u("rule-name",`${s}.${l}`,`"${$}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(d&&!d.fields[$]&&!d.edges?.[$]&&d.computed?.[$]===void 0){let j=Object.keys(d.edges??{}).find(E=>E.includes("-")&&E.split("-").includes($));t.push(u("rule-name",`${s}.${l}`,`${r.over} has no field or relation called "${$}"`,j?`"${j}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${j.replace(/-([a-z0-9])/g,(E,h)=>h.toUpperCase())}"`:void 0))}for(let $ of z.edges)a.has($)||t.push(u("rule-edge",`${s}.${l}`,`"${$}" is not a relation any kind declares`));for(let $ of z.sweeps)i.has($)?r.over!=="graph"&&t.push(ve("rule-cost",`${s}.${l}`,`this rule looks at every ${$} for every ${r.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):t.push(u("rule-kind",`${s}.${l}`,`"${$}" is not a kind this document declares`))}r.says&&ge(r.says,`${s}.says`,t),(r.repairs??[]).forEach((l,y)=>{!p[l.act]&&!/^(edit|remove)-/.test(l.act)&&t.push(u("repair-act",`${s}.repairs.${y}.act`,`"${l.act}" is not an act this document declares`))})}let m=e.policy;return m&&(m.grants.forEach((c,r)=>{if(c.roles!=="*"&&f.size>0)for(let s of c.roles)f.has(s)||t.push(u("grant-role",`policy.grants.${r}.roles`,`"${s}" is not one of the document's roles`));if(c.mutations!=="*")for(let s of c.mutations)!p[s]&&!/^(edit|remove)-/.test(s)&&t.push(u("grant-act",`policy.grants.${r}.mutations`,`"${s}" is not an act this document declares`))}),(m.sees??[]).forEach((c,r)=>{for(let s of c.kinds)i.has(s)||t.push(u("sight-kind",`policy.sees.${r}.kinds`,`"${s}" is not a kind this document declares`));if(c.roles!=="*"&&f.size>0)for(let s of c.roles)f.has(s)||t.push(u("sight-role",`policy.sees.${r}.roles`,`"${s}" is not one of the document's roles`))})),t.push(...Me(e)),t}function gn(e,t,i,a){let p=new Map,f=re(e.on),m=new Map,c=new Map;(f.length>0||t.some(o=>"remove"in o&&v(o.remove)==="subject"||"from"in o&&(v(o.from)==="subject"||v(o.to)==="subject")||"set"in o&&!("create"in o)&&v(o.target??"$subject")==="subject"))&&p.set(ce,{ref:f.length>0?f:"*",required:!0});let s=e.args??{},d=e.writes?.length===1,l=(o,z)=>z&&o.type===z.type&&o.min===void 0&&o.max===void 0&&o.step===void 0?{...o,...z.min===void 0?{}:{min:z.min},...z.max===void 0?{}:{max:z.max},...z.step===void 0?{}:{step:z.step}}:o,y=(o,z,$)=>{if(o===ce||fn.has(o)||m.has(o)||p.has(o))return;let j=s[o]?l(s[o],$):void 0;p.set(o,j?{field:j,optional:!j.required,required:!!j.required}:z())};for(let o of t)if("create"in o){let z=i.kinds[o.create];for(let[$,j]of Object.entries(o.set??{})){let E=v(j),h=z?.fields[$];if(E&&h){let M=!!h.required&&h.default===void 0;y(E,()=>({field:h,optional:!M,required:M}),h)}}o.as&&m.set(o.as,o.create)}else if("connect"in o||"sever"in o){let z=a.get("connect"in o?o.connect:o.sever);for(let[$,j]of[["from",o.from],["to",o.to]]){let E=v(j);if(!E)continue;let h=$==="to"?z?.to??"*":z?.from??"*";h!=="*"&&!c.has(E)&&c.set(E,h),y(E,()=>({ref:h,required:!0}))}}else if("set"in o){let z=v(o.target??"$subject"),$=z==="subject"?f[0]:m.get(z??"")??c.get(z??"")?.[0];z&&z!=="subject"&&!m.has(z)&&y(z,()=>({ref:"*",required:!0}));for(let[j,E]of Object.entries(o.set)){let h=v(E);if(!h)continue;let M=$?i.kinds[$]?.fields[j]:void 0;y(h,()=>M?{field:M,optional:!d,required:d}:{any:!0,required:!1},M)}}else if("remove"in o){let z=v(o.remove);z&&y(z,()=>({ref:"*",required:!0}))}for(let[o,z]of Object.entries(s))p.has(o)||p.set(o,{field:z,optional:!z.required,required:!!z.required});return p}function In(e,t={}){let i=un(e);if(!i.document||ae(i.findings))return{ok:!1,findings:i.findings};let a=i.document,p=[...i.findings];t.previous&&p.push(...hn(a,t.previous));let f=zn(a,p);return ae(f.findings)?{ok:!1,findings:f.findings}:Fe(f,t)}function zn(e,t){let i=Be(e),a={};for(let[s,d]of Object.entries(e.kinds)){let l=Ee(d),y=d.label??(l?`{${l}}`:void 0),o=X(d);a[s]={...y?{label:W(y)}:{},...d.describe?{describe:W(d.describe)}:{},...o?{computed:[...o]}:{}}}let p={};for(let[s,d]of Object.entries(e.acts??{})){let l=Ue(d,e),y=gn(d,l,e,i),o=d.destructive??l.some(g=>"remove"in g||"sever"in g||"replace"in g),z=[...new Set(l.flatMap(g=>"create"in g?[g.create]:[]))],$=[...new Set(l.flatMap(g=>"connect"in g?[g.connect]:[]))],j=[...new Set(l.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],E=[...new Set(l.flatMap(g=>"set"in g&&!("create"in g)&&v(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],h=new Map;for(let g of l){if(!("connect"in g)&&!("sever"in g))continue;let S=i.get("connect"in g?g.connect:g.sever);for(let[D,Le]of[["from",g.from],["to",g.to]]){let Q=v(Le),ie=D==="to"?S?.to:S?.from;Q&&Q!=="subject"&&ie&&ie!=="*"&&h.set(Q,[...new Set([...h.get(Q)??[],...ie])])}}let M={};for(let g of l){if(!("set"in g)||"create"in g)continue;let S=v(g.target??"$subject");for(let D of S&&S!=="subject"&&h.get(S)||[])M[D]=[...new Set([...M[D]??[],...Object.keys(g.set)])]}let K={};for(let g of l)if(!(!("set"in g)||"create"in g||v(g.target??"$subject")!=="subject"))for(let[S,D]of Object.entries(g.set??{}))typeof D=="string"&&v(D)===void 0||typeof D=="number"||typeof D=="boolean"?K[S]=typeof D=="string"&&D.startsWith("$$")?D.slice(1):D:delete K[S];let N=z.length===0&&l.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(S=>!(S&&typeof S=="object"&&!Array.isArray(S)&&"expr"in S))),ze=new Map;for(let g of l)if(!(!("set"in g)||!g.set))for(let S of Object.values(g.set))S&&typeof S=="object"&&!Array.isArray(S)&&"expr"in S&&ze.set(S.expr,L(S.expr));p[s]={title:d.title??s.replace(/-/g," "),effects:l,args:[...y],...d.allowedWhen?{guard:L(d.allowedWhen)}:{},...d.refusal?{refusal:W(d.refusal)}:{},exprs:[...ze],destructive:o,idempotent:N,creates:z,connects:$,severs:j,writes:E,writesOther:M,sets:K}}let f={};for(let[s,d]of Object.entries(e.rules??{}))f[s]={title:d.title??s.replace(/-/g," "),require:L(d.require),...d.when?{when:L(d.when)}:{},...d.says?{says:W(d.says)}:{}};let m=Oe(e,t),c=Re(e),r=De(e);return{format:xe,document:e,findings:t,kinds:a,...e.computed?{facts:[...X(e)??[]]}:{},edges:[...i].map(([s,{from:d,to:l,cardinality:y}])=>[s,{from:d,to:l,cardinality:y}]),acts:p,rules:f,brand:m,...Object.keys(c).length>0?{viewSpecs:c}:{},...r?{home:r}:{}}}function Nn(e,t){let i=e.split(/[\s:·]/).find(a=>a.length>0)??e;return t.kinds[i]?`kinds.${i}`:t.acts?.[i]?`acts.${i}`:t.rules?.[i]?`rules.${i}`:e}function Vn(e,t,i){let a=/^defineNode\("([^"]+)"\)/.exec(t)?.[1],p=a?i.kinds[a]:void 0;if(!a||!p)return e;let f=Object.keys(p.fields).filter(m=>m!=="label").slice(0,3);return{...e,path:`kinds.${a}.glance`,fix:`Say which: "glance": [${f.map(m=>`"${m}"`).join(", ")}] on kinds.${a} \u2014 the facts a person compares one by, at a glance.`}}function hn(e,t){let i=[],a=new Set(Object.values(t.kinds).flatMap(p=>Object.keys(p.edges??{})));for(let[p,f]of Object.entries(e.kinds)){let m=f.renamedFrom;m&&!t.kinds[m]&&i.push(u("renamed-from-nothing",`kinds.${p}.renamedFrom`,`${p} says it was ${m}, and the previous version has no kind called ${m}`,"name the kind it was, or drop renamedFrom"));let c=t.kinds[m??p];for(let[r,s]of Object.entries(f.fields)){let d=s.renamedFrom;d&&!c?.fields[d]&&i.push(u("renamed-from-nothing",`kinds.${p}.fields.${r}.renamedFrom`,`${r} says it was ${d}, and the previous ${m??p} has no field called ${d}`,"name the field it was, or drop renamedFrom"))}for(let[r,s]of Object.entries(f.edges??{})){let d=s.renamedFrom;d&&!a.has(d)&&i.push(u("renamed-from-nothing",`kinds.${p}.edges.${r}.renamedFrom`,`${r} says it was ${d}, and the previous version has no relation called ${d}`,"name the relation it was, or drop renamedFrom"))}}return i}export{We as ActRefusal,In as compileDocumentWithoutCheck,Ue as effectsOf,Nn as frameworkPath,Vn as inDocumentWords,qn as kindShapes,un as readDocument};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Aa as p,B as s,Ba as w,L as k,ya as x}from"./chunk.MKNXV4TM.js";var j=e=>e.safeParse?.(void 0).success??!1,O=e=>p(e).shape,m=e=>{let r=p(e);if(s(r)?.type!=="literal")return;let o=s(r)?.values;return o&&o.length===1&&typeof o[0]=="string"?o[0]:void 0};function u(e,r){let o=j(r),n=p(r),i=s(n)?.type,g=x(r);if(g)return{control:"node",name:e,optional:o,kinds:g};if(i==="boolean")return{control:"boolean",name:e,optional:o};let b=k(n);if(b)return{control:"file",name:e,optional:o,...b==="image"?{image:!0}:{}};if(i==="object"){let a=n.shape??{};return{control:"group",name:e,optional:o,fields:Object.entries(a).map(([d,c])=>u(d,c))}}if(i==="union"){let a=s(n)?.options??[],d=a.map(l=>O(l));if(d.every(l=>l!==void 0)){let l=Object.keys(d[0]??{}).find(F=>d.every(f=>m(f?.[F])!==void 0));if(l)return{control:"variant",name:e,optional:o,tag:l,options:a.map((F,f)=>({value:m(d[f]?.[l])??"",fields:Object.entries(d[f]??{}).filter(([y])=>y!==l).map(([y,v])=>u(y,v))}))}}let c=a.map(l=>m(l));return c.every(l=>l!==void 0)?{control:"choice",name:e,optional:o,options:c}:{control:"opaque",name:e,optional:o}}if(i==="array"){let a=s(n)?.element;return a!==void 0?{control:"list",name:e,optional:o,item:u(e,a)}:{control:"opaque",name:e,optional:o}}let t=w(r);return t.type==="text"?{control:"text",name:e,optional:o,...t.long?{long:!0}:{}}:t.type==="date"?{control:"date",name:e,optional:o,...t.time?{time:!0}:{}}:t.type==="number"?{control:"number",name:e,optional:o,...t.min===void 0?{}:{min:t.min},...t.max===void 0?{}:{max:t.max},...t.step===void 0?{}:{step:t.step}}:t.type==="choice"?{control:"choice",name:e,optional:o,options:t.options}:{control:"opaque",name:e,optional:o}}function R(e){let r=e.shape;return r?Object.entries(r).map(([o,n])=>u(o,n)):[]}function h(e,r){let o={...r};for(let n of e){let i=r[n.name];i===void 0&&!n.optional&&(n.control==="list"||n.control==="boolean")&&(o[n.name]=n.control==="list"?[]:!1),n.control==="group"&&i!==void 0&&typeof i=="object"&&i!==null&&(o[n.name]=h(n.fields,i))}return o}export{R as a,h as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as m}from"./chunk.RZLNDVGN.js";import"./chunk.4TUNX4WM.js";import"./chunk.7S22MBNN.js";import"./chunk.ONDILMIX.js";import{f as g}from"./chunk.J6CBMLGR.js";import"./chunk.TBG2QBOS.js";import"./chunk.BCBH6WJF.js";import"./chunk.A73BXXE4.js";import"./chunk.N7HCALRK.js";import"./chunk.IKT7JQUW.js";import"./chunk.ISRS7GOT.js";import"./chunk.DCIC3YHX.js";import"./chunk.WHTNSETN.js";import"./chunk.WVUJXDXZ.js";import"./chunk.46KUPBQC.js";import"./chunk.N2WTNKEV.js";import"./chunk.SBHVVJY7.js";import"./chunk.GE5EAN36.js";import"./chunk.337WDTG3.js";import"./chunk.PWHJHFC4.js";import"./chunk.EYF6ONTA.js";import"./chunk.Q3HVA6L4.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.2GBQJXJH.js";import"./chunk.ZJDRD6PO.js";import"./chunk.SNBIZ3B6.js";import"./chunk.6LJ66MB7.js";import"./chunk.NRRUGG22.js";import{ua as n}from"./chunk.MKNXV4TM.js";import{a as b,b as l}from"./chunk.MRK6QJV5.js";import{b as t}from"./chunk.AJZBJBMO.js";var y=t(b(),1),a=t(l(),1);function P({store:h,auto:c,brand:r,views:f,presence:i,steering:o,overview:s,scope:d,titleLevel:v=2,props:e}){let u=(0,y.useMemo)(()=>g({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:c?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:u}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(m,{context:{store:h,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...s?{overview:s}:{},titleLevel:v,views:f,settings:e.app.settings??[],...i?{presence:i}:{},...r?{brand:r}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}},...e.pages?{registry:e.pages}:{},...o?{steering:o}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{P as PagesContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as _e,c as ae,d as We,e as ne,g as he,h as He,m as Je,o as te}from"./chunk.337WDTG3.js";import{A as Me,Ab as Be,Bb as Ze,D as me,E as Pe,M as ge,N as Te,T as Ne,_ as Fe,a as Oe,b as Re,c as xe,d as ee,ea as Ce,eb as Le,f as pe,fa as Ve,h as B,i as Ae,ia as ye,j as je,ja as Ie,k as se,l as Se,m as Ee,o as ze,p as De,q as fe,qb as qe,sa as Z,v as Ge,x as ue,xa as Ke,y as $e}from"./chunk.MKNXV4TM.js";function un(n,l){let e=n.brand??{},o=e.accent?Ze(e.accent):void 0;o&&!o.ok&&l.push(He("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${o.why}`,"pick a color further from orange-red, or a darker one"));let g=typeof e.logo=="string"?{src:e.logo}:e.logo,c=e.name??n.name,O=e.typography?Object.fromEntries(Object.entries(e.typography).filter(([,A])=>typeof A=="string"&&!/url\(|@import|[;{}<>\\]/i.test(A)).map(([A,N])=>[A,Be(N)])):void 0;return{name:c,schemes:o?.ok?o.schemes:qe,...e.currency?{currency:e.currency}:{},...e.locale?{locale:e.locale}:{},...g?{logo:g.src,logoAlt:g.alt??c}:{},...e.favicon?{favicon:e.favicon}:{},...n.description?{subtitle:n.description}:{},...O?{typography:O}:{},...e.shape?{shape:e.shape}:{},...e.accents?{accents:e.accents}:{},...e.scheme?{scheme:e.scheme}:{}}}function Ue(n){let{currency:l,locale:e}=n.brand??{};return{...l?{currency:l}:{},...e?{locale:e}:{}}}var tn=new WeakMap;function Ye(n,l){tn.set(n,l)}var rn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],T=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function Qe(n,l=rn){if(!T(n))return{document:n,respelled:[]};let e=[],o=n;for(let g of l)o=we(o,g.where.split("."),g,"",e);return{document:o,respelled:e}}function we(n,l,e,o,g){if(l.length===0){if(!T(n)||!Object.hasOwn(n,e.was))return n;g.push(`${o}${e.was}`);let{[e.was]:V,...$}=n;return Object.hasOwn(n,e.now)?$:{...$,[e.now]:V}}if(!T(n))return n;let[c,...O]=l,A=c.endsWith("[]"),N=A?c.slice(0,-2):c,z=n[N],D=z;if(!A)D=we(z,O,e,`${o}${N}.`,g);else if(Array.isArray(z)){let V=z.map(($,W)=>we($,O,e,`${o}${N}.${W}.`,g));D=V.some(($,W)=>$!==z[W])?V:z}return D===z?n:{...n,[N]:D}}var Xe="graview-compiled@1",_="id",de=n=>typeof n=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(n)?n.slice(1):void 0;function on(n){let l=Object.entries(n.fields);return l.find(([,e])=>e.required&&(e.type==="string"||e.type==="text"))?.[0]??l.find(([,e])=>e.type==="string")?.[0]}function en(n,l){let e;switch(n.type){case"string":e=B().check(ee(500));break;case"text":e=B().check(ee(2e4));break;case"number":case"integer":{let o=[...n.type==="integer"?[Se()]:[],...n.min===void 0?[]:[Re(n.min)],...n.max===void 0?[]:[Oe(n.max)],...n.step===void 0?[]:[xe(n.step)]];e=o.length>0?se().check(...o):se();break}case"boolean":e=Ee();break;case"date":e=B().check(pe(me,"a date like 2026-10-02"));break;case"datetime":e=B().check($e(o=>!Number.isNaN(Date.parse(o)),"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":e=Ge(n.options);break;case"list":e=De(n.of==="number"?se():n.of==="date"?B().check(pe(me)):n.of==="image"||n.of==="file"?ge(n.of):B().check(ee(500))).check(ee(200));break;case"image":case"file":e=ge(n.type);break;case"url":e=je();break;case"email":e=Ae();break}return n.description&&(e=e.check(Me(n.description))),l?ue(e):e}var re=n=>{throw new Z(`there is no record "${n}"`,"invalid")},sn=n=>"field"in n?en(n.field,n.optional):"ref"in n?Ke(n.ref):ue(ze()),an=new WeakMap;var ke=(n,l)=>T(l)&&Object.keys(n??{}).length===Object.keys(l).length&&Object.keys(n??{}).every(e=>Object.hasOwn(l,e));function zn(n,l={}){let e=T(n)?n.format:void 0;if(e!==Xe)return{ok:!1,findings:[he("compiled-format","format",e===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(e)}, and this build reads ${Xe}`,"compile the document instead")]};let o=n,g=Qe(o.document).document,c=g===o.document?o:{...o,document:g},O=T(g)&&typeof g.name=="string"&&T(g.kinds)&&ke(g.kinds,c.kinds)&&ke(g.acts,c.acts)&&ke(g.rules,c.rules)&&Array.isArray(c.edges)&&Array.isArray(c.findings),A={ok:!1,findings:[he("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!O)return A;try{return dn(c,l)}catch{return A}}function dn(n,l={}){let{document:e}=n,o=l.today??Pe,g=new Map(n.edges.map(([u,t])=>[u,t])),c=new Map;for(let[u,t]of Object.entries(e.kinds)){let R=n.kinds[u]?.computed;c.set(u,{fields:new Set(Object.keys(t.fields)),edges:new Map(Object.entries(t.edges??{}).map(([b,E])=>[b,E.cardinality??"many"])),...R?{computed:new Map(R)}:{}})}n.facts&&c.set(_e,{computed:new Map(n.facts)});let O=Ue(e),A=new Map,N=Object.entries(e.kinds).map(([u,t])=>{let R={};for(let[i,k]of Object.entries(t.fields))R[i]=en(k,!k.required);let{label:b,describe:E}=n.kinds[u]??{},F=Object.entries(t.computed??{}).map(([i,k])=>[i,typeof k=="string"?{expr:k}:k]),M=Object.fromEntries([...Object.entries(t.fields).filter(([,i])=>i.label).map(([i,k])=>[i,k.label]),...F.filter(([,i])=>i.label).map(([i,k])=>[i,k.label])]),I=Object.keys(M).length>0,C=Object.fromEntries(Object.entries(t.fields).filter(([,i])=>i.default!==void 0).map(([i,k])=>[i,k.default]));A.set(u,C);let j=Object.fromEntries(Object.entries(t.edges??{}).map(([i,{renamedFrom:k,...H}])=>[i,H])),p=i=>t[i]?{[i]:t[i]}:{};return Te(u,{fields:fe(R),edges:j,...p("plural"),...p("noun"),...p("description"),...b?{label:i=>te(b,{node:i,kinds:c,today:o(),money:O})||i.id}:{},...E?{describe:i=>te(E,{node:i,kinds:c,today:o(),money:O})}:{},...p("lifecycle"),...p("figure"),...p("fieldRoles"),...p("people"),...t.computed&&Object.keys(t.computed).length>0?{computed:t.computed}:{},...I||t.glance||t.page?{display:{...I?{labels:M}:{},...t.glance?{glance:[...t.glance]}:{},...t.page?{page:t.page}:{}}}:{},...Object.keys(C).length>0?{defaults:C}:{}})}),z=Ce(N,e.computed);function D(u){return z.tryDefinition(u.kind)?.label?.(u)??u.id}let V=u=>({id:"",kind:u,...A.get(u)}),$=[];for(let[u,t]of Object.entries(e.acts??{})){let R=n.acts[u],{title:b,effects:E,guard:F,refusal:M,destructive:I,idempotent:C,creates:j,connects:p,severs:i,writes:k,writesOther:H,sets:v}=R,J=new Map(R.args),K={};for(let[a,x]of J)K[a]=sn(x);let U=[t.on??[]].flat(),oe=new Map(R.exprs),G=E.find(a=>"create"in a),L=(a,x,y,h=null)=>{if(T(a)&&"expr"in a)return ne(oe.get(a.expr),{graph:y,subject:h,kinds:c,bindings:x,today:o()});let m=de(a);return m===void 0?typeof a=="string"&&a.startsWith("$$")?a.slice(1):a:m==="now"?new Date().toISOString():m==="today"?o():x[m]},nn=(a,x)=>{if(!G)return"";let y=e.kinds[G.create].fields,h=V(G.create),m=[];for(let[w,X]of Object.entries(G.set??{})){try{h[w]=L(X,a,x)??h[w]}catch{}let Y=de(X);Y&&a[Y]!==void 0&&m.push(w)}let P=D(h).trim(),q=m.filter(w=>h[w]!==!1&&y[w].type!=="text"&&!(/[^]{41}/.test(h[w])||/ .*[.!?]$/.test(h[w])&&!/[ .][A-Z]\w{0,3}\.$/.test(h[w]))&&D({...h,[w]:void 0}).trim()===P).map(w=>h[w]===!0?y[w].label??Ne(w):Je(h[w],y[w].format,o(),[],O));return P&&q.length>0?`${P} (${q.join(", ")})`:P};$.push(Le(u,{input:fe(K),title:b,...t.description?{description:t.description}:{},...t.fromTheOtherEnd?{fromTheOtherEnd:t.fromTheOtherEnd}:{},...J.has(_)?{subject:{kinds:U.length>0?U:"*",arg:_}}:{},...I?{destructive:!0}:{},...C?{idempotent:!0}:{},...j.length>0?{creates:j}:{},...p.length>0?{connects:p}:{},...i.length>0?{severs:i}:{},writes:k,...Object.keys(H).length>0?{writesOther:H}:{},...Object.keys(v).length>0?{sets:v}:{},describe:(a,x)=>{let y=typeof a[_]=="string"?x.getNode(a[_]):void 0,h=y?D(y):nn(a,x);return h?`${b}: ${h}`:b},apply(a,x){let y=a.graph,h=typeof x[_]=="string"?x[_]:void 0,m=h?y.getNode(h):void 0;if(h&&!m&&re(h),m&&U.length>0&&!U.includes(m.kind))throw new Z(`"${b}" acts on ${U.join(" or ")}, not on ${Fe(m.kind)}`,"invalid");let P={};for(let[r,s]of Object.entries(x))s!==void 0&&(P[r]=s);if(F&&m){let r;try{r=ne(F,{graph:y,subject:m,kinds:c,bindings:P,today:o()})}catch(s){throw s instanceof ae?new Z(`"${b}" could not be judged: ${s.sentence}`):s}if(r!==!0)throw new Z(M?te(M,{node:m,kinds:c,graph:y,bindings:P,today:o(),money:O}):`"${b}" is not allowed for ${D(m)} right now`)}let q=new Map,w=r=>y.has(r)||[...q.values()].includes(r),X=new Set,Y=r=>{let s=Ve(r);X.has(s)||(X.add(s),a.removeEdge(r))},Q=(r,s)=>{let d=de(r);if(d==="subject")return h;if(d==="me"){let f=a.me;if(f&&e.kinds[y.getNode(f)?.kind]?.people)return f;throw new Z(`"${b}" is done as you, and you have no record here`)}if(q.has(d))return q.get(d);try{return L(r,P,y,s??m??null)}catch(f){throw f instanceof ae?new Z(`"${b}" could not work out a value: ${f.sentence}`):f}};for(let r of E)if("create"in r){let s=e.kinds[r.create],d=V(r.create);for(let[le,ie]of Object.entries(r.set??{})){let ve=Q(ie,void 0);ve!==void 0&&(d[le]=ve)}let f=on(s),S=a.freshId(String((f&&d[f])??r.create),r.create);a.addNode({...d,id:S}),r.as&&q.set(r.as,S)}else if("connect"in r||"sever"in r){let s="connect"in r?r.connect:r.sever,d=String(Q(r.from,void 0)??""),f=String(Q(r.to,void 0)??"");if(w(d)||re(d),w(f)||re(f),"connect"in r){if(g.get(s)?.cardinality==="one")for(let S of y.out(d,s))S.id!==f&&Y({kind:s,from:d,to:S.id});y.out(d,s).some(S=>S.id===f)||a.addEdge({kind:s,from:d,to:f})}else Y({kind:s,from:d,to:f})}else if("set"in r){let s=String(Q(r.target??"$subject",void 0)??""),d=y.getNode(s);!d&&!w(s)&&re(s);let f={};for(let[S,le]of Object.entries(r.set)){let ie=Q(le,d);ie!==void 0&&(f[S]=ie)}Object.keys(f).length>0&&a.patchNode(s,f)}else if("remove"in r){let s=String(Q(r.remove,void 0)??"");y.has(s)||re(s),a.removeNode(s)}else if("replace"in r&&m){let s=x.to;for(let d of r.replace){let f=g.get(d)?.from.includes(m.kind)??!0;for(let S of f?y.out(m.id,d):y.in(m.id,d))d===r.keep&&S.id===s||Y(f?{kind:d,from:m.id,to:S.id}:{kind:d,from:S.id,to:m.id})}}}}))}let W=[];for(let[u,t]of Object.entries(e.rules??{})){let{title:R,require:b,when:E,says:F}=n.rules[u],M=t.repairs??[],I=(j,p)=>{let i={graph:j,subject:p,kinds:c,today:o()},k;try{if(E&&ne(E,i)!==!0)return[];k=ne(b,i)===!0}catch(v){throw v instanceof We?new Ie(v.sentence):v instanceof ae?new Error(v.sentence):v}if(k)return[];let H=M.flatMap(v=>{let J=e.acts?.[v.act],K={};p&&(J?.on||/^(edit|remove)-/.test(v.act))&&(K[_]=p.id);for(let[G,L]of Object.entries(v.args??{}))K[G]=de(L)==="subject"?p?.id:L;let oe=(J?n.acts[v.act].args:[]).filter(([G,L])=>L.required&&K[G]===void 0).map(([G])=>G);return[{mutation:v.act,label:v.label??J?.title??v.act.replace(/-/g," "),args:K,...oe.length>0?{missing:oe}:{}}]});return[{invariant:u,...p?{subjectId:p.id}:{},label:R,message:F?te(F,{node:p,kinds:c,graph:j,today:o(),money:O}):p?`${D(p)}: ${R}`:R,nodeIds:p?[p.id]:[],repairs:H}]},C={label:R,shape:{over:t.over,require:b,when:E,says:F,declared:e.kinds,money:O,kinds:c,today:o},judgment:{require:t.require,...t.when?{when:t.when}:{},...t.says?{says:t.says}:{}},...t.description?{description:t.description}:{},...M.length>0?{repairs:M.map(j=>j.act)}:{}};W.push(t.over==="graph"?ye(u,{scope:"graph",...C,evaluate:({graph:j})=>I(j,null)}):ye(u,{scope:{kind:t.over},...C,evaluate:({graph:j,subject:p})=>I(j,p)}))}let be=e.policy&&{...e.policy,...e.roles?{roles:e.roles}:{}},ce={name:e.name,schema:z,mutations:$,invariants:W,...be?{policy:be}:{},...n.brand?{brand:n.brand}:{},...e.modules?{modules:e.modules}:{},...e.lenses?{lenses:e.lenses}:{},...e.pages?{pages:e.pages}:{},...e.settings?{settings:e.settings}:{},...n.viewSpecs?{viewSpecs:n.viewSpecs}:{},...n.home?{home:n.home}:{},version:e.version??1};return Ye(ce,e),an.set(ce,n),{ok:!0,app:ce,document:e,findings:n.findings,sights:e.policy?.sees,kinds:c}}export{Qe as a,un as b,Xe as c,_ as d,de as e,on as f,zn as g,dn as h};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i}from"./chunk.HOPIZMJR.js";import"./chunk.46KUPBQC.js";import"./chunk.N2WTNKEV.js";import"./chunk.SBHVVJY7.js";import"./chunk.GE5EAN36.js";import"./chunk.337WDTG3.js";import"./chunk.MKNXV4TM.js";import"./chunk.AJZBJBMO.js";export{f as columnActs,c as columnMoves,b as columnOf,d as columnReach,e as columnSteps,h as describePlace,i as placeText,g as resolveFor,a as statusColumns};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as g}from"./chunk.6LJ66MB7.js";import{za as w}from"./chunk.NRRUGG22.js";import{Tb as L}from"./chunk.MKNXV4TM.js";import{a as C,b as V}from"./chunk.MRK6QJV5.js";import{b as u}from"./chunk.AJZBJBMO.js";var E="[data-graview-foot]",N="graview:foot-moved";var D=()=>({width:document.documentElement.clientWidth||innerWidth,height:innerHeight});function z(t,e){let o=D(),r=e?.getBoundingClientRect()??{left:0,top:0,right:o.width,bottom:o.height},i=Math.max(0,r.left),c=Math.min(o.width,r.right),s=Math.max(0,r.top),l=Math.min(o.height,r.bottom),m=Math.max(0,c-i),x=m<640;t.style.translate="none",t.style.top="auto",t.style.right="auto",t.style.maxWidth=`${Math.max(0,Math.min(560,m-2*16))}px`;let p=t.getBoundingClientRect();if(p.width===0&&p.height===0&&t.style.left!=="")return;let y=p.width,A=p.height;t.style.visibility=e&&l-s<A+16?"hidden":"";let h=x?i+(m-y)/2:i+16,f=o.height-l+16,v=[...document.querySelectorAll(E)].filter(n=>n!==t&&!t.contains(n)&&!n.contains(t)).map(n=>n.getBoundingClientRect()).filter(n=>n.width>0&&n.height>0&&n.right>i&&n.left<c&&n.bottom>s&&n.top<l),P=n=>n.bottom-n.top>(l-s)*.4;if(!x)for(let n of v)P(n)&&n.left<=h+1&&n.right+16>h&&n.right+16+y<=c&&(h=n.right+16);let R=v.filter(n=>!P(n));for(let n=!0,b=0;n&&b<R.length+1;b++){n=!1;for(let d of R){let M=o.height-f;d.right>h&&d.left<h+y&&d.bottom>M-A&&d.top<M&&(f=o.height-d.top+16/2,n=!0)}}t.style.left=`${Math.round(h)}px`,t.style.bottom=`calc(${Math.round(f)}px + env(safe-area-inset-bottom, 0px))`}function U(t,e){let o=D(),r=e?.getBoundingClientRect()??{left:0,top:0,right:o.width,bottom:o.height},i=Math.max(0,r.left),c=Math.min(o.width,r.right),s=Math.max(0,c-i);t.style.translate="none",t.style.bottom="auto",t.style.right="auto",t.style.maxWidth=`${Math.max(0,Math.min(560,s-2*16))}px`;let l=t.getBoundingClientRect().width;t.style.left=`${Math.round(i+(s-l)/2)}px`,t.style.top=`${Math.round(Math.max(16/2,r.top+16/2))}px`}var O=t=>`graview:lenses:${t}`,q=(t,e)=>t?.name??e.kinds.join(",");function k(t){try{let e=JSON.parse(localStorage.getItem(O(t))??"[]");return Array.isArray(e)?e.filter(o=>typeof o?.title=="string"&&typeof o.lens=="string"):[]}catch{return[]}}var S=u(C(),1);var a=u(V(),1),G=w(g(()=>import("./chunk.ARE3MEDN.js")));function B({lens:t,view:e}){let o=G.current.declaredLensView(t);return(0,a.jsx)(o,{...e})}var K=G.part((t,e)=>(0,a.jsx)(B,{...e}),{what:"This picture"});function $(t){return o=>(0,a.jsx)(S.Suspense,{fallback:null,children:(0,a.jsx)(K,{lens:t,view:o})})}var T=w(g(()=>import("./chunk.ASFZTYFO.js")));function W({blocks:t,view:e}){let o=T.current.homeView(t);return(0,a.jsx)(o,{...e})}var _=T.part((t,e)=>(0,a.jsx)(W,{...e}),{what:"The home"});function F(t){let e=o=>(0,a.jsx)(S.Suspense,{fallback:null,children:(0,a.jsx)(_,{blocks:t,view:o})});return Object.defineProperty(e,Symbol.for("graview.home-blocks"),{value:!0}),e}function tt(t,e){return e.home&&e.home.length>0&&t.home?.(F(e.home)),H(t,e),t.arrange?.(e.pages),t}function H(t,e,o){for(let r of L(e).drawn){if(o&&t.places().some(s=>s.title===r.title))continue;let i=$(r),c={title:r.title,...r.across?{across:r.across}:{},...o?{beside:o}:{}};for(let s of r.kinds)t.register(s,{cardinality:"many",fidelity:"full"},i,c),t.register(s,{cardinality:"many",fidelity:"summary"},i,c)}}function I(t,e,o){o.length>0&&H(t,{schema:e,lenses:o.map(({lens:r,...i})=>({...i,name:r}))},!0)}function et(t,e,o){I(t,e,k(o))}export{N as a,z as b,U as c,O as d,q as e,k as f,tt as g,I as h,et as i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as c,b as d,c as e,d as f,e as g,f as h,g as i}from"./chunk.2GBQJXJH.js";import{a,b}from"./chunk.ZJDRD6PO.js";import"./chunk.SNBIZ3B6.js";import"./chunk.6LJ66MB7.js";import"./chunk.NRRUGG22.js";import"./chunk.MKNXV4TM.js";import"./chunk.MRK6QJV5.js";import"./chunk.AJZBJBMO.js";export{c as ARRANGE_NARROW,h as ArrangeBar,i as arrangementCaption,a as arrangementOf,f as directionWords,e as inSentence,g as preloadArrangeLists,d as sayCondition,b as withArrangement};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as ae}from"./chunk.WHTNSETN.js";import"./chunk.WVUJXDXZ.js";import{b as $,c as ne}from"./chunk.46KUPBQC.js";import"./chunk.N2WTNKEV.js";import"./chunk.SBHVVJY7.js";import"./chunk.GE5EAN36.js";import"./chunk.337WDTG3.js";import"./chunk.6R4EI47C.js";import{Y as X,da as ee,ga as te}from"./chunk.NRRUGG22.js";import{Gb as Y,I as J,J as v,K as j,Z as Q}from"./chunk.MKNXV4TM.js";import{a as we,b as Z}from"./chunk.MRK6QJV5.js";import{b as B}from"./chunk.AJZBJBMO.js";var g=B(we(),1);async function re(e,i){let r=await createImageBitmap(e);try{let l=Math.min(1,i/Math.max(r.width,r.height)),o=document.createElement("canvas");o.width=Math.max(1,Math.round(r.width*l)),o.height=Math.max(1,Math.round(r.height*l));let s=o.getContext("2d");if(s===null)throw new Error("This browser will not give us a canvas to resize with.");return s.drawImage(r,0,0,o.width,o.height),o}finally{r.close()}}var t=B(Z(),1),ve=2048,$e=.85;function H(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function O(e){if(e.type==="application/pdf")return"PDF";let i=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return i?i.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ue(e){let i=[...new Set(e.map(r=>r==="image/*"?"pictures":r==="*/*"||r==="*"?"any file":`${O({type:r})} files`))];return i.length<=1?i[0]??"no files":`${i.slice(0,-1).join(", ")} and ${i[i.length-1]}`}function ce(e,i){if(e.length===0)return!0;let r=`${i.split("/")[0]}/*`;return e.some(l=>l==="*"||l==="*/*"||l===i||l===r)}var ie=/^image\/hei[cf]$|\.hei[cf]$/i,le=e=>ie.test(e.type)||ie.test(e.name);async function Fe(e,i,r){let l=e.name||(r.camera?"photo.jpg":"file"),o=e.type||(le({type:"",name:l})?"image/heic":"application/octet-stream"),s=le({type:o,name:l}),d=o.startsWith("image/")||s;if(r.image&&!d)return{refused:`\u201C${l}\u201D isn\u2019t a picture.`};if(s||d&&/^image\/(jpeg|webp)$/.test(o)&&(r.camera||e.size>i.maxBytes||e.size>15e5))try{let a=await re(e,ve),f=await new Promise(y=>a.toBlob(y,"image/jpeg",$e));if(f)return oe({blob:f,name:s?l.replace(/\.hei[cf]$/i,"")+".jpg":l,type:"image/jpeg",width:a.width,height:a.height},i)}catch{if(s&&!ce(i.kinds,o))return{refused:`\u201C${l}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let c={};if(d&&!s)try{let a=await createImageBitmap(e);c={width:a.width,height:a.height},a.close()}catch{}return oe({blob:e,name:l,type:o,...c},i)}function oe(e,i){return ce(i.kinds,e.type)?e.blob.size>i.maxBytes?{refused:`\u201C${e.name}\u201D is ${H(e.blob.size)}; this host takes files up to ${H(i.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${O(e)} file; this host takes ${ue(i.kinds)}.`}}async function ke(e,i,r){let l;try{l=await i.upload(e.blob,e.name)}catch(s){let d=s instanceof Error&&s.message.trim()?s.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${d}`}}return J(l)?r&&!v(l)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:{...l,...l.width===void 0&&e.width?{width:e.width}:{},...l.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var F="var(--graview-radius, 8px)",S={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function _({file:e,size:i=56,style:r}){return(0,t.jsx)("img",{src:e.href,alt:$(e),width:i,height:i,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:i,height:i,objectFit:"cover",borderRadius:F,display:"block",flex:"none",background:"var(--graview-edge)",...r}})}function N({files:e,label:i}){let r=e.filter(v),l=e.filter(a=>!v(a)),[o,s]=(0,g.useState)(null),d=(0,g.useRef)(null),m=(0,g.useRef)(null);(0,g.useEffect)(()=>{let a=d.current;o!==null&&a&&!a.open&&a.showModal?.()},[o]);let c=o===null?void 0:r[o];return(0,t.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[r.length>0?(0,t.jsx)("ul",{"data-graview-gallery":"","aria-label":i,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:r.map((a,f)=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)("button",{type:"button","aria-label":`Open ${$(a)} full size`,onClick:y=>{m.current=y.currentTarget,s(f)},style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:F},children:(0,t.jsx)("img",{src:a.href,alt:$(a),loading:"lazy",decoding:"async",style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:F,display:"block",background:"var(--graview-edge)"}})})},a.href))}):null,l.length>0?(0,t.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:l.map(a=>(0,t.jsxs)("li",{"data-graview-document":a.type,style:{display:"grid",gap:6,minWidth:0},children:[a.type==="application/pdf"?(0,t.jsx)("object",{data:a.href,type:"application/pdf","aria-label":$(a),style:{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:F},children:(0,t.jsxs)("p",{style:{margin:0,padding:12},children:["This browser shows no PDF here: ",(0,t.jsxs)("a",{href:a.href,download:a.name,children:["download ",a.name]}),"."]})}):null,(0,t.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,t.jsx)("a",{href:a.href,download:a.name,...a.type==="application/pdf"?{target:"_blank",rel:"noopener"}:{},children:a.name}),(0,t.jsxs)("span",{style:S,children:[O(a)," \xB7 ",H(a.bytes)]})]}),a.caption?(0,t.jsx)("span",{style:S,children:a.caption}):null]},a.href))}):null,c?(0,t.jsx)("dialog",{ref:d,"data-graview-full":c.href,"aria-label":$(c),onClose:()=>{s(null),m.current?.focus()},onClick:a=>{a.target===a.currentTarget&&a.currentTarget.close()},style:{padding:0,border:0,borderRadius:F,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,t.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,t.jsx)("img",{src:c.href,alt:$(c),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,t.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:c.caption??c.name}),(0,t.jsx)("form",{method:"dialog",style:{margin:0},children:(0,t.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function ge({value:e,onChange:i,several:r,image:l,label:o,thumbs:s=!0}){let d=X(),m=(0,g.useId)(),c=(0,g.useRef)(null),a=(0,g.useRef)(null),[f,y]=(0,g.useState)(null),[k,D]=(0,g.useState)(null),[U,E]=(0,g.useState)([]),[I,L]=(0,g.useState)(!1),C=d?l?d.kinds.filter(n=>n.startsWith("image/")||n==="*"||n==="*/*"):d.kinds:[],A=d?d.kinds.length===0||C.some(n=>n.startsWith("image/")||n.startsWith("*")):!1,P=!!d&&(!l||A),G=l?r?"pictures":"a picture":r?"files":"a file",q=l?C.length>0?C.join(","):"image/*":d?.kinds.join(",")||void 0,me=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,V=(0,g.useRef)(e);V.current=e;let K=(0,g.useRef)(null),W=(0,g.useRef)(null);(0,g.useEffect)(()=>{let n=W.current;if(!n||n.from===e)return;W.current=null;let u=K.current?.children,h=u?.[Math.min(n.at,u.length-1)];((n.what==="move"?h?.querySelector("[data-graview-file-move]"):null)??h?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let T=async(n,u)=>{if(!d||n.length===0)return;let h=r?n:n.slice(0,1),p=[],w=[];h.length<n.length&&w.push(`${o} holds one ${l?"picture":"file"}, so ${n.slice(1).map(b=>`\u201C${b.name||"the photo"}\u201D`).join(", ")} ${n.length>2?"were":"was"} left out.`),E([]),D(null);for(let b of h){y(`Sending ${b.name||"the photo"}\u2026`);let z=await Fe(b,d,{image:l,camera:u==="camera"});if("refused"in z){w.push(z.refused);continue}let x=await ke(z,d,l);"refused"in x?w.push(x.refused):[...r?V.current:[],...p].some(be=>be.href===x.href)?w.push(`\u201C${x.name}\u201D is already here.`):p.push(x)}if(y(null),E(w),p.length!==0)try{i(r?[...V.current,...p]:p.slice(-1)),D(`Added ${p.map(b=>b.name).join(", ")}.`)}catch(b){E([...w,b instanceof Error?b.message:String(b)])}},R=(n,u,h)=>{try{W.current=h?{...h,from:e}:null,i(n),D(u)}catch(p){W.current=null,E([p instanceof Error?p.message:String(p)])}},M=n=>n?Array.from(n):[],ye=n=>{let u=M(n.clipboardData?.files);!P||u.length===0||(n.preventDefault(),T(u,"pasted"))},fe=n=>{L(!1),P&&(n.preventDefault(),T(M(n.dataTransfer?.files),"dropped"))};return(0,t.jsxs)("div",{role:"group","aria-labelledby":`${m}-label`,"data-graview-file-editor":"","data-graview-dropping":I?"":void 0,onPaste:ye,onDragOver:n=>{P&&(n.preventDefault(),L(!0))},onDragLeave:()=>L(!1),onDrop:fe,style:{display:"grid",gap:8,minWidth:0,padding:I?6:0,outline:I?"2px dashed var(--graview-accent)":"none",borderRadius:F},children:[(0,t.jsx)("span",{id:`${m}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:o}),e.length>0&&(r||e.length>1)?(0,t.jsx)("ul",{ref:K,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((n,u)=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[s&&v(n)?(0,t.jsx)(_,{file:n,size:40}):null,(0,t.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:n.name}),(0,t.jsx)(de,{file:n,onCaption:h=>R(e.map((p,w)=>w===u?se(p,h):p),h?`${n.name} now says \u201C${h}\u201D.`:`${n.name} says its name again.`)}),r&&u>0?(0,t.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${n.name} earlier`,onClick:()=>R(e.map((h,p)=>p===u-1?n:p===u?e[u-1]:h),`Moved ${n.name} earlier.`,{at:u-1,what:"move"}),children:"\u2191"}):null,r?(0,t.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${n.name}`,onClick:()=>R(e.filter((h,p)=>p!==u),`Removed ${n.name}.`,{at:u,what:"remove"}),children:"Remove"}):null]},`${u}:${n.href}`))}):e.length===1?(0,t.jsx)(de,{file:e[0],onCaption:n=>R([se(e[0],n)],n?`${e[0].name} now says \u201C${n}\u201D.`:`${e[0].name} says its name again.`)}):null,P?(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:r,...q?{accept:q}:{},"data-graview-file-input":"","aria-label":`Choose ${G}`,onChange:n=>{let u=M(n.currentTarget.files);n.currentTarget.value="",T(u,"picked")}}),(0,t.jsx)("button",{type:"button",disabled:f!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!r?`Replace ${l?"the picture":"the file"}`:`Choose ${G}`}),A?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:a,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:n=>{let u=M(n.currentTarget.files);n.currentTarget.value="",T(u,"camera")}}),me?(0,t.jsx)("button",{type:"button",disabled:f!==null,onClick:()=>a.current?.click(),children:"Take a photo"}):null]}):null,(0,t.jsxs)("span",{style:S,"data-graview-file-takes":"",children:["or drop or paste ",r?"them":"it"," here \xB7 ",d.kinds.length>0?ue(C.length>0?C:d.kinds):"any file",", up to ",H(d.maxBytes)]})]}):(0,t.jsx)("p",{style:{...S,margin:0},"data-graview-file-none":"",children:d?"This host doesn\u2019t take pictures, so none can be added here.":"This host doesn\u2019t take files, so none can be added here."}),(0,t.jsx)("p",{"aria-live":"polite",style:{...S,margin:0,minHeight:f||k?void 0:0},"data-graview-file-status":"",children:f??k??""}),U.length>0?(0,t.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:U.map((n,u)=>(0,t.jsx)("p",{style:{margin:0},children:n},u))}):null]})}var se=(e,i)=>{let{caption:r,...l}=e;return i?{...l,caption:i}:l};function de({file:e,onCaption:i}){let[r,l]=(0,g.useState)(e.caption??"");(0,g.useEffect)(()=>l(e.caption??""),[e.caption]);let o=()=>{let s=r.trim().slice(0,500);s!==(e.caption??"")&&i(s)};return(0,t.jsx)("input",{type:"text",value:r,placeholder:v(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${v(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:s=>l(s.target.value),onBlur:o,onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),o())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function pe({field:e,label:i,labelStyle:r,valueStyle:l,style:o,children:s}){return(0,t.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...o},children:[(0,t.jsx)("dt",{style:r,children:i}),(0,t.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...l},children:s})]})}function he(e){let{nodeId:i,field:r,label:l,files:o}=e,{fields:s,commit:d}=ae(i),m=s.find(y=>y.field===r&&y.takesValue),c=m?.shape,a=c?.type==="several"?c.of:c,f=c?.type==="several";return o.length===0&&a?.type!=="file"?null:(0,t.jsxs)(pe,{...e,children:[(0,t.jsx)(N,{files:o,label:l}),m&&a?.type==="file"?(0,t.jsx)(ge,{value:o,thumbs:!1,several:f,image:a.image===!0,label:l,onChange:y=>{let k=f?y:y[y.length-1];k!==void 0&&d(m,k)}}):null]})}function Re(e){switch(e.as){case"field":return e.read?e.files.length>0?(0,t.jsx)(pe,{...e,children:(0,t.jsx)(N,{files:e.files,label:e.label})}):null:(0,t.jsx)(he,{...e});case"unfilled":return(0,t.jsx)(Ce,{...e});case"thumb":return(0,t.jsx)(_,{...e});case"block":return e.files.length>0?(0,t.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:Y.raised}:{}},children:e.view==="thumb"?(0,t.jsx)(_,{file:e.files[0],size:72}):(0,t.jsx)(N,{files:e.files,label:e.label})}):null;case"control":{let i=(0,t.jsx)(ge,{value:j(e.value),several:e.several,image:e.image,label:e.label,onChange:r=>e.onChange(e.several?r:r[r.length-1])});return e.title===void 0?i:(0,t.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,t.jsx)("legend",{"data-graview-part":"label",children:e.title}),i]})}}}function Ce({nodeId:e,skip:i,labels:r,labelStyle:l,style:o}){let{store:s}=ee(),d=te(e),m=d?s.schema.tryDefinition(d.kind):void 0,c=ne(m).filter(a=>!i.includes(a)&&!(m?.display?.hide??[]).includes(a)&&j(d?.[a]).length===0);return c.length===0?null:(0,t.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:c.map(a=>(0,t.jsx)(he,{nodeId:e,field:a,label:r?.[a]??Q(m,a),files:[],...l?{labelStyle:l}:{},...o?{style:o}:{}},a))})}export{ge as FilesEditor,ve as SEND_EDGE,Re as drawFiles,ue as kindsWords,Fe as prepare,ke as send,H as sizeWords,ce as takes,O as typeWords};
|