ocean-brain 0.6.3 → 0.7.0

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 (46) hide show
  1. package/dist/mcp.js +79 -24
  2. package/package.json +2 -1
  3. package/server/client/dist/assets/{Calendar-DbPut8EU.js → Calendar-B2_OJcHD.js} +1 -1
  4. package/server/client/dist/assets/{Callout-DfX-gIUB.js → Callout-BvXAlA5k.js} +1 -1
  5. package/server/client/dist/assets/{Graph-yHE9m5fy.js → Graph-DO35UCPM.js} +1 -1
  6. package/server/client/dist/assets/{Image.es-CtMc7BW4.js → Image.es-DLqLiGdW.js} +1 -1
  7. package/server/client/dist/assets/Note-AaTlS352.js +22 -0
  8. package/server/client/dist/assets/{Plus.es-BGVIIQtM.js → Plus.es-I7xuoJ9B.js} +1 -1
  9. package/server/client/dist/assets/{Reminders-CvEJf0eQ.js → Reminders-B0LJeSlu.js} +1 -1
  10. package/server/client/dist/assets/{Search-CKZhztuV.js → Search-xbDSlNOT.js} +1 -1
  11. package/server/client/dist/assets/{SurfaceCard-Bnfo5EOl.js → SurfaceCard-Brd1cMxi.js} +1 -1
  12. package/server/client/dist/assets/{Tag-C4oAwjs0.js → Tag-2PlhkjwY.js} +1 -1
  13. package/server/client/dist/assets/{TagNotes-Rl1ZSJP6.js → TagNotes-1yUBLqhX.js} +1 -1
  14. package/server/client/dist/assets/{Trash.es-BcwUz2yM.js → Trash.es-B-7U25B6.js} +1 -1
  15. package/server/client/dist/assets/{ViewNotes-B9Yc0A87.js → ViewNotes-D4X-MCTk.js} +1 -1
  16. package/server/client/dist/assets/{ViewSectionTableRenderer-C5yJBO7C.js → ViewSectionTableRenderer-FuqBpQts.js} +1 -1
  17. package/server/client/dist/assets/{Views-Bqq0pUEE.js → Views-CBEimWY8.js} +1 -1
  18. package/server/client/dist/assets/{image.api-CuGTgzyQ.js → image.api-BtadKO98.js} +1 -1
  19. package/server/client/dist/assets/{index-CDjYEIVf.css → index-BFkZTZ6v.css} +1 -1
  20. package/server/client/dist/assets/{index-B43ulIPo.js → index-BgnmVjeF.js} +45 -11
  21. package/server/client/dist/assets/{index-BQDR6hIA.js → index-sGhvnErO.js} +1 -1
  22. package/server/client/dist/assets/{manage-image-Bs4Kmevx.js → manage-image-B4UZ-ZQx.js} +1 -1
  23. package/server/client/dist/assets/{manage-image-detail-WARala-v.js → manage-image-detail-ejAh3nCL.js} +1 -1
  24. package/server/client/dist/assets/{mcp-C0Z3vKBa.js → mcp-aIwuouT9.js} +1 -1
  25. package/server/client/dist/assets/{placeholder-D080guzn.js → placeholder-B_9Hnm7h.js} +4 -4
  26. package/server/client/dist/assets/{properties-DbnmfbT5.js → properties-D8oLyTCD.js} +1 -1
  27. package/server/client/dist/assets/{trash-D5ZiZfTk.js → trash-w7Hhxckg.js} +1 -1
  28. package/server/client/dist/assets/{useReminderMutate-h7d_S_X2.js → useReminderMutate--RlAj_Gg.js} +1 -1
  29. package/server/client/dist/index.html +2 -2
  30. package/server/dist/features/note/graphql/note.query.resolver.js +88 -47
  31. package/server/dist/features/note/graphql/note.query.resolver.js.map +1 -1
  32. package/server/dist/features/note/graphql/note.type-defs.js +32 -0
  33. package/server/dist/features/note/graphql/note.type-defs.js.map +1 -1
  34. package/server/dist/features/note/http/mcp.js +32 -0
  35. package/server/dist/features/note/http/mcp.js.map +1 -1
  36. package/server/dist/features/note/services/markdown-intent-write.js +3 -3
  37. package/server/dist/features/note/services/markdown-intent-write.js.map +1 -1
  38. package/server/dist/features/note/services/markdown-patch.js +34 -4
  39. package/server/dist/features/note/services/markdown-patch.js.map +1 -1
  40. package/server/dist/features/note/services/snapshot.js +159 -0
  41. package/server/dist/features/note/services/snapshot.js.map +1 -1
  42. package/server/dist/modules/blocknote.js +171 -17
  43. package/server/dist/modules/blocknote.js.map +1 -1
  44. package/server/dist/routes/mcp.js +5 -0
  45. package/server/dist/routes/mcp.js.map +1 -1
  46. package/server/client/dist/assets/Note-BECn-AoI.js +0 -21
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Calendar-DbPut8EU.js","assets/note-vendor-uuJO2MTD.js","assets/graph-vendor-CUxe67Lr.js","assets/note-core-DMZcZ4yV.js","assets/Callout-DfX-gIUB.js","assets/Views-Bqq0pUEE.js","assets/ViewSectionTableRenderer-C5yJBO7C.js","assets/SurfaceCard-Bnfo5EOl.js","assets/Plus.es-BGVIIQtM.js","assets/Reminders-CvEJf0eQ.js","assets/useReminderMutate-h7d_S_X2.js","assets/Graph-yHE9m5fy.js","assets/Search-CKZhztuV.js","assets/Tag-C4oAwjs0.js","assets/Note-BECn-AoI.js","assets/image.api-CuGTgzyQ.js","assets/Note-W4f6H9K0.css","assets/TagNotes-Rl1ZSJP6.js","assets/ViewNotes-B9Yc0A87.js","assets/index-BQDR6hIA.js","assets/Trash.es-BcwUz2yM.js","assets/Image.es-CtMc7BW4.js","assets/mcp-C0Z3vKBa.js","assets/trash-D5ZiZfTk.js","assets/manage-image-Bs4Kmevx.js","assets/Image-DK0lnaK2.js","assets/manage-image-detail-WARala-v.js","assets/properties-DbnmfbT5.js","assets/placeholder-D080guzn.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Calendar-B2_OJcHD.js","assets/note-vendor-uuJO2MTD.js","assets/graph-vendor-CUxe67Lr.js","assets/note-core-DMZcZ4yV.js","assets/Callout-BvXAlA5k.js","assets/Views-CBEimWY8.js","assets/ViewSectionTableRenderer-FuqBpQts.js","assets/SurfaceCard-Brd1cMxi.js","assets/Plus.es-I7xuoJ9B.js","assets/Reminders-B0LJeSlu.js","assets/useReminderMutate--RlAj_Gg.js","assets/Graph-DO35UCPM.js","assets/Search-xbDSlNOT.js","assets/Tag-2PlhkjwY.js","assets/Note-AaTlS352.js","assets/image.api-BtadKO98.js","assets/Note-W4f6H9K0.css","assets/TagNotes-1yUBLqhX.js","assets/ViewNotes-D4X-MCTk.js","assets/index-sGhvnErO.js","assets/Trash.es-B-7U25B6.js","assets/Image.es-DLqLiGdW.js","assets/mcp-aIwuouT9.js","assets/trash-w7Hhxckg.js","assets/manage-image-B4UZ-ZQx.js","assets/Image-DK0lnaK2.js","assets/manage-image-detail-ejAh3nCL.js","assets/properties-D8oLyTCD.js","assets/placeholder-B_9Hnm7h.js"])))=>i.map(i=>d[i]);
2
2
  import{j as h,w as Qp,r as $t,R as tu,a as Xa,c as Xp,u as Jp,o as e1,s as t1,f as n1,b as r1,d as o1,h as s1,e as a1,l as i1,_ as Ze,g as c1}from"./note-vendor-uuJO2MTD.js";import{a as c,R as Ko,N as M,g as Gn,r as l1,P as xe}from"./graph-vendor-CUxe67Lr.js";import"./note-core-DMZcZ4yV.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();const Ja={DARK:"(prefers-color-scheme: dark)",LIGHT:"(prefers-color-scheme: light)",RETINA:"(min-resolution: 2dppx)",RESPONSIVE:e=>`screen and (max-width: ${e})`},nu=e=>typeof window<"u"&&window.matchMedia?window.matchMedia(e):null,ei=(e,t,n=!0)=>{const r=nu(e);n&&t(r?.matches||!1);const o=s=>{t?.(s.matches)};return r?.addEventListener("change",o),()=>{r?.removeEventListener("change",o)}},u1=(e,t=!0)=>ei(Ja.DARK,e,t),d1=(e,t,n=!0)=>ei(Ja.RESPONSIVE(e),t,n),f1={MEDIA_QUERY:Ja,listenThemeChange:u1,listenResponsiveChange:d1,createMediaQuery:nu,listenMediaQueryChange:ei};var Ee=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(Ee||{});function ru({update:e,notify:t,unwatched:n}){return{link:r,unlink:o,propagate:s,checkDirty:a,shallowPropagate:i};function r(u,f,d){const p=f.depsTail;if(p!==void 0&&p.dep===u)return;const m=p!==void 0?p.nextDep:f.deps;if(m!==void 0&&m.dep===u){m.version=d,f.depsTail=m;return}const v=u.subsTail;if(v!==void 0&&v.version===d&&v.sub===f)return;const g=f.depsTail=u.subsTail={version:d,dep:u,sub:f,prevDep:p,nextDep:m,prevSub:v,nextSub:void 0};m!==void 0&&(m.prevDep=g),p!==void 0?p.nextDep=g:f.deps=g,v!==void 0?v.nextSub=g:u.subs=g}function o(u,f=u.sub){const d=u.dep,p=u.prevDep,m=u.nextDep,v=u.nextSub,g=u.prevSub;return m!==void 0?m.prevDep=p:f.depsTail=p,p!==void 0?p.nextDep=m:f.deps=m,v!==void 0?v.prevSub=g:d.subsTail=g,g!==void 0?g.nextSub=v:(d.subs=v)===void 0&&n(d),m}function s(u){let f=u.nextSub,d;e:do{const p=u.sub;let m=p.flags;if(m&60?m&12?m&4?!(m&48)&&l(u,p)?(p.flags=m|40,m&=1):m=0:p.flags=m&-9|32:m=0:p.flags=m|32,m&2&&t(p),m&1){const v=p.subs;if(v!==void 0){const g=(u=v).nextSub;g!==void 0&&(d={value:f,prev:d},f=g);continue}}if((u=f)!==void 0){f=u.nextSub;continue}for(;d!==void 0;)if(u=d.value,d=d.prev,u!==void 0){f=u.nextSub;continue e}break}while(!0)}function a(u,f){let d,p=0,m=!1;e:do{const v=u.dep,g=v.flags;if(f.flags&16)m=!0;else if((g&17)===17){if(e(v)){const y=v.subs;y.nextSub!==void 0&&i(y),m=!0}}else if((g&33)===33){(u.nextSub!==void 0||u.prevSub!==void 0)&&(d={value:u,prev:d}),u=v.deps,f=v,++p;continue}if(!m){const y=u.nextDep;if(y!==void 0){u=y;continue}}for(;p--;){const y=f.subs,b=y.nextSub!==void 0;if(b?(u=d.value,d=d.prev):u=y,m){if(e(f)){b&&i(y),f=u.sub;continue}m=!1}else f.flags&=-33;f=u.sub;const x=u.nextDep;if(x!==void 0){u=x;continue e}}return m}while(!0)}function i(u){do{const f=u.sub,d=f.flags;(d&48)===32&&(f.flags=d|16,(d&6)===2&&t(f))}while((u=u.nextSub)!==void 0)}function l(u,f){let d=f.depsTail;for(;d!==void 0;){if(d===u)return!0;d=d.prevDep}return!1}}let ti=0,rn=0,vr=0;const kt=[],{link:HC,unlink:ou,propagate:BC,checkDirty:h1,shallowPropagate:VC}=ru({update(e){return e.depsTail!==void 0?v1(e):y1(e)},notify(e){let t=vr,n=t;do if(kt[t++]=e,e.flags&=-3,e=e.subs?.sub,e===void 0||!(e.flags&2))break;while(!0);for(vr=t;n<--t;){const r=kt[n];kt[n++]=kt[t],kt[t]=r}},unwatched(e){e.flags&1?e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Wo(e)):w1.call(e)}});function p1(){return ti}function m1(){++ti}function g1(){--ti||x1()}function v1(e){e.depsTail=void 0,e.flags=5;try{const t=e.value;return t!==(e.value=e.getter(t))}finally{e.flags&=-5,Wo(e)}}function y1(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function b1(e){const t=e.flags;if(t&16||t&32&&h1(e.deps,e)){e.depsTail=void 0,e.flags=6;try{e.fn()}finally{e.flags&=-5,Wo(e)}}else e.flags=2}function x1(){try{for(;rn<vr;){const e=kt[rn];kt[rn++]=void 0,b1(e)}}finally{for(;rn<vr;){const e=kt[rn];kt[rn++]=void 0,e.flags|=10}rn=0,vr=0}}function w1(){this.depsTail=void 0,this.flags=0,Wo(this);const e=this.subs;e!==void 0&&ou(e)}function Wo(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=ou(n,e)}function ni(e,t,n){const r=typeof e=="object",o=r?e:void 0;return{next:(r?e.next:e)?.bind(o),error:(r?e.error:t)?.bind(o),complete:(r?e.complete:n)?.bind(o)}}const ua=[];let ho=0;const{link:cc,unlink:E1,propagate:S1,checkDirty:su,shallowPropagate:lc}=ru({update(e){return e._update()},notify(e){ua[da++]=e,e.flags&=~Ee.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Ee.Mutable|Ee.Dirty,Eo(e))}});let Xr=0,da=0,At;function Eo(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=E1(n,e)}function au(){if(!(p1()>0)){for(;Xr<da;){const e=ua[Xr];ua[Xr++]=void 0,e.notify()}Xr=0,da=0}}function iu(e,t){const n=typeof e=="function",r=e,o={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?Ee.None:Ee.Mutable,get(){return At!==void 0&&cc(o,At,ho),o._snapshot},subscribe(s){const a=ni(s),i={current:!1},l=R1(()=>{o.get(),i.current?a.next?.(o._snapshot):i.current=!0});return{unsubscribe:()=>{l.stop()}}},_update(s){const a=At,i=Object.is;if(n)At=o,++ho,o.depsTail=void 0;else if(s===void 0)return!1;n&&(o.flags=Ee.Mutable|Ee.RecursedCheck);try{const l=o._snapshot,u=typeof s=="function"?s(l):s===void 0&&n?r(l):s;return l===void 0||!i(l,u)?(o._snapshot=u,!0):!1}finally{At=a,n&&(o.flags&=~Ee.RecursedCheck),Eo(o)}}};return n?(o.flags=Ee.Mutable|Ee.Dirty,o.get=function(){const s=o.flags;if(s&Ee.Dirty||s&Ee.Pending&&su(o.deps,o)){if(o._update()){const a=o.subs;a!==void 0&&lc(a)}}else s&Ee.Pending&&(o.flags=s&~Ee.Pending);return At!==void 0&&cc(o,At,ho),o._snapshot}):o.set=function(s){if(o._update(s)){const a=o.subs;a!==void 0&&(S1(a),lc(a),au())}},o}function R1(e){const t=()=>{const r=At;At=n,++ho,n.depsTail=void 0,n.flags=Ee.Watching|Ee.RecursedCheck;try{return e()}finally{At=r,n.flags&=~Ee.RecursedCheck,Eo(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Ee.Watching|Ee.RecursedCheck,notify(){const r=this.flags;r&Ee.Dirty||r&Ee.Pending&&su(this.deps,this)?t():this.flags=Ee.Watching},stop(){this.flags=Ee.None,this.depsTail=void 0,Eo(this)}};return t(),n}class C1{constructor(t){this.atom=iu(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(ni(t))}}class A1{constructor(t){this.atom=iu(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(ni(t))}}function T1(e){return typeof e=="function"?new A1(e):new C1(e)}function P1(e){try{m1(),e()}finally{g1(),au()}}const Yt="__TSR_index",uc="popstate",dc="beforeunload";function M1(e){let t=e.getLocation();const n=new Set,r=a=>{t=e.getLocation(),n.forEach(i=>i({location:t,action:a}))},o=a=>{e.notifyOnIndexChange??!0?r(a):t=e.getLocation()},s=async({task:a,navigateOpts:i,...l})=>{if(i?.ignoreBlocker??!1){a();return}const f=e.getBlockers?.()??[],d=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&f.length&&d)for(const p of f){const m=So(l.path,l.state);if(await p.blockerFn({currentLocation:t,nextLocation:m,action:l.type})){e.onBlocked?.();return}}a()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:a=>(n.add(a),()=>{n.delete(a)}),push:(a,i,l)=>{const u=t.state[Yt];i=fc(u+1,i),s({task:()=>{e.pushState(a,i),r({type:"PUSH"})},navigateOpts:l,type:"PUSH",path:a,state:i})},replace:(a,i,l)=>{const u=t.state[Yt];i=fc(u,i),s({task:()=>{e.replaceState(a,i),r({type:"REPLACE"})},navigateOpts:l,type:"REPLACE",path:a,state:i})},go:(a,i)=>{s({task:()=>{e.go(a),o({type:"GO",index:a})},navigateOpts:i,type:"GO"})},back:a=>{s({task:()=>{e.back(a?.ignoreBlocker??!1),o({type:"BACK"})},navigateOpts:a,type:"BACK"})},forward:a=>{s({task:()=>{e.forward(a?.ignoreBlocker??!1),o({type:"FORWARD"})},navigateOpts:a,type:"FORWARD"})},canGoBack:()=>t.state[Yt]!==0,createHref:a=>e.createHref(a),block:a=>{if(!e.setBlockers)return()=>{};const i=e.getBlockers?.()??[];return e.setBlockers([...i,a]),()=>{const l=e.getBlockers?.()??[];e.setBlockers?.(l.filter(u=>u!==a))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function fc(e,t){t||(t={});const n=ri();return{...t,key:n,__TSR_key:n,[Yt]:e}}function _1(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,r=t.history.replaceState;let o=[];const s=()=>o,a=S=>o=S,i=(S=>S),l=(()=>So(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const S=ri();t.history.replaceState({[Yt]:0,key:S,__TSR_key:S},"")}let u=l(),f,d=!1,p=!1,m=!1,v=!1;const g=()=>u;let y,b;const x=()=>{y&&(C._ignoreSubscribers=!0,(y.isPush?t.history.pushState:t.history.replaceState)(y.state,"",y.href),C._ignoreSubscribers=!1,y=void 0,b=void 0,f=void 0)},w=(S,N,I)=>{const P=i(N);b||(f=u),u=So(N,I),y={href:P,state:I,isPush:y?.isPush||S==="push"},b||(b=Promise.resolve().then(()=>x()))},E=S=>{u=l(),C.notify({type:S})},T=async()=>{if(p){p=!1;return}const S=l(),N=S.state[Yt]-u.state[Yt],I=N===1,P=N===-1,H=!I&&!P||d;d=!1;const z=H?"GO":P?"BACK":"FORWARD",L=H?{type:"GO",index:N}:{type:P?"BACK":"FORWARD"};if(m)m=!1;else{const k=s();if(typeof document<"u"&&k.length){for(const A of k)if(await A.blockerFn({currentLocation:u,nextLocation:S,action:z})){p=!0,t.history.go(1),C.notify(L);return}}}u=l(),C.notify(L)},O=S=>{if(v){v=!1;return}let N=!1;const I=s();if(typeof document<"u"&&I.length)for(const P of I){const H=P.enableBeforeUnload??!0;if(H===!0){N=!0;break}if(typeof H=="function"&&H()===!0){N=!0;break}}if(N)return S.preventDefault(),S.returnValue=""},C=M1({getLocation:g,getLength:()=>t.history.length,pushState:(S,N)=>w("push",S,N),replaceState:(S,N)=>w("replace",S,N),back:S=>(S&&(m=!0),v=!0,t.history.back()),forward:S=>{S&&(m=!0),v=!0,t.history.forward()},go:S=>{d=!0,t.history.go(S)},createHref:S=>i(S),flush:x,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(dc,O,{capture:!0}),t.removeEventListener(uc,T)},onBlocked:()=>{f&&u!==f&&(u=f)},getBlockers:s,setBlockers:a,notifyOnIndexChange:!1});return t.addEventListener(dc,O,{capture:!0}),t.addEventListener(uc,T),t.history.pushState=function(...S){const N=n.apply(t.history,S);return C._ignoreSubscribers||E("PUSH"),N},t.history.replaceState=function(...S){const N=r.apply(t.history,S);return C._ignoreSubscribers||E("REPLACE"),N},C}function N1(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function So(e,t){const n=N1(e),r=n.indexOf("#"),o=n.indexOf("?"),s=ri();return{href:n,pathname:n.substring(0,r>0?o>0?Math.min(r,o):r:o>0?o:n.length),hash:r>-1?n.substring(r):"",search:o>-1?n.slice(o,r===-1?void 0:r):"",state:t||{[Yt]:0,key:s,__TSR_key:s}}}function ri(){return(Math.random()+1).toString(36).substring(7)}const O1=!1;function yr(e){let t;return P1(()=>{t=e()}),t}function Sr(e){return e[e.length-1]}function I1(e){return typeof e=="function"}function Wt(e,t){return I1(e)?e(t):e}const D1=Object.prototype.hasOwnProperty,hc=Object.prototype.propertyIsEnumerable;function st(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=t,o=gc(e)&&gc(r);if(!o&&!(Ro(e)&&Ro(r)))return r;const s=o?e:pc(e);if(!s)return r;const a=o?r:pc(r);if(!a)return r;const i=s.length,l=a.length,u=o?new Array(l):{};let f=0;for(let d=0;d<l;d++){const p=o?d:a[d],m=e[p],v=r[p];if(m===v){u[p]=m,(o?d<i:D1.call(e,p))&&f++;continue}if(m===null||v===null||typeof m!="object"||typeof v!="object"){u[p]=v;continue}const g=st(m,v,n+1);u[p]=g,g===m&&f++}return i===l&&f===i?e:u}function pc(e){const t=Object.getOwnPropertyNames(e);for(const o of t)if(!hc.call(e,o))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const r=t;for(const o of n){if(!hc.call(e,o))return!1;r.push(o)}return r}function Ro(e){if(!mc(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!mc(n)||!n.hasOwnProperty("isPrototypeOf"))}function mc(e){return Object.prototype.toString.call(e)==="[object Object]"}function gc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function un(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,o=e.length;r<o;r++)if(!un(e[r],t[r],n))return!1;return!0}if(Ro(e)&&Ro(t)){const r=n?.ignoreUndefined??!0;if(n?.partial){for(const a in t)if((!r||t[a]!==void 0)&&!un(e[a],t[a],n))return!1;return!0}let o=0;if(!r)o=Object.keys(e).length;else for(const a in e)e[a]!==void 0&&o++;let s=0;for(const a in t)if((!r||t[a]!==void 0)&&(s++,s>o||!un(e[a],t[a],n)))return!1;return o===s}return!1}function Un(e){let t,n;const r=new Promise((o,s)=>{t=o,n=s});return r.status="pending",r.resolve=o=>{r.status="resolved",r.value=o,t(o),e?.(o)},r.reject=o=>{r.status="rejected",n(o)},r}function L1(e){return typeof e?.message!="string"?!1:e.message.startsWith("Failed to fetch dynamically imported module")||e.message.startsWith("error loading dynamically imported module")||e.message.startsWith("Importing a module script failed")}function Rr(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function j1(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function vc(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return j1(t)}const k1=["http:","https:","mailto:","tel:"];function Co(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function ir(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,r="",o;for(;(o=t.exec(e))!==null;)r+=vc(e.slice(n,o.index))+o[0],n=t.lastIndex;r=r+vc(n?e.slice(n):e);let s=!1;return r.startsWith("//")&&(s=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:s}}function F1(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}var $1="Invariant failed";function Jt(e,t){if(!e)throw new Error($1)}function Ao(e){const t=new Map;let n,r;const o=s=>{s.next&&(s.prev?(s.prev.next=s.next,s.next.prev=s.prev,s.next=void 0,r&&(r.next=s,s.prev=r)):(s.next.prev=void 0,n=s.next,s.next=void 0,r&&(s.prev=r,r.next=s)),r=s)};return{get(s){const a=t.get(s);if(a)return o(a),a.value},set(s,a){if(t.size>=e&&n){const l=n;t.delete(l.key),l.next&&(n=l.next,l.next.prev=void 0),l===r&&(r=void 0)}const i=t.get(s);if(i)i.value=a,o(i);else{const l={key:s,value:a,prev:r};r&&(r.next=l),r=l,n||(n=l),t.set(s,l)}},clear(){t.clear(),n=void 0,r=void 0}}}const qn=0,pn=1,mn=2,Cr=3,sn=4,cu=5;function H1(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function oi(e,t,n=new Uint16Array(6)){const r=e.indexOf("/",t),o=r===-1?e.length:r,s=e.substring(t,o);if(!s||!s.includes("$"))return n[0]=qn,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n;if(s==="$"){const i=e.length;return n[0]=mn,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}if(s.charCodeAt(0)===36)return n[0]=pn,n[1]=t,n[2]=t+1,n[3]=o,n[4]=o,n[5]=o,n;const a=H1(s);if(a){const[i,l]=a,u=s.charCodeAt(i+1);if(u===45){if(i+2<s.length&&s.charCodeAt(i+2)===36){const f=i+3,d=l;if(f<d)return n[0]=Cr,n[1]=t+i,n[2]=t+f,n[3]=t+d,n[4]=t+l+1,n[5]=o,n}}else if(u===36){const f=i+1,d=i+2;return d===l?(n[0]=mn,n[1]=t+i,n[2]=t+f,n[3]=t+d,n[4]=t+l+1,n[5]=e.length,n):(n[0]=pn,n[1]=t+i,n[2]=t+d,n[3]=t+l,n[4]=t+l+1,n[5]=o,n)}}return n[0]=qn,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n}function Go(e,t,n,r,o,s,a){a?.(n);let i=r;{const l=n.fullPath??n.from,u=l.length,f=n.options?.caseSensitive??e,d=!!(n.options?.params?.parse&&n.options?.skipRouteOnParseError?.params);for(;i<u;){const m=oi(l,i,t);let v;const g=i,y=m[5];switch(i=y+1,s++,m[0]){case qn:{const x=l.substring(m[2],m[3]);if(f){const w=o.static?.get(x);if(w)v=w;else{o.static??=new Map;const E=an(n.fullPath??n.from);E.parent=o,E.depth=s,v=E,o.static.set(x,E)}}else{const w=x.toLowerCase(),E=o.staticInsensitive?.get(w);if(E)v=E;else{o.staticInsensitive??=new Map;const T=an(n.fullPath??n.from);T.parent=o,T.depth=s,v=T,o.staticInsensitive.set(w,T)}}break}case pn:{const x=l.substring(g,m[1]),w=l.substring(m[4],y),E=f&&!!(x||w),T=x?E?x:x.toLowerCase():void 0,O=w?E?w:w.toLowerCase():void 0,C=!d&&o.dynamic?.find(S=>!S.skipOnParamError&&S.caseSensitive===E&&S.prefix===T&&S.suffix===O);if(C)v=C;else{const S=Ls(pn,n.fullPath??n.from,E,T,O);v=S,S.depth=s,S.parent=o,o.dynamic??=[],o.dynamic.push(S)}break}case Cr:{const x=l.substring(g,m[1]),w=l.substring(m[4],y),E=f&&!!(x||w),T=x?E?x:x.toLowerCase():void 0,O=w?E?w:w.toLowerCase():void 0,C=!d&&o.optional?.find(S=>!S.skipOnParamError&&S.caseSensitive===E&&S.prefix===T&&S.suffix===O);if(C)v=C;else{const S=Ls(Cr,n.fullPath??n.from,E,T,O);v=S,S.parent=o,S.depth=s,o.optional??=[],o.optional.push(S)}break}case mn:{const x=l.substring(g,m[1]),w=l.substring(m[4],y),E=f&&!!(x||w),T=x?E?x:x.toLowerCase():void 0,O=w?E?w:w.toLowerCase():void 0,C=Ls(mn,n.fullPath??n.from,E,T,O);v=C,C.parent=o,C.depth=s,o.wildcard??=[],o.wildcard.push(C)}}o=v}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const m=an(n.fullPath??n.from);m.kind=cu,m.parent=o,s++,m.depth=s,o.pathless??=[],o.pathless.push(m),o=m}const p=(n.path||!n.children)&&!n.isRoot;if(p&&l.endsWith("/")){const m=an(n.fullPath??n.from);m.kind=sn,m.parent=o,s++,m.depth=s,o.index=m,o=m}o.parse=n.options?.params?.parse??null,o.skipOnParamError=d,o.parsingPriority=n.options?.skipRouteOnParseError?.priority??0,p&&!o.route&&(o.route=n,o.fullPath=n.fullPath??n.from)}if(n.children)for(const l of n.children)Go(e,t,l,i,o,s,a)}function Ds(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function zt(e){if(e.pathless)for(const t of e.pathless)zt(t);if(e.static)for(const t of e.static.values())zt(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())zt(t);if(e.dynamic?.length){e.dynamic.sort(Ds);for(const t of e.dynamic)zt(t)}if(e.optional?.length){e.optional.sort(Ds);for(const t of e.optional)zt(t)}if(e.wildcard?.length){e.wildcard.sort(Ds);for(const t of e.wildcard)zt(t)}}function an(e){return{kind:qn,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function Ls(e,t,n,r,o){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:n,prefix:r,suffix:o}}function B1(e,t){const n=an("/"),r=new Uint16Array(6);for(const o of e)Go(!1,r,o,1,n,0);zt(n),t.masksTree=n,t.flatCache=Ao(1e3)}function V1(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const r=si(e,t.masksTree);return t.flatCache.set(e,r),r}function Z1(e,t,n,r,o){e||="/",r||="/";const s=t?`case\0${e}`:e;let a=o.singleCache.get(s);if(!a){a=an("/");const i=new Uint16Array(6);Go(t,i,{from:e},1,a,0),o.singleCache.set(s,a)}return si(r,a,n)}function U1(e,t,n=!1){const r=n?e:`nofuzz\0${e}`,o=t.matchCache.get(r);if(o!==void 0)return o;e||="/";let s;try{s=si(e,t.segmentTree,n)}catch(a){if(a instanceof URIError)s=null;else throw a}return s&&(s.branch=K1(s.route)),t.matchCache.set(r,s),s}function q1(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function z1(e,t=!1,n){const r=an(e.fullPath),o=new Uint16Array(6),s={},a={};let i=0;return Go(t,o,e,1,r,0,u=>{if(n?.(u,i),Jt(!(u.id in s),`Duplicate routes found with id: ${String(u.id)}`),s[u.id]=u,i!==0&&u.path){const f=q1(u.fullPath);(!a[f]||u.fullPath.endsWith("/"))&&(a[f]=u)}i++}),zt(r),{processedTree:{segmentTree:r,singleCache:Ao(1e3),matchCache:Ao(1e3),flatCache:null,masksTree:null},routesById:s,routesByPath:a}}function si(e,t,n=!1){const r=e.split("/"),o=G1(e,r,t,n);if(!o)return null;const[s]=lu(e,r,o);return{route:o.node.route,rawParams:s,parsedParams:o.parsedParams}}function lu(e,t,n){const r=W1(n.node);let o=null;const s={};let a=n.extract?.part??0,i=n.extract?.node??0,l=n.extract?.path??0,u=n.extract?.segment??0;for(;i<r.length;a++,i++,l++,u++){const f=r[i];if(f.kind===sn)break;if(f.kind===cu){u--,a--,l--;continue}const d=t[a],p=l;if(d&&(l+=d.length),f.kind===pn){o??=n.node.fullPath.split("/");const m=o[u],v=f.prefix?.length??0;if(m.charCodeAt(v)===123){const y=f.suffix?.length??0,b=m.substring(v+2,m.length-y-1),x=d.substring(v,d.length-y);s[b]=decodeURIComponent(x)}else{const y=m.substring(1);s[y]=decodeURIComponent(d)}}else if(f.kind===Cr){if(n.skipped&1<<i){a--,l=p-1;continue}o??=n.node.fullPath.split("/");const m=o[u],v=f.prefix?.length??0,g=f.suffix?.length??0,y=m.substring(v+3,m.length-g-1),b=f.suffix||f.prefix?d.substring(v,d.length-g):d;b&&(s[y]=decodeURIComponent(b))}else if(f.kind===mn){const m=f,v=e.substring(p+(m.prefix?.length??0),e.length-(m.suffix?.length??0)),g=decodeURIComponent(v);s["*"]=g,s._splat=g;break}}return n.rawParams&&Object.assign(s,n.rawParams),[s,{part:a,node:i,path:l,segment:u}]}function K1(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function W1(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function G1(e,t,n,r){if(e==="/"&&n.index)return{node:n.index,skipped:0};const o=!Sr(t),s=o&&e!=="/",a=t.length-(o?1:0),i=[{node:n,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let l=null,u=null,f=null;for(;i.length;){const d=i.pop(),{node:p,index:m,skipped:v,depth:g,statics:y,dynamics:b,optionals:x}=d;let{extract:w,rawParams:E,parsedParams:T}=d;if(p.skipOnParamError){if(!js(e,t,d))continue;E=d.rawParams,w=d.extract,T=d.parsedParams}r&&p.route&&p.kind!==sn&&cr(u,d)&&(u=d);const O=m===a;if(O&&(p.route&&!s&&cr(f,d)&&(f=d),!p.optional&&!p.wildcard&&!p.index&&!p.pathless))continue;const C=O?void 0:t[m];let S;if(O&&p.index){const N={node:p.index,index:m,skipped:v,depth:g+1,statics:y,dynamics:b,optionals:x,extract:w,rawParams:E,parsedParams:T};let I=!0;if(p.index.skipOnParamError&&(js(e,t,N)||(I=!1)),I){if(y===a&&!b&&!x&&!v)return N;cr(f,N)&&(f=N)}}if(p.wildcard&&cr(l,d))for(const N of p.wildcard){const{prefix:I,suffix:P}=N;if(I&&(O||!(N.caseSensitive?C:S??=C.toLowerCase()).startsWith(I)))continue;if(P){if(O)continue;const z=t.slice(m).join("/").slice(-P.length);if((N.caseSensitive?z:z.toLowerCase())!==P)continue}const H={node:N,index:a,skipped:v,depth:g,statics:y,dynamics:b,optionals:x,extract:w,rawParams:E,parsedParams:T};if(!(N.skipOnParamError&&!js(e,t,H))){l=H;break}}if(p.optional){const N=v|1<<g,I=g+1;for(let P=p.optional.length-1;P>=0;P--){const H=p.optional[P];i.push({node:H,index:m,skipped:N,depth:I,statics:y,dynamics:b,optionals:x,extract:w,rawParams:E,parsedParams:T})}if(!O)for(let P=p.optional.length-1;P>=0;P--){const H=p.optional[P],{prefix:z,suffix:L}=H;if(z||L){const k=H.caseSensitive?C:S??=C.toLowerCase();if(z&&!k.startsWith(z)||L&&!k.endsWith(L))continue}i.push({node:H,index:m+1,skipped:v,depth:I,statics:y,dynamics:b,optionals:x+1,extract:w,rawParams:E,parsedParams:T})}}if(!O&&p.dynamic&&C)for(let N=p.dynamic.length-1;N>=0;N--){const I=p.dynamic[N],{prefix:P,suffix:H}=I;if(P||H){const z=I.caseSensitive?C:S??=C.toLowerCase();if(P&&!z.startsWith(P)||H&&!z.endsWith(H))continue}i.push({node:I,index:m+1,skipped:v,depth:g+1,statics:y,dynamics:b+1,optionals:x,extract:w,rawParams:E,parsedParams:T})}if(!O&&p.staticInsensitive){const N=p.staticInsensitive.get(S??=C.toLowerCase());N&&i.push({node:N,index:m+1,skipped:v,depth:g+1,statics:y+1,dynamics:b,optionals:x,extract:w,rawParams:E,parsedParams:T})}if(!O&&p.static){const N=p.static.get(C);N&&i.push({node:N,index:m+1,skipped:v,depth:g+1,statics:y+1,dynamics:b,optionals:x,extract:w,rawParams:E,parsedParams:T})}if(p.pathless){const N=g+1;for(let I=p.pathless.length-1;I>=0;I--){const P=p.pathless[I];i.push({node:P,index:m,skipped:v,depth:N,statics:y,dynamics:b,optionals:x,extract:w,rawParams:E,parsedParams:T})}}}if(f&&l)return cr(l,f)?f:l;if(f)return f;if(l)return l;if(r&&u){let d=u.index;for(let m=0;m<u.index;m++)d+=t[m].length;const p=d===e.length?"/":e.slice(d);return u.rawParams??={},u.rawParams["**"]=decodeURIComponent(p),u}return null}function js(e,t,n){try{const[r,o]=lu(e,t,n);n.rawParams=r,n.extract=o;const s=n.node.parse(r);return n.parsedParams=Object.assign({},n.parsedParams,s),!0}catch{return null}}function cr(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===sn)>(e.node.kind===sn)||t.node.kind===sn==(e.node.kind===sn)&&t.depth>e.depth))):!0}function po(e){return ai(e.filter(t=>t!==void 0).join("/"))}function ai(e){return e.replace(/\/{2,}/g,"/")}function uu(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Qt(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function du(e){return Qt(uu(e))}function To(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Y1(e,t,n){return To(e,n)===To(t,n)}function Q1({base:e,to:t,trailingSlash:n="never",cache:r}){const o=t.startsWith("/"),s=!o&&t===".";let a;if(r){a=o?t:s?e:e+"\0"+t;const d=r.get(a);if(d)return d}let i;if(s)i=e.split("/");else if(o)i=t.split("/");else{for(i=e.split("/");i.length>1&&Sr(i)==="";)i.pop();const d=t.split("/");for(let p=0,m=d.length;p<m;p++){const v=d[p];v===""?p?p===m-1&&i.push(v):i=[v]:v===".."?i.pop():v==="."||i.push(v)}}i.length>1&&(Sr(i)===""?n==="never"&&i.pop():n==="always"&&i.push(""));let l,u="";for(let d=0;d<i.length;d++){d>0&&(u+="/");const p=i[d];if(!p)continue;l=oi(p,0,l);const m=l[0];if(m===qn){u+=p;continue}const v=l[5],g=p.substring(0,l[1]),y=p.substring(l[4],v),b=p.substring(l[2],l[3]);m===pn?u+=g||y?`${g}{$${b}}${y}`:`$${b}`:m===mn?u+=g||y?`${g}{$}${y}`:"$":u+=`${g}{-$${b}}${y}`}u=ai(u);const f=u||"/";return a&&r&&r.set(a,f),f}function X1(e){const t=new Map(e.map(o=>[encodeURIComponent(o),o])),n=Array.from(t.keys()).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(n,"g");return o=>o.replace(r,s=>t.get(s)??s)}function ks(e,t,n){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(o=>bc(o,n)).join("/"):bc(r,n)}function yc({path:e,params:t,decoder:n,...r}){let o=!1;const s={};if(!e||e==="/")return{interpolatedPath:"/",usedParams:s,isMissingParams:o};if(!e.includes("$"))return{interpolatedPath:e,usedParams:s,isMissingParams:o};const a=e.length;let i=0,l,u="";for(;i<a;){const d=i;l=oi(e,d,l);const p=l[5];if(i=p+1,d===p)continue;const m=l[0];if(m===qn){u+="/"+e.substring(d,p);continue}if(m===mn){const v=t._splat;s._splat=v,s["*"]=v;const g=e.substring(d,l[1]),y=e.substring(l[4],p);if(!v){o=!0,(g||y)&&(u+="/"+g+y);continue}const b=ks("_splat",t,n);u+="/"+g+b+y;continue}if(m===pn){const v=e.substring(l[2],l[3]);!o&&!(v in t)&&(o=!0),s[v]=t[v];const g=e.substring(d,l[1]),y=e.substring(l[4],p),b=ks(v,t,n)??"undefined";u+="/"+g+b+y;continue}if(m===Cr){const v=e.substring(l[2],l[3]),g=t[v];if(g==null)continue;s[v]=g;const y=e.substring(d,l[1]),b=e.substring(l[4],p),x=ks(v,t,n)??"";u+="/"+y+x+b;continue}}return e.endsWith("/")&&(u+="/"),{usedParams:s,interpolatedPath:u||"/",isMissingParams:o}}function bc(e,t){const n=encodeURIComponent(e);return t?.(n)??n}function fu(e={}){if(e.isNotFound=!0,e.throw)throw e;return e}function et(e){return!!e?.isNotFound}function J1(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const fa="tsr-scroll-restoration-v1_3",em=(e,t)=>{let n;return(...r)=>{n||(n=setTimeout(()=>{e(...r),n=null},t))}};function tm(){const e=J1();if(!e)return null;const t=e.getItem(fa);let n=t?JSON.parse(t):{};return{state:n,set:r=>{n=Wt(r,n)||n;try{e.setItem(fa,JSON.stringify(n))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}const Jr=tm(),nm=e=>e.state.__TSR_key||e.href;function rm(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}let Po=!1;function om({storageKey:e,key:t,behavior:n,shouldScrollRestoration:r,scrollToTopSelectors:o,location:s}){let a;try{a=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(u){console.error(u);return}const i=t||window.history.state?.__TSR_key,l=a[i];Po=!0;e:{if(r&&l&&Object.keys(l).length>0){for(const d in l){const p=l[d];if(d==="window")window.scrollTo({top:p.scrollY,left:p.scrollX,behavior:n});else if(d){const m=document.querySelector(d);m&&(m.scrollLeft=p.scrollX,m.scrollTop=p.scrollY)}}break e}const u=(s??window.location).hash.split("#",2)[1];if(u){const d=window.history.state?.__hashScrollIntoViewOptions??!0;if(d){const p=document.getElementById(u);p&&p.scrollIntoView(d)}break e}const f={top:0,left:0,behavior:n};if(window.scrollTo(f),o)for(const d of o){if(d==="window")continue;const p=typeof d=="function"?d():document.querySelector(d);p&&p.scrollTo(f)}}Po=!1}function sm(e,t){if(!Jr||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!Jr))return;e.isScrollRestorationSetup=!0,Po=!1;const r=e.options.getScrollRestorationKey||nm;window.history.scrollRestoration="manual";const o=s=>{if(Po||!e.isScrollRestoring)return;let a="";if(s.target===document||s.target===window)a="window";else{const l=s.target.getAttribute("data-scroll-restoration-id");l?a=`[data-scroll-restoration-id="${l}"]`:a=rm(s.target)}const i=r(e.state.location);Jr.set(l=>{const u=l[i]||={},f=u[a]||={};if(a==="window")f.scrollX=window.scrollX||0,f.scrollY=window.scrollY||0;else if(a){const d=document.querySelector(a);d&&(f.scrollX=d.scrollLeft||0,f.scrollY=d.scrollTop||0)}return l})};typeof document<"u"&&document.addEventListener("scroll",em(o,100),!0),e.subscribe("onRendered",s=>{const a=r(s.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(om({storageKey:fa,key:a,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&Jr.set(i=>(i[a]||={},i)))})}function am(e){if(typeof document<"u"&&document.querySelector){const t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==""){const n=document.getElementById(e.state.location.hash);n&&n.scrollIntoView(t)}}}function im(e,t=String){const n=new URLSearchParams;for(const r in e){const o=e[r];o!==void 0&&n.set(r,t(o))}return n.toString()}function Fs(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function cm(e){const t=new URLSearchParams(e),n={};for(const[r,o]of t.entries()){const s=n[r];s==null?n[r]=Fs(o):Array.isArray(s)?s.push(Fs(o)):n[r]=[s,Fs(o)]}return n}const lm=dm(JSON.parse),um=fm(JSON.stringify,JSON.parse);function dm(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=cm(t);for(const r in n){const o=n[r];if(typeof o=="string")try{n[r]=e(o)}catch{}}return n}}function fm(e,t){const n=typeof t=="function";function r(o){if(typeof o=="object"&&o!==null)try{return e(o)}catch{}else if(n&&typeof o=="string")try{return t(o),e(o)}catch{}return o}return o=>{const s=im(o,r);return s?`?${s}`:""}}const ft="__root__";function hu(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function at(e){return e instanceof Response&&!!e.options}const ha=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Yo=(e,t)=>!!(e.preload&&!e.router.state.matches.some(n=>n.id===t)),Hn=(e,t,n=!0)=>{const r={...e.router.options.context??{}},o=n?t:t-1;for(let s=0;s<=o;s++){const a=e.matches[s];if(!a)continue;const i=e.router.getMatch(a.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},xc=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,r=e.matches.findIndex(a=>a.routeId===e.router.routeTree.id),o=r>=0?r:0;let s=n?e.matches.findIndex(a=>a.routeId===n):e.firstBadMatchIndex??e.matches.length-1;s<0&&(s=o);for(let a=s;a>=0;a--){const i=e.matches[a];if(e.router.looseRoutesById[i.routeId].options.notFoundComponent)return a}return n?s:o},Gt=(e,t,n)=>{if(!(!at(n)&&!et(n)))throw at(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:at(n)?"redirected":r.status==="pending"?"success":r.status,context:Hn(e,t.index),isFetching:!1,error:n})),et(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),at(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},pu=(e,t)=>!!e.router.getMatch(t)._nonReactive.dehydrated,lr=(e,t,n,r)=>{const{id:o,routeId:s}=e.matches[t],a=e.router.looseRoutesById[s];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,Gt(e,e.router.getMatch(o),n);try{a.options.onError?.(n)}catch(i){n=i,Gt(e,e.router.getMatch(o),n)}e.updateMatch(o,i=>(i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,i._nonReactive.loadPromise?.resolve(),{...i,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!at(n)&&!et(n)&&(e.serialError??=n)},mu=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;const o=n.options.pendingMs??e.router.options.defaultPendingMs;if(!!(e.onReady&&!Yo(e,t)&&(n.options.loader||n.options.beforeLoad||vu(n))&&typeof o=="number"&&o!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent))){const a=setTimeout(()=>{ha(e)},o);r._nonReactive.pendingTimeout=a}},hm=(e,t,n)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;mu(e,t,n,r);const o=()=>{const s=e.router.getMatch(t);s.preload&&(s.status==="redirected"||s.status==="notFound")&&Gt(e,s,s.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(o):o()},pm=(e,t,n,r)=>{const o=e.router.getMatch(t),s=o._nonReactive.loadPromise;o._nonReactive.loadPromise=Un(()=>{s?.resolve()});const{paramsError:a,searchError:i}=o;a&&lr(e,n,a,"PARSE_PARAMS"),i&&lr(e,n,i,"VALIDATE_SEARCH"),mu(e,t,r,o);const l=new AbortController;let u=!1;const f=()=>{u||(u=!0,e.updateMatch(t,E=>({...E,isFetching:"beforeLoad",fetchCount:E.fetchCount+1,abortController:l})))},d=()=>{o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,E=>({...E,isFetching:!1}))};if(!r.options.beforeLoad){yr(()=>{f(),d()});return}o._nonReactive.beforeLoadPromise=Un();const p={...Hn(e,n,!1),...o.__routeContext},{search:m,params:v,cause:g}=o,y=Yo(e,t),b={search:m,abortController:l,params:v,preload:y,context:p,location:e.location,navigate:E=>e.router.navigate({...E,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:y?"preload":g,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},x=E=>{if(E===void 0){yr(()=>{f(),d()});return}(at(E)||et(E))&&(f(),lr(e,n,E,"BEFORE_LOAD")),yr(()=>{f(),e.updateMatch(t,T=>({...T,__beforeLoadContext:E})),d()})};let w;try{if(w=r.options.beforeLoad(b),Rr(w))return f(),w.catch(E=>{lr(e,n,E,"BEFORE_LOAD")}).then(x)}catch(E){f(),lr(e,n,E,"BEFORE_LOAD")}x(w)},mm=(e,t)=>{const{id:n,routeId:r}=e.matches[t],o=e.router.looseRoutesById[r],s=()=>i(),a=()=>pm(e,n,t,o),i=()=>{if(pu(e,n))return;const l=hm(e,n,o);return Rr(l)?l.then(a):a()};return s()},gm=(e,t,n)=>{const r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const o={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(o),n.options.scripts?.(o),n.options.headers?.(o)]).then(([s,a,i])=>{const l=s?.meta,u=s?.links,f=s?.scripts,d=s?.styles;return{meta:l,links:u,headScripts:f,headers:i,scripts:a,styles:d}})},gu=(e,t,n,r,o)=>{const s=t[r-1],{params:a,loaderDeps:i,abortController:l,cause:u}=e.router.getMatch(n),f=Hn(e,r),d=Yo(e,n);return{params:a,deps:i,preload:!!d,parentMatchPromise:s,abortController:l,context:f,location:e.location,navigate:p=>e.router.navigate({...p,_fromLocation:e.location}),cause:d?"preload":u,route:o,...e.router.options.additionalContext}},wc=async(e,t,n,r,o)=>{try{const s=e.router.getMatch(n);try{(!(O1??e.router.isServer)||s.ssr===!0)&&Mo(o);const a=o.options.loader?.(gu(e,t,n,r,o)),i=o.options.loader&&Rr(a);if((i||o._lazyPromise||o._componentsPromise||o.options.head||o.options.scripts||o.options.headers||s._nonReactive.minPendingPromise)&&e.updateMatch(n,f=>({...f,isFetching:"loader"})),o.options.loader){const f=i?await a:a;Gt(e,e.router.getMatch(n),f),f!==void 0&&e.updateMatch(n,d=>({...d,loaderData:f}))}o._lazyPromise&&await o._lazyPromise;const u=s._nonReactive.minPendingPromise;u&&await u,o._componentsPromise&&await o._componentsPromise,e.updateMatch(n,f=>({...f,error:void 0,context:Hn(e,r),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(a){let i=a;if(i?.name==="AbortError"){if(s.abortController.signal.aborted){s._nonReactive.loaderPromise?.resolve(),s._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,u=>({...u,status:u.status==="pending"?"success":u.status,isFetching:!1,context:Hn(e,r)}));return}const l=s._nonReactive.minPendingPromise;l&&await l,et(a)&&await o.options.notFoundComponent?.preload?.(),Gt(e,e.router.getMatch(n),a);try{o.options.onError?.(a)}catch(u){i=u,Gt(e,e.router.getMatch(n),u)}e.updateMatch(n,u=>({...u,error:i,context:Hn(e,r),status:"error",isFetching:!1}))}}catch(s){const a=e.router.getMatch(n);a&&(a._nonReactive.loaderPromise=void 0),Gt(e,a,s)}},vm=async(e,t,n)=>{async function r(d,p,m,v){const g=Date.now()-p.updatedAt,y=d?v.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:v.options.staleTime??e.router.options.defaultStaleTime??0,b=v.options.shouldReload,x=typeof b=="function"?b(gu(e,t,o,n,v)):b,{status:w,invalid:E}=m;a=w==="success"&&(E||(x??g>y)),d&&v.options.preload===!1||(a&&!e.sync?(i=!0,(async()=>{try{await wc(e,t,o,n,v);const T=e.router.getMatch(o);T._nonReactive.loaderPromise?.resolve(),T._nonReactive.loadPromise?.resolve(),T._nonReactive.loaderPromise=void 0}catch(T){at(T)&&await e.router.navigate(T.options)}})()):(w!=="success"||a&&e.sync)&&await wc(e,t,o,n,v))}const{id:o,routeId:s}=e.matches[n];let a=!1,i=!1;const l=e.router.looseRoutesById[s];if(!pu(e,o)){const d=e.router.getMatch(o),p=Yo(e,o);if(d._nonReactive.loaderPromise){if(d.status==="success"&&!e.sync&&!d.preload)return d;await d._nonReactive.loaderPromise;const m=e.router.getMatch(o),v=m._nonReactive.error||m.error;v&&Gt(e,m,v),m.status==="pending"&&await r(p,d,m,l)}else{const m=p&&!e.router.state.matches.some(g=>g.id===o),v=e.router.getMatch(o);v._nonReactive.loaderPromise=Un(),m!==v.preload&&e.updateMatch(o,g=>({...g,preload:m})),await r(p,d,v,l)}}const u=e.router.getMatch(o);i||(u._nonReactive.loaderPromise?.resolve(),u._nonReactive.loadPromise?.resolve()),clearTimeout(u._nonReactive.pendingTimeout),u._nonReactive.pendingTimeout=void 0,i||(u._nonReactive.loaderPromise=void 0),u._nonReactive.dehydrated=void 0;const f=i?u.isFetching:!1;return f!==u.isFetching||u.invalid!==!1?(e.updateMatch(o,d=>({...d,isFetching:f,invalid:!1})),e.router.getMatch(o)):u};async function Ec(e){const t=e,n=[];t.router.state.matches.some(p=>p._forcePending)&&ha(t);let r;for(let p=0;p<t.matches.length;p++){try{const m=mm(t,p);Rr(m)&&await m}catch(m){if(at(m))throw m;if(et(m))r=m;else if(!t.preload)throw m;break}if(t.serialError)break}const o=t.firstBadMatchIndex??t.matches.length,s=r&&!t.preload?xc(t,r):void 0,a=r&&t.preload?0:s!==void 0?Math.min(s+1,o):o;let i,l;for(let p=0;p<a;p++)n.push(vm(t,n,p));try{await Promise.all(n)}catch{const p=await Promise.allSettled(n);for(const m of p){if(m.status!=="rejected")continue;const v=m.reason;if(at(v))throw v;et(v)?i??=v:l??=v}if(l!==void 0)throw l}const u=i??(r&&!t.preload?r:void 0);let f=t.serialError?t.firstBadMatchIndex??0:t.matches.length-1;if(!u&&r&&t.preload)return t.matches;if(u){const p=xc(t,u);Jt(p!==void 0);const m=t.matches[p],v=t.router.looseRoutesById[m.routeId],g=t.router.options?.defaultNotFoundComponent;!v.options.notFoundComponent&&g&&(v.options.notFoundComponent=g),u.routeId=m.routeId;const y=m.routeId===t.router.routeTree.id;t.updateMatch(m.id,b=>({...b,...y?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:u},isFetching:!1})),f=p,await Mo(v)}else if(!t.preload){const p=t.matches[0];p.globalNotFound||t.router.getMatch(p.id)?.globalNotFound&&t.updateMatch(p.id,v=>({...v,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const p=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await Mo(p)}for(let p=0;p<=f;p++){const m=t.matches[p],{id:v,routeId:g}=m,y=t.router.looseRoutesById[g];try{const b=gm(t,v,y);if(b){const x=await b;t.updateMatch(v,w=>({...w,...x}))}}catch(b){console.error(`Error executing head for route ${g}:`,b)}}const d=ha(t);if(Rr(d)&&await d,u)throw u;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}async function Mo(e){if(!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{const{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){const t=()=>{const n=[];for(const r of yu){const o=e.options[r]?.preload;o&&n.push(o())}if(n.length)return Promise.all(n).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(t):t()}return e._componentsPromise}function vu(e){for(const t of yu)if(e.options[t]?.preload)return!0;return!1}const yu=["component","errorComponent","pendingComponent","notFoundComponent"];function ym(e){return{input:({url:t})=>{for(const n of e)t=pa(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=bu(e[n],t);return t}}}function bm(e){const t=du(e.basepath),n=`/${t}`,r=`${n}/`,o=e.caseSensitive?n:n.toLowerCase(),s=e.caseSensitive?r:r.toLowerCase();return{input:({url:a})=>{const i=e.caseSensitive?a.pathname:a.pathname.toLowerCase();return i===o?a.pathname="/":i.startsWith(s)&&(a.pathname=a.pathname.slice(n.length)),a},output:({url:a})=>(a.pathname=po(["/",t,a.pathname]),a)}}function pa(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function bu(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function dn(e){const t=e.resolvedLocation,n=e.location,r=t?.pathname!==n.pathname,o=t?.href!==n.href,s=t?.hash!==n.hash;return{fromLocation:t,toLocation:n,pathChanged:r,hrefChanged:o,hashChanged:s}}function xm(e){const t=e.filter(n=>n.status!=="redirected");return t.length===e.length?e:t}class wm{constructor(t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=n=>n(),this.update=n=>{const r=this.options,o=this.basepath??r?.basepath??"/",s=this.basepath===void 0,a=r?.rewrite;if(this.options={...r,...n},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=X1(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=_1()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let p;this.resolvePathCache=Ao(1e3),p=this.buildRouteTree(),this.setRoutes(p)}!this.__store&&this.latestLocation&&(this.__store=T1(Sm(this.latestLocation)),sm(this));let i=!1;const l=this.options.basepath??"/",u=this.options.rewrite;if(s||o!==l||a!==u){this.basepath=l;const p=[],m=du(l);m&&m!=="/"&&p.push(bm({basepath:l})),u&&p.push(u),this.rewrite=p.length===0?void 0:p.length===1?p[0]:ym(p),this.history&&this.updateLatestLocation(),i=!0}i&&this.__store&&this.__store.setState(p=>({...p,location:this.latestLocation})),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=z1(this.routeTree,this.options.caseSensitive,(r,o)=>{r.init({originalIndex:o})});return this.options.routeMasks&&B1(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,r)=>{const o={eventType:n,fn:r};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}},this.emit=n=>{this.subscribers.forEach(r=>{r.eventType===n.type&&r.fn(n)})},this.parseLocation=(n,r)=>{const o=({pathname:l,search:u,hash:f,href:d,state:p})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){const x=this.options.parseSearch(u),w=this.options.stringifySearch(x);return{href:l+w+f,publicHref:d,pathname:ir(l).path,external:!1,searchStr:w,search:st(r?.search,x),hash:ir(f.slice(1)).path,state:st(r?.state,p)}}const m=new URL(d,this.origin),v=pa(this.rewrite,m),g=this.options.parseSearch(v.search),y=this.options.stringifySearch(g);return v.search=y,{href:v.href.replace(v.origin,""),publicHref:d,pathname:ir(v.pathname).path,external:!!this.rewrite&&v.origin!==this.origin,searchStr:y,search:st(r?.search,g),hash:ir(v.hash.slice(1)).path,state:st(r?.state,p)}},s=o(n),{__tempLocation:a,__tempKey:i}=s.state;if(a&&(!i||i===this.tempLocationKey)){const l=o(a);return l.state.key=s.state.key,l.state.__TSR_key=s.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:s}}return s},this.resolvePathWithBase=(n,r)=>Q1({base:n,to:ai(r),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,r,o)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:r},o):this.matchRoutesInternal(n,r),this.getMatchedRoutes=n=>Rm({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const r=this.getMatch(n);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const n=this.state.matches.filter(s=>s.status==="pending"),r=this.state.matches.filter(s=>s.isFetching==="loader");new Set([...this.state.pendingMatches??[],...n,...r]).forEach(s=>{this.cancelMatch(s.id)})},this.buildLocation=n=>{const r=(s={})=>{const a=s._fromLocation||this.pendingBuiltLocation||this.latestLocation,i=this.matchRoutesLightweight(a);s.from;const l=s.unsafeRelative==="path"?a.pathname:s.from??i.fullPath,u=this.resolvePathWithBase(l,"."),f=i.search,d={...i.params},p=s.to?this.resolvePathWithBase(u,`${s.to}`):this.resolvePathWithBase(u,"."),m=s.params===!1||s.params===null?{}:(s.params??!0)===!0?d:Object.assign(d,Wt(s.params,d)),v=this.getMatchedRoutes(p);let g=v.matchedRoutes;if((!v.foundRoute||v.foundRoute.path!=="/"&&v.routeParams["**"])&&this.options.notFoundRoute&&(g=[...g,this.options.notFoundRoute]),Object.keys(m).length>0)for(const P of g){const H=P.options.params?.stringify??P.options.stringifyParams;if(H)try{Object.assign(m,H(m))}catch{}}const b=n.leaveParams?p:ir(yc({path:p,params:m,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let x=f;if(n._includeValidateSearch&&this.options.search?.strict){const P={};g.forEach(H=>{if(H.options.validateSearch)try{Object.assign(P,mo(H.options.validateSearch,{...P,...x}))}catch{}}),x=P}x=Cm({search:x,dest:s,destRoutes:g,_includeValidateSearch:n._includeValidateSearch}),x=st(f,x);const w=this.options.stringifySearch(x),E=s.hash===!0?a.hash:s.hash?Wt(s.hash,a.hash):void 0,T=E?`#${E}`:"";let O=s.state===!0?a.state:s.state?Wt(s.state,a.state):{};O=st(a.state,O);const C=`${b}${w}${T}`;let S,N,I=!1;if(this.rewrite){const P=new URL(C,this.origin),H=bu(this.rewrite,P);S=P.href.replace(P.origin,""),H.origin!==this.origin?(N=H.href,I=!0):N=H.pathname+H.search+H.hash}else S=F1(C),N=S;return{publicHref:N,href:S,pathname:b,search:x,searchStr:w,state:O,hash:E??"",external:I,unmaskOnReload:s.unmaskOnReload}},o=(s={},a)=>{const i=r(s);let l=a?r(a):void 0;if(!l){const u={};if(this.options.routeMasks){const f=V1(i.pathname,this.processedTree);if(f){Object.assign(u,f.rawParams);const{from:d,params:p,...m}=f.route,v=p===!1||p===null?{}:(p??!0)===!0?u:Object.assign(u,Wt(p,u));a={from:n.from,...m,params:v},l=r(a)}}}return l&&(i.maskedLocation=l),i};return n.mask?o(n,{from:n.from,...n.mask}):o(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:r,...o})=>{const s=()=>{const l=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];l.forEach(f=>{o.state[f]=this.latestLocation.state[f]});const u=un(o.state,this.latestLocation.state);return l.forEach(f=>{delete o.state[f]}),u},a=Qt(this.latestLocation.href)===Qt(o.href),i=this.commitLocationPromise;if(this.commitLocationPromise=Un(()=>{i?.resolve()}),a&&s())this.load();else{let{maskedLocation:l,hashScrollIntoView:u,...f}=o;l&&(f={...l,state:{...l.state,__tempKey:void 0,__tempLocation:{...f,search:f.searchStr,state:{...f.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(f.unmaskOnReload??this.options.unmaskOnReload??!1)&&(f.state.__tempKey=this.tempLocationKey)),f.state.__hashScrollIntoViewOptions=u??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,this.history[o.replace?"replace":"push"](f.publicHref,f.state,{ignoreBlocker:r})}return this.resetNextScroll=o.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,hashScrollIntoView:o,viewTransition:s,ignoreBlocker:a,href:i,...l}={})=>{if(i){const d=this.history.location.state.__TSR_index,p=So(i,{__TSR_index:n?d:d+1}),m=new URL(p.pathname,this.origin),v=pa(this.rewrite,m);l.to=v.pathname,l.search=this.options.parseSearch(p.search),l.hash=p.hash.slice(1)}const u=this.buildLocation({...l,_includeValidateSearch:!0});this.pendingBuiltLocation=u;const f=this.commitLocation({...u,viewTransition:s,replace:n,resetScroll:r,hashScrollIntoView:o,ignoreBlocker:a});return Promise.resolve().then(()=>{this.pendingBuiltLocation===u&&(this.pendingBuiltLocation=void 0)}),f},this.navigate=async({to:n,reloadDocument:r,href:o,publicHref:s,...a})=>{let i=!1;if(o)try{new URL(`${o}`),i=!0}catch{}if(i&&!r&&(r=!0),r){if(n!==void 0||!o){const u=this.buildLocation({to:n,...a});o=o??u.publicHref,s=s??u.publicHref}const l=!i&&s?s:o;if(Co(l,this.protocolAllowlist))return Promise.resolve();if(!a.ignoreBlocker){const f=this.history.getBlockers?.()??[];for(const d of f)if(d?.blockerFn&&await d.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return a.replace?window.location.replace(l):window.location.href=l,Promise.resolve()}return this.buildAndCommitLocation({...a,href:o,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation);this.__store.setState(r=>({...r,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:n,cachedMatches:r.cachedMatches.filter(o=>!n.some(s=>s.id===o.id))}))},this.load=async n=>{let r,o,s;for(s=new Promise(i=>{this.startTransition(async()=>{try{this.beforeLoad();const l=this.latestLocation,u=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...dn({resolvedLocation:u,location:l})}),this.emit({type:"onBeforeLoad",...dn({resolvedLocation:u,location:l})}),await Ec({router:this,sync:n?.sync,matches:this.state.pendingMatches,location:l,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let f=[],d=[],p=[],m=[];yr(()=>{this.__store.setState(v=>{const g=v.matches,y=v.pendingMatches||v.matches;return f=g.filter(b=>!y.some(x=>x.id===b.id)),d=g.filter(b=>!y.some(x=>x.routeId===b.routeId)),p=y.filter(b=>!g.some(x=>x.routeId===b.routeId)),m=y.filter(b=>g.some(x=>x.routeId===b.routeId)),{...v,isLoading:!1,loadedAt:Date.now(),matches:y,pendingMatches:void 0,cachedMatches:[...v.cachedMatches,...f.filter(b=>b.status!=="error"&&b.status!=="notFound"&&b.status!=="redirected")]}}),this.clearExpiredCache()}),[[d,"onLeave"],[p,"onEnter"],[m,"onStay"]].forEach(([v,g])=>{v.forEach(y=>{this.looseRoutesById[y.routeId].options[g]?.(y)})})})})}})}catch(l){at(l)?(r=l,this.navigate({...r.options,replace:!0,ignoreBlocker:!0})):et(l)&&(o=l),this.__store.setState(u=>({...u,statusCode:r?r.status:o?404:u.matches.some(f=>f.status==="error")?500:200,redirect:r}))}this.latestLoadPromise===s&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),i()})}),this.latestLoadPromise=s,await s;this.latestLoadPromise&&s!==this.latestLoadPromise;)await this.latestLoadPromise;let a;this.hasNotFoundMatch()?a=404:this.__store.state.matches.some(i=>i.status==="error")&&(a=500),a!==void 0&&this.__store.setState(i=>({...i,statusCode:a}))},this.startViewTransition=n=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let o;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const s=this.latestLocation,a=this.state.resolvedLocation,i=typeof r.types=="function"?r.types(dn({resolvedLocation:a,location:s})):r.types;if(i===!1){n();return}o={update:n,types:i}}else o=n;document.startViewTransition(o)}else n()},this.updateMatch=(n,r)=>{this.startTransition(()=>{const o=this.state.pendingMatches?.some(s=>s.id===n)?"pendingMatches":this.state.matches.some(s=>s.id===n)?"matches":this.state.cachedMatches.some(s=>s.id===n)?"cachedMatches":"";o&&(o==="cachedMatches"?this.__store.setState(s=>({...s,cachedMatches:xm(s.cachedMatches.map(a=>a.id===n?r(a):a))})):this.__store.setState(s=>({...s,[o]:s[o]?.map(a=>a.id===n?r(a):a)})))})},this.getMatch=n=>{const r=o=>o.id===n;return this.state.cachedMatches.find(r)??this.state.pendingMatches?.find(r)??this.state.matches.find(r)},this.invalidate=n=>{const r=o=>n?.filter?.(o)??!0?{...o,invalid:!0,...n?.forcePending||o.status==="error"||o.status==="notFound"?{status:"pending",error:void 0}:void 0}:o;return this.__store.setState(o=>({...o,matches:o.matches.map(r),cachedMatches:o.cachedMatches.map(r),pendingMatches:o.pendingMatches?.map(r)})),this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const r=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const o=n.options._builtLocation??this.buildLocation(n.options),s=this.getParsedLocationHref(o);n.options.href=s,n.headers.set("Location",s)}else if(r)try{const o=new URL(r);if(this.origin&&o.origin===this.origin){const s=o.pathname+o.search+o.hash;n.options.href=s,n.headers.set("Location",s)}}catch{}if(n.options.href&&!n.options._builtLocation&&Co(n.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const r=n?.filter;r!==void 0?this.__store.setState(o=>({...o,cachedMatches:o.cachedMatches.filter(s=>!r(s))})):this.__store.setState(o=>({...o,cachedMatches:[]}))},this.clearExpiredCache=()=>{const n=r=>{const o=this.looseRoutesById[r.routeId];if(!o.options.loader)return!0;const s=(r.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return r.status==="error"?!0:Date.now()-r.updatedAt>=s};this.clearCache({filter:n})},this.loadRouteChunk=Mo,this.preloadRoute=async n=>{const r=n._builtLocation??this.buildLocation(n);let o=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:n});const s=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(i=>i.id)),a=new Set([...s,...this.state.cachedMatches.map(i=>i.id)]);yr(()=>{o.forEach(i=>{a.has(i.id)||this.__store.setState(l=>({...l,cachedMatches:[...l.cachedMatches,i]}))})});try{return o=await Ec({router:this,matches:o,location:r,preload:!0,updateMatch:(i,l)=>{s.has(i)?o=o.map(u=>u.id===i?l(u):u):this.updateMatch(i,l)}}),o}catch(i){if(at(i))return i.options.reloadDocument?void 0:await this.preloadRoute({...i.options,_fromLocation:r});et(i)||console.error(i);return}},this.matchRoute=(n,r)=>{const o={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},s=this.buildLocation(o);if(r?.pending&&this.state.status!=="pending")return!1;const i=(r?.pending===void 0?!this.state.isLoading:r.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,l=Z1(s.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,i.pathname,this.processedTree);return!l||n.params&&!un(l.rawParams,n.params,{partial:!0})?!1:r?.includeSearch??!0?un(i.search,s.search,{partial:!0})?l.rawParams:!1:l.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(n=>n.status==="notFound"||n.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,caseSensitive:t.caseSensitive??!1,notFoundMode:t.notFoundMode??"fuzzy",stringifySearch:t.stringifySearch??um,parseSearch:t.parseSearch??lm,protocolAllowlist:t.protocolAllowlist??k1}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:t,routesByPath:n,processedTree:r}){this.routesById=t,this.routesByPath=n,this.processedTree=r;const o=this.options.notFoundRoute;o&&(o.init({originalIndex:99999999999}),this.routesById[o.id]=o)}get looseRoutesById(){return this.routesById}getParentContext(t){return t?.id?t.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(t,n){const r=this.getMatchedRoutes(t.pathname),{foundRoute:o,routeParams:s,parsedParams:a}=r;let{matchedRoutes:i}=r,l=!1;(o?o.path!=="/"&&s["**"]:Qt(t.pathname))&&(this.options.notFoundRoute?i=[...i,this.options.notFoundRoute]:l=!0);const u=l?Tm(this.options.notFoundMode,i):void 0,f=new Array(i.length),d=new Map(this.state.matches.map(p=>[p.routeId,p]));for(let p=0;p<i.length;p++){const m=i[p],v=f[p-1];let g,y,b;{const L=v?.search??t.search,k=v?._strictSearch??void 0;try{const A=mo(m.options.validateSearch,{...L})??void 0;g={...L,...A},y={...k,...A},b=void 0}catch(A){let D=A;if(A instanceof _o||(D=new _o(A.message,{cause:A})),n?.throwOnError)throw D;g=L,y={},b=D}}const x=m.options.loaderDeps?.({search:g})??"",w=x?JSON.stringify(x):"",{interpolatedPath:E,usedParams:T}=yc({path:m.fullPath,params:s,decoder:this.pathParamsDecoder,server:this.isServer}),O=m.id+E+w,C=this.getMatch(O),S=d.get(m.id),N=C?._strictParams??T;let I;if(!C)try{Sc(m,T,a,N)}catch(L){if(et(L)||at(L)?I=L:I=new Em(L.message,{cause:L}),n?.throwOnError)throw I}Object.assign(s,N);const P=S?"stay":"enter";let H;if(C)H={...C,cause:P,params:S?.params??s,_strictParams:N,search:st(S?S.search:C.search,g),_strictSearch:y};else{const L=m.options.loader||m.options.beforeLoad||m.lazyFn||vu(m)?"pending":"success";H={id:O,ssr:m.options.ssr,index:p,routeId:m.id,params:S?.params??s,_strictParams:N,pathname:E,updatedAt:Date.now(),search:S?st(S.search,g):g,_strictSearch:y,searchError:void 0,status:L,isFetching:!1,error:void 0,paramsError:I,__routeContext:void 0,_nonReactive:{loadPromise:Un()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:P,loaderDeps:S?st(S.loaderDeps,x):x,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:m.options.staticData||{},fullPath:m.fullPath}}n?.preload||(H.globalNotFound=u===m.id),H.searchError=b;const z=this.getParentContext(v);H.context={...z,...H.__routeContext,...H.__beforeLoadContext},f[p]=H}for(let p=0;p<f.length;p++){const m=f[p],v=this.looseRoutesById[m.routeId],g=this.getMatch(m.id),y=d.get(m.routeId);if(m.params=y?st(y.params,s):s,!g){const b=f[p-1],x=this.getParentContext(b);if(v.options.context){const w={deps:m.loaderDeps,params:m.params,context:x??{},location:t,navigate:E=>this.navigate({...E,_fromLocation:t}),buildLocation:this.buildLocation,cause:m.cause,abortController:m.abortController,preload:!!m.preload,matches:f,routeId:v.id};m.__routeContext=v.options.context(w)??void 0}m.context={...x,...m.__routeContext,...m.__beforeLoadContext}}}return f}matchRoutesLightweight(t){const{matchedRoutes:n,routeParams:r,parsedParams:o}=this.getMatchedRoutes(t.pathname),s=Sr(n),a={...t.search};for(const f of n)try{Object.assign(a,mo(f.options.validateSearch,a))}catch{}const i=Sr(this.state.matches),l=i&&i.routeId===s.id&&t.pathname===this.state.location.pathname;let u;if(l)u=i.params;else{const f={...r};for(const d of n)try{Sc(d,r,o??{},f)}catch{}u=f}return{matchedRoutes:n,fullPath:s.fullPath,search:a,params:u}}}class _o extends Error{}class Em extends Error{}function Sm(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function mo(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new _o("Async validation not supported");if(n.issues)throw new _o(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function Rm({pathname:e,routesById:t,processedTree:n}){const r={},o=Qt(e);let s,a;const i=U1(o,n,!0);return i&&(s=i.route,Object.assign(r,i.rawParams),a=Object.assign({},i.parsedParams)),{matchedRoutes:i?.branch||[t[ft]],routeParams:r,foundRoute:s,parsedParams:a}}function Cm({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return Am(n)(e,t,r??!1)}function Am(e){const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const o of e){if("search"in o.options)o.options.search?.middlewares&&t.middlewares.push(...o.options.search.middlewares);else if(o.options.preSearchFilters||o.options.postSearchFilters){const s=({search:a,next:i})=>{let l=a;"preSearchFilters"in o.options&&o.options.preSearchFilters&&(l=o.options.preSearchFilters.reduce((f,d)=>d(f),a));const u=i(l);return"postSearchFilters"in o.options&&o.options.postSearchFilters?o.options.postSearchFilters.reduce((f,d)=>d(f),u):u};t.middlewares.push(s)}if(o.options.validateSearch){const s=({search:a,next:i})=>{const l=i(a);if(!t._includeValidateSearch)return l;try{return{...l,...mo(o.options.validateSearch,l)??void 0}}catch{return l}};t.middlewares.push(s)}}const n=({search:o})=>{const s=t.dest;return s.search?s.search===!0?o:Wt(s.search,o):{}};t.middlewares.push(n);const r=(o,s,a)=>{if(o>=a.length)return s;const i=a[o];return i({search:s,next:u=>r(o+1,u,a)})};return function(s,a,i){return t.dest=a,t._includeValidateSearch=i,r(0,s,t.middlewares)}}function Tm(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.children)return r.id}return ft}function Sc(e,t,n,r){const o=e.options.params?.parse??e.options.parseParams;if(o)if(e.options.skipRouteOnParseError)for(const s in t)s in n&&(r[s]=n[s]);else{const s=o(r);Object.assign(r,s)}}const Pm="Error preloading route! ☝️";class xu{constructor(t){if(this.init=n=>{this.originalIndex=n.originalIndex;const r=this.options,o=!r?.path&&!r?.id;this.parentRoute=this.options.getParentRoute?.(),o?this._path=ft:this.parentRoute||Jt(!1);let s=o?ft:r?.path;s&&s!=="/"&&(s=uu(s));const a=r?.id||s;let i=o?ft:po([this.parentRoute.id===ft?"":this.parentRoute.id,a]);s===ft&&(s="/"),i!==ft&&(i=po(["/",i]));const l=i===ft?"/":po([this.parentRoute.fullPath,s]);this._path=s,this._id=i,this._fullPath=l,this._to=Qt(l)},this.addChildren=n=>this._addFileChildren(n),this._addFileChildren=n=>(Array.isArray(n)&&(this.children=n),typeof n=="object"&&n!==null&&(this.children=Object.values(n)),this),this._addFileTypes=()=>this,this.updateLoader=n=>(Object.assign(this.options,n),this),this.update=n=>(Object.assign(this.options,n),this),this.lazy=n=>(this.lazyFn=n,this),this.redirect=n=>hu({from:this.fullPath,...n}),this.options=t||{},this.isRoot=!t?.getParentRoute,t?.id&&t?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class Mm{constructor({id:t}){this.notFound=n=>fu({routeId:this.id,...n}),this.redirect=n=>hu({from:this.id,...n}),this.id=t}}class _m extends xu{constructor(t){super(t)}}const Nm="use",Rc=Ko[Nm],eo=typeof window<"u"?c.useLayoutEffect:c.useEffect;function $s(e){const t=c.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function Om(e,t,n={},r={}){c.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!="function")return;const o=new IntersectionObserver(([s])=>{t(s)},n);return o.observe(e.current),()=>{o.disconnect()}},[t,n,r.disabled,e])}function Im(e){const t=c.useRef(null);return c.useImperativeHandle(e,()=>t.current,[]),t}function ii(e){const t=e.errorComponent??ci;return h.jsx(Dm,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?c.createElement(t,{error:n,reset:r}):e.children})}class Dm extends c.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidUpdate(t,n){n.error&&n.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(t,n){this.props.onCatch&&this.props.onCatch(t,n)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function ci({error:e}){const[t,n]=c.useState(!1);return h.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[h.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),h.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),h.jsx("div",{style:{height:".25rem"}}),t?h.jsx("div",{children:h.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?h.jsx("code",{children:e.message}):null})}):null]})}function Lm({children:e,fallback:t=null}){return wu()?h.jsx(M.Fragment,{children:e}):h.jsx(M.Fragment,{children:t})}function wu(){return M.useSyncExternalStore(jm,()=>!0,()=>!1)}function jm(){return()=>{}}function km(e,t){return e===t}function Fm(e,t,n=km){const r=c.useCallback(a=>{if(!e)return()=>{};const{unsubscribe:i}=e.subscribe(a);return i},[e]),o=c.useCallback(()=>e?.get(),[e]);return Qp.useSyncExternalStoreWithSelector(r,o,o,t,n)}const Eu=c.createContext(null);function Ge(e){const t=c.useContext(Eu);return e?.warn,t}function it(e){const t=Ge({warn:e?.router===void 0}),n=e?.router||t,r=c.useRef(void 0);return Fm(n.__store,o=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const s=st(r.current,e.select(o));return r.current=s,s}return e.select(o)}return o})}const Qo=c.createContext(void 0),$m=c.createContext(void 0);function gt(e){const t=c.useContext(e.from?$m:Qo);return it({select:r=>{const o=r.matches.find(s=>e.from?e.from===s.routeId:s.id===t);if(Jt(!((e.shouldThrow??!0)&&!o),`Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`),o!==void 0)return e.select?e.select(o):o},structuralSharing:e.structuralSharing})}function Xo(e){return gt({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Jo(e){const{select:t,...n}=e;return gt({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function es(e){return gt({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function ts(e){return gt({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Sn(e){const t=Ge();return c.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Hm(e,t){const n=Ge(),r=Im(t),{activeProps:o,inactiveProps:s,activeOptions:a,to:i,preload:l,preloadDelay:u,hashScrollIntoView:f,replace:d,startTransition:p,resetScroll:m,viewTransition:v,children:g,target:y,disabled:b,style:x,className:w,onClick:E,onBlur:T,onFocus:O,onMouseEnter:C,onMouseLeave:S,onTouchStart:N,ignoreBlocker:I,params:P,search:H,hash:z,state:L,mask:k,reloadDocument:A,unsafeRelative:D,from:j,_fromLocation:_,...V}=e,K=wu(),Y=it({select:ie=>{const ge=ie.matches[ie.matches.length-1];return{search:ge?.search,hash:ie.location.hash,path:ge?.pathname}},structuralSharing:!0}),B=e.from,q=c.useMemo(()=>({...e,from:B}),[n,Y,B,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),U=c.useMemo(()=>n.buildLocation({...q}),[n,q]),J=U.maskedLocation?U.maskedLocation.publicHref:U.publicHref,$=U.maskedLocation?U.maskedLocation.external:U.external,F=c.useMemo(()=>zm(J,$,n.history,b),[b,$,J,n.history]),ee=c.useMemo(()=>{if(F?.external)return Co(F.href,n.protocolAllowlist)?void 0:F.href;if(!Km(i)&&!(typeof i!="string"||i.indexOf(":")===-1))try{return new URL(i),Co(i,n.protocolAllowlist)?void 0:i}catch{}},[i,F,n.protocolAllowlist]),Z=it({select:ie=>{if(ee)return!1;if(a?.exact){if(!Y1(ie.location.pathname,U.pathname,n.basepath))return!1}else{const ge=To(ie.location.pathname,n.basepath),Re=To(U.pathname,n.basepath);if(!(ge.startsWith(Re)&&(ge.length===Re.length||ge[Re.length]==="/")))return!1}return(a?.includeSearch??!0)&&!un(ie.location.search,U.search,{partial:!a?.exact,ignoreUndefined:!a?.explicitUndefined})?!1:a?.includeHash?K&&ie.location.hash===U.hash:!0}}),X=Z?Wt(o,{})??Bm:Hs,te=Z?Hs:Wt(s,{})??Hs,ae=[w,X.className,te.className].filter(Boolean).join(" "),le=(x||X.style||te.style)&&{...x,...X.style,...te.style},[Qe,Fe]=c.useState(!1),qe=c.useRef(!1),ct=e.reloadDocument||ee?!1:l??n.options.defaultPreload,Le=u??n.options.defaultPreloadDelay??0,Ne=c.useCallback(()=>{n.preloadRoute({...q,_builtLocation:U}).catch(ie=>{console.warn(ie),console.warn(Pm)})},[n,q,U]),Zt=c.useCallback(ie=>{ie?.isIntersecting&&Ne()},[Ne]);Om(r,Zt,qm,{disabled:!!b||ct!=="viewport"}),c.useEffect(()=>{qe.current||!b&&ct==="render"&&(Ne(),qe.current=!0)},[b,Ne,ct]);const Te=ie=>{const ge=ie.currentTarget.getAttribute("target"),Re=y!==void 0?y:ge;if(!b&&!Wm(ie)&&!ie.defaultPrevented&&(!Re||Re==="_self")&&ie.button===0){ie.preventDefault(),$t.flushSync(()=>{Fe(!0)});const ut=n.subscribe("onResolved",()=>{ut(),Fe(!1)});n.navigate({...q,replace:d,resetScroll:m,hashScrollIntoView:f,startTransition:p,viewTransition:v,ignoreBlocker:I})}};if(ee)return{...V,ref:r,href:ee,...g&&{children:g},...y&&{target:y},...b&&{disabled:b},...x&&{style:x},...w&&{className:w},...E&&{onClick:E},...T&&{onBlur:T},...O&&{onFocus:O},...C&&{onMouseEnter:C},...S&&{onMouseLeave:S},...N&&{onTouchStart:N}};const lt=ie=>{if(b||ct!=="intent")return;if(!Le){Ne();return}const ge=ie.currentTarget;if(ur.has(ge))return;const Re=setTimeout(()=>{ur.delete(ge),Ne()},Le);ur.set(ge,Re)},Tn=ie=>{b||ct!=="intent"||Ne()},Pn=ie=>{if(b||!ct||!Le)return;const ge=ie.currentTarget,Re=ur.get(ge);Re&&(clearTimeout(Re),ur.delete(ge))};return{...V,...X,...te,href:F?.href,ref:r,onClick:Nn([E,Te]),onBlur:Nn([T,Pn]),onFocus:Nn([O,lt]),onMouseEnter:Nn([C,lt]),onMouseLeave:Nn([S,Pn]),onTouchStart:Nn([N,Tn]),disabled:!!b,target:y,...le&&{style:le},...ae&&{className:ae},...b&&Vm,...Z&&Zm,...K&&Qe&&Um}}const Hs={},Bm={className:"active"},Vm={role:"link","aria-disabled":!0},Zm={"data-status":"active","aria-current":"page"},Um={"data-transitioning":"transitioning"},ur=new WeakMap,qm={rootMargin:"100px"},Nn=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function zm(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function Km(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}const Pt=c.forwardRef((e,t)=>{const{_asChild:n,...r}=e,{type:o,...s}=Hm(r,t),a=typeof r.children=="function"?r.children({isActive:s["data-status"]==="active"}):r.children;if(!n){const{disabled:i,...l}=s;return c.createElement("a",l,a)}return c.createElement(n,s,a)});function Wm(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Gm(e){return new Ym({id:e})}class Ym extends Mm{constructor({id:t}){super({id:t}),this.useMatch=n=>gt({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>gt({from:this.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>ts({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>es({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>Jo({...n,from:this.id,strict:!1}),this.useLoaderData=n=>Xo({...n,from:this.id,strict:!1}),this.useNavigate=()=>{const n=Ge();return Sn({from:n.routesById[this.id].fullPath})},this.notFound=n=>fu({routeId:this.id,...n}),this.Link=M.forwardRef((n,r)=>{const s=Ge().routesById[this.id].fullPath;return h.jsx(Pt,{ref:r,from:s,...n})})}}let Qm=class extends xu{constructor(t){super(t),this.useMatch=n=>gt({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>gt({...n,from:this.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>ts({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>es({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>Jo({...n,from:this.id}),this.useLoaderData=n=>Xo({...n,from:this.id}),this.useNavigate=()=>Sn({from:this.fullPath}),this.Link=M.forwardRef((n,r)=>h.jsx(Pt,{ref:r,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}};function Ie(e){return new Qm(e)}class Xm extends _m{constructor(t){super(t),this.useMatch=n=>gt({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>gt({...n,from:this.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>ts({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>es({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>Jo({...n,from:this.id}),this.useLoaderData=n=>Xo({...n,from:this.id}),this.useNavigate=()=>Sn({from:this.fullPath}),this.Link=M.forwardRef((n,r)=>h.jsx(Pt,{ref:r,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}}function Jm(e){return new Xm(e)}function Cc(e){return typeof e=="object"?new Ac(e,{silent:!0}).createRoute(e):new Ac(e,{silent:!0}).createRoute}class Ac{constructor(t,n){this.path=t,this.createRoute=r=>{const o=Ie(r);return o.isRoot=!1,o},this.silent=n?.silent}}class Tc{constructor(t){this.useMatch=n=>gt({select:n?.select,from:this.options.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>gt({from:this.options.id,select:r=>n?.select?n.select(r.context):r.context}),this.useSearch=n=>ts({select:n?.select,structuralSharing:n?.structuralSharing,from:this.options.id}),this.useParams=n=>es({select:n?.select,structuralSharing:n?.structuralSharing,from:this.options.id}),this.useLoaderDeps=n=>Jo({...n,from:this.options.id}),this.useLoaderData=n=>Xo({...n,from:this.options.id}),this.useNavigate=()=>{const n=Ge();return Sn({from:n.routesById[this.options.id].fullPath})},this.options=t,this.$$typeof=Symbol.for("react.memo")}}function Pc(e){return typeof e=="object"?new Tc(e):t=>new Tc({id:e,...t})}function Ue(e,t){let n,r,o,s;const a=()=>(n||(n=e().then(l=>{n=void 0,r=l.default}).catch(l=>{if(o=l,L1(o)&&o instanceof Error&&typeof window<"u"&&typeof sessionStorage<"u"){const u=`tanstack_router_reload:${o.message}`;sessionStorage.getItem(u)||(sessionStorage.setItem(u,"1"),s=!0)}})),n),i=function(u){if(s)throw window.location.reload(),new Promise(()=>{});if(o)throw o;if(!r)if(Rc)Rc(a());else throw a();return c.createElement(r,u)};return i.preload=a,i}function eg(){const e=Ge(),t=c.useRef({router:e,mounted:!1}),[n,r]=c.useState(!1),{hasPendingMatches:o,isLoading:s}=it({select:d=>({isLoading:d.isLoading,hasPendingMatches:d.matches.some(p=>p.status==="pending")}),structuralSharing:!0}),a=$s(s),i=s||n||o,l=$s(i),u=s||o,f=$s(u);return e.startTransition=d=>{r(!0),c.startTransition(()=>{d(),r(!1)})},c.useEffect(()=>{const d=e.history.subscribe(e.load),p=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Qt(e.latestLocation.publicHref)!==Qt(p.publicHref)&&e.commitLocation({...p,replace:!0}),()=>{d()}},[e,e.history]),eo(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(p){console.error(p)}})()},[e]),eo(()=>{a&&!s&&e.emit({type:"onLoad",...dn(e.state)})},[a,e,s]),eo(()=>{f&&!u&&e.emit({type:"onBeforeRouteMount",...dn(e.state)})},[u,f,e]),eo(()=>{if(l&&!i){const d=dn(e.state);e.emit({type:"onResolved",...d}),e.__store.setState(p=>({...p,status:"idle",resolvedLocation:p.location})),d.hrefChanged&&am(e)}},[i,l,e]),null}function tg(e){const t=it({select:n=>`not-found-${n.location.pathname}-${n.status}`});return h.jsx(ii,{getResetKey:()=>t,onCatch:(n,r)=>{if(et(n))e.onCatch?.(n,r);else throw n},errorComponent:({error:n})=>{if(et(n))return e.fallback?.(n);throw n},children:e.children})}function ng(){return h.jsx("p",{children:"Not Found"})}function kn(e){return h.jsx(h.Fragment,{children:e.children})}function Su(e,t,n){return t.options.notFoundComponent?h.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?h.jsx(e.options.defaultNotFoundComponent,{...n}):h.jsx(ng,{})}function rg(){return Ge().isScrollRestoring,null}const Ru=c.memo(function({matchId:t}){const n=Ge(),r=it({select:g=>{const y=g.matches.findIndex(x=>x.id===t),b=g.matches[y];return Jt(b),{routeId:b.routeId,ssr:b.ssr,_displayPending:b._displayPending,resetKey:g.loadedAt,parentRouteId:g.matches[y-1]?.routeId}},structuralSharing:!0}),o=n.routesById[r.routeId],s=o.options.pendingComponent??n.options.defaultPendingComponent,a=s?h.jsx(s,{}):null,i=o.options.errorComponent??n.options.defaultErrorComponent,l=o.options.onCatch??n.options.defaultOnCatch,u=o.isRoot?o.options.notFoundComponent??n.options.notFoundRoute?.options.component:o.options.notFoundComponent,f=r.ssr===!1||r.ssr==="data-only",d=(!o.isRoot||o.options.wrapInSuspense||f)&&(o.options.wrapInSuspense??s??(o.options.errorComponent?.preload||f))?c.Suspense:kn,p=i?ii:kn,m=u?tg:kn,v=o.isRoot?o.options.shellComponent??kn:kn;return h.jsxs(v,{children:[h.jsx(Qo.Provider,{value:t,children:h.jsx(d,{fallback:a,children:h.jsx(p,{getResetKey:()=>r.resetKey,errorComponent:i||ci,onCatch:(g,y)=>{if(et(g))throw g;l?.(g,y)},children:h.jsx(m,{fallback:g=>{if(!u||g.routeId&&g.routeId!==r.routeId||!g.routeId&&!o.isRoot)throw g;return c.createElement(u,g)},children:f||r._displayPending?h.jsx(Lm,{fallback:a,children:h.jsx(Mc,{matchId:t})}):h.jsx(Mc,{matchId:t})})})})}),r.parentRouteId===ft&&n.options.scrollRestoration?h.jsxs(h.Fragment,{children:[h.jsx(og,{}),h.jsx(rg,{})]}):null]})});function og(){const e=Ge(),t=c.useRef(void 0);return h.jsx("script",{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...dn(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}const Mc=c.memo(function({matchId:t}){const n=Ge(),{match:r,key:o,routeId:s}=it({select:l=>{const u=l.matches.find(v=>v.id===t),f=u.routeId,p=(n.routesById[f].options.remountDeps??n.options.defaultRemountDeps)?.({routeId:f,loaderDeps:u.loaderDeps,params:u._strictParams,search:u._strictSearch});return{key:p?JSON.stringify(p):void 0,routeId:f,match:{id:u.id,status:u.status,error:u.error,invalid:u.invalid,_forcePending:u._forcePending,_displayPending:u._displayPending}}},structuralSharing:!0}),a=n.routesById[s],i=c.useMemo(()=>{const l=a.options.component??n.options.defaultComponent;return l?h.jsx(l,{},o):h.jsx(Cu,{})},[o,a.options.component,n.options.defaultComponent]);if(r._displayPending)throw n.getMatch(r.id)?._nonReactive.displayPendingPromise;if(r._forcePending)throw n.getMatch(r.id)?._nonReactive.minPendingPromise;if(r.status==="pending"){const l=a.options.pendingMinMs??n.options.defaultPendingMinMs;if(l){const u=n.getMatch(r.id);if(u&&!u._nonReactive.minPendingPromise){const f=Un();u._nonReactive.minPendingPromise=f,setTimeout(()=>{f.resolve(),u._nonReactive.minPendingPromise=void 0},l)}}throw n.getMatch(r.id)?._nonReactive.loadPromise}if(r.status==="notFound")return Jt(et(r.error)),Su(n,a,r.error);if(r.status==="redirected")throw Jt(at(r.error)),n.getMatch(r.id)?._nonReactive.loadPromise;if(r.status==="error")throw r.error;return i}),Cu=c.memo(function(){const t=Ge(),n=c.useContext(Qo),r=it({select:u=>u.matches.find(f=>f.id===n)?.routeId}),o=t.routesById[r],s=it({select:u=>{const d=u.matches.find(p=>p.id===n);return Jt(d),d.globalNotFound}}),a=it({select:u=>{const f=u.matches,d=f.findIndex(p=>p.id===n);return f[d+1]?.id}}),i=t.options.defaultPendingComponent?h.jsx(t.options.defaultPendingComponent,{}):null;if(s)return Su(t,o,void 0);if(!a)return null;const l=h.jsx(Ru,{matchId:a});return r===ft?h.jsx(c.Suspense,{fallback:i,children:l}):l});function sg(){const e=Ge(),n=e.routesById[ft].options.pendingComponent??e.options.defaultPendingComponent,r=n?h.jsx(n,{}):null,o=typeof document<"u"&&e.ssr?kn:c.Suspense,s=h.jsxs(o,{fallback:r,children:[h.jsx(eg,{}),h.jsx(ag,{})]});return e.options.InnerWrap?h.jsx(e.options.InnerWrap,{children:s}):s}function ag(){const e=Ge(),t=it({select:o=>o.matches[0]?.id}),n=it({select:o=>o.loadedAt}),r=t?h.jsx(Ru,{matchId:t}):null;return h.jsx(Qo.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:h.jsx(ii,{getResetKey:()=>n,errorComponent:ci,onCatch:void 0,children:r})})}const ig=e=>new cg(e);class cg extends wm{constructor(t){super(t)}}typeof globalThis<"u"?(globalThis.createFileRoute=Cc,globalThis.createLazyFileRoute=Pc):typeof window<"u"&&(window.createFileRoute=Cc,window.createLazyFileRoute=Pc);function lg({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=h.jsx(Eu.Provider,{value:e,children:t});return e.options.Wrap?h.jsx(e.options.Wrap,{children:r}):r}function ug({router:e,...t}){return h.jsx(lg,{router:e,...t,children:h.jsx(sg,{})})}function ns(e){return it({select:t=>e?.select?e.select(t.location):t.location})}var Yn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},dg={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},fg=class{#e=dg;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},cn=new fg;function hg(e){setTimeout(e,0)}var gn=typeof window>"u"||"Deno"in globalThis;function Ke(){}function pg(e,t){return typeof e=="function"?e(t):e}function ma(e){return typeof e=="number"&&e>=0&&e!==1/0}function Au(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Xt(e,t){return typeof e=="function"?e(t):e}function ht(e,t){return typeof e=="function"?e(t):e}function _c(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:s,queryKey:a,stale:i}=e;if(a){if(r){if(t.queryHash!==li(a,t.options))return!1}else if(!Ar(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||o&&o!==t.state.fetchStatus||s&&!s(t))}function Nc(e,t){const{exact:n,status:r,predicate:o,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(vn(t.options.mutationKey)!==vn(s))return!1}else if(!Ar(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function li(e,t){return(t?.queryKeyHashFn||vn)(e)}function vn(e){return JSON.stringify(e,(t,n)=>ga(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Ar(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ar(e[n],t[n])):!1}var mg=Object.prototype.hasOwnProperty;function Tu(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Oc(e)&&Oc(t);if(!r&&!(ga(e)&&ga(t)))return t;const s=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),i=a.length,l=r?new Array(i):{};let u=0;for(let f=0;f<i;f++){const d=r?f:a[f],p=e[d],m=t[d];if(p===m){l[d]=p,(r?f<s:mg.call(e,d))&&u++;continue}if(p===null||m===null||typeof p!="object"||typeof m!="object"){l[d]=m;continue}const v=Tu(p,m,n+1);l[d]=v,v===p&&u++}return s===i&&u===s?e:l}function No(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Oc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ga(e){if(!Ic(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Ic(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ic(e){return Object.prototype.toString.call(e)==="[object Object]"}function gg(e){return new Promise(t=>{cn.setTimeout(t,e)})}function va(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Tu(e,t):t}function vg(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function yg(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ui=Symbol();function Pu(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ui?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function di(e,t){return typeof e=="function"?e(...t):!!e}function bg(e,t,n){let r=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??=t(),r||(r=!0,o.aborted?n():o.addEventListener("abort",n,{once:!0})),o)}),e}var xg=class extends Yn{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!gn&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},fi=new xg;function ya(){let e,t;const n=new Promise((o,s)=>{e=o,t=s});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}var wg=hg;function Eg(){let e=[],t=0,n=i=>{i()},r=i=>{i()},o=wg;const s=i=>{t?e.push(i):o(()=>{n(i)})},a=()=>{const i=e;e=[],i.length&&o(()=>{r(()=>{i.forEach(l=>{n(l)})})})};return{batch:i=>{let l;t++;try{l=i()}finally{t--,t||a()}return l},batchCalls:i=>(...l)=>{s(()=>{i(...l)})},schedule:s,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{r=i},setScheduler:i=>{o=i}}}var _e=Eg(),Sg=class extends Yn{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!gn&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},Oo=new Sg;function Rg(e){return Math.min(1e3*2**e,3e4)}function Mu(e){return(e??"online")==="online"?Oo.isOnline():!0}var ba=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function _u(e){let t=!1,n=0,r;const o=ya(),s=()=>o.status!=="pending",a=g=>{if(!s()){const y=new ba(g);p(y),e.onCancel?.(y)}},i=()=>{t=!0},l=()=>{t=!1},u=()=>fi.isFocused()&&(e.networkMode==="always"||Oo.isOnline())&&e.canRun(),f=()=>Mu(e.networkMode)&&e.canRun(),d=g=>{s()||(r?.(),o.resolve(g))},p=g=>{s()||(r?.(),o.reject(g))},m=()=>new Promise(g=>{r=y=>{(s()||u())&&g(y)},e.onPause?.()}).then(()=>{r=void 0,s()||e.onContinue?.()}),v=()=>{if(s())return;let g;const y=n===0?e.initialPromise:void 0;try{g=y??e.fn()}catch(b){g=Promise.reject(b)}Promise.resolve(g).then(d).catch(b=>{if(s())return;const x=e.retry??(gn?0:3),w=e.retryDelay??Rg,E=typeof w=="function"?w(n,b):w,T=x===!0||typeof x=="number"&&n<x||typeof x=="function"&&x(n,b);if(t||!T){p(b);return}n++,e.onFail?.(n,b),gg(E).then(()=>u()?void 0:m()).then(()=>{t?p(b):v()})})};return{promise:o,status:()=>o.status,cancel:a,continue:()=>(r?.(),o),cancelRetry:i,continueRetry:l,canStart:f,start:()=>(f()?v():m().then(v),o)}}var Nu=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ma(this.gcTime)&&(this.#e=cn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(gn?1/0:300*1e3))}clearGcTimeout(){this.#e&&(cn.clearTimeout(this.#e),this.#e=void 0)}},Cg=class extends Nu{#e;#t;#n;#o;#r;#a;#i;constructor(e){super(),this.#i=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#o=e.client,this.#n=this.#o.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Lc(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=Lc(this.options);t.data!==void 0&&(this.setState(Dc(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=va(this.state.data,e,this.options);return this.#s({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(Ke).catch(Ke):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>ht(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ui||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Xt(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Au(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#i?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const i=this.observers.find(l=>l.options.queryFn);i&&this.setOptions(i.options)}const n=new AbortController,r=i=>{Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(this.#i=!0,n.signal)})},o=()=>{const i=Pu(this.options,t),u=(()=>{const f={client:this.#o,queryKey:this.queryKey,meta:this.meta};return r(f),f})();return this.#i=!1,this.options.persister?this.options.persister(i,u,this):i(u)},a=(()=>{const i={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#o,state:this.state,fetchFn:o};return r(i),i})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:"fetch",meta:a.fetchOptions?.meta}),this.#r=_u({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:i=>{i instanceof ba&&i.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(i,l)=>{this.#s({type:"failed",failureCount:i,error:l})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const i=await this.#r.start();if(i===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(i),this.#n.config.onSuccess?.(i,this),this.#n.config.onSettled?.(i,this.state.error,this),i}catch(i){if(i instanceof ba){if(i.silent)return this.#r.promise;if(i.revert){if(this.state.data===void 0)throw i;return this.state.data}}throw this.#s({type:"error",error:i}),this.#n.config.onError?.(i,this),this.#n.config.onSettled?.(this.state.data,i,this),i}finally{this.scheduleGc()}}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Ou(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...Dc(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?r:void 0,r;case"error":const o=e.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),_e.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Ou(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Mu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Dc(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Lc(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Iu=class extends Yn{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#i=ya(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#o=void 0;#r;#a;#i;#s;#m;#f;#h;#l;#u;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),jc(this.#t,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return xa(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return xa(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ht(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#E(),this.#t.setOptions(this.options),t._defaulted&&!No(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&kc(this.#t,n,this.options,t)&&this.#d(),this.updateResult(),r&&(this.#t!==n||ht(this.options.enabled,this.#t)!==ht(t.enabled,this.#t)||Xt(this.options.staleTime,this.#t)!==Xt(t.staleTime,this.#t))&&this.#g();const o=this.#v();r&&(this.#t!==n||ht(this.options.enabled,this.#t)!==ht(t.enabled,this.#t)||o!==this.#c)&&this.#y(o)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Tg(this,n)&&(this.#o=n,this.#a=this.options,this.#r=this.#t.state),n}getCurrentResult(){return this.#o}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#i.status==="pending"&&this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#o))}#d(e){this.#E();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Ke)),t}#g(){this.#x();const e=Xt(this.options.staleTime,this.#t);if(gn||this.#o.isStale||!ma(e))return;const n=Au(this.#o.dataUpdatedAt,e)+1;this.#l=cn.setTimeout(()=>{this.#o.isStale||this.updateResult()},n)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#c=e,!(gn||ht(this.options.enabled,this.#t)===!1||!ma(this.#c)||this.#c===0)&&(this.#u=cn.setInterval(()=>{(this.options.refetchIntervalInBackground||fi.isFocused())&&this.#d()},this.#c))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#l&&(cn.clearTimeout(this.#l),this.#l=void 0)}#w(){this.#u&&(cn.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#t,r=this.options,o=this.#o,s=this.#r,a=this.#a,l=e!==n?e.state:this.#n,{state:u}=e;let f={...u},d=!1,p;if(t._optimisticResults){const S=this.hasListeners(),N=!S&&jc(e,t),I=S&&kc(e,n,t,r);(N||I)&&(f={...f,...Ou(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:m,errorUpdatedAt:v,status:g}=f;p=f.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&g==="pending"){let S;o?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(S=o.data,y=!0):S=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,S!==void 0&&(g="success",p=va(o?.data,S,t),d=!0)}if(t.select&&p!==void 0&&!y)if(o&&p===s?.data&&t.select===this.#m)p=this.#f;else try{this.#m=t.select,p=t.select(p),p=va(o?.data,p,t),this.#f=p,this.#s=null}catch(S){this.#s=S}this.#s&&(m=this.#s,p=this.#f,v=Date.now(),g="error");const b=f.fetchStatus==="fetching",x=g==="pending",w=g==="error",E=x&&b,T=p!==void 0,C={status:g,fetchStatus:f.fetchStatus,isPending:x,isSuccess:g==="success",isError:w,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:f.dataUpdatedAt,error:m,errorUpdatedAt:v,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>l.dataUpdateCount||f.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:w&&!T,isPaused:f.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:w&&T,isStale:hi(e,t),refetch:this.refetch,promise:this.#i,isEnabled:ht(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const S=C.data!==void 0,N=C.status==="error"&&!S,I=z=>{N?z.reject(C.error):S&&z.resolve(C.data)},P=()=>{const z=this.#i=C.promise=ya();I(z)},H=this.#i;switch(H.status){case"pending":e.queryHash===n.queryHash&&I(H);break;case"fulfilled":(N||C.data!==H.value)&&P();break;case"rejected":(!N||C.error!==H.reason)&&P();break}}return C}updateResult(){const e=this.#o,t=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#a=this.options,this.#r.data!==void 0&&(this.#h=this.#t),No(t,e))return;this.#o=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,o=typeof r=="function"?r():r;if(o==="all"||!o&&!this.#p.size)return!0;const s=new Set(o??this.#p);return this.options.throwOnError&&s.add("error"),Object.keys(this.#o).some(a=>{const i=a;return this.#o[i]!==e[i]&&s.has(i)})};this.#S({listeners:n()})}#E(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(e){_e.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#o)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Ag(e,t){return ht(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function jc(e,t){return Ag(e,t)||e.state.data!==void 0&&xa(e,t,t.refetchOnMount)}function xa(e,t,n){if(ht(t.enabled,e)!==!1&&Xt(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&hi(e,t)}return!1}function kc(e,t,n,r){return(e!==t||ht(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&hi(e,n)}function hi(e,t){return ht(t.enabled,e)!==!1&&e.isStaleByTime(Xt(t.staleTime,e))}function Tg(e,t){return!No(e.getCurrentResult(),t)}function Fc(e){return{onFetch:(t,n)=>{const r=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let i={pages:[],pageParams:[]},l=0;const u=async()=>{let f=!1;const d=v=>{bg(v,()=>t.signal,()=>f=!0)},p=Pu(t.options,t.fetchOptions),m=async(v,g,y)=>{if(f)return Promise.reject();if(g==null&&v.pages.length)return Promise.resolve(v);const x=(()=>{const O={client:t.client,queryKey:t.queryKey,pageParam:g,direction:y?"backward":"forward",meta:t.options.meta};return d(O),O})(),w=await p(x),{maxPages:E}=t.options,T=y?yg:vg;return{pages:T(v.pages,w,E),pageParams:T(v.pageParams,g,E)}};if(o&&s.length){const v=o==="backward",g=v?Pg:$c,y={pages:s,pageParams:a},b=g(r,y);i=await m(y,b,v)}else{const v=e??s.length;do{const g=l===0?a[0]??r.initialPageParam:$c(r,i);if(l>0&&g==null)break;i=await m(i,g),l++}while(l<v)}return i};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function $c(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Pg(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Mg=class extends Nu{#e;#t;#n;#o;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Du(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#o?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#o=_u({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(s,a)=>{this.#r({type:"failed",failureCount:s,error:a})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",o=!this.#o.canStart();try{if(r)t();else{this.#r({type:"pending",variables:e,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const a=await this.options.onMutate?.(e,n);a!==this.state.context&&this.#r({type:"pending",context:a,variables:e,isPaused:o})}const s=await this.#o.start();return await this.#n.config.onSuccess?.(s,e,this.state.context,this,n),await this.options.onSuccess?.(s,e,this.state.context,n),await this.#n.config.onSettled?.(s,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(s,null,e,this.state.context,n),this.#r({type:"success",data:s}),s}catch(s){try{await this.#n.config.onError?.(s,e,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onError?.(s,e,this.state.context,n)}catch(a){Promise.reject(a)}try{await this.#n.config.onSettled?.(void 0,s,this.state.variables,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onSettled?.(void 0,s,e,this.state.context,n)}catch(a){Promise.reject(a)}throw this.#r({type:"error",error:s}),s}finally{this.#n.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),_e.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function Du(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var _g=class extends Yn{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new Mg({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=to(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=to(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=to(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(o=>o.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=to(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){_e.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Nc(t,n))}findAll(e={}){return this.getAll().filter(t=>Nc(e,t))}notify(e){_e.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return _e.batch(()=>Promise.all(e.map(t=>t.continue().catch(Ke))))}};function to(e){return e.options.scope?.id}var Ng=class extends Yn{#e;#t=void 0;#n;#o;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),No(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&vn(n.mutationKey)!==vn(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#a(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#a()}mutate(t,n){return this.#o=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#r(){const t=this.#n?.state??Du();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#a(t){_e.batch(()=>{if(this.#o&&this.hasListeners()){const n=this.#t.variables,r=this.#t.context,o={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#o.onSuccess?.(t.data,n,r,o)}catch(s){Promise.reject(s)}try{this.#o.onSettled?.(t.data,null,n,r,o)}catch(s){Promise.reject(s)}}else if(t?.type==="error"){try{this.#o.onError?.(t.error,n,r,o)}catch(s){Promise.reject(s)}try{this.#o.onSettled?.(void 0,t.error,n,r,o)}catch(s){Promise.reject(s)}}}this.listeners.forEach(n=>{n(this.#t)})})}},Og=class extends Yn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,o=t.queryHash??li(r,t);let s=this.get(o);return s||(s=new Cg({client:e,queryKey:r,queryHash:o,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(s)),s}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){_e.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>_c(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>_c(e,n)):t}notify(e){_e.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){_e.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){_e.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ig=class{#e;#t;#n;#o;#r;#a;#i;#s;constructor(e={}){this.#e=e.queryCache||new Og,this.#t=e.mutationCache||new _g,this.#n=e.defaultOptions||{},this.#o=new Map,this.#r=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#i=fi.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Oo.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#i?.(),this.#i=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Xt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=this.#e.get(r.queryHash)?.state.data,a=pg(t,s);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return _e.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;_e.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return _e.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=_e.batch(()=>this.#e.findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Ke).catch(Ke)}invalidateQueries(e,t={}){return _e.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=_e.batch(()=>this.#e.findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let s=o.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ke)),o.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ke)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(Xt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ke).catch(Ke)}fetchInfiniteQuery(e){return e.behavior=Fc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ke).catch(Ke)}ensureInfiniteQueryData(e){return e.behavior=Fc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Oo.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#o.set(vn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#o.values()],n={};return t.forEach(r=>{Ar(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(vn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Ar(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=li(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ui&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Lu=c.createContext(void 0),Qn=e=>{const t=c.useContext(Lu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Dg=({client:e,children:t})=>(c.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),h.jsx(Lu.Provider,{value:e,children:t})),ju=c.createContext(!1),Lg=()=>c.useContext(ju);ju.Provider;function ku(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Fu=c.createContext(ku()),jg=()=>c.useContext(Fu),kg=({children:e})=>{const[t]=c.useState(()=>ku());return h.jsx(Fu.Provider,{value:t,children:typeof e=="function"?e(t):e})},Fg=(e,t,n)=>{const r=n?.state.error&&typeof e.throwOnError=="function"?di(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},$g=e=>{c.useEffect(()=>{e.clearReset()},[e])},Hg=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||di(n,[e.error,r])),Bg=(e,t)=>t.state.data===void 0,Vg=e=>{if(e.suspense){const n=o=>o==="static"?o:Math.max(o??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...o)=>n(r(...o)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Zg=(e,t)=>e.isLoading&&e.isFetching&&!t,Ug=(e,t)=>e?.suspense&&t.isPending,Hc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function $u(e,t,n){const r=Lg(),o=jg(),s=Qn(),a=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const i=s.getQueryCache().get(a.queryHash);a._optimisticResults=r?"isRestoring":"optimistic",Vg(a),Fg(a,o,i),$g(o);const l=!s.getQueryCache().get(a.queryHash),[u]=c.useState(()=>new t(s,a)),f=u.getOptimisticResult(a),d=!r&&e.subscribed!==!1;if(c.useSyncExternalStore(c.useCallback(p=>{const m=d?u.subscribe(_e.batchCalls(p)):Ke;return u.updateResult(),m},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),c.useEffect(()=>{u.setOptions(a)},[a,u]),Ug(a,f))throw Hc(a,u,o);if(Hg({result:f,errorResetBoundary:o,throwOnError:a.throwOnError,query:i,suspense:a.suspense}))throw f.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(a,f),a.experimental_prefetchInRender&&!gn&&Zg(f,r)&&(l?Hc(a,u,o):i?.promise)?.catch(Ke).finally(()=>{u.updateResult()}),a.notifyOnChangeProps?f:u.trackResult(f)}function qg(e,t){return $u(e,Iu)}function Hu(e,t){return $u({...e,enabled:!0,suspense:!0,throwOnError:Bg,placeholderData:void 0},Iu)}function zg(e,t){const n=Qn(),[r]=c.useState(()=>new Ng(n,e));c.useEffect(()=>{r.setOptions(e)},[r,e]);const o=c.useSyncExternalStore(c.useCallback(a=>r.subscribe(_e.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=c.useCallback((a,i)=>{r.mutate(a,i).catch(Ke)},[r]);if(o.error&&di(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:s,mutateAsync:o.mutate}}var Bs={confirmLabel:"OK",dismissible:!0},Bc={confirmLabel:"Continue",cancelLabel:"Cancel",tone:"default",dismissible:!0},Kg=e=>typeof e=="string"?{title:e,...Bs}:{...Bs,...e,dismissible:e.dismissible??Bs.dismissible},Wg=e=>typeof e=="string"?{title:e,...Bc}:{...Bc,...e,dismissible:e.dismissible??e.tone!=="danger"},Gg=()=>{let e={current:null};const t=new Set,n=()=>{t.forEach(l=>l())},r=l=>{e=l,n()},o=()=>e,s=()=>{const l=e.current;!l||l.kind!=="alert"||(r({current:null}),l.resolver())},a=l=>{const u=e.current;!u||u.kind!=="confirm"||(r({current:null}),u.resolver(l))},i=()=>{const l=e.current;if(l){if(l.kind==="confirm"){a(!1);return}s()}};return{subscribe:l=>(t.add(l),()=>{t.delete(l)}),getSnapshot:o,alert:l=>{const u=Kg(l);return i(),new Promise(f=>{r({current:{kind:"alert",options:u,resolver:f}})})},confirm:l=>{const u=Wg(l);return i(),new Promise(f=>{r({current:{kind:"confirm",options:u,resolver:f}})})},resolveAlert:s,resolveConfirm:a,dismiss:i,reset:()=>{i()}}},Bu=c.createContext(null),Yg=()=>{const e=c.useRef();return e.current||(e.current=Gg()),e.current},Qg=({children:e,components:t})=>{const n=Yg(),r=c.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot);c.useEffect(()=>()=>{n.reset()},[n]);const o=n,s=r.current;return h.jsxs(Bu.Provider,{value:o,children:[e,s?.kind==="alert"&&h.jsx(t.Alert,{open:!0,options:s.options,onClose:n.resolveAlert}),s?.kind==="confirm"&&h.jsx(t.Confirm,{open:!0,options:s.options,onCancel:()=>n.resolveConfirm(!1),onConfirm:()=>n.resolveConfirm(!0)})]})},Xg=()=>{const e=c.useContext(Bu);if(!e)throw new Error("useModal must be used within ModalProvider");return e};function Jg(e,t){const n=c.createContext(t),r=s=>{const{children:a,...i}=s,l=c.useMemo(()=>i,Object.values(i));return h.jsx(n.Provider,{value:l,children:a})};r.displayName=e+"Provider";function o(s){const a=c.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function Nt(e,t=[]){let n=[];function r(s,a){const i=c.createContext(a),l=n.length;n=[...n,a];const u=d=>{const{scope:p,children:m,...v}=d,g=p?.[e]?.[l]||i,y=c.useMemo(()=>v,Object.values(v));return h.jsx(g.Provider,{value:y,children:m})};u.displayName=s+"Provider";function f(d,p){const m=p?.[e]?.[l]||i,v=c.useContext(m);if(v)return v;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[u,f]}const o=()=>{const s=n.map(a=>c.createContext(a));return function(i){const l=i?.[e]||s;return c.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return o.scopeName=e,[r,e2(o,...t)]}function e2(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=r.reduce((i,{useScope:l,scopeName:u})=>{const d=l(s)[`__scope${u}`];return{...i,...d}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Vc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Lr(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Vc(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Vc(e[o],null)}}}}function ce(...e){return c.useCallback(Lr(...e),e)}function W(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var Ve=globalThis?.document?c.useLayoutEffect:()=>{},t2=Ko[" useId ".trim().toString()]||(()=>{}),n2=0;function Tt(e){const[t,n]=c.useState(t2());return Ve(()=>{n(r=>r??String(n2++))},[e]),t?`radix-${t}`:""}var r2=Ko[" useInsertionEffect ".trim().toString()]||Ve;function Bt({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,a]=o2({defaultProp:t,onChange:n}),i=e!==void 0,l=i?e:o;{const f=c.useRef(e!==void 0);c.useEffect(()=>{const d=f.current;d!==i&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=i},[i,r])}const u=c.useCallback(f=>{if(i){const d=s2(f)?f(e):f;d!==e&&a.current?.(d)}else s(f)},[i,e,s,a]);return[l,u]}function o2({defaultProp:e,onChange:t}){const[n,r]=c.useState(e),o=c.useRef(n),s=c.useRef(t);return r2(()=>{s.current=t},[t]),c.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function s2(e){return typeof e=="function"}function zn(e){const t=a2(e),n=c.forwardRef((r,o)=>{const{children:s,...a}=r,i=c.Children.toArray(s),l=i.find(i2);if(l){const u=l.props.children,f=i.map(d=>d===l?c.Children.count(u)>1?c.Children.only(null):c.isValidElement(u)?u.props.children:null:d);return h.jsx(t,{...a,ref:o,children:c.isValidElement(u)?c.cloneElement(u,void 0,f):null})}return h.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function a2(e){const t=c.forwardRef((n,r)=>{const{children:o,...s}=n;if(c.isValidElement(o)){const a=l2(o),i=c2(s,o.props);return o.type!==c.Fragment&&(i.ref=r?Lr(r,a):a),c.cloneElement(o,i)}return c.Children.count(o)>1?c.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Vu=Symbol("radix.slottable");function Zu(e){const t=({children:n})=>h.jsx(h.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Vu,t}function i2(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Vu}function c2(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...i)=>{const l=s(...i);return o(...i),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function l2(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var u2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],re=u2.reduce((e,t)=>{const n=zn(`Primitive.${t}`),r=c.forwardRef((o,s)=>{const{asChild:a,...i}=o,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...i,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Uu(e,t){e&&$t.flushSync(()=>e.dispatchEvent(t))}function Mt(e){const t=c.useRef(e);return c.useEffect(()=>{t.current=e}),c.useMemo(()=>(...n)=>t.current?.(...n),[])}function d2(e,t=globalThis?.document){const n=Mt(e);c.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var f2="DismissableLayer",wa="dismissableLayer.update",h2="dismissableLayer.pointerDownOutside",p2="dismissableLayer.focusOutside",Zc,qu=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),jr=c.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...l}=e,u=c.useContext(qu),[f,d]=c.useState(null),p=f?.ownerDocument??globalThis?.document,[,m]=c.useState({}),v=ce(t,C=>d(C)),g=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(y),x=f?g.indexOf(f):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,E=x>=b,T=v2(C=>{const S=C.target,N=[...u.branches].some(I=>I.contains(S));!E||N||(o?.(C),a?.(C),C.defaultPrevented||i?.())},p),O=y2(C=>{const S=C.target;[...u.branches].some(I=>I.contains(S))||(s?.(C),a?.(C),C.defaultPrevented||i?.())},p);return d2(C=>{x===u.layers.size-1&&(r?.(C),!C.defaultPrevented&&i&&(C.preventDefault(),i()))},p),c.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Zc=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Uc(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Zc)}},[f,p,n,u]),c.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Uc())},[f,u]),c.useEffect(()=>{const C=()=>m({});return document.addEventListener(wa,C),()=>document.removeEventListener(wa,C)},[]),h.jsx(re.div,{...l,ref:v,style:{pointerEvents:w?E?"auto":"none":void 0,...e.style},onFocusCapture:W(e.onFocusCapture,O.onFocusCapture),onBlurCapture:W(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:W(e.onPointerDownCapture,T.onPointerDownCapture)})});jr.displayName=f2;var m2="DismissableLayerBranch",g2=c.forwardRef((e,t)=>{const n=c.useContext(qu),r=c.useRef(null),o=ce(t,r);return c.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),h.jsx(re.div,{...e,ref:o})});g2.displayName=m2;function v2(e,t=globalThis?.document){const n=Mt(e),r=c.useRef(!1),o=c.useRef(()=>{});return c.useEffect(()=>{const s=i=>{if(i.target&&!r.current){let l=function(){zu(h2,n,u,{discrete:!0})};const u={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function y2(e,t=globalThis?.document){const n=Mt(e),r=c.useRef(!1);return c.useEffect(()=>{const o=s=>{s.target&&!r.current&&zu(p2,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Uc(){const e=new CustomEvent(wa);document.dispatchEvent(e)}function zu(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Uu(o,s):o.dispatchEvent(s)}var Vs="focusScope.autoFocusOnMount",Zs="focusScope.autoFocusOnUnmount",qc={bubbles:!1,cancelable:!0},b2="FocusScope",rs=c.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=e,[i,l]=c.useState(null),u=Mt(o),f=Mt(s),d=c.useRef(null),p=ce(t,g=>l(g)),m=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(r){let g=function(w){if(m.paused||!i)return;const E=w.target;i.contains(E)?d.current=E:qt(d.current,{select:!0})},y=function(w){if(m.paused||!i)return;const E=w.relatedTarget;E!==null&&(i.contains(E)||qt(d.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const T of w)T.removedNodes.length>0&&qt(i)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const x=new MutationObserver(b);return i&&x.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),x.disconnect()}}},[r,i,m.paused]),c.useEffect(()=>{if(i){Kc.add(m);const g=document.activeElement;if(!i.contains(g)){const b=new CustomEvent(Vs,qc);i.addEventListener(Vs,u),i.dispatchEvent(b),b.defaultPrevented||(x2(C2(Ku(i)),{select:!0}),document.activeElement===g&&qt(i))}return()=>{i.removeEventListener(Vs,u),setTimeout(()=>{const b=new CustomEvent(Zs,qc);i.addEventListener(Zs,f),i.dispatchEvent(b),b.defaultPrevented||qt(g??document.body,{select:!0}),i.removeEventListener(Zs,f),Kc.remove(m)},0)}}},[i,u,f,m]);const v=c.useCallback(g=>{if(!n&&!r||m.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,b=document.activeElement;if(y&&b){const x=g.currentTarget,[w,E]=w2(x);w&&E?!g.shiftKey&&b===E?(g.preventDefault(),n&&qt(w,{select:!0})):g.shiftKey&&b===w&&(g.preventDefault(),n&&qt(E,{select:!0})):b===x&&g.preventDefault()}},[n,r,m.paused]);return h.jsx(re.div,{tabIndex:-1,...a,ref:p,onKeyDown:v})});rs.displayName=b2;function x2(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(qt(r,{select:t}),document.activeElement!==n)return}function w2(e){const t=Ku(e),n=zc(t,e),r=zc(t.reverse(),e);return[n,r]}function Ku(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function zc(e,t){for(const n of e)if(!E2(n,{upTo:t}))return n}function E2(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function S2(e){return e instanceof HTMLInputElement&&"select"in e}function qt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&S2(e)&&t&&e.select()}}var Kc=R2();function R2(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Wc(e,t),e.unshift(t)},remove(t){e=Wc(e,t),e[0]?.resume()}}}function Wc(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function C2(e){return e.filter(t=>t.tagName!=="A")}var A2="Portal",kr=c.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=c.useState(!1);Ve(()=>s(!0),[]);const a=n||o&&globalThis?.document?.body;return a?tu.createPortal(h.jsx(re.div,{...r,ref:t}),a):null});kr.displayName=A2;function T2(e,t){return c.useReducer((n,r)=>t[n][r]??n,e)}var Ot=e=>{const{present:t,children:n}=e,r=P2(t),o=typeof n=="function"?n({present:r.isPresent}):c.Children.only(n),s=ce(r.ref,M2(o));return typeof n=="function"||r.isPresent?c.cloneElement(o,{ref:s}):null};Ot.displayName="Presence";function P2(e){const[t,n]=c.useState(),r=c.useRef(null),o=c.useRef(e),s=c.useRef("none"),a=e?"mounted":"unmounted",[i,l]=T2(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return c.useEffect(()=>{const u=no(r.current);s.current=i==="mounted"?u:"none"},[i]),Ve(()=>{const u=r.current,f=o.current;if(f!==e){const p=s.current,m=no(u);e?l("MOUNT"):m==="none"||u?.display==="none"?l("UNMOUNT"):l(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Ve(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,d=m=>{const g=no(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&g&&(l("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},p=m=>{m.target===t&&(s.current=no(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:c.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function no(e){return e?.animationName||"none"}function M2(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Us=0;function pi(){c.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Gc()),document.body.insertAdjacentElement("beforeend",e[1]??Gc()),Us++,()=>{Us===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Us--}},[])}function Gc(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var _2=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},On=new WeakMap,ro=new WeakMap,oo={},qs=0,Wu=function(e){return e&&(e.host||Wu(e.parentNode))},N2=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Wu(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},O2=function(e,t,n,r){var o=N2(t,Array.isArray(e)?e:[e]);oo[n]||(oo[n]=new WeakMap);var s=oo[n],a=[],i=new Set,l=new Set(o),u=function(d){!d||i.has(d)||(i.add(d),u(d.parentNode))};o.forEach(u);var f=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(p){if(i.has(p))f(p);else try{var m=p.getAttribute(r),v=m!==null&&m!=="false",g=(On.get(p)||0)+1,y=(s.get(p)||0)+1;On.set(p,g),s.set(p,y),a.push(p),g===1&&v&&ro.set(p,!0),y===1&&p.setAttribute(n,"true"),v||p.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",p,b)}})};return f(t),i.clear(),qs++,function(){a.forEach(function(d){var p=On.get(d)-1,m=s.get(d)-1;On.set(d,p),s.set(d,m),p||(ro.has(d)||d.removeAttribute(r),ro.delete(d)),m||d.removeAttribute(n)}),qs--,qs||(On=new WeakMap,On=new WeakMap,ro=new WeakMap,oo={})}},mi=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=_2(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),O2(r,o,n,"aria-hidden")):function(){return null}},os="Dialog",[Gu,Yu]=Nt(os),[I2,Et]=Gu(os),Qu=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,i=c.useRef(null),l=c.useRef(null),[u,f]=Bt({prop:r,defaultProp:o??!1,onChange:s,caller:os});return h.jsx(I2,{scope:t,triggerRef:i,contentRef:l,contentId:Tt(),titleId:Tt(),descriptionId:Tt(),open:u,onOpenChange:f,onOpenToggle:c.useCallback(()=>f(d=>!d),[f]),modal:a,children:n})};Qu.displayName=os;var Xu="DialogTrigger",Ju=c.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Et(Xu,n),s=ce(t,o.triggerRef);return h.jsx(re.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":yi(o.open),...r,ref:s,onClick:W(e.onClick,o.onOpenToggle)})});Ju.displayName=Xu;var gi="DialogPortal",[D2,ed]=Gu(gi,{forceMount:void 0}),td=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=Et(gi,t);return h.jsx(D2,{scope:t,forceMount:n,children:c.Children.map(r,a=>h.jsx(Ot,{present:n||s.open,children:h.jsx(kr,{asChild:!0,container:o,children:a})}))})};td.displayName=gi;var Io="DialogOverlay",nd=c.forwardRef((e,t)=>{const n=ed(Io,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Et(Io,e.__scopeDialog);return s.modal?h.jsx(Ot,{present:r||s.open,children:h.jsx(j2,{...o,ref:t})}):null});nd.displayName=Io;var L2=zn("DialogOverlay.RemoveScroll"),j2=c.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Et(Io,n);return h.jsx(Xa,{as:L2,allowPinchZoom:!0,shards:[o.contentRef],children:h.jsx(re.div,{"data-state":yi(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),yn="DialogContent",rd=c.forwardRef((e,t)=>{const n=ed(yn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Et(yn,e.__scopeDialog);return h.jsx(Ot,{present:r||s.open,children:s.modal?h.jsx(k2,{...o,ref:t}):h.jsx(F2,{...o,ref:t})})});rd.displayName=yn;var k2=c.forwardRef((e,t)=>{const n=Et(yn,e.__scopeDialog),r=c.useRef(null),o=ce(t,n.contentRef,r);return c.useEffect(()=>{const s=r.current;if(s)return mi(s)},[]),h.jsx(od,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:W(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:W(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&s.preventDefault()}),onFocusOutside:W(e.onFocusOutside,s=>s.preventDefault())})}),F2=c.forwardRef((e,t)=>{const n=Et(yn,e.__scopeDialog),r=c.useRef(!1),o=c.useRef(!1);return h.jsx(od,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=s.target;n.triggerRef.current?.contains(a)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),od=c.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...a}=e,i=Et(yn,n),l=c.useRef(null),u=ce(t,l);return pi(),h.jsxs(h.Fragment,{children:[h.jsx(rs,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:h.jsx(jr,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":yi(i.open),...a,ref:u,onDismiss:()=>i.onOpenChange(!1)})}),h.jsxs(h.Fragment,{children:[h.jsx(H2,{titleId:i.titleId}),h.jsx(V2,{contentRef:l,descriptionId:i.descriptionId})]})]})}),vi="DialogTitle",sd=c.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Et(vi,n);return h.jsx(re.h2,{id:o.titleId,...r,ref:t})});sd.displayName=vi;var ad="DialogDescription",id=c.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Et(ad,n);return h.jsx(re.p,{id:o.descriptionId,...r,ref:t})});id.displayName=ad;var cd="DialogClose",ld=c.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Et(cd,n);return h.jsx(re.button,{type:"button",...r,ref:t,onClick:W(e.onClick,()=>o.onOpenChange(!1))})});ld.displayName=cd;function yi(e){return e?"open":"closed"}var ud="DialogTitleWarning",[$2,dd]=Jg(ud,{contentName:yn,titleName:vi,docsSlug:"dialog"}),H2=({titleId:e})=>{const t=dd(ud),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
