react-reason-editor 1.0.80 → 1.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/{BubbleMenus-vqNuXWlm.cjs → BubbleMenus-D1uFJJL1.cjs} +1 -1
  2. package/dist/{BubbleMenus-CIOMgQ-M.js → BubbleMenus-DIKbCm67.js} +1 -1
  3. package/dist/FontSize.cjs +1 -1
  4. package/dist/FontSize.js +1 -1
  5. package/dist/{Heading-Bcrl3eKU.js → Heading-BCa-LW8o.js} +1 -1
  6. package/dist/Heading.cjs +1 -1
  7. package/dist/Heading.js +1 -1
  8. package/dist/LineHeight.cjs +1 -1
  9. package/dist/LineHeight.js +1 -1
  10. package/dist/{MoreMark-Bfsa3STU.js → MoreMark-DOhnB4xI.js} +1 -1
  11. package/dist/MoreMark.cjs +1 -1
  12. package/dist/MoreMark.js +1 -1
  13. package/dist/{ReasonDocs-Cwj6pAAY.js → ReasonDocs-D-vS87iT.js} +104 -105
  14. package/dist/{ReasonDocs-CXj3ne3U.cjs → ReasonDocs-UxpbwteO.cjs} +1 -1
  15. package/dist/{RichTextProvider-BuTrDlZY.cjs → RichTextProvider-COW59xhl.cjs} +1 -1
  16. package/dist/{RichTextProvider-D9EtjDKS.js → RichTextProvider-ChSp_ZVC.js} +1 -1
  17. package/dist/{bubble-BhkjoWdo.js → bubble-BrxMujzD.js} +1 -1
  18. package/dist/bubble.cjs +1 -1
  19. package/dist/bubble.js +1 -1
  20. package/dist/docs-agent.cjs +1 -1
  21. package/dist/docs-agent.js +1 -1
  22. package/dist/dropdown-menu-By9VjdjW.cjs +1 -0
  23. package/dist/dropdown-menu-tmQwCqOR.js +2 -0
  24. package/dist/editor-kit.cjs +1 -1
  25. package/dist/editor-kit.js +1 -1
  26. package/dist/editorConfig-BAZYamPM.cjs +1 -0
  27. package/dist/{editorConfig-BR7z-P0e.js → editorConfig-DqEFArGq.js} +1 -1
  28. package/dist/features/settings/sections/FileSourcesSection.d.ts +5 -1
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/reason-docs.cjs +1 -1
  32. package/dist/reason-docs.js +1 -1
  33. package/dist/{reason-toolbar-skin-CD4T53He.cjs → reason-toolbar-skin-C5X8hUwr.cjs} +1 -1
  34. package/dist/{reason-toolbar-skin-BNYK97ET.js → reason-toolbar-skin-e9MfqS7c.js} +1 -1
  35. package/dist/style.css +1 -1
  36. package/package.json +2 -2
  37. package/dist/dropdown-menu-BNKyUimd.cjs +0 -1
  38. package/dist/dropdown-menu-BhMqMb9N.js +0 -2
  39. package/dist/editorConfig-CHBSp2KG.cjs +0 -1
  40. package/dist/features/settings/sections/StorageSection.d.ts +0 -6
@@ -1,4 +1,4 @@
1
- import{a as e,n as t,r}from"./rolldown-runtime-Drgf5FY8.js";import{s as n,t as a}from"./dist-DmY5xFkC.js";import{_ as o,g as i,h as s,l,o as c,p as d,u,w as h,x as p,y as m}from"./tooltip-G11f5UOp.js";import{i as f,m as g,n as v,t as y}from"./editorConfig-BR7z-P0e.js";import{n as b}from"./locales-rT_qjKW9.js";import{n as x,t as w}from"./BubbleMenus-CIOMgQ-M.js";import{t as S}from"./Icon-B4rxamCu.js";import{a as k,c as C,i as N,l as T,o as A,s as M,t as D,u as E}from"./Comment-DcnVhRwn.js";import{S as I,Z as R,_ as z,at as _,dt as P,et as O,ft as L,g as F,h as B,i as V,lt as $,m as H,mt as j,n as q,pt as U,r as G,st as W,t as K,ut as Y,y as X}from"./reason-toolbar-skin-BNYK97ET.js";import{themeActions as Z,useTheme as J}from"./theme.js";import"./katex.min-CveY35r9.js";import*as Q from"react";import ee,{Children as te,Component as re,Fragment as ne,createContext as ae,createElement as oe,forwardRef as ie,isValidElement as se,memo as le,useCallback as ce,useContext as de,useEffect as ue,useId as he,useImperativeHandle as pe,useInsertionEffect as me,useLayoutEffect as fe,useMemo as ge,useRef as ve,useState as ye}from"react";import{Slot as be}from"@radix-ui/react-slot";import xe from"clsx";import{Fragment as we,jsx as Se,jsxs as ke}from"react/jsx-runtime";import{Building2 as Ce,Check as Ne,CheckIcon as Te,ChevronDown as Ae,ChevronRight as Me,ChevronRightIcon as De,ChevronUp as Ee,CircleIcon as Ie,Cloud as Re,Command as ze,Crown as _e,Database as Pe,Edit2 as Oe,Edit3 as Le,Eye as Fe,FileText as Be,Globe as Ve,HardDrive as $e,HelpCircle as He,Info as je,Keyboard as qe,Link2 as Ue,Lock as Ge,LogIn as We,Mail as Ke,Menu as Ye,MessageSquare as Xe,MessageSquarePlus as Ze,Monitor as Je,Moon as Qe,Paintbrush as et,PanelRight as tt,Plus as rt,RotateCcw as nt,Search as at,Server as ot,Settings as it,Shield as st,Sun as lt,Trash2 as ct,UserPlus as dt,Users as ut,Wand2 as ht,Workflow as pt,X as mt,XIcon as ft}from"lucide-react";import*as gt from"@radix-ui/react-dialog";import{createDialogScope as vt}from"@radix-ui/react-dialog";import*as yt from"react-dom";import bt,{createPortal as xt}from"react-dom";import*as wt from"@radix-ui/react-dropdown-menu";import*as St from"@radix-ui/react-label";import*as kt from"@radix-ui/react-select";import*as Ct from"@radix-ui/react-separator";import*as Nt from"@radix-ui/react-tooltip";import*as Tt from"@radix-ui/react-switch";import*as At from"@radix-ui/react-tabs";import Mt from"grab-url";import{Resizable as Dt}from"re-resizable";var Et=Object.defineProperty,It=(e,t)=>Et(e,"name",{value:t,configurable:!0}),[Rt,zt]=E("AlertDialog",[vt]),_t=vt(),Pt=/* @__PURE__ */It(e=>{const{__scopeAlertDialog:t,...r}=e,n=_t(t);/* @__PURE__ */
1
+ import{a as e,n as t,r}from"./rolldown-runtime-Drgf5FY8.js";import{s as n,t as a}from"./dist-DmY5xFkC.js";import{_ as o,g as i,h as s,l,o as c,p as d,u,w as h,x as p,y as m}from"./tooltip-G11f5UOp.js";import{i as f,m as g,n as v,t as y}from"./editorConfig-DqEFArGq.js";import{n as b}from"./locales-rT_qjKW9.js";import{n as x,t as w}from"./BubbleMenus-DIKbCm67.js";import{t as S}from"./Icon-B4rxamCu.js";import{a as k,c as C,i as N,l as T,o as A,s as M,t as D,u as E}from"./Comment-DcnVhRwn.js";import{S as I,Z as R,_ as z,at as _,dt as P,et as O,ft as L,g as F,h as B,i as V,lt as $,m as H,mt as j,n as q,pt as U,r as G,st as W,t as K,ut as Y,y as X}from"./reason-toolbar-skin-e9MfqS7c.js";import{themeActions as Z,useTheme as J}from"./theme.js";import"./katex.min-CveY35r9.js";import*as Q from"react";import ee,{Children as te,Component as re,Fragment as ne,createContext as ae,createElement as oe,forwardRef as ie,isValidElement as se,memo as le,useCallback as ce,useContext as de,useEffect as ue,useId as he,useImperativeHandle as pe,useInsertionEffect as me,useLayoutEffect as fe,useMemo as ge,useRef as ve,useState as ye}from"react";import{Slot as be}from"@radix-ui/react-slot";import xe from"clsx";import{Fragment as we,jsx as Se,jsxs as ke}from"react/jsx-runtime";import{Building2 as Ce,Check as Ne,CheckIcon as Te,ChevronDown as Ae,ChevronRight as Me,ChevronRightIcon as De,ChevronUp as Ee,CircleIcon as Ie,Cloud as Re,Command as ze,Crown as _e,Database as Pe,Edit2 as Oe,Edit3 as Le,Eye as Fe,FileText as Be,Globe as Ve,HardDrive as $e,HelpCircle as He,Info as je,Keyboard as qe,Link2 as Ue,Lock as Ge,LogIn as We,Mail as Ke,Menu as Ye,MessageSquare as Xe,MessageSquarePlus as Ze,Monitor as Je,Moon as Qe,Paintbrush as et,PanelRight as tt,Plus as rt,RotateCcw as nt,Search as at,Server as ot,Settings as it,Shield as st,Sun as lt,Trash2 as ct,UserPlus as dt,Users as ut,Wand2 as ht,Workflow as pt,X as mt,XIcon as ft}from"lucide-react";import*as gt from"@radix-ui/react-dialog";import{createDialogScope as vt}from"@radix-ui/react-dialog";import*as yt from"react-dom";import bt,{createPortal as xt}from"react-dom";import*as wt from"@radix-ui/react-dropdown-menu";import*as St from"@radix-ui/react-label";import*as kt from"@radix-ui/react-select";import*as Ct from"@radix-ui/react-separator";import*as Nt from"@radix-ui/react-tooltip";import*as Tt from"@radix-ui/react-switch";import*as At from"@radix-ui/react-tabs";import Mt from"grab-url";import{Resizable as Dt}from"re-resizable";var Et=Object.defineProperty,It=(e,t)=>Et(e,"name",{value:t,configurable:!0}),[Rt,zt]=E("AlertDialog",[vt]),_t=vt(),Pt=/* @__PURE__ */It(e=>{const{__scopeAlertDialog:t,...r}=e,n=_t(t);/* @__PURE__ */
2
2
  return Se(gt.Root,{...n,...r,modal:!0})},"AlertDialog"),Ot=(/* @__PURE__ */Q.forwardRef(/* @__PURE__ */It(function(e,t){const{__scopeAlertDialog:r,...n}=e,a=_t(r);/* @__PURE__ */
3
3
  return Se(gt.Trigger,{...a,...n,ref:t})},"AlertDialogTrigger")),It(e=>{const{__scopeAlertDialog:t,...r}=e,n=_t(t);/* @__PURE__ */
4
4
  return Se(gt.Portal,{...n,...r})},"AlertDialogPortal")),Lt=Q.forwardRef(/* @__PURE__ */It(function(e,t){const{__scopeAlertDialog:r,...n}=e,a=_t(r);/* @__PURE__ */
@@ -302,110 +302,109 @@ return ke("div",{className:"space-y-6",children:[
302
302
  /* @__PURE__ */ke("div",{className:"space-y-4",children:[
303
303
  /* @__PURE__ */Se(xD,{className:"text-base",children:"Default Sidebar View"}),
304
304
  /* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground mb-2",children:"Choose the default view when opening the application"}),
305
- /* @__PURE__ */Se(wD,{value:e,onValueChange:e=>t?.(e),className:"space-y-3",children:[{value:"tree",label:"Documents Tree",desc:"Show only the document tree"},{value:"outline",label:"Outline Only",desc:"Show only the headings outline"},{value:"split",label:"Split View",desc:"Show both tree and outline side by side"},{value:"last-used",label:"Remember Last Used",desc:"Use the view you had open last time"}].map(e=>/* @__PURE__ */ke("div",{className:"flex items-start space-x-3",children:[/* @__PURE__ */Se(SD,{value:e.value,id:e.value,className:"mt-1"}),/* @__PURE__ */ke("label",{htmlFor:e.value,className:"flex-1 cursor-pointer",children:[/* @__PURE__ */Se("div",{className:"flex items-center gap-2 mb-1",children:/* @__PURE__ */Se("span",{className:"font-medium",children:e.label})}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:e.desc})]})]},e.value))})]})]})},_D=({enableDatabaseSync:e=!1,onEnableDatabaseSyncChange:t})=>/* @__PURE__ */ke("div",{className:"space-y-6",children:[
306
- /* @__PURE__ */ke("div",{children:[/* @__PURE__ */Se("h2",{className:"text-xl font-semibold mb-2",children:"Storage"}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"Manage how your documents are stored"})]}),
307
- /* @__PURE__ */Se(eD,{}),
308
- /* @__PURE__ */ke("div",{className:"space-y-4",children:[/* @__PURE__ */ke("div",{className:"flex items-start justify-between",children:[/* @__PURE__ */ke("div",{className:"space-y-1",children:[/* @__PURE__ */ke(xD,{className:"text-base flex items-center gap-2",children:[/* @__PURE__ */Se(Pe,{className:"h-4 w-4"}),"Database Sync"]}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"Save documents to SQL database for persistent storage"})]}),/* @__PURE__ */Se("input",{type:"checkbox",id:"database-sync",checked:e,onChange:e=>t?.(e.target.checked),className:"h-4 w-4 rounded border-gray-300"})]}),/* @__PURE__ */Se("div",e?{className:"rounded-md bg-muted p-3 space-y-2",children:/* @__PURE__ */ke("div",{className:"flex items-start gap-2",children:[/* @__PURE__ */Se(je,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),/* @__PURE__ */ke("div",{className:"space-y-1",children:[/* @__PURE__ */Se("p",{className:"text-sm font-medium",children:"Database Sync Enabled"}),/* @__PURE__ */Se("p",{className:"text-xs text-muted-foreground",children:"Your documents will be automatically saved to the database. Changes are synced every 2 seconds after editing."})]})]})}:{className:"rounded-md bg-muted p-3 space-y-2",children:/* @__PURE__ */ke("div",{className:"flex items-start gap-2",children:[/* @__PURE__ */Se($e,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),/* @__PURE__ */ke("div",{className:"space-y-1",children:[/* @__PURE__ */Se("p",{className:"text-sm font-medium",children:"Local Storage Only"}),/* @__PURE__ */Se("p",{className:"text-xs text-muted-foreground",children:"Your documents are stored in your browser's local storage. They won't be accessible from other devices."})]})]})})]})]});Array(12).fill(0);var PD=1,OD=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;const{message:r,...n}=e,a="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:PD++,o=this.toasts.find(e=>e.id===a),i=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(t=>t.id===a?(this.publish({...t,...e,id:a,title:r}),{...t,...e,id:a,dismissible:i,title:r}):t):this.addToast({title:r,...n,dismissible:i,id:a}),a},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;void 0!==t.loading&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));const n=Promise.resolve(e instanceof Function?e():e);let a,o=void 0!==r;const i=n.then(async e=>{if(a=["resolve",e],ee.isValidElement(e))o=!1,this.create({id:r,type:"default",message:e});else if(LD(e)&&!e.ok){o=!1;const n="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,a="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description,i="object"!=typeof n||ee.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:a,...i})}else if(e instanceof Error){o=!1;const n="function"==typeof t.error?await t.error(e):t.error,a="function"==typeof t.description?await t.description(e):t.description,i="object"!=typeof n||ee.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:a,...i})}else if(void 0!==t.success){o=!1;const n="function"==typeof t.success?await t.success(e):t.success,a="function"==typeof t.description?await t.description(e):t.description,i="object"!=typeof n||ee.isValidElement(n)?{message:n}:n;this.create({id:r,type:"success",description:a,...i})}}).catch(async e=>{if(a=["reject",e],void 0!==t.error){o=!1;const n="function"==typeof t.error?await t.error(e):t.error,a="function"==typeof t.description?await t.description(e):t.description,i="object"!=typeof n||ee.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:a,...i})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),null==t.finally||t.finally.call(t)}),s=()=>new Promise((e,t)=>i.then(()=>"reject"===a[0]?t(a[1]):e(a[1])).catch(t));return"string"!=typeof r&&"number"!=typeof r?{unwrap:s}:Object.assign(r,{unwrap:s})},this.custom=(e,t)=>{const r=(null==t?void 0:t.id)||PD++;return this.create({jsx:e(r),id:r,...t}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=/* @__PURE__ */new Set}},LD=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,FD=(e,t)=>{const r=(null==t?void 0:t.id)||PD++;return OD.addToast({title:e,...t,id:r}),r},BD=Object.assign(FD,{success:OD.success,info:OD.info,warning:OD.warning,error:OD.error,custom:OD.custom,message:OD.message,promise:OD.promise,dismiss:OD.dismiss,loading:OD.loading},{getHistory:()=>OD.toasts,getToasts:()=>OD.getActiveToasts()});!function(e){if(!e||"undefined"==typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");var VD={name:"",type:"local",credentials:{}},$D=({open:e})=>{const[t,r]=ye([]),[n,a]=ye(null),[o,i]=ye(VD);ue(()=>{e&&r(Yf())},[e]);const s=()=>{o.name.trim()?(n&&"new"!==n?(!function(e,t){Xf(Yf().map(r=>r.id===e?{...r,...t,updatedAt:/* @__PURE__ */(new Date).toISOString()}:r))}(n,{name:o.name,credentials:"local"!==o.type?o.credentials:void 0}),BD.success("Source updated")):(!function(e){let t={...e,id:`${e.type}-${Date.now()}`,createdAt:/* @__PURE__ */(new Date).toISOString(),updatedAt:/* @__PURE__ */(new Date).toISOString()};Xf([...Yf(),t])}({name:o.name,type:o.type,credentials:"local"!==o.type?o.credentials:void 0}),BD.success("Source added")),r(Yf()),a(null),i(VD)):BD.error("Please enter a source name")},l=e=>{!function(e){"local-default"!==e&&(Xf(Yf().filter(t=>t.id!==e)),Zf()===e&&Jf("local-default"))}(e),r(Yf()),BD.success("Source deleted")},c=()=>{a(null),i(VD)},d=e=>o.credentials[e],u=e=>i(t=>({...t,credentials:{...t.credentials,...e}})),h=({type:e})=>"local"===e?/* @__PURE__ */Se($e,{className:"h-4 w-4"}):"ssh"===e?/* @__PURE__ */Se(ot,{className:"h-4 w-4"}):"s3"===e||"b2"===e?/* @__PURE__ */Se(Re,{className:"h-4 w-4"}):"r2"===e?/* @__PURE__ */Se(Pe,{className:"h-4 w-4"}):"gdocs"===e?/* @__PURE__ */Se(Be,{className:"h-4 w-4"}):"turso"===e?/* @__PURE__ */Se(pt,{className:"h-4 w-4"}):null,p=e=>"ssh"===e?/* @__PURE__ */ke(we,{children:[
309
- /* @__PURE__ */Se(HD,{label:"Host",children:/* @__PURE__ */Se(BM,{value:d("host")||"",onChange:e=>u({host:e.target.value}),placeholder:"example.com"})}),
310
- /* @__PURE__ */ke("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */Se(HD,{label:"Port",children:/* @__PURE__ */Se(BM,{type:"number",value:d("port")||22,onChange:e=>u({port:parseInt(e.target.value)}),placeholder:"22"})}),/* @__PURE__ */Se(HD,{label:"Username",children:/* @__PURE__ */Se(BM,{value:d("username")||"",onChange:e=>u({username:e.target.value}),placeholder:"user"})})]}),
311
- /* @__PURE__ */Se(HD,{label:"Password (Optional)",children:/* @__PURE__ */Se(BM,{type:"password",value:d("password")||"",onChange:e=>u({password:e.target.value}),placeholder:"••••••••"})}),
312
- /* @__PURE__ */Se(HD,{label:"Base Path (Optional)",children:/* @__PURE__ */Se(BM,{value:d("basePath")||"",onChange:e=>u({basePath:e.target.value}),placeholder:"/home/user/documents"})})]}):"s3"===e?/* @__PURE__ */ke(we,{children:[
313
- /* @__PURE__ */Se(HD,{label:"Access Key ID",children:/* @__PURE__ */Se(BM,{value:d("accessKeyId")||"",onChange:e=>u({accessKeyId:e.target.value}),placeholder:"AKIAIOSFODNN7EXAMPLE"})}),
314
- /* @__PURE__ */Se(HD,{label:"Secret Access Key",children:/* @__PURE__ */Se(BM,{type:"password",value:d("secretAccessKey")||"",onChange:e=>u({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),
315
- /* @__PURE__ */ke("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */Se(HD,{label:"Region",children:/* @__PURE__ */Se(BM,{value:d("region")||"",onChange:e=>u({region:e.target.value}),placeholder:"us-east-1"})}),/* @__PURE__ */Se(HD,{label:"Bucket",children:/* @__PURE__ */Se(BM,{value:d("bucket")||"",onChange:e=>u({bucket:e.target.value}),placeholder:"my-bucket"})})]})]}):"r2"===e?/* @__PURE__ */ke(we,{children:[
316
- /* @__PURE__ */Se(HD,{label:"Account ID",children:/* @__PURE__ */Se(BM,{value:d("accountId")||"",onChange:e=>u({accountId:e.target.value}),placeholder:"your-account-id"})}),
317
- /* @__PURE__ */Se(HD,{label:"Access Key ID",children:/* @__PURE__ */Se(BM,{value:d("accessKeyId")||"",onChange:e=>u({accessKeyId:e.target.value}),placeholder:"your-access-key-id"})}),
318
- /* @__PURE__ */Se(HD,{label:"Secret Access Key",children:/* @__PURE__ */Se(BM,{type:"password",value:d("secretAccessKey")||"",onChange:e=>u({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),
319
- /* @__PURE__ */Se(HD,{label:"Bucket",children:/* @__PURE__ */Se(BM,{value:d("bucket")||"",onChange:e=>u({bucket:e.target.value}),placeholder:"my-bucket"})})]}):"b2"===e?/* @__PURE__ */ke(we,{children:[
320
- /* @__PURE__ */Se(HD,{label:"Access Key ID",children:/* @__PURE__ */Se(BM,{value:d("accessKeyId")||"",onChange:e=>u({accessKeyId:e.target.value}),placeholder:"your-key-id"})}),
321
- /* @__PURE__ */Se(HD,{label:"Secret Access Key",children:/* @__PURE__ */Se(BM,{type:"password",value:d("secretAccessKey")||"",onChange:e=>u({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),
322
- /* @__PURE__ */Se(HD,{label:"Bucket",children:/* @__PURE__ */Se(BM,{value:d("bucket")||"",onChange:e=>u({bucket:e.target.value}),placeholder:"my-bucket"})}),
323
- /* @__PURE__ */Se(HD,{label:"Endpoint (Optional)",children:/* @__PURE__ */Se(BM,{value:d("endpoint")||"",onChange:e=>u({endpoint:e.target.value}),placeholder:"https://s3.us-west-004.backblazeb2.com"})})]}):"gdocs"===e?/* @__PURE__ */ke(we,{children:[
324
- /* @__PURE__ */Se(HD,{label:"Email",children:/* @__PURE__ */Se(BM,{value:d("email")||"",onChange:e=>u({email:e.target.value}),placeholder:"user@gmail.com",disabled:!0})}),
325
- /* @__PURE__ */ke(HD,{label:"Folder IDs (comma-separated)",children:[/* @__PURE__ */Se(sc,{value:d("folderIds")?.join(", ")||"",onChange:e=>u({folderIds:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}),placeholder:"folder-id-1, folder-id-2",rows:3}),/* @__PURE__ */Se("p",{className:"text-xs text-muted-foreground",children:"Enter Google Drive folder IDs to sync (one per line or comma-separated)"})]}),
326
- /* @__PURE__ */ke("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md",children:[/* @__PURE__ */Se("div",{className:"flex-1",children:/* @__PURE__ */Se("p",{className:"text-sm font-medium",children:d("isAuthenticated")?"Connected to Google":"Not authenticated"})}),/* @__PURE__ */ke(ic,{size:"sm",variant:"outline",children:[/* @__PURE__ */Se(We,{className:"h-4 w-4 mr-2"}),d("isAuthenticated")?"Reconnect":"Authenticate"]})]})]}):"turso"===e?/* @__PURE__ */ke(we,{children:[
327
- /* @__PURE__ */Se(HD,{label:"Database Endpoint",children:/* @__PURE__ */Se(BM,{value:d("endpoint")||"",onChange:e=>u({endpoint:e.target.value}),placeholder:"https://your-db.turso.io"})}),
328
- /* @__PURE__ */Se(HD,{label:"Auth Token (Optional)",children:/* @__PURE__ */Se(BM,{type:"password",value:d("authToken")||"",onChange:e=>u({authToken:e.target.value}),placeholder:"••••••••"})}),
329
- /* @__PURE__ */Se(HD,{label:"Database Name (Optional)",children:/* @__PURE__ */Se(BM,{value:d("database")||"",onChange:e=>u({database:e.target.value}),placeholder:"my-database"})}),
330
- /* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se("input",{type:"checkbox",id:"gdocs-sync",checked:d("enableGoogleDocsSync")||!1,onChange:e=>u({enableGoogleDocsSync:e.target.checked}),className:"h-4 w-4"}),/* @__PURE__ */Se(xD,{htmlFor:"gdocs-sync",className:"cursor-pointer",children:"Enable Google Docs Sync"})]}),d("enableGoogleDocsSync")&&/* @__PURE__ */ke("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md",children:[/* @__PURE__ */Se("div",{className:"flex-1",children:/* @__PURE__ */Se("p",{className:"text-sm",children:"Authenticate with Google to sync documents"})}),/* @__PURE__ */ke(ic,{size:"sm",variant:"outline",children:[/* @__PURE__ */Se(We,{className:"h-4 w-4 mr-2"}),"Login with Google"]})]})]}):null;/* @__PURE__ */
305
+ /* @__PURE__ */Se(wD,{value:e,onValueChange:e=>t?.(e),className:"space-y-3",children:[{value:"tree",label:"Documents Tree",desc:"Show only the document tree"},{value:"outline",label:"Outline Only",desc:"Show only the headings outline"},{value:"split",label:"Split View",desc:"Show both tree and outline side by side"},{value:"last-used",label:"Remember Last Used",desc:"Use the view you had open last time"}].map(e=>/* @__PURE__ */ke("div",{className:"flex items-start space-x-3",children:[/* @__PURE__ */Se(SD,{value:e.value,id:e.value,className:"mt-1"}),/* @__PURE__ */ke("label",{htmlFor:e.value,className:"flex-1 cursor-pointer",children:[/* @__PURE__ */Se("div",{className:"flex items-center gap-2 mb-1",children:/* @__PURE__ */Se("span",{className:"font-medium",children:e.label})}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:e.desc})]})]},e.value))})]})]})};Array(12).fill(0);var _D=1,PD=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;const{message:r,...n}=e,a="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:_D++,o=this.toasts.find(e=>e.id===a),i=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(t=>t.id===a?(this.publish({...t,...e,id:a,title:r}),{...t,...e,id:a,dismissible:i,title:r}):t):this.addToast({title:r,...n,dismissible:i,id:a}),a},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;void 0!==t.loading&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));const n=Promise.resolve(e instanceof Function?e():e);let a,o=void 0!==r;const i=n.then(async e=>{if(a=["resolve",e],ee.isValidElement(e))o=!1,this.create({id:r,type:"default",message:e});else if(OD(e)&&!e.ok){o=!1;const n="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,a="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description,i="object"!=typeof n||ee.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:a,...i})}else if(e instanceof Error){o=!1;const n="function"==typeof t.error?await t.error(e):t.error,a="function"==typeof t.description?await t.description(e):t.description,i="object"!=typeof n||ee.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:a,...i})}else if(void 0!==t.success){o=!1;const n="function"==typeof t.success?await t.success(e):t.success,a="function"==typeof t.description?await t.description(e):t.description,i="object"!=typeof n||ee.isValidElement(n)?{message:n}:n;this.create({id:r,type:"success",description:a,...i})}}).catch(async e=>{if(a=["reject",e],void 0!==t.error){o=!1;const n="function"==typeof t.error?await t.error(e):t.error,a="function"==typeof t.description?await t.description(e):t.description,i="object"!=typeof n||ee.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:a,...i})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),null==t.finally||t.finally.call(t)}),s=()=>new Promise((e,t)=>i.then(()=>"reject"===a[0]?t(a[1]):e(a[1])).catch(t));return"string"!=typeof r&&"number"!=typeof r?{unwrap:s}:Object.assign(r,{unwrap:s})},this.custom=(e,t)=>{const r=(null==t?void 0:t.id)||_D++;return this.create({jsx:e(r),id:r,...t}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=/* @__PURE__ */new Set}},OD=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,LD=(e,t)=>{const r=(null==t?void 0:t.id)||_D++;return PD.addToast({title:e,...t,id:r}),r},FD=Object.assign(LD,{success:PD.success,info:PD.info,warning:PD.warning,error:PD.error,custom:PD.custom,message:PD.message,promise:PD.promise,dismiss:PD.dismiss,loading:PD.loading},{getHistory:()=>PD.toasts,getToasts:()=>PD.getActiveToasts()});!function(e){if(!e||"undefined"==typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");var BD={name:"",type:"local",credentials:{}},VD=({open:e,enableDatabaseSync:t=!1,onEnableDatabaseSyncChange:r})=>{const[n,a]=ye([]),[o,i]=ye(null),[s,l]=ye(BD);ue(()=>{e&&a(Yf())},[e]);const c=()=>{s.name.trim()?(o&&"new"!==o?(!function(e,t){Xf(Yf().map(r=>r.id===e?{...r,...t,updatedAt:/* @__PURE__ */(new Date).toISOString()}:r))}(o,{name:s.name,credentials:"local"!==s.type?s.credentials:void 0}),FD.success("Source updated")):(!function(e){let t={...e,id:`${e.type}-${Date.now()}`,createdAt:/* @__PURE__ */(new Date).toISOString(),updatedAt:/* @__PURE__ */(new Date).toISOString()};Xf([...Yf(),t])}({name:s.name,type:s.type,credentials:"local"!==s.type?s.credentials:void 0}),FD.success("Source added")),a(Yf()),i(null),l(BD)):FD.error("Please enter a source name")},d=e=>{!function(e){"local-default"!==e&&(Xf(Yf().filter(t=>t.id!==e)),Zf()===e&&Jf("local-default"))}(e),a(Yf()),FD.success("Source deleted")},u=()=>{i(null),l(BD)},h=e=>s.credentials[e],p=e=>l(t=>({...t,credentials:{...t.credentials,...e}})),m=({type:e})=>"local"===e?/* @__PURE__ */Se($e,{className:"h-4 w-4"}):"ssh"===e?/* @__PURE__ */Se(ot,{className:"h-4 w-4"}):"s3"===e||"b2"===e?/* @__PURE__ */Se(Re,{className:"h-4 w-4"}):"r2"===e?/* @__PURE__ */Se(Pe,{className:"h-4 w-4"}):"gdocs"===e?/* @__PURE__ */Se(Be,{className:"h-4 w-4"}):"turso"===e?/* @__PURE__ */Se(pt,{className:"h-4 w-4"}):null,f=e=>"ssh"===e?/* @__PURE__ */ke(we,{children:[
306
+ /* @__PURE__ */Se($D,{label:"Host",children:/* @__PURE__ */Se(BM,{value:h("host")||"",onChange:e=>p({host:e.target.value}),placeholder:"example.com"})}),
307
+ /* @__PURE__ */ke("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */Se($D,{label:"Port",children:/* @__PURE__ */Se(BM,{type:"number",value:h("port")||22,onChange:e=>p({port:parseInt(e.target.value)}),placeholder:"22"})}),/* @__PURE__ */Se($D,{label:"Username",children:/* @__PURE__ */Se(BM,{value:h("username")||"",onChange:e=>p({username:e.target.value}),placeholder:"user"})})]}),
308
+ /* @__PURE__ */Se($D,{label:"Password (Optional)",children:/* @__PURE__ */Se(BM,{type:"password",value:h("password")||"",onChange:e=>p({password:e.target.value}),placeholder:"••••••••"})}),
309
+ /* @__PURE__ */Se($D,{label:"Base Path (Optional)",children:/* @__PURE__ */Se(BM,{value:h("basePath")||"",onChange:e=>p({basePath:e.target.value}),placeholder:"/home/user/documents"})})]}):"s3"===e?/* @__PURE__ */ke(we,{children:[
310
+ /* @__PURE__ */Se($D,{label:"Access Key ID",children:/* @__PURE__ */Se(BM,{value:h("accessKeyId")||"",onChange:e=>p({accessKeyId:e.target.value}),placeholder:"AKIAIOSFODNN7EXAMPLE"})}),
311
+ /* @__PURE__ */Se($D,{label:"Secret Access Key",children:/* @__PURE__ */Se(BM,{type:"password",value:h("secretAccessKey")||"",onChange:e=>p({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),
312
+ /* @__PURE__ */ke("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */Se($D,{label:"Region",children:/* @__PURE__ */Se(BM,{value:h("region")||"",onChange:e=>p({region:e.target.value}),placeholder:"us-east-1"})}),/* @__PURE__ */Se($D,{label:"Bucket",children:/* @__PURE__ */Se(BM,{value:h("bucket")||"",onChange:e=>p({bucket:e.target.value}),placeholder:"my-bucket"})})]})]}):"r2"===e?/* @__PURE__ */ke(we,{children:[
313
+ /* @__PURE__ */Se($D,{label:"Account ID",children:/* @__PURE__ */Se(BM,{value:h("accountId")||"",onChange:e=>p({accountId:e.target.value}),placeholder:"your-account-id"})}),
314
+ /* @__PURE__ */Se($D,{label:"Access Key ID",children:/* @__PURE__ */Se(BM,{value:h("accessKeyId")||"",onChange:e=>p({accessKeyId:e.target.value}),placeholder:"your-access-key-id"})}),
315
+ /* @__PURE__ */Se($D,{label:"Secret Access Key",children:/* @__PURE__ */Se(BM,{type:"password",value:h("secretAccessKey")||"",onChange:e=>p({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),
316
+ /* @__PURE__ */Se($D,{label:"Bucket",children:/* @__PURE__ */Se(BM,{value:h("bucket")||"",onChange:e=>p({bucket:e.target.value}),placeholder:"my-bucket"})})]}):"b2"===e?/* @__PURE__ */ke(we,{children:[
317
+ /* @__PURE__ */Se($D,{label:"Access Key ID",children:/* @__PURE__ */Se(BM,{value:h("accessKeyId")||"",onChange:e=>p({accessKeyId:e.target.value}),placeholder:"your-key-id"})}),
318
+ /* @__PURE__ */Se($D,{label:"Secret Access Key",children:/* @__PURE__ */Se(BM,{type:"password",value:h("secretAccessKey")||"",onChange:e=>p({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),
319
+ /* @__PURE__ */Se($D,{label:"Bucket",children:/* @__PURE__ */Se(BM,{value:h("bucket")||"",onChange:e=>p({bucket:e.target.value}),placeholder:"my-bucket"})}),
320
+ /* @__PURE__ */Se($D,{label:"Endpoint (Optional)",children:/* @__PURE__ */Se(BM,{value:h("endpoint")||"",onChange:e=>p({endpoint:e.target.value}),placeholder:"https://s3.us-west-004.backblazeb2.com"})})]}):"gdocs"===e?/* @__PURE__ */ke(we,{children:[
321
+ /* @__PURE__ */Se($D,{label:"Email",children:/* @__PURE__ */Se(BM,{value:h("email")||"",onChange:e=>p({email:e.target.value}),placeholder:"user@gmail.com",disabled:!0})}),
322
+ /* @__PURE__ */ke($D,{label:"Folder IDs (comma-separated)",children:[/* @__PURE__ */Se(sc,{value:h("folderIds")?.join(", ")||"",onChange:e=>p({folderIds:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}),placeholder:"folder-id-1, folder-id-2",rows:3}),/* @__PURE__ */Se("p",{className:"text-xs text-muted-foreground",children:"Enter Google Drive folder IDs to sync (one per line or comma-separated)"})]}),
323
+ /* @__PURE__ */ke("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md",children:[/* @__PURE__ */Se("div",{className:"flex-1",children:/* @__PURE__ */Se("p",{className:"text-sm font-medium",children:h("isAuthenticated")?"Connected to Google":"Not authenticated"})}),/* @__PURE__ */ke(ic,{size:"sm",variant:"outline",children:[/* @__PURE__ */Se(We,{className:"h-4 w-4 mr-2"}),h("isAuthenticated")?"Reconnect":"Authenticate"]})]})]}):"turso"===e?/* @__PURE__ */ke(we,{children:[
324
+ /* @__PURE__ */Se($D,{label:"Database Endpoint",children:/* @__PURE__ */Se(BM,{value:h("endpoint")||"",onChange:e=>p({endpoint:e.target.value}),placeholder:"https://your-db.turso.io"})}),
325
+ /* @__PURE__ */Se($D,{label:"Auth Token (Optional)",children:/* @__PURE__ */Se(BM,{type:"password",value:h("authToken")||"",onChange:e=>p({authToken:e.target.value}),placeholder:"••••••••"})}),
326
+ /* @__PURE__ */Se($D,{label:"Database Name (Optional)",children:/* @__PURE__ */Se(BM,{value:h("database")||"",onChange:e=>p({database:e.target.value}),placeholder:"my-database"})}),
327
+ /* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se("input",{type:"checkbox",id:"gdocs-sync",checked:h("enableGoogleDocsSync")||!1,onChange:e=>p({enableGoogleDocsSync:e.target.checked}),className:"h-4 w-4"}),/* @__PURE__ */Se(xD,{htmlFor:"gdocs-sync",className:"cursor-pointer",children:"Enable Google Docs Sync"})]}),h("enableGoogleDocsSync")&&/* @__PURE__ */ke("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md",children:[/* @__PURE__ */Se("div",{className:"flex-1",children:/* @__PURE__ */Se("p",{className:"text-sm",children:"Authenticate with Google to sync documents"})}),/* @__PURE__ */ke(ic,{size:"sm",variant:"outline",children:[/* @__PURE__ */Se(We,{className:"h-4 w-4 mr-2"}),"Login with Google"]})]})]}):null;/* @__PURE__ */
331
328
  return ke("div",{className:"space-y-6",children:[
332
- /* @__PURE__ */ke("div",{children:[/* @__PURE__ */Se("h2",{className:"text-xl font-semibold mb-2",children:"File Sources"}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"Manage storage sources (SSH, S3, R2, B2, Google Docs, Turso DB)"})]}),
329
+ /* @__PURE__ */ke("div",{children:[/* @__PURE__ */Se("h2",{className:"text-xl font-semibold mb-2",children:"Storage Sources"}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"Choose where documents are stored (local, SQL database, SSH, S3, R2, B2, Google Docs, Turso DB)"})]}),
330
+ /* @__PURE__ */Se(eD,{}),
331
+ /* @__PURE__ */ke("div",{className:"flex items-start justify-between",children:[/* @__PURE__ */ke("div",{className:"space-y-1",children:[/* @__PURE__ */ke(xD,{className:"text-base flex items-center gap-2",children:[/* @__PURE__ */Se(Pe,{className:"h-4 w-4"}),"Database Sync"]}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:t?"Documents are saved to the SQL database, synced a couple of seconds after each edit.":"Documents stay in this browser's local storage and won't be available on other devices."})]}),/* @__PURE__ */Se("input",{type:"checkbox",id:"database-sync",checked:t,onChange:e=>r?.(e.target.checked),className:"h-4 w-4 rounded border-gray-300"})]}),
333
332
  /* @__PURE__ */Se(eD,{}),
334
- /* @__PURE__ */ke("div",{className:"space-y-3",children:[t.map(e=>{/* @__PURE__ */return Se("div",{className:"border rounded-lg p-3 space-y-2",children:n===e.id?/* @__PURE__ */ke("div",{className:"space-y-3",children:[
335
- /* @__PURE__ */Se(HD,{label:"Source Name",children:/* @__PURE__ */Se(BM,{value:o.name,onChange:e=>i(t=>({...t,name:e.target.value})),placeholder:"My Remote Files"})}),p(e.type),
336
- /* @__PURE__ */Se(jD,{onSave:s,onCancel:c,label:"Save"})]}):/* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */ke("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[
337
- /* @__PURE__ */Se(h,{type:e.type}),
333
+ /* @__PURE__ */ke("div",{className:"space-y-3",children:[n.map(e=>{/* @__PURE__ */return Se("div",{className:"border rounded-lg p-3 space-y-2",children:o===e.id?/* @__PURE__ */ke("div",{className:"space-y-3",children:[
334
+ /* @__PURE__ */Se($D,{label:"Source Name",children:/* @__PURE__ */Se(BM,{value:s.name,onChange:e=>l(t=>({...t,name:e.target.value})),placeholder:"My Remote Files"})}),f(e.type),
335
+ /* @__PURE__ */Se(HD,{onSave:c,onCancel:u,label:"Save"})]}):/* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */ke("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[
336
+ /* @__PURE__ */Se(m,{type:e.type}),
338
337
  /* @__PURE__ */Se("span",{className:"font-medium",children:e.name}),
339
- /* @__PURE__ */Se(cc,{variant:"outline",className:"text-xs",children:(t=e.type,"gdocs"===t?"Google Docs":"turso"===t?"Turso DB":"b2"===t?"Backblaze B2":t.toUpperCase())})]}),"local-default"!==e.id&&/* @__PURE__ */ke("div",{className:"flex gap-1",children:[/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>(e=>{a(e.id),i({name:e.name,type:e.type,credentials:e.credentials||{}})})(e),children:/* @__PURE__ */Se(Oe,{className:"h-3 w-3"})}),/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive",onClick:()=>l(e.id),children:/* @__PURE__ */Se(ct,{className:"h-3 w-3"})})]})]}),/* @__PURE__ */Se(qD,{source:e})]})},e.id);var t}),"new"===n&&/* @__PURE__ */ke("div",{className:"border rounded-lg p-3 space-y-3",children:[
340
- /* @__PURE__ */Se(HD,{label:"Source Name",children:/* @__PURE__ */Se(BM,{value:o.name,onChange:e=>i(t=>({...t,name:e.target.value})),placeholder:"My Remote Files"})}),
341
- /* @__PURE__ */Se(HD,{label:"Source Type",children:/* @__PURE__ */ke("select",{value:o.type,onChange:e=>{const t=e.target.value;i({name:o.name,type:t,credentials:"gdocs"===t?{isAuthenticated:!1}:{}})},className:"w-full border rounded-md px-3 py-2 text-sm",children:[
338
+ /* @__PURE__ */Se(cc,{variant:"outline",className:"text-xs",children:(t=e.type,"gdocs"===t?"Google Docs":"turso"===t?"Turso DB":"b2"===t?"Backblaze B2":t.toUpperCase())})]}),"local-default"!==e.id&&/* @__PURE__ */ke("div",{className:"flex gap-1",children:[/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>(e=>{i(e.id),l({name:e.name,type:e.type,credentials:e.credentials||{}})})(e),children:/* @__PURE__ */Se(Oe,{className:"h-3 w-3"})}),/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive",onClick:()=>d(e.id),children:/* @__PURE__ */Se(ct,{className:"h-3 w-3"})})]})]}),/* @__PURE__ */Se(jD,{source:e})]})},e.id);var t}),"new"===o&&/* @__PURE__ */ke("div",{className:"border rounded-lg p-3 space-y-3",children:[
339
+ /* @__PURE__ */Se($D,{label:"Source Name",children:/* @__PURE__ */Se(BM,{value:s.name,onChange:e=>l(t=>({...t,name:e.target.value})),placeholder:"My Remote Files"})}),
340
+ /* @__PURE__ */Se($D,{label:"Source Type",children:/* @__PURE__ */ke("select",{value:s.type,onChange:e=>{const t=e.target.value;l({name:s.name,type:t,credentials:"gdocs"===t?{isAuthenticated:!1}:{}})},className:"w-full border rounded-md px-3 py-2 text-sm",children:[
342
341
  /* @__PURE__ */Se("option",{value:"ssh",children:"SSH"}),
343
342
  /* @__PURE__ */Se("option",{value:"s3",children:"Amazon S3"}),
344
343
  /* @__PURE__ */Se("option",{value:"r2",children:"Cloudflare R2"}),
345
344
  /* @__PURE__ */Se("option",{value:"b2",children:"Backblaze B2"}),
346
345
  /* @__PURE__ */Se("option",{value:"gdocs",children:"Google Docs"}),
347
- /* @__PURE__ */Se("option",{value:"turso",children:"Turso DB"})]})}),p(o.type),
348
- /* @__PURE__ */Se(jD,{onSave:s,onCancel:c,label:"Add Source"})]})]}),"new"!==n&&/* @__PURE__ */ke(ic,{variant:"outline",size:"sm",onClick:()=>{a("new"),i({name:"",type:"ssh",credentials:{port:22}})},className:"w-full gap-2",children:[/* @__PURE__ */Se(rt,{className:"h-4 w-4"}),"Add New File Source"]})]})},HD=({label:e,children:t})=>/* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */Se(xD,{children:e}),t]}),jD=({onSave:e,onCancel:t,label:r})=>/* @__PURE__ */ke("div",{className:"flex gap-2",children:[/* @__PURE__ */Se(ic,{size:"sm",onClick:e,children:r}),/* @__PURE__ */Se(ic,{size:"sm",variant:"outline",onClick:t,children:"Cancel"})]}),qD=({source:e})=>{if("ssh"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
346
+ /* @__PURE__ */Se("option",{value:"turso",children:"Turso DB"})]})}),f(s.type),
347
+ /* @__PURE__ */Se(HD,{onSave:c,onCancel:u,label:"Add Source"})]})]}),"new"!==o&&/* @__PURE__ */ke(ic,{variant:"outline",size:"sm",onClick:()=>{i("new"),l({name:"",type:"ssh",credentials:{port:22}})},className:"w-full gap-2",children:[/* @__PURE__ */Se(rt,{className:"h-4 w-4"}),"Add New Storage Source"]})]})},$D=({label:e,children:t})=>/* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */Se(xD,{children:e}),t]}),HD=({onSave:e,onCancel:t,label:r})=>/* @__PURE__ */ke("div",{className:"flex gap-2",children:[/* @__PURE__ */Se(ic,{size:"sm",onClick:e,children:r}),/* @__PURE__ */Se(ic,{size:"sm",variant:"outline",onClick:t,children:"Cancel"})]}),jD=({source:e})=>{if("ssh"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
349
348
  return ke("p",{className:"text-xs text-muted-foreground",children:[t.username,"@",t.host,":",t.port||22]})}if("s3"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
350
349
  return ke("p",{className:"text-xs text-muted-foreground",children:[t.bucket," (",t.region,")"]})}if("r2"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
351
350
  return Se("p",{className:"text-xs text-muted-foreground",children:t.bucket})}if("b2"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
352
351
  return ke("p",{className:"text-xs text-muted-foreground",children:[t.bucket," (",t.endpoint||"default endpoint",")"]})}if("gdocs"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
353
352
  return Se("p",{className:"text-xs text-muted-foreground",children:t.isAuthenticated?`${t.email||"Authenticated"} - ${t.folderIds?.length||0} folder(s)`:"Not authenticated"})}if("turso"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
354
- return ke("p",{className:"text-xs text-muted-foreground",children:[t.endpoint,t.enableGoogleDocsSync&&" (Google Docs sync enabled)"]})}return null},UD=["blue","purple","green","orange","pink"],GD=({open:e})=>{const[t,r]=ye([]),[n,a]=ye(null),[o,i]=ye({});ue(()=>{e&&r(yM())},[e]);const s=({modeId:e,onSave:t,onCancel:r})=>/* @__PURE__ */ke("div",{className:"space-y-3",children:[
353
+ return ke("p",{className:"text-xs text-muted-foreground",children:[t.endpoint,t.enableGoogleDocsSync&&" (Google Docs sync enabled)"]})}return null},qD=["blue","purple","green","orange","pink"],UD=({open:e})=>{const[t,r]=ye([]),[n,a]=ye(null),[o,i]=ye({});ue(()=>{e&&r(yM())},[e]);const s=({modeId:e,onSave:t,onCancel:r})=>/* @__PURE__ */ke("div",{className:"space-y-3",children:[
355
354
  /* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */Se(xD,{htmlFor:`name-${e}`,children:"Mode Name"}),/* @__PURE__ */Se(BM,{id:`name-${e}`,value:o.name||"",onChange:e=>i(t=>({...t,name:e.target.value})),placeholder:"Mode name"})]}),
356
355
  /* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */Se(xD,{htmlFor:`prompt-${e}`,children:"Prompt"}),/* @__PURE__ */Se(sc,{id:`prompt-${e}`,value:o.prompt||"",onChange:e=>i(t=>({...t,prompt:e.target.value})),placeholder:"Rewrite prompt...",rows:4})]}),
357
- /* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */Se(xD,{htmlFor:`color-${e}`,children:"Color"}),/* @__PURE__ */Se("select",{id:`color-${e}`,value:o.color||"blue",onChange:e=>i(t=>({...t,color:e.target.value})),className:"w-full border rounded-md px-3 py-2 text-sm",children:UD.map(e=>/* @__PURE__ */Se("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),
356
+ /* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */Se(xD,{htmlFor:`color-${e}`,children:"Color"}),/* @__PURE__ */Se("select",{id:`color-${e}`,value:o.color||"blue",onChange:e=>i(t=>({...t,color:e.target.value})),className:"w-full border rounded-md px-3 py-2 text-sm",children:qD.map(e=>/* @__PURE__ */Se("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),
358
357
  /* @__PURE__ */ke("div",{className:"flex gap-2",children:[/* @__PURE__ */Se(ic,{size:"sm",onClick:t,children:"Save"}),/* @__PURE__ */Se(ic,{size:"sm",variant:"outline",onClick:r,children:"Cancel"})]})]});/* @__PURE__ */
359
358
  return ke("div",{className:"space-y-6",children:[
360
- /* @__PURE__ */ke("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */ke("div",{children:[/* @__PURE__ */Se("h2",{className:"text-xl font-semibold mb-2",children:"AI Rewrite Modes"}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"Customize AI rewrite prompts and add your own modes"})]}),/* @__PURE__ */ke(ic,{variant:"outline",size:"sm",onClick:()=>{bM(gM),r(yM()),BD.success("Modes reset to defaults")},className:"gap-2",children:[/* @__PURE__ */Se(nt,{className:"h-4 w-4"}),"Reset"]})]}),
359
+ /* @__PURE__ */ke("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */ke("div",{children:[/* @__PURE__ */Se("h2",{className:"text-xl font-semibold mb-2",children:"AI Rewrite Modes"}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"Customize AI rewrite prompts and add your own modes"})]}),/* @__PURE__ */ke(ic,{variant:"outline",size:"sm",onClick:()=>{bM(gM),r(yM()),FD.success("Modes reset to defaults")},className:"gap-2",children:[/* @__PURE__ */Se(nt,{className:"h-4 w-4"}),"Reset"]})]}),
361
360
  /* @__PURE__ */Se(eD,{}),
362
- /* @__PURE__ */ke("div",{className:"space-y-3",children:[t.map(e=>/* @__PURE__ */Se("div",{className:"border rounded-lg p-3 space-y-2",children:n===e.id?/* @__PURE__ */Se(s,{modeId:e.id,onSave:()=>(e=>{const n=t.map(t=>t.id===e.id?e:t);r(n),bM(n),a(null),i({}),BD.success("Mode updated")})(o),onCancel:()=>{a(null),i({})}}):/* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */ke("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */Se(cc,{variant:"outline",className:"text-sm",children:e.name}),/* @__PURE__ */ke("div",{className:"flex gap-1",children:[/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{a(e.id),i(e)},children:/* @__PURE__ */Se(Oe,{className:"h-3 w-3"})}),/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive",onClick:()=>(e=>{const n=t.filter(t=>t.id!==e);r(n),bM(n),BD.success("Mode deleted")})(e.id),children:/* @__PURE__ */Se(ct,{className:"h-3 w-3"})})]})]}),/* @__PURE__ */Se("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.prompt})]})},e.id)),"new"===n&&/* @__PURE__ */Se("div",{className:"border rounded-lg p-3",children:/* @__PURE__ */Se(s,{modeId:"new",onSave:()=>{const e={id:`custom-${Date.now()}`,name:o.name||"New Mode",prompt:o.prompt||"Rewrite this text:",color:o.color||"blue"},n=[...t,e];r(n),bM(n),a(null),i({}),BD.success("Mode added")},onCancel:()=>{a(null),i({})}})})]}),"new"!==n&&/* @__PURE__ */ke(ic,{variant:"outline",size:"sm",onClick:()=>{a("new"),i({name:"",prompt:"",color:"blue"})},className:"w-full gap-2",children:[/* @__PURE__ */Se(rt,{className:"h-4 w-4"}),"Add New Mode"]})]})};function WD({keys:e,muted:t=!1}){/* @__PURE__ */
363
- return Se("span",{className:"inline-flex items-center gap-1",children:e.map((e,r)=>/* @__PURE__ */Se("kbd",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded border px-1.5 text-[11px] font-semibold leading-none "+(t?"border-gray-200 bg-gray-50 text-gray-400 dark:border-slate-700 dark:bg-slate-800/50 dark:text-slate-500":"border-gray-300 border-b-2 bg-gray-100 text-gray-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200"),children:c(e)},`${e}-${r}`))})}function KD({action:e,recording:t,conflict:r,onStartRecording:n}){const a=d(e.id),o=i(e.id);/* @__PURE__ */
361
+ /* @__PURE__ */ke("div",{className:"space-y-3",children:[t.map(e=>/* @__PURE__ */Se("div",{className:"border rounded-lg p-3 space-y-2",children:n===e.id?/* @__PURE__ */Se(s,{modeId:e.id,onSave:()=>(e=>{const n=t.map(t=>t.id===e.id?e:t);r(n),bM(n),a(null),i({}),FD.success("Mode updated")})(o),onCancel:()=>{a(null),i({})}}):/* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */ke("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */Se(cc,{variant:"outline",className:"text-sm",children:e.name}),/* @__PURE__ */ke("div",{className:"flex gap-1",children:[/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{a(e.id),i(e)},children:/* @__PURE__ */Se(Oe,{className:"h-3 w-3"})}),/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive",onClick:()=>(e=>{const n=t.filter(t=>t.id!==e);r(n),bM(n),FD.success("Mode deleted")})(e.id),children:/* @__PURE__ */Se(ct,{className:"h-3 w-3"})})]})]}),/* @__PURE__ */Se("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.prompt})]})},e.id)),"new"===n&&/* @__PURE__ */Se("div",{className:"border rounded-lg p-3",children:/* @__PURE__ */Se(s,{modeId:"new",onSave:()=>{const e={id:`custom-${Date.now()}`,name:o.name||"New Mode",prompt:o.prompt||"Rewrite this text:",color:o.color||"blue"},n=[...t,e];r(n),bM(n),a(null),i({}),FD.success("Mode added")},onCancel:()=>{a(null),i({})}})})]}),"new"!==n&&/* @__PURE__ */ke(ic,{variant:"outline",size:"sm",onClick:()=>{a("new"),i({name:"",prompt:"",color:"blue"})},className:"w-full gap-2",children:[/* @__PURE__ */Se(rt,{className:"h-4 w-4"}),"Add New Mode"]})]})};function GD({keys:e,muted:t=!1}){/* @__PURE__ */
362
+ return Se("span",{className:"inline-flex items-center gap-1",children:e.map((e,r)=>/* @__PURE__ */Se("kbd",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded border px-1.5 text-[11px] font-semibold leading-none "+(t?"border-gray-200 bg-gray-50 text-gray-400 dark:border-slate-700 dark:bg-slate-800/50 dark:text-slate-500":"border-gray-300 border-b-2 bg-gray-100 text-gray-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200"),children:c(e)},`${e}-${r}`))})}function WD({action:e,recording:t,conflict:r,onStartRecording:n}){const a=d(e.id),o=i(e.id);/* @__PURE__ */
364
363
  return ke("div",{className:"flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-gray-50 dark:hover:bg-slate-800/60",children:[
365
364
  /* @__PURE__ */Se("span",{className:"flex-1 truncate text-sm",children:e.label}),r&&/* @__PURE__ */Se("span",{className:"text-xs text-red-500 dark:text-red-400",children:r}),
366
- /* @__PURE__ */Se("button",{type:"button",onClick:n,title:t?"Press the new shortcut (Esc to cancel)":"Click to record a new shortcut",className:"flex h-7 min-w-[88px] items-center justify-center rounded-md border px-2 transition-colors "+(t?"border-blue-400 bg-blue-50 ring-2 ring-blue-200 dark:border-blue-500 dark:bg-blue-950/40 dark:ring-blue-900":"border-transparent hover:border-gray-300 dark:hover:border-slate-600"),children:t?/* @__PURE__ */Se("span",{className:"animate-pulse text-xs text-blue-600 dark:text-blue-400",children:"Press keys…"}):/* @__PURE__ */Se(WD,{keys:a})}),
367
- /* @__PURE__ */Se("button",{type:"button",onClick:()=>p(e.id,null),title:"Reset to default",className:"rounded p-1 text-gray-400 transition-opacity hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-slate-700 dark:hover:text-gray-300 "+(o?"opacity-100":"pointer-events-none opacity-0"),children:/* @__PURE__ */Se(nt,{size:13})})]})}var YD=({compact:e=!1}={})=>{h();const[t,r]=ye(null),[n,a]=ye(null),c=ge(()=>{const e=/* @__PURE__ */new Map;for(const t of l){const r=e.get(t.group)??[];r.push(t),e.set(t.group,r)}return[...e.entries()]},[]);ue(()=>{if(!t)return;const e=e=>{if(e.preventDefault(),e.stopPropagation(),"Escape"===e.key)return void r(null);const n=o(e);if(!n)return;if(!s(n)&&!/^F\d{1,2}$/.test(n[n.length-1]))return void a({id:t,message:"Include Ctrl/⌘ or Alt"});const i=u(n);i&&i.id!==t?a({id:t,message:`Already used by “${i.label}”`}):(p(t,n),a(null),r(null))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]);const d=l.some(e=>i(e.id));/* @__PURE__ */
368
- return ke("div",{className:"space-y-6",children:[/* @__PURE__ */ke("div",{className:"flex items-start justify-between gap-4",children:[/* @__PURE__ */ke("div",{children:[!e&&/* @__PURE__ */Se("h2",{className:"text-xl font-semibold mb-2",children:"Keyboard Shortcuts"}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"Click a shortcut, then press the new key combination. Esc cancels recording."})]}),/* @__PURE__ */ke("button",{type:"button",onClick:()=>{m(),a(null),r(null)},disabled:!d,className:"flex shrink-0 items-center gap-1.5 rounded-md border border-gray-200 px-3 py-1.5 text-xs hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-40 dark:border-slate-700 dark:hover:bg-slate-800",children:[/* @__PURE__ */Se(nt,{size:12}),"Reset all"]})]}),c.map(([e,o])=>/* @__PURE__ */ke("div",{className:"space-y-1",children:[/* @__PURE__ */Se("h3",{className:"px-2 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:e}),o.map(e=>/* @__PURE__ */Se(KD,{action:e,recording:t===e.id,conflict:n?.id===e.id?n.message:void 0,onStartRecording:()=>{a(null),r(t=>t===e.id?null:e.id)}},e.id))]},e))]})},XD=()=>/* @__PURE__ */ke("div",{className:"space-y-6",children:[
365
+ /* @__PURE__ */Se("button",{type:"button",onClick:n,title:t?"Press the new shortcut (Esc to cancel)":"Click to record a new shortcut",className:"flex h-7 min-w-[88px] items-center justify-center rounded-md border px-2 transition-colors "+(t?"border-blue-400 bg-blue-50 ring-2 ring-blue-200 dark:border-blue-500 dark:bg-blue-950/40 dark:ring-blue-900":"border-transparent hover:border-gray-300 dark:hover:border-slate-600"),children:t?/* @__PURE__ */Se("span",{className:"animate-pulse text-xs text-blue-600 dark:text-blue-400",children:"Press keys…"}):/* @__PURE__ */Se(GD,{keys:a})}),
366
+ /* @__PURE__ */Se("button",{type:"button",onClick:()=>p(e.id,null),title:"Reset to default",className:"rounded p-1 text-gray-400 transition-opacity hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-slate-700 dark:hover:text-gray-300 "+(o?"opacity-100":"pointer-events-none opacity-0"),children:/* @__PURE__ */Se(nt,{size:13})})]})}var KD=({compact:e=!1}={})=>{h();const[t,r]=ye(null),[n,a]=ye(null),c=ge(()=>{const e=/* @__PURE__ */new Map;for(const t of l){const r=e.get(t.group)??[];r.push(t),e.set(t.group,r)}return[...e.entries()]},[]);ue(()=>{if(!t)return;const e=e=>{if(e.preventDefault(),e.stopPropagation(),"Escape"===e.key)return void r(null);const n=o(e);if(!n)return;if(!s(n)&&!/^F\d{1,2}$/.test(n[n.length-1]))return void a({id:t,message:"Include Ctrl/⌘ or Alt"});const i=u(n);i&&i.id!==t?a({id:t,message:`Already used by “${i.label}”`}):(p(t,n),a(null),r(null))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]);const d=l.some(e=>i(e.id));/* @__PURE__ */
367
+ return ke("div",{className:"space-y-6",children:[/* @__PURE__ */ke("div",{className:"flex items-start justify-between gap-4",children:[/* @__PURE__ */ke("div",{children:[!e&&/* @__PURE__ */Se("h2",{className:"text-xl font-semibold mb-2",children:"Keyboard Shortcuts"}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"Click a shortcut, then press the new key combination. Esc cancels recording."})]}),/* @__PURE__ */ke("button",{type:"button",onClick:()=>{m(),a(null),r(null)},disabled:!d,className:"flex shrink-0 items-center gap-1.5 rounded-md border border-gray-200 px-3 py-1.5 text-xs hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-40 dark:border-slate-700 dark:hover:bg-slate-800",children:[/* @__PURE__ */Se(nt,{size:12}),"Reset all"]})]}),c.map(([e,o])=>/* @__PURE__ */ke("div",{className:"space-y-1",children:[/* @__PURE__ */Se("h3",{className:"px-2 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:e}),o.map(e=>/* @__PURE__ */Se(WD,{action:e,recording:t===e.id,conflict:n?.id===e.id?n.message:void 0,onStartRecording:()=>{a(null),r(t=>t===e.id?null:e.id)}},e.id))]},e))]})},YD=()=>/* @__PURE__ */ke("div",{className:"space-y-6",children:[
369
368
  /* @__PURE__ */ke("div",{children:[/* @__PURE__ */Se("h2",{className:"text-xl font-semibold mb-2",children:"About"}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"Application information"})]}),
370
369
  /* @__PURE__ */Se(eD,{}),
371
- /* @__PURE__ */ke("div",{className:"text-sm space-y-3",children:[/* @__PURE__ */ke("div",{className:"space-y-1",children:[/* @__PURE__ */Se("p",{className:"font-medium",children:"REASON"}),/* @__PURE__ */Se("p",{className:"text-muted-foreground",children:"A powerful note-taking application"})]}),/* @__PURE__ */ke("div",{className:"space-y-1",children:[/* @__PURE__ */Se("p",{className:"font-medium",children:"Version"}),/* @__PURE__ */Se("p",{className:"text-muted-foreground",children:"1.0.0"})]})]})]}),ZD=[{name:"Appearance",icon:et},{name:"Storage",icon:Pe},{name:"File Sources",icon:$e},{name:"AI Rewrite Modes",icon:ht},{name:"Keyboard Shortcuts",icon:qe},{name:"About",icon:je}],JD=({open:e,onOpenChange:t,initialSection:r,defaultSidebarView:n="last-used",onDefaultSidebarViewChange:a,enableDatabaseSync:o=!1,onEnableDatabaseSyncChange:i})=>{const[s,l]=ye(r||"Appearance");ue(()=>{e&&l(r||"Appearance")},[e,r]);/* @__PURE__ */
370
+ /* @__PURE__ */ke("div",{className:"text-sm space-y-3",children:[/* @__PURE__ */ke("div",{className:"space-y-1",children:[/* @__PURE__ */Se("p",{className:"font-medium",children:"REASON"}),/* @__PURE__ */Se("p",{className:"text-muted-foreground",children:"A powerful note-taking application"})]}),/* @__PURE__ */ke("div",{className:"space-y-1",children:[/* @__PURE__ */Se("p",{className:"font-medium",children:"Version"}),/* @__PURE__ */Se("p",{className:"text-muted-foreground",children:"1.0.0"})]})]})]}),XD=[{name:"Appearance",icon:et},{name:"Storage Sources",icon:Pe},{name:"AI Rewrite Modes",icon:ht},{name:"Keyboard Shortcuts",icon:qe},{name:"About",icon:je}],ZD={Storage:"Storage Sources","File Sources":"Storage Sources"},JD=e=>e&&(ZD[e]??e)||"Appearance",QD=({open:e,onOpenChange:t,initialSection:r,defaultSidebarView:n="last-used",onDefaultSidebarViewChange:a,enableDatabaseSync:o=!1,onEnableDatabaseSyncChange:i})=>{const[s,l]=ye(()=>JD(r));ue(()=>{e&&l(JD(r))},[e,r]);/* @__PURE__ */
372
371
  return Se(IM,{open:e,onOpenChange:t,children:/* @__PURE__ */ke(_M,{className:"overflow-hidden p-0 md:max-h-[500px] md:max-w-[700px] lg:max-w-[800px]",children:[
373
372
  /* @__PURE__ */Se(LM,{className:"sr-only",children:"Settings"}),
374
373
  /* @__PURE__ */Se(FM,{className:"sr-only",children:"Customize your settings here."}),
375
- /* @__PURE__ */ke(sD,{className:"items-start",children:[/* @__PURE__ */Se(lD,{collapsible:"none",className:"hidden md:flex",children:/* @__PURE__ */Se(cD,{children:/* @__PURE__ */Se(dD,{children:/* @__PURE__ */Se(uD,{children:/* @__PURE__ */Se(hD,{children:ZD.map(e=>/* @__PURE__ */Se(pD,{children:/* @__PURE__ */Se(fD,{asChild:!0,isActive:e.name===s,onClick:()=>l(e.name),children:/* @__PURE__ */ke("a",{href:"#",children:[/* @__PURE__ */Se(e.icon,{}),/* @__PURE__ */Se("span",{children:e.name})]})})},e.name))})})})})}),/* @__PURE__ */ke("main",{className:"flex h-[480px] flex-1 flex-col overflow-hidden",children:[/* @__PURE__ */Se("header",{className:"flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12",children:/* @__PURE__ */Se("div",{className:"flex items-center gap-2 px-4",children:/* @__PURE__ */Se(WM,{children:/* @__PURE__ */ke(KM,{children:[
374
+ /* @__PURE__ */ke(sD,{className:"items-start",children:[/* @__PURE__ */Se(lD,{collapsible:"none",className:"hidden md:flex",children:/* @__PURE__ */Se(cD,{children:/* @__PURE__ */Se(dD,{children:/* @__PURE__ */Se(uD,{children:/* @__PURE__ */Se(hD,{children:XD.map(e=>/* @__PURE__ */Se(pD,{children:/* @__PURE__ */Se(fD,{asChild:!0,isActive:e.name===s,onClick:()=>l(e.name),children:/* @__PURE__ */ke("a",{href:"#",children:[/* @__PURE__ */Se(e.icon,{}),/* @__PURE__ */Se("span",{children:e.name})]})})},e.name))})})})})}),/* @__PURE__ */ke("main",{className:"flex h-[480px] flex-1 flex-col overflow-hidden",children:[/* @__PURE__ */Se("header",{className:"flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12",children:/* @__PURE__ */Se("div",{className:"flex items-center gap-2 px-4",children:/* @__PURE__ */Se(WM,{children:/* @__PURE__ */ke(KM,{children:[
376
375
  /* @__PURE__ */Se(YM,{className:"hidden md:block",children:/* @__PURE__ */ke(XM,{href:"#",children:[/* @__PURE__ */Se(it,{className:"h-4 w-4 inline mr-1"}),"Settings"]})}),
377
376
  /* @__PURE__ */Se(JM,{className:"hidden md:block"}),
378
- /* @__PURE__ */Se(YM,{children:/* @__PURE__ */Se(ZM,{children:s})})]})})})}),/* @__PURE__ */Se("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-4 pt-0",children:(()=>{switch(s){case"Appearance":/* @__PURE__ */return Se(zD,{defaultSidebarView:n,onDefaultSidebarViewChange:a});case"Storage":/* @__PURE__ */return Se(_D,{enableDatabaseSync:o,onEnableDatabaseSyncChange:i});case"File Sources":/* @__PURE__ */return Se($D,{open:e});case"AI Rewrite Modes":/* @__PURE__ */return Se(GD,{open:e});case"Keyboard Shortcuts":/* @__PURE__ */return Se(YD,{});case"About":/* @__PURE__ */return Se(XD,{});default:return null}})()})]})]})]})})};function QD({className:e,...t}){/* @__PURE__ */
379
- return Se(At.Root,{"data-slot":"tabs",className:tc("flex flex-col gap-2",e),...t})}function eE({className:e,...t}){/* @__PURE__ */
380
- return Se(At.List,{"data-slot":"tabs-list",className:tc("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-2xl p-[3px]",e),...t})}function tE({className:e,...t}){/* @__PURE__ */
381
- return Se(At.Trigger,{"data-slot":"tabs-trigger",className:tc("cursor-pointer data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-2xl border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function rE({className:e,...t}){/* @__PURE__ */
382
- return Se(At.Content,{"data-slot":"tabs-content",className:tc("flex-1 outline-none",e),...t})}var nE=kt.Root,aE=kt.Value,oE=Q.forwardRef(({className:e,children:t,...r},n)=>/* @__PURE__ */ke(kt.Trigger,{ref:n,className:tc("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,/* @__PURE__ */Se(kt.Icon,{asChild:!0,children:/* @__PURE__ */Se(Ae,{className:"h-4 w-4 opacity-50"})})]}));oE.displayName=kt.Trigger.displayName;var iE=Q.forwardRef(({className:e,...t},r)=>/* @__PURE__ */Se(kt.ScrollUpButton,{ref:r,className:tc("flex cursor-default items-center justify-center py-1",e),...t,children:/* @__PURE__ */Se(Ee,{className:"h-4 w-4"})}));iE.displayName=kt.ScrollUpButton.displayName;var sE=Q.forwardRef(({className:e,...t},r)=>/* @__PURE__ */Se(kt.ScrollDownButton,{ref:r,className:tc("flex cursor-default items-center justify-center py-1",e),...t,children:/* @__PURE__ */Se(Ae,{className:"h-4 w-4"})}));sE.displayName=kt.ScrollDownButton.displayName;var lE=Q.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>/* @__PURE__ */Se(kt.Portal,{children:/* @__PURE__ */ke(kt.Content,{ref:a,className:tc("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[
383
- /* @__PURE__ */Se(iE,{}),
377
+ /* @__PURE__ */Se(YM,{children:/* @__PURE__ */Se(ZM,{children:s})})]})})})}),/* @__PURE__ */Se("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-4 pt-0",children:(()=>{switch(s){case"Appearance":/* @__PURE__ */return Se(zD,{defaultSidebarView:n,onDefaultSidebarViewChange:a});case"Storage Sources":/* @__PURE__ */return Se(VD,{open:e,enableDatabaseSync:o,onEnableDatabaseSyncChange:i});case"AI Rewrite Modes":/* @__PURE__ */return Se(UD,{open:e});case"Keyboard Shortcuts":/* @__PURE__ */return Se(KD,{});case"About":/* @__PURE__ */return Se(YD,{});default:return null}})()})]})]})]})})};function eE({className:e,...t}){/* @__PURE__ */
378
+ return Se(At.Root,{"data-slot":"tabs",className:tc("flex flex-col gap-2",e),...t})}function tE({className:e,...t}){/* @__PURE__ */
379
+ return Se(At.List,{"data-slot":"tabs-list",className:tc("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-2xl p-[3px]",e),...t})}function rE({className:e,...t}){/* @__PURE__ */
380
+ return Se(At.Trigger,{"data-slot":"tabs-trigger",className:tc("cursor-pointer data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-2xl border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function nE({className:e,...t}){/* @__PURE__ */
381
+ return Se(At.Content,{"data-slot":"tabs-content",className:tc("flex-1 outline-none",e),...t})}var aE=kt.Root,oE=kt.Value,iE=Q.forwardRef(({className:e,children:t,...r},n)=>/* @__PURE__ */ke(kt.Trigger,{ref:n,className:tc("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,/* @__PURE__ */Se(kt.Icon,{asChild:!0,children:/* @__PURE__ */Se(Ae,{className:"h-4 w-4 opacity-50"})})]}));iE.displayName=kt.Trigger.displayName;var sE=Q.forwardRef(({className:e,...t},r)=>/* @__PURE__ */Se(kt.ScrollUpButton,{ref:r,className:tc("flex cursor-default items-center justify-center py-1",e),...t,children:/* @__PURE__ */Se(Ee,{className:"h-4 w-4"})}));sE.displayName=kt.ScrollUpButton.displayName;var lE=Q.forwardRef(({className:e,...t},r)=>/* @__PURE__ */Se(kt.ScrollDownButton,{ref:r,className:tc("flex cursor-default items-center justify-center py-1",e),...t,children:/* @__PURE__ */Se(Ae,{className:"h-4 w-4"})}));lE.displayName=kt.ScrollDownButton.displayName;var cE=Q.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>/* @__PURE__ */Se(kt.Portal,{children:/* @__PURE__ */ke(kt.Content,{ref:a,className:tc("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[
382
+ /* @__PURE__ */Se(sE,{}),
384
383
  /* @__PURE__ */Se(kt.Viewport,{className:tc("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),
385
- /* @__PURE__ */Se(sE,{})]})}));lE.displayName=kt.Content.displayName,Q.forwardRef(({className:e,...t},r)=>/* @__PURE__ */Se(kt.Label,{ref:r,className:tc("px-2 py-1.5 text-sm font-semibold",e),...t})).displayName=kt.Label.displayName;var cE=Q.forwardRef(({className:e,children:t,...r},n)=>/* @__PURE__ */ke(kt.Item,{ref:n,className:tc("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[/* @__PURE__ */Se("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:/* @__PURE__ */Se(kt.ItemIndicator,{children:/* @__PURE__ */Se(Ne,{className:"h-4 w-4"})})}),/* @__PURE__ */Se(kt.ItemText,{children:t})]}));function dE({...e}){/* @__PURE__ */
386
- return Se(Ut,{"data-slot":"alert-dialog",...e})}function uE({...e}){/* @__PURE__ */
387
- return Se(Gt,{"data-slot":"alert-dialog-portal",...e})}function hE({className:e,...t}){/* @__PURE__ */
388
- return Se(Wt,{"data-slot":"alert-dialog-overlay",className:tc("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs",e),...t})}function pE({className:e,...t}){/* @__PURE__ */
389
- return ke(uE,{children:[/* @__PURE__ */Se(hE,{}),/* @__PURE__ */Se(Kt,{"data-slot":"alert-dialog-content",className:tc("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200 sm:max-w-lg",e),...t})]})}function mE({className:e,...t}){/* @__PURE__ */
390
- return Se("div",{"data-slot":"alert-dialog-header",className:tc("flex flex-col gap-2 text-center sm:text-left",e),...t})}function fE({className:e,...t}){/* @__PURE__ */
391
- return Se("div",{"data-slot":"alert-dialog-footer",className:tc("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function gE({className:e,...t}){/* @__PURE__ */
392
- return Se(Zt,{"data-slot":"alert-dialog-title",className:tc("text-lg font-semibold",e),...t})}function vE({className:e,...t}){/* @__PURE__ */
393
- return Se(Jt,{"data-slot":"alert-dialog-description",className:tc("text-muted-foreground text-sm",e),...t})}function yE({className:e,...t}){/* @__PURE__ */
394
- return Se(Yt,{className:tc(oc(),e),...t})}function bE({className:e,...t}){/* @__PURE__ */
395
- return Se(Xt,{className:tc(oc({variant:"outline"}),e),...t})}function xE(e,t){const[r,n]=ye(()=>{try{const r=window.localStorage.getItem(e);if(!r)return t;const n=JSON.parse(r);return Array.isArray(n)&&0===n.length&&Array.isArray(t)&&t.length>0?t:n}catch(r){return t}});return[r,t=>{try{const a=t instanceof Function?t(r):t;n(a),window.localStorage.setItem(e,JSON.stringify(a))}catch(a){}}]}cE.displayName=kt.Item.displayName,Q.forwardRef(({className:e,...t},r)=>/* @__PURE__ */Se(kt.Separator,{ref:r,className:tc("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=kt.Separator.displayName;var wE={owner:/* @__PURE__ */Se(_e,{className:"h-3 w-3"}),admin:/* @__PURE__ */Se(st,{className:"h-3 w-3"}),member:/* @__PURE__ */Se(ut,{className:"h-3 w-3"}),viewer:/* @__PURE__ */Se(Fe,{className:"h-3 w-3"})},SE={owner:"bg-yellow-500/10 text-yellow-700 dark:text-yellow-400",admin:"bg-purple-500/10 text-purple-700 dark:text-purple-400",member:"bg-blue-500/10 text-blue-700 dark:text-blue-400",viewer:"bg-gray-500/10 text-gray-700 dark:text-gray-400"},kE=({open:e,onOpenChange:t})=>{const[r,n]=xE("REASON-organizations",[{id:"1",name:"My Organization",slug:"my-org",description:"Your personal workspace",teams:[{id:"1",name:"General",description:"Default team for collaboration",members:[{id:"1",name:"You",email:"you@example.com",role:"owner",joinedAt:/* @__PURE__ */new Date}],createdAt:/* @__PURE__ */new Date,updatedAt:/* @__PURE__ */new Date}],createdAt:/* @__PURE__ */new Date,updatedAt:/* @__PURE__ */new Date}]),[a,o]=ye(r[0]?.id||null),[i,s]=ye(null),[l,c]=ye(!1),[d,u]=ye(null),[h,p]=ye(""),[m,f]=ye("member"),g=r.find(e=>e.id===a),v=g?.teams.find(e=>e.id===i);/* @__PURE__ */
384
+ /* @__PURE__ */Se(lE,{})]})}));cE.displayName=kt.Content.displayName,Q.forwardRef(({className:e,...t},r)=>/* @__PURE__ */Se(kt.Label,{ref:r,className:tc("px-2 py-1.5 text-sm font-semibold",e),...t})).displayName=kt.Label.displayName;var dE=Q.forwardRef(({className:e,children:t,...r},n)=>/* @__PURE__ */ke(kt.Item,{ref:n,className:tc("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[/* @__PURE__ */Se("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:/* @__PURE__ */Se(kt.ItemIndicator,{children:/* @__PURE__ */Se(Ne,{className:"h-4 w-4"})})}),/* @__PURE__ */Se(kt.ItemText,{children:t})]}));function uE({...e}){/* @__PURE__ */
385
+ return Se(Ut,{"data-slot":"alert-dialog",...e})}function hE({...e}){/* @__PURE__ */
386
+ return Se(Gt,{"data-slot":"alert-dialog-portal",...e})}function pE({className:e,...t}){/* @__PURE__ */
387
+ return Se(Wt,{"data-slot":"alert-dialog-overlay",className:tc("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs",e),...t})}function mE({className:e,...t}){/* @__PURE__ */
388
+ return ke(hE,{children:[/* @__PURE__ */Se(pE,{}),/* @__PURE__ */Se(Kt,{"data-slot":"alert-dialog-content",className:tc("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200 sm:max-w-lg",e),...t})]})}function fE({className:e,...t}){/* @__PURE__ */
389
+ return Se("div",{"data-slot":"alert-dialog-header",className:tc("flex flex-col gap-2 text-center sm:text-left",e),...t})}function gE({className:e,...t}){/* @__PURE__ */
390
+ return Se("div",{"data-slot":"alert-dialog-footer",className:tc("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function vE({className:e,...t}){/* @__PURE__ */
391
+ return Se(Zt,{"data-slot":"alert-dialog-title",className:tc("text-lg font-semibold",e),...t})}function yE({className:e,...t}){/* @__PURE__ */
392
+ return Se(Jt,{"data-slot":"alert-dialog-description",className:tc("text-muted-foreground text-sm",e),...t})}function bE({className:e,...t}){/* @__PURE__ */
393
+ return Se(Yt,{className:tc(oc(),e),...t})}function xE({className:e,...t}){/* @__PURE__ */
394
+ return Se(Xt,{className:tc(oc({variant:"outline"}),e),...t})}function wE(e,t){const[r,n]=ye(()=>{try{const r=window.localStorage.getItem(e);if(!r)return t;const n=JSON.parse(r);return Array.isArray(n)&&0===n.length&&Array.isArray(t)&&t.length>0?t:n}catch(r){return t}});return[r,t=>{try{const a=t instanceof Function?t(r):t;n(a),window.localStorage.setItem(e,JSON.stringify(a))}catch(a){}}]}dE.displayName=kt.Item.displayName,Q.forwardRef(({className:e,...t},r)=>/* @__PURE__ */Se(kt.Separator,{ref:r,className:tc("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=kt.Separator.displayName;var SE={owner:/* @__PURE__ */Se(_e,{className:"h-3 w-3"}),admin:/* @__PURE__ */Se(st,{className:"h-3 w-3"}),member:/* @__PURE__ */Se(ut,{className:"h-3 w-3"}),viewer:/* @__PURE__ */Se(Fe,{className:"h-3 w-3"})},kE={owner:"bg-yellow-500/10 text-yellow-700 dark:text-yellow-400",admin:"bg-purple-500/10 text-purple-700 dark:text-purple-400",member:"bg-blue-500/10 text-blue-700 dark:text-blue-400",viewer:"bg-gray-500/10 text-gray-700 dark:text-gray-400"},CE=({open:e,onOpenChange:t})=>{const[r,n]=wE("REASON-organizations",[{id:"1",name:"My Organization",slug:"my-org",description:"Your personal workspace",teams:[{id:"1",name:"General",description:"Default team for collaboration",members:[{id:"1",name:"You",email:"you@example.com",role:"owner",joinedAt:/* @__PURE__ */new Date}],createdAt:/* @__PURE__ */new Date,updatedAt:/* @__PURE__ */new Date}],createdAt:/* @__PURE__ */new Date,updatedAt:/* @__PURE__ */new Date}]),[a,o]=ye(r[0]?.id||null),[i,s]=ye(null),[l,c]=ye(!1),[d,u]=ye(null),[h,p]=ye(""),[m,f]=ye("member"),g=r.find(e=>e.id===a),v=g?.teams.find(e=>e.id===i);/* @__PURE__ */
396
395
  return ke(we,{children:[
397
- /* @__PURE__ */Se(IM,{open:e,onOpenChange:t,children:/* @__PURE__ */ke(_M,{className:"max-w-4xl max-h-[85vh]",children:[/* @__PURE__ */ke(PM,{children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Ce,{className:"h-5 w-5"}),/* @__PURE__ */Se(LM,{children:"Teams & Organizations"})]}),/* @__PURE__ */Se(FM,{children:"Manage your teams and collaborate with others"})]}),/* @__PURE__ */ke(QD,{defaultValue:"teams",className:"flex-1",children:[
398
- /* @__PURE__ */ke(eE,{className:"grid w-full grid-cols-2",children:[/* @__PURE__ */Se(tE,{value:"teams",children:"Teams"}),/* @__PURE__ */Se(tE,{value:"organizations",children:"Organizations"})]}),
399
- /* @__PURE__ */ke(rE,{value:"teams",className:"space-y-4 mt-4",children:[
400
- /* @__PURE__ */ke("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */ke("div",{className:"space-y-1",children:[/* @__PURE__ */Se("h3",{className:"font-semibold",children:"Your Teams"}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"Collaborate with team members"})]}),/* @__PURE__ */ke(ic,{onClick:()=>{if(!a)return;const e={id:Date.now().toString(),name:"New Team",members:[],createdAt:/* @__PURE__ */new Date,updatedAt:/* @__PURE__ */new Date};n(t=>t.map(t=>t.id===a?{...t,teams:[...t.teams,e],updatedAt:/* @__PURE__ */new Date}:t)),s(e.id),BD.success("Team created")},size:"sm",children:[/* @__PURE__ */Se(rt,{className:"h-4 w-4 mr-2"}),"New Team"]})]}),
396
+ /* @__PURE__ */Se(IM,{open:e,onOpenChange:t,children:/* @__PURE__ */ke(_M,{className:"max-w-4xl max-h-[85vh]",children:[/* @__PURE__ */ke(PM,{children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Ce,{className:"h-5 w-5"}),/* @__PURE__ */Se(LM,{children:"Teams & Organizations"})]}),/* @__PURE__ */Se(FM,{children:"Manage your teams and collaborate with others"})]}),/* @__PURE__ */ke(eE,{defaultValue:"teams",className:"flex-1",children:[
397
+ /* @__PURE__ */ke(tE,{className:"grid w-full grid-cols-2",children:[/* @__PURE__ */Se(rE,{value:"teams",children:"Teams"}),/* @__PURE__ */Se(rE,{value:"organizations",children:"Organizations"})]}),
398
+ /* @__PURE__ */ke(nE,{value:"teams",className:"space-y-4 mt-4",children:[
399
+ /* @__PURE__ */ke("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */ke("div",{className:"space-y-1",children:[/* @__PURE__ */Se("h3",{className:"font-semibold",children:"Your Teams"}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"Collaborate with team members"})]}),/* @__PURE__ */ke(ic,{onClick:()=>{if(!a)return;const e={id:Date.now().toString(),name:"New Team",members:[],createdAt:/* @__PURE__ */new Date,updatedAt:/* @__PURE__ */new Date};n(t=>t.map(t=>t.id===a?{...t,teams:[...t.teams,e],updatedAt:/* @__PURE__ */new Date}:t)),s(e.id),FD.success("Team created")},size:"sm",children:[/* @__PURE__ */Se(rt,{className:"h-4 w-4 mr-2"}),"New Team"]})]}),
401
400
  /* @__PURE__ */Se(eD,{}),
402
401
  /* @__PURE__ */Se(VM,{className:"h-[50vh]",children:g&&g.teams.length>0?/* @__PURE__ */Se("div",{className:"space-y-4",children:g.teams.map(e=>/* @__PURE__ */ke("div",{className:"border rounded-lg p-4 space-y-4",children:[/* @__PURE__ */ke("div",{className:"flex items-start justify-between",children:[/* @__PURE__ */ke("div",{className:"space-y-1",children:[
403
402
  /* @__PURE__ */ke("h4",{className:"font-semibold flex items-center gap-2",children:[/* @__PURE__ */Se(ut,{className:"h-4 w-4"}),e.name]}),e.description&&/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:e.description}),
404
- /* @__PURE__ */ke("p",{className:"text-xs text-muted-foreground",children:[e.members.length," member",1!==e.members.length?"s":""]})]}),/* @__PURE__ */ke(ic,{variant:"outline",size:"sm",onClick:()=>{s(e.id),c(!0)},children:[/* @__PURE__ */Se(dt,{className:"h-4 w-4 mr-2"}),"Invite"]})]}),/* @__PURE__ */Se("div",{className:"space-y-2",children:e.members.map(e=>/* @__PURE__ */ke("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */ke(rc,{className:"h-8 w-8",children:[/* @__PURE__ */Se(nc,{src:e.avatarUrl}),/* @__PURE__ */Se(ac,{children:e.name.substring(0,2).toUpperCase()})]}),/* @__PURE__ */ke("div",{children:[/* @__PURE__ */Se("p",{className:"text-sm font-medium",children:e.name}),/* @__PURE__ */Se("p",{className:"text-xs text-muted-foreground",children:e.email})]})]}),/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */ke(cc,{variant:"secondary",className:SE[e.role],children:[/* @__PURE__ */Se("span",{className:"mr-1",children:wE[e.role]}),e.role]}),"owner"!==e.role&&/* @__PURE__ */ke(we,{children:[/* @__PURE__ */ke(nE,{value:e.role,onValueChange:t=>{return r=e.id,o=t,void(a&&i&&(n(e=>e.map(e=>e.id===a?{...e,teams:e.teams.map(e=>e.id===i?{...e,members:e.members.map(e=>e.id===r?{...e,role:o}:e),updatedAt:/* @__PURE__ */new Date}:e)}:e)),BD.success("Role updated")));var r,o},children:[/* @__PURE__ */Se(oE,{className:"h-8 w-28",children:/* @__PURE__ */Se(aE,{})}),/* @__PURE__ */ke(lE,{children:[
405
- /* @__PURE__ */Se(cE,{value:"admin",children:"Admin"}),
406
- /* @__PURE__ */Se(cE,{value:"member",children:"Member"}),
407
- /* @__PURE__ */Se(cE,{value:"viewer",children:"Viewer"})]})]}),/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",onClick:()=>u(e),children:/* @__PURE__ */Se(ct,{className:"h-4 w-4 text-destructive"})})]})]})]},e.id))})]},e.id))}):/* @__PURE__ */ke("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[/* @__PURE__ */Se(ut,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"No teams yet. Create your first team to get started."})]})})]}),
408
- /* @__PURE__ */ke(rE,{value:"organizations",className:"space-y-4 mt-4",children:[
403
+ /* @__PURE__ */ke("p",{className:"text-xs text-muted-foreground",children:[e.members.length," member",1!==e.members.length?"s":""]})]}),/* @__PURE__ */ke(ic,{variant:"outline",size:"sm",onClick:()=>{s(e.id),c(!0)},children:[/* @__PURE__ */Se(dt,{className:"h-4 w-4 mr-2"}),"Invite"]})]}),/* @__PURE__ */Se("div",{className:"space-y-2",children:e.members.map(e=>/* @__PURE__ */ke("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */ke(rc,{className:"h-8 w-8",children:[/* @__PURE__ */Se(nc,{src:e.avatarUrl}),/* @__PURE__ */Se(ac,{children:e.name.substring(0,2).toUpperCase()})]}),/* @__PURE__ */ke("div",{children:[/* @__PURE__ */Se("p",{className:"text-sm font-medium",children:e.name}),/* @__PURE__ */Se("p",{className:"text-xs text-muted-foreground",children:e.email})]})]}),/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */ke(cc,{variant:"secondary",className:kE[e.role],children:[/* @__PURE__ */Se("span",{className:"mr-1",children:SE[e.role]}),e.role]}),"owner"!==e.role&&/* @__PURE__ */ke(we,{children:[/* @__PURE__ */ke(aE,{value:e.role,onValueChange:t=>{return r=e.id,o=t,void(a&&i&&(n(e=>e.map(e=>e.id===a?{...e,teams:e.teams.map(e=>e.id===i?{...e,members:e.members.map(e=>e.id===r?{...e,role:o}:e),updatedAt:/* @__PURE__ */new Date}:e)}:e)),FD.success("Role updated")));var r,o},children:[/* @__PURE__ */Se(iE,{className:"h-8 w-28",children:/* @__PURE__ */Se(oE,{})}),/* @__PURE__ */ke(cE,{children:[
404
+ /* @__PURE__ */Se(dE,{value:"admin",children:"Admin"}),
405
+ /* @__PURE__ */Se(dE,{value:"member",children:"Member"}),
406
+ /* @__PURE__ */Se(dE,{value:"viewer",children:"Viewer"})]})]}),/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",onClick:()=>u(e),children:/* @__PURE__ */Se(ct,{className:"h-4 w-4 text-destructive"})})]})]})]},e.id))})]},e.id))}):/* @__PURE__ */ke("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[/* @__PURE__ */Se(ut,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"No teams yet. Create your first team to get started."})]})})]}),
407
+ /* @__PURE__ */ke(nE,{value:"organizations",className:"space-y-4 mt-4",children:[
409
408
  /* @__PURE__ */ke("div",{className:"space-y-1",children:[/* @__PURE__ */Se("h3",{className:"font-semibold",children:"Your Organizations"}),/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"Manage organization settings and details"})]}),
410
409
  /* @__PURE__ */Se(eD,{}),
411
410
  /* @__PURE__ */Se(VM,{className:"h-[50vh]",children:r.map(e=>/* @__PURE__ */Se("div",{className:"border rounded-lg p-4 space-y-4 mb-4",children:/* @__PURE__ */ke("div",{className:"flex items-start gap-4",children:[/* @__PURE__ */ke(rc,{className:"h-16 w-16",children:[/* @__PURE__ */Se(nc,{src:e.logoUrl}),/* @__PURE__ */Se(ac,{className:"text-lg",children:e.name.substring(0,2).toUpperCase()})]}),/* @__PURE__ */ke("div",{className:"flex-1 space-y-1",children:[
@@ -414,50 +413,50 @@ return ke(we,{children:[
414
413
  /* @__PURE__ */ke("div",{className:"flex gap-4 text-xs text-muted-foreground pt-2",children:[/* @__PURE__ */ke("span",{children:[e.teams.length," teams"]}),/* @__PURE__ */ke("span",{children:[e.teams.reduce((e,t)=>e+t.members.length,0)," ","members"]})]})]})]})},e.id))})]})]})]})}),
415
414
  /* @__PURE__ */Se(IM,{open:l,onOpenChange:c,children:/* @__PURE__ */ke(_M,{children:[
416
415
  /* @__PURE__ */ke(PM,{children:[/* @__PURE__ */Se(LM,{children:"Invite Team Member"}),/* @__PURE__ */ke(FM,{children:["Send an invitation to join ",v?.name]})]}),
417
- /* @__PURE__ */ke("div",{className:"space-y-4 py-4",children:[/* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */Se(xD,{htmlFor:"email",children:"Email Address"}),/* @__PURE__ */ke("div",{className:"relative",children:[/* @__PURE__ */Se(Ke,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),/* @__PURE__ */Se(BM,{id:"email",type:"email",placeholder:"colleague@example.com",value:h,onChange:e=>p(e.target.value),className:"pl-9"})]})]}),/* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */Se(xD,{htmlFor:"role",children:"Role"}),/* @__PURE__ */ke(nE,{value:m,onValueChange:e=>f(e),children:[/* @__PURE__ */Se(oE,{children:/* @__PURE__ */Se(aE,{})}),/* @__PURE__ */ke(lE,{children:[
418
- /* @__PURE__ */Se(cE,{value:"admin",children:"Admin"}),
419
- /* @__PURE__ */Se(cE,{value:"member",children:"Member"}),
420
- /* @__PURE__ */Se(cE,{value:"viewer",children:"Viewer"})]})]})]})]}),
421
- /* @__PURE__ */ke("div",{className:"flex justify-end gap-2",children:[/* @__PURE__ */Se(ic,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),/* @__PURE__ */Se(ic,{onClick:()=>{if(!h.trim()||!a||!i)return;const e={id:Date.now().toString(),name:h.split("@")[0],email:h,role:m,joinedAt:/* @__PURE__ */new Date};n(t=>t.map(t=>t.id===a?{...t,teams:t.teams.map(t=>t.id===i?{...t,members:[...t.members,e],updatedAt:/* @__PURE__ */new Date}:t)}:t)),p(""),f("member"),c(!1),BD.success("Member invited")},children:"Send Invitation"})]})]})}),
422
- /* @__PURE__ */Se(dE,{open:!!d,onOpenChange:()=>u(null),children:/* @__PURE__ */ke(pE,{children:[/* @__PURE__ */ke(mE,{children:[/* @__PURE__ */Se(gE,{children:"Remove Team Member"}),/* @__PURE__ */ke(vE,{children:["Are you sure you want to remove ",d?.name," from the team? They will lose access to all team resources."]})]}),/* @__PURE__ */ke(fE,{children:[/* @__PURE__ */Se(bE,{children:"Cancel"}),/* @__PURE__ */Se(yE,{onClick:()=>{return d&&(e=d.id,void(a&&i&&(n(t=>t.map(t=>t.id===a?{...t,teams:t.teams.map(t=>t.id===i?{...t,members:t.members.filter(t=>t.id!==e),updatedAt:/* @__PURE__ */new Date}:t)}:t)),u(null),BD.success("Member removed"))));var e},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})};function CE({className:e,...t}){/* @__PURE__ */
423
- return Se(Tt.Root,{"data-slot":"switch",className:tc("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:/* @__PURE__ */Se(Tt.Thumb,{"data-slot":"switch-thumb",className:tc("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}var NE=({open:e,onOpenChange:t,documentTitle:r,documentId:n,sharingInfo:a,teams:o=[],onUpdateSharing:i})=>{const[s,l]=ye(""),[c,d]=ye("editor"),[u,h]=ye(a?.isPublic||!1),[p,m]=ye(a?.sharedWith||[]),[f,g]=ye(a?.shareLink||null),[v,y]=ye(!1),b=()=>{if(!s.trim())return;if(p.find(e=>e.email===s))return void BD.error("Already shared with this user");const e={email:s,role:c,sharedAt:/* @__PURE__ */(new Date).toISOString()},t=[...p,e];m(t),i&&i({...a,isPublic:u,sharedWith:t}),l(""),BD.success(`Invited ${s}`)},x=async()=>{if(!v){y(!0);try{const e=await Mt("doc/share",{method:"POST",headers:{"Content-Type":"application/json"},body:{documentId:n}});return e.success?(g(e.data.shareUrl),i&&i({...a,isPublic:u,sharedWith:p,shareLink:e.data.shareUrl}),e.data.shareUrl):(BD.error(e.error||"Failed to generate share link"),null)}catch(e){return BD.error(e.message||"Failed to generate share link"),null}finally{y(!1)}}};/* @__PURE__ */
416
+ /* @__PURE__ */ke("div",{className:"space-y-4 py-4",children:[/* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */Se(xD,{htmlFor:"email",children:"Email Address"}),/* @__PURE__ */ke("div",{className:"relative",children:[/* @__PURE__ */Se(Ke,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),/* @__PURE__ */Se(BM,{id:"email",type:"email",placeholder:"colleague@example.com",value:h,onChange:e=>p(e.target.value),className:"pl-9"})]})]}),/* @__PURE__ */ke("div",{className:"space-y-2",children:[/* @__PURE__ */Se(xD,{htmlFor:"role",children:"Role"}),/* @__PURE__ */ke(aE,{value:m,onValueChange:e=>f(e),children:[/* @__PURE__ */Se(iE,{children:/* @__PURE__ */Se(oE,{})}),/* @__PURE__ */ke(cE,{children:[
417
+ /* @__PURE__ */Se(dE,{value:"admin",children:"Admin"}),
418
+ /* @__PURE__ */Se(dE,{value:"member",children:"Member"}),
419
+ /* @__PURE__ */Se(dE,{value:"viewer",children:"Viewer"})]})]})]})]}),
420
+ /* @__PURE__ */ke("div",{className:"flex justify-end gap-2",children:[/* @__PURE__ */Se(ic,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),/* @__PURE__ */Se(ic,{onClick:()=>{if(!h.trim()||!a||!i)return;const e={id:Date.now().toString(),name:h.split("@")[0],email:h,role:m,joinedAt:/* @__PURE__ */new Date};n(t=>t.map(t=>t.id===a?{...t,teams:t.teams.map(t=>t.id===i?{...t,members:[...t.members,e],updatedAt:/* @__PURE__ */new Date}:t)}:t)),p(""),f("member"),c(!1),FD.success("Member invited")},children:"Send Invitation"})]})]})}),
421
+ /* @__PURE__ */Se(uE,{open:!!d,onOpenChange:()=>u(null),children:/* @__PURE__ */ke(mE,{children:[/* @__PURE__ */ke(fE,{children:[/* @__PURE__ */Se(vE,{children:"Remove Team Member"}),/* @__PURE__ */ke(yE,{children:["Are you sure you want to remove ",d?.name," from the team? They will lose access to all team resources."]})]}),/* @__PURE__ */ke(gE,{children:[/* @__PURE__ */Se(xE,{children:"Cancel"}),/* @__PURE__ */Se(bE,{onClick:()=>{return d&&(e=d.id,void(a&&i&&(n(t=>t.map(t=>t.id===a?{...t,teams:t.teams.map(t=>t.id===i?{...t,members:t.members.filter(t=>t.id!==e),updatedAt:/* @__PURE__ */new Date}:t)}:t)),u(null),FD.success("Member removed"))));var e},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})};function NE({className:e,...t}){/* @__PURE__ */
422
+ return Se(Tt.Root,{"data-slot":"switch",className:tc("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:/* @__PURE__ */Se(Tt.Thumb,{"data-slot":"switch-thumb",className:tc("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}var TE=({open:e,onOpenChange:t,documentTitle:r,documentId:n,sharingInfo:a,teams:o=[],onUpdateSharing:i})=>{const[s,l]=ye(""),[c,d]=ye("editor"),[u,h]=ye(a?.isPublic||!1),[p,m]=ye(a?.sharedWith||[]),[f,g]=ye(a?.shareLink||null),[v,y]=ye(!1),b=()=>{if(!s.trim())return;if(p.find(e=>e.email===s))return void FD.error("Already shared with this user");const e={email:s,role:c,sharedAt:/* @__PURE__ */(new Date).toISOString()},t=[...p,e];m(t),i&&i({...a,isPublic:u,sharedWith:t}),l(""),FD.success(`Invited ${s}`)},x=async()=>{if(!v){y(!0);try{const e=await Mt("doc/share",{method:"POST",headers:{"Content-Type":"application/json"},body:{documentId:n}});return e.success?(g(e.data.shareUrl),i&&i({...a,isPublic:u,sharedWith:p,shareLink:e.data.shareUrl}),e.data.shareUrl):(FD.error(e.error||"Failed to generate share link"),null)}catch(e){return FD.error(e.message||"Failed to generate share link"),null}finally{y(!1)}}};/* @__PURE__ */
424
423
  return Se(IM,{open:e,onOpenChange:t,children:/* @__PURE__ */ke(_M,{className:"max-w-2xl max-h-[85vh]",children:[/* @__PURE__ */ke(PM,{children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(dt,{className:"h-5 w-5"}),/* @__PURE__ */ke(LM,{children:['Share "',r,'"']})]}),/* @__PURE__ */Se(FM,{children:"Invite people or share with teams"})]}),/* @__PURE__ */ke("div",{className:"space-y-6",children:[
425
- /* @__PURE__ */ke("div",{className:"flex items-center justify-between p-4 rounded-lg border bg-muted/30",children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-3",children:[u?/* @__PURE__ */Se(Ve,{className:"h-5 w-5 text-primary"}):/* @__PURE__ */Se(Ge,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */ke("div",{children:[/* @__PURE__ */Se("p",{className:"font-medium text-sm",children:u?"Public Access":"Private"}),/* @__PURE__ */Se("p",{className:"text-xs text-muted-foreground",children:u?"Anyone with the link can view":"Only invited people can access"})]})]}),/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[u&&/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",onClick:async()=>{let e=f;(e||(e=await x(),e))&&(navigator.clipboard.writeText(e),BD.success("Link copied to clipboard"))},className:"h-8",children:/* @__PURE__ */Se(Ue,{className:"h-4 w-4"})}),/* @__PURE__ */Se(CE,{checked:u,onCheckedChange:async e=>{h(e),e&&!f&&await x(),i&&i({...a,isPublic:e,sharedWith:p,shareLink:f}),BD.success(e?"Document is now public":"Document is now private")}})]})]}),
424
+ /* @__PURE__ */ke("div",{className:"flex items-center justify-between p-4 rounded-lg border bg-muted/30",children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-3",children:[u?/* @__PURE__ */Se(Ve,{className:"h-5 w-5 text-primary"}):/* @__PURE__ */Se(Ge,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */ke("div",{children:[/* @__PURE__ */Se("p",{className:"font-medium text-sm",children:u?"Public Access":"Private"}),/* @__PURE__ */Se("p",{className:"text-xs text-muted-foreground",children:u?"Anyone with the link can view":"Only invited people can access"})]})]}),/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[u&&/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",onClick:async()=>{let e=f;(e||(e=await x(),e))&&(navigator.clipboard.writeText(e),FD.success("Link copied to clipboard"))},className:"h-8",children:/* @__PURE__ */Se(Ue,{className:"h-4 w-4"})}),/* @__PURE__ */Se(NE,{checked:u,onCheckedChange:async e=>{h(e),e&&!f&&await x(),i&&i({...a,isPublic:e,sharedWith:p,shareLink:f}),FD.success(e?"Document is now public":"Document is now private")}})]})]}),
426
425
  /* @__PURE__ */ke("div",{className:"space-y-3",children:[/* @__PURE__ */Se(xD,{children:"Invite by email"}),/* @__PURE__ */ke("div",{className:"flex gap-2",children:[
427
426
  /* @__PURE__ */ke("div",{className:"relative flex-1",children:[/* @__PURE__ */Se(Ke,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),/* @__PURE__ */Se(BM,{type:"email",placeholder:"colleague@example.com",value:s,onChange:e=>l(e.target.value),onKeyPress:e=>"Enter"===e.key&&b(),className:"pl-9"})]}),
428
- /* @__PURE__ */ke(nE,{value:c,onValueChange:e=>d(e),children:[/* @__PURE__ */Se(oE,{className:"w-36",children:/* @__PURE__ */Se(aE,{})}),/* @__PURE__ */ke(lE,{children:[
429
- /* @__PURE__ */Se(cE,{value:"editor",children:/* @__PURE__ */ke("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Le,{className:"h-3 w-3"}),"Editor"]})}),
430
- /* @__PURE__ */Se(cE,{value:"commentor",children:/* @__PURE__ */ke("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Xe,{className:"h-3 w-3"}),"Commentor"]})}),
431
- /* @__PURE__ */Se(cE,{value:"viewer",children:/* @__PURE__ */ke("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Fe,{className:"h-3 w-3"}),"Viewer"]})})]})]}),
427
+ /* @__PURE__ */ke(aE,{value:c,onValueChange:e=>d(e),children:[/* @__PURE__ */Se(iE,{className:"w-36",children:/* @__PURE__ */Se(oE,{})}),/* @__PURE__ */ke(cE,{children:[
428
+ /* @__PURE__ */Se(dE,{value:"editor",children:/* @__PURE__ */ke("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Le,{className:"h-3 w-3"}),"Editor"]})}),
429
+ /* @__PURE__ */Se(dE,{value:"commentor",children:/* @__PURE__ */ke("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Xe,{className:"h-3 w-3"}),"Commentor"]})}),
430
+ /* @__PURE__ */Se(dE,{value:"viewer",children:/* @__PURE__ */ke("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Fe,{className:"h-3 w-3"}),"Viewer"]})})]})]}),
432
431
  /* @__PURE__ */Se(ic,{onClick:b,children:"Invite"})]})]}),
433
432
  /* @__PURE__ */Se(eD,{}),o.length>0&&/* @__PURE__ */ke(we,{children:[/* @__PURE__ */ke("div",{className:"space-y-3",children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(ut,{className:"h-4 w-4 text-muted-foreground"}),/* @__PURE__ */Se("h4",{className:"text-sm font-semibold",children:"Teams with access"})]}),/* @__PURE__ */Se("div",{className:"space-y-2",children:o.map(e=>/* @__PURE__ */ke("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors",children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */Se(rc,{className:"h-8 w-8",children:/* @__PURE__ */Se(ac,{className:"bg-primary/10 text-primary",children:/* @__PURE__ */Se(ut,{className:"h-4 w-4"})})}),/* @__PURE__ */ke("div",{children:[/* @__PURE__ */Se("p",{className:"text-sm font-medium",children:e.name}),/* @__PURE__ */ke("p",{className:"text-xs text-muted-foreground",children:[e.members.length," member",1!==e.members.length?"s":""]})]})]}),/* @__PURE__ */ke(cc,{variant:"secondary",className:"bg-blue-500/10 text-blue-700 dark:text-blue-400",children:[/* @__PURE__ */Se(Le,{className:"h-3 w-3 mr-1"}),"Team"]})]},e.id))})]}),/* @__PURE__ */Se(eD,{})]}),
434
- /* @__PURE__ */ke("div",{className:"space-y-3",children:[/* @__PURE__ */Se("h4",{className:"text-sm font-semibold",children:"People with access"}),/* @__PURE__ */Se(VM,{className:"max-h-[300px]",children:p.length>0?/* @__PURE__ */Se("div",{className:"space-y-2 pr-4",children:p.map(e=>{/* @__PURE__ */return ke("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors",children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */Se(rc,{className:"h-8 w-8",children:/* @__PURE__ */Se(ac,{className:"bg-gradient-to-br from-primary/20 to-primary/10",children:(t=e.email,t.substring(0,2).toUpperCase())})}),/* @__PURE__ */ke("div",{children:[/* @__PURE__ */Se("p",{className:"text-sm font-medium",children:e.email}),/* @__PURE__ */ke("p",{className:"text-xs text-muted-foreground",children:["Added ",new Date(e.sharedAt).toLocaleDateString()]})]})]}),/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */ke(nE,{value:e.role||"viewer",onValueChange:t=>((e,t)=>{const r=p.map(r=>r.email===e?{...r,role:t}:r);m(r),i&&i({...a,isPublic:u,sharedWith:r}),BD.success("Role updated")})(e.email,t),children:[/* @__PURE__ */Se(oE,{className:"h-8 w-32",children:/* @__PURE__ */Se(aE,{})}),/* @__PURE__ */ke(lE,{children:[
435
- /* @__PURE__ */Se(cE,{value:"editor",children:/* @__PURE__ */ke("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Le,{className:"h-3 w-3"}),"Editor"]})}),
436
- /* @__PURE__ */Se(cE,{value:"commentor",children:/* @__PURE__ */ke("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Xe,{className:"h-3 w-3"}),"Commentor"]})}),
437
- /* @__PURE__ */Se(cE,{value:"viewer",children:/* @__PURE__ */ke("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Fe,{className:"h-3 w-3"}),"Viewer"]})})]})]}),/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",onClick:()=>(e=>{const t=p.filter(t=>t.email!==e);m(t),i&&i({...a,isPublic:u,sharedWith:t}),BD.success("Access removed")})(e.email),className:"h-8 w-8 p-0",children:/* @__PURE__ */Se(mt,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"})})]})]},e.email);var t})}):/* @__PURE__ */ke("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[
433
+ /* @__PURE__ */ke("div",{className:"space-y-3",children:[/* @__PURE__ */Se("h4",{className:"text-sm font-semibold",children:"People with access"}),/* @__PURE__ */Se(VM,{className:"max-h-[300px]",children:p.length>0?/* @__PURE__ */Se("div",{className:"space-y-2 pr-4",children:p.map(e=>{/* @__PURE__ */return ke("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors",children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */Se(rc,{className:"h-8 w-8",children:/* @__PURE__ */Se(ac,{className:"bg-gradient-to-br from-primary/20 to-primary/10",children:(t=e.email,t.substring(0,2).toUpperCase())})}),/* @__PURE__ */ke("div",{children:[/* @__PURE__ */Se("p",{className:"text-sm font-medium",children:e.email}),/* @__PURE__ */ke("p",{className:"text-xs text-muted-foreground",children:["Added ",new Date(e.sharedAt).toLocaleDateString()]})]})]}),/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */ke(aE,{value:e.role||"viewer",onValueChange:t=>((e,t)=>{const r=p.map(r=>r.email===e?{...r,role:t}:r);m(r),i&&i({...a,isPublic:u,sharedWith:r}),FD.success("Role updated")})(e.email,t),children:[/* @__PURE__ */Se(iE,{className:"h-8 w-32",children:/* @__PURE__ */Se(oE,{})}),/* @__PURE__ */ke(cE,{children:[
434
+ /* @__PURE__ */Se(dE,{value:"editor",children:/* @__PURE__ */ke("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Le,{className:"h-3 w-3"}),"Editor"]})}),
435
+ /* @__PURE__ */Se(dE,{value:"commentor",children:/* @__PURE__ */ke("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Xe,{className:"h-3 w-3"}),"Commentor"]})}),
436
+ /* @__PURE__ */Se(dE,{value:"viewer",children:/* @__PURE__ */ke("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Fe,{className:"h-3 w-3"}),"Viewer"]})})]})]}),/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",onClick:()=>(e=>{const t=p.filter(t=>t.email!==e);m(t),i&&i({...a,isPublic:u,sharedWith:t}),FD.success("Access removed")})(e.email),className:"h-8 w-8 p-0",children:/* @__PURE__ */Se(mt,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"})})]})]},e.email);var t})}):/* @__PURE__ */ke("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[
438
437
  /* @__PURE__ */Se(dt,{className:"h-12 w-12 text-muted-foreground mb-3 opacity-50"}),
439
438
  /* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"No one else has access yet"}),
440
- /* @__PURE__ */Se("p",{className:"text-xs text-muted-foreground mt-1",children:"Invite people to collaborate"})]})})]})]})]})})},TE=({open:e,onOpenChange:t,currentTags:r,onUpdateTags:n})=>{const[a,o]=ye(""),[i,s]=ye(r),l=()=>{if(a.trim()&&!i.includes(a.trim())){const e=[...i,a.trim()];s(e),o("")}};/* @__PURE__ */
439
+ /* @__PURE__ */Se("p",{className:"text-xs text-muted-foreground mt-1",children:"Invite people to collaborate"})]})})]})]})]})})},AE=({open:e,onOpenChange:t,currentTags:r,onUpdateTags:n})=>{const[a,o]=ye(""),[i,s]=ye(r),l=()=>{if(a.trim()&&!i.includes(a.trim())){const e=[...i,a.trim()];s(e),o("")}};/* @__PURE__ */
441
440
  return Se(IM,{open:e,onOpenChange:t,children:/* @__PURE__ */ke(_M,{className:"sm:max-w-md",children:[/* @__PURE__ */Se(PM,{children:/* @__PURE__ */Se(LM,{children:"Manage Tags"})}),/* @__PURE__ */ke("div",{className:"space-y-4",children:[
442
441
  /* @__PURE__ */ke("div",{className:"flex gap-2",children:[/* @__PURE__ */Se(BM,{value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),l())},placeholder:"Enter tag name...",className:"flex-1"}),/* @__PURE__ */ke(ic,{onClick:l,size:"sm",children:[/* @__PURE__ */Se(rt,{className:"h-4 w-4 mr-1"}),"Add"]})]}),
443
442
  /* @__PURE__ */Se("div",{className:"flex flex-wrap gap-2 min-h-[60px] p-3 border border-border rounded-md bg-muted/20",children:0===i.length?/* @__PURE__ */Se("p",{className:"text-sm text-muted-foreground",children:"No tags added yet"}):i.map(e=>/* @__PURE__ */ke(cc,{variant:"secondary",className:"gap-1 pl-2 pr-1",children:[e,/* @__PURE__ */Se("button",{onClick:()=>(e=>{const t=i.filter(t=>t!==e);s(t)})(e),className:"ml-1 hover:bg-background/80 rounded-sm p-0.5",children:/* @__PURE__ */Se(mt,{className:"h-3 w-3"})})]},e))}),
444
- /* @__PURE__ */ke("div",{className:"flex justify-end gap-2",children:[/* @__PURE__ */Se(ic,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),/* @__PURE__ */Se(ic,{onClick:()=>{n(i),t(!1)},children:"Save Tags"})]})]})]})})};function AE({isSearchModalOpen:e,setIsSearchModalOpen:t,isSettingsOpen:r,setIsSettingsOpen:n,settingsInitialSection:a,isTeamsOpen:o,setIsTeamsOpen:i,isInviteModalOpen:s,setIsInviteModalOpen:l,isTagDialogOpen:c,setIsTagDialogOpen:d,documents:u,activeDocument:h,tagManagementDocId:p,defaultSidebarView:m,setDefaultSidebarView:f,enableDatabaseSync:g,setEnableDatabaseSync:v,setDocuments:y,onSelectDocument:b,onToggleTheme:x,currentTheme:w,onUpdateTags:S}){/* @__PURE__ */
443
+ /* @__PURE__ */ke("div",{className:"flex justify-end gap-2",children:[/* @__PURE__ */Se(ic,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),/* @__PURE__ */Se(ic,{onClick:()=>{n(i),t(!1)},children:"Save Tags"})]})]})]})})};function ME({isSearchModalOpen:e,setIsSearchModalOpen:t,isSettingsOpen:r,setIsSettingsOpen:n,settingsInitialSection:a,isTeamsOpen:o,setIsTeamsOpen:i,isInviteModalOpen:s,setIsInviteModalOpen:l,isTagDialogOpen:c,setIsTagDialogOpen:d,documents:u,activeDocument:h,tagManagementDocId:p,defaultSidebarView:m,setDefaultSidebarView:f,enableDatabaseSync:g,setEnableDatabaseSync:v,setDocuments:y,onSelectDocument:b,onToggleTheme:x,currentTheme:w,onUpdateTags:S}){/* @__PURE__ */
445
444
  return ke(we,{children:[
446
445
  /* @__PURE__ */Se(GM,{open:e,onOpenChange:t,documents:u,onSelectDocument:b,onOpenSettings:()=>n(!0),onOpenTeams:()=>i(!0),onToggleTheme:x,currentTheme:w}),
447
- /* @__PURE__ */Se(JD,{open:r,onOpenChange:n,initialSection:a,defaultSidebarView:m,onDefaultSidebarViewChange:f,enableDatabaseSync:g,onEnableDatabaseSyncChange:v}),
448
- /* @__PURE__ */Se(kE,{open:o,onOpenChange:i}),
449
- /* @__PURE__ */Se(NE,{open:s,onOpenChange:l,documentTitle:h?.title||"Untitled",documentId:h?.id||"",sharingInfo:h?.sharing,onUpdateSharing:e=>{h&&y(t=>t.map(t=>t.id===h.id?{...t,sharing:e}:t))}}),
450
- /* @__PURE__ */Se(TE,{open:c,onOpenChange:d,currentTags:p&&u.find(e=>e.id===p)?.tags||[],onUpdateTags:S})]})}function ME(e,t){const r=[],n=t=>{for(const a of e)a.parentId===t&&(r.push(a.id),n(a.id))};return n(t),r}function DE(e,t){const r=/* @__PURE__ */new Set([t,...ME(e,t)]);let n=e.findIndex(e=>e.id===t);if(-1===n)return e.length;for(let a=n;a<e.length;a++)r.has(e[a].id)&&(n=a);return n+1}function EE(e){const t=QM(),[r,n]=ye(!1),[a,o]=ye(!1),[i,s]=ye(!1),[l,c]=ye(!1),[d,u]=ye(!1),[h,p]=ye(!1),[m,f]=ye(!1),[g,v]=ye(null),[y,b]=xE("REASON-default-sidebar-view","last-used"),[x,w]=xE("REASON-left-panels",["openTabs","files"]),[S,k]=xE("REASON-right-panels",[]),[C,N]=xE("REASON-show-dynamic-island",!1),[T,A]=xE("REASON-sidebar-width",25),[M,D]=ye(null),[E,I]=ye(!1),R=ve(null),[z,_]=ye([]),[P,O]=xE("REASON-documents",Wb),[L,F]=xE("REASON-active-doc",P.length>0?P[0].id:null),[B,V]=xE("REASON-open-tabs",P.length>0?[P[0].id]:[]),[$,H]=ye([]),[j,q]=ye(null),[U,G]=ye(""),[W,K]=ye(null),[Y,X]=ye(Zf()),[Z,J]=xE("REASON-enable-db-sync",!1),{isSyncing:Q,lastSyncTime:ee,saveDocument:te,deleteDocument:re,queueDocumentForSync:ne}=function(e,t,r={}){const{enableSync:n=!1,syncInterval:a=5e3}=r,[o,i]=ye(!1),[s,l]=ye(null),c=ve(/* @__PURE__ */new Map),d=ve(void 0),u=ce(async()=>{if(n)try{const e=(await Mt("doc/documents")).map(e=>({id:e.id.toString(),title:e.title||e.name||"Untitled",content:e.content||"",parentId:e.parentId?e.parentId.toString():null,children:[],isExpanded:1===e.isExpanded,isFolder:1===e.isFolder,tags:e.metadata&&JSON.parse(e.metadata).tags||[],metadata:e.metadata?JSON.parse(e.metadata):void 0}));return t(e),l(/* @__PURE__ */new Date),e}catch(e){return BD.error("Failed to load documents from database"),null}},[n,t]),h=ce(async e=>{if(n)try{const r={name:e.title||"Untitled",title:e.title||"Untitled",content:e.content||"",parentId:e.parentId?parseInt(e.parentId):null,isFolder:e.isFolder||!1,metadata:{tags:e.tags||[],isExpanded:e.isExpanded||!1,...e.metadata}};if(isNaN(parseInt(e.id))){const n=await Mt("doc/documents",{method:"POST",headers:{"Content-Type":"application/json"},body:r});return t(t=>t.map(t=>t.id===e.id?{...t,id:n.id.toString()}:t)),n}return await Mt(`doc/documents/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:r})}catch(r){return BD.error("Failed to save document to database"),null}},[n,t]),p=ce(async()=>{if(n&&0!==c.current.size){i(!0);try{const e=Array.from(c.current.values());await Promise.all(e.map(e=>h(e))),c.current.clear(),l(/* @__PURE__ */new Date)}catch(e){}finally{i(!1)}}},[n,h]),m=ce(e=>{n&&(c.current.set(e.id,e),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{p()},2e3))},[n,p]),f=ce(async e=>{if(n)try{return await Mt(`doc/documents/${e}`,{method:"DELETE"}),!0}catch(t){return BD.error("Failed to delete document from database"),!1}},[n]);return ue(()=>{if(!n||a<=0)return;const e=setInterval(()=>{c.current.size>0&&p()},a);return()=>clearInterval(e)},[n,a,p]),ue(()=>()=>{d.current&&clearTimeout(d.current)},[]),{isSyncing:o,lastSyncTime:s,loadFromDatabase:u,saveDocument:h,deleteDocument:f,queueDocumentForSync:m,syncPendingChanges:p}}(0,O,{enableSync:Z,syncInterval:5e3}),ae=e=>{const t=/* @__PURE__ */new Map,r=[];return e.forEach(e=>{t.set(e.id,{...e,children:[]})}),e.forEach(e=>{const n=t.get(e.id);e.parentId&&t.has(e.parentId)?t.get(e.parentId).children.push(n):r.push(n)}),r},oe=ge(()=>ae(P),[P]),ie=P.find(e=>e.id===L);ue(()=>{document.title=ie?.title?`${ie.title} - Reason Docs`:"Reason - Powerful Note-Taking App"},[ie?.title]),ue(()=>{_([])},[L]);const se=ge(()=>{const e=P.filter(e=>!e.isDeleted);if(!U.trim())return e;const t=U.toLowerCase();return e.filter(e=>e.title.toLowerCase().includes(t)||e.content.toLowerCase().includes(t))},[P,U]),le=ge(()=>U.trim()?ae(se):oe,[se,U]),de=async(e,t=!1)=>{let r=null;if(e){const t=P.find(t=>t.id===e);t&&(r=t.isFolder?e:t.parentId)}const n={id:Date.now().toString(),title:t?"New Folder":"",content:"",parentId:r,children:[],isExpanded:t,isFolder:t,tags:[]};O([...P,n]),Z&&await te(n),t||(F(n.id),V([...B,n.id])),K(n.id),setTimeout(()=>K(null),500),r&&O(e=>e.map(e=>e.id===r?{...e,isExpanded:!0}:e)),BD.success(t?"Folder created":"Note created")},he=async e=>{const t=e=>[e,...P.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],r=t(e),n=P.filter(e=>!r.includes(e.id));if(O(n),Z)for(const o of r)await re(o);const a=B.filter(e=>!r.includes(e));V(a),L&&r.includes(L)&&F(a.length>0?a[0]:n.length>0?n[0].id:null),BD.success("Note deleted")},pe=e=>{O(t=>t.map(t=>t.id===e?{...t,isExpanded:!t.isExpanded}:t))};ue(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"k"===e.key&&(e.preventDefault(),s(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),ue(()=>{e&&(w(e=>e.includes("files")?e:["files",...e]),n(!0))},[e]),ue(()=>{const e="REASON-open-tabs-default-restored";try{if(window.localStorage.getItem(e))return;window.localStorage.setItem(e,"1")}catch{return}"tree"!==y&&"outline"!==y&&w(e=>e.includes("openTabs")?e:[...e,"openTabs"])},[]),ue(()=>{"tree"===y?w(["files"]):"outline"===y?w(["outline"]):"split"===y&&w(["openTabs","files","outline"])},[]);const me=e=>{const t=function(e,t,r){const n=new Set(r.filter(t=>e.includes(t)));if(0===n.size)return{openTabs:e,activeTabId:t,closed:[]};const a=e.filter(e=>!n.has(e)),o=e.filter(e=>n.has(e));if(!t||!n.has(t))return{openTabs:a,activeTabId:t,closed:o};const i=e.indexOf(t);let s=null;for(let l=i-1;l>=0&&null===s;l--)n.has(e[l])||(s=e[l]);for(let l=i+1;l<e.length&&null===s;l++)n.has(e[l])||(s=e[l]);return{openTabs:a,activeTabId:s,closed:o}}(B,L,e);0!==t.closed.length&&(H([...t.closed,...$].slice(0,10)),V(t.openTabs),t.activeTabId!==L&&F(t.activeTabId))},fe=e=>{me([e])},be=()=>{if(0===$.length)return;const[e,...t]=$;P.find(t=>t.id===e)?(B.includes(e)||V([...B,e]),F(e),H(t),BD.success("Tab reopened")):(H(t),t.length>0&&be())},xe=()=>{k(e=>e.filter(e=>"ai"!==e)),w(e=>e.length>1?e.filter(e=>"ai"!==e):e)};return ue(()=>{L&&!P.find(e=>e.id===L)&&F(P.length>0?P[0].id:null)},[P,L,F]),{isMobile:t,isSidebarOpen:r,setIsSidebarOpen:n,isRightSidebarOpen:a,setIsRightSidebarOpen:o,isSearchModalOpen:i,setIsSearchModalOpen:s,isSettingsOpen:l,setIsSettingsOpen:c,isTeamsOpen:d,setIsTeamsOpen:u,isInviteModalOpen:h,setIsInviteModalOpen:p,isTagDialogOpen:m,setIsTagDialogOpen:f,tagManagementDocId:g,defaultSidebarView:y,setDefaultSidebarView:b,leftPanels:x,setLeftPanels:w,rightPanels:S,setRightPanels:k,showDynamicIsland:C,setShowDynamicIsland:N,sidebarWidth:T,setSidebarWidth:A,aiSuggestion:M,setAiSuggestion:D,isAiLoading:E,setIsAiLoading:I,editorRef:R,headings:z,setHeadings:_,documents:P,setDocuments:O,activeDocId:L,setActiveDocId:F,openTabs:B,setOpenTabs:V,closedTabsHistory:$,splitViewDocId:j,setSplitViewDocId:q,searchQuery:U,setSearchQuery:G,newDocumentId:W,activeFileSourceId:Y,enableDatabaseSync:Z,setEnableDatabaseSync:J,isSyncing:Q,lastSyncTime:ee,documentTree:oe,activeDocument:ie,filteredDocuments:se,filteredTree:le,handleAddDocument:de,handleDeleteDocument:he,handleDuplicateDocument:e=>{const t=P.find(t=>t.id===e);if(!t)return;const r={...t,id:Date.now().toString(),title:t.title+" (Copy)",children:[]};O([...P,r]),F(r.id),V([...B,r.id]),BD.success("Note duplicated")},handleUpdateDocument:(e,t)=>{O(r=>r.map(r=>{if(r.id===e){const e={...r,...t};return Z&&ne(e),e}return r}))},handleToggleExpand:pe,handleSetExpandedFolders:e=>{const t=new Set(e);O(e=>e.map(e=>{const r=t.has(e.id);return!!e.isExpanded===r?e:{...e,isExpanded:r}}))},handleMoveDocument:(e,t,r)=>{if(e===t)return;if(t&&ME(P,e).includes(t))return void BD.error("Cannot move a note into its own child");const n=function(e,t,r,n){if(!e.find(e=>e.id===t)||t===r)return e;if(r&&!e.some(e=>e.id===r))return e;const a=/* @__PURE__ */new Set([t,...ME(e,t)]);if(r&&a.has(r))return e;const o=r?e.find(e=>e.id===r):void 0,i="child"===n?r:o?.parentId??null,s=e.filter(e=>a.has(e.id)).map(e=>e.id===t?{...e,parentId:i}:e),l=e.filter(e=>!a.has(e.id));let c;return c="before"===n?l.findIndex(e=>e.id===r):"after"===n||r?DE(l,r):l.length,c<0&&(c=l.length),[...l.slice(0,c),...s,...l.slice(c)]}(P,e,t,r);if(n!==P){if(O(n),Z){const t=n.find(t=>t.id===e);t&&ne(t)}BD.success("Note moved")}},handleAddTag:(e,t)=>{O(r=>r.map(r=>r.id===e?{...r,tags:[...r.tags||[],t]}:r))},handleRemoveTag:(e,t)=>{O(r=>r.map(r=>r.id===e?{...r,tags:(r.tags||[]).filter(e=>e!==t)}:r))},handleManageTags:e=>{v(e),f(!0)},handleFileSourceChange:async e=>{X(e),Jf(e);const t=function(){let e=Yf(),t=Zf();return e.find(e=>e.id===t)||Kf}();try{"local"!==t.type?BD.info(`Source switching for ${t.type} not yet implemented in standalone mode`):BD.success("Switched to local storage")}catch(r){BD.error("Failed to load documents from source")}},handleUpdateTags:e=>{g&&(O(t=>t.map(t=>t.id===g?{...t,tags:e}:t)),BD.success("Tags updated"))},handleRestoreDocument:e=>{O(t=>t.map(t=>t.id===e?{...t,isDeleted:!1}:t)),BD.success("Note restored")},handlePermanentDelete:e=>{const t=e=>[e,...P.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],r=t(e),n=P.filter(e=>!r.includes(e.id));O(n);const a=B.filter(e=>!r.includes(e));V(a),L&&r.includes(L)&&F(a.length>0?a[0]:n.length>0?n[0].id:null),BD.success("Note permanently deleted")},handleTabChange:e=>{F(e)},handleTabClose:fe,handleTabsClose:me,handleTabAdd:()=>{de(null)},handleTabDelete:e=>{fe(e),he(e)},handleReopenLastClosed:be,handleSplitRight:e=>{q(e),BD.success("Split view enabled")},handleSelectDocument:e=>{P.find(t=>t.id===e)?.isFolder?pe(e):(B.includes(e)||V([...B,e]),F(e))},handleAIRewrite:async(e,t)=>{BD.info("AI rewrite is not yet available for this editor")},handleAIApprove:()=>{D(null),xe()},handleAIReject:()=>{D(null),xe()},handleAIRegenerate:async e=>{BD.info("AI rewrite is not yet available for this editor")}}}var IE=ae({});function RE(e){const t=ve(null);return null===t.current&&(t.current=e()),t.current}var zE="undefined"!=typeof window?fe:ue,_E=/* @__PURE__ */ae(null);function PE(e,t){-1===e.indexOf(t)&&e.push(t)}function OE(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}var LE=(e,t,r)=>r>t?t:r<e?e:r;var FE=()=>{},BE=()=>{};"undefined"!=typeof process&&"production"!==process.env.NODE_ENV&&(FE=(e,t,r)=>{},BE=(e,t,r)=>{if(!e)throw new Error(function(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}(t,r))});var VE={},$E=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),HE=e=>"object"==typeof e&&null!==e,jE=e=>/^0[^.\s]+$/u.test(e);function qE(e){let t;return()=>(void 0===t&&(t=e()),t)}var UE=e=>e,GE=(...e)=>e.reduce((e,t)=>r=>t(e(r))),WE=(e,t,r)=>{const n=t-e;return n?(r-e)/n:1},KE=class{constructor(){this.subscriptions=[]}add(e){return PE(this.subscriptions,e),()=>OE(this.subscriptions,e)}notify(e,t,r){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](e,t,r);else for(let a=0;a<n;a++){const n=this.subscriptions[a];n&&n(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},YE=e=>1e3*e,XE=e=>e/1e3,ZE=(e,t)=>t?e*(1e3/t):0,JE=/* @__PURE__ */new Set;function QE(e,t,r){e||JE.has(t)||JE.add(t)}var eI=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function tI(e,t,r,n){if(e===t&&r===n)return UE;const a=t=>function(e,t,r,n,a){let o,i,s=0;do{i=t+(r-t)/2,o=eI(i,n,a)-e,o>0?r=i:t=i}while(Math.abs(o)>1e-7&&++s<12);return i}(t,0,1,e,r);return e=>0===e||1===e?e:eI(a(e),t,n)}var rI=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,nI=e=>t=>1-e(1-t),aI=/*@__PURE__*/tI(.33,1.53,.69,.99),oI=/*@__PURE__*/nI(aI),iI=/*@__PURE__*/rI(oI),sI=e=>e>=1?1:(e*=2)<1?.5*oI(e):.5*(2-Math.pow(2,-10*(e-1))),lI=e=>1-Math.sin(Math.acos(e)),cI=nI(lI),dI=rI(lI),uI=/*@__PURE__*/tI(.42,0,1,1),hI=/*@__PURE__*/tI(0,0,.58,1),pI=/*@__PURE__*/tI(.42,0,.58,1),mI=e=>Array.isArray(e)&&"number"==typeof e[0],fI={linear:UE,easeIn:uI,easeInOut:pI,easeOut:hI,circIn:lI,circInOut:dI,circOut:cI,backIn:oI,backInOut:iI,backOut:aI,anticipate:sI},gI=e=>{if(mI(e)){BE(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,r,n,a]=e;return tI(t,r,n,a)}return"string"==typeof e?(BE(void 0!==fI[e],`Invalid easing type '${e}'`,"invalid-easing-type"),fI[e]):e},vI=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function yI(e,t){let r=!1,n=!0;const a={delta:0,timestamp:0,isProcessing:!1},o=()=>r=!0,i=vI.reduce((e,t)=>(e[t]=function(e){let t=/* @__PURE__ */new Set,r=/* @__PURE__ */new Set,n=!1,a=!1;const o=/* @__PURE__ */new WeakSet;let i={delta:0,timestamp:0,isProcessing:!1};function s(t){o.has(t)&&(l.schedule(t),e()),t(i)}const l={schedule:(e,a=!1,i=!1)=>{const s=i&&n?t:r;return a&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(i=e,n)return void(a=!0);n=!0;const o=t;t=r,r=o,t.forEach(s),t.clear(),n=!1,a&&(a=!1,l.process(e))}};return l}(o),e),{}),{setup:s,read:l,resolveKeyframes:c,preUpdate:d,update:u,preRender:h,render:p,postRender:m}=i,f=()=>{const o=VE.useManualTiming,i=o?a.timestamp:performance.now();r=!1,o||(a.delta=n?1e3/60:Math.max(Math.min(i-a.timestamp,40),1)),a.timestamp=i,a.isProcessing=!0,s.process(a),l.process(a),c.process(a),d.process(a),u.process(a),h.process(a),p.process(a),m.process(a),a.isProcessing=!1,r&&t&&(n=!1,e(f))};return{schedule:vI.reduce((t,o)=>{const s=i[o];return t[o]=(t,o=!1,i=!1)=>(r||(r=!0,n=!0,a.isProcessing||e(f)),s.schedule(t,o,i)),t},{}),cancel:e=>{for(let t=0;t<vI.length;t++)i[vI[t]].cancel(e)},state:a,steps:i}}var bI,{schedule:xI,cancel:wI,state:SI,steps:kI}=/* @__PURE__ */yI("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:UE,!0);function CI(){bI=void 0}var NI={now:()=>(void 0===bI&&NI.set(SI.isProcessing||VE.useManualTiming?SI.timestamp:performance.now()),bI),set:e=>{bI=e,queueMicrotask(CI)}},TI=e=>t=>"string"==typeof t&&t.startsWith(e),AI=/*@__PURE__*/TI("--"),MI=/*@__PURE__*/TI("var(--"),DI=e=>!!MI(e)&&EI.test(e.split("/*")[0].trim()),EI=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function II(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}var RI={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},zI={...RI,transform:e=>LE(0,1,e)},_I={...RI,default:1},PI=e=>Math.round(1e5*e)/1e5,OI=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;var LI=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,FI=(e,t)=>r=>Boolean("string"==typeof r&&LI.test(r)&&r.startsWith(e)||t&&!function(e){return null==e}(r)&&Object.prototype.hasOwnProperty.call(r,t)),BI=(e,t,r)=>n=>{if("string"!=typeof n)return n;const[a,o,i,s]=n.match(OI);return{[e]:parseFloat(a),[t]:parseFloat(o),[r]:parseFloat(i),alpha:void 0!==s?parseFloat(s):1}},VI={...RI,transform:e=>Math.round((e=>LE(0,255,e))(e))},$I={test:/*@__PURE__*/FI("rgb","red"),parse:/*@__PURE__*/BI("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+VI.transform(e)+", "+VI.transform(t)+", "+VI.transform(r)+", "+PI(zI.transform(n))+")"};var HI={test:/*@__PURE__*/FI("#"),parse:function(e){let t="",r="",n="",a="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),a=e.substring(4,5),t+=t,r+=r,n+=n,a+=a),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:a?parseInt(a,16)/255:1}},transform:$I.transform},jI=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),qI=/*@__PURE__*/jI("deg"),UI=/*@__PURE__*/jI("%"),GI=/*@__PURE__*/jI("px"),WI=/*@__PURE__*/jI("vh"),KI=/*@__PURE__*/jI("vw"),YI=/*@__PURE__*/(()=>({...UI,parse:e=>UI.parse(e)/100,transform:e=>UI.transform(100*e)}))(),XI={test:/*@__PURE__*/FI("hsl","hue"),parse:/*@__PURE__*/BI("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+UI.transform(PI(t))+", "+UI.transform(PI(r))+", "+PI(zI.transform(n))+")"},ZI={test:e=>$I.test(e)||HI.test(e)||XI.test(e),parse:e=>$I.test(e)?$I.parse(e):XI.test(e)?XI.parse(e):HI.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?$I.transform(e):XI.transform(e),getAnimatableNone:e=>{const t=ZI.parse(e);return t.alpha=0,ZI.transform(t)}},JI=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;var QI="number",eR="color",tR=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function rR(e){const t=e.toString(),r=[],n={color:[],number:[],var:[]},a=[];let o=0;return{values:r,split:t.replace(tR,e=>(ZI.test(e)?(n.color.push(o),a.push(eR),r.push(ZI.parse(e))):e.startsWith("var(")?(n.var.push(o),a.push("var"),r.push(e)):(n.number.push(o),a.push(QI),r.push(parseFloat(e))),++o,"${}")).split("${}"),indexes:n,types:a}}function nR({split:e,types:t}){const r=e.length;return n=>{let a="";for(let o=0;o<r;o++)if(a+=e[o],void 0!==n[o]){const e=t[o];a+=e===QI?PI(n[o]):e===eR?ZI.transform(n[o]):n[o]}return a}}var aR=(e,t)=>"number"==typeof e?t?.trim().endsWith("/")?e:0:(e=>"number"==typeof e?0:ZI.test(e)?ZI.getAnimatableNone(e):e)(e);var oR={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(OI)?.length||0)+(e.match(JI)?.length||0)>0},parse:function(e){return rR(e).values},createTransformer:function(e){return nR(rR(e))},getAnimatableNone:function(e){const t=rR(e);return nR(t)(t.values.map((e,r)=>aR(e,t.split[r])))}};function iR(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function sR(e,t){return r=>r>0?t:e}var lR=(e,t,r)=>e+(t-e)*r,cR=(e,t,r)=>{const n=e*e,a=r*(t*t-n)+n;return a<0?0:Math.sqrt(a)},dR=[HI,$I,XI];function uR(e){const t=(e=>dR.find(t=>t.test(e)))(e);if(FE(Boolean(t),`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(t))return!1;let r=t.parse(e);return t===XI&&(r=function({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,r/=100;let a=0,o=0,i=0;if(t/=100){const n=r<.5?r*(1+t):r+t-r*t,s=2*r-n;a=iR(s,n,e+1/3),o=iR(s,n,e),i=iR(s,n,e-1/3)}else a=o=i=r;return{red:Math.round(255*a),green:Math.round(255*o),blue:Math.round(255*i),alpha:n}}(r)),r}var hR=(e,t)=>{const r=uR(e),n=uR(t);if(!r||!n)return sR(e,t);const a={...r};return e=>(a.red=cR(r.red,n.red,e),a.green=cR(r.green,n.green,e),a.blue=cR(r.blue,n.blue,e),a.alpha=lR(r.alpha,n.alpha,e),$I.transform(a))},pR=/* @__PURE__ */new Set(["none","hidden"]);function mR(e,t){return r=>lR(e,t,r)}function fR(e){return"number"==typeof e?mR:"string"==typeof e?DI(e)?sR:ZI.test(e)?hR:yR:Array.isArray(e)?gR:"object"==typeof e?ZI.test(e)?hR:vR:sR}function gR(e,t){const r=[...e],n=r.length,a=e.map((e,r)=>fR(e)(e,t[r]));return e=>{for(let t=0;t<n;t++)r[t]=a[t](e);return r}}function vR(e,t){const r={...e,...t},n={};for(const a in r)void 0!==e[a]&&void 0!==t[a]&&(n[a]=fR(e[a])(e[a],t[a]));return e=>{for(const t in n)r[t]=n[t](e);return r}}var yR=(e,t)=>{const r=oR.createTransformer(t),n=rR(e),a=rR(t);return n.indexes.var.length===a.indexes.var.length&&n.indexes.color.length===a.indexes.color.length&&n.indexes.number.length>=a.indexes.number.length?pR.has(e)&&!a.values.length||pR.has(t)&&!n.values.length?function(e,t){return pR.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}(e,t):GE(gR(function(e,t){const r=[],n={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const o=t.types[a],i=e.indexes[o][n[o]],s=e.values[i]??0;r[a]=s,n[o]++}return r}(n,a),a.values),r):(FE(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),sR(e,t))};function bR(e,t,r){return"number"==typeof e&&"number"==typeof t&&"number"==typeof r?lR(e,t,r):fR(e)(e,t)}var xR=e=>{const t=({timestamp:t})=>e(t);return{start:(e=!0)=>xI.update(t,e),stop:()=>wI(t),now:()=>SI.isProcessing?SI.timestamp:NI.now()}},wR=(e,t,r=10)=>{let n="";const a=Math.max(Math.round(t/r),2);for(let o=0;o<a;o++)n+=Math.round(1e4*e(o/(a-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`};function SR(e){let t=0;let r=e.next(t);for(;!r.done&&t<2e4;)t+=50,r=e.next(t);return t>=2e4?1/0:t}var kR=100,CR=10,NR=1,TR=0,AR=800,MR=.3,DR=.3,ER={granular:.01,default:2},IR={granular:.005,default:.5},RR=.01,zR=10,_R=.05,PR=1;function OR(e,t){return e*Math.sqrt(1-t*t)}var LR=["duration","bounce"],FR=["stiffness","damping","mass"];function BR(e,t){return t.some(t=>void 0!==e[t])}function VR(e){let t={velocity:TR,stiffness:kR,damping:CR,mass:NR,isResolvedFromDuration:!1,...e};if(!BR(e,FR)&&BR(e,LR))if(t.velocity=0,e.visualDuration){const r=e.visualDuration,n=2*Math.PI/(1.2*r),a=n*n,o=2*LE(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:NR,stiffness:a,damping:o}}else{const r=function({duration:e=AR,bounce:t=MR,velocity:r=TR,mass:n=NR}){let a,o;FE(e<=YE(zR),"Spring duration must be 10 seconds or less","spring-duration-limit");let i=1-t;i=LE(_R,PR,i),e=LE(RR,zR,XE(e)),i<1?(a=t=>{const n=t*i,a=n*e;return.001-(n-r)/OR(t,i)*Math.exp(-a)},o=t=>{const n=t*i*e,o=n*r+r,s=Math.pow(i,2)*Math.pow(t,2)*e,l=Math.exp(-n),c=OR(Math.pow(t,2),i);return(.001-a(t)>0?-1:1)*((o-s)*l)/c}):(a=t=>Math.exp(-t*e)*((t-r)*e+1)-.001,o=t=>Math.exp(-t*e)*(e*e*(r-t)));const s=function(e,t,r){let n=r;for(let a=1;a<12;a++)n-=e(n)/t(n);return n}(a,o,5/e);if(e=YE(e),isNaN(s))return{stiffness:kR,damping:CR,duration:e};{const t=Math.pow(s,2)*n;return{stiffness:t,damping:2*i*Math.sqrt(n*t),duration:e}}}({...e,velocity:0});t={...t,...r,mass:NR},t.isResolvedFromDuration=!0}return t}function $R(e=DR,t=MR){const r="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:n,restDelta:a}=r;const o=r.keyframes[0],i=r.keyframes[r.keyframes.length-1],s={done:!1,value:o},{stiffness:l,damping:c,mass:d,duration:u,velocity:h,isResolvedFromDuration:p}=VR({...r,velocity:-XE(r.velocity||0)}),m=h||0,f=c/(2*Math.sqrt(l*d)),g=i-o,v=XE(Math.sqrt(l/d)),y=Math.abs(g)<5;let b,x,w,S,k,C;if(n||(n=y?ER.granular:ER.default),a||(a=y?IR.granular:IR.default),f<1)w=OR(v,f),S=(m+f*v*g)/w,b=e=>{const t=Math.exp(-f*v*e);return i-t*(S*Math.sin(w*e)+g*Math.cos(w*e))},k=f*v*S+g*w,C=f*v*g-S*w,x=e=>Math.exp(-f*v*e)*(k*Math.sin(w*e)+C*Math.cos(w*e));else if(1===f){b=e=>i-Math.exp(-v*e)*(g+(m+v*g)*e);const e=m+v*g;x=t=>Math.exp(-v*t)*(v*e*t-m)}else{const e=v*Math.sqrt(f*f-1);b=t=>{const r=Math.exp(-f*v*t),n=Math.min(e*t,300);return i-r*((m+f*v*g)*Math.sinh(n)+e*g*Math.cosh(n))/e};const t=(m+f*v*g)/e,r=f*v*t-g*e,n=f*v*g-t*e;x=t=>{const a=Math.exp(-f*v*t),o=Math.min(e*t,300);return a*(r*Math.sinh(o)+n*Math.cosh(o))}}const N={calculatedDuration:p&&u||null,velocity:e=>YE(x(e)),next:e=>{if(!p&&f<1){const t=Math.exp(-f*v*e),r=Math.sin(w*e),o=Math.cos(w*e),l=i-t*(S*r+g*o),c=YE(t*(k*r+C*o));return s.done=Math.abs(c)<=n&&Math.abs(i-l)<=a,s.value=s.done?i:l,s}const t=b(e);if(p)s.done=e>=u;else{const r=YE(x(e));s.done=Math.abs(r)<=n&&Math.abs(i-t)<=a}return s.value=s.done?i:t,s},toString:()=>{const e=Math.min(SR(N),2e4),t=wR(t=>N.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return N}$R.applyToOptions=e=>{const t=function(e,t=100,r){const n=r({...e,keyframes:[0,t]}),a=Math.min(SR(n),2e4);return{type:"keyframes",ease:e=>n.next(a*e).value/t,duration:XE(a)}}(e,100,$R);return e.ease=t.ease,e.duration=YE(t.duration),e.type="keyframes",e};function HR(e,t,r){const n=Math.max(t-5,0);return ZE(r-e(n),t-n)}function jR({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:a=10,bounceStiffness:o=500,modifyTarget:i,min:s,max:l,restDelta:c=.5,restSpeed:d}){const u=e[0],h={done:!1,value:u},p=e=>void 0===s?l:void 0===l||Math.abs(s-e)<Math.abs(l-e)?s:l;let m=r*t;const f=u+m,g=void 0===i?f:i(f);g!==f&&(m=g-u);const v=e=>-m*Math.exp(-e/n),y=e=>g+v(e),b=e=>{const t=v(e),r=y(e);h.done=Math.abs(t)<=c,h.value=h.done?g:r};let x,w;const S=e=>{(e=>void 0!==s&&e<s||void 0!==l&&e>l)(h.value)&&(x=e,w=$R({keyframes:[h.value,p(h.value)],velocity:HR(y,e,h.value),damping:a,stiffness:o,restDelta:c,restSpeed:d}))};return S(0),{calculatedDuration:null,next:e=>{let t=!1;return w||void 0!==x||(t=!0,b(e),S(e)),void 0!==x&&e>=x?w.next(e-x):(!t&&b(e),h)}}}function qR(e,t,{clamp:r=!0,ease:n,mixer:a}={}){const o=e.length;if(BE(o===t.length,"Both input and output ranges must be the same length","range-length"),1===o)return()=>t[0];if(2===o&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const s=function(e,t,r){const n=[],a=r||VE.mix||bR,o=e.length-1;for(let i=0;i<o;i++){let r=a(e[i],e[i+1]);if(t){const e=Array.isArray(t)?t[i]||UE:t;r=GE(e,r)}n.push(r)}return n}(t,n,a),l=s.length,c=r=>{if(i&&r<e[0])return t[0];let n=0;if(l>1)for(;n<e.length-2&&!(r<e[n+1]);n++);const a=WE(e[n],e[n+1],r);return s[n](a)};return r?t=>c(LE(e[0],e[o-1],t)):c}function UR(e){const t=[0];return function(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const a=WE(0,t,n);e.push(lR(r,1,a))}}(t,e.length-1),t}function GR({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const a=(e=>Array.isArray(e)&&"number"!=typeof e[0])(n)?n.map(gI):gI(n),o={done:!1,value:t[0]},i=function(e,t){return e.map(e=>e*t)}(r&&r.length===t.length?r:UR(t),e),s=qR(i,t,{ease:Array.isArray(a)?a:(l=t,c=a,l.map(()=>c||pI).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(o.value=s(t),o.done=t>=e,o)}}var WR=e=>null!==e;function KR(e,{repeat:t,repeatType:r="loop"},n,a=1){const o=e.filter(WR),i=a<0||t&&"loop"!==r&&t%2==1?0:o.length-1;return i&&void 0!==n?n:o[i]}var YR={decay:jR,inertia:jR,tween:GR,keyframes:GR,spring:$R};function XR(e){"string"==typeof e.type&&(e.type=YR[e.type])}var ZR=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},JR=e=>e/100,QR=class extends ZR{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:e}=this.options;e&&e.updatedAt!==NI.now()&&this.tick(NI.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){const{options:e}=this;XR(e);const{type:t=GR,repeat:r=0,repeatDelay:n=0,repeatType:a,velocity:o=0}=e;let{keyframes:i}=e;const s=t||GR;"production"!==process.env.NODE_ENV&&s!==GR&&BE(i.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${i}`,"spring-two-frames"),s!==GR&&"number"!=typeof i[0]&&(this.mixKeyframes=GE(JR,bR(i[0],i[1])),i=[0,100]);const l=s({...e,keyframes:i});"mirror"===a&&(this.mirroredGenerator=s({...e,keyframes:[...i].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=SR(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+n,this.totalDuration=this.resolvedDuration*(r+1)-n,this.generator=l}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:r,totalDuration:n,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:i,calculatedDuration:s}=this;if(null===this.startTime)return r.next(0);const{delay:l=0,keyframes:c,repeat:d,repeatType:u,repeatDelay:h,type:p,onUpdate:m,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-n/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>n;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let y,b=this.currentTime,x=r;if(d){const e=Math.min(this.currentTime,n)/i;let t=Math.floor(e),r=e%1;!r&&e>=1&&(r=1),1===r&&t--,t=Math.min(t,d+1),Boolean(t%2)&&("reverse"===u?(r=1-r,h&&(r-=h/i)):"mirror"===u&&(x=o)),b=LE(0,1,r)*i}v?(this.delayState.value=c[0],y=this.delayState):y=x.next(b),a&&!v&&(y.value=a(y.value));let{done:w}=y;v||null===s||(w=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return S&&p!==jR&&(y.value=KR(c,this.options,f,this.speed)),m&&m(y.value),S&&this.finish(),y}then(e,t){return this.finished.then(e,t)}get duration(){return XE(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+XE(e)}get time(){return XE(this.currentTime)}set time(e){e=YE(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);return HR(e=>this.generator.next(e).value,e,this.generator.next(e).value)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(NI.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=XE(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=xR,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();const r=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=r):null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime||(this.startTime=t??r),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(NI.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}};var ez=e=>180*e/Math.PI,tz=e=>{const t=ez(Math.atan2(e[1],e[0]));return nz(t)},rz={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:tz,rotateZ:tz,skewX:e=>ez(Math.atan(e[1])),skewY:e=>ez(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},nz=e=>((e%=360)<0&&(e+=360),e),az=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),oz=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),iz={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:az,scaleY:oz,scale:e=>(az(e)+oz(e))/2,rotateX:e=>nz(ez(Math.atan2(e[6],e[5]))),rotateY:e=>nz(ez(Math.atan2(-e[2],e[0]))),rotateZ:tz,rotate:tz,skewX:e=>ez(Math.atan(e[4])),skewY:e=>ez(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function sz(e){return e.includes("scale")?1:0}function lz(e,t){if(!e||"none"===e)return sz(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,a;if(r)n=iz,a=r;else{const t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=rz,a=t}if(!a)return sz(t);const o=n[t],i=a[1].split(",").map(cz);return"function"==typeof o?o(i):i[o]}function cz(e){return parseFloat(e.trim())}var dz=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],uz=/*@__PURE__*/(()=>/* @__PURE__ */new Set([...dz,"pathRotation"]))(),hz=e=>e===RI||e===GI,pz=/* @__PURE__ */new Set(["x","y","z"]),mz=dz.filter(e=>!pz.has(e));var fz={width:({x:e},{paddingLeft:t="0",paddingRight:r="0",boxSizing:n})=>{const a=e.max-e.min;return"border-box"===n?a:a-parseFloat(t)-parseFloat(r)},height:({y:e},{paddingTop:t="0",paddingBottom:r="0",boxSizing:n})=>{const a=e.max-e.min;return"border-box"===n?a:a-parseFloat(t)-parseFloat(r)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>lz(t,"x"),y:(e,{transform:t})=>lz(t,"y")};fz.translateX=fz.x,fz.translateY=fz.y;var gz=/* @__PURE__ */new Set,vz=!1,yz=!1,bz=!1;function xz(){if(yz){const e=Array.from(gz).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),r=/* @__PURE__ */new Map;t.forEach(e=>{const t=function(e){const t=[];return mz.forEach(r=>{const n=e.getValue(r);void 0!==n&&(t.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),t}(e);t.length&&(r.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();const t=r.get(e);t&&t.forEach(([t,r])=>{e.getValue(t)?.set(r)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}yz=!1,vz=!1,gz.forEach(e=>e.complete(bz)),gz.clear()}function wz(){gz.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(yz=!0)})}var Sz=class{constructor(e,t,r,n,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=n,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(gz.add(this),vz||(vz=!0,xI.read(wz),xI.resolveKeyframes(xz))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:r,motionValue:n}=this;if(null===e[0]){const a=n?.get(),o=e[e.length-1];if(void 0!==a)e[0]=a;else if(r&&t){const n=r.readValue(t,o);null!=n&&(e[0]=n)}void 0===e[0]&&(e[0]=o),n&&void 0===a&&n.set(e[0])}!function(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),gz.delete(this)}cancel(){"scheduled"===this.state&&(gz.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}};function kz(e,t,r){(e=>e.startsWith("--"))(t)?e.style.setProperty(t,r):e.style[t]=r}var Cz={};function Nz(e,t){const r=qE(e);return()=>Cz[t]??r()}var Tz=/* @__PURE__ */Nz(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),Az=/*@__PURE__*/Nz(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),Mz=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,Dz={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:/*@__PURE__*/Mz([0,.65,.55,1]),circOut:/*@__PURE__*/Mz([.55,0,1,.45]),backIn:/*@__PURE__*/Mz([.31,.01,.66,-.59]),backOut:/*@__PURE__*/Mz([.33,1.53,.69,.99])};function Ez(e,t){return e?"function"==typeof e?Az()?wR(e,t):"ease-out":mI(e)?Mz(e):Array.isArray(e)?e.map(e=>Ez(e,t)||Dz.easeOut):Dz[e]:void 0}function Iz(e,t,r,{delay:n=0,duration:a=300,repeat:o=0,repeatType:i="loop",ease:s="easeOut",times:l}={},c=void 0){const d={[t]:r};l&&(d.offset=l);const u=Ez(s,a);Array.isArray(u)&&(d.easing=u);const h={delay:n,duration:a,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===i?"alternate":"normal"};return c&&(h.pseudoElement=c),e.animate(d,h)}function Rz(e){return"function"==typeof e&&"applyToOptions"in e}var zz=class extends ZR{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:r,keyframes:n,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:i,onComplete:s}=e;this.isPseudoElement=Boolean(a),this.allowFlatten=o,this.options=e,BE("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return Rz(e)&&Az()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=Iz(t,r,n,l,a),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const e=KR(n,this.options,i,this.speed);this.updateMotionValue&&this.updateMotionValue(e),kz(t,r,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return XE(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+XE(e)}get time(){return XE(Number(this.animation.currentTime)||0)}set time(e){const t=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=YE(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:r,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Tz()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),r&&(this.animation.rangeEnd=r),UE):n(this)}},_z={anticipate:sI,backInOut:iI,circInOut:dI};function Pz(e){"string"==typeof e.ease&&e.ease in _z&&(e.ease=_z[e.ease])}var Oz=class extends zz{constructor(e){Pz(e),XR(e),super(e),void 0!==e.startTime&&!1!==e.autoplay&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:r,onComplete:n,element:a,...o}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);const i=new QR({...o,autoplay:!1}),s=Math.max(10,NI.now()-this.startTime),l=LE(0,10,s-10),c=i.sample(s).value,{name:d}=this.options;a&&d&&kz(a,d,c),t.setWithVelocity(i.sample(Math.max(0,s-l)).value,c,l),i.stop()}},Lz=(e,t)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!oR.test(e)&&"0"!==e||e.startsWith("url(")));function Fz(e){e.duration=0,e.type="keyframes"}var Bz=/* @__PURE__ */new Set(["opacity","clipPath","filter","transform","backgroundColor"]),Vz=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;var $z=/* @__PURE__ */new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Hz=/*@__PURE__*/qE(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function jz(e){const{motionValue:t,name:r,repeatDelay:n,repeatType:a,damping:o,type:i,keyframes:s}=e,l=t?.owner?.current;if(!(l instanceof HTMLElement||l instanceof SVGElement))return!1;const{onUpdate:c,transformTemplate:d}=t.owner.getProps();return Hz()&&r&&(Bz.has(r)||$z.has(r)&&function(e){for(let t=0;t<e.length;t++)if("string"==typeof e[t]&&Vz.test(e[t]))return!0;return!1}(s))&&("transform"!==r||!d)&&!c&&!n&&"mirror"!==a&&0!==o&&"inertia"!==i}var qz=class extends ZR{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:n=0,repeatDelay:a=0,repeatType:o="loop",keyframes:i,name:s,motionValue:l,element:c,...d}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=NI.now();const u={autoplay:e,delay:t,type:r,repeat:n,repeatDelay:a,repeatType:o,name:s,motionValue:l,element:c,...d},h=c?.KeyframeResolver||Sz;this.keyframeResolver=new h(i,(e,t,r)=>this.onKeyframesResolved(e,t,u,!r),s,l,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,r,n){this.keyframeResolver=void 0;const{name:a,type:o,velocity:i,delay:s,isHandoff:l,onUpdate:c}=r;this.resolvedAt=NI.now();let d=!0;(function(e,t,r,n){const a=e[0];if(null===a)return!1;if("display"===t||"visibility"===t)return!0;const o=e[e.length-1],i=Lz(a,t),s=Lz(o,t);return FE(i===s,`You are trying to animate ${t} from "${a}" to "${o}". "${i?o:a}" is not an animatable value.`,"value-not-animatable"),!(!i||!s)&&(function(e){const t=e[0];if(1===e.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}(e)||("spring"===r||Rz(r))&&n)})(e,a,o,i)||(d=!1,!VE.instantAnimations&&s||c?.(KR(e,r,t)),e[0]=e[e.length-1],Fz(r),r.repeat=0);const u={startTime:n?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},h=d&&!l&&jz(u),p=u.motionValue?.owner?.current;let m;if(h)try{m=new Oz({...u,element:p})}catch{m=new QR(u)}else m=new QR(u);m.finished.then(()=>{this.notifyFinished()}).catch(UE),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),bz=!0,wz(),xz(),bz=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function Uz(e,t,r,n=0,a=1){const o=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),i=e.size,s=(i-1)*n;return"function"==typeof r?r(o,i):1===a?o*n:s-o*n}var Gz={current:void 0},Wz=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{const t=NI.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const r of this.dependents)r.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=NI.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=(e=>!isNaN(parseFloat(e)))(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return"production"!==process.env.NODE_ENV&&QE(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new KE);const r=this.events[e].add(t);return"change"===e?()=>{r(),xI.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=/* @__PURE__ */new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Gz.current&&Gz.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=NI.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return ZE(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Kz(e,t){return new Wz(e,t)}function Yz(e,t){if(e?.inherit&&t){const{inherit:r,...n}=e;return{...t,...n}}return e}function Xz(e,t){const r=e?.[t]??e?.default??e;return r!==e?Yz(r,e):r}var Zz={type:"spring",stiffness:500,damping:25,restSpeed:10},Jz={type:"keyframes",duration:.8},Qz={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},e_=(e,{keyframes:t})=>t.length>2?Jz:uz.has(e)?e.startsWith("scale")?(e=>({type:"spring",stiffness:550,damping:0===e?2*Math.sqrt(550):30,restSpeed:10}))(t[1]):Zz:Qz,t_=/* @__PURE__ */new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);var r_=(e,t,r,n={},a,o)=>i=>{const s=Xz(n,e)||{},l=s.delay||n.delay||0;let{elapsed:c=0}=n;c-=YE(l);const d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...s,delay:-c,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{i(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:o?void 0:a};(function(e){for(const t in e)if(!t_.has(t))return!0;return!1})(s)||Object.assign(d,e_(e,d)),d.duration&&(d.duration=YE(d.duration)),d.repeatDelay&&(d.repeatDelay=YE(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let u=!1;if((!1===d.type||0===d.duration&&!d.repeatDelay)&&(Fz(d),0===d.delay&&(u=!0)),(VE.instantAnimations||VE.skipAnimations||a?.shouldSkipAnimations||s.skipAnimations)&&(u=!0,Fz(d),d.delay=0),d.allowFlatten=!s.type&&!s.ease,u&&!o&&void 0!==t.get()){const e=KR(d.keyframes,s);if(void 0!==e)return void xI.update(()=>{d.onUpdate(e),d.onComplete()})}return s.isSync?new QR(d):new qz(d)},n_=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function a_(e,t,r=1){BE(r<=4,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[n,a]=function(e){const t=n_.exec(e);if(!t)return[,];const[,r,n,a]=t;return[`--${r??n}`,a]}(e);if(!n)return;const o=window.getComputedStyle(t).getPropertyValue(n);if(o){const e=o.trim();return $E(e)?parseFloat(e):e}return DI(a)?a_(a,t,r+1):a}function o_(e){const t=[{},{}];return e?.values.forEach((e,r)=>{t[0][r]=e.get(),t[1][r]=e.getVelocity()}),t}function i_(e,t,r,n){if("function"==typeof t){const[a,o]=o_(n);t=t(void 0!==r?r:e.custom,a,o)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){const[a,o]=o_(n);t=t(void 0!==r?r:e.custom,a,o)}return t}function s_(e,t,r){const n=e.getProps();return i_(n,t,void 0!==r?r:n.custom,e)}var l_=/* @__PURE__ */new Set(["width","height","top","left","right","bottom",...dz]),c_=e=>Array.isArray(e);function d_(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,Kz(r))}function u_(e){return c_(e)?e[e.length-1]||0:e}var h_=e=>Boolean(e&&e.getVelocity);function p_(e,t){const r=e.getValue("willChange");if(function(e){return Boolean(h_(e)&&e.add)}(r))return r.add(t);if(!r&&VE.WillChange){const r=new VE.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function m_(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var f_="data-"+m_("framerAppearId");function g_(e){return e.props[f_]}function v_({protectedKeys:e,needsAnimating:t},r){const n=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,n}function y_(e,t,{delay:r=0,transitionOverride:n,type:a}={}){let{transition:o,transitionEnd:i,...s}=t;const l=e.getDefaultTransition();o=o?Yz(o,l):l;const c=o?.reduceMotion,d=o?.skipAnimations;n&&(o=n);const u=[],h=a&&e.animationState&&e.animationState.getState()[a],p=o?.path;p&&p.animateVisualElement(e,s,o,r,u);for(const m in s){const t=e.getValue(m,e.latestValues[m]??null),n=s[m];if(void 0===n||h&&v_(h,m))continue;const a={delay:r,...Xz(o||{},m)};d&&(a.skipAnimations=!0);const i=t.get();if(void 0!==i&&!t.isAnimating()&&!Array.isArray(n)&&n===i&&!a.velocity){xI.update(()=>t.set(n));continue}let l=!1;if(window.MotionHandoffAnimation){const t=g_(e);if(t){const e=window.MotionHandoffAnimation(t,m,xI);null!==e&&(a.startTime=e,l=!0)}}p_(e,m);const p=c??e.shouldReduceMotion;t.start(r_(m,t,n,p&&l_.has(m)?{type:!1}:a,e,l));const f=t.animation;f&&u.push(f)}if(i){const t=()=>xI.update(()=>{i&&function(e,t){let{transitionEnd:r={},transition:n={},...a}=s_(e,t)||{};a={...a,...r};for(const o in a)d_(e,o,u_(a[o]))}(e,i)});u.length?Promise.all(u).then(t):t()}return u}function b_(e,t,r={}){const n=s_(e,t,"exit"===r.type?e.presenceContext?.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(a=r.transitionOverride);const o=n?()=>Promise.all(y_(e,n,r)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(n=0)=>{const{delayChildren:o=0,staggerChildren:i,staggerDirection:s}=a;return function(e,t,r=0,n=0,a=0,o=1,i){const s=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),s.push(b_(l,t,{...i,delay:r+("function"==typeof n?0:n)+Uz(e.variantChildren,l,n,a,o)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(s)}(e,t,n,o,i,s,r)}:()=>Promise.resolve(),{when:s}=a;if(s){const[e,t]="beforeChildren"===s?[o,i]:[i,o];return e().then(()=>t())}return Promise.all([o(),i(r.delay)])}var x_=e=>t=>t.test(e),w_=[RI,GI,UI,qI,KI,WI,{test:e=>"auto"===e,parse:e=>e}],S_=e=>w_.find(x_(e));function k_(e){return"number"==typeof e?0===e:null===e||("none"===e||"0"===e||jE(e))}var C_=/* @__PURE__ */new Set(["brightness","contrast","saturate","opacity"]);function N_(e){const[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[n]=r.match(OI)||[];if(!n)return e;const a=r.replace(n,"");let o=C_.has(t)?1:0;return n!==r&&(o*=100),t+"("+o+a+")"}var T_=/\b([a-z-]*)\(.*?\)/gu,A_={...oR,getAnimatableNone:e=>{const t=e.match(T_);return t?t.map(N_).join(" "):e}},M_={...oR,getAnimatableNone:e=>{const t=oR.parse(e);return oR.createTransformer(e)(t.map(e=>"number"==typeof e?0:"object"==typeof e?{...e,alpha:1}:e))}},D_={...RI,transform:Math.round},E_={borderWidth:GI,borderTopWidth:GI,borderRightWidth:GI,borderBottomWidth:GI,borderLeftWidth:GI,borderRadius:GI,borderTopLeftRadius:GI,borderTopRightRadius:GI,borderBottomRightRadius:GI,borderBottomLeftRadius:GI,width:GI,maxWidth:GI,height:GI,maxHeight:GI,top:GI,right:GI,bottom:GI,left:GI,inset:GI,insetBlock:GI,insetBlockStart:GI,insetBlockEnd:GI,insetInline:GI,insetInlineStart:GI,insetInlineEnd:GI,padding:GI,paddingTop:GI,paddingRight:GI,paddingBottom:GI,paddingLeft:GI,paddingBlock:GI,paddingBlockStart:GI,paddingBlockEnd:GI,paddingInline:GI,paddingInlineStart:GI,paddingInlineEnd:GI,margin:GI,marginTop:GI,marginRight:GI,marginBottom:GI,marginLeft:GI,marginBlock:GI,marginBlockStart:GI,marginBlockEnd:GI,marginInline:GI,marginInlineStart:GI,marginInlineEnd:GI,fontSize:GI,backgroundPositionX:GI,backgroundPositionY:GI,...{rotate:qI,pathRotation:qI,rotateX:qI,rotateY:qI,rotateZ:qI,scale:_I,scaleX:_I,scaleY:_I,scaleZ:_I,skew:qI,skewX:qI,skewY:qI,distance:GI,translateX:GI,translateY:GI,translateZ:GI,x:GI,y:GI,z:GI,perspective:GI,transformPerspective:GI,opacity:zI,originX:YI,originY:YI,originZ:GI},zIndex:D_,fillOpacity:zI,strokeOpacity:zI,numOctaves:D_},I_={...E_,color:ZI,backgroundColor:ZI,outlineColor:ZI,fill:ZI,stroke:ZI,borderColor:ZI,borderTopColor:ZI,borderRightColor:ZI,borderBottomColor:ZI,borderLeftColor:ZI,filter:A_,WebkitFilter:A_,mask:M_,WebkitMask:M_},R_=e=>I_[e],z_=/*@__PURE__*/new Set([A_,M_]);function __(e,t){let r=R_(e);return z_.has(r)||(r=oR),r.getAnimatableNone?r.getAnimatableNone(t):void 0}var P_=/* @__PURE__ */new Set(["auto","none","0"]);var O_=class extends Sz{constructor(e,t,r,n,a){super(e,t,r,n,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:r}=this;if(!t||!t.current)return;super.readKeyframes();for(let s=0;s<e.length;s++){let r=e[s];if("string"==typeof r&&(r=r.trim(),DI(r))){const n=a_(r,t.current);void 0!==n&&(e[s]=n),s===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!l_.has(r)||2!==e.length)return;const[n,a]=e,o=S_(n),i=S_(a);if(II(n)!==II(a)&&fz[r])this.needsMeasurement=!0;else if(o!==i)if(hz(o)&&hz(i))for(let s=0;s<e.length;s++){const t=e[s];"string"==typeof t&&(e[s]=parseFloat(t))}else fz[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,r=[];for(let n=0;n<e.length;n++)(null===e[n]||k_(e[n]))&&r.push(n);r.length&&function(e,t,r){let n,a=0;for(;a<e.length&&!n;){const t=e[a];"string"==typeof t&&!P_.has(t)&&rR(t).values.length&&(n=e[a]),a++}if(n&&r)for(const o of t)e[o]=__(r,n)}(e,r,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:r}=this;if(!e||!e.current)return;"height"===r&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=fz[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const n=t[t.length-1];void 0!==n&&e.getValue(r,n).jump(n,!1)}measureEndState(){const{element:e,name:t,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const n=e.getValue(t);n&&n.jump(this.measuredOrigin,!1);const a=r.length-1,o=r[a];r[a]=fz[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,r])=>{e.getValue(t).set(r)}),this.resolveNoneKeyframes()}},L_=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function F_(e,t,r){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let n=document;t&&(n=t.current);const a=r?.[e]??n.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e).filter(e=>null!=e)}var B_=(e,t)=>t&&"number"==typeof e?t.transform(e):e;function V_(e){return HE(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}var{schedule:$_,cancel:H_}=/* @__PURE__ */yI(queueMicrotask,!1),j_={x:!1,y:!1};function q_(){return j_.x||j_.y}function U_(e,t){const r=F_(e),n=new AbortController;return[r,{passive:!0,...t,signal:n.signal},()=>n.abort()]}function G_(e,t,r={}){const[n,a,o]=U_(e,r);return n.forEach(e=>{let r,n=!1,o=!1;const i=t=>{r&&(r(t),r=void 0),e.removeEventListener("pointerleave",l)},s=e=>{n=!1,window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s),o&&(o=!1,i(e))},l=e=>{"touch"!==e.pointerType&&(n?o=!0:i(e))};e.addEventListener("pointerenter",n=>{if("touch"===n.pointerType||q_())return;o=!1;const i=t(e,n);"function"==typeof i&&(r=i,e.addEventListener("pointerleave",l,a))},a),e.addEventListener("pointerdown",()=>{n=!0,window.addEventListener("pointerup",s,a),window.addEventListener("pointercancel",s,a)},a)}),o}var W_=(e,t)=>!!t&&(e===t||W_(e,t.parentElement)),K_=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary,Y_=/* @__PURE__ */new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);var X_=/* @__PURE__ */new Set(["INPUT","SELECT","TEXTAREA"]);var Z_=/* @__PURE__ */new WeakSet;function J_(e){return t=>{"Enter"===t.key&&e(t)}}function Q_(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function eP(e){return K_(e)&&!q_()}var tP=/* @__PURE__ */new WeakSet;function rP(e,t,r={}){const[n,a,o]=U_(e,r),i=e=>{const n=e.currentTarget;if(!eP(e))return;if(tP.has(e))return;Z_.add(n),r.stopPropagation&&tP.add(e);const o=t(n,e),i={...a,capture:!0},s=(e,t)=>{window.removeEventListener("pointerup",l,i),window.removeEventListener("pointercancel",c,i),Z_.has(n)&&Z_.delete(n),eP(e)&&"function"==typeof o&&o(e,{success:t})},l=e=>{s(e,n===window||n===document||r.useGlobalTarget||W_(n,e.target))},c=e=>{s(e,!1)};window.addEventListener("pointerup",l,i),window.addEventListener("pointercancel",c,i)};return n.forEach(e=>{var t;(r.useGlobalTarget?window:e).addEventListener("pointerdown",i,a),V_(e)&&(e.addEventListener("focus",e=>((e,t)=>{const r=e.currentTarget;if(!r)return;const n=J_(()=>{if(Z_.has(r))return;Q_(r,"down");const e=J_(()=>{Q_(r,"up")});r.addEventListener("keyup",e,t),r.addEventListener("blur",()=>Q_(r,"cancel"),t)});r.addEventListener("keydown",n,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),t)})(e,a)),t=e,Y_.has(t.tagName)||!0===t.isContentEditable||e.hasAttribute("tabindex")||(e.tabIndex=0))}),o}function nP(e){return HE(e)&&"ownerSVGElement"in e}var aP,oP=/* @__PURE__ */new WeakMap,iP=(e,t,r)=>(n,a)=>a&&a[0]?a[0][e+"Size"]:nP(n)&&"getBBox"in n?n.getBBox()[t]:n[r],sP=/*@__PURE__*/iP("inline","width","offsetWidth"),lP=/*@__PURE__*/iP("block","height","offsetHeight");function cP({target:e,borderBoxSize:t}){oP.get(e)?.forEach(r=>{r(e,{get width(){return sP(e,t)},get height(){return lP(e,t)}})})}function dP(e){e.forEach(cP)}function uP(e,t){aP||"undefined"!=typeof ResizeObserver&&(aP=new ResizeObserver(dP));const r=F_(e);return r.forEach(e=>{let r=oP.get(e);r||(r=/* @__PURE__ */new Set,oP.set(e,r)),r.add(t),aP?.observe(e)}),()=>{r.forEach(e=>{const r=oP.get(e);r?.delete(t),r?.size||aP?.unobserve(e)})}}var hP,pP=/* @__PURE__ */new Set;function mP(e){return pP.add(e),hP||(hP=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};pP.forEach(t=>t(e))},window.addEventListener("resize",hP)),()=>{pP.delete(e),pP.size||"function"!=typeof hP||(window.removeEventListener("resize",hP),hP=void 0)}}function fP(e,t){return"function"==typeof e?mP(e):uP(e,t)}var gP={value:null,addProjectionMetrics:null};var vP=[...w_,ZI,oR],yP=()=>({x:{min:0,max:0},y:{min:0,max:0}}),bP=/* @__PURE__ */new WeakMap;function xP(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function wP(e){return"string"==typeof e||Array.isArray(e)}var SP=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],kP=["initial",...SP];function CP(e){return xP(e.animate)||kP.some(t=>wP(e[t]))}function NP(e){return Boolean(CP(e)||e.variants)}var TP={current:null},AP={current:!1},MP="undefined"!=typeof window;var DP=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],EP={};function IP(e){EP=e}var RP=class{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:n,skipAnimations:a,blockInitialAnimation:o,visualState:i},s={}){this.current=null,this.children=/* @__PURE__ */new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=/* @__PURE__ */new Map,this.KeyframeResolver=Sz,this.features={},this.valueSubscriptions=/* @__PURE__ */new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const e=NI.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,xI.render(this.render,!1,!0))};const{latestValues:l,renderState:c}=i;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=n,this.skipAnimationsConfig=a,this.options=s,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=CP(t),this.isVariantNode=NP(t),this.isVariantNode&&(this.variantChildren=/* @__PURE__ */new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:d,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(const h in u){const e=u[h];void 0!==l[h]&&h_(e)&&e.set(l[h])}}mount(e){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=e,bP.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(AP.current||function(){if(AP.current=!0,MP)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>TP.current=e.matches;e.addEventListener("change",t),t()}else TP.current=!1}(),this.shouldReduceMotion=TP.current),"production"!==process.env.NODE_ENV&&QE(!0!==this.shouldReduceMotion,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),wI(this.notifyUpdate),wI(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=/* @__PURE__ */new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&Bz.has(e)&&this.current instanceof HTMLElement){const{factory:r,keyframes:n,times:a,ease:o,duration:i}=t.accelerate,s=new zz({element:this.current,name:e,keyframes:n,times:a,ease:o,duration:YE(i)}),l=r(s);return void this.valueSubscriptions.set(e,()=>{l(),s.cancel()})}const r=uz.has(e);r&&this.onBindTransform&&this.onBindTransform();const n=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&xI.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{n(),a&&a()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in EP){const t=EP[e];if(!t)continue;const{isEnabled:r,Feature:n}=t;if(!this.features[e]&&n&&r(this.props)&&(this.features[e]=new n(this)),this.features[e]){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let r=0;r<DP.length;r++){const t=DP[r];this.propEventSubscriptions[t]&&(this.propEventSubscriptions[t](),delete this.propEventSubscriptions[t]);const n=e["on"+t];n&&(this.propEventSubscriptions[t]=this.on(t,n))}this.prevMotionValues=function(e,t,r){for(const n in t){const a=t[n],o=r[n];if(h_(a))e.addValue(n,a);else if(h_(o))e.addValue(n,Kz(a,{owner:e}));else if(o!==a)if(e.hasValue(n)){const t=e.getValue(n);!0===t.liveStyle?t.jump(a):t.hasAnimated||t.set(a)}else{const t=e.getStaticValue(n);e.addValue(n,Kz(void 0!==t?t:a,{owner:e}))}}for(const n in r)void 0===t[n]&&e.removeValue(n);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return void 0===r&&void 0!==t&&(r=Kz(null===t?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){let r=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];return null!=r&&("string"==typeof r&&($E(r)||jE(r))?r=parseFloat(r):!(e=>vP.find(x_(e)))(r)&&oR.test(t)&&(r=__(e,t)),this.setBaseTarget(e,h_(r)?r.get():r)),h_(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){const{initial:t}=this.props;let r;if("string"==typeof t||"object"==typeof t){const n=i_(this.props,t,this.presenceContext?.custom);n&&(r=n[e])}if(t&&void 0!==r)return r;const n=this.getBaseTargetFromProps(this.props,e);return void 0===n||h_(n)?void 0!==this.initialValues[e]&&void 0===r?void 0:this.baseTarget[e]:n}on(e,t){return this.events[e]||(this.events[e]=new KE),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){$_.render(this.render)}},zP=class extends RP{constructor(){super(...arguments),this.KeyframeResolver=O_}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){const r=e.style;return r?r[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;h_(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}},_P=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function PP({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function OP(e){return void 0===e||1===e}function LP({scale:e,scaleX:t,scaleY:r}){return!OP(e)||!OP(t)||!OP(r)}function FP(e){return LP(e)||BP(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function BP(e){return VP(e.x)||VP(e.y)}function VP(e){return e&&"0%"!==e}function $P(e,t,r){return r+t*(e-r)}function HP(e,t,r,n,a){return void 0!==a&&(e=$P(e,a,n)),$P(e,r,n)+t}function jP(e,t=0,r=1,n,a){e.min=HP(e.min,t,r,n,a),e.max=HP(e.max,t,r,n,a)}function qP(e,{x:t,y:r}){jP(e.x,t.translate,t.scale,t.originPoint),jP(e.y,r.translate,r.scale,r.originPoint)}var UP=.999999999999,GP=1.0000000000001;function WP(e,t){e.min+=t,e.max+=t}function KP(e,t,r,n,a=.5){jP(e,t,r,lR(e.min,e.max,a),n)}function YP(e,t){return"string"==typeof e?parseFloat(e)/100*(t.max-t.min):e}function XP(e,t,r){const n=r??e;KP(e.x,YP(t.x,n.x),t.scaleX,t.scale,t.originX),KP(e.y,YP(t.y,n.y),t.scaleY,t.scale,t.originY)}function ZP(e,t){return PP(function(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}(e.getBoundingClientRect(),t))}var JP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},QP=dz.length;function eO(e,t,r){const{style:n,vars:a,transformOrigin:o}=e;let i=!1,s=!1;for(const l in t){const e=t[l];if(uz.has(l))i=!0;else if(AI(l))a[l]=e;else{const t=B_(e,E_[l]);l.startsWith("origin")?(s=!0,o[l]=t):n[l]=t}}if(t.transform||(i||r?n.transform=function(e,t,r){let n="",a=!0;for(let i=0;i<QP;i++){const o=dz[i],s=e[o];if(void 0===s)continue;let l=!0;if("number"==typeof s)l=s===(o.startsWith("scale")?1:0);else{const e=parseFloat(s);l=o.startsWith("scale")?1===e:0===e}if(!l||r){const e=B_(s,E_[o]);l||(a=!1,n+=`${JP[o]||o}(${e}) `),r&&(t[o]=e)}}const o=e.pathRotation;return o&&(a=!1,n+=`rotate(${B_(o,E_.pathRotation)}) `),n=n.trim(),r?n=r(t,a?"":n):a&&(n="none"),n}(t,e.transform,r):n.transform&&(n.transform="none")),s){const{originX:e="50%",originY:t="50%",originZ:r=0}=o;n.transformOrigin=`${e} ${t} ${r}`}}function tO(e,{style:t,vars:r},n,a){const o=e.style;let i;for(i in t)o[i]=t[i];for(i in a?.applyProjectionStyles(o,n),r)o.setProperty(i,r[i])}function rO(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var nO={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e){if(!GI.test(e))return e;e=parseFloat(e)}return`${rO(e,t.target.x)}% ${rO(e,t.target.y)}%`}},aO={correct:(e,{treeScale:t,projectionDelta:r})=>{const n=e,a=oR.parse(e);if(a.length>5)return n;const o=oR.createTransformer(e),i="number"!=typeof a[0]?1:0,s=r.x.scale*t.x,l=r.y.scale*t.y;a[0+i]/=s,a[1+i]/=l;const c=lR(s,l,.5);return"number"==typeof a[2+i]&&(a[2+i]/=c),"number"==typeof a[3+i]&&(a[3+i]/=c),o(a)}},oO={borderRadius:{...nO,applyTo:[...L_]},borderTopLeftRadius:nO,borderTopRightRadius:nO,borderBottomLeftRadius:nO,borderBottomRightRadius:nO,boxShadow:aO};function iO(e,{layout:t,layoutId:r}){return uz.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!oO[e]||"opacity"===e)}function sO(e,t,r){const n=e.style,a=t?.style,o={};if(!n)return o;for(const i in n)(h_(n[i])||a&&h_(a[i])||iO(i,e)||void 0!==r?.getValue(i)?.liveStyle)&&(o[i]=n[i]);return o}var lO=class extends zP{constructor(){super(...arguments),this.type="html",this.renderInstance=tO}mount(e){BE(Boolean(e.style),"motion.create() components must forward their ref to a HTML or SVG element","custom-component-ref"),super.mount(e)}readValueFromInstance(e,t){if(uz.has(t))return this.projection?.isProjecting?sz(t):((e,t)=>{const{transform:r="none"}=getComputedStyle(e);return lz(r,t)})(e,t);{const n=(r=e,window.getComputedStyle(r)),a=(AI(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof a?a.trim():a}var r}measureInstanceViewportBox(e,{transformPagePoint:t}){return ZP(e,t)}build(e,t,r){eO(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return sO(e,t,r)}},cO={offset:"stroke-dashoffset",array:"stroke-dasharray"},dO={offset:"strokeDashoffset",array:"strokeDasharray"};var uO=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function hO(e,{attrX:t,attrY:r,attrScale:n,pathLength:a,pathSpacing:o=1,pathOffset:i=0,...s},l,c,d){if(eO(e,s,c),l)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:u,style:h}=e;u.transform&&(h.transform=u.transform,delete u.transform),(h.transform||u.transformOrigin)&&(h.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),h.transform&&(h.transformBox=d?.transformBox??"fill-box",delete u.transformBox);for(const p of uO)void 0!==u[p]&&(h[p]=u[p],delete u[p]);void 0!==t&&(u.x=t),void 0!==r&&(u.y=r),void 0!==n&&(u.scale=n),void 0!==a&&function(e,t,r=1,n=0,a=!0){e.pathLength=1;const o=a?cO:dO;e[o.offset]=""+-n,e[o.array]=`${t} ${r}`}(u,a,o,i,!1)}var pO=/* @__PURE__ */new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),mO=e=>"string"==typeof e&&"svg"===e.toLowerCase();function fO(e,t,r){const n=sO(e,t,r);for(const a in e)if(h_(e[a])||h_(t[a])){n[-1!==dz.indexOf(a)?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a]=e[a]}return n}var gO=class extends zP{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=yP}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(uz.has(t)){const e=R_(t);return e&&e.default||0}return t=pO.has(t)?t:m_(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return fO(e,t,r)}build(e,t,r){hO(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,n){!function(e,t,r,n){tO(e,t,void 0,n);for(const a in t.attrs)e.setAttribute(pO.has(a)?a:m_(a),t.attrs[a])}(e,t,0,n)}mount(e){this.isSVGTag=mO(e.tagName),super.mount(e)}},vO=kP.length;function yO(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&yO(e.parent)||{};return void 0!==e.props.initial&&(t.initial=e.props.initial),t}const t={};for(let r=0;r<vO;r++){const n=kP[r],a=e.props[n];(wP(a)||!1===a)&&(t[n]=a)}return t}function bO(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}var xO=[...SP].reverse(),wO=SP.length;function SO(e){return t=>Promise.all(t.map(({animation:t,options:r})=>function(e,t,r={}){let n;if(e.notify("AnimationStart",t),Array.isArray(t)){const a=t.map(t=>b_(e,t,r));n=Promise.all(a)}else if("string"==typeof t)n=b_(e,t,r);else{const a="function"==typeof t?s_(e,t,r.custom):t;n=Promise.all(y_(e,a,r))}return n.then(()=>{e.notify("AnimationComplete",t)})}(e,t,r)))}function kO(e){let t=SO(e),r=TO(),n=!0,a=!1;const o=t=>(r,n)=>{const a=s_(e,n,"exit"===t?e.presenceContext?.custom:void 0);if(a){const{transition:e,transitionEnd:t,...n}=a;r={...r,...n,...t}}return r};function i(i){const{props:s}=e,l=yO(e.parent)||{},c=[],d=/* @__PURE__ */new Set;let u={},h=1/0;for(let t=0;t<wO;t++){const p=xO[t],m=r[p],f=void 0!==s[p]?s[p]:l[p],g=wP(f),v=p===i?m.isActive:null;!1===v&&(h=t);let y=f===l[p]&&f!==s[p]&&g;if(y&&(n||a)&&e.manuallyAnimateOnMount&&(y=!1),m.protectedKeys={...u},!m.isActive&&null===v||!f&&!m.prevProp||xP(f)||"boolean"==typeof f)continue;if("exit"===p&&m.isActive&&!0!==v){m.prevResolvedValues&&(u={...u,...m.prevResolvedValues});continue}const b=CO(m.prevProp,f);let x=b||p===i&&m.isActive&&!y&&g||t>h&&g,w=!1;const S=Array.isArray(f)?f:[f];let k=S.reduce(o(p),{});!1===v&&(k={});const{prevResolvedValues:C={}}=m,N={...C,...k},T=t=>{x=!0,d.has(t)&&(w=!0,d.delete(t)),m.needsAnimating[t]=!0;const r=e.getValue(t);r&&(r.liveStyle=!1)};for(const e in N){const t=k[e],r=C[e];if(u.hasOwnProperty(e))continue;let n=!1;n=c_(t)&&c_(r)?!bO(t,r)||b:t!==r,n?null!=t?T(e):d.add(e):void 0!==t&&d.has(e)?T(e):m.protectedKeys[e]=!0}m.prevProp=f,m.prevResolvedValues=k,m.isActive&&(u={...u,...k}),(n||a)&&e.blockInitialAnimation&&(x=!1);const A=y&&b;!x||A&&!w||c.push(...S.map(t=>{const r={type:p};if("string"==typeof t&&(n||a)&&!A&&e.manuallyAnimateOnMount&&e.parent){const{parent:n}=e,a=s_(n,t);if(n.enteringChildren&&a){const{delayChildren:t}=a.transition||{};r.delay=Uz(n.enteringChildren,e,t)}}return{animation:t,options:r}}))}if(d.size){const t={};if("boolean"!=typeof s.initial){const r=s_(e,Array.isArray(s.initial)?s.initial[0]:s.initial);r&&r.transition&&(t.transition=r.transition)}d.forEach(r=>{const n=e.getBaseTarget(r),a=e.getValue(r);a&&(a.liveStyle=!0),t[r]=n??null}),c.push({animation:t})}let p=Boolean(c.length);return!n||!1!==s.initial&&s.initial!==s.animate||e.manuallyAnimateOnMount||(p=!1),n=!1,a=!1,p?t(c):Promise.resolve()}return{animateChanges:i,setActive:function(t,n){if(r[t].isActive===n)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,n)),r[t].isActive=n;const a=i(t);for(const e in r)r[e].protectedKeys={};return a},setAnimateFunction:function(r){t=r(e)},getState:()=>r,reset:()=>{r=TO(),a=!0}}}function CO(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!bO(t,e)}function NO(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function TO(){return{animate:NO(!0),whileInView:NO(),whileHover:NO(),whileTap:NO(),whileDrag:NO(),whileFocus:NO(),exit:NO()}}function AO(e,t){e.min=t.min,e.max=t.max}function MO(e,t){AO(e.x,t.x),AO(e.y,t.y)}function DO(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function EO(e){return e.max-e.min}function IO(e,t,r,n=.5){e.origin=n,e.originPoint=lR(t.min,t.max,e.origin),e.scale=EO(r)/EO(t),e.translate=lR(r.min,r.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function RO(e,t,r,n){IO(e.x,t.x,r.x,n?n.originX:void 0),IO(e.y,t.y,r.y,n?n.originY:void 0)}function zO(e,t,r,n=0){e.min=(n?lR(r.min,r.max,n):r.min)+t.min,e.max=e.min+EO(t)}function _O(e,t,r,n=0){const a=n?lR(r.min,r.max,n):r.min;e.min=t.min-a,e.max=e.min+EO(t)}function PO(e,t,r,n){_O(e.x,t.x,r.x,n?.x),_O(e.y,t.y,r.y,n?.y)}function OO(e,t,r,n,a){return e=$P(e-=t,1/r,n),void 0!==a&&(e=$P(e,1/a,n)),e}function LO(e,t,[r,n,a],o,i){!function(e,t=0,r=1,n=.5,a,o=e,i=e){if(UI.test(t)&&(t=parseFloat(t),t=lR(i.min,i.max,t/100)-i.min),"number"!=typeof t)return;let s=lR(o.min,o.max,n);e===o&&(s-=t),e.min=OO(e.min,t,r,s,a),e.max=OO(e.max,t,r,s,a)}(e,t[r],t[n],t[a],t.scale,o,i)}var FO=["x","scaleX","originX"],BO=["y","scaleY","originY"];function VO(e,t,r,n){LO(e.x,t,FO,r?r.x:void 0,n?n.x:void 0),LO(e.y,t,BO,r?r.y:void 0,n?n.y:void 0)}function $O(e){return 0===e.translate&&1===e.scale}function HO(e){return $O(e.x)&&$O(e.y)}function jO(e,t){return e.min===t.min&&e.max===t.max}function qO(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function UO(e,t){return qO(e.x,t.x)&&qO(e.y,t.y)}function GO(e){return EO(e.x)/EO(e.y)}function WO(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function KO(e){return[e("x"),e("y")]}var YO=L_.length,XO=e=>"string"==typeof e?parseFloat(e):e,ZO=e=>"number"==typeof e||GI.test(e);function JO(e,t){return void 0!==e[t]?e[t]:e.borderRadius}var QO=/*@__PURE__*/tL(0,.5,cI),eL=/*@__PURE__*/tL(.5,.95,UE);function tL(e,t,r){return n=>n<e?0:n>t?1:r(WE(e,t,n))}function rL(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r,n)}var nL=(e,t)=>e.depth-t.depth,aL=class{constructor(){this.children=[],this.isDirty=!1}add(e){PE(this.children,e),this.isDirty=!0}remove(e){OE(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(nL),this.isDirty=!1,this.children.forEach(e)}};function oL(e){return h_(e)?e.get():e}var iL=class{constructor(){this.members=[]}add(e){PE(this.members,e);for(let t=this.members.length-1;t>=0;t--){const r=this.members[t];if(r===e||r===this.lead||r===this.prevLead)continue;const n=r.instance;n&&!1!==n.isConnected||r.snapshot||(OE(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(OE(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent&&!1!==e.instance?.isConnected)return this.promote(e),!0}return!1}promote(e,t){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:n}=r.options,{layoutDependency:a}=e.options;void 0!==n&&n===a||(e.resumeFrom=r,t&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),!1===e.options.crossfade&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},sL={hasAnimatedSinceResize:!0,hasEverUpdated:!1},lL={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},cL=["","X","Y","Z"],dL=0;function uL(e,t,r,n){const{latestValues:a}=t;a[e]&&(r[e]=a[e],t.setStaticValue(e,0),n&&(n[e]=0))}function hL(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=g_(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:t,layoutId:n}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",xI,!(t||n))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&hL(n)}function pL({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:a}){return class{constructor(e={},r=t?.()){this.id=dL++,this.animationId=0,this.animationCommitId=0,this.children=/* @__PURE__ */new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=/* @__PURE__ */new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,gP.value&&(lL.nodes=lL.calculatedTargetDeltas=lL.calculatedProjections=0),this.nodes.forEach(gL),this.nodes.forEach(NL),this.nodes.forEach(TL),this.nodes.forEach(vL),gP.addProjectionMetrics&&gP.addProjectionMetrics(lL)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=/* @__PURE__ */new Map,this.latestValues=e,this.root=r?r.root||r:this,this.path=r?[...r.path,r]:[],this.parent=r,this.depth=r?r.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new aL)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new KE),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){const r=this.eventHandlers.get(e);r&&r.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;var r;this.isSVG=nP(t)&&!(nP(r=t)&&"svg"===r.tagName),this.instance=t;const{layoutId:n,layout:a,visualElement:o}=this.options;if(o&&!o.current&&o.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(a||n)&&(this.isLayoutDirty=!0),e){let r,n=0;const a=()=>this.root.updateBlockedByResize=!1;xI.read(()=>{n=window.innerWidth}),e(t,()=>{const e=window.innerWidth;e!==n&&(n=e,this.root.updateBlockedByResize=!0,r&&r(),r=function(e,t){const r=NI.now(),n=({timestamp:a})=>{const o=a-r;o>=t&&(wI(n),e(o-t))};return xI.setup(n,!0),()=>wI(n)}(a,250),sL.hasAnimatedSinceResize&&(sL.hasAnimatedSinceResize=!1,this.nodes.forEach(CL)))})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&o&&(n||a)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:n})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const a=this.options.transition||o.getDefaultTransition()||RL,{onLayoutAnimationStart:i,onLayoutAnimationComplete:s}=o.getProps(),l=!this.targetLayout||!UO(this.targetLayout,n),c=!t&&r;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...Xz(a,"layout"),onPlay:i,onComplete:s};(o.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c,t.path)}else t||CL(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=n})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),wI(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(AL),this.animationId++)}getTransformTemplate(){const{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&hL(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let a=0;a<this.path.length;a++){const e=this.path[a];e.shouldResetTransform=!0,"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:t,layout:r}=this.options;if(void 0===t&&!r)return;const n=this.getTransformTemplate();this.prevTransformTemplateValue=n?n(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const e=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(xL),void this.nodes.forEach(bL)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(wL);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(SL),this.nodes.forEach(kL),this.nodes.forEach(mL),this.nodes.forEach(fL)):this.nodes.forEach(wL),this.clearAllSnapshots();const e=NI.now();SI.delta=LE(0,1e3/60,e-SI.timestamp),SI.timestamp=e,SI.isProcessing=!0,kI.update.process(SI),kI.preRender.process(SI),kI.render.process(SI),SI.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,$_.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(yL),this.sharedNodes.forEach(ML)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,xI.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){xI.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||EO(this.snapshot.measuredBox.x)||EO(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let r=0;r<this.path.length;r++)this.path[r].updateScroll();const e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}}),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){const t=n(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!a)return;const e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!HO(this.projectionDelta),r=this.getTransformTemplate(),n=r?r(this.latestValues,""):void 0,o=n!==this.prevTransformTemplateValue;e&&this.instance&&(t||FP(this.latestValues)||o)&&(a(this.instance,n),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){const t=this.measurePageBox();let r=this.removeElementScroll(t);var n;return e&&(r=this.removeTransform(r)),PL((n=r).x),PL(n.y),{animationId:this.root.animationId,measuredBox:t,layoutBox:r,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:e}=this.options;if(!e)return{x:{min:0,max:0},y:{min:0,max:0}};const t=e.measureViewportBox();if(!this.scroll?.wasRoot&&!this.path.some(LL)){const{scroll:e}=this.root;e&&(WP(t.x,e.offset.x),WP(t.y,e.offset.y))}return t}removeElementScroll(e){const t={x:{min:0,max:0},y:{min:0,max:0}};if(MO(t,e),this.scroll?.wasRoot)return t;for(let r=0;r<this.path.length;r++){const n=this.path[r],{scroll:a,options:o}=n;n!==this.root&&a&&o.layoutScroll&&(a.wasRoot&&MO(t,e),WP(t.x,a.offset.x),WP(t.y,a.offset.y))}return t}applyTransform(e,t=!1,r){const n=r||{x:{min:0,max:0},y:{min:0,max:0}};MO(n,e);for(let a=0;a<this.path.length;a++){const e=this.path[a];!t&&e.options.layoutScroll&&e.scroll&&e!==e.root&&(WP(n.x,-e.scroll.offset.x),WP(n.y,-e.scroll.offset.y)),FP(e.latestValues)&&XP(n,e.latestValues,e.layout?.layoutBox)}return FP(this.latestValues)&&XP(n,this.latestValues,this.layout?.layoutBox),n}removeTransform(e){const t={x:{min:0,max:0},y:{min:0,max:0}};MO(t,e);for(let r=0;r<this.path.length;r++){const e=this.path[r];if(!FP(e.latestValues))continue;let n;e.instance&&(LP(e.latestValues)&&e.updateSnapshot(),n=yP(),MO(n,e.measurePageBox())),VO(t,e.latestValues,e.snapshot?.layoutBox,n)}return FP(this.latestValues)&&VO(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==SI.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){const t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);const r=Boolean(this.resumingFrom)||this!==t;if(!(e||r&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:n,layoutId:a}=this.options;if(!this.layout||!n&&!a)return;this.resolvedRelativeTargetAt=SI.timestamp;const o=this.getClosestProjectingParent();o&&this.linkedParentVersion!==o.layoutVersion&&!o.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&o&&o.layout?this.createRelativeTarget(o,this.layout.layoutBox,o.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),function(e,t,r,n){zO(e.x,t.x,r.x,n?.x),zO(e.y,t.y,r.y,n?.y)}(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target):MO(this.target,this.layout.layoutBox),qP(this.target,this.targetDelta)):MO(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&o&&Boolean(o.resumingFrom)===Boolean(this.resumingFrom)&&!o.options.layoutScroll&&o.target&&1!==this.animationProgress?this.createRelativeTarget(o,this.target,o.target):this.relativeParent=this.relativeTarget=void 0),gP.value&&lL.calculatedTargetDeltas++)}getClosestProjectingParent(){if(this.parent&&!LP(this.parent.latestValues)&&!BP(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,r){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},PO(this.relativeTargetOrigin,t,r,this.options.layoutAnchor||void 0),MO(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const e=this.getLead(),t=Boolean(this.resumingFrom)||this!==e;let r=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(r=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===SI.timestamp&&(r=!1),r)return;const{layout:n,layoutId:a}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!n&&!a)return;MO(this.layoutCorrected,this.layout.layoutBox);const o=this.treeScale.x,i=this.treeScale.y;!function(e,t,r,n=!1){const a=r.length;if(!a)return;let o,i;t.x=t.y=1;for(let s=0;s<a;s++){o=r[s],i=o.projectionDelta;const{visualElement:a}=o.options;a&&a.props.style&&"contents"===a.props.style.display||(n&&o.options.layoutScroll&&o.scroll&&o!==o.root&&(WP(e.x,-o.scroll.offset.x),WP(e.y,-o.scroll.offset.y)),i&&(t.x*=i.x.scale,t.y*=i.y.scale,qP(e,i)),n&&FP(o.latestValues)&&XP(e,o.latestValues,o.layout?.layoutBox))}t.x<GP&&t.x>UP&&(t.x=1),t.y<GP&&t.y>UP&&(t.y=1)}(this.layoutCorrected,this.treeScale,this.path,t),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:s}=e;s?(this.projectionDelta&&this.prevProjectionDelta?(DO(this.prevProjectionDelta.x,this.projectionDelta.x),DO(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),RO(this.projectionDelta,this.layoutCorrected,s,this.latestValues),this.treeScale.x===o&&this.treeScale.y===i&&WO(this.projectionDelta.x,this.prevProjectionDelta.x)&&WO(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",s)),gP.value&&lL.calculatedProjections++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(e,t=!1,r){const n=this.snapshot,a=n?n.latestValues:{},o={...this.latestValues},i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const s={x:{min:0,max:0},y:{min:0,max:0}},l=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),d=!c||c.members.length<=1,u=Boolean(l&&!d&&!0===this.options.crossfade&&!this.path.some(IL));let h;this.animationProgress=0;const p=r?.interpolateProjection(e);this.mixTargetDelta=t=>{const r=t/1e3,n=p?.(r);var c,m;n?(i.x.translate=n.x,i.x.scale=lR(e.x.scale,1,r),i.x.origin=e.x.origin,i.x.originPoint=e.x.originPoint,i.y.translate=n.y,i.y.scale=lR(e.y.scale,1,r),i.y.origin=e.y.origin,i.y.originPoint=e.y.originPoint):(DL(i.x,e.x,r),DL(i.y,e.y,r)),this.setTargetDelta(i),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(PO(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),function(e,t,r,n){EL(e.x,t.x,r.x,n),EL(e.y,t.y,r.y,n)}(this.relativeTarget,this.relativeTargetOrigin,s,r),h&&(c=this.relativeTarget,m=h,jO(c.x,m.x)&&jO(c.y,m.y))&&(this.isProjectionDirty=!1),h||(h={x:{min:0,max:0},y:{min:0,max:0}}),MO(h,this.relativeTarget)),l&&(this.animationValues=o,function(e,t,r,n,a,o){a?(e.opacity=lR(0,r.opacity??1,QO(n)),e.opacityExit=lR(t.opacity??1,0,eL(n))):o&&(e.opacity=lR(t.opacity??1,r.opacity??1,n));for(let i=0;i<YO;i++){const a=L_[i];let o=JO(t,a),s=JO(r,a);void 0===o&&void 0===s||(o||(o=0),s||(s=0),0===o||0===s||ZO(o)===ZO(s)?(e[a]=Math.max(lR(XO(o),XO(s),n),0),(UI.test(s)||UI.test(o))&&(e[a]+="%")):e[a]=s)}(t.rotate||r.rotate)&&(e.rotate=lR(t.rotate||0,r.rotate||0,n))}(o,a,this.latestValues,r,u,d)),n&&void 0!==n.rotate&&(this.animationValues||(this.animationValues=o),this.animationValues.pathRotation=n.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=r},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(wI(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=xI.update(()=>{sL.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Kz(0)),this.motionValue.jump(0,!1),this.currentAnimation=function(e,t,r){const n=h_(e)?e:Kz(e);return n.start(r_("",n,t,r)),n.animation}(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let{targetWithTransforms:t,target:r,layout:n,latestValues:a}=e;if(t&&r&&n){if(this!==e&&this.layout&&n&&OL(this.options.animationType,this.layout.layoutBox,n.layoutBox)){r=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const t=EO(this.layout.layoutBox.x);r.x.min=e.target.x.min,r.x.max=r.x.min+t;const n=EO(this.layout.layoutBox.y);r.y.min=e.target.y.min,r.y.max=r.y.min+n}MO(t,r),XP(t,a),RO(this.projectionDeltaWithTransform,this.layoutCorrected,t,a)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new iL),this.sharedNodes.get(e).add(t);const r=t.options.initialPromotionConfig;t.promote({transition:r?r.transition:void 0,preserveFollowOpacity:r&&r.shouldPreserveFollowOpacity?r.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){const{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:r}={}){const n=this.getStack();n&&n.promote(this,r),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){const{visualElement:e}=this.options;if(!e)return;let t=!1;const{latestValues:r}=e;if((r.z||r.rotate||r.rotateX||r.rotateY||r.rotateZ||r.skewX||r.skewY)&&(t=!0),!t)return;const n={};r.z&&uL("z",e,n,this.animationValues);for(let a=0;a<cL.length;a++)uL(`rotate${cL[a]}`,e,n,this.animationValues),uL(`skew${cL[a]}`,e,n,this.animationValues);e.render();for(const a in n)e.setStaticValue(a,n[a]),this.animationValues&&(this.animationValues[a]=n[a]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(e.visibility="hidden");const r=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=oL(t?.pointerEvents)||"",void(e.transform=r?r(this.latestValues,""):"none");const n=this.getLead();if(!this.projectionDelta||!this.layout||!n.target)return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=oL(t?.pointerEvents)||""),void(this.hasProjected&&!FP(this.latestValues)&&(e.transform=r?r({},""):"none",this.hasProjected=!1));e.visibility="";const a=n.animationValues||n.latestValues;this.applyTransformsToTarget();let o=function(e,t,r){let n="";const a=e.x.translate/t.x,o=e.y.translate/t.y,i=r?.z||0;if((a||o||i)&&(n=`translate3d(${a}px, ${o}px, ${i}px) `),1===t.x&&1===t.y||(n+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:e,rotate:t,pathRotation:a,rotateX:o,rotateY:i,skewX:s,skewY:l}=r;e&&(n=`perspective(${e}px) ${n}`),t&&(n+=`rotate(${t}deg) `),a&&(n+=`rotate(${a}deg) `),o&&(n+=`rotateX(${o}deg) `),i&&(n+=`rotateY(${i}deg) `),s&&(n+=`skewX(${s}deg) `),l&&(n+=`skewY(${l}deg) `)}const s=e.x.scale*t.x,l=e.y.scale*t.y;return 1===s&&1===l||(n+=`scale(${s}, ${l})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,a);r&&(o=r(a,o)),e.transform=o;const{x:i,y:s}=this.projectionDelta;e.transformOrigin=`${100*i.origin}% ${100*s.origin}% 0`,n.animationValues?e.opacity=n===this?a.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:a.opacityExit:e.opacity=n===this?void 0!==a.opacity?a.opacity:"":void 0!==a.opacityExit?a.opacityExit:0;for(const l in oO){if(void 0===a[l])continue;const{correct:t,applyTo:r,isCSSVariable:i}=oO[l],s="none"===o?a[l]:t(a[l],n);if(r){const t=r.length;for(let n=0;n<t;n++)e[r[n]]=s}else i?this.options.visualElement.renderState.vars[l]=s:e[l]=s}this.options.layoutId&&(e.pointerEvents=n===this?oL(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(bL),this.root.sharedNodes.clear()}}}function mL(e){e.updateLayout()}function fL(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:n}=e.layout,{animationType:a}=e.options,o=t.source!==e.layout.source;if("size"===a)KO(e=>{const n=o?t.measuredBox[e]:t.layoutBox[e],a=EO(n);n.min=r[e].min,n.max=n.min+a});else if("x"===a||"y"===a){const e="x"===a?"y":"x";AO(o?t.measuredBox[e]:t.layoutBox[e],r[e])}else OL(a,t.layoutBox,r)&&KO(n=>{const a=o?t.measuredBox[n]:t.layoutBox[n],i=EO(r[n]);a.max=a.min+i,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[n].max=e.relativeTarget[n].min+i)});const i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};RO(i,r,t.layoutBox);const s={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};o?RO(s,e.applyTransform(n,!0),t.measuredBox):RO(s,r,t.layoutBox);const l=!HO(i);let c=!1;if(!e.resumeFrom){const n=e.getClosestProjectingParent();if(n&&!n.resumeFrom){const{snapshot:a,layout:o}=n;if(a&&o){const i=e.options.layoutAnchor||void 0,s={x:{min:0,max:0},y:{min:0,max:0}};PO(s,t.layoutBox,a.layoutBox,i);const l={x:{min:0,max:0},y:{min:0,max:0}};PO(l,r,o.layoutBox,i),UO(s,l)||(c=!0),n.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=s,e.relativeParent=n)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:s,layoutDelta:i,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function gL(e){gP.value&&lL.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function vL(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function yL(e){e.clearSnapshot()}function bL(e){e.clearMeasurements()}function xL(e){e.isLayoutDirty=!0,e.updateLayout()}function wL(e){e.isLayoutDirty=!1}function SL(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function kL(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function CL(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function NL(e){e.resolveTargetDelta()}function TL(e){e.calcProjection()}function AL(e){e.resetSkewAndRotation()}function ML(e){e.removeLeadSnapshot()}function DL(e,t,r){e.translate=lR(t.translate,0,r),e.scale=lR(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function EL(e,t,r,n){e.min=lR(t.min,r.min,n),e.max=lR(t.max,r.max,n)}function IL(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}var RL={duration:.45,ease:[.4,0,.1,1]},zL=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),_L=zL("applewebkit/")&&!zL("chrome/")?Math.round:UE;function PL(e){e.min=_L(e.min),e.max=_L(e.max)}function OL(e,t,r){return"position"===e||"preserve-aspect"===e&&!function(e,t,r){return Math.abs(e-t)<=r}(GO(t),GO(r),.2)}function LL(e){return e!==e.root&&e.scroll?.wasRoot}var FL=pL({attachResizeListener:(e,t)=>rL(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),BL={current:void 0},VL=pL({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!BL.current){const e=new FL({});e.mount(window),e.setOptions({layoutScroll:!0}),BL.current=e}return BL.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),$L=ae({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function HL(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function jL(...e){return Q.useCallback(function(...e){return t=>{let r=!1;const n=e.map(e=>{const n=HL(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){const r=n[t];"function"==typeof r?r():HL(e[t],null)}}}}(...e),e)}var qL=class extends Q.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(V_(t)&&e.isPresent&&!this.props.isPresent&&!1!==this.props.pop){const e=t.offsetParent,r=V_(e)&&e.offsetWidth||0,n=V_(e)&&e.offsetHeight||0,a=getComputedStyle(t),o=this.props.sizeRef.current;o.height=parseFloat(a.height),o.width=parseFloat(a.width),o.top=t.offsetTop,o.left=t.offsetLeft,o.right=r-o.width-o.left,o.bottom=n-o.height-o.top,o.direction=a.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function UL({children:e,isPresent:t,anchorX:r,anchorY:n,root:a,pop:o}){const i=he(),s=ve(null),l=ve({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:c}=de($L),d=!1!==o?e.props?.ref??e?.ref:void 0,u=jL(s,d);return me(()=>{const{width:e,height:d,top:u,left:h,right:p,bottom:m,direction:f}=l.current;if(t||!1===o||!s.current||!e||!d)return;const g="rtl"===f,v="left"===r?g?`right: ${p}`:`left: ${h}`:g?`left: ${h}`:`right: ${p}`,y="bottom"===n?`bottom: ${m}`:`top: ${u}`;s.current.dataset.motionPopId=i;const b=document.createElement("style");c&&(b.nonce=c);const x=a??document.head;return x.appendChild(b),b.sheet&&b.sheet.insertRule(`\n [data-motion-pop-id="${i}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${d}px !important;\n ${v}px !important;\n ${y}px !important;\n }\n `),()=>{s.current?.removeAttribute("data-motion-pop-id"),x.contains(b)&&x.removeChild(b)}},[t]),Se(qL,{isPresent:t,childRef:s,sizeRef:l,pop:o,children:!1===o?e:Q.cloneElement(e,{ref:u})})}var GL=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:a,presenceAffectsLayout:o,mode:i,anchorX:s,anchorY:l,root:c})=>{const d=RE(WL),u=he(),h=ve(r),p=ve(n);zE(()=>{h.current=r,p.current=n});let m=!0,f=ge(()=>(m=!1,{id:u,initial:t,isPresent:r,custom:a,onExitComplete:e=>{d.set(e,!0);for(const t of d.values())if(!t)return;n&&n()},register:e=>(d.set(e,!1),()=>{d.delete(e),!h.current&&!d.size&&p.current?.()})}),[r,d,n]);return o&&m&&(f={...f}),ge(()=>{d.forEach((e,t)=>d.set(t,!1))},[r]),Q.useEffect(()=>{!r&&!d.size&&n&&n()},[r]),e=Se(UL,{pop:"popLayout"===i,isPresent:r,anchorX:s,anchorY:l,root:c,children:e}),Se(_E.Provider,{value:f,children:e})};function WL(){/* @__PURE__ */
451
- return new Map}function KL(e=!0){const t=de(_E);if(null===t)return[!0,null];const{isPresent:r,onExitComplete:n,register:a}=t,o=he();ue(()=>{if(e)return a(o)},[e]);const i=ce(()=>e&&n&&n(o),[o,n,e]);return!r&&n?[!1,i]:[!0]}var YL=e=>e.key||"";function XL(e){const t=[];return te.forEach(e,e=>{se(e)&&t.push(e)}),t}var ZL=({children:e,custom:t,initial:r=!0,onExitComplete:n,presenceAffectsLayout:a=!0,mode:o="sync",propagate:i=!1,anchorX:s="left",anchorY:l="top",root:c})=>{const[d,u]=KL(i),h=ge(()=>XL(e),[e]),p=i&&!d?[]:h.map(YL),m=ve(!0),f=ve(h),g=RE(()=>/* @__PURE__ */new Map),v=ve(/* @__PURE__ */new Set),[y,b]=ye(h),[x,w]=ye(h);zE(()=>{m.current=!1,f.current=h;for(let e=0;e<x.length;e++){const t=YL(x[e]);p.includes(t)?(g.delete(t),v.current.delete(t)):!0!==g.get(t)&&g.set(t,!1)}},[x,p.length,p.join("-")]);const S=[];if(h!==y){let e=[...h];for(let t=0;t<x.length;t++){const r=x[t],n=YL(r);p.includes(n)||(e.splice(t,0,r),S.push(r))}return"wait"===o&&S.length&&(e=S),w(XL(e)),b(h),null}"production"!==process.env.NODE_ENV&&"wait"===o&&x.length;const{forceRender:k}=de(IE);return Se(we,{children:x.map(e=>{const y=YL(e),b=!(i&&!d)&&(h===x||p.includes(y));return Se(GL,{isPresent:b,initial:!(m.current&&!r)&&void 0,custom:t,presenceAffectsLayout:a,mode:o,root:c,onExitComplete:b?void 0:()=>{if(v.current.has(y))return;if(!g.has(y))return;v.current.add(y),g.set(y,!0);let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(k?.(),w(f.current),i&&u?.(),n&&n())},anchorX:s,anchorY:l,children:e},y)})})},JL=ae({strict:!1}),QL={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},eF=!1;function tF(){return function(){if(eF)return;const e={};for(const t in QL)e[t]={isEnabled:e=>QL[t].some(t=>!!e[t])};IP(e),eF=!0}(),EP}var rF=/* @__PURE__ */new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function nF(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||rF.has(e)}var aF,oF,iF=/* @__PURE__ */r({default:()=>aF}),sF=t(()=>{throw aF={},new Error('Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?')}),lF=e=>!nF(e);try{"function"==typeof(oF=(sF(),e(iF)).default)&&(lF=e=>e.startsWith("on")?!nF(e):oF(e))}catch{}var cF=/* @__PURE__ */ae({});function dF(e){const{initial:t,animate:r}=function(e,t){if(CP(e)){const{initial:t,animate:r}=e;return{initial:!1===t||wP(t)?t:void 0,animate:wP(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,de(cF));return ge(()=>({initial:t,animate:r}),[uF(t),uF(r)])}function uF(e){return Array.isArray(e)?e.join(" "):e}var hF=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function pF(e,t,r){for(const n in t)h_(t[n])||iO(n,r)||(e[n]=t[n])}function mF(e,t){const r={};return pF(r,e.style||{},e),Object.assign(r,function({transformTemplate:e},t){return ge(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{}};return eO(r,t,e),Object.assign({},r.vars,r.style)},[t])}(e,t)),r}function fF(e,t){const r={},n=mF(e,t);return e.drag&&!1!==e.dragListener&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=n,r}var gF=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}});function vF(e,t,r,n){const a=ge(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return hO(r,t,mO(n),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const t={};pF(t,e.style,e),a.style={...t,...a.style}}return a}var yF=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function bF(e){return"string"==typeof e&&!e.includes("-")&&!!(yF.indexOf(e)>-1||/[A-Z]/u.test(e))}function xF(e,t,r,{latestValues:n},a,o=!1,i){const s=(i??bF(e)?vF:fF)(t,n,a,e),l=function(e,t,r){const n={};for(const a in e)"values"===a&&"object"==typeof e.values||h_(e[a])||(lF(a)||!0===r&&nF(a)||!t&&!nF(a)||e.draggable&&a.startsWith("onDrag"))&&(n[a]=e[a]);return n}(t,"string"==typeof e,o),c=e!==ne?{...l,...s,ref:r}:{},{children:d}=t,u=ge(()=>h_(d)?d.get():d,[d]);return oe(e,{...c,children:u})}function wF(e,t,r,n){const a={},o=n(e,{});for(const h in o)a[h]=oL(o[h]);let{initial:i,animate:s}=e;const l=CP(e),c=NP(e);t&&c&&!l&&!1!==e.inherit&&(void 0===i&&(i=t.initial),void 0===s&&(s=t.animate));let d=!!r&&!1===r.initial;d=d||!1===i;const u=d?s:i;if(u&&"boolean"!=typeof u&&!xP(u)){const t=Array.isArray(u)?u:[u];for(let r=0;r<t.length;r++){const n=i_(e,t[r]);if(n){const{transitionEnd:e,transition:t,...r}=n;for(const n in r){let e=r[n];if(Array.isArray(e)){e=e[d?e.length-1:0]}null!==e&&(a[n]=e)}for(const n in e)a[n]=e[n]}}}return a}var SF=e=>(t,r)=>{const n=de(cF),a=de(_E),o=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,a){return{latestValues:wF(r,n,a,e),renderState:t()}}(e,t,n,a);return r?o():RE(o)},kF=/*@__PURE__*/SF({scrapeMotionValuesFromProps:sO,createRenderState:hF}),CF=/*@__PURE__*/SF({scrapeMotionValuesFromProps:fO,createRenderState:gF}),NF=Symbol.for("motionComponentSymbol");function TF(e,t,r){const n=ve(r);me(()=>{n.current=r});const a=ve(null);return ce(r=>{r&&e.onMount?.(r),t&&(r?t.mount(r):t.unmount());const o=n.current;if("function"==typeof o)if(r){const e=o(r);"function"==typeof e&&(a.current=e)}else a.current?(a.current(),a.current=null):o(r);else o&&(o.current=r)},[t])}var AF=ae({});function MF(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function DF(e,t,r,n,a,o){const{visualElement:i}=de(cF),s=de(JL),l=de(_E),c=de($L),d=c.reducedMotion,u=c.skipAnimations,h=ve(null),p=ve(!1);n=n||s.renderer,!h.current&&n&&(h.current=n(e,{visualState:t,parent:i,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:d,skipAnimations:u,isSVG:o}),p.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));const m=h.current,f=de(AF);!m||m.projection||!a||"html"!==m.type&&"svg"!==m.type||function(e,t,r,n){const{layoutId:a,layout:o,drag:i,dragConstraints:s,layoutScroll:l,layoutRoot:c,layoutAnchor:d,layoutCrossfade:u}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:EF(e.parent)),e.projection.setOptions({layoutId:a,layout:o,alwaysMeasureLayout:Boolean(i)||s&&MF(s),visualElement:e,animationType:"string"==typeof o?o:"both",initialPromotionConfig:n,crossfade:u,layoutScroll:l,layoutRoot:c,layoutAnchor:d})}(h.current,r,a,f);const g=ve(!1);me(()=>{m&&g.current&&m.update(r,l)});const v=r[f_],y=ve(Boolean(v)&&"undefined"!=typeof window&&!window.MotionHandoffIsComplete?.(v)&&window.MotionHasOptimisedAnimation?.(v));return zE(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),y.current&&m.animationState&&m.animationState.animateChanges())}),ue(()=>{m&&(!y.current&&m.animationState&&m.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(v)}),y.current=!1),m.enteringChildren=void 0)}),m}function EF(e){if(e)return!1!==e.options.allowProjection?e.projection:EF(e.parent)}function IF(e,{forwardMotionProps:t=!1,type:r}={},n,a){n&&function(e){const t=tF();for(const r in e)t[r]={...t[r],...e[r]};IP(t)}(n);const o=r?"svg"===r:bF(e),i=o?CF:kF;function s(r,s){let l;const c={...de($L),...r,layoutId:RF(r)},{isStatic:d}=c,u=dF(r),h=i(r,d);if(!d&&"undefined"!=typeof window){!function(e,t){const r=de(JL).strict;if("production"!==process.env.NODE_ENV&&t&&r){const t="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?FE(!1,t,"lazy-strict-mode"):BE(!1,t,"lazy-strict-mode")}}(c,n);const t=function(e){const{drag:t,layout:r}=tF();if(!t&&!r)return{};const n={...t,...r};return{MeasureLayout:t?.isEnabled(e)||r?.isEnabled(e)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}(c);l=t.MeasureLayout,u.visualElement=DF(e,h,c,a,t.ProjectionNode,o)}return ke(cF.Provider,{value:u,children:[l&&u.visualElement?Se(l,{visualElement:u.visualElement,...c}):null,xF(e,r,TF(h,u.visualElement,s),h,d,t,o)]})}s.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;const l=ie(s);return l[NF]=e,l}function RF({layoutId:e}){const t=de(IE).id;return t&&void 0!==e?t+"-"+e:e}function zF(e,t){if("undefined"==typeof Proxy)return IF;const r=/* @__PURE__ */new Map,n=(r,n)=>IF(r,n,e,t);return new Proxy((e,t)=>("production"!==process.env.NODE_ENV&&QE(!1,"motion() is deprecated. Use motion.create() instead."),n(e,t)),{get:(a,o)=>"create"===o?n:(r.has(o)||r.set(o,IF(o,void 0,e,t)),r.get(o))})}var _F=(e,t)=>t.isSVG??bF(e)?new gO(t):new lO(t,{allowProjection:e!==ne}),PF=0,OF={animation:{Feature:class extends _P{constructor(e){super(e),e.animationState||(e.animationState=kO(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();xP(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends _P{constructor(){super(...arguments),this.id=PF++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;if(e&&!1===r){if(this.isExitComplete){const{initial:e,custom:t}=this.node.getProps();if("string"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)){const r=s_(this.node,e,t);if(r){const{transition:e,transitionEnd:t,...n}=r;for(const r in n)this.node.getValue(r)?.jump(n[r])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);return void(this.isExitComplete=!1)}const n=this.node.animationState.setActive("exit",!e);t&&!e&&n.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function LF(e){return{point:{x:e.pageX,y:e.pageY}}}function FF(e,t,r,n){return rL(e,t,(e=>t=>K_(t)&&e(t,LF(t)))(r),n)}var BF=({current:e})=>e?e.ownerDocument.defaultView:null,VF=(e,t)=>Math.abs(e-t);var $F=/*#__PURE__*/new Set(["auto","scroll"]),HF=class{constructor(e,t,{transformPagePoint:r,contextWindow:n=window,dragSnapToOrigin:a=!1,distanceThreshold:o=3,element:i}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=/* @__PURE__ */new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=jF(this.lastRawMoveEventInfo,this.transformPagePoint));const e=UF(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,r=function(e,t){const r=VF(e.x,t.x),n=VF(e.y,t.y);return Math.sqrt(r**2+n**2)}(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!r)return;const{point:n}=e,{timestamp:a}=SI;this.history.push({...n,timestamp:a});const{onStart:o,onMove:i}=this.handlers;t||(o&&o(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),i&&i(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=jF(t,this.transformPagePoint),xI.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();const{onEnd:r,onSessionEnd:n,resumeAnimation:a}=this.handlers;if(!this.dragSnapToOrigin&&this.startEvent||a&&a(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=UF("pointercancel"===e.type?this.lastMoveEventInfo:jF(t,this.transformPagePoint),this.history);this.startEvent&&r&&r(e,o),n&&n(e,o)},!K_(e))return;this.dragSnapToOrigin=a,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=n||window;const s=jF(LF(e),this.transformPagePoint),{point:l}=s,{timestamp:c}=SI;this.history=[{...l,timestamp:c}];const{onSessionStart:d}=t;d&&d(e,UF(s,this.history));const u={passive:!0,capture:!0};this.removeListeners=GE(FF(this.contextWindow,"pointermove",this.handlePointerMove,u),FF(this.contextWindow,"pointerup",this.handlePointerUp,u),FF(this.contextWindow,"pointercancel",this.handlePointerUp,u)),i&&this.startScrollTracking(i)}startScrollTracking(e){let t=e.parentElement;for(;t;){const e=getComputedStyle(t);($F.has(e.overflowX)||$F.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const r=e===window,n=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a=n.x-t.x,o=n.y-t.y;0===a&&0===o||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a,this.lastMoveEventInfo.point.y+=o):this.history.length>0&&(this.history[0].x-=a,this.history[0].y-=o),this.scrollPositions.set(e,n),xI.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),wI(this.updatePoint)}};function jF(e,t){return t?{point:t(e.point)}:e}function qF(e,t){return{x:e.x-t.x,y:e.y-t.y}}function UF({point:e},t){return{point:e,delta:qF(e,WF(t)),offset:qF(e,GF(t)),velocity:KF(t,.1)}}function GF(e){return e[0]}function WF(e){return e[e.length-1]}function KF(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null;const a=WF(e);for(;r>=0&&(n=e[r],!(a.timestamp-n.timestamp>YE(t)));)r--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&a.timestamp-n.timestamp>2*YE(t)&&(n=e[1]);const o=XE(a.timestamp-n.timestamp);if(0===o)return{x:0,y:0};const i={x:(a.x-n.x)/o,y:(a.y-n.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function YF(e,t,r){return{min:void 0!==t?e.min+t:void 0,max:void 0!==r?e.max+r-(e.max-e.min):void 0}}function XF(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,n]=[n,r]),{min:r,max:n}}var ZF=.35;function JF(e,t,r){return{min:QF(e,t),max:QF(e,r)}}function QF(e,t){return"number"==typeof e?e:e[t]||0}var eB=/* @__PURE__ */new WeakMap,tB=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:r}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:a}=this.getProps();this.panSession=new HF(e,{onSessionStart:e=>{t&&this.snapToCursor(LF(e).point),this.stopAnimation()},onStart:(e,t)=>{const{drag:r,dragPropagation:n,onDragStart:a}=this.getProps();if(r&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(o=r)||"y"===o?j_[o]?null:(j_[o]=!0,()=>{j_[o]=!1}):j_.x||j_.y?null:(j_.x=j_.y=!0,()=>{j_.x=j_.y=!1}),!this.openDragLock))return;var o;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),KO(e=>{let t=this.getAxisMotionValue(e).get()||0;if(UI.test(t)){const{projection:r}=this.visualElement;if(r&&r.layout){const n=r.layout.layoutBox[e];n&&(t=EO(n)*(parseFloat(t)/100))}}this.originPoint[e]=t}),a&&xI.update(()=>a(e,t),!1,!0),p_(this.visualElement,"transform");const{animationState:i}=this.visualElement;i&&i.setActive("whileDrag",!0)},onMove:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;const{dragPropagation:r,dragDirectionLock:n,onDirectionLock:a,onDrag:o}=this.getProps();if(!r&&!this.openDragLock)return;const{offset:i}=t;if(n&&null===this.currentDirection)return this.currentDirection=function(e,t=10){let r=null;Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x");return r}(i),void(null!==this.currentDirection&&a&&a(this.currentDirection));this.updateAxis("x",t.point,i),this.updateAxis("y",t.point,i),this.visualElement.render(),o&&xI.update(()=>o(e,t),!1,!0)},onSessionEnd:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>{const{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})}},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:a,distanceThreshold:r,contextWindow:BF(this.visualElement),element:this.visualElement.current})}stop(e,t){const r=e||this.latestPointerEvent,n=t||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!n||!r)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:i}=this.getProps();i&&xI.postRender(()=>i(r,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,r){const{drag:n}=this.getProps();if(!r||!nB(e,n,this.currentDirection))return;const a=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=function(e,{min:t,max:r},n){return void 0!==t&&e<t?e=n?lR(t,e,n.min):Math.max(e,t):void 0!==r&&e>r&&(e=n?lR(r,e,n.max):Math.min(e,r)),e}(o,this.constraints[e],this.elastic[e])),a.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:t}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,n=this.constraints;e&&MF(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!r)&&function(e,{top:t,left:r,bottom:n,right:a}){return{x:YF(e.x,r,a),y:YF(e.y,t,n)}}(r.layoutBox,e),this.elastic=function(e=ZF){return!1===e?e=0:!0===e&&(e=ZF),{x:JF(e,"left","right"),y:JF(e,"top","bottom")}}(t),n!==this.constraints&&!MF(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&KO(e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const r={};return void 0!==t.min&&(r.min=t.min-e.min),void 0!==t.max&&(r.max=t.max-e.min),r}(r.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!MF(e))return!1;const r=e.current;BE(null!==r,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:n}=this.visualElement;if(!n||!n.layout)return!1;n.root&&(n.root.scroll=void 0,n.root.updateScroll());const a=function(e,t,r){const n=ZP(e,r),{scroll:a}=t;return a&&(WP(n.x,a.offset.x),WP(n.y,a.offset.y)),n}(r,n.root,this.visualElement.getTransformPagePoint());let o=function(e,t){return{x:XF(e.x,t.x),y:XF(e.y,t.y)}}(n.layout.layoutBox,a);if(t){const e=t(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(o));this.hasMutatedConstraints=!!e,e&&(o=PP(e))}return o}startAnimation(e){const{drag:t,dragMomentum:r,dragElastic:n,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:i}=this.getProps(),s=this.constraints||{},l=KO(i=>{if(!nB(i,t,this.currentDirection))return;let l=s&&s[i]||{};!0!==o&&o!==i||(l={min:0,max:0});const c=n?200:1e6,d=n?40:1e7,u={type:"inertia",velocity:r?e[i]:0,bounceStiffness:c,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...a,...l};return this.startAxisValueAnimation(i,u)});return Promise.all(l).then(i)}startAxisValueAnimation(e,t){const r=this.getAxisMotionValue(e);return p_(this.visualElement,e),r.start(r_(e,r,0,t,this.visualElement,!1))}stopAnimation(){KO(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps()[t];return r||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){KO(t=>{const{drag:r}=this.getProps();if(!nB(t,r,this.currentDirection))return;const{projection:n}=this.visualElement,a=this.getAxisMotionValue(t);if(n&&n.layout){const{min:r,max:o}=n.layout.layoutBox[t],i=a.get()||0;a.set(e[t]-lR(r,o,.5)+i)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!MF(t)||!r||!this.constraints)return;this.stopAnimation();const n={x:0,y:0};KO(e=>{const t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){const r=t.get();n[e]=function(e,t){let r=.5;const n=EO(e),a=EO(t);return a>n?r=WE(t.min,t.max-n,e.min):n>a&&(r=WE(e.min,e.max-a,t.min)),LE(0,1,r)}({min:r,max:r},this.constraints[e])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),KO(t=>{if(!nB(t,e,null))return;const r=this.getAxisMotionValue(t),{min:a,max:o}=this.constraints[t];r.set(lR(a,o,n[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;eB.set(this.visualElement,this);const e=this.visualElement.current,t=FF(e,"pointerdown",t=>{const{drag:r,dragListener:n=!0}=this.getProps(),a=t.target,o=a!==e&&function(e){return X_.has(e.tagName)||!0===e.isContentEditable}(a);r&&n&&!o&&this.start(t)});let r;const n=()=>{const{dragConstraints:t}=this.getProps();MF(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),r||(r=function(e,t,r){const n=fP(e,rB(r)),a=fP(t,rB(r));return()=>{n(),a()}}(e,t.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,o=a.addEventListener("measure",n);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),xI.read(n);const i=rL(window,"resize",()=>this.scalePositionWithinConstraints()),s=a.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(KO(t=>{const r=this.getAxisMotionValue(t);r&&(this.originPoint[t]+=e[t].translate,r.set(r.get()+e[t].translate))}),this.visualElement.render())});return()=>{i(),t(),o(),s&&s(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:n=!1,dragConstraints:a=!1,dragElastic:o=ZF,dragMomentum:i=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:n,dragConstraints:a,dragElastic:o,dragMomentum:i}}};function rB(e){let t=!0;return()=>{t?t=!1:e()}}function nB(e,t,r){return!(!0!==t&&t!==e||null!==r&&r!==e)}var aB=e=>(t,r)=>{e&&xI.update(()=>e(t,r),!1,!0)},oB=!1,iB=class extends re{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:n}=this.props,{projection:a}=e;a&&(t.group&&t.group.add(a),r&&r.register&&n&&r.register(a),oB&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),sL.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:r,drag:n,isPresent:a}=this.props,{projection:o}=r;return o?(o.isPresent=a,e.layoutDependency!==t&&o.setOptions({...o.options,layoutDependency:t}),oB=!0,n||e.layoutDependency!==t||void 0===t||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||xI.postRender(()=>{const e=o.getStack();e&&e.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:r}=e;r&&(r.options.layoutAnchor=t,r.root.didUpdate(),$_.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:n}=e;oB=!0,n&&(n.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(n),r&&r.deregister&&r.deregister(n))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}};function sB(e){const[t,r]=KL(),n=de(IE);return Se(iB,{...e,layoutGroup:n,switchLayoutGroup:de(AF),isPresent:t,safeToRemove:r})}var lB={pan:{Feature:class extends _P{constructor(){super(...arguments),this.removePointerDownListener=UE}onPointerDown(e){this.session=new HF(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:BF(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:n}=this.node.getProps();return{onSessionStart:aB(e),onStart:aB(t),onMove:aB(r),onEnd:(e,t)=>{delete this.session,n&&xI.postRender(()=>n(e,t))}}}mount(){this.removePointerDownListener=FF(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends _P{constructor(e){super(e),this.removeGroupControls=UE,this.removeListeners=UE,this.controls=new tB(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||UE}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:VL,MeasureLayout:sB}};function cB(e,t,r){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover","Start"===r);const a=n["onHover"+r];a&&xI.postRender(()=>a(t,LF(t)))}function dB(e,t,r){const{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap","Start"===r);const a=n["onTap"+("End"===r?"":r)];a&&xI.postRender(()=>a(t,LF(t)))}var uB=/* @__PURE__ */new WeakMap,hB=/* @__PURE__ */new WeakMap,pB=e=>{const t=uB.get(e.target);t&&t(e)},mB=e=>{e.forEach(pB)};function fB(e,t,r){const n=function({root:e,...t}){const r=e||document;hB.has(r)||hB.set(r,{});const n=hB.get(r),a=JSON.stringify(t);return n[a]||(n[a]=new IntersectionObserver(mB,{root:e,...t})),n[a]}(t);return uB.set(e,r),n.observe(e),()=>{uB.delete(e),n.unobserve(e)}}var gB={some:0,all:1};var vB=/*@__PURE__*/zF({...OF,...{inView:{Feature:class extends _P{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:n="some",once:a}=e,o={root:t?t.current:void 0,rootMargin:r,threshold:"number"==typeof n?n:gB[n]};this.stopObserver=fB(this.node.current,o,e=>{const{isIntersecting:t}=e;if(this.isInView===t)return;if(this.isInView=t,a&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:r,onViewportLeave:n}=this.node.getProps(),o=t?r:n;o&&o(e)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}},tap:{Feature:class extends _P{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:r}=this.node.props;this.unmount=rP(e,(e,t)=>(dB(this.node,t,"Start"),(e,{success:t})=>dB(this.node,e,t?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:!1===r?.tap})}unmount(){}}},focus:{Feature:class extends _P{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=GE(rL(this.node.current,"focus",()=>this.onFocus()),rL(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends _P{mount(){const{current:e}=this.node;e&&(this.unmount=G_(e,(e,t)=>(cB(this.node,t,"Start"),e=>cB(this.node,e,"End"))))}unmount(){}}}},...lB,...{layout:{ProjectionNode:VL,MeasureLayout:sB}}},_F),yB={type:"tween",ease:[.22,1,.36,1],duration:.5};function bB({percentage:e}){const t=24,r=10.75,n=2*Math.PI*r,a=n-e/100*n;/* @__PURE__ */
452
- return ke("svg",{width:t,height:t,className:"-rotate-90 shrink-0",children:[/* @__PURE__ */Se("circle",{cx:12,cy:12,r:r,fill:"none",stroke:"var(--muted)",strokeWidth:2.5}),/* @__PURE__ */Se(vB.circle,{cx:12,cy:12,r:r,fill:"none",stroke:"var(--foreground)",strokeWidth:2.5,strokeDasharray:n,initial:{strokeDashoffset:n},animate:{strokeDashoffset:a},transition:{duration:.15,ease:"easeOut"},strokeLinecap:"round"})]})}function xB({headings:e,onNavigate:t,editorRef:r}){const[n,a]=ye(null),[o,i]=ye(null),[s,l]=ye(!1),[c,d]=ye(0),[u,h]=ye(44),p=ve(null);ue(()=>{const e=()=>{const e=document.querySelector(".toolbar");e&&h(e.getBoundingClientRect().bottom+6)};e();const t=document.querySelector(".toolbar");if(!t)return;const r=new ResizeObserver(e);return r.observe(t),()=>r.disconnect()},[]);const m=ge(()=>0===e.length?1:Math.min(...e.map(([,,e])=>parseInt(e[1],10))),[e]);if(ue(()=>{(()=>{if(!r?.current)return;const t=e[0]?.[0];if(!t)return;const n=r.current.getElementByKey(t);if(!n)return;let a=n.parentElement;for(;a;){const e=window.getComputedStyle(a);if("auto"===e.overflowY||"scroll"===e.overflowY)return void(p.current=a);a=a.parentElement}p.current=null})()},[e,r]),ue(()=>{if(0===e.length)return;const t=e=>r?.current?.getElementByKey(e)??null,n=()=>{const r=p.current,n=r?r.scrollTop:window.scrollY,o=r?r.clientHeight:window.innerHeight,i=(r?r.scrollHeight:document.documentElement.scrollHeight)-o;d(i>0?Math.min(100,Math.max(0,n/i*100)):0);const s=.3*o;let l=null;for(const[a]of e){const e=t(a);if(!e)continue;const n=e.getBoundingClientRect(),o=r?r.getBoundingClientRect().top:0;if(!(n.top-o<=s))break;l=a}!l&&e.length>0&&(l=e[0][0]),a(l)},o=p.current??window;return o.addEventListener("scroll",n,{passive:!0}),n(),()=>o.removeEventListener("scroll",n)},[e,r]),0===e.length)return null;const f=e.find(([e])=>e===n)?.[1]??"Contents";/* @__PURE__ */
453
- return ke(we,{children:[/* @__PURE__ */Se(ZL,{children:s&&/* @__PURE__ */Se(vB.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:yB,className:"fixed inset-0 z-[9998] bg-black/20 backdrop-blur-[4px]",onClick:()=>l(!1)})}),/* @__PURE__ */Se(vB.div,{initial:{y:-50,opacity:0},animate:{y:0,opacity:1},transition:{type:"spring",stiffness:300,damping:25},style:{top:u},className:"fixed left-1/2 z-[9999] flex -translate-x-1/2 flex-col items-center",children:/* @__PURE__ */ke(vB.div,{onClick:()=>{s||l(!0)},initial:!1,animate:{width:s?340:280,height:s?400:52,borderRadius:s?24:26},transition:yB,style:{cursor:s?"default":"pointer"},className:"relative overflow-hidden border border-foreground/10 bg-background text-foreground shadow-2xl",children:[/* @__PURE__ */ke(vB.div,{initial:!1,animate:{opacity:s?0:1,scale:s?.95:1,filter:s?"blur(4px)":"blur(0px)"},transition:{...yB,delay:s?0:.1},className:tc("absolute inset-0 flex items-center gap-4 px-4 sm:px-5",s&&"pointer-events-none"),children:[
446
+ /* @__PURE__ */Se(QD,{open:r,onOpenChange:n,initialSection:a,defaultSidebarView:m,onDefaultSidebarViewChange:f,enableDatabaseSync:g,onEnableDatabaseSyncChange:v}),
447
+ /* @__PURE__ */Se(CE,{open:o,onOpenChange:i}),
448
+ /* @__PURE__ */Se(TE,{open:s,onOpenChange:l,documentTitle:h?.title||"Untitled",documentId:h?.id||"",sharingInfo:h?.sharing,onUpdateSharing:e=>{h&&y(t=>t.map(t=>t.id===h.id?{...t,sharing:e}:t))}}),
449
+ /* @__PURE__ */Se(AE,{open:c,onOpenChange:d,currentTags:p&&u.find(e=>e.id===p)?.tags||[],onUpdateTags:S})]})}function DE(e,t){const r=[],n=t=>{for(const a of e)a.parentId===t&&(r.push(a.id),n(a.id))};return n(t),r}function EE(e,t){const r=/* @__PURE__ */new Set([t,...DE(e,t)]);let n=e.findIndex(e=>e.id===t);if(-1===n)return e.length;for(let a=n;a<e.length;a++)r.has(e[a].id)&&(n=a);return n+1}function IE(e){const t=QM(),[r,n]=ye(!1),[a,o]=ye(!1),[i,s]=ye(!1),[l,c]=ye(!1),[d,u]=ye(!1),[h,p]=ye(!1),[m,f]=ye(!1),[g,v]=ye(null),[y,b]=wE("REASON-default-sidebar-view","last-used"),[x,w]=wE("REASON-left-panels",["openTabs","files"]),[S,k]=wE("REASON-right-panels",[]),[C,N]=wE("REASON-show-dynamic-island",!1),[T,A]=wE("REASON-sidebar-width",25),[M,D]=ye(null),[E,I]=ye(!1),R=ve(null),[z,_]=ye([]),[P,O]=wE("REASON-documents",Wb),[L,F]=wE("REASON-active-doc",P.length>0?P[0].id:null),[B,V]=wE("REASON-open-tabs",P.length>0?[P[0].id]:[]),[$,H]=ye([]),[j,q]=ye(null),[U,G]=ye(""),[W,K]=ye(null),[Y,X]=ye(Zf()),[Z,J]=wE("REASON-enable-db-sync",!1),{isSyncing:Q,lastSyncTime:ee,saveDocument:te,deleteDocument:re,queueDocumentForSync:ne}=function(e,t,r={}){const{enableSync:n=!1,syncInterval:a=5e3}=r,[o,i]=ye(!1),[s,l]=ye(null),c=ve(/* @__PURE__ */new Map),d=ve(void 0),u=ce(async()=>{if(n)try{const e=(await Mt("doc/documents")).map(e=>({id:e.id.toString(),title:e.title||e.name||"Untitled",content:e.content||"",parentId:e.parentId?e.parentId.toString():null,children:[],isExpanded:1===e.isExpanded,isFolder:1===e.isFolder,tags:e.metadata&&JSON.parse(e.metadata).tags||[],metadata:e.metadata?JSON.parse(e.metadata):void 0}));return t(e),l(/* @__PURE__ */new Date),e}catch(e){return FD.error("Failed to load documents from database"),null}},[n,t]),h=ce(async e=>{if(n)try{const r={name:e.title||"Untitled",title:e.title||"Untitled",content:e.content||"",parentId:e.parentId?parseInt(e.parentId):null,isFolder:e.isFolder||!1,metadata:{tags:e.tags||[],isExpanded:e.isExpanded||!1,...e.metadata}};if(isNaN(parseInt(e.id))){const n=await Mt("doc/documents",{method:"POST",headers:{"Content-Type":"application/json"},body:r});return t(t=>t.map(t=>t.id===e.id?{...t,id:n.id.toString()}:t)),n}return await Mt(`doc/documents/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:r})}catch(r){return FD.error("Failed to save document to database"),null}},[n,t]),p=ce(async()=>{if(n&&0!==c.current.size){i(!0);try{const e=Array.from(c.current.values());await Promise.all(e.map(e=>h(e))),c.current.clear(),l(/* @__PURE__ */new Date)}catch(e){}finally{i(!1)}}},[n,h]),m=ce(e=>{n&&(c.current.set(e.id,e),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{p()},2e3))},[n,p]),f=ce(async e=>{if(n)try{return await Mt(`doc/documents/${e}`,{method:"DELETE"}),!0}catch(t){return FD.error("Failed to delete document from database"),!1}},[n]);return ue(()=>{if(!n||a<=0)return;const e=setInterval(()=>{c.current.size>0&&p()},a);return()=>clearInterval(e)},[n,a,p]),ue(()=>()=>{d.current&&clearTimeout(d.current)},[]),{isSyncing:o,lastSyncTime:s,loadFromDatabase:u,saveDocument:h,deleteDocument:f,queueDocumentForSync:m,syncPendingChanges:p}}(0,O,{enableSync:Z,syncInterval:5e3}),ae=e=>{const t=/* @__PURE__ */new Map,r=[];return e.forEach(e=>{t.set(e.id,{...e,children:[]})}),e.forEach(e=>{const n=t.get(e.id);e.parentId&&t.has(e.parentId)?t.get(e.parentId).children.push(n):r.push(n)}),r},oe=ge(()=>ae(P),[P]),ie=P.find(e=>e.id===L);ue(()=>{document.title=ie?.title?`${ie.title} - Reason Docs`:"Reason - Powerful Note-Taking App"},[ie?.title]),ue(()=>{_([])},[L]);const se=ge(()=>{const e=P.filter(e=>!e.isDeleted);if(!U.trim())return e;const t=U.toLowerCase();return e.filter(e=>e.title.toLowerCase().includes(t)||e.content.toLowerCase().includes(t))},[P,U]),le=ge(()=>U.trim()?ae(se):oe,[se,U]),de=async(e,t=!1)=>{let r=null;if(e){const t=P.find(t=>t.id===e);t&&(r=t.isFolder?e:t.parentId)}const n={id:Date.now().toString(),title:t?"New Folder":"",content:"",parentId:r,children:[],isExpanded:t,isFolder:t,tags:[]};O([...P,n]),Z&&await te(n),t||(F(n.id),V([...B,n.id])),K(n.id),setTimeout(()=>K(null),500),r&&O(e=>e.map(e=>e.id===r?{...e,isExpanded:!0}:e)),FD.success(t?"Folder created":"Note created")},he=async e=>{const t=e=>[e,...P.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],r=t(e),n=P.filter(e=>!r.includes(e.id));if(O(n),Z)for(const o of r)await re(o);const a=B.filter(e=>!r.includes(e));V(a),L&&r.includes(L)&&F(a.length>0?a[0]:n.length>0?n[0].id:null),FD.success("Note deleted")},pe=e=>{O(t=>t.map(t=>t.id===e?{...t,isExpanded:!t.isExpanded}:t))};ue(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"k"===e.key&&(e.preventDefault(),s(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),ue(()=>{e&&(w(e=>e.includes("files")?e:["files",...e]),n(!0))},[e]),ue(()=>{const e="REASON-open-tabs-default-restored";try{if(window.localStorage.getItem(e))return;window.localStorage.setItem(e,"1")}catch{return}"tree"!==y&&"outline"!==y&&w(e=>e.includes("openTabs")?e:[...e,"openTabs"])},[]),ue(()=>{"tree"===y?w(["files"]):"outline"===y?w(["outline"]):"split"===y&&w(["openTabs","files","outline"])},[]);const me=e=>{const t=function(e,t,r){const n=new Set(r.filter(t=>e.includes(t)));if(0===n.size)return{openTabs:e,activeTabId:t,closed:[]};const a=e.filter(e=>!n.has(e)),o=e.filter(e=>n.has(e));if(!t||!n.has(t))return{openTabs:a,activeTabId:t,closed:o};const i=e.indexOf(t);let s=null;for(let l=i-1;l>=0&&null===s;l--)n.has(e[l])||(s=e[l]);for(let l=i+1;l<e.length&&null===s;l++)n.has(e[l])||(s=e[l]);return{openTabs:a,activeTabId:s,closed:o}}(B,L,e);0!==t.closed.length&&(H([...t.closed,...$].slice(0,10)),V(t.openTabs),t.activeTabId!==L&&F(t.activeTabId))},fe=e=>{me([e])},be=()=>{if(0===$.length)return;const[e,...t]=$;P.find(t=>t.id===e)?(B.includes(e)||V([...B,e]),F(e),H(t),FD.success("Tab reopened")):(H(t),t.length>0&&be())},xe=()=>{k(e=>e.filter(e=>"ai"!==e)),w(e=>e.length>1?e.filter(e=>"ai"!==e):e)};return ue(()=>{L&&!P.find(e=>e.id===L)&&F(P.length>0?P[0].id:null)},[P,L,F]),{isMobile:t,isSidebarOpen:r,setIsSidebarOpen:n,isRightSidebarOpen:a,setIsRightSidebarOpen:o,isSearchModalOpen:i,setIsSearchModalOpen:s,isSettingsOpen:l,setIsSettingsOpen:c,isTeamsOpen:d,setIsTeamsOpen:u,isInviteModalOpen:h,setIsInviteModalOpen:p,isTagDialogOpen:m,setIsTagDialogOpen:f,tagManagementDocId:g,defaultSidebarView:y,setDefaultSidebarView:b,leftPanels:x,setLeftPanels:w,rightPanels:S,setRightPanels:k,showDynamicIsland:C,setShowDynamicIsland:N,sidebarWidth:T,setSidebarWidth:A,aiSuggestion:M,setAiSuggestion:D,isAiLoading:E,setIsAiLoading:I,editorRef:R,headings:z,setHeadings:_,documents:P,setDocuments:O,activeDocId:L,setActiveDocId:F,openTabs:B,setOpenTabs:V,closedTabsHistory:$,splitViewDocId:j,setSplitViewDocId:q,searchQuery:U,setSearchQuery:G,newDocumentId:W,activeFileSourceId:Y,enableDatabaseSync:Z,setEnableDatabaseSync:J,isSyncing:Q,lastSyncTime:ee,documentTree:oe,activeDocument:ie,filteredDocuments:se,filteredTree:le,handleAddDocument:de,handleDeleteDocument:he,handleDuplicateDocument:e=>{const t=P.find(t=>t.id===e);if(!t)return;const r={...t,id:Date.now().toString(),title:t.title+" (Copy)",children:[]};O([...P,r]),F(r.id),V([...B,r.id]),FD.success("Note duplicated")},handleUpdateDocument:(e,t)=>{O(r=>r.map(r=>{if(r.id===e){const e={...r,...t};return Z&&ne(e),e}return r}))},handleToggleExpand:pe,handleSetExpandedFolders:e=>{const t=new Set(e);O(e=>e.map(e=>{const r=t.has(e.id);return!!e.isExpanded===r?e:{...e,isExpanded:r}}))},handleMoveDocument:(e,t,r)=>{if(e===t)return;if(t&&DE(P,e).includes(t))return void FD.error("Cannot move a note into its own child");const n=function(e,t,r,n){if(!e.find(e=>e.id===t)||t===r)return e;if(r&&!e.some(e=>e.id===r))return e;const a=/* @__PURE__ */new Set([t,...DE(e,t)]);if(r&&a.has(r))return e;const o=r?e.find(e=>e.id===r):void 0,i="child"===n?r:o?.parentId??null,s=e.filter(e=>a.has(e.id)).map(e=>e.id===t?{...e,parentId:i}:e),l=e.filter(e=>!a.has(e.id));let c;return c="before"===n?l.findIndex(e=>e.id===r):"after"===n||r?EE(l,r):l.length,c<0&&(c=l.length),[...l.slice(0,c),...s,...l.slice(c)]}(P,e,t,r);if(n!==P){if(O(n),Z){const t=n.find(t=>t.id===e);t&&ne(t)}FD.success("Note moved")}},handleAddTag:(e,t)=>{O(r=>r.map(r=>r.id===e?{...r,tags:[...r.tags||[],t]}:r))},handleRemoveTag:(e,t)=>{O(r=>r.map(r=>r.id===e?{...r,tags:(r.tags||[]).filter(e=>e!==t)}:r))},handleManageTags:e=>{v(e),f(!0)},handleFileSourceChange:async e=>{X(e),Jf(e);const t=function(){let e=Yf(),t=Zf();return e.find(e=>e.id===t)||Kf}();try{"local"!==t.type?FD.info(`Source switching for ${t.type} not yet implemented in standalone mode`):FD.success("Switched to local storage")}catch(r){FD.error("Failed to load documents from source")}},handleUpdateTags:e=>{g&&(O(t=>t.map(t=>t.id===g?{...t,tags:e}:t)),FD.success("Tags updated"))},handleRestoreDocument:e=>{O(t=>t.map(t=>t.id===e?{...t,isDeleted:!1}:t)),FD.success("Note restored")},handlePermanentDelete:e=>{const t=e=>[e,...P.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],r=t(e),n=P.filter(e=>!r.includes(e.id));O(n);const a=B.filter(e=>!r.includes(e));V(a),L&&r.includes(L)&&F(a.length>0?a[0]:n.length>0?n[0].id:null),FD.success("Note permanently deleted")},handleTabChange:e=>{F(e)},handleTabClose:fe,handleTabsClose:me,handleTabAdd:()=>{de(null)},handleTabDelete:e=>{fe(e),he(e)},handleReopenLastClosed:be,handleSplitRight:e=>{q(e),FD.success("Split view enabled")},handleSelectDocument:e=>{P.find(t=>t.id===e)?.isFolder?pe(e):(B.includes(e)||V([...B,e]),F(e))},handleAIRewrite:async(e,t)=>{FD.info("AI rewrite is not yet available for this editor")},handleAIApprove:()=>{D(null),xe()},handleAIReject:()=>{D(null),xe()},handleAIRegenerate:async e=>{FD.info("AI rewrite is not yet available for this editor")}}}var RE=ae({});function zE(e){const t=ve(null);return null===t.current&&(t.current=e()),t.current}var _E="undefined"!=typeof window?fe:ue,PE=/* @__PURE__ */ae(null);function OE(e,t){-1===e.indexOf(t)&&e.push(t)}function LE(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}var FE=(e,t,r)=>r>t?t:r<e?e:r;var BE=()=>{},VE=()=>{};"undefined"!=typeof process&&"production"!==process.env.NODE_ENV&&(BE=(e,t,r)=>{},VE=(e,t,r)=>{if(!e)throw new Error(function(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}(t,r))});var $E={},HE=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),jE=e=>"object"==typeof e&&null!==e,qE=e=>/^0[^.\s]+$/u.test(e);function UE(e){let t;return()=>(void 0===t&&(t=e()),t)}var GE=e=>e,WE=(...e)=>e.reduce((e,t)=>r=>t(e(r))),KE=(e,t,r)=>{const n=t-e;return n?(r-e)/n:1},YE=class{constructor(){this.subscriptions=[]}add(e){return OE(this.subscriptions,e),()=>LE(this.subscriptions,e)}notify(e,t,r){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](e,t,r);else for(let a=0;a<n;a++){const n=this.subscriptions[a];n&&n(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},XE=e=>1e3*e,ZE=e=>e/1e3,JE=(e,t)=>t?e*(1e3/t):0,QE=/* @__PURE__ */new Set;function eI(e,t,r){e||QE.has(t)||QE.add(t)}var tI=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function rI(e,t,r,n){if(e===t&&r===n)return GE;const a=t=>function(e,t,r,n,a){let o,i,s=0;do{i=t+(r-t)/2,o=tI(i,n,a)-e,o>0?r=i:t=i}while(Math.abs(o)>1e-7&&++s<12);return i}(t,0,1,e,r);return e=>0===e||1===e?e:tI(a(e),t,n)}var nI=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,aI=e=>t=>1-e(1-t),oI=/*@__PURE__*/rI(.33,1.53,.69,.99),iI=/*@__PURE__*/aI(oI),sI=/*@__PURE__*/nI(iI),lI=e=>e>=1?1:(e*=2)<1?.5*iI(e):.5*(2-Math.pow(2,-10*(e-1))),cI=e=>1-Math.sin(Math.acos(e)),dI=aI(cI),uI=nI(cI),hI=/*@__PURE__*/rI(.42,0,1,1),pI=/*@__PURE__*/rI(0,0,.58,1),mI=/*@__PURE__*/rI(.42,0,.58,1),fI=e=>Array.isArray(e)&&"number"==typeof e[0],gI={linear:GE,easeIn:hI,easeInOut:mI,easeOut:pI,circIn:cI,circInOut:uI,circOut:dI,backIn:iI,backInOut:sI,backOut:oI,anticipate:lI},vI=e=>{if(fI(e)){VE(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,r,n,a]=e;return rI(t,r,n,a)}return"string"==typeof e?(VE(void 0!==gI[e],`Invalid easing type '${e}'`,"invalid-easing-type"),gI[e]):e},yI=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function bI(e,t){let r=!1,n=!0;const a={delta:0,timestamp:0,isProcessing:!1},o=()=>r=!0,i=yI.reduce((e,t)=>(e[t]=function(e){let t=/* @__PURE__ */new Set,r=/* @__PURE__ */new Set,n=!1,a=!1;const o=/* @__PURE__ */new WeakSet;let i={delta:0,timestamp:0,isProcessing:!1};function s(t){o.has(t)&&(l.schedule(t),e()),t(i)}const l={schedule:(e,a=!1,i=!1)=>{const s=i&&n?t:r;return a&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(i=e,n)return void(a=!0);n=!0;const o=t;t=r,r=o,t.forEach(s),t.clear(),n=!1,a&&(a=!1,l.process(e))}};return l}(o),e),{}),{setup:s,read:l,resolveKeyframes:c,preUpdate:d,update:u,preRender:h,render:p,postRender:m}=i,f=()=>{const o=$E.useManualTiming,i=o?a.timestamp:performance.now();r=!1,o||(a.delta=n?1e3/60:Math.max(Math.min(i-a.timestamp,40),1)),a.timestamp=i,a.isProcessing=!0,s.process(a),l.process(a),c.process(a),d.process(a),u.process(a),h.process(a),p.process(a),m.process(a),a.isProcessing=!1,r&&t&&(n=!1,e(f))};return{schedule:yI.reduce((t,o)=>{const s=i[o];return t[o]=(t,o=!1,i=!1)=>(r||(r=!0,n=!0,a.isProcessing||e(f)),s.schedule(t,o,i)),t},{}),cancel:e=>{for(let t=0;t<yI.length;t++)i[yI[t]].cancel(e)},state:a,steps:i}}var xI,{schedule:wI,cancel:SI,state:kI,steps:CI}=/* @__PURE__ */bI("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:GE,!0);function NI(){xI=void 0}var TI={now:()=>(void 0===xI&&TI.set(kI.isProcessing||$E.useManualTiming?kI.timestamp:performance.now()),xI),set:e=>{xI=e,queueMicrotask(NI)}},AI=e=>t=>"string"==typeof t&&t.startsWith(e),MI=/*@__PURE__*/AI("--"),DI=/*@__PURE__*/AI("var(--"),EI=e=>!!DI(e)&&II.test(e.split("/*")[0].trim()),II=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function RI(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}var zI={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},_I={...zI,transform:e=>FE(0,1,e)},PI={...zI,default:1},OI=e=>Math.round(1e5*e)/1e5,LI=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;var FI=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,BI=(e,t)=>r=>Boolean("string"==typeof r&&FI.test(r)&&r.startsWith(e)||t&&!function(e){return null==e}(r)&&Object.prototype.hasOwnProperty.call(r,t)),VI=(e,t,r)=>n=>{if("string"!=typeof n)return n;const[a,o,i,s]=n.match(LI);return{[e]:parseFloat(a),[t]:parseFloat(o),[r]:parseFloat(i),alpha:void 0!==s?parseFloat(s):1}},$I={...zI,transform:e=>Math.round((e=>FE(0,255,e))(e))},HI={test:/*@__PURE__*/BI("rgb","red"),parse:/*@__PURE__*/VI("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+$I.transform(e)+", "+$I.transform(t)+", "+$I.transform(r)+", "+OI(_I.transform(n))+")"};var jI={test:/*@__PURE__*/BI("#"),parse:function(e){let t="",r="",n="",a="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),a=e.substring(4,5),t+=t,r+=r,n+=n,a+=a),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:a?parseInt(a,16)/255:1}},transform:HI.transform},qI=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),UI=/*@__PURE__*/qI("deg"),GI=/*@__PURE__*/qI("%"),WI=/*@__PURE__*/qI("px"),KI=/*@__PURE__*/qI("vh"),YI=/*@__PURE__*/qI("vw"),XI=/*@__PURE__*/(()=>({...GI,parse:e=>GI.parse(e)/100,transform:e=>GI.transform(100*e)}))(),ZI={test:/*@__PURE__*/BI("hsl","hue"),parse:/*@__PURE__*/VI("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+GI.transform(OI(t))+", "+GI.transform(OI(r))+", "+OI(_I.transform(n))+")"},JI={test:e=>HI.test(e)||jI.test(e)||ZI.test(e),parse:e=>HI.test(e)?HI.parse(e):ZI.test(e)?ZI.parse(e):jI.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?HI.transform(e):ZI.transform(e),getAnimatableNone:e=>{const t=JI.parse(e);return t.alpha=0,JI.transform(t)}},QI=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;var eR="number",tR="color",rR=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function nR(e){const t=e.toString(),r=[],n={color:[],number:[],var:[]},a=[];let o=0;return{values:r,split:t.replace(rR,e=>(JI.test(e)?(n.color.push(o),a.push(tR),r.push(JI.parse(e))):e.startsWith("var(")?(n.var.push(o),a.push("var"),r.push(e)):(n.number.push(o),a.push(eR),r.push(parseFloat(e))),++o,"${}")).split("${}"),indexes:n,types:a}}function aR({split:e,types:t}){const r=e.length;return n=>{let a="";for(let o=0;o<r;o++)if(a+=e[o],void 0!==n[o]){const e=t[o];a+=e===eR?OI(n[o]):e===tR?JI.transform(n[o]):n[o]}return a}}var oR=(e,t)=>"number"==typeof e?t?.trim().endsWith("/")?e:0:(e=>"number"==typeof e?0:JI.test(e)?JI.getAnimatableNone(e):e)(e);var iR={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(LI)?.length||0)+(e.match(QI)?.length||0)>0},parse:function(e){return nR(e).values},createTransformer:function(e){return aR(nR(e))},getAnimatableNone:function(e){const t=nR(e);return aR(t)(t.values.map((e,r)=>oR(e,t.split[r])))}};function sR(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function lR(e,t){return r=>r>0?t:e}var cR=(e,t,r)=>e+(t-e)*r,dR=(e,t,r)=>{const n=e*e,a=r*(t*t-n)+n;return a<0?0:Math.sqrt(a)},uR=[jI,HI,ZI];function hR(e){const t=(e=>uR.find(t=>t.test(e)))(e);if(BE(Boolean(t),`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(t))return!1;let r=t.parse(e);return t===ZI&&(r=function({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,r/=100;let a=0,o=0,i=0;if(t/=100){const n=r<.5?r*(1+t):r+t-r*t,s=2*r-n;a=sR(s,n,e+1/3),o=sR(s,n,e),i=sR(s,n,e-1/3)}else a=o=i=r;return{red:Math.round(255*a),green:Math.round(255*o),blue:Math.round(255*i),alpha:n}}(r)),r}var pR=(e,t)=>{const r=hR(e),n=hR(t);if(!r||!n)return lR(e,t);const a={...r};return e=>(a.red=dR(r.red,n.red,e),a.green=dR(r.green,n.green,e),a.blue=dR(r.blue,n.blue,e),a.alpha=cR(r.alpha,n.alpha,e),HI.transform(a))},mR=/* @__PURE__ */new Set(["none","hidden"]);function fR(e,t){return r=>cR(e,t,r)}function gR(e){return"number"==typeof e?fR:"string"==typeof e?EI(e)?lR:JI.test(e)?pR:bR:Array.isArray(e)?vR:"object"==typeof e?JI.test(e)?pR:yR:lR}function vR(e,t){const r=[...e],n=r.length,a=e.map((e,r)=>gR(e)(e,t[r]));return e=>{for(let t=0;t<n;t++)r[t]=a[t](e);return r}}function yR(e,t){const r={...e,...t},n={};for(const a in r)void 0!==e[a]&&void 0!==t[a]&&(n[a]=gR(e[a])(e[a],t[a]));return e=>{for(const t in n)r[t]=n[t](e);return r}}var bR=(e,t)=>{const r=iR.createTransformer(t),n=nR(e),a=nR(t);return n.indexes.var.length===a.indexes.var.length&&n.indexes.color.length===a.indexes.color.length&&n.indexes.number.length>=a.indexes.number.length?mR.has(e)&&!a.values.length||mR.has(t)&&!n.values.length?function(e,t){return mR.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}(e,t):WE(vR(function(e,t){const r=[],n={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const o=t.types[a],i=e.indexes[o][n[o]],s=e.values[i]??0;r[a]=s,n[o]++}return r}(n,a),a.values),r):(BE(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),lR(e,t))};function xR(e,t,r){return"number"==typeof e&&"number"==typeof t&&"number"==typeof r?cR(e,t,r):gR(e)(e,t)}var wR=e=>{const t=({timestamp:t})=>e(t);return{start:(e=!0)=>wI.update(t,e),stop:()=>SI(t),now:()=>kI.isProcessing?kI.timestamp:TI.now()}},SR=(e,t,r=10)=>{let n="";const a=Math.max(Math.round(t/r),2);for(let o=0;o<a;o++)n+=Math.round(1e4*e(o/(a-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`};function kR(e){let t=0;let r=e.next(t);for(;!r.done&&t<2e4;)t+=50,r=e.next(t);return t>=2e4?1/0:t}var CR=100,NR=10,TR=1,AR=0,MR=800,DR=.3,ER=.3,IR={granular:.01,default:2},RR={granular:.005,default:.5},zR=.01,_R=10,PR=.05,OR=1;function LR(e,t){return e*Math.sqrt(1-t*t)}var FR=["duration","bounce"],BR=["stiffness","damping","mass"];function VR(e,t){return t.some(t=>void 0!==e[t])}function $R(e){let t={velocity:AR,stiffness:CR,damping:NR,mass:TR,isResolvedFromDuration:!1,...e};if(!VR(e,BR)&&VR(e,FR))if(t.velocity=0,e.visualDuration){const r=e.visualDuration,n=2*Math.PI/(1.2*r),a=n*n,o=2*FE(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:TR,stiffness:a,damping:o}}else{const r=function({duration:e=MR,bounce:t=DR,velocity:r=AR,mass:n=TR}){let a,o;BE(e<=XE(_R),"Spring duration must be 10 seconds or less","spring-duration-limit");let i=1-t;i=FE(PR,OR,i),e=FE(zR,_R,ZE(e)),i<1?(a=t=>{const n=t*i,a=n*e;return.001-(n-r)/LR(t,i)*Math.exp(-a)},o=t=>{const n=t*i*e,o=n*r+r,s=Math.pow(i,2)*Math.pow(t,2)*e,l=Math.exp(-n),c=LR(Math.pow(t,2),i);return(.001-a(t)>0?-1:1)*((o-s)*l)/c}):(a=t=>Math.exp(-t*e)*((t-r)*e+1)-.001,o=t=>Math.exp(-t*e)*(e*e*(r-t)));const s=function(e,t,r){let n=r;for(let a=1;a<12;a++)n-=e(n)/t(n);return n}(a,o,5/e);if(e=XE(e),isNaN(s))return{stiffness:CR,damping:NR,duration:e};{const t=Math.pow(s,2)*n;return{stiffness:t,damping:2*i*Math.sqrt(n*t),duration:e}}}({...e,velocity:0});t={...t,...r,mass:TR},t.isResolvedFromDuration=!0}return t}function HR(e=ER,t=DR){const r="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:n,restDelta:a}=r;const o=r.keyframes[0],i=r.keyframes[r.keyframes.length-1],s={done:!1,value:o},{stiffness:l,damping:c,mass:d,duration:u,velocity:h,isResolvedFromDuration:p}=$R({...r,velocity:-ZE(r.velocity||0)}),m=h||0,f=c/(2*Math.sqrt(l*d)),g=i-o,v=ZE(Math.sqrt(l/d)),y=Math.abs(g)<5;let b,x,w,S,k,C;if(n||(n=y?IR.granular:IR.default),a||(a=y?RR.granular:RR.default),f<1)w=LR(v,f),S=(m+f*v*g)/w,b=e=>{const t=Math.exp(-f*v*e);return i-t*(S*Math.sin(w*e)+g*Math.cos(w*e))},k=f*v*S+g*w,C=f*v*g-S*w,x=e=>Math.exp(-f*v*e)*(k*Math.sin(w*e)+C*Math.cos(w*e));else if(1===f){b=e=>i-Math.exp(-v*e)*(g+(m+v*g)*e);const e=m+v*g;x=t=>Math.exp(-v*t)*(v*e*t-m)}else{const e=v*Math.sqrt(f*f-1);b=t=>{const r=Math.exp(-f*v*t),n=Math.min(e*t,300);return i-r*((m+f*v*g)*Math.sinh(n)+e*g*Math.cosh(n))/e};const t=(m+f*v*g)/e,r=f*v*t-g*e,n=f*v*g-t*e;x=t=>{const a=Math.exp(-f*v*t),o=Math.min(e*t,300);return a*(r*Math.sinh(o)+n*Math.cosh(o))}}const N={calculatedDuration:p&&u||null,velocity:e=>XE(x(e)),next:e=>{if(!p&&f<1){const t=Math.exp(-f*v*e),r=Math.sin(w*e),o=Math.cos(w*e),l=i-t*(S*r+g*o),c=XE(t*(k*r+C*o));return s.done=Math.abs(c)<=n&&Math.abs(i-l)<=a,s.value=s.done?i:l,s}const t=b(e);if(p)s.done=e>=u;else{const r=XE(x(e));s.done=Math.abs(r)<=n&&Math.abs(i-t)<=a}return s.value=s.done?i:t,s},toString:()=>{const e=Math.min(kR(N),2e4),t=SR(t=>N.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return N}HR.applyToOptions=e=>{const t=function(e,t=100,r){const n=r({...e,keyframes:[0,t]}),a=Math.min(kR(n),2e4);return{type:"keyframes",ease:e=>n.next(a*e).value/t,duration:ZE(a)}}(e,100,HR);return e.ease=t.ease,e.duration=XE(t.duration),e.type="keyframes",e};function jR(e,t,r){const n=Math.max(t-5,0);return JE(r-e(n),t-n)}function qR({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:a=10,bounceStiffness:o=500,modifyTarget:i,min:s,max:l,restDelta:c=.5,restSpeed:d}){const u=e[0],h={done:!1,value:u},p=e=>void 0===s?l:void 0===l||Math.abs(s-e)<Math.abs(l-e)?s:l;let m=r*t;const f=u+m,g=void 0===i?f:i(f);g!==f&&(m=g-u);const v=e=>-m*Math.exp(-e/n),y=e=>g+v(e),b=e=>{const t=v(e),r=y(e);h.done=Math.abs(t)<=c,h.value=h.done?g:r};let x,w;const S=e=>{(e=>void 0!==s&&e<s||void 0!==l&&e>l)(h.value)&&(x=e,w=HR({keyframes:[h.value,p(h.value)],velocity:jR(y,e,h.value),damping:a,stiffness:o,restDelta:c,restSpeed:d}))};return S(0),{calculatedDuration:null,next:e=>{let t=!1;return w||void 0!==x||(t=!0,b(e),S(e)),void 0!==x&&e>=x?w.next(e-x):(!t&&b(e),h)}}}function UR(e,t,{clamp:r=!0,ease:n,mixer:a}={}){const o=e.length;if(VE(o===t.length,"Both input and output ranges must be the same length","range-length"),1===o)return()=>t[0];if(2===o&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const s=function(e,t,r){const n=[],a=r||$E.mix||xR,o=e.length-1;for(let i=0;i<o;i++){let r=a(e[i],e[i+1]);if(t){const e=Array.isArray(t)?t[i]||GE:t;r=WE(e,r)}n.push(r)}return n}(t,n,a),l=s.length,c=r=>{if(i&&r<e[0])return t[0];let n=0;if(l>1)for(;n<e.length-2&&!(r<e[n+1]);n++);const a=KE(e[n],e[n+1],r);return s[n](a)};return r?t=>c(FE(e[0],e[o-1],t)):c}function GR(e){const t=[0];return function(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const a=KE(0,t,n);e.push(cR(r,1,a))}}(t,e.length-1),t}function WR({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const a=(e=>Array.isArray(e)&&"number"!=typeof e[0])(n)?n.map(vI):vI(n),o={done:!1,value:t[0]},i=function(e,t){return e.map(e=>e*t)}(r&&r.length===t.length?r:GR(t),e),s=UR(i,t,{ease:Array.isArray(a)?a:(l=t,c=a,l.map(()=>c||mI).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(o.value=s(t),o.done=t>=e,o)}}var KR=e=>null!==e;function YR(e,{repeat:t,repeatType:r="loop"},n,a=1){const o=e.filter(KR),i=a<0||t&&"loop"!==r&&t%2==1?0:o.length-1;return i&&void 0!==n?n:o[i]}var XR={decay:qR,inertia:qR,tween:WR,keyframes:WR,spring:HR};function ZR(e){"string"==typeof e.type&&(e.type=XR[e.type])}var JR=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},QR=e=>e/100,ez=class extends JR{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:e}=this.options;e&&e.updatedAt!==TI.now()&&this.tick(TI.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){const{options:e}=this;ZR(e);const{type:t=WR,repeat:r=0,repeatDelay:n=0,repeatType:a,velocity:o=0}=e;let{keyframes:i}=e;const s=t||WR;"production"!==process.env.NODE_ENV&&s!==WR&&VE(i.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${i}`,"spring-two-frames"),s!==WR&&"number"!=typeof i[0]&&(this.mixKeyframes=WE(QR,xR(i[0],i[1])),i=[0,100]);const l=s({...e,keyframes:i});"mirror"===a&&(this.mirroredGenerator=s({...e,keyframes:[...i].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=kR(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+n,this.totalDuration=this.resolvedDuration*(r+1)-n,this.generator=l}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:r,totalDuration:n,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:i,calculatedDuration:s}=this;if(null===this.startTime)return r.next(0);const{delay:l=0,keyframes:c,repeat:d,repeatType:u,repeatDelay:h,type:p,onUpdate:m,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-n/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>n;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let y,b=this.currentTime,x=r;if(d){const e=Math.min(this.currentTime,n)/i;let t=Math.floor(e),r=e%1;!r&&e>=1&&(r=1),1===r&&t--,t=Math.min(t,d+1),Boolean(t%2)&&("reverse"===u?(r=1-r,h&&(r-=h/i)):"mirror"===u&&(x=o)),b=FE(0,1,r)*i}v?(this.delayState.value=c[0],y=this.delayState):y=x.next(b),a&&!v&&(y.value=a(y.value));let{done:w}=y;v||null===s||(w=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return S&&p!==qR&&(y.value=YR(c,this.options,f,this.speed)),m&&m(y.value),S&&this.finish(),y}then(e,t){return this.finished.then(e,t)}get duration(){return ZE(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ZE(e)}get time(){return ZE(this.currentTime)}set time(e){e=XE(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);return jR(e=>this.generator.next(e).value,e,this.generator.next(e).value)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(TI.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=ZE(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=wR,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();const r=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=r):null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime||(this.startTime=t??r),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(TI.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}};var tz=e=>180*e/Math.PI,rz=e=>{const t=tz(Math.atan2(e[1],e[0]));return az(t)},nz={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:rz,rotateZ:rz,skewX:e=>tz(Math.atan(e[1])),skewY:e=>tz(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},az=e=>((e%=360)<0&&(e+=360),e),oz=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),iz=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),sz={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:oz,scaleY:iz,scale:e=>(oz(e)+iz(e))/2,rotateX:e=>az(tz(Math.atan2(e[6],e[5]))),rotateY:e=>az(tz(Math.atan2(-e[2],e[0]))),rotateZ:rz,rotate:rz,skewX:e=>tz(Math.atan(e[4])),skewY:e=>tz(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function lz(e){return e.includes("scale")?1:0}function cz(e,t){if(!e||"none"===e)return lz(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,a;if(r)n=sz,a=r;else{const t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=nz,a=t}if(!a)return lz(t);const o=n[t],i=a[1].split(",").map(dz);return"function"==typeof o?o(i):i[o]}function dz(e){return parseFloat(e.trim())}var uz=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],hz=/*@__PURE__*/(()=>/* @__PURE__ */new Set([...uz,"pathRotation"]))(),pz=e=>e===zI||e===WI,mz=/* @__PURE__ */new Set(["x","y","z"]),fz=uz.filter(e=>!mz.has(e));var gz={width:({x:e},{paddingLeft:t="0",paddingRight:r="0",boxSizing:n})=>{const a=e.max-e.min;return"border-box"===n?a:a-parseFloat(t)-parseFloat(r)},height:({y:e},{paddingTop:t="0",paddingBottom:r="0",boxSizing:n})=>{const a=e.max-e.min;return"border-box"===n?a:a-parseFloat(t)-parseFloat(r)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>cz(t,"x"),y:(e,{transform:t})=>cz(t,"y")};gz.translateX=gz.x,gz.translateY=gz.y;var vz=/* @__PURE__ */new Set,yz=!1,bz=!1,xz=!1;function wz(){if(bz){const e=Array.from(vz).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),r=/* @__PURE__ */new Map;t.forEach(e=>{const t=function(e){const t=[];return fz.forEach(r=>{const n=e.getValue(r);void 0!==n&&(t.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),t}(e);t.length&&(r.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();const t=r.get(e);t&&t.forEach(([t,r])=>{e.getValue(t)?.set(r)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}bz=!1,yz=!1,vz.forEach(e=>e.complete(xz)),vz.clear()}function Sz(){vz.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(bz=!0)})}var kz=class{constructor(e,t,r,n,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=n,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(vz.add(this),yz||(yz=!0,wI.read(Sz),wI.resolveKeyframes(wz))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:r,motionValue:n}=this;if(null===e[0]){const a=n?.get(),o=e[e.length-1];if(void 0!==a)e[0]=a;else if(r&&t){const n=r.readValue(t,o);null!=n&&(e[0]=n)}void 0===e[0]&&(e[0]=o),n&&void 0===a&&n.set(e[0])}!function(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),vz.delete(this)}cancel(){"scheduled"===this.state&&(vz.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}};function Cz(e,t,r){(e=>e.startsWith("--"))(t)?e.style.setProperty(t,r):e.style[t]=r}var Nz={};function Tz(e,t){const r=UE(e);return()=>Nz[t]??r()}var Az=/* @__PURE__ */Tz(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),Mz=/*@__PURE__*/Tz(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),Dz=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,Ez={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:/*@__PURE__*/Dz([0,.65,.55,1]),circOut:/*@__PURE__*/Dz([.55,0,1,.45]),backIn:/*@__PURE__*/Dz([.31,.01,.66,-.59]),backOut:/*@__PURE__*/Dz([.33,1.53,.69,.99])};function Iz(e,t){return e?"function"==typeof e?Mz()?SR(e,t):"ease-out":fI(e)?Dz(e):Array.isArray(e)?e.map(e=>Iz(e,t)||Ez.easeOut):Ez[e]:void 0}function Rz(e,t,r,{delay:n=0,duration:a=300,repeat:o=0,repeatType:i="loop",ease:s="easeOut",times:l}={},c=void 0){const d={[t]:r};l&&(d.offset=l);const u=Iz(s,a);Array.isArray(u)&&(d.easing=u);const h={delay:n,duration:a,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===i?"alternate":"normal"};return c&&(h.pseudoElement=c),e.animate(d,h)}function zz(e){return"function"==typeof e&&"applyToOptions"in e}var _z=class extends JR{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:r,keyframes:n,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:i,onComplete:s}=e;this.isPseudoElement=Boolean(a),this.allowFlatten=o,this.options=e,VE("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return zz(e)&&Mz()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=Rz(t,r,n,l,a),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const e=YR(n,this.options,i,this.speed);this.updateMotionValue&&this.updateMotionValue(e),Cz(t,r,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return ZE(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ZE(e)}get time(){return ZE(Number(this.animation.currentTime)||0)}set time(e){const t=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=XE(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:r,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Az()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),r&&(this.animation.rangeEnd=r),GE):n(this)}},Pz={anticipate:lI,backInOut:sI,circInOut:uI};function Oz(e){"string"==typeof e.ease&&e.ease in Pz&&(e.ease=Pz[e.ease])}var Lz=class extends _z{constructor(e){Oz(e),ZR(e),super(e),void 0!==e.startTime&&!1!==e.autoplay&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:r,onComplete:n,element:a,...o}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);const i=new ez({...o,autoplay:!1}),s=Math.max(10,TI.now()-this.startTime),l=FE(0,10,s-10),c=i.sample(s).value,{name:d}=this.options;a&&d&&Cz(a,d,c),t.setWithVelocity(i.sample(Math.max(0,s-l)).value,c,l),i.stop()}},Fz=(e,t)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!iR.test(e)&&"0"!==e||e.startsWith("url(")));function Bz(e){e.duration=0,e.type="keyframes"}var Vz=/* @__PURE__ */new Set(["opacity","clipPath","filter","transform","backgroundColor"]),$z=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;var Hz=/* @__PURE__ */new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),jz=/*@__PURE__*/UE(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function qz(e){const{motionValue:t,name:r,repeatDelay:n,repeatType:a,damping:o,type:i,keyframes:s}=e,l=t?.owner?.current;if(!(l instanceof HTMLElement||l instanceof SVGElement))return!1;const{onUpdate:c,transformTemplate:d}=t.owner.getProps();return jz()&&r&&(Vz.has(r)||Hz.has(r)&&function(e){for(let t=0;t<e.length;t++)if("string"==typeof e[t]&&$z.test(e[t]))return!0;return!1}(s))&&("transform"!==r||!d)&&!c&&!n&&"mirror"!==a&&0!==o&&"inertia"!==i}var Uz=class extends JR{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:n=0,repeatDelay:a=0,repeatType:o="loop",keyframes:i,name:s,motionValue:l,element:c,...d}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=TI.now();const u={autoplay:e,delay:t,type:r,repeat:n,repeatDelay:a,repeatType:o,name:s,motionValue:l,element:c,...d},h=c?.KeyframeResolver||kz;this.keyframeResolver=new h(i,(e,t,r)=>this.onKeyframesResolved(e,t,u,!r),s,l,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,r,n){this.keyframeResolver=void 0;const{name:a,type:o,velocity:i,delay:s,isHandoff:l,onUpdate:c}=r;this.resolvedAt=TI.now();let d=!0;(function(e,t,r,n){const a=e[0];if(null===a)return!1;if("display"===t||"visibility"===t)return!0;const o=e[e.length-1],i=Fz(a,t),s=Fz(o,t);return BE(i===s,`You are trying to animate ${t} from "${a}" to "${o}". "${i?o:a}" is not an animatable value.`,"value-not-animatable"),!(!i||!s)&&(function(e){const t=e[0];if(1===e.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}(e)||("spring"===r||zz(r))&&n)})(e,a,o,i)||(d=!1,!$E.instantAnimations&&s||c?.(YR(e,r,t)),e[0]=e[e.length-1],Bz(r),r.repeat=0);const u={startTime:n?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},h=d&&!l&&qz(u),p=u.motionValue?.owner?.current;let m;if(h)try{m=new Lz({...u,element:p})}catch{m=new ez(u)}else m=new ez(u);m.finished.then(()=>{this.notifyFinished()}).catch(GE),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),xz=!0,Sz(),wz(),xz=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function Gz(e,t,r,n=0,a=1){const o=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),i=e.size,s=(i-1)*n;return"function"==typeof r?r(o,i):1===a?o*n:s-o*n}var Wz={current:void 0},Kz=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{const t=TI.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const r of this.dependents)r.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=TI.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=(e=>!isNaN(parseFloat(e)))(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return"production"!==process.env.NODE_ENV&&eI(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new YE);const r=this.events[e].add(t);return"change"===e?()=>{r(),wI.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=/* @__PURE__ */new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Wz.current&&Wz.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=TI.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return JE(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Yz(e,t){return new Kz(e,t)}function Xz(e,t){if(e?.inherit&&t){const{inherit:r,...n}=e;return{...t,...n}}return e}function Zz(e,t){const r=e?.[t]??e?.default??e;return r!==e?Xz(r,e):r}var Jz={type:"spring",stiffness:500,damping:25,restSpeed:10},Qz={type:"keyframes",duration:.8},e_={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},t_=(e,{keyframes:t})=>t.length>2?Qz:hz.has(e)?e.startsWith("scale")?(e=>({type:"spring",stiffness:550,damping:0===e?2*Math.sqrt(550):30,restSpeed:10}))(t[1]):Jz:e_,r_=/* @__PURE__ */new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);var n_=(e,t,r,n={},a,o)=>i=>{const s=Zz(n,e)||{},l=s.delay||n.delay||0;let{elapsed:c=0}=n;c-=XE(l);const d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...s,delay:-c,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{i(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:o?void 0:a};(function(e){for(const t in e)if(!r_.has(t))return!0;return!1})(s)||Object.assign(d,t_(e,d)),d.duration&&(d.duration=XE(d.duration)),d.repeatDelay&&(d.repeatDelay=XE(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let u=!1;if((!1===d.type||0===d.duration&&!d.repeatDelay)&&(Bz(d),0===d.delay&&(u=!0)),($E.instantAnimations||$E.skipAnimations||a?.shouldSkipAnimations||s.skipAnimations)&&(u=!0,Bz(d),d.delay=0),d.allowFlatten=!s.type&&!s.ease,u&&!o&&void 0!==t.get()){const e=YR(d.keyframes,s);if(void 0!==e)return void wI.update(()=>{d.onUpdate(e),d.onComplete()})}return s.isSync?new ez(d):new Uz(d)},a_=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function o_(e,t,r=1){VE(r<=4,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[n,a]=function(e){const t=a_.exec(e);if(!t)return[,];const[,r,n,a]=t;return[`--${r??n}`,a]}(e);if(!n)return;const o=window.getComputedStyle(t).getPropertyValue(n);if(o){const e=o.trim();return HE(e)?parseFloat(e):e}return EI(a)?o_(a,t,r+1):a}function i_(e){const t=[{},{}];return e?.values.forEach((e,r)=>{t[0][r]=e.get(),t[1][r]=e.getVelocity()}),t}function s_(e,t,r,n){if("function"==typeof t){const[a,o]=i_(n);t=t(void 0!==r?r:e.custom,a,o)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){const[a,o]=i_(n);t=t(void 0!==r?r:e.custom,a,o)}return t}function l_(e,t,r){const n=e.getProps();return s_(n,t,void 0!==r?r:n.custom,e)}var c_=/* @__PURE__ */new Set(["width","height","top","left","right","bottom",...uz]),d_=e=>Array.isArray(e);function u_(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,Yz(r))}function h_(e){return d_(e)?e[e.length-1]||0:e}var p_=e=>Boolean(e&&e.getVelocity);function m_(e,t){const r=e.getValue("willChange");if(function(e){return Boolean(p_(e)&&e.add)}(r))return r.add(t);if(!r&&$E.WillChange){const r=new $E.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function f_(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var g_="data-"+f_("framerAppearId");function v_(e){return e.props[g_]}function y_({protectedKeys:e,needsAnimating:t},r){const n=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,n}function b_(e,t,{delay:r=0,transitionOverride:n,type:a}={}){let{transition:o,transitionEnd:i,...s}=t;const l=e.getDefaultTransition();o=o?Xz(o,l):l;const c=o?.reduceMotion,d=o?.skipAnimations;n&&(o=n);const u=[],h=a&&e.animationState&&e.animationState.getState()[a],p=o?.path;p&&p.animateVisualElement(e,s,o,r,u);for(const m in s){const t=e.getValue(m,e.latestValues[m]??null),n=s[m];if(void 0===n||h&&y_(h,m))continue;const a={delay:r,...Zz(o||{},m)};d&&(a.skipAnimations=!0);const i=t.get();if(void 0!==i&&!t.isAnimating()&&!Array.isArray(n)&&n===i&&!a.velocity){wI.update(()=>t.set(n));continue}let l=!1;if(window.MotionHandoffAnimation){const t=v_(e);if(t){const e=window.MotionHandoffAnimation(t,m,wI);null!==e&&(a.startTime=e,l=!0)}}m_(e,m);const p=c??e.shouldReduceMotion;t.start(n_(m,t,n,p&&c_.has(m)?{type:!1}:a,e,l));const f=t.animation;f&&u.push(f)}if(i){const t=()=>wI.update(()=>{i&&function(e,t){let{transitionEnd:r={},transition:n={},...a}=l_(e,t)||{};a={...a,...r};for(const o in a)u_(e,o,h_(a[o]))}(e,i)});u.length?Promise.all(u).then(t):t()}return u}function x_(e,t,r={}){const n=l_(e,t,"exit"===r.type?e.presenceContext?.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(a=r.transitionOverride);const o=n?()=>Promise.all(b_(e,n,r)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(n=0)=>{const{delayChildren:o=0,staggerChildren:i,staggerDirection:s}=a;return function(e,t,r=0,n=0,a=0,o=1,i){const s=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),s.push(x_(l,t,{...i,delay:r+("function"==typeof n?0:n)+Gz(e.variantChildren,l,n,a,o)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(s)}(e,t,n,o,i,s,r)}:()=>Promise.resolve(),{when:s}=a;if(s){const[e,t]="beforeChildren"===s?[o,i]:[i,o];return e().then(()=>t())}return Promise.all([o(),i(r.delay)])}var w_=e=>t=>t.test(e),S_=[zI,WI,GI,UI,YI,KI,{test:e=>"auto"===e,parse:e=>e}],k_=e=>S_.find(w_(e));function C_(e){return"number"==typeof e?0===e:null===e||("none"===e||"0"===e||qE(e))}var N_=/* @__PURE__ */new Set(["brightness","contrast","saturate","opacity"]);function T_(e){const[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[n]=r.match(LI)||[];if(!n)return e;const a=r.replace(n,"");let o=N_.has(t)?1:0;return n!==r&&(o*=100),t+"("+o+a+")"}var A_=/\b([a-z-]*)\(.*?\)/gu,M_={...iR,getAnimatableNone:e=>{const t=e.match(A_);return t?t.map(T_).join(" "):e}},D_={...iR,getAnimatableNone:e=>{const t=iR.parse(e);return iR.createTransformer(e)(t.map(e=>"number"==typeof e?0:"object"==typeof e?{...e,alpha:1}:e))}},E_={...zI,transform:Math.round},I_={borderWidth:WI,borderTopWidth:WI,borderRightWidth:WI,borderBottomWidth:WI,borderLeftWidth:WI,borderRadius:WI,borderTopLeftRadius:WI,borderTopRightRadius:WI,borderBottomRightRadius:WI,borderBottomLeftRadius:WI,width:WI,maxWidth:WI,height:WI,maxHeight:WI,top:WI,right:WI,bottom:WI,left:WI,inset:WI,insetBlock:WI,insetBlockStart:WI,insetBlockEnd:WI,insetInline:WI,insetInlineStart:WI,insetInlineEnd:WI,padding:WI,paddingTop:WI,paddingRight:WI,paddingBottom:WI,paddingLeft:WI,paddingBlock:WI,paddingBlockStart:WI,paddingBlockEnd:WI,paddingInline:WI,paddingInlineStart:WI,paddingInlineEnd:WI,margin:WI,marginTop:WI,marginRight:WI,marginBottom:WI,marginLeft:WI,marginBlock:WI,marginBlockStart:WI,marginBlockEnd:WI,marginInline:WI,marginInlineStart:WI,marginInlineEnd:WI,fontSize:WI,backgroundPositionX:WI,backgroundPositionY:WI,...{rotate:UI,pathRotation:UI,rotateX:UI,rotateY:UI,rotateZ:UI,scale:PI,scaleX:PI,scaleY:PI,scaleZ:PI,skew:UI,skewX:UI,skewY:UI,distance:WI,translateX:WI,translateY:WI,translateZ:WI,x:WI,y:WI,z:WI,perspective:WI,transformPerspective:WI,opacity:_I,originX:XI,originY:XI,originZ:WI},zIndex:E_,fillOpacity:_I,strokeOpacity:_I,numOctaves:E_},R_={...I_,color:JI,backgroundColor:JI,outlineColor:JI,fill:JI,stroke:JI,borderColor:JI,borderTopColor:JI,borderRightColor:JI,borderBottomColor:JI,borderLeftColor:JI,filter:M_,WebkitFilter:M_,mask:D_,WebkitMask:D_},z_=e=>R_[e],__=/*@__PURE__*/new Set([M_,D_]);function P_(e,t){let r=z_(e);return __.has(r)||(r=iR),r.getAnimatableNone?r.getAnimatableNone(t):void 0}var O_=/* @__PURE__ */new Set(["auto","none","0"]);var L_=class extends kz{constructor(e,t,r,n,a){super(e,t,r,n,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:r}=this;if(!t||!t.current)return;super.readKeyframes();for(let s=0;s<e.length;s++){let r=e[s];if("string"==typeof r&&(r=r.trim(),EI(r))){const n=o_(r,t.current);void 0!==n&&(e[s]=n),s===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!c_.has(r)||2!==e.length)return;const[n,a]=e,o=k_(n),i=k_(a);if(RI(n)!==RI(a)&&gz[r])this.needsMeasurement=!0;else if(o!==i)if(pz(o)&&pz(i))for(let s=0;s<e.length;s++){const t=e[s];"string"==typeof t&&(e[s]=parseFloat(t))}else gz[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,r=[];for(let n=0;n<e.length;n++)(null===e[n]||C_(e[n]))&&r.push(n);r.length&&function(e,t,r){let n,a=0;for(;a<e.length&&!n;){const t=e[a];"string"==typeof t&&!O_.has(t)&&nR(t).values.length&&(n=e[a]),a++}if(n&&r)for(const o of t)e[o]=P_(r,n)}(e,r,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:r}=this;if(!e||!e.current)return;"height"===r&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=gz[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const n=t[t.length-1];void 0!==n&&e.getValue(r,n).jump(n,!1)}measureEndState(){const{element:e,name:t,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const n=e.getValue(t);n&&n.jump(this.measuredOrigin,!1);const a=r.length-1,o=r[a];r[a]=gz[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,r])=>{e.getValue(t).set(r)}),this.resolveNoneKeyframes()}},F_=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function B_(e,t,r){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let n=document;t&&(n=t.current);const a=r?.[e]??n.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e).filter(e=>null!=e)}var V_=(e,t)=>t&&"number"==typeof e?t.transform(e):e;function $_(e){return jE(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}var{schedule:H_,cancel:j_}=/* @__PURE__ */bI(queueMicrotask,!1),q_={x:!1,y:!1};function U_(){return q_.x||q_.y}function G_(e,t){const r=B_(e),n=new AbortController;return[r,{passive:!0,...t,signal:n.signal},()=>n.abort()]}function W_(e,t,r={}){const[n,a,o]=G_(e,r);return n.forEach(e=>{let r,n=!1,o=!1;const i=t=>{r&&(r(t),r=void 0),e.removeEventListener("pointerleave",l)},s=e=>{n=!1,window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s),o&&(o=!1,i(e))},l=e=>{"touch"!==e.pointerType&&(n?o=!0:i(e))};e.addEventListener("pointerenter",n=>{if("touch"===n.pointerType||U_())return;o=!1;const i=t(e,n);"function"==typeof i&&(r=i,e.addEventListener("pointerleave",l,a))},a),e.addEventListener("pointerdown",()=>{n=!0,window.addEventListener("pointerup",s,a),window.addEventListener("pointercancel",s,a)},a)}),o}var K_=(e,t)=>!!t&&(e===t||K_(e,t.parentElement)),Y_=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary,X_=/* @__PURE__ */new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);var Z_=/* @__PURE__ */new Set(["INPUT","SELECT","TEXTAREA"]);var J_=/* @__PURE__ */new WeakSet;function Q_(e){return t=>{"Enter"===t.key&&e(t)}}function eP(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function tP(e){return Y_(e)&&!U_()}var rP=/* @__PURE__ */new WeakSet;function nP(e,t,r={}){const[n,a,o]=G_(e,r),i=e=>{const n=e.currentTarget;if(!tP(e))return;if(rP.has(e))return;J_.add(n),r.stopPropagation&&rP.add(e);const o=t(n,e),i={...a,capture:!0},s=(e,t)=>{window.removeEventListener("pointerup",l,i),window.removeEventListener("pointercancel",c,i),J_.has(n)&&J_.delete(n),tP(e)&&"function"==typeof o&&o(e,{success:t})},l=e=>{s(e,n===window||n===document||r.useGlobalTarget||K_(n,e.target))},c=e=>{s(e,!1)};window.addEventListener("pointerup",l,i),window.addEventListener("pointercancel",c,i)};return n.forEach(e=>{var t;(r.useGlobalTarget?window:e).addEventListener("pointerdown",i,a),$_(e)&&(e.addEventListener("focus",e=>((e,t)=>{const r=e.currentTarget;if(!r)return;const n=Q_(()=>{if(J_.has(r))return;eP(r,"down");const e=Q_(()=>{eP(r,"up")});r.addEventListener("keyup",e,t),r.addEventListener("blur",()=>eP(r,"cancel"),t)});r.addEventListener("keydown",n,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),t)})(e,a)),t=e,X_.has(t.tagName)||!0===t.isContentEditable||e.hasAttribute("tabindex")||(e.tabIndex=0))}),o}function aP(e){return jE(e)&&"ownerSVGElement"in e}var oP,iP=/* @__PURE__ */new WeakMap,sP=(e,t,r)=>(n,a)=>a&&a[0]?a[0][e+"Size"]:aP(n)&&"getBBox"in n?n.getBBox()[t]:n[r],lP=/*@__PURE__*/sP("inline","width","offsetWidth"),cP=/*@__PURE__*/sP("block","height","offsetHeight");function dP({target:e,borderBoxSize:t}){iP.get(e)?.forEach(r=>{r(e,{get width(){return lP(e,t)},get height(){return cP(e,t)}})})}function uP(e){e.forEach(dP)}function hP(e,t){oP||"undefined"!=typeof ResizeObserver&&(oP=new ResizeObserver(uP));const r=B_(e);return r.forEach(e=>{let r=iP.get(e);r||(r=/* @__PURE__ */new Set,iP.set(e,r)),r.add(t),oP?.observe(e)}),()=>{r.forEach(e=>{const r=iP.get(e);r?.delete(t),r?.size||oP?.unobserve(e)})}}var pP,mP=/* @__PURE__ */new Set;function fP(e){return mP.add(e),pP||(pP=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};mP.forEach(t=>t(e))},window.addEventListener("resize",pP)),()=>{mP.delete(e),mP.size||"function"!=typeof pP||(window.removeEventListener("resize",pP),pP=void 0)}}function gP(e,t){return"function"==typeof e?fP(e):hP(e,t)}var vP={value:null,addProjectionMetrics:null};var yP=[...S_,JI,iR],bP=()=>({x:{min:0,max:0},y:{min:0,max:0}}),xP=/* @__PURE__ */new WeakMap;function wP(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function SP(e){return"string"==typeof e||Array.isArray(e)}var kP=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],CP=["initial",...kP];function NP(e){return wP(e.animate)||CP.some(t=>SP(e[t]))}function TP(e){return Boolean(NP(e)||e.variants)}var AP={current:null},MP={current:!1},DP="undefined"!=typeof window;var EP=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],IP={};function RP(e){IP=e}var zP=class{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:n,skipAnimations:a,blockInitialAnimation:o,visualState:i},s={}){this.current=null,this.children=/* @__PURE__ */new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=/* @__PURE__ */new Map,this.KeyframeResolver=kz,this.features={},this.valueSubscriptions=/* @__PURE__ */new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const e=TI.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,wI.render(this.render,!1,!0))};const{latestValues:l,renderState:c}=i;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=n,this.skipAnimationsConfig=a,this.options=s,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=NP(t),this.isVariantNode=TP(t),this.isVariantNode&&(this.variantChildren=/* @__PURE__ */new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:d,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(const h in u){const e=u[h];void 0!==l[h]&&p_(e)&&e.set(l[h])}}mount(e){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=e,xP.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(MP.current||function(){if(MP.current=!0,DP)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>AP.current=e.matches;e.addEventListener("change",t),t()}else AP.current=!1}(),this.shouldReduceMotion=AP.current),"production"!==process.env.NODE_ENV&&eI(!0!==this.shouldReduceMotion,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),SI(this.notifyUpdate),SI(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=/* @__PURE__ */new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&Vz.has(e)&&this.current instanceof HTMLElement){const{factory:r,keyframes:n,times:a,ease:o,duration:i}=t.accelerate,s=new _z({element:this.current,name:e,keyframes:n,times:a,ease:o,duration:XE(i)}),l=r(s);return void this.valueSubscriptions.set(e,()=>{l(),s.cancel()})}const r=hz.has(e);r&&this.onBindTransform&&this.onBindTransform();const n=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&wI.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{n(),a&&a()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in IP){const t=IP[e];if(!t)continue;const{isEnabled:r,Feature:n}=t;if(!this.features[e]&&n&&r(this.props)&&(this.features[e]=new n(this)),this.features[e]){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let r=0;r<EP.length;r++){const t=EP[r];this.propEventSubscriptions[t]&&(this.propEventSubscriptions[t](),delete this.propEventSubscriptions[t]);const n=e["on"+t];n&&(this.propEventSubscriptions[t]=this.on(t,n))}this.prevMotionValues=function(e,t,r){for(const n in t){const a=t[n],o=r[n];if(p_(a))e.addValue(n,a);else if(p_(o))e.addValue(n,Yz(a,{owner:e}));else if(o!==a)if(e.hasValue(n)){const t=e.getValue(n);!0===t.liveStyle?t.jump(a):t.hasAnimated||t.set(a)}else{const t=e.getStaticValue(n);e.addValue(n,Yz(void 0!==t?t:a,{owner:e}))}}for(const n in r)void 0===t[n]&&e.removeValue(n);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return void 0===r&&void 0!==t&&(r=Yz(null===t?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){let r=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];return null!=r&&("string"==typeof r&&(HE(r)||qE(r))?r=parseFloat(r):!(e=>yP.find(w_(e)))(r)&&iR.test(t)&&(r=P_(e,t)),this.setBaseTarget(e,p_(r)?r.get():r)),p_(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){const{initial:t}=this.props;let r;if("string"==typeof t||"object"==typeof t){const n=s_(this.props,t,this.presenceContext?.custom);n&&(r=n[e])}if(t&&void 0!==r)return r;const n=this.getBaseTargetFromProps(this.props,e);return void 0===n||p_(n)?void 0!==this.initialValues[e]&&void 0===r?void 0:this.baseTarget[e]:n}on(e,t){return this.events[e]||(this.events[e]=new YE),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){H_.render(this.render)}},_P=class extends zP{constructor(){super(...arguments),this.KeyframeResolver=L_}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){const r=e.style;return r?r[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;p_(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}},PP=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function OP({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function LP(e){return void 0===e||1===e}function FP({scale:e,scaleX:t,scaleY:r}){return!LP(e)||!LP(t)||!LP(r)}function BP(e){return FP(e)||VP(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function VP(e){return $P(e.x)||$P(e.y)}function $P(e){return e&&"0%"!==e}function HP(e,t,r){return r+t*(e-r)}function jP(e,t,r,n,a){return void 0!==a&&(e=HP(e,a,n)),HP(e,r,n)+t}function qP(e,t=0,r=1,n,a){e.min=jP(e.min,t,r,n,a),e.max=jP(e.max,t,r,n,a)}function UP(e,{x:t,y:r}){qP(e.x,t.translate,t.scale,t.originPoint),qP(e.y,r.translate,r.scale,r.originPoint)}var GP=.999999999999,WP=1.0000000000001;function KP(e,t){e.min+=t,e.max+=t}function YP(e,t,r,n,a=.5){qP(e,t,r,cR(e.min,e.max,a),n)}function XP(e,t){return"string"==typeof e?parseFloat(e)/100*(t.max-t.min):e}function ZP(e,t,r){const n=r??e;YP(e.x,XP(t.x,n.x),t.scaleX,t.scale,t.originX),YP(e.y,XP(t.y,n.y),t.scaleY,t.scale,t.originY)}function JP(e,t){return OP(function(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}(e.getBoundingClientRect(),t))}var QP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},eO=uz.length;function tO(e,t,r){const{style:n,vars:a,transformOrigin:o}=e;let i=!1,s=!1;for(const l in t){const e=t[l];if(hz.has(l))i=!0;else if(MI(l))a[l]=e;else{const t=V_(e,I_[l]);l.startsWith("origin")?(s=!0,o[l]=t):n[l]=t}}if(t.transform||(i||r?n.transform=function(e,t,r){let n="",a=!0;for(let i=0;i<eO;i++){const o=uz[i],s=e[o];if(void 0===s)continue;let l=!0;if("number"==typeof s)l=s===(o.startsWith("scale")?1:0);else{const e=parseFloat(s);l=o.startsWith("scale")?1===e:0===e}if(!l||r){const e=V_(s,I_[o]);l||(a=!1,n+=`${QP[o]||o}(${e}) `),r&&(t[o]=e)}}const o=e.pathRotation;return o&&(a=!1,n+=`rotate(${V_(o,I_.pathRotation)}) `),n=n.trim(),r?n=r(t,a?"":n):a&&(n="none"),n}(t,e.transform,r):n.transform&&(n.transform="none")),s){const{originX:e="50%",originY:t="50%",originZ:r=0}=o;n.transformOrigin=`${e} ${t} ${r}`}}function rO(e,{style:t,vars:r},n,a){const o=e.style;let i;for(i in t)o[i]=t[i];for(i in a?.applyProjectionStyles(o,n),r)o.setProperty(i,r[i])}function nO(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var aO={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e){if(!WI.test(e))return e;e=parseFloat(e)}return`${nO(e,t.target.x)}% ${nO(e,t.target.y)}%`}},oO={correct:(e,{treeScale:t,projectionDelta:r})=>{const n=e,a=iR.parse(e);if(a.length>5)return n;const o=iR.createTransformer(e),i="number"!=typeof a[0]?1:0,s=r.x.scale*t.x,l=r.y.scale*t.y;a[0+i]/=s,a[1+i]/=l;const c=cR(s,l,.5);return"number"==typeof a[2+i]&&(a[2+i]/=c),"number"==typeof a[3+i]&&(a[3+i]/=c),o(a)}},iO={borderRadius:{...aO,applyTo:[...F_]},borderTopLeftRadius:aO,borderTopRightRadius:aO,borderBottomLeftRadius:aO,borderBottomRightRadius:aO,boxShadow:oO};function sO(e,{layout:t,layoutId:r}){return hz.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!iO[e]||"opacity"===e)}function lO(e,t,r){const n=e.style,a=t?.style,o={};if(!n)return o;for(const i in n)(p_(n[i])||a&&p_(a[i])||sO(i,e)||void 0!==r?.getValue(i)?.liveStyle)&&(o[i]=n[i]);return o}var cO=class extends _P{constructor(){super(...arguments),this.type="html",this.renderInstance=rO}mount(e){VE(Boolean(e.style),"motion.create() components must forward their ref to a HTML or SVG element","custom-component-ref"),super.mount(e)}readValueFromInstance(e,t){if(hz.has(t))return this.projection?.isProjecting?lz(t):((e,t)=>{const{transform:r="none"}=getComputedStyle(e);return cz(r,t)})(e,t);{const n=(r=e,window.getComputedStyle(r)),a=(MI(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof a?a.trim():a}var r}measureInstanceViewportBox(e,{transformPagePoint:t}){return JP(e,t)}build(e,t,r){tO(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return lO(e,t,r)}},dO={offset:"stroke-dashoffset",array:"stroke-dasharray"},uO={offset:"strokeDashoffset",array:"strokeDasharray"};var hO=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function pO(e,{attrX:t,attrY:r,attrScale:n,pathLength:a,pathSpacing:o=1,pathOffset:i=0,...s},l,c,d){if(tO(e,s,c),l)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:u,style:h}=e;u.transform&&(h.transform=u.transform,delete u.transform),(h.transform||u.transformOrigin)&&(h.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),h.transform&&(h.transformBox=d?.transformBox??"fill-box",delete u.transformBox);for(const p of hO)void 0!==u[p]&&(h[p]=u[p],delete u[p]);void 0!==t&&(u.x=t),void 0!==r&&(u.y=r),void 0!==n&&(u.scale=n),void 0!==a&&function(e,t,r=1,n=0,a=!0){e.pathLength=1;const o=a?dO:uO;e[o.offset]=""+-n,e[o.array]=`${t} ${r}`}(u,a,o,i,!1)}var mO=/* @__PURE__ */new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),fO=e=>"string"==typeof e&&"svg"===e.toLowerCase();function gO(e,t,r){const n=lO(e,t,r);for(const a in e)if(p_(e[a])||p_(t[a])){n[-1!==uz.indexOf(a)?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a]=e[a]}return n}var vO=class extends _P{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=bP}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(hz.has(t)){const e=z_(t);return e&&e.default||0}return t=mO.has(t)?t:f_(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return gO(e,t,r)}build(e,t,r){pO(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,n){!function(e,t,r,n){rO(e,t,void 0,n);for(const a in t.attrs)e.setAttribute(mO.has(a)?a:f_(a),t.attrs[a])}(e,t,0,n)}mount(e){this.isSVGTag=fO(e.tagName),super.mount(e)}},yO=CP.length;function bO(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&bO(e.parent)||{};return void 0!==e.props.initial&&(t.initial=e.props.initial),t}const t={};for(let r=0;r<yO;r++){const n=CP[r],a=e.props[n];(SP(a)||!1===a)&&(t[n]=a)}return t}function xO(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}var wO=[...kP].reverse(),SO=kP.length;function kO(e){return t=>Promise.all(t.map(({animation:t,options:r})=>function(e,t,r={}){let n;if(e.notify("AnimationStart",t),Array.isArray(t)){const a=t.map(t=>x_(e,t,r));n=Promise.all(a)}else if("string"==typeof t)n=x_(e,t,r);else{const a="function"==typeof t?l_(e,t,r.custom):t;n=Promise.all(b_(e,a,r))}return n.then(()=>{e.notify("AnimationComplete",t)})}(e,t,r)))}function CO(e){let t=kO(e),r=AO(),n=!0,a=!1;const o=t=>(r,n)=>{const a=l_(e,n,"exit"===t?e.presenceContext?.custom:void 0);if(a){const{transition:e,transitionEnd:t,...n}=a;r={...r,...n,...t}}return r};function i(i){const{props:s}=e,l=bO(e.parent)||{},c=[],d=/* @__PURE__ */new Set;let u={},h=1/0;for(let t=0;t<SO;t++){const p=wO[t],m=r[p],f=void 0!==s[p]?s[p]:l[p],g=SP(f),v=p===i?m.isActive:null;!1===v&&(h=t);let y=f===l[p]&&f!==s[p]&&g;if(y&&(n||a)&&e.manuallyAnimateOnMount&&(y=!1),m.protectedKeys={...u},!m.isActive&&null===v||!f&&!m.prevProp||wP(f)||"boolean"==typeof f)continue;if("exit"===p&&m.isActive&&!0!==v){m.prevResolvedValues&&(u={...u,...m.prevResolvedValues});continue}const b=NO(m.prevProp,f);let x=b||p===i&&m.isActive&&!y&&g||t>h&&g,w=!1;const S=Array.isArray(f)?f:[f];let k=S.reduce(o(p),{});!1===v&&(k={});const{prevResolvedValues:C={}}=m,N={...C,...k},T=t=>{x=!0,d.has(t)&&(w=!0,d.delete(t)),m.needsAnimating[t]=!0;const r=e.getValue(t);r&&(r.liveStyle=!1)};for(const e in N){const t=k[e],r=C[e];if(u.hasOwnProperty(e))continue;let n=!1;n=d_(t)&&d_(r)?!xO(t,r)||b:t!==r,n?null!=t?T(e):d.add(e):void 0!==t&&d.has(e)?T(e):m.protectedKeys[e]=!0}m.prevProp=f,m.prevResolvedValues=k,m.isActive&&(u={...u,...k}),(n||a)&&e.blockInitialAnimation&&(x=!1);const A=y&&b;!x||A&&!w||c.push(...S.map(t=>{const r={type:p};if("string"==typeof t&&(n||a)&&!A&&e.manuallyAnimateOnMount&&e.parent){const{parent:n}=e,a=l_(n,t);if(n.enteringChildren&&a){const{delayChildren:t}=a.transition||{};r.delay=Gz(n.enteringChildren,e,t)}}return{animation:t,options:r}}))}if(d.size){const t={};if("boolean"!=typeof s.initial){const r=l_(e,Array.isArray(s.initial)?s.initial[0]:s.initial);r&&r.transition&&(t.transition=r.transition)}d.forEach(r=>{const n=e.getBaseTarget(r),a=e.getValue(r);a&&(a.liveStyle=!0),t[r]=n??null}),c.push({animation:t})}let p=Boolean(c.length);return!n||!1!==s.initial&&s.initial!==s.animate||e.manuallyAnimateOnMount||(p=!1),n=!1,a=!1,p?t(c):Promise.resolve()}return{animateChanges:i,setActive:function(t,n){if(r[t].isActive===n)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,n)),r[t].isActive=n;const a=i(t);for(const e in r)r[e].protectedKeys={};return a},setAnimateFunction:function(r){t=r(e)},getState:()=>r,reset:()=>{r=AO(),a=!0}}}function NO(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!xO(t,e)}function TO(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function AO(){return{animate:TO(!0),whileInView:TO(),whileHover:TO(),whileTap:TO(),whileDrag:TO(),whileFocus:TO(),exit:TO()}}function MO(e,t){e.min=t.min,e.max=t.max}function DO(e,t){MO(e.x,t.x),MO(e.y,t.y)}function EO(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function IO(e){return e.max-e.min}function RO(e,t,r,n=.5){e.origin=n,e.originPoint=cR(t.min,t.max,e.origin),e.scale=IO(r)/IO(t),e.translate=cR(r.min,r.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function zO(e,t,r,n){RO(e.x,t.x,r.x,n?n.originX:void 0),RO(e.y,t.y,r.y,n?n.originY:void 0)}function _O(e,t,r,n=0){e.min=(n?cR(r.min,r.max,n):r.min)+t.min,e.max=e.min+IO(t)}function PO(e,t,r,n=0){const a=n?cR(r.min,r.max,n):r.min;e.min=t.min-a,e.max=e.min+IO(t)}function OO(e,t,r,n){PO(e.x,t.x,r.x,n?.x),PO(e.y,t.y,r.y,n?.y)}function LO(e,t,r,n,a){return e=HP(e-=t,1/r,n),void 0!==a&&(e=HP(e,1/a,n)),e}function FO(e,t,[r,n,a],o,i){!function(e,t=0,r=1,n=.5,a,o=e,i=e){if(GI.test(t)&&(t=parseFloat(t),t=cR(i.min,i.max,t/100)-i.min),"number"!=typeof t)return;let s=cR(o.min,o.max,n);e===o&&(s-=t),e.min=LO(e.min,t,r,s,a),e.max=LO(e.max,t,r,s,a)}(e,t[r],t[n],t[a],t.scale,o,i)}var BO=["x","scaleX","originX"],VO=["y","scaleY","originY"];function $O(e,t,r,n){FO(e.x,t,BO,r?r.x:void 0,n?n.x:void 0),FO(e.y,t,VO,r?r.y:void 0,n?n.y:void 0)}function HO(e){return 0===e.translate&&1===e.scale}function jO(e){return HO(e.x)&&HO(e.y)}function qO(e,t){return e.min===t.min&&e.max===t.max}function UO(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function GO(e,t){return UO(e.x,t.x)&&UO(e.y,t.y)}function WO(e){return IO(e.x)/IO(e.y)}function KO(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function YO(e){return[e("x"),e("y")]}var XO=F_.length,ZO=e=>"string"==typeof e?parseFloat(e):e,JO=e=>"number"==typeof e||WI.test(e);function QO(e,t){return void 0!==e[t]?e[t]:e.borderRadius}var eL=/*@__PURE__*/rL(0,.5,dI),tL=/*@__PURE__*/rL(.5,.95,GE);function rL(e,t,r){return n=>n<e?0:n>t?1:r(KE(e,t,n))}function nL(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r,n)}var aL=(e,t)=>e.depth-t.depth,oL=class{constructor(){this.children=[],this.isDirty=!1}add(e){OE(this.children,e),this.isDirty=!0}remove(e){LE(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(aL),this.isDirty=!1,this.children.forEach(e)}};function iL(e){return p_(e)?e.get():e}var sL=class{constructor(){this.members=[]}add(e){OE(this.members,e);for(let t=this.members.length-1;t>=0;t--){const r=this.members[t];if(r===e||r===this.lead||r===this.prevLead)continue;const n=r.instance;n&&!1!==n.isConnected||r.snapshot||(LE(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(LE(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent&&!1!==e.instance?.isConnected)return this.promote(e),!0}return!1}promote(e,t){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:n}=r.options,{layoutDependency:a}=e.options;void 0!==n&&n===a||(e.resumeFrom=r,t&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),!1===e.options.crossfade&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},lL={hasAnimatedSinceResize:!0,hasEverUpdated:!1},cL={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},dL=["","X","Y","Z"],uL=0;function hL(e,t,r,n){const{latestValues:a}=t;a[e]&&(r[e]=a[e],t.setStaticValue(e,0),n&&(n[e]=0))}function pL(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=v_(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:t,layoutId:n}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",wI,!(t||n))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&pL(n)}function mL({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:a}){return class{constructor(e={},r=t?.()){this.id=uL++,this.animationId=0,this.animationCommitId=0,this.children=/* @__PURE__ */new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=/* @__PURE__ */new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,vP.value&&(cL.nodes=cL.calculatedTargetDeltas=cL.calculatedProjections=0),this.nodes.forEach(vL),this.nodes.forEach(TL),this.nodes.forEach(AL),this.nodes.forEach(yL),vP.addProjectionMetrics&&vP.addProjectionMetrics(cL)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=/* @__PURE__ */new Map,this.latestValues=e,this.root=r?r.root||r:this,this.path=r?[...r.path,r]:[],this.parent=r,this.depth=r?r.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new oL)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new YE),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){const r=this.eventHandlers.get(e);r&&r.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;var r;this.isSVG=aP(t)&&!(aP(r=t)&&"svg"===r.tagName),this.instance=t;const{layoutId:n,layout:a,visualElement:o}=this.options;if(o&&!o.current&&o.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(a||n)&&(this.isLayoutDirty=!0),e){let r,n=0;const a=()=>this.root.updateBlockedByResize=!1;wI.read(()=>{n=window.innerWidth}),e(t,()=>{const e=window.innerWidth;e!==n&&(n=e,this.root.updateBlockedByResize=!0,r&&r(),r=function(e,t){const r=TI.now(),n=({timestamp:a})=>{const o=a-r;o>=t&&(SI(n),e(o-t))};return wI.setup(n,!0),()=>SI(n)}(a,250),lL.hasAnimatedSinceResize&&(lL.hasAnimatedSinceResize=!1,this.nodes.forEach(NL)))})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&o&&(n||a)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:n})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const a=this.options.transition||o.getDefaultTransition()||zL,{onLayoutAnimationStart:i,onLayoutAnimationComplete:s}=o.getProps(),l=!this.targetLayout||!GO(this.targetLayout,n),c=!t&&r;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...Zz(a,"layout"),onPlay:i,onComplete:s};(o.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c,t.path)}else t||NL(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=n})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),SI(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(ML),this.animationId++)}getTransformTemplate(){const{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&pL(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let a=0;a<this.path.length;a++){const e=this.path[a];e.shouldResetTransform=!0,"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:t,layout:r}=this.options;if(void 0===t&&!r)return;const n=this.getTransformTemplate();this.prevTransformTemplateValue=n?n(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const e=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(wL),void this.nodes.forEach(xL)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(SL);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(kL),this.nodes.forEach(CL),this.nodes.forEach(fL),this.nodes.forEach(gL)):this.nodes.forEach(SL),this.clearAllSnapshots();const e=TI.now();kI.delta=FE(0,1e3/60,e-kI.timestamp),kI.timestamp=e,kI.isProcessing=!0,CI.update.process(kI),CI.preRender.process(kI),CI.render.process(kI),kI.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,H_.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(bL),this.sharedNodes.forEach(DL)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,wI.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){wI.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||IO(this.snapshot.measuredBox.x)||IO(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let r=0;r<this.path.length;r++)this.path[r].updateScroll();const e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}}),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){const t=n(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!a)return;const e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!jO(this.projectionDelta),r=this.getTransformTemplate(),n=r?r(this.latestValues,""):void 0,o=n!==this.prevTransformTemplateValue;e&&this.instance&&(t||BP(this.latestValues)||o)&&(a(this.instance,n),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){const t=this.measurePageBox();let r=this.removeElementScroll(t);var n;return e&&(r=this.removeTransform(r)),OL((n=r).x),OL(n.y),{animationId:this.root.animationId,measuredBox:t,layoutBox:r,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:e}=this.options;if(!e)return{x:{min:0,max:0},y:{min:0,max:0}};const t=e.measureViewportBox();if(!this.scroll?.wasRoot&&!this.path.some(FL)){const{scroll:e}=this.root;e&&(KP(t.x,e.offset.x),KP(t.y,e.offset.y))}return t}removeElementScroll(e){const t={x:{min:0,max:0},y:{min:0,max:0}};if(DO(t,e),this.scroll?.wasRoot)return t;for(let r=0;r<this.path.length;r++){const n=this.path[r],{scroll:a,options:o}=n;n!==this.root&&a&&o.layoutScroll&&(a.wasRoot&&DO(t,e),KP(t.x,a.offset.x),KP(t.y,a.offset.y))}return t}applyTransform(e,t=!1,r){const n=r||{x:{min:0,max:0},y:{min:0,max:0}};DO(n,e);for(let a=0;a<this.path.length;a++){const e=this.path[a];!t&&e.options.layoutScroll&&e.scroll&&e!==e.root&&(KP(n.x,-e.scroll.offset.x),KP(n.y,-e.scroll.offset.y)),BP(e.latestValues)&&ZP(n,e.latestValues,e.layout?.layoutBox)}return BP(this.latestValues)&&ZP(n,this.latestValues,this.layout?.layoutBox),n}removeTransform(e){const t={x:{min:0,max:0},y:{min:0,max:0}};DO(t,e);for(let r=0;r<this.path.length;r++){const e=this.path[r];if(!BP(e.latestValues))continue;let n;e.instance&&(FP(e.latestValues)&&e.updateSnapshot(),n=bP(),DO(n,e.measurePageBox())),$O(t,e.latestValues,e.snapshot?.layoutBox,n)}return BP(this.latestValues)&&$O(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==kI.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){const t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);const r=Boolean(this.resumingFrom)||this!==t;if(!(e||r&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:n,layoutId:a}=this.options;if(!this.layout||!n&&!a)return;this.resolvedRelativeTargetAt=kI.timestamp;const o=this.getClosestProjectingParent();o&&this.linkedParentVersion!==o.layoutVersion&&!o.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&o&&o.layout?this.createRelativeTarget(o,this.layout.layoutBox,o.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),function(e,t,r,n){_O(e.x,t.x,r.x,n?.x),_O(e.y,t.y,r.y,n?.y)}(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target):DO(this.target,this.layout.layoutBox),UP(this.target,this.targetDelta)):DO(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&o&&Boolean(o.resumingFrom)===Boolean(this.resumingFrom)&&!o.options.layoutScroll&&o.target&&1!==this.animationProgress?this.createRelativeTarget(o,this.target,o.target):this.relativeParent=this.relativeTarget=void 0),vP.value&&cL.calculatedTargetDeltas++)}getClosestProjectingParent(){if(this.parent&&!FP(this.parent.latestValues)&&!VP(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,r){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},OO(this.relativeTargetOrigin,t,r,this.options.layoutAnchor||void 0),DO(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const e=this.getLead(),t=Boolean(this.resumingFrom)||this!==e;let r=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(r=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===kI.timestamp&&(r=!1),r)return;const{layout:n,layoutId:a}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!n&&!a)return;DO(this.layoutCorrected,this.layout.layoutBox);const o=this.treeScale.x,i=this.treeScale.y;!function(e,t,r,n=!1){const a=r.length;if(!a)return;let o,i;t.x=t.y=1;for(let s=0;s<a;s++){o=r[s],i=o.projectionDelta;const{visualElement:a}=o.options;a&&a.props.style&&"contents"===a.props.style.display||(n&&o.options.layoutScroll&&o.scroll&&o!==o.root&&(KP(e.x,-o.scroll.offset.x),KP(e.y,-o.scroll.offset.y)),i&&(t.x*=i.x.scale,t.y*=i.y.scale,UP(e,i)),n&&BP(o.latestValues)&&ZP(e,o.latestValues,o.layout?.layoutBox))}t.x<WP&&t.x>GP&&(t.x=1),t.y<WP&&t.y>GP&&(t.y=1)}(this.layoutCorrected,this.treeScale,this.path,t),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:s}=e;s?(this.projectionDelta&&this.prevProjectionDelta?(EO(this.prevProjectionDelta.x,this.projectionDelta.x),EO(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),zO(this.projectionDelta,this.layoutCorrected,s,this.latestValues),this.treeScale.x===o&&this.treeScale.y===i&&KO(this.projectionDelta.x,this.prevProjectionDelta.x)&&KO(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",s)),vP.value&&cL.calculatedProjections++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(e,t=!1,r){const n=this.snapshot,a=n?n.latestValues:{},o={...this.latestValues},i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const s={x:{min:0,max:0},y:{min:0,max:0}},l=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),d=!c||c.members.length<=1,u=Boolean(l&&!d&&!0===this.options.crossfade&&!this.path.some(RL));let h;this.animationProgress=0;const p=r?.interpolateProjection(e);this.mixTargetDelta=t=>{const r=t/1e3,n=p?.(r);var c,m;n?(i.x.translate=n.x,i.x.scale=cR(e.x.scale,1,r),i.x.origin=e.x.origin,i.x.originPoint=e.x.originPoint,i.y.translate=n.y,i.y.scale=cR(e.y.scale,1,r),i.y.origin=e.y.origin,i.y.originPoint=e.y.originPoint):(EL(i.x,e.x,r),EL(i.y,e.y,r)),this.setTargetDelta(i),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(OO(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),function(e,t,r,n){IL(e.x,t.x,r.x,n),IL(e.y,t.y,r.y,n)}(this.relativeTarget,this.relativeTargetOrigin,s,r),h&&(c=this.relativeTarget,m=h,qO(c.x,m.x)&&qO(c.y,m.y))&&(this.isProjectionDirty=!1),h||(h={x:{min:0,max:0},y:{min:0,max:0}}),DO(h,this.relativeTarget)),l&&(this.animationValues=o,function(e,t,r,n,a,o){a?(e.opacity=cR(0,r.opacity??1,eL(n)),e.opacityExit=cR(t.opacity??1,0,tL(n))):o&&(e.opacity=cR(t.opacity??1,r.opacity??1,n));for(let i=0;i<XO;i++){const a=F_[i];let o=QO(t,a),s=QO(r,a);void 0===o&&void 0===s||(o||(o=0),s||(s=0),0===o||0===s||JO(o)===JO(s)?(e[a]=Math.max(cR(ZO(o),ZO(s),n),0),(GI.test(s)||GI.test(o))&&(e[a]+="%")):e[a]=s)}(t.rotate||r.rotate)&&(e.rotate=cR(t.rotate||0,r.rotate||0,n))}(o,a,this.latestValues,r,u,d)),n&&void 0!==n.rotate&&(this.animationValues||(this.animationValues=o),this.animationValues.pathRotation=n.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=r},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(SI(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=wI.update(()=>{lL.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Yz(0)),this.motionValue.jump(0,!1),this.currentAnimation=function(e,t,r){const n=p_(e)?e:Yz(e);return n.start(n_("",n,t,r)),n.animation}(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let{targetWithTransforms:t,target:r,layout:n,latestValues:a}=e;if(t&&r&&n){if(this!==e&&this.layout&&n&&LL(this.options.animationType,this.layout.layoutBox,n.layoutBox)){r=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const t=IO(this.layout.layoutBox.x);r.x.min=e.target.x.min,r.x.max=r.x.min+t;const n=IO(this.layout.layoutBox.y);r.y.min=e.target.y.min,r.y.max=r.y.min+n}DO(t,r),ZP(t,a),zO(this.projectionDeltaWithTransform,this.layoutCorrected,t,a)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new sL),this.sharedNodes.get(e).add(t);const r=t.options.initialPromotionConfig;t.promote({transition:r?r.transition:void 0,preserveFollowOpacity:r&&r.shouldPreserveFollowOpacity?r.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){const{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:r}={}){const n=this.getStack();n&&n.promote(this,r),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){const{visualElement:e}=this.options;if(!e)return;let t=!1;const{latestValues:r}=e;if((r.z||r.rotate||r.rotateX||r.rotateY||r.rotateZ||r.skewX||r.skewY)&&(t=!0),!t)return;const n={};r.z&&hL("z",e,n,this.animationValues);for(let a=0;a<dL.length;a++)hL(`rotate${dL[a]}`,e,n,this.animationValues),hL(`skew${dL[a]}`,e,n,this.animationValues);e.render();for(const a in n)e.setStaticValue(a,n[a]),this.animationValues&&(this.animationValues[a]=n[a]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(e.visibility="hidden");const r=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=iL(t?.pointerEvents)||"",void(e.transform=r?r(this.latestValues,""):"none");const n=this.getLead();if(!this.projectionDelta||!this.layout||!n.target)return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=iL(t?.pointerEvents)||""),void(this.hasProjected&&!BP(this.latestValues)&&(e.transform=r?r({},""):"none",this.hasProjected=!1));e.visibility="";const a=n.animationValues||n.latestValues;this.applyTransformsToTarget();let o=function(e,t,r){let n="";const a=e.x.translate/t.x,o=e.y.translate/t.y,i=r?.z||0;if((a||o||i)&&(n=`translate3d(${a}px, ${o}px, ${i}px) `),1===t.x&&1===t.y||(n+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:e,rotate:t,pathRotation:a,rotateX:o,rotateY:i,skewX:s,skewY:l}=r;e&&(n=`perspective(${e}px) ${n}`),t&&(n+=`rotate(${t}deg) `),a&&(n+=`rotate(${a}deg) `),o&&(n+=`rotateX(${o}deg) `),i&&(n+=`rotateY(${i}deg) `),s&&(n+=`skewX(${s}deg) `),l&&(n+=`skewY(${l}deg) `)}const s=e.x.scale*t.x,l=e.y.scale*t.y;return 1===s&&1===l||(n+=`scale(${s}, ${l})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,a);r&&(o=r(a,o)),e.transform=o;const{x:i,y:s}=this.projectionDelta;e.transformOrigin=`${100*i.origin}% ${100*s.origin}% 0`,n.animationValues?e.opacity=n===this?a.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:a.opacityExit:e.opacity=n===this?void 0!==a.opacity?a.opacity:"":void 0!==a.opacityExit?a.opacityExit:0;for(const l in iO){if(void 0===a[l])continue;const{correct:t,applyTo:r,isCSSVariable:i}=iO[l],s="none"===o?a[l]:t(a[l],n);if(r){const t=r.length;for(let n=0;n<t;n++)e[r[n]]=s}else i?this.options.visualElement.renderState.vars[l]=s:e[l]=s}this.options.layoutId&&(e.pointerEvents=n===this?iL(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(xL),this.root.sharedNodes.clear()}}}function fL(e){e.updateLayout()}function gL(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:n}=e.layout,{animationType:a}=e.options,o=t.source!==e.layout.source;if("size"===a)YO(e=>{const n=o?t.measuredBox[e]:t.layoutBox[e],a=IO(n);n.min=r[e].min,n.max=n.min+a});else if("x"===a||"y"===a){const e="x"===a?"y":"x";MO(o?t.measuredBox[e]:t.layoutBox[e],r[e])}else LL(a,t.layoutBox,r)&&YO(n=>{const a=o?t.measuredBox[n]:t.layoutBox[n],i=IO(r[n]);a.max=a.min+i,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[n].max=e.relativeTarget[n].min+i)});const i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};zO(i,r,t.layoutBox);const s={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};o?zO(s,e.applyTransform(n,!0),t.measuredBox):zO(s,r,t.layoutBox);const l=!jO(i);let c=!1;if(!e.resumeFrom){const n=e.getClosestProjectingParent();if(n&&!n.resumeFrom){const{snapshot:a,layout:o}=n;if(a&&o){const i=e.options.layoutAnchor||void 0,s={x:{min:0,max:0},y:{min:0,max:0}};OO(s,t.layoutBox,a.layoutBox,i);const l={x:{min:0,max:0},y:{min:0,max:0}};OO(l,r,o.layoutBox,i),GO(s,l)||(c=!0),n.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=s,e.relativeParent=n)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:s,layoutDelta:i,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function vL(e){vP.value&&cL.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function yL(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function bL(e){e.clearSnapshot()}function xL(e){e.clearMeasurements()}function wL(e){e.isLayoutDirty=!0,e.updateLayout()}function SL(e){e.isLayoutDirty=!1}function kL(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function CL(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function NL(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function TL(e){e.resolveTargetDelta()}function AL(e){e.calcProjection()}function ML(e){e.resetSkewAndRotation()}function DL(e){e.removeLeadSnapshot()}function EL(e,t,r){e.translate=cR(t.translate,0,r),e.scale=cR(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function IL(e,t,r,n){e.min=cR(t.min,r.min,n),e.max=cR(t.max,r.max,n)}function RL(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}var zL={duration:.45,ease:[.4,0,.1,1]},_L=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),PL=_L("applewebkit/")&&!_L("chrome/")?Math.round:GE;function OL(e){e.min=PL(e.min),e.max=PL(e.max)}function LL(e,t,r){return"position"===e||"preserve-aspect"===e&&!function(e,t,r){return Math.abs(e-t)<=r}(WO(t),WO(r),.2)}function FL(e){return e!==e.root&&e.scroll?.wasRoot}var BL=mL({attachResizeListener:(e,t)=>nL(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),VL={current:void 0},$L=mL({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!VL.current){const e=new BL({});e.mount(window),e.setOptions({layoutScroll:!0}),VL.current=e}return VL.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),HL=ae({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function jL(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function qL(...e){return Q.useCallback(function(...e){return t=>{let r=!1;const n=e.map(e=>{const n=jL(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){const r=n[t];"function"==typeof r?r():jL(e[t],null)}}}}(...e),e)}var UL=class extends Q.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if($_(t)&&e.isPresent&&!this.props.isPresent&&!1!==this.props.pop){const e=t.offsetParent,r=$_(e)&&e.offsetWidth||0,n=$_(e)&&e.offsetHeight||0,a=getComputedStyle(t),o=this.props.sizeRef.current;o.height=parseFloat(a.height),o.width=parseFloat(a.width),o.top=t.offsetTop,o.left=t.offsetLeft,o.right=r-o.width-o.left,o.bottom=n-o.height-o.top,o.direction=a.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function GL({children:e,isPresent:t,anchorX:r,anchorY:n,root:a,pop:o}){const i=he(),s=ve(null),l=ve({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:c}=de(HL),d=!1!==o?e.props?.ref??e?.ref:void 0,u=qL(s,d);return me(()=>{const{width:e,height:d,top:u,left:h,right:p,bottom:m,direction:f}=l.current;if(t||!1===o||!s.current||!e||!d)return;const g="rtl"===f,v="left"===r?g?`right: ${p}`:`left: ${h}`:g?`left: ${h}`:`right: ${p}`,y="bottom"===n?`bottom: ${m}`:`top: ${u}`;s.current.dataset.motionPopId=i;const b=document.createElement("style");c&&(b.nonce=c);const x=a??document.head;return x.appendChild(b),b.sheet&&b.sheet.insertRule(`\n [data-motion-pop-id="${i}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${d}px !important;\n ${v}px !important;\n ${y}px !important;\n }\n `),()=>{s.current?.removeAttribute("data-motion-pop-id"),x.contains(b)&&x.removeChild(b)}},[t]),Se(UL,{isPresent:t,childRef:s,sizeRef:l,pop:o,children:!1===o?e:Q.cloneElement(e,{ref:u})})}var WL=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:a,presenceAffectsLayout:o,mode:i,anchorX:s,anchorY:l,root:c})=>{const d=zE(KL),u=he(),h=ve(r),p=ve(n);_E(()=>{h.current=r,p.current=n});let m=!0,f=ge(()=>(m=!1,{id:u,initial:t,isPresent:r,custom:a,onExitComplete:e=>{d.set(e,!0);for(const t of d.values())if(!t)return;n&&n()},register:e=>(d.set(e,!1),()=>{d.delete(e),!h.current&&!d.size&&p.current?.()})}),[r,d,n]);return o&&m&&(f={...f}),ge(()=>{d.forEach((e,t)=>d.set(t,!1))},[r]),Q.useEffect(()=>{!r&&!d.size&&n&&n()},[r]),e=Se(GL,{pop:"popLayout"===i,isPresent:r,anchorX:s,anchorY:l,root:c,children:e}),Se(PE.Provider,{value:f,children:e})};function KL(){/* @__PURE__ */
450
+ return new Map}function YL(e=!0){const t=de(PE);if(null===t)return[!0,null];const{isPresent:r,onExitComplete:n,register:a}=t,o=he();ue(()=>{if(e)return a(o)},[e]);const i=ce(()=>e&&n&&n(o),[o,n,e]);return!r&&n?[!1,i]:[!0]}var XL=e=>e.key||"";function ZL(e){const t=[];return te.forEach(e,e=>{se(e)&&t.push(e)}),t}var JL=({children:e,custom:t,initial:r=!0,onExitComplete:n,presenceAffectsLayout:a=!0,mode:o="sync",propagate:i=!1,anchorX:s="left",anchorY:l="top",root:c})=>{const[d,u]=YL(i),h=ge(()=>ZL(e),[e]),p=i&&!d?[]:h.map(XL),m=ve(!0),f=ve(h),g=zE(()=>/* @__PURE__ */new Map),v=ve(/* @__PURE__ */new Set),[y,b]=ye(h),[x,w]=ye(h);_E(()=>{m.current=!1,f.current=h;for(let e=0;e<x.length;e++){const t=XL(x[e]);p.includes(t)?(g.delete(t),v.current.delete(t)):!0!==g.get(t)&&g.set(t,!1)}},[x,p.length,p.join("-")]);const S=[];if(h!==y){let e=[...h];for(let t=0;t<x.length;t++){const r=x[t],n=XL(r);p.includes(n)||(e.splice(t,0,r),S.push(r))}return"wait"===o&&S.length&&(e=S),w(ZL(e)),b(h),null}"production"!==process.env.NODE_ENV&&"wait"===o&&x.length;const{forceRender:k}=de(RE);return Se(we,{children:x.map(e=>{const y=XL(e),b=!(i&&!d)&&(h===x||p.includes(y));return Se(WL,{isPresent:b,initial:!(m.current&&!r)&&void 0,custom:t,presenceAffectsLayout:a,mode:o,root:c,onExitComplete:b?void 0:()=>{if(v.current.has(y))return;if(!g.has(y))return;v.current.add(y),g.set(y,!0);let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(k?.(),w(f.current),i&&u?.(),n&&n())},anchorX:s,anchorY:l,children:e},y)})})},QL=ae({strict:!1}),eF={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},tF=!1;function rF(){return function(){if(tF)return;const e={};for(const t in eF)e[t]={isEnabled:e=>eF[t].some(t=>!!e[t])};RP(e),tF=!0}(),IP}var nF=/* @__PURE__ */new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function aF(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||nF.has(e)}var oF,iF,sF=/* @__PURE__ */r({default:()=>oF}),lF=t(()=>{throw oF={},new Error('Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?')}),cF=e=>!aF(e);try{"function"==typeof(iF=(lF(),e(sF)).default)&&(cF=e=>e.startsWith("on")?!aF(e):iF(e))}catch{}var dF=/* @__PURE__ */ae({});function uF(e){const{initial:t,animate:r}=function(e,t){if(NP(e)){const{initial:t,animate:r}=e;return{initial:!1===t||SP(t)?t:void 0,animate:SP(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,de(dF));return ge(()=>({initial:t,animate:r}),[hF(t),hF(r)])}function hF(e){return Array.isArray(e)?e.join(" "):e}var pF=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function mF(e,t,r){for(const n in t)p_(t[n])||sO(n,r)||(e[n]=t[n])}function fF(e,t){const r={};return mF(r,e.style||{},e),Object.assign(r,function({transformTemplate:e},t){return ge(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{}};return tO(r,t,e),Object.assign({},r.vars,r.style)},[t])}(e,t)),r}function gF(e,t){const r={},n=fF(e,t);return e.drag&&!1!==e.dragListener&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=n,r}var vF=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}});function yF(e,t,r,n){const a=ge(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return pO(r,t,fO(n),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const t={};mF(t,e.style,e),a.style={...t,...a.style}}return a}var bF=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function xF(e){return"string"==typeof e&&!e.includes("-")&&!!(bF.indexOf(e)>-1||/[A-Z]/u.test(e))}function wF(e,t,r,{latestValues:n},a,o=!1,i){const s=(i??xF(e)?yF:gF)(t,n,a,e),l=function(e,t,r){const n={};for(const a in e)"values"===a&&"object"==typeof e.values||p_(e[a])||(cF(a)||!0===r&&aF(a)||!t&&!aF(a)||e.draggable&&a.startsWith("onDrag"))&&(n[a]=e[a]);return n}(t,"string"==typeof e,o),c=e!==ne?{...l,...s,ref:r}:{},{children:d}=t,u=ge(()=>p_(d)?d.get():d,[d]);return oe(e,{...c,children:u})}function SF(e,t,r,n){const a={},o=n(e,{});for(const h in o)a[h]=iL(o[h]);let{initial:i,animate:s}=e;const l=NP(e),c=TP(e);t&&c&&!l&&!1!==e.inherit&&(void 0===i&&(i=t.initial),void 0===s&&(s=t.animate));let d=!!r&&!1===r.initial;d=d||!1===i;const u=d?s:i;if(u&&"boolean"!=typeof u&&!wP(u)){const t=Array.isArray(u)?u:[u];for(let r=0;r<t.length;r++){const n=s_(e,t[r]);if(n){const{transitionEnd:e,transition:t,...r}=n;for(const n in r){let e=r[n];if(Array.isArray(e)){e=e[d?e.length-1:0]}null!==e&&(a[n]=e)}for(const n in e)a[n]=e[n]}}}return a}var kF=e=>(t,r)=>{const n=de(dF),a=de(PE),o=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,a){return{latestValues:SF(r,n,a,e),renderState:t()}}(e,t,n,a);return r?o():zE(o)},CF=/*@__PURE__*/kF({scrapeMotionValuesFromProps:lO,createRenderState:pF}),NF=/*@__PURE__*/kF({scrapeMotionValuesFromProps:gO,createRenderState:vF}),TF=Symbol.for("motionComponentSymbol");function AF(e,t,r){const n=ve(r);me(()=>{n.current=r});const a=ve(null);return ce(r=>{r&&e.onMount?.(r),t&&(r?t.mount(r):t.unmount());const o=n.current;if("function"==typeof o)if(r){const e=o(r);"function"==typeof e&&(a.current=e)}else a.current?(a.current(),a.current=null):o(r);else o&&(o.current=r)},[t])}var MF=ae({});function DF(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function EF(e,t,r,n,a,o){const{visualElement:i}=de(dF),s=de(QL),l=de(PE),c=de(HL),d=c.reducedMotion,u=c.skipAnimations,h=ve(null),p=ve(!1);n=n||s.renderer,!h.current&&n&&(h.current=n(e,{visualState:t,parent:i,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:d,skipAnimations:u,isSVG:o}),p.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));const m=h.current,f=de(MF);!m||m.projection||!a||"html"!==m.type&&"svg"!==m.type||function(e,t,r,n){const{layoutId:a,layout:o,drag:i,dragConstraints:s,layoutScroll:l,layoutRoot:c,layoutAnchor:d,layoutCrossfade:u}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:IF(e.parent)),e.projection.setOptions({layoutId:a,layout:o,alwaysMeasureLayout:Boolean(i)||s&&DF(s),visualElement:e,animationType:"string"==typeof o?o:"both",initialPromotionConfig:n,crossfade:u,layoutScroll:l,layoutRoot:c,layoutAnchor:d})}(h.current,r,a,f);const g=ve(!1);me(()=>{m&&g.current&&m.update(r,l)});const v=r[g_],y=ve(Boolean(v)&&"undefined"!=typeof window&&!window.MotionHandoffIsComplete?.(v)&&window.MotionHasOptimisedAnimation?.(v));return _E(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),y.current&&m.animationState&&m.animationState.animateChanges())}),ue(()=>{m&&(!y.current&&m.animationState&&m.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(v)}),y.current=!1),m.enteringChildren=void 0)}),m}function IF(e){if(e)return!1!==e.options.allowProjection?e.projection:IF(e.parent)}function RF(e,{forwardMotionProps:t=!1,type:r}={},n,a){n&&function(e){const t=rF();for(const r in e)t[r]={...t[r],...e[r]};RP(t)}(n);const o=r?"svg"===r:xF(e),i=o?NF:CF;function s(r,s){let l;const c={...de(HL),...r,layoutId:zF(r)},{isStatic:d}=c,u=uF(r),h=i(r,d);if(!d&&"undefined"!=typeof window){!function(e,t){const r=de(QL).strict;if("production"!==process.env.NODE_ENV&&t&&r){const t="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?BE(!1,t,"lazy-strict-mode"):VE(!1,t,"lazy-strict-mode")}}(c,n);const t=function(e){const{drag:t,layout:r}=rF();if(!t&&!r)return{};const n={...t,...r};return{MeasureLayout:t?.isEnabled(e)||r?.isEnabled(e)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}(c);l=t.MeasureLayout,u.visualElement=EF(e,h,c,a,t.ProjectionNode,o)}return ke(dF.Provider,{value:u,children:[l&&u.visualElement?Se(l,{visualElement:u.visualElement,...c}):null,wF(e,r,AF(h,u.visualElement,s),h,d,t,o)]})}s.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;const l=ie(s);return l[TF]=e,l}function zF({layoutId:e}){const t=de(RE).id;return t&&void 0!==e?t+"-"+e:e}function _F(e,t){if("undefined"==typeof Proxy)return RF;const r=/* @__PURE__ */new Map,n=(r,n)=>RF(r,n,e,t);return new Proxy((e,t)=>("production"!==process.env.NODE_ENV&&eI(!1,"motion() is deprecated. Use motion.create() instead."),n(e,t)),{get:(a,o)=>"create"===o?n:(r.has(o)||r.set(o,RF(o,void 0,e,t)),r.get(o))})}var PF=(e,t)=>t.isSVG??xF(e)?new vO(t):new cO(t,{allowProjection:e!==ne}),OF=0,LF={animation:{Feature:class extends PP{constructor(e){super(e),e.animationState||(e.animationState=CO(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();wP(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends PP{constructor(){super(...arguments),this.id=OF++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;if(e&&!1===r){if(this.isExitComplete){const{initial:e,custom:t}=this.node.getProps();if("string"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)){const r=l_(this.node,e,t);if(r){const{transition:e,transitionEnd:t,...n}=r;for(const r in n)this.node.getValue(r)?.jump(n[r])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);return void(this.isExitComplete=!1)}const n=this.node.animationState.setActive("exit",!e);t&&!e&&n.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function FF(e){return{point:{x:e.pageX,y:e.pageY}}}function BF(e,t,r,n){return nL(e,t,(e=>t=>Y_(t)&&e(t,FF(t)))(r),n)}var VF=({current:e})=>e?e.ownerDocument.defaultView:null,$F=(e,t)=>Math.abs(e-t);var HF=/*#__PURE__*/new Set(["auto","scroll"]),jF=class{constructor(e,t,{transformPagePoint:r,contextWindow:n=window,dragSnapToOrigin:a=!1,distanceThreshold:o=3,element:i}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=/* @__PURE__ */new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=qF(this.lastRawMoveEventInfo,this.transformPagePoint));const e=GF(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,r=function(e,t){const r=$F(e.x,t.x),n=$F(e.y,t.y);return Math.sqrt(r**2+n**2)}(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!r)return;const{point:n}=e,{timestamp:a}=kI;this.history.push({...n,timestamp:a});const{onStart:o,onMove:i}=this.handlers;t||(o&&o(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),i&&i(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=qF(t,this.transformPagePoint),wI.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();const{onEnd:r,onSessionEnd:n,resumeAnimation:a}=this.handlers;if(!this.dragSnapToOrigin&&this.startEvent||a&&a(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=GF("pointercancel"===e.type?this.lastMoveEventInfo:qF(t,this.transformPagePoint),this.history);this.startEvent&&r&&r(e,o),n&&n(e,o)},!Y_(e))return;this.dragSnapToOrigin=a,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=n||window;const s=qF(FF(e),this.transformPagePoint),{point:l}=s,{timestamp:c}=kI;this.history=[{...l,timestamp:c}];const{onSessionStart:d}=t;d&&d(e,GF(s,this.history));const u={passive:!0,capture:!0};this.removeListeners=WE(BF(this.contextWindow,"pointermove",this.handlePointerMove,u),BF(this.contextWindow,"pointerup",this.handlePointerUp,u),BF(this.contextWindow,"pointercancel",this.handlePointerUp,u)),i&&this.startScrollTracking(i)}startScrollTracking(e){let t=e.parentElement;for(;t;){const e=getComputedStyle(t);(HF.has(e.overflowX)||HF.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const r=e===window,n=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a=n.x-t.x,o=n.y-t.y;0===a&&0===o||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a,this.lastMoveEventInfo.point.y+=o):this.history.length>0&&(this.history[0].x-=a,this.history[0].y-=o),this.scrollPositions.set(e,n),wI.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),SI(this.updatePoint)}};function qF(e,t){return t?{point:t(e.point)}:e}function UF(e,t){return{x:e.x-t.x,y:e.y-t.y}}function GF({point:e},t){return{point:e,delta:UF(e,KF(t)),offset:UF(e,WF(t)),velocity:YF(t,.1)}}function WF(e){return e[0]}function KF(e){return e[e.length-1]}function YF(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null;const a=KF(e);for(;r>=0&&(n=e[r],!(a.timestamp-n.timestamp>XE(t)));)r--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&a.timestamp-n.timestamp>2*XE(t)&&(n=e[1]);const o=ZE(a.timestamp-n.timestamp);if(0===o)return{x:0,y:0};const i={x:(a.x-n.x)/o,y:(a.y-n.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function XF(e,t,r){return{min:void 0!==t?e.min+t:void 0,max:void 0!==r?e.max+r-(e.max-e.min):void 0}}function ZF(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,n]=[n,r]),{min:r,max:n}}var JF=.35;function QF(e,t,r){return{min:eB(e,t),max:eB(e,r)}}function eB(e,t){return"number"==typeof e?e:e[t]||0}var tB=/* @__PURE__ */new WeakMap,rB=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:r}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:a}=this.getProps();this.panSession=new jF(e,{onSessionStart:e=>{t&&this.snapToCursor(FF(e).point),this.stopAnimation()},onStart:(e,t)=>{const{drag:r,dragPropagation:n,onDragStart:a}=this.getProps();if(r&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(o=r)||"y"===o?q_[o]?null:(q_[o]=!0,()=>{q_[o]=!1}):q_.x||q_.y?null:(q_.x=q_.y=!0,()=>{q_.x=q_.y=!1}),!this.openDragLock))return;var o;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),YO(e=>{let t=this.getAxisMotionValue(e).get()||0;if(GI.test(t)){const{projection:r}=this.visualElement;if(r&&r.layout){const n=r.layout.layoutBox[e];n&&(t=IO(n)*(parseFloat(t)/100))}}this.originPoint[e]=t}),a&&wI.update(()=>a(e,t),!1,!0),m_(this.visualElement,"transform");const{animationState:i}=this.visualElement;i&&i.setActive("whileDrag",!0)},onMove:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;const{dragPropagation:r,dragDirectionLock:n,onDirectionLock:a,onDrag:o}=this.getProps();if(!r&&!this.openDragLock)return;const{offset:i}=t;if(n&&null===this.currentDirection)return this.currentDirection=function(e,t=10){let r=null;Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x");return r}(i),void(null!==this.currentDirection&&a&&a(this.currentDirection));this.updateAxis("x",t.point,i),this.updateAxis("y",t.point,i),this.visualElement.render(),o&&wI.update(()=>o(e,t),!1,!0)},onSessionEnd:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>{const{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})}},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:a,distanceThreshold:r,contextWindow:VF(this.visualElement),element:this.visualElement.current})}stop(e,t){const r=e||this.latestPointerEvent,n=t||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!n||!r)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:i}=this.getProps();i&&wI.postRender(()=>i(r,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,r){const{drag:n}=this.getProps();if(!r||!aB(e,n,this.currentDirection))return;const a=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=function(e,{min:t,max:r},n){return void 0!==t&&e<t?e=n?cR(t,e,n.min):Math.max(e,t):void 0!==r&&e>r&&(e=n?cR(r,e,n.max):Math.min(e,r)),e}(o,this.constraints[e],this.elastic[e])),a.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:t}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,n=this.constraints;e&&DF(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!r)&&function(e,{top:t,left:r,bottom:n,right:a}){return{x:XF(e.x,r,a),y:XF(e.y,t,n)}}(r.layoutBox,e),this.elastic=function(e=JF){return!1===e?e=0:!0===e&&(e=JF),{x:QF(e,"left","right"),y:QF(e,"top","bottom")}}(t),n!==this.constraints&&!DF(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&YO(e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const r={};return void 0!==t.min&&(r.min=t.min-e.min),void 0!==t.max&&(r.max=t.max-e.min),r}(r.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!DF(e))return!1;const r=e.current;VE(null!==r,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:n}=this.visualElement;if(!n||!n.layout)return!1;n.root&&(n.root.scroll=void 0,n.root.updateScroll());const a=function(e,t,r){const n=JP(e,r),{scroll:a}=t;return a&&(KP(n.x,a.offset.x),KP(n.y,a.offset.y)),n}(r,n.root,this.visualElement.getTransformPagePoint());let o=function(e,t){return{x:ZF(e.x,t.x),y:ZF(e.y,t.y)}}(n.layout.layoutBox,a);if(t){const e=t(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(o));this.hasMutatedConstraints=!!e,e&&(o=OP(e))}return o}startAnimation(e){const{drag:t,dragMomentum:r,dragElastic:n,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:i}=this.getProps(),s=this.constraints||{},l=YO(i=>{if(!aB(i,t,this.currentDirection))return;let l=s&&s[i]||{};!0!==o&&o!==i||(l={min:0,max:0});const c=n?200:1e6,d=n?40:1e7,u={type:"inertia",velocity:r?e[i]:0,bounceStiffness:c,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...a,...l};return this.startAxisValueAnimation(i,u)});return Promise.all(l).then(i)}startAxisValueAnimation(e,t){const r=this.getAxisMotionValue(e);return m_(this.visualElement,e),r.start(n_(e,r,0,t,this.visualElement,!1))}stopAnimation(){YO(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps()[t];return r||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){YO(t=>{const{drag:r}=this.getProps();if(!aB(t,r,this.currentDirection))return;const{projection:n}=this.visualElement,a=this.getAxisMotionValue(t);if(n&&n.layout){const{min:r,max:o}=n.layout.layoutBox[t],i=a.get()||0;a.set(e[t]-cR(r,o,.5)+i)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!DF(t)||!r||!this.constraints)return;this.stopAnimation();const n={x:0,y:0};YO(e=>{const t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){const r=t.get();n[e]=function(e,t){let r=.5;const n=IO(e),a=IO(t);return a>n?r=KE(t.min,t.max-n,e.min):n>a&&(r=KE(e.min,e.max-a,t.min)),FE(0,1,r)}({min:r,max:r},this.constraints[e])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),YO(t=>{if(!aB(t,e,null))return;const r=this.getAxisMotionValue(t),{min:a,max:o}=this.constraints[t];r.set(cR(a,o,n[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;tB.set(this.visualElement,this);const e=this.visualElement.current,t=BF(e,"pointerdown",t=>{const{drag:r,dragListener:n=!0}=this.getProps(),a=t.target,o=a!==e&&function(e){return Z_.has(e.tagName)||!0===e.isContentEditable}(a);r&&n&&!o&&this.start(t)});let r;const n=()=>{const{dragConstraints:t}=this.getProps();DF(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),r||(r=function(e,t,r){const n=gP(e,nB(r)),a=gP(t,nB(r));return()=>{n(),a()}}(e,t.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,o=a.addEventListener("measure",n);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),wI.read(n);const i=nL(window,"resize",()=>this.scalePositionWithinConstraints()),s=a.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(YO(t=>{const r=this.getAxisMotionValue(t);r&&(this.originPoint[t]+=e[t].translate,r.set(r.get()+e[t].translate))}),this.visualElement.render())});return()=>{i(),t(),o(),s&&s(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:n=!1,dragConstraints:a=!1,dragElastic:o=JF,dragMomentum:i=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:n,dragConstraints:a,dragElastic:o,dragMomentum:i}}};function nB(e){let t=!0;return()=>{t?t=!1:e()}}function aB(e,t,r){return!(!0!==t&&t!==e||null!==r&&r!==e)}var oB=e=>(t,r)=>{e&&wI.update(()=>e(t,r),!1,!0)},iB=!1,sB=class extends re{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:n}=this.props,{projection:a}=e;a&&(t.group&&t.group.add(a),r&&r.register&&n&&r.register(a),iB&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),lL.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:r,drag:n,isPresent:a}=this.props,{projection:o}=r;return o?(o.isPresent=a,e.layoutDependency!==t&&o.setOptions({...o.options,layoutDependency:t}),iB=!0,n||e.layoutDependency!==t||void 0===t||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||wI.postRender(()=>{const e=o.getStack();e&&e.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:r}=e;r&&(r.options.layoutAnchor=t,r.root.didUpdate(),H_.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:n}=e;iB=!0,n&&(n.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(n),r&&r.deregister&&r.deregister(n))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}};function lB(e){const[t,r]=YL(),n=de(RE);return Se(sB,{...e,layoutGroup:n,switchLayoutGroup:de(MF),isPresent:t,safeToRemove:r})}var cB={pan:{Feature:class extends PP{constructor(){super(...arguments),this.removePointerDownListener=GE}onPointerDown(e){this.session=new jF(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:VF(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:n}=this.node.getProps();return{onSessionStart:oB(e),onStart:oB(t),onMove:oB(r),onEnd:(e,t)=>{delete this.session,n&&wI.postRender(()=>n(e,t))}}}mount(){this.removePointerDownListener=BF(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends PP{constructor(e){super(e),this.removeGroupControls=GE,this.removeListeners=GE,this.controls=new rB(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||GE}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:$L,MeasureLayout:lB}};function dB(e,t,r){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover","Start"===r);const a=n["onHover"+r];a&&wI.postRender(()=>a(t,FF(t)))}function uB(e,t,r){const{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap","Start"===r);const a=n["onTap"+("End"===r?"":r)];a&&wI.postRender(()=>a(t,FF(t)))}var hB=/* @__PURE__ */new WeakMap,pB=/* @__PURE__ */new WeakMap,mB=e=>{const t=hB.get(e.target);t&&t(e)},fB=e=>{e.forEach(mB)};function gB(e,t,r){const n=function({root:e,...t}){const r=e||document;pB.has(r)||pB.set(r,{});const n=pB.get(r),a=JSON.stringify(t);return n[a]||(n[a]=new IntersectionObserver(fB,{root:e,...t})),n[a]}(t);return hB.set(e,r),n.observe(e),()=>{hB.delete(e),n.unobserve(e)}}var vB={some:0,all:1};var yB=/*@__PURE__*/_F({...LF,...{inView:{Feature:class extends PP{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:n="some",once:a}=e,o={root:t?t.current:void 0,rootMargin:r,threshold:"number"==typeof n?n:vB[n]};this.stopObserver=gB(this.node.current,o,e=>{const{isIntersecting:t}=e;if(this.isInView===t)return;if(this.isInView=t,a&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:r,onViewportLeave:n}=this.node.getProps(),o=t?r:n;o&&o(e)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}},tap:{Feature:class extends PP{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:r}=this.node.props;this.unmount=nP(e,(e,t)=>(uB(this.node,t,"Start"),(e,{success:t})=>uB(this.node,e,t?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:!1===r?.tap})}unmount(){}}},focus:{Feature:class extends PP{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=WE(nL(this.node.current,"focus",()=>this.onFocus()),nL(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends PP{mount(){const{current:e}=this.node;e&&(this.unmount=W_(e,(e,t)=>(dB(this.node,t,"Start"),e=>dB(this.node,e,"End"))))}unmount(){}}}},...cB,...{layout:{ProjectionNode:$L,MeasureLayout:lB}}},PF),bB={type:"tween",ease:[.22,1,.36,1],duration:.5};function xB({percentage:e}){const t=24,r=10.75,n=2*Math.PI*r,a=n-e/100*n;/* @__PURE__ */
451
+ return ke("svg",{width:t,height:t,className:"-rotate-90 shrink-0",children:[/* @__PURE__ */Se("circle",{cx:12,cy:12,r:r,fill:"none",stroke:"var(--muted)",strokeWidth:2.5}),/* @__PURE__ */Se(yB.circle,{cx:12,cy:12,r:r,fill:"none",stroke:"var(--foreground)",strokeWidth:2.5,strokeDasharray:n,initial:{strokeDashoffset:n},animate:{strokeDashoffset:a},transition:{duration:.15,ease:"easeOut"},strokeLinecap:"round"})]})}function wB({headings:e,onNavigate:t,editorRef:r}){const[n,a]=ye(null),[o,i]=ye(null),[s,l]=ye(!1),[c,d]=ye(0),[u,h]=ye(44),p=ve(null);ue(()=>{const e=()=>{const e=document.querySelector(".toolbar");e&&h(e.getBoundingClientRect().bottom+6)};e();const t=document.querySelector(".toolbar");if(!t)return;const r=new ResizeObserver(e);return r.observe(t),()=>r.disconnect()},[]);const m=ge(()=>0===e.length?1:Math.min(...e.map(([,,e])=>parseInt(e[1],10))),[e]);if(ue(()=>{(()=>{if(!r?.current)return;const t=e[0]?.[0];if(!t)return;const n=r.current.getElementByKey(t);if(!n)return;let a=n.parentElement;for(;a;){const e=window.getComputedStyle(a);if("auto"===e.overflowY||"scroll"===e.overflowY)return void(p.current=a);a=a.parentElement}p.current=null})()},[e,r]),ue(()=>{if(0===e.length)return;const t=e=>r?.current?.getElementByKey(e)??null,n=()=>{const r=p.current,n=r?r.scrollTop:window.scrollY,o=r?r.clientHeight:window.innerHeight,i=(r?r.scrollHeight:document.documentElement.scrollHeight)-o;d(i>0?Math.min(100,Math.max(0,n/i*100)):0);const s=.3*o;let l=null;for(const[a]of e){const e=t(a);if(!e)continue;const n=e.getBoundingClientRect(),o=r?r.getBoundingClientRect().top:0;if(!(n.top-o<=s))break;l=a}!l&&e.length>0&&(l=e[0][0]),a(l)},o=p.current??window;return o.addEventListener("scroll",n,{passive:!0}),n(),()=>o.removeEventListener("scroll",n)},[e,r]),0===e.length)return null;const f=e.find(([e])=>e===n)?.[1]??"Contents";/* @__PURE__ */
452
+ return ke(we,{children:[/* @__PURE__ */Se(JL,{children:s&&/* @__PURE__ */Se(yB.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:bB,className:"fixed inset-0 z-[9998] bg-black/20 backdrop-blur-[4px]",onClick:()=>l(!1)})}),/* @__PURE__ */Se(yB.div,{initial:{y:-50,opacity:0},animate:{y:0,opacity:1},transition:{type:"spring",stiffness:300,damping:25},style:{top:u},className:"fixed left-1/2 z-[9999] flex -translate-x-1/2 flex-col items-center",children:/* @__PURE__ */ke(yB.div,{onClick:()=>{s||l(!0)},initial:!1,animate:{width:s?340:280,height:s?400:52,borderRadius:s?24:26},transition:bB,style:{cursor:s?"default":"pointer"},className:"relative overflow-hidden border border-foreground/10 bg-background text-foreground shadow-2xl",children:[/* @__PURE__ */ke(yB.div,{initial:!1,animate:{opacity:s?0:1,scale:s?.95:1,filter:s?"blur(4px)":"blur(0px)"},transition:{...bB,delay:s?0:.1},className:tc("absolute inset-0 flex items-center gap-4 px-4 sm:px-5",s&&"pointer-events-none"),children:[
454
453
  /* @__PURE__ */Se("div",{className:"h-2 w-2 shrink-0 rounded-full bg-foreground"}),
455
- /* @__PURE__ */Se("div",{className:"relative flex h-full flex-1 items-center overflow-hidden text-left",children:/* @__PURE__ */Se(ZL,{mode:"popLayout",initial:!1,children:/* @__PURE__ */Se(vB.span,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},exit:{opacity:0,y:-15},transition:{duration:.35,ease:[.16,1,.3,1]},className:"block w-full overflow-hidden text-ellipsis whitespace-nowrap text-sm font-medium text-foreground",children:f},n??"empty")})}),
456
- /* @__PURE__ */Se(bB,{percentage:c})]}),/* @__PURE__ */ke(vB.div,{initial:!1,animate:{opacity:s?1:0,scale:s?1:1.05},transition:{...yB,delay:s?.1:0},className:tc("absolute inset-0 flex flex-col",!s&&"pointer-events-none"),children:[/* @__PURE__ */ke("div",{className:"flex shrink-0 items-center justify-between px-6 pb-3 pt-5",children:[/* @__PURE__ */Se("span",{className:"text-[11px] font-semibold tracking-[0.08em] text-muted-foreground",children:"TABLE OF CONTENTS"}),/* @__PURE__ */Se("button",{onClick:e=>{e.stopPropagation(),l(!1)},className:"text-muted-foreground transition-colors hover:text-foreground",children:/* @__PURE__ */Se(mt,{className:"h-5 w-5"})})]}),/* @__PURE__ */Se("div",{className:"flex-1 overflow-y-auto px-3 pb-4",children:/* @__PURE__ */Se("div",{className:"flex flex-col gap-0.5",children:e.map(([e,r,a])=>{const s=parseInt(a[1],10),c=n===e,d=o===e,u=14*Math.max(0,s-m)+12;/* @__PURE__ */
457
- return ke("button",{onMouseEnter:()=>i(e),onMouseLeave:()=>i(null),onClick:r=>{r.stopPropagation(),t(e),l(!1)},style:{paddingLeft:`${u}px`},className:tc("group flex w-full shrink-0 cursor-pointer items-center rounded-lg border-none py-2 pr-3 text-left text-sm transition-all duration-300 ease-out",c&&"bg-foreground/10 font-medium text-foreground",!c&&d&&"bg-foreground/5 text-foreground/85",!c&&!d&&"bg-transparent text-foreground/45"),children:[/* @__PURE__ */Se("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap transition-transform duration-300 group-hover:translate-x-1",children:r}),/* @__PURE__ */Se(vB.div,{initial:!1,animate:{scale:c?1:0,opacity:c?1:0},transition:{duration:.3,ease:"easeOut"},className:"ml-3 h-1.5 w-1.5 shrink-0 rounded-full bg-foreground"})]},e)})})})]})]})})]})}var wB="undefined"==typeof window?{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},key:()=>null,length:0}:window.localStorage;var SB=({state:e,onRequestAccess:t,onOpenChange:r,onSignIn:n})=>{const a="denied"===e.status||"not-found"===e.status||"sign-in-required"===e.status;/* @__PURE__ */
458
- return Se(IM,{open:a,onOpenChange:r,children:/* @__PURE__ */ke(_M,{className:"sm:max-w-md",children:["denied"===e.status&&/* @__PURE__ */ke(we,{children:[/* @__PURE__ */ke(PM,{children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Ge,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */Se(LM,{children:"You don't have access to this document"})]}),/* @__PURE__ */Se(FM,{children:"Ask the owner for access — they'll get a one-time email letting them know you'd like to view it."})]}),/* @__PURE__ */ke(OM,{children:[/* @__PURE__ */Se(ic,{variant:"outline",onClick:()=>r(!1),children:"Close"}),/* @__PURE__ */Se(ic,{onClick:t,disabled:e.accessRequested||e.requesting,children:e.accessRequested?/* @__PURE__ */ke(we,{children:[/* @__PURE__ */Se(Ne,{className:"h-4 w-4"}),"Request sent"]}):/* @__PURE__ */ke(we,{children:[/* @__PURE__ */Se(Ke,{className:"h-4 w-4"}),e.requesting?"Sending…":"Request access"]})})]})]}),"sign-in-required"===e.status&&/* @__PURE__ */ke(we,{children:[/* @__PURE__ */ke(PM,{children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Ge,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */Se(LM,{children:"Sign in to open this document"})]}),/* @__PURE__ */Se(FM,{children:"This document belongs to someone else. Sign in so we know who to request access for."})]}),/* @__PURE__ */ke(OM,{children:[/* @__PURE__ */Se(ic,{variant:"outline",onClick:()=>r(!1),children:"Close"}),n&&/* @__PURE__ */Se(ic,{onClick:n,children:"Sign in"})]})]}),"not-found"===e.status&&/* @__PURE__ */ke(we,{children:[/* @__PURE__ */ke(PM,{children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(He,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */Se(LM,{children:"Document not found"})]}),/* @__PURE__ */Se(FM,{children:"This link doesn't point to a document that exists anymore."})]}),/* @__PURE__ */Se(OM,{children:/* @__PURE__ */Se(ic,{onClick:()=>r(!1),children:"Close"})})]})]})})},kB=({SidebarComponent:e,SidebarContentComponent:t,mainContent:r,belowMainContent:n,openFilesSidebarSignal:a,editorEngine:o,extraTabs:i,activeExtraTabId:s,onExtraTabSelect:l,onExtraTabClose:c,onExtraTabsClose:d,onExtraTabAdd:u,onFileTabSelect:h,initialDocId:p,onActiveDocumentChange:m,onGenerateTips:f,onGenerateTopics:g,onSearchTopic:v,onSignIn:y})=>{const{theme:b,setTheme:x}=bD(),w=EE(a),[S,k]=ye(void 0),[C,N]=ye([]),[T,A]=ye(!1),[M,D]=ye([]),[E,I]=ye(!1),R=ve(!1);ue(()=>{!R.current&&p&&w.documents.some(e=>e.id===p)&&(R.current=!0,p!==w.activeDocId&&w.handleSelectDocument(p))},[p,w.documents,w.activeDocId,w.handleSelectDocument]);const{state:z,requestAccess:_,dismiss:P}=function(e,t,r){const[n,a]=ye({status:"idle"}),o=ve(t);o.current=t;const i=ve(r);i.current=r;const s=ve(null);return ue(()=>{if(!e||o.current.some(t=>t.id===e))return void a({status:"idle"});if(s.current===e)return;s.current=e;let t=!1;return a({status:"loading"}),(async()=>{try{const r=await fetch(`/api/doc/documents/${e}`,{credentials:"include"});if(t)return;if(r.ok){const e=await r.json();return i.current({id:e.id.toString(),title:e.title||e.name||"Untitled",content:e.content||"",parentId:e.parentId?e.parentId.toString():null,children:[],isExpanded:1===e.isExpanded,isFolder:1===e.isFolder,tags:e.metadata&&JSON.parse(e.metadata).tags||[]}),void a({status:"idle"})}if(401===r.status)return void a({status:"sign-in-required"});if(403===r.status){const e=await r.json().catch(()=>({}));return void a({status:"denied",accessRequested:Boolean(e?.accessRequested),requesting:!1})}if(404===r.status)return void a({status:"not-found"});a({status:"error"})}catch{t||a({status:"error"})}})(),()=>{t=!0}},[e]),{state:n,requestAccess:ce(async()=>{if(e){a(e=>"denied"===e.status?{...e,requesting:!0}:e);try{const t=await fetch(`/api/doc/documents/${e}/access-request`,{method:"POST",credentials:"include"});t.ok||409===t.status?a({status:"denied",accessRequested:!0,requesting:!1}):a(e=>"denied"===e.status?{...e,requesting:!1}:e)}catch{a(e=>"denied"===e.status?{...e,requesting:!1}:e)}}},[e]),dismiss:ce(()=>a({status:"idle"}),[])}}(p??null,w.documents,e=>{w.setDocuments(t=>t.some(t=>t.id===e.id)?t:[...t,e])});ue(()=>{m?.(w.activeDocId)},[w.activeDocId,m]),ue(()=>{N([]),D([])},[w.activeDocId]);const O=f?{tips:C,isTipsLoading:T,onGenerateTips:async()=>{if(f&&w.activeDocument){A(!0);try{const e=await f(w.activeDocument.title,w.activeDocument.content||"");N(e)}catch{N([])}finally{A(!1)}}}}:void 0,L=g?{topics:M,isTopicsLoading:E,onGenerateTopics:async()=>{if(g&&w.activeDocument){I(!0);try{const e=await g(w.activeDocument.title,w.activeDocument.content||"");D(e)}catch{D([])}finally{I(!1)}}},onSearchTopic:v}:void 0,[F,B]=function(e){const{key:t,storage:r=localStorage,debounce:n=300}=e,[a,o]=ye(()=>{try{const e=r.getItem(t);return e?JSON.parse(e):[]}catch{return[]}});return ue(()=>{if(0===a.length)return;const e=setTimeout(()=>{try{r.setItem(t,JSON.stringify(a))}catch(e){}},n);return()=>clearTimeout(e)},[a,t,r,n]),[a,o]}({key:"reason-docs-sidebar",storage:wB}),V=ge(()=>{const e=w.openTabs.map(e=>({id:e,title:w.documents.find(t=>t.id===e)?.title||"Untitled",kind:"file"})),t=(i??[]).map(e=>({id:e.id,title:e.title,kind:e.kind}));return[...e,...t]},[w.openTabs,w.documents,i]),$=s??w.activeDocId,H=e=>{i?.some(t=>t.id===e)?l?.(e):(w.handleTabChange(e),h?.())},j=e=>{i?.some(t=>t.id===e)?c?.(e):w.handleTabClose(e)},q=e=>{const t=e.filter(e=>i?.some(t=>t.id===e)),r=e.filter(e=>!t.includes(e));r.length>0&&w.handleTabsClose(r),t.length>0&&(d?d(t):t.forEach(e=>c?.(e)))},U=(e,t)=>{w.handleAddDocument(e,t),t||h?.()},G=e=>{w.handleSelectDocument(e),h?.()},W={documents:w.documents,activeId:w.activeDocId,activeDocument:w.activeDocument,onSelect:G,onAdd:U,onDelete:w.handleDeleteDocument,onDuplicate:w.handleDuplicateDocument,onToggleExpand:w.handleToggleExpand,onSetExpandedFolders:w.handleSetExpandedFolders,onMove:w.handleMoveDocument,onManageTags:w.handleManageTags,onRename:(e,t)=>w.handleUpdateDocument(e,{title:t}),searchQuery:w.searchQuery,onSearchChange:w.setSearchQuery,onSearchClear:()=>w.setSearchQuery(""),onSearchFocus:()=>w.setIsSearchModalOpen(!0),isOpen:w.isSidebarOpen,onOpenChange:w.setIsSidebarOpen,isMobile:w.isMobile,leftPanels:w.leftPanels,onLeftPanelsChange:w.setLeftPanels,rightPanels:w.rightPanels,onRightPanelsChange:w.setRightPanels,onSettingsClick:e=>{k(e),w.setIsSettingsOpen(!0)},onInviteClick:()=>w.setIsInviteModalOpen(!0),onRestore:w.handleRestoreDocument,onPermanentDelete:w.handlePermanentDelete,newDocumentId:w.newDocumentId,showDynamicIsland:w.showDynamicIsland,onToggleDynamicIsland:()=>w.setShowDynamicIsland(!w.showDynamicIsland),activeFileSourceId:w.activeFileSourceId,onFileSourceChange:w.handleFileSourceChange,onNavigate:e=>w.editorRef.current?.scrollToHeading(e),editorRef:w.editorRef,openTabs:w.openTabs,activeTab:$,onTabChange:H,onTabClose:j,onTabsClose:q,onTabRename:(e,t)=>w.handleUpdateDocument(e,{title:t}),onSplitRight:w.handleSplitRight,onReopenLastClosed:w.handleReopenLastClosed,canReopenLastClosed:w.closedTabsHistory.length>0,tabItems:V,onNewChat:u,aiProps:{isAiLoading:w.isAiLoading,aiSuggestion:w.aiSuggestion,onAiApprove:w.handleAIApprove,onAiReject:w.handleAIReject,onAiRegenerate:w.handleAIRegenerate},tipsProps:O,topicsProps:L},K={activeDocument:w.activeDocument,engine:o,documents:w.documents,splitViewDocId:w.splitViewDocId,activeDocId:w.activeDocId,isMobile:w.isMobile,editorRef:w.editorRef,onUpdateDocument:w.handleUpdateDocument,onHeadingsChange:w.setHeadings,onCloseSplitView:()=>w.setSplitViewDocId(null),aiSuggestion:w.aiSuggestion,isAiLoading:w.isAiLoading,onAiRewrite:w.handleAIRewrite,onAiApprove:w.handleAIApprove,onAiReject:w.handleAIReject,onAiRegenerate:w.handleAIRegenerate,onInviteClick:()=>w.setIsInviteModalOpen(!0),onShareClick:()=>w.setIsInviteModalOpen(!0)},Y=w.rightPanels.length>0&&/* @__PURE__ */Se(EM,{panels:w.rightPanels,documents:w.documents,activeId:w.activeDocId,activeDocument:w.activeDocument,onSelect:G,onAdd:U,onDelete:w.handleDeleteDocument,onDuplicate:w.handleDuplicateDocument,onSetExpandedFolders:w.handleSetExpandedFolders,onMove:w.handleMoveDocument,onManageTags:w.handleManageTags,onRename:(e,t)=>w.handleUpdateDocument(e,{title:t}),headings:w.headings,onNavigate:e=>w.editorRef.current?.scrollToHeading(e),editorRef:w.editorRef,openTabs:w.openTabs,activeTab:$,onTabChange:H,onTabClose:j,onTabsClose:q,onTabRename:(e,t)=>w.handleUpdateDocument(e,{title:t}),onSplitRight:w.handleSplitRight,onReopenLastClosed:w.handleReopenLastClosed,canReopenLastClosed:w.closedTabsHistory.length>0,tabItems:V,onNewChat:u,aiProps:{isAiLoading:w.isAiLoading,aiSuggestion:w.aiSuggestion,onAiApprove:w.handleAIApprove,onAiReject:w.handleAIReject,onAiRegenerate:w.handleAIRegenerate},tipsProps:O,topicsProps:L,onClose:()=>w.setRightPanels([]),isMobile:w.isMobile,isOpen:w.isRightSidebarOpen,onOpenChange:w.setIsRightSidebarOpen,SidebarContentComponent:t});/* @__PURE__ */
454
+ /* @__PURE__ */Se("div",{className:"relative flex h-full flex-1 items-center overflow-hidden text-left",children:/* @__PURE__ */Se(JL,{mode:"popLayout",initial:!1,children:/* @__PURE__ */Se(yB.span,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},exit:{opacity:0,y:-15},transition:{duration:.35,ease:[.16,1,.3,1]},className:"block w-full overflow-hidden text-ellipsis whitespace-nowrap text-sm font-medium text-foreground",children:f},n??"empty")})}),
455
+ /* @__PURE__ */Se(xB,{percentage:c})]}),/* @__PURE__ */ke(yB.div,{initial:!1,animate:{opacity:s?1:0,scale:s?1:1.05},transition:{...bB,delay:s?.1:0},className:tc("absolute inset-0 flex flex-col",!s&&"pointer-events-none"),children:[/* @__PURE__ */ke("div",{className:"flex shrink-0 items-center justify-between px-6 pb-3 pt-5",children:[/* @__PURE__ */Se("span",{className:"text-[11px] font-semibold tracking-[0.08em] text-muted-foreground",children:"TABLE OF CONTENTS"}),/* @__PURE__ */Se("button",{onClick:e=>{e.stopPropagation(),l(!1)},className:"text-muted-foreground transition-colors hover:text-foreground",children:/* @__PURE__ */Se(mt,{className:"h-5 w-5"})})]}),/* @__PURE__ */Se("div",{className:"flex-1 overflow-y-auto px-3 pb-4",children:/* @__PURE__ */Se("div",{className:"flex flex-col gap-0.5",children:e.map(([e,r,a])=>{const s=parseInt(a[1],10),c=n===e,d=o===e,u=14*Math.max(0,s-m)+12;/* @__PURE__ */
456
+ return ke("button",{onMouseEnter:()=>i(e),onMouseLeave:()=>i(null),onClick:r=>{r.stopPropagation(),t(e),l(!1)},style:{paddingLeft:`${u}px`},className:tc("group flex w-full shrink-0 cursor-pointer items-center rounded-lg border-none py-2 pr-3 text-left text-sm transition-all duration-300 ease-out",c&&"bg-foreground/10 font-medium text-foreground",!c&&d&&"bg-foreground/5 text-foreground/85",!c&&!d&&"bg-transparent text-foreground/45"),children:[/* @__PURE__ */Se("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap transition-transform duration-300 group-hover:translate-x-1",children:r}),/* @__PURE__ */Se(yB.div,{initial:!1,animate:{scale:c?1:0,opacity:c?1:0},transition:{duration:.3,ease:"easeOut"},className:"ml-3 h-1.5 w-1.5 shrink-0 rounded-full bg-foreground"})]},e)})})})]})]})})]})}var SB="undefined"==typeof window?{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},key:()=>null,length:0}:window.localStorage;var kB=({state:e,onRequestAccess:t,onOpenChange:r,onSignIn:n})=>{const a="denied"===e.status||"not-found"===e.status||"sign-in-required"===e.status;/* @__PURE__ */
457
+ return Se(IM,{open:a,onOpenChange:r,children:/* @__PURE__ */ke(_M,{className:"sm:max-w-md",children:["denied"===e.status&&/* @__PURE__ */ke(we,{children:[/* @__PURE__ */ke(PM,{children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Ge,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */Se(LM,{children:"You don't have access to this document"})]}),/* @__PURE__ */Se(FM,{children:"Ask the owner for access — they'll get a one-time email letting them know you'd like to view it."})]}),/* @__PURE__ */ke(OM,{children:[/* @__PURE__ */Se(ic,{variant:"outline",onClick:()=>r(!1),children:"Close"}),/* @__PURE__ */Se(ic,{onClick:t,disabled:e.accessRequested||e.requesting,children:e.accessRequested?/* @__PURE__ */ke(we,{children:[/* @__PURE__ */Se(Ne,{className:"h-4 w-4"}),"Request sent"]}):/* @__PURE__ */ke(we,{children:[/* @__PURE__ */Se(Ke,{className:"h-4 w-4"}),e.requesting?"Sending…":"Request access"]})})]})]}),"sign-in-required"===e.status&&/* @__PURE__ */ke(we,{children:[/* @__PURE__ */ke(PM,{children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(Ge,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */Se(LM,{children:"Sign in to open this document"})]}),/* @__PURE__ */Se(FM,{children:"This document belongs to someone else. Sign in so we know who to request access for."})]}),/* @__PURE__ */ke(OM,{children:[/* @__PURE__ */Se(ic,{variant:"outline",onClick:()=>r(!1),children:"Close"}),n&&/* @__PURE__ */Se(ic,{onClick:n,children:"Sign in"})]})]}),"not-found"===e.status&&/* @__PURE__ */ke(we,{children:[/* @__PURE__ */ke(PM,{children:[/* @__PURE__ */ke("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Se(He,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */Se(LM,{children:"Document not found"})]}),/* @__PURE__ */Se(FM,{children:"This link doesn't point to a document that exists anymore."})]}),/* @__PURE__ */Se(OM,{children:/* @__PURE__ */Se(ic,{onClick:()=>r(!1),children:"Close"})})]})]})})},CB=({SidebarComponent:e,SidebarContentComponent:t,mainContent:r,belowMainContent:n,openFilesSidebarSignal:a,editorEngine:o,extraTabs:i,activeExtraTabId:s,onExtraTabSelect:l,onExtraTabClose:c,onExtraTabsClose:d,onExtraTabAdd:u,onFileTabSelect:h,initialDocId:p,onActiveDocumentChange:m,onGenerateTips:f,onGenerateTopics:g,onSearchTopic:v,onSignIn:y})=>{const{theme:b,setTheme:x}=bD(),w=IE(a),[S,k]=ye(void 0),[C,N]=ye([]),[T,A]=ye(!1),[M,D]=ye([]),[E,I]=ye(!1),R=ve(!1);ue(()=>{!R.current&&p&&w.documents.some(e=>e.id===p)&&(R.current=!0,p!==w.activeDocId&&w.handleSelectDocument(p))},[p,w.documents,w.activeDocId,w.handleSelectDocument]);const{state:z,requestAccess:_,dismiss:P}=function(e,t,r){const[n,a]=ye({status:"idle"}),o=ve(t);o.current=t;const i=ve(r);i.current=r;const s=ve(null);return ue(()=>{if(!e||o.current.some(t=>t.id===e))return void a({status:"idle"});if(s.current===e)return;s.current=e;let t=!1;return a({status:"loading"}),(async()=>{try{const r=await fetch(`/api/doc/documents/${e}`,{credentials:"include"});if(t)return;if(r.ok){const e=await r.json();return i.current({id:e.id.toString(),title:e.title||e.name||"Untitled",content:e.content||"",parentId:e.parentId?e.parentId.toString():null,children:[],isExpanded:1===e.isExpanded,isFolder:1===e.isFolder,tags:e.metadata&&JSON.parse(e.metadata).tags||[]}),void a({status:"idle"})}if(401===r.status)return void a({status:"sign-in-required"});if(403===r.status){const e=await r.json().catch(()=>({}));return void a({status:"denied",accessRequested:Boolean(e?.accessRequested),requesting:!1})}if(404===r.status)return void a({status:"not-found"});a({status:"error"})}catch{t||a({status:"error"})}})(),()=>{t=!0}},[e]),{state:n,requestAccess:ce(async()=>{if(e){a(e=>"denied"===e.status?{...e,requesting:!0}:e);try{const t=await fetch(`/api/doc/documents/${e}/access-request`,{method:"POST",credentials:"include"});t.ok||409===t.status?a({status:"denied",accessRequested:!0,requesting:!1}):a(e=>"denied"===e.status?{...e,requesting:!1}:e)}catch{a(e=>"denied"===e.status?{...e,requesting:!1}:e)}}},[e]),dismiss:ce(()=>a({status:"idle"}),[])}}(p??null,w.documents,e=>{w.setDocuments(t=>t.some(t=>t.id===e.id)?t:[...t,e])});ue(()=>{m?.(w.activeDocId)},[w.activeDocId,m]),ue(()=>{N([]),D([])},[w.activeDocId]);const O=f?{tips:C,isTipsLoading:T,onGenerateTips:async()=>{if(f&&w.activeDocument){A(!0);try{const e=await f(w.activeDocument.title,w.activeDocument.content||"");N(e)}catch{N([])}finally{A(!1)}}}}:void 0,L=g?{topics:M,isTopicsLoading:E,onGenerateTopics:async()=>{if(g&&w.activeDocument){I(!0);try{const e=await g(w.activeDocument.title,w.activeDocument.content||"");D(e)}catch{D([])}finally{I(!1)}}},onSearchTopic:v}:void 0,[F,B]=function(e){const{key:t,storage:r=localStorage,debounce:n=300}=e,[a,o]=ye(()=>{try{const e=r.getItem(t);return e?JSON.parse(e):[]}catch{return[]}});return ue(()=>{if(0===a.length)return;const e=setTimeout(()=>{try{r.setItem(t,JSON.stringify(a))}catch(e){}},n);return()=>clearTimeout(e)},[a,t,r,n]),[a,o]}({key:"reason-docs-sidebar",storage:SB}),V=ge(()=>{const e=w.openTabs.map(e=>({id:e,title:w.documents.find(t=>t.id===e)?.title||"Untitled",kind:"file"})),t=(i??[]).map(e=>({id:e.id,title:e.title,kind:e.kind}));return[...e,...t]},[w.openTabs,w.documents,i]),$=s??w.activeDocId,H=e=>{i?.some(t=>t.id===e)?l?.(e):(w.handleTabChange(e),h?.())},j=e=>{i?.some(t=>t.id===e)?c?.(e):w.handleTabClose(e)},q=e=>{const t=e.filter(e=>i?.some(t=>t.id===e)),r=e.filter(e=>!t.includes(e));r.length>0&&w.handleTabsClose(r),t.length>0&&(d?d(t):t.forEach(e=>c?.(e)))},U=(e,t)=>{w.handleAddDocument(e,t),t||h?.()},G=e=>{w.handleSelectDocument(e),h?.()},W={documents:w.documents,activeId:w.activeDocId,activeDocument:w.activeDocument,onSelect:G,onAdd:U,onDelete:w.handleDeleteDocument,onDuplicate:w.handleDuplicateDocument,onToggleExpand:w.handleToggleExpand,onSetExpandedFolders:w.handleSetExpandedFolders,onMove:w.handleMoveDocument,onManageTags:w.handleManageTags,onRename:(e,t)=>w.handleUpdateDocument(e,{title:t}),searchQuery:w.searchQuery,onSearchChange:w.setSearchQuery,onSearchClear:()=>w.setSearchQuery(""),onSearchFocus:()=>w.setIsSearchModalOpen(!0),isOpen:w.isSidebarOpen,onOpenChange:w.setIsSidebarOpen,isMobile:w.isMobile,leftPanels:w.leftPanels,onLeftPanelsChange:w.setLeftPanels,rightPanels:w.rightPanels,onRightPanelsChange:w.setRightPanels,onSettingsClick:e=>{k(e),w.setIsSettingsOpen(!0)},onInviteClick:()=>w.setIsInviteModalOpen(!0),onRestore:w.handleRestoreDocument,onPermanentDelete:w.handlePermanentDelete,newDocumentId:w.newDocumentId,showDynamicIsland:w.showDynamicIsland,onToggleDynamicIsland:()=>w.setShowDynamicIsland(!w.showDynamicIsland),activeFileSourceId:w.activeFileSourceId,onFileSourceChange:w.handleFileSourceChange,onNavigate:e=>w.editorRef.current?.scrollToHeading(e),editorRef:w.editorRef,openTabs:w.openTabs,activeTab:$,onTabChange:H,onTabClose:j,onTabsClose:q,onTabRename:(e,t)=>w.handleUpdateDocument(e,{title:t}),onSplitRight:w.handleSplitRight,onReopenLastClosed:w.handleReopenLastClosed,canReopenLastClosed:w.closedTabsHistory.length>0,tabItems:V,onNewChat:u,aiProps:{isAiLoading:w.isAiLoading,aiSuggestion:w.aiSuggestion,onAiApprove:w.handleAIApprove,onAiReject:w.handleAIReject,onAiRegenerate:w.handleAIRegenerate},tipsProps:O,topicsProps:L},K={activeDocument:w.activeDocument,engine:o,documents:w.documents,splitViewDocId:w.splitViewDocId,activeDocId:w.activeDocId,isMobile:w.isMobile,editorRef:w.editorRef,onUpdateDocument:w.handleUpdateDocument,onHeadingsChange:w.setHeadings,onCloseSplitView:()=>w.setSplitViewDocId(null),aiSuggestion:w.aiSuggestion,isAiLoading:w.isAiLoading,onAiRewrite:w.handleAIRewrite,onAiApprove:w.handleAIApprove,onAiReject:w.handleAIReject,onAiRegenerate:w.handleAIRegenerate,onInviteClick:()=>w.setIsInviteModalOpen(!0),onShareClick:()=>w.setIsInviteModalOpen(!0)},Y=w.rightPanels.length>0&&/* @__PURE__ */Se(EM,{panels:w.rightPanels,documents:w.documents,activeId:w.activeDocId,activeDocument:w.activeDocument,onSelect:G,onAdd:U,onDelete:w.handleDeleteDocument,onDuplicate:w.handleDuplicateDocument,onSetExpandedFolders:w.handleSetExpandedFolders,onMove:w.handleMoveDocument,onManageTags:w.handleManageTags,onRename:(e,t)=>w.handleUpdateDocument(e,{title:t}),headings:w.headings,onNavigate:e=>w.editorRef.current?.scrollToHeading(e),editorRef:w.editorRef,openTabs:w.openTabs,activeTab:$,onTabChange:H,onTabClose:j,onTabsClose:q,onTabRename:(e,t)=>w.handleUpdateDocument(e,{title:t}),onSplitRight:w.handleSplitRight,onReopenLastClosed:w.handleReopenLastClosed,canReopenLastClosed:w.closedTabsHistory.length>0,tabItems:V,onNewChat:u,aiProps:{isAiLoading:w.isAiLoading,aiSuggestion:w.aiSuggestion,onAiApprove:w.handleAIApprove,onAiReject:w.handleAIReject,onAiRegenerate:w.handleAIRegenerate},tipsProps:O,topicsProps:L,onClose:()=>w.setRightPanels([]),isMobile:w.isMobile,isOpen:w.isRightSidebarOpen,onOpenChange:w.setIsRightSidebarOpen,SidebarContentComponent:t});/* @__PURE__ */
459
458
  return ke("div",{className:"h-screen w-screen flex flex-col overflow-hidden",children:[w.isMobile?/* @__PURE__ */ke("div",{className:"flex-1 flex flex-col overflow-hidden",children:[/* @__PURE__ */ke("div",{className:"flex items-center justify-between h-10 px-1 border-b border-sidebar-border/60 shrink-0",children:[/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:()=>w.setIsSidebarOpen(!0),"aria-label":"Open sidebar",children:/* @__PURE__ */Se(Ye,{className:"h-5 w-5"})}),w.rightPanels.length>0&&/* @__PURE__ */Se(ic,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:()=>w.setIsRightSidebarOpen(!0),"aria-label":"Open right panel",children:/* @__PURE__ */Se(tt,{className:"h-5 w-5"})})]}),/* @__PURE__ */ke("div",{className:"flex-1 flex overflow-hidden",children:[
460
459
  /* @__PURE__ */Se(e,{...W,headings:w.headings}),
461
- /* @__PURE__ */ke("main",{className:"flex-1 overflow-hidden flex flex-col",children:[/* @__PURE__ */Se("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:r??/* @__PURE__ */Se(_c,{...K})}),n&&/* @__PURE__ */Se("div",{className:"shrink-0 px-2 pt-1 pb-[60px] sm:pb-2 sm:pr-56",children:n})]}),Y]})]}):/* @__PURE__ */Se("div",{className:"flex-1 overflow-hidden",children:/* @__PURE__ */ke(Rc,{direction:"horizontal",onResize:B,children:[/* @__PURE__ */Se(wc,{size:F?.[0]||"250px",minSize:"0px",maxSize:"600px",children:/* @__PURE__ */Se("div",{className:"overflow-y-auto overflow-x-hidden bg-background",children:/* @__PURE__ */Se(e,{...W,headings:w.headings})})}),/* @__PURE__ */Se(wc,{children:/* @__PURE__ */ke("div",{className:"h-screen flex flex-col bg-background",children:[/* @__PURE__ */ke("div",{className:"flex-1 flex min-h-0",children:[/* @__PURE__ */Se("div",{className:"flex-1 min-h-0 overflow-auto",children:r??/* @__PURE__ */Se(_c,{...K})}),Y]}),n&&/* @__PURE__ */Se("div",{className:"shrink-0 px-2 pb-2",children:n})]})})]})}),w.headings.length>0&&0===w.rightPanels.length&&w.showDynamicIsland&&/* @__PURE__ */Se(xB,{headings:w.headings,onNavigate:e=>w.editorRef.current?.scrollToHeading(e),editorRef:w.editorRef}),
462
- /* @__PURE__ */Se(AE,{isSearchModalOpen:w.isSearchModalOpen,setIsSearchModalOpen:w.setIsSearchModalOpen,isSettingsOpen:w.isSettingsOpen,setIsSettingsOpen:w.setIsSettingsOpen,settingsInitialSection:S,isTeamsOpen:w.isTeamsOpen,setIsTeamsOpen:w.setIsTeamsOpen,isInviteModalOpen:w.isInviteModalOpen,setIsInviteModalOpen:w.setIsInviteModalOpen,isTagDialogOpen:w.isTagDialogOpen,setIsTagDialogOpen:w.setIsTagDialogOpen,documents:w.documents,activeDocument:w.activeDocument,tagManagementDocId:w.tagManagementDocId,defaultSidebarView:w.defaultSidebarView,setDefaultSidebarView:w.setDefaultSidebarView,enableDatabaseSync:w.enableDatabaseSync,setEnableDatabaseSync:w.setEnableDatabaseSync,setDocuments:w.setDocuments,onSelectDocument:G,onToggleTheme:()=>{x("dark"===b?"light":"dark")},currentTheme:b,onUpdateTags:w.handleUpdateTags}),
463
- /* @__PURE__ */Se(SB,{state:z,onRequestAccess:_,onOpenChange:e=>{e||P()},onSignIn:y})]})};export{kB as t};
460
+ /* @__PURE__ */ke("main",{className:"flex-1 overflow-hidden flex flex-col",children:[/* @__PURE__ */Se("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:r??/* @__PURE__ */Se(_c,{...K})}),n&&/* @__PURE__ */Se("div",{className:"shrink-0 px-2 pt-1 pb-[60px] sm:pb-2 sm:pr-56",children:n})]}),Y]})]}):/* @__PURE__ */Se("div",{className:"flex-1 overflow-hidden",children:/* @__PURE__ */ke(Rc,{direction:"horizontal",onResize:B,children:[/* @__PURE__ */Se(wc,{size:F?.[0]||"250px",minSize:"0px",maxSize:"600px",children:/* @__PURE__ */Se("div",{className:"overflow-y-auto overflow-x-hidden bg-background",children:/* @__PURE__ */Se(e,{...W,headings:w.headings})})}),/* @__PURE__ */Se(wc,{children:/* @__PURE__ */ke("div",{className:"h-screen flex flex-col bg-background",children:[/* @__PURE__ */ke("div",{className:"flex-1 flex min-h-0",children:[/* @__PURE__ */Se("div",{className:"flex-1 min-h-0 overflow-auto",children:r??/* @__PURE__ */Se(_c,{...K})}),Y]}),n&&/* @__PURE__ */Se("div",{className:"shrink-0 px-2 pb-2",children:n})]})})]})}),w.headings.length>0&&0===w.rightPanels.length&&w.showDynamicIsland&&/* @__PURE__ */Se(wB,{headings:w.headings,onNavigate:e=>w.editorRef.current?.scrollToHeading(e),editorRef:w.editorRef}),
461
+ /* @__PURE__ */Se(ME,{isSearchModalOpen:w.isSearchModalOpen,setIsSearchModalOpen:w.setIsSearchModalOpen,isSettingsOpen:w.isSettingsOpen,setIsSettingsOpen:w.setIsSettingsOpen,settingsInitialSection:S,isTeamsOpen:w.isTeamsOpen,setIsTeamsOpen:w.setIsTeamsOpen,isInviteModalOpen:w.isInviteModalOpen,setIsInviteModalOpen:w.setIsInviteModalOpen,isTagDialogOpen:w.isTagDialogOpen,setIsTagDialogOpen:w.setIsTagDialogOpen,documents:w.documents,activeDocument:w.activeDocument,tagManagementDocId:w.tagManagementDocId,defaultSidebarView:w.defaultSidebarView,setDefaultSidebarView:w.setDefaultSidebarView,enableDatabaseSync:w.enableDatabaseSync,setEnableDatabaseSync:w.setEnableDatabaseSync,setDocuments:w.setDocuments,onSelectDocument:G,onToggleTheme:()=>{x("dark"===b?"light":"dark")},currentTheme:b,onUpdateTags:w.handleUpdateTags}),
462
+ /* @__PURE__ */Se(kB,{state:z,onRequestAccess:_,onOpenChange:e=>{e||P()},onSignIn:y})]})};export{CB as t};