graview 0.1.24 → 0.1.25

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.
Files changed (75) hide show
  1. package/dist/preview/{chunk.47GRZWQN.js → chunk.2AJMM7JG.js} +1 -1
  2. package/dist/preview/{chunk.2VX6H2LL.js → chunk.2WFEFZAW.js} +1 -1
  3. package/dist/preview/chunk.2YVXTTC2.js +1 -0
  4. package/dist/preview/{chunk.AKOC43TV.js → chunk.6DU4XN2F.js} +1 -1
  5. package/dist/preview/{chunk.RT3XFR6E.js → chunk.6OBXKKB5.js} +2 -2
  6. package/dist/preview/{chunk.7EN53F4Q.js → chunk.6UL2JUEH.js} +1 -1
  7. package/dist/preview/chunk.6WFN4C46.js +107 -0
  8. package/dist/preview/{chunk.Y4R77MKX.js → chunk.7BAUPTMY.js} +1 -1
  9. package/dist/preview/chunk.A4SJ7EEY.js +1 -0
  10. package/dist/preview/{chunk.BNSY25SG.js → chunk.ACKTGTOT.js} +1 -1
  11. package/dist/preview/{chunk.7U7Q3HIS.js → chunk.B57EIGTS.js} +1 -1
  12. package/dist/preview/{chunk.ISAMJ7AK.js → chunk.BJ2Y5F66.js} +1 -1
  13. package/dist/preview/{chunk.3O2QU7LU.js → chunk.BYUQOV3O.js} +1 -1
  14. package/dist/preview/chunk.C5N4RTPF.js +1 -0
  15. package/dist/preview/{chunk.XDPRWUCJ.js → chunk.CFL2B2Z5.js} +1 -1
  16. package/dist/preview/{chunk.UM5IPM22.js → chunk.DEZEXD24.js} +1 -1
  17. package/dist/preview/{chunk.6MCK7K3M.js → chunk.DJ72CUS7.js} +1 -1
  18. package/dist/preview/{chunk.WOTNMTIY.js → chunk.DSZ3I557.js} +1 -1
  19. package/dist/preview/chunk.EA4BZKPG.js +1 -0
  20. package/dist/preview/{chunk.GDIRDJF3.js → chunk.EKZWX6NG.js} +1 -1
  21. package/dist/preview/{chunk.RGXNZ7PN.js → chunk.F26676IW.js} +1 -1
  22. package/dist/preview/{chunk.NRWJ6PLU.js → chunk.F2KDFGHR.js} +1 -1
  23. package/dist/preview/chunk.FWV4XAZA.js +1 -0
  24. package/dist/preview/chunk.G3BOZHKR.js +1 -0
  25. package/dist/preview/{chunk.HH6WIUK3.js → chunk.H4LHHT56.js} +6 -6
  26. package/dist/preview/{chunk.FKQTQ3FV.js → chunk.HQX5FGYT.js} +1 -1
  27. package/dist/preview/{chunk.TWFYXD3P.js → chunk.I5ELK6JF.js} +1 -1
  28. package/dist/preview/{chunk.WEGBBWWK.js → chunk.I6T3FDQS.js} +1 -1
  29. package/dist/preview/{chunk.DQL3WKR3.js → chunk.IB6PGEU7.js} +1 -1
  30. package/dist/preview/{chunk.LW7KV5SL.js → chunk.JCZH55RX.js} +1 -1
  31. package/dist/preview/{chunk.XUXCDUKC.js → chunk.JEMQBV6K.js} +1 -1
  32. package/dist/preview/{chunk.AXACXB4D.js → chunk.JIXW4WIO.js} +1 -1
  33. package/dist/preview/chunk.JW3E4SAC.js +1 -0
  34. package/dist/preview/{chunk.HDEQXJWX.js → chunk.KUTTVYOB.js} +1 -1
  35. package/dist/preview/{chunk.53RZI5PM.js → chunk.LHFEOEYY.js} +1 -1
  36. package/dist/preview/{chunk.D3CYTXNZ.js → chunk.MJ67MK4R.js} +1 -1
  37. package/dist/preview/{chunk.BLAODPYJ.js → chunk.ORJ3T4IW.js} +1 -1
  38. package/dist/preview/{chunk.TDW6QEG4.js → chunk.PY42PBMB.js} +1 -1
  39. package/dist/preview/{chunk.VTBAKTFP.js → chunk.QOYC424P.js} +2 -2
  40. package/dist/preview/{chunk.OXODTBOP.js → chunk.R6F3YMRK.js} +1 -1
  41. package/dist/preview/chunk.RAE4M3KQ.js +8 -0
  42. package/dist/preview/chunk.RUFAVEXB.js +1 -0
  43. package/dist/preview/chunk.RVEMN5WU.js +1 -0
  44. package/dist/preview/{chunk.XDVKD6VX.js → chunk.S24R4MRK.js} +3 -3
  45. package/dist/preview/{chunk.S4FO7Y2Q.js → chunk.S56LSUHV.js} +1 -1
  46. package/dist/preview/{chunk.HAQ4KHRY.js → chunk.SSOTDXRS.js} +1 -1
  47. package/dist/preview/{chunk.TWGB347L.js → chunk.T6KID3WO.js} +1 -1
  48. package/dist/preview/chunk.TAOT74FR.js +1 -0
  49. package/dist/preview/chunk.TTODVIXW.js +1 -0
  50. package/dist/preview/{chunk.XJNXSQT4.js → chunk.U6BWYBPM.js} +1 -1
  51. package/dist/preview/{chunk.KKTHQJ6F.js → chunk.UOYH2DFX.js} +1 -1
  52. package/dist/preview/{chunk.MYCTNK6D.js → chunk.US4KIJSW.js} +1 -1
  53. package/dist/preview/{chunk.42U4UBDE.js → chunk.WX5CJ7PI.js} +1 -1
  54. package/dist/preview/chunk.WXO3XUNW.js +1 -0
  55. package/dist/preview/{chunk.6XBLDV4A.js → chunk.YZZGD5OY.js} +1 -1
  56. package/dist/preview/{chunk.C7KLA2MW.js → chunk.ZJVIH6IF.js} +1 -1
  57. package/dist/preview/{chunk.PRXKRG6O.js → chunk.ZRVDIVYY.js} +1 -1
  58. package/dist/preview/chunk.ZV7ZFH2S.js +1 -0
  59. package/dist/preview/page.js +2 -2
  60. package/package.json +6 -6
  61. package/dist/preview/chunk.2STFOAXA.js +0 -1
  62. package/dist/preview/chunk.33C6VZAD.js +0 -1
  63. package/dist/preview/chunk.3TNQPFIK.js +0 -1
  64. package/dist/preview/chunk.54NSG7BX.js +0 -1
  65. package/dist/preview/chunk.6O67NOZR.js +0 -1
  66. package/dist/preview/chunk.7Q7S7YCA.js +0 -1
  67. package/dist/preview/chunk.EUCXNNCZ.js +0 -107
  68. package/dist/preview/chunk.FRNIWOKD.js +0 -1
  69. package/dist/preview/chunk.H3HRTEW7.js +0 -1
  70. package/dist/preview/chunk.KWSXL3A2.js +0 -1
  71. package/dist/preview/chunk.UEBBASQW.js +0 -1
  72. package/dist/preview/chunk.UIZWVBJ7.js +0 -1
  73. package/dist/preview/chunk.VLNI5U6H.js +0 -1
  74. package/dist/preview/chunk.XCOPECOJ.js +0 -1
  75. package/dist/preview/chunk.ZQ4HFIIS.js +0 -8
@@ -1,4 +1,4 @@
1
- import{b as pt,c as oe,d as yt}from"./chunk.RGXNZ7PN.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.AKOC43TV.js";import{a as lt}from"./chunk.HAQ4KHRY.js";import{da as ot}from"./chunk.2VX6H2LL.js";import{L as Se,Oa as Ze,P as ne,Pa as qe,Pb as rt,Qa as et,Qb as at,Rb as nt,U as Xe,W as Qe,ob as tt}from"./chunk.ZQ4HFIIS.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.
1
+ import{b as pt,c as oe,d as yt}from"./chunk.F26676IW.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.6DU4XN2F.js";import{a as lt}from"./chunk.SSOTDXRS.js";import{da as ot}from"./chunk.2WFEFZAW.js";import{Ja as Ze,Ka as qe,La as et,M as Se,Q as ne,Rb as rt,Sb as at,Tb as nt,V as Xe,X as Qe,qb as tt}from"./chunk.RAE4M3KQ.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
2
 