3
3
 
4
4
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
@@ -215,7 +215,41 @@ __NOTE_ADDITIONAL_FIELDS__ id
215
215
  label
216
216
  }
217
217
  }
218
- }`,{id:e})}function C5(e){return fe(`mutation RestoreNoteSnapshot($id: ID!) {
218
+ }`,{id:e})}function C5(e,t="current"){return fe(`query FetchNoteSnapshotDiff($id: ID!, $target: NoteSnapshotDiffTarget, $contextLines: Int) {
219
+ noteSnapshotDiff(id: $id, target: $target, contextLines: $contextLines) {
220
+ noteId
221
+ mode
222
+ before {
223
+ kind
224
+ id
225
+ title
226
+ createdAt
227
+ updatedAt
228
+ meta {
229
+ entrypoint
230
+ label
231
+ }
232
+ }
233
+ after {
234
+ kind
235
+ id
236
+ title
237
+ createdAt
238
+ updatedAt
239
+ meta {
240
+ entrypoint
241
+ label
242
+ }
243
+ }
244
+ diff {
245
+ markdown
246
+ changedLineCount
247
+ changedCharCount
248
+ beforeMarkdownSha256
249
+ afterMarkdownSha256
250
+ }
251
+ }
252
+ }`,{id:e,target:t.toUpperCase(),contextLines:3})}function A5(e){return fe(`mutation RestoreNoteSnapshot($id: ID!) {
219
253
  restoreNoteSnapshot(id: $id) {
220
254
  id
221
255
  title
@@ -224,7 +258,7 @@ __NOTE_ADDITIONAL_FIELDS__ id
224
258
  content
225
259
  updatedAt
226
260
  }
227
- }`,{id:e})}function A5({limit:e=25,offset:t=0}={}){return fe(`query FetchTrashedNotes($pagination: PaginationInput) {
261
+ }`,{id:e})}function T5({limit:e=25,offset:t=0}={}){return fe(`query FetchTrashedNotes($pagination: PaginationInput) {
228
262
  trashedNotes(pagination: $pagination) {
229
263
  totalCount
230
264
  notes {
@@ -240,7 +274,7 @@ __NOTE_ADDITIONAL_FIELDS__ id
240
274
  tagNames
241
275
  }
242
276
  }
243
- }`,{pagination:{limit:e,offset:t}})}function T5(e){return fe(`query FetchTrashedNote($id: ID!) {
277
+ }`,{pagination:{limit:e,offset:t}})}function P5(e){return fe(`query FetchTrashedNote($id: ID!) {
244
278
  trashedNote(id: $id) {
245
279
  id
246
280
  title
@@ -254,7 +288,7 @@ __NOTE_ADDITIONAL_FIELDS__ id
254
288
  layout
255
289
  tagNames
256
290
  }
257
- }`,{id:e})}function P5(e){return fe(`mutation RestoreTrashedNote($id: ID!) {
291
+ }`,{id:e})}function M5(e){return fe(`mutation RestoreTrashedNote($id: ID!) {
258
292
  restoreTrashedNote(id: $id) {
259
293
  id
260
294
  title
@@ -263,7 +297,7 @@ __NOTE_ADDITIONAL_FIELDS__ id
263
297
  content
264
298
  updatedAt
265
299
  }
266
- }`,{id:e})}function M5(e){return fe(`mutation PurgeTrashedNote($id: ID!) {
300
+ }`,{id:e})}function _5(e){return fe(`mutation PurgeTrashedNote($id: ID!) {
267
301
  purgeTrashedNote(id: $id)
268
302
  }`,{id:e})}function wS(e,t){return fe(`mutation PinNote($id: ID!, $pinned: Boolean!) {
269
303
  pinNote(id: $id, pinned: $pinned) {
@@ -280,7 +314,7 @@ __NOTE_ADDITIONAL_FIELDS__ id
280
314
  id
281
315
  order
282
316
  }
283
- }`,{notes:e})}function _5(){return fe(`query FetchNoteGraph {
317
+ }`,{notes:e})}function N5(){return fe(`query FetchNoteGraph {
284
318
  noteGraph {
285
319
  nodes {
286
320
  id
@@ -292,11 +326,11 @@ __NOTE_ADDITIONAL_FIELDS__ id
292
326
  target
293
327
  }
294
328
  }
295
- }`)}const qa=6e4,io=6e4,jn=(e,t)=>`${e} ${t}${e===1?"":"s"} ago`;function Cp(e,t=Date.now()){const n=new Date(e),r=Math.max(0,Math.floor((t-n.getTime())/1e3));let o=Math.floor(r/31536e3);return o>=1?jn(o,"year"):(o=Math.floor(r/2592e3),o>=1?jn(o,"month"):(o=Math.floor(r/86400),o>=1?jn(o,"day"):(o=Math.floor(r/3600),o>=1?jn(o,"hour"):(o=Math.floor(r/60),o>=1?jn(o,"minute"):jn(Math.floor(r),"second")))))}function N5(e,t=Date.now()){return e===null||t-e<qa?"just now":Cp(e,t)}function O5(e,t=Date.now()){if(e===null)return io;const n=Math.max(0,t-e);if(n<qa)return qa-n;const r=n%io;return r===0?io:io-r}function RS({id:e,title:t,tags:n,pinned:r,updatedAt:o,onPinned:s,onDelete:a}){const i=Cp(Number(o));return h.jsxs("div",{className:me("surface-base group relative flex h-full flex-col px-4 py-3.5 transition-colors"),children:[r&&h.jsx("div",{className:"absolute left-1/2 top-0 z-[1] -translate-x-1/2 -translate-y-[38%]",children:h.jsxs("div",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full border border-border-secondary/70 bg-elevated text-fg-tertiary shadow-[0_8px_18px_-14px_rgba(23,29,38,0.32)]",children:[h.jsx(tf,{className:"h-3.5 w-3.5",weight:"fill"}),h.jsx("span",{className:"sr-only",children:"Pinned note"})]})}),h.jsxs("div",{className:"flex h-full flex-col gap-2.5",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2.5",children:[h.jsx("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1",children:h.jsxs(se,{as:"span",variant:"label",weight:"medium",tone:"secondary",children:["Updated ",i]})}),h.jsx(tx,{button:h.jsx(ix,{label:"Note actions",size:"sm"}),items:[{name:r?"Unpin":"Pin",onClick:()=>s?.()},{name:"Delete",onClick:()=>a?.()}]})]}),h.jsxs("div",{className:"flex flex-1 flex-col justify-between gap-2.5",children:[h.jsx(se,{as:"div",variant:"body",weight:"semibold",tracking:"tight",className:"leading-[1.45]",children:h.jsx(Pt,{className:"line-clamp-2 transition-colors hover:text-fg-default/85",to:tr,params:{id:e},children:t||"Untitled"})}),n.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1.5 pt-0.5",children:n.map(l=>h.jsx(Pt,{to:Qi,params:{id:l.id},search:{page:1},children:h.jsx(se,{as:"span",variant:"label",weight:"medium",tone:"secondary",className:"inline-flex items-center rounded-full border border-border-subtle bg-transparent px-2 py-0.5 transition-colors hover:bg-hover-subtle hover:text-fg-default",children:l.name})},l.id))})]})]})]},e)}function CS({isOpen:e,title:t,description:n,references:r,confirmLabel:o,onClose:s,onConfirm:a,confirmVariant:i="primary",isConfirming:l=!1}){return h.jsxs(Ft,{isOpen:e,onClose:s,variant:"inspect",children:[h.jsx(Ft.Header,{title:t,onClose:s}),h.jsx(Ft.Body,{children:h.jsxs("div",{className:"flex flex-col gap-3",children:[h.jsx(Ft.Description,{className:"text-meta font-normal text-fg-secondary",children:n}),h.jsxs("div",{className:"overflow-hidden rounded-[16px] border border-border-subtle bg-hover-subtle/40",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border-subtle px-4 py-3",children:[h.jsx(se,{as:"p",variant:"micro",weight:"semibold",tracking:"wider",transform:"uppercase",tone:"tertiary",children:"Referenced notes"}),h.jsxs(se,{as:"p",variant:"label",tone:"tertiary",children:[r.length," ",r.length===1?"note":"notes"]})]}),h.jsx("ul",{className:"flex flex-col",children:r.map((u,f)=>h.jsx("li",{className:f>0?"border-t border-border-subtle":void 0,children:h.jsxs("div",{className:"flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[h.jsx(se,{as:"p",variant:"body",weight:"medium",className:"min-w-0 flex-1 break-words",children:u.title||"Untitled note"}),h.jsx(bt,{asChild:!0,variant:"ghost",size:"sm",className:"self-start sm:self-auto",children:h.jsx(Pt,{to:tr,params:{id:u.id},children:"Open note"})})]})},u.id))})]})]})}),h.jsx(Ft.Footer,{children:h.jsxs(Kw,{children:[h.jsx(bt,{variant:"ghost",size:"sm",onClick:s,disabled:l,children:"Cancel"}),h.jsx(bt,{variant:i,size:"sm",onClick:a,isLoading:l,children:o})]})})]})}var xo={exports:{}},AS=xo.exports,kl;function TS(){return kl||(kl=1,(function(e,t){(function(n,r){e.exports=r()})(AS,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",a="second",i="minute",l="hour",u="day",f="week",d="month",p="quarter",m="year",v="date",g="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,x={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var k=["th","st","nd","rd"],A=L%100;return"["+L+(k[(A-20)%10]||k[A]||k[0])+"]"}},w=function(L,k,A){var D=String(L);return!D||D.length>=k?L:""+Array(k+1-D.length).join(A)+L},E={s:w,z:function(L){var k=-L.utcOffset(),A=Math.abs(k),D=Math.floor(A/60),j=A%60;return(k<=0?"+":"-")+w(D,2,"0")+":"+w(j,2,"0")},m:function L(k,A){if(k.date()<A.date())return-L(A,k);var D=12*(A.year()-k.year())+(A.month()-k.month()),j=k.clone().add(D,d),_=A-j<0,V=k.clone().add(D+(_?-1:1),d);return+(-(D+(A-j)/(_?j-V:V-j))||0)},a:function(L){return L<0?Math.ceil(L)||0:Math.floor(L)},p:function(L){return{M:d,y:m,w:f,d:u,D:v,h:l,m:i,s:a,ms:s,Q:p}[L]||String(L||"").toLowerCase().replace(/s$/,"")},u:function(L){return L===void 0}},T="en",O={};O[T]=x;var C="$isDayjsObject",S=function(L){return L instanceof H||!(!L||!L[C])},N=function L(k,A,D){var j;if(!k)return T;if(typeof k=="string"){var _=k.toLowerCase();O[_]&&(j=_),A&&(O[_]=A,j=_);var V=k.split("-");if(!j&&V.length>1)return L(V[0])}else{var K=k.name;O[K]=k,j=K}return!D&&j&&(T=j),j||!D&&T},I=function(L,k){if(S(L))return L.clone();var A=typeof k=="object"?k:{};return A.date=L,A.args=arguments,new H(A)},P=E;P.l=N,P.i=S,P.w=function(L,k){return I(L,{locale:k.$L,utc:k.$u,x:k.$x,$offset:k.$offset})};var H=(function(){function L(A){this.$L=N(A.locale,null,!0),this.parse(A),this.$x=this.$x||A.x||{},this[C]=!0}var k=L.prototype;return k.parse=function(A){this.$d=(function(D){var j=D.date,_=D.utc;if(j===null)return new Date(NaN);if(P.u(j))return new Date;if(j instanceof Date)return new Date(j);if(typeof j=="string"&&!/Z$/i.test(j)){var V=j.match(y);if(V){var K=V[2]-1||0,Y=(V[7]||"0").substring(0,3);return _?new Date(Date.UTC(V[1],K,V[3]||1,V[4]||0,V[5]||0,V[6]||0,Y)):new Date(V[1],K,V[3]||1,V[4]||0,V[5]||0,V[6]||0,Y)}}return new Date(j)})(A),this.init()},k.init=function(){var A=this.$d;this.$y=A.getFullYear(),this.$M=A.getMonth(),this.$D=A.getDate(),this.$W=A.getDay(),this.$H=A.getHours(),this.$m=A.getMinutes(),this.$s=A.getSeconds(),this.$ms=A.getMilliseconds()},k.$utils=function(){return P},k.isValid=function(){return this.$d.toString()!==g},k.isSame=function(A,D){var j=I(A);return this.startOf(D)<=j&&j<=this.endOf(D)},k.isAfter=function(A,D){return I(A)<this.startOf(D)},k.isBefore=function(A,D){return this.endOf(D)<I(A)},k.$g=function(A,D,j){return P.u(A)?this[D]:this.set(j,A)},k.unix=function(){return Math.floor(this.valueOf()/1e3)},k.valueOf=function(){return this.$d.getTime()},k.startOf=function(A,D){var j=this,_=!!P.u(D)||D,V=P.p(A),K=function(ee,Z){var X=P.w(j.$u?Date.UTC(j.$y,Z,ee):new Date(j.$y,Z,ee),j);return _?X:X.endOf(u)},Y=function(ee,Z){return P.w(j.toDate()[ee].apply(j.toDate("s"),(_?[0,0,0,0]:[23,59,59,999]).slice(Z)),j)},B=this.$W,q=this.$M,U=this.$D,J="set"+(this.$u?"UTC":"");switch(V){case m:return _?K(1,0):K(31,11);case d:return _?K(1,q):K(0,q+1);case f:var $=this.$locale().weekStart||0,F=(B<$?B+7:B)-$;return K(_?U-F:U+(6-F),q);case u:case v:return Y(J+"Hours",0);case l:return Y(J+"Minutes",1);case i:return Y(J+"Seconds",2);case a:return Y(J+"Milliseconds",3);default:return this.clone()}},k.endOf=function(A){return this.startOf(A,!1)},k.$set=function(A,D){var j,_=P.p(A),V="set"+(this.$u?"UTC":""),K=(j={},j[u]=V+"Date",j[v]=V+"Date",j[d]=V+"Month",j[m]=V+"FullYear",j[l]=V+"Hours",j[i]=V+"Minutes",j[a]=V+"Seconds",j[s]=V+"Milliseconds",j)[_],Y=_===u?this.$D+(D-this.$W):D;if(_===d||_===m){var B=this.clone().set(v,1);B.$d[K](Y),B.init(),this.$d=B.set(v,Math.min(this.$D,B.daysInMonth())).$d}else K&&this.$d[K](Y);return this.init(),this},k.set=function(A,D){return this.clone().$set(A,D)},k.get=function(A){return this[P.p(A)]()},k.add=function(A,D){var j,_=this;A=Number(A);var V=P.p(D),K=function(q){var U=I(_);return P.w(U.date(U.date()+Math.round(q*A)),_)};if(V===d)return this.set(d,this.$M+A);if(V===m)return this.set(m,this.$y+A);if(V===u)return K(1);if(V===f)return K(7);var Y=(j={},j[i]=r,j[l]=o,j[a]=n,j)[V]||1,B=this.$d.getTime()+A*Y;return P.w(B,this)},k.subtract=function(A,D){return this.add(-1*A,D)},k.format=function(A){var D=this,j=this.$locale();if(!this.isValid())return j.invalidDate||g;var _=A||"YYYY-MM-DDTHH:mm:ssZ",V=P.z(this),K=this.$H,Y=this.$m,B=this.$M,q=j.weekdays,U=j.months,J=j.meridiem,$=function(Z,X,te,ae){return Z&&(Z[X]||Z(D,_))||te[X].slice(0,ae)},F=function(Z){return P.s(K%12||12,Z,"0")},ee=J||function(Z,X,te){var ae=Z<12?"AM":"PM";return te?ae.toLowerCase():ae};return _.replace(b,(function(Z,X){return X||(function(te){switch(te){case"YY":return String(D.$y).slice(-2);case"YYYY":return P.s(D.$y,4,"0");case"M":return B+1;case"MM":return P.s(B+1,2,"0");case"MMM":return $(j.monthsShort,B,U,3);case"MMMM":return $(U,B);case"D":return D.$D;case"DD":return P.s(D.$D,2,"0");case"d":return String(D.$W);case"dd":return $(j.weekdaysMin,D.$W,q,2);case"ddd":return $(j.weekdaysShort,D.$W,q,3);case"dddd":return q[D.$W];case"H":return String(K);case"HH":return P.s(K,2,"0");case"h":return F(1);case"hh":return F(2);case"a":return ee(K,Y,!0);case"A":return ee(K,Y,!1);case"m":return String(Y);case"mm":return P.s(Y,2,"0");case"s":return String(D.$s);case"ss":return P.s(D.$s,2,"0");case"SSS":return P.s(D.$ms,3,"0");case"Z":return V}return null})(Z)||V.replace(":","")}))},k.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},k.diff=function(A,D,j){var _,V=this,K=P.p(D),Y=I(A),B=(Y.utcOffset()-this.utcOffset())*r,q=this-Y,U=function(){return P.m(V,Y)};switch(K){case m:_=U()/12;break;case d:_=U();break;case p:_=U()/3;break;case f:_=(q-B)/6048e5;break;case u:_=(q-B)/864e5;break;case l:_=q/o;break;case i:_=q/r;break;case a:_=q/n;break;default:_=q}return j?_:P.a(_)},k.daysInMonth=function(){return this.endOf(d).$D},k.$locale=function(){return O[this.$L]},k.locale=function(A,D){if(!A)return this.$L;var j=this.clone(),_=N(A,D,!0);return _&&(j.$L=_),j},k.clone=function(){return P.w(this.$d,this)},k.toDate=function(){return new Date(this.valueOf())},k.toJSON=function(){return this.isValid()?this.toISOString():null},k.toISOString=function(){return this.$d.toISOString()},k.toString=function(){return this.$d.toUTCString()},L})(),z=H.prototype;return I.prototype=z,[["$ms",s],["$s",a],["$m",i],["$H",l],["$W",u],["$M",d],["$y",m],["$D",v]].forEach((function(L){z[L[1]]=function(k){return this.$g(k,L[0],L[1])}})),I.extend=function(L,k){return L.$i||(L(k,H,I),L.$i=!0),I},I.locale=N,I.isDayjs=S,I.unix=function(L){return I(1e3*L)},I.en=O[T],I.Ls=O,I.p={},I}))})(xo)),xo.exports}var PS=TS();const He=Gn(PS),MS=()=>{const e=new Date,t=e.getDate(),n=e.getMonth(),r=e.getFullYear(),s=new Date(r,n,1).getDay();return Math.ceil((t+s)/7)},_S=()=>[{name:"Year",template:"year",replacement:He().format("YYYY")},{name:"Month",template:"month",replacement:He().format("MM")},{name:"Short Month",template:"mon",replacement:He().format("M")},{name:"Day",template:"day",replacement:He().format("DD")},{name:"Short Day",template:"d",replacement:He().format("D")},{name:"Week of Month",template:"week_of_month",replacement:MS().toString()},{name:"Hour 24",template:"hour",replacement:He().format("HH")},{name:"Hour 12",template:"hour_12",replacement:He().format("hh")},{name:"Short Hour 24",template:"h",replacement:He().format("H")},{name:"Short Hour 12",template:"h_12",replacement:He().format("h")},{name:"AM/PM",template:"ampm",replacement:He().format("A")},{name:"Minute",template:"minute",replacement:He().format("mm")},{name:"Short Minute",template:"m",replacement:He().format("m")},{name:"Second",template:"second",replacement:He().format("ss")},{name:"Short Second",template:"s",replacement:He().format("s")}],NS="{%",OS="%}",Fl=e=>e.replace(new RegExp(`${NS}([^}]+)${OS}`,"g"),(t,n)=>_S().find(o=>o.template===n)?.replacement||t),co={title:"Move note to Trash?",description:"This note is referenced by the notes below. Those links may stop opening while this note stays in Trash. If you restore this note later, the links will work again.",confirmLabel:"Move to Trash",confirmVariant:"soft-danger"},Ap=()=>{const e=lf(),t=df(),n=Qn(),r=Sn(),[o,s]=c.useState(null),a=async(d="",p="",m)=>{const v=Fl(d),g=Fl(p),y=await xS({title:v,content:g,...m&&{layout:m}});return y.type==="error"?(t(y.errors[0].message),null):(r({to:tr,params:{id:y.createNote.id}}),y.createNote.id)},i=async(d,p,m)=>{try{const v=await wS(d,!p);if(v.type==="error"){t(v.errors[0].message);return}await Promise.all([n.invalidateQueries({queryKey:ve.notes.listAll(),exact:!1}),n.invalidateQueries({queryKey:ve.notes.tagListAll(),exact:!1}),n.invalidateQueries({queryKey:ve.notes.pinned(),exact:!0})]),m?.()}catch{t("Failed to update note pin status")}},l=async(d,p)=>{const m=await ES(d);if(m.type==="error"){t(m.errors[0].message);return}await Promise.all([n.invalidateQueries({queryKey:ve.notes.all(),exact:!1}),n.invalidateQueries({queryKey:ve.tags.all(),exact:!1}),n.invalidateQueries({queryKey:ve.reminders.all(),exact:!1}),n.invalidateQueries({queryKey:ve.images.all(),exact:!1}),n.invalidateQueries({queryKey:["calendar"],exact:!1})]),t("The note has been moved to trash."),p?.()},u=async()=>{if(!o)return;const{id:d,callback:p}=o;s(null),await l(d,p)};return{onCreate:a,onPinned:i,onDelete:async(d,p)=>{const m=await bS(d);if(m.type==="error"){t("Failed to check linked notes before moving this note to Trash.");return}if(n.setQueryData(ve.notes.backReferences(d),m.backReferences),m.backReferences.length>0){s({id:d,callback:p,backReferences:m.backReferences});return}await e("Move this note to trash?")&&await l(d,p)},deleteWarningDialog:h.jsx(CS,{isOpen:!!o,title:co.title,description:co.description,references:o?.backReferences??[],confirmLabel:co.confirmLabel,confirmVariant:co.confirmVariant,onClose:()=>s(null),onConfirm:()=>{u()}})}};function IS(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Ss=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function nr(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ji(e){return"nodeType"in e}function nt(e){var t,n;return e?nr(e)?e:Ji(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function ec(e){const{Document:t}=nt(e);return e instanceof t}function Gr(e){return nr(e)?!1:e instanceof nt(e).HTMLElement}function Tp(e){return e instanceof nt(e).SVGElement}function rr(e){return e?nr(e)?e.document:Ji(e)?ec(e)?e:Gr(e)||Tp(e)?e.ownerDocument:document:document:document}const _t=Ss?c.useLayoutEffect:c.useEffect;function tc(e){const t=c.useRef(e);return _t(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function DS(){const e=c.useRef(null),t=c.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Nr(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return _t(()=>{n.current!==e&&(n.current=e)},t),n}function Yr(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Zo(e){const t=tc(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function za(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let aa={};function Qr(e,t){return c.useMemo(()=>{if(t)return t;const n=aa[e]==null?0:aa[e]+1;return aa[e]=n,e+"-"+n},[e,t])}function Pp(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,a)=>{const i=Object.entries(a);for(const[l,u]of i){const f=s[l];f!=null&&(s[l]=f+e*u)}return s},{...t})}}const Zn=Pp(1),Or=Pp(-1);function LS(e){return"clientX"in e&&"clientY"in e}function nc(e){if(!e)return!1;const{KeyboardEvent:t}=nt(e.target);return t&&e instanceof t}function jS(e){if(!e)return!1;const{TouchEvent:t}=nt(e.target);return t&&e instanceof t}function Ka(e){if(jS(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return LS(e)?{x:e.clientX,y:e.clientY}:null}const Ir=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ir.Translate.toString(e),Ir.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),$l="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function kS(e){return e.matches($l)?e:e.querySelector($l)}const FS={display:"none"};function $S(e){let{id:t,value:n}=e;return M.createElement("div",{id:t,style:FS},n)}function HS(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return M.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function BS(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Mp=c.createContext(null);function VS(e){const t=c.useContext(Mp);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function ZS(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:s}=r;e.forEach(a=>{var i;return(i=a[o])==null?void 0:i.call(a,s)})},[e]),t]}const US={draggable:`
329
+ }`)}const qa=6e4,io=6e4,jn=(e,t)=>`${e} ${t}${e===1?"":"s"} ago`;function Cp(e,t=Date.now()){const n=new Date(e),r=Math.max(0,Math.floor((t-n.getTime())/1e3));let o=Math.floor(r/31536e3);return o>=1?jn(o,"year"):(o=Math.floor(r/2592e3),o>=1?jn(o,"month"):(o=Math.floor(r/86400),o>=1?jn(o,"day"):(o=Math.floor(r/3600),o>=1?jn(o,"hour"):(o=Math.floor(r/60),o>=1?jn(o,"minute"):jn(Math.floor(r),"second")))))}function O5(e,t=Date.now()){return e===null||t-e<qa?"just now":Cp(e,t)}function I5(e,t=Date.now()){if(e===null)return io;const n=Math.max(0,t-e);if(n<qa)return qa-n;const r=n%io;return r===0?io:io-r}function RS({id:e,title:t,tags:n,pinned:r,updatedAt:o,onPinned:s,onDelete:a}){const i=Cp(Number(o));return h.jsxs("div",{className:me("surface-base group relative flex h-full flex-col px-4 py-3.5 transition-colors"),children:[r&&h.jsx("div",{className:"absolute left-1/2 top-0 z-[1] -translate-x-1/2 -translate-y-[38%]",children:h.jsxs("div",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full border border-border-secondary/70 bg-elevated text-fg-tertiary shadow-[0_8px_18px_-14px_rgba(23,29,38,0.32)]",children:[h.jsx(tf,{className:"h-3.5 w-3.5",weight:"fill"}),h.jsx("span",{className:"sr-only",children:"Pinned note"})]})}),h.jsxs("div",{className:"flex h-full flex-col gap-2.5",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2.5",children:[h.jsx("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1",children:h.jsxs(se,{as:"span",variant:"label",weight:"medium",tone:"secondary",children:["Updated ",i]})}),h.jsx(tx,{button:h.jsx(ix,{label:"Note actions",size:"sm"}),items:[{name:r?"Unpin":"Pin",onClick:()=>s?.()},{name:"Delete",onClick:()=>a?.()}]})]}),h.jsxs("div",{className:"flex flex-1 flex-col justify-between gap-2.5",children:[h.jsx(se,{as:"div",variant:"body",weight:"semibold",tracking:"tight",className:"leading-[1.45]",children:h.jsx(Pt,{className:"line-clamp-2 transition-colors hover:text-fg-default/85",to:tr,params:{id:e},children:t||"Untitled"})}),n.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1.5 pt-0.5",children:n.map(l=>h.jsx(Pt,{to:Qi,params:{id:l.id},search:{page:1},children:h.jsx(se,{as:"span",variant:"label",weight:"medium",tone:"secondary",className:"inline-flex items-center rounded-full border border-border-subtle bg-transparent px-2 py-0.5 transition-colors hover:bg-hover-subtle hover:text-fg-default",children:l.name})},l.id))})]})]})]},e)}function CS({isOpen:e,title:t,description:n,references:r,confirmLabel:o,onClose:s,onConfirm:a,confirmVariant:i="primary",isConfirming:l=!1}){return h.jsxs(Ft,{isOpen:e,onClose:s,variant:"inspect",children:[h.jsx(Ft.Header,{title:t,onClose:s}),h.jsx(Ft.Body,{children:h.jsxs("div",{className:"flex flex-col gap-3",children:[h.jsx(Ft.Description,{className:"text-meta font-normal text-fg-secondary",children:n}),h.jsxs("div",{className:"overflow-hidden rounded-[16px] border border-border-subtle bg-hover-subtle/40",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border-subtle px-4 py-3",children:[h.jsx(se,{as:"p",variant:"micro",weight:"semibold",tracking:"wider",transform:"uppercase",tone:"tertiary",children:"Referenced notes"}),h.jsxs(se,{as:"p",variant:"label",tone:"tertiary",children:[r.length," ",r.length===1?"note":"notes"]})]}),h.jsx("ul",{className:"flex flex-col",children:r.map((u,f)=>h.jsx("li",{className:f>0?"border-t border-border-subtle":void 0,children:h.jsxs("div",{className:"flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[h.jsx(se,{as:"p",variant:"body",weight:"medium",className:"min-w-0 flex-1 break-words",children:u.title||"Untitled note"}),h.jsx(bt,{asChild:!0,variant:"ghost",size:"sm",className:"self-start sm:self-auto",children:h.jsx(Pt,{to:tr,params:{id:u.id},children:"Open note"})})]})},u.id))})]})]})}),h.jsx(Ft.Footer,{children:h.jsxs(Kw,{children:[h.jsx(bt,{variant:"ghost",size:"sm",onClick:s,disabled:l,children:"Cancel"}),h.jsx(bt,{variant:i,size:"sm",onClick:a,isLoading:l,children:o})]})})]})}var xo={exports:{}},AS=xo.exports,kl;function TS(){return kl||(kl=1,(function(e,t){(function(n,r){e.exports=r()})(AS,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",a="second",i="minute",l="hour",u="day",f="week",d="month",p="quarter",m="year",v="date",g="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,x={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var k=["th","st","nd","rd"],A=L%100;return"["+L+(k[(A-20)%10]||k[A]||k[0])+"]"}},w=function(L,k,A){var D=String(L);return!D||D.length>=k?L:""+Array(k+1-D.length).join(A)+L},E={s:w,z:function(L){var k=-L.utcOffset(),A=Math.abs(k),D=Math.floor(A/60),j=A%60;return(k<=0?"+":"-")+w(D,2,"0")+":"+w(j,2,"0")},m:function L(k,A){if(k.date()<A.date())return-L(A,k);var D=12*(A.year()-k.year())+(A.month()-k.month()),j=k.clone().add(D,d),_=A-j<0,V=k.clone().add(D+(_?-1:1),d);return+(-(D+(A-j)/(_?j-V:V-j))||0)},a:function(L){return L<0?Math.ceil(L)||0:Math.floor(L)},p:function(L){return{M:d,y:m,w:f,d:u,D:v,h:l,m:i,s:a,ms:s,Q:p}[L]||String(L||"").toLowerCase().replace(/s$/,"")},u:function(L){return L===void 0}},T="en",O={};O[T]=x;var C="$isDayjsObject",S=function(L){return L instanceof H||!(!L||!L[C])},N=function L(k,A,D){var j;if(!k)return T;if(typeof k=="string"){var _=k.toLowerCase();O[_]&&(j=_),A&&(O[_]=A,j=_);var V=k.split("-");if(!j&&V.length>1)return L(V[0])}else{var K=k.name;O[K]=k,j=K}return!D&&j&&(T=j),j||!D&&T},I=function(L,k){if(S(L))return L.clone();var A=typeof k=="object"?k:{};return A.date=L,A.args=arguments,new H(A)},P=E;P.l=N,P.i=S,P.w=function(L,k){return I(L,{locale:k.$L,utc:k.$u,x:k.$x,$offset:k.$offset})};var H=(function(){function L(A){this.$L=N(A.locale,null,!0),this.parse(A),this.$x=this.$x||A.x||{},this[C]=!0}var k=L.prototype;return k.parse=function(A){this.$d=(function(D){var j=D.date,_=D.utc;if(j===null)return new Date(NaN);if(P.u(j))return new Date;if(j instanceof Date)return new Date(j);if(typeof j=="string"&&!/Z$/i.test(j)){var V=j.match(y);if(V){var K=V[2]-1||0,Y=(V[7]||"0").substring(0,3);return _?new Date(Date.UTC(V[1],K,V[3]||1,V[4]||0,V[5]||0,V[6]||0,Y)):new Date(V[1],K,V[3]||1,V[4]||0,V[5]||0,V[6]||0,Y)}}return new Date(j)})(A),this.init()},k.init=function(){var A=this.$d;this.$y=A.getFullYear(),this.$M=A.getMonth(),this.$D=A.getDate(),this.$W=A.getDay(),this.$H=A.getHours(),this.$m=A.getMinutes(),this.$s=A.getSeconds(),this.$ms=A.getMilliseconds()},k.$utils=function(){return P},k.isValid=function(){return this.$d.toString()!==g},k.isSame=function(A,D){var j=I(A);return this.startOf(D)<=j&&j<=this.endOf(D)},k.isAfter=function(A,D){return I(A)<this.startOf(D)},k.isBefore=function(A,D){return this.endOf(D)<I(A)},k.$g=function(A,D,j){return P.u(A)?this[D]:this.set(j,A)},k.unix=function(){return Math.floor(this.valueOf()/1e3)},k.valueOf=function(){return this.$d.getTime()},k.startOf=function(A,D){var j=this,_=!!P.u(D)||D,V=P.p(A),K=function(ee,Z){var X=P.w(j.$u?Date.UTC(j.$y,Z,ee):new Date(j.$y,Z,ee),j);return _?X:X.endOf(u)},Y=function(ee,Z){return P.w(j.toDate()[ee].apply(j.toDate("s"),(_?[0,0,0,0]:[23,59,59,999]).slice(Z)),j)},B=this.$W,q=this.$M,U=this.$D,J="set"+(this.$u?"UTC":"");switch(V){case m:return _?K(1,0):K(31,11);case d:return _?K(1,q):K(0,q+1);case f:var $=this.$locale().weekStart||0,F=(B<$?B+7:B)-$;return K(_?U-F:U+(6-F),q);case u:case v:return Y(J+"Hours",0);case l:return Y(J+"Minutes",1);case i:return Y(J+"Seconds",2);case a:return Y(J+"Milliseconds",3);default:return this.clone()}},k.endOf=function(A){return this.startOf(A,!1)},k.$set=function(A,D){var j,_=P.p(A),V="set"+(this.$u?"UTC":""),K=(j={},j[u]=V+"Date",j[v]=V+"Date",j[d]=V+"Month",j[m]=V+"FullYear",j[l]=V+"Hours",j[i]=V+"Minutes",j[a]=V+"Seconds",j[s]=V+"Milliseconds",j)[_],Y=_===u?this.$D+(D-this.$W):D;if(_===d||_===m){var B=this.clone().set(v,1);B.$d[K](Y),B.init(),this.$d=B.set(v,Math.min(this.$D,B.daysInMonth())).$d}else K&&this.$d[K](Y);return this.init(),this},k.set=function(A,D){return this.clone().$set(A,D)},k.get=function(A){return this[P.p(A)]()},k.add=function(A,D){var j,_=this;A=Number(A);var V=P.p(D),K=function(q){var U=I(_);return P.w(U.date(U.date()+Math.round(q*A)),_)};if(V===d)return this.set(d,this.$M+A);if(V===m)return this.set(m,this.$y+A);if(V===u)return K(1);if(V===f)return K(7);var Y=(j={},j[i]=r,j[l]=o,j[a]=n,j)[V]||1,B=this.$d.getTime()+A*Y;return P.w(B,this)},k.subtract=function(A,D){return this.add(-1*A,D)},k.format=function(A){var D=this,j=this.$locale();if(!this.isValid())return j.invalidDate||g;var _=A||"YYYY-MM-DDTHH:mm:ssZ",V=P.z(this),K=this.$H,Y=this.$m,B=this.$M,q=j.weekdays,U=j.months,J=j.meridiem,$=function(Z,X,te,ae){return Z&&(Z[X]||Z(D,_))||te[X].slice(0,ae)},F=function(Z){return P.s(K%12||12,Z,"0")},ee=J||function(Z,X,te){var ae=Z<12?"AM":"PM";return te?ae.toLowerCase():ae};return _.replace(b,(function(Z,X){return X||(function(te){switch(te){case"YY":return String(D.$y).slice(-2);case"YYYY":return P.s(D.$y,4,"0");case"M":return B+1;case"MM":return P.s(B+1,2,"0");case"MMM":return $(j.monthsShort,B,U,3);case"MMMM":return $(U,B);case"D":return D.$D;case"DD":return P.s(D.$D,2,"0");case"d":return String(D.$W);case"dd":return $(j.weekdaysMin,D.$W,q,2);case"ddd":return $(j.weekdaysShort,D.$W,q,3);case"dddd":return q[D.$W];case"H":return String(K);case"HH":return P.s(K,2,"0");case"h":return F(1);case"hh":return F(2);case"a":return ee(K,Y,!0);case"A":return ee(K,Y,!1);case"m":return String(Y);case"mm":return P.s(Y,2,"0");case"s":return String(D.$s);case"ss":return P.s(D.$s,2,"0");case"SSS":return P.s(D.$ms,3,"0");case"Z":return V}return null})(Z)||V.replace(":","")}))},k.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},k.diff=function(A,D,j){var _,V=this,K=P.p(D),Y=I(A),B=(Y.utcOffset()-this.utcOffset())*r,q=this-Y,U=function(){return P.m(V,Y)};switch(K){case m:_=U()/12;break;case d:_=U();break;case p:_=U()/3;break;case f:_=(q-B)/6048e5;break;case u:_=(q-B)/864e5;break;case l:_=q/o;break;case i:_=q/r;break;case a:_=q/n;break;default:_=q}return j?_:P.a(_)},k.daysInMonth=function(){return this.endOf(d).$D},k.$locale=function(){return O[this.$L]},k.locale=function(A,D){if(!A)return this.$L;var j=this.clone(),_=N(A,D,!0);return _&&(j.$L=_),j},k.clone=function(){return P.w(this.$d,this)},k.toDate=function(){return new Date(this.valueOf())},k.toJSON=function(){return this.isValid()?this.toISOString():null},k.toISOString=function(){return this.$d.toISOString()},k.toString=function(){return this.$d.toUTCString()},L})(),z=H.prototype;return I.prototype=z,[["$ms",s],["$s",a],["$m",i],["$H",l],["$W",u],["$M",d],["$y",m],["$D",v]].forEach((function(L){z[L[1]]=function(k){return this.$g(k,L[0],L[1])}})),I.extend=function(L,k){return L.$i||(L(k,H,I),L.$i=!0),I},I.locale=N,I.isDayjs=S,I.unix=function(L){return I(1e3*L)},I.en=O[T],I.Ls=O,I.p={},I}))})(xo)),xo.exports}var PS=TS();const He=Gn(PS),MS=()=>{const e=new Date,t=e.getDate(),n=e.getMonth(),r=e.getFullYear(),s=new Date(r,n,1).getDay();return Math.ceil((t+s)/7)},_S=()=>[{name:"Year",template:"year",replacement:He().format("YYYY")},{name:"Month",template:"month",replacement:He().format("MM")},{name:"Short Month",template:"mon",replacement:He().format("M")},{name:"Day",template:"day",replacement:He().format("DD")},{name:"Short Day",template:"d",replacement:He().format("D")},{name:"Week of Month",template:"week_of_month",replacement:MS().toString()},{name:"Hour 24",template:"hour",replacement:He().format("HH")},{name:"Hour 12",template:"hour_12",replacement:He().format("hh")},{name:"Short Hour 24",template:"h",replacement:He().format("H")},{name:"Short Hour 12",template:"h_12",replacement:He().format("h")},{name:"AM/PM",template:"ampm",replacement:He().format("A")},{name:"Minute",template:"minute",replacement:He().format("mm")},{name:"Short Minute",template:"m",replacement:He().format("m")},{name:"Second",template:"second",replacement:He().format("ss")},{name:"Short Second",template:"s",replacement:He().format("s")}],NS="{%",OS="%}",Fl=e=>e.replace(new RegExp(`${NS}([^}]+)${OS}`,"g"),(t,n)=>_S().find(o=>o.template===n)?.replacement||t),co={title:"Move note to Trash?",description:"This note is referenced by the notes below. Those links may stop opening while this note stays in Trash. If you restore this note later, the links will work again.",confirmLabel:"Move to Trash",confirmVariant:"soft-danger"},Ap=()=>{const e=lf(),t=df(),n=Qn(),r=Sn(),[o,s]=c.useState(null),a=async(d="",p="",m)=>{const v=Fl(d),g=Fl(p),y=await xS({title:v,content:g,...m&&{layout:m}});return y.type==="error"?(t(y.errors[0].message),null):(r({to:tr,params:{id:y.createNote.id}}),y.createNote.id)},i=async(d,p,m)=>{try{const v=await wS(d,!p);if(v.type==="error"){t(v.errors[0].message);return}await Promise.all([n.invalidateQueries({queryKey:ve.notes.listAll(),exact:!1}),n.invalidateQueries({queryKey:ve.notes.tagListAll(),exact:!1}),n.invalidateQueries({queryKey:ve.notes.pinned(),exact:!0})]),m?.()}catch{t("Failed to update note pin status")}},l=async(d,p)=>{const m=await ES(d);if(m.type==="error"){t(m.errors[0].message);return}await Promise.all([n.invalidateQueries({queryKey:ve.notes.all(),exact:!1}),n.invalidateQueries({queryKey:ve.tags.all(),exact:!1}),n.invalidateQueries({queryKey:ve.reminders.all(),exact:!1}),n.invalidateQueries({queryKey:ve.images.all(),exact:!1}),n.invalidateQueries({queryKey:["calendar"],exact:!1})]),t("The note has been moved to trash."),p?.()},u=async()=>{if(!o)return;const{id:d,callback:p}=o;s(null),await l(d,p)};return{onCreate:a,onPinned:i,onDelete:async(d,p)=>{const m=await bS(d);if(m.type==="error"){t("Failed to check linked notes before moving this note to Trash.");return}if(n.setQueryData(ve.notes.backReferences(d),m.backReferences),m.backReferences.length>0){s({id:d,callback:p,backReferences:m.backReferences});return}await e("Move this note to trash?")&&await l(d,p)},deleteWarningDialog:h.jsx(CS,{isOpen:!!o,title:co.title,description:co.description,references:o?.backReferences??[],confirmLabel:co.confirmLabel,confirmVariant:co.confirmVariant,onClose:()=>s(null),onConfirm:()=>{u()}})}};function IS(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Ss=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function nr(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ji(e){return"nodeType"in e}function nt(e){var t,n;return e?nr(e)?e:Ji(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function ec(e){const{Document:t}=nt(e);return e instanceof t}function Gr(e){return nr(e)?!1:e instanceof nt(e).HTMLElement}function Tp(e){return e instanceof nt(e).SVGElement}function rr(e){return e?nr(e)?e.document:Ji(e)?ec(e)?e:Gr(e)||Tp(e)?e.ownerDocument:document:document:document}const _t=Ss?c.useLayoutEffect:c.useEffect;function tc(e){const t=c.useRef(e);return _t(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function DS(){const e=c.useRef(null),t=c.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Nr(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return _t(()=>{n.current!==e&&(n.current=e)},t),n}function Yr(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Zo(e){const t=tc(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function za(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let aa={};function Qr(e,t){return c.useMemo(()=>{if(t)return t;const n=aa[e]==null?0:aa[e]+1;return aa[e]=n,e+"-"+n},[e,t])}function Pp(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,a)=>{const i=Object.entries(a);for(const[l,u]of i){const f=s[l];f!=null&&(s[l]=f+e*u)}return s},{...t})}}const Zn=Pp(1),Or=Pp(-1);function LS(e){return"clientX"in e&&"clientY"in e}function nc(e){if(!e)return!1;const{KeyboardEvent:t}=nt(e.target);return t&&e instanceof t}function jS(e){if(!e)return!1;const{TouchEvent:t}=nt(e.target);return t&&e instanceof t}function Ka(e){if(jS(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return LS(e)?{x:e.clientX,y:e.clientY}:null}const Ir=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ir.Translate.toString(e),Ir.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),$l="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function kS(e){return e.matches($l)?e:e.querySelector($l)}const FS={display:"none"};function $S(e){let{id:t,value:n}=e;return M.createElement("div",{id:t,style:FS},n)}function HS(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return M.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function BS(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Mp=c.createContext(null);function VS(e){const t=c.useContext(Mp);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function ZS(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:s}=r;e.forEach(a=>{var i;return(i=a[o])==null?void 0:i.call(a,s)})},[e]),t]}const US={draggable:`
296
330
  To pick up a draggable item, press the space bar.
