d1s 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/.next/.next/BUILD_ID +1 -1
- package/dist/.next/.next/app-build-manifest.json +27 -27
- package/dist/.next/.next/app-path-routes-manifest.json +1 -1
- package/dist/.next/.next/build-manifest.json +2 -2
- package/dist/.next/.next/cache/.tsbuildinfo +1 -1
- package/dist/.next/.next/cache/webpack/client-production/0.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/12.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/2.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/3.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/4.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/5.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/6.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/7.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/8.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/index.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/dist/.next/.next/cache/webpack/server-production/0.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/1.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/2.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/3.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/index.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/index.pack.old +0 -0
- package/dist/.next/.next/next-minimal-server.js.nft.json +1 -1
- package/dist/.next/.next/next-server.js.nft.json +1 -1
- package/dist/.next/.next/prerender-manifest.json +1 -1
- package/dist/.next/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/_not-found.html +1 -1
- package/dist/.next/.next/server/app/_not-found.rsc +1 -1
- package/dist/.next/.next/server/app/api/cloudflare/route.js +1 -1
- package/dist/.next/.next/server/app/api/cloudflare/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/databases/route.js +1 -1
- package/dist/.next/.next/server/app/api/databases/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/migrations/list/route.js +1 -1
- package/dist/.next/.next/server/app/api/migrations/list/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/migrations/sync/route.js +1 -1
- package/dist/.next/.next/server/app/api/migrations/sync/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/migrations/sync-files/route.js +1 -1
- package/dist/.next/.next/server/app/api/migrations/sync-files/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/pro/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/pull-data/confirm/route.js +1 -1
- package/dist/.next/.next/server/app/api/pull-data/confirm/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/pull-remote/confirm/route.js +1 -1
- package/dist/.next/.next/server/app/api/pull-remote/confirm/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/pull-remote/preview/route.js +1 -1
- package/dist/.next/.next/server/app/api/pull-remote/preview/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/push-remote/confirm/route.js +1 -1
- package/dist/.next/.next/server/app/api/push-remote/confirm/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/push-remote/preview/route.js +1 -1
- package/dist/.next/.next/server/app/api/push-remote/preview/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/query/route.js +1 -1
- package/dist/.next/.next/server/app/api/query/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/schema/route.js +1 -1
- package/dist/.next/.next/server/app/api/schema/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/tables/[name]/import/route.js +1 -1
- package/dist/.next/.next/server/app/api/tables/[name]/import/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/tables/[name]/route.js +1 -1
- package/dist/.next/.next/server/app/api/tables/[name]/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/tables/route.js +1 -1
- package/dist/.next/.next/server/app/api/tables/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/time-travel/preview/route.js +1 -1
- package/dist/.next/.next/server/app/api/time-travel/preview/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/time-travel/restore/route.js +1 -1
- package/dist/.next/.next/server/app/api/time-travel/restore/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/update/route.js +1 -1
- package/dist/.next/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/index.html +2 -2
- package/dist/.next/.next/server/app/index.rsc +2 -2
- package/dist/.next/.next/server/app/page.js +2 -2
- package/dist/.next/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app-paths-manifest.json +5 -5
- package/dist/.next/.next/server/chunks/391.js +1 -1
- package/dist/.next/.next/server/chunks/572.js +1 -1
- package/dist/.next/.next/server/chunks/992.js +2 -2
- package/dist/.next/.next/server/pages/404.html +1 -1
- package/dist/.next/.next/server/pages/500.html +1 -1
- package/dist/.next/.next/server/pages-manifest.json +1 -1
- package/dist/.next/.next/static/ZmKZbpam0G_d3SphfZPJ7/_buildManifest.js +1 -0
- package/dist/.next/.next/static/ZmKZbpam0G_d3SphfZPJ7/_ssgManifest.js +1 -0
- package/dist/.next/.next/static/chunks/app/page-3ec9d72ecb052d39.js +1 -0
- package/dist/.next/.next/static/f_PVCmmSeM5SwW3M1tw7Q/_buildManifest.js +1 -0
- package/dist/.next/.next/static/f_PVCmmSeM5SwW3M1tw7Q/_ssgManifest.js +1 -0
- package/dist/.next/.next/static/v-i2YsOGT890zutOSiqqK/_buildManifest.js +1 -0
- package/dist/.next/.next/static/v-i2YsOGT890zutOSiqqK/_ssgManifest.js +1 -0
- package/dist/.next/.next/trace +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var e={};e.id=974,e.ids=[974],e.modules={846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},9121:e=>{"use strict";e.exports=require("next/dist/server/app-render/action-async-storage.external.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},3873:e=>{"use strict";e.exports=require("path")},7185:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GlobalError:()=>o.a,__next_app__:()=>u,pages:()=>d,routeModule:()=>f,tree:()=>c});var n=r(260),a=r(8203),l=r(5155),o=r.n(l),s=r(7292),i={};for(let e in s)0>["default","tree","pages","GlobalError","__next_app__","routeModule"].indexOf(e)&&(i[e]=()=>s[e]);r.d(t,i);let c=["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(r.bind(r,8868)),"/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx"]}]},{layout:[()=>Promise.resolve().then(r.bind(r,8180)),"/Volumes/ProjectSpace/_wip/d1studio/src/app/layout.jsx"],"not-found":[()=>Promise.resolve().then(r.t.bind(r,9937,23)),"next/dist/client/components/not-found-error"],forbidden:[()=>Promise.resolve().then(r.t.bind(r,9116,23)),"next/dist/client/components/forbidden-error"],unauthorized:[()=>Promise.resolve().then(r.t.bind(r,1485,23)),"next/dist/client/components/unauthorized-error"]}],d=["/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx"],u={require:r,loadChunk:()=>Promise.resolve()},f=new n.AppPageRouteModule({definition:{kind:a.RouteKind.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:c}})},7048:(e,t,r)=>{Promise.resolve().then(r.bind(r,8868))},6776:(e,t,r)=>{Promise.resolve().then(r.bind(r,7098))},6256:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let n=r(5488)._(r(568));function a(e,t){var r;let a={};"function"==typeof e&&(a.loader=e);let l={...a,...t};return(0,n.default)({...l,modules:null==(r=l.loadableGenerated)?void 0:r.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3400:(e,t)=>{"use strict";function r(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"encodeURIPath",{enumerable:!0,get:function(){return r}})},5771:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return a}});let n=r(4639);function a(e){let{reason:t,children:r}=e;throw new n.BailoutToCSRError(t)}},568:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return c}});let n=r(5512),a=r(8009),l=r(5771),o=r(6054);function s(e){return{default:e&&"default"in e?e.default:e}}let i={loader:()=>Promise.resolve(s(()=>null)),loading:null,ssr:!0},c=function(e){let t={...i,...e},r=(0,a.lazy)(()=>t.loader().then(s)),c=t.loading;function d(e){let s=c?(0,n.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,i=!t.ssr||!!t.loading,d=i?a.Suspense:a.Fragment,u=t.ssr?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.PreloadChunks,{moduleIds:t.modules}),(0,n.jsx)(r,{...e})]}):(0,n.jsx)(l.BailoutToCSR,{reason:"next/dynamic",children:(0,n.jsx)(r,{...e})});return(0,n.jsx)(d,{...i?{fallback:s}:{},children:u})}return d.displayName="LoadableComponent",d}},6054:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return s}});let n=r(5512),a=r(5740),l=r(9294),o=r(3400);function s(e){let{moduleIds:t}=e,r=l.workAsyncStorage.getStore();if(void 0===r)return null;let s=[];if(r.reactLoadableManifest&&t){let e=r.reactLoadableManifest;for(let r of t){if(!e[r])continue;let t=e[r].files;s.push(...t)}}return 0===s.length?null:(0,n.jsx)(n.Fragment,{children:s.map(e=>{let t=r.assetPrefix+"/_next/"+(0,o.encodeURIPath)(e);return e.endsWith(".css")?(0,n.jsx)("link",{precedence:"dynamic",href:t,rel:"stylesheet",as:"style"},e):((0,a.preload)(t,{as:"script",fetchPriority:"low"}),null)})})}},7098:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>iO});var n,a,l=r(5512),o=r(8009),s=r.t(o,2),i=r.n(o);let c={rE:"0.3.0"};var d=r(4825);let u=(0,d.A)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),f=(0,d.A)("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]),m=(0,d.A)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),p=(0,d.A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),h=(0,d.A)("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]),x=(0,d.A)("ArrowUpFromLine",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]),g=(0,d.A)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),v=(0,d.A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),y=(0,d.A)("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),b=(0,d.A)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),w=(0,d.A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);var j=r(3603);let N=o.forwardRef(({className:e,type:t,...r},n)=>(0,l.jsx)("input",{type:t,className:(0,j.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...r}));N.displayName="Input";var C=r(1643);let k=(0,C.F)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),S=o.forwardRef(({className:e,variant:t,...r},n)=>(0,l.jsx)("div",{ref:n,role:"alert",className:(0,j.cn)(k({variant:t}),e),...r}));S.displayName="Alert",o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("h5",{ref:r,className:(0,j.cn)("mb-1 font-medium leading-none tracking-tight",e),...t})).displayName="AlertTitle";let R=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("div",{ref:r,className:(0,j.cn)("text-sm [&_p]:leading-relaxed",e),...t}));R.displayName="AlertDescription";var E=r(1412),T=r(9952),M=r(6004),A=r(643),D=r(830),_=r(9217),O=o.createContext(void 0);function P(e){let t=o.useContext(O);return e||t||"ltr"}var L=r(1675),I=0;function $(){o.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??F()),document.body.insertAdjacentElement("beforeend",e[1]??F()),I++,()=>{1===I&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),I--}},[])}function F(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var U=r(2828),z="focusScope.autoFocusOnMount",B="focusScope.autoFocusOnUnmount",H={bubbles:!1,cancelable:!0},W=o.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...i}=e,[c,d]=o.useState(null),u=(0,U.c)(a),f=(0,U.c)(s),m=o.useRef(null),p=(0,T.s)(t,e=>d(e)),h=o.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;o.useEffect(()=>{if(n){let e=function(e){if(h.paused||!c)return;let t=e.target;c.contains(t)?m.current=t:q(m.current,{select:!0})},t=function(e){if(h.paused||!c)return;let t=e.relatedTarget;null===t||c.contains(t)||q(m.current,{select:!0})};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&q(c)});return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[n,c,h.paused]),o.useEffect(()=>{if(c){G.add(h);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(z,H);c.addEventListener(z,u),c.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(q(n,{select:t}),document.activeElement!==r)return}(V(c).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&q(c))}return()=>{c.removeEventListener(z,u),setTimeout(()=>{let t=new CustomEvent(B,H);c.addEventListener(B,f),c.dispatchEvent(t),t.defaultPrevented||q(e??document.body,{select:!0}),c.removeEventListener(B,f),G.remove(h)},0)}}},[c,u,f,h]);let x=o.useCallback(e=>{if(!r&&!n||h.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){let t=e.currentTarget,[n,l]=function(e){let t=V(e);return[K(t,e),K(t.reverse(),e)]}(t);n&&l?e.shiftKey||a!==l?e.shiftKey&&a===n&&(e.preventDefault(),r&&q(l,{select:!0})):(e.preventDefault(),r&&q(n,{select:!0})):a===t&&e.preventDefault()}},[r,n,h.paused]);return(0,l.jsx)(D.sG.div,{tabIndex:-1,...i,ref:p,onKeyDown:x})});function V(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function K(e,t){for(let r of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(r,{upTo:t}))return r}function q(e,{select:t=!1}={}){if(e&&e.focus){var r;let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&(r=e)instanceof HTMLInputElement&&"select"in r&&t&&e.select()}}W.displayName="FocusScope";var G=function(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),(e=Y(e,t)).unshift(t)},remove(t){e=Y(e,t),e[0]?.resume()}}}();function Y(e,t){let r=[...e],n=r.indexOf(t);return -1!==n&&r.splice(n,1),r}var X=r(9397),Q=s["useId".toString()]||(()=>void 0),J=0;function Z(e){let[t,r]=o.useState(Q());return(0,X.N)(()=>{e||r(e=>e??String(J++))},[e]),e||(t?`radix-${t}`:"")}let ee=["top","right","bottom","left"],et=Math.min,er=Math.max,en=Math.round,ea=Math.floor,el=e=>({x:e,y:e}),eo={left:"right",right:"left",bottom:"top",top:"bottom"},es={start:"end",end:"start"};function ei(e,t){return"function"==typeof e?e(t):e}function ec(e){return e.split("-")[0]}function ed(e){return e.split("-")[1]}function eu(e){return"x"===e?"y":"x"}function ef(e){return"y"===e?"height":"width"}function em(e){return["top","bottom"].includes(ec(e))?"y":"x"}function ep(e){return e.replace(/start|end/g,e=>es[e])}function eh(e){return e.replace(/left|right|bottom|top/g,e=>eo[e])}function ex(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function eg(e){let{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function ev(e,t,r){let n,{reference:a,floating:l}=e,o=em(t),s=eu(em(t)),i=ef(s),c=ec(t),d="y"===o,u=a.x+a.width/2-l.width/2,f=a.y+a.height/2-l.height/2,m=a[i]/2-l[i]/2;switch(c){case"top":n={x:u,y:a.y-l.height};break;case"bottom":n={x:u,y:a.y+a.height};break;case"right":n={x:a.x+a.width,y:f};break;case"left":n={x:a.x-l.width,y:f};break;default:n={x:a.x,y:a.y}}switch(ed(t)){case"start":n[s]-=m*(r&&d?-1:1);break;case"end":n[s]+=m*(r&&d?-1:1)}return n}let ey=async(e,t,r)=>{let{placement:n="bottom",strategy:a="absolute",middleware:l=[],platform:o}=r,s=l.filter(Boolean),i=await (null==o.isRTL?void 0:o.isRTL(t)),c=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=ev(c,n,i),f=n,m={},p=0;for(let r=0;r<s.length;r++){let{name:l,fn:h}=s[r],{x:x,y:g,data:v,reset:y}=await h({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:m,rects:c,platform:o,elements:{reference:e,floating:t}});d=null!=x?x:d,u=null!=g?g:u,m={...m,[l]:{...m[l],...v}},y&&p<=50&&(p++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(c=!0===y.rects?await o.getElementRects({reference:e,floating:t,strategy:a}):y.rects),{x:d,y:u}=ev(c,f,i)),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:m}};async function eb(e,t){var r;void 0===t&&(t={});let{x:n,y:a,platform:l,rects:o,elements:s,strategy:i}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:m=0}=ei(t,e),p=ex(m),h=s[f?"floating"===u?"reference":"floating":u],x=eg(await l.getClippingRect({element:null==(r=await (null==l.isElement?void 0:l.isElement(h)))||r?h:h.contextElement||await (null==l.getDocumentElement?void 0:l.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:i})),g="floating"===u?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,v=await (null==l.getOffsetParent?void 0:l.getOffsetParent(s.floating)),y=await (null==l.isElement?void 0:l.isElement(v))&&await (null==l.getScale?void 0:l.getScale(v))||{x:1,y:1},b=eg(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:g,offsetParent:v,strategy:i}):g);return{top:(x.top-b.top+p.top)/y.y,bottom:(b.bottom-x.bottom+p.bottom)/y.y,left:(x.left-b.left+p.left)/y.x,right:(b.right-x.right+p.right)/y.x}}function ew(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ej(e){return ee.some(t=>e[t]>=0)}async function eN(e,t){let{placement:r,platform:n,elements:a}=e,l=await (null==n.isRTL?void 0:n.isRTL(a.floating)),o=ec(r),s=ed(r),i="y"===em(r),c=["left","top"].includes(o)?-1:1,d=l&&i?-1:1,u=ei(t,e),{mainAxis:f,crossAxis:m,alignmentAxis:p}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof p&&(m="end"===s?-1*p:p),i?{x:m*d,y:f*c}:{x:f*c,y:m*d}}function eC(){return"undefined"!=typeof window}function ek(e){return eE(e)?(e.nodeName||"").toLowerCase():"#document"}function eS(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function eR(e){var t;return null==(t=(eE(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function eE(e){return!!eC()&&(e instanceof Node||e instanceof eS(e).Node)}function eT(e){return!!eC()&&(e instanceof Element||e instanceof eS(e).Element)}function eM(e){return!!eC()&&(e instanceof HTMLElement||e instanceof eS(e).HTMLElement)}function eA(e){return!!eC()&&"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof eS(e).ShadowRoot)}function eD(e){let{overflow:t,overflowX:r,overflowY:n,display:a}=eI(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(a)}function e_(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch(e){return!1}})}function eO(e){let t=eP(),r=eT(e)?eI(e):e;return["transform","translate","scale","rotate","perspective"].some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||["transform","translate","scale","rotate","perspective","filter"].some(e=>(r.willChange||"").includes(e))||["paint","layout","strict","content"].some(e=>(r.contain||"").includes(e))}function eP(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}function eL(e){return["html","body","#document"].includes(ek(e))}function eI(e){return eS(e).getComputedStyle(e)}function e$(e){return eT(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function eF(e){if("html"===ek(e))return e;let t=e.assignedSlot||e.parentNode||eA(e)&&e.host||eR(e);return eA(t)?t.host:t}function eU(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let a=function e(t){let r=eF(t);return eL(r)?t.ownerDocument?t.ownerDocument.body:t.body:eM(r)&&eD(r)?r:e(r)}(e),l=a===(null==(n=e.ownerDocument)?void 0:n.body),o=eS(a);if(l){let e=ez(o);return t.concat(o,o.visualViewport||[],eD(a)?a:[],e&&r?eU(e):[])}return t.concat(a,eU(a,[],r))}function ez(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function eB(e){let t=eI(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,a=eM(e),l=a?e.offsetWidth:r,o=a?e.offsetHeight:n,s=en(r)!==l||en(n)!==o;return s&&(r=l,n=o),{width:r,height:n,$:s}}function eH(e){return eT(e)?e:e.contextElement}function eW(e){let t=eH(e);if(!eM(t))return el(1);let r=t.getBoundingClientRect(),{width:n,height:a,$:l}=eB(t),o=(l?en(r.width):r.width)/n,s=(l?en(r.height):r.height)/a;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}let eV=el(0);function eK(e){let t=eS(e);return eP()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:eV}function eq(e,t,r,n){var a;void 0===t&&(t=!1),void 0===r&&(r=!1);let l=e.getBoundingClientRect(),o=eH(e),s=el(1);t&&(n?eT(n)&&(s=eW(n)):s=eW(e));let i=(void 0===(a=r)&&(a=!1),n&&(!a||n===eS(o))&&a)?eK(o):el(0),c=(l.left+i.x)/s.x,d=(l.top+i.y)/s.y,u=l.width/s.x,f=l.height/s.y;if(o){let e=eS(o),t=n&&eT(n)?eS(n):n,r=e,a=ez(r);for(;a&&n&&t!==r;){let e=eW(a),t=a.getBoundingClientRect(),n=eI(a),l=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,d*=e.y,u*=e.x,f*=e.y,c+=l,d+=o,a=ez(r=eS(a))}}return eg({width:u,height:f,x:c,y:d})}function eG(e,t){let r=e$(e).scrollLeft;return t?t.left+r:eq(eR(e)).left+r}function eY(e,t,r){void 0===r&&(r=!1);let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-(r?0:eG(e,n)),y:n.top+t.scrollTop}}function eX(e,t,r){let n;if("viewport"===t)n=function(e,t){let r=eS(e),n=eR(e),a=r.visualViewport,l=n.clientWidth,o=n.clientHeight,s=0,i=0;if(a){l=a.width,o=a.height;let e=eP();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,i=a.offsetTop)}return{width:l,height:o,x:s,y:i}}(e,r);else if("document"===t)n=function(e){let t=eR(e),r=e$(e),n=e.ownerDocument.body,a=er(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),l=er(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight),o=-r.scrollLeft+eG(e),s=-r.scrollTop;return"rtl"===eI(n).direction&&(o+=er(t.clientWidth,n.clientWidth)-a),{width:a,height:l,x:o,y:s}}(eR(e));else if(eT(t))n=function(e,t){let r=eq(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,l=eM(e)?eW(e):el(1),o=e.clientWidth*l.x;return{width:o,height:e.clientHeight*l.y,x:a*l.x,y:n*l.y}}(t,r);else{let r=eK(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return eg(n)}function eQ(e){return"static"===eI(e).position}function eJ(e,t){if(!eM(e)||"fixed"===eI(e).position)return null;if(t)return t(e);let r=e.offsetParent;return eR(e)===r&&(r=r.ownerDocument.body),r}function eZ(e,t){let r=eS(e);if(e_(e))return r;if(!eM(e)){let t=eF(e);for(;t&&!eL(t);){if(eT(t)&&!eQ(t))return t;t=eF(t)}return r}let n=eJ(e,t);for(;n&&["table","td","th"].includes(ek(n))&&eQ(n);)n=eJ(n,t);return n&&eL(n)&&eQ(n)&&!eO(n)?r:n||function(e){let t=eF(e);for(;eM(t)&&!eL(t);){if(eO(t))return t;if(e_(t))break;t=eF(t)}return null}(e)||r}let e0=async function(e){let t=this.getOffsetParent||eZ,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=eM(t),a=eR(t),l="fixed"===r,o=eq(e,!0,l,t),s={scrollLeft:0,scrollTop:0},i=el(0);if(n||!n&&!l){if(("body"!==ek(t)||eD(a))&&(s=e$(t)),n){let e=eq(t,!0,l,t);i.x=e.x+t.clientLeft,i.y=e.y+t.clientTop}else a&&(i.x=eG(a))}let c=!a||n||l?el(0):eY(a,s);return{x:o.left+s.scrollLeft-i.x-c.x,y:o.top+s.scrollTop-i.y-c.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},e1={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e,l="fixed"===a,o=eR(n),s=!!t&&e_(t.floating);if(n===o||s&&l)return r;let i={scrollLeft:0,scrollTop:0},c=el(1),d=el(0),u=eM(n);if((u||!u&&!l)&&(("body"!==ek(n)||eD(o))&&(i=e$(n)),eM(n))){let e=eq(n);c=eW(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}let f=!o||u||l?el(0):eY(o,i,!0);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-i.scrollLeft*c.x+d.x+f.x,y:r.y*c.y-i.scrollTop*c.y+d.y+f.y}},getDocumentElement:eR,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e,l=[..."clippingAncestors"===r?e_(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=eU(e,[],!1).filter(e=>eT(e)&&"body"!==ek(e)),a=null,l="fixed"===eI(e).position,o=l?eF(e):e;for(;eT(o)&&!eL(o);){let t=eI(o),r=eO(o);r||"fixed"!==t.position||(a=null),(l?!r&&!a:!r&&"static"===t.position&&!!a&&["absolute","fixed"].includes(a.position)||eD(o)&&!r&&function e(t,r){let n=eF(t);return!(n===r||!eT(n)||eL(n))&&("fixed"===eI(n).position||e(n,r))}(e,o))?n=n.filter(e=>e!==o):a=t,o=eF(o)}return t.set(e,n),n}(t,this._c):[].concat(r),n],o=l[0],s=l.reduce((e,r)=>{let n=eX(t,r,a);return e.top=er(n.top,e.top),e.right=et(n.right,e.right),e.bottom=et(n.bottom,e.bottom),e.left=er(n.left,e.left),e},eX(t,o,a));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:eZ,getElementRects:e0,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=eB(e);return{width:t,height:r}},getScale:eW,isElement:eT,isRTL:function(e){return"rtl"===eI(e).direction}};function e2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let e5=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:a,rects:l,platform:o,elements:s,middlewareData:i}=t,{element:c,padding:d=0}=ei(e,t)||{};if(null==c)return{};let u=ex(d),f={x:r,y:n},m=eu(em(a)),p=ef(m),h=await o.getDimensions(c),x="y"===m,g=x?"clientHeight":"clientWidth",v=l.reference[p]+l.reference[m]-f[m]-l.floating[p],y=f[m]-l.reference[m],b=await (null==o.getOffsetParent?void 0:o.getOffsetParent(c)),w=b?b[g]:0;w&&await (null==o.isElement?void 0:o.isElement(b))||(w=s.floating[g]||l.floating[p]);let j=w/2-h[p]/2-1,N=et(u[x?"top":"left"],j),C=et(u[x?"bottom":"right"],j),k=w-h[p]-C,S=w/2-h[p]/2+(v/2-y/2),R=er(N,et(S,k)),E=!i.arrow&&null!=ed(a)&&S!==R&&l.reference[p]/2-(S<N?N:C)-h[p]/2<0,T=E?S<N?S-N:S-k:0;return{[m]:f[m]+T,data:{[m]:R,centerOffset:S-R-T,...E&&{alignmentOffset:T}},reset:E}}}),e4=(e,t,r)=>{let n=new Map,a={platform:e1,...r},l={...a.platform,_c:n};return ey(e,t,{...a,platform:l})};var e3=r(5740),e6="undefined"!=typeof document?o.useLayoutEffect:o.useEffect;function e8(e,t){let r,n,a;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n=r;0!=n--;)if(!e8(e[n],t[n]))return!1;return!0}if((r=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!({}).hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!=n--;){let r=a[n];if(("_owner"!==r||!e.$$typeof)&&!e8(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function e9(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function e7(e,t){let r=e9(e);return Math.round(t*r)/r}function te(e){let t=o.useRef(e);return e6(()=>{t.current=e}),t}let tt=e=>({name:"arrow",options:e,fn(t){let{element:r,padding:n}="function"==typeof e?e(t):e;return r&&({}).hasOwnProperty.call(r,"current")?null!=r.current?e5({element:r.current,padding:n}).fn(t):{}:r?e5({element:r,padding:n}).fn(t):{}}}),tr=(e,t)=>({...function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;let{x:a,y:l,placement:o,middlewareData:s}=t,i=await eN(t,e);return o===(null==(r=s.offset)?void 0:r.placement)&&null!=(n=s.arrow)&&n.alignmentOffset?{}:{x:a+i.x,y:l+i.y,data:{...i,placement:o}}}}}(e),options:[e,t]}),tn=(e,t)=>({...function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:r,y:n,placement:a}=t,{mainAxis:l=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...i}=ei(e,t),c={x:r,y:n},d=await eb(t,i),u=em(ec(a)),f=eu(u),m=c[f],p=c[u];if(l){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=m+d[e],n=m-d[t];m=er(r,et(m,n))}if(o){let e="y"===u?"top":"left",t="y"===u?"bottom":"right",r=p+d[e],n=p-d[t];p=er(r,et(p,n))}let h=s.fn({...t,[f]:m,[u]:p});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:l,[u]:o}}}}}}(e),options:[e,t]}),ta=(e,t)=>({...function(e){return void 0===e&&(e={}),{options:e,fn(t){let{x:r,y:n,placement:a,rects:l,middlewareData:o}=t,{offset:s=0,mainAxis:i=!0,crossAxis:c=!0}=ei(e,t),d={x:r,y:n},u=em(a),f=eu(u),m=d[f],p=d[u],h=ei(s,t),x="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(i){let e="y"===f?"height":"width",t=l.reference[f]-l.floating[e]+x.mainAxis,r=l.reference[f]+l.reference[e]-x.mainAxis;m<t?m=t:m>r&&(m=r)}if(c){var g,v;let e="y"===f?"width":"height",t=["top","left"].includes(ec(a)),r=l.reference[u]-l.floating[e]+(t&&(null==(g=o.offset)?void 0:g[u])||0)+(t?0:x.crossAxis),n=l.reference[u]+l.reference[e]+(t?0:(null==(v=o.offset)?void 0:v[u])||0)-(t?x.crossAxis:0);p<r?p=r:p>n&&(p=n)}return{[f]:m,[u]:p}}}}(e),options:[e,t]}),tl=(e,t)=>({...function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n,a,l,o;let{placement:s,middlewareData:i,rects:c,initialPlacement:d,platform:u,elements:f}=t,{mainAxis:m=!0,crossAxis:p=!0,fallbackPlacements:h,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...y}=ei(e,t);if(null!=(r=i.arrow)&&r.alignmentOffset)return{};let b=ec(s),w=em(d),j=ec(d)===d,N=await (null==u.isRTL?void 0:u.isRTL(f.floating)),C=h||(j||!v?[eh(d)]:function(e){let t=eh(e);return[ep(e),t,ep(t)]}(d)),k="none"!==g;!h&&k&&C.push(...function(e,t,r,n){let a=ed(e),l=function(e,t,r){let n=["left","right"],a=["right","left"];switch(e){case"top":case"bottom":if(r)return t?a:n;return t?n:a;case"left":case"right":return t?["top","bottom"]:["bottom","top"];default:return[]}}(ec(e),"start"===r,n);return a&&(l=l.map(e=>e+"-"+a),t&&(l=l.concat(l.map(ep)))),l}(d,v,g,N));let S=[d,...C],R=await eb(t,y),E=[],T=(null==(n=i.flip)?void 0:n.overflows)||[];if(m&&E.push(R[b]),p){let e=function(e,t,r){void 0===r&&(r=!1);let n=ed(e),a=eu(em(e)),l=ef(a),o="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[l]>t.floating[l]&&(o=eh(o)),[o,eh(o)]}(s,c,N);E.push(R[e[0]],R[e[1]])}if(T=[...T,{placement:s,overflows:E}],!E.every(e=>e<=0)){let e=((null==(a=i.flip)?void 0:a.index)||0)+1,t=S[e];if(t)return{data:{index:e,overflows:T},reset:{placement:t}};let r=null==(l=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:l.placement;if(!r)switch(x){case"bestFit":{let e=null==(o=T.filter(e=>{if(k){let t=em(e.placement);return t===w||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:o[0];e&&(r=e);break}case"initialPlacement":r=d}if(s!==r)return{reset:{placement:r}}}return{}}}}(e),options:[e,t]}),to=(e,t)=>({...function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;let a,l;let{placement:o,rects:s,platform:i,elements:c}=t,{apply:d=()=>{},...u}=ei(e,t),f=await eb(t,u),m=ec(o),p=ed(o),h="y"===em(o),{width:x,height:g}=s.floating;"top"===m||"bottom"===m?(a=m,l=p===(await (null==i.isRTL?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(l=m,a="end"===p?"top":"bottom");let v=g-f.top-f.bottom,y=x-f.left-f.right,b=et(g-f[a],v),w=et(x-f[l],y),j=!t.middlewareData.shift,N=b,C=w;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(C=y),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(N=v),j&&!p){let e=er(f.left,0),t=er(f.right,0),r=er(f.top,0),n=er(f.bottom,0);h?C=x-2*(0!==e||0!==t?e+t:er(f.left,f.right)):N=g-2*(0!==r||0!==n?r+n:er(f.top,f.bottom))}await d({...t,availableWidth:C,availableHeight:N});let k=await i.getDimensions(c.floating);return x!==k.width||g!==k.height?{reset:{rects:!0}}:{}}}}(e),options:[e,t]}),ts=(e,t)=>({...function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:r}=t,{strategy:n="referenceHidden",...a}=ei(e,t);switch(n){case"referenceHidden":{let e=ew(await eb(t,{...a,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ej(e)}}}case"escaped":{let e=ew(await eb(t,{...a,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:ej(e)}}}default:return{}}}}}(e),options:[e,t]}),ti=(e,t)=>({...tt(e),options:[e,t]});var tc=o.forwardRef((e,t)=>{let{children:r,width:n=10,height:a=5,...o}=e;return(0,l.jsx)(D.sG.svg,{...o,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:(0,l.jsx)("polygon",{points:"0,0 30,0 15,10"})})});function td(e){let[t,r]=o.useState(void 0);return(0,X.N)(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,a;if(!Array.isArray(t)||!t.length)return;let l=t[0];if("borderBoxSize"in l){let e=l.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,a=t.blockSize}else n=e.offsetWidth,a=e.offsetHeight;r({width:n,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}tc.displayName="Arrow";var tu="Popper",[tf,tm]=(0,M.A)(tu),[tp,th]=tf(tu),tx=e=>{let{__scopePopper:t,children:r}=e,[n,a]=o.useState(null);return(0,l.jsx)(tp,{scope:t,anchor:n,onAnchorChange:a,children:r})};tx.displayName=tu;var tg="PopperAnchor",tv=o.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:n,...a}=e,s=th(tg,r),i=o.useRef(null),c=(0,T.s)(t,i);return o.useEffect(()=>{s.onAnchorChange(n?.current||i.current)}),n?null:(0,l.jsx)(D.sG.div,{...a,ref:c})});tv.displayName=tg;var ty="PopperContent",[tb,tw]=tf(ty),tj=o.forwardRef((e,t)=>{let{__scopePopper:r,side:n="bottom",sideOffset:a=0,align:s="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:p=!1,updatePositionStrategy:h="optimized",onPlaced:x,...g}=e,v=th(ty,r),[y,b]=o.useState(null),w=(0,T.s)(t,e=>b(e)),[j,N]=o.useState(null),C=td(j),k=C?.width??0,S=C?.height??0,R="number"==typeof f?f:{top:0,right:0,bottom:0,left:0,...f},E=Array.isArray(u)?u:[u],M=E.length>0,A={padding:R,boundary:E.filter(tS),altBoundary:M},{refs:_,floatingStyles:O,placement:P,isPositioned:L,middlewareData:I}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:l,floating:s}={},transform:i=!0,whileElementsMounted:c,open:d}=e,[u,f]=o.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=o.useState(n);e8(m,n)||p(n);let[h,x]=o.useState(null),[g,v]=o.useState(null),y=o.useCallback(e=>{e!==N.current&&(N.current=e,x(e))},[]),b=o.useCallback(e=>{e!==C.current&&(C.current=e,v(e))},[]),w=l||h,j=s||g,N=o.useRef(null),C=o.useRef(null),k=o.useRef(u),S=null!=c,R=te(c),E=te(a),T=te(d),M=o.useCallback(()=>{if(!N.current||!C.current)return;let e={placement:t,strategy:r,middleware:m};E.current&&(e.platform=E.current),e4(N.current,C.current,e).then(e=>{let t={...e,isPositioned:!1!==T.current};A.current&&!e8(k.current,t)&&(k.current=t,e3.flushSync(()=>{f(t)}))})},[m,t,r,E,T]);e6(()=>{!1===d&&k.current.isPositioned&&(k.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[d]);let A=o.useRef(!1);e6(()=>(A.current=!0,()=>{A.current=!1}),[]),e6(()=>{if(w&&(N.current=w),j&&(C.current=j),w&&j){if(R.current)return R.current(w,j,M);M()}},[w,j,M,R,S]);let D=o.useMemo(()=>({reference:N,floating:C,setReference:y,setFloating:b}),[y,b]),_=o.useMemo(()=>({reference:w,floating:j}),[w,j]),O=o.useMemo(()=>{let e={position:r,left:0,top:0};if(!_.floating)return e;let t=e7(_.floating,u.x),n=e7(_.floating,u.y);return i?{...e,transform:"translate("+t+"px, "+n+"px)",...e9(_.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,i,_.floating,u.x,u.y]);return o.useMemo(()=>({...u,update:M,refs:D,elements:_,floatingStyles:O}),[u,M,D,_,O])}({strategy:"fixed",placement:n+("center"!==s?"-"+s:""),whileElementsMounted:(...e)=>(function(e,t,r,n){let a;void 0===n&&(n={});let{ancestorScroll:l=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,d=eH(e),u=l||o?[...d?eU(d):[],...eU(t)]:[];u.forEach(e=>{l&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});let f=d&&i?function(e,t){let r,n=null,a=eR(e);function l(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function o(s,i){void 0===s&&(s=!1),void 0===i&&(i=1),l();let c=e.getBoundingClientRect(),{left:d,top:u,width:f,height:m}=c;if(s||t(),!f||!m)return;let p=ea(u),h=ea(a.clientWidth-(d+f)),x={rootMargin:-p+"px "+-h+"px "+-ea(a.clientHeight-(u+m))+"px "+-ea(d)+"px",threshold:er(0,et(1,i))||1},g=!0;function v(t){let n=t[0].intersectionRatio;if(n!==i){if(!g)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||e2(c,e.getBoundingClientRect())||o(),g=!1}try{n=new IntersectionObserver(v,{...x,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(v,x)}n.observe(e)}(!0),l}(d,r):null,m=-1,p=null;s&&(p=new ResizeObserver(e=>{let[n]=e;n&&n.target===d&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),r()}),d&&!c&&p.observe(d),p.observe(t));let h=c?eq(e):null;return c&&function t(){let n=eq(e);h&&!e2(h,n)&&r(),h=n,a=requestAnimationFrame(t)}(),r(),()=>{var e;u.forEach(e=>{l&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==f||f(),null==(e=p)||e.disconnect(),p=null,c&&cancelAnimationFrame(a)}})(...e,{animationFrame:"always"===h}),elements:{reference:v.anchor},middleware:[tr({mainAxis:a+S,alignmentAxis:i}),d&&tn({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?ta():void 0,...A}),d&&tl({...A}),to({...A,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{let{width:a,height:l}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${a}px`),o.setProperty("--radix-popper-anchor-height",`${l}px`)}}),j&&ti({element:j,padding:c}),tR({arrowWidth:k,arrowHeight:S}),p&&ts({strategy:"referenceHidden",...A})]}),[$,F]=tE(P),z=(0,U.c)(x);(0,X.N)(()=>{L&&z?.()},[L,z]);let B=I.arrow?.x,H=I.arrow?.y,W=I.arrow?.centerOffset!==0,[V,K]=o.useState();return(0,X.N)(()=>{y&&K(window.getComputedStyle(y).zIndex)},[y]),(0,l.jsx)("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:L?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(" "),...I.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,l.jsx)(tb,{scope:r,placedSide:$,onArrowChange:N,arrowX:B,arrowY:H,shouldHideArrow:W,children:(0,l.jsx)(D.sG.div,{"data-side":$,"data-align":F,...g,ref:w,style:{...g.style,animation:L?void 0:"none"}})})})});tj.displayName=ty;var tN="PopperArrow",tC={top:"bottom",right:"left",bottom:"top",left:"right"},tk=o.forwardRef(function(e,t){let{__scopePopper:r,...n}=e,a=tw(tN,r),o=tC[a.placedSide];return(0,l.jsx)("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:(0,l.jsx)(tc,{...n,ref:t,style:{...n.style,display:"block"}})})});function tS(e){return null!==e}tk.displayName=tN;var tR=e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:a}=t,l=a.arrow?.centerOffset!==0,o=l?0:e.arrowWidth,s=l?0:e.arrowHeight,[i,c]=tE(r),d={start:"0%",center:"50%",end:"100%"}[c],u=(a.arrow?.x??0)+o/2,f=(a.arrow?.y??0)+s/2,m="",p="";return"bottom"===i?(m=l?d:`${u}px`,p=`${-s}px`):"top"===i?(m=l?d:`${u}px`,p=`${n.floating.height+s}px`):"right"===i?(m=`${-s}px`,p=l?d:`${f}px`):"left"===i&&(m=`${n.floating.width+s}px`,p=l?d:`${f}px`),{data:{x:m,y:p}}}});function tE(e){let[t,r="center"]=e.split("-");return[t,r]}var tT=r(707),tM=r(8060),tA="rovingFocusGroup.onEntryFocus",tD={bubbles:!1,cancelable:!0},t_="RovingFocusGroup",[tO,tP,tL]=(0,_.N)(t_),[tI,t$]=(0,M.A)(t_,[tL]),[tF,tU]=tI(t_),tz=o.forwardRef((e,t)=>(0,l.jsx)(tO.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,l.jsx)(tO.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,l.jsx)(tB,{...e,ref:t})})}));tz.displayName=t_;var tB=o.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...m}=e,p=o.useRef(null),h=(0,T.s)(t,p),x=P(s),[g=null,v]=(0,A.i)({prop:i,defaultProp:c,onChange:d}),[y,b]=o.useState(!1),w=(0,U.c)(u),j=tP(r),N=o.useRef(!1),[C,k]=o.useState(0);return o.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(tA,w),()=>e.removeEventListener(tA,w)},[w]),(0,l.jsx)(tF,{scope:r,orientation:n,dir:x,loop:a,currentTabStopId:g,onItemFocus:o.useCallback(e=>v(e),[v]),onItemShiftTab:o.useCallback(()=>b(!0),[]),onFocusableItemAdd:o.useCallback(()=>k(e=>e+1),[]),onFocusableItemRemove:o.useCallback(()=>k(e=>e-1),[]),children:(0,l.jsx)(D.sG.div,{tabIndex:y||0===C?-1:0,"data-orientation":n,...m,ref:h,style:{outline:"none",...e.style},onMouseDown:(0,E.m)(e.onMouseDown,()=>{N.current=!0}),onFocus:(0,E.m)(e.onFocus,e=>{let t=!N.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(tA,tD);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=j().filter(e=>e.focusable);tK([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),f)}}N.current=!1}),onBlur:(0,E.m)(e.onBlur,()=>b(!1))})})}),tH="RovingFocusGroupItem",tW=o.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:s,...i}=e,c=Z(),d=s||c,u=tU(tH,r),f=u.currentTabStopId===d,m=tP(r),{onFocusableItemAdd:p,onFocusableItemRemove:h}=u;return o.useEffect(()=>{if(n)return p(),()=>h()},[n,p,h]),(0,l.jsx)(tO.ItemSlot,{scope:r,id:d,focusable:n,active:a,children:(0,l.jsx)(D.sG.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...i,ref:t,onMouseDown:(0,E.m)(e.onMouseDown,e=>{n?u.onItemFocus(d):e.preventDefault()}),onFocus:(0,E.m)(e.onFocus,()=>u.onItemFocus(d)),onKeyDown:(0,E.m)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=function(e,t,r){var n;let a=(n=e.key,"rtl"!==r?n:"ArrowLeft"===n?"ArrowRight":"ArrowRight"===n?"ArrowLeft":n);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(a))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(a)))return tV[a]}(e,u.orientation,u.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=m().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();let n=r.indexOf(e.currentTarget);r=u.loop?function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(r,n+1):r.slice(n+1)}setTimeout(()=>tK(r))}})})})});tW.displayName=tH;var tV={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function tK(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}var tq=r(2705),tG=new WeakMap,tY=new WeakMap,tX={},tQ=0,tJ=function(e){return e&&(e.host||tJ(e.parentNode))},tZ=function(e,t,r,n){var a=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var r=tJ(e);return r&&t.contains(r)?r:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});tX[r]||(tX[r]=new WeakMap);var l=tX[r],o=[],s=new Set,i=new Set(a),c=function(e){!e||s.has(e)||(s.add(e),c(e.parentNode))};a.forEach(c);var d=function(e){!e||i.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,i=(tG.get(e)||0)+1,c=(l.get(e)||0)+1;tG.set(e,i),l.set(e,c),o.push(e),1===i&&a&&tY.set(e,!0),1===c&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),s.clear(),tQ++,function(){o.forEach(function(e){var t=tG.get(e)-1,a=l.get(e)-1;tG.set(e,t),l.set(e,a),t||(tY.has(e)||e.removeAttribute(n),tY.delete(e)),a||e.removeAttribute(r)}),--tQ||(tG=new WeakMap,tG=new WeakMap,tY=new WeakMap,tX={})}},t0=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n,a=Array.from(Array.isArray(e)?e:[e]),l=t||(n=e,"undefined"==typeof document?null:(Array.isArray(n)?n[0]:n).ownerDocument.body);return l?(a.push.apply(a,Array.from(l.querySelectorAll("[aria-live]"))),tZ(a,l,r,"aria-hidden")):function(){return null}},t1=function(){return(t1=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function t2(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)0>t.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}Object.create,Object.create;var t5=("function"==typeof SuppressedError&&SuppressedError,"right-scroll-bar-position"),t4="width-before-scroll-bar";function t3(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var t6="undefined"!=typeof window?o.useLayoutEffect:o.useEffect,t8=new WeakMap;function t9(e){return e}var t7=function(e){void 0===e&&(e={});var t,r,n,a=(void 0===t&&(t=t9),r=[],n=!1,{read:function(){if(n)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:null},useMedium:function(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var l=function(){var r=t;t=[],r.forEach(e)},o=function(){return Promise.resolve().then(l)};o(),r={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),r}}}});return a.options=t1({async:!0,ssr:!1},e),a}(),re=function(){},rt=o.forwardRef(function(e,t){var r,n,a,l,s=o.useRef(null),i=o.useState({onScrollCapture:re,onWheelCapture:re,onTouchMoveCapture:re}),c=i[0],d=i[1],u=e.forwardProps,f=e.children,m=e.className,p=e.removeScrollBar,h=e.enabled,x=e.shards,g=e.sideCar,v=e.noIsolation,y=e.inert,b=e.allowPinchZoom,w=e.as,j=e.gapMode,N=t2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=(r=[s,t],n=function(e){return r.forEach(function(t){return t3(t,e)})},(a=(0,o.useState)(function(){return{value:null,callback:n,facade:{get current(){return a.value},set current(value){var e=a.value;e!==value&&(a.value=value,a.callback(value,e))}}}})[0]).callback=n,l=a.facade,t6(function(){var e=t8.get(l);if(e){var t=new Set(e),n=new Set(r),a=l.current;t.forEach(function(e){n.has(e)||t3(e,null)}),n.forEach(function(e){t.has(e)||t3(e,a)})}t8.set(l,r)},[r]),l),k=t1(t1({},N),c);return o.createElement(o.Fragment,null,h&&o.createElement(g,{sideCar:t7,removeScrollBar:p,shards:x,noIsolation:v,inert:y,setCallbacks:d,allowPinchZoom:!!b,lockRef:s,gapMode:j}),u?o.cloneElement(o.Children.only(f),t1(t1({},k),{ref:C})):o.createElement(void 0===w?"div":w,t1({},k,{className:m,ref:C}),f))});rt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},rt.classNames={fullWidth:t4,zeroRight:t5};var rr=function(e){var t=e.sideCar,r=t2(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw Error("Sidecar medium not found");return o.createElement(n,t1({},r))};rr.isSideCarExport=!0;var rn=function(){var e=0,t=null;return{add:function(n){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=a||r.nc;return t&&e.setAttribute("nonce",t),e}())){var l,o;(l=t).styleSheet?l.styleSheet.cssText=n:l.appendChild(document.createTextNode(n)),o=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(o)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ra=function(){var e=rn();return function(t,r){o.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},rl=function(){var e=ra();return function(t){return e(t.styles,t.dynamic),null}},ro={left:0,top:0,right:0,gap:0},rs=function(e){return parseInt(e||"",10)||0},ri=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[rs(r),rs(n),rs(a)]},rc=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return ro;var t=ri(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},rd=rl(),ru="data-scroll-locked",rf=function(e,t,r,n){var a=e.left,l=e.top,o=e.right,s=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(s,"px ").concat(n,";\n }\n body[").concat(ru,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(l,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(t5," {\n right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(t4," {\n margin-right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(t5," .").concat(t5," {\n right: 0 ").concat(n,";\n }\n \n .").concat(t4," .").concat(t4," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(ru,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},rm=function(){var e=parseInt(document.body.getAttribute(ru)||"0",10);return isFinite(e)?e:0},rp=function(){o.useEffect(function(){return document.body.setAttribute(ru,(rm()+1).toString()),function(){var e=rm()-1;e<=0?document.body.removeAttribute(ru):document.body.setAttribute(ru,e.toString())}},[])},rh=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=void 0===n?"margin":n;rp();var l=o.useMemo(function(){return rc(a)},[a]);return o.createElement(rd,{styles:rf(l,!t,a,r?"":"!important")})},rx=!1;if("undefined"!=typeof window)try{var rg=Object.defineProperty({},"passive",{get:function(){return rx=!0,!0}});window.addEventListener("test",rg,rg),window.removeEventListener("test",rg,rg)}catch(e){rx=!1}var rv=!!rx&&{passive:!1},ry=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&"TEXTAREA"!==e.tagName&&"visible"===r[t])},rb=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),rw(e,n)){var a=rj(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},rw=function(e,t){return"v"===e?ry(t,"overflowY"):ry(t,"overflowX")},rj=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},rN=function(e,t,r,n,a){var l,o=(l=window.getComputedStyle(t).direction,"h"===e&&"rtl"===l?-1:1),s=o*n,i=r.target,c=t.contains(i),d=!1,u=s>0,f=0,m=0;do{var p=rj(e,i),h=p[0],x=p[1]-p[2]-o*h;(h||x)&&rw(e,i)&&(f+=x,m+=h),i instanceof ShadowRoot?i=i.host:i=i.parentNode}while(!c&&i!==document.body||c&&(t.contains(i)||t===i));return u&&(a&&1>Math.abs(f)||!a&&s>f)?d=!0:!u&&(a&&1>Math.abs(m)||!a&&-s>m)&&(d=!0),d},rC=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},rk=function(e){return[e.deltaX,e.deltaY]},rS=function(e){return e&&"current"in e?e.current:e},rR=0,rE=[];let rT=(n=function(e){var t=o.useRef([]),r=o.useRef([0,0]),n=o.useRef(),a=o.useState(rR++)[0],l=o.useState(rl)[0],s=o.useRef(e);o.useEffect(function(){s.current=e},[e]),o.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var t=(function(e,t,r){if(r||2==arguments.length)for(var n,a=0,l=t.length;a<l;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(rS),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var i=o.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var a,l=rC(e),o=r.current,i="deltaX"in e?e.deltaX:o[0]-l[0],c="deltaY"in e?e.deltaY:o[1]-l[1],d=e.target,u=Math.abs(i)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var f=rb(u,d);if(!f)return!0;if(f?a=u:(a="v"===u?"h":"v",f=rb(u,d)),!f)return!1;if(!n.current&&"changedTouches"in e&&(i||c)&&(n.current=a),!a)return!0;var m=n.current||a;return rN(m,t,e,"h"===m?i:c,!0)},[]),c=o.useCallback(function(e){if(rE.length&&rE[rE.length-1]===l){var r="deltaY"in e?rk(e):rC(e),n=t.current.filter(function(t){var n;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(n=t.delta)[0]===r[0]&&n[1]===r[1]})[0];if(n&&n.should){e.cancelable&&e.preventDefault();return}if(!n){var a=(s.current.shards||[]).map(rS).filter(Boolean).filter(function(t){return t.contains(e.target)});(a.length>0?i(e,a[0]):!s.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),d=o.useCallback(function(e,r,n,a){var l={name:e,delta:r,target:n,should:a,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(n)};t.current.push(l),setTimeout(function(){t.current=t.current.filter(function(e){return e!==l})},1)},[]),u=o.useCallback(function(e){r.current=rC(e),n.current=void 0},[]),f=o.useCallback(function(t){d(t.type,rk(t),t.target,i(t,e.lockRef.current))},[]),m=o.useCallback(function(t){d(t.type,rC(t),t.target,i(t,e.lockRef.current))},[]);o.useEffect(function(){return rE.push(l),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,rv),document.addEventListener("touchmove",c,rv),document.addEventListener("touchstart",u,rv),function(){rE=rE.filter(function(e){return e!==l}),document.removeEventListener("wheel",c,rv),document.removeEventListener("touchmove",c,rv),document.removeEventListener("touchstart",u,rv)}},[]);var p=e.removeScrollBar,h=e.inert;return o.createElement(o.Fragment,null,h?o.createElement(l,{styles:"\n .block-interactivity-".concat(a," {pointer-events: none;}\n .allow-interactivity-").concat(a," {pointer-events: all;}\n")}):null,p?o.createElement(rh,{gapMode:e.gapMode}):null)},t7.useMedium(n),rr);var rM=o.forwardRef(function(e,t){return o.createElement(rt,t1({},e,{ref:t,sideCar:rT}))});rM.classNames=rt.classNames;var rA=["Enter"," "],rD=["ArrowUp","PageDown","End"],r_=["ArrowDown","PageUp","Home",...rD],rO={ltr:[...rA,"ArrowRight"],rtl:[...rA,"ArrowLeft"]},rP={ltr:["ArrowLeft"],rtl:["ArrowRight"]},rL="Menu",[rI,r$,rF]=(0,_.N)(rL),[rU,rz]=(0,M.A)(rL,[rF,tm,t$]),rB=tm(),rH=t$(),[rW,rV]=rU(rL),[rK,rq]=rU(rL),rG=e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:a,onOpenChange:s,modal:i=!0}=e,c=rB(t),[d,u]=o.useState(null),f=o.useRef(!1),m=(0,U.c)(s),p=P(a);return o.useEffect(()=>{let e=()=>{f.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>f.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,l.jsx)(tx,{...c,children:(0,l.jsx)(rW,{scope:t,open:r,onOpenChange:m,content:d,onContentChange:u,children:(0,l.jsx)(rK,{scope:t,onClose:o.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:p,modal:i,children:n})})})};rG.displayName=rL;var rY=o.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,a=rB(r);return(0,l.jsx)(tv,{...a,...n,ref:t})});rY.displayName="MenuAnchor";var rX="MenuPortal",[rQ,rJ]=rU(rX,{forceMount:void 0}),rZ=e=>{let{__scopeMenu:t,forceMount:r,children:n,container:a}=e,o=rV(rX,t);return(0,l.jsx)(rQ,{scope:t,forceMount:r,children:(0,l.jsx)(tM.C,{present:r||o.open,children:(0,l.jsx)(tT.Z,{asChild:!0,container:a,children:n})})})};rZ.displayName=rX;var r0="MenuContent",[r1,r2]=rU(r0),r5=o.forwardRef((e,t)=>{let r=rJ(r0,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,o=rV(r0,e.__scopeMenu),s=rq(r0,e.__scopeMenu);return(0,l.jsx)(rI.Provider,{scope:e.__scopeMenu,children:(0,l.jsx)(tM.C,{present:n||o.open,children:(0,l.jsx)(rI.Slot,{scope:e.__scopeMenu,children:s.modal?(0,l.jsx)(r4,{...a,ref:t}):(0,l.jsx)(r3,{...a,ref:t})})})})}),r4=o.forwardRef((e,t)=>{let r=rV(r0,e.__scopeMenu),n=o.useRef(null),a=(0,T.s)(t,n);return o.useEffect(()=>{let e=n.current;if(e)return t0(e)},[]),(0,l.jsx)(r6,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:(0,E.m)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),r3=o.forwardRef((e,t)=>{let r=rV(r0,e.__scopeMenu);return(0,l.jsx)(r6,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),r6=o.forwardRef((e,t)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:p,onDismiss:h,disableOutsideScroll:x,...g}=e,v=rV(r0,r),y=rq(r0,r),b=rB(r),w=rH(r),j=r$(r),[N,C]=o.useState(null),k=o.useRef(null),S=(0,T.s)(t,k,v.onContentChange),R=o.useRef(0),M=o.useRef(""),A=o.useRef(0),D=o.useRef(null),_=o.useRef("right"),O=o.useRef(0),P=x?rM:o.Fragment,I=x?{as:tq.DX,allowPinchZoom:!0}:void 0,F=e=>{let t=M.current+e,r=j().filter(e=>!e.disabled),n=document.activeElement,a=r.find(e=>e.ref.current===n)?.textValue,l=function(e,t,r){var n;let a=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,l=(n=Math.max(r?e.indexOf(r):-1,0),e.map((t,r)=>e[(n+r)%e.length]));1===a.length&&(l=l.filter(e=>e!==r));let o=l.find(e=>e.toLowerCase().startsWith(a.toLowerCase()));return o!==r?o:void 0}(r.map(e=>e.textValue),t,a),o=r.find(e=>e.textValue===l)?.ref.current;(function e(t){M.current=t,window.clearTimeout(R.current),""!==t&&(R.current=window.setTimeout(()=>e(""),1e3))})(t),o&&setTimeout(()=>o.focus())};o.useEffect(()=>()=>window.clearTimeout(R.current),[]),$();let U=o.useCallback(e=>_.current===D.current?.side&&function(e,t){return!!t&&function(e,t){let{x:r,y:n}=e,a=!1;for(let e=0,l=t.length-1;e<t.length;l=e++){let o=t[e].x,s=t[e].y,i=t[l].x,c=t[l].y;s>n!=c>n&&r<(i-o)*(n-s)/(c-s)+o&&(a=!a)}return a}({x:e.clientX,y:e.clientY},t)}(e,D.current?.area),[]);return(0,l.jsx)(r1,{scope:r,searchRef:M,onItemEnter:o.useCallback(e=>{U(e)&&e.preventDefault()},[U]),onItemLeave:o.useCallback(e=>{U(e)||(k.current?.focus(),C(null))},[U]),onTriggerLeave:o.useCallback(e=>{U(e)&&e.preventDefault()},[U]),pointerGraceTimerRef:A,onPointerGraceIntentChange:o.useCallback(e=>{D.current=e},[]),children:(0,l.jsx)(P,{...I,children:(0,l.jsx)(W,{asChild:!0,trapped:a,onMountAutoFocus:(0,E.m)(s,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:(0,l.jsx)(L.qW,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:p,onDismiss:h,children:(0,l.jsx)(tz,{asChild:!0,...w,dir:y.dir,orientation:"vertical",loop:n,currentTabStopId:N,onCurrentTabStopIdChange:C,onEntryFocus:(0,E.m)(d,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,l.jsx)(tj,{role:"menu","aria-orientation":"vertical","data-state":nj(v.open),"data-radix-menu-content":"",dir:y.dir,...b,...g,ref:S,style:{outline:"none",...g.style},onKeyDown:(0,E.m)(g.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!r&&n&&F(e.key));let a=k.current;if(e.target!==a||!r_.includes(e.key))return;e.preventDefault();let l=j().filter(e=>!e.disabled).map(e=>e.ref.current);rD.includes(e.key)&&l.reverse(),function(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}(l)}),onBlur:(0,E.m)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(R.current),M.current="")}),onPointerMove:(0,E.m)(e.onPointerMove,nk(e=>{let t=e.target,r=O.current!==e.clientX;if(e.currentTarget.contains(t)&&r){let t=e.clientX>O.current?"right":"left";_.current=t,O.current=e.clientX}}))})})})})})})});r5.displayName=r0;var r8=o.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,l.jsx)(D.sG.div,{role:"group",...n,ref:t})});r8.displayName="MenuGroup";var r9=o.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,l.jsx)(D.sG.div,{...n,ref:t})});r9.displayName="MenuLabel";var r7="MenuItem",ne="menu.itemSelect",nt=o.forwardRef((e,t)=>{let{disabled:r=!1,onSelect:n,...a}=e,s=o.useRef(null),i=rq(r7,e.__scopeMenu),c=r2(r7,e.__scopeMenu),d=(0,T.s)(t,s),u=o.useRef(!1);return(0,l.jsx)(nr,{...a,ref:d,disabled:r,onClick:(0,E.m)(e.onClick,()=>{let e=s.current;if(!r&&e){let t=new CustomEvent(ne,{bubbles:!0,cancelable:!0});e.addEventListener(ne,e=>n?.(e),{once:!0}),(0,D.hO)(e,t),t.defaultPrevented?u.current=!1:i.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:(0,E.m)(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:(0,E.m)(e.onKeyDown,e=>{let t=""!==c.searchRef.current;!r&&(!t||" "!==e.key)&&rA.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});nt.displayName=r7;var nr=o.forwardRef((e,t)=>{let{__scopeMenu:r,disabled:n=!1,textValue:a,...s}=e,i=r2(r7,r),c=rH(r),d=o.useRef(null),u=(0,T.s)(t,d),[f,m]=o.useState(!1),[p,h]=o.useState("");return o.useEffect(()=>{let e=d.current;e&&h((e.textContent??"").trim())},[s.children]),(0,l.jsx)(rI.ItemSlot,{scope:r,disabled:n,textValue:a??p,children:(0,l.jsx)(tW,{asChild:!0,...c,focusable:!n,children:(0,l.jsx)(D.sG.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:u,onPointerMove:(0,E.m)(e.onPointerMove,nk(e=>{n?i.onItemLeave(e):(i.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,E.m)(e.onPointerLeave,nk(e=>i.onItemLeave(e))),onFocus:(0,E.m)(e.onFocus,()=>m(!0)),onBlur:(0,E.m)(e.onBlur,()=>m(!1))})})})}),nn=o.forwardRef((e,t)=>{let{checked:r=!1,onCheckedChange:n,...a}=e;return(0,l.jsx)(nu,{scope:e.__scopeMenu,checked:r,children:(0,l.jsx)(nt,{role:"menuitemcheckbox","aria-checked":nN(r)?"mixed":r,...a,ref:t,"data-state":nC(r),onSelect:(0,E.m)(a.onSelect,()=>n?.(!!nN(r)||!r),{checkForDefaultPrevented:!1})})})});nn.displayName="MenuCheckboxItem";var na="MenuRadioGroup",[nl,no]=rU(na,{value:void 0,onValueChange:()=>{}}),ns=o.forwardRef((e,t)=>{let{value:r,onValueChange:n,...a}=e,o=(0,U.c)(n);return(0,l.jsx)(nl,{scope:e.__scopeMenu,value:r,onValueChange:o,children:(0,l.jsx)(r8,{...a,ref:t})})});ns.displayName=na;var ni="MenuRadioItem",nc=o.forwardRef((e,t)=>{let{value:r,...n}=e,a=no(ni,e.__scopeMenu),o=r===a.value;return(0,l.jsx)(nu,{scope:e.__scopeMenu,checked:o,children:(0,l.jsx)(nt,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":nC(o),onSelect:(0,E.m)(n.onSelect,()=>a.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});nc.displayName=ni;var nd="MenuItemIndicator",[nu,nf]=rU(nd,{checked:!1}),nm=o.forwardRef((e,t)=>{let{__scopeMenu:r,forceMount:n,...a}=e,o=nf(nd,r);return(0,l.jsx)(tM.C,{present:n||nN(o.checked)||!0===o.checked,children:(0,l.jsx)(D.sG.span,{...a,ref:t,"data-state":nC(o.checked)})})});nm.displayName=nd;var np=o.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,l.jsx)(D.sG.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});np.displayName="MenuSeparator";var nh=o.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,a=rB(r);return(0,l.jsx)(tk,{...a,...n,ref:t})});nh.displayName="MenuArrow";var[nx,ng]=rU("MenuSub"),nv="MenuSubTrigger",ny=o.forwardRef((e,t)=>{let r=rV(nv,e.__scopeMenu),n=rq(nv,e.__scopeMenu),a=ng(nv,e.__scopeMenu),s=r2(nv,e.__scopeMenu),i=o.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=s,u={__scopeMenu:e.__scopeMenu},f=o.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return o.useEffect(()=>f,[f]),o.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),d(null)}},[c,d]),(0,l.jsx)(rY,{asChild:!0,...u,children:(0,l.jsx)(nr,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":a.contentId,"data-state":nj(r.open),...e,ref:(0,T.t)(t,a.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:(0,E.m)(e.onPointerMove,nk(t=>{s.onItemEnter(t),t.defaultPrevented||e.disabled||r.open||i.current||(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{r.onOpenChange(!0),f()},100))})),onPointerLeave:(0,E.m)(e.onPointerLeave,nk(e=>{f();let t=r.content?.getBoundingClientRect();if(t){let n=r.content?.dataset.side,a="right"===n,l=t[a?"left":"right"],o=t[a?"right":"left"];s.onPointerGraceIntentChange({area:[{x:e.clientX+(a?-5:5),y:e.clientY},{x:l,y:t.top},{x:o,y:t.top},{x:o,y:t.bottom},{x:l,y:t.bottom}],side:n}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(e),e.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:(0,E.m)(e.onKeyDown,t=>{let a=""!==s.searchRef.current;!e.disabled&&(!a||" "!==t.key)&&rO[n.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})});ny.displayName=nv;var nb="MenuSubContent",nw=o.forwardRef((e,t)=>{let r=rJ(r0,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,s=rV(r0,e.__scopeMenu),i=rq(r0,e.__scopeMenu),c=ng(nb,e.__scopeMenu),d=o.useRef(null),u=(0,T.s)(t,d);return(0,l.jsx)(rI.Provider,{scope:e.__scopeMenu,children:(0,l.jsx)(tM.C,{present:n||s.open,children:(0,l.jsx)(rI.Slot,{scope:e.__scopeMenu,children:(0,l.jsx)(r6,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:"start",side:"rtl"===i.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{i.isUsingKeyboardRef.current&&d.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,E.m)(e.onFocusOutside,e=>{e.target!==c.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:(0,E.m)(e.onEscapeKeyDown,e=>{i.onClose(),e.preventDefault()}),onKeyDown:(0,E.m)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=rP[i.dir].includes(e.key);t&&r&&(s.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});function nj(e){return e?"open":"closed"}function nN(e){return"indeterminate"===e}function nC(e){return nN(e)?"indeterminate":e?"checked":"unchecked"}function nk(e){return t=>"mouse"===t.pointerType?e(t):void 0}nw.displayName=nb;var nS="DropdownMenu",[nR,nE]=(0,M.A)(nS,[rz]),nT=rz(),[nM,nA]=nR(nS),nD=e=>{let{__scopeDropdownMenu:t,children:r,dir:n,open:a,defaultOpen:s,onOpenChange:i,modal:c=!0}=e,d=nT(t),u=o.useRef(null),[f=!1,m]=(0,A.i)({prop:a,defaultProp:s,onChange:i});return(0,l.jsx)(nM,{scope:t,triggerId:Z(),triggerRef:u,contentId:Z(),open:f,onOpenChange:m,onOpenToggle:o.useCallback(()=>m(e=>!e),[m]),modal:c,children:(0,l.jsx)(rG,{...d,open:f,onOpenChange:m,dir:n,modal:c,children:r})})};nD.displayName=nS;var n_="DropdownMenuTrigger",nO=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...a}=e,o=nA(n_,r),s=nT(r);return(0,l.jsx)(rY,{asChild:!0,...s,children:(0,l.jsx)(D.sG.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...a,ref:(0,T.t)(t,o.triggerRef),onPointerDown:(0,E.m)(e.onPointerDown,e=>{n||0!==e.button||!1!==e.ctrlKey||(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:(0,E.m)(e.onKeyDown,e=>{!n&&(["Enter"," "].includes(e.key)&&o.onOpenToggle(),"ArrowDown"===e.key&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});nO.displayName=n_;var nP=e=>{let{__scopeDropdownMenu:t,...r}=e,n=nT(t);return(0,l.jsx)(rZ,{...n,...r})};nP.displayName="DropdownMenuPortal";var nL="DropdownMenuContent",nI=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nA(nL,r),s=nT(r),i=o.useRef(!1);return(0,l.jsx)(r5,{id:a.contentId,"aria-labelledby":a.triggerId,...s,...n,ref:t,onCloseAutoFocus:(0,E.m)(e.onCloseAutoFocus,e=>{i.current||a.triggerRef.current?.focus(),i.current=!1,e.preventDefault()}),onInteractOutside:(0,E.m)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;(!a.modal||n)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});nI.displayName=nL,o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(r8,{...a,...n,ref:t})}).displayName="DropdownMenuGroup";var n$=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(r9,{...a,...n,ref:t})});n$.displayName="DropdownMenuLabel";var nF=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(nt,{...a,...n,ref:t})});nF.displayName="DropdownMenuItem";var nU=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(nn,{...a,...n,ref:t})});nU.displayName="DropdownMenuCheckboxItem",o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(ns,{...a,...n,ref:t})}).displayName="DropdownMenuRadioGroup";var nz=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(nc,{...a,...n,ref:t})});nz.displayName="DropdownMenuRadioItem";var nB=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(nm,{...a,...n,ref:t})});nB.displayName="DropdownMenuItemIndicator";var nH=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(np,{...a,...n,ref:t})});nH.displayName="DropdownMenuSeparator",o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(nh,{...a,...n,ref:t})}).displayName="DropdownMenuArrow";var nW=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(ny,{...a,...n,ref:t})});nW.displayName="DropdownMenuSubTrigger";var nV=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(nw,{...a,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});nV.displayName="DropdownMenuSubContent";let nK=(0,d.A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),nq=(0,d.A)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),nG=(0,d.A)("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);o.forwardRef(({className:e,inset:t,children:r,...n},a)=>(0,l.jsxs)(nW,{ref:a,className:(0,j.cn)("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...n,children:[r,(0,l.jsx)(nK,{className:"ml-auto"})]})).displayName=nW.displayName,o.forwardRef(({className:e,...t},r)=>(0,l.jsx)(nV,{ref:r,className:(0,j.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",e),...t})).displayName=nV.displayName;let nY=o.forwardRef(({className:e,sideOffset:t=4,...r},n)=>(0,l.jsx)(nP,{children:(0,l.jsx)(nI,{ref:n,sideOffset:t,className:(0,j.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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",e),...r})}));nY.displayName=nI.displayName;let nX=o.forwardRef(({className:e,inset:t,...r},n)=>(0,l.jsx)(nF,{ref:n,className:(0,j.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...r}));nX.displayName=nF.displayName,o.forwardRef(({className:e,children:t,checked:r,...n},a)=>(0,l.jsxs)(nU,{ref:a,className:(0,j.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[(0,l.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,l.jsx)(nB,{children:(0,l.jsx)(nq,{className:"h-4 w-4"})})}),t]})).displayName=nU.displayName,o.forwardRef(({className:e,children:t,...r},n)=>(0,l.jsxs)(nz,{ref:n,className:(0,j.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[(0,l.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,l.jsx)(nB,{children:(0,l.jsx)(nG,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=nz.displayName,o.forwardRef(({className:e,inset:t,...r},n)=>(0,l.jsx)(n$,{ref:n,className:(0,j.cn)("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r})).displayName=n$.displayName,o.forwardRef(({className:e,...t},r)=>(0,l.jsx)(nH,{ref:r,className:(0,j.cn)("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=nH.displayName;var nQ=r(2899);let nJ=(0,C.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),nZ=o.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...a},o)=>{let s=n?tq.DX:"button";return(0,l.jsx)(s,{className:(0,j.cn)(nJ({variant:t,size:r,className:e})),ref:o,...a})});function n0(e,[t,r]){return Math.min(r,Math.max(t,e))}nZ.displayName="Button";var n1="ScrollArea",[n2,n5]=(0,M.A)(n1),[n4,n3]=n2(n1),n6=o.forwardRef((e,t)=>{let{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:s=600,...i}=e,[c,d]=o.useState(null),[u,f]=o.useState(null),[m,p]=o.useState(null),[h,x]=o.useState(null),[g,v]=o.useState(null),[y,b]=o.useState(0),[w,j]=o.useState(0),[N,C]=o.useState(!1),[k,S]=o.useState(!1),R=(0,T.s)(t,e=>d(e)),E=P(a);return(0,l.jsx)(n4,{scope:r,type:n,dir:E,scrollHideDelay:s,scrollArea:c,viewport:u,onViewportChange:f,content:m,onContentChange:p,scrollbarX:h,onScrollbarXChange:x,scrollbarXEnabled:N,onScrollbarXEnabledChange:C,scrollbarY:g,onScrollbarYChange:v,scrollbarYEnabled:k,onScrollbarYEnabledChange:S,onCornerWidthChange:b,onCornerHeightChange:j,children:(0,l.jsx)(D.sG.div,{dir:E,...i,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});n6.displayName=n1;var n8="ScrollAreaViewport",n9=o.forwardRef((e,t)=>{let{__scopeScrollArea:r,children:n,nonce:a,...s}=e,i=n3(n8,r),c=o.useRef(null),d=(0,T.s)(t,c,i.onViewportChange);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),(0,l.jsx)(D.sG.div,{"data-radix-scroll-area-viewport":"",...s,ref:d,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,l.jsx)("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});n9.displayName=n8;var n7="ScrollAreaScrollbar",ae=o.forwardRef((e,t)=>{let{forceMount:r,...n}=e,a=n3(n7,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=a,c="horizontal"===e.orientation;return o.useEffect(()=>(c?s(!0):i(!0),()=>{c?s(!1):i(!1)}),[c,s,i]),"hover"===a.type?(0,l.jsx)(at,{...n,ref:t,forceMount:r}):"scroll"===a.type?(0,l.jsx)(ar,{...n,ref:t,forceMount:r}):"auto"===a.type?(0,l.jsx)(an,{...n,ref:t,forceMount:r}):"always"===a.type?(0,l.jsx)(aa,{...n,ref:t}):null});ae.displayName=n7;var at=o.forwardRef((e,t)=>{let{forceMount:r,...n}=e,a=n3(n7,e.__scopeScrollArea),[s,i]=o.useState(!1);return o.useEffect(()=>{let e=a.scrollArea,t=0;if(e){let r=()=>{window.clearTimeout(t),i(!0)},n=()=>{t=window.setTimeout(()=>i(!1),a.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[a.scrollArea,a.scrollHideDelay]),(0,l.jsx)(tM.C,{present:r||s,children:(0,l.jsx)(an,{"data-state":s?"visible":"hidden",...n,ref:t})})}),ar=o.forwardRef((e,t)=>{var r,n;let{forceMount:a,...s}=e,i=n3(n7,e.__scopeScrollArea),c="horizontal"===e.orientation,d=aj(()=>f("SCROLL_END"),100),[u,f]=(r="hidden",n={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},o.useReducer((e,t)=>n[e][t]??e,r));return o.useEffect(()=>{if("idle"===u){let e=window.setTimeout(()=>f("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[u,i.scrollHideDelay,f]),o.useEffect(()=>{let e=i.viewport,t=c?"scrollLeft":"scrollTop";if(e){let r=e[t],n=()=>{let n=e[t];r!==n&&(f("SCROLL"),d()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[i.viewport,c,f,d]),(0,l.jsx)(tM.C,{present:a||"hidden"!==u,children:(0,l.jsx)(aa,{"data-state":"hidden"===u?"hidden":"visible",...s,ref:t,onPointerEnter:(0,E.m)(e.onPointerEnter,()=>f("POINTER_ENTER")),onPointerLeave:(0,E.m)(e.onPointerLeave,()=>f("POINTER_LEAVE"))})})}),an=o.forwardRef((e,t)=>{let r=n3(n7,e.__scopeScrollArea),{forceMount:n,...a}=e,[s,i]=o.useState(!1),c="horizontal"===e.orientation,d=aj(()=>{if(r.viewport){let e=r.viewport.offsetWidth<r.viewport.scrollWidth,t=r.viewport.offsetHeight<r.viewport.scrollHeight;i(c?e:t)}},10);return aN(r.viewport,d),aN(r.content,d),(0,l.jsx)(tM.C,{present:n||s,children:(0,l.jsx)(aa,{"data-state":s?"visible":"hidden",...a,ref:t})})}),aa=o.forwardRef((e,t)=>{let{orientation:r="vertical",...n}=e,a=n3(n7,e.__scopeScrollArea),s=o.useRef(null),i=o.useRef(0),[c,d]=o.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=ag(c.viewport,c.content),f={...n,sizes:c,onSizesChange:d,hasThumb:!!(u>0&&u<1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:e=>i.current=e};function m(e,t){return function(e,t,r,n="ltr"){let a=av(r),l=t||a/2,o=r.scrollbar.paddingStart+l,s=r.scrollbar.size-r.scrollbar.paddingEnd-(a-l),i=r.content-r.viewport;return ab([o,s],"ltr"===n?[0,i]:[-1*i,0])(e)}(e,i.current,c,t)}return"horizontal"===r?(0,l.jsx)(al,{...f,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){let e=ay(a.viewport.scrollLeft,c,a.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollLeft=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollLeft=m(e,a.dir))}}):"vertical"===r?(0,l.jsx)(ao,{...f,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){let e=ay(a.viewport.scrollTop,c);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollTop=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollTop=m(e))}}):null}),al=o.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...a}=e,s=n3(n7,e.__scopeScrollArea),[i,c]=o.useState(),d=o.useRef(null),u=(0,T.s)(t,d,s.onScrollbarXChange);return o.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),(0,l.jsx)(ac,{"data-orientation":"horizontal",...a,ref:u,sizes:r,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":av(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(s.viewport){let n=s.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),function(e,t){return e>0&&e<t}(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:ax(i.paddingLeft),paddingEnd:ax(i.paddingRight)}})}})}),ao=o.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...a}=e,s=n3(n7,e.__scopeScrollArea),[i,c]=o.useState(),d=o.useRef(null),u=(0,T.s)(t,d,s.onScrollbarYChange);return o.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),(0,l.jsx)(ac,{"data-orientation":"vertical",...a,ref:u,sizes:r,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":av(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(s.viewport){let n=s.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),function(e,t){return e>0&&e<t}(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:ax(i.paddingTop),paddingEnd:ax(i.paddingBottom)}})}})}),[as,ai]=n2(n7),ac=o.forwardRef((e,t)=>{let{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:m,...p}=e,h=n3(n7,r),[x,g]=o.useState(null),v=(0,T.s)(t,e=>g(e)),y=o.useRef(null),b=o.useRef(""),w=h.viewport,j=n.content-n.viewport,N=(0,U.c)(f),C=(0,U.c)(d),k=aj(m,10);function S(e){y.current&&u({x:e.clientX-y.current.left,y:e.clientY-y.current.top})}return o.useEffect(()=>{let e=e=>{let t=e.target;x?.contains(t)&&N(e,j)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,x,j,N]),o.useEffect(C,[n,C]),aN(x,k),aN(h.content,k),(0,l.jsx)(as,{scope:r,scrollbar:x,hasThumb:a,onThumbChange:(0,U.c)(s),onThumbPointerUp:(0,U.c)(i),onThumbPositionChange:C,onThumbPointerDown:(0,U.c)(c),children:(0,l.jsx)(D.sG.div,{...p,ref:v,style:{position:"absolute",...p.style},onPointerDown:(0,E.m)(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),y.current=x.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),S(e))}),onPointerMove:(0,E.m)(e.onPointerMove,S),onPointerUp:(0,E.m)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=b.current,h.viewport&&(h.viewport.style.scrollBehavior=""),y.current=null})})})}),ad="ScrollAreaThumb",au=o.forwardRef((e,t)=>{let{forceMount:r,...n}=e,a=ai(ad,e.__scopeScrollArea);return(0,l.jsx)(tM.C,{present:r||a.hasThumb,children:(0,l.jsx)(af,{ref:t,...n})})}),af=o.forwardRef((e,t)=>{let{__scopeScrollArea:r,style:n,...a}=e,s=n3(ad,r),i=ai(ad,r),{onThumbPositionChange:c}=i,d=(0,T.s)(t,e=>i.onThumbChange(e)),u=o.useRef(void 0),f=aj(()=>{u.current&&(u.current(),u.current=void 0)},100);return o.useEffect(()=>{let e=s.viewport;if(e){let t=()=>{if(f(),!u.current){let t=aw(e,c);u.current=t,c()}};return c(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[s.viewport,f,c]),(0,l.jsx)(D.sG.div,{"data-state":i.hasThumb?"visible":"hidden",...a,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:(0,E.m)(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;i.onThumbPointerDown({x:r,y:n})}),onPointerUp:(0,E.m)(e.onPointerUp,i.onThumbPointerUp)})});au.displayName=ad;var am="ScrollAreaCorner",ap=o.forwardRef((e,t)=>{let r=n3(am,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&n?(0,l.jsx)(ah,{...e,ref:t}):null});ap.displayName=am;var ah=o.forwardRef((e,t)=>{let{__scopeScrollArea:r,...n}=e,a=n3(am,r),[s,i]=o.useState(0),[c,d]=o.useState(0),u=!!(s&&c);return aN(a.scrollbarX,()=>{let e=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(e),d(e)}),aN(a.scrollbarY,()=>{let e=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(e),i(e)}),u?(0,l.jsx)(D.sG.div,{...n,ref:t,style:{width:s,height:c,position:"absolute",right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:0,...e.style}}):null});function ax(e){return e?parseInt(e,10):0}function ag(e,t){let r=e/t;return isNaN(r)?0:r}function av(e){let t=ag(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-r)*t,18)}function ay(e,t,r="ltr"){let n=av(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,l=t.scrollbar.size-a,o=t.content-t.viewport,s=n0(e,"ltr"===r?[0,o]:[-1*o,0]);return ab([0,o],[0,l-n])(s)}function ab(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}var aw=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){let l={left:e.scrollLeft,top:e.scrollTop},o=r.left!==l.left,s=r.top!==l.top;(o||s)&&t(),r=l,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function aj(e,t){let r=(0,U.c)(e),n=o.useRef(0);return o.useEffect(()=>()=>window.clearTimeout(n.current),[]),o.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function aN(e,t){let r=(0,U.c)(t);(0,X.N)(()=>{let t=0;if(e){let n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}let aC=o.forwardRef(({className:e,children:t,...r},n)=>(0,l.jsxs)(n6,{ref:n,className:(0,j.cn)("relative overflow-hidden",e),...r,children:[(0,l.jsx)(n9,{className:"h-full w-full rounded-[inherit]",children:t}),(0,l.jsx)(ak,{}),(0,l.jsx)(ap,{})]}));aC.displayName=n6.displayName;let ak=o.forwardRef(({className:e,orientation:t="vertical",...r},n)=>(0,l.jsx)(ae,{ref:n,orientation:t,className:(0,j.cn)("flex touch-none select-none transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:(0,l.jsx)(au,{className:"relative flex-1 rounded-full bg-border"})}));ak.displayName=ae.displayName;let aS=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("div",{className:"relative w-full overflow-auto",children:(0,l.jsx)("table",{ref:r,className:(0,j.cn)("w-full caption-bottom text-sm",e),...t})}));aS.displayName="Table";let aR=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("thead",{ref:r,className:(0,j.cn)("[&_tr]:border-b",e),...t}));aR.displayName="TableHeader";let aE=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("tbody",{ref:r,className:(0,j.cn)("[&_tr:last-child]:border-0",e),...t}));aE.displayName="TableBody",o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("tfoot",{ref:r,className:(0,j.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t})).displayName="TableFooter";let aT=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("tr",{ref:r,className:(0,j.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));aT.displayName="TableRow";let aM=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("th",{ref:r,className:(0,j.cn)("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));aM.displayName="TableHead";let aA=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("td",{ref:r,className:(0,j.cn)("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));aA.displayName="TableCell",o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("caption",{ref:r,className:(0,j.cn)("mt-4 text-sm text-muted-foreground",e),...t})).displayName="TableCaption";var aD=r(1255);let a_=function({preview:e=[],onConfirm:t,onCancel:r,isConfirming:n,error:a,isLoading:s,success:i,databaseName:c,migrationsDir:d}){let[u,f]=(0,o.useState)(!0);if(s)return(0,l.jsx)("div",{className:"fixed bottom-4 right-4 z-50 font-sans w-[600px]",children:(0,l.jsx)("div",{className:"rounded-lg border p-4 shadow-lg bg-background",children:(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)(v,{className:"h-5 w-5 text-neutral-600 shrink-0 mt-0.5 animate-spin"}),(0,l.jsx)("div",{className:"flex-1 space-y-3",children:(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsxs)("p",{className:"font-medium text-neutral-800",children:["Preparing Push Migration",c?` \xb7 ${c}`:""]}),(0,l.jsx)("p",{className:"text-sm text-neutral-600",children:"Checking local migrations..."})]})})]})})});if(!e?.length)return(0,l.jsx)("div",{className:"fixed bottom-4 right-4 z-50 w-[600px]",children:(0,l.jsx)("div",{className:"rounded-lg border p-4",children:(0,l.jsx)("p",{className:"text-sm font-medium",children:"No migrations to preview"})})});let m=e.filter(e=>"will be applied"===e.action).length,p=e.filter(e=>"skipped"===e.action).length;e.filter(e=>"applied"===e.action).length;let h=e=>{switch(e){case"will be applied":return"\uD83D\uDD52️";case"applied":return"✅";case"skipped":return"⏭️";case"failed":return"❌";default:return""}};return(0,l.jsx)("div",{className:"fixed bottom-4 right-4 z-50 font-sans w-[600px]",children:(0,l.jsx)("div",{className:(0,j.cn)("rounded-lg border p-4 shadow-lg",a?"bg-destructive/15":"bg-background"),children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("h5",{className:"font-medium text-neutral-900",children:["Push Migration Preview",c&&(0,l.jsx)("span",{className:"ml-2 text-xs font-normal text-neutral-500 font-mono",children:c})]}),(0,l.jsx)("button",{onClick:r,className:"text-neutral-500 hover:text-neutral-900 p-1 rounded-md hover:bg-neutral-100",children:(0,l.jsx)(aD.A,{className:"h-4 w-4"})})]}),(0,l.jsxs)("p",{className:"text-sm text-neutral-700",children:[m," migration(s) \uD83D\uDD52️ pending, ",p," to ⏭️ skip"]}),(0,l.jsx)("p",{className:"text-xs text-neutral-400 font-mono",children:d?(0,l.jsxs)(l.Fragment,{children:["\uD83D\uDCC1 ",d]}):(0,l.jsx)("span",{className:"text-amber-600",children:'⚠ migrations_dir not set — using default "migrations/"'})}),a?(0,l.jsx)("p",{className:"text-sm text-destructive font-medium mt-1",children:a.message}):i&&(0,l.jsx)("p",{className:"text-sm text-green-700 font-medium mt-1",children:i})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{onClick:()=>f(!u),className:"text-sm font-medium hover:underline",children:u?"Hide Details":"Show Details"}),u&&(0,l.jsx)(aC,{className:"h-[480px] mt-2 rounded border border-neutral-200",children:(0,l.jsxs)(aS,{children:[(0,l.jsx)(aR,{children:(0,l.jsxs)(aT,{children:[(0,l.jsx)(aM,{children:"Migration"}),(0,l.jsx)(aM,{className:"text-center w-24",children:"Status"})]})}),(0,l.jsx)(aE,{children:e.map((e,t)=>(0,l.jsxs)(aT,{children:[(0,l.jsx)(aA,{className:"font-mono text-xs",children:e.name}),(0,l.jsx)(aA,{className:"text-center align-middle",children:h(e.action)})]},t))})]})})]}),(0,l.jsxs)("p",{className:"text-xs text-neutral-400",children:["Seed files (",(0,l.jsx)("span",{className:"font-mono",children:"*seed*.sql"}),") are local-only and excluded from remote sync."]}),(0,l.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,l.jsx)(nZ,{onClick:t,disabled:n||0===m,className:"flex-1",children:n?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(v,{className:"mr-2 h-4 w-4 animate-spin"}),"Confirming..."]}):"Confirm Push"}),(0,l.jsx)(nZ,{variant:"outline",onClick:r,disabled:n,className:"flex-1",children:"Cancel"})]})]})})})},aO=function({preview:e=[],onConfirm:t,onCancel:r,onDataPull:n,isConfirming:a,isDataPulling:s,error:i,isLoading:c,success:d,databaseName:u,migrationsDir:f}){console.log("PullPreviewToast rendered with:",{previewLength:e.length,isConfirming:a,error:i,isLoading:c});let[m,p]=(0,o.useState)(!1);if(c)return console.log("Rendering loading state"),(0,l.jsx)("div",{className:"fixed bottom-4 right-4 z-50 font-sans w-[600px]",children:(0,l.jsx)("div",{className:"rounded-lg border p-4 shadow-lg bg-background",children:(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)(v,{className:"h-5 w-5 text-neutral-600 shrink-0 mt-0.5 animate-spin"}),(0,l.jsx)("div",{className:"flex-1 space-y-3",children:(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsxs)("p",{className:"font-medium text-neutral-800",children:["Preparing Pull Migration",u?` \xb7 ${u}`:""]}),(0,l.jsx)("p",{className:"text-sm text-neutral-600",children:"Checking remote migrations..."})]})})]})})});if(!e?.length)return console.log("No preview data available"),(0,l.jsx)("div",{className:"fixed bottom-4 right-4 z-50 w-[600px]",children:(0,l.jsx)("div",{className:"rounded-lg border bg-destructive/15 p-4",children:(0,l.jsx)("div",{className:"flex items-center gap-2",children:(0,l.jsx)("p",{className:"text-sm font-medium text-destructive",children:"No preview data available"})})})});let h=e.filter(e=>(e.migration||e.name||"").endsWith(".sql")),x=h.length;console.log("Migration stats:",{totalMigrations:x});let g=d&&!s&&!i;return(0,l.jsx)("div",{className:"fixed bottom-4 right-4 z-50 font-sans w-[600px]",children:(0,l.jsx)("div",{className:(0,j.cn)("rounded-lg border p-4 shadow-lg",i?"bg-destructive/15":"bg-background"),children:(0,l.jsx)("div",{className:"flex items-start gap-x-1",children:(0,l.jsxs)("div",{className:"flex-1 space-y-3",children:[(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("h5",{className:(0,j.cn)("font-medium",i?"text-destructive":"text-neutral-900"),children:[i?"Pull Migration Error":"Pull Migration Preview",u&&(0,l.jsx)("span",{className:"ml-2 text-xs font-normal text-neutral-500 font-mono",children:u})]}),(0,l.jsx)("button",{onClick:r,className:"text-neutral-500 hover:text-neutral-900 p-1 rounded-md hover:bg-neutral-100",children:(0,l.jsx)(aD.A,{className:"h-4 w-4"})})]}),(0,l.jsx)("p",{className:(0,j.cn)("text-sm",i?"text-destructive/80":"text-neutral-700"),children:`${x} migration(s) will be applied`}),(0,l.jsx)("p",{className:"text-xs text-neutral-400 font-mono",children:f?(0,l.jsxs)(l.Fragment,{children:["\uD83D\uDCC1 ",f]}):(0,l.jsx)("span",{className:"text-amber-600",children:'⚠ migrations_dir not set — using default "migrations/"'})}),i&&(0,l.jsx)("p",{className:"text-sm text-destructive font-medium mt-1",children:i.message}),d&&(0,l.jsx)("p",{className:"text-sm text-green-700 font-medium mt-1",children:d})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{onClick:()=>p(!m),className:"text-sm font-medium hover:underline",children:m?"Hide Details":"Show Details"}),m&&(0,l.jsx)(aC,{className:"h-[480px] mt-2 rounded border border-neutral-200",children:(0,l.jsxs)("div",{className:"w-full",children:[(0,l.jsx)("div",{className:"bg-neutral-50 border-b px-4 py-2",children:(0,l.jsx)("div",{className:"text-sm font-medium text-neutral-600",children:"Migration"})}),(0,l.jsx)("div",{children:h.map((e,t)=>(0,l.jsx)("div",{className:"px-4 py-2 border-b last:border-0",children:(0,l.jsx)("div",{className:"font-mono text-xs",children:e.migration||e.name})},t))})]})})]}),(0,l.jsxs)("p",{className:"text-xs text-neutral-400",children:["Seed files (",(0,l.jsx)("span",{className:"font-mono",children:"*seed*.sql"}),") are local-only and excluded from remote sync."]}),(0,l.jsx)("div",{className:"flex flex-col gap-2 pt-1",children:(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(nZ,{onClick:t,disabled:a,className:`flex-1 ${a?"cursor-not-allowed opacity-50":""}`,children:a?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(v,{className:"h-4 w-4 animate-spin"}),"Confirming..."]}):"Confirm Pull"}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,l.jsx)(nZ,{onClick:n,disabled:!g,variant:"outline",className:`w-full ${g?"":"cursor-not-allowed opacity-50"}`,children:s?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(v,{className:"h-4 w-4 animate-spin"}),"Syncing remote data..."]}):"Sync remote data"}),(0,l.jsx)("p",{className:"text-xs text-neutral-500 text-center",children:"75 records per table"})]})]})})]})})})})};function aP(){let[e]=(0,o.useState)(!1),[t,r]=(0,o.useState)(!1),[n,a]=(0,o.useState)(!1),[s,i]=(0,o.useState)(null),[c,d]=(0,o.useState)(null),[u,f]=(0,o.useState)(null),[m,p]=(0,o.useState)(null),{refreshTables:h,setOperationStatus:x,setLastSyncTime:g,currentDatabase:v}=(0,nQ.t)(),y=()=>{a(!1),i(null),d(null),f(null),p(null)},b=async()=>{try{f("push"),a(!0),r(!0),d(null),p(null),i({preview:[]});let e=await fetch("/api/push-remote/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({db:v?.database_name})}),t=await e.json();if(!t.success)throw Error(t.error?.message||"Failed to generate preview");i(t.details.details)}catch(e){console.error("Push to remote preview failed:",e),d(e),x("error",e.message||"Failed to generate push preview")}finally{r(!1)}},w=async()=>{try{r(!0),d(null),p(null);let e=await fetch("/api/push-remote/confirm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({db:v?.database_name})}),t=await e.json();if(!t.success)throw Error(t.error?.message||"Failed to confirm push");i(e=>({...e,preview:e.preview.map(e=>({...e,action:"will be applied"===e.action?"applied":e.action}))})),p(`Applied ${t.details.applied} migration(s), skipped ${t.details.skipped}.`),g(),x("success",`Push complete — ${t.details.applied} migration(s) applied`)}catch(e){console.error("Push to remote confirm failed:",e),d(e)}finally{r(!1)}},j=async()=>{try{f("pull"),a(!0),r(!0),d(null),p(null),i({preview:[]});let e=await fetch("/api/pull-remote/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({db:v?.database_name})}),t=await e.json();if(!t.success)throw Error(t.error?.message||"Failed to generate pull preview");i(t.details)}catch(e){console.error("Pull to remote preview failed:",e),d(e),x("error",e.message||"Failed to generate pull preview")}finally{r(!1)}},N=async()=>{try{r(!0),d(null),p(null);let e=await fetch("/api/pull-remote/confirm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({db:v?.database_name})}),t=await e.json();if(!t.success)throw Error(t.error?.message||"Failed to confirm pull");p("Pull migrations applied successfully."),g(),x("success","Pull complete"),i(e=>({...e,preview:e.preview.map(e=>({...e,action:"will be applied"===e.action?"applied":e.action}))})),await h()}catch(e){console.error("Pull to remote confirm failed:",e),d(e)}finally{r(!1)}},C=n&&("pull"===u?(0,l.jsx)(aO,{preview:s?.preview||[],onConfirm:N,onCancel:y,isConfirming:t,error:c,success:m,isLoading:t&&!s?.preview?.length,databaseName:v?.database_name,migrationsDir:v?.migrations_dir}):(0,l.jsx)(a_,{preview:s?.preview||[],onConfirm:w,onCancel:y,isConfirming:t,error:c,success:m,isLoading:t&&!s?.preview?.length,databaseName:v?.database_name,migrationsDir:v?.migrations_dir}));return{isConnecting:e,isPushing:t,showPreview:n,pushToRemote:b,pullToRemotePreview:j,PreviewUI:C}}function aL({icon:e,label:t,view:r,currentView:n,onNavigate:a,disabled:o,pro:s,locked:i}){let c=n===r;return(0,l.jsxs)("button",{className:`w-full flex items-center gap-x-1.5 border rounded-md text-sm font-medium transition-colors px-2 py-2
|
|
1
|
+
(()=>{var e={};e.id=974,e.ids=[974],e.modules={846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},9121:e=>{"use strict";e.exports=require("next/dist/server/app-render/action-async-storage.external.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},3873:e=>{"use strict";e.exports=require("path")},7185:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GlobalError:()=>o.a,__next_app__:()=>u,pages:()=>d,routeModule:()=>f,tree:()=>c});var n=r(260),a=r(8203),l=r(5155),o=r.n(l),s=r(7292),i={};for(let e in s)0>["default","tree","pages","GlobalError","__next_app__","routeModule"].indexOf(e)&&(i[e]=()=>s[e]);r.d(t,i);let c=["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(r.bind(r,8868)),"/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx"]}]},{layout:[()=>Promise.resolve().then(r.bind(r,8180)),"/Volumes/ProjectSpace/_wip/d1studio/src/app/layout.jsx"],"not-found":[()=>Promise.resolve().then(r.t.bind(r,9937,23)),"next/dist/client/components/not-found-error"],forbidden:[()=>Promise.resolve().then(r.t.bind(r,9116,23)),"next/dist/client/components/forbidden-error"],unauthorized:[()=>Promise.resolve().then(r.t.bind(r,1485,23)),"next/dist/client/components/unauthorized-error"]}],d=["/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx"],u={require:r,loadChunk:()=>Promise.resolve()},f=new n.AppPageRouteModule({definition:{kind:a.RouteKind.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:c}})},7048:(e,t,r)=>{Promise.resolve().then(r.bind(r,8868))},6776:(e,t,r)=>{Promise.resolve().then(r.bind(r,7098))},6256:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let n=r(5488)._(r(568));function a(e,t){var r;let a={};"function"==typeof e&&(a.loader=e);let l={...a,...t};return(0,n.default)({...l,modules:null==(r=l.loadableGenerated)?void 0:r.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3400:(e,t)=>{"use strict";function r(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"encodeURIPath",{enumerable:!0,get:function(){return r}})},5771:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return a}});let n=r(4639);function a(e){let{reason:t,children:r}=e;throw new n.BailoutToCSRError(t)}},568:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return c}});let n=r(5512),a=r(8009),l=r(5771),o=r(6054);function s(e){return{default:e&&"default"in e?e.default:e}}let i={loader:()=>Promise.resolve(s(()=>null)),loading:null,ssr:!0},c=function(e){let t={...i,...e},r=(0,a.lazy)(()=>t.loader().then(s)),c=t.loading;function d(e){let s=c?(0,n.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,i=!t.ssr||!!t.loading,d=i?a.Suspense:a.Fragment,u=t.ssr?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.PreloadChunks,{moduleIds:t.modules}),(0,n.jsx)(r,{...e})]}):(0,n.jsx)(l.BailoutToCSR,{reason:"next/dynamic",children:(0,n.jsx)(r,{...e})});return(0,n.jsx)(d,{...i?{fallback:s}:{},children:u})}return d.displayName="LoadableComponent",d}},6054:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return s}});let n=r(5512),a=r(5740),l=r(9294),o=r(3400);function s(e){let{moduleIds:t}=e,r=l.workAsyncStorage.getStore();if(void 0===r)return null;let s=[];if(r.reactLoadableManifest&&t){let e=r.reactLoadableManifest;for(let r of t){if(!e[r])continue;let t=e[r].files;s.push(...t)}}return 0===s.length?null:(0,n.jsx)(n.Fragment,{children:s.map(e=>{let t=r.assetPrefix+"/_next/"+(0,o.encodeURIPath)(e);return e.endsWith(".css")?(0,n.jsx)("link",{precedence:"dynamic",href:t,rel:"stylesheet",as:"style"},e):((0,a.preload)(t,{as:"script",fetchPriority:"low"}),null)})})}},7098:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>iO});var n,a,l=r(5512),o=r(8009),s=r.t(o,2),i=r.n(o);let c={rE:"0.3.1"};var d=r(4825);let u=(0,d.A)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),f=(0,d.A)("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]),m=(0,d.A)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),p=(0,d.A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),h=(0,d.A)("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]),x=(0,d.A)("ArrowUpFromLine",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]),g=(0,d.A)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),v=(0,d.A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),y=(0,d.A)("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),b=(0,d.A)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),w=(0,d.A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);var j=r(3603);let N=o.forwardRef(({className:e,type:t,...r},n)=>(0,l.jsx)("input",{type:t,className:(0,j.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...r}));N.displayName="Input";var C=r(1643);let k=(0,C.F)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),S=o.forwardRef(({className:e,variant:t,...r},n)=>(0,l.jsx)("div",{ref:n,role:"alert",className:(0,j.cn)(k({variant:t}),e),...r}));S.displayName="Alert",o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("h5",{ref:r,className:(0,j.cn)("mb-1 font-medium leading-none tracking-tight",e),...t})).displayName="AlertTitle";let R=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("div",{ref:r,className:(0,j.cn)("text-sm [&_p]:leading-relaxed",e),...t}));R.displayName="AlertDescription";var E=r(1412),T=r(9952),M=r(6004),A=r(3024),D=r(830),_=r(9217),O=o.createContext(void 0);function P(e){let t=o.useContext(O);return e||t||"ltr"}var L=r(1675),I=0;function $(){o.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??F()),document.body.insertAdjacentElement("beforeend",e[1]??F()),I++,()=>{1===I&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),I--}},[])}function F(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var U=r(2828),z="focusScope.autoFocusOnMount",B="focusScope.autoFocusOnUnmount",H={bubbles:!1,cancelable:!0},W=o.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...i}=e,[c,d]=o.useState(null),u=(0,U.c)(a),f=(0,U.c)(s),m=o.useRef(null),p=(0,T.s)(t,e=>d(e)),h=o.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;o.useEffect(()=>{if(n){let e=function(e){if(h.paused||!c)return;let t=e.target;c.contains(t)?m.current=t:q(m.current,{select:!0})},t=function(e){if(h.paused||!c)return;let t=e.relatedTarget;null===t||c.contains(t)||q(m.current,{select:!0})};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&q(c)});return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[n,c,h.paused]),o.useEffect(()=>{if(c){G.add(h);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(z,H);c.addEventListener(z,u),c.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(q(n,{select:t}),document.activeElement!==r)return}(V(c).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&q(c))}return()=>{c.removeEventListener(z,u),setTimeout(()=>{let t=new CustomEvent(B,H);c.addEventListener(B,f),c.dispatchEvent(t),t.defaultPrevented||q(e??document.body,{select:!0}),c.removeEventListener(B,f),G.remove(h)},0)}}},[c,u,f,h]);let x=o.useCallback(e=>{if(!r&&!n||h.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){let t=e.currentTarget,[n,l]=function(e){let t=V(e);return[K(t,e),K(t.reverse(),e)]}(t);n&&l?e.shiftKey||a!==l?e.shiftKey&&a===n&&(e.preventDefault(),r&&q(l,{select:!0})):(e.preventDefault(),r&&q(n,{select:!0})):a===t&&e.preventDefault()}},[r,n,h.paused]);return(0,l.jsx)(D.sG.div,{tabIndex:-1,...i,ref:p,onKeyDown:x})});function V(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function K(e,t){for(let r of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(r,{upTo:t}))return r}function q(e,{select:t=!1}={}){if(e&&e.focus){var r;let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&(r=e)instanceof HTMLInputElement&&"select"in r&&t&&e.select()}}W.displayName="FocusScope";var G=function(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),(e=Y(e,t)).unshift(t)},remove(t){e=Y(e,t),e[0]?.resume()}}}();function Y(e,t){let r=[...e],n=r.indexOf(t);return -1!==n&&r.splice(n,1),r}var X=r(9397),Q=s["useId".toString()]||(()=>void 0),J=0;function Z(e){let[t,r]=o.useState(Q());return(0,X.N)(()=>{e||r(e=>e??String(J++))},[e]),e||(t?`radix-${t}`:"")}let ee=["top","right","bottom","left"],et=Math.min,er=Math.max,en=Math.round,ea=Math.floor,el=e=>({x:e,y:e}),eo={left:"right",right:"left",bottom:"top",top:"bottom"},es={start:"end",end:"start"};function ei(e,t){return"function"==typeof e?e(t):e}function ec(e){return e.split("-")[0]}function ed(e){return e.split("-")[1]}function eu(e){return"x"===e?"y":"x"}function ef(e){return"y"===e?"height":"width"}function em(e){return["top","bottom"].includes(ec(e))?"y":"x"}function ep(e){return e.replace(/start|end/g,e=>es[e])}function eh(e){return e.replace(/left|right|bottom|top/g,e=>eo[e])}function ex(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function eg(e){let{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function ev(e,t,r){let n,{reference:a,floating:l}=e,o=em(t),s=eu(em(t)),i=ef(s),c=ec(t),d="y"===o,u=a.x+a.width/2-l.width/2,f=a.y+a.height/2-l.height/2,m=a[i]/2-l[i]/2;switch(c){case"top":n={x:u,y:a.y-l.height};break;case"bottom":n={x:u,y:a.y+a.height};break;case"right":n={x:a.x+a.width,y:f};break;case"left":n={x:a.x-l.width,y:f};break;default:n={x:a.x,y:a.y}}switch(ed(t)){case"start":n[s]-=m*(r&&d?-1:1);break;case"end":n[s]+=m*(r&&d?-1:1)}return n}let ey=async(e,t,r)=>{let{placement:n="bottom",strategy:a="absolute",middleware:l=[],platform:o}=r,s=l.filter(Boolean),i=await (null==o.isRTL?void 0:o.isRTL(t)),c=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=ev(c,n,i),f=n,m={},p=0;for(let r=0;r<s.length;r++){let{name:l,fn:h}=s[r],{x:x,y:g,data:v,reset:y}=await h({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:m,rects:c,platform:o,elements:{reference:e,floating:t}});d=null!=x?x:d,u=null!=g?g:u,m={...m,[l]:{...m[l],...v}},y&&p<=50&&(p++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(c=!0===y.rects?await o.getElementRects({reference:e,floating:t,strategy:a}):y.rects),{x:d,y:u}=ev(c,f,i)),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:m}};async function eb(e,t){var r;void 0===t&&(t={});let{x:n,y:a,platform:l,rects:o,elements:s,strategy:i}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:m=0}=ei(t,e),p=ex(m),h=s[f?"floating"===u?"reference":"floating":u],x=eg(await l.getClippingRect({element:null==(r=await (null==l.isElement?void 0:l.isElement(h)))||r?h:h.contextElement||await (null==l.getDocumentElement?void 0:l.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:i})),g="floating"===u?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,v=await (null==l.getOffsetParent?void 0:l.getOffsetParent(s.floating)),y=await (null==l.isElement?void 0:l.isElement(v))&&await (null==l.getScale?void 0:l.getScale(v))||{x:1,y:1},b=eg(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:g,offsetParent:v,strategy:i}):g);return{top:(x.top-b.top+p.top)/y.y,bottom:(b.bottom-x.bottom+p.bottom)/y.y,left:(x.left-b.left+p.left)/y.x,right:(b.right-x.right+p.right)/y.x}}function ew(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ej(e){return ee.some(t=>e[t]>=0)}async function eN(e,t){let{placement:r,platform:n,elements:a}=e,l=await (null==n.isRTL?void 0:n.isRTL(a.floating)),o=ec(r),s=ed(r),i="y"===em(r),c=["left","top"].includes(o)?-1:1,d=l&&i?-1:1,u=ei(t,e),{mainAxis:f,crossAxis:m,alignmentAxis:p}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof p&&(m="end"===s?-1*p:p),i?{x:m*d,y:f*c}:{x:f*c,y:m*d}}function eC(){return"undefined"!=typeof window}function ek(e){return eE(e)?(e.nodeName||"").toLowerCase():"#document"}function eS(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function eR(e){var t;return null==(t=(eE(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function eE(e){return!!eC()&&(e instanceof Node||e instanceof eS(e).Node)}function eT(e){return!!eC()&&(e instanceof Element||e instanceof eS(e).Element)}function eM(e){return!!eC()&&(e instanceof HTMLElement||e instanceof eS(e).HTMLElement)}function eA(e){return!!eC()&&"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof eS(e).ShadowRoot)}function eD(e){let{overflow:t,overflowX:r,overflowY:n,display:a}=eI(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(a)}function e_(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch(e){return!1}})}function eO(e){let t=eP(),r=eT(e)?eI(e):e;return["transform","translate","scale","rotate","perspective"].some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||["transform","translate","scale","rotate","perspective","filter"].some(e=>(r.willChange||"").includes(e))||["paint","layout","strict","content"].some(e=>(r.contain||"").includes(e))}function eP(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}function eL(e){return["html","body","#document"].includes(ek(e))}function eI(e){return eS(e).getComputedStyle(e)}function e$(e){return eT(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function eF(e){if("html"===ek(e))return e;let t=e.assignedSlot||e.parentNode||eA(e)&&e.host||eR(e);return eA(t)?t.host:t}function eU(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let a=function e(t){let r=eF(t);return eL(r)?t.ownerDocument?t.ownerDocument.body:t.body:eM(r)&&eD(r)?r:e(r)}(e),l=a===(null==(n=e.ownerDocument)?void 0:n.body),o=eS(a);if(l){let e=ez(o);return t.concat(o,o.visualViewport||[],eD(a)?a:[],e&&r?eU(e):[])}return t.concat(a,eU(a,[],r))}function ez(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function eB(e){let t=eI(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,a=eM(e),l=a?e.offsetWidth:r,o=a?e.offsetHeight:n,s=en(r)!==l||en(n)!==o;return s&&(r=l,n=o),{width:r,height:n,$:s}}function eH(e){return eT(e)?e:e.contextElement}function eW(e){let t=eH(e);if(!eM(t))return el(1);let r=t.getBoundingClientRect(),{width:n,height:a,$:l}=eB(t),o=(l?en(r.width):r.width)/n,s=(l?en(r.height):r.height)/a;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}let eV=el(0);function eK(e){let t=eS(e);return eP()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:eV}function eq(e,t,r,n){var a;void 0===t&&(t=!1),void 0===r&&(r=!1);let l=e.getBoundingClientRect(),o=eH(e),s=el(1);t&&(n?eT(n)&&(s=eW(n)):s=eW(e));let i=(void 0===(a=r)&&(a=!1),n&&(!a||n===eS(o))&&a)?eK(o):el(0),c=(l.left+i.x)/s.x,d=(l.top+i.y)/s.y,u=l.width/s.x,f=l.height/s.y;if(o){let e=eS(o),t=n&&eT(n)?eS(n):n,r=e,a=ez(r);for(;a&&n&&t!==r;){let e=eW(a),t=a.getBoundingClientRect(),n=eI(a),l=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,d*=e.y,u*=e.x,f*=e.y,c+=l,d+=o,a=ez(r=eS(a))}}return eg({width:u,height:f,x:c,y:d})}function eG(e,t){let r=e$(e).scrollLeft;return t?t.left+r:eq(eR(e)).left+r}function eY(e,t,r){void 0===r&&(r=!1);let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-(r?0:eG(e,n)),y:n.top+t.scrollTop}}function eX(e,t,r){let n;if("viewport"===t)n=function(e,t){let r=eS(e),n=eR(e),a=r.visualViewport,l=n.clientWidth,o=n.clientHeight,s=0,i=0;if(a){l=a.width,o=a.height;let e=eP();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,i=a.offsetTop)}return{width:l,height:o,x:s,y:i}}(e,r);else if("document"===t)n=function(e){let t=eR(e),r=e$(e),n=e.ownerDocument.body,a=er(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),l=er(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight),o=-r.scrollLeft+eG(e),s=-r.scrollTop;return"rtl"===eI(n).direction&&(o+=er(t.clientWidth,n.clientWidth)-a),{width:a,height:l,x:o,y:s}}(eR(e));else if(eT(t))n=function(e,t){let r=eq(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,l=eM(e)?eW(e):el(1),o=e.clientWidth*l.x;return{width:o,height:e.clientHeight*l.y,x:a*l.x,y:n*l.y}}(t,r);else{let r=eK(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return eg(n)}function eQ(e){return"static"===eI(e).position}function eJ(e,t){if(!eM(e)||"fixed"===eI(e).position)return null;if(t)return t(e);let r=e.offsetParent;return eR(e)===r&&(r=r.ownerDocument.body),r}function eZ(e,t){let r=eS(e);if(e_(e))return r;if(!eM(e)){let t=eF(e);for(;t&&!eL(t);){if(eT(t)&&!eQ(t))return t;t=eF(t)}return r}let n=eJ(e,t);for(;n&&["table","td","th"].includes(ek(n))&&eQ(n);)n=eJ(n,t);return n&&eL(n)&&eQ(n)&&!eO(n)?r:n||function(e){let t=eF(e);for(;eM(t)&&!eL(t);){if(eO(t))return t;if(e_(t))break;t=eF(t)}return null}(e)||r}let e0=async function(e){let t=this.getOffsetParent||eZ,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=eM(t),a=eR(t),l="fixed"===r,o=eq(e,!0,l,t),s={scrollLeft:0,scrollTop:0},i=el(0);if(n||!n&&!l){if(("body"!==ek(t)||eD(a))&&(s=e$(t)),n){let e=eq(t,!0,l,t);i.x=e.x+t.clientLeft,i.y=e.y+t.clientTop}else a&&(i.x=eG(a))}let c=!a||n||l?el(0):eY(a,s);return{x:o.left+s.scrollLeft-i.x-c.x,y:o.top+s.scrollTop-i.y-c.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},e1={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e,l="fixed"===a,o=eR(n),s=!!t&&e_(t.floating);if(n===o||s&&l)return r;let i={scrollLeft:0,scrollTop:0},c=el(1),d=el(0),u=eM(n);if((u||!u&&!l)&&(("body"!==ek(n)||eD(o))&&(i=e$(n)),eM(n))){let e=eq(n);c=eW(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}let f=!o||u||l?el(0):eY(o,i,!0);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-i.scrollLeft*c.x+d.x+f.x,y:r.y*c.y-i.scrollTop*c.y+d.y+f.y}},getDocumentElement:eR,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e,l=[..."clippingAncestors"===r?e_(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=eU(e,[],!1).filter(e=>eT(e)&&"body"!==ek(e)),a=null,l="fixed"===eI(e).position,o=l?eF(e):e;for(;eT(o)&&!eL(o);){let t=eI(o),r=eO(o);r||"fixed"!==t.position||(a=null),(l?!r&&!a:!r&&"static"===t.position&&!!a&&["absolute","fixed"].includes(a.position)||eD(o)&&!r&&function e(t,r){let n=eF(t);return!(n===r||!eT(n)||eL(n))&&("fixed"===eI(n).position||e(n,r))}(e,o))?n=n.filter(e=>e!==o):a=t,o=eF(o)}return t.set(e,n),n}(t,this._c):[].concat(r),n],o=l[0],s=l.reduce((e,r)=>{let n=eX(t,r,a);return e.top=er(n.top,e.top),e.right=et(n.right,e.right),e.bottom=et(n.bottom,e.bottom),e.left=er(n.left,e.left),e},eX(t,o,a));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:eZ,getElementRects:e0,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=eB(e);return{width:t,height:r}},getScale:eW,isElement:eT,isRTL:function(e){return"rtl"===eI(e).direction}};function e2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let e5=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:a,rects:l,platform:o,elements:s,middlewareData:i}=t,{element:c,padding:d=0}=ei(e,t)||{};if(null==c)return{};let u=ex(d),f={x:r,y:n},m=eu(em(a)),p=ef(m),h=await o.getDimensions(c),x="y"===m,g=x?"clientHeight":"clientWidth",v=l.reference[p]+l.reference[m]-f[m]-l.floating[p],y=f[m]-l.reference[m],b=await (null==o.getOffsetParent?void 0:o.getOffsetParent(c)),w=b?b[g]:0;w&&await (null==o.isElement?void 0:o.isElement(b))||(w=s.floating[g]||l.floating[p]);let j=w/2-h[p]/2-1,N=et(u[x?"top":"left"],j),C=et(u[x?"bottom":"right"],j),k=w-h[p]-C,S=w/2-h[p]/2+(v/2-y/2),R=er(N,et(S,k)),E=!i.arrow&&null!=ed(a)&&S!==R&&l.reference[p]/2-(S<N?N:C)-h[p]/2<0,T=E?S<N?S-N:S-k:0;return{[m]:f[m]+T,data:{[m]:R,centerOffset:S-R-T,...E&&{alignmentOffset:T}},reset:E}}}),e4=(e,t,r)=>{let n=new Map,a={platform:e1,...r},l={...a.platform,_c:n};return ey(e,t,{...a,platform:l})};var e3=r(5740),e6="undefined"!=typeof document?o.useLayoutEffect:o.useEffect;function e8(e,t){let r,n,a;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n=r;0!=n--;)if(!e8(e[n],t[n]))return!1;return!0}if((r=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!({}).hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!=n--;){let r=a[n];if(("_owner"!==r||!e.$$typeof)&&!e8(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function e9(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function e7(e,t){let r=e9(e);return Math.round(t*r)/r}function te(e){let t=o.useRef(e);return e6(()=>{t.current=e}),t}let tt=e=>({name:"arrow",options:e,fn(t){let{element:r,padding:n}="function"==typeof e?e(t):e;return r&&({}).hasOwnProperty.call(r,"current")?null!=r.current?e5({element:r.current,padding:n}).fn(t):{}:r?e5({element:r,padding:n}).fn(t):{}}}),tr=(e,t)=>({...function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;let{x:a,y:l,placement:o,middlewareData:s}=t,i=await eN(t,e);return o===(null==(r=s.offset)?void 0:r.placement)&&null!=(n=s.arrow)&&n.alignmentOffset?{}:{x:a+i.x,y:l+i.y,data:{...i,placement:o}}}}}(e),options:[e,t]}),tn=(e,t)=>({...function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:r,y:n,placement:a}=t,{mainAxis:l=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...i}=ei(e,t),c={x:r,y:n},d=await eb(t,i),u=em(ec(a)),f=eu(u),m=c[f],p=c[u];if(l){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=m+d[e],n=m-d[t];m=er(r,et(m,n))}if(o){let e="y"===u?"top":"left",t="y"===u?"bottom":"right",r=p+d[e],n=p-d[t];p=er(r,et(p,n))}let h=s.fn({...t,[f]:m,[u]:p});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:l,[u]:o}}}}}}(e),options:[e,t]}),ta=(e,t)=>({...function(e){return void 0===e&&(e={}),{options:e,fn(t){let{x:r,y:n,placement:a,rects:l,middlewareData:o}=t,{offset:s=0,mainAxis:i=!0,crossAxis:c=!0}=ei(e,t),d={x:r,y:n},u=em(a),f=eu(u),m=d[f],p=d[u],h=ei(s,t),x="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(i){let e="y"===f?"height":"width",t=l.reference[f]-l.floating[e]+x.mainAxis,r=l.reference[f]+l.reference[e]-x.mainAxis;m<t?m=t:m>r&&(m=r)}if(c){var g,v;let e="y"===f?"width":"height",t=["top","left"].includes(ec(a)),r=l.reference[u]-l.floating[e]+(t&&(null==(g=o.offset)?void 0:g[u])||0)+(t?0:x.crossAxis),n=l.reference[u]+l.reference[e]+(t?0:(null==(v=o.offset)?void 0:v[u])||0)-(t?x.crossAxis:0);p<r?p=r:p>n&&(p=n)}return{[f]:m,[u]:p}}}}(e),options:[e,t]}),tl=(e,t)=>({...function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n,a,l,o;let{placement:s,middlewareData:i,rects:c,initialPlacement:d,platform:u,elements:f}=t,{mainAxis:m=!0,crossAxis:p=!0,fallbackPlacements:h,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...y}=ei(e,t);if(null!=(r=i.arrow)&&r.alignmentOffset)return{};let b=ec(s),w=em(d),j=ec(d)===d,N=await (null==u.isRTL?void 0:u.isRTL(f.floating)),C=h||(j||!v?[eh(d)]:function(e){let t=eh(e);return[ep(e),t,ep(t)]}(d)),k="none"!==g;!h&&k&&C.push(...function(e,t,r,n){let a=ed(e),l=function(e,t,r){let n=["left","right"],a=["right","left"];switch(e){case"top":case"bottom":if(r)return t?a:n;return t?n:a;case"left":case"right":return t?["top","bottom"]:["bottom","top"];default:return[]}}(ec(e),"start"===r,n);return a&&(l=l.map(e=>e+"-"+a),t&&(l=l.concat(l.map(ep)))),l}(d,v,g,N));let S=[d,...C],R=await eb(t,y),E=[],T=(null==(n=i.flip)?void 0:n.overflows)||[];if(m&&E.push(R[b]),p){let e=function(e,t,r){void 0===r&&(r=!1);let n=ed(e),a=eu(em(e)),l=ef(a),o="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[l]>t.floating[l]&&(o=eh(o)),[o,eh(o)]}(s,c,N);E.push(R[e[0]],R[e[1]])}if(T=[...T,{placement:s,overflows:E}],!E.every(e=>e<=0)){let e=((null==(a=i.flip)?void 0:a.index)||0)+1,t=S[e];if(t)return{data:{index:e,overflows:T},reset:{placement:t}};let r=null==(l=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:l.placement;if(!r)switch(x){case"bestFit":{let e=null==(o=T.filter(e=>{if(k){let t=em(e.placement);return t===w||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:o[0];e&&(r=e);break}case"initialPlacement":r=d}if(s!==r)return{reset:{placement:r}}}return{}}}}(e),options:[e,t]}),to=(e,t)=>({...function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;let a,l;let{placement:o,rects:s,platform:i,elements:c}=t,{apply:d=()=>{},...u}=ei(e,t),f=await eb(t,u),m=ec(o),p=ed(o),h="y"===em(o),{width:x,height:g}=s.floating;"top"===m||"bottom"===m?(a=m,l=p===(await (null==i.isRTL?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(l=m,a="end"===p?"top":"bottom");let v=g-f.top-f.bottom,y=x-f.left-f.right,b=et(g-f[a],v),w=et(x-f[l],y),j=!t.middlewareData.shift,N=b,C=w;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(C=y),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(N=v),j&&!p){let e=er(f.left,0),t=er(f.right,0),r=er(f.top,0),n=er(f.bottom,0);h?C=x-2*(0!==e||0!==t?e+t:er(f.left,f.right)):N=g-2*(0!==r||0!==n?r+n:er(f.top,f.bottom))}await d({...t,availableWidth:C,availableHeight:N});let k=await i.getDimensions(c.floating);return x!==k.width||g!==k.height?{reset:{rects:!0}}:{}}}}(e),options:[e,t]}),ts=(e,t)=>({...function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:r}=t,{strategy:n="referenceHidden",...a}=ei(e,t);switch(n){case"referenceHidden":{let e=ew(await eb(t,{...a,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ej(e)}}}case"escaped":{let e=ew(await eb(t,{...a,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:ej(e)}}}default:return{}}}}}(e),options:[e,t]}),ti=(e,t)=>({...tt(e),options:[e,t]});var tc=o.forwardRef((e,t)=>{let{children:r,width:n=10,height:a=5,...o}=e;return(0,l.jsx)(D.sG.svg,{...o,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:(0,l.jsx)("polygon",{points:"0,0 30,0 15,10"})})});function td(e){let[t,r]=o.useState(void 0);return(0,X.N)(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,a;if(!Array.isArray(t)||!t.length)return;let l=t[0];if("borderBoxSize"in l){let e=l.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,a=t.blockSize}else n=e.offsetWidth,a=e.offsetHeight;r({width:n,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}tc.displayName="Arrow";var tu="Popper",[tf,tm]=(0,M.A)(tu),[tp,th]=tf(tu),tx=e=>{let{__scopePopper:t,children:r}=e,[n,a]=o.useState(null);return(0,l.jsx)(tp,{scope:t,anchor:n,onAnchorChange:a,children:r})};tx.displayName=tu;var tg="PopperAnchor",tv=o.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:n,...a}=e,s=th(tg,r),i=o.useRef(null),c=(0,T.s)(t,i);return o.useEffect(()=>{s.onAnchorChange(n?.current||i.current)}),n?null:(0,l.jsx)(D.sG.div,{...a,ref:c})});tv.displayName=tg;var ty="PopperContent",[tb,tw]=tf(ty),tj=o.forwardRef((e,t)=>{let{__scopePopper:r,side:n="bottom",sideOffset:a=0,align:s="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:p=!1,updatePositionStrategy:h="optimized",onPlaced:x,...g}=e,v=th(ty,r),[y,b]=o.useState(null),w=(0,T.s)(t,e=>b(e)),[j,N]=o.useState(null),C=td(j),k=C?.width??0,S=C?.height??0,R="number"==typeof f?f:{top:0,right:0,bottom:0,left:0,...f},E=Array.isArray(u)?u:[u],M=E.length>0,A={padding:R,boundary:E.filter(tS),altBoundary:M},{refs:_,floatingStyles:O,placement:P,isPositioned:L,middlewareData:I}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:l,floating:s}={},transform:i=!0,whileElementsMounted:c,open:d}=e,[u,f]=o.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=o.useState(n);e8(m,n)||p(n);let[h,x]=o.useState(null),[g,v]=o.useState(null),y=o.useCallback(e=>{e!==N.current&&(N.current=e,x(e))},[]),b=o.useCallback(e=>{e!==C.current&&(C.current=e,v(e))},[]),w=l||h,j=s||g,N=o.useRef(null),C=o.useRef(null),k=o.useRef(u),S=null!=c,R=te(c),E=te(a),T=te(d),M=o.useCallback(()=>{if(!N.current||!C.current)return;let e={placement:t,strategy:r,middleware:m};E.current&&(e.platform=E.current),e4(N.current,C.current,e).then(e=>{let t={...e,isPositioned:!1!==T.current};A.current&&!e8(k.current,t)&&(k.current=t,e3.flushSync(()=>{f(t)}))})},[m,t,r,E,T]);e6(()=>{!1===d&&k.current.isPositioned&&(k.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[d]);let A=o.useRef(!1);e6(()=>(A.current=!0,()=>{A.current=!1}),[]),e6(()=>{if(w&&(N.current=w),j&&(C.current=j),w&&j){if(R.current)return R.current(w,j,M);M()}},[w,j,M,R,S]);let D=o.useMemo(()=>({reference:N,floating:C,setReference:y,setFloating:b}),[y,b]),_=o.useMemo(()=>({reference:w,floating:j}),[w,j]),O=o.useMemo(()=>{let e={position:r,left:0,top:0};if(!_.floating)return e;let t=e7(_.floating,u.x),n=e7(_.floating,u.y);return i?{...e,transform:"translate("+t+"px, "+n+"px)",...e9(_.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,i,_.floating,u.x,u.y]);return o.useMemo(()=>({...u,update:M,refs:D,elements:_,floatingStyles:O}),[u,M,D,_,O])}({strategy:"fixed",placement:n+("center"!==s?"-"+s:""),whileElementsMounted:(...e)=>(function(e,t,r,n){let a;void 0===n&&(n={});let{ancestorScroll:l=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,d=eH(e),u=l||o?[...d?eU(d):[],...eU(t)]:[];u.forEach(e=>{l&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});let f=d&&i?function(e,t){let r,n=null,a=eR(e);function l(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function o(s,i){void 0===s&&(s=!1),void 0===i&&(i=1),l();let c=e.getBoundingClientRect(),{left:d,top:u,width:f,height:m}=c;if(s||t(),!f||!m)return;let p=ea(u),h=ea(a.clientWidth-(d+f)),x={rootMargin:-p+"px "+-h+"px "+-ea(a.clientHeight-(u+m))+"px "+-ea(d)+"px",threshold:er(0,et(1,i))||1},g=!0;function v(t){let n=t[0].intersectionRatio;if(n!==i){if(!g)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||e2(c,e.getBoundingClientRect())||o(),g=!1}try{n=new IntersectionObserver(v,{...x,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(v,x)}n.observe(e)}(!0),l}(d,r):null,m=-1,p=null;s&&(p=new ResizeObserver(e=>{let[n]=e;n&&n.target===d&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),r()}),d&&!c&&p.observe(d),p.observe(t));let h=c?eq(e):null;return c&&function t(){let n=eq(e);h&&!e2(h,n)&&r(),h=n,a=requestAnimationFrame(t)}(),r(),()=>{var e;u.forEach(e=>{l&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==f||f(),null==(e=p)||e.disconnect(),p=null,c&&cancelAnimationFrame(a)}})(...e,{animationFrame:"always"===h}),elements:{reference:v.anchor},middleware:[tr({mainAxis:a+S,alignmentAxis:i}),d&&tn({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?ta():void 0,...A}),d&&tl({...A}),to({...A,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{let{width:a,height:l}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${a}px`),o.setProperty("--radix-popper-anchor-height",`${l}px`)}}),j&&ti({element:j,padding:c}),tR({arrowWidth:k,arrowHeight:S}),p&&ts({strategy:"referenceHidden",...A})]}),[$,F]=tE(P),z=(0,U.c)(x);(0,X.N)(()=>{L&&z?.()},[L,z]);let B=I.arrow?.x,H=I.arrow?.y,W=I.arrow?.centerOffset!==0,[V,K]=o.useState();return(0,X.N)(()=>{y&&K(window.getComputedStyle(y).zIndex)},[y]),(0,l.jsx)("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:L?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(" "),...I.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,l.jsx)(tb,{scope:r,placedSide:$,onArrowChange:N,arrowX:B,arrowY:H,shouldHideArrow:W,children:(0,l.jsx)(D.sG.div,{"data-side":$,"data-align":F,...g,ref:w,style:{...g.style,animation:L?void 0:"none"}})})})});tj.displayName=ty;var tN="PopperArrow",tC={top:"bottom",right:"left",bottom:"top",left:"right"},tk=o.forwardRef(function(e,t){let{__scopePopper:r,...n}=e,a=tw(tN,r),o=tC[a.placedSide];return(0,l.jsx)("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:(0,l.jsx)(tc,{...n,ref:t,style:{...n.style,display:"block"}})})});function tS(e){return null!==e}tk.displayName=tN;var tR=e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:a}=t,l=a.arrow?.centerOffset!==0,o=l?0:e.arrowWidth,s=l?0:e.arrowHeight,[i,c]=tE(r),d={start:"0%",center:"50%",end:"100%"}[c],u=(a.arrow?.x??0)+o/2,f=(a.arrow?.y??0)+s/2,m="",p="";return"bottom"===i?(m=l?d:`${u}px`,p=`${-s}px`):"top"===i?(m=l?d:`${u}px`,p=`${n.floating.height+s}px`):"right"===i?(m=`${-s}px`,p=l?d:`${f}px`):"left"===i&&(m=`${n.floating.width+s}px`,p=l?d:`${f}px`),{data:{x:m,y:p}}}});function tE(e){let[t,r="center"]=e.split("-");return[t,r]}var tT=r(707),tM=r(8060),tA="rovingFocusGroup.onEntryFocus",tD={bubbles:!1,cancelable:!0},t_="RovingFocusGroup",[tO,tP,tL]=(0,_.N)(t_),[tI,t$]=(0,M.A)(t_,[tL]),[tF,tU]=tI(t_),tz=o.forwardRef((e,t)=>(0,l.jsx)(tO.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,l.jsx)(tO.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,l.jsx)(tB,{...e,ref:t})})}));tz.displayName=t_;var tB=o.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...m}=e,p=o.useRef(null),h=(0,T.s)(t,p),x=P(s),[g=null,v]=(0,A.i)({prop:i,defaultProp:c,onChange:d}),[y,b]=o.useState(!1),w=(0,U.c)(u),j=tP(r),N=o.useRef(!1),[C,k]=o.useState(0);return o.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(tA,w),()=>e.removeEventListener(tA,w)},[w]),(0,l.jsx)(tF,{scope:r,orientation:n,dir:x,loop:a,currentTabStopId:g,onItemFocus:o.useCallback(e=>v(e),[v]),onItemShiftTab:o.useCallback(()=>b(!0),[]),onFocusableItemAdd:o.useCallback(()=>k(e=>e+1),[]),onFocusableItemRemove:o.useCallback(()=>k(e=>e-1),[]),children:(0,l.jsx)(D.sG.div,{tabIndex:y||0===C?-1:0,"data-orientation":n,...m,ref:h,style:{outline:"none",...e.style},onMouseDown:(0,E.m)(e.onMouseDown,()=>{N.current=!0}),onFocus:(0,E.m)(e.onFocus,e=>{let t=!N.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(tA,tD);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=j().filter(e=>e.focusable);tK([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),f)}}N.current=!1}),onBlur:(0,E.m)(e.onBlur,()=>b(!1))})})}),tH="RovingFocusGroupItem",tW=o.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:s,...i}=e,c=Z(),d=s||c,u=tU(tH,r),f=u.currentTabStopId===d,m=tP(r),{onFocusableItemAdd:p,onFocusableItemRemove:h}=u;return o.useEffect(()=>{if(n)return p(),()=>h()},[n,p,h]),(0,l.jsx)(tO.ItemSlot,{scope:r,id:d,focusable:n,active:a,children:(0,l.jsx)(D.sG.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...i,ref:t,onMouseDown:(0,E.m)(e.onMouseDown,e=>{n?u.onItemFocus(d):e.preventDefault()}),onFocus:(0,E.m)(e.onFocus,()=>u.onItemFocus(d)),onKeyDown:(0,E.m)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=function(e,t,r){var n;let a=(n=e.key,"rtl"!==r?n:"ArrowLeft"===n?"ArrowRight":"ArrowRight"===n?"ArrowLeft":n);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(a))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(a)))return tV[a]}(e,u.orientation,u.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=m().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();let n=r.indexOf(e.currentTarget);r=u.loop?function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(r,n+1):r.slice(n+1)}setTimeout(()=>tK(r))}})})})});tW.displayName=tH;var tV={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function tK(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}var tq=r(2705),tG=new WeakMap,tY=new WeakMap,tX={},tQ=0,tJ=function(e){return e&&(e.host||tJ(e.parentNode))},tZ=function(e,t,r,n){var a=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var r=tJ(e);return r&&t.contains(r)?r:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});tX[r]||(tX[r]=new WeakMap);var l=tX[r],o=[],s=new Set,i=new Set(a),c=function(e){!e||s.has(e)||(s.add(e),c(e.parentNode))};a.forEach(c);var d=function(e){!e||i.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,i=(tG.get(e)||0)+1,c=(l.get(e)||0)+1;tG.set(e,i),l.set(e,c),o.push(e),1===i&&a&&tY.set(e,!0),1===c&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),s.clear(),tQ++,function(){o.forEach(function(e){var t=tG.get(e)-1,a=l.get(e)-1;tG.set(e,t),l.set(e,a),t||(tY.has(e)||e.removeAttribute(n),tY.delete(e)),a||e.removeAttribute(r)}),--tQ||(tG=new WeakMap,tG=new WeakMap,tY=new WeakMap,tX={})}},t0=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n,a=Array.from(Array.isArray(e)?e:[e]),l=t||(n=e,"undefined"==typeof document?null:(Array.isArray(n)?n[0]:n).ownerDocument.body);return l?(a.push.apply(a,Array.from(l.querySelectorAll("[aria-live]"))),tZ(a,l,r,"aria-hidden")):function(){return null}},t1=function(){return(t1=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function t2(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)0>t.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}Object.create,Object.create;var t5=("function"==typeof SuppressedError&&SuppressedError,"right-scroll-bar-position"),t4="width-before-scroll-bar";function t3(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var t6="undefined"!=typeof window?o.useLayoutEffect:o.useEffect,t8=new WeakMap;function t9(e){return e}var t7=function(e){void 0===e&&(e={});var t,r,n,a=(void 0===t&&(t=t9),r=[],n=!1,{read:function(){if(n)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:null},useMedium:function(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var l=function(){var r=t;t=[],r.forEach(e)},o=function(){return Promise.resolve().then(l)};o(),r={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),r}}}});return a.options=t1({async:!0,ssr:!1},e),a}(),re=function(){},rt=o.forwardRef(function(e,t){var r,n,a,l,s=o.useRef(null),i=o.useState({onScrollCapture:re,onWheelCapture:re,onTouchMoveCapture:re}),c=i[0],d=i[1],u=e.forwardProps,f=e.children,m=e.className,p=e.removeScrollBar,h=e.enabled,x=e.shards,g=e.sideCar,v=e.noIsolation,y=e.inert,b=e.allowPinchZoom,w=e.as,j=e.gapMode,N=t2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=(r=[s,t],n=function(e){return r.forEach(function(t){return t3(t,e)})},(a=(0,o.useState)(function(){return{value:null,callback:n,facade:{get current(){return a.value},set current(value){var e=a.value;e!==value&&(a.value=value,a.callback(value,e))}}}})[0]).callback=n,l=a.facade,t6(function(){var e=t8.get(l);if(e){var t=new Set(e),n=new Set(r),a=l.current;t.forEach(function(e){n.has(e)||t3(e,null)}),n.forEach(function(e){t.has(e)||t3(e,a)})}t8.set(l,r)},[r]),l),k=t1(t1({},N),c);return o.createElement(o.Fragment,null,h&&o.createElement(g,{sideCar:t7,removeScrollBar:p,shards:x,noIsolation:v,inert:y,setCallbacks:d,allowPinchZoom:!!b,lockRef:s,gapMode:j}),u?o.cloneElement(o.Children.only(f),t1(t1({},k),{ref:C})):o.createElement(void 0===w?"div":w,t1({},k,{className:m,ref:C}),f))});rt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},rt.classNames={fullWidth:t4,zeroRight:t5};var rr=function(e){var t=e.sideCar,r=t2(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw Error("Sidecar medium not found");return o.createElement(n,t1({},r))};rr.isSideCarExport=!0;var rn=function(){var e=0,t=null;return{add:function(n){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=a||r.nc;return t&&e.setAttribute("nonce",t),e}())){var l,o;(l=t).styleSheet?l.styleSheet.cssText=n:l.appendChild(document.createTextNode(n)),o=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(o)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ra=function(){var e=rn();return function(t,r){o.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},rl=function(){var e=ra();return function(t){return e(t.styles,t.dynamic),null}},ro={left:0,top:0,right:0,gap:0},rs=function(e){return parseInt(e||"",10)||0},ri=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[rs(r),rs(n),rs(a)]},rc=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return ro;var t=ri(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},rd=rl(),ru="data-scroll-locked",rf=function(e,t,r,n){var a=e.left,l=e.top,o=e.right,s=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(s,"px ").concat(n,";\n }\n body[").concat(ru,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(l,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(t5," {\n right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(t4," {\n margin-right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(t5," .").concat(t5," {\n right: 0 ").concat(n,";\n }\n \n .").concat(t4," .").concat(t4," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(ru,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},rm=function(){var e=parseInt(document.body.getAttribute(ru)||"0",10);return isFinite(e)?e:0},rp=function(){o.useEffect(function(){return document.body.setAttribute(ru,(rm()+1).toString()),function(){var e=rm()-1;e<=0?document.body.removeAttribute(ru):document.body.setAttribute(ru,e.toString())}},[])},rh=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=void 0===n?"margin":n;rp();var l=o.useMemo(function(){return rc(a)},[a]);return o.createElement(rd,{styles:rf(l,!t,a,r?"":"!important")})},rx=!1;if("undefined"!=typeof window)try{var rg=Object.defineProperty({},"passive",{get:function(){return rx=!0,!0}});window.addEventListener("test",rg,rg),window.removeEventListener("test",rg,rg)}catch(e){rx=!1}var rv=!!rx&&{passive:!1},ry=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&"TEXTAREA"!==e.tagName&&"visible"===r[t])},rb=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),rw(e,n)){var a=rj(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},rw=function(e,t){return"v"===e?ry(t,"overflowY"):ry(t,"overflowX")},rj=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},rN=function(e,t,r,n,a){var l,o=(l=window.getComputedStyle(t).direction,"h"===e&&"rtl"===l?-1:1),s=o*n,i=r.target,c=t.contains(i),d=!1,u=s>0,f=0,m=0;do{var p=rj(e,i),h=p[0],x=p[1]-p[2]-o*h;(h||x)&&rw(e,i)&&(f+=x,m+=h),i instanceof ShadowRoot?i=i.host:i=i.parentNode}while(!c&&i!==document.body||c&&(t.contains(i)||t===i));return u&&(a&&1>Math.abs(f)||!a&&s>f)?d=!0:!u&&(a&&1>Math.abs(m)||!a&&-s>m)&&(d=!0),d},rC=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},rk=function(e){return[e.deltaX,e.deltaY]},rS=function(e){return e&&"current"in e?e.current:e},rR=0,rE=[];let rT=(n=function(e){var t=o.useRef([]),r=o.useRef([0,0]),n=o.useRef(),a=o.useState(rR++)[0],l=o.useState(rl)[0],s=o.useRef(e);o.useEffect(function(){s.current=e},[e]),o.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var t=(function(e,t,r){if(r||2==arguments.length)for(var n,a=0,l=t.length;a<l;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(rS),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var i=o.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var a,l=rC(e),o=r.current,i="deltaX"in e?e.deltaX:o[0]-l[0],c="deltaY"in e?e.deltaY:o[1]-l[1],d=e.target,u=Math.abs(i)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var f=rb(u,d);if(!f)return!0;if(f?a=u:(a="v"===u?"h":"v",f=rb(u,d)),!f)return!1;if(!n.current&&"changedTouches"in e&&(i||c)&&(n.current=a),!a)return!0;var m=n.current||a;return rN(m,t,e,"h"===m?i:c,!0)},[]),c=o.useCallback(function(e){if(rE.length&&rE[rE.length-1]===l){var r="deltaY"in e?rk(e):rC(e),n=t.current.filter(function(t){var n;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(n=t.delta)[0]===r[0]&&n[1]===r[1]})[0];if(n&&n.should){e.cancelable&&e.preventDefault();return}if(!n){var a=(s.current.shards||[]).map(rS).filter(Boolean).filter(function(t){return t.contains(e.target)});(a.length>0?i(e,a[0]):!s.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),d=o.useCallback(function(e,r,n,a){var l={name:e,delta:r,target:n,should:a,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(n)};t.current.push(l),setTimeout(function(){t.current=t.current.filter(function(e){return e!==l})},1)},[]),u=o.useCallback(function(e){r.current=rC(e),n.current=void 0},[]),f=o.useCallback(function(t){d(t.type,rk(t),t.target,i(t,e.lockRef.current))},[]),m=o.useCallback(function(t){d(t.type,rC(t),t.target,i(t,e.lockRef.current))},[]);o.useEffect(function(){return rE.push(l),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,rv),document.addEventListener("touchmove",c,rv),document.addEventListener("touchstart",u,rv),function(){rE=rE.filter(function(e){return e!==l}),document.removeEventListener("wheel",c,rv),document.removeEventListener("touchmove",c,rv),document.removeEventListener("touchstart",u,rv)}},[]);var p=e.removeScrollBar,h=e.inert;return o.createElement(o.Fragment,null,h?o.createElement(l,{styles:"\n .block-interactivity-".concat(a," {pointer-events: none;}\n .allow-interactivity-").concat(a," {pointer-events: all;}\n")}):null,p?o.createElement(rh,{gapMode:e.gapMode}):null)},t7.useMedium(n),rr);var rM=o.forwardRef(function(e,t){return o.createElement(rt,t1({},e,{ref:t,sideCar:rT}))});rM.classNames=rt.classNames;var rA=["Enter"," "],rD=["ArrowUp","PageDown","End"],r_=["ArrowDown","PageUp","Home",...rD],rO={ltr:[...rA,"ArrowRight"],rtl:[...rA,"ArrowLeft"]},rP={ltr:["ArrowLeft"],rtl:["ArrowRight"]},rL="Menu",[rI,r$,rF]=(0,_.N)(rL),[rU,rz]=(0,M.A)(rL,[rF,tm,t$]),rB=tm(),rH=t$(),[rW,rV]=rU(rL),[rK,rq]=rU(rL),rG=e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:a,onOpenChange:s,modal:i=!0}=e,c=rB(t),[d,u]=o.useState(null),f=o.useRef(!1),m=(0,U.c)(s),p=P(a);return o.useEffect(()=>{let e=()=>{f.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>f.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,l.jsx)(tx,{...c,children:(0,l.jsx)(rW,{scope:t,open:r,onOpenChange:m,content:d,onContentChange:u,children:(0,l.jsx)(rK,{scope:t,onClose:o.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:p,modal:i,children:n})})})};rG.displayName=rL;var rY=o.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,a=rB(r);return(0,l.jsx)(tv,{...a,...n,ref:t})});rY.displayName="MenuAnchor";var rX="MenuPortal",[rQ,rJ]=rU(rX,{forceMount:void 0}),rZ=e=>{let{__scopeMenu:t,forceMount:r,children:n,container:a}=e,o=rV(rX,t);return(0,l.jsx)(rQ,{scope:t,forceMount:r,children:(0,l.jsx)(tM.C,{present:r||o.open,children:(0,l.jsx)(tT.Z,{asChild:!0,container:a,children:n})})})};rZ.displayName=rX;var r0="MenuContent",[r1,r2]=rU(r0),r5=o.forwardRef((e,t)=>{let r=rJ(r0,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,o=rV(r0,e.__scopeMenu),s=rq(r0,e.__scopeMenu);return(0,l.jsx)(rI.Provider,{scope:e.__scopeMenu,children:(0,l.jsx)(tM.C,{present:n||o.open,children:(0,l.jsx)(rI.Slot,{scope:e.__scopeMenu,children:s.modal?(0,l.jsx)(r4,{...a,ref:t}):(0,l.jsx)(r3,{...a,ref:t})})})})}),r4=o.forwardRef((e,t)=>{let r=rV(r0,e.__scopeMenu),n=o.useRef(null),a=(0,T.s)(t,n);return o.useEffect(()=>{let e=n.current;if(e)return t0(e)},[]),(0,l.jsx)(r6,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:(0,E.m)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),r3=o.forwardRef((e,t)=>{let r=rV(r0,e.__scopeMenu);return(0,l.jsx)(r6,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),r6=o.forwardRef((e,t)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:p,onDismiss:h,disableOutsideScroll:x,...g}=e,v=rV(r0,r),y=rq(r0,r),b=rB(r),w=rH(r),j=r$(r),[N,C]=o.useState(null),k=o.useRef(null),S=(0,T.s)(t,k,v.onContentChange),R=o.useRef(0),M=o.useRef(""),A=o.useRef(0),D=o.useRef(null),_=o.useRef("right"),O=o.useRef(0),P=x?rM:o.Fragment,I=x?{as:tq.DX,allowPinchZoom:!0}:void 0,F=e=>{let t=M.current+e,r=j().filter(e=>!e.disabled),n=document.activeElement,a=r.find(e=>e.ref.current===n)?.textValue,l=function(e,t,r){var n;let a=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,l=(n=Math.max(r?e.indexOf(r):-1,0),e.map((t,r)=>e[(n+r)%e.length]));1===a.length&&(l=l.filter(e=>e!==r));let o=l.find(e=>e.toLowerCase().startsWith(a.toLowerCase()));return o!==r?o:void 0}(r.map(e=>e.textValue),t,a),o=r.find(e=>e.textValue===l)?.ref.current;(function e(t){M.current=t,window.clearTimeout(R.current),""!==t&&(R.current=window.setTimeout(()=>e(""),1e3))})(t),o&&setTimeout(()=>o.focus())};o.useEffect(()=>()=>window.clearTimeout(R.current),[]),$();let U=o.useCallback(e=>_.current===D.current?.side&&function(e,t){return!!t&&function(e,t){let{x:r,y:n}=e,a=!1;for(let e=0,l=t.length-1;e<t.length;l=e++){let o=t[e].x,s=t[e].y,i=t[l].x,c=t[l].y;s>n!=c>n&&r<(i-o)*(n-s)/(c-s)+o&&(a=!a)}return a}({x:e.clientX,y:e.clientY},t)}(e,D.current?.area),[]);return(0,l.jsx)(r1,{scope:r,searchRef:M,onItemEnter:o.useCallback(e=>{U(e)&&e.preventDefault()},[U]),onItemLeave:o.useCallback(e=>{U(e)||(k.current?.focus(),C(null))},[U]),onTriggerLeave:o.useCallback(e=>{U(e)&&e.preventDefault()},[U]),pointerGraceTimerRef:A,onPointerGraceIntentChange:o.useCallback(e=>{D.current=e},[]),children:(0,l.jsx)(P,{...I,children:(0,l.jsx)(W,{asChild:!0,trapped:a,onMountAutoFocus:(0,E.m)(s,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:(0,l.jsx)(L.qW,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:p,onDismiss:h,children:(0,l.jsx)(tz,{asChild:!0,...w,dir:y.dir,orientation:"vertical",loop:n,currentTabStopId:N,onCurrentTabStopIdChange:C,onEntryFocus:(0,E.m)(d,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,l.jsx)(tj,{role:"menu","aria-orientation":"vertical","data-state":nj(v.open),"data-radix-menu-content":"",dir:y.dir,...b,...g,ref:S,style:{outline:"none",...g.style},onKeyDown:(0,E.m)(g.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!r&&n&&F(e.key));let a=k.current;if(e.target!==a||!r_.includes(e.key))return;e.preventDefault();let l=j().filter(e=>!e.disabled).map(e=>e.ref.current);rD.includes(e.key)&&l.reverse(),function(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}(l)}),onBlur:(0,E.m)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(R.current),M.current="")}),onPointerMove:(0,E.m)(e.onPointerMove,nk(e=>{let t=e.target,r=O.current!==e.clientX;if(e.currentTarget.contains(t)&&r){let t=e.clientX>O.current?"right":"left";_.current=t,O.current=e.clientX}}))})})})})})})});r5.displayName=r0;var r8=o.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,l.jsx)(D.sG.div,{role:"group",...n,ref:t})});r8.displayName="MenuGroup";var r9=o.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,l.jsx)(D.sG.div,{...n,ref:t})});r9.displayName="MenuLabel";var r7="MenuItem",ne="menu.itemSelect",nt=o.forwardRef((e,t)=>{let{disabled:r=!1,onSelect:n,...a}=e,s=o.useRef(null),i=rq(r7,e.__scopeMenu),c=r2(r7,e.__scopeMenu),d=(0,T.s)(t,s),u=o.useRef(!1);return(0,l.jsx)(nr,{...a,ref:d,disabled:r,onClick:(0,E.m)(e.onClick,()=>{let e=s.current;if(!r&&e){let t=new CustomEvent(ne,{bubbles:!0,cancelable:!0});e.addEventListener(ne,e=>n?.(e),{once:!0}),(0,D.hO)(e,t),t.defaultPrevented?u.current=!1:i.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:(0,E.m)(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:(0,E.m)(e.onKeyDown,e=>{let t=""!==c.searchRef.current;!r&&(!t||" "!==e.key)&&rA.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});nt.displayName=r7;var nr=o.forwardRef((e,t)=>{let{__scopeMenu:r,disabled:n=!1,textValue:a,...s}=e,i=r2(r7,r),c=rH(r),d=o.useRef(null),u=(0,T.s)(t,d),[f,m]=o.useState(!1),[p,h]=o.useState("");return o.useEffect(()=>{let e=d.current;e&&h((e.textContent??"").trim())},[s.children]),(0,l.jsx)(rI.ItemSlot,{scope:r,disabled:n,textValue:a??p,children:(0,l.jsx)(tW,{asChild:!0,...c,focusable:!n,children:(0,l.jsx)(D.sG.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:u,onPointerMove:(0,E.m)(e.onPointerMove,nk(e=>{n?i.onItemLeave(e):(i.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,E.m)(e.onPointerLeave,nk(e=>i.onItemLeave(e))),onFocus:(0,E.m)(e.onFocus,()=>m(!0)),onBlur:(0,E.m)(e.onBlur,()=>m(!1))})})})}),nn=o.forwardRef((e,t)=>{let{checked:r=!1,onCheckedChange:n,...a}=e;return(0,l.jsx)(nu,{scope:e.__scopeMenu,checked:r,children:(0,l.jsx)(nt,{role:"menuitemcheckbox","aria-checked":nN(r)?"mixed":r,...a,ref:t,"data-state":nC(r),onSelect:(0,E.m)(a.onSelect,()=>n?.(!!nN(r)||!r),{checkForDefaultPrevented:!1})})})});nn.displayName="MenuCheckboxItem";var na="MenuRadioGroup",[nl,no]=rU(na,{value:void 0,onValueChange:()=>{}}),ns=o.forwardRef((e,t)=>{let{value:r,onValueChange:n,...a}=e,o=(0,U.c)(n);return(0,l.jsx)(nl,{scope:e.__scopeMenu,value:r,onValueChange:o,children:(0,l.jsx)(r8,{...a,ref:t})})});ns.displayName=na;var ni="MenuRadioItem",nc=o.forwardRef((e,t)=>{let{value:r,...n}=e,a=no(ni,e.__scopeMenu),o=r===a.value;return(0,l.jsx)(nu,{scope:e.__scopeMenu,checked:o,children:(0,l.jsx)(nt,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":nC(o),onSelect:(0,E.m)(n.onSelect,()=>a.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});nc.displayName=ni;var nd="MenuItemIndicator",[nu,nf]=rU(nd,{checked:!1}),nm=o.forwardRef((e,t)=>{let{__scopeMenu:r,forceMount:n,...a}=e,o=nf(nd,r);return(0,l.jsx)(tM.C,{present:n||nN(o.checked)||!0===o.checked,children:(0,l.jsx)(D.sG.span,{...a,ref:t,"data-state":nC(o.checked)})})});nm.displayName=nd;var np=o.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,l.jsx)(D.sG.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});np.displayName="MenuSeparator";var nh=o.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,a=rB(r);return(0,l.jsx)(tk,{...a,...n,ref:t})});nh.displayName="MenuArrow";var[nx,ng]=rU("MenuSub"),nv="MenuSubTrigger",ny=o.forwardRef((e,t)=>{let r=rV(nv,e.__scopeMenu),n=rq(nv,e.__scopeMenu),a=ng(nv,e.__scopeMenu),s=r2(nv,e.__scopeMenu),i=o.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=s,u={__scopeMenu:e.__scopeMenu},f=o.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return o.useEffect(()=>f,[f]),o.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),d(null)}},[c,d]),(0,l.jsx)(rY,{asChild:!0,...u,children:(0,l.jsx)(nr,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":a.contentId,"data-state":nj(r.open),...e,ref:(0,T.t)(t,a.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:(0,E.m)(e.onPointerMove,nk(t=>{s.onItemEnter(t),t.defaultPrevented||e.disabled||r.open||i.current||(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{r.onOpenChange(!0),f()},100))})),onPointerLeave:(0,E.m)(e.onPointerLeave,nk(e=>{f();let t=r.content?.getBoundingClientRect();if(t){let n=r.content?.dataset.side,a="right"===n,l=t[a?"left":"right"],o=t[a?"right":"left"];s.onPointerGraceIntentChange({area:[{x:e.clientX+(a?-5:5),y:e.clientY},{x:l,y:t.top},{x:o,y:t.top},{x:o,y:t.bottom},{x:l,y:t.bottom}],side:n}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(e),e.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:(0,E.m)(e.onKeyDown,t=>{let a=""!==s.searchRef.current;!e.disabled&&(!a||" "!==t.key)&&rO[n.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})});ny.displayName=nv;var nb="MenuSubContent",nw=o.forwardRef((e,t)=>{let r=rJ(r0,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,s=rV(r0,e.__scopeMenu),i=rq(r0,e.__scopeMenu),c=ng(nb,e.__scopeMenu),d=o.useRef(null),u=(0,T.s)(t,d);return(0,l.jsx)(rI.Provider,{scope:e.__scopeMenu,children:(0,l.jsx)(tM.C,{present:n||s.open,children:(0,l.jsx)(rI.Slot,{scope:e.__scopeMenu,children:(0,l.jsx)(r6,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:"start",side:"rtl"===i.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{i.isUsingKeyboardRef.current&&d.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,E.m)(e.onFocusOutside,e=>{e.target!==c.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:(0,E.m)(e.onEscapeKeyDown,e=>{i.onClose(),e.preventDefault()}),onKeyDown:(0,E.m)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=rP[i.dir].includes(e.key);t&&r&&(s.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});function nj(e){return e?"open":"closed"}function nN(e){return"indeterminate"===e}function nC(e){return nN(e)?"indeterminate":e?"checked":"unchecked"}function nk(e){return t=>"mouse"===t.pointerType?e(t):void 0}nw.displayName=nb;var nS="DropdownMenu",[nR,nE]=(0,M.A)(nS,[rz]),nT=rz(),[nM,nA]=nR(nS),nD=e=>{let{__scopeDropdownMenu:t,children:r,dir:n,open:a,defaultOpen:s,onOpenChange:i,modal:c=!0}=e,d=nT(t),u=o.useRef(null),[f=!1,m]=(0,A.i)({prop:a,defaultProp:s,onChange:i});return(0,l.jsx)(nM,{scope:t,triggerId:Z(),triggerRef:u,contentId:Z(),open:f,onOpenChange:m,onOpenToggle:o.useCallback(()=>m(e=>!e),[m]),modal:c,children:(0,l.jsx)(rG,{...d,open:f,onOpenChange:m,dir:n,modal:c,children:r})})};nD.displayName=nS;var n_="DropdownMenuTrigger",nO=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...a}=e,o=nA(n_,r),s=nT(r);return(0,l.jsx)(rY,{asChild:!0,...s,children:(0,l.jsx)(D.sG.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...a,ref:(0,T.t)(t,o.triggerRef),onPointerDown:(0,E.m)(e.onPointerDown,e=>{n||0!==e.button||!1!==e.ctrlKey||(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:(0,E.m)(e.onKeyDown,e=>{!n&&(["Enter"," "].includes(e.key)&&o.onOpenToggle(),"ArrowDown"===e.key&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});nO.displayName=n_;var nP=e=>{let{__scopeDropdownMenu:t,...r}=e,n=nT(t);return(0,l.jsx)(rZ,{...n,...r})};nP.displayName="DropdownMenuPortal";var nL="DropdownMenuContent",nI=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nA(nL,r),s=nT(r),i=o.useRef(!1);return(0,l.jsx)(r5,{id:a.contentId,"aria-labelledby":a.triggerId,...s,...n,ref:t,onCloseAutoFocus:(0,E.m)(e.onCloseAutoFocus,e=>{i.current||a.triggerRef.current?.focus(),i.current=!1,e.preventDefault()}),onInteractOutside:(0,E.m)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;(!a.modal||n)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});nI.displayName=nL,o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(r8,{...a,...n,ref:t})}).displayName="DropdownMenuGroup";var n$=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(r9,{...a,...n,ref:t})});n$.displayName="DropdownMenuLabel";var nF=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(nt,{...a,...n,ref:t})});nF.displayName="DropdownMenuItem";var nU=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(nn,{...a,...n,ref:t})});nU.displayName="DropdownMenuCheckboxItem",o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(ns,{...a,...n,ref:t})}).displayName="DropdownMenuRadioGroup";var nz=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(nc,{...a,...n,ref:t})});nz.displayName="DropdownMenuRadioItem";var nB=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(nm,{...a,...n,ref:t})});nB.displayName="DropdownMenuItemIndicator";var nH=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(np,{...a,...n,ref:t})});nH.displayName="DropdownMenuSeparator",o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(nh,{...a,...n,ref:t})}).displayName="DropdownMenuArrow";var nW=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(ny,{...a,...n,ref:t})});nW.displayName="DropdownMenuSubTrigger";var nV=o.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,a=nT(r);return(0,l.jsx)(nw,{...a,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});nV.displayName="DropdownMenuSubContent";let nK=(0,d.A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),nq=(0,d.A)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),nG=(0,d.A)("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);o.forwardRef(({className:e,inset:t,children:r,...n},a)=>(0,l.jsxs)(nW,{ref:a,className:(0,j.cn)("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...n,children:[r,(0,l.jsx)(nK,{className:"ml-auto"})]})).displayName=nW.displayName,o.forwardRef(({className:e,...t},r)=>(0,l.jsx)(nV,{ref:r,className:(0,j.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",e),...t})).displayName=nV.displayName;let nY=o.forwardRef(({className:e,sideOffset:t=4,...r},n)=>(0,l.jsx)(nP,{children:(0,l.jsx)(nI,{ref:n,sideOffset:t,className:(0,j.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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",e),...r})}));nY.displayName=nI.displayName;let nX=o.forwardRef(({className:e,inset:t,...r},n)=>(0,l.jsx)(nF,{ref:n,className:(0,j.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...r}));nX.displayName=nF.displayName,o.forwardRef(({className:e,children:t,checked:r,...n},a)=>(0,l.jsxs)(nU,{ref:a,className:(0,j.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[(0,l.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,l.jsx)(nB,{children:(0,l.jsx)(nq,{className:"h-4 w-4"})})}),t]})).displayName=nU.displayName,o.forwardRef(({className:e,children:t,...r},n)=>(0,l.jsxs)(nz,{ref:n,className:(0,j.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[(0,l.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,l.jsx)(nB,{children:(0,l.jsx)(nG,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=nz.displayName,o.forwardRef(({className:e,inset:t,...r},n)=>(0,l.jsx)(n$,{ref:n,className:(0,j.cn)("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r})).displayName=n$.displayName,o.forwardRef(({className:e,...t},r)=>(0,l.jsx)(nH,{ref:r,className:(0,j.cn)("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=nH.displayName;var nQ=r(2899);let nJ=(0,C.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),nZ=o.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...a},o)=>{let s=n?tq.DX:"button";return(0,l.jsx)(s,{className:(0,j.cn)(nJ({variant:t,size:r,className:e})),ref:o,...a})});function n0(e,[t,r]){return Math.min(r,Math.max(t,e))}nZ.displayName="Button";var n1="ScrollArea",[n2,n5]=(0,M.A)(n1),[n4,n3]=n2(n1),n6=o.forwardRef((e,t)=>{let{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:s=600,...i}=e,[c,d]=o.useState(null),[u,f]=o.useState(null),[m,p]=o.useState(null),[h,x]=o.useState(null),[g,v]=o.useState(null),[y,b]=o.useState(0),[w,j]=o.useState(0),[N,C]=o.useState(!1),[k,S]=o.useState(!1),R=(0,T.s)(t,e=>d(e)),E=P(a);return(0,l.jsx)(n4,{scope:r,type:n,dir:E,scrollHideDelay:s,scrollArea:c,viewport:u,onViewportChange:f,content:m,onContentChange:p,scrollbarX:h,onScrollbarXChange:x,scrollbarXEnabled:N,onScrollbarXEnabledChange:C,scrollbarY:g,onScrollbarYChange:v,scrollbarYEnabled:k,onScrollbarYEnabledChange:S,onCornerWidthChange:b,onCornerHeightChange:j,children:(0,l.jsx)(D.sG.div,{dir:E,...i,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});n6.displayName=n1;var n8="ScrollAreaViewport",n9=o.forwardRef((e,t)=>{let{__scopeScrollArea:r,children:n,nonce:a,...s}=e,i=n3(n8,r),c=o.useRef(null),d=(0,T.s)(t,c,i.onViewportChange);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),(0,l.jsx)(D.sG.div,{"data-radix-scroll-area-viewport":"",...s,ref:d,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,l.jsx)("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});n9.displayName=n8;var n7="ScrollAreaScrollbar",ae=o.forwardRef((e,t)=>{let{forceMount:r,...n}=e,a=n3(n7,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=a,c="horizontal"===e.orientation;return o.useEffect(()=>(c?s(!0):i(!0),()=>{c?s(!1):i(!1)}),[c,s,i]),"hover"===a.type?(0,l.jsx)(at,{...n,ref:t,forceMount:r}):"scroll"===a.type?(0,l.jsx)(ar,{...n,ref:t,forceMount:r}):"auto"===a.type?(0,l.jsx)(an,{...n,ref:t,forceMount:r}):"always"===a.type?(0,l.jsx)(aa,{...n,ref:t}):null});ae.displayName=n7;var at=o.forwardRef((e,t)=>{let{forceMount:r,...n}=e,a=n3(n7,e.__scopeScrollArea),[s,i]=o.useState(!1);return o.useEffect(()=>{let e=a.scrollArea,t=0;if(e){let r=()=>{window.clearTimeout(t),i(!0)},n=()=>{t=window.setTimeout(()=>i(!1),a.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[a.scrollArea,a.scrollHideDelay]),(0,l.jsx)(tM.C,{present:r||s,children:(0,l.jsx)(an,{"data-state":s?"visible":"hidden",...n,ref:t})})}),ar=o.forwardRef((e,t)=>{var r,n;let{forceMount:a,...s}=e,i=n3(n7,e.__scopeScrollArea),c="horizontal"===e.orientation,d=aj(()=>f("SCROLL_END"),100),[u,f]=(r="hidden",n={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},o.useReducer((e,t)=>n[e][t]??e,r));return o.useEffect(()=>{if("idle"===u){let e=window.setTimeout(()=>f("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[u,i.scrollHideDelay,f]),o.useEffect(()=>{let e=i.viewport,t=c?"scrollLeft":"scrollTop";if(e){let r=e[t],n=()=>{let n=e[t];r!==n&&(f("SCROLL"),d()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[i.viewport,c,f,d]),(0,l.jsx)(tM.C,{present:a||"hidden"!==u,children:(0,l.jsx)(aa,{"data-state":"hidden"===u?"hidden":"visible",...s,ref:t,onPointerEnter:(0,E.m)(e.onPointerEnter,()=>f("POINTER_ENTER")),onPointerLeave:(0,E.m)(e.onPointerLeave,()=>f("POINTER_LEAVE"))})})}),an=o.forwardRef((e,t)=>{let r=n3(n7,e.__scopeScrollArea),{forceMount:n,...a}=e,[s,i]=o.useState(!1),c="horizontal"===e.orientation,d=aj(()=>{if(r.viewport){let e=r.viewport.offsetWidth<r.viewport.scrollWidth,t=r.viewport.offsetHeight<r.viewport.scrollHeight;i(c?e:t)}},10);return aN(r.viewport,d),aN(r.content,d),(0,l.jsx)(tM.C,{present:n||s,children:(0,l.jsx)(aa,{"data-state":s?"visible":"hidden",...a,ref:t})})}),aa=o.forwardRef((e,t)=>{let{orientation:r="vertical",...n}=e,a=n3(n7,e.__scopeScrollArea),s=o.useRef(null),i=o.useRef(0),[c,d]=o.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=ag(c.viewport,c.content),f={...n,sizes:c,onSizesChange:d,hasThumb:!!(u>0&&u<1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:e=>i.current=e};function m(e,t){return function(e,t,r,n="ltr"){let a=av(r),l=t||a/2,o=r.scrollbar.paddingStart+l,s=r.scrollbar.size-r.scrollbar.paddingEnd-(a-l),i=r.content-r.viewport;return ab([o,s],"ltr"===n?[0,i]:[-1*i,0])(e)}(e,i.current,c,t)}return"horizontal"===r?(0,l.jsx)(al,{...f,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){let e=ay(a.viewport.scrollLeft,c,a.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollLeft=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollLeft=m(e,a.dir))}}):"vertical"===r?(0,l.jsx)(ao,{...f,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){let e=ay(a.viewport.scrollTop,c);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollTop=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollTop=m(e))}}):null}),al=o.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...a}=e,s=n3(n7,e.__scopeScrollArea),[i,c]=o.useState(),d=o.useRef(null),u=(0,T.s)(t,d,s.onScrollbarXChange);return o.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),(0,l.jsx)(ac,{"data-orientation":"horizontal",...a,ref:u,sizes:r,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":av(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(s.viewport){let n=s.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),function(e,t){return e>0&&e<t}(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:ax(i.paddingLeft),paddingEnd:ax(i.paddingRight)}})}})}),ao=o.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...a}=e,s=n3(n7,e.__scopeScrollArea),[i,c]=o.useState(),d=o.useRef(null),u=(0,T.s)(t,d,s.onScrollbarYChange);return o.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),(0,l.jsx)(ac,{"data-orientation":"vertical",...a,ref:u,sizes:r,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":av(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(s.viewport){let n=s.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),function(e,t){return e>0&&e<t}(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&i&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:ax(i.paddingTop),paddingEnd:ax(i.paddingBottom)}})}})}),[as,ai]=n2(n7),ac=o.forwardRef((e,t)=>{let{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:m,...p}=e,h=n3(n7,r),[x,g]=o.useState(null),v=(0,T.s)(t,e=>g(e)),y=o.useRef(null),b=o.useRef(""),w=h.viewport,j=n.content-n.viewport,N=(0,U.c)(f),C=(0,U.c)(d),k=aj(m,10);function S(e){y.current&&u({x:e.clientX-y.current.left,y:e.clientY-y.current.top})}return o.useEffect(()=>{let e=e=>{let t=e.target;x?.contains(t)&&N(e,j)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,x,j,N]),o.useEffect(C,[n,C]),aN(x,k),aN(h.content,k),(0,l.jsx)(as,{scope:r,scrollbar:x,hasThumb:a,onThumbChange:(0,U.c)(s),onThumbPointerUp:(0,U.c)(i),onThumbPositionChange:C,onThumbPointerDown:(0,U.c)(c),children:(0,l.jsx)(D.sG.div,{...p,ref:v,style:{position:"absolute",...p.style},onPointerDown:(0,E.m)(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),y.current=x.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),S(e))}),onPointerMove:(0,E.m)(e.onPointerMove,S),onPointerUp:(0,E.m)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=b.current,h.viewport&&(h.viewport.style.scrollBehavior=""),y.current=null})})})}),ad="ScrollAreaThumb",au=o.forwardRef((e,t)=>{let{forceMount:r,...n}=e,a=ai(ad,e.__scopeScrollArea);return(0,l.jsx)(tM.C,{present:r||a.hasThumb,children:(0,l.jsx)(af,{ref:t,...n})})}),af=o.forwardRef((e,t)=>{let{__scopeScrollArea:r,style:n,...a}=e,s=n3(ad,r),i=ai(ad,r),{onThumbPositionChange:c}=i,d=(0,T.s)(t,e=>i.onThumbChange(e)),u=o.useRef(void 0),f=aj(()=>{u.current&&(u.current(),u.current=void 0)},100);return o.useEffect(()=>{let e=s.viewport;if(e){let t=()=>{if(f(),!u.current){let t=aw(e,c);u.current=t,c()}};return c(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[s.viewport,f,c]),(0,l.jsx)(D.sG.div,{"data-state":i.hasThumb?"visible":"hidden",...a,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:(0,E.m)(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;i.onThumbPointerDown({x:r,y:n})}),onPointerUp:(0,E.m)(e.onPointerUp,i.onThumbPointerUp)})});au.displayName=ad;var am="ScrollAreaCorner",ap=o.forwardRef((e,t)=>{let r=n3(am,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&n?(0,l.jsx)(ah,{...e,ref:t}):null});ap.displayName=am;var ah=o.forwardRef((e,t)=>{let{__scopeScrollArea:r,...n}=e,a=n3(am,r),[s,i]=o.useState(0),[c,d]=o.useState(0),u=!!(s&&c);return aN(a.scrollbarX,()=>{let e=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(e),d(e)}),aN(a.scrollbarY,()=>{let e=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(e),i(e)}),u?(0,l.jsx)(D.sG.div,{...n,ref:t,style:{width:s,height:c,position:"absolute",right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:0,...e.style}}):null});function ax(e){return e?parseInt(e,10):0}function ag(e,t){let r=e/t;return isNaN(r)?0:r}function av(e){let t=ag(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-r)*t,18)}function ay(e,t,r="ltr"){let n=av(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,l=t.scrollbar.size-a,o=t.content-t.viewport,s=n0(e,"ltr"===r?[0,o]:[-1*o,0]);return ab([0,o],[0,l-n])(s)}function ab(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}var aw=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){let l={left:e.scrollLeft,top:e.scrollTop},o=r.left!==l.left,s=r.top!==l.top;(o||s)&&t(),r=l,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function aj(e,t){let r=(0,U.c)(e),n=o.useRef(0);return o.useEffect(()=>()=>window.clearTimeout(n.current),[]),o.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function aN(e,t){let r=(0,U.c)(t);(0,X.N)(()=>{let t=0;if(e){let n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}let aC=o.forwardRef(({className:e,children:t,...r},n)=>(0,l.jsxs)(n6,{ref:n,className:(0,j.cn)("relative overflow-hidden",e),...r,children:[(0,l.jsx)(n9,{className:"h-full w-full rounded-[inherit]",children:t}),(0,l.jsx)(ak,{}),(0,l.jsx)(ap,{})]}));aC.displayName=n6.displayName;let ak=o.forwardRef(({className:e,orientation:t="vertical",...r},n)=>(0,l.jsx)(ae,{ref:n,orientation:t,className:(0,j.cn)("flex touch-none select-none transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:(0,l.jsx)(au,{className:"relative flex-1 rounded-full bg-border"})}));ak.displayName=ae.displayName;let aS=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("div",{className:"relative w-full overflow-auto",children:(0,l.jsx)("table",{ref:r,className:(0,j.cn)("w-full caption-bottom text-sm",e),...t})}));aS.displayName="Table";let aR=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("thead",{ref:r,className:(0,j.cn)("[&_tr]:border-b",e),...t}));aR.displayName="TableHeader";let aE=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("tbody",{ref:r,className:(0,j.cn)("[&_tr:last-child]:border-0",e),...t}));aE.displayName="TableBody",o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("tfoot",{ref:r,className:(0,j.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t})).displayName="TableFooter";let aT=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("tr",{ref:r,className:(0,j.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));aT.displayName="TableRow";let aM=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("th",{ref:r,className:(0,j.cn)("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));aM.displayName="TableHead";let aA=o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("td",{ref:r,className:(0,j.cn)("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));aA.displayName="TableCell",o.forwardRef(({className:e,...t},r)=>(0,l.jsx)("caption",{ref:r,className:(0,j.cn)("mt-4 text-sm text-muted-foreground",e),...t})).displayName="TableCaption";var aD=r(1255);let a_=function({preview:e=[],onConfirm:t,onCancel:r,isConfirming:n,error:a,isLoading:s,success:i,databaseName:c,migrationsDir:d}){let[u,f]=(0,o.useState)(!0);if(s)return(0,l.jsx)("div",{className:"fixed bottom-4 right-4 z-50 font-sans w-[600px]",children:(0,l.jsx)("div",{className:"rounded-lg border p-4 shadow-lg bg-background",children:(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)(v,{className:"h-5 w-5 text-neutral-600 shrink-0 mt-0.5 animate-spin"}),(0,l.jsx)("div",{className:"flex-1 space-y-3",children:(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsxs)("p",{className:"font-medium text-neutral-800",children:["Preparing Push Migration",c?` \xb7 ${c}`:""]}),(0,l.jsx)("p",{className:"text-sm text-neutral-600",children:"Checking local migrations..."})]})})]})})});if(!e?.length)return(0,l.jsx)("div",{className:"fixed bottom-4 right-4 z-50 w-[600px]",children:(0,l.jsx)("div",{className:"rounded-lg border p-4",children:(0,l.jsx)("p",{className:"text-sm font-medium",children:"No migrations to preview"})})});let m=e.filter(e=>"will be applied"===e.action).length,p=e.filter(e=>"skipped"===e.action).length;e.filter(e=>"applied"===e.action).length;let h=e=>{switch(e){case"will be applied":return"\uD83D\uDD52️";case"applied":return"✅";case"skipped":return"⏭️";case"failed":return"❌";default:return""}};return(0,l.jsx)("div",{className:"fixed bottom-4 right-4 z-50 font-sans w-[600px]",children:(0,l.jsx)("div",{className:(0,j.cn)("rounded-lg border p-4 shadow-lg",a?"bg-destructive/15":"bg-background"),children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("h5",{className:"font-medium text-neutral-900",children:["Push Migration Preview",c&&(0,l.jsx)("span",{className:"ml-2 text-xs font-normal text-neutral-500 font-mono",children:c})]}),(0,l.jsx)("button",{onClick:r,className:"text-neutral-500 hover:text-neutral-900 p-1 rounded-md hover:bg-neutral-100",children:(0,l.jsx)(aD.A,{className:"h-4 w-4"})})]}),(0,l.jsxs)("p",{className:"text-sm text-neutral-700",children:[m," migration(s) \uD83D\uDD52️ pending, ",p," to ⏭️ skip"]}),(0,l.jsx)("p",{className:"text-xs text-neutral-400 font-mono",children:d?(0,l.jsxs)(l.Fragment,{children:["\uD83D\uDCC1 ",d]}):(0,l.jsx)("span",{className:"text-amber-600",children:'⚠ migrations_dir not set — using default "migrations/"'})}),a?(0,l.jsx)("p",{className:"text-sm text-destructive font-medium mt-1",children:a.message}):i&&(0,l.jsx)("p",{className:"text-sm text-green-700 font-medium mt-1",children:i})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{onClick:()=>f(!u),className:"text-sm font-medium hover:underline",children:u?"Hide Details":"Show Details"}),u&&(0,l.jsx)(aC,{className:"h-[480px] mt-2 rounded border border-neutral-200",children:(0,l.jsxs)(aS,{children:[(0,l.jsx)(aR,{children:(0,l.jsxs)(aT,{children:[(0,l.jsx)(aM,{children:"Migration"}),(0,l.jsx)(aM,{className:"text-center w-24",children:"Status"})]})}),(0,l.jsx)(aE,{children:e.map((e,t)=>(0,l.jsxs)(aT,{children:[(0,l.jsx)(aA,{className:"font-mono text-xs",children:e.name}),(0,l.jsx)(aA,{className:"text-center align-middle",children:h(e.action)})]},t))})]})})]}),(0,l.jsxs)("p",{className:"text-xs text-neutral-400",children:["Seed files (",(0,l.jsx)("span",{className:"font-mono",children:"*seed*.sql"}),") are local-only and excluded from remote sync."]}),(0,l.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,l.jsx)(nZ,{onClick:t,disabled:n||0===m,className:"flex-1",children:n?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(v,{className:"mr-2 h-4 w-4 animate-spin"}),"Confirming..."]}):"Confirm Push"}),(0,l.jsx)(nZ,{variant:"outline",onClick:r,disabled:n,className:"flex-1",children:"Cancel"})]})]})})})},aO=function({preview:e=[],onConfirm:t,onCancel:r,onDataPull:n,isConfirming:a,isDataPulling:s,error:i,isLoading:c,success:d,databaseName:u,migrationsDir:f}){console.log("PullPreviewToast rendered with:",{previewLength:e.length,isConfirming:a,error:i,isLoading:c});let[m,p]=(0,o.useState)(!1);if(c)return console.log("Rendering loading state"),(0,l.jsx)("div",{className:"fixed bottom-4 right-4 z-50 font-sans w-[600px]",children:(0,l.jsx)("div",{className:"rounded-lg border p-4 shadow-lg bg-background",children:(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)(v,{className:"h-5 w-5 text-neutral-600 shrink-0 mt-0.5 animate-spin"}),(0,l.jsx)("div",{className:"flex-1 space-y-3",children:(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsxs)("p",{className:"font-medium text-neutral-800",children:["Preparing Pull Migration",u?` \xb7 ${u}`:""]}),(0,l.jsx)("p",{className:"text-sm text-neutral-600",children:"Checking remote migrations..."})]})})]})})});if(!e?.length)return console.log("No preview data available"),(0,l.jsx)("div",{className:"fixed bottom-4 right-4 z-50 w-[600px]",children:(0,l.jsx)("div",{className:"rounded-lg border bg-destructive/15 p-4",children:(0,l.jsx)("div",{className:"flex items-center gap-2",children:(0,l.jsx)("p",{className:"text-sm font-medium text-destructive",children:"No preview data available"})})})});let h=e.filter(e=>(e.migration||e.name||"").endsWith(".sql")),x=h.length;console.log("Migration stats:",{totalMigrations:x});let g=d&&!s&&!i;return(0,l.jsx)("div",{className:"fixed bottom-4 right-4 z-50 font-sans w-[600px]",children:(0,l.jsx)("div",{className:(0,j.cn)("rounded-lg border p-4 shadow-lg",i?"bg-destructive/15":"bg-background"),children:(0,l.jsx)("div",{className:"flex items-start gap-x-1",children:(0,l.jsxs)("div",{className:"flex-1 space-y-3",children:[(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("h5",{className:(0,j.cn)("font-medium",i?"text-destructive":"text-neutral-900"),children:[i?"Pull Migration Error":"Pull Migration Preview",u&&(0,l.jsx)("span",{className:"ml-2 text-xs font-normal text-neutral-500 font-mono",children:u})]}),(0,l.jsx)("button",{onClick:r,className:"text-neutral-500 hover:text-neutral-900 p-1 rounded-md hover:bg-neutral-100",children:(0,l.jsx)(aD.A,{className:"h-4 w-4"})})]}),(0,l.jsx)("p",{className:(0,j.cn)("text-sm",i?"text-destructive/80":"text-neutral-700"),children:`${x} migration(s) will be applied`}),(0,l.jsx)("p",{className:"text-xs text-neutral-400 font-mono",children:f?(0,l.jsxs)(l.Fragment,{children:["\uD83D\uDCC1 ",f]}):(0,l.jsx)("span",{className:"text-amber-600",children:'⚠ migrations_dir not set — using default "migrations/"'})}),i&&(0,l.jsx)("p",{className:"text-sm text-destructive font-medium mt-1",children:i.message}),d&&(0,l.jsx)("p",{className:"text-sm text-green-700 font-medium mt-1",children:d})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{onClick:()=>p(!m),className:"text-sm font-medium hover:underline",children:m?"Hide Details":"Show Details"}),m&&(0,l.jsx)(aC,{className:"h-[480px] mt-2 rounded border border-neutral-200",children:(0,l.jsxs)("div",{className:"w-full",children:[(0,l.jsx)("div",{className:"bg-neutral-50 border-b px-4 py-2",children:(0,l.jsx)("div",{className:"text-sm font-medium text-neutral-600",children:"Migration"})}),(0,l.jsx)("div",{children:h.map((e,t)=>(0,l.jsx)("div",{className:"px-4 py-2 border-b last:border-0",children:(0,l.jsx)("div",{className:"font-mono text-xs",children:e.migration||e.name})},t))})]})})]}),(0,l.jsxs)("p",{className:"text-xs text-neutral-400",children:["Seed files (",(0,l.jsx)("span",{className:"font-mono",children:"*seed*.sql"}),") are local-only and excluded from remote sync."]}),(0,l.jsx)("div",{className:"flex flex-col gap-2 pt-1",children:(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(nZ,{onClick:t,disabled:a,className:`flex-1 ${a?"cursor-not-allowed opacity-50":""}`,children:a?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(v,{className:"h-4 w-4 animate-spin"}),"Confirming..."]}):"Confirm Pull"}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,l.jsx)(nZ,{onClick:n,disabled:!g,variant:"outline",className:`w-full ${g?"":"cursor-not-allowed opacity-50"}`,children:s?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(v,{className:"h-4 w-4 animate-spin"}),"Syncing remote data..."]}):"Sync remote data"}),(0,l.jsx)("p",{className:"text-xs text-neutral-500 text-center",children:"75 records per table"})]})]})})]})})})})};function aP(){let[e]=(0,o.useState)(!1),[t,r]=(0,o.useState)(!1),[n,a]=(0,o.useState)(!1),[s,i]=(0,o.useState)(null),[c,d]=(0,o.useState)(null),[u,f]=(0,o.useState)(null),[m,p]=(0,o.useState)(null),{refreshTables:h,setOperationStatus:x,setLastSyncTime:g,currentDatabase:v}=(0,nQ.t)(),y=()=>{a(!1),i(null),d(null),f(null),p(null)},b=async()=>{try{f("push"),a(!0),r(!0),d(null),p(null),i({preview:[]});let e=await fetch("/api/push-remote/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({db:v?.database_name})}),t=await e.json();if(!t.success)throw Error(t.error?.message||"Failed to generate preview");i(t.details.details)}catch(e){console.error("Push to remote preview failed:",e),d(e),x("error",e.message||"Failed to generate push preview")}finally{r(!1)}},w=async()=>{try{r(!0),d(null),p(null);let e=await fetch("/api/push-remote/confirm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({db:v?.database_name})}),t=await e.json();if(!t.success)throw Error(t.error?.message||"Failed to confirm push");i(e=>({...e,preview:e.preview.map(e=>({...e,action:"will be applied"===e.action?"applied":e.action}))})),p(`Applied ${t.details.applied} migration(s), skipped ${t.details.skipped}.`),g(),x("success",`Push complete — ${t.details.applied} migration(s) applied`)}catch(e){console.error("Push to remote confirm failed:",e),d(e)}finally{r(!1)}},j=async()=>{try{f("pull"),a(!0),r(!0),d(null),p(null),i({preview:[]});let e=await fetch("/api/pull-remote/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({db:v?.database_name})}),t=await e.json();if(!t.success)throw Error(t.error?.message||"Failed to generate pull preview");i(t.details)}catch(e){console.error("Pull to remote preview failed:",e),d(e),x("error",e.message||"Failed to generate pull preview")}finally{r(!1)}},N=async()=>{try{r(!0),d(null),p(null);let e=await fetch("/api/pull-remote/confirm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({db:v?.database_name})}),t=await e.json();if(!t.success)throw Error(t.error?.message||"Failed to confirm pull");p("Pull migrations applied successfully."),g(),x("success","Pull complete"),i(e=>({...e,preview:e.preview.map(e=>({...e,action:"will be applied"===e.action?"applied":e.action}))})),await h()}catch(e){console.error("Pull to remote confirm failed:",e),d(e)}finally{r(!1)}},C=n&&("pull"===u?(0,l.jsx)(aO,{preview:s?.preview||[],onConfirm:N,onCancel:y,isConfirming:t,error:c,success:m,isLoading:t&&!s?.preview?.length,databaseName:v?.database_name,migrationsDir:v?.migrations_dir}):(0,l.jsx)(a_,{preview:s?.preview||[],onConfirm:w,onCancel:y,isConfirming:t,error:c,success:m,isLoading:t&&!s?.preview?.length,databaseName:v?.database_name,migrationsDir:v?.migrations_dir}));return{isConnecting:e,isPushing:t,showPreview:n,pushToRemote:b,pullToRemotePreview:j,PreviewUI:C}}function aL({icon:e,label:t,view:r,currentView:n,onNavigate:a,disabled:o,pro:s,locked:i}){let c=n===r;return(0,l.jsxs)("button",{className:`w-full flex items-center gap-x-1.5 border rounded-md text-sm font-medium transition-colors px-2 py-2
|
|
2
2
|
${c?"bg-neutral-900 text-white":"bg-white hover:bg-neutral-100"}`,onClick:()=>a(r),disabled:o,title:i?"Pro license required — run: d1s --license YOUR-KEY":void 0,children:[(0,l.jsx)(e,{className:"h-[16px] w-[16px] flex-shrink-0"}),(0,l.jsx)("span",{className:"flex-1 text-left",children:t}),s&&i&&(0,l.jsx)(u,{className:"h-3 w-3 opacity-40 flex-shrink-0"})]})}function aI({className:e,currentView:t,onNavigate:r,onTableSelect:n}){let{tables:a,databases:s,currentDatabase:i,switchDatabase:d,isLoading:j,error:C,lastSyncTime:k}=(0,nQ.t)(),[E,T]=(0,o.useState)(""),[M,A]=(0,o.useState)(null),[D,_]=(0,o.useState)(!1),[O,P]=(0,o.useState)(!1),{isConnecting:L,isPushing:I,pushToRemote:$,pullToRemotePreview:F,PreviewUI:U}=aP(),z=(0,o.useMemo)(()=>{let e=[...a?.filter(e=>e.toLowerCase().includes(E.toLowerCase()))||[]].sort((e,t)=>e.localeCompare(t)),t=e.indexOf("d1_migrations");return -1!==t&&(e.splice(t,1),e.unshift("d1_migrations")),e},[a,E]),B=async e=>{try{_(!0),A(e),n(e)}catch(e){console.error("Error selecting table:",e)}finally{_(!1)}};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("aside",{className:`${e} top-[var(--banner-height,0px)] left-0 h-[calc(100vh-var(--banner-height,0px))] bg-neutral-50 p-4`,children:(0,l.jsxs)("div",{className:"flex flex-col h-full font-sans",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(f,{className:"h-5 w-5"}),(0,l.jsx)("span",{className:"font-mono font-bold text-sm",children:"d1-studio"})]}),(0,l.jsxs)("div",{className:"text-xs font-medium text-muted-foreground",children:["v",c.rE]})]}),C&&(0,l.jsxs)(S,{variant:"destructive",className:"mb-4",children:[(0,l.jsx)(m,{className:"h-4 w-4"}),(0,l.jsx)(R,{className:"text-sm ml-2",children:C})]}),(0,l.jsxs)("div",{className:"mb-1.5",children:[(0,l.jsx)("div",{className:"text-xs text-muted-foreground mb-1",children:"Database"}),(0,l.jsxs)(nD,{children:[(0,l.jsx)(nO,{asChild:!0,children:(0,l.jsxs)("button",{className:"flex items-center gap-1.5 text-sm font-semibold hover:text-foreground/80 transition-colors max-w-full w-full text-left",children:[(0,l.jsx)("span",{className:"truncate",children:i?.database_name||"Select database"}),i&&(0,l.jsxs)("span",{className:"shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded bg-green-100 text-green-700",children:["Local",i.hasLocal?" ✓":""]}),(0,l.jsx)(p,{className:"h-3 w-3 shrink-0 ml-auto opacity-50"})]})}),(0,l.jsx)(nY,{align:"start",className:"w-56",children:s.map(e=>(0,l.jsxs)(nX,{onClick:()=>d(e.database_name),className:`flex items-center justify-between gap-2 ${i?.database_name===e.database_name?"font-semibold bg-accent":""}`,children:[(0,l.jsx)("span",{className:"truncate",children:e.database_name}),(0,l.jsxs)("span",{className:"shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded bg-green-100 text-green-700",children:["Local",e.hasLocal?" ✓":""]})]},e.database_name))})]})]}),(0,l.jsxs)("div",{className:"mb-2",children:[(0,l.jsxs)("div",{className:"flex gap-1.5 mb-1",children:[(0,l.jsxs)("button",{onClick:F,disabled:!O||L||I,title:O?void 0:"Pro license required — run: d1s --license YOUR-KEY",className:"flex-1 flex items-center justify-center gap-1 text-xs font-medium border rounded-md px-2 py-1.5 bg-white hover:bg-neutral-100 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[O?(0,l.jsx)(h,{className:"h-3.5 w-3.5"}):(0,l.jsx)(u,{className:"h-3.5 w-3.5 opacity-40"}),"Pull"]}),(0,l.jsxs)("button",{onClick:$,disabled:!O||L||I,title:O?void 0:"Pro license required — run: d1s --license YOUR-KEY",className:"flex-1 flex items-center justify-center gap-1 text-xs font-medium border rounded-md px-2 py-1.5 bg-white hover:bg-neutral-100 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[O?(0,l.jsx)(x,{className:"h-3.5 w-3.5"}):(0,l.jsx)(u,{className:"h-3.5 w-3.5 opacity-40"}),"Push"]})]}),(0,l.jsx)("div",{className:"text-[11px] text-muted-foreground px-0.5",children:k?`Remote sync \xb7 ${function(e){if(!e)return null;let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?"just now":t<3600?`${Math.floor(t/60)} min ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}(k)}`:"Never synced"})]}),(0,l.jsxs)("div",{className:"relative mt-3 mb-2 bg-white",children:[(0,l.jsx)(g,{className:"absolute left-2 top-2.5 h-4 w-4 text-neutral-500"}),(0,l.jsx)(N,{placeholder:"Search tables",value:E,onChange:e=>T(e.target.value),className:"pl-7"})]}),(0,l.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-1 flex-none",children:[(0,l.jsxs)("h3",{className:"text-sm font-medium text-muted-foreground",children:["Tables ",a?.length?`(${a.length})`:""]}),j&&(0,l.jsx)(v,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),(0,l.jsx)("div",{className:"overflow-y-auto flex-1",children:(0,l.jsxs)("div",{className:"pr-2 pb-2",children:[!j&&0===z.length&&(0,l.jsx)("div",{className:"text-sm font-medium text-muted-foreground px-2 py-2",children:E?"No matching tables found":C?"Error loading tables":"No tables available"}),z.map(e=>(0,l.jsx)("button",{className:`w-full text-left text-sm font-medium rounded-md transition-colors px-2 py-2
|
|
3
3
|
${"table-view"===t&&M===e?"bg-[#F0F0F0] text-neutral-900 font-semibold":"text-neutral-700 hover:bg-[#F2F2F2]"}
|
|
4
4
|
${D&&"opacity-50 cursor-not-allowed"}`,onClick:()=>B(e),disabled:D,children:e},e))]})})]}),(0,l.jsxs)("div",{className:"pt-2 flex flex-col gap-1",children:[(0,l.jsx)(aL,{icon:y,label:"SQL editor",view:"sql-editor",currentView:t,onNavigate:r,disabled:D}),(0,l.jsx)(aL,{icon:b,label:"Schema",view:"schema",currentView:t,onNavigate:r,disabled:D}),(0,l.jsx)(aL,{icon:w,label:"Time travel",view:"time-travel",currentView:t,onNavigate:r,disabled:D||!O,pro:!0,locked:!O})]})]})}),U]})}function a$(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function aF(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function aU(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?aF(Object(r),!0).forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):aF(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function az(e){return function t(){for(var r=this,n=arguments.length,a=Array(n),l=0;l<n;l++)a[l]=arguments[l];return a.length>=e.length?e.apply(this,a):function(){for(var e=arguments.length,n=Array(e),l=0;l<e;l++)n[l]=arguments[l];return t.apply(r,[].concat(a,n))}}}function aB(e){return({}).toString.call(e).includes("Object")}function aH(e){return"function"==typeof e}var aW=az(function(e,t){throw Error(e[t]||e.default)})({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),aV={changes:function(e,t){return aB(t)||aW("changeType"),Object.keys(t).some(function(t){return!Object.prototype.hasOwnProperty.call(e,t)})&&aW("changeField"),t},selector:function(e){aH(e)||aW("selectorType")},handler:function(e){aH(e)||aB(e)||aW("handlerType"),aB(e)&&Object.values(e).some(function(e){return!aH(e)})&&aW("handlersType")},initial:function(e){e||aW("initialIsRequired"),aB(e)||aW("initialType"),Object.keys(e).length||aW("initialContent")}};function aK(e,t){return aH(t)?t(e.current):t}function aq(e,t){return e.current=aU(aU({},e.current),t),t}function aG(e,t,r){return aH(t)?t(e.current):Object.keys(r).forEach(function(r){var n;return null===(n=t[r])||void 0===n?void 0:n.call(t,e.current[r])}),r}(function(e){return function t(){for(var r=this,n=arguments.length,a=Array(n),l=0;l<n;l++)a[l]=arguments[l];return a.length>=e.length?e.apply(this,a):function(){for(var e=arguments.length,n=Array(e),l=0;l<e;l++)n[l]=arguments[l];return t.apply(r,[].concat(a,n))}}})(function(e,t){throw Error(e[t]||e.default)})({configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "});let aY=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}};var aX={type:"cancelation",msg:"operation is manually canceled"};let aQ=function(e){var t=!1,r=new Promise(function(r,n){e.then(function(e){return t?n(aX):r(e)}),e.catch(n)});return r.cancel=function(){return t=!0},r};var aJ=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,l=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),2!==r.length);n=!0);}catch(e){a=!0,l=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw l}}return r}}(e,2)||function(e,t){if(e){if("string"==typeof e)return a$(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a$(e,t)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(({create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};aV.initial(e),aV.handler(t);var r={current:e},n=az(aG)(r,t),a=az(aq)(r),l=az(aV.changes)(e),o=az(aK)(r);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return aV.selector(e),e(r.current)},function(e){(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}})(n,a,l,o)(e)}]}}).create({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}),0),aZ=aJ[0],a0=aJ[1];function a1(e){return document.body.appendChild(e)}function a2(e){var t,r,n=aZ(function(e){return{config:e.config,reject:e.reject}}),a=(t="".concat(n.config.paths.vs,"/loader.js"),r=document.createElement("script"),t&&(r.src=t),r);return a.onload=function(){return e()},a.onerror=n.reject,a}function a5(){var e=aZ(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(t){a4(t),e.resolve(t)},function(t){e.reject(t)})}function a4(e){aZ().monaco||a0({monaco:e})}var a3=new Promise(function(e,t){return a0({resolve:e,reject:t})});let a6={init:function(){var e=aZ(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(a0({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),aQ(a3);if(window.monaco&&window.monaco.editor)return a4(window.monaco),e.resolve(window.monaco),aQ(a3);aY(a1,a2)(a5)}return aQ(a3)}};var a8={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},a9={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},a7=function({children:e}){return o.createElement("div",{style:a9.container},e)},le=(0,o.memo)(function({width:e,height:t,isEditorReady:r,loading:n,_ref:a,className:l,wrapperProps:s}){return o.createElement("section",{style:{...a8.wrapper,width:e,height:t},...s},!r&&o.createElement(a7,null,n),o.createElement("div",{ref:a,style:{...a8.fullWidth,...!r&&a8.hide},className:l}))}),lt=function(e){(0,o.useEffect)(e,[])},lr=function(e,t,r=!0){let n=(0,o.useRef)(!0);(0,o.useEffect)(n.current||!r?()=>{n.current=!1}:e,t)};function ln(){}function la(e,t,r,n){return e.editor.getModel(ll(e,n))||e.editor.createModel(t,r,n?ll(e,n):void 0)}function ll(e,t){return e.Uri.parse(t)}(0,o.memo)(function({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:a,originalModelPath:l,modifiedModelPath:s,keepCurrentOriginalModel:i=!1,keepCurrentModifiedModel:c=!1,theme:d="light",loading:u="Loading...",options:f={},height:m="100%",width:p="100%",className:h,wrapperProps:x={},beforeMount:g=ln,onMount:v=ln}){let[y,b]=(0,o.useState)(!1),[w,j]=(0,o.useState)(!0),N=(0,o.useRef)(null),C=(0,o.useRef)(null),k=(0,o.useRef)(null),S=(0,o.useRef)(v),R=(0,o.useRef)(g),E=(0,o.useRef)(!1);lt(()=>{let e=a6.init();return e.then(e=>(C.current=e)&&j(!1)).catch(e=>e?.type!=="cancelation"&&console.error("Monaco initialization: error:",e)),()=>{let t;return N.current?(t=N.current?.getModel(),void(i||t?.original?.dispose(),c||t?.modified?.dispose(),N.current?.dispose())):e.cancel()}}),lr(()=>{if(N.current&&C.current){let t=N.current.getOriginalEditor(),a=la(C.current,e||"",n||r||"text",l||"");a!==t.getModel()&&t.setModel(a)}},[l],y),lr(()=>{if(N.current&&C.current){let e=N.current.getModifiedEditor(),n=la(C.current,t||"",a||r||"text",s||"");n!==e.getModel()&&e.setModel(n)}},[s],y),lr(()=>{let e=N.current.getModifiedEditor();e.getOption(C.current.editor.EditorOption.readOnly)?e.setValue(t||""):t!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[t],y),lr(()=>{N.current?.getModel()?.original.setValue(e||"")},[e],y),lr(()=>{let{original:e,modified:t}=N.current.getModel();C.current.editor.setModelLanguage(e,n||r||"text"),C.current.editor.setModelLanguage(t,a||r||"text")},[r,n,a],y),lr(()=>{C.current?.editor.setTheme(d)},[d],y),lr(()=>{N.current?.updateOptions(f)},[f],y);let T=(0,o.useCallback)(()=>{if(!C.current)return;R.current(C.current);let o=la(C.current,e||"",n||r||"text",l||""),i=la(C.current,t||"",a||r||"text",s||"");N.current?.setModel({original:o,modified:i})},[r,t,a,e,n,l,s]),M=(0,o.useCallback)(()=>{!E.current&&k.current&&(N.current=C.current.editor.createDiffEditor(k.current,{automaticLayout:!0,...f}),T(),C.current?.editor.setTheme(d),b(!0),E.current=!0)},[f,d,T]);return(0,o.useEffect)(()=>{y&&S.current(N.current,C.current)},[y]),(0,o.useEffect)(()=>{w||y||M()},[w,y,M]),o.createElement(le,{width:p,height:m,isEditorReady:y,loading:u,_ref:k,className:h,wrapperProps:x})});var lo=function(e){let t=(0,o.useRef)();return(0,o.useEffect)(()=>{t.current=e},[e]),t.current},ls=new Map,li=(0,o.memo)(function({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:a,path:l,theme:s="light",line:i,loading:c="Loading...",options:d={},overrideServices:u={},saveViewState:f=!0,keepCurrentModel:m=!1,width:p="100%",height:h="100%",className:x,wrapperProps:g={},beforeMount:v=ln,onMount:y=ln,onChange:b,onValidate:w=ln}){let[j,N]=(0,o.useState)(!1),[C,k]=(0,o.useState)(!0),S=(0,o.useRef)(null),R=(0,o.useRef)(null),E=(0,o.useRef)(null),T=(0,o.useRef)(y),M=(0,o.useRef)(v),A=(0,o.useRef)(),D=(0,o.useRef)(n),_=lo(l),O=(0,o.useRef)(!1),P=(0,o.useRef)(!1);lt(()=>{let e=a6.init();return e.then(e=>(S.current=e)&&k(!1)).catch(e=>e?.type!=="cancelation"&&console.error("Monaco initialization: error:",e)),()=>R.current?void(A.current?.dispose(),m?f&&ls.set(l,R.current.saveViewState()):R.current.getModel()?.dispose(),R.current.dispose()):e.cancel()}),lr(()=>{let o=la(S.current,e||n||"",t||a||"",l||r||"");o!==R.current?.getModel()&&(f&&ls.set(_,R.current?.saveViewState()),R.current?.setModel(o),f&&R.current?.restoreViewState(ls.get(l)))},[l],j),lr(()=>{R.current?.updateOptions(d)},[d],j),lr(()=>{R.current&&void 0!==n&&(R.current.getOption(S.current.editor.EditorOption.readOnly)?R.current.setValue(n):n===R.current.getValue()||(P.current=!0,R.current.executeEdits("",[{range:R.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),R.current.pushUndoStop(),P.current=!1))},[n],j),lr(()=>{let e=R.current?.getModel();e&&a&&S.current?.editor.setModelLanguage(e,a)},[a],j),lr(()=>{void 0!==i&&R.current?.revealLine(i)},[i],j),lr(()=>{S.current?.editor.setTheme(s)},[s],j);let L=(0,o.useCallback)(()=>{if(!(!E.current||!S.current)&&!O.current){M.current(S.current);let o=l||r,c=la(S.current,n||e||"",t||a||"",o||"");R.current=S.current?.editor.create(E.current,{model:c,automaticLayout:!0,...d},u),f&&R.current.restoreViewState(ls.get(o)),S.current.editor.setTheme(s),void 0!==i&&R.current.revealLine(i),N(!0),O.current=!0}},[e,t,r,n,a,l,d,u,f,s,i]);return(0,o.useEffect)(()=>{j&&T.current(R.current,S.current)},[j]),(0,o.useEffect)(()=>{C||j||L()},[C,j,L]),D.current=n,(0,o.useEffect)(()=>{j&&b&&(A.current?.dispose(),A.current=R.current?.onDidChangeModelContent(e=>{P.current||b(R.current.getValue(),e)}))},[j,b]),(0,o.useEffect)(()=>{if(j){let e=S.current.editor.onDidChangeMarkers(e=>{let t=R.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=S.current.editor.getModelMarkers({resource:t});w?.(e)}});return()=>{e?.dispose()}}return()=>{}},[j,w]),o.createElement(le,{width:p,height:h,isEditorReady:j,loading:c,_ref:E,className:x,wrapperProps:g})});let lc=(0,d.A)("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),ld=(0,d.A)("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),lu=(0,d.A)("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);function lf({results:e}){return e&&Array.isArray(e)?(0,l.jsxs)("div",{className:"text-xs font-medium text-neutral-900 flex items-center gap-2 mb-2",children:[e.length," ",1===e.length?"row":"rows"," returned"]}):null}function lm({error:e}){console.debug("SQLErrorDisplay - Received error prop:",e);let t=e&&"string"==typeof e.message?e:{message:"An unknown error occurred",details:{}};return(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-neutral-700 text-sm",children:t.message}),t.details?.stderr&&(0,l.jsx)("pre",{className:"mt-2 p-2 text-xs text-red-500 whitespace-pre-wrap",children:t.details.stderr})]})}function lp({query:e,results:t}){if(!t?.length)return(0,l.jsx)("div",{className:"text-sm text-neutral-500",children:"No results to display."});let r=e?.trim().toLowerCase().startsWith("pragma table_info"),n=r?["Column Name","Type","Not Null","Default Value","Primary Key"]:Object.keys(t[0]),a=r?t.map(e=>({"Column Name":e.name,Type:e.type,"Not Null":1===e.notnull?"YES":"NO","Default Value":e.dflt_value||"(null)","Primary Key":1===e.pk?"YES":"NO"})):t;return(0,l.jsxs)("div",{className:"flex flex-col h-full",children:[(0,l.jsx)(lf,{results:a}),(0,l.jsx)("div",{className:"flex-1 overflow-auto border rounded-lg",children:(0,l.jsx)("div",{className:"min-w-full",children:(0,l.jsxs)(aS,{children:[(0,l.jsx)(aR,{children:(0,l.jsx)(aT,{className:"bg-muted/50",children:n.map(e=>(0,l.jsx)(aM,{className:"font-mono text-xs font-medium text-muted-foreground",children:e},e))})}),(0,l.jsx)(aE,{children:a.map((e,t)=>(0,l.jsx)(aT,{className:"hover:bg-muted/50",children:n.map(r=>{let n=e[r],a=null===n?"(null)":String(n);return(0,l.jsx)(aA,{className:"font-monospace text-xs whitespace-nowrap",children:a},`${t}-${r}`)})},t))})]})})})]})}let lh={SYNTAX_ERROR:"SYNTAX_ERROR",EXECUTION_ERROR:"EXECUTION_ERROR",TABLE_NOT_FOUND:"TABLE_NOT_FOUND",TABLE_EXISTS:"TABLE_EXISTS",FOREIGN_KEY_ERROR:"FOREIGN_KEY_ERROR",UNIQUE_CONSTRAINT_ERROR:"UNIQUE_CONSTRAINT_ERROR",NOT_NULL_CONSTRAINT_ERROR:"NOT_NULL_CONSTRAINT_ERROR",CHECK_CONSTRAINT_ERROR:"CHECK_CONSTRAINT_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"};function lx(e){if(!e)return{type:lh.UNKNOWN_ERROR,message:"An unknown error occurred",details:{}};let t=null,r=e.cmd||e.details&&e.details.command;if(r){let e=r.match(/--command="(.+?)"\s*--json/s);e&&(t=e[1].replace(/\\n/g,"\n").replace(/\\"/g,'"'))}let n=e.stdout||e.details&&e.details.stdout;if(n)try{let e=JSON.parse(n.trim()),a=e?.error?.text||"";if(a)return lg(a,t,r)}catch{}let a=e.stderr||e.details&&e.details.stderr;if(a)return lg(a.replace(/\x1B\[[0-9;]*[a-zA-Z]/g,""),t,r);let l=e.message||e.details&&e.details.originalError||"";return l?lg(l,t,r):{type:lh.UNKNOWN_ERROR,message:e.message||"An unknown error occurred",details:{}}}function lg(e,t,r){if(e.includes("env: node: No such file or directory"))return{type:lh.EXECUTION_ERROR,message:"Node.js not found — ensure Node.js is installed and in PATH",details:{originalQuery:t}};let n=e.match(/near "([^"]+)": syntax error(?:\s+at offset (\d+))?/);if(n){let[,e,r]=n;return{type:lh.SYNTAX_ERROR,message:`Syntax error near "${e}"${r?` at position ${r}`:""}`,details:{originalQuery:t,errorLocation:{near:e,offset:r?parseInt(r):null}}}}if(e.includes("UNIQUE constraint failed")){let[,r]=e.match(/UNIQUE constraint failed: ([\w.]+)/)||[];return{type:lh.UNIQUE_CONSTRAINT_ERROR,message:`UNIQUE constraint failed: ${r||"unknown column"}`,details:{originalQuery:t}}}if(e.includes("NOT NULL constraint failed")){let[,r]=e.match(/NOT NULL constraint failed: ([\w.]+)/)||[];return{type:lh.NOT_NULL_CONSTRAINT_ERROR,message:`NOT NULL constraint failed: ${r||"unknown column"}`,details:{originalQuery:t}}}if(e.includes("CHECK constraint failed")){let[,r]=e.match(/CHECK constraint failed: (\S+)/)||[];return{type:lh.CHECK_CONSTRAINT_ERROR,message:`CHECK constraint failed: ${r||"unknown constraint"}`,details:{originalQuery:t}}}if(e.includes("FOREIGN KEY constraint failed"))return{type:lh.FOREIGN_KEY_ERROR,message:"FOREIGN KEY constraint failed",details:{originalQuery:t}};if(e.includes("no such table")){let[,r]=e.match(/no such table: (\S+)/)||[];return{type:lh.TABLE_NOT_FOUND,message:`Table not found: ${r||"unknown"}`,details:{originalQuery:t}}}if(e.includes("already exists")){let[,r]=e.match(/table (\w+) already exists/)||[];return{type:lh.TABLE_EXISTS,message:`Table already exists: ${r||"unknown"}`,details:{originalQuery:t}}}return{type:lh.EXECUTION_ERROR,message:e.replace(/:\s*SQLITE_\w+$/,"").trim()||"Failed to execute SQL command",details:{originalQuery:t}}}let lv={"Show Tables":`SELECT name
|
|
@@ -55,4 +55,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
55
55
|
UPDATE ${e}
|
|
56
56
|
SET ${l}
|
|
57
57
|
WHERE ${n} = ${i};
|
|
58
|
-
`;await r(c),o++}if(o>0){let t=await u(e);x(t.data),w(t.meta.total),z(Math.ceil(t.meta.total/$)),f("success",`Updated ${o} ${1===o?"record":"records"} \xb7 ${e}`),p({title:"Success",description:`Updated ${o} ${1===o?"record":"records"}`})}}A(new Map),_(new Set),er(null)}catch(n){let t=lx(n),r={...t,stderr:n.stderr,stdout:n.stdout};f("error",t.message||"Save failed",`Error saving changes to ${e}`),er(r),ee(!0)}finally{k(!1)}},eU=(0,o.useCallback)(async()=>{if(e){G(!0),X(null);try{let t;let n=g.find(e=>1===e.pk)?.name;if(!n)throw Error("No primary key found in table schema");let a=Array.from(B).map(e=>h[e][n]);if(0===a.length)return;let l=e=>null==e||"null"===e,o=a.filter(l),s=a.filter(e=>!l(e)),i=s.map(e=>"string"==typeof e&&isNaN(e)?`'${e.replace(/'/g,"''")}'`:e);t=o.length>0&&s.length>0?`DELETE FROM ${e} WHERE ${n} IS NULL OR ${n} IN (${i.join(",")});`:o.length>0?`DELETE FROM ${e} WHERE ${n} IS NULL;`:`DELETE FROM ${e} WHERE ${n} IN (${i.join(",")});`,await r(t);let c=new Set(a),d=h.filter(e=>!c.has(e[n]));x(d),w(e=>e-a.length),z(Math.ceil((b-a.length)/$)),L>1&&h.length===a.length&&I(e=>e-1),K(!1),H(new Set),f("success",`Deleted ${a.length} ${1===a.length?"record":"records"} \xb7 ${e}`),p({title:"Success",description:`Deleted ${a.length} ${1===a.length?"record":"records"}`})}catch(t){console.error("Delete operation failed:",t),f("error",t.message||"Delete failed",`Error deleting from ${e}`),X(t.message||String(t))}finally{G(!1)}}},[e,B,h,g,r,u,eT,L,$,b,p,n,a,f]),ez=(0,o.useCallback)(e=>{H(e?new Set(ej.map((e,t)=>t)):new Set)},[ej]),eB=(0,o.useCallback)((e,t)=>{H(r=>{let n=new Set(r);return t?n.add(e):n.delete(e),n})},[]);return((0,o.useCallback)(t=>{ev(t),localStorage.setItem(`table-widths-${e}`,JSON.stringify(t))},[e]),(0,o.useCallback)(async t=>{let n=id(t);if(!n){ed(null),ef(0);return}try{let t=g.find(e=>1===e.pk)?.name||g[0]?.name||"rowid",a=await r(`SELECT COUNT(*) as total FROM "${e}" WHERE ${n}`),l=a?.results?.[0]?.results?.[0]?.total??0,o=await r(`SELECT * FROM "${e}" WHERE ${n} ORDER BY "${t}" DESC LIMIT ${$} OFFSET ${(L-1)*$}`),s=o?.results?.[0]?.results||[];ef(l),ed(s)}catch{ed([]),ef(0)}},[e,g,r,$,L]),E)?(0,l.jsx)("div",{className:"p-4",children:(0,l.jsxs)(S,{variant:"destructive",children:[(0,l.jsx)(m,{className:"h-4 w-4"}),(0,l.jsxs)(R,{children:["Failed to load table: ",E]})]})}):(0,l.jsxs)("div",{className:"h-full flex flex-col",children:[(0,l.jsx)(sg,{selectedCount:B.size,totalRows:eN,currentPage:L,totalPages:eC,rowsPerPage:$,onPageChange:I,onRowsPerPageChange:F,onAdd:eL,onDelete:()=>K(!0),onImport:()=>J(!0),onRefresh:eD,tableName:e,disabled:eR,editCount:M.size,newRecordsCount:O.length,isSaving:C,onSaveChanges:eF,onDiscardChanges:()=>{A(new Map),_(new Set),P([]),er(null),p({description:"Changes discarded"})},schema:g,visibleColumns:ey,onColumnToggle:eM,showFilters:es,onToggleFilters:()=>ei(e=>!e),activeFilterCount:el.filter(e=>e.column&&e.operator).length}),es&&(0,l.jsx)(iu,{schema:g,filters:el,onFiltersChange:eo,onOpenInSQL:()=>{let r=id(el);if(r&&t){let n=g.find(e=>1===e.pk)?.name||g[0]?.name||"rowid";t(`SELECT * FROM "${e}" WHERE ${r} ORDER BY "${n}" DESC LIMIT ${$};`)}}}),(0,l.jsx)("div",{className:"flex-1 overflow-hidden bg-background font-mono",children:(0,l.jsxs)(aC,{className:"w-full h-full",children:[(0,l.jsx)("div",{className:"w-max min-w-full pb-4",children:(0,l.jsxs)(aS,{style:{tableLayout:"fixed",width:`${eS}px`},children:[!j&&(0,l.jsx)(aR,{className:"bg-neutral-100 sticky top-0 z-30",children:(0,l.jsxs)(aT,{children:[(0,l.jsx)(aM,{className:"p-0 border-r border-neutral-200",style:{width:"40px",minWidth:"40px"},children:(0,l.jsx)("div",{className:"py-0.5 px-3 flex items-center",children:(0,l.jsx)(lO,{ref:W,checked:B.size===ej.length&&ej.length>0,onCheckedChange:ez,disabled:eR})})}),ek.map(e=>(0,l.jsx)(s7,{width:eg[e.name]||150,onResize:t=>eA(e.name,t),className:"py-0.5 whitespace-nowrap border-r border-neutral-200",children:(0,l.jsxs)(ia,{column:e.name,sortConfig:en,onSort:e_,children:[(0,l.jsx)("span",{className:"text-xs font-bold text-foreground",children:e.name}),(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:e.type?.toLowerCase()})]})},e.name))]})}),(0,l.jsxs)(aE,{children:[j&&(0,l.jsx)(aT,{className:"hover:bg-transparent",children:(0,l.jsx)(aA,{colSpan:ek.length+1,className:"h-64",children:(0,l.jsx)("div",{className:"h-full w-full flex items-center justify-center",children:(0,l.jsx)(v,{className:"h-6 w-6 animate-spin text-primary"})})})}),!j&&(0,l.jsxs)(l.Fragment,{children:[O.map((e,t)=>(0,l.jsx)(sw,{schema:ek,onRemove:()=>eI(t),onChange:e=>e$(t,e)},`new-${t}`)),0===ej.length&&0===O.length?(0,l.jsx)(aT,{className:"hover:bg-transparent",children:(0,l.jsx)(aA,{colSpan:ek.length+1,className:"h-64 text-center text-muted-foreground",children:ew?"No rows match the current filters":"Table is empty"})}):ej.map((e,t)=>(0,l.jsxs)(i().Fragment,{children:[(0,l.jsxs)(aT,{className:B.has(t)?"bg-blue-50":"bg-white",children:[(0,l.jsx)(aA,{className:"p-0",children:(0,l.jsx)("div",{className:"px-3 py-2.5 flex items-center",children:(0,l.jsx)(lO,{checked:B.has(t),onCheckedChange:e=>eB(t,e),disabled:eR})})}),ek.map(r=>{let n=`${t}::${r.name}`,a=M.get(n);return(0,l.jsx)(sv,{value:a?a.value:e[r.name],row:e,column:r.name,schema:g,onChange:e=>eP(t,r.name,e),onStartEdit:ew?void 0:e=>eO(t,r.name,e),isEditing:!ew&&M.has(n),style:{width:`${eg[r.name]||150}px`},fkInfo:em[r.name],onShowRelation:em[r.name]?()=>ex({rowIndex:t,relatedTable:em[r.name].table,relatedKey:em[r.name].to,value:e[r.name]}):void 0},r.name)})]}),eh?.rowIndex===t&&(0,l.jsx)(il,{relatedTable:eh.relatedTable,relatedKey:eh.relatedKey,value:eh.value,colSpan:ek.length+1,onClose:()=>ex(null)})]},t))]})]})]})}),(0,l.jsx)(ak,{orientation:"horizontal"})]})}),(0,l.jsx)(s3,{isOpen:V,onClose:()=>{K(!1),X(null)},onConfirm:eU,selectedCount:B.size,tableName:e,isDeleting:q,error:Y}),(0,l.jsx)(s6,{isOpen:Z,onClose:()=>ee(!1),error:et,onOpenInSQL:()=>{ee(!1)},onUpdateAnyway:async()=>{ee(!1),await eF(!0)},showSQLOption:et?.type==="NULLABLE_PK"}),(0,l.jsx)(s9,{open:Q,onClose:()=>J(!1),tableName:e,schema:g,onImportComplete:()=>{J(!1),eD()}})]})}function ip({migration:e}){return e.orphaned?(0,l.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-amber-600",children:[(0,l.jsx)(m,{className:"h-3 w-3"})," Orphaned"]}):e.applied?(0,l.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-green-600",children:[(0,l.jsx)(s8,{className:"h-3 w-3"})," Applied"]}):(0,l.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-amber-600",children:[(0,l.jsx)(w,{className:"h-3 w-3"})," Pending"]})}function ih(){let{currentDatabase:e,executeQuery:t,refreshTables:r}=(0,nQ.t)(),{toast:n}=(0,sr.dj)(),[a,s]=(0,o.useState)([]),[i,c]=(0,o.useState)(""),[d,u]=(0,o.useState)(!0),[f,p]=(0,o.useState)(!1),[h,x]=(0,o.useState)(null),g=(0,o.useCallback)(async()=>{u(!0),x(null);try{let t=e?.database_name,r=t?`?db=${encodeURIComponent(t)}`:"",n=await fetch(`/api/migrations/list${r}`),a=await n.json();if(!n.ok||!a.success)throw Error(a.error||"Failed to load migrations");s(a.migrations),c(a.migrationsDir)}catch(e){x(e.message)}finally{u(!1)}},[e]),y=a.filter(e=>!e.applied&&!e.orphaned),b=(0,o.useCallback)(async()=>{if(0===y.length)return;p(!0);let t=0;try{for(let r of y){await fetch(`/api/migrations/list?file=${encodeURIComponent(r.name)}${e?.database_name?`&db=${encodeURIComponent(e.database_name)}`:""}`);let n=await fetch("/api/migrations/sync-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({migrationName:r.name,db:e?.database_name})}),a=await n.json();if(!n.ok||!a.success)throw Error(`Failed to apply ${r.name}: ${a.error||"Unknown error"}`);t++}n({title:"Migrations Applied",description:`${t} migration${1!==t?"s":""} applied successfully.`}),await r(),await g()}catch(e){n({variant:"destructive",title:"Apply Failed",description:e.message})}finally{p(!1)}},[y,e,n,r,g]);return(0,l.jsxs)("div",{className:"h-full flex flex-col",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between p-4 border-b",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-sm font-semibold",children:"Migrations"}),i&&(0,l.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:i})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[y.length>0&&(0,l.jsx)(nZ,{size:"sm",onClick:b,disabled:f,className:"font-semibold",children:f?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(v,{className:"h-4 w-4 animate-spin"})," Applying…"]}):`Apply ${y.length} pending`}),(0,l.jsx)(nZ,{variant:"outline",size:"icon",className:"h-8",onClick:g,disabled:d,children:(0,l.jsx)(o7,{className:`h-4 w-4 ${d?"animate-spin":""}`})})]})]}),(0,l.jsxs)("div",{className:"flex-1 overflow-auto",children:[h&&(0,l.jsx)("div",{className:"p-4",children:(0,l.jsxs)(S,{variant:"destructive",children:[(0,l.jsx)(m,{className:"h-4 w-4"}),(0,l.jsx)(R,{children:h})]})}),!d&&!h&&0===a.length&&(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-2",children:[(0,l.jsx)(ss,{className:"h-8 w-8"}),(0,l.jsx)("p",{className:"text-sm",children:"No migration files found"}),(0,l.jsx)("p",{className:"text-xs",children:"Migration files appear here when you run DDL statements in the SQL editor"})]}),!h&&a.length>0&&(0,l.jsxs)(aS,{children:[(0,l.jsx)(aR,{className:"bg-neutral-100 sticky top-0 z-10",children:(0,l.jsxs)(aT,{children:[(0,l.jsx)(aM,{className:"text-xs font-bold",children:"Migration file"}),(0,l.jsx)(aM,{className:"text-xs font-bold w-28",children:"Status"}),(0,l.jsx)(aM,{className:"text-xs font-bold w-44",children:"Applied at"}),(0,l.jsx)(aM,{className:"text-xs font-bold w-20",children:"Checksum"})]})}),(0,l.jsx)(aE,{children:a.map(e=>(0,l.jsxs)(aT,{className:e.orphaned?"opacity-60":"",children:[(0,l.jsx)(aA,{className:"font-mono text-xs",children:e.name}),(0,l.jsx)(aA,{children:(0,l.jsx)(ip,{migration:e})}),(0,l.jsx)(aA,{className:"text-xs text-muted-foreground",children:e.applied_at?new Date(e.applied_at).toLocaleString():"—"}),(0,l.jsx)(aA,{className:"font-mono text-xs text-muted-foreground",children:e.checksum?e.checksum.slice(0,8):"—"})]},e.name))})]})]})]})}var ix=r(6256);let ig=r.n(ix)()(async()=>{},{loadableGenerated:{modules:["components/schema-view.jsx -> ./schema-erd"]},ssr:!1,loading:()=>(0,l.jsx)("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:"#0d1117",color:"#8b949e"},children:(0,l.jsx)("span",{style:{fontSize:14},children:"Loading…"})})});function iv(){let{currentDatabase:e}=(0,nQ.t)();return(0,l.jsx)(ig,{db:e?.database_name})}let iy={bg:"#ffffff",bg2:"#f9f8f6",border:"#e8e5e0",border2:"#d4d0c8",text:"#1a1714",text2:"#5a5650",text3:"#9a9590",orange:"#d4581e",orangeBg:"#fff4ee",orangeBorder:"#fddcc8"},ib=["January","February","March","April","May","June","July","August","September","October","November","December"],iw={2:[3,7,10,14,16],1:[5,12,18,22]};function ij(e){return String(e).padStart(2,"0")}function iN({year:e,month:t,selDay:r,today:n,earliest:a,onSelect:o,onPrev:s,onNext:i}){let c=new Date(e,t,1).getDay(),d=new Date(e,t+1,0).getDate(),u=iw[t]||[],f=n.getUTCFullYear(),m=n.getUTCMonth(),p=n.getUTCDate(),h=[];for(let e=0;e<c;e++)h.push((0,l.jsx)("div",{},`b${e}`));for(let n=1;n<=d;n++){let s=e>f||e===f&&t>m||e===f&&t===m&&n>p,i=new Date(e,t,n).getTime(),c=!!a&&i<new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),d=e===f&&t===m&&n===p,x=n===r,g=u.includes(n),v=s||c;h.push((0,l.jsxs)("div",{onClick:v?void 0:()=>o(n),style:{fontSize:11,textAlign:"center",padding:"4px 0",borderRadius:4,cursor:v?"default":"pointer",color:v?iy.border2:x?iy.bg:d?iy.text:iy.text2,background:x?iy.text:"transparent",fontWeight:d?600:void 0,pointerEvents:v?"none":void 0,position:"relative",userSelect:"none"},className:v||x?"":"hover:bg-[#f2f0ec]",children:[n,g&&!s&&(0,l.jsx)("span",{style:{position:"absolute",bottom:1,left:"50%",transform:"translateX(-50%)",width:3,height:3,borderRadius:"50%",background:x?iy.bg:iy.orange,display:"block"}})]},n))}return(0,l.jsxs)("div",{style:{padding:"14px 16px",borderBottom:`1px solid ${iy.border}`},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[(0,l.jsxs)("span",{style:{fontSize:13,fontWeight:500,color:iy.text},children:[ib[t]," ",e]}),(0,l.jsx)("div",{style:{display:"flex",gap:3},children:[["‹",s],["›",i]].map(([e,t])=>(0,l.jsx)("button",{onClick:t,style:{width:24,height:24,border:`1px solid ${iy.border}`,borderRadius:6,background:"transparent",cursor:"pointer",fontSize:14,color:iy.text2,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1},className:"hover:bg-[#f9f8f6]",children:e},e))})]}),(0,l.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:1},children:[["Su","Mo","Tu","We","Th","Fr","Sa"].map(e=>(0,l.jsx)("div",{style:{fontSize:10,fontWeight:500,color:iy.text3,textAlign:"center",padding:"3px 0"},children:e},e)),h]})]})}function iC({kind:e,text:t}){let r={a:{bg:"#f0fdf4",color:"#15803d",markBg:"#f0fdf4",markColor:"#16a34a",mark:"+"},r:{bg:"#fef2f2",color:"#b91c1c",markBg:"#fef2f2",markColor:"#dc2626",mark:"−"},c:{bg:"#f9fafb",color:iy.text3,markBg:"#f9fafb",markColor:iy.text3,mark:"~"}}[e];return(0,l.jsxs)("div",{style:{display:"flex",alignItems:"stretch",fontSize:11,fontFamily:"ui-monospace,SF Mono,monospace",borderRadius:5,overflow:"hidden",marginBottom:2},children:[(0,l.jsx)("div",{style:{width:22,minWidth:22,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:12,background:r.markBg,color:r.markColor},children:r.mark}),(0,l.jsx)("div",{style:{flex:1,padding:"4px 8px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",background:r.bg,color:r.color},children:t})]})}function ik({type:e,children:t}){return(0,l.jsx)("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:3,fontFamily:"ui-monospace,SF Mono,monospace",...{rm:{background:"#fef2f2",color:"#dc2626",border:"1px solid #fecaca"},add:{background:"#f0fdf4",color:"#16a34a",border:"1px solid #bbf7d0"},ch:{background:"#fffbeb",color:"#d97706",border:"1px solid #fde68a"}}[e]},children:t})}function iS({label:e,bookmark:t,onCancel:r,onConfirm:n}){return(0,l.jsx)("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.2)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:30,borderRadius:12},children:(0,l.jsxs)("div",{style:{background:iy.bg,border:`1px solid ${iy.border}`,borderRadius:12,padding:24,boxShadow:"0 8px 40px rgba(0,0,0,0.12)",width:340},children:[(0,l.jsx)("div",{style:{width:38,height:38,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",background:"#fef2f2",border:"1px solid #fecaca",marginBottom:14},children:(0,l.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",stroke:"#dc2626",strokeWidth:"1.5",children:[(0,l.jsx)("path",{d:"M9 2L2 15h14L9 2z"}),(0,l.jsx)("path",{d:"M9 7v4M9 12.5v.5"})]})}),(0,l.jsx)("div",{style:{fontSize:14,fontWeight:600,color:iy.text,marginBottom:5},children:"Restore database?"}),(0,l.jsx)("div",{style:{fontSize:12,color:iy.text2,lineHeight:1.6,marginBottom:10},children:"This will overwrite your remote D1 database in place. All in-flight queries and transactions will be cancelled."}),(0,l.jsxs)("div",{style:{fontFamily:"ui-monospace,SF Mono,monospace",fontSize:12,padding:"8px 10px",background:iy.bg2,borderRadius:6,color:iy.text,marginBottom:10,lineHeight:1.7},children:[e,t&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("br",{}),(0,l.jsxs)("span",{style:{fontSize:10,color:iy.text3},children:["bookmark: ",t]})]})]}),(0,l.jsx)("div",{style:{fontSize:11,color:"#c2410c",background:iy.orangeBg,border:`1px solid ${iy.orangeBorder}`,borderRadius:6,padding:"8px 10px",marginBottom:16,lineHeight:1.55},children:"⚠ A pre-restore bookmark will be saved automatically so you can undo this restore if needed."}),(0,l.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,l.jsx)("button",{onClick:r,style:{flex:1,padding:8,border:`1px solid ${iy.border}`,borderRadius:7,background:"transparent",color:iy.text2,fontSize:12,cursor:"pointer",fontFamily:"system-ui,sans-serif"},className:"hover:text-[#1a1714]",children:"Cancel"}),(0,l.jsx)("button",{onClick:n,style:{flex:1,padding:8,background:"#dc2626",color:"white",border:"none",borderRadius:7,fontSize:12,fontWeight:500,cursor:"pointer",fontFamily:"system-ui,sans-serif"},className:"hover:bg-[#b91c1c]",children:"Yes, restore database"})]})]})})}function iR({label:e,undoBookmark:t,onDone:r}){return(0,l.jsx)("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.2)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:30,borderRadius:12},children:(0,l.jsxs)("div",{style:{background:iy.bg,border:`1px solid ${iy.border}`,borderRadius:12,padding:24,boxShadow:"0 8px 40px rgba(0,0,0,0.12)",width:320,textAlign:"center"},children:[(0,l.jsx)("div",{style:{width:38,height:38,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"#f0fdf4",border:"1px solid #bbf7d0",margin:"0 auto 14px"},children:(0,l.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 20 20",fill:"none",stroke:"#16a34a",strokeWidth:"2",children:(0,l.jsx)("path",{d:"M4 10l4 4 8-8"})})}),(0,l.jsx)("div",{style:{fontSize:14,fontWeight:600,color:iy.text,marginBottom:5},children:"Database restored"}),(0,l.jsxs)("div",{style:{fontSize:12,color:iy.text2,lineHeight:1.6,marginBottom:10},children:["Database has been restored to ",e," successfully."]}),t&&(0,l.jsxs)("div",{style:{fontSize:11,color:iy.text2,background:iy.bg2,border:`1px solid ${iy.border}`,borderRadius:6,padding:"7px 10px",marginBottom:14,fontFamily:"ui-monospace,SF Mono,monospace",textAlign:"left"},children:["undo bookmark: ",t,(0,l.jsx)("br",{}),(0,l.jsx)("span",{style:{fontSize:10,color:iy.text3},children:"Use this to revert if something looks wrong"})]}),(0,l.jsx)("button",{onClick:r,style:{width:"100%",padding:9,background:iy.text,color:iy.bg,border:"none",borderRadius:7,fontSize:12,fontWeight:500,cursor:"pointer",fontFamily:"system-ui,sans-serif"},children:"Done"})]})})}function iE(){let{currentDatabase:e}=(0,nQ.t)(),t=e?.database_name||"database",r=new Date,[n,a]=(0,o.useState)(r.getUTCFullYear()),[s,i]=(0,o.useState)(r.getUTCMonth()),[c,d]=(0,o.useState)(r.getUTCDate()),[u,f]=(0,o.useState)(`${ij(r.getUTCHours())}:${ij(r.getUTCMinutes())}:00`),[m,p]=(0,o.useState)(null),[h,x]=(0,o.useState)(null),[g,v]=(0,o.useState)(!0),[y,b]=(0,o.useState)(null),[w,j]=(0,o.useState)(null),N=new Date(r.getTime()-2592e6),C=w||N,[k,S]=(0,o.useState)(null),[R,E]=(0,o.useState)(!1),[T,M]=(0,o.useState)(null),[A,D]=(0,o.useState)(!1),[_,O]=(0,o.useState)(!1),[P,L]=(0,o.useState)(null),[I,$]=(0,o.useState)(!1),[F,U]=(0,o.useState)(null),z=`${ib[s].slice(0,3)} ${ij(c)}, ${n} \xb7 ${u||"00:00:00"} UTC`,B=`${ib[s].slice(0,3)} ${ij(c)}, ${n} at ${u||"00:00:00"} UTC`,H=(0,o.useCallback)(()=>{i(e=>0===e?(a(e=>e-1),11):e-1),d(1),S(null)},[]),W=(0,o.useCallback)(()=>{let e=11===s?0:s+1,t=11===s?n+1:n;t>r.getUTCFullYear()||t===r.getUTCFullYear()&&e>r.getUTCMonth()||(i(e),a(t),d(1),S(null))},[s,n,r]),V=(0,o.useCallback)(e=>{d(e),p(null),S(null)},[]),K=(0,o.useCallback)((e,t,r,n,l)=>{a(t),i(r),d(n),f(l),p(e),S(null)},[]),q=(0,o.useCallback)(()=>{let e=new Date;a(e.getUTCFullYear()),i(e.getUTCMonth()),d(e.getUTCDate()),f(`${ij(e.getUTCHours())}:${ij(e.getUTCMinutes())}:00`),p(null),S(null)},[]),G=(0,o.useCallback)(async()=>{E(!0),M(null),S(null);try{let t=e?.database_name?`?db=${encodeURIComponent(e.database_name)}`:"",r=await fetch(`/api/time-travel/preview${t}`),n=await r.json();if(!r.ok||!n.success)throw Error(n.error||"Failed to refresh remote state");x(n.currentBookmark),S({bookmark:n.currentBookmark})}catch(e){M(e.message)}finally{E(!1)}},[e]),Y=(0,o.useCallback)(async()=>{D(!1),O(!0),L(null);try{let t=new Date(`${n}-${ij(s+1)}-${ij(c)}T${u}Z`).toISOString(),r=await fetch("/api/time-travel/restore",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({db:e?.database_name,bookmark:k?.bookmark??null,timestamp:t})}),a=await r.json();if(!r.ok||!a.success)throw Error(a.error||"Restore failed");U(a.undoBookmark),$(!0)}catch(e){L(e.message)}finally{O(!1)}},[n,s,c,u,e,k]),X=new Date(r-18e5),Q=new Date(r);Q.setHours(12,0,0,0);let J=new Date(r-864e5);J.setHours(18,0,0,0);let Z=new Date(r-1728e5);Z.setHours(9,0,0,0);let ee=new Date(r-6048e5);ee.setHours(0,0,0,0);let et=[{id:"q30",label:"30 minutes ago",time:`${ij(X.getUTCHours())}:${ij(X.getUTCMinutes())}`,date:X,y:X.getUTCFullYear(),m:X.getUTCMonth(),d:X.getUTCDate(),t:`${ij(X.getUTCHours())}:${ij(X.getUTCMinutes())}:00`,icon:"clock"},{id:"qtoday",label:"Earlier today",time:"12:00",date:Q,y:Q.getUTCFullYear(),m:Q.getUTCMonth(),d:Q.getUTCDate(),t:"12:00:00",icon:"clock"},{id:"qyest",label:"Yesterday evening",time:`${ib[J.getUTCMonth()].slice(0,3)} ${J.getUTCDate()}`,date:J,y:J.getUTCFullYear(),m:J.getUTCMonth(),d:J.getUTCDate(),t:"18:00:00",icon:"clock"},{id:"qmig",label:"Before last migration",time:`${ib[Z.getUTCMonth()].slice(0,3)} ${Z.getUTCDate()}`,date:Z,y:Z.getUTCFullYear(),m:Z.getUTCMonth(),d:Z.getUTCDate(),t:"09:00:00",icon:"shield"},{id:"qweek",label:"1 week ago",time:`${ib[ee.getUTCMonth()].slice(0,3)} ${ee.getUTCDate()}`,date:ee,y:ee.getUTCFullYear(),m:ee.getUTCMonth(),d:ee.getUTCDate(),t:"00:00:00",icon:"clock"}];return(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",position:"relative",overflow:"hidden",background:iy.bg},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 18px",borderBottom:`1px solid ${iy.border}`,flexShrink:0},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{style:{fontSize:13,fontWeight:600,color:iy.text},children:"Time travel"}),(0,l.jsxs)("div",{style:{fontSize:11,color:iy.text3,marginTop:1},children:[t," \xb7 remote \xb7"," ",g?"loading available window…":y?"could not load window info":h?`latest snapshot: ${h.slice(0,18)}…`:"restore to any point in the available window"]})]}),(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"5px 11px",background:iy.orangeBg,border:`1px solid ${iy.orangeBorder}`,borderRadius:20,fontSize:11,color:iy.orange,marginLeft:"auto",flexShrink:0},children:[(0,l.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 13 13",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[(0,l.jsx)("path",{d:"M6.5 1L1 11h11z"}),(0,l.jsx)("path",{d:"M6.5 5v3M6.5 9.5v.5"})]}),"Restore overwrites remote DB in place"]})]}),(0,l.jsxs)("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[(0,l.jsxs)("div",{style:{width:290,minWidth:290,borderRight:`1px solid ${iy.border}`,display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,l.jsx)(iN,{year:n,month:s,selDay:c,today:r,earliest:C,onSelect:V,onPrev:H,onNext:W}),(0,l.jsxs)("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${iy.border}`,flexShrink:0},children:[(0,l.jsx)("div",{style:{fontSize:11,fontWeight:500,color:iy.text3,marginBottom:7},children:"Time (UTC)"}),(0,l.jsxs)("div",{style:{display:"flex",gap:7,alignItems:"center"},children:[(0,l.jsx)("input",{value:u,onChange:e=>{f(e.target.value),S(null)},style:{flex:1,padding:"7px 10px",border:`1px solid ${iy.border}`,borderRadius:6,fontFamily:"ui-monospace,SF Mono,monospace",fontSize:13,color:iy.text,background:iy.bg,outline:"none"},onFocus:e=>e.target.style.borderColor=iy.border2,onBlur:e=>e.target.style.borderColor=iy.border,placeholder:"HH:MM:SS"}),(0,l.jsx)("button",{onClick:q,style:{padding:"7px 11px",border:`1px solid ${iy.border}`,borderRadius:6,fontSize:11,color:iy.text2,background:iy.bg2,cursor:"pointer",fontFamily:"system-ui,sans-serif",whiteSpace:"nowrap"},className:"hover:text-[#1a1714]",children:"Now"})]})]}),(0,l.jsxs)("div",{style:{padding:"10px 16px",flex:1,overflowY:"auto"},children:[(0,l.jsx)("div",{style:{fontSize:11,fontWeight:500,color:iy.text3,marginBottom:9},children:"Quick points"}),et.map(e=>{let t=m===e.id,r=e.date<new Date(C.getFullYear(),C.getMonth(),C.getDate());return(0,l.jsxs)("button",{onClick:r?void 0:()=>K(e.id,e.y,e.m,e.d,e.t),disabled:r,title:r?"Outside available Time Travel window":void 0,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"7px 10px",border:`1px solid ${t?iy.text:iy.border}`,borderRadius:7,background:t?iy.bg2:iy.bg,cursor:r?"not-allowed":"pointer",fontFamily:"system-ui,sans-serif",fontSize:12,color:r?iy.border2:t?iy.text:iy.text2,marginBottom:5,textAlign:"left",transition:"border-color 0.1s",opacity:r?.5:1},className:r?"":"hover:border-[#d4d0c8] hover:text-[#1a1714]",children:["clock"===e.icon?(0,l.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",stroke:"currentColor",strokeWidth:"1.2",style:{opacity:t?.8:.4,flexShrink:0},children:[(0,l.jsx)("circle",{cx:"6.5",cy:"6.5",r:"5"}),(0,l.jsx)("path",{d:"M6.5 3.5v3l2 1.5"})]}):(0,l.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",stroke:"currentColor",strokeWidth:"1.2",style:{opacity:t?.8:.4,flexShrink:0},children:(0,l.jsx)("path",{d:"M6.5 1L1 4v3c0 3 2.4 5.5 5.5 6.5 3.1-1 5.5-3.5 5.5-6.5V4z"})}),e.label,(0,l.jsx)("span",{style:{marginLeft:"auto",fontFamily:"ui-monospace,SF Mono,monospace",fontSize:10,color:iy.text3},children:e.time})]},e.id)})]})]}),(0,l.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"11px 16px",borderBottom:`1px solid ${iy.border}`,flexShrink:0},children:[(0,l.jsxs)("span",{style:{fontSize:12,fontWeight:500,color:iy.text,flex:1},children:["Snapshot — ",B]}),k?.bookmark&&(0,l.jsx)("span",{style:{fontFamily:"ui-monospace,SF Mono,monospace",fontSize:10,color:iy.text3,padding:"2px 7px",background:iy.bg2,border:`1px solid ${iy.border}`,borderRadius:3},children:k.bookmark.length>22?k.bookmark.slice(0,20)+"…":k.bookmark})]}),(0,l.jsxs)("div",{style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:[T&&(0,l.jsx)("div",{style:{fontSize:12,color:"#dc2626",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:7,padding:"10px 12px",marginBottom:12},children:T}),P&&(0,l.jsxs)("div",{style:{fontSize:12,color:"#dc2626",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:7,padding:"10px 12px",marginBottom:12},children:["Restore failed: ",P]}),R&&(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:iy.text3,padding:"20px 0"},children:[(0,l.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",style:{animation:"spin 1s linear infinite"},children:[(0,l.jsx)("circle",{cx:"7",cy:"7",r:"5",strokeOpacity:"0.3"}),(0,l.jsx)("path",{d:"M7 2a5 5 0 0 1 5 5"})]}),"Loading snapshot info…",(0,l.jsx)("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}),!R&&!k&&!T&&(0,l.jsxs)("div",{style:{padding:"20px 0",color:iy.text3,fontSize:12},children:[h&&(0,l.jsxs)("div",{style:{background:iy.bg2,border:`1px solid ${iy.border}`,borderRadius:8,padding:"12px 14px",marginBottom:14},children:[(0,l.jsx)("div",{style:{fontSize:11,fontWeight:500,color:iy.text3,marginBottom:6},children:"Current snapshot (latest)"}),(0,l.jsx)("div",{style:{fontFamily:"ui-monospace,SF Mono,monospace",fontSize:11,color:iy.text,wordBreak:"break-all"},children:h})]}),(0,l.jsxs)("div",{style:{textAlign:"center",paddingTop:h?4:24},children:[(0,l.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 13 13",fill:"none",stroke:"currentColor",strokeWidth:"1",style:{margin:"0 auto 10px",display:"block",opacity:.3},children:[(0,l.jsx)("circle",{cx:"6.5",cy:"6.5",r:"5"}),(0,l.jsx)("path",{d:"M6.5 3.5v3l2 1.5"})]}),"Select a date & time, then click ",(0,l.jsx)("strong",{children:"Refresh preview"})," to load snapshot info."]})]}),!R&&k&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{style:{marginBottom:18},children:[(0,l.jsxs)("div",{style:{fontSize:11,fontWeight:600,color:iy.text,marginBottom:7,display:"flex",alignItems:"center",gap:6},children:["Remote state",(0,l.jsx)(ik,{type:"add",children:"refreshed"})]}),(0,l.jsx)(iC,{kind:"c",text:`Restore target: ${B}`}),k.bookmark?(0,l.jsx)(iC,{kind:"a",text:`current bookmark: ${k.bookmark}`}):(0,l.jsx)(iC,{kind:"c",text:"current bookmark: (not returned by wrangler)"}),(0,l.jsx)(iC,{kind:"c",text:"Restore will roll back all changes made after the selected time"})]}),(0,l.jsx)("div",{style:{fontSize:11,color:iy.text3,background:iy.bg2,border:`1px solid ${iy.border}`,borderRadius:7,padding:"10px 12px",lineHeight:1.6},children:"Cloudflare Time Travel does not provide a row-level diff before restore. After confirming, the database will be rolled back atomically to the selected point in time. An undo bookmark will be shown after restore."})]})]}),(0,l.jsxs)("div",{style:{padding:"12px 16px",borderTop:`1px solid ${iy.border}`,display:"flex",alignItems:"center",gap:10,background:iy.bg,flexShrink:0},children:[(0,l.jsxs)("div",{style:{flex:1},children:[(0,l.jsxs)("div",{style:{fontSize:12,fontWeight:500,color:iy.text},children:["Restore to ",z]}),k?.bookmark&&(0,l.jsxs)("div",{style:{fontSize:11,color:iy.text3,fontFamily:"ui-monospace,SF Mono,monospace",marginTop:1},children:["bookmark: ",k.bookmark]})]}),(0,l.jsxs)("button",{onClick:G,disabled:R,style:{display:"flex",alignItems:"center",gap:5,padding:"8px 14px",borderRadius:7,border:`1px solid ${iy.border}`,background:iy.bg,color:iy.text,fontSize:12,fontWeight:500,cursor:R?"default":"pointer",fontFamily:"system-ui,sans-serif",whiteSpace:"nowrap",opacity:R?.6:1},className:"hover:bg-[#f9f8f6]",children:[(0,l.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[(0,l.jsx)("path",{d:"M1 6A5 5 0 0 1 10 3M11 6A5 5 0 0 1 2 9"}),(0,l.jsx)("path",{d:"M9 1.5v2h2M1 8.5v2h2"})]}),"Refresh preview"]}),(0,l.jsxs)("button",{onClick:()=>D(!0),disabled:_,style:{display:"flex",alignItems:"center",gap:5,padding:"8px 14px",borderRadius:7,border:"none",background:_?"#f87171":"#dc2626",color:"white",fontSize:12,fontWeight:500,cursor:_?"default":"pointer",fontFamily:"system-ui,sans-serif",whiteSpace:"nowrap"},className:"hover:bg-[#b91c1c]",children:[(0,l.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[(0,l.jsx)("path",{d:"M1 6A5 5 0 0 1 10 3M11 6A5 5 0 0 1 2 9"}),(0,l.jsx)("path",{d:"M9 1.5v2h2M1 8.5v2h2"})]}),_?"Restoring…":"Restore database"]})]})]})]}),A&&(0,l.jsx)(iS,{label:z,bookmark:k?.bookmark,onCancel:()=>D(!1),onConfirm:Y}),I&&(0,l.jsx)(iR,{label:z,undoBookmark:F,onDone:()=>{$(!1),S(null)}})]})}function iT({open:e,onClose:t,onSubmit:r}){let[n,a]=(0,o.useState)(""),[s,i]=(0,o.useState)(""),[c,d]=(0,o.useState)(""),[u,f]=(0,o.useState)(!1),m=async e=>{e.preventDefault(),d(""),f(!0);try{await r({accountId:n,apiToken:s}),localStorage.setItem("cf_credentials",JSON.stringify({accountId:n,apiToken:s})),t()}catch(e){d(e.message)}finally{f(!1)}};return(0,l.jsx)(sR,{open:e,onOpenChange:t,children:(0,l.jsxs)(s0,{className:"sm:max-w-md",children:[(0,l.jsxs)(s1,{children:[(0,l.jsx)(s5,{children:"Connect to Cloudflare"}),(0,l.jsx)(s4,{children:"Enter your Cloudflare credentials to push your database to production."})]}),(0,l.jsxs)("form",{onSubmit:m,className:"space-y-4 mt-4",children:[c&&(0,l.jsx)(S,{variant:"destructive",children:(0,l.jsx)(R,{children:c})}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("label",{className:"text-sm font-medium",children:"Account ID"}),(0,l.jsx)(N,{placeholder:"Your Cloudflare Account ID",value:n,onChange:e=>a(e.target.value),required:!0})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("label",{className:"text-sm font-medium",children:"API Token"}),(0,l.jsx)(N,{type:"password",placeholder:"Your D1 Database API Token",value:s,onChange:e=>i(e.target.value),required:!0})]}),(0,l.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,l.jsx)(nZ,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,l.jsxs)(nZ,{type:"submit",disabled:u,children:[u&&(0,l.jsx)(v,{className:"mr-2 h-4 w-4 animate-spin"}),"Connect"]})]})]})]})})}function iM(){let{refreshTables:e}=(0,nQ.t)(),[t,r]=(0,o.useState)(!1),[n,a]=(0,o.useState)(null),[s,i]=(0,o.useState)(null),{isConnecting:c,isPushing:d,showPreview:u,connectToCloudflare:f,pushToRemote:p,pullToRemotePreview:h,validateStoredCredentials:x,PreviewUI:g}=aP(),y=async()=>{i(null),a("push");try{if(!await x()){r(!0);return}await p(),i({type:"success",message:"Push to remote initiated. Check the preview for details."})}catch(e){i({type:"error",message:e.message})}},b=async()=>{i(null),a("pull");try{if(!await x()){r(!0);return}await h()}catch(e){i({type:"error",message:e.message})}},w=c||d;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"h-full flex flex-col",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 p-4 border-b",children:[(0,l.jsx)(o7,{className:"h-4 w-4"}),(0,l.jsx)("h2",{className:"text-sm font-semibold",children:"Remote Sync"})]}),(0,l.jsx)("div",{className:"flex-1 overflow-auto p-6",children:(0,l.jsxs)("div",{className:"max-w-lg flex flex-col gap-6",children:[(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:"Sync your local D1 database with Cloudflare. Pushing uploads your local data to production; pulling downloads the remote state to your local environment."}),s&&(0,l.jsxs)(S,{variant:"error"===s.type?"destructive":"default",children:["error"===s.type?(0,l.jsx)(m,{className:"h-4 w-4"}):(0,l.jsx)(s8,{className:"h-4 w-4"}),(0,l.jsx)(R,{children:s.message})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,l.jsxs)("div",{className:"border rounded-md p-4 bg-white flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(oO,{className:"h-4 w-4 text-neutral-600"}),(0,l.jsx)("span",{className:"text-sm font-semibold",children:"Push to remote"})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Upload local database state to your Cloudflare D1 database."}),(0,l.jsx)(nZ,{size:"sm",onClick:y,disabled:w,className:"w-full",children:d&&"push"===n?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(v,{className:"h-4 w-4 animate-spin mr-2"})," Pushing…"]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(oO,{className:"h-4 w-4 mr-2"})," Push"]})})]}),(0,l.jsxs)("div",{className:"border rounded-md p-4 bg-white flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(sa,{className:"h-4 w-4 text-neutral-600"}),(0,l.jsx)("span",{className:"text-sm font-semibold",children:"Pull from remote"})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Download Cloudflare D1 data into your local environment."}),(0,l.jsx)(nZ,{size:"sm",variant:"outline",onClick:b,disabled:w,className:"w-full",children:c&&"pull"===n?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(v,{className:"h-4 w-4 animate-spin mr-2"})," Pulling…"]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(sa,{className:"h-4 w-4 mr-2"})," Pull"]})})]})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Cloudflare API credentials are required. You'll be prompted to enter them if not already saved."})]})})]}),(0,l.jsx)(iT,{open:t,onClose:()=>r(!1),onSubmit:f}),g]})}let iA={loading:"text-blue-500 border-blue-500/40 bg-blue-500/5",success:"text-green-600 border-green-500/40 bg-green-500/5",error:"text-red-500 border-red-500/40 bg-red-500/5",info:"text-muted-foreground border-border bg-transparent"},iD={loading:null,success:"✓",error:"✗",info:"─"};function i_(){let{lastStatus:e}=(0,nQ.t)(),t=function(e){let[t,r]=(0,o.useState)("");return t}(e?.ts),r=e?.type??"info",n=e?.message??"Ready",a=e?.detail??null,s=iA[r]??iA.info,i=iD[r];return(0,l.jsxs)("div",{className:`flex items-center justify-between h-8 px-4 border-t font-mono text-xs select-none shrink-0 ${s}`,role:"status","aria-live":"polite",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,l.jsx)("span",{className:"shrink-0 w-4 flex items-center justify-center",children:"loading"===r?(0,l.jsx)(v,{className:"h-3 w-3 animate-spin"}):(0,l.jsx)("span",{children:i})}),(0,l.jsx)("span",{className:"truncate",children:n}),a&&(0,l.jsxs)("span",{className:"text-muted-foreground truncate hidden sm:inline",children:["\xb7 ",a]})]}),t&&(0,l.jsx)("span",{className:"text-muted-foreground shrink-0 pl-4",children:t})]})}function iO(){let[e,t]=(0,o.useState)("sql-editor"),[r,n]=(0,o.useState)(null),[a,s]=(0,o.useState)("");return(0,l.jsxs)("div",{className:"flex h-screen bg-background",children:[(0,l.jsx)(aI,{className:"w-64 border-r flex-shrink-0",currentView:e,onNavigate:t,onTableSelect:e=>{n(e),t("table-view")}}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,l.jsxs)("main",{className:"flex-1 overflow-hidden",children:["sql-editor"===e&&(0,l.jsx)(lw,{initialQuery:a}),"schema"===e&&(0,l.jsx)(iv,{}),"migrations"===e&&(0,l.jsx)(ih,{}),"time-travel"===e&&(0,l.jsx)(iE,{}),"remote-sync"===e&&(0,l.jsx)(iM,{}),"table-view"===e&&r&&(0,l.jsx)(im,{tableName:r,onOpenInSQL:e=>{s(e),t("sql-editor")}})]}),(0,l.jsx)(i_,{})]})]})}},8868:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});let n=(0,r(4379).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx","default")}};var t=require("../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[994,992,572],()=>r(7185));module.exports=n})();
|
|
58
|
+
`;await r(c),o++}if(o>0){let t=await u(e);x(t.data),w(t.meta.total),z(Math.ceil(t.meta.total/$)),f("success",`Updated ${o} ${1===o?"record":"records"} \xb7 ${e}`),p({title:"Success",description:`Updated ${o} ${1===o?"record":"records"}`})}}A(new Map),_(new Set),er(null)}catch(n){let t=lx(n),r={...t,stderr:n.stderr,stdout:n.stdout};f("error",t.message||"Save failed",`Error saving changes to ${e}`),er(r),ee(!0)}finally{k(!1)}},eU=(0,o.useCallback)(async()=>{if(e){G(!0),X(null);try{let t;let n=g.find(e=>1===e.pk)?.name;if(!n)throw Error("No primary key found in table schema");let a=Array.from(B).map(e=>h[e][n]);if(0===a.length)return;let l=e=>null==e||"null"===e,o=a.filter(l),s=a.filter(e=>!l(e)),i=s.map(e=>"string"==typeof e&&isNaN(e)?`'${e.replace(/'/g,"''")}'`:e);t=o.length>0&&s.length>0?`DELETE FROM ${e} WHERE ${n} IS NULL OR ${n} IN (${i.join(",")});`:o.length>0?`DELETE FROM ${e} WHERE ${n} IS NULL;`:`DELETE FROM ${e} WHERE ${n} IN (${i.join(",")});`,await r(t);let c=new Set(a),d=h.filter(e=>!c.has(e[n]));x(d),w(e=>e-a.length),z(Math.ceil((b-a.length)/$)),L>1&&h.length===a.length&&I(e=>e-1),K(!1),H(new Set),f("success",`Deleted ${a.length} ${1===a.length?"record":"records"} \xb7 ${e}`),p({title:"Success",description:`Deleted ${a.length} ${1===a.length?"record":"records"}`})}catch(t){console.error("Delete operation failed:",t),f("error",t.message||"Delete failed",`Error deleting from ${e}`),X(t.message||String(t))}finally{G(!1)}}},[e,B,h,g,r,u,eT,L,$,b,p,n,a,f]),ez=(0,o.useCallback)(e=>{H(e?new Set(ej.map((e,t)=>t)):new Set)},[ej]),eB=(0,o.useCallback)((e,t)=>{H(r=>{let n=new Set(r);return t?n.add(e):n.delete(e),n})},[]);return((0,o.useCallback)(t=>{ev(t),localStorage.setItem(`table-widths-${e}`,JSON.stringify(t))},[e]),(0,o.useCallback)(async t=>{let n=id(t);if(!n){ed(null),ef(0);return}try{let t=g.find(e=>1===e.pk)?.name||g[0]?.name||"rowid",a=await r(`SELECT COUNT(*) as total FROM "${e}" WHERE ${n}`),l=a?.results?.[0]?.results?.[0]?.total??0,o=await r(`SELECT * FROM "${e}" WHERE ${n} ORDER BY "${t}" DESC LIMIT ${$} OFFSET ${(L-1)*$}`),s=o?.results?.[0]?.results||[];ef(l),ed(s)}catch{ed([]),ef(0)}},[e,g,r,$,L]),E)?(0,l.jsx)("div",{className:"p-4",children:(0,l.jsxs)(S,{variant:"destructive",children:[(0,l.jsx)(m,{className:"h-4 w-4"}),(0,l.jsxs)(R,{children:["Failed to load table: ",E]})]})}):(0,l.jsxs)("div",{className:"h-full flex flex-col",children:[(0,l.jsx)(sg,{selectedCount:B.size,totalRows:eN,currentPage:L,totalPages:eC,rowsPerPage:$,onPageChange:I,onRowsPerPageChange:F,onAdd:eL,onDelete:()=>K(!0),onImport:()=>J(!0),onRefresh:eD,tableName:e,disabled:eR,editCount:M.size,newRecordsCount:O.length,isSaving:C,onSaveChanges:eF,onDiscardChanges:()=>{A(new Map),_(new Set),P([]),er(null),p({description:"Changes discarded"})},schema:g,visibleColumns:ey,onColumnToggle:eM,showFilters:es,onToggleFilters:()=>ei(e=>!e),activeFilterCount:el.filter(e=>e.column&&e.operator).length}),es&&(0,l.jsx)(iu,{schema:g,filters:el,onFiltersChange:eo,onOpenInSQL:()=>{let r=id(el);if(r&&t){let n=g.find(e=>1===e.pk)?.name||g[0]?.name||"rowid";t(`SELECT * FROM "${e}" WHERE ${r} ORDER BY "${n}" DESC LIMIT ${$};`)}}}),(0,l.jsx)("div",{className:"flex-1 overflow-hidden bg-background font-mono",children:(0,l.jsxs)(aC,{className:"w-full h-full",children:[(0,l.jsx)("div",{className:"w-max min-w-full pb-4",children:(0,l.jsxs)(aS,{style:{tableLayout:"fixed",width:`${eS}px`},children:[!j&&(0,l.jsx)(aR,{className:"bg-neutral-100 sticky top-0 z-30",children:(0,l.jsxs)(aT,{children:[(0,l.jsx)(aM,{className:"p-0 border-r border-neutral-200",style:{width:"40px",minWidth:"40px"},children:(0,l.jsx)("div",{className:"py-0.5 px-3 flex items-center",children:(0,l.jsx)(lO,{ref:W,checked:B.size===ej.length&&ej.length>0,onCheckedChange:ez,disabled:eR})})}),ek.map(e=>(0,l.jsx)(s7,{width:eg[e.name]||150,onResize:t=>eA(e.name,t),className:"py-0.5 whitespace-nowrap border-r border-neutral-200",children:(0,l.jsxs)(ia,{column:e.name,sortConfig:en,onSort:e_,children:[(0,l.jsx)("span",{className:"text-xs font-bold text-foreground",children:e.name}),(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:e.type?.toLowerCase()})]})},e.name))]})}),(0,l.jsxs)(aE,{children:[j&&(0,l.jsx)(aT,{className:"hover:bg-transparent",children:(0,l.jsx)(aA,{colSpan:ek.length+1,className:"h-64",children:(0,l.jsx)("div",{className:"h-full w-full flex items-center justify-center",children:(0,l.jsx)(v,{className:"h-6 w-6 animate-spin text-primary"})})})}),!j&&(0,l.jsxs)(l.Fragment,{children:[O.map((e,t)=>(0,l.jsx)(sw,{schema:ek,onRemove:()=>eI(t),onChange:e=>e$(t,e)},`new-${t}`)),0===ej.length&&0===O.length?(0,l.jsx)(aT,{className:"hover:bg-transparent",children:(0,l.jsx)(aA,{colSpan:ek.length+1,className:"h-64 text-center text-muted-foreground",children:ew?"No rows match the current filters":"Table is empty"})}):ej.map((e,t)=>(0,l.jsxs)(i().Fragment,{children:[(0,l.jsxs)(aT,{className:B.has(t)?"bg-blue-50":"bg-white",children:[(0,l.jsx)(aA,{className:"p-0",children:(0,l.jsx)("div",{className:"px-3 py-2.5 flex items-center",children:(0,l.jsx)(lO,{checked:B.has(t),onCheckedChange:e=>eB(t,e),disabled:eR})})}),ek.map(r=>{let n=`${t}::${r.name}`,a=M.get(n);return(0,l.jsx)(sv,{value:a?a.value:e[r.name],row:e,column:r.name,schema:g,onChange:e=>eP(t,r.name,e),onStartEdit:ew?void 0:e=>eO(t,r.name,e),isEditing:!ew&&M.has(n),style:{width:`${eg[r.name]||150}px`},fkInfo:em[r.name],onShowRelation:em[r.name]?()=>ex({rowIndex:t,relatedTable:em[r.name].table,relatedKey:em[r.name].to,value:e[r.name]}):void 0},r.name)})]}),eh?.rowIndex===t&&(0,l.jsx)(il,{relatedTable:eh.relatedTable,relatedKey:eh.relatedKey,value:eh.value,colSpan:ek.length+1,onClose:()=>ex(null)})]},t))]})]})]})}),(0,l.jsx)(ak,{orientation:"horizontal"})]})}),(0,l.jsx)(s3,{isOpen:V,onClose:()=>{K(!1),X(null)},onConfirm:eU,selectedCount:B.size,tableName:e,isDeleting:q,error:Y}),(0,l.jsx)(s6,{isOpen:Z,onClose:()=>ee(!1),error:et,onOpenInSQL:()=>{ee(!1)},onUpdateAnyway:async()=>{ee(!1),await eF(!0)},showSQLOption:et?.type==="NULLABLE_PK"}),(0,l.jsx)(s9,{open:Q,onClose:()=>J(!1),tableName:e,schema:g,onImportComplete:()=>{J(!1),eD()}})]})}function ip({migration:e}){return e.orphaned?(0,l.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-amber-600",children:[(0,l.jsx)(m,{className:"h-3 w-3"})," Orphaned"]}):e.applied?(0,l.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-green-600",children:[(0,l.jsx)(s8,{className:"h-3 w-3"})," Applied"]}):(0,l.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-amber-600",children:[(0,l.jsx)(w,{className:"h-3 w-3"})," Pending"]})}function ih(){let{currentDatabase:e,executeQuery:t,refreshTables:r}=(0,nQ.t)(),{toast:n}=(0,sr.dj)(),[a,s]=(0,o.useState)([]),[i,c]=(0,o.useState)(""),[d,u]=(0,o.useState)(!0),[f,p]=(0,o.useState)(!1),[h,x]=(0,o.useState)(null),g=(0,o.useCallback)(async()=>{u(!0),x(null);try{let t=e?.database_name,r=t?`?db=${encodeURIComponent(t)}`:"",n=await fetch(`/api/migrations/list${r}`),a=await n.json();if(!n.ok||!a.success)throw Error(a.error||"Failed to load migrations");s(a.migrations),c(a.migrationsDir)}catch(e){x(e.message)}finally{u(!1)}},[e]),y=a.filter(e=>!e.applied&&!e.orphaned),b=(0,o.useCallback)(async()=>{if(0===y.length)return;p(!0);let t=0;try{for(let r of y){await fetch(`/api/migrations/list?file=${encodeURIComponent(r.name)}${e?.database_name?`&db=${encodeURIComponent(e.database_name)}`:""}`);let n=await fetch("/api/migrations/sync-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({migrationName:r.name,db:e?.database_name})}),a=await n.json();if(!n.ok||!a.success)throw Error(`Failed to apply ${r.name}: ${a.error||"Unknown error"}`);t++}n({title:"Migrations Applied",description:`${t} migration${1!==t?"s":""} applied successfully.`}),await r(),await g()}catch(e){n({variant:"destructive",title:"Apply Failed",description:e.message})}finally{p(!1)}},[y,e,n,r,g]);return(0,l.jsxs)("div",{className:"h-full flex flex-col",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between p-4 border-b",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-sm font-semibold",children:"Migrations"}),i&&(0,l.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:i})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[y.length>0&&(0,l.jsx)(nZ,{size:"sm",onClick:b,disabled:f,className:"font-semibold",children:f?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(v,{className:"h-4 w-4 animate-spin"})," Applying…"]}):`Apply ${y.length} pending`}),(0,l.jsx)(nZ,{variant:"outline",size:"icon",className:"h-8",onClick:g,disabled:d,children:(0,l.jsx)(o7,{className:`h-4 w-4 ${d?"animate-spin":""}`})})]})]}),(0,l.jsxs)("div",{className:"flex-1 overflow-auto",children:[h&&(0,l.jsx)("div",{className:"p-4",children:(0,l.jsxs)(S,{variant:"destructive",children:[(0,l.jsx)(m,{className:"h-4 w-4"}),(0,l.jsx)(R,{children:h})]})}),!d&&!h&&0===a.length&&(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-2",children:[(0,l.jsx)(ss,{className:"h-8 w-8"}),(0,l.jsx)("p",{className:"text-sm",children:"No migration files found"}),(0,l.jsx)("p",{className:"text-xs",children:"Migration files appear here when you run DDL statements in the SQL editor"})]}),!h&&a.length>0&&(0,l.jsxs)(aS,{children:[(0,l.jsx)(aR,{className:"bg-neutral-100 sticky top-0 z-10",children:(0,l.jsxs)(aT,{children:[(0,l.jsx)(aM,{className:"text-xs font-bold",children:"Migration file"}),(0,l.jsx)(aM,{className:"text-xs font-bold w-28",children:"Status"}),(0,l.jsx)(aM,{className:"text-xs font-bold w-44",children:"Applied at"}),(0,l.jsx)(aM,{className:"text-xs font-bold w-20",children:"Checksum"})]})}),(0,l.jsx)(aE,{children:a.map(e=>(0,l.jsxs)(aT,{className:e.orphaned?"opacity-60":"",children:[(0,l.jsx)(aA,{className:"font-mono text-xs",children:e.name}),(0,l.jsx)(aA,{children:(0,l.jsx)(ip,{migration:e})}),(0,l.jsx)(aA,{className:"text-xs text-muted-foreground",children:e.applied_at?new Date(e.applied_at).toLocaleString():"—"}),(0,l.jsx)(aA,{className:"font-mono text-xs text-muted-foreground",children:e.checksum?e.checksum.slice(0,8):"—"})]},e.name))})]})]})]})}var ix=r(6256);let ig=r.n(ix)()(async()=>{},{loadableGenerated:{modules:["components/schema-view.jsx -> ./schema-erd"]},ssr:!1,loading:()=>(0,l.jsx)("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:"#0d1117",color:"#8b949e"},children:(0,l.jsx)("span",{style:{fontSize:14},children:"Loading…"})})});function iv(){let{currentDatabase:e}=(0,nQ.t)();return(0,l.jsx)(ig,{db:e?.database_name})}let iy={bg:"#ffffff",bg2:"#f9f8f6",border:"#e8e5e0",border2:"#d4d0c8",text:"#1a1714",text2:"#5a5650",text3:"#9a9590",orange:"#d4581e",orangeBg:"#fff4ee",orangeBorder:"#fddcc8"},ib=["January","February","March","April","May","June","July","August","September","October","November","December"],iw={2:[3,7,10,14,16],1:[5,12,18,22]};function ij(e){return String(e).padStart(2,"0")}function iN({year:e,month:t,selDay:r,today:n,earliest:a,onSelect:o,onPrev:s,onNext:i}){let c=new Date(e,t,1).getDay(),d=new Date(e,t+1,0).getDate(),u=iw[t]||[],f=n.getUTCFullYear(),m=n.getUTCMonth(),p=n.getUTCDate(),h=[];for(let e=0;e<c;e++)h.push((0,l.jsx)("div",{},`b${e}`));for(let n=1;n<=d;n++){let s=e>f||e===f&&t>m||e===f&&t===m&&n>p,i=new Date(e,t,n).getTime(),c=!!a&&i<new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),d=e===f&&t===m&&n===p,x=n===r,g=u.includes(n),v=s||c;h.push((0,l.jsxs)("div",{onClick:v?void 0:()=>o(n),style:{fontSize:11,textAlign:"center",padding:"4px 0",borderRadius:4,cursor:v?"default":"pointer",color:v?iy.border2:x?iy.bg:d?iy.text:iy.text2,background:x?iy.text:"transparent",fontWeight:d?600:void 0,pointerEvents:v?"none":void 0,position:"relative",userSelect:"none"},className:v||x?"":"hover:bg-[#f2f0ec]",children:[n,g&&!s&&(0,l.jsx)("span",{style:{position:"absolute",bottom:1,left:"50%",transform:"translateX(-50%)",width:3,height:3,borderRadius:"50%",background:x?iy.bg:iy.orange,display:"block"}})]},n))}return(0,l.jsxs)("div",{style:{padding:"14px 16px",borderBottom:`1px solid ${iy.border}`},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[(0,l.jsxs)("span",{style:{fontSize:13,fontWeight:500,color:iy.text},children:[ib[t]," ",e]}),(0,l.jsx)("div",{style:{display:"flex",gap:3},children:[["‹",s],["›",i]].map(([e,t])=>(0,l.jsx)("button",{onClick:t,style:{width:24,height:24,border:`1px solid ${iy.border}`,borderRadius:6,background:"transparent",cursor:"pointer",fontSize:14,color:iy.text2,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1},className:"hover:bg-[#f9f8f6]",children:e},e))})]}),(0,l.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:1},children:[["Su","Mo","Tu","We","Th","Fr","Sa"].map(e=>(0,l.jsx)("div",{style:{fontSize:10,fontWeight:500,color:iy.text3,textAlign:"center",padding:"3px 0"},children:e},e)),h]})]})}function iC({kind:e,text:t}){let r={a:{bg:"#f0fdf4",color:"#15803d",markBg:"#f0fdf4",markColor:"#16a34a",mark:"+"},r:{bg:"#fef2f2",color:"#b91c1c",markBg:"#fef2f2",markColor:"#dc2626",mark:"−"},c:{bg:"#f9fafb",color:iy.text3,markBg:"#f9fafb",markColor:iy.text3,mark:"~"}}[e];return(0,l.jsxs)("div",{style:{display:"flex",alignItems:"stretch",fontSize:11,fontFamily:"ui-monospace,SF Mono,monospace",borderRadius:5,overflow:"hidden",marginBottom:2},children:[(0,l.jsx)("div",{style:{width:22,minWidth:22,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:12,background:r.markBg,color:r.markColor},children:r.mark}),(0,l.jsx)("div",{style:{flex:1,padding:"4px 8px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",background:r.bg,color:r.color},children:t})]})}function ik({type:e,children:t}){return(0,l.jsx)("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:3,fontFamily:"ui-monospace,SF Mono,monospace",...{rm:{background:"#fef2f2",color:"#dc2626",border:"1px solid #fecaca"},add:{background:"#f0fdf4",color:"#16a34a",border:"1px solid #bbf7d0"},ch:{background:"#fffbeb",color:"#d97706",border:"1px solid #fde68a"}}[e]},children:t})}function iS({label:e,bookmark:t,onCancel:r,onConfirm:n}){return(0,l.jsx)("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.2)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:30,borderRadius:12},children:(0,l.jsxs)("div",{style:{background:iy.bg,border:`1px solid ${iy.border}`,borderRadius:12,padding:24,boxShadow:"0 8px 40px rgba(0,0,0,0.12)",width:340},children:[(0,l.jsx)("div",{style:{width:38,height:38,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",background:"#fef2f2",border:"1px solid #fecaca",marginBottom:14},children:(0,l.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",stroke:"#dc2626",strokeWidth:"1.5",children:[(0,l.jsx)("path",{d:"M9 2L2 15h14L9 2z"}),(0,l.jsx)("path",{d:"M9 7v4M9 12.5v.5"})]})}),(0,l.jsx)("div",{style:{fontSize:14,fontWeight:600,color:iy.text,marginBottom:5},children:"Restore database?"}),(0,l.jsx)("div",{style:{fontSize:12,color:iy.text2,lineHeight:1.6,marginBottom:10},children:"This will overwrite your remote D1 database in place. All in-flight queries and transactions will be cancelled."}),(0,l.jsxs)("div",{style:{fontFamily:"ui-monospace,SF Mono,monospace",fontSize:12,padding:"8px 10px",background:iy.bg2,borderRadius:6,color:iy.text,marginBottom:10,lineHeight:1.7},children:[e,t&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("br",{}),(0,l.jsxs)("span",{style:{fontSize:10,color:iy.text3},children:["bookmark: ",t]})]})]}),(0,l.jsx)("div",{style:{fontSize:11,color:"#c2410c",background:iy.orangeBg,border:`1px solid ${iy.orangeBorder}`,borderRadius:6,padding:"8px 10px",marginBottom:16,lineHeight:1.55},children:"⚠ A pre-restore bookmark will be saved automatically so you can undo this restore if needed."}),(0,l.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,l.jsx)("button",{onClick:r,style:{flex:1,padding:8,border:`1px solid ${iy.border}`,borderRadius:7,background:"transparent",color:iy.text2,fontSize:12,cursor:"pointer",fontFamily:"system-ui,sans-serif"},className:"hover:text-[#1a1714]",children:"Cancel"}),(0,l.jsx)("button",{onClick:n,style:{flex:1,padding:8,background:"#dc2626",color:"white",border:"none",borderRadius:7,fontSize:12,fontWeight:500,cursor:"pointer",fontFamily:"system-ui,sans-serif"},className:"hover:bg-[#b91c1c]",children:"Yes, restore database"})]})]})})}function iR({label:e,undoBookmark:t,onDone:r}){return(0,l.jsx)("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.2)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:30,borderRadius:12},children:(0,l.jsxs)("div",{style:{background:iy.bg,border:`1px solid ${iy.border}`,borderRadius:12,padding:24,boxShadow:"0 8px 40px rgba(0,0,0,0.12)",width:320,textAlign:"center"},children:[(0,l.jsx)("div",{style:{width:38,height:38,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"#f0fdf4",border:"1px solid #bbf7d0",margin:"0 auto 14px"},children:(0,l.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 20 20",fill:"none",stroke:"#16a34a",strokeWidth:"2",children:(0,l.jsx)("path",{d:"M4 10l4 4 8-8"})})}),(0,l.jsx)("div",{style:{fontSize:14,fontWeight:600,color:iy.text,marginBottom:5},children:"Database restored"}),(0,l.jsxs)("div",{style:{fontSize:12,color:iy.text2,lineHeight:1.6,marginBottom:10},children:["Database has been restored to ",e," successfully."]}),t&&(0,l.jsxs)("div",{style:{fontSize:11,color:iy.text2,background:iy.bg2,border:`1px solid ${iy.border}`,borderRadius:6,padding:"7px 10px",marginBottom:14,fontFamily:"ui-monospace,SF Mono,monospace",textAlign:"left"},children:["undo bookmark: ",t,(0,l.jsx)("br",{}),(0,l.jsx)("span",{style:{fontSize:10,color:iy.text3},children:"Use this to revert if something looks wrong"})]}),(0,l.jsx)("button",{onClick:r,style:{width:"100%",padding:9,background:iy.text,color:iy.bg,border:"none",borderRadius:7,fontSize:12,fontWeight:500,cursor:"pointer",fontFamily:"system-ui,sans-serif"},children:"Done"})]})})}function iE(){let{currentDatabase:e}=(0,nQ.t)(),t=e?.database_name||"database",r=new Date,[n,a]=(0,o.useState)(r.getUTCFullYear()),[s,i]=(0,o.useState)(r.getUTCMonth()),[c,d]=(0,o.useState)(r.getUTCDate()),[u,f]=(0,o.useState)(`${ij(r.getUTCHours())}:${ij(r.getUTCMinutes())}:00`),[m,p]=(0,o.useState)(null),[h,x]=(0,o.useState)(null),[g,v]=(0,o.useState)(!0),[y,b]=(0,o.useState)(null),[w,j]=(0,o.useState)(null),N=new Date(r.getTime()-2592e6),C=w||N,[k,S]=(0,o.useState)(null),[R,E]=(0,o.useState)(!1),[T,M]=(0,o.useState)(null),[A,D]=(0,o.useState)(!1),[_,O]=(0,o.useState)(!1),[P,L]=(0,o.useState)(null),[I,$]=(0,o.useState)(!1),[F,U]=(0,o.useState)(null),z=`${ib[s].slice(0,3)} ${ij(c)}, ${n} \xb7 ${u||"00:00:00"} UTC`,B=`${ib[s].slice(0,3)} ${ij(c)}, ${n} at ${u||"00:00:00"} UTC`,H=(0,o.useCallback)(()=>{i(e=>0===e?(a(e=>e-1),11):e-1),d(1),S(null)},[]),W=(0,o.useCallback)(()=>{let e=11===s?0:s+1,t=11===s?n+1:n;t>r.getUTCFullYear()||t===r.getUTCFullYear()&&e>r.getUTCMonth()||(i(e),a(t),d(1),S(null))},[s,n,r]),V=(0,o.useCallback)(e=>{d(e),p(null),S(null)},[]),K=(0,o.useCallback)((e,t,r,n,l)=>{a(t),i(r),d(n),f(l),p(e),S(null)},[]),q=(0,o.useCallback)(()=>{let e=new Date;a(e.getUTCFullYear()),i(e.getUTCMonth()),d(e.getUTCDate()),f(`${ij(e.getUTCHours())}:${ij(e.getUTCMinutes())}:00`),p(null),S(null)},[]),G=(0,o.useCallback)(async()=>{E(!0),M(null),S(null);try{let t=e?.database_name?`?db=${encodeURIComponent(e.database_name)}`:"",r=await fetch(`/api/time-travel/preview${t}`),n=await r.json();if(!r.ok||!n.success)throw Error(n.error||"Failed to refresh remote state");x(n.currentBookmark),S({bookmark:n.currentBookmark})}catch(e){M(e.message)}finally{E(!1)}},[e]),Y=(0,o.useCallback)(async()=>{D(!1),O(!0),L(null);try{let t=new Date(`${n}-${ij(s+1)}-${ij(c)}T${u}Z`).toISOString(),r=await fetch("/api/time-travel/restore",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({db:e?.database_name,bookmark:k?.bookmark??null,timestamp:t})}),a=await r.json();if(!r.ok||!a.success)throw Error(a.error||"Restore failed");U(a.undoBookmark),$(!0)}catch(e){L(e.message)}finally{O(!1)}},[n,s,c,u,e,k]),X=new Date(r-18e5),Q=new Date(r);Q.setHours(12,0,0,0);let J=new Date(r-864e5);J.setHours(18,0,0,0);let Z=new Date(r-1728e5);Z.setHours(9,0,0,0);let ee=new Date(r-6048e5);ee.setHours(0,0,0,0);let et=[{id:"q30",label:"30 minutes ago",time:`${ij(X.getUTCHours())}:${ij(X.getUTCMinutes())}`,date:X,y:X.getUTCFullYear(),m:X.getUTCMonth(),d:X.getUTCDate(),t:`${ij(X.getUTCHours())}:${ij(X.getUTCMinutes())}:00`,icon:"clock"},{id:"qtoday",label:"Earlier today",time:"12:00",date:Q,y:Q.getUTCFullYear(),m:Q.getUTCMonth(),d:Q.getUTCDate(),t:"12:00:00",icon:"clock"},{id:"qyest",label:"Yesterday evening",time:`${ib[J.getUTCMonth()].slice(0,3)} ${J.getUTCDate()}`,date:J,y:J.getUTCFullYear(),m:J.getUTCMonth(),d:J.getUTCDate(),t:"18:00:00",icon:"clock"},{id:"qmig",label:"Before last migration",time:`${ib[Z.getUTCMonth()].slice(0,3)} ${Z.getUTCDate()}`,date:Z,y:Z.getUTCFullYear(),m:Z.getUTCMonth(),d:Z.getUTCDate(),t:"09:00:00",icon:"shield"},{id:"qweek",label:"1 week ago",time:`${ib[ee.getUTCMonth()].slice(0,3)} ${ee.getUTCDate()}`,date:ee,y:ee.getUTCFullYear(),m:ee.getUTCMonth(),d:ee.getUTCDate(),t:"00:00:00",icon:"clock"}];return(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",position:"relative",overflow:"hidden",background:iy.bg},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 18px",borderBottom:`1px solid ${iy.border}`,flexShrink:0},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{style:{fontSize:13,fontWeight:600,color:iy.text},children:"Time travel"}),(0,l.jsxs)("div",{style:{fontSize:11,color:iy.text3,marginTop:1},children:[t," \xb7 remote \xb7"," ",g?"loading available window…":y?"could not load window info":h?`latest snapshot: ${h.slice(0,18)}…`:"restore to any point in the available window"]})]}),(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"5px 11px",background:iy.orangeBg,border:`1px solid ${iy.orangeBorder}`,borderRadius:20,fontSize:11,color:iy.orange,marginLeft:"auto",flexShrink:0},children:[(0,l.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 13 13",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[(0,l.jsx)("path",{d:"M6.5 1L1 11h11z"}),(0,l.jsx)("path",{d:"M6.5 5v3M6.5 9.5v.5"})]}),"Restore overwrites remote DB in place"]})]}),(0,l.jsxs)("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[(0,l.jsxs)("div",{style:{width:290,minWidth:290,borderRight:`1px solid ${iy.border}`,display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,l.jsx)(iN,{year:n,month:s,selDay:c,today:r,earliest:C,onSelect:V,onPrev:H,onNext:W}),(0,l.jsxs)("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${iy.border}`,flexShrink:0},children:[(0,l.jsx)("div",{style:{fontSize:11,fontWeight:500,color:iy.text3,marginBottom:7},children:"Time (UTC)"}),(0,l.jsxs)("div",{style:{display:"flex",gap:7,alignItems:"center"},children:[(0,l.jsx)("input",{value:u,onChange:e=>{f(e.target.value),S(null)},style:{flex:1,padding:"7px 10px",border:`1px solid ${iy.border}`,borderRadius:6,fontFamily:"ui-monospace,SF Mono,monospace",fontSize:13,color:iy.text,background:iy.bg,outline:"none"},onFocus:e=>e.target.style.borderColor=iy.border2,onBlur:e=>e.target.style.borderColor=iy.border,placeholder:"HH:MM:SS"}),(0,l.jsx)("button",{onClick:q,style:{padding:"7px 11px",border:`1px solid ${iy.border}`,borderRadius:6,fontSize:11,color:iy.text2,background:iy.bg2,cursor:"pointer",fontFamily:"system-ui,sans-serif",whiteSpace:"nowrap"},className:"hover:text-[#1a1714]",children:"Now"})]})]}),(0,l.jsxs)("div",{style:{padding:"10px 16px",flex:1,overflowY:"auto"},children:[(0,l.jsx)("div",{style:{fontSize:11,fontWeight:500,color:iy.text3,marginBottom:9},children:"Quick points"}),et.map(e=>{let t=m===e.id,r=e.date<new Date(C.getFullYear(),C.getMonth(),C.getDate());return(0,l.jsxs)("button",{onClick:r?void 0:()=>K(e.id,e.y,e.m,e.d,e.t),disabled:r,title:r?"Outside available Time Travel window":void 0,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"7px 10px",border:`1px solid ${t?iy.text:iy.border}`,borderRadius:7,background:t?iy.bg2:iy.bg,cursor:r?"not-allowed":"pointer",fontFamily:"system-ui,sans-serif",fontSize:12,color:r?iy.border2:t?iy.text:iy.text2,marginBottom:5,textAlign:"left",transition:"border-color 0.1s",opacity:r?.5:1},className:r?"":"hover:border-[#d4d0c8] hover:text-[#1a1714]",children:["clock"===e.icon?(0,l.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",stroke:"currentColor",strokeWidth:"1.2",style:{opacity:t?.8:.4,flexShrink:0},children:[(0,l.jsx)("circle",{cx:"6.5",cy:"6.5",r:"5"}),(0,l.jsx)("path",{d:"M6.5 3.5v3l2 1.5"})]}):(0,l.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",stroke:"currentColor",strokeWidth:"1.2",style:{opacity:t?.8:.4,flexShrink:0},children:(0,l.jsx)("path",{d:"M6.5 1L1 4v3c0 3 2.4 5.5 5.5 6.5 3.1-1 5.5-3.5 5.5-6.5V4z"})}),e.label,(0,l.jsx)("span",{style:{marginLeft:"auto",fontFamily:"ui-monospace,SF Mono,monospace",fontSize:10,color:iy.text3},children:e.time})]},e.id)})]})]}),(0,l.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"11px 16px",borderBottom:`1px solid ${iy.border}`,flexShrink:0},children:[(0,l.jsxs)("span",{style:{fontSize:12,fontWeight:500,color:iy.text,flex:1},children:["Snapshot — ",B]}),k?.bookmark&&(0,l.jsx)("span",{style:{fontFamily:"ui-monospace,SF Mono,monospace",fontSize:10,color:iy.text3,padding:"2px 7px",background:iy.bg2,border:`1px solid ${iy.border}`,borderRadius:3},children:k.bookmark.length>22?k.bookmark.slice(0,20)+"…":k.bookmark})]}),(0,l.jsxs)("div",{style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:[T&&(0,l.jsx)("div",{style:{fontSize:12,color:"#dc2626",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:7,padding:"10px 12px",marginBottom:12},children:T}),P&&(0,l.jsxs)("div",{style:{fontSize:12,color:"#dc2626",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:7,padding:"10px 12px",marginBottom:12},children:["Restore failed: ",P]}),R&&(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:iy.text3,padding:"20px 0"},children:[(0,l.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",style:{animation:"spin 1s linear infinite"},children:[(0,l.jsx)("circle",{cx:"7",cy:"7",r:"5",strokeOpacity:"0.3"}),(0,l.jsx)("path",{d:"M7 2a5 5 0 0 1 5 5"})]}),"Loading snapshot info…",(0,l.jsx)("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}),!R&&!k&&!T&&(0,l.jsxs)("div",{style:{padding:"20px 0",color:iy.text3,fontSize:12},children:[h&&(0,l.jsxs)("div",{style:{background:iy.bg2,border:`1px solid ${iy.border}`,borderRadius:8,padding:"12px 14px",marginBottom:14},children:[(0,l.jsx)("div",{style:{fontSize:11,fontWeight:500,color:iy.text3,marginBottom:6},children:"Current snapshot (latest)"}),(0,l.jsx)("div",{style:{fontFamily:"ui-monospace,SF Mono,monospace",fontSize:11,color:iy.text,wordBreak:"break-all"},children:h})]}),(0,l.jsxs)("div",{style:{textAlign:"center",paddingTop:h?4:24},children:[(0,l.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 13 13",fill:"none",stroke:"currentColor",strokeWidth:"1",style:{margin:"0 auto 10px",display:"block",opacity:.3},children:[(0,l.jsx)("circle",{cx:"6.5",cy:"6.5",r:"5"}),(0,l.jsx)("path",{d:"M6.5 3.5v3l2 1.5"})]}),"Select a date & time, then click ",(0,l.jsx)("strong",{children:"Refresh preview"})," to load snapshot info."]})]}),!R&&k&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{style:{marginBottom:18},children:[(0,l.jsxs)("div",{style:{fontSize:11,fontWeight:600,color:iy.text,marginBottom:7,display:"flex",alignItems:"center",gap:6},children:["Remote state",(0,l.jsx)(ik,{type:"add",children:"refreshed"})]}),(0,l.jsx)(iC,{kind:"c",text:`Restore target: ${B}`}),k.bookmark?(0,l.jsx)(iC,{kind:"a",text:`current bookmark: ${k.bookmark}`}):(0,l.jsx)(iC,{kind:"c",text:"current bookmark: (not returned by wrangler)"}),(0,l.jsx)(iC,{kind:"c",text:"Restore will roll back all changes made after the selected time"})]}),(0,l.jsx)("div",{style:{fontSize:11,color:iy.text3,background:iy.bg2,border:`1px solid ${iy.border}`,borderRadius:7,padding:"10px 12px",lineHeight:1.6},children:"Cloudflare Time Travel does not provide a row-level diff before restore. After confirming, the database will be rolled back atomically to the selected point in time. An undo bookmark will be shown after restore."})]})]}),(0,l.jsxs)("div",{style:{padding:"12px 16px",borderTop:`1px solid ${iy.border}`,display:"flex",alignItems:"center",gap:10,background:iy.bg,flexShrink:0},children:[(0,l.jsxs)("div",{style:{flex:1},children:[(0,l.jsxs)("div",{style:{fontSize:12,fontWeight:500,color:iy.text},children:["Restore to ",z]}),k?.bookmark&&(0,l.jsxs)("div",{style:{fontSize:11,color:iy.text3,fontFamily:"ui-monospace,SF Mono,monospace",marginTop:1},children:["bookmark: ",k.bookmark]})]}),(0,l.jsxs)("button",{onClick:G,disabled:R,style:{display:"flex",alignItems:"center",gap:5,padding:"8px 14px",borderRadius:7,border:`1px solid ${iy.border}`,background:iy.bg,color:iy.text,fontSize:12,fontWeight:500,cursor:R?"default":"pointer",fontFamily:"system-ui,sans-serif",whiteSpace:"nowrap",opacity:R?.6:1},className:"hover:bg-[#f9f8f6]",children:[(0,l.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[(0,l.jsx)("path",{d:"M1 6A5 5 0 0 1 10 3M11 6A5 5 0 0 1 2 9"}),(0,l.jsx)("path",{d:"M9 1.5v2h2M1 8.5v2h2"})]}),"Refresh preview"]}),(0,l.jsxs)("button",{onClick:()=>D(!0),disabled:_,style:{display:"flex",alignItems:"center",gap:5,padding:"8px 14px",borderRadius:7,border:"none",background:_?"#f87171":"#dc2626",color:"white",fontSize:12,fontWeight:500,cursor:_?"default":"pointer",fontFamily:"system-ui,sans-serif",whiteSpace:"nowrap"},className:"hover:bg-[#b91c1c]",children:[(0,l.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[(0,l.jsx)("path",{d:"M1 6A5 5 0 0 1 10 3M11 6A5 5 0 0 1 2 9"}),(0,l.jsx)("path",{d:"M9 1.5v2h2M1 8.5v2h2"})]}),_?"Restoring…":"Restore database"]})]})]})]}),A&&(0,l.jsx)(iS,{label:z,bookmark:k?.bookmark,onCancel:()=>D(!1),onConfirm:Y}),I&&(0,l.jsx)(iR,{label:z,undoBookmark:F,onDone:()=>{$(!1),S(null)}})]})}function iT({open:e,onClose:t,onSubmit:r}){let[n,a]=(0,o.useState)(""),[s,i]=(0,o.useState)(""),[c,d]=(0,o.useState)(""),[u,f]=(0,o.useState)(!1),m=async e=>{e.preventDefault(),d(""),f(!0);try{await r({accountId:n,apiToken:s}),localStorage.setItem("cf_credentials",JSON.stringify({accountId:n,apiToken:s})),t()}catch(e){d(e.message)}finally{f(!1)}};return(0,l.jsx)(sR,{open:e,onOpenChange:t,children:(0,l.jsxs)(s0,{className:"sm:max-w-md",children:[(0,l.jsxs)(s1,{children:[(0,l.jsx)(s5,{children:"Connect to Cloudflare"}),(0,l.jsx)(s4,{children:"Enter your Cloudflare credentials to push your database to production."})]}),(0,l.jsxs)("form",{onSubmit:m,className:"space-y-4 mt-4",children:[c&&(0,l.jsx)(S,{variant:"destructive",children:(0,l.jsx)(R,{children:c})}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("label",{className:"text-sm font-medium",children:"Account ID"}),(0,l.jsx)(N,{placeholder:"Your Cloudflare Account ID",value:n,onChange:e=>a(e.target.value),required:!0})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("label",{className:"text-sm font-medium",children:"API Token"}),(0,l.jsx)(N,{type:"password",placeholder:"Your D1 Database API Token",value:s,onChange:e=>i(e.target.value),required:!0})]}),(0,l.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,l.jsx)(nZ,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,l.jsxs)(nZ,{type:"submit",disabled:u,children:[u&&(0,l.jsx)(v,{className:"mr-2 h-4 w-4 animate-spin"}),"Connect"]})]})]})]})})}function iM(){let{refreshTables:e}=(0,nQ.t)(),[t,r]=(0,o.useState)(!1),[n,a]=(0,o.useState)(null),[s,i]=(0,o.useState)(null),{isConnecting:c,isPushing:d,showPreview:u,connectToCloudflare:f,pushToRemote:p,pullToRemotePreview:h,validateStoredCredentials:x,PreviewUI:g}=aP(),y=async()=>{i(null),a("push");try{if(!await x()){r(!0);return}await p(),i({type:"success",message:"Push to remote initiated. Check the preview for details."})}catch(e){i({type:"error",message:e.message})}},b=async()=>{i(null),a("pull");try{if(!await x()){r(!0);return}await h()}catch(e){i({type:"error",message:e.message})}},w=c||d;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"h-full flex flex-col",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 p-4 border-b",children:[(0,l.jsx)(o7,{className:"h-4 w-4"}),(0,l.jsx)("h2",{className:"text-sm font-semibold",children:"Remote Sync"})]}),(0,l.jsx)("div",{className:"flex-1 overflow-auto p-6",children:(0,l.jsxs)("div",{className:"max-w-lg flex flex-col gap-6",children:[(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:"Sync your local D1 database with Cloudflare. Pushing uploads your local data to production; pulling downloads the remote state to your local environment."}),s&&(0,l.jsxs)(S,{variant:"error"===s.type?"destructive":"default",children:["error"===s.type?(0,l.jsx)(m,{className:"h-4 w-4"}):(0,l.jsx)(s8,{className:"h-4 w-4"}),(0,l.jsx)(R,{children:s.message})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,l.jsxs)("div",{className:"border rounded-md p-4 bg-white flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(oO,{className:"h-4 w-4 text-neutral-600"}),(0,l.jsx)("span",{className:"text-sm font-semibold",children:"Push to remote"})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Upload local database state to your Cloudflare D1 database."}),(0,l.jsx)(nZ,{size:"sm",onClick:y,disabled:w,className:"w-full",children:d&&"push"===n?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(v,{className:"h-4 w-4 animate-spin mr-2"})," Pushing…"]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(oO,{className:"h-4 w-4 mr-2"})," Push"]})})]}),(0,l.jsxs)("div",{className:"border rounded-md p-4 bg-white flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(sa,{className:"h-4 w-4 text-neutral-600"}),(0,l.jsx)("span",{className:"text-sm font-semibold",children:"Pull from remote"})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Download Cloudflare D1 data into your local environment."}),(0,l.jsx)(nZ,{size:"sm",variant:"outline",onClick:b,disabled:w,className:"w-full",children:c&&"pull"===n?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(v,{className:"h-4 w-4 animate-spin mr-2"})," Pulling…"]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(sa,{className:"h-4 w-4 mr-2"})," Pull"]})})]})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Cloudflare API credentials are required. You'll be prompted to enter them if not already saved."})]})})]}),(0,l.jsx)(iT,{open:t,onClose:()=>r(!1),onSubmit:f}),g]})}let iA={loading:"text-blue-500 border-blue-500/40 bg-blue-500/5",success:"text-green-600 border-green-500/40 bg-green-500/5",error:"text-red-500 border-red-500/40 bg-red-500/5",info:"text-muted-foreground border-border bg-transparent"},iD={loading:null,success:"✓",error:"✗",info:"─"};function i_(){let{lastStatus:e}=(0,nQ.t)(),t=function(e){let[t,r]=(0,o.useState)("");return t}(e?.ts),r=e?.type??"info",n=e?.message??"Ready",a=e?.detail??null,s=iA[r]??iA.info,i=iD[r];return(0,l.jsxs)("div",{className:`flex items-center justify-between h-8 px-4 border-t font-mono text-xs select-none shrink-0 ${s}`,role:"status","aria-live":"polite",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,l.jsx)("span",{className:"shrink-0 w-4 flex items-center justify-center",children:"loading"===r?(0,l.jsx)(v,{className:"h-3 w-3 animate-spin"}):(0,l.jsx)("span",{children:i})}),(0,l.jsx)("span",{className:"truncate",children:n}),a&&(0,l.jsxs)("span",{className:"text-muted-foreground truncate hidden sm:inline",children:["\xb7 ",a]})]}),t&&(0,l.jsx)("span",{className:"text-muted-foreground shrink-0 pl-4",children:t})]})}function iO(){let[e,t]=(0,o.useState)("sql-editor"),[r,n]=(0,o.useState)(null),[a,s]=(0,o.useState)("");return(0,l.jsxs)("div",{className:"flex h-screen bg-background",children:[(0,l.jsx)(aI,{className:"w-64 border-r flex-shrink-0",currentView:e,onNavigate:t,onTableSelect:e=>{n(e),t("table-view")}}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,l.jsxs)("main",{className:"flex-1 overflow-hidden",children:["sql-editor"===e&&(0,l.jsx)(lw,{initialQuery:a}),"schema"===e&&(0,l.jsx)(iv,{}),"migrations"===e&&(0,l.jsx)(ih,{}),"time-travel"===e&&(0,l.jsx)(iE,{}),"remote-sync"===e&&(0,l.jsx)(iM,{}),"table-view"===e&&r&&(0,l.jsx)(im,{tableName:r,onOpenInSQL:e=>{s(e),t("sql-editor")}})]}),(0,l.jsx)(i_,{})]})]})}},8868:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});let n=(0,r(6760).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx","default")}};var t=require("../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[994,992,572],()=>r(7185));module.exports=n})();
|