3
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)(yt,{})});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)(pt,{})]})})}):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
4
  /*! Bundled license information:
@@ -1 +1 @@
1
- import{A as l,H as p,O as k,P as y,c}from"./chunk.FKQTQ3FV.js";import"./chunk.RGXNZ7PN.js";import"./chunk.ONDILMIX.js";import{b as m}from"./chunk.VLNI5U6H.js";import"./chunk.IKT7JQUW.js";import"./chunk.AKOC43TV.js";import"./chunk.MYCTNK6D.js";import"./chunk.53RZI5PM.js";import"./chunk.XJNXSQT4.js";import"./chunk.VTBAKTFP.js";import"./chunk.7U7Q3HIS.js";import"./chunk.6O67NOZR.js";import"./chunk.WWRWXFYR.js";import"./chunk.ISAMJ7AK.js";import"./chunk.54NSG7BX.js";import"./chunk.6KJSFIO7.js";import"./chunk.UM5IPM22.js";import"./chunk.6XBLDV4A.js";import"./chunk.WOTNMTIY.js";import"./chunk.HAQ4KHRY.js";import"./chunk.PRXKRG6O.js";import"./chunk.AHDOKM4O.js";import"./chunk.TDW6QEG4.js";import"./chunk.LW7KV5SL.js";import{U as s,W as d,da as g}from"./chunk.2VX6H2LL.js";import"./chunk.ZQ4HFIIS.js";import{a as S,b as f}from"./chunk.MRK6QJV5.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
1
+ import{A as l,H as p,O as k,P as y,c}from"./chunk.HQX5FGYT.js";import"./chunk.F26676IW.js";import"./chunk.ONDILMIX.js";import{b as m}from"./chunk.G3BOZHKR.js";import"./chunk.IKT7JQUW.js";import"./chunk.6DU4XN2F.js";import"./chunk.US4KIJSW.js";import"./chunk.LHFEOEYY.js";import"./chunk.U6BWYBPM.js";import"./chunk.QOYC424P.js";import"./chunk.B57EIGTS.js";import"./chunk.2YVXTTC2.js";import"./chunk.WWRWXFYR.js";import"./chunk.BJ2Y5F66.js";import"./chunk.A4SJ7EEY.js";import"./chunk.6KJSFIO7.js";import"./chunk.DEZEXD24.js";import"./chunk.YZZGD5OY.js";import"./chunk.DSZ3I557.js";import"./chunk.SSOTDXRS.js";import"./chunk.ZRVDIVYY.js";import"./chunk.AHDOKM4O.js";import"./chunk.PY42PBMB.js";import"./chunk.JCZH55RX.js";import{U as s,W as d,da as g}from"./chunk.2WFEFZAW.js";import"./chunk.RAE4M3KQ.js";import{a as S,b as f}from"./chunk.MRK6QJV5.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
@@ -1 +1 @@
1
- import{a as U,b as V,c as W,d as q,e as b,f as z,h as J}from"./chunk.6MCK7K3M.js";import{a as L,b as H,c as A,d as X,j as Q,k as Z,l as ee}from"./chunk.54NSG7BX.js";import{a as M,b as K,c as E,d as Y,e as F,g as R,h as ne}from"./chunk.6XBLDV4A.js";import{b as B,g as u,h as I,i as G}from"./chunk.WOTNMTIY.js";var ce={};function te(e,t=ce,i=H){let{document:r,respelled:f}=U(e),l=f.length>0?{respelled:f}:{};if(!r||typeof r!="object"||Array.isArray(r))return{document:r};let p=r;if(p.format!==L||typeof p.formatVersion!="number"||p.formatVersion>=i)return{document:r,...l};let a=p.formatVersion,o=structuredClone(p);for(let s=a;s<i;s++){let c=t[s];if(!c)throw new Error(`there is no upgrade from format ${s} to ${s+1}`);o={...c(o),formatVersion:s+1}}return{document:o,from:a,...l}}function se(e,t,i){let r=Object.keys(e).filter(a=>e[a].edges?.[t]!==void 0);if(r.length===0)return;let f=r.map(a=>e[a].edges[t].to),l=f.some(a=>a==="*")?"*":[...new Set(f.flatMap(a=>a))];if(i.length===0||i.some(a=>r.includes(a)))return{reversed:!1,kinds:l};let p=r.filter(a=>{let o=e[a].edges[t].to;return o==="*"||i.every(s=>o.includes(s))});return p.length>0?{reversed:!0,kinds:p}:{reversed:!1,kinds:l}}function oe(e,t,i=`kinds.${e}.page`){let r=t.page;if(!r)return[];let f=[],l=[...Object.keys(t.fields),...Object.keys(t.computed??{})],p=new Set,a=(s,c)=>{l.includes(s)?p.has(s)&&f.push(u("page-field-twice",c,`"${s}" is on ${e}'s page twice; name each field once`)):f.push(u("page-field",c,`${e}'s page is to show "${s}", and ${e} has no field or computed field called that`,`use one of: ${l.join(", ")}`)),p.add(s)};(r.fields??[]).forEach((s,c)=>a(s,`${i}.fields.${c}`));let o=new Set;return(r.groups??[]).forEach((s,c)=>{let d=s.title.trim().toLowerCase();o.has(d)&&f.push(u("page-group-twice",`${i}.groups.${c}.title`,`${e}'s page has two groups called "${s.title}"; give each its own title`)),o.add(d),s.fields.forEach(($,n)=>a($,`${i}.groups.${c}.fields.${n}`))}),f}var de=new Set(["subject","now","today"]);function fe(e){if(typeof e=="string"){if(e.length>A)return{findings:[u("too-large","",`a document may be at most ${A/1024} KB`)]};try{e=JSON.parse(e)}catch(r){return{findings:[u("not-json","",`this is not JSON: ${r.message}`)]}}}else if(JSON.stringify(e??null).length>A)return{findings:[u("too-large","",`a document may be at most ${A/1024} KB`)]};try{e=te(e).document}catch(r){return{findings:[u("format","formatVersion",r.message)]}}let t=X.safeParse(e);if(!t.success)return{findings:t.error.issues.map(r=>{let f=r.path.map(String).join(".");if(r.code==="unrecognized_keys")return u("unknown-key",f,`${r.keys.map(l=>`"${l}"`).join(", ")} ${r.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(r.code==="invalid_union"&&/\.effects\.\d+$/.test(f))return u("effect-shape",f,"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(r.code==="invalid_key"){let l=r.issues?.[0]?.message;return u("shape",f,`the name "${String(r.path.at(-1))}" is not allowed here${l?`: ${l}`:""}`)}return u("shape",f,r.message)})};let i=t.data;return{document:i,findings:le(i)}}var P=e=>e===void 0?[]:Array.isArray(e)?e:[e];function re(e){let t=new Map;for(let[i,r]of Object.entries(e.kinds))for(let[f,l]of Object.entries(r.edges??{})){let p=t.get(f);t.set(f,{name:f,from:[...p?.from??[],i],to:l.to==="*"||p?.to==="*"?"*":[...new Set([...p?.to??[],...l.to])],cardinality:l.cardinality??"many"})}return t}function Ge(e){let t=new Map;for(let[r,f]of Object.entries(e.kinds)){let l=R(f);t.set(r,{fields:new Set(Object.keys(f.fields)),edges:new Map(Object.entries(f.edges??{}).map(([p,a])=>[p,a.cardinality??"many"])),...l?{computed:l}:{}})}let i=R(e);return i&&t.set(B,{computed:i}),t}function ie(e,t){let i=[],r=P(e.on),f=(l,p)=>{let a=se(t.kinds,l,r)?.reversed===!0,[o,s]=a?["$to","$subject"]:["$subject","$to"];return p==="connect"?{connect:l,from:o,to:s}:{sever:l,from:o,to:s}};if(e.creates){let l=t.kinds[e.creates],p={};for(let a of Object.keys(l?.fields??{}))p[a]=`$${a}`;for(let a of e.effects??[])"set"in a&&!("create"in a)&&b(a.target)==="new"&&Object.assign(p,a.set);i.push({create:e.creates,as:"new",set:p})}return e.sets&&i.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&i.push({set:Object.fromEntries(e.writes.map(l=>[l,`$${l}`]))}),e.connects&&(e.replaces&&i.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),i.push(f(e.connects,"connect"))),e.severs&&i.push(f(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(l=>!(e.creates&&"set"in l&&!("create"in l)&&b(l.target)==="new"))),i}function C(e,t,i){try{let r=E(e),f=M(r);for(let l of f.unknownFunctions)i.push(u("unknown-function",t,`"${l}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return r}catch(r){if(r instanceof K){i.push(u("expression",t,r.sentence+` (at character ${r.at+1})`));return}throw r}}function N(e,t,i){try{return F(e)}catch(r){if(r instanceof Y||r instanceof K){i.push(u("template",t,(r instanceof K,r.sentence)));return}throw r}}function le(e){let t=[],i=new Set(Object.keys(e.kinds)),r=re(e),f=e.acts??{},l=new Set(e.roles??[]);for(let[a,o]of Object.entries(e.kinds)){let s=`kinds.${a}`;for(let[d,$]of Object.entries(o.edges??{})){if($.to!=="*")for(let n of $.to)i.has(n)||t.push(u("edge-target",`${s}.edges.${d}.to`,`"${n}" is not a kind this document declares`));o.fields[d]&&t.push(u("edge-field-clash",`${s}.edges.${d}`,`"${d}" is both a field and a relation of ${a}`,"rename one of them"))}o.lifecycle&&!o.fields[o.lifecycle.field]&&t.push(u("lifecycle-field",`${s}.lifecycle.field`,`${a} has no field "${o.lifecycle.field}"`));let c=d=>o.computed!==void 0&&Object.hasOwn(o.computed,d);for(let d of o.glance??[])!o.fields[d]&&!c(d)&&t.push(u("glance-field",`${s}.glance`,`a glance at ${a} is to say "${d}", and ${a} has no field or computed field called that`,`use one of: ${[...Object.keys(o.fields),...Object.keys(o.computed??{})].join(", ")}`));t.push(...oe(a,o));for(let d of["label","describe"]){let $=o[d];if(!$)continue;let n=N($,`${s}.${d}`,t);for(let m of n??[])if(m.expr){for(let y of M(m.expr).names)if(!o.fields[y]){if(c(y)){ne(o,y)||t.push(u("template-field",`${s}.${d}`,`${a}'s ${y} is worked out from beyond the record, and a ${d} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${a}'s own fields`));continue}t.push(u("template-field",`${s}.${d}`,`${a} has no field "${y}" for its ${d} to show`,d==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[d,$]of Object.entries(o.fields))$.default!==void 0&&$.type==="enum"&&!$.options?.includes(String($.default))&&t.push(u("default-option",`${s}.fields.${d}.default`,`"${String($.default)}" is not one of ${d}'s options`))}for(let[a,o]of Object.entries(f)){let s=`acts.${a}`;for(let n of P(o.on))i.has(n)||t.push(u("act-kind",`${s}.on`,`"${n}" is not a kind this document declares`));let c=P(o.on),d=ie(o,e);if(o.creates&&o.on===void 0&&o.writes&&i.has(o.creates))for(let n of o.writes)e.kinds[o.creates].fields[n]||(e.kinds[o.creates].computed?.[n]!==void 0?t.push(u("computed-written",`${s}.writes`,`${o.creates}'s ${n} 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`,`${o.creates} has no field "${n}"`)));d.length===0&&t.push(u("act-empty",s,`"${a}" does nothing`,"give it effects or a shorthand such as sets or creates"));let $=new Map;d.forEach((n,m)=>{let y=d.length-(o.effects?.length??0),w=o.effects&&m>=y?`${s}.effects.${m-y}`:s;if("create"in n){if(!i.has(n.create))t.push(u("act-kind",`${w}.create`,`"${n.create}" is not a kind this document declares`));else for(let h of Object.keys(n.set??{}))e.kinds[n.create].fields[h]||(e.kinds[n.create].computed?.[h]!==void 0?t.push(u("computed-written",`${w}.set.${h}`,`${n.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",`${w}.set.${h}`,`${n.create} has no field "${h}"`)));n.as&&$.set(n.as,n.create)}else if("connect"in n||"sever"in n){let h="connect"in n?n.connect:n.sever;r.has(h)||t.push(u("act-edge",`${w}.${"connect"in n?"connect":"sever"}`,`"${h}" is not a relation any kind declares`)),b(n.from)==="subject"&&c.length===0&&t.push(u("act-subject",`${s}.on`,`"${a}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in n){let h=b(n.target??"$subject"),O=h==="subject"?c:$.has(h??"")?[$.get(h)]:[];h==="subject"&&c.length===0&&t.push(u("act-subject",`${s}.on`,`"${a}" changes "$subject" but does not say which kinds it is "on"`));for(let S of Object.keys(n.set))for(let x of O)!i.has(x)||e.kinds[x].fields[S]||(e.kinds[x].computed?.[S]!==void 0?t.push(u("computed-written",`${w}.set.${S}`,`${x}'s ${S} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):t.push(u("act-field",`${w}.set.${S}`,`${x} has no field "${S}"`)))}else"remove"in n&&b(n.remove)==="subject"&&c.length===0&&t.push(u("act-subject",`${s}.on`,`"${a}" removes "$subject" but does not say which kinds it is "on"`));("set"in n&&n.set?Object.values(n.set):[]).forEach(h=>{h&&typeof h=="object"&&!Array.isArray(h)&&"expr"in h&&C(h.expr,`${w}.set`,t)})}),o.allowedWhen&&C(o.allowedWhen,`${s}.allowedWhen`,t),o.refusal&&N(o.refusal,`${s}.refusal`,t)}for(let[a,o]of Object.entries(e.rules??{})){let s=`rules.${a}`;o.over!=="graph"&&!i.has(o.over)&&t.push(u("rule-kind",`${s}.over`,`"${o.over}" is not a kind this document declares`));let c=o.over==="graph"?void 0:e.kinds[o.over];for(let d of["when","require"]){let $=o[d];if(!$)continue;let n=C($,`${s}.${d}`,t);if(!n)continue;let m=M(n);for(let y of m.names)if(o.over==="graph")t.push(u("rule-name",`${s}.${d}`,`"${y}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(c&&!c.fields[y]&&!c.edges?.[y]&&c.computed?.[y]===void 0){let w=Object.keys(c.edges??{}).find(v=>v.includes("-")&&v.split("-").includes(y));t.push(u("rule-name",`${s}.${d}`,`${o.over} has no field or relation called "${y}"`,w?`"${w}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${w.replace(/-([a-z0-9])/g,(v,h)=>h.toUpperCase())}"`:void 0))}for(let y of m.edges)r.has(y)||t.push(u("rule-edge",`${s}.${d}`,`"${y}" is not a relation any kind declares`));for(let y of m.sweeps)i.has(y)?o.over!=="graph"&&t.push(I("rule-cost",`${s}.${d}`,`this rule looks at every ${y} for every ${o.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}.${d}`,`"${y}" is not a kind this document declares`))}o.says&&N(o.says,`${s}.says`,t),(o.repairs??[]).forEach((d,$)=>{!f[d.act]&&!/^(edit|remove)-/.test(d.act)&&t.push(u("repair-act",`${s}.repairs.${$}.act`,`"${d.act}" is not an act this document declares`))})}let p=e.policy;return p&&(p.grants.forEach((a,o)=>{if(a.roles!=="*"&&l.size>0)for(let s of a.roles)l.has(s)||t.push(u("grant-role",`policy.grants.${o}.roles`,`"${s}" is not one of the document's roles`));if(a.mutations!=="*")for(let s of a.mutations)!f[s]&&!/^(edit|remove)-/.test(s)&&t.push(u("grant-act",`policy.grants.${o}.mutations`,`"${s}" is not an act this document declares`))}),(p.sees??[]).forEach((a,o)=>{for(let s of a.kinds)i.has(s)||t.push(u("sight-kind",`policy.sees.${o}.kinds`,`"${s}" is not a kind this document declares`));if(a.roles!=="*"&&l.size>0)for(let s of a.roles)l.has(s)||t.push(u("sight-role",`policy.sees.${o}.roles`,`"${s}" is not one of the document's roles`))})),t.push(...ee(e)),t}function ue(e,t,i,r){let f=new Map,l=P(e.on),p=new Map,a=new Map;(l.length>0||t.some(n=>"remove"in n&&b(n.remove)==="subject"||"from"in n&&(b(n.from)==="subject"||b(n.to)==="subject")||"set"in n&&!("create"in n)&&b(n.target??"$subject")==="subject"))&&f.set(q,{ref:l.length>0?l:"*",required:!0});let s=e.args??{},c=e.writes?.length===1,d=(n,m)=>m&&n.type===m.type&&n.min===void 0&&n.max===void 0&&n.step===void 0?{...n,...m.min===void 0?{}:{min:m.min},...m.max===void 0?{}:{max:m.max},...m.step===void 0?{}:{step:m.step}}:n,$=(n,m,y)=>{if(n===q||de.has(n)||p.has(n)||f.has(n))return;let w=s[n]?d(s[n],y):void 0;f.set(n,w?{field:w,optional:!w.required,required:!!w.required}:m())};for(let n of t)if("create"in n){let m=i.kinds[n.create];for(let[y,w]of Object.entries(n.set??{})){let v=b(w),h=m?.fields[y];if(v&&h){let O=!!h.required&&h.default===void 0;$(v,()=>({field:h,optional:!O,required:O}),h)}}n.as&&p.set(n.as,n.create)}else if("connect"in n||"sever"in n){let m=r.get("connect"in n?n.connect:n.sever);for(let[y,w]of[["from",n.from],["to",n.to]]){let v=b(w);if(!v)continue;let h=y==="to"?m?.to??"*":m?.from??"*";h!=="*"&&!a.has(v)&&a.set(v,h),$(v,()=>({ref:h,required:!0}))}}else if("set"in n){let m=b(n.target??"$subject"),y=m==="subject"?l[0]:p.get(m??"")??a.get(m??"")?.[0];m&&m!=="subject"&&!p.has(m)&&$(m,()=>({ref:"*",required:!0}));for(let[w,v]of Object.entries(n.set)){let h=b(v);if(!h)continue;let O=y?i.kinds[y]?.fields[w]:void 0;$(h,()=>O?{field:O,optional:!c,required:c}:{any:!0,required:!1},O)}}else if("remove"in n){let m=b(n.remove);m&&$(m,()=>({ref:"*",required:!0}))}for(let[n,m]of Object.entries(s))f.has(n)||f.set(n,{field:m,optional:!m.required,required:!!m.required});return f}function qe(e,t={}){let i=fe(e);if(!i.document||G(i.findings))return{ok:!1,findings:i.findings};let r=i.document,f=[...i.findings];t.previous&&f.push(...ge(r,t.previous));let l=pe(r,f);return G(l.findings)?{ok:!1,findings:l.findings}:J(l,t)}function pe(e,t){let i=re(e),r={};for(let[s,c]of Object.entries(e.kinds)){let d=z(c),$=c.label??(d?`{${d}}`:void 0),n=R(c);r[s]={...$?{label:F($)}:{},...c.describe?{describe:F(c.describe)}:{},...n?{computed:[...n]}:{}}}let f={};for(let[s,c]of Object.entries(e.acts??{})){let d=ie(c,e),$=ue(c,d,e,i),n=c.destructive??d.some(g=>"remove"in g||"sever"in g||"replace"in g),m=[...new Set(d.flatMap(g=>"create"in g?[g.create]:[]))],y=[...new Set(d.flatMap(g=>"connect"in g?[g.connect]:[]))],w=[...new Set(d.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],v=[...new Set(d.flatMap(g=>"set"in g&&!("create"in g)&&b(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],h=new Map;for(let g of d){if(!("connect"in g)&&!("sever"in g))continue;let k=i.get("connect"in g?g.connect:g.sever);for(let[j,ae]of[["from",g.from],["to",g.to]]){let D=b(ae),T=j==="to"?k?.to:k?.from;D&&D!=="subject"&&T&&T!=="*"&&h.set(D,[...new Set([...h.get(D)??[],...T])])}}let O={};for(let g of d){if(!("set"in g)||"create"in g)continue;let k=b(g.target??"$subject");for(let j of k&&k!=="subject"&&h.get(k)||[])O[j]=[...new Set([...O[j]??[],...Object.keys(g.set)])]}let S={};for(let g of d)if(!(!("set"in g)||"create"in g||b(g.target??"$subject")!=="subject"))for(let[k,j]of Object.entries(g.set??{}))typeof j=="string"&&b(j)===void 0||typeof j=="number"||typeof j=="boolean"?S[k]=typeof j=="string"&&j.startsWith("$$")?j.slice(1):j:delete S[k];let x=m.length===0&&d.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(k=>!(k&&typeof k=="object"&&!Array.isArray(k)&&"expr"in k))),_=new Map;for(let g of d)if(!(!("set"in g)||!g.set))for(let k of Object.values(g.set))k&&typeof k=="object"&&!Array.isArray(k)&&"expr"in k&&_.set(k.expr,E(k.expr));f[s]={title:c.title??s.replace(/-/g," "),effects:d,args:[...$],...c.allowedWhen?{guard:E(c.allowedWhen)}:{},...c.refusal?{refusal:F(c.refusal)}:{},exprs:[..._],destructive:n,idempotent:x,creates:m,connects:y,severs:w,writes:v,writesOther:O,sets:S}}let l={};for(let[s,c]of Object.entries(e.rules??{}))l[s]={title:c.title??s.replace(/-/g," "),require:E(c.require),...c.when?{when:E(c.when)}:{},...c.says?{says:F(c.says)}:{}};let p=V(e,t),a=Q(e),o=Z(e);return{format:W,document:e,findings:t,kinds:r,...e.computed?{facts:[...R(e)??[]]}:{},edges:[...i].map(([s,{from:c,to:d,cardinality:$}])=>[s,{from:c,to:d,cardinality:$}]),acts:f,rules:l,brand:p,...Object.keys(a).length>0?{viewSpecs:a}:{},...o?{home:o}:{}}}function Ce(e,t){let i=e.split(/[\s:·]/).find(r=>r.length>0)??e;return t.kinds[i]?`kinds.${i}`:t.acts?.[i]?`acts.${i}`:t.rules?.[i]?`rules.${i}`:e}function Ne(e,t,i){let r=/^defineNode\("([^"]+)"\)/.exec(t)?.[1],f=r?i.kinds[r]:void 0;if(!r||!f)return e;let l=Object.keys(f.fields).filter(p=>p!=="label").slice(0,3);return{...e,path:`kinds.${r}.glance`,fix:`Say which: "glance": [${l.map(p=>`"${p}"`).join(", ")}] on kinds.${r} \u2014 the facts a person compares one by, at a glance.`}}function ge(e,t){let i=[],r=new Set(Object.values(t.kinds).flatMap(f=>Object.keys(f.edges??{})));for(let[f,l]of Object.entries(e.kinds)){let p=l.renamedFrom;p&&!t.kinds[p]&&i.push(u("renamed-from-nothing",`kinds.${f}.renamedFrom`,`${f} says it was ${p}, and the previous version has no kind called ${p}`,"name the kind it was, or drop renamedFrom"));let a=t.kinds[p??f];for(let[o,s]of Object.entries(l.fields)){let c=s.renamedFrom;c&&!a?.fields[c]&&i.push(u("renamed-from-nothing",`kinds.${f}.fields.${o}.renamedFrom`,`${o} says it was ${c}, and the previous ${p??f} has no field called ${c}`,"name the field it was, or drop renamedFrom"))}for(let[o,s]of Object.entries(l.edges??{})){let c=s.renamedFrom;c&&!r.has(c)&&i.push(u("renamed-from-nothing",`kinds.${f}.edges.${o}.renamedFrom`,`${o} says it was ${c}, and the previous version has no relation called ${c}`,"name the relation it was, or drop renamedFrom"))}}return i}export{fe as a,Ge as b,ie as c,qe as d,Ce as e,Ne as f};
1
+ import{a as U,b as V,c as W,d as q,e as b,f as z,h as J}from"./chunk.DJ72CUS7.js";import{a as L,b as H,c as A,d as X,j as Q,k as Z,l as ee}from"./chunk.A4SJ7EEY.js";import{a as M,b as K,c as E,d as Y,e as F,g as R,h as ne}from"./chunk.YZZGD5OY.js";import{b as B,g as u,h as I,i as G}from"./chunk.DSZ3I557.js";var ce={};function te(e,t=ce,i=H){let{document:r,respelled:f}=U(e),l=f.length>0?{respelled:f}:{};if(!r||typeof r!="object"||Array.isArray(r))return{document:r};let p=r;if(p.format!==L||typeof p.formatVersion!="number"||p.formatVersion>=i)return{document:r,...l};let a=p.formatVersion,o=structuredClone(p);for(let s=a;s<i;s++){let c=t[s];if(!c)throw new Error(`there is no upgrade from format ${s} to ${s+1}`);o={...c(o),formatVersion:s+1}}return{document:o,from:a,...l}}function se(e,t,i){let r=Object.keys(e).filter(a=>e[a].edges?.[t]!==void 0);if(r.length===0)return;let f=r.map(a=>e[a].edges[t].to),l=f.some(a=>a==="*")?"*":[...new Set(f.flatMap(a=>a))];if(i.length===0||i.some(a=>r.includes(a)))return{reversed:!1,kinds:l};let p=r.filter(a=>{let o=e[a].edges[t].to;return o==="*"||i.every(s=>o.includes(s))});return p.length>0?{reversed:!0,kinds:p}:{reversed:!1,kinds:l}}function oe(e,t,i=`kinds.${e}.page`){let r=t.page;if(!r)return[];let f=[],l=[...Object.keys(t.fields),...Object.keys(t.computed??{})],p=new Set,a=(s,c)=>{l.includes(s)?p.has(s)&&f.push(u("page-field-twice",c,`"${s}" is on ${e}'s page twice; name each field once`)):f.push(u("page-field",c,`${e}'s page is to show "${s}", and ${e} has no field or computed field called that`,`use one of: ${l.join(", ")}`)),p.add(s)};(r.fields??[]).forEach((s,c)=>a(s,`${i}.fields.${c}`));let o=new Set;return(r.groups??[]).forEach((s,c)=>{let d=s.title.trim().toLowerCase();o.has(d)&&f.push(u("page-group-twice",`${i}.groups.${c}.title`,`${e}'s page has two groups called "${s.title}"; give each its own title`)),o.add(d),s.fields.forEach(($,n)=>a($,`${i}.groups.${c}.fields.${n}`))}),f}var de=new Set(["subject","now","today"]);function fe(e){if(typeof e=="string"){if(e.length>A)return{findings:[u("too-large","",`a document may be at most ${A/1024} KB`)]};try{e=JSON.parse(e)}catch(r){return{findings:[u("not-json","",`this is not JSON: ${r.message}`)]}}}else if(JSON.stringify(e??null).length>A)return{findings:[u("too-large","",`a document may be at most ${A/1024} KB`)]};try{e=te(e).document}catch(r){return{findings:[u("format","formatVersion",r.message)]}}let t=X.safeParse(e);if(!t.success)return{findings:t.error.issues.map(r=>{let f=r.path.map(String).join(".");if(r.code==="unrecognized_keys")return u("unknown-key",f,`${r.keys.map(l=>`"${l}"`).join(", ")} ${r.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(r.code==="invalid_union"&&/\.effects\.\d+$/.test(f))return u("effect-shape",f,"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(r.code==="invalid_key"){let l=r.issues?.[0]?.message;return u("shape",f,`the name "${String(r.path.at(-1))}" is not allowed here${l?`: ${l}`:""}`)}return u("shape",f,r.message)})};let i=t.data;return{document:i,findings:le(i)}}var P=e=>e===void 0?[]:Array.isArray(e)?e:[e];function re(e){let t=new Map;for(let[i,r]of Object.entries(e.kinds))for(let[f,l]of Object.entries(r.edges??{})){let p=t.get(f);t.set(f,{name:f,from:[...p?.from??[],i],to:l.to==="*"||p?.to==="*"?"*":[...new Set([...p?.to??[],...l.to])],cardinality:l.cardinality??"many"})}return t}function Ge(e){let t=new Map;for(let[r,f]of Object.entries(e.kinds)){let l=R(f);t.set(r,{fields:new Set(Object.keys(f.fields)),edges:new Map(Object.entries(f.edges??{}).map(([p,a])=>[p,a.cardinality??"many"])),...l?{computed:l}:{}})}let i=R(e);return i&&t.set(B,{computed:i}),t}function ie(e,t){let i=[],r=P(e.on),f=(l,p)=>{let a=se(t.kinds,l,r)?.reversed===!0,[o,s]=a?["$to","$subject"]:["$subject","$to"];return p==="connect"?{connect:l,from:o,to:s}:{sever:l,from:o,to:s}};if(e.creates){let l=t.kinds[e.creates],p={};for(let a of Object.keys(l?.fields??{}))p[a]=`$${a}`;for(let a of e.effects??[])"set"in a&&!("create"in a)&&b(a.target)==="new"&&Object.assign(p,a.set);i.push({create:e.creates,as:"new",set:p})}return e.sets&&i.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&i.push({set:Object.fromEntries(e.writes.map(l=>[l,`$${l}`]))}),e.connects&&(e.replaces&&i.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),i.push(f(e.connects,"connect"))),e.severs&&i.push(f(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(l=>!(e.creates&&"set"in l&&!("create"in l)&&b(l.target)==="new"))),i}function C(e,t,i){try{let r=E(e),f=M(r);for(let l of f.unknownFunctions)i.push(u("unknown-function",t,`"${l}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return r}catch(r){if(r instanceof K){i.push(u("expression",t,r.sentence+` (at character ${r.at+1})`));return}throw r}}function N(e,t,i){try{return F(e)}catch(r){if(r instanceof Y||r instanceof K){i.push(u("template",t,(r instanceof K,r.sentence)));return}throw r}}function le(e){let t=[],i=new Set(Object.keys(e.kinds)),r=re(e),f=e.acts??{},l=new Set(e.roles??[]);for(let[a,o]of Object.entries(e.kinds)){let s=`kinds.${a}`;for(let[d,$]of Object.entries(o.edges??{})){if($.to!=="*")for(let n of $.to)i.has(n)||t.push(u("edge-target",`${s}.edges.${d}.to`,`"${n}" is not a kind this document declares`));o.fields[d]&&t.push(u("edge-field-clash",`${s}.edges.${d}`,`"${d}" is both a field and a relation of ${a}`,"rename one of them"))}o.lifecycle&&!o.fields[o.lifecycle.field]&&t.push(u("lifecycle-field",`${s}.lifecycle.field`,`${a} has no field "${o.lifecycle.field}"`));let c=d=>o.computed!==void 0&&Object.hasOwn(o.computed,d);for(let d of o.glance??[])!o.fields[d]&&!c(d)&&t.push(u("glance-field",`${s}.glance`,`a glance at ${a} is to say "${d}", and ${a} has no field or computed field called that`,`use one of: ${[...Object.keys(o.fields),...Object.keys(o.computed??{})].join(", ")}`));t.push(...oe(a,o));for(let d of["label","describe"]){let $=o[d];if(!$)continue;let n=N($,`${s}.${d}`,t);for(let m of n??[])if(m.expr){for(let y of M(m.expr).names)if(!o.fields[y]){if(c(y)){ne(o,y)||t.push(u("template-field",`${s}.${d}`,`${a}'s ${y} is worked out from beyond the record, and a ${d} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${a}'s own fields`));continue}t.push(u("template-field",`${s}.${d}`,`${a} has no field "${y}" for its ${d} to show`,d==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[d,$]of Object.entries(o.fields))$.default!==void 0&&$.type==="enum"&&!$.options?.includes(String($.default))&&t.push(u("default-option",`${s}.fields.${d}.default`,`"${String($.default)}" is not one of ${d}'s options`))}for(let[a,o]of Object.entries(f)){let s=`acts.${a}`;for(let n of P(o.on))i.has(n)||t.push(u("act-kind",`${s}.on`,`"${n}" is not a kind this document declares`));let c=P(o.on),d=ie(o,e);if(o.creates&&o.on===void 0&&o.writes&&i.has(o.creates))for(let n of o.writes)e.kinds[o.creates].fields[n]||(e.kinds[o.creates].computed?.[n]!==void 0?t.push(u("computed-written",`${s}.writes`,`${o.creates}'s ${n} 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`,`${o.creates} has no field "${n}"`)));d.length===0&&t.push(u("act-empty",s,`"${a}" does nothing`,"give it effects or a shorthand such as sets or creates"));let $=new Map;d.forEach((n,m)=>{let y=d.length-(o.effects?.length??0),w=o.effects&&m>=y?`${s}.effects.${m-y}`:s;if("create"in n){if(!i.has(n.create))t.push(u("act-kind",`${w}.create`,`"${n.create}" is not a kind this document declares`));else for(let h of Object.keys(n.set??{}))e.kinds[n.create].fields[h]||(e.kinds[n.create].computed?.[h]!==void 0?t.push(u("computed-written",`${w}.set.${h}`,`${n.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",`${w}.set.${h}`,`${n.create} has no field "${h}"`)));n.as&&$.set(n.as,n.create)}else if("connect"in n||"sever"in n){let h="connect"in n?n.connect:n.sever;r.has(h)||t.push(u("act-edge",`${w}.${"connect"in n?"connect":"sever"}`,`"${h}" is not a relation any kind declares`)),b(n.from)==="subject"&&c.length===0&&t.push(u("act-subject",`${s}.on`,`"${a}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in n){let h=b(n.target??"$subject"),O=h==="subject"?c:$.has(h??"")?[$.get(h)]:[];h==="subject"&&c.length===0&&t.push(u("act-subject",`${s}.on`,`"${a}" changes "$subject" but does not say which kinds it is "on"`));for(let S of Object.keys(n.set))for(let x of O)!i.has(x)||e.kinds[x].fields[S]||(e.kinds[x].computed?.[S]!==void 0?t.push(u("computed-written",`${w}.set.${S}`,`${x}'s ${S} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):t.push(u("act-field",`${w}.set.${S}`,`${x} has no field "${S}"`)))}else"remove"in n&&b(n.remove)==="subject"&&c.length===0&&t.push(u("act-subject",`${s}.on`,`"${a}" removes "$subject" but does not say which kinds it is "on"`));("set"in n&&n.set?Object.values(n.set):[]).forEach(h=>{h&&typeof h=="object"&&!Array.isArray(h)&&"expr"in h&&C(h.expr,`${w}.set`,t)})}),o.allowedWhen&&C(o.allowedWhen,`${s}.allowedWhen`,t),o.refusal&&N(o.refusal,`${s}.refusal`,t)}for(let[a,o]of Object.entries(e.rules??{})){let s=`rules.${a}`;o.over!=="graph"&&!i.has(o.over)&&t.push(u("rule-kind",`${s}.over`,`"${o.over}" is not a kind this document declares`));let c=o.over==="graph"?void 0:e.kinds[o.over];for(let d of["when","require"]){let $=o[d];if(!$)continue;let n=C($,`${s}.${d}`,t);if(!n)continue;let m=M(n);for(let y of m.names)if(o.over==="graph")t.push(u("rule-name",`${s}.${d}`,`"${y}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(c&&!c.fields[y]&&!c.edges?.[y]&&c.computed?.[y]===void 0){let w=Object.keys(c.edges??{}).find(v=>v.includes("-")&&v.split("-").includes(y));t.push(u("rule-name",`${s}.${d}`,`${o.over} has no field or relation called "${y}"`,w?`"${w}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${w.replace(/-([a-z0-9])/g,(v,h)=>h.toUpperCase())}"`:void 0))}for(let y of m.edges)r.has(y)||t.push(u("rule-edge",`${s}.${d}`,`"${y}" is not a relation any kind declares`));for(let y of m.sweeps)i.has(y)?o.over!=="graph"&&t.push(I("rule-cost",`${s}.${d}`,`this rule looks at every ${y} for every ${o.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}.${d}`,`"${y}" is not a kind this document declares`))}o.says&&N(o.says,`${s}.says`,t),(o.repairs??[]).forEach((d,$)=>{!f[d.act]&&!/^(edit|remove)-/.test(d.act)&&t.push(u("repair-act",`${s}.repairs.${$}.act`,`"${d.act}" is not an act this document declares`))})}let p=e.policy;return p&&(p.grants.forEach((a,o)=>{if(a.roles!=="*"&&l.size>0)for(let s of a.roles)l.has(s)||t.push(u("grant-role",`policy.grants.${o}.roles`,`"${s}" is not one of the document's roles`));if(a.mutations!=="*")for(let s of a.mutations)!f[s]&&!/^(edit|remove)-/.test(s)&&t.push(u("grant-act",`policy.grants.${o}.mutations`,`"${s}" is not an act this document declares`))}),(p.sees??[]).forEach((a,o)=>{for(let s of a.kinds)i.has(s)||t.push(u("sight-kind",`policy.sees.${o}.kinds`,`"${s}" is not a kind this document declares`));if(a.roles!=="*"&&l.size>0)for(let s of a.roles)l.has(s)||t.push(u("sight-role",`policy.sees.${o}.roles`,`"${s}" is not one of the document's roles`))})),t.push(...ee(e)),t}function ue(e,t,i,r){let f=new Map,l=P(e.on),p=new Map,a=new Map;(l.length>0||t.some(n=>"remove"in n&&b(n.remove)==="subject"||"from"in n&&(b(n.from)==="subject"||b(n.to)==="subject")||"set"in n&&!("create"in n)&&b(n.target??"$subject")==="subject"))&&f.set(q,{ref:l.length>0?l:"*",required:!0});let s=e.args??{},c=e.writes?.length===1,d=(n,m)=>m&&n.type===m.type&&n.min===void 0&&n.max===void 0&&n.step===void 0?{...n,...m.min===void 0?{}:{min:m.min},...m.max===void 0?{}:{max:m.max},...m.step===void 0?{}:{step:m.step}}:n,$=(n,m,y)=>{if(n===q||de.has(n)||p.has(n)||f.has(n))return;let w=s[n]?d(s[n],y):void 0;f.set(n,w?{field:w,optional:!w.required,required:!!w.required}:m())};for(let n of t)if("create"in n){let m=i.kinds[n.create];for(let[y,w]of Object.entries(n.set??{})){let v=b(w),h=m?.fields[y];if(v&&h){let O=!!h.required&&h.default===void 0;$(v,()=>({field:h,optional:!O,required:O}),h)}}n.as&&p.set(n.as,n.create)}else if("connect"in n||"sever"in n){let m=r.get("connect"in n?n.connect:n.sever);for(let[y,w]of[["from",n.from],["to",n.to]]){let v=b(w);if(!v)continue;let h=y==="to"?m?.to??"*":m?.from??"*";h!=="*"&&!a.has(v)&&a.set(v,h),$(v,()=>({ref:h,required:!0}))}}else if("set"in n){let m=b(n.target??"$subject"),y=m==="subject"?l[0]:p.get(m??"")??a.get(m??"")?.[0];m&&m!=="subject"&&!p.has(m)&&$(m,()=>({ref:"*",required:!0}));for(let[w,v]of Object.entries(n.set)){let h=b(v);if(!h)continue;let O=y?i.kinds[y]?.fields[w]:void 0;$(h,()=>O?{field:O,optional:!c,required:c}:{any:!0,required:!1},O)}}else if("remove"in n){let m=b(n.remove);m&&$(m,()=>({ref:"*",required:!0}))}for(let[n,m]of Object.entries(s))f.has(n)||f.set(n,{field:m,optional:!m.required,required:!!m.required});return f}function qe(e,t={}){let i=fe(e);if(!i.document||G(i.findings))return{ok:!1,findings:i.findings};let r=i.document,f=[...i.findings];t.previous&&f.push(...ge(r,t.previous));let l=pe(r,f);return G(l.findings)?{ok:!1,findings:l.findings}:J(l,t)}function pe(e,t){let i=re(e),r={};for(let[s,c]of Object.entries(e.kinds)){let d=z(c),$=c.label??(d?`{${d}}`:void 0),n=R(c);r[s]={...$?{label:F($)}:{},...c.describe?{describe:F(c.describe)}:{},...n?{computed:[...n]}:{}}}let f={};for(let[s,c]of Object.entries(e.acts??{})){let d=ie(c,e),$=ue(c,d,e,i),n=c.destructive??d.some(g=>"remove"in g||"sever"in g||"replace"in g),m=[...new Set(d.flatMap(g=>"create"in g?[g.create]:[]))],y=[...new Set(d.flatMap(g=>"connect"in g?[g.connect]:[]))],w=[...new Set(d.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],v=[...new Set(d.flatMap(g=>"set"in g&&!("create"in g)&&b(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],h=new Map;for(let g of d){if(!("connect"in g)&&!("sever"in g))continue;let k=i.get("connect"in g?g.connect:g.sever);for(let[j,ae]of[["from",g.from],["to",g.to]]){let D=b(ae),T=j==="to"?k?.to:k?.from;D&&D!=="subject"&&T&&T!=="*"&&h.set(D,[...new Set([...h.get(D)??[],...T])])}}let O={};for(let g of d){if(!("set"in g)||"create"in g)continue;let k=b(g.target??"$subject");for(let j of k&&k!=="subject"&&h.get(k)||[])O[j]=[...new Set([...O[j]??[],...Object.keys(g.set)])]}let S={};for(let g of d)if(!(!("set"in g)||"create"in g||b(g.target??"$subject")!=="subject"))for(let[k,j]of Object.entries(g.set??{}))typeof j=="string"&&b(j)===void 0||typeof j=="number"||typeof j=="boolean"?S[k]=typeof j=="string"&&j.startsWith("$$")?j.slice(1):j:delete S[k];let x=m.length===0&&d.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(k=>!(k&&typeof k=="object"&&!Array.isArray(k)&&"expr"in k))),_=new Map;for(let g of d)if(!(!("set"in g)||!g.set))for(let k of Object.values(g.set))k&&typeof k=="object"&&!Array.isArray(k)&&"expr"in k&&_.set(k.expr,E(k.expr));f[s]={title:c.title??s.replace(/-/g," "),effects:d,args:[...$],...c.allowedWhen?{guard:E(c.allowedWhen)}:{},...c.refusal?{refusal:F(c.refusal)}:{},exprs:[..._],destructive:n,idempotent:x,creates:m,connects:y,severs:w,writes:v,writesOther:O,sets:S}}let l={};for(let[s,c]of Object.entries(e.rules??{}))l[s]={title:c.title??s.replace(/-/g," "),require:E(c.require),...c.when?{when:E(c.when)}:{},...c.says?{says:F(c.says)}:{}};let p=V(e,t),a=Q(e),o=Z(e);return{format:W,document:e,findings:t,kinds:r,...e.computed?{facts:[...R(e)??[]]}:{},edges:[...i].map(([s,{from:c,to:d,cardinality:$}])=>[s,{from:c,to:d,cardinality:$}]),acts:f,rules:l,brand:p,...Object.keys(a).length>0?{viewSpecs:a}:{},...o?{home:o}:{}}}function Ce(e,t){let i=e.split(/[\s:·]/).find(r=>r.length>0)??e;return t.kinds[i]?`kinds.${i}`:t.acts?.[i]?`acts.${i}`:t.rules?.[i]?`rules.${i}`:e}function Ne(e,t,i){let r=/^defineNode\("([^"]+)"\)/.exec(t)?.[1],f=r?i.kinds[r]:void 0;if(!r||!f)return e;let l=Object.keys(f.fields).filter(p=>p!=="label").slice(0,3);return{...e,path:`kinds.${r}.glance`,fix:`Say which: "glance": [${l.map(p=>`"${p}"`).join(", ")}] on kinds.${r} \u2014 the facts a person compares one by, at a glance.`}}function ge(e,t){let i=[],r=new Set(Object.values(t.kinds).flatMap(f=>Object.keys(f.edges??{})));for(let[f,l]of Object.entries(e.kinds)){let p=l.renamedFrom;p&&!t.kinds[p]&&i.push(u("renamed-from-nothing",`kinds.${f}.renamedFrom`,`${f} says it was ${p}, and the previous version has no kind called ${p}`,"name the kind it was, or drop renamedFrom"));let a=t.kinds[p??f];for(let[o,s]of Object.entries(l.fields)){let c=s.renamedFrom;c&&!a?.fields[c]&&i.push(u("renamed-from-nothing",`kinds.${f}.fields.${o}.renamedFrom`,`${o} says it was ${c}, and the previous ${p??f} has no field called ${c}`,"name the field it was, or drop renamedFrom"))}for(let[o,s]of Object.entries(l.edges??{})){let c=s.renamedFrom;c&&!r.has(c)&&i.push(u("renamed-from-nothing",`kinds.${f}.edges.${o}.renamedFrom`,`${o} says it was ${c}, and the previous version has no relation called ${c}`,"name the relation it was, or drop renamedFrom"))}}return i}export{fe as a,Ge as b,ie as c,qe as d,Ce as e,Ne as f};
@@ -1 +1 @@
1
- import{a as I,c as x}from"./chunk.AXACXB4D.js";import"./chunk.TWGB347L.js";import"./chunk.AKOC43TV.js";import"./chunk.D3CYTXNZ.js";import"./chunk.MYCTNK6D.js";import"./chunk.AHDOKM4O.js";import{C as G,c as b,d as A,j as v,x as w,z as O}from"./chunk.2VX6H2LL.js";import{Oa as S,Ob as W,ya as k,za as E}from"./chunk.ZQ4HFIIS.js";import"./chunk.MRK6QJV5.js";import"./chunk.AJZBJBMO.js";var F=(e,i)=>S(e,i).slice(1);function j(e,i){let l=e.split("/").filter(Boolean);return l.length===i.length&&l.every((s,h)=>s.startsWith(":")||s==="*"||s===i[h])}var $=["problems","search","map","places"];function R(e,i,l,s,h=[]){let{schema:r}=i,o=r.kinds,f=t=>{if(t.startsWith(w))return(t.slice(w.length).split("|")[0]??"").split("+").every(V=>o.includes(V));let y=O(t);return y!==null?o.includes(y):t.startsWith("edge:")||l.graph.getNode(t)!==void 0},[p="/",u]=e.path.split("?"),n=p.split("/").filter(Boolean),m=u?`?${u}`:"",d=n.length>0&&!$.includes(n[0])?o.find(t=>F(r,t)===n[0]):void 0,c=e.path;if(n[0]==="places"&&n.length===2)`/places/${n[1]}`!==W&&!s.some(t=>t.as===decodeURIComponent(n[1]))&&(c="/");else if(d){let t=n[1]===void 0?void 0:decodeURIComponent(n[1]);c=`/${F(r,d)}${t!==void 0&&l.graph.getNode(t)?.kind===d?`/${n[1]}`:""}${m}`}else n.length>0&&n.length<=2&&!$.includes(n[0])&&!h.some(t=>j(t.path,n))&&(c="/");let g=A(e.stop),P=g.within?.view,U=P!==void 0&&!s.some(t=>t.as===P),a=g;if(U){let{view:t,...y}=g.within??{};a={...a,within:y}}if(g.focusId&&!f(g.focusId)){let t=e.kind&&o.includes(e.kind)?G(e.kind):null;a={...v(a,t),zoom:!1}}return a={...a,relation:a.relation&&(o.includes(a.relation)||r.edgeKinds.includes(a.relation))?a.relation:null,expanded:a.expanded.filter(f),pins:Object.fromEntries(Object.entries(a.pins).filter(([t])=>f(t))),...a.selection?{selection:a.selection.filter(f)}:{}},{face:e.face,path:c,stop:b(a),...e.kind?{kind:e.kind}:{}}}function B(e,i,l){let s=e.at,h=e.pages?.routes()??[];if(e.routing!=="address"||typeof window>"u")return R(s,e.app,i,l,h);let{pathname:r,search:o,hash:f}=window.location,p=E(r,e.basePath),u=I({routing:"address",...e.basePath===void 0?{}:{basePath:e.basePath},face:s.face}),n=u==="pages",m={...s,face:u,...p===null?{}:n?{path:p+o}:{stop:x(e.basePath)??s.stop}},d=R(m,e.app,i,l,h),c=n?d.path===m.path?null:k(d.path,e.basePath===void 0?{}:{basePath:e.basePath}):d.stop===b(A(m.stop))?null:r+o+d.stop;return p!==null&&c!==null&&c!==r+o+f&&window.history.replaceState(window.history.state,"",c),d}export{R as settle,B as settleAt};
1
+ import{a as I,c as x}from"./chunk.JIXW4WIO.js";import"./chunk.T6KID3WO.js";import"./chunk.6DU4XN2F.js";import"./chunk.MJ67MK4R.js";import"./chunk.US4KIJSW.js";import"./chunk.AHDOKM4O.js";import{C as G,c as b,d as A,j as v,x as w,z as O}from"./chunk.2WFEFZAW.js";import{Ja as S,Qb as W,oa as k,pa as E}from"./chunk.RAE4M3KQ.js";import"./chunk.MRK6QJV5.js";import"./chunk.AJZBJBMO.js";var F=(e,i)=>S(e,i).slice(1);function j(e,i){let l=e.split("/").filter(Boolean);return l.length===i.length&&l.every((s,h)=>s.startsWith(":")||s==="*"||s===i[h])}var $=["problems","search","map","places"];function R(e,i,l,s,h=[]){let{schema:r}=i,o=r.kinds,f=t=>{if(t.startsWith(w))return(t.slice(w.length).split("|")[0]??"").split("+").every(V=>o.includes(V));let y=O(t);return y!==null?o.includes(y):t.startsWith("edge:")||l.graph.getNode(t)!==void 0},[p="/",u]=e.path.split("?"),n=p.split("/").filter(Boolean),m=u?`?${u}`:"",d=n.length>0&&!$.includes(n[0])?o.find(t=>F(r,t)===n[0]):void 0,c=e.path;if(n[0]==="places"&&n.length===2)`/places/${n[1]}`!==W&&!s.some(t=>t.as===decodeURIComponent(n[1]))&&(c="/");else if(d){let t=n[1]===void 0?void 0:decodeURIComponent(n[1]);c=`/${F(r,d)}${t!==void 0&&l.graph.getNode(t)?.kind===d?`/${n[1]}`:""}${m}`}else n.length>0&&n.length<=2&&!$.includes(n[0])&&!h.some(t=>j(t.path,n))&&(c="/");let g=A(e.stop),P=g.within?.view,U=P!==void 0&&!s.some(t=>t.as===P),a=g;if(U){let{view:t,...y}=g.within??{};a={...a,within:y}}if(g.focusId&&!f(g.focusId)){let t=e.kind&&o.includes(e.kind)?G(e.kind):null;a={...v(a,t),zoom:!1}}return a={...a,relation:a.relation&&(o.includes(a.relation)||r.edgeKinds.includes(a.relation))?a.relation:null,expanded:a.expanded.filter(f),pins:Object.fromEntries(Object.entries(a.pins).filter(([t])=>f(t))),...a.selection?{selection:a.selection.filter(f)}:{}},{face:e.face,path:c,stop:b(a),...e.kind?{kind:e.kind}:{}}}function B(e,i,l){let s=e.at,h=e.pages?.routes()??[];if(e.routing!=="address"||typeof window>"u")return R(s,e.app,i,l,h);let{pathname:r,search:o,hash:f}=window.location,p=E(r,e.basePath),u=I({routing:"address",...e.basePath===void 0?{}:{basePath:e.basePath},face:s.face}),n=u==="pages",m={...s,face:u,...p===null?{}:n?{path:p+o}:{stop:x(e.basePath)??s.stop}},d=R(m,e.app,i,l,h),c=n?d.path===m.path?null:k(d.path,e.basePath===void 0?{}:{basePath:e.basePath}):d.stop===b(A(m.stop))?null:r+o+d.stop;return p!==null&&c!==null&&c!==r+o+f&&window.history.replaceState(window.history.state,"",c),d}export{R as settle,B as settleAt};
@@ -1 +1 @@
1
- import{Aa as G,Ba as F,Ca as v,Ea as q,Fa as W,H as x,Ha as T,I as R,Ia as A,Ja as h,Ka as k,L as O,Ua as j,Va as B}from"./chunk.ZQ4HFIIS.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
+ import{Aa as W,Ca as T,Da as A,Ea as h,Fa as k,I as x,J as R,M as O,Pa as j,Qa as B,va as G,wa as F,xa as v,za as q}from"./chunk.RAE4M3KQ.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 +1 @@
1
- import{c as L}from"./chunk.RGXNZ7PN.js";import{a as R,b as O,c as v,d as P}from"./chunk.ONDILMIX.js";import"./chunk.VLNI5U6H.js";import"./chunk.AKOC43TV.js";import{a as E,b as T}from"./chunk.MYCTNK6D.js";import"./chunk.53RZI5PM.js";import"./chunk.XJNXSQT4.js";import"./chunk.VTBAKTFP.js";import"./chunk.7U7Q3HIS.js";import"./chunk.6O67NOZR.js";import"./chunk.WWRWXFYR.js";import"./chunk.ISAMJ7AK.js";import"./chunk.54NSG7BX.js";import"./chunk.6KJSFIO7.js";import"./chunk.UM5IPM22.js";import"./chunk.6XBLDV4A.js";import"./chunk.WOTNMTIY.js";import"./chunk.HAQ4KHRY.js";import"./chunk.PRXKRG6O.js";import"./chunk.AHDOKM4O.js";import"./chunk.TDW6QEG4.js";import"./chunk.LW7KV5SL.js";import{va as x}from"./chunk.2VX6H2LL.js";import{xb as k}from"./chunk.ZQ4HFIIS.js";import{a as D,b as C}from"./chunk.MRK6QJV5.js";import{b as S}from"./chunk.AJZBJBMO.js";var o=S(D(),1);var i=S(C(),1);function W(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let r=c??document,a=r.querySelector("main")??r.querySelector("[data-graview-page]")??null,n=r.querySelector("[data-graview-page-title]")??a?.querySelector("h1, h2")??a;n instanceof HTMLElement&&(n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus({preventScroll:!0}))}var H=1500;function z(c,e,r){let{store:a,principal:n}=c,u=L(a),l=(0,o.useMemo)(()=>R(a,n),[a,n,u]),b=(0,o.useRef)(r),[p,m]=(0,o.useState)(),[s,f]=(0,o.useState)("");(0,o.useEffect)(()=>{let t=O(a,n,b.current);b.current=a.batches().length,t&&(m({batch:t.batch,at:e,when:Date.now()}),f(""))},[a,n,u]),(0,o.useEffect)(()=>{m(t=>!t||t.at===e?t:Date.now()-t.when<H?{...t,at:e}:void 0)},[e]);let[g,h]=(0,o.useState)(null),y=(0,o.useCallback)(()=>{m(void 0),h(null)},[]),w=(0,o.useCallback)(()=>{h(null);try{let t=P(a,n);t&&f(`Took back \u201C${t.intent}\u201D`)}catch(t){h(t instanceof Error?t.message:String(t))}},[a,n]),d=l&&p?.batch===l.batch&&p.at===e?l:void 0;return{change:l,offered:d,close:y,takeBack:w,refused:g,said:s}}function Y({context:c,docked:e,at:r,since:a}){let{change:n,offered:u,close:l,takeBack:b,refused:p,said:m}=z(c,r,a),s=e?u:n,f=(0,o.useRef)(null),g=e&&(s!==void 0||p!==null);B(f,g),(0,o.useEffect)(()=>{if(!g)return;let d,t=()=>d=setTimeout(()=>f.current?.matches(":hover, :focus-within")?t():l(),1e4);return t(),()=>clearTimeout(d)},[g,s?.batch,p,l]);let h=m||(e&&s?v(s):""),y=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:k("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...g?{}:{display:"none"}}:{},w=s?(0,i.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${v(s)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");b(),requestAnimationFrame(()=>W(t))},style:e?I:A,children:[(0,i.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),(0,i.jsx)("span",{style:e?j:F,children:v(s)})]}):null;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{role:"status","aria-live":"polite",style:N,children:h}),(0,i.jsxs)("div",{ref:f,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",style:{display:"grid",justifyItems:"end",gap:4,maxWidth:"100%",minWidth:0,...y},children:[e&&s?(0,i.jsxs)("div",{"data-testid":"page-undo-notice",style:_,children:[w,(0,i.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${v(s)}`,title:"Dismiss",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");l(),requestAnimationFrame(()=>W(t))},style:q,children:"\xD7"})]}):w,p?(0,i.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",background:e?"var(--graview-float)":void 0,padding:e?"4px 8px":void 0,borderRadius:6},children:p}):null]})]})}function B(c,e){(0,o.useLayoutEffect)(()=>{let r=c.current;if(!r||!e)return;if(typeof r.showPopover=="function"&&!x(r))try{r.showPopover()}catch{}let a=()=>r.parentElement?.closest("[data-embed-content]")??null,n=()=>{T(r,a()),dispatchEvent(new Event(E))};n(),addEventListener("resize",n),addEventListener("scroll",n,!0);let u=typeof ResizeObserver=="function"?new ResizeObserver(n):null;return u?.observe(r),()=>{if(u?.disconnect(),removeEventListener("resize",n),removeEventListener("scroll",n,!0),r.isConnected&&x(r))try{r.hidePopover()}catch{}dispatchEvent(new Event(E))}},[c,e])}var A={display:"inline-flex",alignItems:"center",gap:6,minHeight:36,maxWidth:"100%",minWidth:0,padding:"0 14px",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",font:"inherit",fontSize:"0.875rem",cursor:"pointer"},I={...A,textAlign:"start",lineHeight:1.4,padding:"8px 4px 8px 14px",border:"none",background:"none",color:"inherit"},_={display:"flex",alignItems:"center",gap:2,maxWidth:"100%",minWidth:0,paddingRight:6,borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},q={flex:"0 0 auto",minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"1rem",cursor:"pointer"},F={minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},j={minWidth:0,overflow:"hidden",overflowWrap:"anywhere",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:4},N={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};export{Y as TakeBack};
1
+ import{c as L}from"./chunk.F26676IW.js";import{a as R,b as O,c as v,d as P}from"./chunk.ONDILMIX.js";import"./chunk.G3BOZHKR.js";import"./chunk.6DU4XN2F.js";import{a as E,b as T}from"./chunk.US4KIJSW.js";import"./chunk.LHFEOEYY.js";import"./chunk.U6BWYBPM.js";import"./chunk.QOYC424P.js";import"./chunk.B57EIGTS.js";import"./chunk.2YVXTTC2.js";import"./chunk.WWRWXFYR.js";import"./chunk.BJ2Y5F66.js";import"./chunk.A4SJ7EEY.js";import"./chunk.6KJSFIO7.js";import"./chunk.DEZEXD24.js";import"./chunk.YZZGD5OY.js";import"./chunk.DSZ3I557.js";import"./chunk.SSOTDXRS.js";import"./chunk.ZRVDIVYY.js";import"./chunk.AHDOKM4O.js";import"./chunk.PY42PBMB.js";import"./chunk.JCZH55RX.js";import{va as x}from"./chunk.2WFEFZAW.js";import{zb as k}from"./chunk.RAE4M3KQ.js";import{a as D,b as C}from"./chunk.MRK6QJV5.js";import{b as S}from"./chunk.AJZBJBMO.js";var o=S(D(),1);var i=S(C(),1);function W(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let r=c??document,a=r.querySelector("main")??r.querySelector("[data-graview-page]")??null,n=r.querySelector("[data-graview-page-title]")??a?.querySelector("h1, h2")??a;n instanceof HTMLElement&&(n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus({preventScroll:!0}))}var H=1500;function z(c,e,r){let{store:a,principal:n}=c,u=L(a),l=(0,o.useMemo)(()=>R(a,n),[a,n,u]),b=(0,o.useRef)(r),[p,m]=(0,o.useState)(),[s,f]=(0,o.useState)("");(0,o.useEffect)(()=>{let t=O(a,n,b.current);b.current=a.batches().length,t&&(m({batch:t.batch,at:e,when:Date.now()}),f(""))},[a,n,u]),(0,o.useEffect)(()=>{m(t=>!t||t.at===e?t:Date.now()-t.when<H?{...t,at:e}:void 0)},[e]);let[g,h]=(0,o.useState)(null),y=(0,o.useCallback)(()=>{m(void 0),h(null)},[]),w=(0,o.useCallback)(()=>{h(null);try{let t=P(a,n);t&&f(`Took back \u201C${t.intent}\u201D`)}catch(t){h(t instanceof Error?t.message:String(t))}},[a,n]),d=l&&p?.batch===l.batch&&p.at===e?l:void 0;return{change:l,offered:d,close:y,takeBack:w,refused:g,said:s}}function Y({context:c,docked:e,at:r,since:a}){let{change:n,offered:u,close:l,takeBack:b,refused:p,said:m}=z(c,r,a),s=e?u:n,f=(0,o.useRef)(null),g=e&&(s!==void 0||p!==null);B(f,g),(0,o.useEffect)(()=>{if(!g)return;let d,t=()=>d=setTimeout(()=>f.current?.matches(":hover, :focus-within")?t():l(),1e4);return t(),()=>clearTimeout(d)},[g,s?.batch,p,l]);let h=m||(e&&s?v(s):""),y=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:k("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...g?{}:{display:"none"}}:{},w=s?(0,i.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${v(s)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");b(),requestAnimationFrame(()=>W(t))},style:e?I:A,children:[(0,i.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),(0,i.jsx)("span",{style:e?j:F,children:v(s)})]}):null;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{role:"status","aria-live":"polite",style:N,children:h}),(0,i.jsxs)("div",{ref:f,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",style:{display:"grid",justifyItems:"end",gap:4,maxWidth:"100%",minWidth:0,...y},children:[e&&s?(0,i.jsxs)("div",{"data-testid":"page-undo-notice",style:_,children:[w,(0,i.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${v(s)}`,title:"Dismiss",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");l(),requestAnimationFrame(()=>W(t))},style:q,children:"\xD7"})]}):w,p?(0,i.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",background:e?"var(--graview-float)":void 0,padding:e?"4px 8px":void 0,borderRadius:6},children:p}):null]})]})}function B(c,e){(0,o.useLayoutEffect)(()=>{let r=c.current;if(!r||!e)return;if(typeof r.showPopover=="function"&&!x(r))try{r.showPopover()}catch{}let a=()=>r.parentElement?.closest("[data-embed-content]")??null,n=()=>{T(r,a()),dispatchEvent(new Event(E))};n(),addEventListener("resize",n),addEventListener("scroll",n,!0);let u=typeof ResizeObserver=="function"?new ResizeObserver(n):null;return u?.observe(r),()=>{if(u?.disconnect(),removeEventListener("resize",n),removeEventListener("scroll",n,!0),r.isConnected&&x(r))try{r.hidePopover()}catch{}dispatchEvent(new Event(E))}},[c,e])}var A={display:"inline-flex",alignItems:"center",gap:6,minHeight:36,maxWidth:"100%",minWidth:0,padding:"0 14px",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",font:"inherit",fontSize:"0.875rem",cursor:"pointer"},I={...A,textAlign:"start",lineHeight:1.4,padding:"8px 4px 8px 14px",border:"none",background:"none",color:"inherit"},_={display:"flex",alignItems:"center",gap:2,maxWidth:"100%",minWidth:0,paddingRight:6,borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},q={flex:"0 0 auto",minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"1rem",cursor:"pointer"},F={minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},j={minWidth:0,overflow:"hidden",overflowWrap:"anywhere",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:4},N={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};export{Y as TakeBack};
@@ -1 +1 @@
1
- import{b as W}from"./chunk.TWGB347L.js";import{C as R,b as A,c as T,d as v,e as f,f as x,j as I,m as b,ra as k}from"./chunk.2VX6H2LL.js";import{Ob as s,ya as y,za as r}from"./chunk.ZQ4HFIIS.js";import{a as H}from"./chunk.MRK6QJV5.js";import{b as B}from"./chunk.AJZBJBMO.js";var u=B(H(),1),L=e=>typeof e=="object"&&e!==null&&"idx"in e;function E(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":L(window.history.state)?"pages":null}function J(e){let n=e.face??(e.stop&&v(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:E(e.basePath)??n}function K(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&E(e.basePath)===null}function Q(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?T(f(window.location.hash)):void 0}function X({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:U,places:w,opens:$}){let{view:F,go:p}=k(),g=(0,u.useRef)({shown:t,view:F,onFace:i});g.current={shown:t,view:F,onFace:i};let S=(0,u.useRef)(n??"/"),M=()=>{S.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:N,onFace:V}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",y(c??S.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){M();let m=a===void 0?N:j(v(a),w),h=Y(m)?q($):m,O=h!==m&&h.overview?"graview":o,P=_(O,h,U);p(P),window.history.pushState(null,"",`${y(s,{basePath:e})}${x(P)}`),V?.(O);return}V?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=E(e)??"pages",{shown:a,onFace:d}=g.current;if(c==="pages"){a!=="pages"&&d?.("pages");return}a==="pages"&&(p(j(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function j(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:R(i.kind)}:e}function _(e,n,t){return e==="graview"?b(n,!0):n.overview?I(b(n,!1),W(n,t)):n}function Y(e){return e.focusId===null&&e.overview!==!0}function q(e){return e??{...A,overview:!0}}export{J as a,K as b,Q as c,X as d,j as e,_ as f,Y as g,q as h};
1
+ import{b as W}from"./chunk.T6KID3WO.js";import{C as R,b as A,c as T,d as v,e as f,f as x,j as I,m as b,ra as k}from"./chunk.2WFEFZAW.js";import{Qb as s,oa as y,pa as r}from"./chunk.RAE4M3KQ.js";import{a as H}from"./chunk.MRK6QJV5.js";import{b as B}from"./chunk.AJZBJBMO.js";var u=B(H(),1),L=e=>typeof e=="object"&&e!==null&&"idx"in e;function E(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":L(window.history.state)?"pages":null}function J(e){let n=e.face??(e.stop&&v(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:E(e.basePath)??n}function K(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&E(e.basePath)===null}function Q(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?T(f(window.location.hash)):void 0}function X({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:U,places:w,opens:$}){let{view:F,go:p}=k(),g=(0,u.useRef)({shown:t,view:F,onFace:i});g.current={shown:t,view:F,onFace:i};let S=(0,u.useRef)(n??"/"),M=()=>{S.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:N,onFace:V}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",y(c??S.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){M();let m=a===void 0?N:j(v(a),w),h=Y(m)?q($):m,O=h!==m&&h.overview?"graview":o,P=_(O,h,U);p(P),window.history.pushState(null,"",`${y(s,{basePath:e})}${x(P)}`),V?.(O);return}V?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=E(e)??"pages",{shown:a,onFace:d}=g.current;if(c==="pages"){a!=="pages"&&d?.("pages");return}a==="pages"&&(p(j(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function j(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:R(i.kind)}:e}function _(e,n,t){return e==="graview"?b(n,!0):n.overview?I(b(n,!1),W(n,t)):n}function Y(e){return e.focusId===null&&e.overview!==!0}function q(e){return e??{...A,overview:!0}}export{J as a,K as b,Q as c,X as d,j as e,_ as f,Y as g,q as h};
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i}from"./chunk.ORJ3T4IW.js";import"./chunk.BJ2Y5F66.js";import"./chunk.A4SJ7EEY.js";import"./chunk.6KJSFIO7.js";import"./chunk.DEZEXD24.js";import"./chunk.YZZGD5OY.js";import"./chunk.DSZ3I557.js";import"./chunk.RAE4M3KQ.js";import"./chunk.AJZBJBMO.js";export{f as columnActs,c as columnMoves,b as columnOf,d as columnReach,e as columnSteps,h as describePlace,i as placeText,g as resolveFor,a as statusColumns};
@@ -1,4 +1,4 @@
1
- import{c as E,d as I}from"./chunk.XJNXSQT4.js";import"./chunk.TDW6QEG4.js";import"./chunk.LW7KV5SL.js";import"./chunk.2VX6H2LL.js";import{I as A,M as k}from"./chunk.ZQ4HFIIS.js";import{a as F,b as S}from"./chunk.MRK6QJV5.js";import{b as f}from"./chunk.AJZBJBMO.js";var v=f(F(),1);var a=f(S(),1),C=40,O=60;function D(l,i,p){return l.allNodes().filter(o=>o.kind===i).map(o=>o[p])}function G(l){if(l.length<2)return[];let i=[...l].sort((n,d)=>n-d),p=i[i.length-1]-i[0];if(p<=0)return[];let o=Math.max(1,10**Math.floor(Math.log10(p/4))),e=p/4>=o*5?o*5:o,r=n=>Math.round(n/e)*e;return[...new Set([.2,.4,.6,.8].map(n=>r(i[Math.floor(n*(i.length-1))])))].filter(n=>n>0)}function T(l,i,p){let o=p.far??[],e=new Map,r=new Set(o);for(let t of i.allNodes())r.has(t.kind)&&e.set(t.id,A(l.tryDefinition(t.kind),t));let n=[...e.entries()].map(([t,g])=>({id:t,label:g}));return(n.length<=C?n:n.map(t=>({end:t,ties:i.out(t.id).length+i.in(t.id).length})).sort((t,g)=>g.ties-t.ties||t.end.label.localeCompare(g.end.label)).slice(0,C).map(t=>t.end)).sort((t,g)=>t.label.localeCompare(g.label))}function R(l,i,p){let o=[];for(let e of p.filters)if(e.about==="is")for(let r of e.options??[])o.push({value:`is:${r}`,label:r,group:e.label,condition:{key:"is",value:r}});else if(e.about==="edge"){o.push({value:`${e.key}:*`,label:"anything",group:e.label,condition:{key:e.key,value:"*"}}),o.push({value:`${e.key}:none`,label:"nothing",group:e.label,condition:{key:e.key,value:"none"}});for(let r of T(l,i,e))o.push({value:`${e.key}:${r.id}`,label:r.label,group:e.label,condition:{key:e.key,value:r.id}})}else if(e.type==="date")for(let r of["before","after","on"])o.push({value:`${e.key}:${r}`,label:`${r}\u2026`,group:e.label,ask:{key:e.key,op:r,label:e.label}});else if(e.type==="number"){let r=l.tryDefinition(p.kind),n=G(D(i,p.kind,e.key).filter(d=>typeof d=="number"));for(let d of["at-most","at-least"])for(let t of d==="at-most"?n:[...n].reverse())o.push({value:`${e.key}:${d}:${t}`,label:`${d==="at-most"?"at most":"at least"} ${k(r,e.key,t)}`,group:e.label,condition:{key:e.key,value:`${d}:${t}`}})}else if(e.type==="text"){let r=[...new Set(D(i,p.kind,e.key).filter(n=>typeof n=="string"&&n.length>0&&!n.includes(",")))].sort((n,d)=>n.localeCompare(d));if(r.length>=2&&r.length<=O)for(let n of r)o.push({value:`${e.key}:${n}`,label:n,group:e.label,condition:{key:e.key,value:n}})}else if(e.type==="boolean")o.push({value:`${e.key}:true`,label:"yes",group:e.label,condition:{key:e.key,value:"true"}}),o.push({value:`${e.key}:false`,label:"no",group:e.label,condition:{key:e.key,value:"false"}});else for(let r of e.options??[])o.push({value:`${e.key}:${r}`,label:k(l.tryDefinition(p.kind),e.key,r),group:e.label,condition:{key:e.key,value:r}});return o}var H=["day","week","month","year","decade"];function K(l){let{which:i,schema:p,graph:o,offers:e,arrangement:r,set:n,toggle:d,has:t,done:g}=l,y=l.testId,h=(0,v.useRef)(null);(0,v.useEffect)(()=>{let u=h.current?.closest("[data-graview-popover]");!u||document.activeElement!==u||(u.querySelector('[aria-pressed="true"]')??u.querySelector("button, input"))?.focus({preventScroll:!0})},[]);let L=r.sort?e.sorts.find(u=>u.key===r.sort.by):void 0,P=r.group?e.groups.find(u=>u.key===r.group.by):void 0,M=I(L),m=e.natural?e.sorts.find(u=>u.key===e.natural.by):void 0,N=i==="filter"||i==="all"&&l.parts?.filter?R(p,o,e):[],w=u=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:"Sort by"}),(0,a.jsx)(c,{testId:`${y}-sort-default`,value:"",on:!r.sort,onPress:()=>(n({sort:void 0}),u()),children:m?`As declared (${E(m.label)})`:"As they were added"}),e.sorts.map(s=>(0,a.jsx)(c,{value:s.key,on:r.sort?.by===s.key,onPress:()=>(n({sort:{by:s.key,direction:r.sort?.direction??"asc"}}),u()),children:s.label},s.key)),r.sort?(0,a.jsxs)("div",{role:"group","aria-label":"Order","data-testid":`${y}-direction`,children:[(0,a.jsx)("p",{"aria-hidden":"true",children:"Order"}),["asc","desc"].map(s=>(0,a.jsx)(c,{testId:`${y}-direction-${s}`,value:s,on:r.sort.direction===s,onPress:()=>(n({sort:{by:r.sort.by,direction:s}}),u()),children:M[s]},s))]}):null]}),x=u=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:"Group by"}),(0,a.jsx)(c,{testId:`${y}-group-none`,value:"",on:!r.group,onPress:()=>(n({group:void 0}),u()),children:"Not grouped"}),e.groups.map(s=>(0,a.jsx)(c,{value:s.key,on:r.group?.by===s.key,onPress:()=>(n({group:{by:s.key}}),u()),children:s.label},s.key)),r.group&&P?.buckets?(0,a.jsxs)("div",{role:"group","aria-label":"How wide a group is","data-testid":`${y}-bucket`,children:[(0,a.jsx)("p",{"aria-hidden":"true",children:"Each group"}),H.map(s=>(0,a.jsx)(c,{testId:`${y}-bucket-${s}`,value:s,on:(r.group.bucket??"day")===s,onPress:()=>(n({group:{by:r.group.by,bucket:s}}),u()),children:`A ${s}`},s))]}):null]}),$=u=>(0,a.jsx)(z,{entries:N,has:t,testId:y,onToggle:s=>(d(s),u())}),b=l.parts??{sort:!0,group:!0,filter:!0};return(0,a.jsxs)("div",{ref:h,style:{display:"contents"},children:[(0,a.jsx)("style",{children:W}),i==="sort"?w(g):i==="group"?x(g):i==="filter"?$(g):(0,a.jsxs)(a.Fragment,{children:[b.sort?(0,a.jsx)("div",{role:"group","aria-label":"Sort",children:w(g)}):null,b.group?(0,a.jsx)("div",{role:"group","aria-label":"Group",children:x(g)}):null,b.filter?(0,a.jsx)("div",{role:"group","aria-label":"Filter",children:$(g)}):null]})]})}function c({value:l,on:i,onPress:p,testId:o,children:e}){return(0,a.jsx)("button",{type:"button",className:"graview-arrange-item",value:l,"data-value":l,"aria-pressed":i,onClick:p,...o?{"data-testid":o}:{},children:e})}function z({entries:l,has:i,testId:p,onToggle:o}){let[e,r]=(0,v.useState)(null);if(e)return(0,a.jsx)(B,{ask:e,testId:p,onDay:d=>o({key:e.key,value:`${e.op}:${d}`}),onCancel:()=>r(null)});let n=[...new Set(l.map(d=>d.group))];return(0,a.jsx)(a.Fragment,{children:n.map(d=>(0,a.jsxs)("div",{role:"group","aria-label":d,children:[(0,a.jsx)("p",{"aria-hidden":"true",children:d}),l.filter(t=>t.group===d).map(t=>(0,a.jsx)(c,{value:t.value,on:t.condition?i(t.condition):!1,onPress:()=>t.condition?o(t.condition):r(t.ask),children:t.label},t.value))]},d))})}function B({ask:l,testId:i,onDay:p,onCancel:o}){let[e,r]=(0,v.useState)(""),n=/^\d{4}-\d{2}-\d{2}$/.test(e)&&Number(e.slice(0,4))>=1e3,d=()=>{n&&p(e)};return(0,a.jsxs)("div",{role:"group","aria-label":`${l.label} ${l.op} which day`,"data-testid":`${i}-ask-day`,className:"graview-arrange-ask",children:[(0,a.jsx)("p",{"aria-hidden":"true",children:`${l.label} ${l.op}`}),(0,a.jsx)("input",{type:"date","data-testid":`${i}-day`,"aria-label":`${l.label} ${l.op} which day`,autoFocus:!0,value:e,onChange:t=>r(t.target.value),onKeyDown:t=>{t.key==="Enter"?(t.preventDefault(),d()):t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),o())}}),(0,a.jsxs)("span",{children:[(0,a.jsx)("button",{type:"button","data-testid":`${i}-day-add`,disabled:!n,onClick:d,children:"Add"}),(0,a.jsx)("button",{type:"button",onClick:o,children:"Never mind"})]})]})}var W=`
1
+ import{c as E,d as I}from"./chunk.U6BWYBPM.js";import"./chunk.PY42PBMB.js";import"./chunk.JCZH55RX.js";import"./chunk.2WFEFZAW.js";import{J as A,N as k}from"./chunk.RAE4M3KQ.js";import{a as F,b as S}from"./chunk.MRK6QJV5.js";import{b as f}from"./chunk.AJZBJBMO.js";var v=f(F(),1);var a=f(S(),1),C=40,O=60;function D(l,i,p){return l.allNodes().filter(o=>o.kind===i).map(o=>o[p])}function G(l){if(l.length<2)return[];let i=[...l].sort((n,d)=>n-d),p=i[i.length-1]-i[0];if(p<=0)return[];let o=Math.max(1,10**Math.floor(Math.log10(p/4))),e=p/4>=o*5?o*5:o,r=n=>Math.round(n/e)*e;return[...new Set([.2,.4,.6,.8].map(n=>r(i[Math.floor(n*(i.length-1))])))].filter(n=>n>0)}function T(l,i,p){let o=p.far??[],e=new Map,r=new Set(o);for(let t of i.allNodes())r.has(t.kind)&&e.set(t.id,A(l.tryDefinition(t.kind),t));let n=[...e.entries()].map(([t,g])=>({id:t,label:g}));return(n.length<=C?n:n.map(t=>({end:t,ties:i.out(t.id).length+i.in(t.id).length})).sort((t,g)=>g.ties-t.ties||t.end.label.localeCompare(g.end.label)).slice(0,C).map(t=>t.end)).sort((t,g)=>t.label.localeCompare(g.label))}function R(l,i,p){let o=[];for(let e of p.filters)if(e.about==="is")for(let r of e.options??[])o.push({value:`is:${r}`,label:r,group:e.label,condition:{key:"is",value:r}});else if(e.about==="edge"){o.push({value:`${e.key}:*`,label:"anything",group:e.label,condition:{key:e.key,value:"*"}}),o.push({value:`${e.key}:none`,label:"nothing",group:e.label,condition:{key:e.key,value:"none"}});for(let r of T(l,i,e))o.push({value:`${e.key}:${r.id}`,label:r.label,group:e.label,condition:{key:e.key,value:r.id}})}else if(e.type==="date")for(let r of["before","after","on"])o.push({value:`${e.key}:${r}`,label:`${r}\u2026`,group:e.label,ask:{key:e.key,op:r,label:e.label}});else if(e.type==="number"){let r=l.tryDefinition(p.kind),n=G(D(i,p.kind,e.key).filter(d=>typeof d=="number"));for(let d of["at-most","at-least"])for(let t of d==="at-most"?n:[...n].reverse())o.push({value:`${e.key}:${d}:${t}`,label:`${d==="at-most"?"at most":"at least"} ${k(r,e.key,t)}`,group:e.label,condition:{key:e.key,value:`${d}:${t}`}})}else if(e.type==="text"){let r=[...new Set(D(i,p.kind,e.key).filter(n=>typeof n=="string"&&n.length>0&&!n.includes(",")))].sort((n,d)=>n.localeCompare(d));if(r.length>=2&&r.length<=O)for(let n of r)o.push({value:`${e.key}:${n}`,label:n,group:e.label,condition:{key:e.key,value:n}})}else if(e.type==="boolean")o.push({value:`${e.key}:true`,label:"yes",group:e.label,condition:{key:e.key,value:"true"}}),o.push({value:`${e.key}:false`,label:"no",group:e.label,condition:{key:e.key,value:"false"}});else for(let r of e.options??[])o.push({value:`${e.key}:${r}`,label:k(l.tryDefinition(p.kind),e.key,r),group:e.label,condition:{key:e.key,value:r}});return o}var H=["day","week","month","year","decade"];function K(l){let{which:i,schema:p,graph:o,offers:e,arrangement:r,set:n,toggle:d,has:t,done:g}=l,y=l.testId,h=(0,v.useRef)(null);(0,v.useEffect)(()=>{let u=h.current?.closest("[data-graview-popover]");!u||document.activeElement!==u||(u.querySelector('[aria-pressed="true"]')??u.querySelector("button, input"))?.focus({preventScroll:!0})},[]);let L=r.sort?e.sorts.find(u=>u.key===r.sort.by):void 0,P=r.group?e.groups.find(u=>u.key===r.group.by):void 0,M=I(L),m=e.natural?e.sorts.find(u=>u.key===e.natural.by):void 0,N=i==="filter"||i==="all"&&l.parts?.filter?R(p,o,e):[],w=u=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:"Sort by"}),(0,a.jsx)(c,{testId:`${y}-sort-default`,value:"",on:!r.sort,onPress:()=>(n({sort:void 0}),u()),children:m?`As declared (${E(m.label)})`:"As they were added"}),e.sorts.map(s=>(0,a.jsx)(c,{value:s.key,on:r.sort?.by===s.key,onPress:()=>(n({sort:{by:s.key,direction:r.sort?.direction??"asc"}}),u()),children:s.label},s.key)),r.sort?(0,a.jsxs)("div",{role:"group","aria-label":"Order","data-testid":`${y}-direction`,children:[(0,a.jsx)("p",{"aria-hidden":"true",children:"Order"}),["asc","desc"].map(s=>(0,a.jsx)(c,{testId:`${y}-direction-${s}`,value:s,on:r.sort.direction===s,onPress:()=>(n({sort:{by:r.sort.by,direction:s}}),u()),children:M[s]},s))]}):null]}),x=u=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:"Group by"}),(0,a.jsx)(c,{testId:`${y}-group-none`,value:"",on:!r.group,onPress:()=>(n({group:void 0}),u()),children:"Not grouped"}),e.groups.map(s=>(0,a.jsx)(c,{value:s.key,on:r.group?.by===s.key,onPress:()=>(n({group:{by:s.key}}),u()),children:s.label},s.key)),r.group&&P?.buckets?(0,a.jsxs)("div",{role:"group","aria-label":"How wide a group is","data-testid":`${y}-bucket`,children:[(0,a.jsx)("p",{"aria-hidden":"true",children:"Each group"}),H.map(s=>(0,a.jsx)(c,{testId:`${y}-bucket-${s}`,value:s,on:(r.group.bucket??"day")===s,onPress:()=>(n({group:{by:r.group.by,bucket:s}}),u()),children:`A ${s}`},s))]}):null]}),$=u=>(0,a.jsx)(z,{entries:N,has:t,testId:y,onToggle:s=>(d(s),u())}),b=l.parts??{sort:!0,group:!0,filter:!0};return(0,a.jsxs)("div",{ref:h,style:{display:"contents"},children:[(0,a.jsx)("style",{children:W}),i==="sort"?w(g):i==="group"?x(g):i==="filter"?$(g):(0,a.jsxs)(a.Fragment,{children:[b.sort?(0,a.jsx)("div",{role:"group","aria-label":"Sort",children:w(g)}):null,b.group?(0,a.jsx)("div",{role:"group","aria-label":"Group",children:x(g)}):null,b.filter?(0,a.jsx)("div",{role:"group","aria-label":"Filter",children:$(g)}):null]})]})}function c({value:l,on:i,onPress:p,testId:o,children:e}){return(0,a.jsx)("button",{type:"button",className:"graview-arrange-item",value:l,"data-value":l,"aria-pressed":i,onClick:p,...o?{"data-testid":o}:{},children:e})}function z({entries:l,has:i,testId:p,onToggle:o}){let[e,r]=(0,v.useState)(null);if(e)return(0,a.jsx)(B,{ask:e,testId:p,onDay:d=>o({key:e.key,value:`${e.op}:${d}`}),onCancel:()=>r(null)});let n=[...new Set(l.map(d=>d.group))];return(0,a.jsx)(a.Fragment,{children:n.map(d=>(0,a.jsxs)("div",{role:"group","aria-label":d,children:[(0,a.jsx)("p",{"aria-hidden":"true",children:d}),l.filter(t=>t.group===d).map(t=>(0,a.jsx)(c,{value:t.value,on:t.condition?i(t.condition):!1,onPress:()=>t.condition?o(t.condition):r(t.ask),children:t.label},t.value))]},d))})}function B({ask:l,testId:i,onDay:p,onCancel:o}){let[e,r]=(0,v.useState)(""),n=/^\d{4}-\d{2}-\d{2}$/.test(e)&&Number(e.slice(0,4))>=1e3,d=()=>{n&&p(e)};return(0,a.jsxs)("div",{role:"group","aria-label":`${l.label} ${l.op} which day`,"data-testid":`${i}-ask-day`,className:"graview-arrange-ask",children:[(0,a.jsx)("p",{"aria-hidden":"true",children:`${l.label} ${l.op}`}),(0,a.jsx)("input",{type:"date","data-testid":`${i}-day`,"aria-label":`${l.label} ${l.op} which day`,autoFocus:!0,value:e,onChange:t=>r(t.target.value),onKeyDown:t=>{t.key==="Enter"?(t.preventDefault(),d()):t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),o())}}),(0,a.jsxs)("span",{children:[(0,a.jsx)("button",{type:"button","data-testid":`${i}-day-add`,disabled:!n,onClick:d,children:"Add"}),(0,a.jsx)("button",{type:"button",onClick:o,children:"Never mind"})]})]})}var W=`
2
2
  .graview-arrange-list{display:grid;align-content:start;width:min(300px,calc(100vw - 24px));height:auto;max-height:min(70vh,520px);overflow:auto;margin:0;padding:6px;border-radius:10px;border:1px solid var(--graview-edge);background:var(--graview-float);box-shadow:var(--graview-lift-high);color:var(--graview-ink);font-size:.875rem;line-height:1.3}
3
3
  .graview-arrange-list [role=group]{display:grid}
4
4
  .graview-arrange-list p{margin:8px 8px 2px;font-size:.6875rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--graview-ink-muted)}
@@ -1 +1 @@
1
- import{a as y}from"./chunk.HAQ4KHRY.js";import{Aa as g,a as f,ya as m}from"./chunk.2VX6H2LL.js";import{T as p}from"./chunk.ZQ4HFIIS.js";import{a as R,b as c}from"./chunk.MRK6QJV5.js";import{b as u}from"./chunk.AJZBJBMO.js";var s=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>import("./chunk.KWSXL3A2.js")));function L(e){let[n,t]=(0,s.useState)(()=>h().current);return(0,s.useEffect)(()=>{if(!e||n)return;let i=!0;return h().load().then(a=>i&&t(a),()=>{}),()=>{i=!1}},[e,n]),n}function D(e,n){let t=L(n.length>0);return(0,s.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,s.useMemo)(()=>{let i=new Map;if(!t)return i;for(let a of n){let l=t.ruleLine(a,e);l&&i.set(a.name,l)}return i},[t,e,n])}function M(e){let n=e.line;if(!(!n||e.message.endsWith(` \u2014 ${n.text}`)||e.message===b(e)))return e.message}function b(e){let n=e.line;return n?n.record!==void 0?`${n.record} \u2014 ${n.text}`:n.text:e.message}var P={name:{},op:{color:"var(--graview-ink-muted)",fontWeight:500},value:{fontWeight:600,fontVariantNumeric:"tabular-nums"},word:{color:"var(--graview-ink-muted)"},open:{color:"var(--graview-ink-faint)"},close:{color:"var(--graview-ink-faint)"}};function w({parts:e}){return(0,r.jsx)(r.Fragment,{children:e.map((n,t)=>(0,r.jsxs)("span",{children:[n.space?" ":"",(0,r.jsx)("span",{"data-graview-rule-part":n.as,style:P[n.as],children:n.text})]},t))})}function x(e,n){let t=p(e?.tryDefinition(n),n);return t.charAt(0).toUpperCase()+t.slice(1)}function C({line:e,schema:n,brand:t,lead:i=e.record===void 0?"kind":"record",stacked:a=!1,style:l}){let d=e.kind,o=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&o?`${o}: ${e.said}`:i==="record"&&o?`${o} \u2014 ${e.said}`:e.said;return(0,r.jsxs)("span",{"data-graview-rule-line":"",style:{overflowWrap:"anywhere",...l},children:[(0,r.jsx)("span",{style:g,children:k}),(0,r.jsxs)("span",{"aria-hidden":"true",children:[i!=="none"&&d?(0,r.jsx)("span",{style:{display:"inline-flex",verticalAlign:"-0.1em",marginRight:"0.4em"},children:(0,r.jsx)(y,{kind:d,...n?{schema:n}:{},...t?{brand:t}:{},size:13})}):null,o?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[o,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&o?(0,r.jsx)("br",{}):null,(0,r.jsx)(w,{parts:e.parts}),e.when&&e.when.length>0?(0,r.jsxs)("span",{"data-graview-rule-when":"",style:{color:"var(--graview-ink-faint)"},children:[", when ",(0,r.jsx)(w,{parts:e.when})]}):null]})]})}function z(e){return e.line?e.label&&e.label.trim().length>0?e.label:void 0:e.label&&e.label!==e.message?e.label:void 0}export{D as a,I as b,M as c,b as d,C as e,z as f};
1
+ import{a as y}from"./chunk.SSOTDXRS.js";import{Ba as g,a as f,ya as m}from"./chunk.2WFEFZAW.js";import{U as p}from"./chunk.RAE4M3KQ.js";import{a as R,b as c}from"./chunk.MRK6QJV5.js";import{b as u}from"./chunk.AJZBJBMO.js";var s=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>import("./chunk.RVEMN5WU.js")));function L(e){let[n,t]=(0,s.useState)(()=>h().current);return(0,s.useEffect)(()=>{if(!e||n)return;let i=!0;return h().load().then(a=>i&&t(a),()=>{}),()=>{i=!1}},[e,n]),n}function D(e,n){let t=L(n.length>0);return(0,s.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,s.useMemo)(()=>{let i=new Map;if(!t)return i;for(let a of n){let l=t.ruleLine(a,e);l&&i.set(a.name,l)}return i},[t,e,n])}function M(e){let n=e.line;if(!(!n||e.message.endsWith(` \u2014 ${n.text}`)||e.message===b(e)))return e.message}function b(e){let n=e.line;return n?n.record!==void 0?`${n.record} \u2014 ${n.text}`:n.text:e.message}var P={name:{},op:{color:"var(--graview-ink-muted)",fontWeight:500},value:{fontWeight:600,fontVariantNumeric:"tabular-nums"},word:{color:"var(--graview-ink-muted)"},open:{color:"var(--graview-ink-faint)"},close:{color:"var(--graview-ink-faint)"}};function w({parts:e}){return(0,r.jsx)(r.Fragment,{children:e.map((n,t)=>(0,r.jsxs)("span",{children:[n.space?" ":"",(0,r.jsx)("span",{"data-graview-rule-part":n.as,style:P[n.as],children:n.text})]},t))})}function x(e,n){let t=p(e?.tryDefinition(n),n);return t.charAt(0).toUpperCase()+t.slice(1)}function C({line:e,schema:n,brand:t,lead:i=e.record===void 0?"kind":"record",stacked:a=!1,style:l}){let d=e.kind,o=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&o?`${o}: ${e.said}`:i==="record"&&o?`${o} \u2014 ${e.said}`:e.said;return(0,r.jsxs)("span",{"data-graview-rule-line":"",style:{overflowWrap:"anywhere",...l},children:[(0,r.jsx)("span",{style:g,children:k}),(0,r.jsxs)("span",{"aria-hidden":"true",children:[i!=="none"&&d?(0,r.jsx)("span",{style:{display:"inline-flex",verticalAlign:"-0.1em",marginRight:"0.4em"},children:(0,r.jsx)(y,{kind:d,...n?{schema:n}:{},...t?{brand:t}:{},size:13})}):null,o?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[o,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&o?(0,r.jsx)("br",{}):null,(0,r.jsx)(w,{parts:e.parts}),e.when&&e.when.length>0?(0,r.jsxs)("span",{"data-graview-rule-when":"",style:{color:"var(--graview-ink-faint)"},children:[", when ",(0,r.jsx)(w,{parts:e.when})]}):null]})]})}function z(e){return e.line?e.label&&e.label.trim().length>0?e.label:void 0:e.label&&e.label!==e.message?e.label:void 0}export{D as a,I as b,M as c,b as d,C as e,z as f};
@@ -1 +1 @@
1
- import{a as b,b as N,c as S}from"./chunk.MYCTNK6D.js";import{Aa as y,va as m,wa as w}from"./chunk.2VX6H2LL.js";import{xb as x}from"./chunk.ZQ4HFIIS.js";import{a as C,b as h}from"./chunk.MRK6QJV5.js";import{b as g}from"./chunk.AJZBJBMO.js";var c=g(C(),1);var i=g(h(),1),P=6e3;function M(){let t=[],n=0,s=new Set,a=new Map,p,r=()=>{for(let e of[...s])e()},o=e=>{if(clearTimeout(a.get(e.id)),a.delete(e.id),e.kind!=="toast")return;let l=(e.actions?.length??0)+(e.action?1:0),f=e.timeout??(l>0?!1:P);f!==!1&&a.set(e.id,setTimeout(()=>p?.()?o(e):d(e.id),f))},d=e=>{clearTimeout(a.get(e)),a.delete(e),t.some(l=>l.id===e)&&(t=t.filter(l=>l.id!==e),r())},u=e=>{t=t.some(l=>l.id===e.id)?t.map(l=>l.id===e.id?e:l):[...t,e],o(e),r()};return{notify(e){let l=e.id??`notice-${++n}`;return u({...e,id:l,said:++n}),{id:l,dismiss:()=>d(l),update:f=>{let v=t.find(L=>L.id===l);v&&u({...v,...f,id:l,kind:v.kind,said:f.sentence!==void 0&&f.sentence!==v.sentence?++n:v.said})}}},dismiss:d,hold(e){p=e},list:()=>t,subscribe(e){return s.add(e),()=>s.delete(e)}}}var k={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"};function T({notices:t,at:n,anchor:s,board:a}){let p=(0,c.useRef)(null),r=t.length>0;return(0,c.useLayoutEffect)(()=>{let o=p.current;if(!r||!o)return;if(typeof o.showPopover=="function"&&!m(o))try{o.showPopover()}catch{}let d=()=>(n==="top"?S:N)(o,s());d(),n==="foot"&&a.hold?.(()=>o.matches(":hover, :focus-within"));let u=w(o);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(b,d);let e=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return e?.observe(o),()=>{if(u(),e?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(b,d),o.isConnected&&m(o))try{o.hidePopover()}catch{}}},[r,n,s,a]),r?(0,i.jsx)("div",{ref:p,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:x("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:t.map(o=>(0,i.jsx)(R,{notice:o,board:a},o.id))}):null}function R({notice:t,board:n}){let s=t.tone??"info",a=[...t.action?[t.action]:[],...t.actions??[]],p=()=>n.dismiss(t.id);return(0,i.jsxs)("div",{"data-testid":"notice","data-kind":t.kind,"data-tone":s,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:t.kind==="banner"?"8px 10px 8px 14px":"10px 12px 10px 14px",borderRadius:"var(--graview-radius, 12px)",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:`3px solid ${k[s]}`,background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,i.jsx)("span",{"aria-hidden":"true",style:{width:7,height:7,borderRadius:999,flex:"0 0 auto",background:k[s]}}),(0,i.jsx)("span",{style:{flex:"1 1 16rem",minWidth:0},children:t.sentence}),a.length>0?(0,i.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:a.map((r,o)=>r.href!==void 0?(0,i.jsx)("a",{href:r.href,...r.target?{target:r.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{r.onSelect?.(),p()},style:{...H,...o===0?E:{}},children:r.label},r.label):(0,i.jsx)("button",{type:"button","data-testid":"notice-action",onClick:()=>{p(),r.onSelect?.()},style:{...H,...o===0?E:{}},children:r.label},r.label))}):null,(0,i.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${t.sentence}`,title:"Dismiss",onClick:p,style:A,children:"\xD7"})]})}var H={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},E={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},A={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};function B({notices:t}){let n=t.reduce((d,u)=>!d||u.said>d.said?u:d,void 0),[s,a]=(0,c.useState)(""),[p,r]=(0,c.useState)(""),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{if(!n||n.said===o.current)return;o.current=n.said;let d=n.tone==="bad";(d?r:a)("");let u=setTimeout(()=>(d?r:a)(n.sentence),50);return()=>clearTimeout(u)},[n]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{role:"status","aria-live":"polite","data-testid":"notices-said",style:y,children:s}),(0,i.jsx)("div",{role:"alert","data-testid":"notices-alarm",style:y,children:p})]})}var W=(0,c.createContext)(null);function F({board:t,anchor:n}){let s=(0,c.useSyncExternalStore)(t.subscribe,t.list,t.list);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(T,{notices:s.filter(a=>a.kind==="banner"),at:"top",anchor:n,board:t}),(0,i.jsx)(T,{notices:s.filter(a=>a.kind==="toast"),at:"foot",anchor:n,board:t}),(0,i.jsx)(B,{notices:s})]})}export{M as a,W as b,F as c};
1
+ import{a as b,b as N,c as S}from"./chunk.US4KIJSW.js";import{Ba as y,va as m,wa as w}from"./chunk.2WFEFZAW.js";import{zb as x}from"./chunk.RAE4M3KQ.js";import{a as C,b as h}from"./chunk.MRK6QJV5.js";import{b as g}from"./chunk.AJZBJBMO.js";var c=g(C(),1);var i=g(h(),1),P=6e3;function M(){let t=[],n=0,s=new Set,a=new Map,p,r=()=>{for(let e of[...s])e()},o=e=>{if(clearTimeout(a.get(e.id)),a.delete(e.id),e.kind!=="toast")return;let l=(e.actions?.length??0)+(e.action?1:0),f=e.timeout??(l>0?!1:P);f!==!1&&a.set(e.id,setTimeout(()=>p?.()?o(e):d(e.id),f))},d=e=>{clearTimeout(a.get(e)),a.delete(e),t.some(l=>l.id===e)&&(t=t.filter(l=>l.id!==e),r())},u=e=>{t=t.some(l=>l.id===e.id)?t.map(l=>l.id===e.id?e:l):[...t,e],o(e),r()};return{notify(e){let l=e.id??`notice-${++n}`;return u({...e,id:l,said:++n}),{id:l,dismiss:()=>d(l),update:f=>{let v=t.find(L=>L.id===l);v&&u({...v,...f,id:l,kind:v.kind,said:f.sentence!==void 0&&f.sentence!==v.sentence?++n:v.said})}}},dismiss:d,hold(e){p=e},list:()=>t,subscribe(e){return s.add(e),()=>s.delete(e)}}}var k={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"};function T({notices:t,at:n,anchor:s,board:a}){let p=(0,c.useRef)(null),r=t.length>0;return(0,c.useLayoutEffect)(()=>{let o=p.current;if(!r||!o)return;if(typeof o.showPopover=="function"&&!m(o))try{o.showPopover()}catch{}let d=()=>(n==="top"?S:N)(o,s());d(),n==="foot"&&a.hold?.(()=>o.matches(":hover, :focus-within"));let u=w(o);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(b,d);let e=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return e?.observe(o),()=>{if(u(),e?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(b,d),o.isConnected&&m(o))try{o.hidePopover()}catch{}}},[r,n,s,a]),r?(0,i.jsx)("div",{ref:p,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:x("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:t.map(o=>(0,i.jsx)(R,{notice:o,board:a},o.id))}):null}function R({notice:t,board:n}){let s=t.tone??"info",a=[...t.action?[t.action]:[],...t.actions??[]],p=()=>n.dismiss(t.id);return(0,i.jsxs)("div",{"data-testid":"notice","data-kind":t.kind,"data-tone":s,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:t.kind==="banner"?"8px 10px 8px 14px":"10px 12px 10px 14px",borderRadius:"var(--graview-radius, 12px)",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:`3px solid ${k[s]}`,background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,i.jsx)("span",{"aria-hidden":"true",style:{width:7,height:7,borderRadius:999,flex:"0 0 auto",background:k[s]}}),(0,i.jsx)("span",{style:{flex:"1 1 16rem",minWidth:0},children:t.sentence}),a.length>0?(0,i.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:a.map((r,o)=>r.href!==void 0?(0,i.jsx)("a",{href:r.href,...r.target?{target:r.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{r.onSelect?.(),p()},style:{...H,...o===0?E:{}},children:r.label},r.label):(0,i.jsx)("button",{type:"button","data-testid":"notice-action",onClick:()=>{p(),r.onSelect?.()},style:{...H,...o===0?E:{}},children:r.label},r.label))}):null,(0,i.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${t.sentence}`,title:"Dismiss",onClick:p,style:A,children:"\xD7"})]})}var H={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},E={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},A={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};function B({notices:t}){let n=t.reduce((d,u)=>!d||u.said>d.said?u:d,void 0),[s,a]=(0,c.useState)(""),[p,r]=(0,c.useState)(""),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{if(!n||n.said===o.current)return;o.current=n.said;let d=n.tone==="bad";(d?r:a)("");let u=setTimeout(()=>(d?r:a)(n.sentence),50);return()=>clearTimeout(u)},[n]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{role:"status","aria-live":"polite","data-testid":"notices-said",style:y,children:s}),(0,i.jsx)("div",{role:"alert","data-testid":"notices-alarm",style:y,children:p})]})}var W=(0,c.createContext)(null);function F({board:t,anchor:n}){let s=(0,c.useSyncExternalStore)(t.subscribe,t.list,t.list);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(T,{notices:s.filter(a=>a.kind==="banner"),at:"top",anchor:n,board:t}),(0,i.jsx)(T,{notices:s.filter(a=>a.kind==="toast"),at:"foot",anchor:n,board:t}),(0,i.jsx)(B,{notices:s})]})}export{M as a,W as b,F as c};