ocean-brain 0.12.2 → 0.13.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.
- package/package.json +1 -1
- package/server/client/dist/assets/{ArrowRight.es-CD1IMhU2.js → ArrowRight.es-BlNsZQFs.js} +1 -1
- package/server/client/dist/assets/AuxiliaryPanelHeader-HAttwVby.js +1 -0
- package/server/client/dist/assets/Calendar-CaeK7gTz.js +25 -0
- package/server/client/dist/assets/Callout-CcYyvHQP.js +1 -0
- package/server/client/dist/assets/CaretUp.es-C8iY5OlB.js +1 -0
- package/server/client/dist/assets/{CheckCircle.es-C7fkzE3t.js → CheckCircle.es-Dqr3WImn.js} +1 -1
- package/server/client/dist/assets/{Copy.es-D6rl6b78.js → Copy.es-fMv0ETir.js} +1 -1
- package/server/client/dist/assets/{File.es-CcjtzE38.js → File.es-CHtXXafR.js} +1 -1
- package/server/client/dist/assets/FileText.es-DPIwDCEe.js +1 -0
- package/server/client/dist/assets/{FlowArrow.es-CAIThqWk.js → FlowArrow.es-Dxee98ir.js} +1 -1
- package/server/client/dist/assets/Graph-CdEu8eAn.js +46 -0
- package/server/client/dist/assets/Graph-hVj6vAYJ.js +1 -0
- package/server/client/dist/assets/{Image.es-BDpo5R66.js → Image.es-CjXY1JVf.js} +1 -1
- package/server/client/dist/assets/Info.es-CYxg-Vku.js +1 -0
- package/server/client/dist/assets/LinkSimple.es-B-P-7Iem.js +1 -0
- package/server/client/dist/assets/{Note-Dq2Szaxd.js → Note-CGI-Y1__.js} +4 -4
- package/server/client/dist/assets/{NotePropertiesPanel-Cu3RgDic.js → NotePropertiesPanel-6P7UfRBR.js} +2 -2
- package/server/client/dist/assets/{Plus.es-P9Fjwtud.js → Plus.es-Dy6onD-Z.js} +1 -1
- package/server/client/dist/assets/Reminders-DnuALBL6.js +1 -0
- package/server/client/dist/assets/{Search-DVROxY_B.js → Search-DAYHxAml.js} +2 -2
- package/server/client/dist/assets/{SurfaceCard-D_OU_Oy6.js → SurfaceCard-D5QxOte_.js} +1 -1
- package/server/client/dist/assets/Tag-CG8b0l1j.js +1 -0
- package/server/client/dist/assets/TagNotes-COyaVsdn.js +1 -0
- package/server/client/dist/assets/{Trash.es-BeR1sZMe.js → Trash.es-XEcWG_aq.js} +1 -1
- package/server/client/dist/assets/{ViewChip-D-Ax5PdL.js → ViewChip-BVkZAXyx.js} +1 -1
- package/server/client/dist/assets/Views-BPxlw3vk.js +1 -0
- package/server/client/dist/assets/app-BezcjTfd.js +151 -0
- package/server/client/dist/assets/app-DjDwGe0t.css +1 -0
- package/server/client/dist/assets/calendar-data-wB0ifXdo.js +1 -0
- package/server/client/dist/assets/{image.api-CtfyPwkV.js → image.api-ChvlfuZg.js} +1 -1
- package/server/client/dist/assets/index-CzZFedXj.js +1 -0
- package/server/client/dist/assets/{manage-image-m-7v_Z1W.js → manage-image-CSJ3Flgc.js} +1 -1
- package/server/client/dist/assets/manage-image-detail-9hRTiAsR.js +1 -0
- package/server/client/dist/assets/{mcp-admin-adapter-Cw6w5mfg.js → mcp-admin-adapter-D0R8p9az.js} +1 -1
- package/server/client/dist/assets/{mcp-B-aGeAQD.js → mcp-ugdCKa6H.js} +1 -1
- package/server/client/dist/assets/{note-ui-CYsZc3DI.js → note-ui-BaqzP-YU.js} +1 -1
- package/server/client/dist/assets/placeholder-CZoqs4S3.js +34 -0
- package/server/client/dist/assets/{properties-B93_V2uD.js → properties-B7Fv95qY.js} +1 -1
- package/server/client/dist/assets/route-preload.js +2 -2
- package/server/client/dist/assets/{search-admin-adapter-Dj0KKKrJ.js → search-admin-adapter-Daf7e2YQ.js} +1 -1
- package/server/client/dist/assets/search-ddYl3qH-.js +1 -0
- package/server/client/dist/assets/{tag.api-BJ6eaHui.js → tag.api-DEUROVKQ.js} +1 -1
- package/server/client/dist/assets/time-PxWila4-.js +361 -0
- package/server/client/dist/assets/trash-BHida7BG.js +1 -0
- package/server/client/dist/assets/{url-BvjSC8PU.js → url-DKUMNVCI.js} +1 -1
- package/server/client/dist/assets/useNoteMutate-BjvZUmtX.js +9 -0
- package/server/client/dist/assets/{useReminderMutate-kTBRSjYc.js → useReminderMutate-C5n-5LM-.js} +2 -2
- package/server/client/dist/index.html +6 -6
- package/server/dist/features/note/services/properties.js +32 -8
- package/server/dist/features/view/graphql/view.query.resolver.js +20 -0
- package/server/dist/features/view/graphql/view.type-defs.js +17 -0
- package/server/dist/features/view/services/workspace.js +116 -1
- package/server/client/dist/assets/AuxiliaryPanelHeader-zoJGsYWR.js +0 -1
- package/server/client/dist/assets/Calendar-6otw_EJn.js +0 -25
- package/server/client/dist/assets/Callout-C1QiCWCa.js +0 -1
- package/server/client/dist/assets/Graph-BHsmPDPh.js +0 -46
- package/server/client/dist/assets/Reminders-DKm0GFI2.js +0 -1
- package/server/client/dist/assets/Tag-wMHTRwlF.js +0 -1
- package/server/client/dist/assets/TagNotes-BRza6i14.js +0 -1
- package/server/client/dist/assets/Views-CL7rC05G.js +0 -1
- package/server/client/dist/assets/app-CyQtGTtn.js +0 -139
- package/server/client/dist/assets/app-DGFNtdpS.css +0 -1
- package/server/client/dist/assets/index-BEfKfbvr.js +0 -1
- package/server/client/dist/assets/manage-image-detail-BNYOCSmu.js +0 -1
- package/server/client/dist/assets/placeholder-C5fNzKrL.js +0 -34
- package/server/client/dist/assets/search-BmXuuK26.js +0 -1
- package/server/client/dist/assets/sortable.esm-DgSW3bAA.js +0 -5
- package/server/client/dist/assets/time-DI902Sxa.js +0 -361
- package/server/client/dist/assets/trash-GulvRh9f.js +0 -1
- package/server/client/dist/assets/useNoteMutate-xEIypxi5.js +0 -9
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as u,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{u as ke,a as re,K as Te,P as at,D as Ce,c as Se,b as At,d as Pt,C as Ae,s as rt,M as Vt,S as nt,h as Et,e as it,v as Dt}from"./sortable.esm-DgSW3bAA.js";import{g as Ft,m as lt,h as Mt,r as zt,j as Rt,u as Ot,k as It,l as Bt,n as ze,o as $t,p as Lt,q as Kt,t as Re,v as _t,w as qt,x as Wt,y as Ut}from"./app-CyQtGTtn.js";import{j as Qt,f as Pe,m as ot,a as ue,M as dt,u as Gt}from"./useNoteMutate-xEIypxi5.js";import{a3 as Yt,a4 as Oe,a5 as Zt,a6 as Ht,a7 as Jt,C as Xt,u as ct,q as W,W as es,e as ut,T as d,l as ce,B as $,c as ee,F as Ve,N as fe,K as Ee,m as mt,a8 as ts,k as ss,M as J,L as U,I as ve,a as Ie,b as de,J as Be,y as H,z as B,d as as,t as rs,P as ns,E as $e,h as is}from"./time-DI902Sxa.js";import{f as ls}from"./tag.api-BJ6eaHui.js";import{S as je}from"./SurfaceCard-D_OU_Oy6.js";import{V as Q}from"./ViewChip-D-Ax5PdL.js";import{N as De,V as os}from"./url-BvjSC8PU.js";import{s as ds}from"./ArrowRight.es-CD1IMhU2.js";import{s as cs}from"./CheckCircle.es-C7fkzE3t.js";import{n as we}from"./Plus.es-P9Fjwtud.js";import"./preload-helper-BXl3LOEh.js";var us=class extends Yt{constructor(t,s){super(t,s)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:Oe()})}getOptimisticResult(t){return t.behavior=Oe(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,s){const{state:a}=t,l=super.createResult(t,s),{isFetching:n,isRefetching:m,isError:x,isRefetchError:o}=l,v=a.fetchMeta?.fetchMore?.direction,j=x&&v==="forward",k=n&&v==="forward",p=x&&v==="backward",F=n&&v==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Ht(s,a.data),hasPreviousPage:Zt(s,a.data),isFetchNextPageError:j,isFetchingNextPage:k,isFetchPreviousPageError:p,isFetchingPreviousPage:F,isRefetchError:o&&!j&&!p,isRefetching:m&&!k&&!F}}};function ms(t,s){return Jt(t,us)}const ps=new Map([["bold",u.createElement(u.Fragment,null,u.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Z"}))],["duotone",u.createElement(u.Fragment,null,u.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),u.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"}))],["fill",u.createElement(u.Fragment,null,u.createElement("path",{d:"M232,128A104,104,0,1,1,128,24,104.13,104.13,0,0,1,232,128Z"}))],["light",u.createElement(u.Fragment,null,u.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Z"}))],["regular",u.createElement(u.Fragment,null,u.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"}))],["thin",u.createElement(u.Fragment,null,u.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Z"}))]]),pt=u.forwardRef((t,s)=>u.createElement(Xt,{ref:s,...t,weights:ps}));pt.displayName="CircleIcon";const hs=pt,me=6,Ne=["title","tags","properties","createdAt","updatedAt"],bs={activeTabId:null,tabs:[]},xs=t=>{const s=t.trim();return s?s.startsWith("@")?s:s.startsWith("#")?"":`@${s}`:""},ht=(t,s,a)=>{if(s===a)return t;const l=t.findIndex(o=>o.id===s),n=t.findIndex(o=>o.id===a);if(l<0||n<0)return t;const m=[...t],[x]=m.splice(l,1);return m.splice(n,0,x),m},bt=(t,s,a)=>{const l=t.findIndex(m=>m.id===s),n=l+(a==="previous"?-1:1);return l>=0&&n>=0&&n<t.length?t[n]?.id:void 0},Le=t=>{const s=t.flatMap(a=>typeof a=="string"?a.split(","):[]);return Array.from(new Set(s.map(xs).filter(Boolean)))},gs=t=>t.tabs.length===0?null:t.activeTabId?t.tabs.find(s=>s.id===t.activeTabId)??t.tabs[0]??null:t.tabs[0]??null,ys=(t,s)=>t.tabs.some(a=>a.id===s)?{...t,activeTabId:s}:t,xt=(t,s,a)=>({...t,tabs:ht(t.tabs,s,a)}),gt=(t,s,a,l)=>({...t,tabs:t.tabs.map(n=>n.id===s?{...n,sections:ht(n.sections,a,l)}:n)}),fs=(t,s,a)=>{const l=bt(t.tabs,s,a);return l?xt(t,s,l):t},vs=(t,s,a,l)=>{const n=t.tabs.find(x=>x.id===s)?.sections??[],m=bt(n,a,l);return m?gt(t,s,a,m):t},Ke=t=>t==="or"?"OR — any selected tag":"AND — all selected tags",js=t=>t==="or"?"OR":"AND",yt=t=>{switch(t){case"notEquals":return"is not";case"contains":return"contains";case"notContains":return"does not contain";case"before":return"before";case"after":return"after";case"exists":return"is set";case"notExists":return"is empty";default:return"is"}},ws=t=>{switch(t){case"table":return"Table";case"board":return"Board";case"calendar":return"Unavailable";default:return"List"}},ft=t=>{switch(t){case"tags":return"Tags";case"properties":return"Properties";case"createdAt":return"Created";case"updatedAt":return"Updated";default:return"Title"}},pe=t=>{const s=new Set(Ne),a=(t??[]).filter(n=>s.has(n)),l=Array.from(new Set(a));return l.length===0?[...Ne]:l.includes("title")?l:["title",...l]},Fe=t=>Array.from(new Set((t??[]).map(s=>s.trim()).filter(Boolean))).slice(0,me),vt=t=>({tableColumns:pe(t?.tableColumns),tablePropertyKeys:Fe(t?.tablePropertyKeys),boardGroupByPropertyKey:t?.boardGroupByPropertyKey?.trim()||null}),Ns=t=>{const s=yt(t.operator);return t.operator==="exists"||t.operator==="notExists"?`${t.name} ${s}`:`${t.name} ${s} ${t.value??""}`.trim()},ks=(t,s={})=>{const a={...t,...s};return{title:a.title,displayType:a.displayType,displayOptions:vt(a.displayOptions),tagNames:a.tagNames,mode:a.mode,propertyFilters:a.propertyFilters.map(l=>({key:l.key,valueType:l.valueType,operator:l.operator,value:l.value})),sortBy:a.sortBy,sortOrder:a.sortOrder,limit:a.limit}},jt="view-board-column:unassigned",Ts=t=>t===null?jt:`view-board-column:value:${encodeURIComponent(t)}`,Cs=t=>[...[...t].sort((s,a)=>s.order-a.order||s.label.localeCompare(a.label)).map(s=>({id:Ts(s.value),label:s.label,value:s.value,color:s.color??null})),{id:jt,label:"Unassigned",value:null,color:null}];function Ss({note:t,column:s,columns:a,isMoving:l,onMove:n}){const{attributes:m,listeners:x,setNodeRef:o,setActivatorNodeRef:v,transform:j,isDragging:k}=Pt({id:`view-board-note:${t.id}`,data:{note:t,sourceValue:s.value},disabled:l});return e.jsx("article",{ref:o,style:{transform:Ae.Translate.toString(j)},className:ee("group rounded-[14px] border border-border-subtle bg-elevated px-3 py-2.5 transition-[opacity,background-color,border-color] hover:border-border-secondary/80 hover:bg-hover-subtle/35",(k||l)&&"opacity-55",k&&"z-20 border-accent-primary/45 bg-elevated ring-2 ring-accent-primary/10"),children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("button",{type:"button",ref:v,"aria-label":`Drag ${t.title||"Untitled"} to another column`,...m,...x,className:"focus-ring-soft mt-0.5 hidden size-7 shrink-0 touch-none items-center justify-center rounded-[9px] text-fg-tertiary outline-none hover:bg-hover-subtle hover:text-fg-default sm:inline-flex",children:e.jsx(lt,{className:"size-3.5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(d,{as:"div",variant:"body",weight:"semibold",tracking:"tight",className:"leading-[1.4]",children:e.jsx(Ve,{to:De,params:{id:t.id},className:"line-clamp-2 transition-colors hover:text-fg-default/80",children:t.title||"Untitled"})}),e.jsxs(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-2",children:["Updated ",fe(Number(t.updatedAt))]})]}),e.jsx(Ee,{button:e.jsx(Pe,{label:`Move ${t.title||"Untitled"}`,size:"sm"}),items:a.filter(p=>p.value!==s.value).map(p=>({name:`Move to ${p.label}`,onClick:()=>n(t,s.value,p.value)}))})]})})}function As({section:t,groupProperty:s,column:a,columns:l,index:n,scrollRootRef:m,movingNoteIds:x,onMove:o,pageCount:v,onPageCountChange:j}){const k=u.useRef(null),[p,F]=u.useState(n<4),{isOver:h,setNodeRef:c}=At({id:a.id,data:{optionValue:a.value}});u.useEffect(()=>{if(p||!k.current)return;if(typeof IntersectionObserver>"u"){F(!0);return}const N=new IntersectionObserver(O=>{O.some(A=>A.isIntersecting)&&(F(!0),N.disconnect())},{root:m.current,rootMargin:"0px 320px",threshold:.01});return N.observe(k.current),()=>N.disconnect()},[m,p]);const{data:g,isPending:D,isError:E,refetch:V,fetchNextPage:S,hasNextPage:z,isFetchingNextPage:y,isFetchNextPageError:w}=ms({queryKey:W.views.sectionBoardColumnPages(t.id,s.key,a.value,t.limit),enabled:p,initialPageParam:0,async queryFn({pageParam:N}){const O=await Ft(t.id,{optionValue:a.value,limit:t.limit,offset:N});if(O.type==="error")throw O;return O.viewSectionBoardColumn},getNextPageParam(N,O){return O.reduce((L,G)=>L+G.notes.length,0)<N.totalCount?O.length*t.limit:void 0}}),T=u.useMemo(()=>Array.from(new Map((g?.pages??[]).flatMap(N=>N.notes).map(N=>[N.id,N])).values()),[g?.pages]),M=g?.pages[0]?.totalCount;u.useEffect(()=>{!p||!g||g.pages.length>=v||!z||y||w||S()},[g,S,z,w,y,v,p]),u.useEffect(()=>{if(M===void 0)return;const N=Math.max(1,Math.ceil(M/t.limit));v>N&&j(N)},[j,v,t.limit,M]);const R=N=>{k.current=N,c(N)};return e.jsxs("section",{ref:R,"aria-label":`${a.label} column`,className:ee("flex min-h-[248px] w-[17rem] shrink-0 flex-col rounded-[18px] border bg-subtle/30 transition-[border-color,background-color] sm:w-[18rem]",h?"border-accent-primary/50 bg-accent-primary/6":"border-border-subtle"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border-subtle/75 px-3.5 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"size-2.5 shrink-0 rounded-full border border-black/5",style:{backgroundColor:a.color??"var(--color-fg-tertiary)"},"aria-hidden":"true"}),e.jsx(d,{as:"h3",variant:"label",weight:"semibold",className:"truncate",children:a.label})]}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary","aria-label":M===void 0?"Card count loading":`${M} cards`,className:"inline-flex min-w-6 justify-center rounded-full bg-elevated px-2 py-0.5 tabular-nums",children:M??"–"})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2 p-2.5",children:[p?D&&!g?e.jsxs(e.Fragment,{children:[e.jsx(ce,{height:"76px",className:"rounded-[14px]"}),e.jsx(ce,{height:"76px",className:"rounded-[14px]"})]}):E?e.jsxs("div",{className:"rounded-[14px] border border-dashed border-border-subtle bg-elevated/60 p-3",children:[e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"Failed to load this column."}),e.jsx($,{type:"button",variant:"ghost",size:"sm",className:"mt-2",onClick:()=>{V()},children:"Retry"})]}):T.length===0?e.jsx("div",{className:"flex min-h-28 items-center justify-center rounded-[14px] border border-dashed border-border-subtle px-3 text-center",children:e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"Drop a note here"})}):T.map(N=>e.jsx(Ss,{note:N,column:a,columns:l,isMoving:x.has(N.id),onMove:o},N.id)):e.jsx("button",{type:"button",className:"focus-ring-soft flex min-h-28 items-center justify-center rounded-[14px] border border-dashed border-border-subtle px-3 text-sm text-fg-tertiary outline-none hover:bg-elevated",onClick:()=>F(!0),children:"Load cards"}),z?e.jsx($,{type:"button",variant:"ghost",size:"sm",className:"mt-auto w-full",disabled:y,onClick:()=>{w||j(v+1),S()},children:y?"Loading...":w?"Retry loading cards":`Load more (${Math.max(0,(M??0)-T.length)})`}):null]})]})}function Ps({section:t,groupProperty:s,navigationState:a={},onNavigationStateChange:l=()=>{}}){const n=ct(),m=ut(),x=u.useRef(null),[o,v]=u.useState(()=>new Set),j=u.useMemo(()=>Cs(s.options),[s.options]),k=ke(re(at,{activationConstraint:{distance:6}}),re(Te)),p=u.useCallback(async(h,c,g)=>{if(c===g||o.has(h.id))return;v(V=>new Set(V).add(h.id));const D=W.views.sectionBoardAll(t.id),E=n.getQueriesData({queryKey:D});for(const[V,S]of E){if(!S||!Array.isArray(S.pages))continue;const z=V[3];if(z?.groupPropertyKey!==s.key)continue;const y=z.optionValue===c,w=z.optionValue===g,T=z.pageSize??t.limit;let M=S.pages.flatMap(N=>N.notes).filter(N=>N.id!==h.id);w&&(M=[h,...M]);const R=Math.max(0,(S.pages[0]?.totalCount??0)-(y?1:0)+(w?1:0));n.setQueryData(V,{...S,pages:S.pages.map((N,O)=>({totalCount:R,notes:M.slice(O*T,(O+1)*T)}))})}try{const V=await es({id:h.id,expectedUpdatedAt:h.updatedAt,...g===null?{deleteKeys:[s.key]}:{set:[{key:s.key,name:s.name,value:g,valueType:"select"}]}});if(V.type==="error"){for(const[S,z]of E)n.setQueryData(S,z);m(V.errors[0]?.message??"Failed to move this note.");return}await Promise.all([Qt(n),n.invalidateQueries({queryKey:W.notes.propertyKeysAll(),exact:!1})])}catch{for(const[V,S]of E)n.setQueryData(V,S);m("Failed to move this note.")}finally{v(V=>{const S=new Set(V);return S.delete(h.id),S})}},[s.key,s.name,o,n,t.id,t.limit,m]),F=({active:h,over:c})=>{const g=h.data.current?.note,D=h.data.current?.sourceValue,E=c?.data.current?.optionValue;!g||D===void 0||E===void 0||p(g,D,E)};return e.jsx(Ce,{sensors:k,collisionDetection:Se,onDragEnd:F,children:e.jsx("div",{ref:x,"data-scroll-restoration-id":`view-board-${t.id}`,className:"overflow-x-auto overscroll-x-contain px-3 py-3.5 [scrollbar-gutter:stable] sm:px-4","aria-label":`Board grouped by ${s.name}`,children:e.jsx("div",{className:"flex min-w-max items-stretch gap-3 pb-1",children:j.map((h,c)=>e.jsx(As,{section:t,groupProperty:s,column:h,columns:j,index:c,scrollRootRef:x,movingNoteIds:o,pageCount:a.columns?.[h.id]??1,onPageCountChange:g=>l(D=>({...D,columns:{...D.columns,[h.id]:g}})),onMove:(g,D,E)=>{p(g,D,E)}},h.id))})})})}const Vs="group flex min-h-[72px] items-center justify-between gap-3 px-4 py-3 transition-colors hover:bg-hover-subtle",Es=t=>t.valueType==="select"?t.option?.label??t.value:t.valueType==="boolean"?t.value==="true"?"True":"False":t.value,Ds=t=>{const s=t.tags.slice(0,2),a=t.tags.length-s.length;return s.length===0?null:e.jsxs(e.Fragment,{children:[s.map(l=>e.jsx(Q,{size:"compact",className:"max-w-[116px] shrink-0 border-border-subtle bg-transparent text-fg-secondary",children:l.name},l.id)),a>0&&e.jsxs(Q,{size:"compact",className:"shrink-0 border-border-subtle bg-subtle text-fg-tertiary",children:["+",a]})]})},Fs=t=>{const s=t.properties??[],a=s.slice(0,2),l=s.length-a.length;return a.length===0?null:e.jsxs(e.Fragment,{children:[a.map(n=>e.jsxs(Q,{size:"compact",truncateContent:!1,className:"max-w-[220px] gap-1.5 border-border-subtle bg-subtle/55 text-fg-secondary",children:[n.valueType==="select"?e.jsx("span",{className:"size-2 shrink-0 rounded-full border border-black/5",style:{backgroundColor:n.option?.color??"var(--color-fg-tertiary)"},"aria-hidden":"true"}):null,e.jsx("span",{className:"max-w-[72px] shrink truncate text-fg-tertiary",children:n.name}),e.jsx("span",{className:"min-w-0 truncate",children:Es(n)||"—"})]},n.key)),l>0?e.jsxs(Q,{size:"compact",className:"shrink-0 border-border-subtle bg-subtle text-fg-tertiary",children:["+",l," properties"]}):null]})};function Ms({notes:t,isPending:s,isError:a,onRetry:l}){return s?e.jsxs("div",{className:"overflow-hidden bg-transparent",children:[e.jsx("div",{className:"h-[72px] animate-pulse bg-subtle/35"}),e.jsx("div",{className:"h-[72px] animate-pulse border-t border-border-subtle/70 bg-subtle/35"}),e.jsx("div",{className:"h-[72px] animate-pulse border-t border-border-subtle/70 bg-subtle/35"})]}):a?e.jsxs("div",{className:"rounded-[16px] border border-border-subtle bg-subtle/30 p-4",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"Failed to load this section"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry to refresh this saved query."}),e.jsx("div",{className:"mt-3",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:l,children:"Retry"})})]}):t.length===0?e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-5",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"No notes match yet"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add matching notes, or edit this view query."})]}):e.jsx("div",{className:"divide-y divide-border-subtle/70 bg-transparent",children:t.map(n=>e.jsxs(Ve,{to:De,params:{id:n.id},className:Vs,children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.pinned?e.jsx(ot,{className:"size-3.5 shrink-0 text-fg-tertiary",weight:"fill","aria-label":"Pinned"}):null,e.jsx(d,{as:"div",variant:"body",weight:"semibold",tracking:"tight",className:"line-clamp-1",children:n.title||"Untitled"})]}),e.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[Fs(n),Ds(n),e.jsxs(d,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"sm:hidden",children:["Updated ",fe(Number(n.updatedAt))]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2 pl-2",children:[e.jsx(d,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"hidden sm:inline",children:fe(Number(n.updatedAt))}),e.jsx(ds,{className:"size-4 text-fg-tertiary transition-transform group-hover:translate-x-0.5"})]})]},n.id))})}const zs={title:300,tags:200,createdAt:148,updatedAt:148},Rs={title:"title",createdAt:"createdAt",updatedAt:"updatedAt"},Os="flex h-[24px] min-w-0 max-w-full items-center gap-1.5 overflow-hidden whitespace-nowrap",wt="text-xs leading-5 text-fg-tertiary",Is=t=>mt(Number(t)).format("MMM D, YYYY"),Bs=t=>t==="text"||t==="url"?220:t==="date"?168:156,Nt=t=>t.kind==="property"?Bs(t.valueType):zs[t.key],$s=(t,s,a)=>{const l=new Map(a.map(o=>[o.key,o])),n=new Map(s.flatMap(o=>o.properties??[]).map(o=>[o.key,o])),m=Fe(t.displayOptions.tablePropertyKeys),x=Array.from(new Set([...t.propertyFilters.map(o=>o.key),...s.flatMap(o=>(o.properties??[]).map(v=>v.key))])).slice(0,3);return(m.length>0?m:x).flatMap(o=>{const v=l.get(o),j=n.get(o);return!v&&!j?[]:[{kind:"property",key:o,name:v?.name??j?.name??o,valueType:v?.valueType??j?.valueType??"text"}]})},Ls=(t,s,a)=>{const l=$s(t,s,a);return pe(t.displayOptions.tableColumns).reduce((n,m)=>(m==="properties"?n.push(...l):n.push({kind:"base",key:m}),n),[])},Ks=t=>t.reduce((s,a)=>s+Nt(a),0),_s=t=>{if(t.tags.length===0)return e.jsx("span",{className:wt,children:"—"});const s=t.tags.slice(0,3),a=t.tags.length-s.length;return e.jsxs("div",{className:Os,children:[s.map(l=>e.jsx(Q,{size:"compact",className:"max-w-[132px] shrink-0 border-border-subtle bg-transparent text-fg-secondary",children:l.name},l.id)),a>0?e.jsxs(Q,{size:"compact",className:"shrink-0 border-border-subtle bg-subtle text-fg-tertiary",children:["+",a]}):null]})},qs=t=>{if(!t)return e.jsx("span",{className:wt,children:"—"});if(t.valueType==="select")return e.jsx(Q,{size:"compact",className:"max-w-full border-border-subtle bg-subtle/65 text-fg-secondary",truncateContent:!1,children:e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"size-2 shrink-0 rounded-full border border-black/5",style:{backgroundColor:t.option?.color??"var(--color-fg-tertiary)"},"aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 truncate",children:t.option?.label??t.value})]})});if(t.valueType==="boolean"){const s=t.value==="true",a=s?cs:hs;return e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm text-fg-secondary",children:[e.jsx(a,{className:"size-3.5 text-fg-tertiary",weight:s?"fill":"regular"}),s?"True":"False"]})}return e.jsx("span",{className:ee("block truncate text-sm text-fg-secondary",t.valueType==="number"&&"tabular-nums"),title:t.value,children:t.value||"—"})};function Ws({section:t,notes:s,isPending:a,isError:l,onRetry:n,onSortChange:m,isSortPending:x,activeSortBy:o=t.sortBy,activeSortOrder:v=t.sortOrder,availableProperties:j=[],surface:k="flush"}){const p=Ls(t,s,j),F=Ks(p),h=k==="card"?"overflow-x-auto rounded-[16px] border border-border-subtle bg-elevated":"overflow-x-auto bg-transparent",c=k==="card"?"overflow-hidden rounded-[16px] border border-border-subtle bg-elevated":"overflow-hidden bg-transparent",g=k==="card"?"bg-elevated":"bg-transparent",D=k==="card"?"bg-subtle/65":"bg-subtle/45",E=k==="card"?"bg-elevated":"bg-transparent",V=k==="card"?"var(--elevated)":"var(--surface)",S=y=>{if(y.kind==="property")return e.jsxs("th",{className:"px-3 py-2 text-left",children:[e.jsx(d,{as:"p",variant:"label",weight:"semibold",className:"truncate",title:y.name,children:y.name}),e.jsx(d,{as:"p",variant:"micro",tone:"tertiary",className:"mt-0.5 capitalize",children:y.valueType})]},`property:${y.key}`);const w=Rs[y.key],T=ft(y.key),M=w?o===w:!1,R=y.key==="title";return e.jsx("th",{"aria-sort":M?v==="asc"?"ascending":"descending":void 0,className:ee("px-3 py-2.5 text-xs font-semibold text-fg-tertiary",R&&"lg:sticky lg:left-0 lg:z-20"),style:R?{background:`linear-gradient(var(--subtle), var(--subtle)), ${V}`}:void 0,children:w?e.jsxs("button",{type:"button",className:"focus-ring-soft -ml-1 inline-flex items-center gap-1 rounded-[8px] px-1 py-0.5 outline-none transition-colors hover:bg-hover-subtle hover:text-fg-secondary disabled:cursor-wait disabled:opacity-60",disabled:x,onClick:()=>m(w),children:[e.jsx("span",{children:T}),e.jsx("span",{"aria-hidden":"true",className:"text-[10px] text-fg-tertiary",children:M?v==="asc"?"↑":"↓":"↕"})]}):T},y.key)},z=(y,w)=>{if(w.kind==="property")return e.jsx("td",{className:"overflow-hidden px-3 py-2.5 align-middle transition-colors group-hover:bg-hover-subtle",children:qs(y.properties?.find(T=>T.key===w.key))},`property:${w.key}`);switch(w.key){case"tags":return e.jsx("td",{className:"overflow-hidden px-3 py-2.5 align-middle transition-colors group-hover:bg-hover-subtle",children:_s(y)},w.key);case"createdAt":case"updatedAt":{const T=w.key==="createdAt"?y.createdAt:y.updatedAt;return e.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 align-middle transition-colors group-hover:bg-hover-subtle",children:e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",title:mt(Number(T)).format("MMM D, YYYY h:mm A"),children:Is(T)})},w.key)}default:return e.jsxs("td",{className:"relative px-3 py-2.5 align-middle lg:sticky lg:left-0 lg:z-10",style:{background:V},children:[e.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 bg-hover-subtle opacity-0 transition-opacity group-hover:opacity-100"}),e.jsxs("div",{className:"relative z-10 flex min-w-0 items-center gap-2",children:[y.pinned?e.jsx(ot,{className:"size-3.5 shrink-0 text-fg-tertiary",weight:"fill","aria-label":"Pinned"}):null,e.jsx(d,{as:"div",variant:"body",weight:"semibold",className:"min-w-0 line-clamp-1",children:e.jsx(Ve,{to:De,params:{id:y.id},className:"focus-ring-soft rounded-[6px] outline-none transition-colors hover:text-fg-default/80",children:y.title||"Untitled"})})]})]},w.key)}};return a?e.jsxs("div",{className:c,children:[e.jsx("div",{className:"h-11 animate-pulse bg-subtle/50"}),e.jsx("div",{className:`h-14 animate-pulse border-t border-border-subtle ${g}`}),e.jsx("div",{className:`h-14 animate-pulse border-t border-border-subtle ${g}`}),e.jsx("div",{className:`h-14 animate-pulse border-t border-border-subtle ${g}`})]}):l?e.jsxs("div",{className:"rounded-[16px] border border-border-subtle bg-subtle/30 p-4",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"Failed to load this table"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry to refresh this saved query."}),e.jsx("div",{className:"mt-3",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:n,children:"Retry"})})]}):s.length===0?e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-5",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"No rows yet"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add matching notes, or edit this view query."})]}):e.jsx("div",{className:h,"data-scroll-restoration-id":`view-table-${t.id}`,"aria-label":"Scrollable view table",children:e.jsxs("table",{className:"w-full table-fixed border-collapse text-left",style:{minWidth:F},children:[e.jsx("caption",{className:"sr-only",children:"View query results as a table"}),e.jsx("colgroup",{children:p.map(y=>e.jsx("col",{style:{width:`${Nt(y)/F*100}%`}},y.kind==="property"?`property:${y.key}`:y.key))}),e.jsx("thead",{className:D,children:e.jsx("tr",{className:"border-b border-border-subtle",children:p.map(S)})}),e.jsx("tbody",{className:E,children:s.map(y=>e.jsx("tr",{className:"group h-12 border-b border-border-subtle/70 last:border-b-0",children:p.map(w=>z(y,w))},y.id))})]})})}function Us({onEdit:t}){return e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle bg-subtle/40 px-4 py-5",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"This display type is unavailable"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Switch this section to List, Table, or Board to show the saved query here."}),e.jsx("div",{className:"mt-3",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:t,children:"Change display"})})]})}function Qs({section:t,notes:s,isPending:a,isError:l,onRetry:n,onEdit:m,onSortChange:x,isSortPending:o,activeSortBy:v=t.sortBy,activeSortOrder:j=t.sortOrder,availableProperties:k=[],isPropertiesLoading:p=!1,navigationState:F={},onNavigationStateChange:h=()=>{}}){if(t.displayType==="board"){const c=k.find(g=>g.key===t.displayOptions.boardGroupByPropertyKey&&g.valueType==="select");return!c&&p?e.jsxs("div",{className:"flex gap-3 overflow-hidden px-4 py-3.5",children:[e.jsx("div",{className:"h-[248px] w-[18rem] shrink-0 animate-pulse rounded-[18px] bg-subtle/50"}),e.jsx("div",{className:"h-[248px] w-[18rem] shrink-0 animate-pulse rounded-[18px] bg-subtle/50"}),e.jsx("div",{className:"h-[248px] w-[18rem] shrink-0 animate-pulse rounded-[18px] bg-subtle/50"})]}):!c||c.options.length===0?e.jsxs("div",{className:"m-4 rounded-[16px] border border-dashed border-border-subtle bg-subtle/40 px-4 py-5",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"Board grouping is unavailable"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Choose an existing select property with options to restore this board."}),e.jsx("div",{className:"mt-3",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:m,children:"Edit board"})})]}):e.jsx(Ps,{section:t,groupProperty:c,navigationState:F,onNavigationStateChange:h})}return t.displayType==="table"?e.jsx(Ws,{section:t,notes:s,isPending:a,isError:l,onRetry:n,onSortChange:x,isSortPending:o,activeSortBy:v,activeSortOrder:j,availableProperties:k}):t.displayType==="calendar"?e.jsx(Us,{onEdit:m}):e.jsx(Ms,{notes:s,isPending:a,isError:l,onRetry:n})}function Gs({section:t,onEdit:s,onDuplicate:a,onDelete:l,onMoveUp:n,onMoveDown:m,dragHandle:x,availableProperties:o=[],isPropertiesLoading:v=!1,navigationState:j={},onNavigationStateChange:k=()=>{}}){const p=t.displayType==="board",F=j.page??1,h=(F-1)*t.limit,c=j.sort?.by??t.sortBy,g=j.sort?.order??t.sortOrder,{data:D,isPending:E,isError:V,isPlaceholderData:S,refetch:z}=ue({queryKey:W.views.sectionNotes(t.id,{limit:t.limit,offset:h,sortBy:c,sortOrder:g}),enabled:!p,placeholderData:ts,async queryFn(){const A=await Mt(t.id,{limit:t.limit,offset:h,sortBy:c,sortOrder:g});if(A.type==="error")throw A;return A.viewSectionNotes}}),y=D?.notes??[],w=D?.totalCount??0,T=Math.max(1,Math.ceil(w/t.limit)),M=js(t.mode),R=t.tagNames.length>0||t.propertyFilters.length>0,N=p?o.find(A=>A.key===t.displayOptions.boardGroupByPropertyKey):null,O=A=>{const L=c===A?g==="asc"?"desc":"asc":A==="title"?"asc":"desc";k(G=>({...G,page:1,sort:{by:A,order:L}}))};return u.useEffect(()=>{p||E||V||S||!D||F<=T||k(A=>({...A,page:T}))},[D,p,V,E,S,T,k,F]),e.jsxs(je,{flush:!0,className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border-subtle/75 px-4 py-3.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[x&&e.jsx("div",{className:"-mr-1 shrink-0 self-center",children:x}),e.jsx("div",{className:"min-w-0",children:e.jsx(d,{as:"h2",variant:"subheading",weight:"semibold",tracking:"tight",className:"min-w-0",children:e.jsx("span",{className:"truncate",children:t.title})})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[e.jsx(Q,{className:"max-w-full border-border-subtle/80 bg-elevated text-fg-secondary",children:ws(t.displayType)}),p&&t.displayOptions.boardGroupByPropertyKey?e.jsxs(Q,{className:"max-w-full border-border-subtle/80 bg-subtle text-fg-secondary",children:["Grouped by ",N?.name??t.displayOptions.boardGroupByPropertyKey]}):null,t.tagNames.map((A,L)=>e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[L>0&&e.jsx("span",{className:"px-0.5 text-[10px] font-semibold tracking-[0.08em] text-fg-tertiary/85",children:M}),e.jsx(Q,{className:"max-w-full border-border-subtle/80 bg-transparent text-fg-secondary",children:A})]},A)),t.propertyFilters.map(A=>e.jsx(Q,{className:"max-w-full border-border-subtle/80 bg-subtle text-fg-secondary",children:Ns(A)},`${A.key}-${A.operator}-${A.value??""}`)),!R&&e.jsx(Q,{className:"max-w-full border-border-subtle/80 bg-transparent text-fg-tertiary",children:"All notes"})]})]}),e.jsx(Ee,{button:e.jsx(Pe,{label:"Section actions"}),items:[...n?[{name:"Move up",onClick:n}]:[],...m?[{name:"Move down",onClick:m}]:[],...n||m?[{type:"separator"}]:[],{name:"Edit section",onClick:s},{name:"Duplicate section",onClick:a},{type:"separator"},{name:"Delete section",onClick:l}]})]}),e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsx(Qs,{section:t,notes:y,isPending:E,isError:V,onRetry:()=>{z()},onEdit:s,onSortChange:O,isSortPending:S,activeSortBy:c,activeSortOrder:g,availableProperties:o,isPropertiesLoading:v,navigationState:j,onNavigationStateChange:k})}),e.jsxs("div",{className:"flex flex-col gap-3 border-t border-border-subtle/75 px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:p?`${t.limit} cards per column load`:E||S?"Loading notes...":w===0?"No matching notes":`Showing ${h+1}–${Math.min(h+y.length,w)} of ${w} notes`}),!p&&T>1?e.jsx(ss,{page:Math.min(F,T),last:T,className:"!mt-0 shrink-0 sm:justify-end",onChange:A=>k(L=>({...L,page:A}))}):null]})]})}const xe="__choose_property__",ge="__choose_board_group__",Ys=["title","tags","properties","createdAt","updatedAt"],_e=t=>String(t?.limit??5),qe=t=>t?.displayType==="table"||t?.displayType==="board"?t.displayType:"list",We=t=>pe(t?.displayOptions?.tableColumns??Ne),Ue=t=>Fe(t?.displayOptions?.tablePropertyKeys),Qe=t=>t?.displayOptions?.boardGroupByPropertyKey??"",Ge=t=>t?.mode??"and",Ye=t=>t?t.tagNames.join(", "):"",Ze=t=>t?.title??"",He=t=>t?.sortBy??"updatedAt",Je=t=>t?.sortOrder??"desc",kt=t=>`property-filter-${Date.now()}-${t}`,Xe=t=>(t?.propertyFilters??[]).map((s,a)=>({id:kt(a),key:s.key,operator:s.operator,value:s.value??""})),et=t=>t?t.valueType==="date"||t.valueType==="number"?["equals","notEquals","before","after","exists","notExists"]:t.valueType==="text"||t.valueType==="url"?["equals","notEquals","contains","notContains","exists","notExists"]:["equals","notEquals","exists","notExists"]:["exists","notExists"],tt=t=>t?"equals":"exists",Zs=t=>t?t.valueType==="boolean"?"true":t.valueType==="select"?t.options[0]?.value??"":"":"",ye=t=>t!=="exists"&&t!=="notExists",Tt=t=>t==="contains"||t==="notContains",Hs=(t,s)=>t.valueType==="date"?"date":t.valueType==="number"?"number":t.valueType==="url"&&!Tt(s)?"url":"text",Js=(t,s)=>{if(t.valueType==="url")return Tt(s)?"example.com":"https://example.com";if(t.valueType==="text")return"Value"};function Xs({open:t,mode:s,initialSection:a=null,availableTags:l,availableProperties:n,isTagsLoading:m=!1,isPropertiesLoading:x=!1,onClose:o,onSubmit:v}){const[j,k]=u.useState(Ze(a)),[p,F]=u.useState(qe(a)),[h,c]=u.useState(We(a)),[g,D]=u.useState(Ue(a)),[E,V]=u.useState(Qe(a)),[S,z]=u.useState(Ye(a)),[y,w]=u.useState(Ge(a)),[T,M]=u.useState(He(a)),[R,N]=u.useState(Je(a)),[O,A]=u.useState(_e(a)),[L,G]=u.useState(Xe(a)),[he,te]=u.useState((a?.tagNames.length??0)>0),[ne,I]=u.useState(""),X=u.useMemo(()=>new Map(n.map(r=>[r.key,r])),[n]);u.useEffect(()=>{t&&(k(Ze(a)),F(qe(a)),c(We(a)),D(Ue(a)),V(Qe(a)),z(Ye(a)),w(Ge(a)),M(He(a)),N(Je(a)),A(_e(a)),G(Xe(a)),te((a?.tagNames.length??0)>0),I(""))},[a,t]);const Y=Le([S]),se=he||Y.length>0,be=Y.length===0&&L.length===0,ae=n.filter(r=>r.valueType==="select"&&r.options.length>0),i=r=>{r!=="title"&&(c(f=>{if(f.includes(r)){const _=f.filter(C=>C!==r);return _.length>0?_:f}return pe([...f,r])}),I(""))},b=r=>{D(f=>f.includes(r)?f.filter(_=>_!==r):f.length>=me?f:[...f,r])},P=r=>{const f=Y.includes(r)?Y.filter(_=>_!==r):[...Y,r];z(f.join(", ")),I("")},K=()=>{te(!0),I("")},ie=()=>{z(""),w("and"),te(!1),I("")},Ct=()=>{if(n.length===0){I("Create a shared property before adding a filter.");return}G(r=>[...r,{id:kt(r.length),key:"",operator:"exists",value:""}]),I("")},le=(r,f)=>{G(_=>_.map(C=>{if(C.id!==r)return C;const Z={...C,...f},oe=X.get(Z.key);return et(oe).includes(Z.operator)||(Z.operator=tt(oe)),"key"in f&&(Z.value=Zs(oe),Z.operator=tt(oe)),Z})),I("")},St=r=>{G(f=>f.filter(_=>_.id!==r)),I("")};return e.jsxs(J,{isOpen:t,onClose:o,variant:"form",className:"sm:max-w-[720px]",children:[e.jsx(J.Header,{title:s==="create"?"Create section":"Edit section",onClose:o}),e.jsx(J.Body,{children:e.jsxs("form",{id:"view-section-form",className:"flex flex-col gap-5",onSubmit:r=>{r.preventDefault();const f=Le([S]);if(se&&f.length===0){I("Choose at least one tag, or remove this tag filter.");return}if(L.find(q=>!q.key||!X.has(q.key))){I("Choose a property for every filter.");return}const C=X.get(E);if(p==="board"&&(!C||C.valueType!=="select"||C.options.length===0)){I("Choose a select property with at least one option for the board columns.");return}if(p==="board"&&L.some(q=>q.key===E)){I("Use different properties for the board columns and the section filter.");return}const Z=L.map(q=>{const Me=X.get(q.key);return{key:Me?.key??q.key,valueType:Me?.valueType??"text",operator:q.operator,value:ye(q.operator)?q.value:null}});if(Z.some(q=>ye(q.operator)&&!q.value?.trim())){I("Fill every filter value, or switch it to is set / is empty.");return}v({title:j,displayType:p,displayOptions:vt({tableColumns:h,tablePropertyKeys:g,boardGroupByPropertyKey:E}),tagNames:f,mode:y,propertyFilters:Z,sortBy:T,sortOrder:R,limit:Number(O)})},children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{htmlFor:"view-section-title",size:"md",children:"Section name"}),e.jsx(ve,{id:"view-section-title",value:j,onChange:r=>k(r.target.value),placeholder:"Doing notes",autoFocus:!0})]}),e.jsxs("section",{className:"flex flex-col gap-3 border-b border-border-subtle pb-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(U,{size:"md",children:"Display"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Show the same note set as a list, table, or property board."})]}),e.jsxs(Ie,{type:"single",value:p,onValueChange:r=>{(r==="list"||r==="table"||r==="board")&&(F(r),r==="board"&&!ae.some(f=>f.key===E)&&V(ae[0]?.key??""),I(""))},variant:"quiet",size:"sm",className:"self-start",children:[e.jsx(de,{value:"list","aria-label":"Show as list",children:"List"}),e.jsx(de,{value:"table","aria-label":"Show as table",children:"Table"}),e.jsx(de,{value:"board","aria-label":"Show as board",children:"Board"})]}),p==="table"?e.jsxs("div",{className:"border-t border-border-subtle/80 pt-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx(U,{size:"sm",children:"Table columns"}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",children:h.includes("properties")&&g.length===0?"Properties automatic":`${h.length-(h.includes("properties")?1:0)+(h.includes("properties")?g.length:0)} shown`})]}),e.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2",children:Ys.map(r=>{const f=ft(r);return e.jsxs("div",{className:"flex items-center gap-2 px-1 py-2",children:[e.jsx(Be,{size:"sm",checked:h.includes(r),disabled:r==="title","aria-label":`Show ${f} column`,onChange:()=>i(r)}),e.jsx(d,{as:"span",variant:"label",tone:"secondary",children:f})]},r)})}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-2",children:"Title is always shown because it opens the note."}),h.includes("properties")?e.jsxs("div",{className:"mt-3 border-t border-border-subtle/80 pt-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx(d,{as:"p",variant:"label",weight:"semibold",children:"Property columns"}),e.jsxs(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-0.5",children:["Select up to ",me," properties to compare."]})]}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",children:g.length>0?`${g.length} selected`:"Automatic"})]}),n.length>0?e.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2",children:n.map(r=>{const f=g.includes(r.key),_=g.length>=me;return e.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-1 py-2",children:[e.jsx(Be,{size:"sm",checked:f,disabled:!f&&_,"aria-label":`Show ${r.name} property column`,onChange:()=>b(r.key)}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(d,{as:"p",variant:"label",tone:"secondary",truncate:!0,children:r.name}),e.jsx(d,{as:"p",variant:"micro",tone:"tertiary",children:r.valueType})]})]},r.key)})}):e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-3",children:"Shared properties will appear here after you create them."}),g.length===0&&n.length>0?e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-2",children:"Automatic mode shows up to three properties relevant to the current notes."}):null]}):null]}):null,p==="board"?e.jsx("div",{className:"border-t border-border-subtle/80 pt-3",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{id:"view-section-board-group-label",htmlFor:"view-section-board-group",size:"sm",children:"Board columns"}),e.jsxs(H,{id:"view-section-board-group",value:E||ge,"aria-labelledby":"view-section-board-group-label",className:"w-full",onValueChange:r=>{r!==ge&&(V(r),I(""))},children:[e.jsx(B,{value:ge,disabled:!0,children:"Choose a select property"}),ae.map(r=>e.jsxs(B,{value:r.key,children:[r.name," · ",r.options.length," columns"]},r.key))]}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"Moving a card changes this property. Notes without a value stay in Unassigned."}),ae.length===0&&!x?e.jsx(d,{as:"p",variant:"meta",className:"text-fg-error",children:"Create a shared select property with options before using a board."}):null]})}):null]}),e.jsxs("section",{className:"flex flex-col gap-3 border-b border-border-subtle pb-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(U,{size:"md",children:"Filters"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Use properties for structured fields, and tags for loose topics or context."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx($,{type:"button",variant:"subtle",size:"sm",onClick:Ct,children:"Add property filter"}),!se&&e.jsx($,{type:"button",variant:"subtle",size:"sm",onClick:K,children:"Add tag filter"})]})]}),L.length===0&&!se?e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle bg-elevated/60 px-4 py-3",children:[e.jsx(d,{as:"p",variant:"label",tone:"default",children:be?"All notes":"No filters"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add a property filter, a tag filter, or leave this view open to all notes."})]}):null,L.length>0?e.jsx("div",{className:"flex flex-col gap-2.5",children:L.map(r=>{const f=X.get(r.key),_=et(f);return e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-border-subtle bg-elevated p-3 md:grid-cols-[minmax(0,1fr)_minmax(10.5rem,12rem)_minmax(0,1fr)_auto] md:items-center",children:[e.jsxs(H,{value:r.key||xe,ariaLabel:"Property filter property",className:"w-full min-w-0",onValueChange:C=>{C!==xe&&le(r.id,{key:C})},children:[e.jsx(B,{value:xe,disabled:!0,children:"Choose property"}),n.map(C=>e.jsx(B,{value:C.key,children:C.name},C.key))]}),e.jsx(H,{value:r.operator,disabled:!f,ariaLabel:"Property filter operator",className:"w-full min-w-0",onValueChange:C=>le(r.id,{operator:C}),children:_.map(C=>e.jsx(B,{value:C,children:yt(C)},C))}),ye(r.operator)&&f?f.valueType==="select"?e.jsx(H,{value:r.value,ariaLabel:"Property filter value",className:"w-full min-w-0",onValueChange:C=>le(r.id,{value:C}),children:f.options.map(C=>e.jsx(B,{value:C.value,children:C.label},C.value))}):f.valueType==="boolean"?e.jsxs(H,{value:r.value||"true",ariaLabel:"Property filter value",className:"w-full min-w-0",onValueChange:C=>le(r.id,{value:C}),children:[e.jsx(B,{value:"true",children:"True"}),e.jsx(B,{value:"false",children:"False"})]}):e.jsx(ve,{type:Hs(f,r.operator),value:r.value,onChange:C=>le(r.id,{value:C.target.value}),placeholder:Js(f,r.operator),"aria-label":"Property filter value"}):e.jsx(d,{as:"span",variant:"label",tone:"tertiary",children:f?"No value needed":"Choose a property first"}),e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:()=>St(r.id),children:"Remove"})]},r.id)})}):null,se?e.jsxs("div",{className:"flex flex-col gap-3 rounded-[16px] border border-border-subtle bg-elevated p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(d,{as:"p",variant:"label",tone:"default",children:"Tag filter"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Match notes by selected tags."})]}),e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:ie,children:"Remove"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{htmlFor:"view-section-tags",size:"sm",children:"Tag names"}),e.jsx(as,{id:"view-section-tags",value:S,onChange:r=>{z(r.target.value),I("")},placeholder:"@OceanBrain, @todo",size:"sm"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"You can use tags only, properties only, both together, or no filters."})]}),Y.length>1?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{size:"sm",children:"Tag match"}),e.jsxs(Ie,{type:"single",value:y,onValueChange:r=>{(r==="and"||r==="or")&&w(r)},variant:"quiet",size:"sm",className:"self-start",children:[e.jsx(de,{value:"and","aria-label":Ke("and"),children:"AND"}),e.jsx(de,{value:"or","aria-label":Ke("or"),children:"OR"})]}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"AND requires every selected tag. OR accepts any selected tag."})]}):null,e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(U,{size:"sm",children:"Existing tags"}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",children:m?"Loading...":`${l.length} available`})]}),l.length>0?e.jsx("div",{className:"max-h-44 overflow-y-auto rounded-[16px] border border-border-subtle bg-hover-subtle/60 p-3",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(r=>{const f=Y.includes(r.name);return e.jsx("button",{type:"button",className:`inline-flex items-center rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${f?"border-border-secondary bg-elevated text-fg-default":"border-border-subtle bg-transparent text-fg-secondary hover:border-border-secondary hover:bg-elevated hover:text-fg-default"}`,"aria-pressed":f,onClick:()=>P(r.name),children:r.name},r.id)})})}):e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"No tags yet. You can still type tag names manually."})]}):null,e.jsx(d,{as:"p",variant:"meta",tone:ne?"default":"tertiary",className:ne?"text-fg-error":void 0,children:ne||(x||m?"Loading filter options...":`${n.length} properties · ${l.length} tags available`)})]}),e.jsxs("details",{className:"group pb-1",children:[e.jsx("summary",{className:"cursor-pointer list-none",children:e.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-1",children:[e.jsx(d,{as:"span",variant:"label",tone:"default",children:"Sort and page size"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"col-start-1 row-start-2",children:p==="board"?"Controls how many cards each board column loads at a time.":"Controls how many matching notes appear on each section page."}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",className:"col-start-2 row-span-2 row-start-1 whitespace-nowrap",children:p==="board"?`${O} per column`:`${O} notes`})]})}),e.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{id:"view-section-sort-by-label",htmlFor:"view-section-sort-by",size:"sm",children:"Sort by"}),e.jsxs(H,{id:"view-section-sort-by",value:T,"aria-labelledby":"view-section-sort-by-label",onValueChange:r=>M(r),children:[e.jsx(B,{value:"updatedAt",children:"Updated time"}),e.jsx(B,{value:"createdAt",children:"Created time"}),e.jsx(B,{value:"title",children:"Title"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{id:"view-section-sort-order-label",htmlFor:"view-section-sort-order",size:"sm",children:"Order"}),e.jsxs(H,{id:"view-section-sort-order",value:R,"aria-labelledby":"view-section-sort-order-label",onValueChange:r=>N(r),children:[e.jsx(B,{value:"desc",children:"Descending"}),e.jsx(B,{value:"asc",children:"Ascending"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{id:"view-section-limit-label",htmlFor:"view-section-limit",size:"sm",children:p==="board"?"Cards per load":"Rows per page"}),e.jsxs(H,{id:"view-section-limit",value:O,"aria-labelledby":"view-section-limit-label",onValueChange:A,children:[e.jsxs(B,{value:"3",children:["3 ",p==="board"?"cards":"rows"]}),e.jsxs(B,{value:"5",children:["5 ",p==="board"?"cards":"rows"]}),e.jsxs(B,{value:"8",children:["8 ",p==="board"?"cards":"rows"]}),e.jsxs(B,{value:"10",children:["10 ",p==="board"?"cards":"rows"]}),e.jsxs(B,{value:"12",children:["12 ",p==="board"?"cards":"rows"]})]})]})]})]})]})}),e.jsx(J.Footer,{children:e.jsxs(dt,{children:[e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:o,children:"Cancel"}),e.jsx($,{type:"submit",size:"sm",form:"view-section-form",children:s==="create"?"Create section":"Save section"})]})})]})}const ea="group flex h-10 max-w-[72vw] shrink-0 items-center rounded-[12px] border transition-[background-color,border-color,color,box-shadow] sm:max-w-[176px]",ta="focus-ring-soft inline-flex h-full min-w-0 flex-1 touch-pan-x items-center gap-1 rounded-[11px] px-3 text-[13px] font-medium outline-none transition-colors";function sa({tab:t,isActive:s,onSelect:a}){const{attributes:l,listeners:n,setNodeRef:m,setActivatorNodeRef:x,transform:o,transition:v,isDragging:j}=it({id:t.id});return e.jsx("div",{ref:m,style:{transform:Ae.Translate.toString(o),transition:v,opacity:j?.6:1},className:ee(ea,s?"border-border-secondary/80 bg-elevated text-fg-default shadow-[0_8px_18px_-18px_rgba(15,18,24,0.28)]":"border-transparent bg-transparent text-fg-secondary hover:border-border-subtle/80 hover:bg-hover-subtle hover:text-fg-default"),children:e.jsxs("button",{type:"button",ref:x,...l,...n,role:"tab","aria-selected":s,title:`${t.title}. Drag to reorder.`,className:ee(ta,s?"text-fg-default":"text-fg-secondary group-hover:text-fg-default",j?"cursor-grabbing":"cursor-pointer"),onClick:a,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.title}),e.jsx("span",{className:"inline-flex min-w-4 shrink-0 items-center justify-center rounded-full bg-hover-subtle/75 px-1 py-0 text-[10px] leading-4 text-current/70",children:t.sections.length})]})})}function aa({tabs:t,activeTabId:s,onSelectTab:a,onReorderTabs:l,onCreateTab:n}){const m=ke(re(Vt,{activationConstraint:{distance:8}}),re(Te,{coordinateGetter:rt}));return e.jsx("div",{className:"-mx-1 rounded-[16px] border border-border-subtle/75 bg-subtle/50 p-1 sm:mx-0",children:e.jsx(Ce,{sensors:m,collisionDetection:Se,modifiers:[zt],autoScroll:!1,onDragEnd:x=>{l(x)},children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(nt,{items:t.map(x=>x.id),strategy:Et,children:e.jsx("div",{role:"tablist","aria-label":"Views tab list",className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden",children:t.map(x=>e.jsx(sa,{tab:x,isActive:x.id===s,onSelect:()=>{a(x)}},x.id))})}),e.jsxs($,{type:"button","aria-label":"New view tab",variant:"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-[12px] border-transparent bg-transparent px-0 text-[13px] text-fg-secondary hover:border-border-subtle/80 hover:bg-hover-subtle hover:text-fg-default sm:w-auto sm:px-2.5",onClick:n,children:[e.jsx(we,{className:"h-5 w-5 shrink-0"}),e.jsx("span",{className:"hidden sm:inline",children:"New view tab"})]})]})})})}function ra({open:t,mode:s,initialTitle:a="",onClose:l,onSubmit:n}){const[m,x]=u.useState(a);return u.useEffect(()=>{t&&x(a)},[a,t]),e.jsxs(J,{isOpen:t,onClose:l,variant:"form",className:"sm:max-w-[480px]",children:[e.jsx(J.Header,{title:s==="create"?"Create view tab":"Rename view tab",onClose:l}),e.jsx(J.Body,{children:e.jsxs("form",{id:"view-tab-form",className:"flex flex-col gap-4",onSubmit:o=>{o.preventDefault(),n(m)},children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{htmlFor:"view-tab-title",size:"md",children:"Tab name"}),e.jsx(ve,{id:"view-tab-title",value:m,onChange:o=>x(o.target.value),placeholder:"Now",autoFocus:!0})]}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"Each tab is one saved view inside the Views page."})]})}),e.jsx(J.Footer,{children:e.jsxs(dt,{children:[e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:l,children:"Cancel"}),e.jsx($,{type:"submit",size:"sm",form:"view-tab-form",children:s==="create"?"Create tab":"Save tab"})]})})]})}const st=is(os),na="Save reusable note queries with tags, shared properties, and sorting.",ia="focus-ring-soft hidden h-8 w-8 items-center justify-center rounded-[10px] text-fg-default/70 outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default sm:inline-flex touch-none",la=({section:t,availableProperties:s,isPropertiesLoading:a,onEdit:l,onDuplicate:n,onDelete:m,onMoveUp:x,onMoveDown:o,navigationState:v,onNavigationStateChange:j})=>{const{attributes:k,listeners:p,setNodeRef:F,setActivatorNodeRef:h,transform:c,transition:g,isDragging:D}=it({id:t.id}),E=u.useCallback(V=>j(t.id,V),[j,t.id]);return e.jsx("div",{ref:F,style:{transform:Ae.Translate.toString(c),transition:g,opacity:D?.6:1},children:e.jsx(Gs,{section:t,availableProperties:s,isPropertiesLoading:a,onEdit:l,onDuplicate:n,onDelete:m,onMoveUp:x,onMoveDown:o,navigationState:v,onNavigationStateChange:E,dragHandle:e.jsx("button",{type:"button",ref:h,"aria-label":`Reorder section ${t.title}`,...k,...p,className:ee(ia,D?"cursor-grabbing":"cursor-grab"),children:e.jsx(lt,{className:"size-4"})})})})};function ja(){const t=Gt(),s=ut(),a=ct(),l=st.useSearch(),n=st.useNavigate(),[m,x]=u.useState(null),[o,v]=u.useState(null),{data:j,isPending:k,isError:p,refetch:F}=ue({queryKey:W.views.workspace(),async queryFn(){const i=await Rt();if(i.type==="error")throw i;return i.viewWorkspace}}),h=j??bs,c=h.tabs.find(i=>i.id===l.tab)??gs(h),g=c?h.tabs.findIndex(i=>i.id===c.id):-1,{data:D,isPending:E}=ue({queryKey:W.tags.list({limit:200}),async queryFn(){const i=await ls({limit:200});if(i.type==="error")throw i;return i.allTags}}),V=ke(re(at,{activationConstraint:{distance:8}}),re(Te,{coordinateGetter:rt})),S=D?.tags??[],{data:z,isPending:y}=ue({queryKey:W.notes.propertyKeys({limit:100}),async queryFn(){const i=await rs({limit:100});if(i.type==="error")throw i;return i.notePropertyKeys}}),w=z?.keys??[],T=i=>{a.setQueryData(W.views.workspace(),i)},M=u.useCallback((i,b)=>{n({search:P=>({...P,state:Ot(P.state,i,b)}),replace:!0,resetScroll:!1})},[n]),R=async()=>{await a.invalidateQueries({queryKey:W.views.all(),exact:!1})},N=async(i,b)=>{T(b);const P=await Wt(b.tabs.map(K=>K.id));if(P.type==="error"){T(i),s(P.errors[0].message);return}await R()},O=async({active:i,over:b})=>{if(!b||i.id===b.id)return;const P=a.getQueryData(W.views.workspace())??h,K=xt(P,String(i.id),String(b.id));await N(P,K)},A=async i=>{if(!c)return;const b=a.getQueryData(W.views.workspace())??h,P=fs(b,c.id,i);P!==b&&await N(b,P)},L=async i=>{const b=a.getQueryData(W.views.workspace())??h,P=l,K=ys(b,i.id);T(K),await n({search:{tab:i.id,state:void 0},resetScroll:!1});const ie=await ze(i.id);if(ie.type==="error"){T(b),await n({search:P,replace:!0,resetScroll:!1}),s(ie.errors[0].message);return}T(ie.setActiveViewTab)},G=async(i,b)=>{if(!c)return;T(b);const P=await Ut(c.id,b.tabs.find(K=>K.id===c.id)?.sections.map(K=>K.id)??[]);if(P.type==="error"){T(i),s(P.errors[0].message);return}await R()},he=async({active:i,over:b})=>{if(!c||!b||i.id===b.id)return;const P=a.getQueryData(W.views.workspace())??h,K=gt(P,c.id,String(i.id),String(b.id));await G(P,K)},te=async(i,b)=>{if(!c)return;const P=a.getQueryData(W.views.workspace())??h,K=vs(P,c.id,i,b);K!==P&&await G(P,K)},ne=async i=>{const b=await $t(i);if(b.type==="error"){s(b.errors[0].message);return}const P=await ze(b.createViewTab.id);P.type==="success"?T(P.setActiveViewTab):s(P.errors[0].message),await R(),await n({search:{tab:b.createViewTab.id,state:void 0},resetScroll:!1}),x(null)},I=async i=>{if(!c)return;const b=await Lt(c.id,i);if(b.type==="error"){s(b.errors[0].message);return}await R(),x(null)},X=async()=>{if(!c||!await t("Delete this view tab and all of its sections?"))return;const i=await Kt(c.id);if(i.type==="error"){s(i.errors[0].message);return}await R(),await n({search:{tab:void 0,state:void 0},replace:!0,resetScroll:!1})},Y=async i=>{if(!c)return;const b=await Re(c.id,i);if(b.type==="error"){s(b.errors[0].message);return}await R(),v(null)},se=async i=>{if(!c||!o||o.mode!=="edit")return;const b=await _t(o.section.id,i);if(b.type==="error"){s(b.errors[0].message);return}M(o.section.id,{}),await R(),v(null)},be=async i=>{const b=await Re(i.tabId,{...ks(i),title:`${i.title} copy`});if(b.type==="error"){s(b.errors[0].message);return}await R(),s("Section duplicated.")},ae=async i=>{if(!c||!await t("Delete this section from the current view tab?"))return;const b=await qt(i);if(b.type==="error"){s(b.errors[0].message);return}M(i,{}),await R()};return e.jsxs(e.Fragment,{children:[e.jsx(ns,{title:"Views",description:na,children:k&&!j?e.jsx(je,{className:"px-6 py-8 sm:px-8 sm:py-10",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(ce,{height:20,width:180,className:"rounded-full"}),e.jsx(ce,{height:16,width:260,className:"rounded-full"}),e.jsx(ce,{height:44,width:140,className:"rounded-[12px]"})]})}):p?e.jsxs(je,{className:"px-6 py-8 sm:px-8 sm:py-10",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"Failed to load saved views"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry loading your saved view tabs."}),e.jsx("div",{className:"mt-4",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:()=>{F()},children:"Retry"})})]}):h.tabs.length===0?e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx($e,{title:"Create your first view tab",description:"Start with a saved view tab, then add sections that query notes by tags, properties, or both.",className:"h-[320px]"}),e.jsx("div",{className:"flex justify-center",children:e.jsxs($,{type:"button",onClick:()=>x({mode:"create"}),children:[e.jsx(we,{className:"h-4 w-4"}),"Create first tab"]})})]}):e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx(aa,{tabs:h.tabs,activeTabId:c?.id??null,onSelectTab:L,onReorderTabs:O,onCreateTab:()=>x({mode:"create"})}),c&&e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-3 border-b border-border-subtle/80 px-1 pb-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(d,{as:"h2",variant:"subheading",weight:"semibold",tracking:"tight",truncate:!0,children:c.title}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:c.sections.length>0?`${c.sections.length} section${c.sections.length===1?"":"s"} in this view`:"Add sections to build this view"})]}),e.jsxs("div",{className:"inline-flex flex-wrap items-center gap-2 self-start sm:self-center",children:[e.jsxs($,{type:"button",size:"sm",onClick:()=>v({mode:"create"}),children:[e.jsx(we,{className:"h-4 w-4"}),"Add section"]}),e.jsx(Ee,{button:e.jsx(Pe,{label:"View tab actions"}),items:[...g>0?[{name:"Move tab left",onClick:()=>{A("previous")}}]:[],...g>=0&&g<h.tabs.length-1?[{name:"Move tab right",onClick:()=>{A("next")}}]:[],...h.tabs.length>1?[{type:"separator"}]:[],{name:"Rename tab",onClick:()=>x({mode:"edit",tab:c})},{type:"separator"},{name:"Delete tab",onClick:()=>{X()}}]})]})]}),c.sections.length===0?e.jsx($e,{title:"Add the first section to this tab",description:"Sections can pull notes by tags, properties, or both.",className:"h-[300px]"}):e.jsx("div",{className:"flex flex-col",children:e.jsx(Ce,{sensors:V,collisionDetection:Se,modifiers:[It],onDragEnd:he,children:e.jsx(nt,{items:c.sections.map(i=>i.id),strategy:Dt,children:e.jsx("div",{className:"flex flex-col gap-4",children:c.sections.map((i,b)=>e.jsx(la,{section:i,availableProperties:w,isPropertiesLoading:y,navigationState:Bt(l.state,i.id),onNavigationStateChange:M,onEdit:()=>v({mode:"edit",section:i}),onDuplicate:()=>{be(i)},onDelete:()=>{ae(i.id)},onMoveUp:b>0?()=>{te(i.id,"previous")}:void 0,onMoveDown:b<c.sections.length-1?()=>{te(i.id,"next")}:void 0},i.id))})})})})]})]})}),e.jsx(ra,{open:m!==null,mode:m?.mode??"create",initialTitle:m?.mode==="edit"?m.tab.title:"",onClose:()=>x(null),onSubmit:i=>{if(m?.mode==="edit"){I(i);return}ne(i)}}),e.jsx(Xs,{open:o!==null,mode:o?.mode??"create",initialSection:o?.mode==="edit"?o.section:null,availableTags:S,availableProperties:w,isTagsLoading:E,isPropertiesLoading:y,onClose:()=>v(null),onSubmit:i=>{if(o?.mode==="edit"){se(i);return}Y(i)}})]})}export{ja as default};
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Calendar-6otw_EJn.js","assets/floating-ui.react-dom-BWTnA00G.js","assets/time-DI902Sxa.js","assets/url-BvjSC8PU.js","assets/useNoteMutate-xEIypxi5.js","assets/Callout-C1QiCWCa.js","assets/preload-helper-BXl3LOEh.js","assets/sortable.esm-DgSW3bAA.js","assets/Views-CL7rC05G.js","assets/tag.api-BJ6eaHui.js","assets/SurfaceCard-D_OU_Oy6.js","assets/ViewChip-D-Ax5PdL.js","assets/ArrowRight.es-CD1IMhU2.js","assets/CheckCircle.es-C7fkzE3t.js","assets/Plus.es-P9Fjwtud.js","assets/Reminders-DKm0GFI2.js","assets/useReminderMutate-kTBRSjYc.js","assets/Graph-BHsmPDPh.js","assets/transform-BUB79_za.js","assets/isObject-U9U2HXiq.js","assets/toNumber-DE3J3kMD.js","assets/ordinal-Cboi1Yqb.js","assets/init-Gi6I4Gst.js","assets/colors-Cc3OSVma.js","assets/min-tv6RD-6E.js","assets/FlowArrow.es-CAIThqWk.js","assets/Search-DVROxY_B.js","assets/AuxiliaryPanelHeader-zoJGsYWR.js","assets/search-admin-adapter-Dj0KKKrJ.js","assets/File.es-CcjtzE38.js","assets/Tag-wMHTRwlF.js","assets/Note-Dq2Szaxd.js","assets/NotePropertiesPanel-Cu3RgDic.js","assets/note-ui-CYsZc3DI.js","assets/note-core-DUTqUh5N.js","assets/note-runtime-zN5ddTba.js","assets/note-ui-DL8owV-U.css","assets/image.api-CtfyPwkV.js","assets/Copy.es-D6rl6b78.js","assets/TagNotes-BRza6i14.js","assets/index-BEfKfbvr.js","assets/mcp-admin-adapter-Cw6w5mfg.js","assets/Image.es-BDpo5R66.js","assets/Trash.es-BeR1sZMe.js","assets/mcp-B-aGeAQD.js","assets/search-BmXuuK26.js","assets/trash-GulvRh9f.js","assets/manage-image-m-7v_Z1W.js","assets/image-delete-confirmation-D7xrODQV.js","assets/manage-image-detail-BNYOCSmu.js","assets/properties-B93_V2uD.js","assets/placeholder-C5fNzKrL.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{j as c,r as h,b as Bo}from"./floating-ui.react-dom-BWTnA00G.js";import{o as Do,q as $o,t as Uo,v as Ko,w as Go,k as zo,u as qo,a as Wo,b as Qo,d as zt,l as Xo,s as Yo,h as Jo,n as es,m as ts,f as os,R as ss}from"./useNoteMutate-xEIypxi5.js";import{aw as oe,ax as me,ay as O,az as F,aA as ge,aB as re,aC as qt,aD as ns,aE as rs,aF as as,aG as is,aH as cs,aI as ls,aJ as ds,aK as se,aL as vt,aM as us,aN as $e,aO as hs,aP as xt,aQ as B,aR as bt,aS as le,aT as ps,aU as fs,aV as xe,aW as ms,aX as M,aY as St,aZ as gs,a_ as ys,a$ as vs,b0 as xs,al as Q,ah as st,b1 as bs,b2 as wt,b3 as U,b4 as Ue,b5 as _e,b6 as nt,b7 as Ss,b8 as ws,C as ie,f as ae,u as rt,b9 as Rs,ba as _s,bb as Ps,bc as Es,T as Z,y as Ke,bd as Wt,z as de,be as Qt,bf as Ls,L as Ms,J as As,g as j,c as D,G as Cs,q as ye,e as Ts,i as Xt,Q as Yt,av as Is,l as he,F as Ce,bg as js,a2 as Vs,m as Rt,ar as Ns,N as ks,K as Hs,h as Fs,P as Os,k as Zs,E as Bs,bh as Ds,bi as $s,bj as Us,bk as T,bl as Ks,a1 as We,bm as _t,bn as Gs}from"./time-DI902Sxa.js";import{_ as V}from"./preload-helper-BXl3LOEh.js";import{f as be,N as at,H as He,V as it,G as Jt,C as eo,R as to,d as oo,i as so,T as no,j as zs,g as qs,h as Ws,S as Qs,c as Xs,b as Ys,e as Js,a as en}from"./url-BvjSC8PU.js";import{u as tn,a as Pt,D as on,c as sn,S as nn,v as rn,s as an,K as cn,P as ln,e as dn,C as un}from"./sortable.esm-DgSW3bAA.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function t(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function n(s){if(s.ep)return;s.ep=!0;const r=t(s);fetch(s.href,r)}})();const ct={DARK:"(prefers-color-scheme: dark)",LIGHT:"(prefers-color-scheme: light)",RETINA:"(min-resolution: 2dppx)",RESPONSIVE:e=>`screen and (max-width: ${e})`},ro=e=>typeof window<"u"&&window.matchMedia?window.matchMedia(e):null,lt=(e,o,t=!0)=>{const n=ro(e);t&&o(n?.matches||!1);const s=r=>{o?.(r.matches)};return n?.addEventListener("change",s),()=>{n?.removeEventListener("change",s)}},hn=(e,o=!0)=>lt(ct.DARK,e,o),pn=(e,o,t=!0)=>lt(ct.RESPONSIVE(e),o,t),fn={MEDIA_QUERY:ct,listenThemeChange:hn,listenResponsiveChange:pn,createMediaQuery:ro,listenMediaQueryChange:lt};var P=(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))(P||{});function ao({update:e,notify:o,unwatched:t}){return{link:n,unlink:s,propagate:r,checkDirty:a,shallowPropagate:i};function n(l,u,f){const p=u.depsTail;if(p!==void 0&&p.dep===l)return;const m=p!==void 0?p.nextDep:u.deps;if(m!==void 0&&m.dep===l){m.version=f,u.depsTail=m;return}const g=l.subsTail;if(g!==void 0&&g.version===f&&g.sub===u)return;const y=u.depsTail=l.subsTail={version:f,dep:l,sub:u,prevDep:p,nextDep:m,prevSub:g,nextSub:void 0};m!==void 0&&(m.prevDep=y),p!==void 0?p.nextDep=y:u.deps=y,g!==void 0?g.nextSub=y:l.subs=y}function s(l,u=l.sub){const f=l.dep,p=l.prevDep,m=l.nextDep,g=l.nextSub,y=l.prevSub;return m!==void 0?m.prevDep=p:u.depsTail=p,p!==void 0?p.nextDep=m:u.deps=m,g!==void 0?g.prevSub=y:f.subsTail=y,y!==void 0?y.nextSub=g:(f.subs=g)===void 0&&t(f),m}function r(l){let u=l.nextSub,f;e:do{const p=l.sub;let m=p.flags;if(m&60?m&12?m&4?!(m&48)&&d(l,p)?(p.flags=m|40,m&=1):m=0:p.flags=m&-9|32:m=0:p.flags=m|32,m&2&&o(p),m&1){const g=p.subs;if(g!==void 0){const y=(l=g).nextSub;y!==void 0&&(f={value:u,prev:f},u=y);continue}}if((l=u)!==void 0){u=l.nextSub;continue}for(;f!==void 0;)if(l=f.value,f=f.prev,l!==void 0){u=l.nextSub;continue e}break}while(!0)}function a(l,u){let f,p=0,m=!1;e:do{const g=l.dep,y=g.flags;if(u.flags&16)m=!0;else if((y&17)===17){if(e(g)){const v=g.subs;v.nextSub!==void 0&&i(v),m=!0}}else if((y&33)===33){(l.nextSub!==void 0||l.prevSub!==void 0)&&(f={value:l,prev:f}),l=g.deps,u=g,++p;continue}if(!m){const v=l.nextDep;if(v!==void 0){l=v;continue}}for(;p--;){const v=u.subs,x=v.nextSub!==void 0;if(x?(l=f.value,f=f.prev):l=v,m){if(e(u)){x&&i(v),u=l.sub;continue}m=!1}else u.flags&=-33;u=l.sub;const S=l.nextDep;if(S!==void 0){l=S;continue e}}return m}while(!0)}function i(l){do{const u=l.sub,f=u.flags;(f&48)===32&&(u.flags=f|16,(f&6)===2&&o(u))}while((l=l.nextSub)!==void 0)}function d(l,u){let f=u.depsTail;for(;f!==void 0;){if(f===l)return!0;f=f.prevDep}return!1}}let dt=0,J=0,pe=0;const z=[],{link:Zi,unlink:io,propagate:Bi,checkDirty:mn,shallowPropagate:Di}=ao({update(e){return e.depsTail!==void 0?xn(e):bn(e)},notify(e){let o=pe,t=o;do if(z[o++]=e,e.flags&=-3,e=e.subs?.sub,e===void 0||!(e.flags&2))break;while(!0);for(pe=o;t<--o;){const n=z[t];z[t++]=z[o],z[o]=n}},unwatched(e){e.flags&1?e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Fe(e)):Rn.call(e)}});function gn(){return dt}function yn(){++dt}function vn(){--dt||wn()}function xn(e){e.depsTail=void 0,e.flags=5;try{const o=e.value;return o!==(e.value=e.getter(o))}finally{e.flags&=-5,Fe(e)}}function bn(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function Sn(e){const o=e.flags;if(o&16||o&32&&mn(e.deps,e)){e.depsTail=void 0,e.flags=6;try{e.fn()}finally{e.flags&=-5,Fe(e)}}else e.flags=2}function wn(){try{for(;J<pe;){const e=z[J];z[J++]=void 0,Sn(e)}}finally{for(;J<pe;){const e=z[J];z[J++]=void 0,e.flags|=10}J=0,pe=0}}function Rn(){this.depsTail=void 0,this.flags=0,Fe(this);const e=this.subs;e!==void 0&&io(e)}function Fe(e){const o=e.depsTail;let t=o!==void 0?o.nextDep:e.deps;for(;t!==void 0;)t=io(t,e)}function ut(e,o,t){const n=typeof e=="object",s=n?e:void 0;return{next:(n?e.next:e)?.bind(s),error:(n?e.error:o)?.bind(s),complete:(n?e.complete:t)?.bind(s)}}const Qe=[];let Me=0;const{link:Et,unlink:_n,propagate:Pn,checkDirty:co,shallowPropagate:Lt}=ao({update(e){return e._update()},notify(e){Qe[Xe++]=e,e.flags&=~P.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=P.Mutable|P.Dirty,Te(e))}});let Pe=0,Xe=0,$;function Te(e){const o=e.depsTail;let t=o!==void 0?o.nextDep:e.deps;for(;t!==void 0;)t=_n(t,e)}function lo(){if(!(gn()>0)){for(;Pe<Xe;){const e=Qe[Pe];Qe[Pe++]=void 0,e.notify()}Pe=0,Xe=0}}function uo(e,o){const t=typeof e=="function",n=e,s={_snapshot:t?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:t?P.None:P.Mutable,get(){return $!==void 0&&Et(s,$,Me),s._snapshot},subscribe(r){const a=ut(r),i={current:!1},d=En(()=>{s.get(),i.current?a.next?.(s._snapshot):i.current=!0});return{unsubscribe:()=>{d.stop()}}},_update(r){const a=$,i=Object.is;if(t)$=s,++Me,s.depsTail=void 0;else if(r===void 0)return!1;t&&(s.flags=P.Mutable|P.RecursedCheck);try{const d=s._snapshot,l=typeof r=="function"?r(d):r===void 0&&t?n(d):r;return d===void 0||!i(d,l)?(s._snapshot=l,!0):!1}finally{$=a,t&&(s.flags&=~P.RecursedCheck),Te(s)}}};return t?(s.flags=P.Mutable|P.Dirty,s.get=function(){const r=s.flags;if(r&P.Dirty||r&P.Pending&&co(s.deps,s)){if(s._update()){const a=s.subs;a!==void 0&&Lt(a)}}else r&P.Pending&&(s.flags=r&~P.Pending);return $!==void 0&&Et(s,$,Me),s._snapshot}):s.set=function(r){if(s._update(r)){const a=s.subs;a!==void 0&&(Pn(a),Lt(a),lo())}},s}function En(e){const o=()=>{const n=$;$=t,++Me,t.depsTail=void 0,t.flags=P.Watching|P.RecursedCheck;try{return e()}finally{$=n,t.flags&=~P.RecursedCheck,Te(t)}},t={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:P.Watching|P.RecursedCheck,notify(){const n=this.flags;n&P.Dirty||n&P.Pending&&co(this.deps,this)?o():this.flags=P.Watching},stop(){this.flags=P.None,this.depsTail=void 0,Te(this)}};return o(),t}class Ln{constructor(o){this.atom=uo(o)}setState(o){this.atom.set(o)}get state(){return this.atom.get()}get(){return this.state}subscribe(o){return this.atom.subscribe(ut(o))}}class Mn{constructor(o){this.atom=uo(o)}get state(){return this.atom.get()}get(){return this.state}subscribe(o){return this.atom.subscribe(ut(o))}}function An(e){return typeof e=="function"?new Mn(e):new Ln(e)}function Cn(e){try{yn(),e()}finally{vn(),lo()}}const Y="__TSR_index",Mt="popstate",At="beforeunload";function Tn(e){let o=e.getLocation();const t=new Set,n=a=>{o=e.getLocation(),t.forEach(i=>i({location:o,action:a}))},s=a=>{e.notifyOnIndexChange??!0?n(a):o=e.getLocation()},r=async({task:a,navigateOpts:i,...d})=>{if(i?.ignoreBlocker??!1){a();return}const u=e.getBlockers?.()??[],f=d.type==="PUSH"||d.type==="REPLACE";if(typeof document<"u"&&u.length&&f)for(const p of u){const m=Ie(d.path,d.state);if(await p.blockerFn({currentLocation:o,nextLocation:m,action:d.type})){e.onBlocked?.();return}}a()};return{get location(){return o},get length(){return e.getLength()},subscribers:t,subscribe:a=>(t.add(a),()=>{t.delete(a)}),push:(a,i,d)=>{const l=o.state[Y];i=Ct(l+1,i),r({task:()=>{e.pushState(a,i),n({type:"PUSH"})},navigateOpts:d,type:"PUSH",path:a,state:i})},replace:(a,i,d)=>{const l=o.state[Y];i=Ct(l,i),r({task:()=>{e.replaceState(a,i),n({type:"REPLACE"})},navigateOpts:d,type:"REPLACE",path:a,state:i})},go:(a,i)=>{r({task:()=>{e.go(a),s({type:"GO",index:a})},navigateOpts:i,type:"GO"})},back:a=>{r({task:()=>{e.back(a?.ignoreBlocker??!1),s({type:"BACK"})},navigateOpts:a,type:"BACK"})},forward:a=>{r({task:()=>{e.forward(a?.ignoreBlocker??!1),s({type:"FORWARD"})},navigateOpts:a,type:"FORWARD"})},canGoBack:()=>o.state[Y]!==0,createHref:a=>e.createHref(a),block:a=>{if(!e.setBlockers)return()=>{};const i=e.getBlockers?.()??[];return e.setBlockers([...i,a]),()=>{const d=e.getBlockers?.()??[];e.setBlockers?.(d.filter(l=>l!==a))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:n}}function Ct(e,o){o||(o={});const t=ht();return{...o,key:t,__TSR_key:t,[Y]:e}}function In(e){const o=typeof document<"u"?window:void 0,t=o.history.pushState,n=o.history.replaceState;let s=[];const r=()=>s,a=b=>s=b,i=(b=>b),d=(()=>Ie(`${o.location.pathname}${o.location.search}${o.location.hash}`,o.history.state));if(!o.history.state?.__TSR_key&&!o.history.state?.key){const b=ht();o.history.replaceState({[Y]:0,key:b,__TSR_key:b},"")}let l=d(),u,f=!1,p=!1,m=!1,g=!1;const y=()=>l;let v,x;const S=()=>{v&&(C._ignoreSubscribers=!0,(v.isPush?o.history.pushState:o.history.replaceState)(v.state,"",v.href),C._ignoreSubscribers=!1,v=void 0,x=void 0,u=void 0)},E=(b,R,k)=>{const L=i(R);x||(u=l),l=Ie(R,k),v={href:L,state:k,isPush:v?.isPush||b==="push"},x||(x=Promise.resolve().then(()=>S()))},w=b=>{l=d(),C.notify({type:b})},I=async()=>{if(p){p=!1;return}const b=d(),R=b.state[Y]-l.state[Y],k=R===1,L=R===-1,_=!k&&!L||f;f=!1;const De=_?"GO":L?"BACK":"FORWARD",H=_?{type:"GO",index:R}:{type:L?"BACK":"FORWARD"};if(m)m=!1;else{const we=r();if(typeof document<"u"&&we.length){for(const G of we)if(await G.blockerFn({currentLocation:l,nextLocation:b,action:De})){p=!0,o.history.go(1),C.notify(H);return}}}l=d(),C.notify(H)},K=b=>{if(g){g=!1;return}let R=!1;const k=r();if(typeof document<"u"&&k.length)for(const L of k){const _=L.enableBeforeUnload??!0;if(_===!0){R=!0;break}if(typeof _=="function"&&_()===!0){R=!0;break}}if(R)return b.preventDefault(),b.returnValue=""},C=Tn({getLocation:y,getLength:()=>o.history.length,pushState:(b,R)=>E("push",b,R),replaceState:(b,R)=>E("replace",b,R),back:b=>(b&&(m=!0),g=!0,o.history.back()),forward:b=>{b&&(m=!0),g=!0,o.history.forward()},go:b=>{f=!0,o.history.go(b)},createHref:b=>i(b),flush:S,destroy:()=>{o.history.pushState=t,o.history.replaceState=n,o.removeEventListener(At,K,{capture:!0}),o.removeEventListener(Mt,I)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:r,setBlockers:a,notifyOnIndexChange:!1});return o.addEventListener(At,K,{capture:!0}),o.addEventListener(Mt,I),o.history.pushState=function(...b){const R=t.apply(o.history,b);return C._ignoreSubscribers||w("PUSH"),R},o.history.replaceState=function(...b){const R=n.apply(o.history,b);return C._ignoreSubscribers||w("REPLACE"),R},C}function jn(e){let o=e.replace(/[\x00-\x1f\x7f]/g,"");return o.startsWith("//")&&(o="/"+o.replace(/^\/+/,"")),o}function Ie(e,o){const t=jn(e),n=t.indexOf("#"),s=t.indexOf("?"),r=ht();return{href:t,pathname:t.substring(0,n>0?s>0?Math.min(n,s):n:s>0?s:t.length),hash:n>-1?t.substring(n):"",search:s>-1?t.slice(s,n===-1?void 0:n):"",state:o||{[Y]:0,key:r,__TSR_key:r}}}function ht(){return(Math.random()+1).toString(36).substring(7)}const Vn=!1;function fe(e){let o;return Cn(()=>{o=e()}),o}function Nn(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const Ye="tsr-scroll-restoration-v1_3",kn=(e,o)=>{let t;return(...n)=>{t||(t=setTimeout(()=>{e(...n),t=null},o))}};function Hn(){const e=Nn();if(!e)return null;const o=e.getItem(Ye);let t=o?JSON.parse(o):{};return{state:t,set:n=>{t=oe(n,t)||t;try{e.setItem(Ye,JSON.stringify(t))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}const Ee=Hn(),Fn=e=>e.state.__TSR_key||e.href;function On(e){const o=[];let t;for(;t=e.parentNode;)o.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(t.children,e)+1})`),e=t;return`${o.reverse().join(" > ")}`.toLowerCase()}let je=!1;function Zn({storageKey:e,key:o,behavior:t,shouldScrollRestoration:n,scrollToTopSelectors:s,location:r}){let a;try{a=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(l){console.error(l);return}const i=o||window.history.state?.__TSR_key,d=a[i];je=!0;e:{if(n&&d&&Object.keys(d).length>0){for(const f in d){const p=d[f];if(f==="window")window.scrollTo({top:p.scrollY,left:p.scrollX,behavior:t});else if(f){const m=document.querySelector(f);m&&(m.scrollLeft=p.scrollX,m.scrollTop=p.scrollY)}}break e}const l=(r??window.location).hash.split("#",2)[1];if(l){const f=window.history.state?.__hashScrollIntoViewOptions??!0;if(f){const p=document.getElementById(l);p&&p.scrollIntoView(f)}break e}const u={top:0,left:0,behavior:t};if(window.scrollTo(u),s)for(const f of s){if(f==="window")continue;const p=typeof f=="function"?f():document.querySelector(f);p&&p.scrollTo(u)}}je=!1}function Bn(e,o){if(!Ee||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!Ee))return;e.isScrollRestorationSetup=!0,je=!1;const n=e.options.getScrollRestorationKey||Fn;window.history.scrollRestoration="manual";const s=r=>{if(je||!e.isScrollRestoring)return;let a="";if(r.target===document||r.target===window)a="window";else{const d=r.target.getAttribute("data-scroll-restoration-id");d?a=`[data-scroll-restoration-id="${d}"]`:a=On(r.target)}const i=n(e.state.location);Ee.set(d=>{const l=d[i]||={},u=l[a]||={};if(a==="window")u.scrollX=window.scrollX||0,u.scrollY=window.scrollY||0;else if(a){const f=document.querySelector(a);f&&(u.scrollX=f.scrollLeft||0,u.scrollY=f.scrollTop||0)}return d})};typeof document<"u"&&document.addEventListener("scroll",kn(s,100),!0),e.subscribe("onRendered",r=>{const a=n(r.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(Zn({storageKey:Ye,key:a,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&Ee.set(i=>(i[a]||={},i)))})}function Dn(e){if(typeof document<"u"&&document.querySelector){const o=e.state.location.state.__hashScrollIntoViewOptions??!0;if(o&&e.state.location.hash!==""){const t=document.getElementById(e.state.location.hash);t&&t.scrollIntoView(o)}}}function $n(e,o=String){const t=new URLSearchParams;for(const n in e){const s=e[n];s!==void 0&&t.set(n,o(s))}return t.toString()}function Ge(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function Un(e){const o=new URLSearchParams(e),t={};for(const[n,s]of o.entries()){const r=t[n];r==null?t[n]=Ge(s):Array.isArray(r)?r.push(Ge(s)):t[n]=[r,Ge(s)]}return t}const Kn=zn(JSON.parse),Gn=qn(JSON.stringify,JSON.parse);function zn(e){return o=>{o[0]==="?"&&(o=o.substring(1));const t=Un(o);for(const n in t){const s=t[n];if(typeof s=="string")try{t[n]=e(s)}catch{}}return t}}function qn(e,o){const t=typeof o=="function";function n(s){if(typeof s=="object"&&s!==null)try{return e(s)}catch{}else if(t&&typeof s=="string")try{return o(s),e(s)}catch{}return s}return s=>{const r=$n(s,n);return r?`?${r}`:""}}const Je=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Oe=(e,o)=>!!(e.preload&&!e.router.state.matches.some(t=>t.id===o)),ne=(e,o,t=!0)=>{const n={...e.router.options.context??{}},s=t?o:o-1;for(let r=0;r<=s;r++){const a=e.matches[r];if(!a)continue;const i=e.router.getMatch(a.id);i&&Object.assign(n,i.__routeContext,i.__beforeLoadContext)}return n},Tt=(e,o)=>{if(!e.matches.length)return;const t=o.routeId,n=e.matches.findIndex(a=>a.routeId===e.router.routeTree.id),s=n>=0?n:0;let r=t?e.matches.findIndex(a=>a.routeId===t):e.firstBadMatchIndex??e.matches.length-1;r<0&&(r=s);for(let a=r;a>=0;a--){const i=e.matches[a];if(e.router.looseRoutesById[i.routeId].options.notFoundComponent)return a}return t?r:s},X=(e,o,t)=>{if(!(!O(t)&&!F(t)))throw O(t)&&t.redirectHandled&&!t.options.reloadDocument||(o&&(o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.loaderPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,o._nonReactive.loaderPromise=void 0,o._nonReactive.error=t,e.updateMatch(o.id,n=>({...n,status:O(t)?"redirected":n.status==="pending"?"success":n.status,context:ne(e,o.index),isFetching:!1,error:t})),F(t)&&!t.routeId&&(t.routeId=o.routeId),o._nonReactive.loadPromise?.resolve()),O(t)&&(e.rendered=!0,t.options._fromLocation=e.location,t.redirectHandled=!0,t=e.router.resolveRedirect(t))),t},ho=(e,o)=>!!e.router.getMatch(o)._nonReactive.dehydrated,ue=(e,o,t,n)=>{const{id:s,routeId:r}=e.matches[o],a=e.router.looseRoutesById[r];if(t instanceof Promise)throw t;t.routerCode=n,e.firstBadMatchIndex??=o,X(e,e.router.getMatch(s),t);try{a.options.onError?.(t)}catch(i){t=i,X(e,e.router.getMatch(s),t)}e.updateMatch(s,i=>(i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,i._nonReactive.loadPromise?.resolve(),{...i,error:t,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!O(t)&&!F(t)&&(e.serialError??=t)},po=(e,o,t,n)=>{if(n._nonReactive.pendingTimeout!==void 0)return;const s=t.options.pendingMs??e.router.options.defaultPendingMs;if(!!(e.onReady&&!Oe(e,o)&&(t.options.loader||t.options.beforeLoad||mo(t))&&typeof s=="number"&&s!==1/0&&(t.options.pendingComponent??e.router.options?.defaultPendingComponent))){const a=setTimeout(()=>{Je(e)},s);n._nonReactive.pendingTimeout=a}},Wn=(e,o,t)=>{const n=e.router.getMatch(o);if(!n._nonReactive.beforeLoadPromise&&!n._nonReactive.loaderPromise)return;po(e,o,t,n);const s=()=>{const r=e.router.getMatch(o);r.preload&&(r.status==="redirected"||r.status==="notFound")&&X(e,r,r.error)};return n._nonReactive.beforeLoadPromise?n._nonReactive.beforeLoadPromise.then(s):s()},Qn=(e,o,t,n)=>{const s=e.router.getMatch(o),r=s._nonReactive.loadPromise;s._nonReactive.loadPromise=re(()=>{r?.resolve()});const{paramsError:a,searchError:i}=s;a&&ue(e,t,a,"PARSE_PARAMS"),i&&ue(e,t,i,"VALIDATE_SEARCH"),po(e,o,n,s);const d=new AbortController;let l=!1;const u=()=>{l||(l=!0,e.updateMatch(o,w=>({...w,isFetching:"beforeLoad",fetchCount:w.fetchCount+1,abortController:d})))},f=()=>{s._nonReactive.beforeLoadPromise?.resolve(),s._nonReactive.beforeLoadPromise=void 0,e.updateMatch(o,w=>({...w,isFetching:!1}))};if(!n.options.beforeLoad){fe(()=>{u(),f()});return}s._nonReactive.beforeLoadPromise=re();const p={...ne(e,t,!1),...s.__routeContext},{search:m,params:g,cause:y}=s,v=Oe(e,o),x={search:m,abortController:d,params:g,preload:v,context:p,location:e.location,navigate:w=>e.router.navigate({...w,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:v?"preload":y,matches:e.matches,routeId:n.id,...e.router.options.additionalContext},S=w=>{if(w===void 0){fe(()=>{u(),f()});return}(O(w)||F(w))&&(u(),ue(e,t,w,"BEFORE_LOAD")),fe(()=>{u(),e.updateMatch(o,I=>({...I,__beforeLoadContext:w})),f()})};let E;try{if(E=n.options.beforeLoad(x),me(E))return u(),E.catch(w=>{ue(e,t,w,"BEFORE_LOAD")}).then(S)}catch(w){u(),ue(e,t,w,"BEFORE_LOAD")}S(E)},Xn=(e,o)=>{const{id:t,routeId:n}=e.matches[o],s=e.router.looseRoutesById[n],r=()=>i(),a=()=>Qn(e,t,o,s),i=()=>{if(ho(e,t))return;const d=Wn(e,t,s);return me(d)?d.then(a):a()};return r()},Yn=(e,o,t)=>{const n=e.router.getMatch(o);if(!n||!t.options.head&&!t.options.scripts&&!t.options.headers)return;const s={ssr:e.router.options.ssr,matches:e.matches,match:n,params:n.params,loaderData:n.loaderData};return Promise.all([t.options.head?.(s),t.options.scripts?.(s),t.options.headers?.(s)]).then(([r,a,i])=>{const d=r?.meta,l=r?.links,u=r?.scripts,f=r?.styles;return{meta:d,links:l,headScripts:u,headers:i,scripts:a,styles:f}})},fo=(e,o,t,n,s)=>{const r=o[n-1],{params:a,loaderDeps:i,abortController:d,cause:l}=e.router.getMatch(t),u=ne(e,n),f=Oe(e,t);return{params:a,deps:i,preload:!!f,parentMatchPromise:r,abortController:d,context:u,location:e.location,navigate:p=>e.router.navigate({...p,_fromLocation:e.location}),cause:f?"preload":l,route:s,...e.router.options.additionalContext}},It=async(e,o,t,n,s)=>{try{const r=e.router.getMatch(t);try{(!(Vn??e.router.isServer)||r.ssr===!0)&&Ve(s);const a=s.options.loader?.(fo(e,o,t,n,s)),i=s.options.loader&&me(a);if((i||s._lazyPromise||s._componentsPromise||s.options.head||s.options.scripts||s.options.headers||r._nonReactive.minPendingPromise)&&e.updateMatch(t,u=>({...u,isFetching:"loader"})),s.options.loader){const u=i?await a:a;X(e,e.router.getMatch(t),u),u!==void 0&&e.updateMatch(t,f=>({...f,loaderData:u}))}s._lazyPromise&&await s._lazyPromise;const l=r._nonReactive.minPendingPromise;l&&await l,s._componentsPromise&&await s._componentsPromise,e.updateMatch(t,u=>({...u,error:void 0,context:ne(e,n),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(a){let i=a;if(i?.name==="AbortError"){if(r.abortController.signal.aborted){r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loaderPromise=void 0;return}e.updateMatch(t,l=>({...l,status:l.status==="pending"?"success":l.status,isFetching:!1,context:ne(e,n)}));return}const d=r._nonReactive.minPendingPromise;d&&await d,F(a)&&await s.options.notFoundComponent?.preload?.(),X(e,e.router.getMatch(t),a);try{s.options.onError?.(a)}catch(l){i=l,X(e,e.router.getMatch(t),l)}e.updateMatch(t,l=>({...l,error:i,context:ne(e,n),status:"error",isFetching:!1}))}}catch(r){const a=e.router.getMatch(t);a&&(a._nonReactive.loaderPromise=void 0),X(e,a,r)}},Jn=async(e,o,t)=>{async function n(f,p,m,g){const y=Date.now()-p.updatedAt,v=f?g.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:g.options.staleTime??e.router.options.defaultStaleTime??0,x=g.options.shouldReload,S=typeof x=="function"?x(fo(e,o,s,t,g)):x,{status:E,invalid:w}=m;a=E==="success"&&(w||(S??y>v)),f&&g.options.preload===!1||(a&&!e.sync?(i=!0,(async()=>{try{await It(e,o,s,t,g);const I=e.router.getMatch(s);I._nonReactive.loaderPromise?.resolve(),I._nonReactive.loadPromise?.resolve(),I._nonReactive.loaderPromise=void 0}catch(I){O(I)&&await e.router.navigate(I.options)}})()):(E!=="success"||a&&e.sync)&&await It(e,o,s,t,g))}const{id:s,routeId:r}=e.matches[t];let a=!1,i=!1;const d=e.router.looseRoutesById[r];if(!ho(e,s)){const f=e.router.getMatch(s),p=Oe(e,s);if(f._nonReactive.loaderPromise){if(f.status==="success"&&!e.sync&&!f.preload)return f;await f._nonReactive.loaderPromise;const m=e.router.getMatch(s),g=m._nonReactive.error||m.error;g&&X(e,m,g),m.status==="pending"&&await n(p,f,m,d)}else{const m=p&&!e.router.state.matches.some(y=>y.id===s),g=e.router.getMatch(s);g._nonReactive.loaderPromise=re(),m!==g.preload&&e.updateMatch(s,y=>({...y,preload:m})),await n(p,f,g,d)}}const l=e.router.getMatch(s);i||(l._nonReactive.loaderPromise?.resolve(),l._nonReactive.loadPromise?.resolve()),clearTimeout(l._nonReactive.pendingTimeout),l._nonReactive.pendingTimeout=void 0,i||(l._nonReactive.loaderPromise=void 0),l._nonReactive.dehydrated=void 0;const u=i?l.isFetching:!1;return u!==l.isFetching||l.invalid!==!1?(e.updateMatch(s,f=>({...f,isFetching:u,invalid:!1})),e.router.getMatch(s)):l};async function jt(e){const o=e,t=[];o.router.state.matches.some(p=>p._forcePending)&&Je(o);let n;for(let p=0;p<o.matches.length;p++){try{const m=Xn(o,p);me(m)&&await m}catch(m){if(O(m))throw m;if(F(m))n=m;else if(!o.preload)throw m;break}if(o.serialError)break}const s=o.firstBadMatchIndex??o.matches.length,r=n&&!o.preload?Tt(o,n):void 0,a=n&&o.preload?0:r!==void 0?Math.min(r+1,s):s;let i,d;for(let p=0;p<a;p++)t.push(Jn(o,t,p));try{await Promise.all(t)}catch{const p=await Promise.allSettled(t);for(const m of p){if(m.status!=="rejected")continue;const g=m.reason;if(O(g))throw g;F(g)?i??=g:d??=g}if(d!==void 0)throw d}const l=i??(n&&!o.preload?n:void 0);let u=o.serialError?o.firstBadMatchIndex??0:o.matches.length-1;if(!l&&n&&o.preload)return o.matches;if(l){const p=Tt(o,l);ge(p!==void 0);const m=o.matches[p],g=o.router.looseRoutesById[m.routeId],y=o.router.options?.defaultNotFoundComponent;!g.options.notFoundComponent&&y&&(g.options.notFoundComponent=y),l.routeId=m.routeId;const v=m.routeId===o.router.routeTree.id;o.updateMatch(m.id,x=>({...x,...v?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:l},isFetching:!1})),u=p,await Ve(g)}else if(!o.preload){const p=o.matches[0];p.globalNotFound||o.router.getMatch(p.id)?.globalNotFound&&o.updateMatch(p.id,g=>({...g,globalNotFound:!1,error:void 0}))}if(o.serialError&&o.firstBadMatchIndex!==void 0){const p=o.router.looseRoutesById[o.matches[o.firstBadMatchIndex].routeId];await Ve(p)}for(let p=0;p<=u;p++){const m=o.matches[p],{id:g,routeId:y}=m,v=o.router.looseRoutesById[y];try{const x=Yn(o,g,v);if(x){const S=await x;o.updateMatch(g,E=>({...E,...S}))}}catch(x){console.error(`Error executing head for route ${y}:`,x)}}const f=Je(o);if(me(f)&&await f,l)throw l;if(o.serialError&&!o.preload&&!o.onReady)throw o.serialError;return o.matches}async function Ve(e){if(!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(o=>{const{id:t,...n}=o.options;Object.assign(e.options,n),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){const o=()=>{const t=[];for(const n of go){const s=e.options[n]?.preload;s&&t.push(s())}if(t.length)return Promise.all(t).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(o):o()}return e._componentsPromise}function mo(e){for(const o of go)if(e.options[o]?.preload)return!0;return!1}const go=["component","errorComponent","pendingComponent","notFoundComponent"];function er(e){return{input:({url:o})=>{for(const t of e)o=et(t,o);return o},output:({url:o})=>{for(let t=e.length-1;t>=0;t--)o=yo(e[t],o);return o}}}function tr(e){const o=qt(e.basepath),t=`/${o}`,n=`${t}/`,s=e.caseSensitive?t:t.toLowerCase(),r=e.caseSensitive?n:n.toLowerCase();return{input:({url:a})=>{const i=e.caseSensitive?a.pathname:a.pathname.toLowerCase();return i===s?a.pathname="/":i.startsWith(r)&&(a.pathname=a.pathname.slice(t.length)),a},output:({url:a})=>(a.pathname=ns(["/",o,a.pathname]),a)}}function et(e,o){const t=e?.input?.({url:o});if(t){if(typeof t=="string")return new URL(t);if(t instanceof URL)return t}return o}function yo(e,o){const t=e?.output?.({url:o});if(t){if(typeof t=="string")return new URL(t);if(t instanceof URL)return t}return o}function ee(e){const o=e.resolvedLocation,t=e.location,n=o?.pathname!==t.pathname,s=o?.href!==t.href,r=o?.hash!==t.hash;return{fromLocation:o,toLocation:t,pathChanged:n,hrefChanged:s,hashChanged:r}}function or(e){const o=e.filter(t=>t.status!=="redirected");return o.length===e.length?e:o}class sr{constructor(o){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=t=>t(),this.update=t=>{const n=this.options,s=this.basepath??n?.basepath??"/",r=this.basepath===void 0,a=n?.rewrite;if(this.options={...n,...t},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=rs(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=In()),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=as(1e3),p=this.buildRouteTree(),this.setRoutes(p)}!this.__store&&this.latestLocation&&(this.__store=An(rr(this.latestLocation)),Bn(this));let i=!1;const d=this.options.basepath??"/",l=this.options.rewrite;if(r||s!==d||a!==l){this.basepath=d;const p=[],m=qt(d);m&&m!=="/"&&p.push(tr({basepath:d})),l&&p.push(l),this.rewrite=p.length===0?void 0:p.length===1?p[0]:er(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 t=is(this.routeTree,this.options.caseSensitive,(n,s)=>{n.init({originalIndex:s})});return this.options.routeMasks&&cs(this.options.routeMasks,t.processedTree),t},this.subscribe=(t,n)=>{const s={eventType:t,fn:n};return this.subscribers.add(s),()=>{this.subscribers.delete(s)}},this.emit=t=>{this.subscribers.forEach(n=>{n.eventType===t.type&&n.fn(t)})},this.parseLocation=(t,n)=>{const s=({pathname:d,search:l,hash:u,href:f,state:p})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(d)){const S=this.options.parseSearch(l),E=this.options.stringifySearch(S);return{href:d+E+u,publicHref:f,pathname:le(d).path,external:!1,searchStr:E,search:B(n?.search,S),hash:le(u.slice(1)).path,state:B(n?.state,p)}}const m=new URL(f,this.origin),g=et(this.rewrite,m),y=this.options.parseSearch(g.search),v=this.options.stringifySearch(y);return g.search=v,{href:g.href.replace(g.origin,""),publicHref:f,pathname:le(g.pathname).path,external:!!this.rewrite&&g.origin!==this.origin,searchStr:v,search:B(n?.search,y),hash:le(g.hash.slice(1)).path,state:B(n?.state,p)}},r=s(t),{__tempLocation:a,__tempKey:i}=r.state;if(a&&(!i||i===this.tempLocationKey)){const d=s(a);return d.state.key=r.state.key,d.state.__TSR_key=r.state.__TSR_key,delete d.state.__tempLocation,{...d,maskedLocation:r}}return r},this.resolvePathWithBase=(t,n)=>ls({base:t,to:ds(n),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(t,n,s)=>typeof t=="string"?this.matchRoutesInternal({pathname:t,search:n},s):this.matchRoutesInternal(t,n),this.getMatchedRoutes=t=>ar({pathname:t,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=t=>{const n=this.getMatch(t);n&&(n.abortController.abort(),clearTimeout(n._nonReactive.pendingTimeout),n._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const t=this.state.matches.filter(r=>r.status==="pending"),n=this.state.matches.filter(r=>r.isFetching==="loader");new Set([...this.state.pendingMatches??[],...t,...n]).forEach(r=>{this.cancelMatch(r.id)})},this.buildLocation=t=>{const n=(r={})=>{const a=r._fromLocation||this.pendingBuiltLocation||this.latestLocation,i=this.matchRoutesLightweight(a);r.from;const d=r.unsafeRelative==="path"?a.pathname:r.from??i.fullPath,l=this.resolvePathWithBase(d,"."),u=i.search,f={...i.params},p=r.to?this.resolvePathWithBase(l,`${r.to}`):this.resolvePathWithBase(l,"."),m=r.params===!1||r.params===null?{}:(r.params??!0)===!0?f:Object.assign(f,oe(r.params,f)),g=this.getMatchedRoutes(p);let y=g.matchedRoutes;if((!g.foundRoute||g.foundRoute.path!=="/"&&g.routeParams["**"])&&this.options.notFoundRoute&&(y=[...y,this.options.notFoundRoute]),Object.keys(m).length>0)for(const L of y){const _=L.options.params?.stringify??L.options.stringifyParams;if(_)try{Object.assign(m,_(m))}catch{}}const x=t.leaveParams?p:le(xt({path:p,params:m,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let S=u;if(t._includeValidateSearch&&this.options.search?.strict){const L={};y.forEach(_=>{if(_.options.validateSearch)try{Object.assign(L,Ae(_.options.validateSearch,{...L,...S}))}catch{}}),S=L}S=ir({search:S,dest:r,destRoutes:y,_includeValidateSearch:t._includeValidateSearch}),S=B(u,S);const E=this.options.stringifySearch(S),w=r.hash===!0?a.hash:r.hash?oe(r.hash,a.hash):void 0,I=w?`#${w}`:"";let K=r.state===!0?a.state:r.state?oe(r.state,a.state):{};K=B(a.state,K);const C=`${x}${E}${I}`;let b,R,k=!1;if(this.rewrite){const L=new URL(C,this.origin),_=yo(this.rewrite,L);b=L.href.replace(L.origin,""),_.origin!==this.origin?(R=_.href,k=!0):R=_.pathname+_.search+_.hash}else b=ms(C),R=b;return{publicHref:R,href:b,pathname:x,search:S,searchStr:E,state:K,hash:w??"",external:k,unmaskOnReload:r.unmaskOnReload}},s=(r={},a)=>{const i=n(r);let d=a?n(a):void 0;if(!d){const l={};if(this.options.routeMasks){const u=ps(i.pathname,this.processedTree);if(u){Object.assign(l,u.rawParams);const{from:f,params:p,...m}=u.route,g=p===!1||p===null?{}:(p??!0)===!0?l:Object.assign(l,oe(p,l));a={from:t.from,...m,params:g},d=n(a)}}}return d&&(i.maskedLocation=d),i};return t.mask?s(t,{from:t.from,...t.mask}):s(t)},this.commitLocation=async({viewTransition:t,ignoreBlocker:n,...s})=>{const r=()=>{const d=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];d.forEach(u=>{s.state[u]=this.latestLocation.state[u]});const l=$e(s.state,this.latestLocation.state);return d.forEach(u=>{delete s.state[u]}),l},a=se(this.latestLocation.href)===se(s.href),i=this.commitLocationPromise;if(this.commitLocationPromise=re(()=>{i?.resolve()}),a&&r())this.load();else{let{maskedLocation:d,hashScrollIntoView:l,...u}=s;d&&(u={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...u,search:u.searchStr,state:{...u.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(u.unmaskOnReload??this.options.unmaskOnReload??!1)&&(u.state.__tempKey=this.tempLocationKey)),u.state.__hashScrollIntoViewOptions=l??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=t,this.history[s.replace?"replace":"push"](u.publicHref,u.state,{ignoreBlocker:n})}return this.resetNextScroll=s.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:t,resetScroll:n,hashScrollIntoView:s,viewTransition:r,ignoreBlocker:a,href:i,...d}={})=>{if(i){const f=this.history.location.state.__TSR_index,p=Ie(i,{__TSR_index:t?f:f+1}),m=new URL(p.pathname,this.origin),g=et(this.rewrite,m);d.to=g.pathname,d.search=this.options.parseSearch(p.search),d.hash=p.hash.slice(1)}const l=this.buildLocation({...d,_includeValidateSearch:!0});this.pendingBuiltLocation=l;const u=this.commitLocation({...l,viewTransition:r,replace:t,resetScroll:n,hashScrollIntoView:s,ignoreBlocker:a});return Promise.resolve().then(()=>{this.pendingBuiltLocation===l&&(this.pendingBuiltLocation=void 0)}),u},this.navigate=async({to:t,reloadDocument:n,href:s,publicHref:r,...a})=>{let i=!1;if(s)try{new URL(`${s}`),i=!0}catch{}if(i&&!n&&(n=!0),n){if(t!==void 0||!s){const l=this.buildLocation({to:t,...a});s=s??l.publicHref,r=r??l.publicHref}const d=!i&&r?r:s;if(vt(d,this.protocolAllowlist))return Promise.resolve();if(!a.ignoreBlocker){const u=this.history.getBlockers?.()??[];for(const f of u)if(f?.blockerFn&&await f.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return a.replace?window.location.replace(d):window.location.href=d,Promise.resolve()}return this.buildAndCommitLocation({...a,href:s,to:t,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const t=this.matchRoutes(this.latestLocation);this.__store.setState(n=>({...n,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:t,cachedMatches:n.cachedMatches.filter(s=>!t.some(r=>r.id===s.id))}))},this.load=async t=>{let n,s,r;for(r=new Promise(i=>{this.startTransition(async()=>{try{this.beforeLoad();const d=this.latestLocation,l=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...ee({resolvedLocation:l,location:d})}),this.emit({type:"onBeforeLoad",...ee({resolvedLocation:l,location:d})}),await jt({router:this,sync:t?.sync,matches:this.state.pendingMatches,location:d,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let u=[],f=[],p=[],m=[];fe(()=>{this.__store.setState(g=>{const y=g.matches,v=g.pendingMatches||g.matches;return u=y.filter(x=>!v.some(S=>S.id===x.id)),f=y.filter(x=>!v.some(S=>S.routeId===x.routeId)),p=v.filter(x=>!y.some(S=>S.routeId===x.routeId)),m=v.filter(x=>y.some(S=>S.routeId===x.routeId)),{...g,isLoading:!1,loadedAt:Date.now(),matches:v,pendingMatches:void 0,cachedMatches:[...g.cachedMatches,...u.filter(x=>x.status!=="error"&&x.status!=="notFound"&&x.status!=="redirected")]}}),this.clearExpiredCache()}),[[f,"onLeave"],[p,"onEnter"],[m,"onStay"]].forEach(([g,y])=>{g.forEach(v=>{this.looseRoutesById[v.routeId].options[y]?.(v)})})})})}})}catch(d){O(d)?(n=d,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):F(d)&&(s=d),this.__store.setState(l=>({...l,statusCode:n?n.status:s?404:l.matches.some(u=>u.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===r&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),i()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==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=t=>{const n=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,n&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let s;if(typeof n=="object"&&this.isViewTransitionTypesSupported){const r=this.latestLocation,a=this.state.resolvedLocation,i=typeof n.types=="function"?n.types(ee({resolvedLocation:a,location:r})):n.types;if(i===!1){t();return}s={update:t,types:i}}else s=t;document.startViewTransition(s)}else t()},this.updateMatch=(t,n)=>{this.startTransition(()=>{const s=this.state.pendingMatches?.some(r=>r.id===t)?"pendingMatches":this.state.matches.some(r=>r.id===t)?"matches":this.state.cachedMatches.some(r=>r.id===t)?"cachedMatches":"";s&&(s==="cachedMatches"?this.__store.setState(r=>({...r,cachedMatches:or(r.cachedMatches.map(a=>a.id===t?n(a):a))})):this.__store.setState(r=>({...r,[s]:r[s]?.map(a=>a.id===t?n(a):a)})))})},this.getMatch=t=>{const n=s=>s.id===t;return this.state.cachedMatches.find(n)??this.state.pendingMatches?.find(n)??this.state.matches.find(n)},this.invalidate=t=>{const n=s=>t?.filter?.(s)??!0?{...s,invalid:!0,...t?.forcePending||s.status==="error"||s.status==="notFound"?{status:"pending",error:void 0}:void 0}:s;return this.__store.setState(s=>({...s,matches:s.matches.map(n),cachedMatches:s.cachedMatches.map(n),pendingMatches:s.pendingMatches?.map(n)})),this.shouldViewTransition=!1,this.load({sync:t?.sync})},this.getParsedLocationHref=t=>t.publicHref||"/",this.resolveRedirect=t=>{const n=t.headers.get("Location");if(!t.options.href||t.options._builtLocation){const s=t.options._builtLocation??this.buildLocation(t.options),r=this.getParsedLocationHref(s);t.options.href=r,t.headers.set("Location",r)}else if(n)try{const s=new URL(n);if(this.origin&&s.origin===this.origin){const r=s.pathname+s.search+s.hash;t.options.href=r,t.headers.set("Location",r)}}catch{}if(t.options.href&&!t.options._builtLocation&&vt(t.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return t.headers.get("Location")||t.headers.set("Location",t.options.href),t},this.clearCache=t=>{const n=t?.filter;n!==void 0?this.__store.setState(s=>({...s,cachedMatches:s.cachedMatches.filter(r=>!n(r))})):this.__store.setState(s=>({...s,cachedMatches:[]}))},this.clearExpiredCache=()=>{const t=n=>{const s=this.looseRoutesById[n.routeId];if(!s.options.loader)return!0;const r=(n.preload?s.options.preloadGcTime??this.options.defaultPreloadGcTime:s.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:Date.now()-n.updatedAt>=r};this.clearCache({filter:t})},this.loadRouteChunk=Ve,this.preloadRoute=async t=>{const n=t._builtLocation??this.buildLocation(t);let s=this.matchRoutes(n,{throwOnError:!0,preload:!0,dest:t});const r=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(i=>i.id)),a=new Set([...r,...this.state.cachedMatches.map(i=>i.id)]);fe(()=>{s.forEach(i=>{a.has(i.id)||this.__store.setState(d=>({...d,cachedMatches:[...d.cachedMatches,i]}))})});try{return s=await jt({router:this,matches:s,location:n,preload:!0,updateMatch:(i,d)=>{r.has(i)?s=s.map(l=>l.id===i?d(l):l):this.updateMatch(i,d)}}),s}catch(i){if(O(i))return i.options.reloadDocument?void 0:await this.preloadRoute({...i.options,_fromLocation:n});F(i)||console.error(i);return}},this.matchRoute=(t,n)=>{const s={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0,params:t.params||{},leaveParams:!0},r=this.buildLocation(s);if(n?.pending&&this.state.status!=="pending")return!1;const i=(n?.pending===void 0?!this.state.isLoading:n.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,d=us(r.pathname,n?.caseSensitive??!1,n?.fuzzy??!1,i.pathname,this.processedTree);return!d||t.params&&!$e(d.rawParams,t.params,{partial:!0})?!1:n?.includeSearch??!0?$e(i.search,r.search,{partial:!0})?d.rawParams:!1:d.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(t=>t.status==="notFound"||t.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...o,caseSensitive:o.caseSensitive??!1,notFoundMode:o.notFoundMode??"fuzzy",stringifySearch:o.stringifySearch??Gn,parseSearch:o.parseSearch??Kn,protocolAllowlist:o.protocolAllowlist??hs}),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:o,routesByPath:t,processedTree:n}){this.routesById=o,this.routesByPath=t,this.processedTree=n;const s=this.options.notFoundRoute;s&&(s.init({originalIndex:99999999999}),this.routesById[s.id]=s)}get looseRoutesById(){return this.routesById}getParentContext(o){return o?.id?o.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(o,t){const n=this.getMatchedRoutes(o.pathname),{foundRoute:s,routeParams:r,parsedParams:a}=n;let{matchedRoutes:i}=n,d=!1;(s?s.path!=="/"&&r["**"]:se(o.pathname))&&(this.options.notFoundRoute?i=[...i,this.options.notFoundRoute]:d=!0);const l=d?lr(this.options.notFoundMode,i):void 0,u=new Array(i.length),f=new Map(this.state.matches.map(p=>[p.routeId,p]));for(let p=0;p<i.length;p++){const m=i[p],g=u[p-1];let y,v,x;{const H=g?.search??o.search,we=g?._strictSearch??void 0;try{const G=Ae(m.options.validateSearch,{...H})??void 0;y={...H,...G},v={...we,...G},x=void 0}catch(G){let Re=G;if(G instanceof Ne||(Re=new Ne(G.message,{cause:G})),t?.throwOnError)throw Re;y=H,v={},x=Re}}const S=m.options.loaderDeps?.({search:y})??"",E=S?JSON.stringify(S):"",{interpolatedPath:w,usedParams:I}=xt({path:m.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),K=m.id+w+E,C=this.getMatch(K),b=f.get(m.id),R=C?._strictParams??I;let k;if(!C)try{Vt(m,I,a,R)}catch(H){if(F(H)||O(H)?k=H:k=new nr(H.message,{cause:H}),t?.throwOnError)throw k}Object.assign(r,R);const L=b?"stay":"enter";let _;if(C)_={...C,cause:L,params:b?.params??r,_strictParams:R,search:b?B(b.search,y):B(C.search,y),_strictSearch:v};else{const H=m.options.loader||m.options.beforeLoad||m.lazyFn||mo(m)?"pending":"success";_={id:K,ssr:m.options.ssr,index:p,routeId:m.id,params:b?.params??r,_strictParams:R,pathname:w,updatedAt:Date.now(),search:b?B(b.search,y):y,_strictSearch:v,searchError:void 0,status:H,isFetching:!1,error:void 0,paramsError:k,__routeContext:void 0,_nonReactive:{loadPromise:re()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:L,loaderDeps:b?B(b.loaderDeps,S):S,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:m.options.staticData||{},fullPath:m.fullPath}}t?.preload||(_.globalNotFound=l===m.id),_.searchError=x;const De=this.getParentContext(g);_.context={...De,..._.__routeContext,..._.__beforeLoadContext},u[p]=_}for(let p=0;p<u.length;p++){const m=u[p],g=this.looseRoutesById[m.routeId],y=this.getMatch(m.id),v=f.get(m.routeId);if(m.params=v?B(v.params,r):r,!y){const x=u[p-1],S=this.getParentContext(x);if(g.options.context){const E={deps:m.loaderDeps,params:m.params,context:S??{},location:o,navigate:w=>this.navigate({...w,_fromLocation:o}),buildLocation:this.buildLocation,cause:m.cause,abortController:m.abortController,preload:!!m.preload,matches:u,routeId:g.id};m.__routeContext=g.options.context(E)??void 0}m.context={...S,...m.__routeContext,...m.__beforeLoadContext}}}return u}matchRoutesLightweight(o){const{matchedRoutes:t,routeParams:n,parsedParams:s}=this.getMatchedRoutes(o.pathname),r=bt(t),a={...o.search};for(const u of t)try{Object.assign(a,Ae(u.options.validateSearch,a))}catch{}const i=bt(this.state.matches),d=i&&i.routeId===r.id&&o.pathname===this.state.location.pathname;let l;if(d)l=i.params;else{const u={...n};for(const f of t)try{Vt(f,n,s??{},u)}catch{}l=u}return{matchedRoutes:t,fullPath:r.fullPath,search:a,params:l}}}class Ne extends Error{}class nr extends Error{}function rr(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Ae(e,o){if(e==null)return{};if("~standard"in e){const t=e["~standard"].validate(o);if(t instanceof Promise)throw new Ne("Async validation not supported");if(t.issues)throw new Ne(JSON.stringify(t.issues,void 0,2),{cause:t});return t.value}return"parse"in e?e.parse(o):typeof e=="function"?e(o):{}}function ar({pathname:e,routesById:o,processedTree:t}){const n={},s=se(e);let r,a;const i=fs(s,t,!0);return i&&(r=i.route,Object.assign(n,i.rawParams),a=Object.assign({},i.parsedParams)),{matchedRoutes:i?.branch||[o[xe]],routeParams:n,foundRoute:r,parsedParams:a}}function ir({search:e,dest:o,destRoutes:t,_includeValidateSearch:n}){return cr(t)(e,o,n??!1)}function cr(e){const o={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const s of e){if("search"in s.options)s.options.search?.middlewares&&o.middlewares.push(...s.options.search.middlewares);else if(s.options.preSearchFilters||s.options.postSearchFilters){const r=({search:a,next:i})=>{let d=a;"preSearchFilters"in s.options&&s.options.preSearchFilters&&(d=s.options.preSearchFilters.reduce((u,f)=>f(u),a));const l=i(d);return"postSearchFilters"in s.options&&s.options.postSearchFilters?s.options.postSearchFilters.reduce((u,f)=>f(u),l):l};o.middlewares.push(r)}if(s.options.validateSearch){const r=({search:a,next:i})=>{const d=i(a);if(!o._includeValidateSearch)return d;try{return{...d,...Ae(s.options.validateSearch,d)??void 0}}catch{return d}};o.middlewares.push(r)}}const t=({search:s})=>{const r=o.dest;return r.search?r.search===!0?s:oe(r.search,s):{}};o.middlewares.push(t);const n=(s,r,a)=>{if(s>=a.length)return r;const i=a[s];return i({search:r,next:l=>n(s+1,l,a)})};return function(r,a,i){return o.dest=a,o._includeValidateSearch=i,n(0,r,o.middlewares)}}function lr(e,o){if(e!=="root")for(let t=o.length-1;t>=0;t--){const n=o[t];if(n.children)return n.id}return xe}function Vt(e,o,t,n){const s=e.options.params?.parse??e.options.parseParams;if(s)if(e.options.skipRouteOnParseError)for(const r in o)r in t&&(n[r]=t[r]);else{const r=s(n);Object.assign(n,r)}}function pt(e){const o=e.errorComponent??ft;return c.jsx(dr,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:t,reset:n})=>t?h.createElement(o,{error:t,reset:n}):e.children})}class dr extends h.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(o){return{resetKey:o.getResetKey()}}static getDerivedStateFromError(o){return{error:o}}reset(){this.setState({error:null})}componentDidUpdate(o,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(o,t){this.props.onCatch&&this.props.onCatch(o,t)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function ft({error:e}){const[o,t]=h.useState(!1);return c.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[c.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),c.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>t(n=>!n),children:o?"Hide Error":"Show Error"})]}),c.jsx("div",{style:{height:".25rem"}}),o?c.jsx("div",{children:c.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?c.jsx("code",{children:e.message}):null})}):null]})}function Nt(e){return typeof e=="object"?new kt(e,{silent:!0}).createRoute(e):new kt(e,{silent:!0}).createRoute}class kt{constructor(o,t){this.path=o,this.createRoute=n=>{const s=M(n);return s.isRoot=!1,s},this.silent=t?.silent}}class Ht{constructor(o){this.useMatch=t=>St({select:t?.select,from:this.options.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>St({from:this.options.id,select:n=>t?.select?t.select(n.context):n.context}),this.useSearch=t=>gs({select:t?.select,structuralSharing:t?.structuralSharing,from:this.options.id}),this.useParams=t=>ys({select:t?.select,structuralSharing:t?.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>vs({...t,from:this.options.id}),this.useLoaderData=t=>xs({...t,from:this.options.id}),this.useNavigate=()=>{const t=Q();return st({from:t.routesById[this.options.id].fullPath})},this.options=o,this.$$typeof=Symbol.for("react.memo")}}function Ft(e){return typeof e=="object"?new Ht(e):o=>new Ht({id:e,...o})}function N(e,o){let t,n,s,r;const a=()=>(t||(t=e().then(d=>{t=void 0,n=d.default}).catch(d=>{if(s=d,bs(s)&&s instanceof Error&&typeof window<"u"&&typeof sessionStorage<"u"){const l=`tanstack_router_reload:${s.message}`;sessionStorage.getItem(l)||(sessionStorage.setItem(l,"1"),r=!0)}})),t),i=function(l){if(r)throw window.location.reload(),new Promise(()=>{});if(s)throw s;if(!n)if(wt)wt(a());else throw a();return h.createElement(n,l)};return i.preload=a,i}function ur(){const e=Q(),o=h.useRef({router:e,mounted:!1}),[t,n]=h.useState(!1),{hasPendingMatches:s,isLoading:r}=U({select:f=>({isLoading:f.isLoading,hasPendingMatches:f.matches.some(p=>p.status==="pending")}),structuralSharing:!0}),a=Ue(r),i=r||t||s,d=Ue(i),l=r||s,u=Ue(l);return e.startTransition=f=>{n(!0),h.startTransition(()=>{f(),n(!1)})},h.useEffect(()=>{const f=e.history.subscribe(e.load),p=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return se(e.latestLocation.publicHref)!==se(p.publicHref)&&e.commitLocation({...p,replace:!0}),()=>{f()}},[e,e.history]),_e(()=>{if(typeof window<"u"&&e.ssr||o.current.router===e&&o.current.mounted)return;o.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(p){console.error(p)}})()},[e]),_e(()=>{a&&!r&&e.emit({type:"onLoad",...ee(e.state)})},[a,e,r]),_e(()=>{u&&!l&&e.emit({type:"onBeforeRouteMount",...ee(e.state)})},[l,u,e]),_e(()=>{if(d&&!i){const f=ee(e.state);e.emit({type:"onResolved",...f}),e.__store.setState(p=>({...p,status:"idle",resolvedLocation:p.location})),f.hrefChanged&&Dn(e)}},[i,d,e]),null}function hr(e){const o=U({select:t=>`not-found-${t.location.pathname}-${t.status}`});return c.jsx(pt,{getResetKey:()=>o,onCatch:(t,n)=>{if(F(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(F(t))return e.fallback?.(t);throw t},children:e.children})}function pr(){return c.jsx("p",{children:"Not Found"})}function te(e){return c.jsx(c.Fragment,{children:e.children})}function vo(e,o,t){return o.options.notFoundComponent?c.jsx(o.options.notFoundComponent,{...t}):e.options.defaultNotFoundComponent?c.jsx(e.options.defaultNotFoundComponent,{...t}):c.jsx(pr,{})}function fr(){return Q().isScrollRestoring,null}const xo=h.memo(function({matchId:o}){const t=Q(),n=U({select:y=>{const v=y.matches.findIndex(S=>S.id===o),x=y.matches[v];return ge(x),{routeId:x.routeId,ssr:x.ssr,_displayPending:x._displayPending,resetKey:y.loadedAt,parentRouteId:y.matches[v-1]?.routeId}},structuralSharing:!0}),s=t.routesById[n.routeId],r=s.options.pendingComponent??t.options.defaultPendingComponent,a=r?c.jsx(r,{}):null,i=s.options.errorComponent??t.options.defaultErrorComponent,d=s.options.onCatch??t.options.defaultOnCatch,l=s.isRoot?s.options.notFoundComponent??t.options.notFoundRoute?.options.component:s.options.notFoundComponent,u=n.ssr===!1||n.ssr==="data-only",f=(!s.isRoot||s.options.wrapInSuspense||u)&&(s.options.wrapInSuspense??r??(s.options.errorComponent?.preload||u))?h.Suspense:te,p=i?pt:te,m=l?hr:te,g=s.isRoot?s.options.shellComponent??te:te;return c.jsxs(g,{children:[c.jsx(nt.Provider,{value:o,children:c.jsx(f,{fallback:a,children:c.jsx(p,{getResetKey:()=>n.resetKey,errorComponent:i||ft,onCatch:(y,v)=>{if(F(y))throw y;d?.(y,v)},children:c.jsx(m,{fallback:y=>{if(!l||y.routeId&&y.routeId!==n.routeId||!y.routeId&&!s.isRoot)throw y;return h.createElement(l,y)},children:u||n._displayPending?c.jsx(Ss,{fallback:a,children:c.jsx(Ot,{matchId:o})}):c.jsx(Ot,{matchId:o})})})})}),n.parentRouteId===xe&&t.options.scrollRestoration?c.jsxs(c.Fragment,{children:[c.jsx(mr,{}),c.jsx(fr,{})]}):null]})});function mr(){const e=Q(),o=h.useRef(void 0);return c.jsx("script",{suppressHydrationWarning:!0,ref:t=>{t&&(o.current===void 0||o.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...ee(e.state)}),o.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}const Ot=h.memo(function({matchId:o}){const t=Q(),{match:n,key:s,routeId:r}=U({select:d=>{const l=d.matches.find(g=>g.id===o),u=l.routeId,p=(t.routesById[u].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:u,loaderDeps:l.loaderDeps,params:l._strictParams,search:l._strictSearch});return{key:p?JSON.stringify(p):void 0,routeId:u,match:{id:l.id,status:l.status,error:l.error,invalid:l.invalid,_forcePending:l._forcePending,_displayPending:l._displayPending}}},structuralSharing:!0}),a=t.routesById[r],i=h.useMemo(()=>{const d=a.options.component??t.options.defaultComponent;return d?c.jsx(d,{},s):c.jsx(bo,{})},[s,a.options.component,t.options.defaultComponent]);if(n._displayPending)throw t.getMatch(n.id)?._nonReactive.displayPendingPromise;if(n._forcePending)throw t.getMatch(n.id)?._nonReactive.minPendingPromise;if(n.status==="pending"){const d=a.options.pendingMinMs??t.options.defaultPendingMinMs;if(d){const l=t.getMatch(n.id);if(l&&!l._nonReactive.minPendingPromise){const u=re();l._nonReactive.minPendingPromise=u,setTimeout(()=>{u.resolve(),l._nonReactive.minPendingPromise=void 0},d)}}throw t.getMatch(n.id)?._nonReactive.loadPromise}if(n.status==="notFound")return ge(F(n.error)),vo(t,a,n.error);if(n.status==="redirected")throw ge(O(n.error)),t.getMatch(n.id)?._nonReactive.loadPromise;if(n.status==="error")throw n.error;return i}),bo=h.memo(function(){const o=Q(),t=h.useContext(nt),n=U({select:l=>l.matches.find(u=>u.id===t)?.routeId}),s=o.routesById[n],r=U({select:l=>{const f=l.matches.find(p=>p.id===t);return ge(f),f.globalNotFound}}),a=U({select:l=>{const u=l.matches,f=u.findIndex(p=>p.id===t);return u[f+1]?.id}}),i=o.options.defaultPendingComponent?c.jsx(o.options.defaultPendingComponent,{}):null;if(r)return vo(o,s,void 0);if(!a)return null;const d=c.jsx(xo,{matchId:a});return n===xe?c.jsx(h.Suspense,{fallback:i,children:d}):d});function gr(){const e=Q(),t=e.routesById[xe].options.pendingComponent??e.options.defaultPendingComponent,n=t?c.jsx(t,{}):null,s=typeof document<"u"&&e.ssr?te:h.Suspense,r=c.jsxs(s,{fallback:n,children:[c.jsx(ur,{}),c.jsx(yr,{})]});return e.options.InnerWrap?c.jsx(e.options.InnerWrap,{children:r}):r}function yr(){const e=Q(),o=U({select:s=>s.matches[0]?.id}),t=U({select:s=>s.loadedAt}),n=o?c.jsx(xo,{matchId:o}):null;return c.jsx(nt.Provider,{value:o,children:e.options.disableGlobalCatchBoundary?n:c.jsx(pt,{getResetKey:()=>t,errorComponent:ft,onCatch:void 0,children:n})})}const vr=e=>new xr(e);class xr extends sr{constructor(o){super(o)}}typeof globalThis<"u"?(globalThis.createFileRoute=Nt,globalThis.createLazyFileRoute=Ft):typeof window<"u"&&(window.createFileRoute=Nt,window.createLazyFileRoute=Ft);function br({router:e,children:o,...t}){Object.keys(t).length>0&&e.update({...e.options,...t,context:{...e.options.context,...t.context}});const n=c.jsx(ws.Provider,{value:e,children:o});return e.options.Wrap?c.jsx(e.options.Wrap,{children:n}):n}function Sr({router:e,...o}){return c.jsx(br,{router:e,...o,children:c.jsx(gr,{})})}function Ze(e){return U({select:o=>e?.select?e.select(o.location):o.location})}const wr=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,28H188V24a12,12,0,0,0-24,0v4H92V24a12,12,0,0,0-24,0v4H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28ZM68,52a12,12,0,0,0,24,0h72a12,12,0,0,0,24,0h16V76H52V52ZM52,204V100H204V204Zm60-80v56a12,12,0,0,1-24,0V143.32a12,12,0,0,1-9.37-22l16-8A12,12,0,0,1,112,124Zm61.49,33.88L163.9,168H168a12,12,0,0,1,0,24H136a12,12,0,0,1-8.71-20.25L155.45,142a4,4,0,0,0,.55-2,4,4,0,0,0-7.47-2,12,12,0,0,1-20.78-12A28,28,0,0,1,180,140a27.77,27.77,0,0,1-5.64,16.86A10.63,10.63,0,0,1,173.49,157.88Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,48V88H40V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z",opacity:"0.2"}),h.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Zm-96-88v64a8,8,0,0,1-16,0V132.94l-4.42,2.22a8,8,0,0,1-7.16-14.32l16-8A8,8,0,0,1,112,120Zm59.16,30.45L152,176h16a8,8,0,0,1,0,16H136a8,8,0,0,1-6.4-12.8l28.78-38.37A8,8,0,1,0,145.07,132a8,8,0,1,1-13.85-8A24,24,0,0,1,176,136,23.76,23.76,0,0,1,171.16,150.45Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM112,184a8,8,0,0,1-16,0V132.94l-4.42,2.22a8,8,0,0,1-7.16-14.32l16-8A8,8,0,0,1,112,120Zm56-8a8,8,0,0,1,0,16H136a8,8,0,0,1-6.4-12.8l28.78-38.37A8,8,0,1,0,145.07,132a8,8,0,1,1-13.85-8A24,24,0,0,1,176,136a23.76,23.76,0,0,1-4.84,14.45L152,176ZM48,80V48H72v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,34H182V24a6,6,0,0,0-12,0V34H86V24a6,6,0,0,0-12,0V34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM48,46H74V56a6,6,0,0,0,12,0V46h84V56a6,6,0,0,0,12,0V46h26a2,2,0,0,1,2,2V82H46V48A2,2,0,0,1,48,46ZM208,210H48a2,2,0,0,1-2-2V94H210V208A2,2,0,0,1,208,210Zm-98-90v64a6,6,0,0,1-12,0V129.71l-7.32,3.66a6,6,0,1,1-5.36-10.74l16-8A6,6,0,0,1,110,120Zm59.57,29.25L148,178h20a6,6,0,0,1,0,12H136a6,6,0,0,1-4.8-9.6L160,142a10,10,0,1,0-16.65-11A6,6,0,1,1,133,125a22,22,0,1,1,36.62,24.26Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Zm-96-88v64a8,8,0,0,1-16,0V132.94l-4.42,2.22a8,8,0,0,1-7.16-14.32l16-8A8,8,0,0,1,112,120Zm59.16,30.45L152,176h16a8,8,0,0,1,0,16H136a8,8,0,0,1-6.4-12.8l28.78-38.37A8,8,0,1,0,145.07,132a8,8,0,1,1-13.85-8A24,24,0,0,1,176,136,23.76,23.76,0,0,1,171.16,150.45Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,36H180V24a4,4,0,0,0-8,0V36H84V24a4,4,0,0,0-8,0V36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM48,44H76V56a4,4,0,0,0,8,0V44h88V56a4,4,0,0,0,8,0V44h28a4,4,0,0,1,4,4V84H44V48A4,4,0,0,1,48,44ZM208,212H48a4,4,0,0,1-4-4V92H212V208A4,4,0,0,1,208,212ZM108,120v64a4,4,0,0,1-8,0V126.47l-10.21,5.11a4,4,0,0,1-3.58-7.16l16-8A4,4,0,0,1,108,120Zm60,28-24,32h24a4,4,0,0,1,0,8H136a4,4,0,0,1-3.2-6.4l28.78-38.37A11.88,11.88,0,0,0,164,136a12,12,0,0,0-22.4-6,4,4,0,0,1-6.92-4A20,20,0,0,1,172,136,19.79,19.79,0,0,1,168,148Z"}))]]),Rr=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M108,60A16,16,0,1,1,92,44,16,16,0,0,1,108,60Zm56,16a16,16,0,1,0-16-16A16,16,0,0,0,164,76ZM92,112a16,16,0,1,0,16,16A16,16,0,0,0,92,112Zm72,0a16,16,0,1,0,16,16A16,16,0,0,0,164,112ZM92,180a16,16,0,1,0,16,16A16,16,0,0,0,92,180Zm72,0a16,16,0,1,0,16,16A16,16,0,0,0,164,180Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,32V224a16,16,0,0,1-16,16H64a16,16,0,0,1-16-16V32A16,16,0,0,1,64,16H192A16,16,0,0,1,208,32Z",opacity:"0.2"}),h.createElement("path",{d:"M104,60A12,12,0,1,1,92,48,12,12,0,0,1,104,60Zm60,12a12,12,0,1,0-12-12A12,12,0,0,0,164,72ZM92,116a12,12,0,1,0,12,12A12,12,0,0,0,92,116Zm72,0a12,12,0,1,0,12,12A12,12,0,0,0,164,116ZM92,184a12,12,0,1,0,12,12A12,12,0,0,0,92,184Zm72,0a12,12,0,1,0,12,12A12,12,0,0,0,164,184Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M192,16H64A16,16,0,0,0,48,32V224a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V32A16,16,0,0,0,192,16ZM100,200a12,12,0,1,1,12-12A12,12,0,0,1,100,200Zm0-60a12,12,0,1,1,12-12A12,12,0,0,1,100,140Zm0-60a12,12,0,1,1,12-12A12,12,0,0,1,100,80Zm56,120a12,12,0,1,1,12-12A12,12,0,0,1,156,200Zm0-60a12,12,0,1,1,12-12A12,12,0,0,1,156,140Zm0-60a12,12,0,1,1,12-12A12,12,0,0,1,156,80Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M102,60A10,10,0,1,1,92,50,10,10,0,0,1,102,60Zm62,10a10,10,0,1,0-10-10A10,10,0,0,0,164,70ZM92,118a10,10,0,1,0,10,10A10,10,0,0,0,92,118Zm72,0a10,10,0,1,0,10,10A10,10,0,0,0,164,118ZM92,186a10,10,0,1,0,10,10A10,10,0,0,0,92,186Zm72,0a10,10,0,1,0,10,10A10,10,0,0,0,164,186Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M104,60A12,12,0,1,1,92,48,12,12,0,0,1,104,60Zm60,12a12,12,0,1,0-12-12A12,12,0,0,0,164,72ZM92,116a12,12,0,1,0,12,12A12,12,0,0,0,92,116Zm72,0a12,12,0,1,0,12,12A12,12,0,0,0,164,116ZM92,184a12,12,0,1,0,12,12A12,12,0,0,0,92,184Zm72,0a12,12,0,1,0,12,12A12,12,0,0,0,164,184Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M100,60a8,8,0,1,1-8-8A8,8,0,0,1,100,60Zm64,8a8,8,0,1,0-8-8A8,8,0,0,0,164,68ZM92,120a8,8,0,1,0,8,8A8,8,0,0,0,92,120Zm72,0a8,8,0,1,0,8,8A8,8,0,0,0,164,120ZM92,188a8,8,0,1,0,8,8A8,8,0,0,0,92,188Zm72,0a8,8,0,1,0,8,8A8,8,0,0,0,164,188Z"}))]]),_r=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,80H140V60h56ZM116,60v56H60V60ZM60,140h56v56H60Zm80,56V140h56v56Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z",opacity:"0.2"}),h.createElement("path",{d:"M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,80H136V56h64ZM120,56v64H56V56ZM56,136h64v64H56Zm144,64H136V136h64v64Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M216,56v60a4,4,0,0,1-4,4H136V44a4,4,0,0,1,4-4h60A16,16,0,0,1,216,56ZM116,40H56A16,16,0,0,0,40,56v60a4,4,0,0,0,4,4h76V44A4,4,0,0,0,116,40Zm96,96H136v76a4,4,0,0,0,4,4h60a16,16,0,0,0,16-16V140A4,4,0,0,0,212,136ZM40,140v60a16,16,0,0,0,16,16h60a4,4,0,0,0,4-4V136H44A4,4,0,0,0,40,140Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,14v66H134V54h66A2,2,0,0,1,202,56ZM56,54h66v68H54V56A2,2,0,0,1,56,54ZM54,200V134h68v68H56A2,2,0,0,1,54,200Zm146,2H134V134h68v66A2,2,0,0,1,200,202Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,80H136V56h64ZM120,56v64H56V56ZM56,136h64v64H56Zm144,64H136V136h64v64Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,12v68H132V52h68A4,4,0,0,1,204,56ZM56,52h68v72H52V56A4,4,0,0,1,56,52ZM52,200V132h72v72H56A4,4,0,0,1,52,200Zm148,4H132V132h72v68A4,4,0,0,1,200,204Z"}))]]),Pr=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z",opacity:"0.2"}),h.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z"}))]]),Er=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z",opacity:"0.2"}),h.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z"}))]]),Lr=new Map([["bold",h.createElement(h.Fragment,null,h.createElement("path",{d:"M128,128a12,12,0,0,1-12,12H48a12,12,0,0,1,0-24h68A12,12,0,0,1,128,128ZM48,76H180a12,12,0,0,0,0-24H48a12,12,0,0,0,0,24Zm52,104H48a12,12,0,0,0,0,24h52a12,12,0,0,0,0-24Zm132.49-20.49a12,12,0,0,0-17,0L196,179V112a12,12,0,0,0-24,0v67l-19.51-19.52a12,12,0,0,0-17,17l40,40a12,12,0,0,0,17,0l40-40A12,12,0,0,0,232.49,159.51Z"}))],["duotone",h.createElement(h.Fragment,null,h.createElement("path",{d:"M224,80v88l-24,24H48V64H208A16,16,0,0,1,224,80Z",opacity:"0.2"}),h.createElement("path",{d:"M128,128a8,8,0,0,1-8,8H48a8,8,0,0,1,0-16h72A8,8,0,0,1,128,128ZM48,72H184a8,8,0,0,0,0-16H48a8,8,0,0,0,0,16Zm56,112H48a8,8,0,0,0,0,16h56a8,8,0,0,0,0-16Zm125.66-21.66a8,8,0,0,0-11.32,0L192,188.69V112a8,8,0,0,0-16,0v76.69l-26.34-26.35a8,8,0,0,0-11.32,11.32l40,40a8,8,0,0,0,11.32,0l40-40A8,8,0,0,0,229.66,162.34Z"}))],["fill",h.createElement(h.Fragment,null,h.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,72h96a8,8,0,0,1,0,16H72a8,8,0,0,1,0-16Zm40,112H72a8,8,0,0,1,0-16h40a8,8,0,0,1,0,16Zm8-48H72a8,8,0,0,1,0-16h48a8,8,0,0,1,0,16Zm77.66,29.66-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L160,164.69V120a8,8,0,0,1,16,0v44.69l10.34-10.35a8,8,0,0,1,11.32,11.32Z"}))],["light",h.createElement(h.Fragment,null,h.createElement("path",{d:"M126,128a6,6,0,0,1-6,6H48a6,6,0,0,1,0-12h72A6,6,0,0,1,126,128ZM48,70H184a6,6,0,0,0,0-12H48a6,6,0,0,0,0,12Zm56,116H48a6,6,0,0,0,0,12h56a6,6,0,0,0,0-12Zm124.24-22.24a6,6,0,0,0-8.48,0L190,193.51V112a6,6,0,0,0-12,0v81.51l-29.76-29.75a6,6,0,0,0-8.48,8.48l40,40a6,6,0,0,0,8.48,0l40-40A6,6,0,0,0,228.24,163.76Z"}))],["regular",h.createElement(h.Fragment,null,h.createElement("path",{d:"M128,128a8,8,0,0,1-8,8H48a8,8,0,0,1,0-16h72A8,8,0,0,1,128,128ZM48,72H184a8,8,0,0,0,0-16H48a8,8,0,0,0,0,16Zm56,112H48a8,8,0,0,0,0,16h56a8,8,0,0,0,0-16Zm125.66-21.66a8,8,0,0,0-11.32,0L192,188.69V112a8,8,0,0,0-16,0v76.69l-26.34-26.35a8,8,0,0,0-11.32,11.32l40,40a8,8,0,0,0,11.32,0l40-40A8,8,0,0,0,229.66,162.34Z"}))],["thin",h.createElement(h.Fragment,null,h.createElement("path",{d:"M124,128a4,4,0,0,1-4,4H48a4,4,0,0,1,0-8h72A4,4,0,0,1,124,128ZM48,68H184a4,4,0,0,0,0-8H48a4,4,0,0,0,0,8Zm56,120H48a4,4,0,0,0,0,8h56a4,4,0,0,0,0-8Zm122.83-22.83a4,4,0,0,0-5.66,0L188,198.34V112a4,4,0,0,0-8,0v86.34l-33.17-33.17a4,4,0,0,0-5.66,5.66l40,40a4,4,0,0,0,5.66,0l40-40A4,4,0,0,0,226.83,165.17Z"}))]]),So=h.forwardRef((e,o)=>h.createElement(ie,{ref:o,...e,weights:wr}));So.displayName="CalendarIcon";const Mr=So,wo=h.forwardRef((e,o)=>h.createElement(ie,{ref:o,...e,weights:Rr}));wo.displayName="DotsSixVerticalIcon";const Ar=wo,Ro=h.forwardRef((e,o)=>h.createElement(ie,{ref:o,...e,weights:_r}));Ro.displayName="GridFourIcon";const _o=Ro,Po=h.forwardRef((e,o)=>h.createElement(ie,{ref:o,...e,weights:Pr}));Po.displayName="MagnifyingGlassIcon";const Eo=Po,Lo=h.forwardRef((e,o)=>h.createElement(ie,{ref:o,...e,weights:Er}));Lo.displayName="PencilSimpleIcon";const Cr=Lo,Mo=h.forwardRef((e,o)=>h.createElement(ie,{ref:o,...e,weights:Lr}));Mo.displayName="SortAscendingIcon";const Tr=Mo;function Ir(e){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[c.jsx("circle",{cx:"6",cy:"6",r:"3"}),c.jsx("circle",{cx:"18",cy:"6",r:"3"}),c.jsx("circle",{cx:"6",cy:"18",r:"3"}),c.jsx("circle",{cx:"18",cy:"18",r:"3"}),c.jsx("circle",{cx:"12",cy:"12",r:"3"}),c.jsx("line",{x1:"8.5",y1:"7.5",x2:"10",y2:"10"}),c.jsx("line",{x1:"15.5",y1:"7.5",x2:"14",y2:"10"}),c.jsx("line",{x1:"8.5",y1:"16.5",x2:"10",y2:"14"}),c.jsx("line",{x1:"15.5",y1:"16.5",x2:"14",y2:"14"})]})}const mt="/login",jr="/api/auth/";let Zt=!1;const Vr=e=>{const o=`${e.pathname||"/"}${e.search}${e.hash}`;return`${mt}?next=${encodeURIComponent(o)}`},Nr=e=>{if(!ae.isAxiosError(e)||e.response?.status!==401)return!1;const o=e.config?.url??"";return!o.startsWith(jr)&&o!==mt},Ao=(e=window.location)=>{Zt||e.pathname===mt||(Zt=!0,e.assign(Vr(e)))},kr="X-Ocean-Brain-Session-Generation";let Bt=!1,Le;const Hr=e=>!!(e.authRequired&&!e.authenticated),Fr=e=>{const o=e.headers.get(kr);return o?Le?Le===o?!1:(Le=o,!0):(Le=o,!1):!1},Or=(e=window.location)=>{Bt||(Bt=!0,e.reload())},ke=async(e=fetch)=>{const o=await e("/api/auth/session").catch(()=>{});if(!o?.ok)return"unavailable";const t=Fr(o),n=await o.json();return Hr(n)?(Ao(),"expired"):t?(Or(),"reloading"):"active"},Zr=e=>o=>{if(!(o instanceof MessageEvent)||typeof o.data!="string")return;const t=Uo(o.data);!t||t.type!==e||Ko(t)},Br=()=>{const e=rt();return h.useEffect(()=>Do(o=>{Go(e,o)}),[e]),h.useEffect(()=>{if(typeof EventSource>"u")return;const o=new EventSource("/api/events");let t=!1;const n=()=>{t=!0,ke()},s=()=>{t&&(t=!1,ke())},r=$o.map(a=>{const i=Zr(a);return o.addEventListener(a,i),()=>{o.removeEventListener(a,i)}});return o.addEventListener("error",n),o.addEventListener("open",s),()=>{r.forEach(a=>{a()}),o.removeEventListener("error",n),o.removeEventListener("open",s),o.close()}},[]),null},Dr=({children:e})=>c.jsx(Rs,{client:_s,children:c.jsx(Ps,{children:c.jsxs(Es,{children:[c.jsx(Br,{}),e]})})}),Dt=({children:e,fallback:o})=>e||o;function $r({itemsPerPage:e,onItemsPerPageChange:o,sortBy:t,onSortByChange:n,sortOrder:s,onSortOrderChange:r,pinnedFirst:a,onPinnedFirstChange:i}){return c.jsx("div",{className:"flex justify-end",children:c.jsxs("div",{className:"surface-base inline-flex flex-wrap items-center gap-3 rounded-[16px] px-3.5 py-2.5",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(_o,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),c.jsx(Z,{id:"note-filters-items-label",as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Items"}),c.jsx(Ke,{value:String(e),"aria-labelledby":"note-filters-items-label",onValueChange:d=>{const l=Number(d);Ls(l)&&o(l)},variant:"ghost",size:"sm",children:Wt.map(d=>c.jsx(de,{value:String(d),children:d===Qt?`Default (${d})`:d},d))})]}),c.jsx("div",{className:"h-5 w-px bg-divider"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Tr,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),c.jsx(Z,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Sort"}),c.jsxs(Ke,{value:t,ariaLabel:"Sort field",onValueChange:d=>n(d),variant:"ghost",size:"sm",children:[c.jsx(de,{value:"updatedAt",children:"Updated"}),c.jsx(de,{value:"createdAt",children:"Created"})]}),c.jsxs(Ke,{value:s,ariaLabel:"Sort order",onValueChange:d=>r(d),variant:"ghost",size:"sm",children:[c.jsx(de,{value:"desc",children:"Newest"}),c.jsx(de,{value:"asc",children:"Oldest"})]})]}),c.jsx("div",{className:"h-5 w-px bg-divider"}),c.jsxs(Ms,{htmlFor:"pinnedFirst",size:"sm",className:"flex cursor-pointer items-center gap-1.5",children:[c.jsx(As,{id:"pinnedFirst",size:"sm",checked:a,onChange:d=>i(d.target.checked)}),c.jsx(Z,{as:"span",variant:"label",weight:"medium",tone:"secondary",children:"Pinned First"})]})]})})}const Ur=e=>{let o=!1;return()=>{o||(window.requestAnimationFrame(()=>{e(),o=!1}),o=!0)}},ze=new Map;function Kr(){const e=Ze({select:t=>t.pathname}),o=h.useRef(null);return h.useEffect(()=>{if(o.current?.parentElement){const{parentElement:t}=o.current,n=r=>{if(r!==0){ze.set(e,r);return}ze.delete(e)},s=Ur(()=>{if(o.current){const{scrollTop:r}=t;n(r)}});return t.scrollTop=ze.get(e)??0,t.addEventListener("scroll",s),()=>{t.removeEventListener("scroll",s)}}},[e]),c.jsx("div",{ref:o,className:"hidden"})}const gt=`
|
|
3
|
-
id
|
|
4
|
-
tabId
|
|
5
|
-
title
|
|
6
|
-
displayType
|
|
7
|
-
displayOptions {
|
|
8
|
-
tableColumns
|
|
9
|
-
tablePropertyKeys
|
|
10
|
-
boardGroupByPropertyKey
|
|
11
|
-
}
|
|
12
|
-
tagNames
|
|
13
|
-
mode
|
|
14
|
-
propertyFilters {
|
|
15
|
-
key
|
|
16
|
-
name
|
|
17
|
-
valueType
|
|
18
|
-
operator
|
|
19
|
-
value
|
|
20
|
-
}
|
|
21
|
-
sortBy
|
|
22
|
-
sortOrder
|
|
23
|
-
limit
|
|
24
|
-
order
|
|
25
|
-
`;function $i(){return j(`query FetchViewWorkspace {
|
|
26
|
-
viewWorkspace {
|
|
27
|
-
activeTabId
|
|
28
|
-
tabs {
|
|
29
|
-
id
|
|
30
|
-
title
|
|
31
|
-
order
|
|
32
|
-
sections {
|
|
33
|
-
${gt}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}`)}function Gr(e){return j(`query FetchViewSection($id: ID!) {
|
|
38
|
-
viewSection(id: $id) {
|
|
39
|
-
${gt}
|
|
40
|
-
}
|
|
41
|
-
}`,{id:e})}function Ui(e,{limit:o=25,offset:t=0,sortBy:n,sortOrder:s}={}){return j(`query FetchViewSectionNotes(
|
|
42
|
-
$id: ID!
|
|
43
|
-
$pagination: PaginationInput
|
|
44
|
-
$sortBy: ViewSortBy
|
|
45
|
-
$sortOrder: ViewSortOrder
|
|
46
|
-
) {
|
|
47
|
-
viewSectionNotes(id: $id, pagination: $pagination, sortBy: $sortBy, sortOrder: $sortOrder) {
|
|
48
|
-
totalCount
|
|
49
|
-
notes {
|
|
50
|
-
id
|
|
51
|
-
title
|
|
52
|
-
pinned
|
|
53
|
-
tags {
|
|
54
|
-
id
|
|
55
|
-
name
|
|
56
|
-
}
|
|
57
|
-
createdAt
|
|
58
|
-
updatedAt
|
|
59
|
-
properties {
|
|
60
|
-
key
|
|
61
|
-
name
|
|
62
|
-
value
|
|
63
|
-
valueType
|
|
64
|
-
option { id label value color order }
|
|
65
|
-
createdAt
|
|
66
|
-
updatedAt
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}`,{id:e,pagination:{limit:o,offset:t},sortBy:n,sortOrder:s})}function Ki(e,{optionValue:o,limit:t=5,offset:n=0}){return j(`query FetchViewSectionBoardColumn($id: ID!, $optionValue: String, $pagination: PaginationInput) {
|
|
71
|
-
viewSectionBoardColumn(id: $id, optionValue: $optionValue, pagination: $pagination) {
|
|
72
|
-
totalCount
|
|
73
|
-
notes {
|
|
74
|
-
id
|
|
75
|
-
title
|
|
76
|
-
updatedAt
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}`,{id:e,optionValue:o,pagination:{limit:t,offset:n}})}function Gi(e){return j(`mutation CreateViewTab($title: String!) {
|
|
80
|
-
createViewTab(title: $title) {
|
|
81
|
-
id
|
|
82
|
-
}
|
|
83
|
-
}`,{title:e})}function zi(e,o){return j(`mutation UpdateViewTab($id: ID!, $title: String!) {
|
|
84
|
-
updateViewTab(id: $id, title: $title) {
|
|
85
|
-
id
|
|
86
|
-
}
|
|
87
|
-
}`,{id:e,title:o})}function qi(e){return j(`mutation DeleteViewTab($id: ID!) {
|
|
88
|
-
deleteViewTab(id: $id)
|
|
89
|
-
}`,{id:e})}function Wi(e){return j(`mutation SetActiveViewTab($id: ID!) {
|
|
90
|
-
setActiveViewTab(id: $id) {
|
|
91
|
-
activeTabId
|
|
92
|
-
tabs {
|
|
93
|
-
id
|
|
94
|
-
title
|
|
95
|
-
order
|
|
96
|
-
sections {
|
|
97
|
-
${gt}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}`,{id:e})}function Qi(e){return j(`mutation ReorderViewTabs($tabIds: [ID!]!) {
|
|
102
|
-
reorderViewTabs(tabIds: $tabIds) {
|
|
103
|
-
id
|
|
104
|
-
}
|
|
105
|
-
}`,{tabIds:e})}function Xi(e,o){return j(`mutation CreateViewSection($tabId: ID!, $input: ViewSectionInput!) {
|
|
106
|
-
createViewSection(tabId: $tabId, input: $input) {
|
|
107
|
-
id
|
|
108
|
-
}
|
|
109
|
-
}`,{tabId:e,input:o})}function Yi(e,o){return j(`mutation UpdateViewSection($id: ID!, $input: ViewSectionInput!) {
|
|
110
|
-
updateViewSection(id: $id, input: $input) {
|
|
111
|
-
id
|
|
112
|
-
}
|
|
113
|
-
}`,{id:e,input:o})}function Ji(e){return j(`mutation DeleteViewSection($id: ID!) {
|
|
114
|
-
deleteViewSection(id: $id)
|
|
115
|
-
}`,{id:e})}function ec(e,o){return j(`mutation ReorderViewSections($tabId: ID!, $sectionIds: [ID!]!) {
|
|
116
|
-
reorderViewSections(tabId: $tabId, sectionIds: $sectionIds) {
|
|
117
|
-
id
|
|
118
|
-
}
|
|
119
|
-
}`,{tabId:e,sectionIds:o})}const zr=()=>null,qr=e=>e instanceof Element?e instanceof HTMLElement&&(e.isContentEditable||["INPUT","SELECT","TEXTAREA"].includes(e.tagName))?!0:!!e.closest('button, [role="button"], [role="dialog"], [role="menu"], [role="menuitem"], [role="listbox"]'):!1,Wr=()=>{const e=st();return h.useEffect(()=>{const o=t=>{t.defaultPrevented||!(t.metaKey||t.ctrlKey)||t.key.toLowerCase()!=="k"||qr(t.target)||(t.preventDefault(),e({to:be,search:{query:"",page:1,mode:"hybrid"}}))};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[e]),null},Qr="flex h-dvh min-h-0 w-full flex-row overflow-hidden",Xr=D("fixed","bottom-4","left-4","z-[1003]","flex","h-12","w-12","items-center","justify-center","rounded-[14px]","border","border-border-subtle","bg-surface","text-fg-secondary","shadow-[0_12px_24px_-18px_rgba(0,0,0,0.35)]","transition-all","hover:bg-hover-subtle","hover:text-fg-default","active:translate-y-px","aria-expanded:bg-hover-subtle","aria-expanded:text-fg-default"),Yr=D("fixed","z-[1002]","h-full","w-full","flex-[0_0_300px]","overflow-y-auto","border-r-0","border-border-subtle","bg-[var(--page-bg)]","pb-20","sm:w-[300px]","sm:border-r","min-[1000px]:static","min-[1000px]:w-auto","min-[1000px]:translate-x-0","min-[1000px]:pb-0","min-[1000px]:pointer-events-auto"),Jr="pointer-events-none -translate-x-full",ea="pointer-events-auto translate-x-0",ta=D("flex","h-full","min-h-0","min-w-0","flex-1","flex-col","overflow-x-hidden","overflow-y-auto","overscroll-contain","[scrollbar-gutter:stable]"),oa=D("sticky","top-0","z-[1001]","border-b","border-border-subtle","bg-[var(--page-bg)]","max-[999px]:after:content-['']","max-[999px]:after:pointer-events-none","max-[999px]:after:absolute","max-[999px]:after:inset-y-0","max-[999px]:after:right-0","max-[999px]:after:w-12","max-[999px]:after:bg-[linear-gradient(to_right,transparent,var(--page-bg))]"),sa=D("flex","items-center","overflow-x-auto","whitespace-nowrap","[scrollbar-width:none]","[&::-webkit-scrollbar]:hidden"),na=D("min-h-0","min-w-0","max-w-full","flex-1","overflow-x-clip","px-4","pt-4","after:block","after:h-4","after:content-['']","max-[999px]:after:h-24"),ra=({sidebar:e,topNavigation:o,children:t})=>{const n=Ze({select:i=>i.pathname}),[s,r]=h.useState(!1),a="site-layout-sidebar";return h.useEffect(()=>{r(!1)},[n]),c.jsxs("div",{className:Qr,children:[c.jsx(Wr,{}),c.jsx("div",{className:"min-[1000px]:hidden",children:c.jsx("button",{type:"button",className:Xr,"aria-label":"Toggle sidebar","aria-controls":a,"aria-expanded":s,onClick:()=>r(i=>!i),children:c.jsx(zo,{className:"h-6 w-6"})})}),c.jsx("aside",{id:a,className:D(Yr,s?ea:Jr),children:e}),c.jsxs("main",{className:ta,children:[c.jsx("div",{className:oa,children:c.jsx("div",{className:sa,children:o})}),c.jsx("div",{className:na,children:t}),c.jsx(Kr,{})]})]})},Co=e=>typeof e=="object"&&e!==null&&"value"in e&&typeof e.value=="string",To=(e,o)=>({type:"error",category:"graphql",errors:[{code:"INVALID_RESPONSE_SHAPE",message:`GraphQL response field "${e}" is missing or invalid`,details:o}]}),aa=async e=>{try{const o=await j(`
|
|
120
|
-
query GetServerCache($key: String!) {
|
|
121
|
-
cache(key: $key) {
|
|
122
|
-
value
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
`,{key:e});if(o.type==="error")throw o;if(!Co(o.cache))throw To("cache",o);return o.cache.value}catch{return""}},ia=async(e,o)=>{const t=await j(`
|
|
126
|
-
mutation SetServerCache($key: String!, $value: String!) {
|
|
127
|
-
setCache(key: $key, value: $value) {
|
|
128
|
-
value
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
`,{key:e,value:encodeURIComponent(o)});return t.type==="error"?t:Co(t.setCache)?{...t,setCache:t.setCache}:To("setCache",t)},ca=()=>{const e=qo(),o=Ts(),t=rt(),{data:n}=Wo({queryKey:ye.ui.heroBanner(),async queryFn(){return aa("heroBanner")}});return n?c.jsx("div",{className:"p-3 pb-0",children:c.jsxs("div",{className:"surface-base group relative overflow-hidden",children:[c.jsx("img",{alt:"Studio atmosphere banner",className:"w-full object-cover transition duration-500 group-hover:scale-[1.01] group-hover:opacity-90 dark:brightness-[0.85] dark:saturate-[0.9]",src:n}),c.jsx("button",{type:"button","aria-label":"Remove sidebar banner",title:"Remove banner",className:"focus-ring-soft absolute right-2 top-2 inline-flex h-8 w-8 items-center justify-center rounded-[10px] border border-white/14 bg-black/24 text-white/85 opacity-0 outline-none backdrop-blur-sm transition-opacity hover:bg-black/34 hover:text-white focus-visible:opacity-100 group-hover:opacity-100",onClick:async()=>{if(await e("Remove this hero banner from the sidebar?")){const s=await ia("heroBanner","");if(s.type==="error"){o(s.errors[0]?.message??"Failed to remove hero banner");return}await t.invalidateQueries({queryKey:ye.ui.heroBanner(),exact:!0})}},children:c.jsx(Cs,{className:"h-4 w-4",weight:"bold"})})]})}):null},tc=e=>{let{transform:o}=e;return{...o,y:0}},la=e=>{let{transform:o}=e;return{...o,x:0}},da=e=>{const{data:o}=Xt({queryKey:ye.notes.pinned(),async queryFn(){const t=await j(`
|
|
132
|
-
query FetchPinnedNotes {
|
|
133
|
-
pinnedNotes {
|
|
134
|
-
id
|
|
135
|
-
title
|
|
136
|
-
order
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
`);if(t.type==="error")throw t;return t.pinnedNotes}});return c.jsx(c.Fragment,{children:e.render(o)})},ua="focus-ring-soft flex h-8 w-8 items-center justify-center rounded-[10px] text-fg-tertiary opacity-70 outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default hover:opacity-100 focus-visible:opacity-100 active:cursor-grabbing touch-none",ha="focus-ring-soft block truncate rounded-[10px] px-1.5 py-1 outline-none transition-colors",pa=(e,o,t)=>{if(o===t)return null;const n=e.findIndex(i=>i.id===o),s=e.findIndex(i=>i.id===t);if(n<0||s<0)return null;const r=[...e],[a]=r.splice(n,1);return a?(r.splice(s,0,a),{nextItems:r,orders:r.map((i,d)=>({id:i.id,order:d}))}):null};function fa({id:e,title:o,isActive:t=!1,children:n}){const{attributes:s,listeners:r,setNodeRef:a,setActivatorNodeRef:i,transform:d,transition:l,isDragging:u}=dn({id:e}),f={transform:un.Transform.toString(d),transition:l,opacity:u?.5:1};return c.jsxs("div",{ref:a,style:f,className:D("group flex min-h-[38px] items-center gap-1.5 rounded-[12px] px-1.5 py-1 transition-colors",t?"bg-hover-subtle":"hover:bg-hover-subtle/70"),children:[c.jsx("button",{type:"button",ref:i,"aria-label":`Reorder note ${o??"Untitled"}`,title:"Drag to reorder",...s,...r,className:D(ua,u?"cursor-grabbing":"cursor-grab"),children:c.jsx(Ar,{className:"size-4"})}),c.jsx(Z,{as:"div",truncate:!0,variant:"meta",weight:"medium",className:"min-w-0 flex-1",children:n})]})}function ma({notes:e,pathname:o,pinnedItems:t,setPinnedItems:n,handleDragEnd:s,sensors:r}){h.useEffect(()=>{n(e)},[e,n]);const a=t.length>0?t:e;return a.length===0?null:c.jsx(on,{sensors:r,collisionDetection:sn,onDragEnd:s,modifiers:[la],children:c.jsx(nn,{items:a.map(i=>i.id),strategy:rn,children:a.map(i=>c.jsx(fa,{id:i.id,title:i.title||"Untitled",isActive:o===`/${i.id}`,children:c.jsx(Ce,{"aria-current":o===`/${i.id}`?"page":void 0,className:D(ha,o===`/${i.id}`?"text-fg-default":"text-fg-secondary hover:text-fg-default"),to:at,params:{id:i.id},children:i.title||"Untitled"})},i.id))})})}const ga=()=>{const e=Ze({select:i=>i.pathname}),o=rt(),[t,n]=h.useState([]),s=Qo({mutationFn:js,onSuccess:()=>{o.invalidateQueries({queryKey:ye.notes.pinned(),exact:!0})}}),r=tn(Pt(ln,{activationConstraint:{distance:8}}),Pt(cn,{coordinateGetter:an})),a=i=>{const{active:d,over:l}=i;l&&d.id!==l.id&&n(u=>{const f=pa(u,String(d.id),String(l.id));return f?(s.mutate(f.orders),f.nextItems):u})};return c.jsx("div",{className:"border-l border-border-subtle/70 pl-1.5",children:c.jsx(Yt,{fallback:c.jsxs("div",{className:"space-y-1",children:[c.jsx(he,{height:"40px",opacity:.4}),c.jsx(he,{height:"40px",opacity:.4})]}),errorTitle:"Failed to load pinned notes",errorDescription:"Retry loading the pinned note list.",renderError:({error:i,retry:d})=>c.jsx(Is,{title:"Failed to load pinned notes",description:"Retry loading the pinned note list.",error:i,onRetry:d,showBackAction:!1,showHomeAction:!1}),children:c.jsx(da,{render:i=>i.length>0?c.jsx(ma,{notes:i,pathname:e,pinnedItems:t,setPinnedItems:n,handleDragEnd:a,sensors:r}):c.jsx(Z,{as:"div",variant:"meta",tone:"secondary",className:"px-2 py-2.5 leading-6",children:"Pin a note from the note toolbar to keep it here."})})})})},ya=()=>c.jsx("section",{className:"p-3 pt-0","aria-label":"Pinned notes",children:c.jsx(ga,{})}),va="p-3 pb-0",xa="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",ba="flex items-center gap-2.5",Sa="inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-[13px] bg-cta text-fg-on-filled",wa="flex flex-col",Ra="h-4 w-4 text-fg-tertiary transition-colors group-hover:text-fg-default",_a=()=>{const{onCreate:e}=zt();return c.jsx("div",{className:va,children:c.jsxs("button",{type:"button",className:xa,onClick:()=>e(),children:[c.jsxs("span",{className:ba,children:[c.jsx("span",{className:Sa,children:c.jsx(Cr,{className:"h-4.5 w-4.5",weight:"bold"})}),c.jsxs("span",{className:wa,children:[c.jsx(Z,{variant:"meta",weight:"semibold",tracking:"tight",children:"Capture"}),c.jsx(Z,{variant:"label",tone:"secondary",children:"Open a new note"})]})]}),c.jsx(Vs,{className:Ra,weight:"bold"})]})})},Pa=/Mac|iPhone|iPad|iPod/i,Ea=()=>typeof navigator>"u"?"":`${navigator.platform} ${navigator.userAgent}`,Io=(e=Ea())=>Pa.test(e)?"⌘K":"Ctrl+K",La="focus-ring-soft surface-base group flex min-h-14 w-full items-center justify-between gap-3 px-3 py-2.5 text-left text-fg-default outline-none transition-colors hover:bg-hover-subtle",Ma=()=>{const e=st(),o=Io(),t=()=>{e({to:be,search:{query:"",page:1,mode:"hybrid"}})};return c.jsxs("button",{type:"button",className:La,"aria-label":"Open detailed search","aria-keyshortcuts":"Meta+K Control+K",onClick:t,children:[c.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[c.jsx("span",{className:"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-[13px] bg-muted text-fg-secondary transition-colors group-hover:text-fg-default",children:c.jsx(Eo,{className:"h-4.5 w-4.5",weight:"bold"})}),c.jsxs("span",{className:"flex min-w-0 flex-col",children:[c.jsx(Z,{as:"span",variant:"meta",weight:"semibold",tracking:"tight",children:"Search"}),c.jsx(Z,{as:"span",variant:"label",tone:"secondary",children:"Find a memory"})]})]}),c.jsx("span",{className:"shrink-0 rounded-[8px] bg-muted px-1.5 py-1 text-label font-medium text-fg-tertiary",children:o})]})},Aa=()=>c.jsx("div",{className:"p-3",children:c.jsx(Ma,{})}),Ca=[{name:"Search",path:be,icon:Eo},{name:"Notes",path:He,icon:_o},{name:"Views",path:it,icon:Xo},{name:"Graph",path:Jt,icon:Ir},{name:"Calendar",path:eo,icon:Mr},{name:"Reminders",path:to,icon:Yo},{name:"Tags",path:oo,icon:Jo},{name:"Setting",path:so,icon:es}],Ta=()=>{const e=Ze({select:t=>t.pathname}),o=Io();return c.jsx("nav",{"aria-label":"Primary navigation",className:"flex items-center gap-1 px-4 py-2.5",children:Ca.map((t,n)=>{const s=e===t.path||t.path!==He&&e.startsWith(`${t.path}/`),r=t.path===be?o:void 0;return c.jsxs(h.Fragment,{children:[n>0&&c.jsx("span",{className:"h-3.5 w-px shrink-0 bg-border-subtle"}),c.jsx(Ce,{to:t.path,"aria-keyshortcuts":r?"Meta+K Control+K":void 0,title:r?`${t.name} (${r})`:void 0,children:c.jsxs("div",{className:`flex min-w-26 items-center justify-center gap-2 border-b px-2 py-2 transition-colors ${s?"border-fg-muted text-fg-default":"border-transparent text-fg-secondary hover:border-border-subtle hover:text-fg-default"}`,children:[c.jsx(t.icon,{className:"size-5",weight:s?"fill":"regular"}),c.jsx(Z,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:t.name})]})})]},t.path)})})},Ia=({children:e})=>c.jsx(ra,{sidebar:c.jsxs(c.Fragment,{children:[c.jsx(ca,{}),c.jsx(_a,{}),c.jsx(Aa,{}),c.jsx(ya,{}),c.jsx(zr,{})]}),topNavigation:c.jsx(Ta,{}),children:e}),jo=100,Vo=[50,jo,200];function oc(e){return Vo.includes(e)}const tt=1,ja=100,Va=100,Na=256,No=1e5,ka=50,$t=25,ve=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),yt=e=>e.length>0&&e.length<=Na,Ha=e=>typeof e=="number"&&Number.isInteger(e)&&e>1&&e<=No?e:void 0,Fa=e=>typeof e=="number"&&Number.isInteger(e)&&e>1?Math.min(e,ka):void 0,Oa=e=>{if(!ve(e))return;const o=e.by,t=e.order;if(!(o!=="title"&&o!=="createdAt"&&o!=="updatedAt"||t!=="asc"&&t!=="desc"))return{by:o,order:t}},ko=e=>{if(!ve(e))return;const o=Ha(e.page),t=Oa(e.sort),n=ve(e.columns)?Object.fromEntries(Object.entries(e.columns).filter(([s])=>yt(s)).slice(0,Va).flatMap(([s,r])=>{const a=Fa(r);return a===void 0?[]:[[s,a]]})):{};if(!(o===void 0&&Object.keys(n).length===0&&t===void 0))return{...o===void 0?{}:{page:o},...Object.keys(n).length===0?{}:{columns:n},...t===void 0?{}:{sort:t}}},ot=e=>{if(!ve(e)||e.version!==tt||!ve(e.sections))return;const o=Object.fromEntries(Object.entries(e.sections).filter(([t])=>yt(t)).slice(0,ja).flatMap(([t,n])=>{const s=ko(n);return s===void 0?[]:[[t,s]]}));return Object.keys(o).length===0?void 0:{version:tt,sections:o}},Za=(e,o)=>e?.sections[o]??{},Ba=(e,o,t)=>{if(!yt(o))return ot(e);const n=ot(e),s=Za(n,o),r=ko(typeof t=="function"?t(s):t),a=Object.fromEntries(Object.entries({...n?.sections??{},[o]:r}).filter(i=>i[1]!==void 0));return Object.keys(a).length===0?void 0:{version:tt,sections:a}},Da=(e,o,t)=>{if(!Number.isSafeInteger(o)||o<=1)return;const n=Number.isSafeInteger(t)&&t>0?t:$t,s=Math.min(Number.MAX_SAFE_INTEGER,(o-1)*$t),r=Math.min(No,Math.floor(s/n)+1);return Ba(void 0,e,{page:r})},$a=["updatedAt","createdAt"],Ua=["referenceCount","name"],Ho=["asc","desc"],Ka=["create","update"],Ga=["hybrid","lexical","semantic"],za=["open","completed"],qa=["all","overdue","today","upcoming"],Wa=["all","high","medium","low"],Be=e=>Array.isArray(e)?e[0]:e,W=(e,o,{min:t=1,max:n=Number.MAX_SAFE_INTEGER}={})=>{const s=Be(e),r=typeof s=="number"?s:typeof s=="string"?Number(s):Number.NaN;return!Number.isInteger(r)||r<t||r>n?o:r},Fo=(e,o,t)=>{const n=W(e,Number.NaN);return o.includes(n)?n:t},Qa=(e,o=!1)=>{const t=Be(e);return t===!0||t==="true"?!0:t===!1||t==="false"?!1:o},Se=(e,o="")=>{const t=Be(e);return typeof t=="string"?t:o},q=(e,o,t)=>{const n=Be(e);return typeof n!="string"?t:o.includes(n)?n:t},Xa=e=>({page:W(e.page,1),limit:Fo(e.limit,Wt,Qt),sortBy:q(e.sortBy,$a,"updatedAt"),sortOrder:q(e.sortOrder,Ho,"desc"),pinnedFirst:Qa(e.pinnedFirst,!1)}),ce=e=>({page:W(e.page,1)}),Ya=e=>{const o=q(e.status,za,"open"),t=q(e.scope,qa,"all");return{page:W(e.page,1),status:o,scope:o==="completed"?"all":t,priority:q(e.priority,Wa,"all")}},Ja=e=>({page:W(e.page,1),query:Se(e.query,""),mode:q(e.mode,Ga,"hybrid")}),ei=e=>({page:W(e.page,1),query:Se(e.query,""),limit:Fo(e.limit,Vo,jo),sortBy:q(e.sortBy,Ua,"referenceCount"),sortOrder:q(e.sortOrder,Ho,"desc")}),ti=e=>({year:W(e.year,Rt().year(),{min:1970,max:9999}),month:W(e.month,Rt().month()+1,{min:1,max:12}),type:q(e.type,Ka,"create")}),oi=e=>{const o=Se(e.selected,"").trim();return o?{selected:o}:{}},si=e=>{const o=Se(e.tab,"").trim(),t=ot(e.state);return{...o?{tab:o}:{},...t?{state:t}:{}}},ni=e=>({page:W(e.page,1),sectionId:Se(e.sectionId,"")}),ri=e=>{const{data:o}=Xt({queryKey:ye.notes.list(e.searchParams),async queryFn(){const t=await Ns(e.searchParams);if(t.type==="error")throw t;return t.allNotes}});return e.render(o)};function ai({id:e,title:o,tags:t,pinned:n,updatedAt:s,onPinned:r,onDelete:a}){const i=ks(Number(s));return c.jsxs("div",{className:D("surface-base group relative flex h-full flex-col px-4 py-3.5 transition-colors"),children:[n&&c.jsx("div",{className:"absolute left-1/2 top-0 z-[1] -translate-x-1/2 -translate-y-[38%]",children:c.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:[c.jsx(ts,{className:"h-3.5 w-3.5",weight:"fill"}),c.jsx("span",{className:"sr-only",children:"Pinned note"})]})}),c.jsxs("div",{className:"flex h-full flex-col gap-2.5",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2.5",children:[c.jsx("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1",children:c.jsxs(Z,{as:"span",variant:"label",weight:"medium",tone:"secondary",children:["Updated ",i]})}),c.jsx(Hs,{button:c.jsx(os,{label:"Note actions",size:"sm"}),items:[{name:n?"Unpin":"Pin",onClick:()=>r?.()},{name:"Delete",onClick:()=>a?.()}]})]}),c.jsxs("div",{className:"flex flex-1 flex-col justify-between gap-2.5",children:[c.jsx(Z,{as:"div",variant:"body",weight:"semibold",tracking:"tight",className:"leading-[1.45]",children:c.jsx(Ce,{className:"line-clamp-2 transition-colors hover:text-fg-default/85",to:at,params:{id:e},children:o||"Untitled"})}),t.length>0&&c.jsx("div",{className:"flex flex-wrap gap-1.5 pt-0.5",children:t.map(d=>c.jsx(Ce,{to:no,params:{id:d.id},search:{page:1},children:c.jsx(Z,{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:d.name})},d.id))})]})]})]},e)}const Ut=Fs(He);function ii(){const e=Ut.useNavigate(),{limit:o,page:t,sortBy:n,sortOrder:s,pinnedFirst:r}=Ut.useSearch(),{onDelete:a,onPinned:i,deleteWarningDialog:d}=zt(),l=u=>{e({search:f=>({...f,...u})})};return c.jsxs(Os,{title:"",variant:"none",children:[c.jsxs("div",{className:"flex flex-col gap-5",children:[c.jsx($r,{itemsPerPage:o,onItemsPerPageChange:u=>l({limit:u,page:1}),sortBy:n,onSortByChange:u=>l({sortBy:u,page:1}),sortOrder:s,onSortOrderChange:u=>l({sortOrder:u,page:1}),pinnedFirst:r,onPinnedFirstChange:u=>l({pinnedFirst:u,page:1})}),c.jsx(Yt,{fallback:c.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[c.jsx(he,{height:"112px"}),c.jsx(he,{height:"112px"}),c.jsx(he,{height:"112px"})]}),errorTitle:"Failed to load notes",errorDescription:"Retry loading the current note list.",resetKeys:[t,o,n,s,r],children:c.jsx(ri,{searchParams:{offset:(t-1)*o,limit:o,sortBy:n,sortOrder:s,pinnedFirst:r},render:({notes:u,totalCount:f})=>c.jsx(Dt,{fallback:c.jsx(Bs,{title:"Ocean is calm",description:"Capture anything and make waves in the ocean!"}),children:u.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"grid-auto-cards grid gap-5",children:u.map(p=>c.jsx(ai,{...p,onPinned:()=>i(p.id,p.pinned),onDelete:()=>a(p.id)},p.id))}),c.jsx(Dt,{fallback:null,children:f&&o<f&&c.jsx(Zs,{page:t,last:Math.ceil(f/o),onChange:p=>{l({page:p})}})})]})})})})]}),d]})}const A=Ds({component:()=>c.jsx(Ia,{children:c.jsx(bo,{})}),errorComponent:Us,notFoundComponent:$s}),ci=M({getParentRoute:()=>A,path:He,component:ii,validateSearch:Xa}),li=M({getParentRoute:()=>A,path:eo,component:N(()=>V(()=>import("./Calendar-6otw_EJn.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]))),pendingComponent:()=>c.jsx(T,{title:"Loading calendar",description:"Preparing note and reminder snapshots."}),validateSearch:ti}),di=M({getParentRoute:()=>A,path:it,component:N(()=>V(()=>import("./Views-CL7rC05G.js"),__vite__mapDeps([8,1,7,4,2,3,9,10,11,12,13,14,6]))),pendingComponent:()=>c.jsx(T,{title:"Loading views",description:"Preparing your saved dashboards."}),validateSearch:si}),ui=M({getParentRoute:()=>A,path:to,component:N(()=>V(()=>import("./Reminders-DKm0GFI2.js"),__vite__mapDeps([15,1,2,3,16,4,12]))),pendingComponent:()=>c.jsx(T,{title:"Loading reminders",description:"Preparing your reminder workspace."}),validateSearch:Ya}),hi=M({getParentRoute:()=>A,path:Jt,component:N(()=>V(()=>import("./Graph-BHsmPDPh.js"),__vite__mapDeps([17,1,2,3,18,19,20,21,22,23,24,11,7,25,12]))),pendingComponent:()=>c.jsx(T,{title:"Loading graph",description:"Preparing the linked note constellation."}),validateSearch:oi}),pi=M({getParentRoute:()=>A,path:be,component:N(()=>V(()=>import("./Search-DVROxY_B.js"),__vite__mapDeps([26,1,4,2,3,27,12,11,7,28,29,6]))),pendingComponent:()=>c.jsx(T,{title:"Loading search",description:"Preparing indexed note results."}),validateSearch:Ja}),fi=M({getParentRoute:()=>A,path:oo,component:N(()=>V(()=>import("./Tag-wMHTRwlF.js"),__vite__mapDeps([30,1,2,3,9,4,6,7]))),pendingComponent:()=>c.jsx(T,{title:"Loading tags",description:"Preparing the tag catalog."}),validateSearch:ei}),mi=M({getParentRoute:()=>A,path:at,component:N(()=>V(()=>import("./Note-Dq2Szaxd.js"),__vite__mapDeps([31,1,2,3,4,5,32,27,14,10,16,33,34,35,6,36,37,25,38,9,29]))),pendingComponent:()=>c.jsx(T,{title:"Loading note",description:"Preparing the editor and note content."})}),gi=M({getParentRoute:()=>A,path:no,component:N(()=>V(()=>import("./TagNotes-BRza6i14.js"),__vite__mapDeps([39,1,2,3,32,4,27,14,6,7]))),pendingComponent:()=>c.jsx(T,{title:"Loading tagged notes",description:"Preparing notes for the selected tag."}),validateSearch:ce}),yi=M({getParentRoute:()=>A,path:zs,validateSearch:ni,beforeLoad:async({search:e})=>{const o=e.sectionId?await Gr(e.sectionId).catch(()=>null):null,t=o?.type==="success"?o.viewSection:null;throw Ks({to:it,search:{tab:t?.tabId,state:t?Da(t.id,e.page,t.limit):void 0},replace:!0})}}),vi=M({getParentRoute:()=>A,path:so,component:N(()=>V(()=>import("./index-BEfKfbvr.js"),__vite__mapDeps([40,1,4,2,3,41,42,43,6,7]))),pendingComponent:()=>c.jsx(T,{title:"Loading settings",description:"Preparing workspace preferences."})}),xi=M({getParentRoute:()=>A,path:Ws,component:N(()=>V(()=>import("./mcp-B-aGeAQD.js"),__vite__mapDeps([44,1,4,2,3,41,38]))),pendingComponent:()=>c.jsx(T,{title:"Loading MCP settings",description:"Preparing MCP access controls."})}),bi=M({getParentRoute:()=>A,path:qs,component:N(()=>V(()=>import("./search-BmXuuK26.js"),__vite__mapDeps([45,1,4,2,3,28,13,6,7]))),pendingComponent:()=>c.jsx(T,{title:"Loading search settings",description:"Preparing semantic search controls."})}),Si=M({getParentRoute:()=>A,path:Qs,component:N(()=>V(()=>import("./trash-GulvRh9f.js"),__vite__mapDeps([46,1,4,2,3,10,32,27,14]))),pendingComponent:()=>c.jsx(T,{title:"Loading trash",description:"Preparing deleted notes for restore."}),validateSearch:ce}),wi=M({getParentRoute:()=>A,path:Xs,component:N(()=>V(()=>import("./manage-image-m-7v_Z1W.js"),__vite__mapDeps([47,1,2,3,4,37,48,10,43]))),pendingComponent:()=>c.jsx(T,{title:"Loading image manager",description:"Preparing uploaded image metadata."}),validateSearch:ce}),Ri=M({getParentRoute:()=>A,path:Ys,component:N(()=>V(()=>import("./manage-image-detail-BNYOCSmu.js"),__vite__mapDeps([49,1,2,3,4,37,48,10,32,27,14,43,42,6,7]))),pendingComponent:()=>c.jsx(T,{title:"Loading image detail",description:"Preparing references for the selected image."}),validateSearch:ce}),_i=M({getParentRoute:()=>A,path:en,component:N(()=>V(()=>import("./properties-B93_V2uD.js"),__vite__mapDeps([50,1,4,2,3]))),pendingComponent:()=>c.jsx(T,{title:"Loading properties",description:"Preparing shared property definitions."}),validateSearch:ce}),Pi=M({getParentRoute:()=>A,path:Js,component:N(()=>V(()=>import("./placeholder-C5fNzKrL.js"),__vite__mapDeps([51,1,4,2,3,10,14,6,7]))),pendingComponent:()=>c.jsx(T,{title:"Loading placeholders",description:"Preparing template replacement rules."}),validateSearch:ce}),Ei=A.addChildren([ci,di,li,ui,hi,pi,fi,mi,gi,yi,vi,bi,xi,Si,wi,Ri,Pi,_i]),Li=vr({routeTree:Ei,defaultPreload:"intent",scrollRestoration:!0,defaultPendingComponent:()=>c.jsx(T,{title:"Loading page",description:"Preparing the next route."})});function Mi(){const e=We(t=>t.setSystemTheme),o=We(t=>t.setTheme);return h.useEffect(()=>{const t=_t();return t&&o(t),fn.listenThemeChange(n=>{_t()||e(n?"dark":"light")},t==null)},[e,o]),c.jsx(Dr,{children:c.jsx(Sr,{router:Li})})}const Oo="__oceanBrainCsrfRetry";let qe;const Ai=e=>!ae.isAxiosError(e)||e.response?.status!==403?!1:e.response.data?.code==="CSRF_TOKEN_INVALID",Zo=e=>{if(!Ai(e)||!ae.isAxiosError(e))return!1;const o=e.config;return!!(o&&!o[Oo])},Ci=()=>(qe??=ke().finally(()=>{qe=void 0}),qe),Kt=(e,o)=>{if(!e)return;const t=e;if(typeof t.delete=="function"){t.delete(o);return}delete e[o]},Ti=e=>{Kt(e.headers,"X-XSRF-TOKEN"),Kt(e.headers,"x-xsrf-token")},Ii=async e=>{if(!Zo(e)||!ae.isAxiosError(e))return Promise.reject(e);const o=e.config;return o[Oo]=!0,await Ci()!=="active"?Promise.reject(e):(Ti(o),ae.request(o))};let Gt;const ji=()=>{Gt===void 0&&(Gt=ae.interceptors.response.use(e=>e,e=>{if(Nr(e))Ao();else if(Zo(e))return Ii(e);return Promise.reject(e)}))};We.setState({theme:Gs()});ji();ke();ss.createRoot(document.getElementById("root")).render(c.jsx(Bo.StrictMode,{children:c.jsx(Mi,{})}));export{Dt as F,ai as N,Vo as T,jo as a,Tr as b,ia as c,Cr as d,Mr as e,Eo as f,Ki as g,Ui as h,oc as i,$i as j,la as k,Za as l,Ar as m,Wi as n,Gi as o,zi as p,qi as q,tc as r,_o as s,Xi as t,Ba as u,Yi as v,Ji as w,Qi as x,ec as y};
|