297
331
  While dragging, use the arrow keys to move the item.
298
332
  Press space again to drop the item in its new position, or press escape to cancel.
299
- `},qS={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function zS(e){let{announcements:t=qS,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=US}=e;const{announce:s,announcement:a}=BS(),i=Qr("DndLiveRegion"),[l,u]=c.useState(!1);if(c.useEffect(()=>{u(!0)},[]),VS(c.useMemo(()=>({onDragStart(d){let{active:p}=d;s(t.onDragStart({active:p}))},onDragMove(d){let{active:p,over:m}=d;t.onDragMove&&s(t.onDragMove({active:p,over:m}))},onDragOver(d){let{active:p,over:m}=d;s(t.onDragOver({active:p,over:m}))},onDragEnd(d){let{active:p,over:m}=d;s(t.onDragEnd({active:p,over:m}))},onDragCancel(d){let{active:p,over:m}=d;s(t.onDragCancel({active:p,over:m}))}}),[s,t])),!l)return null;const f=M.createElement(M.Fragment,null,M.createElement($S,{id:r,value:o.draggable}),M.createElement(HS,{id:i,announcement:a}));return n?$t.createPortal(f,n):f}var Me;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Me||(Me={}));function Uo(){}function Hl(e,t){return c.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function KS(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const wt=Object.freeze({x:0,y:0});function _p(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Np(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function WS(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Bl(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Op(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Vl(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const GS=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Vl(t,t.left,t.top),s=[];for(const a of r){const{id:i}=a,l=n.get(i);if(l){const u=_p(Vl(l),o);s.push({id:i,data:{droppableContainer:a,value:u}})}}return s.sort(Np)},YS=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Bl(t),s=[];for(const a of r){const{id:i}=a,l=n.get(i);if(l){const u=Bl(l),f=o.reduce((p,m,v)=>p+_p(u[v],m),0),d=Number((f/4).toFixed(4));s.push({id:i,data:{droppableContainer:a,value:d}})}}return s.sort(Np)};function QS(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),a=o-r,i=s-n;if(r<o&&n<s){const l=t.width*t.height,u=e.width*e.height,f=a*i,d=f/(l+u-f);return Number(d.toFixed(4))}return 0}const XS=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:a}=s,i=n.get(a);if(i){const l=QS(i,t);l>0&&o.push({id:a,data:{droppableContainer:s,value:l}})}}return o.sort(WS)};function JS(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Ip(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:wt}function e3(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((a,i)=>({...a,top:a.top+e*i.y,bottom:a.bottom+e*i.y,left:a.left+e*i.x,right:a.right+e*i.x}),{...n})}}const t3=e3(1);function n3(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function r3(e,t,n){const r=n3(t);if(!r)return e;const{scaleX:o,scaleY:s,x:a,y:i}=r,l=e.left-a-(1-o)*parseFloat(n),u=e.top-i-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,d=s?e.height/s:e.height;return{width:f,height:d,top:u,right:l+f,bottom:u+d,left:l}}const o3={ignoreTransform:!1};function or(e,t){t===void 0&&(t=o3);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=nt(e).getComputedStyle(e);u&&(n=r3(n,u,f))}const{top:r,left:o,width:s,height:a,bottom:i,right:l}=n;return{top:r,left:o,width:s,height:a,bottom:i,right:l}}function Zl(e){return or(e,{ignoreTransform:!0})}function s3(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function a3(e,t){return t===void 0&&(t=nt(e).getComputedStyle(e)),t.position==="fixed"}function i3(e,t){t===void 0&&(t=nt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function Rs(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(ec(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Gr(o)||Tp(o)||n.includes(o))return n;const s=nt(e).getComputedStyle(o);return o!==e&&i3(o,s)&&n.push(o),a3(o,s)?n:r(o.parentNode)}return e?r(e):n}function Dp(e){const[t]=Rs(e,1);return t??null}function ia(e){return!Ss||!e?null:nr(e)?e:Ji(e)?ec(e)||e===rr(e).scrollingElement?window:Gr(e)?e:null:null}function Lp(e){return nr(e)?e.scrollX:e.scrollLeft}function jp(e){return nr(e)?e.scrollY:e.scrollTop}function Wa(e){return{x:Lp(e),y:jp(e)}}var Oe;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Oe||(Oe={}));function kp(e){return!Ss||!e?!1:e===document.scrollingElement}function Fp(e){const t={x:0,y:0},n=kp(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,i=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:a,isRight:i,maxScroll:r,minScroll:t}}const c3={x:.2,y:.2};function l3(e,t,n,r,o){let{top:s,left:a,right:i,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=c3);const{isTop:u,isBottom:f,isLeft:d,isRight:p}=Fp(e),m={x:0,y:0},v={x:0,y:0},g={height:t.height*o.y,width:t.width*o.x};return!u&&s<=t.top+g.height?(m.y=Oe.Backward,v.y=r*Math.abs((t.top+g.height-s)/g.height)):!f&&l>=t.bottom-g.height&&(m.y=Oe.Forward,v.y=r*Math.abs((t.bottom-g.height-l)/g.height)),!p&&i>=t.right-g.width?(m.x=Oe.Forward,v.x=r*Math.abs((t.right-g.width-i)/g.width)):!d&&a<=t.left+g.width&&(m.x=Oe.Backward,v.x=r*Math.abs((t.left+g.width-a)/g.width)),{direction:m,speed:v}}function u3(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function $p(e){return e.reduce((t,n)=>Zn(t,Wa(n)),wt)}function d3(e){return e.reduce((t,n)=>t+Lp(n),0)}function f3(e){return e.reduce((t,n)=>t+jp(n),0)}function h3(e,t){if(t===void 0&&(t=or),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);Dp(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const p3=[["x",["left","right"],d3],["y",["top","bottom"],f3]];class rc{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Rs(n),o=$p(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,a,i]of p3)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=i(r),f=o[s]-u;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class xr{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function m3(e){const{EventTarget:t}=nt(e);return e instanceof t?e:rr(e)}function ca(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var pt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(pt||(pt={}));function Ul(e){e.preventDefault()}function g3(e){e.stopPropagation()}var oe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(oe||(oe={}));const Hp={start:[oe.Space,oe.Enter],cancel:[oe.Esc],end:[oe.Space,oe.Enter,oe.Tab]},v3=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case oe.Right:return{...n,x:n.x+25};case oe.Left:return{...n,x:n.x-25};case oe.Down:return{...n,y:n.y+25};case oe.Up:return{...n,y:n.y-25}}};class oc{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new xr(rr(n)),this.windowListeners=new xr(nt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(pt.Resize,this.handleCancel),this.windowListeners.add(pt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(pt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&h3(r),n(wt)}handleKeyDown(t){if(nc(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=Hp,coordinateGetter:a=v3,scrollBehavior:i="smooth"}=o,{code:l}=t;if(s.end.includes(l)){this.handleEnd(t);return}if(s.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,f=u?{x:u.left,y:u.top}:wt;this.referenceCoordinates||(this.referenceCoordinates=f);const d=a(t,{active:n,context:r.current,currentCoordinates:f});if(d){const p=Or(d,f),m={x:0,y:0},{scrollableAncestors:v}=r.current;for(const g of v){const y=t.code,{isTop:b,isRight:x,isLeft:w,isBottom:E,maxScroll:T,minScroll:O}=Fp(g),C=u3(g),S={x:Math.min(y===oe.Right?C.right-C.width/2:C.right,Math.max(y===oe.Right?C.left:C.left+C.width/2,d.x)),y:Math.min(y===oe.Down?C.bottom-C.height/2:C.bottom,Math.max(y===oe.Down?C.top:C.top+C.height/2,d.y))},N=y===oe.Right&&!x||y===oe.Left&&!w,I=y===oe.Down&&!E||y===oe.Up&&!b;if(N&&S.x!==d.x){const P=g.scrollLeft+p.x,H=y===oe.Right&&P<=T.x||y===oe.Left&&P>=O.x;if(H&&!p.y){g.scrollTo({left:P,behavior:i});return}H?m.x=g.scrollLeft-P:m.x=y===oe.Right?g.scrollLeft-T.x:g.scrollLeft-O.x,m.x&&g.scrollBy({left:-m.x,behavior:i});break}else if(I&&S.y!==d.y){const P=g.scrollTop+p.y,H=y===oe.Down&&P<=T.y||y===oe.Up&&P>=O.y;if(H&&!p.x){g.scrollTo({top:P,behavior:i});return}H?m.y=g.scrollTop-P:m.y=y===oe.Down?g.scrollTop-T.y:g.scrollTop-O.y,m.y&&g.scrollBy({top:-m.y,behavior:i});break}}this.handleMove(t,Zn(Or(d,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}oc.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Hp,onActivation:o}=t,{active:s}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const i=s.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function ql(e){return!!(e&&"distance"in e)}function zl(e){return!!(e&&"delay"in e)}class sc{constructor(t,n,r){var o;r===void 0&&(r=m3(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:a}=s;this.props=t,this.events=n,this.document=rr(a),this.documentListeners=new xr(this.document),this.listeners=new xr(r),this.windowListeners=new xr(nt(a)),this.initialCoordinates=(o=Ka(s))!=null?o:wt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(pt.Resize,this.handleCancel),this.windowListeners.add(pt.DragStart,Ul),this.windowListeners.add(pt.VisibilityChange,this.handleCancel),this.windowListeners.add(pt.ContextMenu,Ul),this.documentListeners.add(pt.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(zl(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(ql(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(pt.Click,g3,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(pt.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:a,options:{activationConstraint:i}}=s;if(!o)return;const l=(n=Ka(t))!=null?n:wt,u=Or(o,l);if(!r&&i){if(ql(i)){if(i.tolerance!=null&&ca(u,i.tolerance))return this.handleCancel();if(ca(u,i.distance))return this.handleStart()}if(zl(i)&&ca(u,i.tolerance))return this.handleCancel();this.handlePending(i,u);return}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===oe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const y3={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ac extends sc{constructor(t){const{event:n}=t,r=rr(n.target);super(t,y3,r)}}ac.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const b3={move:{name:"mousemove"},end:{name:"mouseup"}};var Ga;(function(e){e[e.RightClick=2]="RightClick"})(Ga||(Ga={}));class x3 extends sc{constructor(t){super(t,b3,rr(t.event.target))}}x3.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Ga.RightClick?!1:(r?.({event:n}),!0)}}];const la={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class w3 extends sc{constructor(t){super(t,la)}static setup(){return window.addEventListener(la.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(la.move.name,t)};function t(){}}}w3.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var wr;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(wr||(wr={}));var qo;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(qo||(qo={}));function E3(e){let{acceleration:t,activator:n=wr.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:a=5,order:i=qo.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:p}=e;const m=R3({delta:d,disabled:!s}),[v,g]=DS(),y=c.useRef({x:0,y:0}),b=c.useRef({x:0,y:0}),x=c.useMemo(()=>{switch(n){case wr.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case wr.DraggableRect:return o}},[n,o,l]),w=c.useRef(null),E=c.useCallback(()=>{const O=w.current;if(!O)return;const C=y.current.x*b.current.x,S=y.current.y*b.current.y;O.scrollBy(C,S)},[]),T=c.useMemo(()=>i===qo.TreeOrder?[...u].reverse():u,[i,u]);c.useEffect(()=>{if(!s||!u.length||!x){g();return}for(const O of T){if(r?.(O)===!1)continue;const C=u.indexOf(O),S=f[C];if(!S)continue;const{direction:N,speed:I}=l3(O,S,x,t,p);for(const P of["x","y"])m[P][N[P]]||(I[P]=0,N[P]=0);if(I.x>0||I.y>0){g(),w.current=O,v(E,a),y.current=I,b.current=N;return}}y.current={x:0,y:0},b.current={x:0,y:0},g()},[t,E,r,g,s,a,JSON.stringify(x),JSON.stringify(m),v,u,T,f,JSON.stringify(p)])}const S3={x:{[Oe.Backward]:!1,[Oe.Forward]:!1},y:{[Oe.Backward]:!1,[Oe.Forward]:!1}};function R3(e){let{delta:t,disabled:n}=e;const r=za(t);return Yr(o=>{if(n||!r||!o)return S3;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Oe.Backward]:o.x[Oe.Backward]||s.x===-1,[Oe.Forward]:o.x[Oe.Forward]||s.x===1},y:{[Oe.Backward]:o.y[Oe.Backward]||s.y===-1,[Oe.Forward]:o.y[Oe.Forward]||s.y===1}}},[n,t,r])}function C3(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Yr(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function A3(e,t){return c.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...s]},[]),[e,t])}var Dr;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Dr||(Dr={}));var Ya;(function(e){e.Optimized="optimized"})(Ya||(Ya={}));const Kl=new Map;function T3(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,a]=c.useState(null),{frequency:i,measure:l,strategy:u}=o,f=c.useRef(e),d=y(),p=Nr(d),m=c.useCallback(function(b){b===void 0&&(b=[]),!p.current&&a(x=>x===null?b:x.concat(b.filter(w=>!x.includes(w))))},[p]),v=c.useRef(null),g=Yr(b=>{if(d&&!n)return Kl;if(!b||b===Kl||f.current!==e||s!=null){const x=new Map;for(let w of e){if(!w)continue;if(s&&s.length>0&&!s.includes(w.id)&&w.rect.current){x.set(w.id,w.rect.current);continue}const E=w.node.current,T=E?new rc(l(E),E):null;w.rect.current=T,T&&x.set(w.id,T)}return x}return b},[e,s,n,d,l]);return c.useEffect(()=>{f.current=e},[e]),c.useEffect(()=>{d||m()},[n,d]),c.useEffect(()=>{s&&s.length>0&&a(null)},[JSON.stringify(s)]),c.useEffect(()=>{d||typeof i!="number"||v.current!==null||(v.current=setTimeout(()=>{m(),v.current=null},i))},[i,d,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:s!=null};function y(){switch(u){case Dr.Always:return!1;case Dr.BeforeDragging:return n;default:return!n}}}function Bp(e,t){return Yr(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function P3(e,t){return Bp(e,t)}function M3(e){let{callback:t,disabled:n}=e;const r=tc(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function Cs(e){let{callback:t,disabled:n}=e;const r=tc(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function _3(e){return new rc(or(e),e)}function Wl(e,t,n){t===void 0&&(t=_3);const[r,o]=c.useState(null);function s(){o(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const a=M3({callback(l){if(e)for(const u of l){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){s();break}}}}),i=Cs({callback:s});return _t(()=>{s(),e?(i?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(i?.disconnect(),a?.disconnect())},[e]),r}function N3(e){const t=Bp(e);return Ip(e,t)}const Gl=[];function O3(e){const t=c.useRef(e),n=Yr(r=>e?r&&r!==Gl&&e&&t.current&&e.parentNode===t.current.parentNode?r:Rs(e):Gl,[e]);return c.useEffect(()=>{t.current=e},[e]),n}function I3(e){const[t,n]=c.useState(null),r=c.useRef(e),o=c.useCallback(s=>{const a=ia(s.target);a&&n(i=>i?(i.set(a,Wa(a)),new Map(i)):null)},[]);return c.useEffect(()=>{const s=r.current;if(e!==s){a(s);const i=e.map(l=>{const u=ia(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,Wa(u)]):null}).filter(l=>l!=null);n(i.length?new Map(i):null),r.current=e}return()=>{a(e),a(s)};function a(i){i.forEach(l=>{const u=ia(l);u?.removeEventListener("scroll",o)})}},[o,e]),c.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>Zn(s,a),wt):$p(e):wt,[e,t])}function Yl(e,t){t===void 0&&(t=[]);const n=c.useRef(null);return c.useEffect(()=>{n.current=null},t),c.useEffect(()=>{const r=e!==wt;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Or(e,n.current):wt}function D3(e){c.useEffect(()=>{if(!Ss)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function L3(e,t){return c.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=a=>{s(a,t)},n},{}),[e,t])}function Vp(e){return c.useMemo(()=>e?s3(e):null,[e])}const Ql=[];function j3(e,t){t===void 0&&(t=or);const[n]=e,r=Vp(n?nt(n):null),[o,s]=c.useState(Ql);function a(){s(()=>e.length?e.map(l=>kp(l)?r:new rc(t(l),l)):Ql)}const i=Cs({callback:a});return _t(()=>{i?.disconnect(),a(),e.forEach(l=>i?.observe(l))},[e]),o}function k3(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Gr(t)?t:e}function F3(e){let{measure:t}=e;const[n,r]=c.useState(null),o=c.useCallback(u=>{for(const{target:f}of u)if(Gr(f)){r(d=>{const p=t(f);return d?{...d,width:p.width,height:p.height}:p});break}},[t]),s=Cs({callback:o}),a=c.useCallback(u=>{const f=k3(u);s?.disconnect(),f&&s?.observe(f),r(f?t(f):null)},[t,s]),[i,l]=Zo(a);return c.useMemo(()=>({nodeRef:i,rect:n,setRef:l}),[n,i,l])}const $3=[{sensor:ac,options:{}},{sensor:oc,options:{}}],H3={current:{}},wo={draggable:{measure:Zl},droppable:{measure:Zl,strategy:Dr.WhileDragging,frequency:Ya.Optimized},dragOverlay:{measure:or}};class Er extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const B3={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Er,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Uo},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:wo,measureDroppableContainers:Uo,windowRect:null,measuringScheduled:!1},V3={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Uo,draggableNodes:new Map,over:null,measureDroppableContainers:Uo},As=c.createContext(V3),Zp=c.createContext(B3);function Z3(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Er}}}function U3(e,t){switch(t.type){case Me.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Me.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Me.DragEnd:case Me.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Me.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Er(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Me.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new Er(e.droppable.containers);return a.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case Me.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Er(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function q3(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=c.useContext(As),s=za(r),a=za(n?.id);return c.useEffect(()=>{if(!t&&!r&&s&&a!=null){if(!nc(s)||document.activeElement===s.target)return;const i=o.get(a);if(!i)return;const{activatorNode:l,node:u}=i;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[l.current,u.current]){if(!f)continue;const d=kS(f);if(d){d.focus();break}}})}},[r,t,o,a,s]),null}function z3(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function K3(e){return c.useMemo(()=>({draggable:{...wo.draggable,...e?.draggable},droppable:{...wo.droppable,...e?.droppable},dragOverlay:{...wo.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function W3(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=c.useRef(!1),{x:a,y:i}=typeof o=="boolean"?{x:o,y:o}:o;_t(()=>{if(!a&&!i||!t){s.current=!1;return}if(s.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),d=Ip(f,r);if(a||(d.x=0),i||(d.y=0),s.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const p=Dp(u);p&&p.scrollBy({top:d.y,left:d.x})}},[t,a,i,r,n])}const Up=c.createContext({...wt,scaleX:1,scaleY:1});var Kt;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Kt||(Kt={}));const G3=c.memo(function(t){var n,r,o,s;let{id:a,accessibility:i,autoScroll:l=!0,children:u,sensors:f=$3,collisionDetection:d=XS,measuring:p,modifiers:m,...v}=t;const g=c.useReducer(U3,void 0,Z3),[y,b]=g,[x,w]=ZS(),[E,T]=c.useState(Kt.Uninitialized),O=E===Kt.Initialized,{draggable:{active:C,nodes:S,translate:N},droppable:{containers:I}}=y,P=C!=null?S.get(C):null,H=c.useRef({initial:null,translated:null}),z=c.useMemo(()=>{var Pe;return C!=null?{id:C,data:(Pe=P?.data)!=null?Pe:H3,rect:H}:null},[C,P]),L=c.useRef(null),[k,A]=c.useState(null),[D,j]=c.useState(null),_=Nr(v,Object.values(v)),V=Qr("DndDescribedBy",a),K=c.useMemo(()=>I.getEnabled(),[I]),Y=K3(p),{droppableRects:B,measureDroppableContainers:q,measuringScheduled:U}=T3(K,{dragging:O,dependencies:[N.x,N.y],config:Y.droppable}),J=C3(S,C),$=c.useMemo(()=>D?Ka(D):null,[D]),F=Os(),ee=P3(J,Y.draggable.measure);W3({activeNode:C!=null?S.get(C):null,config:F.layoutShiftCompensation,initialRect:ee,measure:Y.draggable.measure});const Z=Wl(J,Y.draggable.measure,ee),X=Wl(J?J.parentElement:null),te=c.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ae=I.getNodeFor((n=te.current.over)==null?void 0:n.id),le=F3({measure:Y.dragOverlay.measure}),Qe=(r=le.nodeRef.current)!=null?r:J,Fe=O?(o=le.rect)!=null?o:Z:null,qe=!!(le.nodeRef.current&&le.rect),ct=N3(qe?null:Z),Le=Vp(Qe?nt(Qe):null),Ne=O3(O?ae??J:null),Zt=j3(Ne),Te=z3(m,{transform:{x:N.x-ct.x,y:N.y-ct.y,scaleX:1,scaleY:1},activatorEvent:D,active:z,activeNodeRect:Z,containerNodeRect:X,draggingNodeRect:Fe,over:te.current.over,overlayNodeRect:le.rect,scrollableAncestors:Ne,scrollableAncestorRects:Zt,windowRect:Le}),lt=$?Zn($,N):null,Tn=I3(Ne),Pn=Yl(Tn),ie=Yl(Tn,[Z]),ge=Zn(Te,Pn),Re=Fe?t3(Fe,Te):null,ut=z&&Re?d({active:z,collisionRect:Re,droppableRects:B,droppableContainers:K,pointerCoordinates:lt}):null,It=Op(ut,"id"),[vt,Dt]=c.useState(null),Ps=qe?Te:Zn(Te,ie),Ms=JS(Ps,(s=vt?.rect)!=null?s:null,Z),Mn=c.useRef(null),sr=c.useCallback((Pe,$e)=>{let{sensor:Q,options:he}=$e;if(L.current==null)return;const de=S.get(L.current);if(!de)return;const pe=Pe.nativeEvent,ze=new Q({active:L.current,activeNode:de,event:pe,options:he,context:te,onAbort(ue){if(!S.get(ue))return;const{onDragAbort:Se}=_.current,Ce={id:ue};Se?.(Ce),x({type:"onDragAbort",event:Ce})},onPending(ue,rt,Se,Ce){if(!S.get(ue))return;const{onDragPending:ot}=_.current,Lt={id:ue,constraint:rt,initialCoordinates:Se,offset:Ce};ot?.(Lt),x({type:"onDragPending",event:Lt})},onStart(ue){const rt=L.current;if(rt==null)return;const Se=S.get(rt);if(!Se)return;const{onDragStart:Ce}=_.current,Ut={activatorEvent:pe,active:{id:rt,data:Se.data,rect:H}};$t.unstable_batchedUpdates(()=>{Ce?.(Ut),T(Kt.Initializing),b({type:Me.DragStart,initialCoordinates:ue,active:rt}),x({type:"onDragStart",event:Ut}),A(Mn.current),j(pe)})},onMove(ue){b({type:Me.DragMove,coordinates:ue})},onEnd:be(Me.DragEnd),onCancel:be(Me.DragCancel)});Mn.current=ze;function be(ue){return async function(){const{active:Se,collisions:Ce,over:Ut,scrollAdjustedTranslate:ot}=te.current;let Lt=null;if(Se&&ot){const{cancelDrop:ar}=_.current;Lt={activatorEvent:pe,active:Se,collisions:Ce,delta:ot,over:Ut},ue===Me.DragEnd&&typeof ar=="function"&&await Promise.resolve(ar(Lt))&&(ue=Me.DragCancel)}L.current=null,$t.unstable_batchedUpdates(()=>{b({type:ue}),T(Kt.Uninitialized),Dt(null),A(null),j(null),Mn.current=null;const ar=ue===Me.DragEnd?"onDragEnd":"onDragCancel";if(Lt){const Is=_.current[ar];Is?.(Lt),x({type:ar,event:Lt})}})}}},[S]),_s=c.useCallback((Pe,$e)=>(Q,he)=>{const de=Q.nativeEvent,pe=S.get(he);if(L.current!==null||!pe||de.dndKit||de.defaultPrevented)return;const ze={active:pe};Pe(Q,$e.options,ze)===!0&&(de.dndKit={capturedBy:$e.sensor},L.current=he,sr(Q,$e))},[S,sr]),_n=A3(f,_s);D3(f),_t(()=>{Z&&E===Kt.Initializing&&T(Kt.Initialized)},[Z,E]),c.useEffect(()=>{const{onDragMove:Pe}=_.current,{active:$e,activatorEvent:Q,collisions:he,over:de}=te.current;if(!$e||!Q)return;const pe={active:$e,activatorEvent:Q,collisions:he,delta:{x:ge.x,y:ge.y},over:de};$t.unstable_batchedUpdates(()=>{Pe?.(pe),x({type:"onDragMove",event:pe})})},[ge.x,ge.y]),c.useEffect(()=>{const{active:Pe,activatorEvent:$e,collisions:Q,droppableContainers:he,scrollAdjustedTranslate:de}=te.current;if(!Pe||L.current==null||!$e||!de)return;const{onDragOver:pe}=_.current,ze=he.get(It),be=ze&&ze.rect.current?{id:ze.id,rect:ze.rect.current,data:ze.data,disabled:ze.disabled}:null,ue={active:Pe,activatorEvent:$e,collisions:Q,delta:{x:de.x,y:de.y},over:be};$t.unstable_batchedUpdates(()=>{Dt(be),pe?.(ue),x({type:"onDragOver",event:ue})})},[It]),_t(()=>{te.current={activatorEvent:D,active:z,activeNode:J,collisionRect:Re,collisions:ut,droppableRects:B,draggableNodes:S,draggingNode:Qe,draggingNodeRect:Fe,droppableContainers:I,over:vt,scrollableAncestors:Ne,scrollAdjustedTranslate:ge},H.current={initial:Fe,translated:Re}},[z,J,ut,Re,S,Qe,Fe,B,I,vt,Ne,ge]),E3({...F,delta:N,draggingRect:Re,pointerCoordinates:lt,scrollableAncestors:Ne,scrollableAncestorRects:Zt});const Rt=c.useMemo(()=>({active:z,activeNode:J,activeNodeRect:Z,activatorEvent:D,collisions:ut,containerNodeRect:X,dragOverlay:le,draggableNodes:S,droppableContainers:I,droppableRects:B,over:vt,measureDroppableContainers:q,scrollableAncestors:Ne,scrollableAncestorRects:Zt,measuringConfiguration:Y,measuringScheduled:U,windowRect:Le}),[z,J,Z,D,ut,X,le,S,I,B,vt,q,Ne,Zt,Y,U,Le]),Ns=c.useMemo(()=>({activatorEvent:D,activators:_n,active:z,activeNodeRect:Z,ariaDescribedById:{draggable:V},dispatch:b,draggableNodes:S,over:vt,measureDroppableContainers:q}),[D,_n,z,Z,b,V,S,vt,q]);return M.createElement(Mp.Provider,{value:w},M.createElement(As.Provider,{value:Ns},M.createElement(Zp.Provider,{value:Rt},M.createElement(Up.Provider,{value:Ms},u)),M.createElement(q3,{disabled:i?.restoreFocus===!1})),M.createElement(zS,{...i,hiddenTextDescribedById:V}));function Os(){const Pe=k?.autoScrollEnabled===!1,$e=typeof l=="object"?l.enabled===!1:l===!1,Q=O&&!Pe&&!$e;return typeof l=="object"?{...l,enabled:Q}:{enabled:Q}}}),Y3=c.createContext(null),Xl="button",Q3="Draggable";function X3(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=Qr(Q3),{activators:a,activatorEvent:i,active:l,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:p}=c.useContext(As),{role:m=Xl,roleDescription:v="draggable",tabIndex:g=0}=o??{},y=l?.id===t,b=c.useContext(y?Up:Y3),[x,w]=Zo(),[E,T]=Zo(),O=L3(a,t),C=Nr(n);_t(()=>(d.set(t,{id:t,key:s,node:x,activatorNode:E,data:C}),()=>{const N=d.get(t);N&&N.key===s&&d.delete(t)}),[d,t]);const S=c.useMemo(()=>({role:m,tabIndex:g,"aria-disabled":r,"aria-pressed":y&&m===Xl?!0:void 0,"aria-roledescription":v,"aria-describedby":f.draggable}),[r,m,g,y,v,f.draggable]);return{active:l,activatorEvent:i,activeNodeRect:u,attributes:S,isDragging:y,listeners:r?void 0:O,node:x,over:p,setNodeRef:w,setActivatorNodeRef:T,transform:b}}function J3(){return c.useContext(Zp)}const eR="Droppable",tR={timeout:25};function nR(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=Qr(eR),{active:a,dispatch:i,over:l,measureDroppableContainers:u}=c.useContext(As),f=c.useRef({disabled:n}),d=c.useRef(!1),p=c.useRef(null),m=c.useRef(null),{disabled:v,updateMeasurementsFor:g,timeout:y}={...tR,...o},b=Nr(g??r),x=c.useCallback(()=>{if(!d.current){d.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),m.current=null},y)},[y]),w=Cs({callback:x,disabled:v||!a}),E=c.useCallback((S,N)=>{w&&(N&&(w.unobserve(N),d.current=!1),S&&w.observe(S))},[w]),[T,O]=Zo(E),C=Nr(t);return c.useEffect(()=>{!w||!T.current||(w.disconnect(),d.current=!1,w.observe(T.current))},[T,w]),c.useEffect(()=>(i({type:Me.RegisterDroppable,element:{id:r,key:s,disabled:n,node:T,rect:p,data:C}}),()=>i({type:Me.UnregisterDroppable,key:s,id:r})),[r]),c.useEffect(()=>{n!==f.current.disabled&&(i({type:Me.SetDroppableDisabled,id:r,key:s,disabled:n}),f.current.disabled=n)},[r,s,n,i]),{active:a,rect:p,isOver:l?.id===r,node:T,over:l,setNodeRef:O}}const I5=e=>{let{transform:t}=e;return{...t,y:0}},rR=e=>{let{transform:t}=e;return{...t,x:0}};function ic(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function oR(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function lo(e){return e!==null&&e>=0}function sR(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function aR(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const uo={scaleX:1,scaleY:1},D5=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:a}=e;const i=(t=n[o])!=null?t:r;if(!i)return null;const l=iR(n,a,o);if(a===o){const u=n[s];return u?{x:o<s?u.left+u.width-(i.left+i.width):u.left-i.left,y:0,...uo}:null}return a>o&&a<=s?{x:-i.width-l,y:0,...uo}:a<o&&a>=s?{x:i.width+l,y:0,...uo}:{x:0,y:0,...uo}};function iR(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return!r||!o&&!s?0:n<t?o?r.left-(o.left+o.width):s.left-(r.left+r.width):s?s.left-(r.left+r.width):r.left-(o.left+o.width)}const qp=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=ic(t,r,n),a=t[o],i=s[o];return!i||!a?null:{x:i.left-a.left,y:i.top-a.top,scaleX:i.width/a.width,scaleY:i.height/a.height}},fo={scaleX:1,scaleY:1},cR=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:a}=e;const i=(t=s[n])!=null?t:r;if(!i)return null;if(o===n){const u=s[a];return u?{x:0,y:n<a?u.top+u.height-(i.top+i.height):u.top-i.top,...fo}:null}const l=lR(s,o,n);return o>n&&o<=a?{x:0,y:-i.height-l,...fo}:o<n&&o>=a?{x:0,y:i.height+l,...fo}:{x:0,y:0,...fo}};function lR(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const zp="Sortable",Kp=M.createContext({activeIndex:-1,containerId:zp,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:qp,disabled:{draggable:!1,droppable:!1}});function uR(e){let{children:t,id:n,items:r,strategy:o=qp,disabled:s=!1}=e;const{active:a,dragOverlay:i,droppableRects:l,over:u,measureDroppableContainers:f}=J3(),d=Qr(zp,n),p=i.rect!==null,m=c.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),v=a!=null,g=a?m.indexOf(a.id):-1,y=u?m.indexOf(u.id):-1,b=c.useRef(m),x=!sR(m,b.current),w=y!==-1&&g===-1||x,E=aR(s);_t(()=>{x&&v&&f(m)},[x,m,v,f]),c.useEffect(()=>{b.current=m},[m]);const T=c.useMemo(()=>({activeIndex:g,containerId:d,disabled:E,disableTransforms:w,items:m,overIndex:y,useDragOverlay:p,sortedRects:oR(m,l),strategy:o}),[g,d,E.draggable,E.droppable,w,m,y,l,p,o]);return M.createElement(Kp.Provider,{value:T},t)}const dR=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return ic(n,r,o).indexOf(t)},fR=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:a,previousItems:i,previousContainerId:l,transition:u}=e;return!u||!r||i!==s&&o===a?!1:n?!0:a!==o&&t===l},hR={duration:200,easing:"ease"},Wp="transform",pR=Ir.Transition.toString({property:Wp,duration:0,easing:"linear"}),mR={roleDescription:"sortable"};function gR(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,a]=c.useState(null),i=c.useRef(n);return _t(()=>{if(!t&&n!==i.current&&r.current){const l=o.current;if(l){const u=or(r.current,{ignoreTransform:!0}),f={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(f.x||f.y)&&a(f)}}n!==i.current&&(i.current=n)},[t,n,r,o]),c.useEffect(()=>{s&&a(null)},[s]),s}function vR(e){let{animateLayoutChanges:t=fR,attributes:n,disabled:r,data:o,getNewIndex:s=dR,id:a,strategy:i,resizeObserverConfig:l,transition:u=hR}=e;const{items:f,containerId:d,activeIndex:p,disabled:m,disableTransforms:v,sortedRects:g,overIndex:y,useDragOverlay:b,strategy:x}=c.useContext(Kp),w=yR(r,m),E=f.indexOf(a),T=c.useMemo(()=>({sortable:{containerId:d,index:E,items:f},...o}),[d,o,E,f]),O=c.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:C,node:S,isOver:N,setNodeRef:I}=nR({id:a,data:T,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...l}}),{active:P,activatorEvent:H,activeNodeRect:z,attributes:L,setNodeRef:k,listeners:A,isDragging:D,over:j,setActivatorNodeRef:_,transform:V}=X3({id:a,data:T,attributes:{...mR,...n},disabled:w.draggable}),K=IS(I,k),Y=!!P,B=Y&&!v&&lo(p)&&lo(y),q=!b&&D,U=q&&B?V:null,$=B?U??(i??x)({rects:g,activeNodeRect:z,activeIndex:p,overIndex:y,index:E}):null,F=lo(p)&&lo(y)?s({id:a,items:f,activeIndex:p,overIndex:y}):E,ee=P?.id,Z=c.useRef({activeId:ee,items:f,newIndex:F,containerId:d}),X=f!==Z.current.items,te=t({active:P,containerId:d,isDragging:D,isSorting:Y,id:a,index:E,items:f,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:u,wasDragging:Z.current.activeId!=null}),ae=gR({disabled:!te,index:E,node:S,rect:C});return c.useEffect(()=>{Y&&Z.current.newIndex!==F&&(Z.current.newIndex=F),d!==Z.current.containerId&&(Z.current.containerId=d),f!==Z.current.items&&(Z.current.items=f)},[Y,F,d,f]),c.useEffect(()=>{if(ee===Z.current.activeId)return;if(ee!=null&&Z.current.activeId==null){Z.current.activeId=ee;return}const Qe=setTimeout(()=>{Z.current.activeId=ee},50);return()=>clearTimeout(Qe)},[ee]),{active:P,activeIndex:p,attributes:L,data:T,rect:C,index:E,newIndex:F,items:f,isOver:N,isSorting:Y,isDragging:D,listeners:A,node:S,overIndex:y,over:j,setNodeRef:K,setActivatorNodeRef:_,setDroppableNodeRef:I,setDraggableNodeRef:k,transform:ae??$,transition:le()};function le(){if(ae||X&&Z.current.newIndex===E)return pR;if(!(q&&!nc(H)||!u)&&(Y||te))return Ir.Transition.toString({...u,property:Wp})}}function yR(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function zo(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const bR=[oe.Down,oe.Right,oe.Up,oe.Left],xR=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:s,over:a,scrollableAncestors:i}}=t;if(bR.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];s.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const p=o.get(d.id);if(p)switch(e.code){case oe.Down:r.top<p.top&&l.push(d);break;case oe.Up:r.top>p.top&&l.push(d);break;case oe.Left:r.left>p.left&&l.push(d);break;case oe.Right:r.left<p.left&&l.push(d);break}});const u=YS({collisionRect:r,droppableRects:o,droppableContainers:l});let f=Op(u,"id");if(f===a?.id&&u.length>1&&(f=u[1].id),f!=null){const d=s.get(n.id),p=s.get(f),m=p?o.get(p.id):null,v=p?.node.current;if(v&&m&&d&&p){const y=Rs(v).some((O,C)=>i[C]!==O),b=Gp(d,p),x=wR(d,p),w=y||!b?{x:0,y:0}:{x:x?r.width-m.width:0,y:x?r.height-m.height:0},E={x:m.left,y:m.top};return w.x&&w.y?E:Or(E,w)}}}};function Gp(e,t){return!zo(e)||!zo(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function wR(e,t){return!zo(e)||!zo(t)||!Gp(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const ER=e=>{const{data:t}=Hu({queryKey:ve.notes.list(e.searchParams),async queryFn(){const n=await Rp(e.searchParams);if(n.type==="error")throw n;return n.allNotes}});return e.render(t)},SR=e=>{const{data:t}=Hu({queryKey:ve.notes.pinned(),async queryFn(){const n=await fe(`
333
+ `},qS={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function zS(e){let{announcements:t=qS,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=US}=e;const{announce:s,announcement:a}=BS(),i=Qr("DndLiveRegion"),[l,u]=c.useState(!1);if(c.useEffect(()=>{u(!0)},[]),VS(c.useMemo(()=>({onDragStart(d){let{active:p}=d;s(t.onDragStart({active:p}))},onDragMove(d){let{active:p,over:m}=d;t.onDragMove&&s(t.onDragMove({active:p,over:m}))},onDragOver(d){let{active:p,over:m}=d;s(t.onDragOver({active:p,over:m}))},onDragEnd(d){let{active:p,over:m}=d;s(t.onDragEnd({active:p,over:m}))},onDragCancel(d){let{active:p,over:m}=d;s(t.onDragCancel({active:p,over:m}))}}),[s,t])),!l)return null;const f=M.createElement(M.Fragment,null,M.createElement($S,{id:r,value:o.draggable}),M.createElement(HS,{id:i,announcement:a}));return n?$t.createPortal(f,n):f}var Me;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Me||(Me={}));function Uo(){}function Hl(e,t){return c.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function KS(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const wt=Object.freeze({x:0,y:0});function _p(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Np(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function WS(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Bl(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Op(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Vl(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const GS=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Vl(t,t.left,t.top),s=[];for(const a of r){const{id:i}=a,l=n.get(i);if(l){const u=_p(Vl(l),o);s.push({id:i,data:{droppableContainer:a,value:u}})}}return s.sort(Np)},YS=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Bl(t),s=[];for(const a of r){const{id:i}=a,l=n.get(i);if(l){const u=Bl(l),f=o.reduce((p,m,v)=>p+_p(u[v],m),0),d=Number((f/4).toFixed(4));s.push({id:i,data:{droppableContainer:a,value:d}})}}return s.sort(Np)};function QS(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),a=o-r,i=s-n;if(r<o&&n<s){const l=t.width*t.height,u=e.width*e.height,f=a*i,d=f/(l+u-f);return Number(d.toFixed(4))}return 0}const XS=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:a}=s,i=n.get(a);if(i){const l=QS(i,t);l>0&&o.push({id:a,data:{droppableContainer:s,value:l}})}}return o.sort(WS)};function JS(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Ip(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:wt}function e3(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((a,i)=>({...a,top:a.top+e*i.y,bottom:a.bottom+e*i.y,left:a.left+e*i.x,right:a.right+e*i.x}),{...n})}}const t3=e3(1);function n3(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function r3(e,t,n){const r=n3(t);if(!r)return e;const{scaleX:o,scaleY:s,x:a,y:i}=r,l=e.left-a-(1-o)*parseFloat(n),u=e.top-i-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,d=s?e.height/s:e.height;return{width:f,height:d,top:u,right:l+f,bottom:u+d,left:l}}const o3={ignoreTransform:!1};function or(e,t){t===void 0&&(t=o3);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=nt(e).getComputedStyle(e);u&&(n=r3(n,u,f))}const{top:r,left:o,width:s,height:a,bottom:i,right:l}=n;return{top:r,left:o,width:s,height:a,bottom:i,right:l}}function Zl(e){return or(e,{ignoreTransform:!0})}function s3(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function a3(e,t){return t===void 0&&(t=nt(e).getComputedStyle(e)),t.position==="fixed"}function i3(e,t){t===void 0&&(t=nt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function Rs(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(ec(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Gr(o)||Tp(o)||n.includes(o))return n;const s=nt(e).getComputedStyle(o);return o!==e&&i3(o,s)&&n.push(o),a3(o,s)?n:r(o.parentNode)}return e?r(e):n}function Dp(e){const[t]=Rs(e,1);return t??null}function ia(e){return!Ss||!e?null:nr(e)?e:Ji(e)?ec(e)||e===rr(e).scrollingElement?window:Gr(e)?e:null:null}function Lp(e){return nr(e)?e.scrollX:e.scrollLeft}function jp(e){return nr(e)?e.scrollY:e.scrollTop}function Wa(e){return{x:Lp(e),y:jp(e)}}var Oe;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Oe||(Oe={}));function kp(e){return!Ss||!e?!1:e===document.scrollingElement}function Fp(e){const t={x:0,y:0},n=kp(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,i=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:a,isRight:i,maxScroll:r,minScroll:t}}const c3={x:.2,y:.2};function l3(e,t,n,r,o){let{top:s,left:a,right:i,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=c3);const{isTop:u,isBottom:f,isLeft:d,isRight:p}=Fp(e),m={x:0,y:0},v={x:0,y:0},g={height:t.height*o.y,width:t.width*o.x};return!u&&s<=t.top+g.height?(m.y=Oe.Backward,v.y=r*Math.abs((t.top+g.height-s)/g.height)):!f&&l>=t.bottom-g.height&&(m.y=Oe.Forward,v.y=r*Math.abs((t.bottom-g.height-l)/g.height)),!p&&i>=t.right-g.width?(m.x=Oe.Forward,v.x=r*Math.abs((t.right-g.width-i)/g.width)):!d&&a<=t.left+g.width&&(m.x=Oe.Backward,v.x=r*Math.abs((t.left+g.width-a)/g.width)),{direction:m,speed:v}}function u3(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function $p(e){return e.reduce((t,n)=>Zn(t,Wa(n)),wt)}function d3(e){return e.reduce((t,n)=>t+Lp(n),0)}function f3(e){return e.reduce((t,n)=>t+jp(n),0)}function h3(e,t){if(t===void 0&&(t=or),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);Dp(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const p3=[["x",["left","right"],d3],["y",["top","bottom"],f3]];class rc{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Rs(n),o=$p(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,a,i]of p3)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=i(r),f=o[s]-u;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class xr{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function m3(e){const{EventTarget:t}=nt(e);return e instanceof t?e:rr(e)}function ca(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var pt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(pt||(pt={}));function Ul(e){e.preventDefault()}function g3(e){e.stopPropagation()}var oe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(oe||(oe={}));const Hp={start:[oe.Space,oe.Enter],cancel:[oe.Esc],end:[oe.Space,oe.Enter,oe.Tab]},v3=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case oe.Right:return{...n,x:n.x+25};case oe.Left:return{...n,x:n.x-25};case oe.Down:return{...n,y:n.y+25};case oe.Up:return{...n,y:n.y-25}}};class oc{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new xr(rr(n)),this.windowListeners=new xr(nt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(pt.Resize,this.handleCancel),this.windowListeners.add(pt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(pt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&h3(r),n(wt)}handleKeyDown(t){if(nc(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=Hp,coordinateGetter:a=v3,scrollBehavior:i="smooth"}=o,{code:l}=t;if(s.end.includes(l)){this.handleEnd(t);return}if(s.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,f=u?{x:u.left,y:u.top}:wt;this.referenceCoordinates||(this.referenceCoordinates=f);const d=a(t,{active:n,context:r.current,currentCoordinates:f});if(d){const p=Or(d,f),m={x:0,y:0},{scrollableAncestors:v}=r.current;for(const g of v){const y=t.code,{isTop:b,isRight:x,isLeft:w,isBottom:E,maxScroll:T,minScroll:O}=Fp(g),C=u3(g),S={x:Math.min(y===oe.Right?C.right-C.width/2:C.right,Math.max(y===oe.Right?C.left:C.left+C.width/2,d.x)),y:Math.min(y===oe.Down?C.bottom-C.height/2:C.bottom,Math.max(y===oe.Down?C.top:C.top+C.height/2,d.y))},N=y===oe.Right&&!x||y===oe.Left&&!w,I=y===oe.Down&&!E||y===oe.Up&&!b;if(N&&S.x!==d.x){const P=g.scrollLeft+p.x,H=y===oe.Right&&P<=T.x||y===oe.Left&&P>=O.x;if(H&&!p.y){g.scrollTo({left:P,behavior:i});return}H?m.x=g.scrollLeft-P:m.x=y===oe.Right?g.scrollLeft-T.x:g.scrollLeft-O.x,m.x&&g.scrollBy({left:-m.x,behavior:i});break}else if(I&&S.y!==d.y){const P=g.scrollTop+p.y,H=y===oe.Down&&P<=T.y||y===oe.Up&&P>=O.y;if(H&&!p.x){g.scrollTo({top:P,behavior:i});return}H?m.y=g.scrollTop-P:m.y=y===oe.Down?g.scrollTop-T.y:g.scrollTop-O.y,m.y&&g.scrollBy({top:-m.y,behavior:i});break}}this.handleMove(t,Zn(Or(d,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}oc.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Hp,onActivation:o}=t,{active:s}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const i=s.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function ql(e){return!!(e&&"distance"in e)}function zl(e){return!!(e&&"delay"in e)}class sc{constructor(t,n,r){var o;r===void 0&&(r=m3(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:a}=s;this.props=t,this.events=n,this.document=rr(a),this.documentListeners=new xr(this.document),this.listeners=new xr(r),this.windowListeners=new xr(nt(a)),this.initialCoordinates=(o=Ka(s))!=null?o:wt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(pt.Resize,this.handleCancel),this.windowListeners.add(pt.DragStart,Ul),this.windowListeners.add(pt.VisibilityChange,this.handleCancel),this.windowListeners.add(pt.ContextMenu,Ul),this.documentListeners.add(pt.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(zl(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(ql(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(pt.Click,g3,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(pt.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:a,options:{activationConstraint:i}}=s;if(!o)return;const l=(n=Ka(t))!=null?n:wt,u=Or(o,l);if(!r&&i){if(ql(i)){if(i.tolerance!=null&&ca(u,i.tolerance))return this.handleCancel();if(ca(u,i.distance))return this.handleStart()}if(zl(i)&&ca(u,i.tolerance))return this.handleCancel();this.handlePending(i,u);return}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===oe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const y3={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ac extends sc{constructor(t){const{event:n}=t,r=rr(n.target);super(t,y3,r)}}ac.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const b3={move:{name:"mousemove"},end:{name:"mouseup"}};var Ga;(function(e){e[e.RightClick=2]="RightClick"})(Ga||(Ga={}));class x3 extends sc{constructor(t){super(t,b3,rr(t.event.target))}}x3.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Ga.RightClick?!1:(r?.({event:n}),!0)}}];const la={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class w3 extends sc{constructor(t){super(t,la)}static setup(){return window.addEventListener(la.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(la.move.name,t)};function t(){}}}w3.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var wr;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(wr||(wr={}));var qo;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(qo||(qo={}));function E3(e){let{acceleration:t,activator:n=wr.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:a=5,order:i=qo.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:p}=e;const m=R3({delta:d,disabled:!s}),[v,g]=DS(),y=c.useRef({x:0,y:0}),b=c.useRef({x:0,y:0}),x=c.useMemo(()=>{switch(n){case wr.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case wr.DraggableRect:return o}},[n,o,l]),w=c.useRef(null),E=c.useCallback(()=>{const O=w.current;if(!O)return;const C=y.current.x*b.current.x,S=y.current.y*b.current.y;O.scrollBy(C,S)},[]),T=c.useMemo(()=>i===qo.TreeOrder?[...u].reverse():u,[i,u]);c.useEffect(()=>{if(!s||!u.length||!x){g();return}for(const O of T){if(r?.(O)===!1)continue;const C=u.indexOf(O),S=f[C];if(!S)continue;const{direction:N,speed:I}=l3(O,S,x,t,p);for(const P of["x","y"])m[P][N[P]]||(I[P]=0,N[P]=0);if(I.x>0||I.y>0){g(),w.current=O,v(E,a),y.current=I,b.current=N;return}}y.current={x:0,y:0},b.current={x:0,y:0},g()},[t,E,r,g,s,a,JSON.stringify(x),JSON.stringify(m),v,u,T,f,JSON.stringify(p)])}const S3={x:{[Oe.Backward]:!1,[Oe.Forward]:!1},y:{[Oe.Backward]:!1,[Oe.Forward]:!1}};function R3(e){let{delta:t,disabled:n}=e;const r=za(t);return Yr(o=>{if(n||!r||!o)return S3;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Oe.Backward]:o.x[Oe.Backward]||s.x===-1,[Oe.Forward]:o.x[Oe.Forward]||s.x===1},y:{[Oe.Backward]:o.y[Oe.Backward]||s.y===-1,[Oe.Forward]:o.y[Oe.Forward]||s.y===1}}},[n,t,r])}function C3(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Yr(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function A3(e,t){return c.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...s]},[]),[e,t])}var Dr;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Dr||(Dr={}));var Ya;(function(e){e.Optimized="optimized"})(Ya||(Ya={}));const Kl=new Map;function T3(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,a]=c.useState(null),{frequency:i,measure:l,strategy:u}=o,f=c.useRef(e),d=y(),p=Nr(d),m=c.useCallback(function(b){b===void 0&&(b=[]),!p.current&&a(x=>x===null?b:x.concat(b.filter(w=>!x.includes(w))))},[p]),v=c.useRef(null),g=Yr(b=>{if(d&&!n)return Kl;if(!b||b===Kl||f.current!==e||s!=null){const x=new Map;for(let w of e){if(!w)continue;if(s&&s.length>0&&!s.includes(w.id)&&w.rect.current){x.set(w.id,w.rect.current);continue}const E=w.node.current,T=E?new rc(l(E),E):null;w.rect.current=T,T&&x.set(w.id,T)}return x}return b},[e,s,n,d,l]);return c.useEffect(()=>{f.current=e},[e]),c.useEffect(()=>{d||m()},[n,d]),c.useEffect(()=>{s&&s.length>0&&a(null)},[JSON.stringify(s)]),c.useEffect(()=>{d||typeof i!="number"||v.current!==null||(v.current=setTimeout(()=>{m(),v.current=null},i))},[i,d,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:s!=null};function y(){switch(u){case Dr.Always:return!1;case Dr.BeforeDragging:return n;default:return!n}}}function Bp(e,t){return Yr(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function P3(e,t){return Bp(e,t)}function M3(e){let{callback:t,disabled:n}=e;const r=tc(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function Cs(e){let{callback:t,disabled:n}=e;const r=tc(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function _3(e){return new rc(or(e),e)}function Wl(e,t,n){t===void 0&&(t=_3);const[r,o]=c.useState(null);function s(){o(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const a=M3({callback(l){if(e)for(const u of l){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){s();break}}}}),i=Cs({callback:s});return _t(()=>{s(),e?(i?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(i?.disconnect(),a?.disconnect())},[e]),r}function N3(e){const t=Bp(e);return Ip(e,t)}const Gl=[];function O3(e){const t=c.useRef(e),n=Yr(r=>e?r&&r!==Gl&&e&&t.current&&e.parentNode===t.current.parentNode?r:Rs(e):Gl,[e]);return c.useEffect(()=>{t.current=e},[e]),n}function I3(e){const[t,n]=c.useState(null),r=c.useRef(e),o=c.useCallback(s=>{const a=ia(s.target);a&&n(i=>i?(i.set(a,Wa(a)),new Map(i)):null)},[]);return c.useEffect(()=>{const s=r.current;if(e!==s){a(s);const i=e.map(l=>{const u=ia(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,Wa(u)]):null}).filter(l=>l!=null);n(i.length?new Map(i):null),r.current=e}return()=>{a(e),a(s)};function a(i){i.forEach(l=>{const u=ia(l);u?.removeEventListener("scroll",o)})}},[o,e]),c.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>Zn(s,a),wt):$p(e):wt,[e,t])}function Yl(e,t){t===void 0&&(t=[]);const n=c.useRef(null);return c.useEffect(()=>{n.current=null},t),c.useEffect(()=>{const r=e!==wt;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Or(e,n.current):wt}function D3(e){c.useEffect(()=>{if(!Ss)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function L3(e,t){return c.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=a=>{s(a,t)},n},{}),[e,t])}function Vp(e){return c.useMemo(()=>e?s3(e):null,[e])}const Ql=[];function j3(e,t){t===void 0&&(t=or);const[n]=e,r=Vp(n?nt(n):null),[o,s]=c.useState(Ql);function a(){s(()=>e.length?e.map(l=>kp(l)?r:new rc(t(l),l)):Ql)}const i=Cs({callback:a});return _t(()=>{i?.disconnect(),a(),e.forEach(l=>i?.observe(l))},[e]),o}function k3(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Gr(t)?t:e}function F3(e){let{measure:t}=e;const[n,r]=c.useState(null),o=c.useCallback(u=>{for(const{target:f}of u)if(Gr(f)){r(d=>{const p=t(f);return d?{...d,width:p.width,height:p.height}:p});break}},[t]),s=Cs({callback:o}),a=c.useCallback(u=>{const f=k3(u);s?.disconnect(),f&&s?.observe(f),r(f?t(f):null)},[t,s]),[i,l]=Zo(a);return c.useMemo(()=>({nodeRef:i,rect:n,setRef:l}),[n,i,l])}const $3=[{sensor:ac,options:{}},{sensor:oc,options:{}}],H3={current:{}},wo={draggable:{measure:Zl},droppable:{measure:Zl,strategy:Dr.WhileDragging,frequency:Ya.Optimized},dragOverlay:{measure:or}};class Er extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const B3={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Er,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Uo},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:wo,measureDroppableContainers:Uo,windowRect:null,measuringScheduled:!1},V3={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Uo,draggableNodes:new Map,over:null,measureDroppableContainers:Uo},As=c.createContext(V3),Zp=c.createContext(B3);function Z3(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Er}}}function U3(e,t){switch(t.type){case Me.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Me.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Me.DragEnd:case Me.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Me.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Er(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Me.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new Er(e.droppable.containers);return a.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case Me.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Er(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function q3(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=c.useContext(As),s=za(r),a=za(n?.id);return c.useEffect(()=>{if(!t&&!r&&s&&a!=null){if(!nc(s)||document.activeElement===s.target)return;const i=o.get(a);if(!i)return;const{activatorNode:l,node:u}=i;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[l.current,u.current]){if(!f)continue;const d=kS(f);if(d){d.focus();break}}})}},[r,t,o,a,s]),null}function z3(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function K3(e){return c.useMemo(()=>({draggable:{...wo.draggable,...e?.draggable},droppable:{...wo.droppable,...e?.droppable},dragOverlay:{...wo.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function W3(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=c.useRef(!1),{x:a,y:i}=typeof o=="boolean"?{x:o,y:o}:o;_t(()=>{if(!a&&!i||!t){s.current=!1;return}if(s.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),d=Ip(f,r);if(a||(d.x=0),i||(d.y=0),s.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const p=Dp(u);p&&p.scrollBy({top:d.y,left:d.x})}},[t,a,i,r,n])}const Up=c.createContext({...wt,scaleX:1,scaleY:1});var Kt;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Kt||(Kt={}));const G3=c.memo(function(t){var n,r,o,s;let{id:a,accessibility:i,autoScroll:l=!0,children:u,sensors:f=$3,collisionDetection:d=XS,measuring:p,modifiers:m,...v}=t;const g=c.useReducer(U3,void 0,Z3),[y,b]=g,[x,w]=ZS(),[E,T]=c.useState(Kt.Uninitialized),O=E===Kt.Initialized,{draggable:{active:C,nodes:S,translate:N},droppable:{containers:I}}=y,P=C!=null?S.get(C):null,H=c.useRef({initial:null,translated:null}),z=c.useMemo(()=>{var Pe;return C!=null?{id:C,data:(Pe=P?.data)!=null?Pe:H3,rect:H}:null},[C,P]),L=c.useRef(null),[k,A]=c.useState(null),[D,j]=c.useState(null),_=Nr(v,Object.values(v)),V=Qr("DndDescribedBy",a),K=c.useMemo(()=>I.getEnabled(),[I]),Y=K3(p),{droppableRects:B,measureDroppableContainers:q,measuringScheduled:U}=T3(K,{dragging:O,dependencies:[N.x,N.y],config:Y.droppable}),J=C3(S,C),$=c.useMemo(()=>D?Ka(D):null,[D]),F=Os(),ee=P3(J,Y.draggable.measure);W3({activeNode:C!=null?S.get(C):null,config:F.layoutShiftCompensation,initialRect:ee,measure:Y.draggable.measure});const Z=Wl(J,Y.draggable.measure,ee),X=Wl(J?J.parentElement:null),te=c.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ae=I.getNodeFor((n=te.current.over)==null?void 0:n.id),le=F3({measure:Y.dragOverlay.measure}),Qe=(r=le.nodeRef.current)!=null?r:J,Fe=O?(o=le.rect)!=null?o:Z:null,qe=!!(le.nodeRef.current&&le.rect),ct=N3(qe?null:Z),Le=Vp(Qe?nt(Qe):null),Ne=O3(O?ae??J:null),Zt=j3(Ne),Te=z3(m,{transform:{x:N.x-ct.x,y:N.y-ct.y,scaleX:1,scaleY:1},activatorEvent:D,active:z,activeNodeRect:Z,containerNodeRect:X,draggingNodeRect:Fe,over:te.current.over,overlayNodeRect:le.rect,scrollableAncestors:Ne,scrollableAncestorRects:Zt,windowRect:Le}),lt=$?Zn($,N):null,Tn=I3(Ne),Pn=Yl(Tn),ie=Yl(Tn,[Z]),ge=Zn(Te,Pn),Re=Fe?t3(Fe,Te):null,ut=z&&Re?d({active:z,collisionRect:Re,droppableRects:B,droppableContainers:K,pointerCoordinates:lt}):null,It=Op(ut,"id"),[vt,Dt]=c.useState(null),Ps=qe?Te:Zn(Te,ie),Ms=JS(Ps,(s=vt?.rect)!=null?s:null,Z),Mn=c.useRef(null),sr=c.useCallback((Pe,$e)=>{let{sensor:Q,options:he}=$e;if(L.current==null)return;const de=S.get(L.current);if(!de)return;const pe=Pe.nativeEvent,ze=new Q({active:L.current,activeNode:de,event:pe,options:he,context:te,onAbort(ue){if(!S.get(ue))return;const{onDragAbort:Se}=_.current,Ce={id:ue};Se?.(Ce),x({type:"onDragAbort",event:Ce})},onPending(ue,rt,Se,Ce){if(!S.get(ue))return;const{onDragPending:ot}=_.current,Lt={id:ue,constraint:rt,initialCoordinates:Se,offset:Ce};ot?.(Lt),x({type:"onDragPending",event:Lt})},onStart(ue){const rt=L.current;if(rt==null)return;const Se=S.get(rt);if(!Se)return;const{onDragStart:Ce}=_.current,Ut={activatorEvent:pe,active:{id:rt,data:Se.data,rect:H}};$t.unstable_batchedUpdates(()=>{Ce?.(Ut),T(Kt.Initializing),b({type:Me.DragStart,initialCoordinates:ue,active:rt}),x({type:"onDragStart",event:Ut}),A(Mn.current),j(pe)})},onMove(ue){b({type:Me.DragMove,coordinates:ue})},onEnd:be(Me.DragEnd),onCancel:be(Me.DragCancel)});Mn.current=ze;function be(ue){return async function(){const{active:Se,collisions:Ce,over:Ut,scrollAdjustedTranslate:ot}=te.current;let Lt=null;if(Se&&ot){const{cancelDrop:ar}=_.current;Lt={activatorEvent:pe,active:Se,collisions:Ce,delta:ot,over:Ut},ue===Me.DragEnd&&typeof ar=="function"&&await Promise.resolve(ar(Lt))&&(ue=Me.DragCancel)}L.current=null,$t.unstable_batchedUpdates(()=>{b({type:ue}),T(Kt.Uninitialized),Dt(null),A(null),j(null),Mn.current=null;const ar=ue===Me.DragEnd?"onDragEnd":"onDragCancel";if(Lt){const Is=_.current[ar];Is?.(Lt),x({type:ar,event:Lt})}})}}},[S]),_s=c.useCallback((Pe,$e)=>(Q,he)=>{const de=Q.nativeEvent,pe=S.get(he);if(L.current!==null||!pe||de.dndKit||de.defaultPrevented)return;const ze={active:pe};Pe(Q,$e.options,ze)===!0&&(de.dndKit={capturedBy:$e.sensor},L.current=he,sr(Q,$e))},[S,sr]),_n=A3(f,_s);D3(f),_t(()=>{Z&&E===Kt.Initializing&&T(Kt.Initialized)},[Z,E]),c.useEffect(()=>{const{onDragMove:Pe}=_.current,{active:$e,activatorEvent:Q,collisions:he,over:de}=te.current;if(!$e||!Q)return;const pe={active:$e,activatorEvent:Q,collisions:he,delta:{x:ge.x,y:ge.y},over:de};$t.unstable_batchedUpdates(()=>{Pe?.(pe),x({type:"onDragMove",event:pe})})},[ge.x,ge.y]),c.useEffect(()=>{const{active:Pe,activatorEvent:$e,collisions:Q,droppableContainers:he,scrollAdjustedTranslate:de}=te.current;if(!Pe||L.current==null||!$e||!de)return;const{onDragOver:pe}=_.current,ze=he.get(It),be=ze&&ze.rect.current?{id:ze.id,rect:ze.rect.current,data:ze.data,disabled:ze.disabled}:null,ue={active:Pe,activatorEvent:$e,collisions:Q,delta:{x:de.x,y:de.y},over:be};$t.unstable_batchedUpdates(()=>{Dt(be),pe?.(ue),x({type:"onDragOver",event:ue})})},[It]),_t(()=>{te.current={activatorEvent:D,active:z,activeNode:J,collisionRect:Re,collisions:ut,droppableRects:B,draggableNodes:S,draggingNode:Qe,draggingNodeRect:Fe,droppableContainers:I,over:vt,scrollableAncestors:Ne,scrollAdjustedTranslate:ge},H.current={initial:Fe,translated:Re}},[z,J,ut,Re,S,Qe,Fe,B,I,vt,Ne,ge]),E3({...F,delta:N,draggingRect:Re,pointerCoordinates:lt,scrollableAncestors:Ne,scrollableAncestorRects:Zt});const Rt=c.useMemo(()=>({active:z,activeNode:J,activeNodeRect:Z,activatorEvent:D,collisions:ut,containerNodeRect:X,dragOverlay:le,draggableNodes:S,droppableContainers:I,droppableRects:B,over:vt,measureDroppableContainers:q,scrollableAncestors:Ne,scrollableAncestorRects:Zt,measuringConfiguration:Y,measuringScheduled:U,windowRect:Le}),[z,J,Z,D,ut,X,le,S,I,B,vt,q,Ne,Zt,Y,U,Le]),Ns=c.useMemo(()=>({activatorEvent:D,activators:_n,active:z,activeNodeRect:Z,ariaDescribedById:{draggable:V},dispatch:b,draggableNodes:S,over:vt,measureDroppableContainers:q}),[D,_n,z,Z,b,V,S,vt,q]);return M.createElement(Mp.Provider,{value:w},M.createElement(As.Provider,{value:Ns},M.createElement(Zp.Provider,{value:Rt},M.createElement(Up.Provider,{value:Ms},u)),M.createElement(q3,{disabled:i?.restoreFocus===!1})),M.createElement(zS,{...i,hiddenTextDescribedById:V}));function Os(){const Pe=k?.autoScrollEnabled===!1,$e=typeof l=="object"?l.enabled===!1:l===!1,Q=O&&!Pe&&!$e;return typeof l=="object"?{...l,enabled:Q}:{enabled:Q}}}),Y3=c.createContext(null),Xl="button",Q3="Draggable";function X3(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=Qr(Q3),{activators:a,activatorEvent:i,active:l,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:p}=c.useContext(As),{role:m=Xl,roleDescription:v="draggable",tabIndex:g=0}=o??{},y=l?.id===t,b=c.useContext(y?Up:Y3),[x,w]=Zo(),[E,T]=Zo(),O=L3(a,t),C=Nr(n);_t(()=>(d.set(t,{id:t,key:s,node:x,activatorNode:E,data:C}),()=>{const N=d.get(t);N&&N.key===s&&d.delete(t)}),[d,t]);const S=c.useMemo(()=>({role:m,tabIndex:g,"aria-disabled":r,"aria-pressed":y&&m===Xl?!0:void 0,"aria-roledescription":v,"aria-describedby":f.draggable}),[r,m,g,y,v,f.draggable]);return{active:l,activatorEvent:i,activeNodeRect:u,attributes:S,isDragging:y,listeners:r?void 0:O,node:x,over:p,setNodeRef:w,setActivatorNodeRef:T,transform:b}}function J3(){return c.useContext(Zp)}const eR="Droppable",tR={timeout:25};function nR(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=Qr(eR),{active:a,dispatch:i,over:l,measureDroppableContainers:u}=c.useContext(As),f=c.useRef({disabled:n}),d=c.useRef(!1),p=c.useRef(null),m=c.useRef(null),{disabled:v,updateMeasurementsFor:g,timeout:y}={...tR,...o},b=Nr(g??r),x=c.useCallback(()=>{if(!d.current){d.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),m.current=null},y)},[y]),w=Cs({callback:x,disabled:v||!a}),E=c.useCallback((S,N)=>{w&&(N&&(w.unobserve(N),d.current=!1),S&&w.observe(S))},[w]),[T,O]=Zo(E),C=Nr(t);return c.useEffect(()=>{!w||!T.current||(w.disconnect(),d.current=!1,w.observe(T.current))},[T,w]),c.useEffect(()=>(i({type:Me.RegisterDroppable,element:{id:r,key:s,disabled:n,node:T,rect:p,data:C}}),()=>i({type:Me.UnregisterDroppable,key:s,id:r})),[r]),c.useEffect(()=>{n!==f.current.disabled&&(i({type:Me.SetDroppableDisabled,id:r,key:s,disabled:n}),f.current.disabled=n)},[r,s,n,i]),{active:a,rect:p,isOver:l?.id===r,node:T,over:l,setNodeRef:O}}const D5=e=>{let{transform:t}=e;return{...t,y:0}},rR=e=>{let{transform:t}=e;return{...t,x:0}};function ic(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function oR(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function lo(e){return e!==null&&e>=0}function sR(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function aR(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const uo={scaleX:1,scaleY:1},L5=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:a}=e;const i=(t=n[o])!=null?t:r;if(!i)return null;const l=iR(n,a,o);if(a===o){const u=n[s];return u?{x:o<s?u.left+u.width-(i.left+i.width):u.left-i.left,y:0,...uo}:null}return a>o&&a<=s?{x:-i.width-l,y:0,...uo}:a<o&&a>=s?{x:i.width+l,y:0,...uo}:{x:0,y:0,...uo}};function iR(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return!r||!o&&!s?0:n<t?o?r.left-(o.left+o.width):s.left-(r.left+r.width):s?s.left-(r.left+r.width):r.left-(o.left+o.width)}const qp=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=ic(t,r,n),a=t[o],i=s[o];return!i||!a?null:{x:i.left-a.left,y:i.top-a.top,scaleX:i.width/a.width,scaleY:i.height/a.height}},fo={scaleX:1,scaleY:1},cR=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:a}=e;const i=(t=s[n])!=null?t:r;if(!i)return null;if(o===n){const u=s[a];return u?{x:0,y:n<a?u.top+u.height-(i.top+i.height):u.top-i.top,...fo}:null}const l=lR(s,o,n);return o>n&&o<=a?{x:0,y:-i.height-l,...fo}:o<n&&o>=a?{x:0,y:i.height+l,...fo}:{x:0,y:0,...fo}};function lR(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const zp="Sortable",Kp=M.createContext({activeIndex:-1,containerId:zp,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:qp,disabled:{draggable:!1,droppable:!1}});function uR(e){let{children:t,id:n,items:r,strategy:o=qp,disabled:s=!1}=e;const{active:a,dragOverlay:i,droppableRects:l,over:u,measureDroppableContainers:f}=J3(),d=Qr(zp,n),p=i.rect!==null,m=c.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),v=a!=null,g=a?m.indexOf(a.id):-1,y=u?m.indexOf(u.id):-1,b=c.useRef(m),x=!sR(m,b.current),w=y!==-1&&g===-1||x,E=aR(s);_t(()=>{x&&v&&f(m)},[x,m,v,f]),c.useEffect(()=>{b.current=m},[m]);const T=c.useMemo(()=>({activeIndex:g,containerId:d,disabled:E,disableTransforms:w,items:m,overIndex:y,useDragOverlay:p,sortedRects:oR(m,l),strategy:o}),[g,d,E.draggable,E.droppable,w,m,y,l,p,o]);return M.createElement(Kp.Provider,{value:T},t)}const dR=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return ic(n,r,o).indexOf(t)},fR=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:a,previousItems:i,previousContainerId:l,transition:u}=e;return!u||!r||i!==s&&o===a?!1:n?!0:a!==o&&t===l},hR={duration:200,easing:"ease"},Wp="transform",pR=Ir.Transition.toString({property:Wp,duration:0,easing:"linear"}),mR={roleDescription:"sortable"};function gR(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,a]=c.useState(null),i=c.useRef(n);return _t(()=>{if(!t&&n!==i.current&&r.current){const l=o.current;if(l){const u=or(r.current,{ignoreTransform:!0}),f={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(f.x||f.y)&&a(f)}}n!==i.current&&(i.current=n)},[t,n,r,o]),c.useEffect(()=>{s&&a(null)},[s]),s}function vR(e){let{animateLayoutChanges:t=fR,attributes:n,disabled:r,data:o,getNewIndex:s=dR,id:a,strategy:i,resizeObserverConfig:l,transition:u=hR}=e;const{items:f,containerId:d,activeIndex:p,disabled:m,disableTransforms:v,sortedRects:g,overIndex:y,useDragOverlay:b,strategy:x}=c.useContext(Kp),w=yR(r,m),E=f.indexOf(a),T=c.useMemo(()=>({sortable:{containerId:d,index:E,items:f},...o}),[d,o,E,f]),O=c.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:C,node:S,isOver:N,setNodeRef:I}=nR({id:a,data:T,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...l}}),{active:P,activatorEvent:H,activeNodeRect:z,attributes:L,setNodeRef:k,listeners:A,isDragging:D,over:j,setActivatorNodeRef:_,transform:V}=X3({id:a,data:T,attributes:{...mR,...n},disabled:w.draggable}),K=IS(I,k),Y=!!P,B=Y&&!v&&lo(p)&&lo(y),q=!b&&D,U=q&&B?V:null,$=B?U??(i??x)({rects:g,activeNodeRect:z,activeIndex:p,overIndex:y,index:E}):null,F=lo(p)&&lo(y)?s({id:a,items:f,activeIndex:p,overIndex:y}):E,ee=P?.id,Z=c.useRef({activeId:ee,items:f,newIndex:F,containerId:d}),X=f!==Z.current.items,te=t({active:P,containerId:d,isDragging:D,isSorting:Y,id:a,index:E,items:f,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:u,wasDragging:Z.current.activeId!=null}),ae=gR({disabled:!te,index:E,node:S,rect:C});return c.useEffect(()=>{Y&&Z.current.newIndex!==F&&(Z.current.newIndex=F),d!==Z.current.containerId&&(Z.current.containerId=d),f!==Z.current.items&&(Z.current.items=f)},[Y,F,d,f]),c.useEffect(()=>{if(ee===Z.current.activeId)return;if(ee!=null&&Z.current.activeId==null){Z.current.activeId=ee;return}const Qe=setTimeout(()=>{Z.current.activeId=ee},50);return()=>clearTimeout(Qe)},[ee]),{active:P,activeIndex:p,attributes:L,data:T,rect:C,index:E,newIndex:F,items:f,isOver:N,isSorting:Y,isDragging:D,listeners:A,node:S,overIndex:y,over:j,setNodeRef:K,setActivatorNodeRef:_,setDroppableNodeRef:I,setDraggableNodeRef:k,transform:ae??$,transition:le()};function le(){if(ae||X&&Z.current.newIndex===E)return pR;if(!(q&&!nc(H)||!u)&&(Y||te))return Ir.Transition.toString({...u,property:Wp})}}function yR(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function zo(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const bR=[oe.Down,oe.Right,oe.Up,oe.Left],xR=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:s,over:a,scrollableAncestors:i}}=t;if(bR.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];s.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const p=o.get(d.id);if(p)switch(e.code){case oe.Down:r.top<p.top&&l.push(d);break;case oe.Up:r.top>p.top&&l.push(d);break;case oe.Left:r.left>p.left&&l.push(d);break;case oe.Right:r.left<p.left&&l.push(d);break}});const u=YS({collisionRect:r,droppableRects:o,droppableContainers:l});let f=Op(u,"id");if(f===a?.id&&u.length>1&&(f=u[1].id),f!=null){const d=s.get(n.id),p=s.get(f),m=p?o.get(p.id):null,v=p?.node.current;if(v&&m&&d&&p){const y=Rs(v).some((O,C)=>i[C]!==O),b=Gp(d,p),x=wR(d,p),w=y||!b?{x:0,y:0}:{x:x?r.width-m.width:0,y:x?r.height-m.height:0},E={x:m.left,y:m.top};return w.x&&w.y?E:Or(E,w)}}}};function Gp(e,t){return!zo(e)||!zo(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function wR(e,t){return!zo(e)||!zo(t)||!Gp(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const ER=e=>{const{data:t}=Hu({queryKey:ve.notes.list(e.searchParams),async queryFn(){const n=await Rp(e.searchParams);if(n.type==="error")throw n;return n.allNotes}});return e.render(t)},SR=e=>{const{data:t}=Hu({queryKey:ve.notes.pinned(),async queryFn(){const n=await fe(`
300
334
  query {
301
335
  pinnedNotes {
302
336
  id
@@ -319,9 +353,9 @@ __NOTE_ADDITIONAL_FIELDS__ id
319
353
  referenceCount
320
354
  }
321
355
  }
