@theobourgeois/ytdb 0.2.13 → 0.2.14
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +4 -2
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +1 -1
- package/.next/routes-manifest.json +12 -0
- package/.next/server/app/[connectionId]/[schema]/[table]/page.js +1 -1
- package/.next/server/app/[connectionId]/[schema]/[table]/page.js.nft.json +1 -1
- package/.next/server/app/[connectionId]/[schema]/[table]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/[connectionId]/diff/page.js +2 -2
- package/.next/server/app/[connectionId]/diff/page.js.nft.json +1 -1
- package/.next/server/app/[connectionId]/diff/page_client-reference-manifest.js +1 -1
- package/.next/server/app/[connectionId]/migrations/[setId]/page.js +1 -1
- package/.next/server/app/[connectionId]/migrations/[setId]/page.js.nft.json +1 -1
- package/.next/server/app/[connectionId]/migrations/[setId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/[connectionId]/migrations/page.js +1 -1
- package/.next/server/app/[connectionId]/migrations/page.js.nft.json +1 -1
- package/.next/server/app/[connectionId]/migrations/page_client-reference-manifest.js +1 -1
- package/.next/server/app/[connectionId]/page.js +1 -1
- package/.next/server/app/[connectionId]/page.js.nft.json +1 -1
- package/.next/server/app/[connectionId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/[connectionId]/query/page.js +1 -1
- package/.next/server/app/[connectionId]/query/page.js.nft.json +1 -1
- package/.next/server/app/[connectionId]/query/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error/page.js +2 -2
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/activity/route.js +2 -2
- package/.next/server/app/api/adopt/route.js +2 -2
- package/.next/server/app/api/adopt/route.js.nft.json +1 -1
- package/.next/server/app/api/cell/route.js +36 -2
- package/.next/server/app/api/cell/route.js.nft.json +1 -1
- package/.next/server/app/api/definition/route.js +2 -3
- package/.next/server/app/api/definition/route.js.nft.json +1 -1
- package/.next/server/app/api/delete-rows/route.js +2 -3
- package/.next/server/app/api/delete-rows/route.js.nft.json +1 -1
- package/.next/server/app/api/detect/route.js +133 -0
- package/.next/server/app/api/detect/route.js.nft.json +1 -0
- package/.next/server/app/api/detect/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/health/route.js +1 -1
- package/.next/server/app/api/insert-row/route.js +36 -2
- package/.next/server/app/api/insert-row/route.js.nft.json +1 -1
- package/.next/server/app/api/ledger/route.js +2 -2
- package/.next/server/app/api/ledger/route.js.nft.json +1 -1
- package/.next/server/app/api/lookup/route.js +36 -2
- package/.next/server/app/api/lookup/route.js.nft.json +1 -1
- package/.next/server/app/api/migrate/route.js +2 -2
- package/.next/server/app/api/migrate/route.js.nft.json +1 -1
- package/.next/server/app/api/note/route.js +1 -0
- package/.next/server/app/api/note/route.js.nft.json +1 -0
- package/.next/server/app/api/note/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/query/route.js +36 -2
- package/.next/server/app/api/query/route.js.nft.json +1 -1
- package/.next/server/app/api/related/route.js +36 -2
- package/.next/server/app/api/related/route.js.nft.json +1 -1
- package/.next/server/app/api/repo/route.js +1 -1
- package/.next/server/app/api/repo/route.js.nft.json +1 -1
- package/.next/server/app/api/rows/route.js +35 -1
- package/.next/server/app/api/rows/route.js.nft.json +1 -1
- package/.next/server/app/api/schema/route.js +1 -1
- package/.next/server/app/api/tables/route.js +2 -2
- package/.next/server/app/api/update-row/route.js +35 -1
- package/.next/server/app/api/update-row/route.js.nft.json +1 -1
- package/.next/server/app/favicon.ico/route.js +1 -1
- package/.next/server/app/icon.svg/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +3 -3
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/page.js +2 -2
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +4 -2
- package/.next/server/chunks/161.js +2 -0
- package/.next/server/chunks/172.js +1 -1
- package/.next/server/chunks/593.js +1 -1
- package/.next/server/chunks/605.js +2 -0
- package/.next/server/chunks/635.js +1 -0
- package/.next/server/chunks/729.js +1 -1
- package/.next/server/chunks/755.js +1 -0
- package/.next/server/chunks/814.js +2 -0
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/static/Kl2VO8n1C_x2tm12ZIpwL/_buildManifest.js +1 -0
- package/.next/static/chunks/3732-27acf4e4f8caa92d.js +1 -0
- package/.next/static/chunks/4730-edc8f5e7a930e67c.js +1 -0
- package/.next/static/chunks/478-36d0af53d0639a95.js +1 -0
- package/.next/static/chunks/6090-2831a02797d69073.js +1 -0
- package/.next/static/chunks/6782-c8b44f7f0d19d8e4.js +1 -0
- package/.next/static/chunks/7709-0647960e67cf25f2.js +1 -0
- package/.next/static/chunks/8026-d0db1e7b45d32046.js +1 -0
- package/.next/static/chunks/9159-49aed1d3f177a824.js +1 -0
- package/.next/static/chunks/app/[connectionId]/[schema]/[table]/page-6f65747dd3e53273.js +1 -0
- package/.next/static/chunks/app/[connectionId]/diff/page-4fec354f34fb5566.js +10 -0
- package/.next/static/chunks/app/[connectionId]/{layout-d990f4312947106b.js → layout-2920542266b3ced9.js} +1 -1
- package/.next/static/chunks/app/[connectionId]/migrations/[setId]/page-07f064833d428c62.js +1 -0
- package/.next/static/chunks/app/[connectionId]/migrations/page-33e44680d62cbc05.js +1 -0
- package/.next/static/chunks/app/[connectionId]/page-df1d6620d85e3e15.js +1 -0
- package/.next/static/chunks/app/[connectionId]/query/page-1dc88ac208e95bfb.js +1 -0
- package/.next/static/chunks/app/_global-error/page-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/activity/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/adopt/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/cell/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/definition/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/delete-rows/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/detect/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/health/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/insert-row/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/ledger/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/lookup/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/migrate/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/note/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/query/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/related/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/repo/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/rows/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/schema/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/tables/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/api/update-row/route-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/app/page-46e11b50fbcec559.js +2 -0
- package/.next/static/chunks/f97e080b-e536bdbfe64c5a7e.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-ff89809b1108405d.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-ff89809b1108405d.js +1 -0
- package/.next/static/css/c143e3d201642479.css +1 -0
- package/README.md +23 -4
- package/package.json +1 -1
- package/.next/server/chunks/566.js +0 -1
- package/.next/server/chunks/738.js +0 -2
- package/.next/server/chunks/802.js +0 -1
- package/.next/server/chunks/97.js +0 -36
- package/.next/static/KSnyCCtuopUbqXHmuoiqW/_buildManifest.js +0 -1
- package/.next/static/chunks/1656-2ef431c507f0f186.js +0 -1
- package/.next/static/chunks/1715-206f291fde410bf6.js +0 -1
- package/.next/static/chunks/3678-daffdce12ffe73e6.js +0 -1
- package/.next/static/chunks/4029-abdeb362648dd921.js +0 -1
- package/.next/static/chunks/649-a1f6ba42883ab7ce.js +0 -1
- package/.next/static/chunks/6996-45e967f18861b87e.js +0 -1
- package/.next/static/chunks/7893-4515c42324443f01.js +0 -1
- package/.next/static/chunks/8500-01a63dafd809e317.js +0 -1
- package/.next/static/chunks/900-3bd4de40e69579da.js +0 -1
- package/.next/static/chunks/app/[connectionId]/[schema]/[table]/page-b08fade19a53bd13.js +0 -1
- package/.next/static/chunks/app/[connectionId]/diff/page-794180465d38394e.js +0 -10
- package/.next/static/chunks/app/[connectionId]/migrations/[setId]/page-31589bfe4aa9fc68.js +0 -1
- package/.next/static/chunks/app/[connectionId]/migrations/page-e99de6630bfec654.js +0 -1
- package/.next/static/chunks/app/[connectionId]/page-a245bfbd8b3eb8a7.js +0 -1
- package/.next/static/chunks/app/[connectionId]/query/page-3955d207f27aefa9.js +0 -1
- package/.next/static/chunks/app/_global-error/page-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/activity/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/adopt/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/cell/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/definition/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/delete-rows/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/health/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/insert-row/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/ledger/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/lookup/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/migrate/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/query/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/related/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/repo/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/rows/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/schema/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/tables/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/api/update-row/route-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/app/page-c487da327ada2a6d.js +0 -2
- package/.next/static/chunks/f97e080b-53d22dc5d0e78dfd.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-474f91618aaa4c39.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-474f91618aaa4c39.js +0 -1
- package/.next/static/css/962dd5ab002fed8a.css +0 -1
- /package/.next/static/{KSnyCCtuopUbqXHmuoiqW → Kl2VO8n1C_x2tm12ZIpwL}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7123],{7412:(e,t,n)=>{"use strict";n.d(t,{L:()=>s});var r=n(95155),a=n(13267),l=n(40980);function s({trailing:e,className:t,...n}){return(0,r.jsxs)("div",{className:(0,l.cn)("flex h-8 items-center gap-1.5 rounded-lg px-2 text-muted-foreground transition-colors focus-within:bg-muted/60 hover:bg-muted/60",t),children:[(0,r.jsx)(a.TfF,{className:"size-3.5 shrink-0"}),(0,r.jsx)("input",{type:"text",spellCheck:!1,autoComplete:"off",...n,className:"h-full min-w-0 flex-1 bg-transparent text-[0.8rem] text-foreground outline-none placeholder:text-muted-foreground"}),e]})}},12860:(e,t,n)=>{Promise.resolve().then(n.bind(n,37875))},15923:(e,t,n)=>{"use strict";n.d(t,{T:()=>a,r:()=>l});let r=new Set;function a(e){return r.add(e),()=>{r.delete(e)}}function l(){for(let e of r)e()}},19065:(e,t,n)=>{"use strict";function r(e,t){if(0===t)return!0;let n=e[t-1];return"_"===n||"-"===n||" "===n||"."===n}function a(e,t,n){return l(e,t,e=>[n(e)])}function l(e,t,n){if(!e.trim())return[];let a=[];for(let l of t){let t=n(l),s=null;for(let n of t){let t=function(e,t){let n=e.trim().toLocaleLowerCase(),a=t.toLocaleLowerCase();if(!n)return 0;if(0===a.length)return null;if(a===n)return 1e4;if(a.startsWith(n))return 5e3-a.length;let l=a.indexOf(n);if(-1!==l)return 2400+1200*!!r(t,l)-l-a.length;let s=0,o=0,i=0;for(let e=0;e<a.length&&s<n.length;e+=1){if(a[e]!==n[s]){i=0;continue}o+=12,(i+=1)>1&&(o+=18*i),r(t,e)&&(o+=40),s+=1}if(s<n.length)return null;let c=t.split(/[_\-\s.]+/).map(e=>e[0]??"").join("").toLocaleLowerCase();return c.startsWith(n)?o+=2200:c.includes(n)&&(o+=700),o-(a.length-n.length)}(e,n);null!==t&&(null===s||t>s)&&(s=t)}null!==s&&a.push({item:l,score:s})}return a.sort((e,t)=>t.score!==e.score?t.score-e.score:n(e.item)[0]?.localeCompare(n(t.item)[0]??"")??0)}n.d(t,{R6:()=>a,UO:()=>l})},23716:(e,t,n)=>{"use strict";n.d(t,{V:()=>o});var r=n(95155),a=n(13267),l=n(72264),s=n(40980);function o({schemas:e,selected:t,onChange:n,compact:i=!1}){let c=null===t||t.length===e.length,u=null===t||t.length===e.length?"All schemas":0===t.length?"No schemas":1===t.length?t[0]:`${t.length} of ${e.length} schemas`;return(0,r.jsxs)(l.rI,{children:[i?(0,r.jsxs)(l.ty,{"aria-label":`Schemas: ${u}`,title:u,className:(0,s.cn)("flex h-6 shrink-0 cursor-pointer items-center gap-1 rounded-md px-1 text-[11px] tabular-nums outline-none transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60 data-open:bg-foreground/10 data-open:text-foreground",c?"text-muted-foreground":"text-foreground"),children:[(0,r.jsx)(a.olY,{className:"size-3.5"}),!c&&(0,r.jsx)("span",{children:t.length})]}):(0,r.jsxs)(l.ty,{className:"group flex h-8 w-full cursor-pointer items-center gap-2 rounded-lg px-2 text-left text-[0.8rem] outline-none transition-colors hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring/60 data-open:bg-muted/60",children:[(0,r.jsx)(a.olY,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:u}),(0,r.jsx)(a.RQe,{className:"size-3.5 shrink-0 text-muted-foreground transition-transform group-data-open:rotate-180"})]}),(0,r.jsx)(l.SQ,{align:i?"end":"start",sideOffset:6,className:(0,s.cn)("max-h-80 min-w-52",!i&&"w-(--anchor-width)"),children:(0,r.jsxs)(l.I,{children:[(0,r.jsx)(l.hO,{checked:c,onCheckedChange:e=>n(e?null:[]),children:"All schemas"}),(0,r.jsx)(l.mB,{}),e.map(a=>(0,r.jsx)(l.hO,{checked:c||(t?.includes(a)??!1),onCheckedChange:r=>{let l,s;return l=t??e,void n((s=r?[...new Set([...l,a])]:l.filter(e=>e!==a)).length===e.length?null:s)},children:(0,r.jsx)("span",{className:"truncate",children:a})},a))]})})]})}},35942:(e,t,n)=>{"use strict";n.d(t,{F:()=>u});var r=n(95155);n(12115);var a=n(76166),l=n(90839),s=n(84588),o=n(66784),i=n(64084),c=n(40980);function u({className:e,children:t,...n}){return(0,r.jsxs)(a.V,{"data-slot":"scroll-area",className:(0,c.cn)("relative",e),...n,children:[(0,r.jsx)(l.B,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:t}),(0,r.jsx)(d,{}),(0,r.jsx)(s.I,{})]})}function d({className:e,orientation:t="vertical",...n}){return(0,r.jsx)(o.V,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:(0,c.cn)("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",e),...n,children:(0,r.jsx)(i.l,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}},37875:(e,t,n)=>{"use strict";n.d(t,{ExplorerShell:()=>ea});var r=n(95155),a=n(98500),l=n.n(a),s=n(13267),o=n(89239),i=n(95377),c=n(69586),u=n(74590),d=n(32538),m=n(36331),f=n(73321),h=n(12115),p=n(35942),x=n(7412),g=n(86846),b=n(43262),w=n(95848),v=n(40980),y=n(72264),j=n(72194),k=n(79781);function N({current:e}){let t=(0,c.Z)(e=>e.connections),n=(0,k.$C)();return(0,r.jsxs)(y.rI,{children:[(0,r.jsxs)(y.ty,{className:"flex h-8 w-full items-center justify-between gap-2 rounded-lg px-2 text-left font-medium outline-none hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50 data-open:bg-muted/60",children:[(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,r.jsx)(j.F,{connection:e}),(0,r.jsx)("span",{className:"truncate",children:e.name}),e.layoutGroup&&(0,r.jsx)(s.WnQ,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),(0,r.jsx)(s.klM,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),(0,r.jsxs)(y.SQ,{align:"start",className:"w-(--anchor-width)",children:[t.map(t=>(0,r.jsxs)(y._2,{onClick:()=>void n(t.id),className:t.id===e.id?"font-medium":void 0,children:[(0,r.jsx)(j.F,{connection:t}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t.name}),t.layoutGroup&&t.layoutGroup===e.layoutGroup&&(0,r.jsx)(s.WnQ,{className:"size-3.5 shrink-0 text-muted-foreground"})]},t.id)),(0,r.jsx)(y.mB,{}),(0,r.jsx)(y._2,{render:(0,r.jsx)(l(),{href:"/"}),children:"Manage connections"})]})]})}var C=n(23716);function S(e,t){let n=e.trim(),r=n.lastIndexOf(".");return -1===r?n:"schema"===t?n.slice(0,r):n.slice(r+1)}function T({text:e,query:t}){if(!t)return e;let n=[],a=e.toLocaleLowerCase(),l=t.toLocaleLowerCase(),s=0,o=a.indexOf(l);if(-1===o)return e;for(;-1!==o;)o>s&&n.push(e.slice(s,o)),n.push((0,r.jsx)("mark",{className:"rounded-[3px] bg-yellow-300/90 px-px text-yellow-950 dark:bg-yellow-400/85 dark:text-yellow-950",children:e.slice(o,o+t.length)},o)),s=o+t.length,o=a.indexOf(l,s);return s<e.length&&n.push(e.slice(s)),n}function E({connectionId:e,table:t,search:n,pinned:a,showSchema:o,active:i,reorderable:c,dragging:u,dropEdge:d,onTogglePin:m,onDragStart:f,onDragOver:h,onDrop:p,onDragEnd:x,onMove:g}){return(0,r.jsxs)("li",{onDragOver:h,onDrop:p,className:(0,v.cn)("group/table-row relative flex h-7 items-center rounded-md text-[13px] transition-[color,background-color,opacity] hover:bg-muted/60",i&&"bg-muted text-foreground",!i&&"text-foreground/80",u&&"opacity-45","before"===d&&"before:absolute before:inset-x-1 before:top-0 before:z-10 before:h-0.5 before:-translate-y-1/2 before:rounded-full before:bg-primary","after"===d&&"after:absolute after:inset-x-1 after:bottom-0 after:z-10 after:h-0.5 after:translate-y-1/2 after:rounded-full after:bg-primary"),children:[c&&(0,r.jsx)("button",{type:"button",draggable:!0,"aria-label":`Reorder ${t.schema}.${t.name}`,title:"Drag to reorder; use Up and Down arrow keys",onDragStart:f,onDragEnd:x,onKeyDown:e=>{("ArrowUp"===e.key||"ArrowDown"===e.key)&&(e.preventDefault(),g?.("ArrowUp"===e.key?-1:1))},className:"ml-1.5 flex size-5 shrink-0 cursor-grab touch-none items-center justify-center rounded text-muted-foreground opacity-50 outline-none transition-[color,background-color,opacity] hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:opacity-100 active:cursor-grabbing",children:(0,r.jsx)(s.Mvf,{className:"size-3.5"})}),(0,r.jsxs)(l(),{href:`/${e}/${encodeURIComponent(t.schema)}/${encodeURIComponent(t.name)}`,className:(0,v.cn)("flex h-full min-w-0 flex-1 items-center gap-1.5 rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring/60",c?"pl-1":"pl-6"),children:[(0,r.jsx)("span",{className:"truncate",children:(0,r.jsx)(T,{text:t.name,query:S(n,"table")})}),o?(0,r.jsx)("span",{className:"ml-auto max-w-20 truncate text-[10px] text-muted-foreground",children:t.schema}):"view"===t.kind&&(0,r.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"view"})]}),(0,r.jsx)("button",{type:"button","aria-label":`${a?"Unpin":"Pin"} ${t.schema}.${t.name}`,"aria-pressed":a,title:a?"Unpin table":"Pin table",onClick:()=>m(t),className:(0,v.cn)("mr-0.5 flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground opacity-0 outline-none transition-[color,background-color,opacity] hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:opacity-100 group-hover/table-row:opacity-100",a&&"text-foreground"),children:a?(0,r.jsx)(s.M0d,{className:"size-3.5"}):(0,r.jsx)(s.rq5,{className:"size-3.5"})})]})}function $({label:e,count:t,collapsed:n,pinned:a,search:l,onToggle:o}){return(0,r.jsxs)("button",{type:"button","aria-expanded":!n,onClick:o,className:"flex h-7 w-full cursor-pointer items-center gap-1 rounded-md px-1 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60",children:[(0,r.jsx)(s.nNJ,{className:(0,v.cn)("size-3.5 transition-transform",!n&&"rotate-90")}),a&&(0,r.jsx)(s.M0d,{className:"mr-0.5 size-3"}),(0,r.jsx)("span",{className:"truncate",children:a?e:(0,r.jsx)(T,{text:e,query:S(l,"schema")})}),(0,r.jsx)("span",{className:"ml-auto pr-1 tabular-nums opacity-60",children:t})]})}function L({connectionId:e,tables:t,search:n,collapsedSchemas:a,pinnedTables:l,onToggleSchema:s,onTogglePin:o,onReorderPinned:i}){let c=(0,f.useParams)(),[u,d]=(0,h.useState)(!1),[m,p]=(0,h.useState)(null),[x,g]=(0,h.useState)(null),b=new Map(t.map(e=>[(0,w.i)(e),e])),v=l.flatMap(e=>{let t=b.get(e);return t?[t]:[]});function y(){p(null),g(null)}return 0===t.length?(0,r.jsx)("p",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:n.trim()?"No tables match your search":"No tables in these schemas"}):(0,r.jsxs)("div",{className:"flex flex-col gap-1 px-2 pb-4",children:[v.length>0&&(0,r.jsxs)("div",{className:"mb-1 border-b border-border/60 pb-1",children:[(0,r.jsx)($,{label:"Pinned tables",count:v.length,collapsed:u,pinned:!0,search:n,onToggle:()=>d(e=>!e)}),!u&&(0,r.jsx)("ul",{children:v.map(t=>{let a=(0,w.i)(t);return(0,r.jsx)(E,{connectionId:e,table:t,search:n,pinned:!0,showSchema:!0,active:c.schema===t.schema&&c.table===t.name,reorderable:!0,dragging:m===a,dropEdge:x?.key===a?x.edge:null,onTogglePin:o,onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",a),p(a),g(null)},onDragOver:e=>(function(e,t){if(!m||m===t)return;e.preventDefault(),e.dataTransfer.dropEffect="move";let n=e.currentTarget.getBoundingClientRect(),r=e.clientY<n.top+n.height/2?"before":"after";g(e=>e?.key===t&&e.edge===r?e:{key:t,edge:r})})(e,a),onDrop:e=>{let t,n;return e.preventDefault(),t=m??e.dataTransfer.getData("text/plain"),n=x?.key===a?x.edge:"before",void(t&&i(t,a,n),y())},onDragEnd:y,onMove:e=>{let t,n;return t=v.findIndex(e=>(0,w.i)(e)===a),void((n=v[t+e])&&i(a,(0,w.i)(n),-1===e?"before":"after"))}},a)})})]}),(function(e){let t=new Map;for(let n of e)t.set(n.schema,[...t.get(n.schema)??[],n]);return[...t.entries()].sort(([e],[t])=>{let n;return((n=new Map([["public",0],["auth",1]])).get(e)??2)-(n.get(t)??2)||e.localeCompare(t)})})(t).map(([t,i])=>{let u=a.includes(t);return(0,r.jsxs)("div",{children:[(0,r.jsx)($,{label:t,count:i.length,collapsed:u,search:n,onToggle:()=>s(t)}),!u&&(0,r.jsx)("ul",{children:i.map(t=>(0,r.jsx)(E,{connectionId:e,table:t,search:n,pinned:l.includes((0,w.i)(t)),active:c.schema===t.schema&&c.table===t.name,onTogglePin:o},(0,w.i)(t)))})]},t)})]})}function z(e){return Math.min(480,Math.max(180,Math.round(e)))}function D(e,t){let n=new Map([["public",0],["auth",1]]);return(n.get(e)??2)-(n.get(t)??2)||e.localeCompare(t)}function R(e,t,n){let r=t.trim().toLocaleLowerCase();return e.filter(e=>(null===n||!!n.includes(e.schema))&&(!r||e.name.toLocaleLowerCase().includes(r)||`${e.schema}.${e.name}`.toLocaleLowerCase().includes(r)))}function I({href:e,active:t,shortcut:n,children:a}){return(0,r.jsxs)(l(),{href:e,"aria-current":t?"page":void 0,className:(0,v.cn)((0,o.r)({variant:t?"secondary":"ghost",size:"sm"}),"h-8 w-full justify-start px-2"),children:[a,(0,r.jsx)("kbd",{className:"ml-auto font-mono text-[10px] text-muted-foreground/55",children:n})]})}function A({width:e,onWidthChange:t,onCollapse:n}){let a=(0,f.usePathname)(),{connection:l,tables:i}=(0,m.k)(),[d,v]=(0,u.DE)(l.id),y=(0,c.Z)(e=>e.connections.length>1),[j,k]=(0,h.useState)(()=>z(e)),S=(0,h.useRef)(null),T=(0,h.useMemo)(()=>[...new Set((i.data??[]).map(e=>e.schema))].sort(D),[i.data]),E=(0,h.useMemo)(()=>null===d.selectedSchemas?null:d.selectedSchemas.filter(e=>T.includes(e)),[d.selectedSchemas,T]),$=(0,h.useMemo)(()=>R(i.data??[],d.search,E),[i.data,d.search,E]),M=`/${encodeURIComponent(l.id)}`,U=`${M}/query`,P=`${M}/diff`,F=`${M}/migrations`;function q(e,t){let n=new Set(R(i.data??[],e,t).map(e=>e.schema));return d.collapsedSchemas.filter(e=>!n.has(e))}return(0,r.jsxs)("aside",{id:"database-explorer-sidebar",style:{width:j},className:"relative flex h-full shrink-0 flex-col border-r bg-sidebar",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-0.5 border-b border-sidebar-border/60 p-2",children:[(0,r.jsxs)("div",{className:"mb-1 flex items-center gap-1",children:[(0,r.jsx)("div",{className:"min-w-0 flex-1",children:(0,r.jsx)(N,{current:l})}),(0,r.jsx)(o.$,{variant:"ghost",size:"icon-sm","aria-label":"Collapse database sidebar",title:"Collapse sidebar",onClick:n,children:(0,r.jsx)(s.cFu,{})})]}),(0,r.jsxs)(I,{href:U,active:a===U,shortcut:b.Ar.sqlEditor,children:[(0,r.jsx)(s.Uoo,{"data-icon":"inline-start"}),"SQL query"]}),(0,r.jsxs)(I,{href:F,active:a===F||a.startsWith(`${F}/`),shortcut:b.Ar.migrations,children:[(0,r.jsx)(s.olY,{"data-icon":"inline-start"}),"Migrations"]}),y&&(0,r.jsxs)(I,{href:P,active:a===P,shortcut:b.Ar.compareSchema,children:[(0,r.jsx)(s.R4X,{"data-icon":"inline-start"}),"Compare schema"]}),(0,r.jsx)(x.L,{value:d.search,onChange:e=>{var t;v({search:t=e.target.value,collapsedSchemas:t.trim()?q(t,E):d.collapsedSchemas})},placeholder:"Search tables","aria-label":"Search tables",className:"mt-1",trailing:(0,r.jsxs)(r.Fragment,{children:[!d.search&&(0,r.jsx)("kbd",{className:"font-mono text-[10px] text-muted-foreground/55",children:b.Ar.tableSearch}),(0,r.jsx)(C.V,{compact:!0,schemas:T,selected:E,onChange:function(e){v({selectedSchemas:e,collapsedSchemas:d.search.trim()?q(d.search,e):d.collapsedSchemas})}})]})})]}),(0,r.jsx)(p.F,{className:"min-h-0 flex-1 pt-1.5",children:i.error?(0,r.jsx)("p",{className:"px-3 py-4 text-xs text-destructive",children:i.error}):i.data?(0,r.jsx)(L,{connectionId:l.id,tables:$,search:d.search,collapsedSchemas:d.collapsedSchemas,pinnedTables:d.pinnedTables,onToggleSchema:function(e){v({collapsedSchemas:d.collapsedSchemas.includes(e)?d.collapsedSchemas.filter(t=>t!==e):[...d.collapsedSchemas,e]})},onTogglePin:function(e){let t=(0,w.i)(e);v({pinnedTables:d.pinnedTables.includes(t)?d.pinnedTables.filter(e=>e!==t):[...d.pinnedTables,t]})},onReorderPinned:function(e,t,n){if(e===t)return;let r=d.pinnedTables.filter(t=>t!==e),a=r.indexOf(t);-1!==a&&(r.splice(a+ +("after"===n),0,e),v({pinnedTables:r}))}}):(0,r.jsx)("div",{className:"flex flex-col gap-2 px-3 py-2",children:Array.from({length:8},(e,t)=>(0,r.jsx)(g.E,{className:"h-5 w-full"},t))})}),(0,r.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize database sidebar","aria-valuemin":180,"aria-valuemax":480,"aria-valuenow":j,tabIndex:0,title:"Drag to resize; double-click to reset",onPointerDown:function(e){e.preventDefault(),S.current={pointerId:e.pointerId,startX:e.clientX,startWidth:j},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:function(e){let t=S.current;t&&t.pointerId===e.pointerId&&(e.preventDefault(),k(z(t.startWidth+e.clientX-t.startX)))},onPointerUp:function(e){let n=S.current;if(!n||n.pointerId!==e.pointerId)return;let r=z(n.startWidth+e.clientX-n.startX);S.current=null,k(r),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),t(r)},onPointerCancel:function(e){let n=S.current;n&&n.pointerId===e.pointerId&&(S.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),t(j))},onKeyDown:function(e){if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();let n=z(j+("ArrowLeft"===e.key?-1:1)*16);k(n),t(n)},onDoubleClick:function(e){e.preventDefault(),k(256),t(256)},className:"group/resize absolute inset-y-0 -right-1 z-30 w-2 cursor-col-resize touch-none outline-none after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-transparent after:transition-colors hover:after:bg-primary focus-visible:after:bg-primary"})]})}var M=n(67385),U=n(88406),P=n(86989),F=n(15923),q=n(19065);function O(e,{nested:t=!1}={}){let n=(0,f.useRouter)(),r=(0,f.usePathname)(),{connection:a,tables:l}=(0,m.k)(),[s]=(0,u.DE)(a.id),o=`/${encodeURIComponent(a.id)}`,i=`${o}/${e}`,c=t?r===i||r.startsWith(`${i}/`):r===i;return{open:c,href:i,toggle:()=>n.push(c?function(){for(let e of s.recentTables){let t=(l.data??[]).find(t=>(0,w.i)(t)===e);if(t)return`${o}/${encodeURIComponent(t.schema)}/${encodeURIComponent(t.name)}`}return o}():i)}}function G(){let e=O("migrations",{nested:!0});return{open:e.open,migrationsHref:e.href,toggle:e.toggle}}var K=n(48861);function Z(){let e=O("diff");return{open:e.open,diffHref:e.href,toggle:e.toggle}}function W(){let e=O("query");return{open:e.open,queryHref:e.href,toggle:e.toggle}}function B({text:e,query:t}){if(!t)return e;let n=e.toLocaleLowerCase(),a=t.toLocaleLowerCase(),l=n.indexOf(a);return -1===l?e:(0,r.jsxs)(r.Fragment,{children:[e.slice(0,l),(0,r.jsx)("mark",{className:"rounded-[3px] bg-yellow-300/90 px-px text-yellow-950 dark:bg-yellow-400/85 dark:text-yellow-950",children:e.slice(l,l+t.length)}),e.slice(l+t.length)]})}async function Q(e){try{await navigator.clipboard.writeText(e)}catch{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),t.remove()}}function _(){let e=(0,f.useRouter)(),t=(0,f.useParams)(),{connection:n,tables:a}=(0,m.k)(),l=W(),o=Z(),i=G(),d=(0,u.y3)(n.id),p=(0,k.yG)(),x=(0,K.Q)(n.id),g=(0,c.Z)(e=>e.add),[y,j]=(0,u.DE)(n.id),[N,C]=(0,h.useState)(!1),[S,T]=(0,h.useState)("commands"),[E,$]=(0,h.useState)(""),[L,z]=(0,h.useState)(0),[D,R]=(0,h.useState)(!1),I=(0,h.useRef)(null),A=(0,h.useRef)(null),O=(0,h.useRef)(null),_=(0,h.useRef)(S),X=(0,U.C)(e=>e.theme),V=t.schema&&t.table?{schema:decodeURIComponent(t.schema),name:decodeURIComponent(t.table)}:null,H=!!V&&y.pinnedTables.includes((0,w.i)(V)),Y=(0,u.lz)(e=>V?e.tables[`${n.id}:${(0,w.i)(V)}`]:void 0),J=(0,h.useMemo)(()=>[{id:"sql-editor",title:l.open?"Back to Table":"Open SQL Query",keywords:["new","query","sql","console","editor","close","back","table"],enabled:!0,shortcut:b.Ar.sqlEditor,run:()=>l.toggle()},{id:"go-back",title:x.back?`Back to ${x.back.label}`:"Back",keywords:["back","previous","return","history","undo"],enabled:null!==x.back,shortcut:b.Ar.back,run:()=>x.goBack()},{id:"go-forward",title:x.forward?`Forward to ${x.forward.label}`:"Forward",keywords:["forward","next","history","redo"],enabled:null!==x.forward,shortcut:b.Ar.forward,run:()=>x.goForward()},{id:"switch-connection",title:p.next?`Switch Connection (${p.next.name})`:"Switch Connection",keywords:["database","env","environment","next","cycle","other"],enabled:p.enabled,shortcut:b.Ar.switchConnection,run:()=>void p.run()},{id:"migrations",title:i.open?"Back to Table":"Open Migrations",keywords:["migration","migrate","apply","revert","rollback","ledger","schema","run"],enabled:!0,shortcut:b.Ar.migrations,run:()=>i.toggle()},{id:"compare-schema",title:d.target?`Compare Schema with ${d.target.name}`:"Compare Schema",keywords:["diff","difference","migration","drift","prod","dev","schema","compare"],enabled:null!==d.target,shortcut:b.Ar.compareSchema,run:()=>o.toggle()},{id:"search-tables",title:"Search Tables",keywords:["find","jump","open","goto","table"],enabled:!0,shortcut:b.Ar.tableSearch,run:()=>window.requestAnimationFrame(()=>(0,b.tT)())},{id:"search-columns",title:"Search Columns",keywords:["find","jump","goto","column","field"],enabled:null!==V,shortcut:b.Ar.columnSearch,run:()=>window.requestAnimationFrame(()=>(0,b.vI)())},{id:"reload-tables",title:"Reload Tables",keywords:["refresh","reload","tables","sync"],enabled:!0,run:()=>a.reload()},{id:"pin-table",title:H?"Unpin Table":"Pin Table",keywords:["pin","unpin","favorite","star"],enabled:null!==V,run:()=>{if(!V)return;let e=(0,w.i)(V);j({pinnedTables:y.pinnedTables.includes(e)?y.pinnedTables.filter(t=>t!==e):[...y.pinnedTables,e]})}},{id:"clear-filters",title:"Clear Filters",keywords:["filter","reset","remove"],enabled:null!==V,run:()=>{V&&u.lz.getState().setTable(n.id,V,{filters:[],page:0})}},{id:"clear-search",title:"Clear Search",keywords:["find","search","reset"],enabled:null!==V&&!!Y?.search,run:()=>{V&&u.lz.getState().setTable(n.id,V,{search:"",page:0})}},{id:"reset-columns",title:"Reset Columns",keywords:["pin","hide","frozen","layout","show"],enabled:null!==V,run:()=>{V&&u.lz.getState().setTable(n.id,V,{pinnedColumns:void 0,hiddenColumns:[]})}},{id:"copy-table",title:"Copy Schema.Table",keywords:["copy","name","qualified"],enabled:null!==V,run:()=>{V&&Q((0,w.i)(V))}},{id:"color-theme",title:"Color Theme",keywords:["theme","appearance","dark","light","color","set","preferences"],enabled:!0,keepOpen:!0,run:()=>{let e=U.C.getState().theme,t=P.zG.findIndex(t=>t.id===e);T("themes"),$(""),z(-1===t?0:t)}},{id:"add-connection",title:"Add Connection",keywords:["new","database","postgres"],enabled:!0,run:()=>R(!0)}],[y.pinnedTables,d.target,n.id,x,i,H,o,j,l,p,V,Y?.search,a]),ee=(0,h.useMemo)(()=>E.trim()?(0,q.R6)(E,J,e=>[e.title,...e.keywords].join(" ")).map(e=>e.item):J,[J,E]),et=(0,h.useMemo)(()=>E.trim()?(0,q.R6)(E,[...P.zG],e=>[e.name,...e.keywords].join(" ")).map(e=>e.item):[...P.zG],[E]),en="themes"===S?et:ee,er="commands"===S?ee[L]??null:null,ea="themes"===S?et[L]??null:null;function el(e){e?.revertTheme&&"themes"===_.current&&(0,P.AZ)(U.C.getState().theme),C(!1),$(""),z(0),T("commands")}function es(){el({revertTheme:!0})}function eo(){"themes"===_.current&&(0,P.AZ)(U.C.getState().theme),T("commands"),$(""),z(0)}function ei(e){e.enabled&&(e.keepOpen||es(),e.run())}function ec(e){U.C.getState().setTheme(e.id),(0,P.AZ)(e.id),el({revertTheme:!1})}return(0,h.useEffect)(()=>{_.current=S},[S]),(0,h.useEffect)(()=>{if("themes"===S&&!E.trim()){let e=P.zG.findIndex(e=>e.id===U.C.getState().theme);z(-1===e?0:e);return}z(0)},[E,N,S]),(0,h.useEffect)(()=>{let e=O.current?.querySelector("[data-active=true]");e?.scrollIntoView({block:"nearest"})},[L,en]),(0,h.useEffect)(()=>{if(!N)return;let e=window.requestAnimationFrame(()=>I.current?.focus());return()=>window.cancelAnimationFrame(e)},[N,S]),(0,h.useEffect)(()=>{if(!N||"themes"!==S)return;let e=et[L];e&&(0,P.AZ)(e.id)},[N,S,L,et]),(0,h.useEffect)(()=>(0,F.T)(es),[]),(0,h.useEffect)(()=>{function e(e){if((e.metaKey||e.ctrlKey)&&e.shiftKey&&"p"===e.key.toLowerCase()){if(e.preventDefault(),N){"themes"===_.current&&eo(),I.current?.select();return}(0,F.r)(),$(""),z(0),T("commands"),C(!0);return}if(N&&"Escape"===e.key){if(e.preventDefault(),"themes"===_.current)return void eo();es()}}function t(e){!N||A.current?.contains(e.target)||es()}return window.addEventListener("keydown",e,!0),window.addEventListener("pointerdown",t),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("pointerdown",t)}},[N]),(0,r.jsxs)(r.Fragment,{children:[N&&(0,r.jsxs)("div",{ref:A,"data-command-palette":"",className:"fixed top-3 left-1/2 z-50 flex w-[min(36rem,calc(100%-1.5rem))] -translate-x-1/2 flex-col overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-lg ring-1 ring-foreground/10",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 border-b px-3",children:[(0,r.jsx)("span",{className:"font-mono text-sm text-muted-foreground",children:">"}),(0,r.jsx)("input",{ref:I,value:E,onChange:e=>$(e.target.value),onKeyDown:function(e){if("ArrowDown"===e.key){if(e.preventDefault(),0===en.length)return;z(e=>(e+1)%en.length);return}if("ArrowUp"===e.key){if(e.preventDefault(),0===en.length)return;z(e=>(e-1+en.length)%en.length);return}if("Enter"===e.key){if(e.preventDefault(),"themes"===S){ea&&ec(ea);return}er&&ei(er)}},spellCheck:!1,autoComplete:"off",autoCorrect:"off",placeholder:"themes"===S?"Select color theme":"Type a command","aria-label":"themes"===S?"Color theme":"Command palette",className:"h-11 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),(0,r.jsx)("div",{ref:O,role:"listbox","aria-label":"themes"===S?"Color themes":"Commands",className:"max-h-[min(24rem,50vh)] overflow-auto py-1",children:0===en.length?(0,r.jsx)("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"themes"===S?"No matching themes":"No matching commands"}):"themes"===S?et.map((e,t)=>{let n=t===L,a=e.id===X;return(0,r.jsxs)("button",{type:"button",role:"option","aria-selected":n,"data-active":n||void 0,onMouseEnter:()=>z(t),onClick:()=>ec(e),className:(0,v.cn)("flex h-8 w-full cursor-pointer items-center gap-2 px-3 text-left text-[13px] outline-none",n&&"bg-primary/10"),children:[(0,r.jsx)("span",{"aria-hidden":!0,className:"size-3.5 shrink-0 rounded-sm border",style:{background:e.swatch}}),(0,r.jsx)("span",{className:"min-w-0 truncate",children:(0,r.jsx)(B,{text:e.name,query:E.trim()})}),a&&(0,r.jsx)(s.wiW,{className:"ml-auto size-3.5 shrink-0 text-muted-foreground"})]},e.id)}):ee.map((e,t)=>{let n=t===L;return(0,r.jsxs)("button",{type:"button",role:"option","aria-selected":n,"aria-disabled":!e.enabled,"data-active":n||void 0,onMouseEnter:()=>z(t),onClick:()=>ei(e),className:(0,v.cn)("flex h-8 w-full cursor-pointer items-center px-3 text-left text-[13px] outline-none",n&&"bg-primary/10",!e.enabled&&"cursor-default opacity-40"),children:[(0,r.jsx)("span",{className:"min-w-0 truncate",children:(0,r.jsx)(B,{text:e.title,query:E.trim()})}),e.shortcut&&(0,r.jsx)("kbd",{className:"ml-auto shrink-0 pl-3 font-mono text-[11px] text-muted-foreground/70",children:e.shortcut})]},e.id)})})]}),(0,r.jsx)(M.f,{open:D,onOpenChange:R,onSubmit:t=>{let{shareWith:n,...r}=t,a=g(r);(0,u.mQ)(a.id,n),e.push(`/${a.id}`)}})]})}function X(){let{toggle:e}=W(),{toggle:t}=Z(),{toggle:n}=G(),{run:r}=(0,k.yG)(),a=(0,K.Q)(),l=(0,c.Z)(e=>e.connections.length>1),s=(0,h.useRef)(e),o=(0,h.useRef)(t),i=(0,h.useRef)(n),u=(0,h.useRef)(r),d=(0,h.useRef)(a),m=(0,h.useRef)(l);return(0,h.useEffect)(()=>{s.current=e},[e]),(0,h.useEffect)(()=>{o.current=t},[t]),(0,h.useEffect)(()=>{i.current=n},[n]),(0,h.useEffect)(()=>{u.current=r},[r]),(0,h.useEffect)(()=>{m.current=l},[l]),(0,h.useEffect)(()=>{d.current=a},[a]),(0,h.useEffect)(()=>{function e(e){if(!(e.metaKey||e.ctrlKey)||e.altKey||e.repeat)return;let t=e.key.toLowerCase();if("["===t||"]"===t){if(e.shiftKey||function(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;let t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t}(e.target))return;e.preventDefault(),(0,F.r)(),"["===t?d.current.goBack():d.current.goForward();return}if("m"===t&&e.shiftKey){e.preventDefault(),(0,F.r)(),i.current();return}if("d"===t&&e.shiftKey){if(!m.current)return;e.preventDefault(),(0,F.r)(),o.current();return}if("e"===t){if(e.preventDefault(),(0,F.r)(),e.shiftKey)return void u.current();s.current()}}return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[]),null}var V=n(27529);let H={pinned:"Pinned",recent:"Recent",tables:"Tables",connections:"Connections"};function Y({text:e,query:t}){if(!t)return e;let n=e.toLocaleLowerCase(),a=t.toLocaleLowerCase(),l=n.indexOf(a);return -1===l?e:(0,r.jsxs)(r.Fragment,{children:[e.slice(0,l),(0,r.jsx)("mark",{className:"rounded-[3px] bg-yellow-300/90 px-px text-yellow-950 dark:bg-yellow-400/85 dark:text-yellow-950",children:e.slice(l,l+t.length)}),e.slice(l+t.length)]})}function J(e){try{return new URL(e).hostname}catch{return""}}function ee(e){return[e.name,J(e.url)].filter(Boolean)}function et(e,t){let n=new Map([["public",0],["auth",1]]);return(n.get(e.schema)??2)-(n.get(t.schema)??2)||e.schema.localeCompare(t.schema)||e.name.localeCompare(t.name)}function en(e,t){return e.map((e,n)=>0===n?{...e,section:t}:e)}function er(){let e=(0,f.useRouter)(),t=(0,k.$C)(),n=(0,f.useParams)(),{connection:a,tables:l}=(0,m.k)(),o=(0,c.Z)(e=>e.connections),[i,d]=(0,h.useState)(!1),[p,x]=(0,h.useState)(""),[g,y]=(0,h.useState)(0),[N,C]=(0,h.useState)(null),S=(0,h.useRef)(null),T=(0,h.useRef)(null),E=(0,h.useRef)(null),$=o.find(e=>e.id===N)??null,L=$??a,z=$&&$.id!==a.id?$.url:null,D=function(e){let[t]=(0,h.useState)(()=>new Map),[n,r]=(0,h.useState)({url:"",error:null});if((0,h.useEffect)(()=>{if(!e)return;let n=new AbortController;return V.F.tables(e,n.signal).then(n=>{t.set(e,n),r({url:e,data:n,error:null})}).catch(a=>{if(n.signal.aborted)return;let l=a instanceof Error?a.message:String(a);r(n=>({url:e,data:n.url===e?n.data:t.get(e),error:l}))}),()=>n.abort()},[t,e]),!e)return{data:void 0,error:null,loading:!1};let a=n.url===e?n.data:t.get(e);return{data:a,error:n.url===e?n.error:null,loading:void 0===a}}(z),[R,I]=(0,u.DE)(a.id),[A,M]=(0,u.DE)(L.id),U=L.id===a.id?R:A,P=(0,h.useMemo)(()=>z?D.data??[]:l.data??[],[D.data,z,l.data]),O=z?D.loading:l.loading,G=z?D.error:null,K=(0,h.useMemo)(()=>[...new Set(P.map(e=>e.schema))],[P]),Z=null===U.selectedSchemas?null:U.selectedSchemas.filter(e=>K.includes(e)),W=(0,h.useMemo)(()=>null===Z?P:P.filter(e=>Z.includes(e.schema)),[P,Z]),B=U.pinnedTables,Q=U.recentTables,_=(0,h.useMemo)(()=>{let e,t;return -1===(t=(e=p.trim()).indexOf(":"))?{schema:null,table:e}:{schema:e.slice(0,t).trim(),table:e.slice(t+1).trim()}},[p]),X=_.table||(_.schema?"":p.trim()),er=(0,h.useMemo)(()=>{let e=new Set(B),t=new Set(Q),n=null===_.schema?null:function(e,t){if(!e)return t;let n=e.toLocaleLowerCase(),r=t.filter(e=>e.toLocaleLowerCase()===n);if(r.length>0)return r;let a=t.filter(e=>e.toLocaleLowerCase().startsWith(n));return a.length>0?a:(0,q.R6)(e,t,e=>e).map(e=>e.item)}(_.schema,K),r=null===n?W:P.filter(e=>n.includes(e.schema)),l=new Map(r.map(e=>[(0,w.i)(e),e])),s=B.flatMap(e=>{let t=l.get(e);return t?[t]:[]}),i=Q.flatMap(t=>{let n=l.get(t);return!n||e.has(t)?[]:[n]}),c=(e,t)=>({type:"table",key:`table:${(0,w.i)(e)}`,table:e,...t}),u=e=>({type:"connection",key:`connection:${e.id}`,connection:e,current:e.id===a.id}),d=null===_.schema?p.trim():_.table,m=null===$&&null===_.schema;if(!d){let e=new Set([...s.map(e=>(0,w.i)(e)),...i.map(e=>(0,w.i)(e))]),n=r.filter(t=>!e.has((0,w.i)(t))).sort(et),l=m?o.filter(e=>e.id!==a.id):[];return[...en(s.map(e=>c(e,{pinned:!0})),"pinned"),...en(i.map(e=>c(e,{pinned:!1,recent:!0})),"recent"),...en(n.map(e=>c(e,{pinned:!1,recent:t.has((0,w.i)(e))})),"tables"),...en(l.map(u),"connections")]}let f=(0,q.UO)(d,r,e=>null===_.schema?[e.name,`${e.schema}.${e.name}`,e.schema]:[e.name]).map(n=>({...n,score:n.score+80*!!e.has((0,w.i)(n.item))+40*!!t.has((0,w.i)(n.item))})).sort((e,t)=>t.score-e.score).map(n=>c(n.item,{pinned:e.has((0,w.i)(n.item)),recent:t.has((0,w.i)(n.item))}));return[...en(m?(0,q.UO)(p,o,ee).map(e=>u(e.item)):[],"connections"),...en(f,"tables")]},[P,a.id,o,$,_.schema,_.table,B,p,Q,K,W]),ea=er[g]??null;function el(){d(!1),x(""),y(0),C(null)}function es(){C(null),y(0),S.current?.focus()}function eo(n){var r,a;(el(),"connection"===n.type)?t(n.connection.id):e.push((r=L.id,a=n.table,`/${r}/${encodeURIComponent(a.schema)}/${encodeURIComponent(a.name)}`))}function ei(e){let t=(0,w.i)(e),n=U.pinnedTables.includes(t)?U.pinnedTables.filter(e=>e!==t):[...U.pinnedTables,t];(L.id===a.id?I:M)({pinnedTables:n})}(0,h.useEffect)(()=>{y(0)},[p,i,N]),(0,h.useEffect)(()=>{let e=E.current?.querySelector("[data-active=true]");e?.scrollIntoView({block:"nearest"})},[g,er]),(0,h.useEffect)(()=>{if(!i)return;let e=window.requestAnimationFrame(()=>S.current?.focus());return()=>window.cancelAnimationFrame(e)},[i]),(0,h.useEffect)(()=>{if(!n.schema||!n.table)return;let e=`${decodeURIComponent(n.schema)}.${decodeURIComponent(n.table)}`,t=u.lz.getState().browse[a.id]?.recentTables??[];t[0]!==e&&I({recentTables:[e,...t.filter(t=>t!==e)].slice(0,12)})},[a.id,n.schema,n.table,I]),(0,h.useEffect)(()=>{function e(){i?S.current?.select():((0,F.r)(),x(""),y(0),C(null),d(!0))}function t(t){if((t.metaKey||t.ctrlKey)&&"p"===t.key.toLowerCase()){if(t.shiftKey)return;t.preventDefault(),e();return}i&&"Escape"===t.key&&(t.preventDefault(),el())}function n(e){!i||T.current?.contains(e.target)||el()}window.addEventListener("keydown",t,!0),window.addEventListener("pointerdown",n);let r=(0,b.s5)(e);return()=>{window.removeEventListener("keydown",t,!0),window.removeEventListener("pointerdown",n),r()}},[i]),(0,h.useEffect)(()=>(0,F.T)(el),[]);let ec=L.id===a.id&&n.schema&&n.table?`${decodeURIComponent(n.schema)}.${decodeURIComponent(n.table)}`:null;return i?(0,r.jsxs)("div",{ref:T,"data-table-palette":"",className:"fixed top-3 left-1/2 z-50 flex w-[min(36rem,calc(100%-1.5rem))] -translate-x-1/2 flex-col overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-lg ring-1 ring-foreground/10",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 border-b px-3",children:[(0,r.jsx)(s.TfF,{className:"size-4 shrink-0 text-muted-foreground"}),$&&(0,r.jsxs)("button",{type:"button",onClick:es,"aria-label":`Stop searching ${$.name}`,className:"flex h-6 max-w-40 shrink-0 items-center gap-1.5 rounded-md bg-muted px-1.5 text-xs outline-none hover:bg-muted/80",children:[(0,r.jsx)(j.F,{connection:$,className:"size-2"}),(0,r.jsx)("span",{className:"truncate",children:$.name})]}),(0,r.jsx)("input",{ref:S,value:p,onChange:e=>x(e.target.value),onKeyDown:function(e){if("ArrowDown"===e.key){if(e.preventDefault(),0===er.length)return;y(e=>(e+1)%er.length);return}if("ArrowUp"===e.key){if(e.preventDefault(),0===er.length)return;y(e=>(e-1+er.length)%er.length);return}if("Tab"===e.key){if(e.preventDefault(),$||e.shiftKey)return;ea?.type==="connection"&&(C(ea.connection.id),x(""),y(0));return}if("Backspace"===e.key&&""===p&&$){e.preventDefault(),es();return}"Enter"===e.key&&(e.preventDefault(),e.shiftKey&&ea?.type==="table"?ei(ea.table):ea&&eo(ea))},spellCheck:!1,autoComplete:"off",autoCorrect:"off",placeholder:$?`Search tables in ${$.name}`:"Go to table (schema:name)","aria-label":$?`Go to table in ${$.name}`:"Go to table or connection",className:"h-11 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),(0,r.jsx)("div",{ref:E,role:"listbox","aria-label":$?`Tables in ${$.name}`:"Tables and connections",className:"max-h-[min(24rem,50vh)] overflow-auto py-1",children:O&&0===P.length&&0===er.length?(0,r.jsx)("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"Loading tables…"}):G&&0===P.length?(0,r.jsx)("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:G}):0===er.length?(0,r.jsx)("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p.trim()?"No matches":"No tables"}):er.map((e,t)=>{let n=t===g;if("connection"===e.type){let a=J(e.connection.url);return(0,r.jsxs)("div",{children:[e.section&&(0,r.jsx)("p",{className:"px-3 pt-2 pb-1 text-[10px] font-medium tracking-wide text-muted-foreground uppercase",children:H[e.section]}),(0,r.jsxs)("button",{type:"button",role:"option","aria-selected":n,"data-active":n||void 0,onMouseEnter:()=>y(t),onClick:()=>eo(e),className:(0,v.cn)("flex h-8 w-full cursor-pointer items-center gap-2 px-3 text-left text-[13px] outline-none",n&&"bg-primary/10"),children:[(0,r.jsx)(s.bkQ,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,r.jsx)(j.F,{connection:e.connection,className:"size-2"}),(0,r.jsx)("span",{className:(0,v.cn)("min-w-0 truncate",e.current&&"font-medium"),children:(0,r.jsx)(Y,{text:e.connection.name,query:X})}),(0,r.jsx)("span",{className:"ml-auto flex min-w-0 shrink-0 items-center gap-2 text-[11px] text-muted-foreground",children:n?(0,r.jsx)("span",{children:"Tab to search"}):(0,r.jsx)("span",{className:"max-w-36 truncate",children:e.current?"current":a||"connection"})})]})]},e.key)}let a=(0,w.i)(e.table)===ec;return(0,r.jsxs)("div",{children:[e.section&&(0,r.jsx)("p",{className:"px-3 pt-2 pb-1 text-[10px] font-medium tracking-wide text-muted-foreground uppercase",children:H[e.section]}),(0,r.jsxs)("div",{onMouseEnter:()=>y(t),className:(0,v.cn)("group/table-result flex items-center",n&&"bg-primary/10"),children:[(0,r.jsxs)("button",{type:"button",role:"option","aria-selected":n,"data-active":n||void 0,onClick:()=>eo(e),className:"flex h-8 min-w-0 flex-1 cursor-pointer items-center gap-2 pl-3 text-left text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/60",children:[e.recent&&!e.pinned?(0,r.jsx)(s.A01,{className:"size-3.5 shrink-0 text-muted-foreground"}):(0,r.jsx)(s.ooN,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,r.jsx)("span",{className:(0,v.cn)("min-w-0 truncate",a&&"font-medium"),children:(0,r.jsx)(Y,{text:e.table.name,query:X})}),(0,r.jsxs)("span",{className:"ml-auto flex min-w-0 shrink-0 items-center gap-2 text-[11px] text-muted-foreground",children:["view"===e.table.kind&&(0,r.jsx)("span",{children:"view"}),(0,r.jsx)("span",{className:"max-w-36 truncate",children:e.table.schema})]})]}),(0,r.jsx)("button",{type:"button","aria-label":`${e.pinned?"Unpin":"Pin"} ${(0,w.i)(e.table)}`,"aria-pressed":e.pinned,title:e.pinned?"Unpin table":"Pin table",onClick:()=>ei(e.table),className:(0,v.cn)("mr-2 flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground opacity-0 outline-none transition-[color,background-color,opacity] hover:bg-foreground/10 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:opacity-100 group-hover/table-result:opacity-100",(e.pinned||n)&&"opacity-100",e.pinned&&"text-foreground"),children:e.pinned?(0,r.jsx)(s.M0d,{className:"size-3.5"}):(0,r.jsx)(s.rq5,{className:"size-3.5"})})]})]},e.key)})}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-3 border-t px-3 py-1.5 text-[10px] text-muted-foreground",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("kbd",{className:"font-mono text-foreground/70",children:"↑↓"}),"Navigate"]}),(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("kbd",{className:"font-mono text-foreground/70",children:"↵"}),"Open"]}),ea?.type==="table"&&(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("kbd",{className:"font-mono text-foreground/70",children:"⇧↵"}),ea.pinned?"Unpin":"Pin"]})]})]}):null}function ea({connectionId:e,children:t}){let n=(0,i.p)(),a=(0,c.w)(e),[f,h]=(0,u.DE)(e);if(!n)return null;if(!a)return(0,r.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-muted-foreground",children:[(0,r.jsx)("p",{children:"Connection not found"}),(0,r.jsx)(l(),{href:"/",className:"text-foreground underline underline-offset-4",children:"Connections"})]});let p=(0,d.Mq)(a);return(0,r.jsxs)(m.Z,{connection:a,children:[(0,r.jsxs)("div",{className:"flex h-dvh flex-col overflow-hidden",children:[(0,r.jsx)("div",{"aria-hidden":!0,title:a.name,className:"h-1.5 w-full shrink-0",style:{background:p}}),(0,r.jsxs)("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[f.sidebarCollapsed?(0,r.jsxs)("aside",{className:"relative flex h-full w-10 shrink-0 justify-center border-r bg-sidebar pt-2",children:[(0,r.jsx)("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-1",style:{background:p}}),(0,r.jsx)(o.$,{variant:"ghost",size:"icon-sm","aria-label":"Show database sidebar",title:"Show sidebar",onClick:()=>h({sidebarCollapsed:!1}),children:(0,r.jsx)(s.cFu,{})})]}):(0,r.jsx)(A,{width:f.sidebarWidth,onWidthChange:e=>h({sidebarWidth:e}),onCollapse:()=>h({sidebarCollapsed:!0})},a.id),(0,r.jsx)("main",{className:"flex min-w-0 flex-1 flex-col",children:t})]})]}),(0,r.jsx)(er,{}),(0,r.jsx)(_,{}),(0,r.jsx)(X,{})]})}},79781:(e,t,n)=>{"use strict";n.d(t,{$C:()=>u,yG:()=>d});var r=n(73321),a=n(12115),l=n(27529),s=n(15923),o=n(20185),i=n(69586),c=n(36331);function u(){let e=(0,r.useRouter)(),t=(0,r.usePathname)(),{connection:n}=(0,c.k)(),u=(0,i.Z)(e=>e.connections);return(0,a.useCallback)(async r=>{if(r===n.id)return;let a=u.find(e=>e.id===r);if(!a)return;(0,s.r)();let i=(0,o.ZG)(t),c=!!n.layoutGroup&&n.layoutGroup===a.layoutGroup,d=!0;if("table"===i.kind&&!c)try{var m,f;m=await l.F.tables(a.url),f=i.table,d=m.some(e=>e.schema===f.schema&&e.name===f.name)}catch{d=!1}e.push((0,o.gZ)(t,r,{tableExists:d}))},[n.id,n.layoutGroup,u,t,e])}function d(){let{connection:e}=(0,c.k)(),t=(0,i.Z)(e=>e.connections),n=u(),r=function(e,t){let n=e.findIndex(e=>e.id===t);if(!(e.length<2)&&-1!==n)return e[(n+1)%e.length]}(t,e.id);return{run:()=>r?n(r.id):Promise.resolve(),enabled:void 0!==r,next:r}}},86846:(e,t,n)=>{"use strict";n.d(t,{E:()=>l});var r=n(95155),a=n(40980);function l({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"skeleton",className:(0,a.cn)("animate-pulse rounded-md bg-muted",e),...t})}}},e=>{e.O(0,[4506,1731,900,8361,8500,8322,649,6996,7893,8441,3794,7358],()=>e(e.s=12860)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7123],{7412:(e,t,n)=>{"use strict";n.d(t,{L:()=>s});var r=n(95155),a=n(13267),l=n(40980);function s({trailing:e,className:t,...n}){return(0,r.jsxs)("div",{className:(0,l.cn)("flex h-8 items-center gap-1.5 rounded-lg px-2 text-muted-foreground transition-colors focus-within:bg-muted/60 hover:bg-muted/60",t),children:[(0,r.jsx)(a.TfF,{className:"size-3.5 shrink-0"}),(0,r.jsx)("input",{type:"text",spellCheck:!1,autoComplete:"off",...n,className:"h-full min-w-0 flex-1 bg-transparent text-[0.8rem] text-foreground outline-none placeholder:text-muted-foreground"}),e]})}},12860:(e,t,n)=>{Promise.resolve().then(n.bind(n,37875))},15923:(e,t,n)=>{"use strict";n.d(t,{T:()=>a,r:()=>l});let r=new Set;function a(e){return r.add(e),()=>{r.delete(e)}}function l(){for(let e of r)e()}},19065:(e,t,n)=>{"use strict";function r(e,t){if(0===t)return!0;let n=e[t-1];return"_"===n||"-"===n||" "===n||"."===n}function a(e,t,n){return l(e,t,e=>[n(e)])}function l(e,t,n){if(!e.trim())return[];let a=[];for(let l of t){let t=n(l),s=null;for(let n of t){let t=function(e,t){let n=e.trim().toLocaleLowerCase(),a=t.toLocaleLowerCase();if(!n)return 0;if(0===a.length)return null;if(a===n)return 1e4;if(a.startsWith(n))return 5e3-a.length;let l=a.indexOf(n);if(-1!==l)return 2400+1200*!!r(t,l)-l-a.length;let s=0,o=0,i=0;for(let e=0;e<a.length&&s<n.length;e+=1){if(a[e]!==n[s]){i=0;continue}o+=12,(i+=1)>1&&(o+=18*i),r(t,e)&&(o+=40),s+=1}if(s<n.length)return null;let c=t.split(/[_\-\s.]+/).map(e=>e[0]??"").join("").toLocaleLowerCase();return c.startsWith(n)?o+=2200:c.includes(n)&&(o+=700),o-(a.length-n.length)}(e,n);null!==t&&(null===s||t>s)&&(s=t)}null!==s&&a.push({item:l,score:s})}return a.sort((e,t)=>t.score!==e.score?t.score-e.score:n(e.item)[0]?.localeCompare(n(t.item)[0]??"")??0)}n.d(t,{R6:()=>a,UO:()=>l})},23716:(e,t,n)=>{"use strict";n.d(t,{V:()=>o});var r=n(95155),a=n(13267),l=n(72264),s=n(40980);function o({schemas:e,selected:t,onChange:n,compact:i=!1}){let c=null===t||t.length===e.length,u=null===t||t.length===e.length?"All schemas":0===t.length?"No schemas":1===t.length?t[0]:`${t.length} of ${e.length} schemas`;return(0,r.jsxs)(l.rI,{children:[i?(0,r.jsxs)(l.ty,{"aria-label":`Schemas: ${u}`,title:u,className:(0,s.cn)("flex h-6 shrink-0 cursor-pointer items-center gap-1 rounded-md px-1 text-[11px] tabular-nums outline-none transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60 data-open:bg-foreground/10 data-open:text-foreground",c?"text-muted-foreground":"text-foreground"),children:[(0,r.jsx)(a.olY,{className:"size-3.5"}),!c&&(0,r.jsx)("span",{children:t.length})]}):(0,r.jsxs)(l.ty,{className:"group flex h-8 w-full cursor-pointer items-center gap-2 rounded-lg px-2 text-left text-[0.8rem] outline-none transition-colors hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring/60 data-open:bg-muted/60",children:[(0,r.jsx)(a.olY,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:u}),(0,r.jsx)(a.RQe,{className:"size-3.5 shrink-0 text-muted-foreground transition-transform group-data-open:rotate-180"})]}),(0,r.jsx)(l.SQ,{align:i?"end":"start",sideOffset:6,className:(0,s.cn)("max-h-80 min-w-52",!i&&"w-(--anchor-width)"),children:(0,r.jsxs)(l.I,{children:[(0,r.jsx)(l.hO,{checked:c,onCheckedChange:e=>n(e?null:[]),children:"All schemas"}),(0,r.jsx)(l.mB,{}),e.map(a=>(0,r.jsx)(l.hO,{checked:c||(t?.includes(a)??!1),onCheckedChange:r=>{let l,s;return l=t??e,void n((s=r?[...new Set([...l,a])]:l.filter(e=>e!==a)).length===e.length?null:s)},children:(0,r.jsx)("span",{className:"truncate",children:a})},a))]})})]})}},35942:(e,t,n)=>{"use strict";n.d(t,{F:()=>u});var r=n(95155);n(12115);var a=n(76166),l=n(90839),s=n(84588),o=n(66784),i=n(64084),c=n(40980);function u({className:e,children:t,...n}){return(0,r.jsxs)(a.V,{"data-slot":"scroll-area",className:(0,c.cn)("relative",e),...n,children:[(0,r.jsx)(l.B,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:t}),(0,r.jsx)(d,{}),(0,r.jsx)(s.I,{})]})}function d({className:e,orientation:t="vertical",...n}){return(0,r.jsx)(o.V,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:(0,c.cn)("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",e),...n,children:(0,r.jsx)(i.l,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}},37875:(e,t,n)=>{"use strict";n.d(t,{ExplorerShell:()=>ea});var r=n(95155),a=n(98500),l=n.n(a),s=n(13267),o=n(89239),i=n(95377),c=n(69586),u=n(74590),d=n(32538),m=n(36331),f=n(73321),h=n(12115),p=n(35942),x=n(7412),g=n(86846),b=n(43262),w=n(95848),v=n(40980),y=n(72264),j=n(72194),k=n(79781);function N({current:e}){let t=(0,c.Z)(e=>e.connections),n=(0,k.$C)();return(0,r.jsxs)(y.rI,{children:[(0,r.jsxs)(y.ty,{className:"flex h-8 w-full items-center justify-between gap-2 rounded-lg px-2 text-left font-medium outline-none hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50 data-open:bg-muted/60",children:[(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,r.jsx)(j.F,{connection:e}),(0,r.jsx)("span",{className:"truncate",children:e.name}),e.layoutGroup&&(0,r.jsx)(s.WnQ,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),(0,r.jsx)(s.klM,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),(0,r.jsxs)(y.SQ,{align:"start",className:"w-(--anchor-width)",children:[t.map(t=>(0,r.jsxs)(y._2,{onClick:()=>void n(t.id),className:t.id===e.id?"font-medium":void 0,children:[(0,r.jsx)(j.F,{connection:t}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t.name}),t.layoutGroup&&t.layoutGroup===e.layoutGroup&&(0,r.jsx)(s.WnQ,{className:"size-3.5 shrink-0 text-muted-foreground"})]},t.id)),(0,r.jsx)(y.mB,{}),(0,r.jsx)(y._2,{render:(0,r.jsx)(l(),{href:"/"}),children:"Manage connections"})]})]})}var C=n(23716);function S(e,t){let n=e.trim(),r=n.lastIndexOf(".");return -1===r?n:"schema"===t?n.slice(0,r):n.slice(r+1)}function T({text:e,query:t}){if(!t)return e;let n=[],a=e.toLocaleLowerCase(),l=t.toLocaleLowerCase(),s=0,o=a.indexOf(l);if(-1===o)return e;for(;-1!==o;)o>s&&n.push(e.slice(s,o)),n.push((0,r.jsx)("mark",{className:"rounded-[3px] bg-yellow-300/90 px-px text-yellow-950 dark:bg-yellow-400/85 dark:text-yellow-950",children:e.slice(o,o+t.length)},o)),s=o+t.length,o=a.indexOf(l,s);return s<e.length&&n.push(e.slice(s)),n}function E({connectionId:e,table:t,search:n,pinned:a,showSchema:o,active:i,reorderable:c,dragging:u,dropEdge:d,onTogglePin:m,onDragStart:f,onDragOver:h,onDrop:p,onDragEnd:x,onMove:g}){return(0,r.jsxs)("li",{onDragOver:h,onDrop:p,className:(0,v.cn)("group/table-row relative flex h-7 items-center rounded-md text-[13px] transition-[color,background-color,opacity] hover:bg-muted/60",i&&"bg-muted text-foreground",!i&&"text-foreground/80",u&&"opacity-45","before"===d&&"before:absolute before:inset-x-1 before:top-0 before:z-10 before:h-0.5 before:-translate-y-1/2 before:rounded-full before:bg-primary","after"===d&&"after:absolute after:inset-x-1 after:bottom-0 after:z-10 after:h-0.5 after:translate-y-1/2 after:rounded-full after:bg-primary"),children:[c&&(0,r.jsx)("button",{type:"button",draggable:!0,"aria-label":`Reorder ${t.schema}.${t.name}`,title:"Drag to reorder; use Up and Down arrow keys",onDragStart:f,onDragEnd:x,onKeyDown:e=>{("ArrowUp"===e.key||"ArrowDown"===e.key)&&(e.preventDefault(),g?.("ArrowUp"===e.key?-1:1))},className:"ml-1.5 flex size-5 shrink-0 cursor-grab touch-none items-center justify-center rounded text-muted-foreground opacity-50 outline-none transition-[color,background-color,opacity] hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:opacity-100 active:cursor-grabbing",children:(0,r.jsx)(s.Mvf,{className:"size-3.5"})}),(0,r.jsxs)(l(),{href:`/${e}/${encodeURIComponent(t.schema)}/${encodeURIComponent(t.name)}`,className:(0,v.cn)("flex h-full min-w-0 flex-1 items-center gap-1.5 rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring/60",c?"pl-1":"pl-6"),children:[(0,r.jsx)("span",{className:"truncate",children:(0,r.jsx)(T,{text:t.name,query:S(n,"table")})}),o?(0,r.jsx)("span",{className:"ml-auto max-w-20 truncate text-[10px] text-muted-foreground",children:t.schema}):"view"===t.kind&&(0,r.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"view"})]}),(0,r.jsx)("button",{type:"button","aria-label":`${a?"Unpin":"Pin"} ${t.schema}.${t.name}`,"aria-pressed":a,title:a?"Unpin table":"Pin table",onClick:()=>m(t),className:(0,v.cn)("mr-0.5 flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground opacity-0 outline-none transition-[color,background-color,opacity] hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:opacity-100 group-hover/table-row:opacity-100",a&&"text-foreground"),children:a?(0,r.jsx)(s.M0d,{className:"size-3.5"}):(0,r.jsx)(s.rq5,{className:"size-3.5"})})]})}function $({label:e,count:t,collapsed:n,pinned:a,search:l,onToggle:o}){return(0,r.jsxs)("button",{type:"button","aria-expanded":!n,onClick:o,className:"flex h-7 w-full cursor-pointer items-center gap-1 rounded-md px-1 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60",children:[(0,r.jsx)(s.nNJ,{className:(0,v.cn)("size-3.5 transition-transform",!n&&"rotate-90")}),a&&(0,r.jsx)(s.M0d,{className:"mr-0.5 size-3"}),(0,r.jsx)("span",{className:"truncate",children:a?e:(0,r.jsx)(T,{text:e,query:S(l,"schema")})}),(0,r.jsx)("span",{className:"ml-auto pr-1 tabular-nums opacity-60",children:t})]})}function L({connectionId:e,tables:t,search:n,collapsedSchemas:a,pinnedTables:l,onToggleSchema:s,onTogglePin:o,onReorderPinned:i}){let c=(0,f.useParams)(),[u,d]=(0,h.useState)(!1),[m,p]=(0,h.useState)(null),[x,g]=(0,h.useState)(null),b=new Map(t.map(e=>[(0,w.i)(e),e])),v=l.flatMap(e=>{let t=b.get(e);return t?[t]:[]});function y(){p(null),g(null)}return 0===t.length?(0,r.jsx)("p",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:n.trim()?"No tables match your search":"No tables in these schemas"}):(0,r.jsxs)("div",{className:"flex flex-col gap-1 px-2 pb-4",children:[v.length>0&&(0,r.jsxs)("div",{className:"mb-1 border-b border-border/60 pb-1",children:[(0,r.jsx)($,{label:"Pinned tables",count:v.length,collapsed:u,pinned:!0,search:n,onToggle:()=>d(e=>!e)}),!u&&(0,r.jsx)("ul",{children:v.map(t=>{let a=(0,w.i)(t);return(0,r.jsx)(E,{connectionId:e,table:t,search:n,pinned:!0,showSchema:!0,active:c.schema===t.schema&&c.table===t.name,reorderable:!0,dragging:m===a,dropEdge:x?.key===a?x.edge:null,onTogglePin:o,onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",a),p(a),g(null)},onDragOver:e=>(function(e,t){if(!m||m===t)return;e.preventDefault(),e.dataTransfer.dropEffect="move";let n=e.currentTarget.getBoundingClientRect(),r=e.clientY<n.top+n.height/2?"before":"after";g(e=>e?.key===t&&e.edge===r?e:{key:t,edge:r})})(e,a),onDrop:e=>{let t,n;return e.preventDefault(),t=m??e.dataTransfer.getData("text/plain"),n=x?.key===a?x.edge:"before",void(t&&i(t,a,n),y())},onDragEnd:y,onMove:e=>{let t,n;return t=v.findIndex(e=>(0,w.i)(e)===a),void((n=v[t+e])&&i(a,(0,w.i)(n),-1===e?"before":"after"))}},a)})})]}),(function(e){let t=new Map;for(let n of e)t.set(n.schema,[...t.get(n.schema)??[],n]);return[...t.entries()].sort(([e],[t])=>{let n;return((n=new Map([["public",0],["auth",1]])).get(e)??2)-(n.get(t)??2)||e.localeCompare(t)})})(t).map(([t,i])=>{let u=a.includes(t);return(0,r.jsxs)("div",{children:[(0,r.jsx)($,{label:t,count:i.length,collapsed:u,search:n,onToggle:()=>s(t)}),!u&&(0,r.jsx)("ul",{children:i.map(t=>(0,r.jsx)(E,{connectionId:e,table:t,search:n,pinned:l.includes((0,w.i)(t)),active:c.schema===t.schema&&c.table===t.name,onTogglePin:o},(0,w.i)(t)))})]},t)})]})}function z(e){return Math.min(480,Math.max(180,Math.round(e)))}function D(e,t){let n=new Map([["public",0],["auth",1]]);return(n.get(e)??2)-(n.get(t)??2)||e.localeCompare(t)}function R(e,t,n){let r=t.trim().toLocaleLowerCase();return e.filter(e=>(null===n||!!n.includes(e.schema))&&(!r||e.name.toLocaleLowerCase().includes(r)||`${e.schema}.${e.name}`.toLocaleLowerCase().includes(r)))}function I({href:e,active:t,shortcut:n,children:a}){return(0,r.jsxs)(l(),{href:e,"aria-current":t?"page":void 0,className:(0,v.cn)((0,o.r)({variant:t?"secondary":"ghost",size:"sm"}),"h-8 w-full justify-start px-2"),children:[a,(0,r.jsx)("kbd",{className:"ml-auto font-mono text-[10px] text-muted-foreground/55",children:n})]})}function A({width:e,onWidthChange:t,onCollapse:n}){let a=(0,f.usePathname)(),{connection:l,tables:i}=(0,m.k)(),[d,v]=(0,u.DE)(l.id),y=(0,c.Z)(e=>e.connections.length>1),[j,k]=(0,h.useState)(()=>z(e)),S=(0,h.useRef)(null),T=(0,h.useMemo)(()=>[...new Set((i.data??[]).map(e=>e.schema))].sort(D),[i.data]),E=(0,h.useMemo)(()=>null===d.selectedSchemas?null:d.selectedSchemas.filter(e=>T.includes(e)),[d.selectedSchemas,T]),$=(0,h.useMemo)(()=>R(i.data??[],d.search,E),[i.data,d.search,E]),M=`/${encodeURIComponent(l.id)}`,U=`${M}/query`,P=`${M}/diff`,F=`${M}/migrations`;function q(e,t){let n=new Set(R(i.data??[],e,t).map(e=>e.schema));return d.collapsedSchemas.filter(e=>!n.has(e))}return(0,r.jsxs)("aside",{id:"database-explorer-sidebar",style:{width:j},className:"relative flex h-full shrink-0 flex-col border-r bg-sidebar",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-0.5 border-b border-sidebar-border/60 p-2",children:[(0,r.jsxs)("div",{className:"mb-1 flex items-center gap-1",children:[(0,r.jsx)("div",{className:"min-w-0 flex-1",children:(0,r.jsx)(N,{current:l})}),(0,r.jsx)(o.$,{variant:"ghost",size:"icon-sm","aria-label":"Collapse database sidebar",title:"Collapse sidebar",onClick:n,children:(0,r.jsx)(s.cFu,{})})]}),(0,r.jsxs)(I,{href:U,active:a===U,shortcut:b.Ar.sqlEditor,children:[(0,r.jsx)(s.Uoo,{"data-icon":"inline-start"}),"SQL query"]}),(0,r.jsxs)(I,{href:F,active:a===F||a.startsWith(`${F}/`),shortcut:b.Ar.migrations,children:[(0,r.jsx)(s.olY,{"data-icon":"inline-start"}),"Migrations"]}),y&&(0,r.jsxs)(I,{href:P,active:a===P,shortcut:b.Ar.compareSchema,children:[(0,r.jsx)(s.R4X,{"data-icon":"inline-start"}),"Compare schema"]}),(0,r.jsx)(x.L,{value:d.search,onChange:e=>{var t;v({search:t=e.target.value,collapsedSchemas:t.trim()?q(t,E):d.collapsedSchemas})},placeholder:"Search tables","aria-label":"Search tables",className:"mt-1",trailing:(0,r.jsxs)(r.Fragment,{children:[!d.search&&(0,r.jsx)("kbd",{className:"font-mono text-[10px] text-muted-foreground/55",children:b.Ar.tableSearch}),(0,r.jsx)(C.V,{compact:!0,schemas:T,selected:E,onChange:function(e){v({selectedSchemas:e,collapsedSchemas:d.search.trim()?q(d.search,e):d.collapsedSchemas})}})]})})]}),(0,r.jsx)(p.F,{className:"min-h-0 flex-1 pt-1.5",children:i.error?(0,r.jsx)("p",{className:"px-3 py-4 text-xs text-destructive",children:i.error}):i.data?(0,r.jsx)(L,{connectionId:l.id,tables:$,search:d.search,collapsedSchemas:d.collapsedSchemas,pinnedTables:d.pinnedTables,onToggleSchema:function(e){v({collapsedSchemas:d.collapsedSchemas.includes(e)?d.collapsedSchemas.filter(t=>t!==e):[...d.collapsedSchemas,e]})},onTogglePin:function(e){let t=(0,w.i)(e);v({pinnedTables:d.pinnedTables.includes(t)?d.pinnedTables.filter(e=>e!==t):[...d.pinnedTables,t]})},onReorderPinned:function(e,t,n){if(e===t)return;let r=d.pinnedTables.filter(t=>t!==e),a=r.indexOf(t);-1!==a&&(r.splice(a+ +("after"===n),0,e),v({pinnedTables:r}))}}):(0,r.jsx)("div",{className:"flex flex-col gap-2 px-3 py-2",children:Array.from({length:8},(e,t)=>(0,r.jsx)(g.E,{className:"h-5 w-full"},t))})}),(0,r.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize database sidebar","aria-valuemin":180,"aria-valuemax":480,"aria-valuenow":j,tabIndex:0,title:"Drag to resize; double-click to reset",onPointerDown:function(e){e.preventDefault(),S.current={pointerId:e.pointerId,startX:e.clientX,startWidth:j},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:function(e){let t=S.current;t&&t.pointerId===e.pointerId&&(e.preventDefault(),k(z(t.startWidth+e.clientX-t.startX)))},onPointerUp:function(e){let n=S.current;if(!n||n.pointerId!==e.pointerId)return;let r=z(n.startWidth+e.clientX-n.startX);S.current=null,k(r),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),t(r)},onPointerCancel:function(e){let n=S.current;n&&n.pointerId===e.pointerId&&(S.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),t(j))},onKeyDown:function(e){if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();let n=z(j+("ArrowLeft"===e.key?-1:1)*16);k(n),t(n)},onDoubleClick:function(e){e.preventDefault(),k(256),t(256)},className:"group/resize absolute inset-y-0 -right-1 z-30 w-2 cursor-col-resize touch-none outline-none after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-transparent after:transition-colors hover:after:bg-primary focus-visible:after:bg-primary"})]})}var M=n(67385),U=n(88406),P=n(86989),F=n(15923),q=n(19065);function O(e,{nested:t=!1}={}){let n=(0,f.useRouter)(),r=(0,f.usePathname)(),{connection:a,tables:l}=(0,m.k)(),[s]=(0,u.DE)(a.id),o=`/${encodeURIComponent(a.id)}`,i=`${o}/${e}`,c=t?r===i||r.startsWith(`${i}/`):r===i;return{open:c,href:i,toggle:()=>n.push(c?function(){for(let e of s.recentTables){let t=(l.data??[]).find(t=>(0,w.i)(t)===e);if(t)return`${o}/${encodeURIComponent(t.schema)}/${encodeURIComponent(t.name)}`}return o}():i)}}function G(){let e=O("migrations",{nested:!0});return{open:e.open,migrationsHref:e.href,toggle:e.toggle}}var K=n(48861);function Z(){let e=O("diff");return{open:e.open,diffHref:e.href,toggle:e.toggle}}function W(){let e=O("query");return{open:e.open,queryHref:e.href,toggle:e.toggle}}function B({text:e,query:t}){if(!t)return e;let n=e.toLocaleLowerCase(),a=t.toLocaleLowerCase(),l=n.indexOf(a);return -1===l?e:(0,r.jsxs)(r.Fragment,{children:[e.slice(0,l),(0,r.jsx)("mark",{className:"rounded-[3px] bg-yellow-300/90 px-px text-yellow-950 dark:bg-yellow-400/85 dark:text-yellow-950",children:e.slice(l,l+t.length)}),e.slice(l+t.length)]})}async function Q(e){try{await navigator.clipboard.writeText(e)}catch{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),t.remove()}}function _(){let e=(0,f.useRouter)(),t=(0,f.useParams)(),{connection:n,tables:a}=(0,m.k)(),l=W(),o=Z(),i=G(),d=(0,u.y3)(n.id),p=(0,k.yG)(),x=(0,K.Q)(n.id),g=(0,c.Z)(e=>e.add),[y,j]=(0,u.DE)(n.id),[N,C]=(0,h.useState)(!1),[S,T]=(0,h.useState)("commands"),[E,$]=(0,h.useState)(""),[L,z]=(0,h.useState)(0),[D,R]=(0,h.useState)(!1),I=(0,h.useRef)(null),A=(0,h.useRef)(null),O=(0,h.useRef)(null),_=(0,h.useRef)(S),X=(0,U.C)(e=>e.theme),V=t.schema&&t.table?{schema:decodeURIComponent(t.schema),name:decodeURIComponent(t.table)}:null,H=!!V&&y.pinnedTables.includes((0,w.i)(V)),Y=(0,u.lz)(e=>V?e.tables[`${n.id}:${(0,w.i)(V)}`]:void 0),J=(0,h.useMemo)(()=>[{id:"sql-editor",title:l.open?"Back to Table":"Open SQL Query",keywords:["new","query","sql","console","editor","close","back","table"],enabled:!0,shortcut:b.Ar.sqlEditor,run:()=>l.toggle()},{id:"go-back",title:x.back?`Back to ${x.back.label}`:"Back",keywords:["back","previous","return","history","undo"],enabled:null!==x.back,shortcut:b.Ar.back,run:()=>x.goBack()},{id:"go-forward",title:x.forward?`Forward to ${x.forward.label}`:"Forward",keywords:["forward","next","history","redo"],enabled:null!==x.forward,shortcut:b.Ar.forward,run:()=>x.goForward()},{id:"switch-connection",title:p.next?`Switch Connection (${p.next.name})`:"Switch Connection",keywords:["database","env","environment","next","cycle","other"],enabled:p.enabled,shortcut:b.Ar.switchConnection,run:()=>void p.run()},{id:"migrations",title:i.open?"Back to Table":"Open Migrations",keywords:["migration","migrate","apply","revert","rollback","ledger","schema","run"],enabled:!0,shortcut:b.Ar.migrations,run:()=>i.toggle()},{id:"compare-schema",title:d.target?`Compare Schema with ${d.target.name}`:"Compare Schema",keywords:["diff","difference","migration","drift","prod","dev","schema","compare"],enabled:null!==d.target,shortcut:b.Ar.compareSchema,run:()=>o.toggle()},{id:"search-tables",title:"Search Tables",keywords:["find","jump","open","goto","table"],enabled:!0,shortcut:b.Ar.tableSearch,run:()=>window.requestAnimationFrame(()=>(0,b.tT)())},{id:"search-columns",title:"Search Columns",keywords:["find","jump","goto","column","field"],enabled:null!==V,shortcut:b.Ar.columnSearch,run:()=>window.requestAnimationFrame(()=>(0,b.vI)())},{id:"reload-tables",title:"Reload Tables",keywords:["refresh","reload","tables","sync"],enabled:!0,run:()=>a.reload()},{id:"pin-table",title:H?"Unpin Table":"Pin Table",keywords:["pin","unpin","favorite","star"],enabled:null!==V,run:()=>{if(!V)return;let e=(0,w.i)(V);j({pinnedTables:y.pinnedTables.includes(e)?y.pinnedTables.filter(t=>t!==e):[...y.pinnedTables,e]})}},{id:"clear-filters",title:"Clear Filters",keywords:["filter","reset","remove"],enabled:null!==V,run:()=>{V&&u.lz.getState().setTable(n.id,V,{filters:[],page:0})}},{id:"clear-search",title:"Clear Search",keywords:["find","search","reset"],enabled:null!==V&&!!Y?.search,run:()=>{V&&u.lz.getState().setTable(n.id,V,{search:"",page:0})}},{id:"reset-columns",title:"Reset Columns",keywords:["pin","hide","frozen","layout","show"],enabled:null!==V,run:()=>{V&&u.lz.getState().setTable(n.id,V,{pinnedColumns:void 0,hiddenColumns:[]})}},{id:"copy-table",title:"Copy Schema.Table",keywords:["copy","name","qualified"],enabled:null!==V,run:()=>{V&&Q((0,w.i)(V))}},{id:"color-theme",title:"Color Theme",keywords:["theme","appearance","dark","light","color","set","preferences"],enabled:!0,keepOpen:!0,run:()=>{let e=U.C.getState().theme,t=P.zG.findIndex(t=>t.id===e);T("themes"),$(""),z(-1===t?0:t)}},{id:"add-connection",title:"Add Connection",keywords:["new","database","postgres"],enabled:!0,run:()=>R(!0)}],[y.pinnedTables,d.target,n.id,x,i,H,o,j,l,p,V,Y?.search,a]),ee=(0,h.useMemo)(()=>E.trim()?(0,q.R6)(E,J,e=>[e.title,...e.keywords].join(" ")).map(e=>e.item):J,[J,E]),et=(0,h.useMemo)(()=>E.trim()?(0,q.R6)(E,[...P.zG],e=>[e.name,...e.keywords].join(" ")).map(e=>e.item):[...P.zG],[E]),en="themes"===S?et:ee,er="commands"===S?ee[L]??null:null,ea="themes"===S?et[L]??null:null;function el(e){e?.revertTheme&&"themes"===_.current&&(0,P.AZ)(U.C.getState().theme),C(!1),$(""),z(0),T("commands")}function es(){el({revertTheme:!0})}function eo(){"themes"===_.current&&(0,P.AZ)(U.C.getState().theme),T("commands"),$(""),z(0)}function ei(e){e.enabled&&(e.keepOpen||es(),e.run())}function ec(e){U.C.getState().setTheme(e.id),(0,P.AZ)(e.id),el({revertTheme:!1})}return(0,h.useEffect)(()=>{_.current=S},[S]),(0,h.useEffect)(()=>{if("themes"===S&&!E.trim()){let e=P.zG.findIndex(e=>e.id===U.C.getState().theme);z(-1===e?0:e);return}z(0)},[E,N,S]),(0,h.useEffect)(()=>{let e=O.current?.querySelector("[data-active=true]");e?.scrollIntoView({block:"nearest"})},[L,en]),(0,h.useEffect)(()=>{if(!N)return;let e=window.requestAnimationFrame(()=>I.current?.focus());return()=>window.cancelAnimationFrame(e)},[N,S]),(0,h.useEffect)(()=>{if(!N||"themes"!==S)return;let e=et[L];e&&(0,P.AZ)(e.id)},[N,S,L,et]),(0,h.useEffect)(()=>(0,F.T)(es),[]),(0,h.useEffect)(()=>{function e(e){if((e.metaKey||e.ctrlKey)&&e.shiftKey&&"p"===e.key.toLowerCase()){if(e.preventDefault(),N){"themes"===_.current&&eo(),I.current?.select();return}(0,F.r)(),$(""),z(0),T("commands"),C(!0);return}if(N&&"Escape"===e.key){if(e.preventDefault(),"themes"===_.current)return void eo();es()}}function t(e){!N||A.current?.contains(e.target)||es()}return window.addEventListener("keydown",e,!0),window.addEventListener("pointerdown",t),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("pointerdown",t)}},[N]),(0,r.jsxs)(r.Fragment,{children:[N&&(0,r.jsxs)("div",{ref:A,"data-command-palette":"",className:"fixed top-3 left-1/2 z-50 flex w-[min(36rem,calc(100%-1.5rem))] -translate-x-1/2 flex-col overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-lg ring-1 ring-foreground/10",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 border-b px-3",children:[(0,r.jsx)("span",{className:"font-mono text-sm text-muted-foreground",children:">"}),(0,r.jsx)("input",{ref:I,value:E,onChange:e=>$(e.target.value),onKeyDown:function(e){if("ArrowDown"===e.key){if(e.preventDefault(),0===en.length)return;z(e=>(e+1)%en.length);return}if("ArrowUp"===e.key){if(e.preventDefault(),0===en.length)return;z(e=>(e-1+en.length)%en.length);return}if("Enter"===e.key){if(e.preventDefault(),"themes"===S){ea&&ec(ea);return}er&&ei(er)}},spellCheck:!1,autoComplete:"off",autoCorrect:"off",placeholder:"themes"===S?"Select color theme":"Type a command","aria-label":"themes"===S?"Color theme":"Command palette",className:"h-11 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),(0,r.jsx)("div",{ref:O,role:"listbox","aria-label":"themes"===S?"Color themes":"Commands",className:"max-h-[min(24rem,50vh)] overflow-auto py-1",children:0===en.length?(0,r.jsx)("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"themes"===S?"No matching themes":"No matching commands"}):"themes"===S?et.map((e,t)=>{let n=t===L,a=e.id===X;return(0,r.jsxs)("button",{type:"button",role:"option","aria-selected":n,"data-active":n||void 0,onMouseEnter:()=>z(t),onClick:()=>ec(e),className:(0,v.cn)("flex h-8 w-full cursor-pointer items-center gap-2 px-3 text-left text-[13px] outline-none",n&&"bg-primary/10"),children:[(0,r.jsx)("span",{"aria-hidden":!0,className:"size-3.5 shrink-0 rounded-sm border",style:{background:e.swatch}}),(0,r.jsx)("span",{className:"min-w-0 truncate",children:(0,r.jsx)(B,{text:e.name,query:E.trim()})}),a&&(0,r.jsx)(s.wiW,{className:"ml-auto size-3.5 shrink-0 text-muted-foreground"})]},e.id)}):ee.map((e,t)=>{let n=t===L;return(0,r.jsxs)("button",{type:"button",role:"option","aria-selected":n,"aria-disabled":!e.enabled,"data-active":n||void 0,onMouseEnter:()=>z(t),onClick:()=>ei(e),className:(0,v.cn)("flex h-8 w-full cursor-pointer items-center px-3 text-left text-[13px] outline-none",n&&"bg-primary/10",!e.enabled&&"cursor-default opacity-40"),children:[(0,r.jsx)("span",{className:"min-w-0 truncate",children:(0,r.jsx)(B,{text:e.title,query:E.trim()})}),e.shortcut&&(0,r.jsx)("kbd",{className:"ml-auto shrink-0 pl-3 font-mono text-[11px] text-muted-foreground/70",children:e.shortcut})]},e.id)})})]}),(0,r.jsx)(M.f,{open:D,onOpenChange:R,onSubmit:t=>{let{shareWith:n,...r}=t,a=g(r);(0,u.mQ)(a.id,n),e.push(`/${a.id}`)}})]})}function X(){let{toggle:e}=W(),{toggle:t}=Z(),{toggle:n}=G(),{run:r}=(0,k.yG)(),a=(0,K.Q)(),l=(0,c.Z)(e=>e.connections.length>1),s=(0,h.useRef)(e),o=(0,h.useRef)(t),i=(0,h.useRef)(n),u=(0,h.useRef)(r),d=(0,h.useRef)(a),m=(0,h.useRef)(l);return(0,h.useEffect)(()=>{s.current=e},[e]),(0,h.useEffect)(()=>{o.current=t},[t]),(0,h.useEffect)(()=>{i.current=n},[n]),(0,h.useEffect)(()=>{u.current=r},[r]),(0,h.useEffect)(()=>{m.current=l},[l]),(0,h.useEffect)(()=>{d.current=a},[a]),(0,h.useEffect)(()=>{function e(e){if(!(e.metaKey||e.ctrlKey)||e.altKey||e.repeat)return;let t=e.key.toLowerCase();if("["===t||"]"===t){if(e.shiftKey||function(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;let t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t}(e.target))return;e.preventDefault(),(0,F.r)(),"["===t?d.current.goBack():d.current.goForward();return}if("m"===t&&e.shiftKey){e.preventDefault(),(0,F.r)(),i.current();return}if("d"===t&&e.shiftKey){if(!m.current)return;e.preventDefault(),(0,F.r)(),o.current();return}if("e"===t){if(e.preventDefault(),(0,F.r)(),e.shiftKey)return void u.current();s.current()}}return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[]),null}var V=n(27529);let H={pinned:"Pinned",recent:"Recent",tables:"Tables",connections:"Connections"};function Y({text:e,query:t}){if(!t)return e;let n=e.toLocaleLowerCase(),a=t.toLocaleLowerCase(),l=n.indexOf(a);return -1===l?e:(0,r.jsxs)(r.Fragment,{children:[e.slice(0,l),(0,r.jsx)("mark",{className:"rounded-[3px] bg-yellow-300/90 px-px text-yellow-950 dark:bg-yellow-400/85 dark:text-yellow-950",children:e.slice(l,l+t.length)}),e.slice(l+t.length)]})}function J(e){try{return new URL(e).hostname}catch{return""}}function ee(e){return[e.name,J(e.url)].filter(Boolean)}function et(e,t){let n=new Map([["public",0],["auth",1]]);return(n.get(e.schema)??2)-(n.get(t.schema)??2)||e.schema.localeCompare(t.schema)||e.name.localeCompare(t.name)}function en(e,t){return e.map((e,n)=>0===n?{...e,section:t}:e)}function er(){let e=(0,f.useRouter)(),t=(0,k.$C)(),n=(0,f.useParams)(),{connection:a,tables:l}=(0,m.k)(),o=(0,c.Z)(e=>e.connections),[i,d]=(0,h.useState)(!1),[p,x]=(0,h.useState)(""),[g,y]=(0,h.useState)(0),[N,C]=(0,h.useState)(null),S=(0,h.useRef)(null),T=(0,h.useRef)(null),E=(0,h.useRef)(null),$=o.find(e=>e.id===N)??null,L=$??a,z=$&&$.id!==a.id?$.url:null,D=function(e){let[t]=(0,h.useState)(()=>new Map),[n,r]=(0,h.useState)({url:"",error:null});if((0,h.useEffect)(()=>{if(!e)return;let n=new AbortController;return V.F.tables(e,n.signal).then(n=>{t.set(e,n),r({url:e,data:n,error:null})}).catch(a=>{if(n.signal.aborted)return;let l=a instanceof Error?a.message:String(a);r(n=>({url:e,data:n.url===e?n.data:t.get(e),error:l}))}),()=>n.abort()},[t,e]),!e)return{data:void 0,error:null,loading:!1};let a=n.url===e?n.data:t.get(e);return{data:a,error:n.url===e?n.error:null,loading:void 0===a}}(z),[R,I]=(0,u.DE)(a.id),[A,M]=(0,u.DE)(L.id),U=L.id===a.id?R:A,P=(0,h.useMemo)(()=>z?D.data??[]:l.data??[],[D.data,z,l.data]),O=z?D.loading:l.loading,G=z?D.error:null,K=(0,h.useMemo)(()=>[...new Set(P.map(e=>e.schema))],[P]),Z=null===U.selectedSchemas?null:U.selectedSchemas.filter(e=>K.includes(e)),W=(0,h.useMemo)(()=>null===Z?P:P.filter(e=>Z.includes(e.schema)),[P,Z]),B=U.pinnedTables,Q=U.recentTables,_=(0,h.useMemo)(()=>{let e,t;return -1===(t=(e=p.trim()).indexOf(":"))?{schema:null,table:e}:{schema:e.slice(0,t).trim(),table:e.slice(t+1).trim()}},[p]),X=_.table||(_.schema?"":p.trim()),er=(0,h.useMemo)(()=>{let e=new Set(B),t=new Set(Q),n=null===_.schema?null:function(e,t){if(!e)return t;let n=e.toLocaleLowerCase(),r=t.filter(e=>e.toLocaleLowerCase()===n);if(r.length>0)return r;let a=t.filter(e=>e.toLocaleLowerCase().startsWith(n));return a.length>0?a:(0,q.R6)(e,t,e=>e).map(e=>e.item)}(_.schema,K),r=null===n?W:P.filter(e=>n.includes(e.schema)),l=new Map(r.map(e=>[(0,w.i)(e),e])),s=B.flatMap(e=>{let t=l.get(e);return t?[t]:[]}),i=Q.flatMap(t=>{let n=l.get(t);return!n||e.has(t)?[]:[n]}),c=(e,t)=>({type:"table",key:`table:${(0,w.i)(e)}`,table:e,...t}),u=e=>({type:"connection",key:`connection:${e.id}`,connection:e,current:e.id===a.id}),d=null===_.schema?p.trim():_.table,m=null===$&&null===_.schema;if(!d){let e=new Set([...s.map(e=>(0,w.i)(e)),...i.map(e=>(0,w.i)(e))]),n=r.filter(t=>!e.has((0,w.i)(t))).sort(et),l=m?o.filter(e=>e.id!==a.id):[];return[...en(s.map(e=>c(e,{pinned:!0})),"pinned"),...en(i.map(e=>c(e,{pinned:!1,recent:!0})),"recent"),...en(n.map(e=>c(e,{pinned:!1,recent:t.has((0,w.i)(e))})),"tables"),...en(l.map(u),"connections")]}let f=(0,q.UO)(d,r,e=>null===_.schema?[e.name,`${e.schema}.${e.name}`,e.schema]:[e.name]).map(n=>({...n,score:n.score+80*!!e.has((0,w.i)(n.item))+40*!!t.has((0,w.i)(n.item))})).sort((e,t)=>t.score-e.score).map(n=>c(n.item,{pinned:e.has((0,w.i)(n.item)),recent:t.has((0,w.i)(n.item))}));return[...en(m?(0,q.UO)(p,o,ee).map(e=>u(e.item)):[],"connections"),...en(f,"tables")]},[P,a.id,o,$,_.schema,_.table,B,p,Q,K,W]),ea=er[g]??null;function el(){d(!1),x(""),y(0),C(null)}function es(){C(null),y(0),S.current?.focus()}function eo(n){var r,a;(el(),"connection"===n.type)?t(n.connection.id):e.push((r=L.id,a=n.table,`/${r}/${encodeURIComponent(a.schema)}/${encodeURIComponent(a.name)}`))}function ei(e){let t=(0,w.i)(e),n=U.pinnedTables.includes(t)?U.pinnedTables.filter(e=>e!==t):[...U.pinnedTables,t];(L.id===a.id?I:M)({pinnedTables:n})}(0,h.useEffect)(()=>{y(0)},[p,i,N]),(0,h.useEffect)(()=>{let e=E.current?.querySelector("[data-active=true]");e?.scrollIntoView({block:"nearest"})},[g,er]),(0,h.useEffect)(()=>{if(!i)return;let e=window.requestAnimationFrame(()=>S.current?.focus());return()=>window.cancelAnimationFrame(e)},[i]),(0,h.useEffect)(()=>{if(!n.schema||!n.table)return;let e=`${decodeURIComponent(n.schema)}.${decodeURIComponent(n.table)}`,t=u.lz.getState().browse[a.id]?.recentTables??[];t[0]!==e&&I({recentTables:[e,...t.filter(t=>t!==e)].slice(0,12)})},[a.id,n.schema,n.table,I]),(0,h.useEffect)(()=>{function e(){i?S.current?.select():((0,F.r)(),x(""),y(0),C(null),d(!0))}function t(t){if((t.metaKey||t.ctrlKey)&&"p"===t.key.toLowerCase()){if(t.shiftKey)return;t.preventDefault(),e();return}i&&"Escape"===t.key&&(t.preventDefault(),el())}function n(e){!i||T.current?.contains(e.target)||el()}window.addEventListener("keydown",t,!0),window.addEventListener("pointerdown",n);let r=(0,b.s5)(e);return()=>{window.removeEventListener("keydown",t,!0),window.removeEventListener("pointerdown",n),r()}},[i]),(0,h.useEffect)(()=>(0,F.T)(el),[]);let ec=L.id===a.id&&n.schema&&n.table?`${decodeURIComponent(n.schema)}.${decodeURIComponent(n.table)}`:null;return i?(0,r.jsxs)("div",{ref:T,"data-table-palette":"",className:"fixed top-3 left-1/2 z-50 flex w-[min(36rem,calc(100%-1.5rem))] -translate-x-1/2 flex-col overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-lg ring-1 ring-foreground/10",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 border-b px-3",children:[(0,r.jsx)(s.TfF,{className:"size-4 shrink-0 text-muted-foreground"}),$&&(0,r.jsxs)("button",{type:"button",onClick:es,"aria-label":`Stop searching ${$.name}`,className:"flex h-6 max-w-40 shrink-0 items-center gap-1.5 rounded-md bg-muted px-1.5 text-xs outline-none hover:bg-muted/80",children:[(0,r.jsx)(j.F,{connection:$,className:"size-2"}),(0,r.jsx)("span",{className:"truncate",children:$.name})]}),(0,r.jsx)("input",{ref:S,value:p,onChange:e=>x(e.target.value),onKeyDown:function(e){if("ArrowDown"===e.key){if(e.preventDefault(),0===er.length)return;y(e=>(e+1)%er.length);return}if("ArrowUp"===e.key){if(e.preventDefault(),0===er.length)return;y(e=>(e-1+er.length)%er.length);return}if("Tab"===e.key){if(e.preventDefault(),$||e.shiftKey)return;ea?.type==="connection"&&(C(ea.connection.id),x(""),y(0));return}if("Backspace"===e.key&&""===p&&$){e.preventDefault(),es();return}"Enter"===e.key&&(e.preventDefault(),e.shiftKey&&ea?.type==="table"?ei(ea.table):ea&&eo(ea))},spellCheck:!1,autoComplete:"off",autoCorrect:"off",placeholder:$?`Search tables in ${$.name}`:"Go to table (schema:name)","aria-label":$?`Go to table in ${$.name}`:"Go to table or connection",className:"h-11 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),(0,r.jsx)("div",{ref:E,role:"listbox","aria-label":$?`Tables in ${$.name}`:"Tables and connections",className:"max-h-[min(24rem,50vh)] overflow-auto py-1",children:O&&0===P.length&&0===er.length?(0,r.jsx)("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"Loading tables…"}):G&&0===P.length?(0,r.jsx)("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:G}):0===er.length?(0,r.jsx)("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p.trim()?"No matches":"No tables"}):er.map((e,t)=>{let n=t===g;if("connection"===e.type){let a=J(e.connection.url);return(0,r.jsxs)("div",{children:[e.section&&(0,r.jsx)("p",{className:"px-3 pt-2 pb-1 text-[10px] font-medium tracking-wide text-muted-foreground uppercase",children:H[e.section]}),(0,r.jsxs)("button",{type:"button",role:"option","aria-selected":n,"data-active":n||void 0,onMouseEnter:()=>y(t),onClick:()=>eo(e),className:(0,v.cn)("flex h-8 w-full cursor-pointer items-center gap-2 px-3 text-left text-[13px] outline-none",n&&"bg-primary/10"),children:[(0,r.jsx)(s.bkQ,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,r.jsx)(j.F,{connection:e.connection,className:"size-2"}),(0,r.jsx)("span",{className:(0,v.cn)("min-w-0 truncate",e.current&&"font-medium"),children:(0,r.jsx)(Y,{text:e.connection.name,query:X})}),(0,r.jsx)("span",{className:"ml-auto flex min-w-0 shrink-0 items-center gap-2 text-[11px] text-muted-foreground",children:n?(0,r.jsx)("span",{children:"Tab to search"}):(0,r.jsx)("span",{className:"max-w-36 truncate",children:e.current?"current":a||"connection"})})]})]},e.key)}let a=(0,w.i)(e.table)===ec;return(0,r.jsxs)("div",{children:[e.section&&(0,r.jsx)("p",{className:"px-3 pt-2 pb-1 text-[10px] font-medium tracking-wide text-muted-foreground uppercase",children:H[e.section]}),(0,r.jsxs)("div",{onMouseEnter:()=>y(t),className:(0,v.cn)("group/table-result flex items-center",n&&"bg-primary/10"),children:[(0,r.jsxs)("button",{type:"button",role:"option","aria-selected":n,"data-active":n||void 0,onClick:()=>eo(e),className:"flex h-8 min-w-0 flex-1 cursor-pointer items-center gap-2 pl-3 text-left text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/60",children:[e.recent&&!e.pinned?(0,r.jsx)(s.A01,{className:"size-3.5 shrink-0 text-muted-foreground"}):(0,r.jsx)(s.ooN,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,r.jsx)("span",{className:(0,v.cn)("min-w-0 truncate",a&&"font-medium"),children:(0,r.jsx)(Y,{text:e.table.name,query:X})}),(0,r.jsxs)("span",{className:"ml-auto flex min-w-0 shrink-0 items-center gap-2 text-[11px] text-muted-foreground",children:["view"===e.table.kind&&(0,r.jsx)("span",{children:"view"}),(0,r.jsx)("span",{className:"max-w-36 truncate",children:e.table.schema})]})]}),(0,r.jsx)("button",{type:"button","aria-label":`${e.pinned?"Unpin":"Pin"} ${(0,w.i)(e.table)}`,"aria-pressed":e.pinned,title:e.pinned?"Unpin table":"Pin table",onClick:()=>ei(e.table),className:(0,v.cn)("mr-2 flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground opacity-0 outline-none transition-[color,background-color,opacity] hover:bg-foreground/10 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:opacity-100 group-hover/table-result:opacity-100",(e.pinned||n)&&"opacity-100",e.pinned&&"text-foreground"),children:e.pinned?(0,r.jsx)(s.M0d,{className:"size-3.5"}):(0,r.jsx)(s.rq5,{className:"size-3.5"})})]})]},e.key)})}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-3 border-t px-3 py-1.5 text-[10px] text-muted-foreground",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("kbd",{className:"font-mono text-foreground/70",children:"↑↓"}),"Navigate"]}),(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("kbd",{className:"font-mono text-foreground/70",children:"↵"}),"Open"]}),ea?.type==="table"&&(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("kbd",{className:"font-mono text-foreground/70",children:"⇧↵"}),ea.pinned?"Unpin":"Pin"]})]})]}):null}function ea({connectionId:e,children:t}){let n=(0,i.p)(),a=(0,c.w)(e),[f,h]=(0,u.DE)(e);if(!n)return null;if(!a)return(0,r.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-muted-foreground",children:[(0,r.jsx)("p",{children:"Connection not found"}),(0,r.jsx)(l(),{href:"/",className:"text-foreground underline underline-offset-4",children:"Connections"})]});let p=(0,d.Mq)(a);return(0,r.jsxs)(m.Z,{connection:a,children:[(0,r.jsxs)("div",{className:"flex h-dvh flex-col overflow-hidden",children:[(0,r.jsx)("div",{"aria-hidden":!0,title:a.name,className:"h-1.5 w-full shrink-0",style:{background:p}}),(0,r.jsxs)("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[f.sidebarCollapsed?(0,r.jsxs)("aside",{className:"relative flex h-full w-10 shrink-0 justify-center border-r bg-sidebar pt-2",children:[(0,r.jsx)("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-1",style:{background:p}}),(0,r.jsx)(o.$,{variant:"ghost",size:"icon-sm","aria-label":"Show database sidebar",title:"Show sidebar",onClick:()=>h({sidebarCollapsed:!1}),children:(0,r.jsx)(s.cFu,{})})]}):(0,r.jsx)(A,{width:f.sidebarWidth,onWidthChange:e=>h({sidebarWidth:e}),onCollapse:()=>h({sidebarCollapsed:!0})},a.id),(0,r.jsx)("main",{className:"flex min-w-0 flex-1 flex-col",children:t})]})]}),(0,r.jsx)(er,{}),(0,r.jsx)(_,{}),(0,r.jsx)(X,{})]})}},79781:(e,t,n)=>{"use strict";n.d(t,{$C:()=>u,yG:()=>d});var r=n(73321),a=n(12115),l=n(27529),s=n(15923),o=n(20185),i=n(69586),c=n(36331);function u(){let e=(0,r.useRouter)(),t=(0,r.usePathname)(),{connection:n}=(0,c.k)(),u=(0,i.Z)(e=>e.connections);return(0,a.useCallback)(async r=>{if(r===n.id)return;let a=u.find(e=>e.id===r);if(!a)return;(0,s.r)();let i=(0,o.ZG)(t),c=!!n.layoutGroup&&n.layoutGroup===a.layoutGroup,d=!0;if("table"===i.kind&&!c)try{var m,f;m=await l.F.tables(a.url),f=i.table,d=m.some(e=>e.schema===f.schema&&e.name===f.name)}catch{d=!1}e.push((0,o.gZ)(t,r,{tableExists:d}))},[n.id,n.layoutGroup,u,t,e])}function d(){let{connection:e}=(0,c.k)(),t=(0,i.Z)(e=>e.connections),n=u(),r=function(e,t){let n=e.findIndex(e=>e.id===t);if(!(e.length<2)&&-1!==n)return e[(n+1)%e.length]}(t,e.id);return{run:()=>r?n(r.id):Promise.resolve(),enabled:void 0!==r,next:r}}},86846:(e,t,n)=>{"use strict";n.d(t,{E:()=>l});var r=n(95155),a=n(40980);function l({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"skeleton",className:(0,a.cn)("animate-pulse rounded-md bg-muted",e),...t})}}},e=>{e.O(0,[4506,1731,8026,4730,8361,8322,6090,7709,6782,8441,3794,7358],()=>e(e.s=12860)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5838],{15923:(e,t,n)=>{"use strict";n.d(t,{T:()=>r,r:()=>i});let s=new Set;function r(e){return s.add(e),()=>{s.delete(e)}}function i(){for(let e of s)e()}},18349:(e,t,n)=>{"use strict";n.d(t,{T:()=>i});var s=n(95155);n(12115);var r=n(40980);function i({className:e,...t}){return(0,s.jsx)("textarea",{"data-slot":"textarea",className:(0,r.cn)("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}},34263:(e,t,n)=>{"use strict";n.d(t,{En:()=>c,Pc:()=>d,jl:()=>o});var s=n(1934),r=n(31692),i=n(40980),a=n(63307);let l="ytdb:queries";(0,a.q)("db-studio:queries",l);let o=144,d=800,c=(0,s.v)()((0,r.Zr)(e=>({drafts:{},editorHeight:224,history:[],setDraft:(t,n)=>e(e=>({drafts:{...e.drafts,[t]:n}})),setEditorHeight:t=>e({editorHeight:Math.min(d,Math.max(o,Math.round(t)))}),record:(t,n)=>e(e=>{let s=n.trim();if(!s)return e;let r=e.history.find(e=>e.connectionId===t&&e.sql===s),a={id:r?.id??(0,i.z)(),connectionId:t,sql:s,executedAt:Date.now()},l=0,o=0;return{history:[a,...e.history.filter(e=>e.id!==a.id)].filter(e=>!(l>=200)&&!(o+e.sql.length>1e6)&&(l+=1,o+=e.sql.length,!0))}}),remove:t=>e(e=>({history:e.history.filter(e=>e.id!==t)}))}),{name:l}))},40891:(e,t,n)=>{"use strict";n.d(t,{os:()=>v,iX:()=>b,mw:()=>j});var s=n(95155),r=n(12115),i=n(13267),a=n(89239),l=n(86846);let o=new Set(["add","all","alter","always","and","as","asc","authorization","between","by","cascade","case","cast","check","collate","column","concurrently","constraint","create","cross","current","default","deferrable","deferred","delete","desc","distinct","drop","else","end","except","exclude","exists","false","foreign","from","full","generated","grant","group","having","identity","if","ilike","immediate","in","include","index","inherits","inner","instead","intersect","into","is","join","key","lateral","left","like","limit","match","materialized","natural","no","not","null","nulls","of","offset","on","only","or","order","outer","over","partition","primary","references","replace","restrict","returning","right","select","server","set","stored","table","temp","temporary","then","time","to","trigger","true","union","unique","unlogged","update","using","values","view","when","where","window","with","without","zone"]);function d(e){let t=[],n=0;for(;n<e.length;){let s=e[n];if(!s)break;if(m(s)){let s=n;for(n+=1;n<e.length&&m(e[n]);)n+=1;t.push({kind:"text",value:e.slice(s,n)});continue}if("-"===s&&"-"===e[n+1]){let s=n;for(n+=2;n<e.length&&"\n"!==e[n];)n+=1;t.push({kind:"comment",value:e.slice(s,n)});continue}if("/"===s&&"*"===e[n+1]){let s=e.indexOf("*/",n+2),r=-1===s?e.length:s+2;t.push({kind:"comment",value:e.slice(n,r)}),n=r;continue}if("$"===s){let s=function(e,t){if("$"!==e[t])return null;let n=t+1;for(;n<e.length&&p(e[n]);)n+=1;return"$"!==e[n]?null:e.slice(t,n+1)}(e,n);if(s){let r=n+s.length,i=e.indexOf(s,r),a=-1===i?e.length:i+s.length;t.push({kind:"string",value:e.slice(n,a)}),n=a;continue}}if('"'===s){n=u(e,n,'"',"ident",t);continue}if("'"===s){n=u(e,n,"'","string",t);continue}if(x(s)||"."===s&&x(e[n+1])){let s=n;n=function(e,t){let n=t;for("."===e[n]&&(n+=1);n<e.length&&x(e[n]);)n+=1;if("."===e[n]&&x(e[n+1]))for(n+=1;n<e.length&&x(e[n]);)n+=1;if("e"===e[n]||"E"===e[n]){let t=n+1;if(("+"===e[t]||"-"===e[t])&&(t+=1),x(e[t]))for(n=t;n<e.length&&x(e[n]);)n+=1}return n}(e,n),t.push({kind:"number",value:e.slice(s,n)});continue}if(h(s)){let s=n;for(n+=1;n<e.length&&p(e[n]);)n+=1;let r=e.slice(s,n);t.push({kind:function(e,t,n){let s=t.toLowerCase();if(o.has(s))return"keyword";let r=n;for(;r<e.length&&(" "===e[r]||" "===e[r]);)r+=1;return"("===e[r]?"function":"ident"}(e,r,n),value:r});continue}t.push({kind:"text",value:s}),n+=1}return t}function c(e){let t=[[]];for(let n of e){let e=n.value.split("\n");for(let s=0;s<e.length;s+=1){s>0&&t.push([]);let r=e[s],i=t[t.length-1];r&&i&&i.push({kind:n.kind,value:r})}}return t}function u(e,t,n,s,r){let i=t+1;for(;i<e.length;){if(e[i]===n){if(e[i+1]===n){i+=2;continue}i+=1;break}i+=1}return r.push({kind:s,value:e.slice(t,i)}),i}function m(e){return" "===e||" "===e||"\n"===e||"\r"===e}function x(e){return void 0!==e&&e>="0"&&e<="9"}function h(e){return void 0!==e&&(e>="A"&&e<="Z"||e>="a"&&e<="z"||"_"===e)}function p(e){return h(e)||x(e)||"$"===e}var f=n(40980);function g({tokens:e}){return e.map((e,t)=>(0,s.jsx)("span",{className:function(e){switch(e){case"keyword":return"text-sky-700 dark:text-sky-400";case"function":return"text-violet-700 dark:text-fuchsia-400";case"ident":return"text-foreground";case"string":case"number":return"text-amber-700 dark:text-amber-300";case"comment":return"text-muted-foreground";case"text":return"text-foreground/80";default:return e}}(e.kind),children:e.value},t))}async function j(e){try{await navigator.clipboard.writeText(e);return}catch{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),t.remove()}}function v({sql:e,className:t}){let n=(0,r.useMemo)(()=>c(d(e.trimEnd())),[e]);return(0,s.jsx)("pre",{className:(0,f.cn)("overflow-x-auto font-mono text-[12px] leading-5 whitespace-pre",t),children:(0,s.jsx)("code",{children:n.map((e,t)=>(0,s.jsx)("div",{className:"min-h-5",children:(0,s.jsx)(g,{tokens:e})},t))})})}function b({sql:e,error:t,loading:n,actions:o}){let[u,m]=(0,r.useState)(!1),x=(0,r.useMemo)(()=>e?c(d(e.trimEnd())):[],[e]);if(t)return(0,s.jsx)("p",{className:"flex-1 px-4 py-6 font-mono text-xs text-destructive",children:t});if(!e||n&&0===x.length)return(0,s.jsx)("div",{className:"flex flex-col gap-2 p-4",children:Array.from({length:16},(e,t)=>(0,s.jsx)(l.E,{className:"h-4 w-full"},t))});async function h(){e&&(await j(e),m(!0),window.setTimeout(()=>m(!1),1500))}let p=`${Math.max(String(x.length).length,2)+1}ch`;return(0,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col","data-sql-source":"",children:[(0,s.jsxs)("div",{className:"flex shrink-0 items-center justify-end gap-2 px-3 py-1",children:[o,(0,s.jsxs)(a.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>void h(),children:[u?(0,s.jsx)(i.wiW,{"data-icon":"inline-start"}):(0,s.jsx)(i.hX7,{"data-icon":"inline-start"}),u?"Copied":"Copy SQL"]})]}),(0,s.jsx)("div",{className:(0,f.cn)("min-h-0 flex-1 overflow-auto",n&&"opacity-60"),children:(0,s.jsx)("pre",{className:"min-w-max px-4 pb-4 font-mono text-[13px] leading-6",children:x.map((e,t)=>(0,s.jsxs)("div",{className:"flex min-h-6",children:[(0,s.jsx)("span",{className:"sticky left-0 shrink-0 bg-background pr-4 text-right text-muted-foreground/45 select-none",style:{width:p},children:t+1}),(0,s.jsx)("code",{className:"pr-8 whitespace-pre",children:(0,s.jsx)(g,{tokens:e})})]},t))})})]})}},52310:(e,t,n)=>{Promise.resolve().then(n.bind(n,92666))},79781:(e,t,n)=>{"use strict";n.d(t,{$C:()=>c,yG:()=>u});var s=n(73321),r=n(12115),i=n(27529),a=n(15923),l=n(20185),o=n(69586),d=n(36331);function c(){let e=(0,s.useRouter)(),t=(0,s.usePathname)(),{connection:n}=(0,d.k)(),c=(0,o.Z)(e=>e.connections);return(0,r.useCallback)(async s=>{if(s===n.id)return;let r=c.find(e=>e.id===s);if(!r)return;(0,a.r)();let o=(0,l.ZG)(t),d=!!n.layoutGroup&&n.layoutGroup===r.layoutGroup,u=!0;if("table"===o.kind&&!d)try{var m,x;m=await i.F.tables(r.url),x=o.table,u=m.some(e=>e.schema===x.schema&&e.name===x.name)}catch{u=!1}e.push((0,l.gZ)(t,s,{tableExists:u}))},[n.id,n.layoutGroup,c,t,e])}function u(){let{connection:e}=(0,d.k)(),t=(0,o.Z)(e=>e.connections),n=c(),s=function(e,t){let n=e.findIndex(e=>e.id===t);if(!(e.length<2)&&-1!==n)return e[(n+1)%e.length]}(t,e.id);return{run:()=>s?n(s.id):Promise.resolve(),enabled:void 0!==s,next:s}}},86846:(e,t,n)=>{"use strict";n.d(t,{E:()=>i});var s=n(95155),r=n(40980);function i({className:e,...t}){return(0,s.jsx)("div",{"data-slot":"skeleton",className:(0,r.cn)("animate-pulse rounded-md bg-muted",e),...t})}},92666:(e,t,n)=>{"use strict";n.d(t,{MigrationDetail:()=>W});var s=n(95155),r=n(98500),i=n.n(r),a=n(73321),l=n(12115),o=n(13267),d=n(36331),c=n(79781),u=n(17491),m=n(89239),x=n(72264),h=n(35942),p=n(87364),f=n(27529),g=n(62417),j=n(56012),v=n(74590),b=n(9385),y=n(79668),k=n(34263),N=n(40980),w=n(72194),C=n(40891),$=n(30374),S=n(25);let R="w-24",z="w-[104px]",A={applied:"applied",drifted:"applied, but the file changed since",pending:"not applied",unknown:"not read yet"};function E({status:e}){return"applied"===e?(0,s.jsx)(o.wiW,{className:"size-4 text-emerald-600 dark:text-emerald-400"}):"drifted"===e?(0,s.jsx)(o.e5t,{className:"size-3.5 text-amber-600 dark:text-amber-400"}):"unknown"===e?(0,s.jsx)("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}):(0,s.jsx)(o.uPM,{className:"size-3.5 text-muted-foreground/40"})}function M({step:e,environments:t,targetId:n,status:r,isNewestApplied:i,expanded:a,busy:d,editable:c=!0,onToggle:u,actions:h}){let[p,f]=(0,l.useState)("apply"),[g,j]=(0,l.useState)(!1),v="revert"===p?e.revertSql??"":e.applySql,b=(0,S.qb)(e.transaction),y=(0,S.TA)(e.transaction),k=[];async function w(){await (0,C.mw)(v),j(!0),window.setTimeout(()=>j(!1),1500)}return"drifted"===r&&k.push("This file changed after it was applied here, so it is no longer the migration that ran."),y&&k.push(y),(0,s.jsxs)("div",{className:"border-b last:border-b-0",children:[(0,s.jsxs)("div",{className:(0,N.cn)("flex h-10 items-center transition-colors hover:bg-muted/40",d&&"opacity-60"),children:[(0,s.jsxs)("button",{type:"button","aria-expanded":a,"aria-label":a?`Hide SQL for ${e.version}`:`Show SQL for ${e.version}`,onClick:u,className:"flex h-8 min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md px-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[(0,s.jsx)(o.nNJ,{className:(0,N.cn)("size-3.5 shrink-0 text-muted-foreground/70 transition-transform",a&&"rotate-90")}),(0,s.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:e.version}),(0,s.jsx)("span",{className:"min-w-0 truncate text-sm",children:e.name}),b&&(0,s.jsx)("span",{className:"shrink-0 rounded border border-amber-600/25 bg-amber-500/10 px-1.5 text-[10px] text-amber-700 dark:text-amber-400",children:b})]}),t.map(t=>{let r=t.connection.id===n;return(0,s.jsx)("span",{title:t.error?`${t.connection.name}: ${t.error}`:`${e.version} is ${A[t.status]} on ${t.connection.name}${t.entry?` — ${function(e){if(!e)return"";let t=new Date(e.appliedAt);return Number.isNaN(t.getTime())?e.appliedAt:t.toLocaleString()}(t.entry)}`:""}`,className:(0,N.cn)("flex h-10 shrink-0 items-center justify-center",R,r&&"bg-foreground/[0.04]"),children:(0,s.jsx)(E,{status:t.status})},t.connection.id)}),(0,s.jsxs)("div",{className:(0,N.cn)("flex shrink-0 items-center justify-end gap-1 pr-2 pl-1",z),children:["pending"===r&&(0,s.jsx)(m.$,{size:"xs",variant:"outline",disabled:d,onClick:h.onApplyThrough,children:"Apply"}),i&&e.revertSql&&(0,s.jsxs)(m.$,{size:"xs",variant:"ghost",disabled:d,onClick:h.onRevertThrough,children:[(0,s.jsx)(o.ij9,{"data-icon":"inline-start"}),"Revert"]}),(0,s.jsxs)(x.rI,{children:[(0,s.jsx)(x.ty,{render:(0,s.jsx)(m.$,{size:"icon-xs",variant:"ghost","aria-label":`Actions for ${e.version}`}),className:"cursor-pointer",children:(0,s.jsx)(o.YKd,{})}),(0,s.jsxs)(x.SQ,{align:"end",className:"min-w-56",children:[(0,s.jsx)(x._2,{disabled:d||"applied"===r,onClick:h.onApplyThrough,children:"Apply everything through here"}),(0,s.jsx)(x._2,{disabled:d||"applied"===r,onClick:h.onApplyOne,children:"Apply only this one"}),(0,s.jsx)(x._2,{disabled:d||"pending"===r||!e.revertSql,onClick:h.onRevertThrough,children:"Revert back through here"}),(0,s.jsx)(x.mB,{}),(0,s.jsxs)(x._2,{disabled:d||"applied"===r,onClick:h.onMarkApplied,children:[(0,s.jsx)(o.nXx,{}),"Mark as already applied"]}),(0,s.jsxs)(x._2,{disabled:d||"pending"===r,onClick:h.onMarkPending,children:[(0,s.jsx)(o.fJ4,{}),"Mark as not applied"]}),(0,s.jsx)(x.mB,{}),c&&(0,s.jsxs)(x._2,{onClick:h.onAttachRevert,children:[(0,s.jsx)(o.W4E,{}),e.revertSql?"Replace revert file…":"Add a revert file…"]}),(0,s.jsxs)(x._2,{onClick:()=>h.onOpenInEditor(v),children:[(0,s.jsx)(o.Uoo,{}),"Open ",p," SQL in editor"]}),(0,s.jsxs)(x._2,{onClick:()=>void w(),children:[(0,s.jsx)(o.hX7,{}),"Copy ",p," SQL"]}),c&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(x.mB,{}),(0,s.jsx)(x._2,{variant:"destructive",onClick:h.onRemove,children:"Remove from this set"})]})]})]})]})]}),a&&(0,s.jsxs)("div",{className:"border-t bg-muted/25",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[(0,s.jsx)($.x,{label:`SQL for ${e.version}`,value:p,onChange:f,options:[{value:"apply",label:"Apply"},{value:"revert",label:"Revert"}]}),(0,s.jsx)("span",{className:"min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:"revert"===p?e.revertPath??"no revert file":e.applyPath}),(0,s.jsxs)(m.$,{size:"xs",variant:"ghost",className:"ml-auto",onClick:()=>void w(),children:[g?(0,s.jsx)(o.wiW,{"data-icon":"inline-start"}):(0,s.jsx)(o.hX7,{"data-icon":"inline-start"}),g?"Copied":"Copy"]})]}),k.length>0&&(0,s.jsx)("ul",{className:"space-y-1 px-3 pb-2",children:k.map(e=>(0,s.jsxs)("li",{className:"flex gap-1.5 text-[11px] text-amber-700 dark:text-amber-400",children:[(0,s.jsx)(o.e5t,{className:"mt-px size-3 shrink-0"}),(0,s.jsx)("span",{children:e})]},e))}),v?(0,s.jsx)(C.os,{sql:v,className:"max-h-72 overflow-auto px-3 pb-3"}):(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 pb-3 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{children:"No revert file, so this one cannot be undone from here."}),c&&(0,s.jsxs)(m.$,{size:"xs",variant:"outline",onClick:h.onAttachRevert,children:[(0,s.jsx)(o.W4E,{"data-icon":"inline-start"}),"Add one"]})]})]})]})}function F({environments:e,targetId:t,onSelect:n}){let r=e.find(e=>e.connection.id===t);return r?(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"Running against"}),(0,s.jsxs)(x.rI,{children:[(0,s.jsxs)(x.ty,{disabled:e.length<2,className:"flex h-7 cursor-pointer items-center gap-1.5 rounded-lg border bg-background px-2 text-xs font-medium outline-none hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-default data-open:bg-muted/60",children:[(0,s.jsx)(w.F,{connection:r.connection}),(0,s.jsx)("span",{className:"max-w-32 truncate",children:r.connection.name})]}),(0,s.jsx)(x.SQ,{align:"start",className:"min-w-52",children:e.map(e=>(0,s.jsxs)(x._2,{onClick:()=>n(e.connection.id),className:e.connection.id===t?"font-medium":void 0,children:[(0,s.jsx)(w.F,{connection:e.connection}),(0,s.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.connection.name}),(0,s.jsxs)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:[e.summary.applied,"/",e.summary.total]})]},e.connection.id))})]})]}):null}function _({environments:e,targetId:t,caption:n,loading:r,onSelect:i,onCompare:a}){return(0,s.jsxs)("div",{className:"flex h-11 shrink-0 items-center border-b bg-muted/20",children:[(0,s.jsx)("span",{className:"min-w-0 flex-1 truncate px-3 text-xs text-muted-foreground",children:n}),e.map(e=>{let{connection:n,summary:a,ledger:l,error:o}=e,d=n.id===t;return(0,s.jsxs)("button",{type:"button",disabled:d,"aria-current":d?"true":void 0,title:d?`${n.name} is what Apply and Revert run against`:`Run against ${n.name} instead`,onClick:()=>i(n.id),className:(0,N.cn)("flex h-11 shrink-0 flex-col items-center justify-center gap-0.5 border-l text-[11px] outline-none",R,d?"cursor-default bg-foreground/[0.04] font-medium":"cursor-pointer text-muted-foreground hover:bg-muted/60 hover:text-foreground",r&&"opacity-60"),children:[(0,s.jsxs)("span",{className:"flex max-w-full items-center gap-1",children:[(0,s.jsx)(w.F,{connection:n,className:"size-1.5"}),(0,s.jsx)("span",{className:"truncate",children:n.name})]}),o?(0,s.jsx)("span",{className:"text-destructive",children:"unreachable"}):l?(0,s.jsxs)("span",{className:"tabular-nums text-muted-foreground/80",children:[a.applied,"/",a.total,a.drifted>0&&(0,s.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:" !"})]}):(0,s.jsx)("span",{className:"text-muted-foreground/70",children:"reading…"})]},n.id)}),(0,s.jsx)("div",{className:(0,N.cn)("flex shrink-0 items-center justify-end border-l pr-2 pl-1",z),children:e.length>1&&(0,s.jsx)(m.$,{size:"icon-xs",variant:"ghost",title:"Compare the two schemas","aria-label":"Compare schemas",onClick:()=>{let n=e.find(e=>e.connection.id!==t);n&&a(n.connection.id)},children:(0,s.jsx)(o.R4X,{})})})]})}var O=n(42763),q=n(60529),T=n(33807);function I({schema:e,found:t,onOpenChange:n,onSave:r}){let[i,a]=(0,l.useState)(e),o=i.trim(),d=(0,j.hD)(o),c=t.filter(e=>e.schema!==o);function u(){d&&(r(o),n(!1))}return(0,s.jsx)(O.lG,{open:!0,onOpenChange:n,children:(0,s.jsxs)(O.Cf,{className:"sm:max-w-md",children:[(0,s.jsxs)(O.c7,{children:[(0,s.jsx)(O.L3,{children:"Ledger schema"}),(0,s.jsx)(O.rr,{children:"Where each database keeps its record of what has run. Created on the first apply."})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)(T.J,{htmlFor:"ledger-schema",children:"Schema"}),(0,s.jsx)(q.p,{id:"ledger-schema",value:i,spellCheck:!1,autoComplete:"off","aria-invalid":o.length>0&&!d,onChange:e=>a(e.target.value),onKeyDown:e=>"Enter"===e.key&&u()}),(0,s.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:d?`${o}.${j.R9}`:"\xa0"}),o.length>0&&!d&&(0,s.jsx)("p",{className:"text-xs text-destructive",children:"Letters, digits and underscores only, starting with a letter or underscore."})]}),c.length>0&&(0,s.jsxs)("p",{className:"rounded-md border border-amber-600/25 bg-amber-500/8 px-3 py-2 text-xs",children:[c.map(e=>`${e.name} keeps its ledger in ${e.schema}`).join("; "),". That one stays where it is."]}),(0,s.jsxs)(O.Es,{children:[o!==j.aC&&(0,s.jsx)(m.$,{variant:"ghost",onClick:()=>a(j.aC),children:"Reset"}),(0,s.jsx)(m.$,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),(0,s.jsx)(m.$,{disabled:!d,onClick:u,children:"Save"})]})]})})}var D=n(42611),L=n(41069),B=n(77649),P=n(27013),G=n(18349);function V({initial:e,file:t,onOpenChange:n,onSave:r}){let[i,a]=(0,l.useState)(e),[o,d]=(0,l.useState)(!1),[c,u]=(0,l.useState)(null),x=i.trim()!==e.trim();async function h(e){if(e?.preventDefault(),x&&!o){d(!0),u(null);try{await r(i.trim()),n(!1)}catch(e){u(e instanceof Error?e.message:String(e))}finally{d(!1)}}}return(0,s.jsx)(O.lG,{open:!0,onOpenChange:e=>!o&&n(e),children:(0,s.jsx)(O.Cf,{className:"sm:max-w-lg",showCloseButton:!1,children:(0,s.jsxs)("form",{onSubmit:e=>void h(e),className:"flex flex-col gap-4",children:[(0,s.jsx)(O.c7,{children:(0,s.jsxs)("div",{className:"flex items-baseline gap-3",children:[(0,s.jsx)(O.L3,{children:"Note"}),t&&(0,s.jsx)("span",{className:"ml-auto truncate font-mono text-[11px] text-muted-foreground",title:"Written into the migration's folder, to commit with the SQL",children:t})]})}),(0,s.jsx)(G.T,{autoFocus:!0,"aria-label":"Note",value:i,maxLength:j.XG,placeholder:"Apply 0001–0007, deploy the app, then apply 0008.",className:"max-h-[50vh] min-h-32",onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&h()}}),c&&(0,s.jsx)("p",{className:"text-xs text-destructive",children:c}),(0,s.jsxs)(O.Es,{children:[(0,s.jsx)(m.$,{type:"button",variant:"ghost",disabled:o,onClick:()=>n(!1),children:"Cancel"}),(0,s.jsx)(m.$,{type:"submit",disabled:!x||o,children:o?"Saving…":"Save"})]})]})})})}var Q=n(83504),X=n(71612);function W({setId:e}){let t=(0,a.useRouter)(),{connection:n,tables:r}=(0,d.k)(),u=(0,y.jV)(e=>e.addFiles),w=(0,y.jV)(e=>e.renameSet),C=(0,y.jV)(e=>e.setNote),$=(0,y.jV)(e=>e.removeSet),S=(0,y.jV)(e=>e.removeStep),R=(0,y.jV)(e=>e.record),z=(0,y.jV)(e=>e.ledgerSchema),A=(0,y.jV)(e=>e.setLedgerSchema),E=(0,y.Ss)(e),{root:O}=(0,y.ox)(n.id),q=(0,X.y)((0,j.km)(e)?O:null),T=(0,j.km)(e)?q.data?.sets.find(t=>t.id===e)??null:E,G=!!T?.source,Z=(0,v.gz)(n.id),J=(0,k.En)(e=>e.setDraft),ee=(0,c.$C)(),[et,en]=(0,l.useState)("migrations"),[es,er]=(0,l.useState)([]),[ei,ea]=(0,l.useState)(null),[el,eo]=(0,l.useState)(null),[ed,ec]=(0,l.useState)(!1),[eu,em]=(0,l.useState)(!1),[ex,eh]=(0,l.useState)(null),[ep,ef]=(0,l.useState)(null),[eg,ej]=(0,l.useState)(!1),[ev,eb]=(0,l.useState)(!1),[ey,ek]=(0,l.useState)(!1),eN=(0,l.useRef)(null),ew=(0,l.useRef)(!1),eC=(0,l.useMemo)(()=>[n,...Z],[n,Z]),e$=eC.map(e=>e.url).join("|"),eS=(0,p.Y)(`ledgers:${z}:${e$}`,async e=>Object.fromEntries(await Promise.all(eC.map(async t=>{try{return[t.id,{ledger:await f.F.ledger(t.url,z,e),error:null}]}catch(n){if(e.aborted)throw n;return[t.id,{ledger:null,error:n instanceof Error?n.message:String(n)}]}})))),eR=eS.data?.[n.id]??null,ez=T?.name??"",eA=(0,l.useMemo)(()=>(0,g.Gf)(eR?.ledger,ez),[eR?.ledger,ez]),eE=(0,l.useMemo)(()=>eC.map(e=>{let t=eS.data?.[e.id]??null,n=(0,g.Gf)(t?.ledger,ez);return{connection:e,ledger:n,error:t?.error??null,summary:(0,g.eh)(T,n)}}),[eC,eS.data,T,ez]),eM=`/${encodeURIComponent(n.id)}/migrations`,eF=(0,y.jV)(e=>e.history),e_=(0,l.useMemo)(()=>(0,b.x)(eE.map(e=>({connection:e.connection,ledger:e.ledger})),eF).filter(e=>e.setName===ez),[eE,eF,ez]),eO=(0,g.eh)(T,eA),eq=(0,l.useMemo)(()=>(0,g.nb)(T,eA),[T,eA]),eT=(0,g.kB)(T,eA),eI=(0,l.useCallback)(t=>{eh(u(e,t.files)),en("migrations")},[u,e]),eD=(0,B.$)(eI);function eL(e,t,n=!1){(0!==t.steps.length||t.blockedBy)&&(eo(null),ea({...t,direction:e,recordOnly:n}))}function eB(e){return{steps:e,blockedBy:null}}async function eP(){if(!ei||!T)return;ew.current=!1,ec(!0);let e=ei.steps.map(e=>({version:e.version,name:e.name,status:"waiting"}));eo(e);let t=(t,n)=>{eo(e=e.map((e,s)=>s===t?{...e,...n}:e))},s=t=>{eo(e=e.map((e,n)=>n>=t&&"waiting"===e.status?{...e,status:"skipped"}:e))};for(let[e,r]of ei.steps.entries()){if(ew.current){s(e);break}let i="apply"===ei.direction?r.applySql:r.revertSql;if(!i&&!ei.recordOnly){t(e,{status:"failed",error:"No revert file for this migration."}),s(e+1);break}t(e,{status:"running"});try{let s=await f.F.migrate(n.url,{direction:ei.direction,version:r.version,name:r.name,checksum:r.checksum,setName:T.name,sql:i??"",revertSql:"apply"===ei.direction?r.revertSql:void 0,ledgerSchema:z,recordOnly:ei.recordOnly});t(e,{status:"ok",durationMs:s.durationMs}),R({setId:T.id,setName:T.name,connectionId:n.id,connectionName:n.name,direction:ei.direction,version:r.version,name:r.name,status:"ok",recorded:ei.recordOnly,durationMs:s.durationMs})}catch(a){let i=a instanceof Error?a.message:String(a);t(e,{status:"failed",error:i}),s(e+1),R({setId:T.id,setName:T.name,connectionId:n.id,connectionName:n.name,direction:ei.direction,version:r.version,name:r.name,status:"failed",durationMs:0,error:i});break}}ec(!1),eS.reload(),r.reload()}function eG(e){J(n.id,e),t.push(`/${encodeURIComponent(n.id)}/query`)}function eV(e){ee(e)}async function eQ(e){T&&(T.source?(await f.F.note(T.source.root,T.source.path,e),q.reload()):C(T.id,e))}async function eX(e){let t=e?.[0];ef(null),t&&ep&&T&&eh(u(T.id,[{path:`revert/${ep}_${t.name}`,text:await t.text()}]))}if(!T){let t=(0,j.km)(e)&&q.loading;return(0,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,s.jsx)(Y,{name:t?"Reading…":"Not found"}),(0,s.jsx)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-muted-foreground",children:t?(0,s.jsx)("p",{className:"text-sm",children:"Reading the folder…"}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"text-sm",children:q.error?q.error:(0,j.km)(e)?"That migration is not in the folder on the branch you have checked out.":"That migration is no longer here."}),(0,s.jsx)(i(),{href:eM,className:"text-foreground underline underline-offset-4",children:"All migrations"})]})})]})}let eW=(0,g.gj)(T,eA),eY=(0,g.e)(T,eA),eK=ed||eS.loading||q.loading;return(0,s.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",onDragOver:e=>{!G&&e.dataTransfer.types.includes("Files")&&(e.preventDefault(),em(!0))},children:[(0,s.jsxs)(Y,{name:T?.name??"",indexHref:eM,children:[T.source&&(0,s.jsxs)("span",{className:"flex min-w-0 items-center gap-1 text-[11px] text-muted-foreground",title:`Read from ${T.source.path}`,children:[(0,s.jsx)(o.WzY,{className:"size-3.5 shrink-0"}),(0,s.jsx)("span",{className:"max-w-48 truncate font-mono",children:T.source.path})]}),(0,s.jsx)(F,{environments:eE,targetId:n.id,onSelect:eV}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,s.jsx)(m.$,{size:"icon-sm",variant:"ghost",disabled:eS.loading||q.loading,"aria-label":"Refresh",title:G?"Re-read the files and every environment's ledger":"Re-read every environment's ledger",onClick:function(){eS.reload(),G&&q.reload()},children:(0,s.jsx)(o.oS8,{className:(0,N.cn)((eS.loading||q.loading)&&"animate-spin")})}),!G&&(0,s.jsxs)(m.$,{size:"sm",variant:"ghost",onClick:()=>em(!0),children:[(0,s.jsx)(o.FeY,{"data-icon":"inline-start"}),"Import"]}),(0,s.jsxs)(x.rI,{children:[(0,s.jsx)(x.ty,{render:(0,s.jsx)(m.$,{size:"icon-sm",variant:"ghost","aria-label":"More migration actions"}),className:"cursor-pointer",children:(0,s.jsx)(o.YKd,{})}),(0,s.jsxs)(x.SQ,{align:"end",className:"min-w-64",children:[(0,s.jsxs)(x._2,{disabled:eK||0===eW.steps.length,onClick:()=>eL("apply",eB(eW.steps),!0),children:[(0,s.jsx)(o.nXx,{}),"Mark ",eW.steps.length," as already applied"]}),(0,s.jsx)(x.mB,{}),(0,s.jsxs)(x._2,{disabled:eK||0===eY.steps.length,onClick:()=>eL("revert",eY),children:[(0,s.jsx)(o.ij9,{}),"Revert everything on ",n.name]}),(0,s.jsx)(x.mB,{}),(0,s.jsxs)(x._2,{onClick:()=>ek(!0),children:[(0,s.jsx)(o.UA_,{}),T.note?"Edit note":"Add note"]}),!G&&(0,s.jsxs)(x._2,{onClick:()=>eb(!0),children:[(0,s.jsx)(o.NOV,{}),"Rename"]}),(0,s.jsxs)(x._2,{onClick:()=>ej(!0),children:[(0,s.jsx)(o.ooN,{}),"Ledger table",(0,s.jsxs)("span",{className:"ml-auto pl-3 font-mono text-[11px] text-muted-foreground",children:[z,".",j.R9]})]}),!G&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(x.mB,{}),(0,s.jsx)(x._2,{variant:"destructive",onClick:function(){T&&($(T.id),t.push(eM))},children:"Forget this migration"})]})]})]}),(0,s.jsxs)(m.$,{size:"sm",disabled:eK||0===eW.steps.length,onClick:()=>eL("apply",eW),children:[(0,s.jsx)(o.eGB,{"data-icon":"inline-start"}),0===eW.steps.length?"Up to date":`Apply ${eW.steps.length} to ${n.name}`]})]})]}),ex&&(0,s.jsx)(U,{report:ex,onDismiss:()=>eh(null)}),eD.error&&(0,s.jsx)("p",{className:"border-b bg-destructive/5 px-4 py-1.5 text-xs text-destructive",children:eD.error}),"migrations"===et&&T.note&&(0,s.jsx)(K,{note:T.note,notePath:T.source?.notePath??null,onEdit:()=>ek(!0)}),(0,s.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:["history"===et?(0,s.jsx)(h.F,{className:"min-h-0 flex-1",children:(0,s.jsx)(D.H,{events:e_,connections:eC,loading:eS.loading})}):eR?.error?(0,s.jsx)("p",{className:"flex-1 px-4 py-6 font-mono text-xs text-destructive",children:eR.error}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(_,{environments:eE,targetId:n.id,caption:function(e,t){if(t&&0===e.total)return"Reading…";let n=`${e.total} migration${1===e.total?"":"s"}`;return e.foreign>0?`${n} \xb7 ${e.foreign} not in this folder`:n}(eO,eS.loading),loading:eS.loading,onSelect:eV,onCompare:function(e){v.lz.getState().setCompareTarget(n.id,e),t.push(`/${encodeURIComponent(n.id)}/diff`)}}),(0,s.jsxs)(h.F,{className:(0,N.cn)("min-h-0 flex-1",eS.loading&&"opacity-70"),children:[(T?.steps.length??0)===0&&!G&&(0,s.jsx)("div",{className:"p-6",children:(0,s.jsx)(B.k,{onFiles:eI,compact:!0})}),T.skipped.length>0&&G&&(0,s.jsxs)("div",{className:"border-b bg-muted/20 px-4 py-2 text-xs text-muted-foreground",children:[(0,s.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,s.jsx)(o.e5t,{className:"size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}),"Skipped ",T.skipped.length," file",1===T.skipped.length?"":"s"]}),(0,s.jsx)("ul",{className:"mt-1 space-y-0.5 pl-5 font-mono text-[11px]",children:T.skipped.map(e=>(0,s.jsx)("li",{children:e},e))})]}),(T?.steps??[]).map(e=>(0,s.jsx)(M,{step:e,targetId:n.id,status:(0,g.FY)(e,eA),environments:eE.map(t=>({connection:t.connection,status:(0,g.FY)(e,t.ledger),entry:(0,g.ay)(e,t.ledger),error:t.error})),isNewestApplied:eT?.version===e.version,expanded:es.includes(e.version),busy:eK,editable:!G,onToggle:()=>{var t;return t=e.version,void er(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},actions:{onApplyThrough:()=>eL("apply",(0,g.gj)(T,eA,e.version)),onApplyOne:()=>eL("apply",{steps:[e],blockedBy:null}),onRevertThrough:()=>eL("revert",(0,g.e)(T,eA,e.version)),onMarkApplied:()=>eL("apply",eB([e]),!0),onMarkPending:()=>eL("revert",eB([e]),!0),onAttachRevert:()=>{ef(e.version),window.requestAnimationFrame(()=>eN.current?.click())},onRemove:()=>T&&S(T.id,e.version),onOpenInEditor:eG}},e.version)),eq.length>0&&(0,s.jsx)(H,{entries:eq,connectionName:n.name})]})]}),eu&&!G&&(0,s.jsx)("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/85 p-6",onDragOver:e=>e.preventDefault(),onDragLeave:()=>em(!1),onDrop:e=>{e.preventDefault(),em(!1),eD.importFrom(e.dataTransfer)},children:(0,s.jsx)(B.k,{onFiles:eI,className:"w-full max-w-xl bg-background"})})]}),(0,s.jsx)(L.l,{pane:et,onPaneChange:en,historyCount:e_.length,migrationsLabel:"Files",caption:function({connectionName:e,summary:t,initialized:n,loading:s,foundIn:r,configuredSchema:i}){if(s&&null===n)return"Reading ledgers…";let a=[];return!1===n||t.pending>0?a.push(`${t.pending} of ${t.total} pending on ${e}`):a.push(`${e} is up to date`),t.drifted>0&&a.push(`${t.drifted} changed since applied`),r&&r!==i&&a.push(`ledger in ${r}`),a.join(" \xb7 ")}({connectionName:n.name,summary:eO,initialized:eA?.initialized??null,loading:eS.loading,foundIn:eA?.initialized?eA.schema:null,configuredSchema:z})}),(0,s.jsx)("input",{ref:eN,type:"file",accept:".sql",className:"sr-only",onChange:e=>{eX(e.target.files),e.target.value=""}}),(0,s.jsx)(P.K,{open:ev,title:"Rename migration",initial:T.name,submitLabel:"Rename",onOpenChange:eb,onSubmit:function(e){T&&w(T.id,e)}}),ey&&(0,s.jsx)(V,{initial:T.note??"",file:T.source?T.source.notePath?.split(/[\\/]/).at(-1)??"README.md":null,onOpenChange:ek,onSave:eQ}),eg&&(0,s.jsx)(I,{schema:z,found:eE.filter(e=>e.ledger?.initialized).map(e=>({name:e.connection.name,schema:e.ledger?.schema??z})),onOpenChange:ej,onSave:e=>{A(e),eS.reload()}}),ei&&(0,s.jsx)(Q.I,{open:!0,direction:ei.direction,connection:n,steps:ei.steps,blockedBy:ei.blockedBy,progress:el,running:ed,recordOnly:ei.recordOnly??!1,note:T.note,onRun:()=>void eP(),onStop:()=>{ew.current=!0},onClose:function(){ed||(ea(null),eo(null))}})]})}function Y({name:e,indexHref:t,children:n}){let r=(0,s.jsx)(o.olY,{className:"size-4 shrink-0 text-muted-foreground"});return(0,s.jsxs)(u.X,{children:[t?(0,s.jsx)(i(),{href:t,title:"All migrations","aria-label":"All migrations",className:"flex size-6 shrink-0 items-center justify-center rounded-md outline-none hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring/60",children:r}):r,(0,s.jsx)("span",{className:"min-w-0 truncate font-medium",children:e}),n]})}function K({note:e,notePath:t,onEdit:n}){return(0,s.jsxs)("button",{type:"button",title:t?`${t} \xb7 click to edit`:"Click to edit",onClick:n,className:"group flex w-full cursor-pointer items-start gap-2 border-b px-4 py-2.5 text-left text-xs outline-none hover:bg-muted/30 focus-visible:bg-muted/30",children:[(0,s.jsx)(o.UA_,{className:"mt-px size-3.5 shrink-0 text-muted-foreground"}),(0,s.jsx)("span",{className:"max-h-40 min-w-0 flex-1 overflow-y-auto whitespace-pre-wrap break-words",children:e}),(0,s.jsx)(o.NOV,{className:"mt-px size-3.5 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100"})]})}function U({report:e,onDismiss:t}){let n=[];return e.added>0&&n.push(`added ${e.added}`),e.updated>0&&n.push(`updated ${e.updated}`),e.reverts>0&&n.push(`${e.reverts} revert file${1===e.reverts?"":"s"}`),(0,s.jsxs)("div",{className:"flex items-start gap-2 border-b bg-muted/30 px-4 py-1.5 text-xs",children:[(0,s.jsxs)("span",{className:"min-w-0 flex-1",children:[n.length>0?`Imported: ${n.join(", ")}`:"Nothing new in those files",e.skipped.length>0&&(0,s.jsxs)("span",{className:"text-muted-foreground",children:[" ","\xb7 skipped ",e.skipped.slice(0,2).join(", "),e.skipped.length>2&&` and ${e.skipped.length-2} more`]})]}),(0,s.jsx)(m.$,{size:"xs",variant:"ghost",onClick:t,children:"Dismiss"})]})}function H({entries:e,connectionName:t}){return(0,s.jsxs)("div",{className:"border-t bg-muted/20",children:[(0,s.jsxs)("p",{className:"flex items-center gap-2 px-4 py-2 text-xs text-muted-foreground",children:[(0,s.jsx)(o.e5t,{className:"size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}),"Applied on ",t,", not in this folder"]}),e.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-2 px-4 py-1.5 text-xs opacity-70",children:[(0,s.jsx)(E,{status:"applied"}),(0,s.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground",children:e.version}),(0,s.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.name||"—"}),(0,s.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:new Date(e.appliedAt).toLocaleString()})]},e.version))]})}}},e=>{e.O(0,[4506,1731,8026,4730,8361,8322,6090,7709,3732,8441,3794,7358],()=>e(e.s=52310)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9820],{7412:(e,t,n)=>{"use strict";n.d(t,{L:()=>i});var s=n(95155),r=n(13267),a=n(40980);function i({trailing:e,className:t,...n}){return(0,s.jsxs)("div",{className:(0,a.cn)("flex h-8 items-center gap-1.5 rounded-lg px-2 text-muted-foreground transition-colors focus-within:bg-muted/60 hover:bg-muted/60",t),children:[(0,s.jsx)(r.TfF,{className:"size-3.5 shrink-0"}),(0,s.jsx)("input",{type:"text",spellCheck:!1,autoComplete:"off",...n,className:"h-full min-w-0 flex-1 bg-transparent text-[0.8rem] text-foreground outline-none placeholder:text-muted-foreground"}),e]})}},28330:(e,t,n)=>{Promise.resolve().then(n.bind(n,69063))},69063:(e,t,n)=>{"use strict";n.d(t,{MigrationsIndex:()=>V});var s=n(95155),r=n(98500),a=n.n(r),i=n(73321),l=n(12115),o=n(13267),d=n(72194),c=n(36331),m=n(17491),h=n(89239),u=n(72264),x=n(35942),p=n(7412),g=n(87364),f=n(27529),j=n(9385),v=n(62417),b=n(74590),N=n(79668),y=n(40980),k=n(42611),w=n(20642),$=n(77649),C=n(27013),S=n(41069),z=n(42763),F=n(83504);let M=[{verdict:"applied",title:"Already there",hint:"Everything these create or change is in the database.",preselected:!0},{verdict:"partial",title:"Partly there",hint:"Some of what these do is in the database and some is not — often a later migration changed it again.",preselected:!1},{verdict:"unknown",title:"Leaves no trace",hint:"Data changes, seeds, and grants cannot be seen in the schema. Include them if you know they ran.",preselected:!1},{verdict:"pending",title:"Not there",hint:"Nothing these do is in the database. Marking these hides work that still needs to run.",preselected:!1}];function R(e){return`${e.setName}\0${e.version}`}function E({connection:e,ledgerSchema:t,plan:n,onDone:r,onOpenChange:a}){let[i,c]=(0,l.useState)(null),[m,u]=(0,l.useState)(null),[x,p]=(0,l.useState)(new Set),[g,j]=(0,l.useState)([]),[v,b]=(0,l.useState)(!1),[N,k]=(0,l.useState)(null),[w,$]=(0,l.useState)(null);(0,l.useEffect)(()=>{let t=new AbortController;return f.F.detect(e.url,n.entries.map(e=>({setName:e.setName,version:e.version,sql:e.applySql})),t.signal).then(({results:e})=>{c(e);let t=new Set;for(let n of e)M.find(e=>e.verdict===n.verdict)?.preselected&&t.add(R(n));p(t)}).catch(e=>{t.signal.aborted||u(e instanceof Error?e.message:String(e))}),()=>t.abort()},[e.url,n.entries]);let C=(0,l.useMemo)(()=>{if(!i)return[];let e=new Map(n.entries.map(e=>[R(e),e]));return M.map(t=>({verdict:t.verdict,title:t.title,hint:t.hint,entries:i.filter(e=>e.verdict===t.verdict).flatMap(t=>{let n=e.get(R(t));return n?[{entry:n,result:t}]:[]})})).filter(e=>e.entries.length>0)},[i,n.entries]),S=n.entries.filter(e=>x.has(R(e)));async function I(n){b(!0),$(null);try{k(await f.F.adopt(e.url,{ledgerSchema:t,entries:n})),r()}catch(e){$(e instanceof Error?e.message:String(e))}finally{b(!1)}}let O=!i&&!m;return(0,s.jsx)(z.lG,{open:!0,onOpenChange:e=>!v&&a(e),children:(0,s.jsxs)(z.Cf,{className:"sm:max-w-xl",children:[(0,s.jsxs)(z.c7,{children:[(0,s.jsx)(z.L3,{children:N?`Marked ${N.recorded} as applied`:O?`Checking ${e.name}…`:`Mark as already applied on ${e.name}`}),(0,s.jsx)(z.rr,{children:(0,s.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[(0,s.jsx)("span",{children:N?"Recorded on":"Records on"}),(0,s.jsx)(d.F,{connection:e}),(0,s.jsx)("span",{className:"font-medium text-foreground",children:e.name}),(0,s.jsx)("span",{className:"font-mono text-[11px]",children:(0,F.p)(e.url)})]})})]}),N?(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:N.existing>0?`${N.existing} were already in the ledger and were left as they were.`:"Every one of them was new to the ledger."}):O?(0,s.jsxs)("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,s.jsx)(o.gnh,{className:"size-3.5 animate-spin"}),"Reading the schema to see which of the ",n.entries.length," have already run…"]}):m?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"max-h-32 overflow-auto rounded-md border border-destructive/25 bg-destructive/5 px-3 py-2 font-mono text-[11px] whitespace-pre-wrap text-destructive",children:m}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:["The check could not run. You can still mark all ",n.entries.length," as applied if you know the database already has these changes."]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"max-h-80 overflow-y-auto rounded-md border",children:C.map(e=>{let t=e.entries.filter(({entry:e})=>x.has(R(e))).length,n=g.includes(e.verdict);return(0,s.jsxs)("div",{className:"border-b last:border-b-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2",children:[(0,s.jsx)("input",{type:"checkbox","aria-label":`Include ${e.title}`,className:"size-3.5 cursor-pointer accent-primary",checked:t===e.entries.length,ref:n=>{n&&(n.indeterminate=t>0&&t<e.entries.length)},onChange:t=>{var n;return n=t.target.checked,void p(t=>{let s=new Set(t);for(let{entry:t}of e.entries)n?s.add(R(t)):s.delete(R(t));return s})}}),(0,s.jsxs)("button",{type:"button","aria-expanded":n,onClick:()=>{var t;return t=e.verdict,void j(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 text-left",children:[(0,s.jsx)(o.nNJ,{className:(0,y.cn)("size-3.5 shrink-0 text-muted-foreground/70 transition-transform",n&&"rotate-90")}),(0,s.jsx)("span",{className:"text-sm",children:e.title}),(0,s.jsxs)("span",{className:"tabular-nums text-xs text-muted-foreground",children:[t,"/",e.entries.length]})]}),(0,s.jsx)(q,{verdict:e.verdict})]}),!n&&(0,s.jsx)("p",{className:"px-9 pb-2 text-[11px] text-muted-foreground",children:e.hint}),n&&(0,s.jsxs)("div",{className:"bg-muted/25",children:[(0,s.jsx)("p",{className:"px-9 py-1.5 text-[11px] text-muted-foreground",children:e.hint}),e.entries.map(({entry:e,result:t})=>{let n=t.evidence.filter(e=>!e.satisfied),r=t.evidence.find(e=>e.note)?.note;return(0,s.jsxs)("label",{className:"flex cursor-pointer items-start gap-2 border-t px-3 py-1.5 text-xs hover:bg-muted/40",children:[(0,s.jsx)("input",{type:"checkbox",className:"mt-0.5 size-3.5 cursor-pointer accent-primary",checked:x.has(R(e)),onChange:()=>{p(t=>{let n=new Set(t),s=R(e);return n.has(s)?n.delete(s):n.add(s),n})}}),(0,s.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"shrink-0 text-muted-foreground",children:e.setName}),(0,s.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground",children:e.version}),(0,s.jsx)("span",{className:"min-w-0 truncate",children:e.name})]}),(n.length>0||r)&&(0,s.jsxs)("span",{className:"mt-0.5 block truncate text-[11px] text-muted-foreground",children:[n.length>0&&(0,s.jsxs)(s.Fragment,{children:["Missing: ",n.slice(0,2).map(e=>e.description).join(", "),n.length>2&&` and ${n.length-2} more`]}),n.length>0&&r&&" \xb7 ",r]})]})]},R(e))})]})]},e.verdict)})}),(0,s.jsxs)("p",{className:"rounded-md border border-amber-600/25 bg-amber-500/8 px-3 py-2 text-xs",children:[(0,s.jsx)("span",{className:"font-medium",children:"No SQL runs."})," Only the ledger on"," ",e.name," changes, in one transaction. Rows already there are not touched."]})]}),w&&(0,s.jsx)("p",{className:"max-h-32 overflow-auto rounded-md border border-destructive/25 bg-destructive/5 px-3 py-2 font-mono text-[11px] whitespace-pre-wrap text-destructive",children:w}),(0,s.jsx)(z.Es,{children:N?(0,s.jsx)(h.$,{onClick:()=>a(!1),children:"Close"}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.$,{variant:"outline",disabled:v,onClick:()=>a(!1),children:"Cancel"}),m?(0,s.jsx)(h.$,{disabled:v,onClick:()=>void I(n.entries),children:v?"Marking…":`Mark all ${n.entries.length} as applied`}):(0,s.jsx)(h.$,{disabled:v||O||0===S.length,onClick:()=>void I(S),children:v?"Marking…":`Mark as applied (${S.length})`})]})})]})})}function q({verdict:e}){return"applied"===e?(0,s.jsx)(o.wiW,{className:"size-4 shrink-0 text-emerald-600 dark:text-emerald-400"}):"partial"===e?(0,s.jsx)(o.e5t,{className:"size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}):"pending"===e?(0,s.jsx)(o.e5t,{className:"size-3.5 shrink-0 text-destructive"}):(0,s.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"})}var I=n(60529),O=n(33807);function A({root:e,environmentNames:t,onOpenChange:n,onSave:r}){let[a,i]=(0,l.useState)(e??""),o=a.trim(),d=o.startsWith("/")||o.startsWith("~")||/^[A-Za-z]:[\\/]/.test(o);function c(){o&&d&&(r(o),n(!1))}return(0,s.jsx)(z.lG,{open:!0,onOpenChange:n,children:(0,s.jsxs)(z.Cf,{className:"sm:max-w-lg",children:[(0,s.jsxs)(z.c7,{children:[(0,s.jsx)(z.L3,{children:"Migrations folder"}),(0,s.jsxs)(z.rr,{children:["A folder on this computer. Each folder inside it that holds .sql files is one migration, read fresh from disk every time — whatever branch is checked out is what shows. ",t.join(", ")," will all read from it."]})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)(O.J,{htmlFor:"repo-root",children:"Path"}),(0,s.jsx)(I.p,{id:"repo-root",value:a,placeholder:"~/code/app/src/lib/supabase/migrations",spellCheck:!1,autoComplete:"off",autoFocus:!0,"aria-invalid":o.length>0&&!d,onChange:e=>i(e.target.value),onKeyDown:e=>"Enter"===e.key&&c()}),o.length>0&&!d&&(0,s.jsx)("p",{className:"text-xs text-destructive",children:"An absolute path, or one starting with ~."})]}),(0,s.jsxs)(z.Es,{children:[e&&(0,s.jsx)(h.$,{variant:"ghost",className:"mr-auto",onClick:function(){r(null),n(!1)},children:"Stop reading from disk"}),(0,s.jsx)(h.$,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),(0,s.jsx)(h.$,{disabled:!o||!d,onClick:c,children:"Save"})]})]})})}var L=n(71612);function V(){let e=(0,i.useRouter)(),{connection:t}=(0,c.k)(),n=(0,N.jV)(e=>e.sets),r=(0,N.jV)(e=>e.createSet),a=(0,N.jV)(e=>e.adoptSet),d=(0,N.jV)(e=>e.addFiles),p=(0,N.jV)(e=>e.removeSet),z=(0,N.jV)(e=>e.ledgerSchema),F=(0,N.jV)(e=>e.history),M=(0,b.gz)(t.id),[R,q]=(0,l.useState)("migrations"),[I,O]=(0,l.useState)(null),[V,_]=(0,l.useState)(null),[U,W]=(0,l.useState)(!1),[D,T]=(0,l.useState)(!1),[G,H]=(0,l.useState)(null),K=(0,l.useMemo)(()=>[t,...M],[t,M]),J=K.map(e=>e.url).join("|"),{scope:X,root:Z}=(0,N.ox)(t.id),ee=(0,N.jV)(e=>e.setRepoRoot),et=(0,N.kG)(X),en=(0,N.jV)(e=>e.setListFilter),es=(0,L.y)(Z),er=(0,l.useMemo)(()=>[...es.data?.sets??[]].sort((e,t)=>t.importedAt-e.importedAt),[es.data]),ea=(0,g.Y)(`ledgers:${z}:${J}`,async e=>Object.fromEntries(await Promise.all(K.map(async t=>{try{return[t.id,{ledger:await f.F.ledger(t.url,z,e),error:null}]}catch(n){if(e.aborted)throw n;return[t.id,{ledger:null,error:n instanceof Error?n.message:String(n)}]}})))),ei=(0,l.useMemo)(()=>(0,j.x)(K.map(e=>({connection:e,ledger:ea.data?.[e.id]?.ledger??null})),F),[K,ea.data,F]),el=`/${encodeURIComponent(t.id)}/migrations`,eo=(0,l.useCallback)(t=>{let n=r(t.name);d(n,t.files),e.push(`${el}/${encodeURIComponent(n)}`)},[r,d,e,el]);async function ed(t){O(t),_(null);try{let n=await Promise.all(K.map(async e=>{try{return{read:await f.F.ledger(e.url,z,void 0,!0),error:null}}catch(e){return{read:null,error:e instanceof Error?e.message:String(e)}}})),s=n.find(e=>e.error);if(s?.error)return void _(s.error);let r=n.some(e=>e.read&&void 0===e.read.withSql),i=new Map;for(let{read:e}of n)for(let n of e?.entries??[]){if(n.setName.trim()!==t)continue;let e=i.get(n.version);e?.applySql||i.set(n.version,n)}let{set:l,missing:o}=(0,w.wQ)(t,[...i.values()]);if(0===l.steps.length)return void _(r?"The YTDB running on your machine is older than this page and cannot send stored SQL. Restart it with `npx @theobourgeois/ytdb@latest`.":`${t} was applied before YTDB stored SQL, so it cannot be rebuilt. Drop its folder instead.`);a(l),o.length>0&&_(`Rebuilt ${l.steps.length} of ${l.steps.length+o.length}. No SQL was stored for ${o.join(", ")}.`),e.push(`${el}/${encodeURIComponent(l.id)}`)}catch(e){_(e instanceof Error?e.message:String(e))}finally{O(null)}}let ec=(0,l.useMemo)(()=>[...n].sort((e,t)=>t.importedAt-e.importedAt),[n]),em=(0,l.useMemo)(()=>(0,v.lF)(K.map(e=>({connection:e,ledger:ea.data?.[e.id]?.ledger??null})),[...er,...n].map(e=>e.name)),[K,ea.data,er,n]),eh=(0,l.useMemo)(()=>{let e=ea.data?.[t.id]?.ledger??null,n=[],s=0;if(!e)return{sets:0,entries:n};for(let t of er){let r=(0,v.gj)(t,(0,v.Gf)(e,t.name));if(0!==r.steps.length)for(let e of(s+=1,r.steps))n.push({setName:t.name,version:e.version,name:e.name,checksum:e.checksum,applySql:e.applySql,revertSql:e.revertSql})}return{sets:s,entries:n}},[ea.data,t.id,er]),eu=ea.loading||es.loading,ex=0===er.length&&0===n.length&&0===em.length,ep=(0,l.useCallback)(e=>K.map(t=>({connection:t,summary:(0,v.eh)(e,ea.data?.[t.id]?.ledger??null),read:!!ea.data?.[t.id]?.ledger,error:ea.data?.[t.id]?.error??null})),[K,ea.data]),eg=(0,l.useCallback)(e=>(0,v.yy)(e,ep(e).map(e=>({connectionId:e.connection.id,summary:e.summary,read:e.read})),et),[ep,et]),ef=(0,l.useMemo)(()=>er.filter(eg),[er,eg]),ej=(0,l.useMemo)(()=>ec.filter(eg),[ec,eg]),ev=""!==et.query.trim()||"all"!==et.status,eb=er.length+ec.length-ef.length-ej.length;return(0,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,s.jsxs)(m.X,{children:[(0,s.jsx)(o.olY,{className:"size-4 shrink-0 text-muted-foreground"}),(0,s.jsx)("span",{className:"font-medium",children:"Migrations"}),Z&&(0,s.jsx)(Y,{root:Z,git:es.data?.git??null,onEdit:()=>T(!0)}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,s.jsx)(h.$,{size:"icon-sm",variant:"ghost",disabled:eu,"aria-label":"Refresh",title:Z?"Re-read the folder and every environment's ledger":"Re-read every environment's ledger",onClick:function(){ea.reload(),es.reload()},children:(0,s.jsx)(o.oS8,{className:(0,y.cn)(eu&&"animate-spin")})}),!Z&&(0,s.jsxs)(h.$,{size:"sm",variant:"ghost",onClick:()=>T(!0),children:[(0,s.jsx)(o.WzY,{"data-icon":"inline-start"}),"Read from a folder"]}),(0,s.jsxs)(h.$,{size:"sm",variant:"ghost",onClick:()=>W(!0),children:[(0,s.jsx)(o.enO,{"data-icon":"inline-start"}),"New migration"]}),(Z||n.length>0)&&(0,s.jsxs)(u.rI,{children:[(0,s.jsx)(u.ty,{render:(0,s.jsx)(h.$,{size:"icon-sm",variant:"ghost","aria-label":"More migration actions"}),className:"cursor-pointer",children:(0,s.jsx)(o.YKd,{})}),(0,s.jsxs)(u.SQ,{align:"end",className:"min-w-72",children:[Z&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(u._2,{disabled:eu||0===eh.entries.length,onClick:()=>H(eh),children:[(0,s.jsx)(o.nXx,{}),"Mark everything as applied on ",t.name,(0,s.jsx)("span",{className:"ml-auto pl-3 font-mono text-[11px] text-muted-foreground",children:eh.entries.length})]}),(0,s.jsx)(u.mB,{}),(0,s.jsxs)(u._2,{onClick:()=>T(!0),children:[(0,s.jsx)(o.WzY,{}),"Change folder…"]})]}),n.length>0&&(0,s.jsxs)(s.Fragment,{children:[Z&&(0,s.jsx)(u.mB,{}),(0,s.jsxs)(u._2,{variant:"destructive",onClick:function(){for(let e of n)p(e.id)},children:["Forget ",n.length," imported migration",1===n.length?"":"s"]})]})]})]})]})]}),es.error&&(0,s.jsxs)("p",{className:"flex items-start gap-2 border-b bg-destructive/5 px-4 py-1.5 text-xs text-destructive",children:[(0,s.jsx)(o.e5t,{className:"mt-px size-3.5 shrink-0"}),(0,s.jsx)("span",{className:"min-w-0 flex-1",children:es.error}),(0,s.jsx)(h.$,{size:"xs",variant:"ghost",onClick:()=>T(!0),children:"Change folder"})]}),"history"===R?(0,s.jsx)(x.F,{className:"min-h-0 flex-1",children:(0,s.jsx)(k.H,{events:ei,connections:K,loading:ea.loading})}):ex&&Z&&es.loading?(0,s.jsxs)("p",{className:"px-4 py-6 text-sm text-muted-foreground",children:["Reading ",Z,"…"]}):ex&&Z?(0,s.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 p-6 text-center",children:[(0,s.jsxs)("p",{className:"text-sm",children:["Nothing in ",Z," yet."]}),(0,s.jsx)("p",{className:"max-w-md text-xs text-muted-foreground",children:"Each folder inside it that holds .sql files becomes a migration here, the moment it exists on the branch you have checked out."})]}):ex?(0,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-4 p-6",children:[(0,s.jsx)($.k,{onFiles:eo,className:"w-full max-w-xl"}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Or"," ",(0,s.jsx)("button",{type:"button",className:"cursor-pointer underline underline-offset-4 hover:text-foreground",onClick:()=>T(!0),children:"read straight from a folder on this computer"}),", so nothing has to be imported."]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Q,{filter:et,environments:K,hidden:eb,onChange:e=>en(X,e)}),(0,s.jsxs)(x.F,{className:"min-h-0 flex-1",children:[ef.map(e=>(0,s.jsx)(P,{set:e,href:`${el}/${encodeURIComponent(e.id)}`,environments:ep(e)},e.id)),ej.length>0&&Z&&(0,s.jsx)("p",{className:"border-b px-4 pt-2.5 pb-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",title:"Imported into this browser rather than read from the folder.",children:"Imported"}),ej.map(e=>(0,s.jsx)(P,{set:e,href:`${el}/${encodeURIComponent(e.id)}`,environments:ep(e)},e.id)),ev&&0===ef.length&&0===ej.length&&(0,s.jsxs)("p",{className:"px-4 py-6 text-sm text-muted-foreground",children:["Nothing matches."," ",(0,s.jsx)("button",{type:"button",className:"cursor-pointer underline underline-offset-4 hover:text-foreground",onClick:()=>en(X,{query:"",status:"all"}),children:"Clear the filter"})]}),em.length>0&&(0,s.jsxs)("div",{className:"border-b bg-muted/20",children:[(0,s.jsx)("p",{className:"px-4 pt-2.5 pb-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",title:"Applied to a database from elsewhere. The SQL is kept in its ledger, so it opens without the folder.",children:"In the ledger only"}),em.map(e=>(0,s.jsx)(B,{migration:e,busy:I===e.name,onOpen:()=>void ed(e.name)},e.name)),V&&(0,s.jsx)("p",{className:"px-4 pt-1 pb-2 text-xs text-destructive",children:V})]}),!Z&&(0,s.jsx)("div",{className:"p-4",children:(0,s.jsx)($.k,{onFiles:eo,compact:!0,className:"w-full"})})]})]}),(0,s.jsx)(S.l,{caption:function(e,t,n,s){if(s&&0===e)return"Reading folder…";if(0===e&&0===t&&0===n)return"No migrations yet";let r=[];return e>0&&r.push(`${e} migration${1===e?"":"s"} on disk`),t>0&&r.push(`${t} imported`),n>0&&r.push(`${n} in the ledger only`),r.join(" \xb7 ")}(er.length,n.length,em.length,null!==Z&&es.loading),pane:R,onPaneChange:q,historyCount:ei.length}),D&&(0,s.jsx)(A,{root:Z,environmentNames:K.map(e=>e.name),onOpenChange:T,onSave:e=>ee(X,e)}),G&&(0,s.jsx)(E,{connection:t,ledgerSchema:z,plan:G,onDone:()=>ea.reload(),onOpenChange:e=>!e&&H(null)}),(0,s.jsx)(C.K,{open:U,title:"New migration",submitLabel:"Create",onOpenChange:W,onSubmit:function(t){let n=r(t);e.push(`${el}/${encodeURIComponent(n)}`)}})]})}let _={all:"All",pending:"Not fully applied",untouched:"Not started anywhere",complete:"Applied everywhere"};function Q({filter:e,environments:t,hidden:n,onChange:r}){let a="all"!==e.status;return(0,s.jsxs)("div",{className:"flex items-center gap-1 border-b px-2 py-1",children:[(0,s.jsx)(p.L,{value:e.query,onChange:e=>r({query:e.target.value}),placeholder:"Search migrations","aria-label":"Search migrations",className:"min-w-0 flex-1",trailing:e.query?(0,s.jsx)("button",{type:"button","aria-label":"Clear search",className:"cursor-pointer rounded p-0.5 hover:text-foreground",onClick:()=>r({query:""}),children:(0,s.jsx)(o.yBK,{className:"size-3.5"})}):null}),(0,s.jsxs)(u.rI,{children:[(0,s.jsxs)(u.ty,{render:(0,s.jsx)(h.$,{size:"sm",variant:a?"outline":"ghost"}),className:"cursor-pointer",children:[function(e,t){if(e.startsWith("pending:")){let n=t.find(t=>t.id===e.slice(8));return n?`Pending on ${n.name}`:_.pending}return _[e]}(e.status,t),(0,s.jsx)(o.RQe,{"data-icon":"inline-end"})]}),(0,s.jsx)(u.SQ,{align:"end",className:"min-w-56",children:(0,s.jsxs)(u.Hr,{value:e.status,onValueChange:e=>r({status:e}),children:[Object.keys(_).map(e=>(0,s.jsx)(u.Ht,{value:e,children:_[e]},e)),t.length>1&&(0,s.jsx)(u.mB,{}),t.length>1&&t.map(e=>(0,s.jsxs)(u.Ht,{value:`pending:${e.id}`,children:[(0,s.jsx)(d.F,{connection:e,className:"size-1.5"}),"Pending on ",e.name]},e.id))]})})]}),n>0&&(0,s.jsxs)("span",{className:"shrink-0 pr-1 text-[11px] tabular-nums text-muted-foreground",children:[n," hidden"]})]})}function Y({root:e,git:t,onEdit:n}){var r;let a;return(0,s.jsxs)("button",{type:"button",title:`Reading from ${e}${t?` on ${t.branch} (${t.commit}${t.dirty?", uncommitted changes":""})`:""}. Click to change.`,onClick:n,className:"flex min-w-0 cursor-pointer items-center gap-1.5 rounded-md px-1.5 py-0.5 text-xs text-muted-foreground outline-none hover:bg-muted/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60",children:[(0,s.jsx)(o.WzY,{className:"size-3.5 shrink-0"}),(0,s.jsx)("span",{className:"max-w-64 truncate font-mono text-[11px]",children:(a=(r=e).split(/[\/]/).filter(Boolean)).length>2?`…/${a.slice(-2).join("/")}`:r}),t&&(0,s.jsxs)("span",{className:"shrink-0 rounded border px-1.5 font-mono text-[10px]",children:[t.branch,t.dirty&&"*"]})]})}function P({set:e,href:t,environments:n}){return(0,s.jsxs)(a(),{href:t,className:"flex items-center gap-3 border-b px-4 py-3 outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"flex min-w-0 items-center gap-1.5 text-sm font-medium",children:[(0,s.jsx)("span",{className:"truncate",children:e.name}),e.note&&(0,s.jsx)("span",{title:e.note,className:"shrink-0 text-muted-foreground",children:(0,s.jsx)(o.UA_,{className:"size-3.5"})})]}),(0,s.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[0===e.steps.length?"No files yet":`${e.steps.length} migration${1===e.steps.length?"":"s"}`,e.steps.length>0&&` \xb7 ${e.steps[0].version}–${e.steps.at(-1)?.version}`,e.skipped.length>0&&` \xb7 ${e.skipped.length} skipped`]})]}),(0,s.jsx)("div",{className:"flex shrink-0 items-center gap-1.5",children:n.map(e=>(0,s.jsx)(U,{environment:e},e.connection.id))}),(0,s.jsx)(o.nNJ,{className:"size-4 shrink-0 text-muted-foreground/60"})]})}function B({migration:e,busy:t,onOpen:n}){return(0,s.jsxs)("div",{className:"flex items-center gap-3 border-t px-4 py-2.5 first:border-t-0",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"truncate text-sm",children:e.name}),(0,s.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[e.total," migration",1===e.total?"":"s",e.versions.length>0&&` \xb7 ${e.versions[0]}–${e.versions.at(-1)}`]})]}),(0,s.jsx)("div",{className:"flex shrink-0 items-center gap-1.5",children:e.applied.map(t=>(0,s.jsxs)("span",{className:"flex h-6 items-center gap-1.5 rounded-lg border border-dashed px-2 text-[11px] text-muted-foreground",children:[(0,s.jsx)("span",{className:"max-w-24 truncate",children:t.connectionName}),(0,s.jsxs)("span",{className:"tabular-nums",children:[t.count,"/",e.total]})]},t.connectionId))}),(0,s.jsx)(h.$,{size:"xs",variant:"outline",disabled:t,onClick:n,children:t?"Opening…":"Open"})]})}function U({environment:e}){let{connection:t,summary:n,read:r,error:a}=e,i=r&&n.total>0&&0===n.pending&&0===n.drifted,l=r&&0===n.applied&&0===n.drifted;return(0,s.jsxs)("span",{title:a?`${t.name}: ${a}`:r?`${t.name}: ${n.applied} of ${n.total} applied`:`${t.name}: reading…`,className:(0,y.cn)("flex h-6 items-center gap-1.5 rounded-lg border px-2 text-[11px]",a&&"border-destructive/30 text-destructive",i&&"border-emerald-600/30 bg-emerald-500/10",!a&&!i&&!l&&"border-amber-600/30 bg-amber-500/10",l&&"text-muted-foreground"),children:[(0,s.jsx)(d.F,{connection:t,className:"size-1.5"}),(0,s.jsx)("span",{className:"max-w-24 truncate",children:t.name}),(0,s.jsx)("span",{className:"tabular-nums",children:a?"—":r?`${n.applied}/${n.total}`:"…"})]})}}},e=>{e.O(0,[4506,1731,8026,4730,8361,8322,6090,7709,3732,8441,3794,7358],()=>e(e.s=28330)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2336],{4108:(e,t,n)=>{Promise.resolve().then(n.bind(n,21890))},20185:(e,t,n)=>{"use strict";function r(e){let t=e.split("/").filter(Boolean).map(decodeURIComponent);if(0===t.length)return{kind:"home"};let[n,r,o]=t;if(1===t.length)return{kind:"connection",connectionId:n};if(2===t.length){if("query"===r)return{kind:"query",connectionId:n};if("diff"===r)return{kind:"diff",connectionId:n};if("migrations"===r)return{kind:"migrations",connectionId:n}}return 3===t.length?"migrations"===r?{kind:"migration",connectionId:n,setId:o}:{kind:"table",connectionId:n,table:{schema:r,name:o}}:{kind:"connection",connectionId:n}}function o(e){let t=encodeURIComponent;switch(e.kind){case"home":return"/";case"connection":return`/${t(e.connectionId)}`;case"query":case"diff":case"migrations":return`/${t(e.connectionId)}/${e.kind}`;case"migration":return`/${t(e.connectionId)}/migrations/${t(e.setId)}`;case"table":return`/${t(e.connectionId)}/${t(e.table.schema)}/${t(e.table.name)}`}}function i(e,t,{tableExists:n=!0}={}){let a=r(e);return"home"!==a.kind&&("table"!==a.kind||n)?o({...a,connectionId:t}):o({kind:"connection",connectionId:t})}n.d(t,{Jn:()=>o,ZG:()=>r,gZ:()=>i})},21890:(e,t,n)=>{"use strict";n.d(t,{ConnectionHome:()=>p});var r=n(95155),o=n(73321),i=n(12115),a=n(74590),s=n(88263),l=n(20185),c=n(43262),u=n(95848),d=n(36331);function p(){let e=(0,o.useRouter)(),{connection:t,tables:n}=(0,d.k)(),[p]=(0,a.DE)(t.id),f=p.recentTables[0]??null,h=f?(n.data??[]).find(e=>(0,u.i)(e)===f):void 0;return((0,i.useEffect)(()=>{h&&(s.c.getState().markReplace(),e.replace((0,l.Jn)({kind:"table",connectionId:t.id,table:{schema:h.schema,name:h.name}})))},[h,t.id,e]),!n.data||h)?null:(0,r.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-1.5 text-muted-foreground",children:[(0,r.jsx)("p",{className:"text-sm",children:"Select a table"}),(0,r.jsx)("kbd",{className:"font-mono text-[11px] text-muted-foreground/60",children:c.Ar.tableSearch})]})}},27529:(e,t,n)=>{"use strict";n.d(t,{F:()=>i});var r=n(72914);async function o(e,t,n){let o,i=await (0,r.Qv)(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n}),a=await i.text();if(!a)throw Error(`YTDB bridge returned an empty response (HTTP ${i.status}). Restart YTDB to update the local bridge.`);try{o=JSON.parse(a)}catch{if(404===i.status)throw Error("The YTDB running on your machine is older than this page and does not know this request. Restart it with `npx @theobourgeois/ytdb@latest`.");throw Error(`YTDB bridge returned an invalid response (HTTP ${i.status}).`)}if(!i.ok)throw Error((o&&"object"==typeof o&&"error"in o&&"string"==typeof o.error?o.error:i.statusText)||`YTDB bridge request failed with HTTP ${i.status}.`);return o}let i={tables:(e,t)=>o("/api/tables",{connectionUrl:e},t),rows:(e,t,n)=>o("/api/rows",{connectionUrl:e,query:t},n),query:(e,t,n)=>o("/api/query",{connectionUrl:e,sql:t},n),updateCell:(e,t,n)=>o("/api/cell",{connectionUrl:e,update:t},n),insertRow:(e,t,n)=>o("/api/insert-row",{connectionUrl:e,insertion:t},n),updateRow:(e,t,n)=>o("/api/update-row",{connectionUrl:e,update:t},n),deleteRows:(e,t,n)=>o("/api/delete-rows",{connectionUrl:e,deletion:t},n),related:(e,t,n)=>o("/api/related",{connectionUrl:e,lookups:t},n),lookup:(e,t,n)=>o("/api/lookup",{connectionUrl:e,query:t},n),definition:(e,t,n)=>o("/api/definition",{connectionUrl:e,table:t},n),schema:(e,t)=>o("/api/schema",{connectionUrl:e},t),ledger:(e,t,n,r=!1)=>o("/api/ledger",{connectionUrl:e,ledgerSchema:t,withSql:r},n),migrate:(e,t,n)=>o("/api/migrate",{connectionUrl:e,migration:t},n),adopt:(e,t,n)=>o("/api/adopt",{connectionUrl:e,adopt:t},n),detect:(e,t,n)=>o("/api/detect",{connectionUrl:e,migrations:t},n),repo:(e,t)=>o("/api/repo",{root:e},t),note:(e,t,n,r)=>o("/api/note",{root:e,path:t,note:n},r)}},32538:(e,t,n)=>{"use strict";n.d(t,{I_:()=>r,Mq:()=>a,XU:()=>i,yQ:()=>o});let r=["#e11d48","#f97316","#d97706","#65a30d","#0d9488","#0284c7","#4f46e5","#7c3aed","#c026d3","#57534e"];function o(e){return r.some(t=>t===e)}function i(e){let t=r.find(t=>!e.includes(t));return t||(r[e.length%r.length]??r[0])}function a(e){if(o(e.color))return e.color;var t=e.id;let n=0;for(let e of t)n=31*n+e.charCodeAt(0)>>>0;return r[n%r.length]??r[0]}},36331:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l,k:()=>c});var r=n(95155),o=n(12115),i=n(27529),a=n(87364);let s=(0,o.createContext)(null);function l({connection:e,children:t}){let n=(0,a.Y)(e.url,t=>i.F.tables(e.url,t));return(0,r.jsx)(s.Provider,{value:{connection:e,tables:n},children:t})}function c(){let e=(0,o.useContext)(s);if(!e)throw Error("useExplorerContext must be used inside ExplorerProvider");return e}},40980:(e,t,n)=>{"use strict";n.d(t,{cn:()=>i,z:()=>a});var r=n(29722),o=n(622);function i(...e){return(0,o.QP)((0,r.$)(e))}function a(){if("function"==typeof crypto.randomUUID)return crypto.randomUUID();let e=crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=63&e[8]|128;let t=Array.from(e,e=>e.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}},42256:(e,t,n)=>{"use strict";n.d(t,{L:()=>o});var r=n(72914);function o(e,t){let{connectionUrl:n,...o}=t??{};(0,r.Qv)("/api/activity",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,connectionUrl:n,params:o}),keepalive:!0}).catch(()=>{})}},43262:(e,t,n)=>{"use strict";n.d(t,{Ar:()=>r,US:()=>s,s5:()=>c,tT:()=>u,vI:()=>l});let r={commandPalette:"⌘⇧P",tableSearch:"⌘P",columnSearch:"⌘/",sqlEditor:"⌘E",switchConnection:"⌘⇧E",compareSchema:"⌘⇧D",migrations:"⌘⇧M",back:"⌘[",forward:"⌘]"};function o(){let e=new Set;return{register:t=>(e.add(t),()=>{e.delete(t)}),open(){for(let t of e)t()}}}let i=o(),a=o(),s=i.register,l=i.open,c=a.register,u=a.open},63307:(e,t,n)=>{"use strict";function r(e,t){if(null!==window.localStorage.getItem(t))return;let n=window.localStorage.getItem(e);null!==n&&window.localStorage.setItem(t,n)}n.d(t,{q:()=>r})},69586:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u,w:()=>d});var r=n(1934),o=n(31692),i=n(42256),a=n(32538),s=n(40980),l=n(63307);let c="ytdb:connections";(0,l.q)("db-studio:connections",c);let u=(0,r.v)()((0,o.Zr)((e,t)=>({connections:[],add:n=>{let r=n.color??(0,a.XU)(t().connections.map(e=>(0,a.Mq)(e))),o={id:(0,s.z)(),...n,color:r};return e(e=>({connections:[...e.connections,o]})),(0,i.L)("connection.add",{connectionUrl:o.url,name:o.name}),o},update:(n,r)=>{let o=t().connections.find(e=>e.id===n);e(e=>({connections:e.connections.map(e=>e.id===n?{...e,...r}:e)})),(0,i.L)("connection.update",{connectionUrl:r.url??o?.url,name:r.name??o?.name,changed:Object.keys(r)})},remove:n=>{let r=t().connections.find(e=>e.id===n);e(e=>({connections:e.connections.filter(e=>e.id!==n)})),(0,i.L)("connection.remove",{connectionUrl:r?.url,name:r?.name})}}),{name:c}));function d(e){return u(t=>t.connections.find(t=>t.id===e))}},72914:(e,t,n)=>{"use strict";n.d(t,{Qv:()=>a,Yf:()=>i,i:()=>o});let r="ytdb:bridge";function o(){var e;return"localhost"!==(e=window.location.hostname)&&"127.0.0.1"!==e&&"[::1]"!==e&&"local.ytdb"!==e&&"local.dbstudio"!==e}function i(){let e=function(){let e=new URLSearchParams(window.location.hash.slice(1)),t=e.get("token"),n=e.get("port");if(!t)return null;let o=n?Number(n):4371;if(!Number.isInteger(o)||o<1024||o>65535)return null;let i={origin:`http://127.0.0.1:${o}`,token:t};return window.sessionStorage.setItem(r,JSON.stringify(i)),window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}`),i}();if(e)return e;let t=window.sessionStorage.getItem(r);if(!t)return null;try{let e=JSON.parse(t);if("string"==typeof e.origin&&/^http:\/\/127\.0\.0\.1:\d+$/.test(e.origin)&&"string"==typeof e.token&&e.token.length>0)return e}catch{}return window.sessionStorage.removeItem(r),null}async function a(e,t={}){let n=i();if(o()&&!n)throw Error("Start YTDB with `npx @theobourgeois/ytdb`, then use the browser tab it opens.");let r=new Headers(t.headers);return n&&r.set("Authorization",`Bearer ${n.token}`),fetch(n?new URL(e,n.origin):e,{...t,headers:r,targetAddressSpace:n?"loopback":void 0})}},73321:(e,t,n)=>{"use strict";var r=n(74645);n.o(r,"useParams")&&n.d(t,{useParams:function(){return r.useParams}}),n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}})},74590:(e,t,n)=>{"use strict";n.d(t,{DE:()=>S,gz:()=>$,jn:()=>v,lz:()=>w,mQ:()=>k,y3:()=>x});var r=n(1934),o=n(31692),i=n(95848),a=n(40980),s=n(69586),l=n(63307);let c="ytdb:explorer";(0,l.q)("db-studio:explorer",c);let u={search:"",selectedSchemas:null,collapsedSchemas:[],pinnedTables:[],recentTables:[],sidebarWidth:256,sidebarCollapsed:!1},d={filters:[],search:"",sort:null,columnWidths:{},hiddenColumns:[],page:0,pageSize:50},p=["selectedSchemas","collapsedSchemas","pinnedTables"],f=["search","recentTables","sidebarWidth","sidebarCollapsed"],h=["columnWidths","hiddenColumns","pinnedColumns","pageSize"],m=["filters","search","sort","page"];function g(e,t){return`${e}:${(0,i.i)(t)}`}function y(e){let t=s.Z.getState().connections.find(t=>t.id===e);return t?.layoutGroup??e}function b(e,t){let n={};for(let r of t)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}let w=(0,r.v)()((0,o.Zr)(e=>({browse:{},tables:{},compareTargets:{},setBrowse:(t,n)=>e(e=>{let r=y(t),o=b(n,p),i=b(n,f),a={...e.browse};return r===t?a[t]={...a[t]??u,...o,...i}:(Object.keys(o).length>0&&(a[r]={...a[r]??u,...o}),Object.keys(i).length>0&&(a[t]={...a[t]??u,...i})),{browse:a}}),setTable:(t,n,r)=>e(e=>{let o=g(y(t),n),i=g(t,n),a=b(r,h),s=b(r,m),l={...e.tables};return o===i?l[i]={...l[i]??d,...a,...s}:(Object.keys(a).length>0&&(l[o]={...l[o]??d,...a}),Object.keys(s).length>0&&(l[i]={...l[i]??d,...s})),{tables:l}}),setCompareTarget:(t,n)=>e(e=>({compareTargets:{...e.compareTargets,[t]:n}})),copyLayout:(t,n)=>e(e=>{if(t===n)return e;let r={...e.browse},o=r[t];o&&(r[n]={...r[n]??u,...b(o,p)});let i={...e.tables},a=`${t}:`;for(let[t,r]of Object.entries(e.tables)){if(!t.startsWith(a))continue;let e=`${n}:${t.slice(a.length)}`;i[e]={...i[e]??d,...b(r,h)}}return{browse:r,tables:i}})}),{name:c}));function S(e){let t,n=(0,s.Z)(t=>t.connections.find(t=>t.id===e)?.layoutGroup??e),r=w(t=>n===e?void 0:t.browse[n]),o=w(t=>t.browse[e]),i=w(e=>e.setBrowse);return[(t=o&&"selectedSchemas"in o?o.selectedSchemas??null:o?.schema?[o.schema]:null,{...u,...o,selectedSchemas:t,...r?{selectedSchemas:r.selectedSchemas,collapsedSchemas:r.collapsedSchemas,pinnedTables:r.pinnedTables}:{}}),t=>i(e,t)]}function v(e,t){let n=(0,s.Z)(t=>t.connections.find(t=>t.id===e)?.layoutGroup??e),r=w(r=>n===e?void 0:r.tables[g(n,t)]),o=w(n=>n.tables[g(e,t)]),i=w(e=>e.setTable);return[{...d,...o,search:o?.search??d.search,hiddenColumns:o?.hiddenColumns??d.hiddenColumns,...r?{columnWidths:r.columnWidths,hiddenColumns:r.hiddenColumns,pinnedColumns:r.pinnedColumns,pageSize:r.pageSize}:{}},n=>i(e,t,n)]}function k(e,t){let n=[...new Set([e,...t])],{connections:r,update:o}=s.Z.getState(),i=w.getState(),l=r.find(t=>t.id===e);if(!l)return;let c=new Map;for(let e of r){if(!e.layoutGroup)continue;let t=c.get(e.layoutGroup)??[];t.push(e.id),c.set(e.layoutGroup,t)}let u=l.layoutGroup,d=u?c.get(u)??[e]:[e],p=d.filter(e=>!n.includes(e));for(let t of p)i.copyLayout(u??e,t),o(t,{layoutGroup:void 0});if(u){let t=d.filter(t=>!p.includes(t)&&t!==e);if(1===t.length){let e=t[0];e&&(i.copyLayout(u,e),o(e,{layoutGroup:void 0}))}}if(n.length<=1){u&&(i.copyLayout(u,e),o(e,{layoutGroup:void 0}));return}let f=u??(0,a.z)();for(let t of(u||i.copyLayout(e,f),n)){let e=r.find(e=>e.id===t);if(e){if(e.layoutGroup&&e.layoutGroup!==f){let r=e.layoutGroup,a=(c.get(r)??[]).filter(e=>e!==t&&!n.includes(e));if(1===a.length){let e=a[0];e&&(i.copyLayout(r,e),o(e,{layoutGroup:void 0}))}else a.length}o(t,{layoutGroup:f})}}}let T=[];function $(e){let t=(0,s.Z)(e=>e.connections),n=(0,s.Z)(t=>t.connections.find(t=>t.id===e)?.layoutGroup);return n?t.filter(t=>t.layoutGroup===n&&t.id!==e):T}function x(e){let t=(0,s.Z)(e=>e.connections),n=w(t=>t.compareTargets[e]),r=w(e=>e.setCompareTarget),o=(0,s.Z)(t=>t.connections.find(t=>t.id===e)?.layoutGroup),i=t.filter(t=>t.id!==e),a=o?i.filter(e=>e.layoutGroup===o):[];return{target:i.find(e=>e.id===n)??a[0]??i[0]??null,candidates:i,partnerIds:a.map(e=>e.id),setTarget:t=>r(e,t)}}},87364:(e,t,n)=>{"use strict";n.d(t,{Y:()=>o});var r=n(12115);function o(e,t){let[n,o]=(0,r.useState)(0),[i,a]=(0,r.useState)({key:"",error:null}),s=`${n}:${e}`;(0,r.useEffect)(()=>{let e=new AbortController;return t(e.signal).then(e=>a({key:s,data:e,error:null})).catch(t=>{if(e.signal.aborted)return;let n=t instanceof Error?t.message:String(t);a(e=>({key:s,data:e.data,error:n}))}),()=>e.abort()},[s]);let l=(0,r.useCallback)(()=>o(e=>e+1),[]),c=i.key!==s;return{data:i.data,error:c?null:i.error,loading:c,reload:l}}},88263:(e,t,n)=>{"use strict";n.d(t,{c:()=>s});var r=n(1934),o=n(31692);let i="ytdbNav";function a(e){let t=window.history.state;t&&"object"==typeof t&&t[i]===e||window.history.replaceState({...t??{},[i]:e},"")}let s=(0,r.v)()((0,o.Zr)((e,t)=>({entries:[],index:-1,traversing:!1,replaceNext:!1,markTraversal:()=>e({traversing:!0}),markReplace:()=>e({replaceNext:!0}),arrive:n=>{let r,{entries:o,index:s,traversing:l,replaceNext:c}=t(),u=function(){let e=window.history.state;if(!e||"object"!=typeof e)return;let t=e[i];return"number"==typeof t?t:void 0}();if(o[s]===n&&!c){e({traversing:!1}),a(s);return}let d=o;void 0!==u&&o[u]===n?r=u:l&&o[s-1]===n?r=s-1:l&&o[s+1]===n?r=s+1:c&&s>=0?(d=o.map((e,t)=>t===s?n:e),r=s):r=(d=[...o.slice(0,s+1),n]).length-1,e({entries:d,index:r,traversing:!1,replaceNext:!1}),a(r)}}),{name:"ytdb:navigation",storage:(0,o.KU)(()=>sessionStorage),partialize:e=>({entries:e.entries,index:e.index})}))},95848:(e,t,n)=>{"use strict";function r(e){return`${e.schema}.${e.name}`}n.d(t,{i:()=>r})}},e=>{e.O(0,[1731,8441,3794,7358],()=>e(e.s=4108)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1083],{7412:(e,t,r)=>{"use strict";r.d(t,{L:()=>s});var n=r(95155),o=r(13267),l=r(40980);function s({trailing:e,className:t,...r}){return(0,n.jsxs)("div",{className:(0,l.cn)("flex h-8 items-center gap-1.5 rounded-lg px-2 text-muted-foreground transition-colors focus-within:bg-muted/60 hover:bg-muted/60",t),children:[(0,n.jsx)(o.TfF,{className:"size-3.5 shrink-0"}),(0,n.jsx)("input",{type:"text",spellCheck:!1,autoComplete:"off",...r,className:"h-full min-w-0 flex-1 bg-transparent text-[0.8rem] text-foreground outline-none placeholder:text-muted-foreground"}),e]})}},17491:(e,t,r)=>{"use strict";r.d(t,{X:()=>d});var n=r(95155),o=r(40980),l=r(13267),s=r(89239),i=r(43262),a=r(36331),c=r(48861);function u({className:e}){let{connection:t}=(0,a.k)(),{back:r,forward:d,goBack:m,goForward:h}=(0,c.Q)(t.id);return(0,n.jsxs)("div",{className:(0,o.cn)("flex items-center",e),children:[(0,n.jsx)(s.$,{variant:"ghost",size:"icon-sm",disabled:!r,"aria-label":r?`Back to ${r.label}`:"Back",title:r?`Back to ${r.label} (${i.Ar.back})`:void 0,className:"disabled:opacity-30",onClick:m,children:(0,n.jsx)(l.SI1,{})}),(0,n.jsx)(s.$,{variant:"ghost",size:"icon-sm",disabled:!d,"aria-label":d?`Forward to ${d.label}`:"Forward",title:d?`Forward to ${d.label} (${i.Ar.forward})`:void 0,className:"disabled:opacity-30",onClick:h,children:(0,n.jsx)(l.nNJ,{})})]})}function d({children:e,className:t}){return(0,n.jsxs)("header",{className:(0,o.cn)("flex h-11 shrink-0 items-center gap-2 border-b pr-3 pl-1.5",t),children:[(0,n.jsx)(u,{className:"mr-0.5"}),e]})}},19065:(e,t,r)=>{"use strict";function n(e,t){if(0===t)return!0;let r=e[t-1];return"_"===r||"-"===r||" "===r||"."===r}function o(e,t,r){return l(e,t,e=>[r(e)])}function l(e,t,r){if(!e.trim())return[];let o=[];for(let l of t){let t=r(l),s=null;for(let r of t){let t=function(e,t){let r=e.trim().toLocaleLowerCase(),o=t.toLocaleLowerCase();if(!r)return 0;if(0===o.length)return null;if(o===r)return 1e4;if(o.startsWith(r))return 5e3-o.length;let l=o.indexOf(r);if(-1!==l)return 2400+1200*!!n(t,l)-l-o.length;let s=0,i=0,a=0;for(let e=0;e<o.length&&s<r.length;e+=1){if(o[e]!==r[s]){a=0;continue}i+=12,(a+=1)>1&&(i+=18*a),n(t,e)&&(i+=40),s+=1}if(s<r.length)return null;let c=t.split(/[_\-\s.]+/).map(e=>e[0]??"").join("").toLocaleLowerCase();return c.startsWith(r)?i+=2200:c.includes(r)&&(i+=700),i-(o.length-r.length)}(e,r);null!==t&&(null===s||t>s)&&(s=t)}null!==s&&o.push({item:l,score:s})}return o.sort((e,t)=>t.score!==e.score?t.score-e.score:r(e.item)[0]?.localeCompare(r(t.item)[0]??"")??0)}r.d(t,{R6:()=>o,UO:()=>l})},21281:(e,t,r)=>{Promise.resolve().then(r.bind(r,96365))},34263:(e,t,r)=>{"use strict";r.d(t,{En:()=>u,Pc:()=>c,jl:()=>a});var n=r(1934),o=r(31692),l=r(40980),s=r(63307);let i="ytdb:queries";(0,s.q)("db-studio:queries",i);let a=144,c=800,u=(0,n.v)()((0,o.Zr)(e=>({drafts:{},editorHeight:224,history:[],setDraft:(t,r)=>e(e=>({drafts:{...e.drafts,[t]:r}})),setEditorHeight:t=>e({editorHeight:Math.min(c,Math.max(a,Math.round(t)))}),record:(t,r)=>e(e=>{let n=r.trim();if(!n)return e;let o=e.history.find(e=>e.connectionId===t&&e.sql===n),s={id:o?.id??(0,l.z)(),connectionId:t,sql:n,executedAt:Date.now()},i=0,a=0;return{history:[s,...e.history.filter(e=>e.id!==s.id)].filter(e=>!(i>=200)&&!(a+e.sql.length>1e6)&&(i+=1,a+=e.sql.length,!0))}}),remove:t=>e(e=>({history:e.history.filter(e=>e.id!==t)}))}),{name:i}))},96365:(e,t,r)=>{"use strict";r.d(t,{QueryView:()=>q});var n=r(95155),o=r(12115),l=r(13267),s=r(36331),i=r(17491),a=r(48861),c=r(89239),u=r(27529),d=r(96532),m=r(43262),h=r(34263),f=r(40980),x=r(55737),g=r(82228),p=r(46732),b=r(14097),v=r(27071),j=r(89561),k=r(32638);let w=[j.Lz.theme({"&":{height:"100%",backgroundColor:"var(--background)",color:"var(--foreground)",fontSize:"13px"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"var(--font-geist-mono), ui-monospace, SFMono-Regular, monospace",lineHeight:"1.6",overflow:"auto"},".cm-content":{padding:"10px 0",caretColor:"var(--foreground)"},".cm-line":{padding:"0 16px 0 8px"},".cm-gutters":{backgroundColor:"color-mix(in oklch, var(--muted) 35%, var(--background))",color:"var(--muted-foreground)",borderRight:"1px solid var(--border)"},".cm-lineNumbers .cm-gutterElement":{minWidth:"42px",padding:"0 10px 0 6px"},".cm-activeLine":{backgroundColor:"color-mix(in oklch, var(--muted) 42%, transparent)"},".cm-activeLineGutter":{backgroundColor:"color-mix(in oklch, var(--muted) 68%, var(--background))",color:"var(--foreground)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--foreground)"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"color-mix(in oklch, var(--primary) 18%, transparent) !important"},".cm-matchingBracket":{backgroundColor:"color-mix(in oklch, var(--primary) 16%, transparent)",outline:"1px solid color-mix(in oklch, var(--primary) 32%, transparent)"},".cm-tooltip":{border:"1px solid var(--border)",borderRadius:"var(--radius-md)",backgroundColor:"var(--popover)",color:"var(--popover-foreground)",overflow:"hidden"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"var(--accent)",color:"var(--accent-foreground)"}}),(0,p.y9)(p.cr.define([{tag:k._A.keyword,color:"var(--chart-1)",fontWeight:"600"},{tag:[k._A.string,k._A.special(k._A.string)],color:"var(--chart-2)"},{tag:[k._A.number,k._A.bool,k._A.null],color:"var(--chart-3)"},{tag:[k._A.typeName,k._A.className],color:"var(--chart-4)"},{tag:k._A.function(k._A.variableName),color:"var(--chart-4)"},{tag:k._A.comment,color:"var(--muted-foreground)",fontStyle:"italic"},{tag:[k._A.operator,k._A.punctuation],color:"var(--foreground)",opacity:"0.72"}]))],y=(0,o.forwardRef)(function({value:e,schema:t,maxLength:r,onChange:l,onRun:s,onLimitExceeded:i},a){let c=(0,o.useRef)(null),u=(0,o.useRef)(s);u.current=s;let d=(0,o.useRef)(i);d.current=i;let m=(0,o.useMemo)(()=>[(0,b.ll)({dialect:b.Rv,schema:t}),v.$t.changeFilter.of(e=>e.newDoc.length<=r||(queueMicrotask(()=>d.current()),!1)),j.Lz.contentAttributes.of({"aria-label":"SQL query editor"}),v.Nb.highest(j.w4.of([{key:"Mod-Enter",run:()=>(u.current(),!0)}])),j.w4.of([g.Yc])],[r,t]);return(0,o.useImperativeHandle)(a,()=>({focus(e=!1){let t=c.current;if(t){if(e){let e=t.state.doc.length;t.dispatch({selection:{anchor:e},scrollIntoView:!0})}t.focus()}},selectedText(){let e=c.current;if(!e)return"";let t=e.state.selection.main;return t.empty?"":e.state.sliceDoc(t.from,t.to)}})),(0,n.jsx)(x.Ay,{className:"h-full",value:e,height:"100%",theme:w,extensions:m,placeholder:"select *\nfrom public.users\nlimit 100;",basicSetup:{lineNumbers:!0,foldGutter:!1,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!1,highlightActiveLine:!0,highlightSelectionMatches:!0},onCreateEditor:e=>{c.current=e},onChange:l})});function N({statement:e}){return(0,n.jsxs)("div",{className:"min-h-0 flex-1 overflow-auto",children:[(0,n.jsxs)("table",{className:"min-w-full border-separate border-spacing-0 font-mono text-xs",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"sticky top-0 left-0 z-20 h-9 w-10 border-r border-b bg-muted px-2 text-right font-normal text-muted-foreground",children:"#"}),e.columns.map((e,t)=>(0,n.jsx)("th",{className:"sticky top-0 z-10 h-9 min-w-32 border-r border-b bg-muted px-3 text-left font-medium whitespace-nowrap text-foreground last:border-r-0",children:e},`${e}:${t}`))]})}),(0,n.jsx)("tbody",{children:e.rows.map((t,r)=>(0,n.jsxs)("tr",{className:"group hover:bg-muted/45",children:[(0,n.jsx)("th",{className:"sticky left-0 z-10 h-8 border-r border-b bg-background px-2 text-right font-normal text-muted-foreground group-hover:bg-muted",children:r+1}),e.columns.map((e,r)=>{let o=t[r]??null,l=null===o?"null":String(o);return(0,n.jsx)("td",{title:l,className:"h-8 max-w-96 min-w-32 border-r border-b px-3 whitespace-nowrap last:border-r-0",children:(0,n.jsx)("span",{className:null===o?"text-muted-foreground/65":"block max-w-96 truncate text-foreground/90",children:l})},`${e}:${r}`)})]},r))})]}),0===e.rows.length?(0,n.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:"Query returned no rows."}):null]})}function C({result:e,loading:t}){let[r,s]=(0,o.useState)({source:null,index:0});if(!e)return(0,n.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center p-8 text-center text-sm text-muted-foreground",children:"Run a query or migration to see its results."});let i=r.index;r.source!==e&&(i=Math.max(0,e.statements.length-1),s({source:e,index:i}));let a=e.statements[i];if(!a)return(0,n.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center p-8 text-center text-sm text-muted-foreground",children:"Execution completed without a result."});let c=function(e){if(e.truncated)return`${e.rows.length.toLocaleString()}+ rows`;let t=e.rowCount??e.rows.length;return 0===e.columns.length&&null===e.rowCount?null:`${t.toLocaleString()} ${1===t?"row":"rows"}`}(a);return(0,n.jsxs)("div",{className:(0,f.cn)("flex min-h-0 flex-1 flex-col",t&&"opacity-55"),"data-query-results":"",children:[(0,n.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-1 overflow-x-auto border-b px-2 text-xs",children:[(0,n.jsx)("span",{className:"mr-1 shrink-0 font-medium",children:"Results"}),e.statements.length>1?e.statements.map((t,r)=>(0,n.jsxs)("button",{type:"button","aria-pressed":r===i,onClick:()=>s({source:e,index:r}),className:(0,f.cn)("h-6 shrink-0 rounded-md px-2 font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60",r===i&&"bg-muted text-foreground"),children:[r+1," ",t.command]},r)):(0,n.jsx)("span",{className:"font-mono text-[11px] text-muted-foreground",children:a.command}),c?(0,n.jsxs)("span",{className:"ml-1 shrink-0 text-muted-foreground",children:["\xb7 ",c]}):null,a.truncated?(0,n.jsxs)("span",{className:"shrink-0 text-muted-foreground",children:["\xb7 limited to ",a.rows.length]}):null,(0,n.jsxs)("span",{className:"ml-auto shrink-0 font-mono tabular-nums text-muted-foreground",children:[e.durationMs.toLocaleString()," ms"]})]}),a.columns.length>0?(0,n.jsx)(N,{statement:a}):(0,n.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 p-8 text-center",children:[(0,n.jsx)(l.Ykz,{className:"size-5 text-emerald-600 dark:text-emerald-400"}),(0,n.jsxs)("p",{className:"font-medium",children:[a.command," completed"]}),c?(0,n.jsxs)("p",{className:"text-xs text-muted-foreground",children:[c," affected"]}):null]})]})}var S=r(7412),A=r(19065);function E(e){return(e.split(/\r?\n/).find(e=>e.trim())?.trim()??e).replace(/\s+/g," ")}function L({connectionId:e,search:t,onSelect:r}){let s=(0,h.En)(e=>e.history),i=(0,h.En)(e=>e.remove),a=(0,o.useMemo)(()=>s.filter(t=>t.connectionId===e),[e,s]),c=(0,o.useMemo)(()=>t.trim()?(0,A.UO)(t,a,e=>[E(e.sql),e.sql]).map(e=>e.item):a,[a,t]);return 0===c.length?(0,n.jsx)("p",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:0===a.length?"Queries you run will appear here.":"No matching queries."}):(0,n.jsx)("ul",{className:"flex flex-col gap-1 p-1.5",children:c.map(e=>{var t;return(0,n.jsxs)("li",{className:"group flex items-start rounded-md hover:bg-muted/70",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>r(e.sql),title:e.sql,className:"min-w-0 flex-1 rounded-md px-2 py-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[(0,n.jsx)("span",{className:"block truncate font-mono text-xs text-foreground/90",children:E(e.sql)}),(0,n.jsx)("span",{className:"mt-1 block text-[10px] text-muted-foreground",children:(t=e.executedAt,new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(t))})]}),(0,n.jsx)("button",{type:"button",onClick:()=>i(e.id),"aria-label":"Remove query from history",title:"Remove from history",className:"mt-1.5 mr-1 flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground opacity-0 outline-none hover:bg-foreground/10 hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:opacity-100 group-hover:opacity-100",children:(0,n.jsx)(l.mYx,{className:"size-3.5"})})]},e.id)})})}function $({connectionId:e,onSelectHistory:t}){let[r,l]=(0,o.useState)("");return(0,n.jsxs)("aside",{className:"flex w-72 max-w-[35%] shrink-0 flex-col border-l bg-sidebar","aria-label":"Query history",children:[(0,n.jsx)("div",{className:"flex h-11 shrink-0 items-center border-b px-2",children:(0,n.jsx)(S.L,{value:r,onChange:e=>l(e.target.value),placeholder:"Search history","aria-label":"Search query history",className:"min-w-0 flex-1"})}),(0,n.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:(0,n.jsx)(L,{connectionId:e,search:r,onSelect:t})})]})}let _=new Set(["SELECT","SHOW","EXPLAIN","FETCH"]);function q(){let{connection:e,tables:t}=(0,s.k)(),r=(0,h.En)(t=>t.drafts[e.id]??""),x=(0,h.En)(e=>e.setDraft),g=(0,h.En)(e=>e.record),p=(0,h.En)(e=>e.editorHeight),b=(0,h.En)(e=>e.setEditorHeight),[v,j]=(0,o.useState)(null),[k,w]=(0,o.useState)(null),[N,S]=(0,o.useState)(!1),A=(0,o.useRef)(null),E=(0,o.useRef)(null),L=(0,o.useRef)(null),q=(0,a.Q)(e.id),R=q.back?.route.kind==="migration"&&q.back.route.connectionId===e.id?q.back:null,z=(0,o.useMemo)(()=>{let e={};for(let r of t.data??[])(e[r.schema]??={})[r.name]=r.columns.map(e=>e.name);return e},[t.data]);async function H(){if(N)return;let n=A.current?.selectedText().trim()||r.trim();if(!n){w("Enter a query to run."),A.current?.focus();return}let o=new AbortController;L.current=o,g(e.id,n),S(!0),w(null);try{let r=await u.F.query(e.url,n,o.signal);j(r),r.statements.some(e=>!_.has(e.command))&&t.reload()}catch(e){if(o.signal.aborted)return;w(e instanceof Error?e.message:String(e))}finally{L.current===o&&(L.current=null,S(!1))}}return(0,o.useEffect)(()=>()=>L.current?.abort(),[]),(0,o.useEffect)(()=>{let e=E.current;if(!e)return;let t=null,r=new ResizeObserver(()=>{null!==t&&window.clearTimeout(t),t=window.setTimeout(()=>b(e.offsetHeight),200)});return r.observe(e),()=>{null!==t&&window.clearTimeout(t),r.disconnect()}},[b]),(0,n.jsxs)("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[(0,n.jsxs)("section",{className:"flex min-w-0 flex-1 flex-col",children:[(0,n.jsxs)(i.X,{children:[(0,n.jsx)(l.Uoo,{className:"size-4 shrink-0 text-muted-foreground"}),(0,n.jsx)("span",{className:"font-medium",children:"Query"}),R&&(0,n.jsxs)(c.$,{type:"button",variant:"ghost",size:"sm",className:"ml-auto text-muted-foreground",title:`Back to ${R.label} (${m.Ar.back})`,onClick:q.goBack,children:[(0,n.jsx)(l.a7N,{"data-icon":"inline-start"}),(0,n.jsx)("span",{className:"max-w-40 truncate",children:R.label})]}),(0,n.jsxs)(c.$,{type:"button",variant:"ghost",size:"sm",className:(0,f.cn)(!R&&"ml-auto"),disabled:N||!r,onClick:function(){x(e.id,""),w(null),A.current?.focus()},children:[(0,n.jsx)(l.GVO,{"data-icon":"inline-start"}),"Clear"]}),(0,n.jsxs)(c.$,{type:"button",size:"sm",disabled:N||!r.trim(),title:"Run the selection or the whole script (⌘↵)",onClick:()=>void H(),children:[N?(0,n.jsx)(l.gnh,{"data-icon":"inline-start",className:"animate-spin"}):(0,n.jsx)(l.eGB,{"data-icon":"inline-start"}),N?"Running":"Run"]})]}),(0,n.jsx)("div",{ref:E,style:{height:p,minHeight:h.jl,maxHeight:h.Pc},className:"max-h-[55vh] shrink-0 resize-y overflow-hidden border-b bg-background",children:(0,n.jsx)(y,{ref:A,value:r,schema:z,maxLength:d.H4,onChange:t=>x(e.id,t),onRun:()=>void H(),onLimitExceeded:()=>w(`Query is too long (maximum ${d.H4.toLocaleString()} characters).`)})}),k?(0,n.jsx)("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:(0,n.jsx)("div",{className:"rounded-md border border-destructive/25 bg-destructive/5 px-3 py-2 font-mono text-xs whitespace-pre-wrap text-destructive",children:k})}):(0,n.jsx)(C,{result:v,loading:N})]}),(0,n.jsx)($,{connectionId:e.id,onSelectHistory:function(t){x(e.id,t),w(null),window.requestAnimationFrame(()=>A.current?.focus(!0))}})]})}},96532:(e,t,r)=>{"use strict";r.d(t,{H4:()=>o,d6:()=>n});let n=1e4,o=5e5}},e=>{e.O(0,[4506,6079,1731,8026,9159,4097,6090,8441,3794,7358],()=>e(e.s=21281)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1047,2042,2772,3058,3219,3577,4688,4707,4896,4909,5047,5374,5721,5794,6258,6306,6636,6819,6988,7761,7851,7981,8167,9433],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|