graview 0.1.27 → 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.5BN2ARQ2.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.HPD3DSTP.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.IXVSJJQH.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.OA5BVKJH.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.4HGBVU5B.js +0 -1
- package/dist/preview/chunk.4JXWQO6Y.js +0 -1
- package/dist/preview/chunk.4R7LDCDO.js +0 -1
- package/dist/preview/chunk.4W24TPMR.js +0 -1
- package/dist/preview/chunk.6LJ66MB7.js +0 -1
- package/dist/preview/chunk.6R4EI47C.js +0 -1
- package/dist/preview/chunk.7CO6VP6F.js +0 -1
- package/dist/preview/chunk.7QTBDACG.js +0 -1
- package/dist/preview/chunk.7SVIRYBB.js +0 -1
- package/dist/preview/chunk.7THQFY52.js +0 -1
- package/dist/preview/chunk.AHDOKM4O.js +0 -1
- package/dist/preview/chunk.AS35X6KA.js +0 -1
- package/dist/preview/chunk.ATLUMYAJ.js +0 -23
- package/dist/preview/chunk.CW7BMVBG.js +0 -321
- package/dist/preview/chunk.DG2UE7PJ.js +0 -1
- package/dist/preview/chunk.DG2WKNMX.js +0 -1
- package/dist/preview/chunk.DQ5OWYLQ.js +0 -1
- package/dist/preview/chunk.DY2FFBWF.js +0 -1
- package/dist/preview/chunk.E3SZ7T75.js +0 -1
- package/dist/preview/chunk.EVTZE2OZ.js +0 -1
- package/dist/preview/chunk.FS5K4AVA.js +0 -8
- package/dist/preview/chunk.FTBKJ5RZ.js +0 -16
- package/dist/preview/chunk.GHMICJIB.js +0 -1
- package/dist/preview/chunk.HO6JR7VY.js +0 -1
- package/dist/preview/chunk.I5KD54S6.js +0 -1
- package/dist/preview/chunk.IZDKEFPJ.js +0 -1
- package/dist/preview/chunk.J36GTQTV.js +0 -1
- package/dist/preview/chunk.KAKX5TZN.js +0 -3
- package/dist/preview/chunk.LHAAZQNQ.js +0 -19
- package/dist/preview/chunk.LQZ2VQWN.js +0 -107
- package/dist/preview/chunk.MHJJEGQO.js +0 -1
- package/dist/preview/chunk.MNPNW4BQ.js +0 -1
- package/dist/preview/chunk.MRK6QJV5.js +0 -25
- package/dist/preview/chunk.NKIFVPS3.js +0 -1
- package/dist/preview/chunk.NQNQPPPM.js +0 -1
- package/dist/preview/chunk.OHGJ5BZ4.js +0 -2
- package/dist/preview/chunk.OYULDOQP.js +0 -1
- package/dist/preview/chunk.PHY3AH3L.js +0 -1
- package/dist/preview/chunk.Q7544RCB.js +0 -1
- package/dist/preview/chunk.QZWN46V6.js +0 -1
- package/dist/preview/chunk.RUC4HFVC.js +0 -1
- package/dist/preview/chunk.S5JWZIVE.js +0 -1
- package/dist/preview/chunk.SHDYLMZE.js +0 -2
- package/dist/preview/chunk.T2EZ5MTH.js +0 -1
- package/dist/preview/chunk.TMPV4HLQ.js +0 -1
- package/dist/preview/chunk.TX2GOL65.js +0 -29
- package/dist/preview/chunk.U5ZUXGWM.js +0 -1040
- package/dist/preview/chunk.UMMN5Z6V.js +0 -1
- package/dist/preview/chunk.UPGDSOBY.js +0 -1
- package/dist/preview/chunk.V57P4LIZ.js +0 -1
- package/dist/preview/chunk.VD6FJ6KJ.js +0 -2
- package/dist/preview/chunk.VFICMX5G.js +0 -61
- package/dist/preview/chunk.VMD4PDYJ.js +0 -1
- package/dist/preview/chunk.VMEX2KZ4.js +0 -8
- package/dist/preview/chunk.XDHBV5K5.js +0 -1
- package/dist/preview/chunk.YO7UFBJP.js +0 -1
- package/dist/preview/chunk.YSYT3ASK.js +0 -1
- package/dist/preview/chunk.YV2RTNPU.js +0 -6
- package/dist/preview/chunk.ZD5HGRPR.js +0 -1
- package/dist/preview/chunk.ZKM4P7US.js +0 -1
- package/dist/preview/chunk.ZMMMKTAG.js +0 -1
- package/dist/preview/chunk.ZNIJONZN.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$b as Yt,Gb as zt,Jb as qt,Kb as Ut,Mb as $t,Ua as Gt,Ya as Kt,Za as Bt,ba as Ft,ec as Se,fc as Ke,mb as jt}from"./chunk.VMEX2KZ4.js";import{a as F,b as ve}from"./chunk.MRK6QJV5.js";import{b as C}from"./chunk.AJZBJBMO.js";var te={focusId:null,relation:null,expanded:[],pins:{}},be=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function U(e){let t=new URLSearchParams;e.focusId&&t.set("focus",e.focusId),e.relation&&t.set("relation",e.relation),e.overview&&t.set("overview","1"),e.zoom&&t.set("zoom","1"),e.past&&t.set("past","1"),e.shown&&e.shown.length>0&&t.set("show",[...e.shown].sort().join(",")),e.selection!==void 0&&e.selection.length>0&&t.set("sel",[...e.selection].sort().join(",")),e.expanded.length>0&&t.set("expand",[...e.expanded].sort().join(","));for(let o of Object.keys(e.pins).sort()){let r=e.pins[o];t.set(`pin.${o}`,`${xe(r.x)},${xe(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${xe(e.pan.x)},${xe(e.pan.y)}`);for(let o of Object.keys(e.within??{}).sort()){let r=e.within[o];r.length>0&&t.set(`in.${o}`,r)}e.q&&e.q.trim().length>0&&t.set("q",e.q);let n=t.toString();return n?`#${n}`:"#"}function $n(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function Ee(e){let t=e.includes("#")?e.slice(e.indexOf("#")+1):e,n=new URLSearchParams(t),o=Object.create(null);for(let[g,p]of n){if(!g.startsWith("pin."))continue;let[m,S]=p.split(","),k=m===void 0?null:be(m),h=S===void 0?null:be(S);k===null||h===null||(o[g.slice(4)]={x:k,y:h})}let r=Object.create(null);for(let[g,p]of n)!g.startsWith("in.")||p.length===0||(r[g.slice(3)]=p);let i=n.get("view");i&&i.length>0&&r.view===void 0&&(r.view=i);let a=n.get("pan")?.split(",")??[],u=a[0]===void 0?null:be(a[0]),l=a[1]===void 0?null:be(a[1]),c=(n.get("sel")??"").split(",").filter(g=>g.length>0).sort(),f=n.get("overview")==="1";return{...c.length>0?{selection:c}:{},...f?{overview:!0}:{},...n.get("zoom")==="1"?{zoom:!0}:{},...n.get("past")==="1"?{past:!0}:{},...n.get("show")?{shown:[...new Set(n.get("show").split(",").filter(Boolean))].sort()}:{},...u!==null&&l!==null?{pan:{x:u,y:l}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:$n(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(g=>g.length>0&&(f||!g.startsWith("kind:"))).sort(),pins:o}}function rr(e){let t=Ee(e);return U(t)==="#"?{...t,overview:!0}:t}function ir(e){let t=U(e);return t==="#overview=1"?"":t}function xe(e){return Math.round(e*100)/100}function Qt(e,t){return U(e)===U(t)}var Be="edge:";function ar(e,t,n){let o=r=>encodeURIComponent(r);return`${Be}${o(e)}:${o(t)}:${o(n)}`}function Xt(e){if(!e.startsWith(Be))return null;let t=e.slice(Be.length).split(":");if(t.length!==3)return null;let[n,o,r]=t;if(!n||!o||!r)return null;try{return{kind:decodeURIComponent(n),from:decodeURIComponent(o),to:decodeURIComponent(r)}}catch{return null}}function Re(e){let{pan:t,...n}=e;return{...n,pins:{}}}function $(e,t){if(t===e.focusId)return{...e,focusId:t};let n=Re(e);return{...n.within?.q!==void 0?ge(n,"q",null):n,focusId:t}}function Jt(e,t){return{...e,relation:t}}function ge(e,t,n){let o={...e.within??{}};if(n===null?delete o[t]:o[t]=n,Object.keys(o).length===0){let{within:r,...i}=e;return i}return{...e,within:o}}function je(e,t){if(t!==e.overview&&(e=Re(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function sr(e,t,n){let o=new Set(e.shown??[]);if(n?o.add(t):o.delete(t),o.size===0){let{shown:r,...i}=e;return i}return{...e,shown:[...o].sort()}}function Yn(e,t){if(t===null||t.trim().length===0){let{q:n,...o}=e;return o}return{...e,q:t}}function lr(e){let t=e.q!==void 0&&e.within?.q===e.q;return Yn(t?ge(e,"q",null):e,null)}function dr(e,t){if(!t){let{past:n,...o}=e;return o}return{...e,past:!0}}function Pe(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function me(e,t){if(t!==(e.zoom===!0)&&(e=Re(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function Me(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}function cr(e,t){if(t===null||t.x===0&&t.y===0){let{pan:n,...o}=e;return o}return{...e,pan:t}}function ur(e){return Re(e)}function pr(e,t,n){let o={...e.pins};return n===null?delete o[t]:o[t]=n,{...e,pins:o}}var ke="aggregate:",Ae="kind:";function ze(e){return`${Ae}${e}`}function ne(e){return e.startsWith(Ae)?e.slice(Ae.length):null}var gr="kinds:beyond";function Qn(e){let t=ne(e);return t?[t]:X(e)}function oe(...e){return`${ke}${[...e].sort().join("+")}`}function Zt(e){return e.startsWith(ke)}function X(e){return!Zt(e)||e.includes("|")?[]:e.slice(ke.length).split("+").filter(Boolean)}function en(e,t,n={}){let o=ne(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return Me(e,t);let r=o!==null?oe(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return me(e,!1);if(o!==null&&n.carry){let i=je({...$(e,r),relation:null},!1);return ge(me(i,!0),"q",n.carry)}return me({...$(e,r),relation:null},!0)}function Xn(e,t,n){return ge(je($(e,oe(t)),!1),"view",n)}function mr(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var tn="aggregate:";function qe(e){return e.startsWith(tn)&&e.includes("|")}function Jn(e,t){let n=0,o=138;for(let r of e.split(" ")){let i=t(r),a=o+t(" ")+i;if(a<=138)o=a;else{let u=Math.ceil(i/138)||1;n+=u,o=i-(u-1)*138}}return n}var Zn=16.25,Ue=27,eo=(e,t)=>{let n=Math.ceil(e.length*7.1/138);return t?Math.max(Ue,Math.ceil(Math.max(n,Jn(e,t))*Zn)+6):Math.max(Ue,n*16+6)};function to(e,t,n){return e.length===0?0:10+e.reduce((o,r)=>o+eo(r,n),0)+(e.length-1)*2}var nn=27,on=8,no=4,rn=64,oo=e=>Math.max(1,Math.min(on,e)),ro=e=>e*nn+rn;var io=(e,t)=>e.length*t*.58;var $e=C(F(),1),ao={turns:[],outcomes:new Map,busy:!1,open:!1,side:"left",pending:null,drawn:0,draft:null,draftNote:null},an=e=>`graview:seat:${e}`;function so(e){if(!e)return{};try{let t=sessionStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return{...Array.isArray(n.turns)?{turns:n.turns}:{},...Array.isArray(n.outcomes)?{outcomes:new Map(n.outcomes)}:{},...typeof n.open=="boolean"?{open:n.open}:{},...n.side==="left"||n.side==="right"?{side:n.side}:{},...n.draft?.drawn?{draft:n.draft}:{}}}catch{return{}}}function lo(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],open:t.open,side:t.side,draft:t.draft}))}catch{}}function Ye(e){let t=e===null?null:an(e),n={...ao,...so(t)},o=new Set,r=(i,a=!0)=>{n=i,a&&lo(t,n);for(let u of[...o])u()};return{get:()=>n,subscribe(i){return o.add(i),()=>void o.delete(i)},setTurns:i=>r({...n,turns:i(n.turns)}),settle:(i,a)=>r({...n,outcomes:new Map(n.outcomes).set(i,a)}),setBusy:i=>r({...n,busy:i},!1),setOpen:i=>{n.open!==i&&r({...n,open:i})},setSide:i=>{n.side!==i&&r({...n,side:i})},ask:i=>r({...n,open:!0,pending:i.trim()||null}),takePending(){let i=n.pending;return i!==null&&r({...n,pending:null},!1),i},drawn(){return r({...n,drawn:n.drawn+1},!1),()=>r({...n,drawn:Math.max(0,n.drawn-1)},!1)},setDraft:(i,a=null)=>r({...n,draft:i,draftNote:a})}}function co(e){let t=()=>e.get().drawn>0;return(0,$e.useSyncExternalStore)(e.subscribe,t,t)}function uo(e){return(0,$e.useSyncExternalStore)(e.subscribe,e.get,e.get)}var Te=C(F(),1),Oe=(0,Te.createContext)(void 0),po=()=>(0,Te.useContext)(Oe);var Qe={};var fo="I can answer about what's in this app. Open questions need AI, which isn't on here.",yo="Answered with AI";var sn=e=>`graview:setting:${e}`;function ln(){return localStorage}function dn(e,t){try{let n=(t??ln()).getItem(sn(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function cn(e,t,n){try{(n??ln()).setItem(sn(e.name),t)}catch{}}function un(e,t){if(typeof document>"u")return;let n=document.documentElement;if(e.honored==="root-font-size"){n.style.fontSize=t===e.initial?"":t;return}let o=`graview${e.name.replace(/-([a-z0-9])/g,(r,i)=>i.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}`;t===e.initial?delete n.dataset[o]:n.dataset[o]=t}var O=C(F(),1);function pn(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}function Xe(e){return Se(e)}var go=12,mo=4;function ho(e,t,n){let o=Xe(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var Ve=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-go);function fn(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=mo)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?ze([...o][0]):n[0]}function Je(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[a,u]of e)u.mode!=="asking"&&u.mode!=="docked"&&t.at-u.since>=t.holdMs&&o.set(a,{...u,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=ho(e,t.author,t.at),i=a=>o.set(r.participant,{...r,...a,since:t.at});switch(t.type){case"read":{let a=fn(t.ids,n);return i({at:a,mode:"reading",trail:Ve(r.trail,a)}),o}case"about-to-write":case"write":{let a=fn(t.ids,n);return i({at:a,mode:"writing",trail:Ve(r.trail,a),say:void 0,confidence:void 0}),o}case"refused":return i({at:t.where,mode:"refused",say:t.say,confidence:void 0,trail:Ve(r.trail,t.where)}),o;case"asking":return i({at:t.where??r.at,mode:"asking",say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},trail:Ve(r.trail,t.where)}),o;case"said":return i({say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},...t.caption?{caption:t.caption}:{}}),o;case"over":return i({over:t.over}),o;case"home":return i({at:null,mode:"docked",trail:[],say:void 0,confidence:void 0,over:null}),o;default:return o}}var yn="graview:session";function gn(e){let t=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);try{let n=e??sessionStorage,o=n.getItem(yn);if(o)return o;let r=t();return n.setItem(yn,r),r}catch{return t()}}var Ze={name:"share-where",title:"Where you are",description:"Whether the others here see which stop you are on.",honored:"root-attribute",options:[{value:"shared",label:"Shown"},{value:"private",label:"Hidden"}],initial:"shared"},et={name:"share-over",title:"What you point at",description:"Whether the others see the thing under your pointer, outlined in your color.",honored:"root-attribute",options:[{value:"private",label:"Kept to yourself"},{value:"shared",label:"Outlined for others"}],initial:"private"},mn=[Ze,et],So=800;function hn(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:a,seatWho:u,settingValues:l,setView:c,ttlMs:f=1e4,people:g,seats:p}=e,[m,S]=(0,O.useState)(()=>new Map),[k,h]=(0,O.useState)(null),[v,w]=(0,O.useState)(null),[x,R]=(0,O.useState)(null),N=typeof r.id=="string"&&r.id.length>0,V=N&&(l[Ze.name]??Ze.initial)==="shared",W=V&&(l[et.name]??et.initial)==="shared",M=Xe({kind:r.kind,...r.id?{id:r.id}:{},session:i}),b=N?Ft(r,{graph:n.graph,schema:n.schema,...p?{seats:p}:{},...g?{people:g}:{}}):"",A=u?a.get(`agent:${u}:${i}`):void 0,L=(0,O.useMemo)(()=>!t||!V?null:{participant:M,kind:r.kind,name:b,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:jt(r.id??"nobody"),stop:x??U(o),...W?{over:k}:{},...A?{robot:{at:A.at,mode:A.mode}}:{},at:new Date().toISOString()},[t,V,W,M,b,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,x,k,A?.at,A?.mode]);(0,O.useEffect)(()=>{if(!t||!L)return;t.here(L);let T=setInterval(()=>t.here({...L,at:new Date().toISOString()}),So);return()=>clearInterval(T)},[t,L]),(0,O.useEffect)(()=>t?t.onWho(D=>S(Ke(new Map,D,Date.now(),f))):void 0,[t,f]);let we=m.size>0;(0,O.useEffect)(()=>{if(!we)return;let T=setInterval(()=>{S(D=>{let K=Ke(D,[],Date.now(),f);return K.size===D.size?D:K})},Math.max(250,Math.min(1e3,f/4)));return()=>clearInterval(T)},[we,f]),(0,O.useEffect)(()=>{if(!t||typeof window>"u")return;let T=()=>t.leave();return window.addEventListener("pagehide",T),()=>window.removeEventListener("pagehide",T)},[t]),(0,O.useEffect)(()=>{if(!W||typeof document>"u")return;let T=null,D=K=>{let Z=pn(K.target);Z!==T&&(T=Z,h(Z))};return document.addEventListener("pointermove",D,{passive:!0}),()=>document.removeEventListener("pointermove",D)},[W]);let Q=(0,O.useRef)(null),H=v?m.get(v)??null:null,J=(0,O.useCallback)(T=>{Q.current=null,w(T)},[]);return(0,O.useEffect)(()=>{if(v){if(!H){w(null);return}H.stop!==Q.current?.stop&&(Q.current={stop:H.stop,at:Date.now()},c(Ee(H.stop)))}},[v,H,c]),(0,O.useEffect)(()=>{let T=Q.current;!v||T===null||Date.now()-T.at<400||Qt(o,Ee(T.stop))||w(null)},[o,v]),(0,O.useEffect)(()=>{if(!v||typeof document>"u")return;let T=D=>{D.key==="Escape"&&w(null)};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[v]),(0,O.useMemo)(()=>({who:m,sharing:L?{participant:M,name:b}:null,following:H,follow:J,sayWhere:R}),[m,L,M,b,H,J])}var B=C(F(),1);function wn(e){return Se(e.author)}function vo(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function Sn(e,t,n,o,r){let i=new Map;for(let[l,c]of e)o-c.at<r&&i.set(l,c);let a=new Set(n.flatMap(l=>l.nodeIds)),u=(l,c,f)=>{let g=i.get(l),p=g?.participants.includes(wn(c))?g.participants:[...g?.participants??[],wn(c)];i.set(l,{at:o,manner:vo(p,c.author.kind),intent:c.intent,wrote:(g?.wrote??!1)||(f.wrote??!1),read:(g?.read??!1)||(f.read??!1),broke:(g?.broke??!1)||a.has(l),participants:p})};for(let l of t){for(let c of l.writes)u(c,l,{wrote:!0});for(let c of l.reads)l.writes.includes(c)||u(c,l,{read:!0})}for(let l of n)for(let c of l.nodeIds){let f=i.get(c);i.set(c,{at:o,manner:f?.manner??"rule",intent:f?.intent??l.message,wrote:f?.wrote??!1,read:f?.read??!1,broke:!0,participants:f?.participants??["rule::"]})}return i}var bo=2600;function vn(e,t=bo){let[n,o]=(0,B.useState)(()=>new Map),r=(0,B.useRef)(n);r.current=n;let i=(0,B.useRef)(null),a=(0,B.useCallback)(l=>{r.current=l,o(l),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,B.useEffect)(()=>{let l=e.violations(),c=e.subscribe((f,g)=>{let p=e.violations(),m=$t(e.allInvariants(),l,p).introduces;l=p,a(Sn(r.current,g,m.map(S=>({nodeIds:S.nodeIds,message:S.message})),Date.now(),t))});return()=>{c(),i.current&&clearTimeout(i.current)}},[e,t,a]);let u=(0,B.useCallback)(l=>{l.reads.length!==0&&a(Sn(r.current,[xo(l)],[],Date.now(),t))},[t,a]);return{activity:n,noteAttention:u}}function xo(e){return{id:`attention:${e.intent}`,seq:-1,batch:"attention",author:e.author,intent:e.intent,mutation:null,primitives:[],inverse:[],reads:e.reads,writes:[],at:new Date().toISOString()}}var s=C(F(),1);function bn(){let e=null,t=new Set,n=new Set,o=r=>{for(let i of n)i(r)};return{subscribe(r){return t.add(r),t.size===1&&o(!0),()=>{t.delete(r),t.size===0&&(e=null,o(!1))}},snapshot:()=>e,set(r){if(!(e===r||e&&r&&e.x===r.x&&e.y===r.y)){e=r;for(let i of t)i()}},get listeners(){return t.size},onActive(r){return n.add(r),()=>void n.delete(r)}}}function xn(){let e=!1,t=new Set;return{moving:()=>e,set(n){if(n!==e){e=n;for(let o of t)o()}},subscribe(n){return t.add(n),()=>t.delete(n)}}}var re=C(ve(),1),Ie=(0,s.createContext)(null),Pn=(0,s.createContext)("scene");function Eo({mode:e,children:t}){return(0,re.jsx)(Pn.Provider,{value:e,children:t})}function Ro(){return(0,s.useContext)(Pn)}var Mn={kind:"human"},Po=[],Mo=[],Ao=[],tt=[];function An(e,t){let n=(0,s.useId)();(0,s.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??Mn,r=()=>{qt(e,o,n),Ut(e)};r();let i,a=e.subscribe(()=>{clearTimeout(i),i=setTimeout(r,250)});return()=>{clearTimeout(i),a(),globalThis.__graviewWatch?.unseen?.({words:[],from:n,gone:!0})}},[e,t,n])}function ko({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,seats:a=Po,onSeat:u,people:l=Mo,memory:c,presenceTtlMs:f,app:g,settings:p=g?.settings??Ao,presence:m,brand:S,onKeepLens:k,providers:h,ai:v=Qe,files:w,view:x,onViewChange:R,children:N}){let[V,W]=(0,s.useState)(null),M=V??i??a[0]?.principal??Mn,b=(0,s.useMemo)(()=>e.seenBy(M),[e,M]);An(e,M);let[A]=(0,s.useState)(()=>gn(c)),[L,we]=(0,s.useState)(!1),Q=(0,s.useCallback)(()=>we(!0),[]),H=(0,s.useMemo)(()=>m?[...p,...mn]:p,[p,m]),[J]=(0,s.useState)(()=>n??ot(t,e.schema)),[T,D]=(0,s.useState)(()=>Pe(J??te,r??J?.selection??[])),K=(0,s.useRef)(J??te).current,[Z,Fn]=(0,s.useState)(null),[ft,Gn]=(0,s.useState)(null),De=(0,s.useContext)(Ie),[yt]=(0,s.useState)(()=>De?.seatTalk??Ye(S?.name??e.schema.kinds.join(","))),We=k??De?.onKeepLens,gt=g??De?.app,mt=(0,s.useRef)(null),ht=(0,s.useCallback)(d=>{mt.current=d},[]),wt=(0,s.useCallback)(d=>mt.current?.whereIs(d)??null,[]),[St]=(0,s.useState)(()=>bn()),[vt]=(0,s.useState)(()=>xn()),[Fe,Kn]=(0,s.useState)(null),[de,bt]=(0,s.useState)(()=>new Map),ce=(0,s.useRef)(de);ce.current=de;let ue=(0,s.useRef)(null),Ge=(0,s.useCallback)(d=>b.graph.getNode(d)?.kind,[b]),q=(0,s.useCallback)(d=>{let y=Je(ce.current,d,Ge);ce.current=y,bt(y),ue.current&&clearTimeout(ue.current),[...y.values()].some(P=>P.mode!=="docked"&&P.mode!=="asking")&&(ue.current=setTimeout(()=>{let P=Je(ce.current,{type:"rest",at:Date.now(),holdMs:nt},Ge);ce.current=P,bt(P)},nt+20))},[Ge]),xt=(0,s.useCallback)(d=>q({...d,at:d.at??Date.now()}),[q]),Et=(0,s.useCallback)(d=>{Kn(d),d&&q({type:"home",author:{kind:"agent",id:d,session:A},at:Date.now()})},[q,A]);(0,s.useEffect)(()=>b.subscribe((d,y)=>{for(let E of y)E.author.kind==="agent"&&q({type:"write",author:E.author,ids:E.writes,at:Date.now()})}),[b,q]),(0,s.useEffect)(()=>()=>{ue.current&&clearTimeout(ue.current)},[]);let z=(0,s.useMemo)(()=>({...M,session:A}),[M,A]),Rt=(0,s.useCallback)(d=>{W(d),u?.(d)},[u]),[pe,Bn]=(0,s.useState)(()=>Object.fromEntries(H.map(d=>[d.name,dn(d,c)])));(0,s.useEffect)(()=>{for(let d of H)un(d,pe[d.name]??d.initial)},[H,pe]);let Pt=(0,s.useCallback)((d,y)=>{let E=H.find(P=>P.name===d);!E||!E.options.some(P=>P.value===y)||(cn(E,y,c),Bn(P=>({...P,[d]:y})))},[H,c]),[Mt,jn]=(0,s.useState)(null),{activity:At,noteAttention:kt}=vn(b),Tt=(0,s.useCallback)(d=>{kt(d),q({type:"read",author:d.author,ids:d.reads,at:Date.now()})},[kt,q]),ee=(0,s.useCallback)(d=>{if(ne(d)!==null||X(d).length>0||qe(d))return!0;let y=Xt(d);return y?b.graph.allEdges().some(E=>E.kind===y.kind&&E.from===y.from&&E.to===y.to):b.graph.getNode(d)!==void 0},[b]),Ot=(0,s.useCallback)(d=>{let y=d.selection??tt,E=y.filter(ee),P=E.length===y.length?d:Pe(d,E);return P.focusId!==null&&!ee(P.focusId)&&(P=$(P,null)),P},[ee]),fe=(0,s.useCallback)(d=>{let y=Ot(d),E=Rn(b,z,y.shown);if(y.focusId!==null&&E.size>0){let P=X(y.focusId),Wt=b.graph.getNode(y.focusId);(P.length>0?P.every(Un=>E.has(Un)):Wt?E.has(Wt.kind):!1)&&(y={...y,focusId:null})}if(!y.overview&&y.focusId===null){let P=K.focusId!==null&&!ee(K.focusId)?ot(t,e.schema)??{...te,overview:!0}:K;P.focusId!==null&&ee(P.focusId)?y={...y,focusId:P.focusId}:P.overview===!0&&(y={...y,overview:!0})}return y},[Ot,ee,b,K,z,t,e.schema]),G=fe(x??T),Vt=(0,s.useMemo)(()=>Rn(b,z,G.shown),[b,z,G.shown]),It=(0,s.useMemo)(()=>[...b.modules.administered.entries()].map(([d,y])=>{let E=b.mayAdminister(d,z);return{name:d,...y.description?{description:y.description}:{},kinds:y.kinds??[],canShow:E,shown:E&&(G.shown??[]).includes(d)}}),[b,z,G.shown]),ye=(0,s.useCallback)(d=>{let y=E=>fe(typeof d=="function"?d(E):d);if(x!==void 0){R?.(y(x));return}R&&R(y(G)),D(E=>y(E))},[G,R,x,fe]);(0,s.useEffect)(()=>{x===void 0&&D(d=>{let y=fe(d);return y===d?d:y})},[G,x,fe]);let Lt=G.selection??tt,Ct=(0,s.useCallback)(d=>{ye(y=>Pe(y,typeof d=="function"?d(y.selection??tt):d))},[ye]),{who:_t,following:Nt,follow:Ht,sayWhere:zn,sharing:Dt}=hn({channel:m,store:b,view:G,principal:z,session:A,robots:de,seatWho:Fe,settingValues:pe,setView:ye,seats:a,people:l,...f!==void 0?{ttlMs:f}:{}}),qn=(0,s.useMemo)(()=>({store:b,scheme:o,views:t,view:G,setView:ye,homeView:K,selection:Lt,setSelection:Ct,menuAt:Z,setMenuAt:Fn,whereIs:wt,pointer:St,motion:vt,registerScene:ht,robots:de,noteSeat:xt,seatWho:Fe,registerSeatWho:Et,actsDoor:ft,registerActsDoor:Gn,seatTalk:yt,...c?{memory:c}:{},who:_t,following:Nt,follow:Ht,sayWhere:zn,sharing:Dt,session:A,ai:v,movedByHand:L,noteMoved:Q,emphasis:Mt,setEmphasis:jn,activity:At,noteAttention:Tt,principal:z,seats:a,people:l,takeSeat:Rt,settings:H,settingValues:pe,chooseSetting:Pt,hiddenKinds:Vt,administered:It,...h?{providers:h}:{},...S?{brand:S}:{},...We?{onKeepLens:We}:{},app:gt}),[b,o,t,G,ye,Lt,Ct,Z,wt,St,vt,ht,de,xt,Fe,Et,ft,yt,c,_t,Nt,Ht,Dt,A,v,L,Q,Mt,At,Tt,z,a,l,Rt,H,pe,Pt,Vt,It,h,S,We,gt]);return(0,re.jsx)(Ie.Provider,{value:qn,children:(0,re.jsx)(To,{children:w?(0,re.jsx)(Oe.Provider,{value:w,children:N}):N})})}var kn=(0,s.createContext)(null);function To({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:a}=Y(),u=Le(),l=n.q,c=n.focusId,f=!!(l&&l.trim().length>0),g=(0,s.useMemo)(()=>f?{flagged:new Set(t.violations().flatMap(S=>S.nodeIds)),touched:Kt(t.log.all())}:null,[t,u,f]),p=c?t.graph.getNode(c)?.kind??ne(c)??(X(c).length===1?X(c)[0]:void 0):void 0,m=(0,s.useMemo)(()=>!l||!g?null:Bt(t,l,{...p?{inKind:p}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(S=>!i.has(S)),from:[...a,...c&&t.graph.has(c)?[c]:[]],flagged:g.flagged,touched:g.touched,limit:200}),[t,l,r,o,i,a,c,p,g]);return(0,re.jsx)(kn.Provider,{value:m,children:e})}var En=new WeakMap;function ri(e){let t=En.get(e);return t||En.set(e,t=new Set(e.matched)),t}function Oo(){return(0,s.useContext)(kn)}function Y(){let e=(0,s.useContext)(Ie);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function Vo(){return(0,s.useContext)(Ie)??null}function Le(){let{store:e}=Y(),t=(0,s.useRef)(null),n=(0,s.useRef)(null),o=(0,s.useCallback)(()=>(n.current!==e&&(n.current=e,t.current=null),t.current??=e.graph.allNodes(),t.current),[e]),r=(0,s.useCallback)(i=>e.subscribe(()=>{t.current=null,i()}),[e]);return(0,s.useSyncExternalStore)(r,o,o)}function Io(e){let{store:t}=Y(),n=(0,s.useCallback)(r=>t.subscribe(r),[t]),o=(0,s.useCallback)(()=>e===null?void 0:t.graph.getNode(e),[t,e]);return(0,s.useSyncExternalStore)(n,o,o)}function Rn(e,t,n){let o=new Set(e.modules.disabledKinds);for(let r of e.kindsKeptFrom(t))o.add(r);for(let[r,i]of e.modules.administered)if(!(e.mayAdminister(r,t)&&(n??[]).includes(r)))for(let a of i.kinds??[])o.add(a);return o}var nt=2600;function ot(e,t){let n=Yt(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...te,focusId:oe(n.place.kind),within:{view:n.place.as}}:{...te,focusId:oe(n.kind)}}var Ce=Symbol.for("graview.default-view");function Tn(e){return Object.defineProperty(e,Ce,{value:!0,enumerable:!1}),e}function On(e){return typeof e=="function"&&e[Ce]===!0}var rt=Symbol.for("graview.replaces-page");function Vn(e){return typeof e=="function"&&e[rt]===!0}function Co(e){return Gt(e)}function _o(e,t){if(t===e)return e;for(let r of t.registrations()){let i={...r.title?{title:r.title}:{},...r.across?{across:r.across}:{},...r.beside?{beside:!0}:{}};e.register(r.kind,{cardinality:r.cardinality,fidelity:r.fidelity},r.view,i)}let n=t.arrangement?.();n&&e.arrange?.(n);let o=t.homeView?.();return o&&e.home?.(o),e}var ae=C(F(),1);function No(){let{selection:e,setSelection:t}=Y();return(0,ae.useMemo)(()=>({selection:e,set:n=>t(n),clear:()=>t([]),toggle:n=>t(o=>o.includes(n)?o.filter(r=>r!==n):[...o,n]),isSelected:n=>e.includes(n)}),[e,t])}function Ho(){let{store:e}=Y(),t=Le();return(0,ae.useMemo)(()=>Do(e),[e,t])}var In=new WeakMap;function Do(e){let t=In.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),In.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function Wo(){let{view:e,setView:t}=Y();return(0,ae.useMemo)(()=>({view:e,url:U(e),focus:n=>t(o=>$(o,n)),show:n=>t(o=>Jt(o,n)),toggle:n=>t(o=>Me(o,n)),go:n=>t(n)}),[e,t])}var ie={at:0,depth:0,listeners:new Set,tell(){for(let e of this.listeners)e()}};typeof window<"u"&&window.addEventListener("popstate",e=>{let t=e.state;ie.at=typeof t?.graview=="number"?t.graview:0,ie.at>ie.depth&&(ie.depth=ie.at),ie.tell()});var I=C(F(),1),at={profile:{trigger:"profile-button",pane:"profile",opens:"press",focus:"into",drawn:["shell","embed"]},problems:{trigger:"standing",pane:"problems",opens:"press",focus:"into",drawn:["shell","embed"]},places:{trigger:"app-places-open",pane:"app-places",opens:"press",focus:"into",drawn:["embed"]},here:{trigger:"here-open",pane:"here-list",opens:"press",focus:"into",drawn:["shell","embed","pages"]},activity:{trigger:"activity-button",pane:"activity",opens:"press",focus:"into",drawn:["shell","embed","pages"]},find:{trigger:"find-box",pane:"find-strip",opens:"typing",focus:"stays",drawn:["shell"]},districts:{trigger:"beyond-more",pane:"beyond-list",opens:"press",focus:"into",drawn:["shell","embed"]},acts:{trigger:null,pane:"context-menu",opens:"context-menu",focus:"into",drawn:["shell","embed"]},arrange:{trigger:"arrange-add",pane:"arrange-list",opens:"press",focus:"into",drawn:["pages"]},"studio-ask":{trigger:"studio-agent",pane:"studio-agent-panel",opens:"press",focus:"into",drawn:["studio"]}},Fo={position:"fixed",inset:"auto",margin:0,zIndex:zt("popover"),boxSizing:"border-box"},_e=6,se=8,Go=e=>typeof e.showPopover=="function";function Ne(e){try{return e.matches(":popover-open")}catch{return!1}}function Ko(e){if(typeof e=="function"){let o=e();return o?{left:o.x,right:o.x,top:o.y,bottom:o.y}:null}let t=e.current;if(!t||!t.isConnected)return null;let n=t.getBoundingClientRect();return{left:n.left,right:n.right,top:n.top,bottom:n.bottom}}function st(e,t,n={}){let o=Ko(t);if(!o)return;let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},i=e.dataset.graviewDesignedHeight??=e.style.maxHeight;e.style.maxHeight=i;let a=e.getBoundingClientRect(),u=r.height-o.bottom-_e-se,l=o.top-_e-se,c=a.height<=u||u>=l,f=Math.max(96,Math.floor(c?u:l)),g=Math.min(a.height,f);a.height>f&&(e.style.maxHeight=i?`min(${i}, ${f}px)`:`${f}px`);let p=a.width,m=n.align==="start"?o.left:o.right-p,S=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();S&&p<=S.right-S.left&&(m<S.left?m=o.left+p<=S.right?o.left:S.left:m+p>S.right&&(m=o.right-p>=S.left?o.right-p:S.right-p));let k=p>=r.width-2*se?Math.max(0,(r.width-p)/2):Math.max(se,Math.min(m,r.width-se-p)),h=c?o.bottom+_e:Math.max(se,o.top-_e-g);e.style.left=`${Math.round(k)}px`,e.style.top=`${Math.round(h)}px`}function Ln(e,t,n,o={}){let r=o.align??"end";(0,I.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(Go(i)&&!Ne(i))try{i.showPopover(),jo()}catch{}let a=0,u=c=>{c?.target instanceof Node&&i.contains(c.target)||(cancelAnimationFrame(a),a=requestAnimationFrame(()=>st(i,n,{align:r})))};st(i,n,{align:r}),addEventListener("resize",u),addEventListener("scroll",u,!0);let l=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>u());return l?.observe(i),()=>{if(cancelAnimationFrame(a),removeEventListener("resize",u),removeEventListener("scroll",u,!0),l?.disconnect(),i.isConnected&&Ne(i))try{i.hidePopover()}catch{}}},[t,e,r])}var lt=new Set;function Bo(e){return lt.add(e),()=>lt.delete(e)}function jo(){for(let e of lt)if(!(!e.isConnected||!Ne(e)))try{e.hidePopover(),e.showPopover()}catch{}}var le=null,zo='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function qo(e){for(let t of e.querySelectorAll(zo))if(t.closest("[hidden]")===null&&getComputedStyle(t).visibility!=="hidden")return t;return e}var it=()=>{let e=document.activeElement;return e===null||e===document.body};function Uo(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[a,u]=(0,I.useState)(!1),l=t.open??a,c=(0,I.useRef)(null),f=(0,I.useRef)(null),g=(0,I.useCallback)(w=>{c.current=w},[]),p=(0,I.useCallback)(w=>{f.current=w},[]),m=`graview-popover-${(0,I.useId)().replace(/:/g,"")}`,S=(0,I.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});S.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let k=(0,I.useCallback)(w=>{S.current.controlled||u(w),S.current.onOpenChange?.(w)},[]),h=(0,I.useCallback)(()=>{(document.querySelector(`[aria-controls="${m}"]`)??c.current??S.current.returnTo?.()??null)?.focus({preventScroll:!0})},[m]),v=(0,I.useCallback)(w=>{let x=f.current,R=typeof document>"u"?null:document.activeElement,N=R===null||R===document.body||x!==null&&x.contains(R);k(!1),!(!w||!N)&&(h(),requestAnimationFrame(()=>{it()&&h()}))},[k,h]);return Ln(f,i&&l,n??c,t.align?{align:t.align}:{}),(0,I.useEffect)(()=>{if(!i||!l)return;let w={name:e,close:()=>v(!1)};if(le&&le.close!==w.close&&le.close(),le=w,at[e].focus==="into"){let M=f.current;M&&!M.contains(document.activeElement)&&qo(M).focus({preventScroll:!0})}let x=M=>{M.key==="Escape"&&v(!0)},R=M=>{let b=M.target;if(!(b instanceof Node))return;let A=f.current;if(A?.contains(b)||c.current?.contains(b))return;let L=b instanceof Element?b.closest('[role="dialog"], [role="alertdialog"]'):null;L&&!(A&&L.contains(A))||(v(!1),at[e].focus==="into"&&requestAnimationFrame(()=>{(it()||A!==null&&A.contains(document.activeElement))&&h()}))},N=null,V=null,W=M=>{let b=M.target;if(!(b instanceof Element))return;let A=f.current,L=b.closest('[role="dialog"], [role="alertdialog"]');!L||A&&(A.contains(L)||L.contains(A))||(N=L,v(!1))};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",R,!0),document.addEventListener("focusin",W),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",R,!0),document.removeEventListener("focusin",W);let M=N;M&&typeof MutationObserver<"u"&&(V?.disconnect(),V=new MutationObserver(()=>{M.isConnected||(V?.disconnect(),requestAnimationFrame(()=>{(it()||document.activeElement.closest("[hidden]")!==null)&&h()}))}),V.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>V?.disconnect(),10*6e4)),le?.close===w.close&&(le=null)}},[i,l,e,v,h]),{open:l,setOpen:w=>w?k(!0):v(!0),toggle:()=>l?v(!0):k(!0),trigger:{ref:g,"aria-expanded":l,"aria-controls":m,"data-graview-popover-trigger":e},pane:{ref:p,id:m,popover:"manual",tabIndex:-1,"data-graview-popover":e,"data-graview-overlay":""}}}var _=C(F(),1),j=C(ve(),1),dt=new Set,Cn=!1;function ct(){for(let e of[...dt])e()}function $o(){Cn||typeof window>"u"||(Cn=!0,window.addEventListener("online",ct))}function Yo(e){let t,n=!1,o=!1,r,i=0,a=new Set,u=()=>{i+=1;for(let p of[...a])p()},l=p=>(a.add(p),()=>void a.delete(p)),c=()=>i,f=()=>void g().catch(()=>{});function g(){if(n)return Promise.resolve(t);if(r)return r;let p=e().then(m=>(t=m,n=!0,o=!1,r=void 0,dt.delete(f),u(),m),m=>{throw r=void 0,o=!0,dt.add(f),$o(),u(),m});return p.catch(()=>{}),r=p,p}return{load:g,prefetch:f,get current(){return t},get failed(){return o},part(p,m={}){let S=m.what??"This part";function k(w){(0,_.useSyncExternalStore)(l,c,c);let x=(0,_.useRef)(null),R=(0,_.useRef)(null),N=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{o&&r===void 0&&f()},[]),n&&typeof document<"u"&&x.current!==null&&document.activeElement===x.current&&(N.current=!0),(0,_.useLayoutEffect)(()=>{if(!(!n||!N.current)){N.current=!1;for(let V=R.current?.nextElementSibling??null;V!==null;V=V.nextElementSibling){let W=V.matches(_n)?V:V.querySelector(_n);if(W instanceof HTMLElement){W.focus();return}}}}),n?(0,j.jsxs)(j.Fragment,{children:[N.current?(0,j.jsx)("span",{ref:R,hidden:!0}):null,p(t,w)]}):m.quiet?null:(0,j.jsx)(Qo,{what:S,button:x,...m.as?{as:m.as}:{}})}let h=(0,_.lazy)(()=>g().then(()=>({default:k}),()=>({default:k})));function v(w){let[x]=(0,_.useState)(()=>n||o);return(0,_.createElement)(x?k:h,w)}return v}}}var _n="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function Qo({what:e,button:t,as:n="p"}){let r=typeof navigator<"u"&&navigator.onLine===!1?`${e} will load when you're back online.`:`${e} didn't load.`;return(0,j.jsxs)(n,{"data-testid":"lazy-part-missing",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,j.jsx)("span",{role:"status",children:r})," ",(0,j.jsx)("button",{ref:t,type:"button","data-testid":"lazy-part-retry",onClick:ct,style:{font:"inherit",fontWeight:600,color:"var(--graview-ink)",background:"none",border:"1px solid var(--graview-edge)",borderRadius:6,padding:"2px 10px"},children:"Try again"})]})}var He=C(F(),1);var Xo=(0,He.createContext)(null);var Nn=C(F(),1),Jo=(0,Nn.createContext)(!1);var Hn=C(F(),1),Zo=(0,Hn.createContext)(null);var Dn=C(F(),1),ut='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',pt=e=>e instanceof HTMLElement&&(e.matches(ut)||e.hasAttribute("tabindex")),he=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function er(e,t){let n=l=>l.replace(/["\\]/g,"\\$&"),o=t.getAttribute("data-testid"),r=t.getAttribute("data-graview-pick"),i=t.getAttribute("aria-label"),a=o?`[data-testid="${n(o)}"]`:r?`[data-graview-pick="${n(r)}"]`:i?`${t.tagName.toLowerCase()}[aria-label="${n(i)}"]`:null;if(!a)return null;let u=e.querySelector(a);return u&&pt(u)&&he(u)?u:null}var tr=e=>e.isConnected&&pt(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&he(e);function Wn(e,t){let n=t?er(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&he(o))return o;for(let r of e.querySelectorAll(ut))if(he(r))return r;return pt(e)&&he(e)?e:null}function nr(e){(0,Dn.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=h=>{let v=h.target;if(v instanceof Element){n=[];for(let w=v;w&&w!==t.parentElement;w=w.parentElement)n.push(w)}},r=!1,i=!1,a=t.ownerDocument,u=()=>!i&&a.defaultView!==null,l=(h,v)=>void setTimeout(()=>u()&&v(),h),c=h=>void requestAnimationFrame(()=>u()&&h()),f=h=>{if(r=!1,i)return;let v=a.activeElement;if(!(!(v===null||v===a.body||v===a.documentElement)||n.length===0)){if(tr(n[0])){h&&n[0]instanceof HTMLElement&&n[0].focus({preventScroll:!0});return}for(let x of n.slice(1)){if(!x.isConnected)continue;let R=Wn(x,n[0]);if(R){R.focus({preventScroll:!0}),n=[];return}}}},g=(h,v=Date.now()+2500)=>{l(100,()=>{f(h);let w=a.activeElement;(w===null||w===a.body||w===a.documentElement)&&n.length>0&&Date.now()<v&&g(h,v)})},p=()=>{r||n.length===0||(r=!0,l(60,()=>c(()=>{f(!1),g(!1)})))},m=h=>{if(!(h instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(h.key))){if(!(h instanceof KeyboardEvent)){let v=h.target instanceof Element?h.target.closest(ut):null,w=a.activeElement,x=w===null||w===a.body||w===a.documentElement;if(v&&x&&t.contains(v)){n=[];for(let R=v;R&&R!==t.parentElement;R=R.parentElement)n.push(R);l(150,()=>c(()=>{f(!1),g(!1)}));return}}!(h instanceof KeyboardEvent)&&!(h.target instanceof Node&&n[0]?.contains(h.target))||l(150,()=>c(()=>{f(!0),g(!0)}))}},S=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&p()}),k=h=>{h.relatedTarget===null&&p()};return t.addEventListener("focusin",o),t.addEventListener("focusout",k),t.addEventListener("click",m),t.addEventListener("keydown",m),S.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",k),t.removeEventListener("click",m),t.removeEventListener("keydown",m),S.disconnect()}},[e])}export{te as a,U as b,Ee as c,rr as d,ir as e,Qt as f,ar as g,Xt as h,$ as i,Jt as j,ge as k,je as l,sr as m,Yn as n,lr as o,dr as p,Pe as q,me as r,Me as s,cr as t,ur as u,pr as v,ke as w,ze as x,ne as y,gr as z,Qn as A,oe as B,Zt as C,X as D,en as E,Xn as F,mr as G,tn as H,qe as I,Ue as J,to as K,nn as L,no as M,rn as N,oo as O,ro as P,io as Q,fo as R,yo as S,Ye as T,co as U,uo as V,pn as W,Oe as X,po as Y,Eo as Z,Ro as _,An as $,ko as aa,ri as ba,Oo as ca,Y as da,Vo as ea,Le as fa,Io as ga,ot as ha,Xo as ia,Tn as ja,On as ka,Vn as la,Co as ma,_o as na,Jo as oa,Zo as pa,No as qa,Ho as ra,Wo as sa,ie as ta,nr as ua,Fo as va,Ne as wa,Bo as xa,Uo as ya,Yo as za};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as a}from"./chunk.QZWN46V6.js";import{k as i}from"./chunk.OYULDOQP.js";import{Ia as o}from"./chunk.VMEX2KZ4.js";function p(r){let t=r.within??{};return o({...t.sort?{sort:t.sort}:{},...t.filter?{filter:t.filter}:{},...t.group?{group:t.group}:{},...t.q?{q:t.q}:{}})}function s(r,t){let m=a(t),e=r;for(let n of["sort","filter","group","q"])e=i(e,n,m[n]??null);return e}export{p as a,s as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as ae}from"./chunk.XDHBV5K5.js";import"./chunk.WVUJXDXZ.js";import{b as $,c as ne}from"./chunk.UMMN5Z6V.js";import"./chunk.DG2WKNMX.js";import"./chunk.HPD3DSTP.js";import"./chunk.VD6FJ6KJ.js";import"./chunk.OHGJ5BZ4.js";import"./chunk.6R4EI47C.js";import{Y as X,da as ee,ga as te}from"./chunk.OYULDOQP.js";import{Fb as Y,H as J,I as v,J as j,Y as Q}from"./chunk.VMEX2KZ4.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ca as G,Da as F,Ea as v,Ga as q,Ha as W,Ja as T,Ka as A,La as h,Ma as k,O as x,P as R,S as O,Wa as j,Xa as B}from"./chunk.VMEX2KZ4.js";function L(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function V(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(o=>`${o.key}:${o.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function Y(e,r){let o=[],i={};if(e.query&&(i.query=e.query),e.sort&&(r.sorts.some(l=>l.key===e.sort.by)?i.sort=e.sort:o.push(`sort ${e.sort.by}`)),e.filter){let l=e.filter.filter(p=>r.filters.find(a=>a.key===p.key)?!0:(o.push(`filter ${p.key}`),!1));l.length>0&&(i.filter=l)}return e.group&&(r.groups.some(l=>l.key===e.group.by)?i.group=e.group:o.push(`group ${e.group.by}`)),{arrangement:i,dropped:o}}function N(e,r){return R(e.schema.tryDefinition(r.kind),A(r))}var z=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function I(e,r,o){if(o==="label")return N(e,r);let i=e.schema.tryDefinition(r.kind);return i&&o in(i.fields.shape??{})?T(r)[o]:h(e.graph,r.id,o).map(p=>N(e,p)).sort()[0]}var P=/^(\d{4})-(\d{2})-(\d{2})/;function U(e,r){let o=P.exec(e);if(!o)return;let[,i,l,p]=o;if(r==="day")return`${i}-${l}-${p}`;if(r==="month")return`${i}-${l}-01`;if(r==="year")return`${i}-01-01`;if(r==="decade")return`${String(Number(i)-Number(i)%10).padStart(4,"0")}-01-01`;let s=new Date(Date.UTC(Number(i),Number(l)-1,Number(p))),a=(s.getUTCDay()+6)%7;return s.setUTCDate(s.getUTCDate()-a),s.toISOString().slice(0,10)}var Q=["January","February","March","April","May","June","July","August","September","October","November","December"];function _(e,r){return r==="month"?`${Q[Number(e.slice(5,7))-1]} ${e.slice(0,4)}`:r==="week"?`Week of ${e}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:e}function K(e,r){let{words:o,conditions:i}=j(r);if(o.length===0&&i.length===0)return()=>!0;let l=new Map,p=s=>{let a=l.get(s);return a||(a=new Set(q(e.schema,s).filters.map(u=>u.key)),l.set(s,a)),a};return s=>{let a=p(s.kind),u=i.filter(g=>a.has(g.key));return u.every(g=>k(e,s,g))?o.length>0?B(e.schema.tryDefinition(s.kind),A(s),o)!==void 0:u.length>0:!1}}function X(e,r,o){let i=r.query?.trim(),l=i?e.filter(K(o,i)):e,p=r.filter?.length?l.filter(n=>r.filter.every(f=>k(o,n,f))):[...l],s=r.sort,a=s?p.map((n,f)=>({node:n,index:f,value:I(o,n,s.by)})).sort((n,f)=>{let t=z(n.value,f.value),d=s.direction==="desc"&&t!==0&&n.value!==void 0&&f.value!==void 0?-t:t;return d!==0?d:n.index-f.index}).map(n=>n.node):p,u=r.group;if(!u)return{nodes:a,groups:[{key:"",label:"",nodes:a}],grouped:!1};let g=new Map,c=(n,f,t)=>{let d=g.get(n)??{label:f,nodes:[]};d.nodes.push(t),g.set(n,d)},$=a[0],m=$?o.schema.tryDefinition($.kind):void 0,C=m?.fields.shape??{},E=m?G(m,u.by):O(u.by),b=u.by in C,y=b?F(C[u.by]):void 0,H=v(o.schema,$?.kind??"").find(n=>n.key===u.by)?.label,S=b?`No ${E.toLowerCase()}`:`Without ${(H??O(u.by)).toLowerCase()}`,M=b?new Map:x([...new Map(a.flatMap(n=>h(o.graph,n.id,u.by)).map(n=>[n.id,n])).values()].map(A),n=>o.schema.tryDefinition(n));for(let n of a){if(b){let t=T(n)[u.by];if(t==null||t==="")c("",S,n);else if(y==="date"){let d=u.bucket??"day",D=U(String(t),d);D?c(D,_(D,d),n):c("",S,n)}else if(y==="boolean")c(t?"1":"0",t?"Yes":"No",n);else{let d=m?.display?.format?.[u.by];c(String(t),d?d(t):String(t),n)}continue}let f=h(o.graph,n.id,u.by).map(t=>({id:t.id,label:M.has(t.id)?`${N(o,t)} \xB7 ${M.get(t.id)}`:N(o,t)})).sort((t,d)=>t.label.localeCompare(d.label));f.length===0?c("",S,n):c(f.map(t=>t.id).join(","),f.map(t=>t.label).join(", "),n)}let w=y==="choice"?W(C[u.by]):void 0,J=[...g.entries()].sort(([n,f],[t,d])=>n===""?1:t===""?-1:w?w.indexOf(n)-w.indexOf(t):y==="boolean"?t.localeCompare(n):y==="date"?n.localeCompare(t):f.label.localeCompare(d.label)).map(([n,f])=>({key:n,label:f.label,nodes:f.nodes}));return{nodes:a,groups:J,grouped:!0}}export{L as a,V as b,Y as c,X as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as n}from"./chunk.LQZ2VQWN.js";import"./chunk.TX2GOL65.js";import"./chunk.T2EZ5MTH.js";import"./chunk.ONDILMIX.js";import{f as s}from"./chunk.AS35X6KA.js";import"./chunk.I5KD54S6.js";import"./chunk.NQNQPPPM.js";import"./chunk.KAKX5TZN.js";import"./chunk.VFICMX5G.js";import"./chunk.IKT7JQUW.js";import"./chunk.CW7BMVBG.js";import"./chunk.IZDKEFPJ.js";import"./chunk.XDHBV5K5.js";import"./chunk.WVUJXDXZ.js";import"./chunk.UMMN5Z6V.js";import"./chunk.DG2WKNMX.js";import"./chunk.HPD3DSTP.js";import"./chunk.VD6FJ6KJ.js";import"./chunk.OHGJ5BZ4.js";import"./chunk.7QTBDACG.js";import"./chunk.5BN2ARQ2.js";import"./chunk.4W24TPMR.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.LHAAZQNQ.js";import"./chunk.PHY3AH3L.js";import"./chunk.QZWN46V6.js";import"./chunk.6LJ66MB7.js";import"./chunk.OYULDOQP.js";import"./chunk.VMEX2KZ4.js";import{a as y,b as i}from"./chunk.MRK6QJV5.js";import{b as r}from"./chunk.AJZBJBMO.js";var c=r(y(),1),e=r(i(),1);function v({store:d,views:t,as:a,scope:o}){let l=(0,c.useMemo)(()=>s({scope:`.${o}`}),[o]);return(0,e.jsxs)("div",{"data-testid":"embed-picture","data-embed-content":"",tabIndex:0,"aria-label":t.places().find(m=>m.as===a)?.title??"The picture",style:{flex:"1 1 auto",minHeight:0,display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)"},children:[(0,e.jsx)("style",{children:l}),(0,e.jsx)(n,{store:d,views:t,as:a})]})}export{v as PictureFace};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as he,b as Oe,c as xe,d as ce,e as v,f as Ee,h as Fe}from"./chunk.MHJJEGQO.js";import{e as Re,f as De,g as Me}from"./chunk.DG2WKNMX.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.VD6FJ6KJ.js";import{b as Se,g as u,h as ve,i as ae}from"./chunk.OHGJ5BZ4.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,ra as We,s 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.VMEX2KZ4.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,2 +0,0 @@
|
|
|
1
|
-
import{e as ye,f as he,i as be,j as J,k as we}from"./chunk.UMMN5Z6V.js";import{f as ge}from"./chunk.VD6FJ6KJ.js";import{$ as H,B as z,E as ne,Ib as ue,N as E,P as T,Ra as ie,S as te,Sb as pe,T as re,U as X,V as oe,Y as _,_b as me,aa as se,ac as fe,gb as ae,hb as q,ib as le,ub as de,wb as ce}from"./chunk.VMEX2KZ4.js";function Re(t,r,n){let s=t.tryDefinition(r)?.fields.shape,e=z(s?.[n]),l=!1,i=!1;for(;e&&(e.type==="optional"||e.type==="default"||e.type==="nullable"||e.type==="prefault");)(e.type==="optional"||e.type==="nullable")&&(l=!0),(e.type==="default"||e.type==="prefault")&&(i=!0),e=z(e.innerType);if(e?.type!=="enum")return;let y=(e.entries?Object.values(e.entries):e.values??[]).filter(u=>typeof u=="string");return y.length>0?{values:y,empty:l&&!i}:void 0}function L(t,r,n){let s=Re(t,r,n);if(!s)return[];let e=t.tryDefinition(r),l=s.values.map(i=>({value:i,label:re(e,n,i)}));return s.empty&&l.push({value:null,label:`No ${_(e,n).toLowerCase()}`}),l}function U(t,r,n){let s=t[r];return typeof s=="string"&&n.some(e=>e.value===s)?s:null}function Q(t,r,n,s,e=L(t.schema,n.kind,s)){let l=xe(t.schema,t.allMutations(),n.kind,s,e),i=U(n,s,e),y=[];for(let{value:u,by:A,acts:O}of l)if(u!==i)for(let $ of O){let B=A==="step"?{[$.subject.arg]:n.id}:{[$.subject.arg]:n.id,[s]:u},R={name:$.name,args:B};if($.input.safeParse(B).success&&t.permits(R,r).ok){try{ae(t.graph,$,B)}catch{continue}y.push({to:u,call:R,title:$.title??$.name});break}}return y}function xe(t,r,n,s,e=L(t,n,s)){let l=ve(t,r,n,s),i=$e(t,r,n,s);return e.flatMap(y=>{if(y.value===null)return[];let u=l.filter(A=>A.sets?.[s]===y.value);return[{value:y.value,label:y.label,by:u.length>0?"step":i.length>0?"value":"none",acts:u.length>0?u:i}]})}function ve(t,r,n,s){return r.filter(e=>e.subject!==void 0&&e.derived===void 0&&typeof e.sets?.[s]=="string"&&q(t,e).includes(n))}function $e(t,r,n,s){let e=t.tryDefinition(n);return e?r.filter(l=>{if(!l.subject||!q(t,l).includes(n)||!le(l,e).includes(s))return!1;let i=l.input.shape;return i!==void 0&&s in i}).sort((l,i)=>+(l.derived!==void 0)-+(i.derived!==void 0)):[]}var Y=(t,r)=>r&&t[r]!==void 0?String(t[r]):"";function Ae(t,r,n){let s=d=>t.tryDefinition(d)?r.nodesOfKind(d).filter(k=>E(t.tryDefinition(d),k)):[],e=s(n.rows),l=s(n.columns),i=new Set(e.map(d=>d.id)),y=new Set(l.map(d=>d.id)),u=r.allEdges(),A=[],O=n.link;if(typeof O=="string"){let d=p=>t.tryDefinition(p)?.edges?.[O]?.to,k=(d(n.columns)??[]).some(p=>p===n.rows||p==="*"),w=(d(n.rows)??[]).some(p=>p===n.columns||p==="*"),D=k||!w;for(let p of u){if(p.kind!==O)continue;let m=D?p.to:p.from,o=D?p.from:p.to;i.has(m)&&y.has(o)&&A.push({rowId:m,columnId:o,via:[]})}}else{let d=new Map(O.path.map(w=>[w,new Map]));for(let w of u){let D=d.get(w.kind);if(!D)continue;let p=D.get(w.from);p?p.push(w.to):D.set(w.from,[w.to]);let m=D.get(w.to);m?m.push(w.from):D.set(w.to,[w.from])}let k=new Set;for(let w of l){let D=[{id:w.id,via:[]}];for(let p of O.path){let m=[],o=new Set;for(let f of D)for(let P of d.get(p).get(f.id)??[])o.has(`${f.id}|${P}`)||(o.add(`${f.id}|${P}`),m.push({id:P,via:[...f.via,f.id]}));D=m}for(let p of D){let m=`${p.id}|${w.id}`;!i.has(p.id)||k.has(m)||(k.add(m),A.push({rowId:p.id,columnId:w.id,via:p.via.slice(1)}))}}}let $=n.groupOrder??[],B=d=>$.indexOf(d)===-1?$.length:$.indexOf(d),R=e.map(d=>{let k=d;return{node:d,label:String(k.label??T(t.tryDefinition(d.kind),d)),group:Y(k,n.rowGroup),ref:Y(k,n.rowRef)}}).sort((d,k)=>B(d.group)-B(k.group)||(d.ref<k.ref?-1:d.ref>k.ref?1:0)),N=l.map(d=>({node:d,label:T(t.tryDefinition(d.kind),d),group:Y(d,n.columnGroup)})).sort((d,k)=>d.group<k.group?-1:d.group>k.group?1:d.node.id<k.node.id?-1:d.node.id>k.node.id?1:0);return{rows:R,columns:N,cells:A}}function ke(t,r,n){let{rows:s,columns:e,cells:l}=Ae(t,r,n),i=(o,f)=>X(t,o,f),y=o=>X(t,o,1).replace(/^1 /,""),u=o=>({id:o.id,kind:o.kind,title:T(t.tryDefinition(o.kind),o),parts:[]}),A=o=>{let f=r.getNode(o);if(!f)return null;let P=t.tryDefinition(f.kind),M=T(P,f),K=H(f,P,{limit:3,said:[M],glance:!0}).map(I=>I.alone.startsWith(I.label)?`${I.label.toLowerCase()}${I.alone.slice(I.label.length)}`:I.alone);return[M,...K].join(", ")},O=typeof n.link=="string"?[]:n.link.path.slice(0,-1).flatMap((o,f,P)=>{let M=ue(t,n.columns,P.slice(0,f+1));return M.ok?[...M.reached]:[]}),$=[{t:"text",text:`${i(n.rows,s.length)} against ${i(n.columns,e.length)}${O.length>0?`, through ${[...new Set(O)].map(o=>i(o,2).replace(/^2 /,"")).join(" and ")}`:""}${e.length>0?`: ${e.map(o=>o.label).join(", ")}`:""}.`}],B=new Map(e.map(o=>[o.node.id,o.label])),R=new Map(e.map((o,f)=>[o.node.id,f])),N=new Map,d=new Map;for(let o of l){let f=N.get(o.rowId);f?f.push(o):N.set(o.rowId,[o]);let P=d.get(o.columnId);P?P.add(o.rowId):d.set(o.columnId,new Set([o.rowId]))}for(let o of s){let P=[...N.get(o.node.id)??[]].sort((M,K)=>R.get(M.columnId)-R.get(K.columnId)).map(M=>{let K=M.via.map(A).filter(I=>I!==null);return`${B.get(M.columnId)}${K.length>0?` (${K.join("; ")})`:""}`});$.push({t:"field",label:o.label,text:P.length>0?P.join(", "):"none"})}$.push({t:"list",as:"name",columns:1,groups:e.map(o=>{let f=d.get(o.node.id)??new Set,P=s.filter(M=>f.has(M.node.id)).map(M=>u(M.node));return{heading:`${o.label} (${P.length})`,items:P}})});let k=new Set(l.map(o=>o.rowId)),w=new Set(l.map(o=>o.columnId)),D=s.filter(o=>!k.has(o.node.id)),p=e.filter(o=>!w.has(o.node.id)),m=n.rows===n.columns;return D.length>0&&$.push({t:"text",text:`${m?`${D.length} with none across`:`${i(n.rows,D.length)} with no ${y(n.columns)}`}: ${D.map(o=>o.label).join(", ")}.`}),p.length>0&&$.push({t:"text",text:`${m?`${p.length} with none down`:`${i(n.columns,p.length)} on no ${y(n.rows)}`}: ${p.map(o=>o.label).join(", ")}.`}),$}function Z(t,r,n,s={}){let{app:e,blocks:l=n?e?.viewSpecs?.[n.kind]?.[s.slot??"page"]:e?.home}=s;if(!l?.length)return[];let i=s.firstHeading??(n||s.blocks?void 0:1),y=we(t,r,n,{...s,money:s.money??e?.brand,firstHeading:i});return n&&!y.node?[]:he(typeof l[0]?.t=="string"?l:ye(l),y)}var Ce=240,Se=10,je=1160,Me=40,Oe=640,Be=3,Ie=t=>Math.max(1,Math.floor((Math.min(t,je)-Me+Se)/(Ce+Se)));function Ge(t,r,n,s){let{app:e}=s,l=s.width??1440,i=s.today??ne(),y=t.seenBy(r),u=y.schema,A=y.graph,O=fe(e),$=typeof n=="string"?n.trim():n.slug,B=typeof n=="string"?O.find(a=>a.slug===$||a.title===$||a.address===$):O.find(a=>a.slug===n.slug&&a.kind===n.kind)??n,R=!B&&typeof n=="string"?A.getNode($):void 0;if(!B&&!R)return{ok:!1,error:`"${$}" is not a place this app has, nor a record this seat can see.`,places:O.map(a=>a.slug)};let N=[],d=e.viewSpecs??{},k=Ie(l),w=(a,h)=>Z(y,null,a,{app:e,today:i,...h}),D=(a,h,b)=>{let g=u.tryDefinition(a.kind),S=T(g,a);if(h==="name")return{id:a.id,kind:a.kind,title:S,parts:[]};if(d[a.kind]?.[h]){let j=w(a,{slot:h}),[F,...v]=j,C=F?.t==="title";return{id:a.id,kind:a.kind,title:C?F.text:S,parts:p(C?v:j,b,`views.${a.kind}.${h}`,` (${a.id})`,C?1:0)}}if(h==="row")return{id:a.id,kind:a.kind,title:S,parts:[]};let c=g?.computed?J(u,A,a):a,G=H(c,g,{limit:3,said:[S],glance:!0});return{id:a.id,kind:a.kind,title:S,parts:G.map(j=>({t:"text",text:j.alone}))}};function p(a,h,b,g="",S=0){let x=[];return a.forEach((c,G)=>{let j=`${b}.${G+S}`;switch("problem"in c&&c.problem&&N.push({at:`${j}${g}`,says:c.problem}),c.t){case"title":x.push({t:"heading",level:3,text:c.text});return;case"text":x.push({t:"text",text:c.text,...c.tone?{tone:c.tone}:{}});return;case"badge":x.push({t:"badge",text:c.text});return;case"field":case"image":x.push({t:"field",label:c.label,text:c.text});return;case"progress":x.push({t:"progress",label:c.label,text:c.text});return;case"group":x.push(...p(c.blocks,h,`${j}.group`,g));return;case"when":x.push(...p(c.blocks,h,`${j}.show`,g));return;case"divider":case"figure":return;case"headline":x.push({t:"heading",level:c.level,text:c.text});return;case"number":x.push({t:"figure",text:c.text,...c.label?{label:c.label}:{}});return;case"list":{if(c.failed){x.push({t:"text",text:"\u2014"});return}if(c.members.length===0){c.empty&&x.push({t:"list",as:c.as,columns:1,groups:[],empty:c.empty});return}let F=h+1,v=F>Be?"name":c.as,C=(c.groups??[{value:null,members:c.members}]).map(W=>({..."heading"in W&&W.heading?{heading:W.heading}:{},items:W.members.map(Pe=>D(Pe,v,F))}));x.push({t:"list",as:v,columns:v==="card"?k:1,groups:C,...c.more>0?{more:c.more}:{}});return}}}),x}let m=[],o,f,P;if(R){f="record";let a=u.tryDefinition(R.kind),h=T(a,R);P={slug:R.id,title:h,kind:R.kind,address:ie(u,R.kind,R.id)},d[R.kind]?.page&&m.push(...p(w(R,{slot:"page"}),1,`views.${R.kind}.page`));let g=a?.computed?J(u,A,R):R;for(let S of se(a,H(g,a,{said:[h]}))){S.title&&m.push({t:"heading",level:2,text:S.title});for(let x of S.fields)m.push({t:"field",label:x.label,text:x.value})}}else{let a=B;P={slug:a.slug,title:a.title,kind:a.kind,address:a.address};let h=a.lens?pe(e).drawn.find(b=>b.as===a.slug&&(a.kind===null||b.kinds.includes(a.kind))):void 0;if(a.kind===null){let b=e.brand,g=b?.name??e.name,S=b?.logo&&ce(b.logo)?b.logo:void 0;if(o={name:g,...b?.subtitle?{subtitle:b.subtitle}:{},...S?{logo:{alt:b?.logoAlt??g,...de(S)?{drawn:"inline SVG"}:{drawn:"image",src:S}}}:{}},e.home)f="blocks",m=p(w(null,{}),0,"views.home");else{f="derived";let x=new Set(e.pages?.hide??[]),c=me(u.kinds,e.pages?.order).filter(G=>!x.has(G));m.push({t:"heading",level:1,text:e.name??"Home"});for(let G of c){let j=A.nodesOfKind(G).filter(F=>E(u.tryDefinition(G),F)).length;j>0&&m.push({t:"text",text:`${j} ${V(u,G,j)}`})}}}else if(h?.lens==="blocks")f="lens:blocks",m=p(w(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){f="lens:columns";let b=h.options.bindings??{};for(let g of Object.keys(b)){let S=b[g]?.column;if(!S)continue;let x=L(u,g,S),c=A.nodesOfKind(g).filter(v=>E(u.tryDefinition(g),v));Object.keys(b).length>1&&m.push({t:"heading",level:2,text:V(u,g,2).replace(/^./,v=>v.toUpperCase())}),m.push({t:"text",text:`${c.length} ${V(u,g,c.length)} in columns by ${_(u.tryDefinition(g),S).toLowerCase()}.`});let G=x.map(v=>({column:v,items:c.filter(C=>U(C,S,x)===v.value).map(C=>D(C,"card",1))})).filter(({column:v,items:C})=>v.value!==null||C.length>0).map(({column:v,items:C})=>({heading:`${v.label} (${C.length})`,items:C}));m.push({t:"list",as:"card",columns:1,groups:G});let j=new Map;for(let v of c)for(let C of Q(t,r,v,S,x))j.set(C.to,(j.get(C.to)??new Set).add(`"${C.title}"`));let F=x.filter(v=>v.value!==null&&j.has(v.value)).map(v=>`to ${v.label} by ${[...j.get(v.value)].join(" or ")}`);m.push({t:"text",text:F.length>0?`Moves: ${F.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")f="lens:coverage",m=ke(u,A,h.options);else if(h){f=`lens:${h.lens}`;let b=h.kinds.flatMap(g=>A.nodesOfKind(g).filter(S=>E(u.tryDefinition(g),S)));m.push({t:"text",text:`A ${h.lens} of ${b.length} ${h.kinds.map(g=>V(u,g,b.length)).join(" and ")}.`}),m.push({t:"list",as:"name",columns:1,groups:[{items:b.map(g=>D(g,"name",1))}]})}else{f="derived";let b=A.nodesOfKind(a.kind).filter(g=>E(u.tryDefinition(a.kind),g));m.push({t:"heading",level:1,text:a.title}),b.length===0?m.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${V(u,a.kind,0)} yet.`}):m.push({t:"list",as:"row",columns:1,groups:[{items:b.map(g=>D(g,"row",1))}]})}}let M=r.kind==="system"?"the system":(r.roles??[]).length>0?(r.roles??[]).join(", "):r.kind,K=l<Oe?"phone":"wide",I=P.kind===null?Fe(u,A):[],ee={...o?{masthead:o}:{},...I.length>0?{facts:I}:{},place:P,seat:M,width:l,variant:K,drawnBy:f,parts:m,problems:N};return{ok:!0,description:{...ee,text:De(ee)}}}function Fe(t,r){let n=be(t,r,null),s=e=>Array.isArray(e)?e.map(s).join(", "):e===null?"nothing":typeof e=="boolean"?e?"yes":"no":typeof e=="object"?e.label:String(e);return[...ge(t)].map(([e,l])=>{let i=l.label??te(e);return Object.hasOwn(n.values,e)?{name:e,label:i,value:s(n.values[e])}:{name:e,label:i,refused:n.refused[e]??"it could not be worked out"}})}function V(t,r,n){let s=t.tryDefinition(r);if(n===1)return s?.noun??r;let e=oe(t,r);return e.charAt(0).toLowerCase()+e.slice(1)}function De(t){let r=[`${t.place.title} (${t.place.address}) \u2014 as ${t.seat}, ${t.width} wide (${t.variant}).`],n=t.masthead;n&&r.push(`Masthead: ${n.logo?`the logo ("${n.logo.alt}", ${n.logo.drawn==="image"?n.logo.src:"inline SVG"}), `:""}${n.name}${n.subtitle?` \u2014 ${n.subtitle}`:""}`);let s=(e,l)=>{for(let i of e)switch(i.t){case"heading":r.push(`${l}${"#".repeat(i.level)} ${i.text}`);break;case"text":r.push(`${l}${i.text}`);break;case"badge":r.push(`${l}[${i.text}]`);break;case"field":case"progress":r.push(`${l}${i.label}: ${i.text}`);break;case"figure":r.push(`${l}${i.text}${i.label?` \u2014 ${i.label}`:""}`);break;case"list":if(i.groups.length===0){i.empty&&r.push(`${l}(${i.empty})`);break}for(let y of i.groups){y.heading&&r.push(`${l}${y.heading}:`);for(let u of y.items)r.push(`${l}${y.heading?" ":""}- ${u.title}`),s(u.parts,`${l}${y.heading?" ":" "}`)}i.as==="card"&&i.columns>1&&r.push(`${l}(cards, ${i.columns} across)`),i.more&&r.push(`${l}and ${i.more} more`);break}};if(s(t.parts,""),t.facts){r.push("Facts of the whole graph (what fact('<name>') reads):");for(let e of t.facts)r.push(`- ${e.label} (${e.name}): ${e.value??`not worked out \u2014 ${e.refused}`}`)}if(t.problems.length>0){r.push("Problems:");for(let e of t.problems)r.push(`- ${e.at}: ${e.says}`)}return r.join(`
|
|
2
|
-
`)}export{L as a,U as b,Q as c,xe as d,ve as e,$e as f,Z as g,Ge as h,De as i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as f}from"./chunk.CW7BMVBG.js";import{Yb as c}from"./chunk.VMEX2KZ4.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 +0,0 @@
|
|
|
1
|
-
import{e as B}from"./chunk.4W24TPMR.js";import{A as M,da as _,h as q}from"./chunk.OYULDOQP.js";import{O as H,P as L,S as R,X as K,_ as T,ab as j}from"./chunk.VMEX2KZ4.js";import{a as J,b as G}from"./chunk.MRK6QJV5.js";import{b as $}from"./chunk.AJZBJBMO.js";var i=$(J(),1),a=$(G(),1);function ae({affordance:r,onApply:o,onCancel:u}){let{store:l}=_(),[y,m]=(0,i.useState)({}),[f,x]=(0,i.useState)(""),[A,F]=(0,i.useState)(U),W=(0,i.useId)(),O=(0,i.useRef)(null),v=r.open.filter(e=>!(e.name in y)),s=v[0];if((0,i.useEffect)(()=>x(""),[s?.name]),(0,i.useEffect)(()=>{O.current?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[s?.name]),(0,i.useLayoutEffect)(()=>{let e=O.current,n=typeof document>"u"?null:document.activeElement;if(!e||n&&n!==document.body&&!e.contains(n))return;let p=e.querySelector("form input, [role=group] button:not([disabled])");p&&p!==n&&p.focus()},[s?.name]),!s)return null;let h=e=>{let n={...y,[s.name]:e};if(r.open.filter(c=>!(c.name in n)).length===0){let c=o(Object.fromEntries(Object.entries(n).filter(([,E])=>E!==void 0)));c&&c.length>0&&m(Object.fromEntries(Object.entries(n).filter(([E])=>!c.includes(E))))}else m(n)},N=s.optional?(0,a.jsx)("button",{type:"button",onClick:()=>h(void 0),style:{fontSize:"0.8125rem"},children:"Skip"}):null,t=s.shape??{type:"unknown"},d=Q(s,t),g=j(l.schema,l.allMutations().find(e=>e.name===r.mutation),s.name),[z,V]=(0,i.useState)(""),I=(0,i.useMemo)(()=>{let e=d.map(n=>l.graph.getNode(n)).filter(n=>n!==void 0);return H(e,n=>l.schema.tryDefinition(n))},[d,l]),C=e=>{let n=Z(l,t,e),p=t.type==="choice"||t.type==="several"&&t.of.type==="choice"?g.option(e):n,c=I.get(e);return c?`${p} \xB7 ${c}`:p},w=(0,i.useMemo)(()=>{let e=z.trim().toLowerCase();return e===""?d:d.filter(n=>C(n).toLowerCase().includes(e))},[d,z,l,t,I]),b=t.type==="several",P=t.type==="file"?t:t.type==="several"&&t.of.type==="file"?t.of:void 0,D=b&&d.length===0,k=s.kinds&&s.kinds.length>0&&!s.kinds.includes("*")?s.kinds.map(e=>R(T(l.schema.tryDefinition(e),e))).join(" or "):g.label,Y=r.open.length>1?`${k} \xB7 ${r.open.length-v.length+1} of ${r.open.length}`:k;return(0,a.jsxs)("div",{ref:O,"data-graview-asking":r.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:4,padding:"5px 0 2px"},children:[r.open.length>1||d.length>0?(0,a.jsx)("span",{id:W,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:Y}):null,d.length>S?(0,a.jsx)("input",{type:"search",value:z,onChange:e=>V(e.target.value),placeholder:`Filter ${d.length}\u2026`,"aria-label":`Filter ${k}`,"data-testid":"ask-filter",style:{font:"inherit",fontSize:"0.8125rem",minWidth:0,padding:"3px 7px"}}):null,P?(0,a.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,a.jsx)(B,{as:"control",value:void 0,onChange:h,several:b,image:P.image===!0,label:g.label}),N]}):d.length>0?(0,a.jsxs)("div",{role:"group","aria-labelledby":W,style:{display:"flex",flexWrap:"wrap",gap:4},children:[w.slice(0,S).map(e=>{let n=A.includes(e);return(0,a.jsx)("button",{type:"button","aria-label":`${k}: ${C(e)}`,...b?{"aria-pressed":n}:{},style:{padding:"3px 9px",fontSize:"0.8125rem",...n?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},onClick:()=>b?F(p=>p.includes(e)?p.filter(c=>c!==e):[...p,e]):h(t.type==="boolean"?e==="yes":e),children:C(e)},e)}),w.length>S?(0,a.jsxs)("span",{"data-testid":"ask-more",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:[w.length-S," more \u2014 type to narrow"]}):null,w.length===0?(0,a.jsxs)("span",{"data-testid":"ask-none",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["None of the ",d.length," match that."]}):null,b?(0,a.jsx)("button",{type:"button",disabled:A.length===0,style:{fontSize:"0.8125rem"},onClick:()=>{let e=A;F(U),h(e)},children:v.length>1?"Next":"Apply"}):null,N]}):(0,a.jsxs)("form",{style:{display:"flex",flexWrap:"wrap",gap:4},onSubmit:e=>{if(e.preventDefault(),D){h(f.split(/[,\n]/).map(n=>n.trim()).filter(Boolean));return}f.trim().length!==0&&h(t.type==="number"?Number(f):f)},children:[t.type==="text"&&t.long?(0,a.jsx)("textarea",{autoFocus:!0,name:s.name,"aria-label":g.label,placeholder:g.label,value:f,rows:4,onChange:e=>x(e.target.value),onKeyDown:e=>{e.key==="Escape"?u():e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},style:{flex:"1 1 100%",minWidth:0,font:"inherit",fontSize:"0.875rem",lineHeight:1.45,padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",resize:"vertical",fieldSizing:"content",minHeight:"5.5em",maxHeight:"40vh"}}):(0,a.jsx)("input",{autoFocus:!0,type:t.type==="date"?t.time?"datetime-local":"date":t.type==="number"?"number":"text",name:s.name,"aria-label":g.label,placeholder:D?`${g.label}, separated by commas`:g.label,value:f,...t.type==="number"&&t.min!==void 0?{min:t.min}:{},...t.type==="number"&&t.max!==void 0?{max:t.max}:{},...t.type==="number"&&t.step!==void 0?{step:t.step}:{},onChange:e=>x(e.target.value),onKeyDown:e=>{e.key==="Escape"&&u()},style:{flex:1,minWidth:0,font:"inherit",fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}),(0,a.jsx)("button",{type:"submit",disabled:!D&&f.trim().length===0,style:{fontSize:"0.8125rem"},children:v.length>1?"Next":"Apply"}),N]})]})}var U=[],S=10;function Q(r,o){return r.candidates&&r.candidates.length>0?r.candidates:o.type==="choice"?o.options:o.type==="several"&&o.of.type==="choice"?o.of.options:o.type==="boolean"?X:[]}var X=["yes","no"];function Z(r,o,u){return o.type==="boolean"||o.type==="choice"||o.type==="several"&&o.of.type==="choice"?u:ee(r,u)}function ee(r,o){let u=q(o);if(u){let m=K(r.schema,r.graph.getNode(u.from)?.kind??"",u.kind,"out");return m.charAt(0).toUpperCase()+m.slice(1)}let l=M(o);if(l.length>0)return l.map(m=>r.schema.tryDefinition(m)?.plural??`${m}s`).join(" + ");let y=r.graph.getNode(o);return y?L(r.schema.tryDefinition(y.kind),y):o}export{ae as a,ee as b};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import{a as pt,c as yt,d as oe}from"./chunk.T2EZ5MTH.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.CW7BMVBG.js";import{a as lt}from"./chunk.5BN2ARQ2.js";import{ea as ot}from"./chunk.OYULDOQP.js";import{$ as Xe,Qa as Ze,Ra as qe,S as Se,Sa as et,W as ne,Yb as rt,Zb as at,_b as nt,ba as Qe,xb as tt}from"./chunk.VMEX2KZ4.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
|
-
*/
|