322
- }`,{searchFilter:{query:e},pagination:{limit:t,offset:n}})}function L5({name:e=""}){return fe(`mutation CreateTag($name: String!) {
356
+ }`,{searchFilter:{query:e},pagination:{limit:t,offset:n}})}function j5({name:e=""}){return fe(`mutation CreateTag($name: String!) {
323
357
  createTag(name: $name) {
324
358
  id
325
359
  name
326
360
  }
327
- }`,{name:e})}const CR="focus-ring-soft flex h-8 w-8 items-center justify-center rounded-[10px] text-fg-default/70 outline-none transition-colors hover:text-fg-default active:cursor-grabbing touch-none",AR="focus-ring-soft block truncate rounded-[10px] px-1.5 py-1 outline-none transition-colors";function TR({id:e,title:t,isActive:n=!1,children:r}){const{attributes:o,listeners:s,setNodeRef:a,setActivatorNodeRef:i,transform:l,transition:u,isDragging:f}=vR({id:e}),d={transform:Ir.Transform.toString(l),transition:u,opacity:f?.5:1};return h.jsxs("div",{ref:a,style:d,className:me("group flex min-h-[40px] items-center gap-1.5 rounded-[12px] px-1.5 py-1 transition-colors",n&&"bg-hover-subtle"),children:[h.jsx("button",{type:"button",ref:i,"aria-label":`Reorder note ${t??"Untitled"}`,...o,...s,className:me(CR,f?"cursor-grabbing":"cursor-grab"),children:h.jsx(qv,{className:"size-4"})}),h.jsx(se,{as:"div",truncate:!0,variant:"body",weight:"medium",className:"min-w-0 flex-1",children:r})]})}function PR({notes:e,pathname:t,pinnedItems:n,setPinnedItems:r,handleDragEnd:o,sensors:s}){c.useEffect(()=>{r(e)},[e,r]);const a=n.length>0?n:e;return a.length===0?null:h.jsx(G3,{sensors:s,collisionDetection:GS,onDragEnd:o,modifiers:[rR],children:h.jsx(uR,{items:a.map(i=>i.id),strategy:cR,children:a.map(i=>h.jsx(TR,{id:i.id,title:i.title||"Untitled",isActive:t===`/${i.id}`,children:h.jsx(Pt,{"aria-current":t===`/${i.id}`?"page":void 0,className:me(AR,t===`/${i.id}`?"text-fg-default":"text-fg-secondary hover:bg-hover-subtle hover:text-fg-default"),to:tr,params:{id:i.id},children:i.title||"Untitled"})},i.id))})})}const MR=()=>{const e=ns({select:i=>i.pathname}),t=Qn(),[n,r]=c.useState([]),o=zg({mutationFn:SS,onSuccess:()=>{t.invalidateQueries({queryKey:ve.notes.pinned(),exact:!0})}}),s=KS(Hl(ac,{activationConstraint:{distance:8}}),Hl(oc,{coordinateGetter:xR})),a=i=>{const{active:l,over:u}=i;u&&l.id!==u.id&&r(f=>{const d=f.findIndex(v=>v.id===l.id),p=f.findIndex(v=>v.id===u.id),m=ic(f,d,p);return o.mutate(m.map((v,g)=>({id:v.id,order:g}))),m})};return h.jsx("div",{className:"flex flex-col gap-1",children:h.jsx(yp,{fallback:h.jsxs("div",{className:"space-y-1",children:[h.jsx(Ht,{height:"40px",opacity:.4}),h.jsx(Ht,{height:"40px",opacity:.4})]}),errorTitle:"Failed to load pinned notes",errorDescription:"Retry loading the pinned note list.",renderError:({error:i,retry:l})=>h.jsx(Xi,{title:"Failed to load pinned notes",description:"Retry loading the pinned note list.",error:i,onRetry:l,showBackAction:!1,showHomeAction:!1}),children:h.jsx(SR,{render:i=>i.length>0?h.jsx(PR,{notes:i,pathname:e,pinnedItems:n,setPinnedItems:r,handleDragEnd:a,sensors:s}):h.jsx(se,{as:"div",variant:"meta",tone:"secondary",className:"px-2 py-2.5 leading-6",children:"Pin a note to keep it in view while the rest of the workspace changes."})})})})},_R="mb-2.5 flex items-center justify-between gap-3 px-1",NR="flex min-w-0 items-center gap-2",OR="inline-flex h-4 w-4 shrink-0 items-center justify-center text-fg-tertiary",IR=({title:e,icon:t,detail:n})=>h.jsxs("div",{className:_R,children:[h.jsxs("div",{className:NR,children:[t?h.jsx("span",{className:OR,children:t}):null,h.jsx(se,{variant:"label",weight:"medium",tone:"tertiary",children:e})]}),n?h.jsx(se,{as:"div",variant:"meta",weight:"medium",tone:"tertiary",children:n}):null]}),DR="flex flex-col gap-3.5 p-3 pt-2",LR="focus-ring-soft surface-base group flex w-full items-center justify-between gap-2.5 px-3 py-2.5 text-left text-fg-default outline-none transition-colors hover:bg-hover-subtle",jR="flex items-center gap-2.5",kR="inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-[13px] bg-cta text-fg-on-filled",FR="flex flex-col",$R="h-4 w-4 text-fg-tertiary transition-colors group-hover:text-fg-default",HR=()=>{const{onCreate:e}=Ap();return h.jsxs("div",{className:DR,children:[h.jsxs("button",{type:"button",className:LR,onClick:()=>e(),children:[h.jsxs("span",{className:jR,children:[h.jsx("span",{className:kR,children:h.jsx(Xv,{className:"h-4.5 w-4.5",weight:"bold"})}),h.jsxs("span",{className:FR,children:[h.jsx(se,{variant:"meta",weight:"semibold",tracking:"tight",children:"Capture"}),h.jsx(se,{variant:"label",tone:"secondary",children:"Open a new note"})]})]}),h.jsx(br,{className:$R,weight:"bold"})]}),h.jsxs("section",{className:"pt-1",children:[h.jsx(IR,{title:"Pinned",icon:h.jsx(tf,{className:"h-4 w-4",weight:"fill"})}),h.jsx(MR,{})]})]})},BR=e=>{const[t,n]=c.useState(!1),r=c.useRef(null),o=c.useRef(!0),s=c.useRef(0),a=c.useCallback(()=>{r.current!==null&&(clearTimeout(r.current),r.current=null)},[]);c.useEffect(()=>(o.current=!0,()=>{o.current=!1,a()}),[a]);const i=c.useCallback(l=>{s.current+=1;const u=s.current;a(),o.current&&n(!0),r.current=setTimeout(()=>{r.current=null,Promise.resolve().then(l).catch(()=>{}).finally(()=>{o.current&&s.current===u&&n(!1)})},e)},[a,e]);return[t,i]},VR="flex flex-col gap-2.5",ZR="surface-base overflow-hidden",UR="grid-search-bar grid items-center border-b border-transparent px-2.5 py-1.5 transition-colors",qR="border-border-subtle/70 bg-muted/25",zR="hover:bg-hover-subtle/60",Jl="flex h-10 items-center justify-center text-fg-tertiary transition-colors hover:text-fg-default sm:h-8",KR="h-10 w-full bg-transparent py-2 text-meta text-fg-default outline-none placeholder:text-fg-placeholder sm:h-8 sm:py-1.5",WR="px-1 py-1.5",GR="px-2 pb-0.5 pt-1",YR="px-2 pb-0.5 pt-1.5",QR="flex min-h-10 items-center gap-2 rounded-[10px] px-2.5 py-2 transition-colors hover:bg-hover-subtle sm:min-h-0 sm:px-2 sm:py-1.5",XR="min-w-0 flex-1",JR="flex flex-wrap gap-1.5 px-1.5 py-1",eC="inline-flex items-center rounded-full border border-border-subtle bg-hover-subtle px-2 py-0.75 sm:py-0.5",tC="mt-1 border-t border-border-subtle/50 px-2 pb-0.5 pt-1.5",nC="flex min-h-9 items-center gap-1.5 text-fg-secondary transition-colors hover:text-fg-default",rC=()=>{const e=Sn(),[t,n]=c.useState(""),[r,o]=c.useState([]),[s,a]=c.useState([]),[,i]=BR(500);c.useEffect(()=>{if(t.length<=0){i(()=>{}),o([]),a([]);return}i(()=>{Rp({query:t,limit:5}).then(d=>{d.type==="success"&&o(d.allNotes.notes)}),RR({query:t,limit:5}).then(d=>{d.type==="success"&&a(d.allTags.tags)})})},[t,i]);const l=d=>{d?.preventDefault(),e({to:pp,search:{query:t,page:1}})},u=()=>{n("")},f=r.length>0||s.length>0;return h.jsx("div",{className:"p-3",children:h.jsx("form",{className:VR,onSubmit:l,children:h.jsxs("div",{className:ZR,children:[h.jsxs("div",{className:`${UR} ${f?qR:zR}`,children:[h.jsx("button",{type:"submit",className:Jl,children:h.jsx(Qv,{className:"h-4.5 w-4.5",weight:"bold"})}),h.jsx("input",{type:"text",placeholder:"Search notes or tags",value:t,onChange:d=>n(d.target.value),className:KR}),t&&h.jsx("button",{type:"button",className:Jl,onClick:u,children:h.jsx(af,{className:"h-4 w-4",weight:"bold"})})]}),f&&h.jsxs("div",{className:WR,children:[r.length>0&&h.jsxs("div",{children:[s.length>0&&h.jsx(se,{as:"div",variant:"label",weight:"medium",tone:"tertiary",className:GR,children:"Notes"}),r.map(({id:d,title:p})=>h.jsxs(Pt,{to:tr,params:{id:d},className:QR,children:[h.jsx(Wv,{className:"h-3.5 w-3.5 shrink-0 text-fg-tertiary"}),h.jsx(se,{as:"span",truncate:!0,variant:"meta",weight:"medium",className:XR,children:p||"Untitled"})]},d))]}),s.length>0&&h.jsxs("div",{children:[r.length>0&&h.jsx(se,{as:"div",variant:"label",weight:"medium",tone:"tertiary",className:YR,children:"Tags"}),h.jsx("div",{className:JR,children:s.map(({id:d,name:p})=>h.jsx(Pt,{to:Qi,params:{id:d},search:{page:1},children:h.jsx(se,{as:"span",variant:"label",weight:"medium",tone:"secondary",className:eC,children:p})},d))})]}),h.jsx("div",{className:tC,children:h.jsxs("button",{type:"submit",className:nC,children:[h.jsx(se,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:"View all results"}),h.jsx(br,{className:"h-3.5 w-3.5",weight:"bold"})]})})]})]})})})},oC=[{name:"Notes",path:Wr,icon:Yd},{name:"Views",path:up,icon:Kv},{name:"Graph",path:hp,icon:ny},{name:"Calendar",path:dp,icon:Vv},{name:"Reminders",path:fp,icon:Bv},{name:"Tags",path:mp,icon:ty},{name:"Setting",path:gp,icon:Gv}],sC=()=>{const e=ns({select:t=>t.pathname});return h.jsx("nav",{"aria-label":"Primary navigation",className:"flex items-center gap-1 px-4 py-2.5",children:oC.map((t,n)=>{const r=e===t.path||t.path!==Wr&&e.startsWith(`${t.path}/`);return h.jsxs(c.Fragment,{children:[n>0&&h.jsx("span",{className:"h-3.5 w-px shrink-0 bg-border-subtle"}),h.jsx(Pt,{to:t.path,children:h.jsxs("div",{className:`flex min-w-26 items-center justify-center gap-2 border-b px-2 py-2 transition-colors ${r?"border-fg-muted text-fg-default":"border-transparent text-fg-secondary hover:border-border-subtle hover:text-fg-default"}`,children:[h.jsx(t.icon,{className:"size-5",weight:r?"fill":"regular"}),h.jsx(se,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:t.name})]})})]},t.path)})})},aC=({children:e})=>h.jsx(uS,{sidebar:h.jsxs(h.Fragment,{children:[h.jsx(mS,{}),h.jsx(rC,{}),h.jsx(HR,{})]}),topNavigation:h.jsx(sC,{}),children:e}),iC=["updatedAt","createdAt"],cC=["asc","desc"],lC=["create","update"],Ts=e=>Array.isArray(e)?e[0]:e,En=(e,t,{min:n=1,max:r=Number.MAX_SAFE_INTEGER}={})=>{const o=Ts(e),s=typeof o=="number"?o:typeof o=="string"?Number(o):Number.NaN;return!Number.isInteger(s)||s<n||s>r?t:s},uC=(e,t,n)=>{const r=En(e,Number.NaN);return t.includes(r)?r:n},dC=(e,t=!1)=>{const n=Ts(e);return n===!0||n==="true"?!0:n===!1||n==="false"?!1:t},Yp=(e,t="")=>{const n=Ts(e);return typeof n=="string"?n:t},Qa=(e,t,n)=>{const r=Ts(e);return typeof r!="string"?n:t.includes(r)?r:n},fC=e=>({page:En(e.page,1),limit:uC(e.limit,Yi,ws),sortBy:Qa(e.sortBy,iC,"updatedAt"),sortOrder:Qa(e.sortOrder,cC,"desc"),pinnedFirst:dC(e.pinnedFirst,!1)}),An=e=>({page:En(e.page,1)}),hC=e=>({page:En(e.page,1),query:Yp(e.query,"")}),pC=e=>({year:En(e.year,He().year(),{min:1970,max:9999}),month:En(e.month,He().month()+1,{min:1,max:12}),type:Qa(e.type,lC,"create")}),mC=e=>({page:En(e.page,1),sectionId:Yp(e.sectionId,"")}),eu=Gm(Wr);function gC(){const e=eu.useNavigate(),{limit:t,page:n,sortBy:r,sortOrder:o,pinnedFirst:s}=eu.useSearch(),{onDelete:a,onPinned:i,deleteWarningDialog:l}=Ap(),u=f=>{e({search:d=>({...d,...f})})};return h.jsxs(Es,{title:"",variant:"none",children:[h.jsxs("div",{className:"flex flex-col gap-5",children:[h.jsx(Gw,{itemsPerPage:t,onItemsPerPageChange:f=>u({limit:f,page:1}),sortBy:r,onSortByChange:f=>u({sortBy:f,page:1}),sortOrder:o,onSortOrderChange:f=>u({sortOrder:f,page:1}),pinnedFirst:s,onPinnedFirstChange:f=>u({pinnedFirst:f,page:1})}),h.jsx(yp,{fallback:h.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[h.jsx(Ht,{height:"112px"}),h.jsx(Ht,{height:"112px"}),h.jsx(Ht,{height:"112px"})]}),errorTitle:"Failed to load notes",errorDescription:"Retry loading the current note list.",resetKeys:[n,t,r,o,s],children:h.jsx(ER,{searchParams:{offset:(n-1)*t,limit:t,sortBy:r,sortOrder:o,pinnedFirst:s},render:({notes:f,totalCount:d})=>h.jsx(Sl,{fallback:h.jsx(fh,{title:"Ocean is calm",description:"Capture anything and make waves in the ocean!"}),children:f.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"grid-auto-cards grid gap-5",children:f.map(p=>h.jsx(RS,{...p,onPinned:()=>i(p.id,p.pinned),onDelete:()=>a(p.id)},p.id))}),h.jsx(Sl,{fallback:null,children:d&&t<d&&h.jsx(ph,{page:n,last:Math.ceil(d/t),onChange:p=>{u({page:p})}})})]})})})})]}),l]})}const De=Jm({component:()=>h.jsx(aC,{children:h.jsx(Cu,{})}),errorComponent:HE,notFoundComponent:BE}),vC=Ie({getParentRoute:()=>De,path:Wr,component:gC,validateSearch:fC}),yC=Ie({getParentRoute:()=>De,path:dp,component:Ue(()=>Ze(()=>import("./Calendar-DbPut8EU.js"),__vite__mapDeps([0,1,2,3,4]))),pendingComponent:()=>h.jsx(ke,{title:"Loading calendar",description:"Preparing note and reminder snapshots."}),validateSearch:pC}),bC=Ie({getParentRoute:()=>De,path:up,component:Ue(()=>Ze(()=>import("./Views-Bqq0pUEE.js"),__vite__mapDeps([5,1,2,3,6,7,8]))),pendingComponent:()=>h.jsx(ke,{title:"Loading views",description:"Preparing your saved dashboards."})}),xC=Ie({getParentRoute:()=>De,path:fp,component:Ue(()=>Ze(()=>import("./Reminders-CvEJf0eQ.js"),__vite__mapDeps([9,1,2,3,10]))),pendingComponent:()=>h.jsx(ke,{title:"Loading reminders",description:"Collecting upcoming reminder cards."}),validateSearch:An}),wC=Ie({getParentRoute:()=>De,path:hp,component:Ue(()=>Ze(()=>import("./Graph-yHE9m5fy.js"),__vite__mapDeps([11,1,2,3]))),pendingComponent:()=>h.jsx(ke,{title:"Loading graph",description:"Preparing the linked note constellation."})}),EC=Ie({getParentRoute:()=>De,path:pp,component:Ue(()=>Ze(()=>import("./Search-CKZhztuV.js"),__vite__mapDeps([12,1,2,3]))),pendingComponent:()=>h.jsx(ke,{title:"Loading search",description:"Preparing indexed note results."}),validateSearch:hC}),SC=Ie({getParentRoute:()=>De,path:mp,component:Ue(()=>Ze(()=>import("./Tag-C4oAwjs0.js"),__vite__mapDeps([13,1,2,3]))),pendingComponent:()=>h.jsx(ke,{title:"Loading tags",description:"Preparing the tag catalog."}),validateSearch:An}),RC=Ie({getParentRoute:()=>De,path:tr,component:Ue(()=>Ze(()=>import("./Note-BECn-AoI.js"),__vite__mapDeps([14,1,2,3,4,7,10,8,15,16]))),pendingComponent:()=>h.jsx(ke,{title:"Loading note",description:"Preparing the editor and note content."})}),CC=Ie({getParentRoute:()=>De,path:Qi,component:Ue(()=>Ze(()=>import("./TagNotes-Rl1ZSJP6.js"),__vite__mapDeps([17,1,2,3]))),pendingComponent:()=>h.jsx(ke,{title:"Loading tagged notes",description:"Preparing notes for the selected tag."}),validateSearch:An}),AC=Ie({getParentRoute:()=>De,path:NE,component:Ue(()=>Ze(()=>import("./ViewNotes-B9Yc0A87.js"),__vite__mapDeps([18,1,2,3,6]))),pendingComponent:()=>h.jsx(ke,{title:"Loading view notes",description:"Preparing notes for this saved view section."}),validateSearch:mC}),TC=Ie({getParentRoute:()=>De,path:gp,component:Ue(()=>Ze(()=>import("./index-BQDR6hIA.js"),__vite__mapDeps([19,1,2,3,20,21]))),pendingComponent:()=>h.jsx(ke,{title:"Loading settings",description:"Preparing workspace preferences."})}),PC=Ie({getParentRoute:()=>De,path:OE,component:Ue(()=>Ze(()=>import("./mcp-C0Z3vKBa.js"),__vite__mapDeps([22,1,2,3,7]))),pendingComponent:()=>h.jsx(ke,{title:"Loading MCP settings",description:"Preparing MCP access controls."})}),MC=Ie({getParentRoute:()=>De,path:IE,component:Ue(()=>Ze(()=>import("./trash-D5ZiZfTk.js"),__vite__mapDeps([23,1,2,3,7]))),pendingComponent:()=>h.jsx(ke,{title:"Loading trash",description:"Preparing deleted notes for restore."}),validateSearch:An}),_C=Ie({getParentRoute:()=>De,path:DE,component:Ue(()=>Ze(()=>import("./manage-image-Bs4Kmevx.js"),__vite__mapDeps([24,1,2,3,15,25,7,20]))),pendingComponent:()=>h.jsx(ke,{title:"Loading image manager",description:"Preparing uploaded image metadata."}),validateSearch:An}),NC=Ie({getParentRoute:()=>De,path:LE,component:Ue(()=>Ze(()=>import("./manage-image-detail-WARala-v.js"),__vite__mapDeps([26,1,2,3,15,25,7,20,21]))),pendingComponent:()=>h.jsx(ke,{title:"Loading image detail",description:"Preparing references for the selected image."})}),OC=Ie({getParentRoute:()=>De,path:kE,component:Ue(()=>Ze(()=>import("./properties-DbnmfbT5.js"),__vite__mapDeps([27,1,2,3]))),pendingComponent:()=>h.jsx(ke,{title:"Loading properties",description:"Preparing shared property definitions."}),validateSearch:An}),IC=Ie({getParentRoute:()=>De,path:jE,component:Ue(()=>Ze(()=>import("./placeholder-D080guzn.js"),__vite__mapDeps([28,1,2,3,7,8]))),pendingComponent:()=>h.jsx(ke,{title:"Loading placeholders",description:"Preparing template replacement rules."}),validateSearch:An}),DC=De.addChildren([vC,bC,yC,xC,wC,EC,SC,RC,CC,AC,TC,PC,MC,_C,NC,IC,OC]),LC=ig({routeTree:DC,defaultPendingComponent:()=>h.jsx(ke,{title:"Loading page",description:"Preparing the next route."})});function jC(){const e=Vo(n=>n.setSystemTheme),t=Vo(n=>n.setTheme);return c.useEffect(()=>{const n=Bo();return n&&t(n),f1.listenThemeChange(r=>{Bo()||e(r?"dark":"light")},n==null)},[e,t]),h.jsx(J8,{children:h.jsx(ug,{router:LC})})}Vo.setState({theme:XE()});L8();c1.createRoot(document.getElementById("root")).render(h.jsx(M.StrictMode,{children:h.jsx(jC,{})}));export{Ir as $,KS as A,bt as B,dp as C,tx as D,Hl as E,xR as F,ac as G,v5 as H,rx as I,fh as J,oc as K,Pt as L,Ft as M,tr as N,G3 as O,Es as P,I5 as Q,GS as R,bo as S,se as T,uR as U,NE as V,D5 as W,rR as X,cR as Y,vR as Z,qv as _,Bv as a,pS as a$,yp as a0,ph as a1,fp as a2,Xi as a3,Sn as a4,Vo as a5,Hu as a6,_5 as a7,af as a8,ER as a9,Fl as aA,w5 as aB,W4 as aC,G4 as aD,lh as aE,ex as aF,dh as aG,uh as aH,kE as aI,Gv as aJ,ty as aK,p5 as aL,RS as aM,OE as aN,DE as aO,jE as aP,Xv as aQ,ye as aR,ow as aS,A5 as aT,P5 as aU,M5 as aV,CS as aW,T5 as aX,LE as aY,Za as aZ,g5 as a_,pp as aa,ws as ab,Sl as ac,Qi as ad,mp as ae,Ge as af,S5 as ag,zg as ah,C5 as ai,R5 as aj,bS as ak,Zv as al,Yv as am,Rp as an,tS as ao,L5 as ap,E5 as aq,d5 as ar,m5 as as,O5 as at,Y8 as au,Ap as av,IE as aw,tf as ax,N5 as ay,xS as az,Vv as b,h5 as b0,y5 as b1,b5 as b2,x5 as b3,_S as b4,NS as b5,OS as b6,je as b7,me as c,He as d,$n as e,Ks as f,br as g,fe as h,Ht as i,Gm as j,Qn as k,ix as l,df as m,hh as n,vw as o,Ae as p,ve as q,yw as r,Wv as s,Cp as t,qg as u,Hf as v,aw as w,Kw as x,lf as y,RR as z};
361
+ }`,{name:e})}const CR="focus-ring-soft flex h-8 w-8 items-center justify-center rounded-[10px] text-fg-default/70 outline-none transition-colors hover:text-fg-default active:cursor-grabbing touch-none",AR="focus-ring-soft block truncate rounded-[10px] px-1.5 py-1 outline-none transition-colors";function TR({id:e,title:t,isActive:n=!1,children:r}){const{attributes:o,listeners:s,setNodeRef:a,setActivatorNodeRef:i,transform:l,transition:u,isDragging:f}=vR({id:e}),d={transform:Ir.Transform.toString(l),transition:u,opacity:f?.5:1};return h.jsxs("div",{ref:a,style:d,className:me("group flex min-h-[40px] items-center gap-1.5 rounded-[12px] px-1.5 py-1 transition-colors",n&&"bg-hover-subtle"),children:[h.jsx("button",{type:"button",ref:i,"aria-label":`Reorder note ${t??"Untitled"}`,...o,...s,className:me(CR,f?"cursor-grabbing":"cursor-grab"),children:h.jsx(qv,{className:"size-4"})}),h.jsx(se,{as:"div",truncate:!0,variant:"body",weight:"medium",className:"min-w-0 flex-1",children:r})]})}function PR({notes:e,pathname:t,pinnedItems:n,setPinnedItems:r,handleDragEnd:o,sensors:s}){c.useEffect(()=>{r(e)},[e,r]);const a=n.length>0?n:e;return a.length===0?null:h.jsx(G3,{sensors:s,collisionDetection:GS,onDragEnd:o,modifiers:[rR],children:h.jsx(uR,{items:a.map(i=>i.id),strategy:cR,children:a.map(i=>h.jsx(TR,{id:i.id,title:i.title||"Untitled",isActive:t===`/${i.id}`,children:h.jsx(Pt,{"aria-current":t===`/${i.id}`?"page":void 0,className:me(AR,t===`/${i.id}`?"text-fg-default":"text-fg-secondary hover:bg-hover-subtle hover:text-fg-default"),to:tr,params:{id:i.id},children:i.title||"Untitled"})},i.id))})})}const MR=()=>{const e=ns({select:i=>i.pathname}),t=Qn(),[n,r]=c.useState([]),o=zg({mutationFn:SS,onSuccess:()=>{t.invalidateQueries({queryKey:ve.notes.pinned(),exact:!0})}}),s=KS(Hl(ac,{activationConstraint:{distance:8}}),Hl(oc,{coordinateGetter:xR})),a=i=>{const{active:l,over:u}=i;u&&l.id!==u.id&&r(f=>{const d=f.findIndex(v=>v.id===l.id),p=f.findIndex(v=>v.id===u.id),m=ic(f,d,p);return o.mutate(m.map((v,g)=>({id:v.id,order:g}))),m})};return h.jsx("div",{className:"flex flex-col gap-1",children:h.jsx(yp,{fallback:h.jsxs("div",{className:"space-y-1",children:[h.jsx(Ht,{height:"40px",opacity:.4}),h.jsx(Ht,{height:"40px",opacity:.4})]}),errorTitle:"Failed to load pinned notes",errorDescription:"Retry loading the pinned note list.",renderError:({error:i,retry:l})=>h.jsx(Xi,{title:"Failed to load pinned notes",description:"Retry loading the pinned note list.",error:i,onRetry:l,showBackAction:!1,showHomeAction:!1}),children:h.jsx(SR,{render:i=>i.length>0?h.jsx(PR,{notes:i,pathname:e,pinnedItems:n,setPinnedItems:r,handleDragEnd:a,sensors:s}):h.jsx(se,{as:"div",variant:"meta",tone:"secondary",className:"px-2 py-2.5 leading-6",children:"Pin a note to keep it in view while the rest of the workspace changes."})})})})},_R="mb-2.5 flex items-center justify-between gap-3 px-1",NR="flex min-w-0 items-center gap-2",OR="inline-flex h-4 w-4 shrink-0 items-center justify-center text-fg-tertiary",IR=({title:e,icon:t,detail:n})=>h.jsxs("div",{className:_R,children:[h.jsxs("div",{className:NR,children:[t?h.jsx("span",{className:OR,children:t}):null,h.jsx(se,{variant:"label",weight:"medium",tone:"tertiary",children:e})]}),n?h.jsx(se,{as:"div",variant:"meta",weight:"medium",tone:"tertiary",children:n}):null]}),DR="flex flex-col gap-3.5 p-3 pt-2",LR="focus-ring-soft surface-base group flex w-full items-center justify-between gap-2.5 px-3 py-2.5 text-left text-fg-default outline-none transition-colors hover:bg-hover-subtle",jR="flex items-center gap-2.5",kR="inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-[13px] bg-cta text-fg-on-filled",FR="flex flex-col",$R="h-4 w-4 text-fg-tertiary transition-colors group-hover:text-fg-default",HR=()=>{const{onCreate:e}=Ap();return h.jsxs("div",{className:DR,children:[h.jsxs("button",{type:"button",className:LR,onClick:()=>e(),children:[h.jsxs("span",{className:jR,children:[h.jsx("span",{className:kR,children:h.jsx(Xv,{className:"h-4.5 w-4.5",weight:"bold"})}),h.jsxs("span",{className:FR,children:[h.jsx(se,{variant:"meta",weight:"semibold",tracking:"tight",children:"Capture"}),h.jsx(se,{variant:"label",tone:"secondary",children:"Open a new note"})]})]}),h.jsx(br,{className:$R,weight:"bold"})]}),h.jsxs("section",{className:"pt-1",children:[h.jsx(IR,{title:"Pinned",icon:h.jsx(tf,{className:"h-4 w-4",weight:"fill"})}),h.jsx(MR,{})]})]})},BR=e=>{const[t,n]=c.useState(!1),r=c.useRef(null),o=c.useRef(!0),s=c.useRef(0),a=c.useCallback(()=>{r.current!==null&&(clearTimeout(r.current),r.current=null)},[]);c.useEffect(()=>(o.current=!0,()=>{o.current=!1,a()}),[a]);const i=c.useCallback(l=>{s.current+=1;const u=s.current;a(),o.current&&n(!0),r.current=setTimeout(()=>{r.current=null,Promise.resolve().then(l).catch(()=>{}).finally(()=>{o.current&&s.current===u&&n(!1)})},e)},[a,e]);return[t,i]},VR="flex flex-col gap-2.5",ZR="surface-base overflow-hidden",UR="grid-search-bar grid items-center border-b border-transparent px-2.5 py-1.5 transition-colors",qR="border-border-subtle/70 bg-muted/25",zR="hover:bg-hover-subtle/60",Jl="flex h-10 items-center justify-center text-fg-tertiary transition-colors hover:text-fg-default sm:h-8",KR="h-10 w-full bg-transparent py-2 text-meta text-fg-default outline-none placeholder:text-fg-placeholder sm:h-8 sm:py-1.5",WR="px-1 py-1.5",GR="px-2 pb-0.5 pt-1",YR="px-2 pb-0.5 pt-1.5",QR="flex min-h-10 items-center gap-2 rounded-[10px] px-2.5 py-2 transition-colors hover:bg-hover-subtle sm:min-h-0 sm:px-2 sm:py-1.5",XR="min-w-0 flex-1",JR="flex flex-wrap gap-1.5 px-1.5 py-1",eC="inline-flex items-center rounded-full border border-border-subtle bg-hover-subtle px-2 py-0.75 sm:py-0.5",tC="mt-1 border-t border-border-subtle/50 px-2 pb-0.5 pt-1.5",nC="flex min-h-9 items-center gap-1.5 text-fg-secondary transition-colors hover:text-fg-default",rC=()=>{const e=Sn(),[t,n]=c.useState(""),[r,o]=c.useState([]),[s,a]=c.useState([]),[,i]=BR(500);c.useEffect(()=>{if(t.length<=0){i(()=>{}),o([]),a([]);return}i(()=>{Rp({query:t,limit:5}).then(d=>{d.type==="success"&&o(d.allNotes.notes)}),RR({query:t,limit:5}).then(d=>{d.type==="success"&&a(d.allTags.tags)})})},[t,i]);const l=d=>{d?.preventDefault(),e({to:pp,search:{query:t,page:1}})},u=()=>{n("")},f=r.length>0||s.length>0;return h.jsx("div",{className:"p-3",children:h.jsx("form",{className:VR,onSubmit:l,children:h.jsxs("div",{className:ZR,children:[h.jsxs("div",{className:`${UR} ${f?qR:zR}`,children:[h.jsx("button",{type:"submit",className:Jl,children:h.jsx(Qv,{className:"h-4.5 w-4.5",weight:"bold"})}),h.jsx("input",{type:"text",placeholder:"Search notes or tags",value:t,onChange:d=>n(d.target.value),className:KR}),t&&h.jsx("button",{type:"button",className:Jl,onClick:u,children:h.jsx(af,{className:"h-4 w-4",weight:"bold"})})]}),f&&h.jsxs("div",{className:WR,children:[r.length>0&&h.jsxs("div",{children:[s.length>0&&h.jsx(se,{as:"div",variant:"label",weight:"medium",tone:"tertiary",className:GR,children:"Notes"}),r.map(({id:d,title:p})=>h.jsxs(Pt,{to:tr,params:{id:d},className:QR,children:[h.jsx(Wv,{className:"h-3.5 w-3.5 shrink-0 text-fg-tertiary"}),h.jsx(se,{as:"span",truncate:!0,variant:"meta",weight:"medium",className:XR,children:p||"Untitled"})]},d))]}),s.length>0&&h.jsxs("div",{children:[r.length>0&&h.jsx(se,{as:"div",variant:"label",weight:"medium",tone:"tertiary",className:YR,children:"Tags"}),h.jsx("div",{className:JR,children:s.map(({id:d,name:p})=>h.jsx(Pt,{to:Qi,params:{id:d},search:{page:1},children:h.jsx(se,{as:"span",variant:"label",weight:"medium",tone:"secondary",className:eC,children:p})},d))})]}),h.jsx("div",{className:tC,children:h.jsxs("button",{type:"submit",className:nC,children:[h.jsx(se,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:"View all results"}),h.jsx(br,{className:"h-3.5 w-3.5",weight:"bold"})]})})]})]})})})},oC=[{name:"Notes",path:Wr,icon:Yd},{name:"Views",path:up,icon:Kv},{name:"Graph",path:hp,icon:ny},{name:"Calendar",path:dp,icon:Vv},{name:"Reminders",path:fp,icon:Bv},{name:"Tags",path:mp,icon:ty},{name:"Setting",path:gp,icon:Gv}],sC=()=>{const e=ns({select:t=>t.pathname});return h.jsx("nav",{"aria-label":"Primary navigation",className:"flex items-center gap-1 px-4 py-2.5",children:oC.map((t,n)=>{const r=e===t.path||t.path!==Wr&&e.startsWith(`${t.path}/`);return h.jsxs(c.Fragment,{children:[n>0&&h.jsx("span",{className:"h-3.5 w-px shrink-0 bg-border-subtle"}),h.jsx(Pt,{to:t.path,children:h.jsxs("div",{className:`flex min-w-26 items-center justify-center gap-2 border-b px-2 py-2 transition-colors ${r?"border-fg-muted text-fg-default":"border-transparent text-fg-secondary hover:border-border-subtle hover:text-fg-default"}`,children:[h.jsx(t.icon,{className:"size-5",weight:r?"fill":"regular"}),h.jsx(se,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:t.name})]})})]},t.path)})})},aC=({children:e})=>h.jsx(uS,{sidebar:h.jsxs(h.Fragment,{children:[h.jsx(mS,{}),h.jsx(rC,{}),h.jsx(HR,{})]}),topNavigation:h.jsx(sC,{}),children:e}),iC=["updatedAt","createdAt"],cC=["asc","desc"],lC=["create","update"],Ts=e=>Array.isArray(e)?e[0]:e,En=(e,t,{min:n=1,max:r=Number.MAX_SAFE_INTEGER}={})=>{const o=Ts(e),s=typeof o=="number"?o:typeof o=="string"?Number(o):Number.NaN;return!Number.isInteger(s)||s<n||s>r?t:s},uC=(e,t,n)=>{const r=En(e,Number.NaN);return t.includes(r)?r:n},dC=(e,t=!1)=>{const n=Ts(e);return n===!0||n==="true"?!0:n===!1||n==="false"?!1:t},Yp=(e,t="")=>{const n=Ts(e);return typeof n=="string"?n:t},Qa=(e,t,n)=>{const r=Ts(e);return typeof r!="string"?n:t.includes(r)?r:n},fC=e=>({page:En(e.page,1),limit:uC(e.limit,Yi,ws),sortBy:Qa(e.sortBy,iC,"updatedAt"),sortOrder:Qa(e.sortOrder,cC,"desc"),pinnedFirst:dC(e.pinnedFirst,!1)}),An=e=>({page:En(e.page,1)}),hC=e=>({page:En(e.page,1),query:Yp(e.query,"")}),pC=e=>({year:En(e.year,He().year(),{min:1970,max:9999}),month:En(e.month,He().month()+1,{min:1,max:12}),type:Qa(e.type,lC,"create")}),mC=e=>({page:En(e.page,1),sectionId:Yp(e.sectionId,"")}),eu=Gm(Wr);function gC(){const e=eu.useNavigate(),{limit:t,page:n,sortBy:r,sortOrder:o,pinnedFirst:s}=eu.useSearch(),{onDelete:a,onPinned:i,deleteWarningDialog:l}=Ap(),u=f=>{e({search:d=>({...d,...f})})};return h.jsxs(Es,{title:"",variant:"none",children:[h.jsxs("div",{className:"flex flex-col gap-5",children:[h.jsx(Gw,{itemsPerPage:t,onItemsPerPageChange:f=>u({limit:f,page:1}),sortBy:r,onSortByChange:f=>u({sortBy:f,page:1}),sortOrder:o,onSortOrderChange:f=>u({sortOrder:f,page:1}),pinnedFirst:s,onPinnedFirstChange:f=>u({pinnedFirst:f,page:1})}),h.jsx(yp,{fallback:h.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[h.jsx(Ht,{height:"112px"}),h.jsx(Ht,{height:"112px"}),h.jsx(Ht,{height:"112px"})]}),errorTitle:"Failed to load notes",errorDescription:"Retry loading the current note list.",resetKeys:[n,t,r,o,s],children:h.jsx(ER,{searchParams:{offset:(n-1)*t,limit:t,sortBy:r,sortOrder:o,pinnedFirst:s},render:({notes:f,totalCount:d})=>h.jsx(Sl,{fallback:h.jsx(fh,{title:"Ocean is calm",description:"Capture anything and make waves in the ocean!"}),children:f.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"grid-auto-cards grid gap-5",children:f.map(p=>h.jsx(RS,{...p,onPinned:()=>i(p.id,p.pinned),onDelete:()=>a(p.id)},p.id))}),h.jsx(Sl,{fallback:null,children:d&&t<d&&h.jsx(ph,{page:n,last:Math.ceil(d/t),onChange:p=>{u({page:p})}})})]})})})})]}),l]})}const De=Jm({component:()=>h.jsx(aC,{children:h.jsx(Cu,{})}),errorComponent:HE,notFoundComponent:BE}),vC=Ie({getParentRoute:()=>De,path:Wr,component:gC,validateSearch:fC}),yC=Ie({getParentRoute:()=>De,path:dp,component:Ue(()=>Ze(()=>import("./Calendar-B2_OJcHD.js"),__vite__mapDeps([0,1,2,3,4]))),pendingComponent:()=>h.jsx(ke,{title:"Loading calendar",description:"Preparing note and reminder snapshots."}),validateSearch:pC}),bC=Ie({getParentRoute:()=>De,path:up,component:Ue(()=>Ze(()=>import("./Views-CBEimWY8.js"),__vite__mapDeps([5,1,2,3,6,7,8]))),pendingComponent:()=>h.jsx(ke,{title:"Loading views",description:"Preparing your saved dashboards."})}),xC=Ie({getParentRoute:()=>De,path:fp,component:Ue(()=>Ze(()=>import("./Reminders-B0LJeSlu.js"),__vite__mapDeps([9,1,2,3,10]))),pendingComponent:()=>h.jsx(ke,{title:"Loading reminders",description:"Collecting upcoming reminder cards."}),validateSearch:An}),wC=Ie({getParentRoute:()=>De,path:hp,component:Ue(()=>Ze(()=>import("./Graph-DO35UCPM.js"),__vite__mapDeps([11,1,2,3]))),pendingComponent:()=>h.jsx(ke,{title:"Loading graph",description:"Preparing the linked note constellation."})}),EC=Ie({getParentRoute:()=>De,path:pp,component:Ue(()=>Ze(()=>import("./Search-xbDSlNOT.js"),__vite__mapDeps([12,1,2,3]))),pendingComponent:()=>h.jsx(ke,{title:"Loading search",description:"Preparing indexed note results."}),validateSearch:hC}),SC=Ie({getParentRoute:()=>De,path:mp,component:Ue(()=>Ze(()=>import("./Tag-2PlhkjwY.js"),__vite__mapDeps([13,1,2,3]))),pendingComponent:()=>h.jsx(ke,{title:"Loading tags",description:"Preparing the tag catalog."}),validateSearch:An}),RC=Ie({getParentRoute:()=>De,path:tr,component:Ue(()=>Ze(()=>import("./Note-AaTlS352.js"),__vite__mapDeps([14,1,2,3,4,7,10,8,15,16]))),pendingComponent:()=>h.jsx(ke,{title:"Loading note",description:"Preparing the editor and note content."})}),CC=Ie({getParentRoute:()=>De,path:Qi,component:Ue(()=>Ze(()=>import("./TagNotes-1yUBLqhX.js"),__vite__mapDeps([17,1,2,3]))),pendingComponent:()=>h.jsx(ke,{title:"Loading tagged notes",description:"Preparing notes for the selected tag."}),validateSearch:An}),AC=Ie({getParentRoute:()=>De,path:NE,component:Ue(()=>Ze(()=>import("./ViewNotes-D4X-MCTk.js"),__vite__mapDeps([18,1,2,3,6]))),pendingComponent:()=>h.jsx(ke,{title:"Loading view notes",description:"Preparing notes for this saved view section."}),validateSearch:mC}),TC=Ie({getParentRoute:()=>De,path:gp,component:Ue(()=>Ze(()=>import("./index-sGhvnErO.js"),__vite__mapDeps([19,1,2,3,20,21]))),pendingComponent:()=>h.jsx(ke,{title:"Loading settings",description:"Preparing workspace preferences."})}),PC=Ie({getParentRoute:()=>De,path:OE,component:Ue(()=>Ze(()=>import("./mcp-aIwuouT9.js"),__vite__mapDeps([22,1,2,3,7]))),pendingComponent:()=>h.jsx(ke,{title:"Loading MCP settings",description:"Preparing MCP access controls."})}),MC=Ie({getParentRoute:()=>De,path:IE,component:Ue(()=>Ze(()=>import("./trash-w7Hhxckg.js"),__vite__mapDeps([23,1,2,3,7]))),pendingComponent:()=>h.jsx(ke,{title:"Loading trash",description:"Preparing deleted notes for restore."}),validateSearch:An}),_C=Ie({getParentRoute:()=>De,path:DE,component:Ue(()=>Ze(()=>import("./manage-image-B4UZ-ZQx.js"),__vite__mapDeps([24,1,2,3,15,25,7,20]))),pendingComponent:()=>h.jsx(ke,{title:"Loading image manager",description:"Preparing uploaded image metadata."}),validateSearch:An}),NC=Ie({getParentRoute:()=>De,path:LE,component:Ue(()=>Ze(()=>import("./manage-image-detail-ejAh3nCL.js"),__vite__mapDeps([26,1,2,3,15,25,7,20,21]))),pendingComponent:()=>h.jsx(ke,{title:"Loading image detail",description:"Preparing references for the selected image."})}),OC=Ie({getParentRoute:()=>De,path:kE,component:Ue(()=>Ze(()=>import("./properties-D8oLyTCD.js"),__vite__mapDeps([27,1,2,3]))),pendingComponent:()=>h.jsx(ke,{title:"Loading properties",description:"Preparing shared property definitions."}),validateSearch:An}),IC=Ie({getParentRoute:()=>De,path:jE,component:Ue(()=>Ze(()=>import("./placeholder-B_9Hnm7h.js"),__vite__mapDeps([28,1,2,3,7,8]))),pendingComponent:()=>h.jsx(ke,{title:"Loading placeholders",description:"Preparing template replacement rules."}),validateSearch:An}),DC=De.addChildren([vC,bC,yC,xC,wC,EC,SC,RC,CC,AC,TC,PC,MC,_C,NC,IC,OC]),LC=ig({routeTree:DC,defaultPendingComponent:()=>h.jsx(ke,{title:"Loading page",description:"Preparing the next route."})});function jC(){const e=Vo(n=>n.setSystemTheme),t=Vo(n=>n.setTheme);return c.useEffect(()=>{const n=Bo();return n&&t(n),f1.listenThemeChange(r=>{Bo()||e(r?"dark":"light")},n==null)},[e,t]),h.jsx(J8,{children:h.jsx(ug,{router:LC})})}Vo.setState({theme:XE()});L8();c1.createRoot(document.getElementById("root")).render(h.jsx(M.StrictMode,{children:h.jsx(jC,{})}));export{Ir as $,KS as A,bt as B,dp as C,tx as D,Hl as E,xR as F,ac as G,v5 as H,rx as I,fh as J,oc as K,Pt as L,Ft as M,tr as N,G3 as O,Es as P,D5 as Q,GS as R,bo as S,se as T,uR as U,NE as V,L5 as W,rR as X,cR as Y,vR as Z,qv as _,Bv as a,g5 as a$,yp as a0,ph as a1,fp as a2,Xi as a3,Sn as a4,Vo as a5,Hu as a6,N5 as a7,af as a8,ER as a9,xS as aA,Fl as aB,w5 as aC,W4 as aD,G4 as aE,lh as aF,ex as aG,dh as aH,uh as aI,kE as aJ,Gv as aK,ty as aL,p5 as aM,RS as aN,OE as aO,DE as aP,jE as aQ,Xv as aR,ye as aS,ow as aT,T5 as aU,M5 as aV,_5 as aW,CS as aX,P5 as aY,LE as aZ,Za as a_,pp as aa,ws as ab,Sl as ac,Qi as ad,mp as ae,Ge as af,S5 as ag,zg as ah,A5 as ai,C5 as aj,R5 as ak,bS as al,Zv as am,Yv as an,Rp as ao,tS as ap,j5 as aq,E5 as ar,d5 as as,m5 as at,I5 as au,Y8 as av,Ap as aw,IE as ax,tf as ay,O5 as az,Vv as b,pS as b0,h5 as b1,y5 as b2,b5 as b3,x5 as b4,_S as b5,NS as b6,OS as b7,je as b8,me as c,He as d,$n as e,Ks as f,br as g,fe as h,Ht as i,Gm as j,Qn as k,ix as l,df as m,hh as n,vw as o,Ae as p,ve as q,yw as r,Wv as s,Cp as t,qg as u,Hf as v,aw as w,Kw as x,lf as y,RR as z};