@theobourgeois/ytdb 0.2.19 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +9 -5
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +4 -4
- package/.next/react-loadable-manifest.json +12 -1
- package/.next/routes-manifest.json +35 -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 +3 -3
- 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/(index)/page.js +1 -0
- package/.next/server/app/[connectionId]/migrations/(index)/page.js.nft.json +1 -0
- package/.next/server/app/[connectionId]/migrations/(index)/page_client-reference-manifest.js +1 -0
- package/.next/server/app/[connectionId]/migrations/(index)/timeline/page.js +1 -0
- package/.next/server/app/[connectionId]/migrations/(index)/timeline/page.js.nft.json +1 -0
- package/.next/server/app/[connectionId]/migrations/(index)/timeline/page_client-reference-manifest.js +1 -0
- package/.next/server/app/[connectionId]/migrations/[setId]/diagram/page.js +1 -0
- package/.next/server/app/[connectionId]/migrations/[setId]/diagram/page.js.nft.json +1 -0
- package/.next/server/app/[connectionId]/migrations/[setId]/diagram/page_client-reference-manifest.js +1 -0
- 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/[setId]/schema/page.js +1 -0
- package/.next/server/app/[connectionId]/migrations/[setId]/schema/page.js.nft.json +1 -0
- package/.next/server/app/[connectionId]/migrations/[setId]/schema/page_client-reference-manifest.js +1 -0
- package/.next/server/app/[connectionId]/migrations/[setId]/timeline/page.js +1 -0
- package/.next/server/app/[connectionId]/migrations/[setId]/timeline/page.js.nft.json +1 -0
- package/.next/server/app/[connectionId]/migrations/[setId]/timeline/page_client-reference-manifest.js +1 -0
- 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 +7 -7
- package/.next/server/app/_not-found.segments/_full.segment.rsc +7 -7
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/api/activity/route.js +2 -2
- package/.next/server/app/api/adopt/route.js +1 -1
- package/.next/server/app/api/cell/route.js +2 -2
- package/.next/server/app/api/definition/route.js +2 -2
- package/.next/server/app/api/delete-rows/route.js +2 -2
- package/.next/server/app/api/detect/route.js +1 -1
- package/.next/server/app/api/health/route.js +1 -1
- package/.next/server/app/api/insert-row/route.js +2 -2
- package/.next/server/app/api/ledger/route.js +1 -1
- package/.next/server/app/api/lookup/route.js +2 -2
- package/.next/server/app/api/migrate/route.js +1 -1
- package/.next/server/app/api/note/route.js +1 -1
- package/.next/server/app/api/query/route.js +2 -2
- package/.next/server/app/api/reconcile/route.js +2 -2
- package/.next/server/app/api/rehearse/route.js +1 -1
- package/.next/server/app/api/related/route.js +2 -2
- package/.next/server/app/api/repo/route.js +1 -1
- package/.next/server/app/api/rows/route.js +2 -2
- 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/timeline/route.js +1 -1
- package/.next/server/app/api/update-row/route.js +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 +8 -8
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/index.segments/_full.segment.rsc +8 -8
- package/.next/server/app/index.segments/_tree.segment.rsc +3 -3
- 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 +9 -5
- package/.next/server/chunks/1421.js +1 -1
- package/.next/server/chunks/4809.js +1 -0
- package/.next/server/chunks/535.js +1 -0
- package/.next/server/chunks/5529.js +1 -0
- package/.next/server/chunks/5816.js +1 -1
- package/.next/server/chunks/6729.js +1 -1
- package/.next/server/chunks/7928.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/middleware.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/{PPqM7ay-YN8BBp1e_HK15 → NB4JOC2i3ctixKpjpc7WH}/_buildManifest.js +1 -1
- package/.next/static/chunks/1413-1888e486022200cf.js +1 -0
- package/.next/static/chunks/1a258343.4407cfad5d6b3688.js +1 -0
- package/.next/static/chunks/{223-a4fca67d979d899d.js → 223-ae41c085e76173d8.js} +1 -1
- package/.next/static/chunks/228-332e8b6e327f10da.js +1 -0
- package/.next/static/chunks/544-624e05bf7e7a38d4.js +1 -0
- package/.next/static/chunks/577-d6d889d30c9375d9.js +1 -0
- package/.next/static/chunks/6090-97474bba31339e8e.js +1 -0
- package/.next/static/chunks/9146.9656b5ec316de71a.js +1 -0
- package/.next/static/chunks/91dbc596.26f4ecb79a1f7c01.js +1 -0
- package/.next/static/chunks/9406.9203511499c8bf43.js +1 -0
- package/.next/static/chunks/app/[connectionId]/[schema]/[table]/page-37b33d781877f0a5.js +1 -0
- package/.next/static/chunks/app/[connectionId]/diff/page-215e1f750956eecb.js +10 -0
- package/.next/static/chunks/app/[connectionId]/{layout-06d736d4773bd4a8.js → layout-b8ad40b3da6824ed.js} +1 -1
- package/.next/static/chunks/app/[connectionId]/migrations/(index)/layout-2635a5499e0b928c.js +1 -0
- package/.next/static/chunks/app/[connectionId]/migrations/(index)/page-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/[connectionId]/migrations/(index)/timeline/page-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/[connectionId]/migrations/[setId]/diagram/page-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/[connectionId]/migrations/[setId]/layout-31e703f1a9beebf7.js +1 -0
- package/.next/static/chunks/app/[connectionId]/migrations/[setId]/page-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/[connectionId]/migrations/[setId]/schema/page-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/[connectionId]/migrations/[setId]/timeline/page-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/[connectionId]/page-78a06e32a2658d3b.js +1 -0
- package/.next/static/chunks/app/[connectionId]/query/page-53c2d6f97a05d957.js +1 -0
- package/.next/static/chunks/app/_global-error/page-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/activity/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/adopt/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/cell/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/definition/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/delete-rows/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/detect/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/health/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/insert-row/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/ledger/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/lookup/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/migrate/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/note/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/query/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/reconcile/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/rehearse/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/related/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/repo/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/rows/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/schema/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/tables/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/timeline/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/api/update-row/route-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/app/layout-2ed8b1f837adb32a.js +1 -0
- package/.next/static/chunks/app/page-52545dcc822c61da.js +2 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-e85d6ff71aeabe8d.js +1 -0
- package/.next/static/chunks/webpack-6451386e3f1b2ec9.js +1 -0
- package/.next/static/css/0e3fe8b2c0252430.css +1 -0
- package/.next/static/css/{e02ab5db9ff2dca2.css → 5df9ea52964d1443.css} +1 -1
- package/.next/static/css/6ada1421df91d770.css +21 -0
- package/README.md +5 -351
- package/bin/ytdb.mjs +4 -9
- package/package.json +3 -1
- package/.next/server/app/[connectionId]/migrations/page.js +0 -1
- package/.next/server/app/[connectionId]/migrations/page.js.nft.json +0 -1
- package/.next/server/app/[connectionId]/migrations/page_client-reference-manifest.js +0 -1
- package/.next/server/chunks/7593.js +0 -1
- package/.next/static/chunks/1520-1d9fc8b9ea29f3aa.js +0 -1
- package/.next/static/chunks/1981-806ce42b1641772f.js +0 -1
- package/.next/static/chunks/6782-c8b44f7f0d19d8e4.js +0 -1
- package/.next/static/chunks/7709-b2eee040599bab79.js +0 -1
- package/.next/static/chunks/9243-585cdd3c297cf117.js +0 -1
- package/.next/static/chunks/9532-860dc97ac3c3ff31.js +0 -1
- package/.next/static/chunks/app/[connectionId]/[schema]/[table]/page-7bed5765c93ce736.js +0 -1
- package/.next/static/chunks/app/[connectionId]/diff/page-e3e50546820ed5d5.js +0 -10
- package/.next/static/chunks/app/[connectionId]/migrations/[setId]/page-86a263e7e4a08d61.js +0 -1
- package/.next/static/chunks/app/[connectionId]/migrations/page-fc5dcf1404df5c65.js +0 -1
- package/.next/static/chunks/app/[connectionId]/page-8f68a2646e2f3eaa.js +0 -1
- package/.next/static/chunks/app/[connectionId]/query/page-55618bbb32f70fee.js +0 -1
- package/.next/static/chunks/app/_global-error/page-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/activity/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/adopt/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/cell/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/definition/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/delete-rows/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/detect/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/health/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/insert-row/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/ledger/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/lookup/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/migrate/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/note/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/query/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/reconcile/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/rehearse/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/related/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/repo/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/rows/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/schema/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/tables/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/timeline/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/api/update-row/route-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/app/layout-e3fdecae5544dc60.js +0 -1
- package/.next/static/chunks/app/page-957b7639b047ba08.js +0 -2
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-ad3ae203c81de67b.js +0 -1
- package/.next/static/chunks/webpack-34eb118f56295776.js +0 -1
- package/.next/static/css/ab9c0ea2c2569929.css +0 -1
- package/public/screenshots/ytdb-command-palette.png +0 -0
- package/public/screenshots/ytdb-connection.png +0 -0
- package/public/screenshots/ytdb-explorer.png +0 -0
- /package/.next/static/{PPqM7ay-YN8BBp1e_HK15 → NB4JOC2i3ctixKpjpc7WH}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9406],{2367:()=>{},61278:(t,e,n)=>{"use strict";n.d(e,{Do:()=>p,WZ:()=>h,TG:()=>y,ny:()=>f,yX:()=>g,xN:()=>m,Qc:()=>d,I$:()=>rv,aQ:()=>rM,di:()=>rE,kO:()=>rI,rN:()=>n1,bi:()=>rl,_s:()=>nH,_7:()=>nf,aE:()=>na,kr:()=>nM,Hm:()=>rn,tM:()=>e8,tn:()=>e3,xc:()=>e2,us:()=>nP,IO:()=>no,e_:()=>nK,Fp:()=>nZ,Mi:()=>nv,HF:()=>nO,Eo:()=>nD,b5:()=>n6,Tq:()=>nu,qX:()=>nG,q1:()=>nV,M_:()=>n7,oj:()=>nX,aZ:()=>nr,aW:()=>re,uD:()=>nT,Jo:()=>nn,U$:()=>ni,X6:()=>nw,oN:()=>n8,ah:()=>n2,R4:()=>nz,WQ:()=>nC,r8:()=>rh,ZO:()=>e5,bK:()=>e4,b$:()=>e9,uj:()=>nJ,v5:()=>nq,Ue:()=>nN,Er:()=>nY,oB:()=>e7,kf:()=>nb,mW:()=>n_,Q6:()=>nL,QE:()=>nI,kM:()=>ng,No:()=>rd,Ff:()=>nk,zj:()=>n$,s_:()=>nE,vS:()=>ra,qn:()=>ry,uL:()=>rf,YN:()=>nB});var r,i,o,a,u,l,s,c,h,f,d,p,y,g,m,v={value:()=>{}};function x(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw Error("illegal type: "+t);r[t]=[]}return new w(r)}function w(t){this._=t}function _(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=v,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function b(){}function M(t){return null==t?b:function(){return this.querySelector(t)}}function E(){return[]}function k(t){return null==t?E:function(){return this.querySelectorAll(t)}}function $(t){return function(){return this.matches(t)}}function A(t){return function(e){return e.matches(t)}}w.prototype=x.prototype={constructor:w,on:function(t,e){var n,r=this._,i=(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw Error("unknown type: "+t);return{type:t,name:e}}),o=-1,a=i.length;if(arguments.length<2){for(;++o<a;)if((n=(t=i[o]).type)&&(n=function(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}(r[n],t.name)))return n;return}if(null!=e&&"function"!=typeof e)throw Error("invalid callback: "+e);for(;++o<a;)if(n=(t=i[o]).type)r[n]=_(r[n],t.name,e);else if(null==e)for(n in r)r[n]=_(r[n],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new w(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw Error("unknown type: "+t);for(r=this._[t],o=0,n=r.length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var z=Array.prototype.find;function N(){return this.firstElementChild}var S=Array.prototype.filter;function T(){return Array.from(this.children)}function I(t){return Array(t.length)}function P(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function H(t,e,n,r,i,o){for(var a,u=0,l=e.length,s=o.length;u<s;++u)(a=e[u])?(a.__data__=o[u],r[u]=a):n[u]=new P(t,o[u]);for(;u<l;++u)(a=e[u])&&(i[u]=a)}function B(t,e,n,r,i,o,a){var u,l,s,c=new Map,h=e.length,f=o.length,d=Array(h);for(u=0;u<h;++u)(l=e[u])&&(d[u]=s=a.call(l,l.__data__,u,e)+"",c.has(s)?i[u]=l:c.set(s,l));for(u=0;u<f;++u)s=a.call(t,o[u],u,o)+"",(l=c.get(s))?(r[u]=l,l.__data__=o[u],c.delete(s)):n[u]=new P(t,o[u]);for(u=0;u<h;++u)(l=e[u])&&c.get(d[u])===l&&(i[u]=l)}function L(t){return t.__data__}function C(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}P.prototype={constructor:P,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var O="http://www.w3.org/1999/xhtml";let R={svg:"http://www.w3.org/2000/svg",xhtml:O,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function D(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),R.hasOwnProperty(e)?{space:R[e],local:t}:t}function X(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function j(t,e){return t.style.getPropertyValue(e)||X(t).getComputedStyle(t,null).getPropertyValue(e)}function q(t){return t.trim().split(/^|\s+/)}function Y(t){return t.classList||new V(t)}function V(t){this._node=t,this._names=q(t.getAttribute("class")||"")}function F(t,e){for(var n=Y(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function K(t,e){for(var n=Y(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function W(){this.textContent=""}function U(){this.innerHTML=""}function Z(){this.nextSibling&&this.parentNode.appendChild(this)}function Q(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function G(t){var e=D(t);return(e.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===O&&e.documentElement.namespaceURI===O?e.createElement(t):e.createElementNS(n,t)}})(e)}function J(){return null}function tt(){var t=this.parentNode;t&&t.removeChild(this)}function te(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function tn(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function tr(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)(n=e[r],t.type&&n.type!==t.type||n.name!==t.name)?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function ti(t,e,n){return function(){var r,i=this.__on,o=function(t){e.call(this,t,this.__data__)};if(i){for(var a=0,u=i.length;a<u;++a)if((r=i[a]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),r.value=e;return}}this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function to(t,e,n){var r=X(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}V.prototype={add:function(t){0>this._names.indexOf(t)&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var ta=[null];function tu(t,e){this._groups=t,this._parents=e}function tl(){return new tu([[document.documentElement]],ta)}function ts(t){return"string"==typeof t?new tu([[document.querySelector(t)]],[document.documentElement]):new tu([[t]],ta)}function tc(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}tu.prototype=tl.prototype={constructor:tu,select:function(t){"function"!=typeof t&&(t=M(t));for(var e=this._groups,n=e.length,r=Array(n),i=0;i<n;++i)for(var o,a,u=e[i],l=u.length,s=r[i]=Array(l),c=0;c<l;++c)(o=u[c])&&(a=t.call(o,o.__data__,c,u))&&("__data__"in o&&(a.__data__=o.__data__),s[c]=a);return new tu(r,this._parents)},selectAll:function(t){if("function"==typeof t){var e;e=t,t=function(){var t;return t=e.apply(this,arguments),null==t?[]:Array.isArray(t)?t:Array.from(t)}}else t=k(t);for(var n=this._groups,r=n.length,i=[],o=[],a=0;a<r;++a)for(var u,l=n[a],s=l.length,c=0;c<s;++c)(u=l[c])&&(i.push(t.call(u,u.__data__,c,l)),o.push(u));return new tu(i,o)},selectChild:function(t){var e;return this.select(null==t?N:(e="function"==typeof t?t:A(t),function(){return z.call(this.children,e)}))},selectChildren:function(t){var e;return this.selectAll(null==t?T:(e="function"==typeof t?t:A(t),function(){return S.call(this.children,e)}))},filter:function(t){"function"!=typeof t&&(t=$(t));for(var e=this._groups,n=e.length,r=Array(n),i=0;i<n;++i)for(var o,a=e[i],u=a.length,l=r[i]=[],s=0;s<u;++s)(o=a[s])&&t.call(o,o.__data__,s,a)&&l.push(o);return new tu(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,L);var n=e?B:H,r=this._parents,i=this._groups;"function"!=typeof t&&(v=t,t=function(){return v});for(var o=i.length,a=Array(o),u=Array(o),l=Array(o),s=0;s<o;++s){var c=r[s],h=i[s],f=h.length,d="object"==typeof(m=t.call(c,c&&c.__data__,s,r))&&"length"in m?m:Array.from(m),p=d.length,y=u[s]=Array(p),g=a[s]=Array(p);n(c,h,y,g,l[s]=Array(f),d,e);for(var m,v,x,w,_=0,b=0;_<p;++_)if(x=y[_]){for(_>=b&&(b=_+1);!(w=g[b])&&++b<p;);x._next=w||null}}return(a=new tu(a,r))._enter=u,a._exit=l,a},enter:function(){return new tu(this._enter||this._groups.map(I),this._parents)},exit:function(){return new tu(this._exit||this._groups.map(I),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),u=Array(i),l=0;l<a;++l)for(var s,c=n[l],h=r[l],f=c.length,d=u[l]=Array(f),p=0;p<f;++p)(s=c[p]||h[p])&&(d[p]=s);for(;l<i;++l)u[l]=n[l];return new tu(u,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=C);for(var n=this._groups,r=n.length,i=Array(r),o=0;o<r;++o){for(var a,u=n[o],l=u.length,s=i[o]=Array(l),c=0;c<l;++c)(a=u[c])&&(s[c]=a);s.sort(e)}return new tu(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(let e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=D(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof e?n.local?function(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}:function(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}:n.local?function(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}:function(t,e){return function(){this.setAttribute(t,e)}})(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}:function(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?"":n)):j(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?function(t){return function(){delete this[t]}}:"function"==typeof e?function(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var n=q(t+"");if(arguments.length<2){for(var r=Y(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?function(t,e){return function(){(e.apply(this,arguments)?F:K)(this,t)}}:e?function(t){return function(){F(this,t)}}:function(t){return function(){K(this,t)}})(n,e))},text:function(t){return arguments.length?this.each(null==t?W:("function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?U:("function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(Z)},lower:function(){return this.each(Q)},append:function(t){var e="function"==typeof t?t:G(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:G(t),r=null==e?J:"function"==typeof e?e:M(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(tt)},clone:function(t){return this.select(t?tn:te)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}),a=o.length;if(arguments.length<2){var u=this.node().__on;if(u){for(var l,s=0,c=u.length;s<c;++s)for(r=0,l=u[s];r<a;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value}return}for(u=e?ti:tr,r=0;r<a;++r)this.each(u(o[r],e,n));return this},dispatch:function(t,e){return this.each(("function"==typeof e?function(t,e){return function(){return to(this,t,e.apply(this,arguments))}}:function(t,e){return function(){return to(this,t,e)}})(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};let th={passive:!1},tf={capture:!0,passive:!1};function td(t){t.stopImmediatePropagation()}function tp(t){t.preventDefault(),t.stopImmediatePropagation()}function ty(t){var e=t.document.documentElement,n=ts(t).on("dragstart.drag",tp,tf);"onselectstart"in e?n.on("selectstart.drag",tp,tf):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function tg(t,e){var n=t.document.documentElement,r=ts(t).on("dragstart.drag",null);e&&(r.on("click.drag",tp,tf),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}let tm=t=>()=>t;function tv(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:u,dx:l,dy:s,dispatch:c}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:s,enumerable:!0,configurable:!0},_:{value:c}})}function tx(t){return!t.ctrlKey&&!t.button}function tw(){return this.parentNode}function t_(t,e){return null==e?{x:t.x,y:t.y}:e}function tb(){return navigator.maxTouchPoints||"ontouchstart"in this}function tM(t){return((t=Math.exp(t))+1/t)/2}tv.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};let tE=function t(e,n,r){function i(t,i){var o,a,u=t[0],l=t[1],s=t[2],c=i[0],h=i[1],f=i[2],d=c-u,p=h-l,y=d*d+p*p;if(y<1e-12)a=Math.log(f/s)/e,o=function(t){return[u+t*d,l+t*p,s*Math.exp(e*t*a)]};else{var g=Math.sqrt(y),m=(f*f-s*s+r*y)/(2*s*n*g),v=(f*f-s*s-r*y)/(2*f*n*g),x=Math.log(Math.sqrt(m*m+1)-m);a=(Math.log(Math.sqrt(v*v+1)-v)-x)/e,o=function(t){var r,i,o=t*a,c=tM(x),h=s/(n*g)*(c*(((r=Math.exp(2*(r=e*o+x)))-1)/(r+1))-((i=Math.exp(i=x))-1/i)/2);return[u+h*d,l+h*p,s*c/tM(e*o+x)]}}return o.duration=1e3*a*e/Math.SQRT2,o}return i.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},i}(Math.SQRT2,2,4);var tk,t$,tA=0,tz=0,tN=0,tS=0,tT=0,tI=0,tP="object"==typeof performance&&performance.now?performance:Date,tH="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function tB(){return tT||(tH(tL),tT=tP.now()+tI)}function tL(){tT=0}function tC(){this._call=this._time=this._next=null}function tO(t,e,n){var r=new tC;return r.restart(t,e,n),r}function tR(){tT=(tS=tP.now())+tI,tA=tz=0;try{tB(),++tA;for(var t,e=tk;e;)(t=tT-e._time)>=0&&e._call.call(void 0,t),e=e._next;--tA}finally{tA=0,function(){for(var t,e,n=tk,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:tk=e);t$=t,tX(r)}(),tT=0}}function tD(){var t=tP.now(),e=t-tS;e>1e3&&(tI-=e,tS=t)}function tX(t){!tA&&(tz&&(tz=clearTimeout(tz)),t-tT>24?(t<1/0&&(tz=setTimeout(tR,t-tP.now()-tI)),tN&&(tN=clearInterval(tN))):(tN||(tS=tP.now(),tN=setInterval(tD,1e3)),tA=1,tH(tR)))}function tj(t,e,n){var r=new tC;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}tC.prototype=tO.prototype={constructor:tC,restart:function(t,e,n){if("function"!=typeof t)throw TypeError("callback is not a function");n=(null==n?tB():+n)+(null==e?0:+e),this._next||t$===this||(t$?t$._next=this:tk=this,t$=this),this._call=t,this._time=n,tX()},stop:function(){this._call&&(this._call=null,this._time=1/0,tX())}};var tq=x("start","end","cancel","interrupt"),tY=[];function tV(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(l){var s,c,h,f;if(1!==n.state)return u();for(s in i)if((f=i[s]).name===n.name){if(3===f.state)return tj(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[s]):+s<e&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[s])}if(tj(function(){3===n.state&&(n.state=4,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=Array(h=n.tween.length),s=0,c=-1;s<h;++s)(f=n.tween[s].value.call(t,t.__data__,n.index,n.group))&&(r[++c]=f);r.length=c+1}}function a(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(u),n.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=tO(function(t){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=t&&o(t-n.delay)},0,n.time)}(t,n,{name:e,index:r,group:i,on:tq,tween:tY,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function tF(t,e){var n=tW(t,e);if(n.state>0)throw Error("too late; already scheduled");return n}function tK(t,e){var n=tW(t,e);if(n.state>3)throw Error("too late; already running");return n}function tW(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw Error("transition not found");return n}function tU(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o){if((n=o[i]).name!==e){a=!1;continue}r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]}a&&delete t.__transition}}function tZ(t,e){return t*=1,e*=1,function(n){return t*(1-n)+e*n}}var tQ=180/Math.PI,tG={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function tJ(t,e,n,r,i,o){var a,u,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,l/=u),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*tQ,skewX:Math.atan(l)*tQ,scaleX:a,scaleY:u}}function t0(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u,l,s,c,h=[],f=[];return o=t(o),a=t(a),!function(t,r,i,o,a,u){if(t!==i||r!==o){var l=a.push("translate(",null,e,null,n);u.push({i:l-4,x:tZ(t,i)},{i:l-2,x:tZ(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,h,f),u=o.rotate,l=a.rotate,u!==l?(u-l>180?l+=360:l-u>180&&(u+=360),f.push({i:h.push(i(h)+"rotate(",null,r)-2,x:tZ(u,l)})):l&&h.push(i(h)+"rotate("+l+r),s=o.skewX,c=a.skewX,s!==c?f.push({i:h.push(i(h)+"skewX(",null,r)-2,x:tZ(s,c)}):c&&h.push(i(h)+"skewX("+c+r),!function(t,e,n,r,o,a){if(t!==n||e!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:tZ(t,n)},{i:u-2,x:tZ(e,r)})}else(1!==n||1!==r)&&o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,h,f),o=a=null,function(t){for(var e,n=-1,r=f.length;++n<r;)h[(e=f[n]).i]=e.x(t);return h.join("")}}}var t1=t0(function(t){let e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?tG:tJ(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),t2=t0(function(t){return null==t?tG:(c||(c=document.createElementNS("http://www.w3.org/2000/svg","g")),c.setAttribute("transform",t),t=c.transform.baseVal.consolidate())?tJ((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):tG},", ",")",")");function t5(t,e,n){var r=t._id;return t.each(function(){var t=tK(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return tW(t,r).value[e]}}function t3(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function t8(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function t4(){}var t6="\\s*([+-]?\\d+)\\s*",t9="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",t7="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",et=/^#([0-9a-f]{3,8})$/,ee=RegExp(`^rgb\\(${t6},${t6},${t6}\\)$`),en=RegExp(`^rgb\\(${t7},${t7},${t7}\\)$`),er=RegExp(`^rgba\\(${t6},${t6},${t6},${t9}\\)$`),ei=RegExp(`^rgba\\(${t7},${t7},${t7},${t9}\\)$`),eo=RegExp(`^hsl\\(${t9},${t7},${t7}\\)$`),ea=RegExp(`^hsla\\(${t9},${t7},${t7},${t9}\\)$`),eu={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function el(){return this.rgb().formatHex()}function es(){return this.rgb().formatRgb()}function ec(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=et.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?eh(e):3===n?new ep(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ef(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ef(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=ee.exec(t))?new ep(e[1],e[2],e[3],1):(e=en.exec(t))?new ep(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=er.exec(t))?ef(e[1],e[2],e[3],e[4]):(e=ei.exec(t))?ef(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=eo.exec(t))?ew(e[1],e[2]/100,e[3]/100,1):(e=ea.exec(t))?ew(e[1],e[2]/100,e[3]/100,e[4]):eu.hasOwnProperty(t)?eh(eu[t]):"transparent"===t?new ep(NaN,NaN,NaN,0):null}function eh(t){return new ep(t>>16&255,t>>8&255,255&t,1)}function ef(t,e,n,r){return r<=0&&(t=e=n=NaN),new ep(t,e,n,r)}function ed(t,e,n,r){var i;return 1==arguments.length?((i=t)instanceof t4||(i=ec(i)),i)?new ep((i=i.rgb()).r,i.g,i.b,i.opacity):new ep:new ep(t,e,n,null==r?1:r)}function ep(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function ey(){return`#${ex(this.r)}${ex(this.g)}${ex(this.b)}`}function eg(){let t=em(this.opacity);return`${1===t?"rgb(":"rgba("}${ev(this.r)}, ${ev(this.g)}, ${ev(this.b)}${1===t?")":`, ${t})`}`}function em(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ev(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ex(t){return((t=ev(t))<16?"0":"")+t.toString(16)}function ew(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new eb(t,e,n,r)}function e_(t){if(t instanceof eb)return new eb(t.h,t.s,t.l,t.opacity);if(t instanceof t4||(t=ec(t)),!t)return new eb;if(t instanceof eb)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,u=o-i,l=(o+i)/2;return u?(a=e===o?(n-r)/u+(n<r)*6:n===o?(r-e)/u+2:(e-n)/u+4,u/=l<.5?o+i:2-o-i,a*=60):u=l>0&&l<1?0:a,new eb(a,u,l,t.opacity)}function eb(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function eM(t){return(t=(t||0)%360)<0?t+360:t}function eE(t){return Math.max(0,Math.min(1,t||0))}function ek(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}function e$(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}t3(t4,ec,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:el,formatHex:el,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return e_(this).formatHsl()},formatRgb:es,toString:es}),t3(ep,ed,t8(t4,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new ep(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new ep(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ep(ev(this.r),ev(this.g),ev(this.b),em(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ey,formatHex:ey,formatHex8:function(){return`#${ex(this.r)}${ex(this.g)}${ex(this.b)}${ex((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:eg,toString:eg})),t3(eb,function(t,e,n,r){return 1==arguments.length?e_(t):new eb(t,e,n,null==r?1:r)},t8(t4,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new eb(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new eb(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new ep(ek(t>=240?t-240:t+120,i,r),ek(t,i,r),ek(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new eb(eM(this.h),eE(this.s),eE(this.l),em(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let t=em(this.opacity);return`${1===t?"hsl(":"hsla("}${eM(this.h)}, ${100*eE(this.s)}%, ${100*eE(this.l)}%${1===t?")":`, ${t})`}`}}));let eA=t=>()=>t;function ez(t,e){var n=e-t;return n?function(e){return t+e*n}:eA(isNaN(t)?e:t)}let eN=function t(e){var n,r=1==(n=+e)?ez:function(t,e){var r,i,o;return e-t?(r=t,i=e,r=Math.pow(r,o=n),i=Math.pow(i,o)-r,o=1/o,function(t){return Math.pow(r+t*i,o)}):eA(isNaN(t)?e:t)};function i(t,e){var n=r((t=ed(t)).r,(e=ed(e)).r),i=r(t.g,e.g),o=r(t.b,e.b),a=ez(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return i.gamma=t,i}(1);function eS(t){return function(e){var n,r,i=e.length,o=Array(i),a=Array(i),u=Array(i);for(n=0;n<i;++n)r=ed(e[n]),o[n]=r.r||0,a[n]=r.g||0,u[n]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}eS(function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r<e-1?t[r+2]:2*o-i;return e$((n-r/e)*e,a,i,o,u)}}),eS(function(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],a=t[(r+1)%e],u=t[(r+2)%e];return e$((n-r/e)*e,i,o,a,u)}});var eT=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,eI=RegExp(eT.source,"g");function eP(t,e){var n,r,i,o,a,u=eT.lastIndex=eI.lastIndex=0,l=-1,s=[],c=[];for(t+="",e+="";(i=eT.exec(t))&&(o=eI.exec(e));)(a=o.index)>u&&(a=e.slice(u,a),s[l]?s[l]+=a:s[++l]=a),(i=i[0])===(o=o[0])?s[l]?s[l]+=o:s[++l]=o:(s[++l]=null,c.push({i:l,x:tZ(i,o)})),u=eI.lastIndex;return u<e.length&&(a=e.slice(u),s[l]?s[l]+=a:s[++l]=a),s.length<2?c[0]?(n=c[0].x,function(t){return n(t)+""}):(r=e,function(){return r}):(e=c.length,function(t){for(var n,r=0;r<e;++r)s[(n=c[r]).i]=n.x(t);return s.join("")})}function eH(t,e){var n;return("number"==typeof e?tZ:e instanceof ec?eN:(n=ec(e))?(e=n,eN):eP)(t,e)}var eB=tl.prototype.constructor;function eL(t){return function(){this.style.removeProperty(t)}}var eC=0;function eO(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}var eR=tl.prototype;eO.prototype=(function(t){return tl().transition(t)}).prototype={constructor:eO,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=M(t));for(var r=this._groups,i=r.length,o=Array(i),a=0;a<i;++a)for(var u,l,s=r[a],c=s.length,h=o[a]=Array(c),f=0;f<c;++f)(u=s[f])&&(l=t.call(u,u.__data__,f,s))&&("__data__"in u&&(l.__data__=u.__data__),h[f]=l,tV(h[f],e,n,f,h,tW(u,n)));return new eO(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=k(t));for(var r=this._groups,i=r.length,o=[],a=[],u=0;u<i;++u)for(var l,s=r[u],c=s.length,h=0;h<c;++h)if(l=s[h]){for(var f,d=t.call(l,l.__data__,h,s),p=tW(l,n),y=0,g=d.length;y<g;++y)(f=d[y])&&tV(f,e,n,y,d,p);o.push(d),a.push(l)}return new eO(o,a,e,n)},selectChild:eR.selectChild,selectChildren:eR.selectChildren,filter:function(t){"function"!=typeof t&&(t=$(t));for(var e=this._groups,n=e.length,r=Array(n),i=0;i<n;++i)for(var o,a=e[i],u=a.length,l=r[i]=[],s=0;s<u;++s)(o=a[s])&&t.call(o,o.__data__,s,a)&&l.push(o);return new eO(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw Error();for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=Array(r),u=0;u<o;++u)for(var l,s=e[u],c=n[u],h=s.length,f=a[u]=Array(h),d=0;d<h;++d)(l=s[d]||c[d])&&(f[d]=l);for(;u<r;++u)a[u]=e[u];return new eO(a,this._parents,this._name,this._id)},selection:function(){return new eB(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=++eC,r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],l=u.length,s=0;s<l;++s)if(a=u[s]){var c=tW(a,e);tV(a,t,n,s,u,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new eO(r,this._parents,t,n)},call:eR.call,nodes:eR.nodes,node:eR.node,size:eR.size,empty:eR.empty,each:eR.each,on:function(t,e){var n,r,i,o,a,u,l=this._id;return arguments.length<2?tW(this.node(),l).on.on(t):this.each((n=l,r=t,i=e,u=(r+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})?tF:tK,function(){var t=u(this,n),e=t.on;e!==o&&(a=(o=e).copy()).on(r,i),t.on=a}))},attr:function(t,e){var n=D(t),r="transform"===n?t2:eH;return this.attrTween(t,"function"==typeof e?(n.local?function(t,e,n){var r,i,o;return function(){var a,u,l=n(this);return null==l?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local))===(u=l+"")?null:a===r&&u===i?o:(i=u,o=e(r=a,l))}}:function(t,e,n){var r,i,o;return function(){var a,u,l=n(this);return null==l?void this.removeAttribute(t):(a=this.getAttribute(t))===(u=l+"")?null:a===r&&u===i?o:(i=u,o=e(r=a,l))}})(n,r,t5(this,"attr."+t,e)):null==e?(n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(n):(n.local?function(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}:function(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}})(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw Error();var r=D(t);return this.tween(n,(r.local?function(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(e){this.setAttributeNS(t.space,t.local,i.call(this,e))}),n}return i._value=e,i}:function(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(e){this.setAttribute(t,i.call(this,e))}),n}return i._value=e,i})(r,e))},style:function(t,e,n){var r,i,o,a,u,l,s,c,h,f,d,p,y,g,m,v,x,w,_,b,M,E="transform"==(t+="")?t1:eH;return null==e?this.styleTween(t,(r=t,function(){var t=j(this,r),e=(this.style.removeProperty(r),j(this,r));return t===e?null:t===i&&e===o?a:a=E(i=t,o=e)})).on("end.style."+t,eL(t)):"function"==typeof e?this.styleTween(t,(u=t,l=t5(this,"style."+t,e),function(){var t=j(this,u),e=l(this),n=e+"";return null==e&&(this.style.removeProperty(u),n=e=j(this,u)),t===n?null:t===s&&n===c?h:(c=n,h=E(s=t,e))})).each((f=this._id,x="end."+(v="style."+(d=t)),function(){var t=tK(this,f),e=t.on,n=null==t.value[v]?m||(m=eL(d)):void 0;(e!==p||g!==n)&&(y=(p=e).copy()).on(x,g=n),t.on=y})):this.styleTween(t,(w=t,M=e+"",function(){var t=j(this,w);return t===M?null:t===_?b:b=E(_=t,e)}),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw Error();return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(e){this.style.setProperty(t,o.call(this,e),n)}),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){var e,n;return this.tween("text","function"==typeof t?(e=t5(this,"text",t),function(){var t=e(this);this.textContent=null==t?"":t}):(n=null==t?"":t+"",function(){this.textContent=n}))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw Error();return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){this.textContent=r.call(this,t)}),e}return r._value=t,r}(t))},remove:function(){var t;return this.on("end.remove",(t=this._id,function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=tW(this.node(),n).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?function(t,e){var n,r;return function(){var i=tK(this,t),o=i.tween;if(o!==n){r=n=o;for(var a=0,u=r.length;a<u;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}}i.tween=r}}:function(t,e,n){var r,i;if("function"!=typeof n)throw Error();return function(){var o=tK(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var u={name:e,value:n},l=0,s=i.length;l<s;++l)if(i[l].name===e){i[l]=u;break}l===s&&i.push(u)}o.tween=i}})(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function(t,e){return function(){tF(this,t).delay=+e.apply(this,arguments)}}:function(t,e){return e*=1,function(){tF(this,t).delay=e}})(e,t)):tW(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function(t,e){return function(){tK(this,t).duration=+e.apply(this,arguments)}}:function(t,e){return e*=1,function(){tK(this,t).duration=e}})(e,t)):tW(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw Error();return function(){tK(this,t).ease=e}}(e,t)):tW(this.node(),e).ease},easeVarying:function(t){var e;if("function"!=typeof t)throw Error();return this.each((e=this._id,function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw Error();tK(this,e).ease=n}))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var u={value:a},l={value:function(){0==--i&&o()}};n.each(function(){var n=tK(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(u),e._.interrupt.push(u),e._.end.push(l)),n.on=e}),0===i&&o()})},[Symbol.iterator]:eR[Symbol.iterator]};var eD={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};tl.prototype.interrupt=function(t){return this.each(function(){tU(this,t)})},tl.prototype.transition=function(t){var e,n;t instanceof eO?(e=t._id,t=t._name):(e=++eC,(n=eD).time=tB(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],l=u.length,s=0;s<l;++s)(a=u[s])&&tV(a,t,e,s,u,n||function(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw Error(`transition ${e} not found`);return n}(a,e));return new eO(r,this._parents,t,e)};let eX=t=>()=>t;function ej(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function eq(t,e,n){this.k=t,this.x=e,this.y=n}eq.prototype={constructor:eq,scale:function(t){return 1===t?this:new eq(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new eq(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var eY=new eq(1,0,0);function eV(t){for(;!t.__zoom;)if(!(t=t.parentNode))return eY;return t.__zoom}function eF(t){t.stopImmediatePropagation()}function eK(t){t.preventDefault(),t.stopImmediatePropagation()}function eW(t){return(!t.ctrlKey||"wheel"===t.type)&&!t.button}function eU(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function eZ(){return this.__zoom||eY}function eQ(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function eG(){return navigator.maxTouchPoints||"ontouchstart"in this}function eJ(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function e0(){var t,e,n,r=eW,i=eU,o=eJ,a=eQ,u=eG,l=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],c=250,h=tE,f=x("start","zoom","end"),d=0,p=10;function y(t){t.property("__zoom",eZ).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",k).filter(u).on("touchstart.zoom",$).on("touchmove.zoom",A).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new eq(e,t.x,t.y)}function m(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new eq(t.k,r,i)}function v(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function w(t,e,n,r){t.on("start.zoom",function(){_(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(r).end()}).tween("zoom",function(){var t=arguments,o=_(this,t).event(r),a=i.apply(this,t),u=null==n?v(a):"function"==typeof n?n.apply(this,t):n,l=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),s=this.__zoom,c="function"==typeof e?e.apply(this,t):e,f=h(s.invert(u).concat(l/s.k),c.invert(u).concat(l/c.k));return function(t){if(1===t)t=c;else{var e=f(t),n=l/e[2];t=new eq(n,u[0]-e[0]*n,u[1]-e[1]*n)}o.zoom(null,t)}})}function _(t,e,n){return!n&&t.__zooming||new b(t,e)}function b(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function M(t,...e){if(r.apply(this,arguments)){var n=_(this,e).event(t),i=this.__zoom,u=Math.max(l[0],Math.min(l[1],i.k*Math.pow(2,a.apply(this,arguments)))),c=tc(t);if(n.wheel)(n.mouse[0][0]!==c[0]||n.mouse[0][1]!==c[1])&&(n.mouse[1]=i.invert(n.mouse[0]=c)),clearTimeout(n.wheel);else{if(i.k===u)return;n.mouse=[c,i.invert(c)],tU(this),n.start()}eK(t),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",o(m(g(i,u),n.mouse[0],n.mouse[1]),n.extent,s))}}function E(t,...e){if(!n&&r.apply(this,arguments)){var i=t.currentTarget,a=_(this,e,!0).event(t),u=ts(t.view).on("mousemove.zoom",function(t){if(eK(t),!a.moved){var e=t.clientX-c,n=t.clientY-h;a.moved=e*e+n*n>d}a.event(t).zoom("mouse",o(m(a.that.__zoom,a.mouse[0]=tc(t,i),a.mouse[1]),a.extent,s))},!0).on("mouseup.zoom",function(t){u.on("mousemove.zoom mouseup.zoom",null),tg(t.view,a.moved),eK(t),a.event(t).end()},!0),l=tc(t,i),c=t.clientX,h=t.clientY;ty(t.view),eF(t),a.mouse=[l,this.__zoom.invert(l)],tU(this),a.start()}}function k(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=tc(t.changedTouches?t.changedTouches[0]:t,this),u=n.invert(a),l=n.k*(t.shiftKey?.5:2),h=o(m(g(n,l),a,u),i.apply(this,e),s);eK(t),c>0?ts(this).transition().duration(c).call(w,h,a,t):ts(this).call(y.transform,h,a,t)}}function $(n,...i){if(r.apply(this,arguments)){var o,a,u,l,s=n.touches,c=s.length,h=_(this,i,n.changedTouches.length===c).event(n);for(eF(n),a=0;a<c;++a)l=[l=tc(u=s[a],this),this.__zoom.invert(l),u.identifier],h.touch0?h.touch1||h.touch0[2]===l[2]||(h.touch1=l,h.taps=0):(h.touch0=l,o=!0,h.taps=1+!!t);t&&(t=clearTimeout(t)),o&&(h.taps<2&&(e=l[0],t=setTimeout(function(){t=null},500)),tU(this),h.start())}}function A(t,...e){if(this.__zooming){var n,r,i,a,u=_(this,e).event(t),l=t.changedTouches,c=l.length;for(eK(t),n=0;n<c;++n)i=tc(r=l[n],this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=i:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=i);if(r=u.that.__zoom,u.touch1){var h=u.touch0[0],f=u.touch0[1],d=u.touch1[0],p=u.touch1[1],y=(y=d[0]-h[0])*y+(y=d[1]-h[1])*y,v=(v=p[0]-f[0])*v+(v=p[1]-f[1])*v;r=g(r,Math.sqrt(y/v)),i=[(h[0]+d[0])/2,(h[1]+d[1])/2],a=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!u.touch0)return;i=u.touch0[0],a=u.touch0[1]}u.zoom("touch",o(m(r,i,a),u.extent,s))}}function z(t,...r){if(this.__zooming){var i,o,a=_(this,r).event(t),u=t.changedTouches,l=u.length;for(eF(t),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),i=0;i<l;++i)o=u[i],a.touch0&&a.touch0[2]===o.identifier?delete a.touch0:a.touch1&&a.touch1[2]===o.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(o=tc(o,this),Math.hypot(e[0]-o[0],e[1]-o[1])<p)){var s=ts(this).on("dblclick.zoom");s&&s.apply(this,arguments)}}}return y.transform=function(t,e,n,r){var i=t.selection?t.selection():t;i.property("__zoom",eZ),t!==i?w(t,e,n,r):i.interrupt().each(function(){_(this,arguments).event(r).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()})},y.scaleBy=function(t,e,n,r){y.scaleTo(t,function(){var t=this.__zoom.k,n="function"==typeof e?e.apply(this,arguments):e;return t*n},n,r)},y.scaleTo=function(t,e,n,r){y.transform(t,function(){var t=i.apply(this,arguments),r=this.__zoom,a=null==n?v(t):"function"==typeof n?n.apply(this,arguments):n,u=r.invert(a),l="function"==typeof e?e.apply(this,arguments):e;return o(m(g(r,l),a,u),t,s)},n,r)},y.translateBy=function(t,e,n,r){y.transform(t,function(){return o(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),i.apply(this,arguments),s)},null,r)},y.translateTo=function(t,e,n,r,a){y.transform(t,function(){var t=i.apply(this,arguments),a=this.__zoom,u=null==r?v(t):"function"==typeof r?r.apply(this,arguments):r;return o(eY.translate(u[0],u[1]).scale(a.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,s)},r,a)},b.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var e=ts(this.that).datum();f.call(t,this.that,new ej(t,{sourceEvent:this.sourceEvent,target:y,type:t,transform:this.that.__zoom,dispatch:f}),e)}},y.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:eX(+t),y):a},y.filter=function(t){return arguments.length?(r="function"==typeof t?t:eX(!!t),y):r},y.touchable=function(t){return arguments.length?(u="function"==typeof t?t:eX(!!t),y):u},y.extent=function(t){return arguments.length?(i="function"==typeof t?t:eX([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),y):i},y.scaleExtent=function(t){return arguments.length?(l[0]=+t[0],l[1]=+t[1],y):[l[0],l[1]]},y.translateExtent=function(t){return arguments.length?(s[0][0]=+t[0][0],s[1][0]=+t[1][0],s[0][1]=+t[0][1],s[1][1]=+t[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(t){return arguments.length?(o=t,y):o},y.duration=function(t){return arguments.length?(c=+t,y):c},y.interpolate=function(t){return arguments.length?(h=t,y):h},y.on=function(){var t=f.on.apply(f,arguments);return t===f?y:t},y.clickDistance=function(t){return arguments.length?(d=(t*=1)*t,y):Math.sqrt(d)},y.tapDistance=function(t){return arguments.length?(p=+t,y):p},y}function e1(t,e){var n,r,i=typeof e;return null==e||"boolean"===i?eA(e):("number"===i?tZ:"string"===i?(r=ec(e))?(e=r,eN):eP:e instanceof ec?eN:e instanceof Date?function(t,e){var n=new Date;return t*=1,e*=1,function(r){return n.setTime(t*(1-r)+e*r),n}}:!ArrayBuffer.isView(n=e)||n instanceof DataView?Array.isArray(e)?function(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=Array(i),a=Array(r);for(n=0;n<i;++n)o[n]=e1(t[n],e[n]);for(;n<r;++n)a[n]=e[n];return function(t){for(n=0;n<i;++n)a[n]=o[n](t);return a}}:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?function(t,e){var n,r={},i={};for(n in(null===t||"object"!=typeof t)&&(t={}),(null===e||"object"!=typeof e)&&(e={}),e)n in t?r[n]=e1(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}:tZ:function(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;n<r;++n)i[n]=t[n]*(1-o)+e[n]*o;return i}})(t,e)}eV.prototype=eq.prototype;let e2={error001:(t="react")=>`Seems like you have not used ${"svelte"===t?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${t}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${t} handle id: "${"source"===t?n:r}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:t=>`Edge with id "${t}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},e5=[[-1/0,-1/0],[1/0,1/0]],e3=["Enter"," ","Escape"],e8={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};(r=h||(h={})).Strict="strict",r.Loose="loose",(i=f||(f={})).Free="free",i.Vertical="vertical",i.Horizontal="horizontal",(o=d||(d={})).Partial="partial",o.Full="full";let e4={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};(a=p||(p={})).Bezier="default",a.Straight="straight",a.Step="step",a.SmoothStep="smoothstep",a.SimpleBezier="simplebezier",(u=y||(y={})).Arrow="arrow",u.ArrowClosed="arrowclosed",(l=g||(g={})).Left="left",l.Top="top",l.Right="right",l.Bottom="bottom";let e6={[g.Left]:g.Right,[g.Right]:g.Left,[g.Top]:g.Bottom,[g.Bottom]:g.Top},e9=t=>!!t&&"object"==typeof t&&"id"in t&&"source"in t&&"target"in t,e7=t=>!!t&&"object"==typeof t&&"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),nt=t=>!!t&&"object"==typeof t&&"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),ne=(t,e=[0,0])=>{let{width:n,height:r}=nT(t),i=t.origin??e,o=n*i[0],a=r*i[1];return{x:t.position.x-o,y:t.position.y-a}},nn=(t,e={nodeOrigin:[0,0]})=>{if(0===t.length)return{x:0,y:0,width:0,height:0};let n=!1,r=t.reduce((t,r)=>{let i="string"==typeof r,o=e.nodeLookup||i?void 0:r;return(e.nodeLookup&&(o=i?e.nodeLookup.get(r):nt(r)?r:e.nodeLookup.get(r.id)),o)?(n=!0,nd(t,nm(o,e.nodeOrigin))):t},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?ny(r):{x:0,y:0,width:0,height:0}},nr=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return t.forEach(t=>{(void 0===e.filter||e.filter(t))&&(n=nd(n,nm(t)),r=!0)}),r?ny(n):{x:0,y:0,width:0,height:0}},ni=(t,e,[n,r,i]=[0,0,1],o=!1,a=!1)=>{let u=(e.x-n)/i,l=(e.y-r)/i,s=e.width/i,c=e.height/i,h=[];for(let e of t.values()){let{measured:t,selectable:n=!0,hidden:r=!1}=e;if(a&&!n||r)continue;let i=t.width??e.width??e.initialWidth??0,f=t.height??e.height??e.initialHeight??0,{x:d,y:p}=e.internals.positionAbsolute,y=nx(u,l,s,c,d,p,i,f),g=i*f,m=o&&y>0;(!e.internals.handleBounds||m||y>=g||e.dragging)&&h.push(e)}return h};async function no({nodes:t,width:e,height:n,panZoom:r,minZoom:i,maxZoom:o},a){let u,l;if(0===t.size)return!0;let s=nz(nr((u=new Map,l=a?.nodes?new Set(a.nodes.map(t=>t.id)):null,t.forEach(t=>{let e;if(a?.includeHiddenNodes){let{width:n,height:r}=nT(t);e=n>0&&r>0}else e=!!(t.measured.width&&t.measured.height&&!t.hidden);e&&(!l||l.has(t.id))&&u.set(t.id,t)}),u)),e,n,a?.minZoom??i,a?.maxZoom??o,a?.padding??.1);return await r.setViewport(s,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),!0}function na({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:o}){let a=n.get(t),u=a.parentId?n.get(a.parentId):void 0,{x:l,y:s}=u?u.internals.positionAbsolute:{x:0,y:0},c=a.origin??r,h=a.extent||i;if("parent"!==a.extent||a.expandParent)u&&nS(a.extent)&&(h=[[a.extent[0][0]+l,a.extent[0][1]+s],[a.extent[1][0]+l,a.extent[1][1]+s]]);else if(u){let{width:t,height:e}=nT(u);t&&e&&(h=[[l,s],[l+t,s+e]])}else o?.("005",e2.error005());let f=nS(h)?ns(e,h,a.measured):e;return(void 0===a.measured.width||void 0===a.measured.height)&&o?.("015",e2.error015()),{position:{x:f.x-l+(a.measured.width??0)*c[0],y:f.y-s+(a.measured.height??0)*c[1]},positionAbsolute:f}}async function nu({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:r,onBeforeDelete:i}){let o,a=new Set(t.map(t=>t.id)),u=[];for(let t of n){if(!1===t.deletable)continue;let e=a.has(t.id),n=!e&&t.parentId&&u.find(e=>e.id===t.parentId);(e||n)&&u.push(t)}let l=new Set(e.map(t=>t.id)),s=r.filter(t=>!1!==t.deletable),c=(o=new Set,u.forEach(t=>{o.add(t.id)}),s.filter(t=>o.has(t.source)||o.has(t.target)));for(let t of s)l.has(t.id)&&!c.find(e=>e.id===t.id)&&c.push(t);if(!i)return{edges:c,nodes:u};let h=await i({nodes:u,edges:c});return"boolean"==typeof h?h?{edges:c,nodes:u}:{edges:[],nodes:[]}:h}let nl=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),ns=(t={x:0,y:0},e,n)=>({x:nl(t.x,e[0][0],e[1][0]-(n?.width??0)),y:nl(t.y,e[0][1],e[1][1]-(n?.height??0))});function nc(t,e,n){let{width:r,height:i}=nT(n),{x:o,y:a}=n.internals.positionAbsolute;return ns(t,[[o,a],[o+r,a+i]],e)}let nh=(t,e,n)=>t<e?nl(Math.abs(t-e),1,e)/e:t>n?-nl(Math.abs(t-n),1,e)/e:0,nf=(t,e,n=15,r=40)=>[nh(t.x,r,e.width-r)*n,nh(t.y,r,e.height-r)*n],nd=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),np=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),ny=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),ng=(t,e=[0,0])=>{let{x:n,y:r}=nt(t)?t.internals.positionAbsolute:ne(t,e);return{x:n,y:r,width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}},nm=(t,e=[0,0])=>{let{x:n,y:r}=nt(t)?t.internals.positionAbsolute:ne(t,e);return{x:n,y:r,x2:n+(t.measured?.width??t.width??t.initialWidth??0),y2:r+(t.measured?.height??t.height??t.initialHeight??0)}},nv=(t,e)=>ny(nd(np(t),np(e))),nx=(t,e,n,r,i,o,a,u)=>Math.ceil(Math.max(0,Math.min(t+n,i+a)-Math.max(t,i))*Math.max(0,Math.min(e+r,o+u)-Math.max(e,o))),nw=(t,e)=>nx(t.x,t.y,t.width,t.height,e.x,e.y,e.width,e.height),n_=t=>nb(t.width)&&nb(t.height)&&nb(t.x)&&nb(t.y),nb=t=>!isNaN(t)&&isFinite(t),nM=(t,e)=>(t,e)=>{},nE=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),nk=({x:t,y:e},[n,r,i],o=!1,a=[1,1])=>{let u={x:(t-n)/i,y:(e-r)/i};return o?nE(u,a):u},n$=({x:t,y:e},[n,r,i])=>({x:t*i+n,y:e*i+r});function nA(t,e){if("number"==typeof t)return Math.floor((e-e/(1+t))*.5);if("string"==typeof t&&t.endsWith("px")){let e=parseFloat(t);if(!Number.isNaN(e))return Math.floor(e)}if("string"==typeof t&&t.endsWith("%")){let n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}let nz=(t,e,n,r,i,o)=>{let a=function(t,e,n){if("string"==typeof t||"number"==typeof t){let r=nA(t,n),i=nA(t,e);return{top:r,right:i,bottom:r,left:i,x:2*i,y:2*r}}if("object"==typeof t){let r=nA(t.top??t.y??0,n),i=nA(t.bottom??t.y??0,n),o=nA(t.left??t.x??0,e),a=nA(t.right??t.x??0,e);return{top:r,right:a,bottom:i,left:o,x:o+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(o,e,n),u=nl(Math.min((e-a.x)/t.width,(n-a.y)/t.height),r,i),l=t.x+t.width/2,s=t.y+t.height/2,c=e/2-l*u,h=n/2-s*u,f=function(t,e,n,r,i,o){let{x:a,y:u}=n$(t,[e,n,r]),{x:l,y:s}=n$({x:t.x+t.width,y:t.y+t.height},[e,n,r]);return{left:Math.floor(a),top:Math.floor(u),right:Math.floor(i-l),bottom:Math.floor(o-s)}}(t,c,h,u,e,n),d={left:Math.min(f.left-a.left,0),top:Math.min(f.top-a.top,0),right:Math.min(f.right-a.right,0),bottom:Math.min(f.bottom-a.bottom,0)};return{x:c-d.left+d.right,y:h-d.top+d.bottom,zoom:u}},nN=()=>"u">typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function nS(t){return null!=t&&"parent"!==t}function nT(t){return{width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}}function nI(t){return(t.measured?.width??t.width??t.initialWidth)!==void 0&&(t.measured?.height??t.height??t.initialHeight)!==void 0}function nP(t,e={width:0,height:0},n,r,i){let o={...t},a=r.get(n);if(a){let t=a.origin||i;o.x+=a.internals.positionAbsolute.x-(e.width??0)*t[0],o.y+=a.internals.positionAbsolute.y-(e.height??0)*t[1]}return o}function nH(t,e){if(t.size!==e.size)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function nB(){let t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}}function nL(t){return{...e8,...t||{}}}function nC(t){}function nO(t){return null===t?null:t?"valid":"invalid"}function nR(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:o,y:a}=nV(t),u=nk({x:o-(i?.left??0),y:a-(i?.top??0)},r),{x:l,y:s}=n?nE(u,e):u;return{xSnapped:l,ySnapped:s,...u}}let nD=t=>({width:t.offsetWidth,height:t.offsetHeight}),nX=t=>t?.getRootNode?.()||window?.document,nj=["INPUT","SELECT","TEXTAREA"];function nq(t){let e=t.composedPath?.()?.[0]||t.target;return e?.nodeType===1&&(nj.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey"))}let nY=t=>"clientX"in t,nV=(t,e)=>{let n=nY(t),r=n?t.clientX:t.touches?.[0].clientX,i=n?t.clientY:t.touches?.[0].clientY;return{x:r-(e?.left??0),y:i-(e?.top??0)}},nF=(t,e,n,r,i)=>{let o=e.querySelectorAll(`.${t}`);return o&&o.length?Array.from(o).map(e=>{let o=e.getBoundingClientRect();return{id:e.getAttribute("data-handleid"),type:t,nodeId:i,position:e.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r,...nD(e)}}):null};function nK({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:i,sourceControlY:o,targetControlX:a,targetControlY:u}){let l=.125*t+.375*i+.375*a+.125*n,s=.125*e+.375*o+.375*u+.125*r,c=Math.abs(l-t),h=Math.abs(s-e);return[l,s,c,h]}function nW(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function nU({pos:t,x1:e,y1:n,x2:r,y2:i,c:o}){switch(t){case g.Left:return[e-nW(e-r,o),n];case g.Right:return[e+nW(r-e,o),n];case g.Top:return[e,n-nW(n-i,o)];case g.Bottom:return[e,n+nW(i-n,o)]}}function nZ({sourceX:t,sourceY:e,sourcePosition:n=g.Bottom,targetX:r,targetY:i,targetPosition:o=g.Top,curvature:a=.25}){let[u,l]=nU({pos:n,x1:t,y1:e,x2:r,y2:i,c:a}),[s,c]=nU({pos:o,x1:r,y1:i,x2:t,y2:e,c:a}),[h,f,d,p]=nK({sourceX:t,sourceY:e,targetX:r,targetY:i,sourceControlX:u,sourceControlY:l,targetControlX:s,targetControlY:c});return[`M${t},${e} C${u},${l} ${s},${c} ${r},${i}`,h,f,d,p]}function nQ({sourceX:t,sourceY:e,targetX:n,targetY:r}){let i=Math.abs(n-t)/2,o=Math.abs(r-e)/2;return[n<t?n+i:n-i,r<e?r+o:r-o,i,o]}function nG({sourceNode:t,targetNode:e,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:o="basic"}){if("manual"===o)return r;let a=Math.max(t.parentId||i&&t.selected?t.internals.z:0,e.parentId||i&&e.selected?e.internals.z:0);return(i&&n?r+1e3:r)+a}function nJ({sourceNode:t,targetNode:e,width:n,height:r,transform:i}){let o=nd(nm(t),nm(e));return o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1),nw({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},ny(o))>0}let n0=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`xy-edge__${t}${e||""}-${n}${r||""}`,n1=(t,e,n={})=>{let r,i;if(!t.source||!t.target)return n.onError?.("006",e2.error006()),e;let o=n.getEdgeId||n0;return(i=r=e9(t)?{...t}:{...t,id:o(t)},e.some(t=>t.source===i.source&&t.target===i.target&&(t.sourceHandle===i.sourceHandle||!t.sourceHandle&&!i.sourceHandle)&&(t.targetHandle===i.targetHandle||!t.targetHandle&&!i.targetHandle)))?e:(null===r.sourceHandle&&delete r.sourceHandle,null===r.targetHandle&&delete r.targetHandle,e.concat(r))};function n2({sourceX:t,sourceY:e,targetX:n,targetY:r}){let[i,o,a,u]=nQ({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,i,o,a,u]}let n5={[g.Left]:{x:-1,y:0},[g.Right]:{x:1,y:0},[g.Top]:{x:0,y:-1},[g.Bottom]:{x:0,y:1}},n3=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function n8({sourceX:t,sourceY:e,sourcePosition:n=g.Bottom,targetX:r,targetY:i,targetPosition:o=g.Top,borderRadius:a=5,centerX:u,centerY:l,offset:s=20,stepPosition:c=.5}){let[h,f,d,p,y]=function({source:t,sourcePosition:e=g.Bottom,target:n,targetPosition:r=g.Top,center:i,offset:o,stepPosition:a}){let u,l,s=n5[e],c=n5[r],h={x:t.x+s.x*o,y:t.y+s.y*o},f={x:n.x+c.x*o,y:n.y+c.y*o},d=(({source:t,sourcePosition:e=g.Bottom,target:n})=>e===g.Left||e===g.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:h,sourcePosition:e,target:f}),p=0!==d.x?"x":"y",y=d[p],m=[],v={x:0,y:0},x={x:0,y:0},[,,w,_]=nQ({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(s[p]*c[p]==-1){"x"===p?(u=i.x??h.x+(f.x-h.x)*a,l=i.y??(h.y+f.y)/2):(u=i.x??(h.x+f.x)/2,l=i.y??h.y+(f.y-h.y)*a);let t=[{x:u,y:h.y},{x:u,y:f.y}],e=[{x:h.x,y:l},{x:f.x,y:l}];m=s[p]===y?"x"===p?t:e:"x"===p?e:t}else{let i=[{x:h.x,y:f.y}],a=[{x:f.x,y:h.y}];if(m="x"===p?s.x===y?a:i:s.y===y?i:a,e===r){let e=Math.abs(t[p]-n[p]);if(e<=o){let r=Math.min(o-1,o-e);s[p]===y?v[p]=(h[p]>t[p]?-1:1)*r:x[p]=(f[p]>n[p]?-1:1)*r}}if(e!==r){let t="x"===p?"y":"x",e=s[p]===c[t],n=h[t]>f[t],r=h[t]<f[t];(1===s[p]&&(!e&&n||e&&r)||1!==s[p]&&(!e&&r||e&&n))&&(m="x"===p?i:a)}let d={x:h.x+v.x,y:h.y+v.y},g={x:f.x+x.x,y:f.y+x.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(g.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(g.y-m[0].y))?(u=(d.x+g.x)/2,l=m[0].y):(u=m[0].x,l=(d.y+g.y)/2)}let b={x:h.x+v.x,y:h.y+v.y},M={x:f.x+x.x,y:f.y+x.y};return[[t,...b.x!==m[0].x||b.y!==m[0].y?[b]:[],...m,...M.x!==m[m.length-1].x||M.y!==m[m.length-1].y?[M]:[],n],u,l,w,_]}({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:i},targetPosition:o,center:{x:u,y:l},offset:s,stepPosition:c}),m=`M${h[0].x} ${h[0].y}`;for(let t=1;t<h.length-1;t++)m+=function(t,e,n,r){let i=Math.min(n3(t,e)/2,n3(e,n)/2,r),{x:o,y:a}=e;if(t.x===o&&o===n.x||t.y===a&&a===n.y)return`L${o} ${a}`;if(t.y===a){let e=t.x<n.x?-1:1,r=t.y<n.y?1:-1;return`L ${o+i*e},${a}Q ${o},${a} ${o},${a+i*r}`}let u=t.x<n.x?1:-1,l=t.y<n.y?-1:1;return`L ${o},${a+i*l}Q ${o},${a} ${o+i*u},${a}`}(h[t-1],h[t],h[t+1],a);return[m+=`L${h[h.length-1].x} ${h[h.length-1].y}`,f,d,p,y]}function n4(t){return t&&!!(t.internals.handleBounds||t.handles?.length)&&!!(t.measured.width||t.width||t.initialWidth)}function n6(t){let{sourceNode:e,targetNode:n}=t;if(!n4(e)||!n4(n))return null;let r=e.internals.handleBounds||n9(e.handles),i=n.internals.handleBounds||n9(n.handles),o=rt(r?.source??[],t.sourceHandle),a=rt(t.connectionMode===h.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),t.targetHandle);if(!o||!a)return t.onError?.("008",e2.error008(!o?"source":"target",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;let u=o?.position||g.Bottom,l=a?.position||g.Top,s=n7(e,o,u),c=n7(n,a,l);return{sourceX:s.x,sourceY:s.y,targetX:c.x,targetY:c.y,sourcePosition:u,targetPosition:l}}function n9(t){if(!t)return null;let e=[],n=[];for(let r of t)r.width=r.width??1,r.height=r.height??1,"source"===r.type?e.push(r):"target"===r.type&&n.push(r);return{source:e,target:n}}function n7(t,e,n=g.Left,r=!1){let i=(e?.x??0)+t.internals.positionAbsolute.x,o=(e?.y??0)+t.internals.positionAbsolute.y,{width:a,height:u}=e??nT(t);if(r)return{x:i+a/2,y:o+u/2};switch(e?.position??n){case g.Top:return{x:i+a/2,y:o};case g.Right:return{x:i+a,y:o+u/2};case g.Bottom:return{x:i+a/2,y:o+u};case g.Left:return{x:i,y:o+u/2}}}function rt(t,e){return t&&(e?t.find(t=>t.id===e):t[0])||null}function re(t,e){if(!t)return"";if("string"==typeof t)return t;let n=e?`${e}__`:"";return`${n}${Object.keys(t).sort().map(e=>`${e}=${t[e]}`).join("&")}`}function rn(t,{id:e,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let o=new Set;return t.reduce((t,a)=>([a.markerStart||r,a.markerEnd||i].forEach(r=>{if(r&&"object"==typeof r){let i=re(r,e);o.has(i)||(t.push({id:i,color:r.color||n,...r}),o.add(i))}}),t),[]).sort((t,e)=>t.id.localeCompare(e.id))}let rr={nodeOrigin:[0,0],nodeExtent:e5,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ri={...rr,checkEquality:!0};function ro(t,e){let n={...t};for(let t in e)void 0!==e[t]&&(n[t]=e[t]);return n}function ra(t,e,n){let r=ro(rr,n);for(let n of t.values())if(n.parentId)rs(n,t,e,r);else{let t=ns(ne(n,r.nodeOrigin),nS(n.extent)?n.extent:r.nodeExtent,nT(n));n.internals.positionAbsolute=t}}function ru(t){return"manual"===t}function rl(t,e,n,r={}){let i=ro(ri,r),o={i:0},a=new Map(e),u=i?.elevateNodesOnSelect&&!ru(i.zIndexMode)?1e3:0,l=t.length>0,s=!1;for(let c of(e.clear(),n.clear(),t)){let t=a.get(c.id);if(i.checkEquality&&c===t?.internals.userNode)e.set(c.id,t);else{let n=ns(ne(c,i.nodeOrigin),nS(c.extent)?c.extent:i.nodeExtent,nT(c));t={...i.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:n,handleBounds:function(t,e){if(!t.handles)return t.measured?e?.internals.handleBounds:void 0;let n=[],r=[];for(let e of t.handles){let i={id:e.id,width:e.width??1,height:e.height??1,nodeId:t.id,x:e.x,y:e.y,position:e.position,type:e.type};"source"===e.type?n.push(i):"target"===e.type&&r.push(i)}return{source:n,target:r}}(c,t),z:rc(c,u,i.zIndexMode),userNode:c}},e.set(c.id,t)}void 0!==t.measured&&void 0!==t.measured.width&&void 0!==t.measured.height||t.hidden||(l=!1),c.parentId&&rs(t,e,n,r,o),s||=c.selected??!1}return{nodesInitialized:l,hasSelectedNodes:s}}function rs(t,e,n,r,i){let{elevateNodesOnSelect:o,nodeOrigin:a,nodeExtent:u,zIndexMode:l}=ro(rr,r),s=t.parentId,c=e.get(s);if(!c)return void console.warn(`Parent node ${s} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(t,e){if(!t.parentId)return;let n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}(t,n),i&&!c.parentId&&void 0===c.internals.rootParentIndex&&"auto"===l&&(c.internals.rootParentIndex=++i.i,c.internals.z=c.internals.z+10*i.i),i&&void 0!==c.internals.rootParentIndex&&(i.i=c.internals.rootParentIndex);let{x:h,y:f,z:d}=function(t,e,n,r,i,o){let{x:a,y:u}=e.internals.positionAbsolute,l=nT(t),s=ne(t,n),c=nS(t.extent)?ns(s,t.extent,l):s,h=ns({x:a+c.x,y:u+c.y},r,l);"parent"===t.extent&&(h=nc(h,l,e));let f=rc(t,i,o),d=e.internals.z??0;return{x:h.x,y:h.y,z:d>=f?d+1:f}}(t,c,a,u,o&&!ru(l)?1e3:0,l),{positionAbsolute:p}=t.internals,y=h!==p.x||f!==p.y;(y||d!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:y?{x:h,y:f}:p,z:d}})}function rc(t,e,n){let r=nb(t.zIndex)?t.zIndex:0;return ru(n)?r:r+(t.selected?e:0)}function rh(t,e,n,r=[0,0]){let i=[],o=new Map;for(let n of t){let t=e.get(n.parentId);if(!t)continue;let r=nv(o.get(n.parentId)?.expandedRect??ng(t),n.rect);o.set(n.parentId,{expandedRect:r,parent:t})}return o.size>0&&o.forEach(({expandedRect:e,parent:o},a)=>{let u=o.internals.positionAbsolute,l=nT(o),s=o.origin??r,c=e.x<u.x?Math.round(Math.abs(u.x-e.x)):0,h=e.y<u.y?Math.round(Math.abs(u.y-e.y)):0,f=Math.max(l.width,Math.round(e.width)),d=Math.max(l.height,Math.round(e.height)),p=(f-l.width)*s[0],y=(d-l.height)*s[1];(c>0||h>0||p||y)&&(i.push({id:a,type:"position",position:{x:o.position.x-c+p,y:o.position.y-h+y}}),n.get(a)?.forEach(e=>{t.some(t=>t.id===e.id)||i.push({id:e.id,type:"position",position:{x:e.position.x+c,y:e.position.y+h}})})),(l.width<e.width||l.height<e.height||c||h)&&i.push({id:a,type:"dimensions",setAttributes:!0,dimensions:{width:f+(c?s[0]*c-p:0),height:d+(h?s[1]*h-y:0)}})}),i}function rf(t,e,n,r,i,o,a){let u=r?.querySelector(".xyflow__viewport"),l=!1;if(!u)return{changes:[],updatedInternals:l};let s=[],c=window.getComputedStyle(u),{m22:h}=new window.DOMMatrixReadOnly(c.transform),f=[];for(let r of t.values()){let t=e.get(r.id);if(!t)continue;if(t.hidden){e.set(t.id,{...t,internals:{...t.internals,handleBounds:void 0}}),l=!0;continue}let u=nD(r.nodeElement),c=t.measured.width!==u.width||t.measured.height!==u.height;if(u.width&&u.height&&(c||!t.internals.handleBounds||r.force)){let d=r.nodeElement.getBoundingClientRect(),p=nS(t.extent)?t.extent:o,{positionAbsolute:y}=t.internals;if(t.parentId&&"parent"===t.extent){let n=e.get(t.parentId);n&&(y=nc(y,u,n))}else p&&(y=ns(y,p,u));let g={...t,measured:u,internals:{...t.internals,positionAbsolute:y,handleBounds:{source:nF("source",r.nodeElement,d,h,t.id),target:nF("target",r.nodeElement,d,h,t.id)}}};e.set(t.id,g),t.parentId&&rs(g,e,n,{nodeOrigin:i,zIndexMode:a}),l=!0,c&&(s.push({id:t.id,type:"dimensions",dimensions:u}),t.expandParent&&t.parentId&&f.push({id:t.id,parentId:t.parentId,rect:ng(g,i)}))}}if(f.length>0){let t=rh(f,e,n,i);s.push(...t)}return{changes:s,updatedInternals:l}}async function rd({delta:t,panZoom:e,transform:n,translateExtent:r,width:i,height:o}){if(!e||!t.x&&!t.y)return!1;let a=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[i,o]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function rp(t,e,n,r,i,o){let a=i,u=r.get(a)||new Map;r.set(a,u.set(n,e)),a=`${i}-${t}`;let l=r.get(a)||new Map;if(r.set(a,l.set(n,e)),o){a=`${i}-${t}-${o}`;let u=r.get(a)||new Map;r.set(a,u.set(n,e))}}function ry(t,e,n){for(let r of(t.clear(),e.clear(),n)){let{source:n,target:i,sourceHandle:o=null,targetHandle:a=null}=r,u={edgeId:r.id,source:n,target:i,sourceHandle:o,targetHandle:a},l=`${n}-${o}--${i}-${a}`;rp("source",u,`${i}-${a}--${n}-${o}`,t,n,o),rp("target",u,l,t,i,a),e.set(r.id,r)}}function rg(t,e,n){let r=t;do{if(r?.matches?.(e))return!0;if(r===n)break;r=r?.parentElement}while(r);return!1}function rm({nodeId:t,dragItems:e,nodeLookup:n,dragging:r=!0}){let i=[];for(let[t,o]of e){let e=n.get(t)?.internals.userNode;e&&i.push({...e,position:o.position,dragging:r})}if(!t)return[i[0],i];let o=n.get(t)?.internals.userNode;return[o?{...o,position:e.get(t)?.position||o.position,dragging:r}:i[0],i]}function rv({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:r,onDragStop:i}){let o={x:null,y:null},a=0,u=new Map,l=!1,s={x:0,y:0},c=null,h=!1,f=null,d=!1,p=!1,y=null;return{update:function({noDragClassName:g,handleSelector:m,domNode:v,isSelectable:w,nodeId:_,nodeClickDistance:b=0}){function M({x:t,y:n}){let{nodeLookup:i,nodeExtent:a,snapGrid:l,snapToGrid:s,nodeOrigin:c,onNodeDrag:h,onSelectionDrag:f,onError:d,updateNodePositions:g}=e();o={x:t,y:n};let m=!1,v=u.size>1,x=v&&a?np(nr(u)):null,w=v&&s?function({dragItems:t,snapGrid:e,x:n,y:r}){let i=t.values().next().value;if(!i)return null;let o={x:n-i.distance.x,y:r-i.distance.y},a=nE(o,e);return{x:a.x-o.x,y:a.y-o.y}}({dragItems:u,snapGrid:l,x:t,y:n}):null;for(let[e,r]of u){if(!i.has(e))continue;let o={x:t-r.distance.x,y:n-r.distance.y};s&&(o=w?{x:Math.round(o.x+w.x),y:Math.round(o.y+w.y)}:nE(o,l));let u=null;if(v&&a&&!r.extent&&x){let{positionAbsolute:t}=r.internals,e=t.x-x.x+a[0][0],n=t.x+r.measured.width-x.x2+a[1][0];u=[[e,t.y-x.y+a[0][1]],[n,t.y+r.measured.height-x.y2+a[1][1]]]}let{position:h,positionAbsolute:f}=na({nodeId:e,nextPosition:o,nodeLookup:i,nodeExtent:u||a,nodeOrigin:c,onError:d});m=m||r.position.x!==h.x||r.position.y!==h.y,r.position=h,r.internals.positionAbsolute=f}if(p=p||m,m&&(g(u,!0),y&&(r||h||!_&&f))){let[t,e]=rm({nodeId:_,dragItems:u,nodeLookup:i});r?.(y,u,t,e),h?.(y,t,e),_||f?.(y,e)}}async function E(){if(!c)return;let{transform:t,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=e();if(!i){l=!1,cancelAnimationFrame(a);return}let[u,h]=nf(s,c,r);(0!==u||0!==h)&&(o.x=(o.x??0)-u/t[2],o.y=(o.y??0)-h/t[2],await n({x:u,y:h})&&M(o)),a=requestAnimationFrame(E)}function k(r){let{nodeLookup:i,multiSelectionActive:a,nodesDraggable:l,transform:s,snapGrid:f,snapToGrid:d,selectNodesOnDrag:p,onNodeDragStart:y,onSelectionDragStart:g,unselectNodesAndEdges:m}=e();h=!0,p&&w||a||!_||i.get(_)?.selected||m(),w&&p&&_&&t?.(_);let v=nR(r.sourceEvent,{transform:s,snapGrid:f,snapToGrid:d,containerBounds:c});if(o=v,(u=function(t,e,n,r){let i=new Map;for(let[o,a]of t)if((a.selected||a.id===r)&&(!a.parentId||!function t(e,n){if(!e.parentId)return!1;let r=n.get(e.parentId);return!!r&&(!!r.selected||t(r,n))}(a,t))&&(a.draggable||e&&void 0===a.draggable)){let e=t.get(o);e&&i.set(o,{id:o,position:e.position||{x:0,y:0},distance:{x:n.x-e.internals.positionAbsolute.x,y:n.y-e.internals.positionAbsolute.y},extent:e.extent,parentId:e.parentId,origin:e.origin,expandParent:e.expandParent,internals:{positionAbsolute:e.internals.positionAbsolute||{x:0,y:0}},measured:{width:e.measured.width??0,height:e.measured.height??0}})}return i}(i,l,v,_)).size>0&&(n||y||!_&&g)){let[t,e]=rm({nodeId:_,dragItems:u,nodeLookup:i});n?.(r.sourceEvent,u,t,e),y?.(r.sourceEvent,t,e),_||g?.(r.sourceEvent,e)}}f=ts(v);let $=(function(){var t,e,n,r,i=tx,o=tw,a=t_,u=tb,l={},s=x("start","drag","end"),c=0,h=0;function f(t){t.on("mousedown.drag",d).filter(u).on("touchstart.drag",g).on("touchmove.drag",m,th).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(a,u){if(!r&&i.call(this,a,u)){var l=w(this,o.call(this,a,u),a,u,"mouse");l&&(ts(a.view).on("mousemove.drag",p,tf).on("mouseup.drag",y,tf),ty(a.view),td(a),n=!1,t=a.clientX,e=a.clientY,l("start",a))}}function p(r){if(tp(r),!n){var i=r.clientX-t,o=r.clientY-e;n=i*i+o*o>h}l.mouse("drag",r)}function y(t){ts(t.view).on("mousemove.drag mouseup.drag",null),tg(t.view,n),tp(t),l.mouse("end",t)}function g(t,e){if(i.call(this,t,e)){var n,r,a=t.changedTouches,u=o.call(this,t,e),l=a.length;for(n=0;n<l;++n)(r=w(this,u,t,e,a[n].identifier,a[n]))&&(td(t),r("start",t,a[n]))}}function m(t){var e,n,r=t.changedTouches,i=r.length;for(e=0;e<i;++e)(n=l[r[e].identifier])&&(tp(t),n("drag",t,r[e]))}function v(t){var e,n,i=t.changedTouches,o=i.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),e=0;e<o;++e)(n=l[i[e].identifier])&&(td(t),n("end",t,i[e]))}function w(t,e,n,r,i,o){var u,h,d,p=s.copy(),y=tc(o||n,e);if(null!=(d=a.call(t,new tv("beforestart",{sourceEvent:n,target:f,identifier:i,active:c,x:y[0],y:y[1],dx:0,dy:0,dispatch:p}),r)))return u=d.x-y[0]||0,h=d.y-y[1]||0,function n(o,a,s){var g,m=y;switch(o){case"start":l[i]=n,g=c++;break;case"end":delete l[i],--c;case"drag":y=tc(s||a,e),g=c}p.call(o,t,new tv(o,{sourceEvent:a,subject:d,target:f,identifier:i,active:g,x:y[0]+u,y:y[1]+h,dx:y[0]-m[0],dy:y[1]-m[1],dispatch:p}),r)}}return f.filter=function(t){return arguments.length?(i="function"==typeof t?t:tm(!!t),f):i},f.container=function(t){return arguments.length?(o="function"==typeof t?t:tm(t),f):o},f.subject=function(t){return arguments.length?(a="function"==typeof t?t:tm(t),f):a},f.touchable=function(t){return arguments.length?(u="function"==typeof t?t:tm(!!t),f):u},f.on=function(){var t=s.on.apply(s,arguments);return t===s?f:t},f.clickDistance=function(t){return arguments.length?(h=(t*=1)*t,f):Math.sqrt(h)},f})().clickDistance(b).on("start",t=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:a,snapToGrid:u}=e();c=n?.getBoundingClientRect()||null,d=!1,p=!1,y=t.sourceEvent,0===r&&k(t),o=nR(t.sourceEvent,{transform:i,snapGrid:a,snapToGrid:u,containerBounds:c}),s=nV(t.sourceEvent,c)}).on("drag",t=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:a,nodeDragThreshold:f,nodeLookup:p}=e(),g=nR(t.sourceEvent,{transform:r,snapGrid:i,snapToGrid:a,containerBounds:c});if(y=t.sourceEvent,("touchmove"===t.sourceEvent.type&&t.sourceEvent.touches.length>1||_&&!p.has(_))&&(d=!0),!d){if(!l&&n&&h&&(l=!0,E()),!h){let e=nV(t.sourceEvent,c),n=e.x-s.x,r=e.y-s.y;Math.sqrt(n*n+r*r)>f&&k(t)}(o.x!==g.xSnapped||o.y!==g.ySnapped)&&u&&h&&(s=nV(t.sourceEvent,c),M(g))}}).on("end",t=>{if(!h||d){d&&u.size>0&&e().updateNodePositions(u,!1);return}if(l=!1,h=!1,cancelAnimationFrame(a),u.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:o,onSelectionDragStop:a}=e();if(p&&(r(u,!1),p=!1),i||o||!_&&a){let[e,r]=rm({nodeId:_,dragItems:u,nodeLookup:n,dragging:!1});i?.(t.sourceEvent,u,e,r),o?.(t.sourceEvent,e,r),_||a?.(t.sourceEvent,r)}}}).filter(t=>{let e=t.target;return!t.button&&(!g||!rg(e,`.${g}`,v))&&(!m||rg(e,m,v))});f.call($)},destroy:function(){f?.on(".drag",null)}}}function rx(t,e,n,r,i,o=!1){let a=r.get(t);if(!a)return null;let u="strict"===i?a.internals.handleBounds?.[e]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],l=(n?u?.find(t=>t.id===n):u?.[0])??null;return l&&o?{...l,...n7(a,l,l.position,!0)}:l}function rw(t,e){return t?t:e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null}let r_=()=>!0;function rb(t,{handle:e,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:o,doc:a,lib:u,flowId:l,isValidConnection:s=r_,nodeLookup:c}){let f="target"===o,d=e?a.querySelector(`.${u}-flow__handle[data-id="${l}-${e?.nodeId}-${e?.id}-${e?.type}"]`):null,{x:p,y}=nV(t),g=a.elementFromPoint(p,y),m=g?.classList.contains(`${u}-flow__handle`)?g:d,v={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){let t=rw(void 0,m),e=m.getAttribute("data-nodeid"),o=m.getAttribute("data-handleid"),a=m.classList.contains("connectable"),u=m.classList.contains("connectableend");if(!e||!t)return v;let l={source:f?e:r,sourceHandle:f?o:i,target:f?r:e,targetHandle:f?i:o};v.connection=l,v.isValid=a&&u&&(n===h.Strict?f&&"source"===t||!f&&"target"===t:e!==r||o!==i)&&s(l),v.toHandle=rx(e,t,o,c,n,!0)}return v}let rM={onPointerDown:function(t,{connectionMode:e,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:o,isTarget:a,domNode:u,nodeLookup:l,lib:s,autoPanOnConnect:c,flowId:h,panBy:f,cancelConnection:d,onConnectStart:p,onConnect:y,onConnectEnd:m,isValidConnection:v=r_,onReconnectEnd:x,updateConnection:w,getTransform:_,getFromHandle:b,autoPanSpeed:M,dragThreshold:E=1,handleDomNode:k}){let $,A=nX(t.target),z=0,{x:N,y:S}=nV(t),T=rw(o,k),I=u?.getBoundingClientRect(),P=!1;if(!I||!T)return;let H=rx(i,T,r,l,e);if(!H)return;let B=nV(t,I),L=!1,C=null,O=!1,R=null,D={...H,nodeId:i,type:T,position:H.position},X=l.get(i),j={inProgress:!0,isValid:null,from:n7(X,D,g.Left,!0),fromHandle:D,fromPosition:D.position,fromNode:X,to:B,toHandle:null,toPosition:e6[D.position],toNode:null,pointer:B};function q(){P=!0,w(j),p?.(t,{nodeId:i,handleId:r,handleType:T})}function Y(t){var o,u;let d;if(!P){let{x:e,y:n}=nV(t),r=e-N,i=n-S;if(!(r*r+i*i>E*E))return;q()}if(!b()||!D)return void V(t);let p=_();$=function(t,e,n,r){let i=[],o=1/0;for(let a of function(t,e,n){let r=[],i={x:t.x-n,y:t.y-n,width:2*n,height:2*n};for(let t of e.values())nw(i,ng(t))>0&&r.push(t);return r}(t,n,e+250))for(let n of[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]]){if(r.nodeId===n.nodeId&&r.type===n.type&&r.id===n.id)continue;let{x:u,y:l}=n7(a,n,n.position,!0),s=Math.sqrt(Math.pow(u-t.x,2)+Math.pow(l-t.y,2));s>e||(s<o?(i=[{...n,x:u,y:l}],o=s):s===o&&i.push({...n,x:u,y:l}))}if(!i.length)return null;if(i.length>1){let t="source"===r.type?"target":"source";return i.find(e=>e.type===t)??i[0]}return i[0]}(nk(B=nV(t,I),p,!1,[1,1]),n,l,D),L||(!function t(){if(!c||!I)return;let[e,n]=nf(B,I,M);f({x:e,y:n}),z=requestAnimationFrame(t)}(),L=!0);let y=rb(t,{handle:$,connectionMode:e,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:v,doc:A,lib:s,flowId:h,nodeLookup:l});R=y.handleDomNode,C=y.connection,o=!!$,u=y.isValid,d=null,u?d=!0:o&&!u&&(d=!1),O=d;let m=l.get(i),x=m?n7(m,D,g.Left,!0):j.from,k={...j,from:x,isValid:O,to:y.toHandle&&O?n$({x:y.toHandle.x,y:y.toHandle.y},p):B,toHandle:y.toHandle,toPosition:O&&y.toHandle?y.toHandle.position:e6[D.position],toNode:y.toHandle?l.get(y.toHandle.nodeId):null,pointer:B};w(k),j=k}function V(t){if(!("touches"in t)||!(t.touches.length>0)){if(P){($||R)&&C&&O&&y?.(C);let{inProgress:e,...n}=j,r={...n,toPosition:j.toHandle?j.toPosition:null};m?.(t,r),o&&x?.(t,r)}d(),cancelAnimationFrame(z),L=!1,O=!1,C=null,R=null,A.removeEventListener("mousemove",Y),A.removeEventListener("mouseup",V),A.removeEventListener("touchmove",Y),A.removeEventListener("touchend",V)}}0===E&&q(),A.addEventListener("mousemove",Y),A.addEventListener("mouseup",V),A.addEventListener("touchmove",Y),A.addEventListener("touchend",V)},isValid:rb};function rE({domNode:t,panZoom:e,getTransform:n,getViewScale:r}){let i=ts(t);return{update:function({translateExtent:t,width:o,height:a,zoomStep:u=1,pannable:l=!0,zoomable:s=!0,inversePan:c=!1}){let h=[0,0],f=e0().on("start",t=>{("mousedown"===t.sourceEvent.type||"touchstart"===t.sourceEvent.type)&&(h=[t.sourceEvent.clientX??t.sourceEvent.touches[0].clientX,t.sourceEvent.clientY??t.sourceEvent.touches[0].clientY])}).on("zoom",l?i=>{let u=n();if("mousemove"!==i.sourceEvent.type&&"touchmove"!==i.sourceEvent.type||!e)return;let l=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],s=[l[0]-h[0],l[1]-h[1]];h=l;let f=r()*Math.max(u[2],Math.log(u[2]))*(c?-1:1),d={x:u[0]-s[0]*f,y:u[1]-s[1]*f};e.setViewportConstrained({x:d.x,y:d.y,zoom:u[2]},[[0,0],[o,a]],t)}:null).on("zoom.wheel",s?t=>{if("wheel"!==t.sourceEvent.type||!e)return;let r=n(),i=t.sourceEvent.ctrlKey&&nN()?10:1,o=-t.sourceEvent.deltaY*(1===t.sourceEvent.deltaMode?.05:t.sourceEvent.deltaMode?1:.002)*u,a=r[2]*Math.pow(2,o*i);e.scaleTo(a)}:null);i.call(f,{})},destroy:function(){i.on("zoom",null)},pointer:tc}}let rk=t=>({x:t.x,y:t.y,zoom:t.k}),r$=({x:t,y:e,zoom:n})=>eY.translate(t,e).scale(n),rA=(t,e)=>t.target.closest(`.${e}`),rz=(t,e)=>2===e&&Array.isArray(t)&&t.includes(2),rN=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,rS=(t,e=0,n=rN,r=()=>{})=>{let i="number"==typeof e&&e>0;return i||r(),i?t.transition().duration(e).ease(n).on("end",r):t},rT=t=>{let e=t.ctrlKey&&nN()?10:1;return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*e};function rI({domNode:t,minZoom:e,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:o,onPanZoomStart:a,onPanZoomEnd:u,onDraggingChange:l}){let s={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},c=t.getBoundingClientRect(),h=[[0,0],[c.width,c.height]],d="u">typeof ResizeObserver?new ResizeObserver(t=>{let e=t[0];e&&(h=[[0,0],[e.contentRect.width,e.contentRect.height]])}):null;d?.observe(t);let p=e0().extent(()=>h).scaleExtent([e,n]).translateExtent(r),y=ts(t).call(p);w({x:i.x,y:i.y,zoom:nl(i.zoom,e,n)},[[0,0],[c.width,c.height]],r);let g=y.on("wheel.zoom"),m=y.on("dblclick.zoom");async function v(t,e){return!!y&&new Promise(n=>{p?.interpolate(e?.interpolate==="linear"?e1:tE).transform(rS(y,e?.duration,e?.ease,()=>n(!0)),t)})}function x(){p.on("zoom",null)}async function w(t,e,n){let r=r$(t),i=p?.constrain()(r,e,n);return i&&await v(i),i}return p.wheelDelta(rT),{update:function({noWheelClassName:t,noPanClassName:e,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:c,panOnScrollMode:h,panOnScrollSpeed:d,preventScrolling:v,zoomOnPinch:w,zoomOnScroll:_,zoomOnDoubleClick:b,panActivationKeyPressed:M=!1,zoomActivationKeyPressed:E,lib:k,onTransformChange:$,connectionInProgress:A,paneClickDistance:z,selectionOnDrag:N}){r&&!s.isZoomingOrPanning&&x();let S=i&&!E&&!r;p.clickDistance(N?1/0:!nb(z)||z<0?0:z);let T=S?function({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:o,zoomOnPinch:a,onPanZoomStart:u,onPanZoom:l,onPanZoomEnd:s}){return c=>{if(rA(c,e))return c.ctrlKey&&c.preventDefault(),!1;c.preventDefault(),c.stopImmediatePropagation();let h=n.property("__zoom").k||1;if(c.ctrlKey&&a){let t=tc(c),e=h*Math.pow(2,rT(c));r.scaleTo(n,e,t,c);return}let d=1===c.deltaMode?20:1,p=i===f.Vertical?0:c.deltaX*d,y=i===f.Horizontal?0:c.deltaY*d;!nN()&&c.shiftKey&&i!==f.Vertical&&(p=c.deltaY*d,y=0),r.translateBy(n,-(p/h)*o,-(y/h)*o,{internal:!0});let g=rk(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?l?.(c,g):(t.isPanScrolling=!0,u?.(c,g)),t.panScrollTimeout=setTimeout(()=>{s?.(c,g),t.isPanScrolling=!1},150)}}({zoomPanValues:s,noWheelClassName:t,d3Selection:y,d3Zoom:p,panOnScrollMode:h,panOnScrollSpeed:d,zoomOnPinch:w,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:u}):function({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(r,i){let o="wheel"===r.type,a=!e&&o&&!r.ctrlKey,u=rA(r,t);if(r.ctrlKey&&o&&u&&r.preventDefault(),a||u)return null;r.preventDefault(),n.call(this,r,i)}}({noWheelClassName:t,preventScrolling:v,d3ZoomHandler:g});y.on("wheel.zoom",T,{passive:!1});let I=function({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=rk(r.transform);t.mouseButton=r.sourceEvent?.button||0,t.isZoomingOrPanning=!0,t.prevViewport=i,r.sourceEvent?.type==="mousedown"&&e(!0),n&&n?.(r.sourceEvent,i)}}({zoomPanValues:s,onDraggingChange:l,onPanZoomStart:a});p.on("start",I);let P=function({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return o=>{t.usedRightMouseButton=!!(n&&rz(e,t.mouseButton??0)),o.sourceEvent?.sync||r([o.transform.x,o.transform.y,o.transform.k]),i&&!o.sourceEvent?.internal&&i?.(o.sourceEvent,rk(o.transform))}}({zoomPanValues:s,panOnDrag:c,onPaneContextMenu:!!n,onPanZoom:o,onTransformChange:$});p.on("zoom",P);let H=function({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:o}){return a=>{if(!a.sourceEvent?.internal&&(t.isZoomingOrPanning=!1,o&&rz(e,t.mouseButton??0)&&!t.usedRightMouseButton&&a.sourceEvent&&o(a.sourceEvent),t.usedRightMouseButton=!1,r(!1),i)){let e=rk(a.transform);t.prevViewport=e,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{i?.(a.sourceEvent,e)},150*!!n)}}}({zoomPanValues:s,panOnDrag:c,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:u,onDraggingChange:l});p.on("end",H);let B=function({panActivationKeyPressed:t,zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:o,zoomOnDoubleClick:a,userSelectionActive:u,noWheelClassName:l,noPanClassName:s,lib:c,connectionInProgress:h}){return f=>{let d=e||n,p=r&&f.ctrlKey,y="wheel"===f.type;if(1===f.button&&"mousedown"===f.type&&(rA(f,`${c}-flow__node`)||rA(f,`${c}-flow__edge`)||rA(f,`${c}-flow__selection`)||rA(f,`${c}-flow__nodesselection`)))return!0;if(!i&&!d&&!o&&!a&&!r||u||h&&!y||rA(f,l)&&y||rA(f,s)&&(!y||o&&y&&!e)||!r&&f.ctrlKey&&y)return!1;if(!r&&"touchstart"===f.type&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!o&&!p&&y||!i&&("mousedown"===f.type||"touchstart"===f.type)||Array.isArray(i)&&!i.includes(f.button)&&"mousedown"===f.type)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||y||t)&&g}}({panActivationKeyPressed:M,zoomActivationKeyPressed:E,panOnDrag:c,zoomOnScroll:_,panOnScroll:i,zoomOnDoubleClick:b,zoomOnPinch:w,userSelectionActive:r,noPanClassName:e,noWheelClassName:t,lib:k,connectionInProgress:A});p.filter(B),b?y.on("dblclick.zoom",m):y.on("dblclick.zoom",null)},destroy:x,setViewport:async function t(t,e){let n=r$(t);return await v(n,e),n},setViewportConstrained:w,getViewport:function(){let t=y?eV(y.node()):{x:0,y:0,k:1};return{x:t.x,y:t.y,zoom:t.k}},scaleTo:async function t(t,e){return!!y&&new Promise(n=>{p?.interpolate(e?.interpolate==="linear"?e1:tE).scaleTo(rS(y,e?.duration,e?.ease,()=>n(!0)),t)})},scaleBy:async function t(t,e){return!!y&&new Promise(n=>{p?.interpolate(e?.interpolate==="linear"?e1:tE).scaleBy(rS(y,e?.duration,e?.ease,()=>n(!0)),t)})},setScaleExtent:function(t){p?.scaleExtent(t)},setTranslateExtent:function(t){p?.translateExtent(t)},syncViewport:function(t){if(y){let e=r$(t),n=y.property("__zoom");(n.k!==t.zoom||n.x!==t.x||n.y!==t.y)&&p?.transform(y,e,null,{sync:!0})}},setClickDistance:function(t){let e=!nb(t)||t<0?0:t;p?.clickDistance(e)}}}(s=m||(m={})).Line="line",s.Handle="handle"},69684:(t,e,n)=>{"use strict";n.d(e,{A:()=>function t(e){if("string"==typeof e||"number"==typeof e)return""+e;let n="";if(Array.isArray(e))for(let r=0,i;r<e.length;r++)""!==(i=t(e[r]))&&(n+=(n&&" ")+i);else for(let t in e)e[t]&&(n+=(n&&" ")+t);return n}})},82282:(t,e,n)=>{"use strict";n.d(e,{h:()=>h,n:()=>s});var r=n(12115),i=n(94577);let o=t=>{let e,n=new Set,r=(t,r)=>{let i="function"==typeof t?t(e):t;if(!Object.is(i,e)){let t=e;e=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},e,i),n.forEach(n=>n(e,t))}},i=()=>e,o={setState:r,getState:i,getInitialState:()=>a,subscribe:t=>(n.add(t),()=>n.delete(t)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=e=t(r,i,o);return o},{useDebugValue:a}=r,{useSyncExternalStoreWithSelector:u}=i,l=t=>t;function s(t,e=l,n){let r=u(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return a(r),r}let c=(t,e)=>{let n=t?o(t):o,r=(t,r=e)=>s(n,t,r);return Object.assign(r,n),r},h=(t,e)=>t?c(t,e):c},94907:(t,e,n)=>{"use strict";function r(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(let[n,r]of t)if(!Object.is(r,e.get(n)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(let n of t)if(!e.has(n))return!1;return!0}let n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}n.d(e,{x:()=>r})}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5521],{16317:(e,t,n)=>{Promise.resolve().then(n.bind(n,71362))},18349:(e,t,n)=>{"use strict";n.d(t,{T:()=>l});var r=n(95155);n(12115);var a=n(40980);function l({className:e,...t}){return(0,r.jsx)("textarea",{"data-slot":"textarea",className:(0,a.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})}},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),o=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 o=0,s=0,i=0;for(let e=0;e<a.length&&o<n.length;e+=1){if(a[e]!==n[o]){i=0;continue}s+=12,(i+=1)>1&&(s+=18*i),r(t,e)&&(s+=40),o+=1}if(o<n.length)return null;let d=t.split(/[_\-\s.]+/).map(e=>e[0]??"").join("").toLocaleLowerCase();return d.startsWith(n)?s+=2200:d.includes(n)&&(s+=700),s-(a.length-n.length)}(e,n);null!==t&&(null===o||t>o)&&(o=t)}null!==o&&a.push({item:l,score:o})}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})},42763:(e,t,n)=>{"use strict";n.d(t,{Cf:()=>g,Es:()=>v,L3:()=>j,c7:()=>b,lG:()=>x,rr:()=>y});var r=n(95155);n(12115);var a=n(98408),l=n(32949),o=n(45477),s=n(88593),i=n(52579),d=n(11975),u=n(31799),c=n(40980),m=n(89239),f=n(13267);function x({...e}){return(0,r.jsx)(a.D,{"data-slot":"dialog",...e})}function p({...e}){return(0,r.jsx)(l.Z,{"data-slot":"dialog-portal",...e})}function h({className:e,...t}){return(0,r.jsx)(o.X,{"data-slot":"dialog-overlay",className:(0,c.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function g({className:e,children:t,showCloseButton:n=!0,...a}){return(0,r.jsxs)(p,{children:[(0,r.jsx)(h,{}),(0,r.jsxs)(s.h,{"data-slot":"dialog-content",className:(0,c.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...a,children:[t,n&&(0,r.jsxs)(i.H,{"data-slot":"dialog-close",render:(0,r.jsx)(m.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,r.jsx)(f.yBK,{}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function b({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"dialog-header",className:(0,c.cn)("flex flex-col gap-2",e),...t})}function v({className:e,showCloseButton:t=!1,children:n,...a}){return(0,r.jsxs)("div",{"data-slot":"dialog-footer",className:(0,c.cn)("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...a,children:[n,t&&(0,r.jsx)(i.H,{render:(0,r.jsx)(m.$,{variant:"outline"}),children:"Close"})]})}function j({className:e,...t}){return(0,r.jsx)(d.L,{"data-slot":"dialog-title",className:(0,c.cn)("font-heading text-base leading-none font-medium",e),...t})}function y({className:e,...t}){return(0,r.jsx)(u.r,{"data-slot":"dialog-description",className:(0,c.cn)("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}},60529:(e,t,n)=>{"use strict";n.d(t,{p:()=>o});var r=n(95155);n(12115);var a=n(64878),l=n(40980);function o({className:e,type:t,...n}){return(0,r.jsx)(a.p,{type:t,"data-slot":"input",className:(0,l.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none 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),...n})}},71362:(e,t,n)=>{"use strict";n.d(t,{TableView:()=>tF});var r=n(95155),a=n(12115),l=n(98500),o=n.n(l),s=n(73321),i=n(13267),d=n(36331),u=n(17491),c=n(40891),m=n(89239),f=n(86846),x=n(87364);function p(e,t){let[n,r]=(0,a.useState)(e);return(0,a.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var h=n(27529),g=n(24866),b=n(95848);let v=["name","title","label","username","display_name","full_name","slug","handle","email","first_name"],j=new Set(["text","varchar","bpchar","citext","name"]);function y(e,t){return e.find(e=>e.schema===t.schema&&e.name===t.name)}function w(e,t){return e?.foreignKeys?.find(e=>e.columns.includes(t))}function N(e,t){return`${(0,b.i)(e)}:${JSON.stringify(t.map(e=>null===e?null:String(e)))}`}function k(e,t,n){let r=e.columns.map(e=>{let r=t.indexOf(e);return r>=0?n[r]??null:null});return r.some(e=>null===e)?null:r}function C(e,t){let n=e.filter(e=>!t.includes(e.name));for(let e of v){let t=n.find(t=>t.name.toLocaleLowerCase()===e);if(t)return t.name}let r=n.find(e=>"S"===e.typeCategory||j.has(e.dataType));return r?.name??n[0]?.name??null}function S(e,t,n){if(!n)return null;let r=e.indexOf(n);if(r<0)return null;let a=t[r];if(null===a||""===a)return null;let l=String(a);return l.trim()?l:null}function $(e,t){return e.flatMap((e,n)=>{let r=t[n];return null===r?[]:[{...(0,g.x7)(e),operator:"eq",value:String(r)}]})}var z=n(40544),E=n(19065),T=n(43262),O=n(40980);function I({columns:e,resetKey:t,onActiveColumn:n}){let[l,o]=(0,a.useState)(!1),[s,i]=(0,a.useState)(""),[d,u]=(0,a.useState)(0),c=(0,a.useRef)(null),m=(0,a.useRef)(null),f=(0,a.useRef)(null),x=(0,a.useRef)(null),p=(0,a.useRef)(n),h=(0,a.useMemo)(()=>(0,E.R6)(s,e,e=>e.name),[s,e]),g=0===h.length?null:h[d%h.length]??null;function b(){null!==f.current&&(window.clearTimeout(f.current),f.current=null)}function v(e,t=0){b(),p.current(e),e&&t>0&&(f.current=window.setTimeout(()=>{p.current(null),f.current=null},t))}function j(e){let t=x.current;o(!1),i(""),u(0),e&&t?v(t,1400):v(null)}function y(e){0!==h.length&&u(t=>(t+e+h.length)%h.length)}if((0,a.useEffect)(()=>{p.current=n},[n]),(0,a.useEffect)(()=>{x.current=g?.item.name??null},[g?.item.name]),(0,a.useEffect)(()=>{o(!1),i(""),u(0),b(),p.current(null)},[t]),(0,a.useEffect)(()=>{l&&v(g?.item.name??null)},[l,g?.item.name]),(0,a.useEffect)(()=>{if(!l)return;let e=window.requestAnimationFrame(()=>c.current?.focus());return()=>window.cancelAnimationFrame(e)},[l]),(0,a.useEffect)(()=>{function t(){if(0!==e.length){if(b(),l)return void c.current?.select();i(""),u(0),o(!0)}}function n(e){if((e.metaKey||e.ctrlKey)&&"/"===e.key){if(document.querySelector("[data-slot=dialog-content], [data-table-palette], [data-command-palette]"))return;e.preventDefault(),t();return}l&&"Escape"===e.key&&(e.preventDefault(),j(!1))}window.addEventListener("keydown",n);let r=(0,T.US)(t);return()=>{window.removeEventListener("keydown",n),r()}},[l,e.length]),(0,a.useEffect)(()=>()=>b(),[]),!l)return null;let w=s.trim()?g?g.item.name:"no match":"type a column";return(0,r.jsxs)("div",{ref:m,className:"pointer-events-auto absolute bottom-2 left-2 z-30 flex max-w-[min(28rem,calc(100%-1rem))] items-center gap-2 rounded-md border bg-background/95 px-2 py-1 font-mono text-xs shadow-sm backdrop-blur-sm",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:":"}),(0,r.jsx)("input",{ref:c,value:s,onChange:e=>{i(e.target.value),u(0)},onKeyDown:function(e){if("ArrowDown"===e.key||"Tab"===e.key&&!e.shiftKey){e.preventDefault(),y(1);return}if("ArrowUp"===e.key||"Tab"===e.key&&e.shiftKey){e.preventDefault(),y(-1);return}"Enter"===e.key&&(e.preventDefault(),j(!0))},onBlur:e=>{m.current?.contains(e.relatedTarget)||j(!0)},spellCheck:!1,autoComplete:"off",autoCorrect:"off","aria-label":"Jump to column",className:"w-36 min-w-0 bg-transparent text-foreground outline-none placeholder:text-muted-foreground/50",placeholder:"column"}),(0,r.jsx)("span",{className:(0,O.cn)("min-w-0 truncate",g?"text-foreground":"text-muted-foreground"),title:g?.item.name,children:w}),h.length>1&&(0,r.jsxs)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:[d+1,"/",h.length]})]})}var D=n(72264),M=n(60529);function K({columns:e,pinnedColumns:t,hiddenColumns:n,onTogglePin:l,onToggleHidden:o,onReset:s}){let[d,u]=(0,a.useState)(""),c=new Set(t),f=new Set(n),x=n.filter(t=>e.some(e=>e.name===t)).length,p=(0,a.useMemo)(()=>{let t=d.trim().toLocaleLowerCase();return t?e.filter(e=>e.name.toLocaleLowerCase().includes(t)):e},[e,d]);return(0,r.jsxs)(D.rI,{onOpenChange:e=>{e||u("")},children:[(0,r.jsxs)(D.ty,{render:(0,r.jsx)(m.$,{variant:"ghost",size:"sm"}),className:"cursor-pointer",children:[(0,r.jsx)(i.x2U,{"data-icon":"inline-start"}),"Columns",x>0&&(0,r.jsxs)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] tabular-nums text-muted-foreground",children:[e.length-x,"/",e.length]})]}),(0,r.jsxs)(D.SQ,{align:"end",sideOffset:6,className:"w-72 min-w-72 p-0",children:[(0,r.jsx)("div",{className:"p-2 pb-1.5",children:(0,r.jsx)(M.p,{value:d,onChange:e=>u(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:"Filter columns","aria-label":"Filter columns",className:"h-8"})}),(0,r.jsx)("div",{className:"max-h-72 overflow-auto px-1 pb-1",children:0===p.length?(0,r.jsx)("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:"No columns"}):p.map(t=>{let n=c.has(t.name),a=f.has(t.name),s=!a&&e.length-f.size<=1;return(0,r.jsxs)("div",{className:"flex items-center gap-0.5 rounded-lg px-0.5 py-0.5 hover:bg-accent",children:[(0,r.jsx)(m.$,{type:"button",variant:"ghost",size:"icon-xs","aria-label":n?`Unpin ${t.name}`:`Pin ${t.name}`,"aria-pressed":n,title:n?"Unpin column":"Pin column to the left",disabled:a,onClick:()=>l(t.name),className:(0,O.cn)("text-muted-foreground",n&&"text-foreground"),children:n?(0,r.jsx)(i.M0d,{}):(0,r.jsx)(i.rq5,{})}),(0,r.jsx)(m.$,{type:"button",variant:"ghost",size:"icon-xs","aria-label":a?`Show ${t.name}`:`Hide ${t.name}`,"aria-pressed":!a,title:a?"Show column":"Hide column",disabled:s,onClick:()=>o(t.name),className:"text-muted-foreground",children:a?(0,r.jsx)(i.E9H,{}):(0,r.jsx)(i.H0j,{})}),(0,r.jsx)("span",{className:(0,O.cn)("min-w-0 flex-1 truncate px-1 font-mono text-xs",t.isPrimaryKey&&"font-semibold",a&&"text-muted-foreground line-through"),title:t.name,children:t.name}),(0,r.jsx)("span",{className:"max-w-20 shrink-0 truncate pr-1 text-[10px] text-muted-foreground",children:t.type})]},t.name)})}),(0,r.jsx)(D.mB,{className:"mx-0"}),(0,r.jsx)("div",{className:"p-1",children:(0,r.jsxs)(D._2,{onClick:s,children:[(0,r.jsx)(i.zRt,{}),"Reset columns"]})})]})]})}var R=n(81312),L=n(98770),_=n(90469),P=n(56385),U=n(8613),F=n(83227),A=n(30030);function B(e){return(0,r.jsx)(R.D,{"data-slot":"context-menu",...e})}function q(e){return(0,r.jsx)(L.R,{"data-slot":"context-menu-trigger",...e})}function V({className:e,sideOffset:t=2,...n}){return(0,r.jsx)(_.g,{children:(0,r.jsx)(P.y,{sideOffset:t,className:"isolate z-50",children:(0,r.jsx)(U._,{"data-slot":"context-menu-content",className:(0,O.cn)("z-50 w-max max-w-(--available-width) min-w-48 origin-(--transform-origin) rounded-xl bg-popover p-1.5 text-popover-foreground shadow-xl ring-1 ring-foreground/10 outline-none duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n})})})}function W({className:e,variant:t="default",...n}){return(0,r.jsx)(F.D,{"data-slot":"context-menu-item","data-variant":t,className:(0,O.cn)("flex h-8 cursor-pointer items-center gap-2 rounded-lg px-2 text-sm whitespace-nowrap outline-none select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:data-highlighted:bg-destructive/10 data-[variant=destructive]:data-highlighted:text-destructive dark:data-[variant=destructive]:data-highlighted:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:size-3.5 [&_svg]:shrink-0 data-[variant=destructive]:*:[svg]:text-destructive",e),...n})}function J({className:e,...t}){return(0,r.jsx)(A.w,{"data-slot":"context-menu-separator",className:(0,O.cn)("-mx-1 my-1 h-px bg-border",e),...t})}var H=n(42763);function G(e){if("string"!=typeof e)return null;let t=e.trim();if(""===t||/\s/.test(t))return null;try{let e=new URL(t);if("http:"!==e.protocol&&"https:"!==e.protocol)return null;return e.href}catch{return null}}var X=n(82208),Y=n(99447),Q=n(91763),Z=n(44118),ee=n(75184),et=n(59739),en=n(70943),er=n(4835),ea=n(11699),el=n(29381),eo=n(34181),es=n(50955),ei=n(58585),ed=n(76286),eu=n(73255),ec=n(19766),em=n(43208),ef=n(77255),ex=n(8651),ep=n(40633);let eh=ee.H;function eg({className:e,...t}){return(0,r.jsx)(et.s,{"data-slot":"select-group",className:(0,O.cn)("scroll-my-1 p-1",e),...t})}function eb({className:e,...t}){return(0,r.jsx)(en.y,{"data-slot":"select-value",className:(0,O.cn)("flex flex-1 text-left",e),...t})}function ev({className:e,size:t="default",children:n,...a}){return(0,r.jsxs)(er.b,{"data-slot":"select-trigger","data-size":t,className:(0,O.cn)("flex w-fit cursor-pointer items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none hover:bg-muted/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...a,children:[n,(0,r.jsx)(ea.w,{render:(0,r.jsx)(i.RQe,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function ej({className:e,children:t,side:n="bottom",sideOffset:a=4,align:l="center",alignOffset:o=0,alignItemWithTrigger:s=!0,...i}){return(0,r.jsx)(el.V,{children:(0,r.jsx)(eo.l,{side:n,sideOffset:a,align:l,alignOffset:o,alignItemWithTrigger:s,className:"isolate z-80",children:(0,r.jsxs)(es.t,{"data-slot":"select-content","data-align-trigger":s,className:(0,O.cn)("relative isolate z-80 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-xl bg-popover p-1.5 text-popover-foreground shadow-xl ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...i,children:[(0,r.jsx)(ek,{}),(0,r.jsx)(ei.B,{children:t}),(0,r.jsx)(eC,{})]})})})}function ey({className:e,...t}){return(0,r.jsx)(ed.M,{"data-slot":"select-label",className:(0,O.cn)("px-1.5 py-1 text-xs text-muted-foreground",e),...t})}function ew({className:e,children:t,...n}){return(0,r.jsxs)(eu.e,{"data-slot":"select-item",className:(0,O.cn)("relative flex h-8 w-full cursor-pointer items-center gap-2 rounded-lg pr-8 pl-2 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[(0,r.jsx)(ec.h,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),(0,r.jsx)(em.h,{render:(0,r.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:(0,r.jsx)(i.wiW,{className:"pointer-events-none"})})]})}function eN({className:e,...t}){return(0,r.jsx)(ef.m,{"data-slot":"select-separator",className:(0,O.cn)("pointer-events-none -mx-1 my-1 h-px bg-border",e),...t})}function ek({className:e,...t}){return(0,r.jsx)(ex.w,{"data-slot":"select-scroll-up-button",className:(0,O.cn)("top-0 z-10 flex w-full cursor-pointer items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,r.jsx)(i.uMc,{})})}function eC({className:e,...t}){return(0,r.jsx)(ep.d,{"data-slot":"select-scroll-down-button",className:(0,O.cn)("bottom-0 z-10 flex w-full cursor-pointer items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,r.jsx)(i.RQe,{})})}var eS=n(18349);let e$=new Set(["int2","int4","int8","oid"]),ez=new Set(["decimal","float4","float8","numeric"]),eE=new Set(["date","time","timestamp","timestamptz","timetz"]),eT=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],eO="__null__";function eI(e){return Array.isArray(e.enumValues)&&e.enumValues.length>0?"enum":"bool"===e.dataType?"boolean":"date"===e.dataType||"timestamp"===e.dataType?"date":"time"===e.dataType?"time":"json"===e.dataType||"jsonb"===e.dataType?"json":e$.has(e.dataType)||ez.has(e.dataType)?"number":"text"}function eD(e){return"boolean"===e||"enum"===e}function eM(e,t,n){if("boolean"===t)return"true"===n;if("enum"===t){if(!e.enumValues?.includes(n))throw Error("Choose a valid enum value");return n}if("json"===t){if(!n.trim())throw Error("JSON cannot be empty. Use NULL instead.");try{JSON.parse(n)}catch(e){throw Error(e instanceof Error?e.message:"Invalid JSON")}return n}if("number"===t){let t=n.trim();if(!t)throw Error("Enter a number or use NULL");if(e$.has(e.dataType)&&!/^[+-]?\d+$/.test(t))throw Error("Enter a whole number");if(ez.has(e.dataType)&&!/^[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[+-]?\d+)?$/i.test(t)&&!/^[+-]?(?:Infinity|NaN)$/i.test(t))throw Error("Enter a valid number");return t}return n}function eK(e,t){if(null===e)return"";if("json"===t)try{let t="string"==typeof e?JSON.parse(e):e;return JSON.stringify(t,null,2)}catch{return"string"==typeof e?JSON.stringify(e):String(e)}return"date"===t&&"string"==typeof e?e.replace(" ","T"):String(e)}function eR(e){return String(e).padStart(2,"0")}function eL(e){let t=new Date,n=`${t.getFullYear()}-${eR(t.getMonth()+1)}-${eR(t.getDate())}`,r=`${eR(t.getHours())}:${eR(t.getMinutes())}:${eR(t.getSeconds())}`;if("date"===e)return n;if("timestamp"===e)return`${n}T${r}`;if("timestamptz"===e)return t.toISOString();if("time"===e)return r;if("timetz"===e){let e=-t.getTimezoneOffset();return`${r}${e>=0?"+":"-"}${eR(Math.floor(Math.abs(e)/60))}:${eR(Math.abs(e)%60)}`}return t.toISOString()}function e_(e,t){if(!t)return"—";if("date"===e){let e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);if(e)return`${e[3]} ${eT[Number(e[2])-1]} ${e[1]}`}if("timestamp"===e){let e=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?)$/.exec(t);if(e)return`${e[3]} ${eT[Number(e[2])-1]} ${e[1]} ${e[4]}`}if("timestamptz"===e){let e=new Date(t.replace(" ","T"));if(!Number.isNaN(e.getTime()))return new Intl.DateTimeFormat("en-GB",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23",timeZoneName:"shortOffset"}).format(e)}return t.replace("T"," ")}function eP(e,t){switch(e){case"boolean":return[{value:"true",label:"true"},{value:"false",label:"false"}];case"enum":return(t.enumValues??[]).map(e=>({value:e,label:e}));default:return e}}function eU({connectionUrl:e,foreignKey:t,referencedTable:n,value:l,onSelect:o}){let[s,d]=(0,a.useState)(""),u=p(s,200),c=t.referencedColumns[0],m=C(n.columns,t.referencedColumns),g=(0,x.Y)(`${e}:${n.schema}.${n.name}:${u}`,n=>h.F.lookup(e,{table:t.referencedTable,search:u,limit:30},n)),b=(0,a.useMemo)(()=>{let e=g.data;if(!e||!c)return[];let t=e.columns.indexOf(c);return t<0?[]:e.rows.map(n=>({key:n[t]??null,label:S(e.columns,n,m),row:n}))},[m,c,g.data]);return(0,r.jsxs)("div",{className:"mt-1.5",children:[(0,r.jsx)(M.p,{value:s,onChange:e=>d(e.target.value),placeholder:`Search ${t.referencedTable.schema}.${t.referencedTable.name}`,className:"font-mono","aria-label":"Search referenced rows",onKeyDown:e=>{"Enter"===e.key&&e.preventDefault()}}),(0,r.jsx)("div",{className:"mt-1.5 max-h-48 overflow-auto rounded-md border bg-background/50",children:g.error?(0,r.jsx)("p",{className:"px-2.5 py-2 text-xs text-destructive",children:g.error}):g.data?0===b.length?(0,r.jsx)("p",{className:"px-2.5 py-3 text-center text-xs text-muted-foreground",children:"No matching rows"}):(0,r.jsx)("ul",{children:b.map((e,t)=>{let n=String(e.key)===String(l),a=e.label&&e.label!==String(e.key)?e.label:null;return(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",onClick:()=>o(e.key),className:(0,O.cn)("flex h-7 w-full cursor-pointer items-center gap-2 px-2.5 text-left font-mono text-xs outline-none hover:bg-muted/60 focus-visible:bg-muted/60",n&&"bg-primary/8"),children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a??String(e.key??"")}),a&&(0,r.jsx)("span",{className:"max-w-[40%] truncate text-muted-foreground",children:String(e.key??"")}),n&&(0,r.jsx)(i.wiW,{className:"size-3 shrink-0"})]})},`${String(e.key)}:${t}`)})}):(0,r.jsx)("div",{className:"flex flex-col gap-1 p-2",children:Array.from({length:5},(e,t)=>(0,r.jsx)(f.E,{className:"h-6 w-full"},t))})})]})}function eF({column:e,value:t,kind:n,onClose:l,onSave:o}){let s=eP(n,e),[i,d]=(0,a.useState)(!0),[u,c]=(0,a.useState)(!1),[m,f]=(0,a.useState)(null),x=null===t?eO:"boolean"==typeof t?t?"true":"false":String(t),p=Object.fromEntries([...e.nullable?[[eO,"null"]]:[],...s.map(e=>[e.value,e.label])]);async function h(r){let a;if(!u){try{a=function(e,t,n){if(n===eO)return null;switch(e){case"boolean":return"true"===n;case"enum":if(!t.enumValues?.includes(n))throw Error("Choose a valid enum value");return n;default:return e}}(n,e,r)}catch(e){f(e instanceof Error?e.message:"Invalid value"),d(!0);return}if(Object.is(a,t))return void l();f(null),c(!0);try{await o(a)}catch(e){f(e instanceof Error?e.message:"Could not update this cell"),c(!1),d(!0)}}}return(0,r.jsx)("div",{"data-inline-cell-editor":!0,className:"flex h-full min-h-0 w-full items-center",onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,r.jsxs)(eh,{items:p,value:x,open:i,disabled:u,onValueChange:e=>{e&&h(e)},onOpenChange:(e,t)=>{if(!u){if("item-press"===t.reason)return void d(!1);if(!e)return void l();d(!0)}},children:[(0,r.jsx)(ev,{size:"sm","aria-label":`Edit ${e.name}`,className:"h-full w-full min-h-0 justify-start gap-0 rounded-none border-0 bg-transparent p-0 font-mono text-xs shadow-none hover:bg-transparent focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent dark:hover:bg-transparent data-[size=sm]:h-full data-[size=sm]:rounded-none [&_svg]:hidden",children:(0,r.jsx)(eb,{})}),(0,r.jsxs)(ej,{align:"start",sideOffset:0,className:"font-mono text-xs",children:[e.nullable&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ew,{value:eO,className:"h-7 font-mono text-xs text-muted-foreground",children:"null"}),(0,r.jsx)(eN,{})]}),s.map(e=>(0,r.jsx)(ew,{value:e.value,className:"h-7 font-mono text-xs",children:e.label},e.value)),m&&(0,r.jsx)("p",{role:"alert",className:"px-2 py-1 text-xs text-destructive",children:m})]})]})})}function eA(e){let t=eI(e.column);return eD(t)?(0,r.jsx)(eF,{...e,kind:t}):(0,r.jsx)(eB,{...e,kind:t})}function eB({anchor:e,column:t,value:n,foreignKey:l,referencedTable:o,connectionUrl:s,layer:d="grid",onClose:u,onSave:c,kind:f}){let[x,p]=(0,a.useState)(()=>eK(n,f)),[h,g]=(0,a.useState)(null===n),[b,v]=(0,a.useState)(!1),[j,y]=(0,a.useState)(null),w=(0,a.useRef)(null),N=(0,a.useRef)(null),k=eE.has(t.dataType);async function C(e){let n;if(e?.preventDefault(),!b){y(null);try{n=h?null:eM(t,f,x)}catch(e){y(e instanceof Error?e.message:"Invalid value");return}v(!0);try{await c(n)}catch(e){y(e instanceof Error?e.message:"Could not update this cell"),v(!1)}}}function S(e){(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),C())}(0,a.useEffect)(()=>{let e=window.requestAnimationFrame(()=>{let e=N.current??w.current;if(e){e.focus();try{e.select()}catch{}}});return()=>window.cancelAnimationFrame(e)},[]);let $=l?.columns.length===1&&!!o&&!!s&&("text"===f||"number"===f),z="json"===f||"text"===f&&"text"===t.dataType,E="json"===f?"w-[min(28rem,calc(100vw-1rem))]":$||z||k?"w-[min(24rem,calc(100vw-1rem))]":"w-[min(18rem,calc(100vw-1rem))]";return(0,r.jsx)(X.y,{open:!0,onOpenChange:e=>{e||b||u()},children:(0,r.jsx)(Y.i,{children:(0,r.jsx)(Q.U,{anchor:e,side:"bottom",sideOffset:5,align:"start",collisionPadding:8,className:"peek"===d?"isolate z-70":"isolate z-60",children:(0,r.jsx)(Z.i,{"data-cell-editor":!0,className:`origin-(--transform-origin) rounded-lg bg-popover p-2.5 text-popover-foreground shadow-2xl ring-1 ring-foreground/15 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 ${E}`,children:(0,r.jsxs)("form",{onSubmit:C,children:[h?(0,r.jsx)("button",{type:"button",onClick:()=>g(!1),className:"flex h-16 w-full cursor-pointer items-center justify-center rounded-lg border border-dashed border-input bg-muted/20 font-mono text-xs text-muted-foreground transition-colors hover:border-foreground/25 hover:bg-muted/40 hover:text-foreground",children:"NULL — click to enter a value"}):"json"===f?(0,r.jsx)(eS.T,{ref:N,value:x,onChange:e=>p(e.target.value),onKeyDown:S,spellCheck:!1,className:"min-h-40 resize-y font-mono text-xs"}):"text"===f&&"text"===t.dataType?(0,r.jsx)(eS.T,{ref:N,value:x,onChange:e=>p(e.target.value),onKeyDown:S,className:"min-h-24 resize-y font-mono text-xs"}):(0,r.jsx)(M.p,{ref:w,type:"text",value:x,inputMode:"number"===f?"decimal":void 0,onChange:e=>p(e.target.value),className:"font-mono"}),$&&!h&&l&&o&&s&&(0,r.jsx)(eU,{connectionUrl:s,foreignKey:l,referencedTable:o,value:x||n,onSelect:e=>{g(!1),p(null===e?"":String(e))}}),k&&!h&&(0,r.jsxs)("div",{className:"mt-1.5 px-0.5",children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Formatted value:"}),(0,r.jsx)("p",{className:"mt-0.5 truncate font-mono text-xs text-foreground/90",children:e_(t.dataType,x)})]}),j&&(0,r.jsx)("p",{role:"alert",className:"mt-2 text-xs text-destructive",children:j}),(0,r.jsxs)("div",{className:"mt-2 flex items-end gap-2",children:[(0,r.jsxs)("div",{className:"flex shrink-0 flex-col items-start gap-0.5",children:[(0,r.jsxs)("button",{type:"submit",disabled:b,className:"group flex h-7 cursor-pointer items-center gap-2 rounded-md pr-2 text-sm whitespace-nowrap text-muted-foreground outline-none transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60 disabled:pointer-events-none disabled:opacity-50",children:[(0,r.jsx)("kbd",{className:"flex h-6 min-w-8 items-center justify-center rounded-md border bg-muted/40 px-1.5 font-mono text-[11px] text-foreground shadow-xs",children:b?(0,r.jsx)(i.gnh,{className:"size-3 animate-spin"}):"↵"}),"Save changes"]}),(0,r.jsxs)("button",{type:"button",onClick:u,disabled:b,className:"flex h-7 cursor-pointer items-center gap-2 rounded-md pr-2 text-sm whitespace-nowrap text-muted-foreground outline-none transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60 disabled:pointer-events-none disabled:opacity-50",children:[(0,r.jsx)("kbd",{className:"flex h-6 min-w-8 items-center justify-center rounded-md border bg-muted/40 px-1.5 font-mono text-[10px] text-foreground shadow-xs",children:"Esc"}),"Cancel changes"]})]}),(0,r.jsxs)("div",{className:"ml-auto flex flex-col items-stretch gap-1",children:[k&&(0,r.jsx)(m.$,{type:"button",variant:"outline",size:"sm",onClick:()=>{g(!1),p(eL(t.dataType))},children:"Set to NOW"}),t.nullable&&!h&&(0,r.jsx)(m.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>g(!0),children:"Set to NULL"})]})]})]})})})})})}function eq({text:e,query:t}){let n=t.trim();if(!n)return e;let a=e.toLocaleLowerCase(),l=n.toLocaleLowerCase(),o=a.indexOf(l);if(-1===o)return e;let s=[],i=0,d=o,u=0;for(;-1!==d;)d>i&&s.push(e.slice(i,d)),s.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(d,d+n.length)},u)),u+=1,i=d+n.length,d=a.indexOf(l,i);return i<e.length&&s.push(e.slice(i)),s}function eV({value:e,label:t,referenced:n,query:a="",onOpen:l}){if(null===e)return(0,r.jsx)("span",{className:"text-muted-foreground/60",children:"null"});let o=String(e),s=null!==t&&t!==o;return(0,r.jsxs)("button",{type:"button","aria-label":`View referenced row in ${n}`,title:`${s?`${t} \xb7 `:""}${o} → ${n}`,onClick:l,className:"inline-flex min-w-0 max-w-full cursor-pointer items-center gap-1 text-left outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/60",children:[(0,r.jsx)(i.WnQ,{className:"size-3 shrink-0 text-muted-foreground/70"}),s&&null!==t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"truncate underline decoration-foreground/20 underline-offset-2",children:(0,r.jsx)(eq,{text:t,query:a})}),(0,r.jsx)("span",{className:"truncate text-muted-foreground/55",children:(0,r.jsx)(eq,{text:o,query:a})})]}):(0,r.jsx)("span",{className:"truncate underline decoration-foreground/20 underline-offset-2",children:(0,r.jsx)(eq,{text:o,query:a})})]})}var eW=n(98408),eJ=n(45477),eH=n(32949),eG=n(88593),eX=n(52579),eY=n(11975),eQ=n(31799);function eZ({...e}){return(0,r.jsx)(eW.D,{"data-slot":"sheet",...e})}function e0({className:e,...t}){return(0,r.jsx)(eJ.X,{"data-slot":"sheet-overlay",className:(0,O.cn)("fixed inset-0 isolate z-50 bg-black/5 duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function e1({className:e,children:t,side:n="right",showCloseButton:a=!0,...l}){return(0,r.jsxs)(eH.Z,{"data-slot":"sheet-portal",children:[(0,r.jsx)(e0,{}),(0,r.jsxs)(eG.h,{"data-slot":"sheet-content",className:(0,O.cn)("fixed inset-y-0 z-50 flex w-full flex-col bg-popover text-sm text-popover-foreground shadow-2xl duration-150 outline-none data-open:animate-in data-closed:animate-out sm:max-w-md","right"===n?"right-0 border-l data-open:slide-in-from-right data-closed:slide-out-to-right":"left-0 border-r data-open:slide-in-from-left data-closed:slide-out-to-left",e),...l,children:[t,a&&(0,r.jsxs)(eX.H,{"data-slot":"sheet-close",render:(0,r.jsx)(m.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,r.jsx)(i.yBK,{}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function e2({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"sheet-header",className:(0,O.cn)("flex shrink-0 flex-col gap-1.5 border-b p-4 pr-10",e),...t})}function e5({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"sheet-footer",className:(0,O.cn)("flex shrink-0 flex-row items-center justify-end gap-2 border-t bg-muted/50 p-3",e),...t})}function e3({className:e,...t}){return(0,r.jsx)(eY.L,{"data-slot":"sheet-title",className:(0,O.cn)("text-sm font-medium",e),...t})}function e4({className:e,...t}){return(0,r.jsx)(eQ.r,{"data-slot":"sheet-description",className:(0,O.cn)("text-muted-foreground",e),...t})}var e6=n(34304),e8=n(55737),e9=n(25460),e7=n(46732),te=n(27071),tt=n(89561),tn=n(32638);let tr=[tt.Lz.theme({"&":{backgroundColor:"var(--background)",color:"var(--foreground)",fontSize:"12px"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"var(--font-geist-mono), ui-monospace, SFMono-Regular, monospace",lineHeight:"1.5"},".cm-content":{padding:"6px 0",caretColor:"var(--foreground)"},".cm-line":{padding:"0 8px"},".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-placeholder":{color:"var(--muted-foreground)"}}),(0,e7.y9)(e7.cr.define([{tag:tn._A.propertyName,color:"var(--chart-1)",fontWeight:"600"},{tag:[tn._A.string,tn._A.special(tn._A.string)],color:"var(--chart-2)"},{tag:[tn._A.number,tn._A.bool,tn._A.null],color:"var(--chart-3)"},{tag:[tn._A.separator,tn._A.punctuation],color:"var(--foreground)",opacity:"0.72"}]))];function ta({id:e,value:t,disabled:n,invalid:l,autoFocus:o,minHeight:s="5rem",onChange:d,onSubmit:u}){let c=function(e){if(!e.trim())return null;try{return JSON.parse(e),null}catch(e){return e instanceof Error?e.message:"Invalid JSON"}}(t),f=function(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return null}}(t),x=null!==f&&f!==t,p=(0,a.useMemo)(()=>[(0,e9.Pq)(),tr,te.$t.readOnly.of(!!n),tt.Lz.lineWrapping,tt.w4.of([{key:"Mod-Enter",run:()=>(u?.(),!0)}])],[n,u]);return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{id:e,"data-invalid":l||!!c||void 0,className:(0,O.cn)("relative overflow-hidden rounded-lg border border-input bg-transparent transition-[color,box-shadow]","focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50","data-invalid:border-destructive data-invalid:focus-within:border-destructive data-invalid:focus-within:ring-destructive/30",n&&"pointer-events-none opacity-50"),children:[(0,r.jsx)(e8.Ay,{value:t,height:"auto",minHeight:s,maxHeight:"18rem",autoFocus:o,basicSetup:{lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1,highlightActiveLineGutter:!1,autocompletion:!1,bracketMatching:!0,closeBrackets:!0,indentOnInput:!0,searchKeymap:!1},placeholder:"{ }",extensions:p,onChange:d}),x&&!n&&(0,r.jsx)(m.$,{type:"button",variant:"ghost",size:"icon-xs",title:"Format JSON","aria-label":"Format JSON",onClick:()=>d(f),className:"absolute top-1 right-1 bg-background/80 backdrop-blur-xs",children:(0,r.jsx)(i.iC_,{})})]}),c&&(0,r.jsx)("p",{className:"mt-1 font-mono text-[10px] text-destructive",children:c})]})}function tl(e){return!e.isGenerated&&!e.isIdentity}function to(e){return!e.nullable&&!e.hasDefault}function ts(e){let t=eI(e);return{mode:"value",draft:eD(t)?eP(t,e)[0]?.value??"":""}}function ti(e){return e.hasDefault?{mode:"default",draft:""}:e.nullable?{mode:"null",draft:""}:ts(e)}function td(e,t){return`${e}-${t}`}function tu(e,t){let n={},r=[],a={};for(let l of e){let e=t[l.name];if(!e)continue;if("default"===e.mode){r.push(l.name);continue}if("null"===e.mode){n[l.name]=null;continue}let o=eI(l);if(!e.draft.trim()&&("number"===o||"json"===o)){a[l.name]=l.nullable?"Enter a value or switch this column to NULL":"Enter a value";continue}try{n[l.name]=eM(l,o,e.draft)}catch(e){a[l.name]=e instanceof Error?e.message:"Invalid value"}}return{values:n,defaults:r,errors:a}}function tc({column:e,field:t,idPrefix:n,error:a,autoFocus:l,disabled:o,dirty:s=!1,foreignKey:d,referencedTable:u,connectionUrl:c,onDraftChange:f,onModeChange:x,onRevert:p,onSubmit:h}){let g=eI(e),b=eE.has(e.dataType),v=to(e),j=td(n,e.name),y=d?.columns.length===1&&!!u&&("text"===g||"number"===g);return(0,r.jsxs)("div",{className:(0,O.cn)("group/field relative py-2.5",s&&"-mx-4 px-4 bg-primary/[0.04]"),children:[s&&(0,r.jsx)("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-0.5 bg-primary/50"}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[e.isPrimaryKey&&(0,r.jsx)(i.nTY,{"aria-label":"Primary key",className:"size-3 shrink-0 text-muted-foreground"}),(0,r.jsx)("label",{htmlFor:j,title:e.name,className:(0,O.cn)("min-w-0 truncate font-mono text-xs",e.isPrimaryKey&&"font-semibold"),children:e.name}),(0,r.jsx)("span",{title:e.defaultExpression?`${e.type} \xb7 default ${e.defaultExpression}`:e.type,className:"min-w-0 truncate text-[10px] text-muted-foreground/70",children:e.type}),v&&(0,r.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground/70",children:"required"}),(0,r.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[s&&p&&(0,r.jsx)(m.$,{type:"button",variant:"ghost",size:"icon-xs",disabled:o,title:`Revert ${e.name}`,"aria-label":`Revert ${e.name}`,onClick:p,children:(0,r.jsx)(i.ij9,{})}),y&&d&&u&&(0,r.jsx)(tf,{column:e,foreignKey:d,referencedTable:u,connectionUrl:c,value:"value"===t.mode?t.draft:"",disabled:o,onSelect:e=>f(null===e?"":String(e))}),b&&(0,r.jsxs)(m.$,{type:"button",variant:"ghost",size:"xs",disabled:o,title:`Set ${e.name} to the current time`,onClick:()=>f(eL(e.dataType)),children:[(0,r.jsx)(i.gvW,{"data-icon":"inline-start"}),"Now"]}),e.hasDefault&&(0,r.jsx)(tm,{active:"default"===t.mode,disabled:o,onClick:()=>x("default"===t.mode?"value":"default"),children:"Default"}),e.nullable&&(0,r.jsx)(tm,{active:"null"===t.mode,disabled:o,onClick:()=>x("null"===t.mode?"value":"null"),children:"Null"})]})]}),(0,r.jsx)("div",{className:"mt-1.5",children:"value"!==t.mode?(0,r.jsxs)("button",{type:"button",id:j,disabled:o,onClick:()=>x("value"),className:"group flex h-8 w-full cursor-pointer items-center gap-2 rounded-lg border border-dashed border-input bg-muted/20 px-2.5 text-left font-mono text-xs text-muted-foreground transition-colors hover:border-foreground/25 hover:bg-muted/40 hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:"null"===t.mode?"NULL":e.isIdentity?"generated identity value":e.defaultExpression??"DEFAULT"}),(0,r.jsx)("span",{className:"shrink-0 text-[10px] opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100",children:"set a value"})]}):eD(g)?(0,r.jsxs)(eh,{items:Object.fromEntries(eP(g,e).map(e=>[e.value,e.label])),value:t.draft,disabled:o,onValueChange:e=>e&&f(String(e)),children:[(0,r.jsx)(ev,{id:j,"aria-invalid":!!a,className:"w-full font-mono text-xs",children:(0,r.jsx)(eb,{})}),(0,r.jsx)(ej,{align:"start",className:"font-mono text-xs",children:eP(g,e).map(e=>(0,r.jsx)(ew,{value:e.value,className:"h-7 font-mono text-xs",children:e.label},e.value))})]}):"json"===g?(0,r.jsx)(ta,{id:j,value:t.draft,disabled:o,invalid:!!a,autoFocus:l,onChange:f,onSubmit:h}):"text"===g&&"text"===e.dataType?(0,r.jsx)(eS.T,{id:j,autoFocus:l,value:t.draft,disabled:o,"aria-invalid":!!a,onChange:e=>f(e.target.value),onKeyDown:function(e){(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&e.currentTarget.form?.requestSubmit()},className:"min-h-16 resize-y font-mono text-xs"}):(0,r.jsx)(M.p,{id:j,type:"text",autoFocus:l,value:t.draft,disabled:o,inputMode:"number"===g?"decimal":void 0,"aria-invalid":!!a,onChange:e=>f(e.target.value),className:"font-mono text-xs"})}),b&&"value"===t.mode&&t.draft&&(0,r.jsx)("p",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:e_(e.dataType,t.draft)}),a&&(0,r.jsx)("p",{role:"alert",className:"mt-1 text-xs text-destructive",children:a})]})}function tm({active:e=!1,disabled:t,onClick:n,children:a}){return(0,r.jsx)("button",{type:"button","aria-pressed":e,disabled:t,onClick:n,className:(0,O.cn)("flex h-5 cursor-pointer items-center rounded-md border px-1.5 text-[10px] font-medium tracking-wide uppercase transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/60 disabled:pointer-events-none disabled:opacity-50",e?"border-primary/30 bg-primary/10 text-primary":"border-transparent text-muted-foreground hover:bg-muted hover:text-foreground"),children:a})}function tf({column:e,foreignKey:t,referencedTable:n,connectionUrl:l,value:o,disabled:s,onSelect:d}){let[u,c]=(0,a.useState)(!1),f=`Pick ${e.name} from ${(0,b.i)(t.referencedTable)}`;return(0,r.jsxs)(X.y,{open:u,onOpenChange:c,children:[(0,r.jsxs)(e6.W,{render:(0,r.jsx)(m.$,{type:"button",variant:"ghost",size:"xs",disabled:s}),"aria-label":f,title:f,children:[(0,r.jsx)(i.TfF,{"data-icon":"inline-start"}),"Pick"]}),(0,r.jsx)(Y.i,{children:(0,r.jsx)(Q.U,{side:"bottom",align:"end",sideOffset:4,collisionPadding:8,className:"isolate z-60",children:(0,r.jsx)(Z.i,{className:"w-[min(22rem,calc(100vw-1rem))] origin-(--transform-origin) rounded-lg bg-popover p-2 text-popover-foreground shadow-2xl ring-1 ring-foreground/15 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",children:(0,r.jsx)(eU,{connectionUrl:l,foreignKey:t,referencedTable:n,value:o,onSelect:e=>{d(e),c(!1)}})})})})]})}let tx="edit";function tp({target:e,...t}){let[n,l]=(0,a.useState)(!1);return(0,r.jsx)(eZ,{open:null!==e,onOpenChange:e=>{(e||!n)&&t.onOpenChange(e)},children:(0,r.jsx)(e1,{showCloseButton:!n,className:"sm:max-w-lg",children:e&&(0,r.jsx)(th,{target:e,...t,onSavingChange:l},`${e.rowIndex}:${JSON.stringify(e.row)}`)})})}function th({target:e,table:t,tables:n,connectionUrl:l,onOpenChange:o,onUpdate:s,onSavingChange:d}){let u=(0,a.useMemo)(()=>t.columns.filter(tl),[t.columns]),c=(0,a.useMemo)(()=>{let t=new Map(e.columns.map((e,t)=>[e,t]));return Object.fromEntries(u.map(n=>{let r=t.get(n.name),a=void 0===r?null:e.row[r]??null;return[n.name,null===a?{mode:"null",draft:""}:{mode:"value",draft:eK(a,eI(n))}]}))},[u,e]),[f,x]=(0,a.useState)(c),[p,h]=(0,a.useState)({}),[g,v]=(0,a.useState)(null),[j,N]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),S=(0,a.useMemo)(()=>u.filter(e=>{let t=c[e.name],n=f[e.name];return t&&n&&(t.mode!==n.mode||"value"===t.mode&&t.draft!==n.draft)}),[u,c,f]),$=t.columns.length-u.length;function z(e,t){x(n=>({...n,[e]:{...n[e]??{mode:"value",draft:""},...t}})),v(null),h(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n})}async function E(n){if(n.preventDefault(),j||0===S.length)return;let{values:r,defaults:a,errors:l}=tu(S,f);h(l);let o=S.find(e=>l[e.name]);if(o){v("Some values could not be used. Check the highlighted fields."),document.getElementById(td(tx,o.name))?.focus();return}let i=Object.fromEntries(t.columns.flatMap(t=>{if(!t.isPrimaryKey)return[];let n=e.columns.indexOf(t.name);if(n<0)throw Error("The row primary key is incomplete");return[[t.name,e.row[n]??null]]}));v(null),N(!0),d(!0);try{await s({primaryKey:i,values:r,defaults:a})}catch(e){v(e instanceof Error?e.message:"Could not update this row")}finally{N(!1),d(!1)}}let T=S.length;return(0,r.jsxs)("form",{onSubmit:E,className:"flex min-h-0 flex-1 flex-col",children:[(0,r.jsxs)(e2,{children:[(0,r.jsxs)(e3,{className:"flex items-center gap-2",children:[(0,r.jsx)(i.NOV,{className:"size-3.5 shrink-0 text-muted-foreground"}),"Edit row"]}),(0,r.jsxs)(e4,{className:"text-xs",children:[(0,r.jsx)("span",{className:"font-mono",children:(0,b.i)(t)}),$>0&&(0,r.jsxs)(r.Fragment,{children:[" \xb7 ",$," generated ",1===$?"column":"columns"," omitted"]})]})]}),(0,r.jsx)("div",{className:"min-h-0 flex-1 divide-y divide-border/60 overflow-y-auto px-4",children:0===u.length?(0,r.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"Every column in this table is written by the database."}):u.map(e=>{let a=w(t,e.name);return(0,r.jsx)(tc,{column:e,field:f[e.name]??ts(e),idPrefix:tx,error:p[e.name],autoFocus:k===e.name,disabled:j,dirty:S.includes(e),foreignKey:a,referencedTable:a?y(n,a.referencedTable):void 0,connectionUrl:l,onDraftChange:t=>z(e.name,{mode:"value",draft:t}),onModeChange:t=>(function(e,t){let n=u.find(t=>t.name===e);if("value"===t&&n){let r=c[e]?.mode==="value"?c[e]:ts(n);z(e,f[e]?.draft?{mode:t}:r),C(e);return}z(e,{mode:t})})(e.name,t),onRevert:()=>{var t;let n;(n=c[t=e.name])&&z(t,n)}},e.name)})}),g&&(0,r.jsx)("p",{role:"alert",className:"shrink-0 border-t bg-destructive/5 px-4 py-2.5 font-mono text-xs text-destructive",children:g}),(0,r.jsxs)(e5,{children:[(0,r.jsx)("span",{className:"mr-auto truncate text-xs text-muted-foreground",children:0===T?"No changes":`${T} ${1===T?"column":"columns"} changed`}),(0,r.jsx)(m.$,{type:"button",variant:"outline",disabled:j,onClick:()=>o(!1),children:"Cancel"}),(0,r.jsxs)(m.$,{type:"submit",disabled:j||0===T,children:[j&&(0,r.jsx)(i.gnh,{className:"animate-spin","data-icon":"inline-start"}),j?"Saving…":0===T?"Save":`Save ${T}`]})]})]})}function tg(e){return null===e?"null":"boolean"==typeof e?e?"true":"false":String(e)}function tb({peek:e,connectionUrl:t,tables:n,relatedRows:l,onClose:o,onPeek:s,onOpenTable:i,onUpdateCell:d}){let[u,c]=(0,a.useState)(null),m=e.stack[e.stack.length-1];if(!m)return null;let f=N(m.table,m.key),x=u?.frame===f?u.edit:null;return(0,r.jsx)(X.y,{open:!0,onOpenChange:(t,n)=>{if(!t&&(!x||"escape-key"!==n.reason)){if("outside-press"===n.reason){let t=n.event.target;if(t instanceof Element&&t.closest("[data-cell-editor],[data-slot='select-content']")||t instanceof Node&&e.anchor.contains(t))return}o()}},children:(0,r.jsx)(Y.i,{children:(0,r.jsx)(Q.U,{anchor:e.anchor,side:"bottom",sideOffset:6,align:"start",collisionPadding:8,className:"isolate z-60",children:(0,r.jsx)(Z.i,{"data-row-peek":!0,className:"flex max-h-[min(32rem,calc(100vh-2rem))] w-[min(32rem,calc(100vw-1rem))] origin-(--transform-origin) flex-col overflow-hidden rounded-xl bg-popover text-popover-foreground shadow-xl ring-1 ring-foreground/10 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",children:(0,r.jsx)(tv,{frame:m,canGoBack:e.stack.length>1,connectionUrl:t,tables:n,relatedRows:l,edit:x,onEdit:e=>c(e?{frame:f,edit:e}:null),onBack:()=>s({...e,stack:e.stack.slice(0,-1)}),onFollow:t=>s({...e,stack:[...e.stack,t]}),onOpenTable:i,onUpdateCell:d},f)})})})})}function tv({frame:e,canGoBack:t,connectionUrl:n,tables:l,relatedRows:o,edit:s,onEdit:d,onBack:u,onFollow:c,onOpenTable:p,onUpdateCell:g}){let v=y(l,e.table),j=o.get(N(e.table,e.key)),[z,E]=(0,a.useState)(null),T=(0,a.useMemo)(()=>({table:e.table,filters:$(e.keyColumns,e.key),sort:null,page:0,pageSize:1}),[e]),I=(0,x.Y)(`${n}:${JSON.stringify(T)}`,e=>h.F.rows(n,T,e)),D=I.data?.columns??j?.columns??v?.columns.map(e=>e.name),M=z??I.data?.rows[0]??j?.row,K=!!(I.data&&0===I.data.rows.length&&!j),R=function(e,t,n,r){if(n&&r){let a=S(n,r,C(e?.columns??[],t.keyColumns));if(a)return a}return t.key.map(tg).join(", ")}(v,e,D,M),L=v?.referencedBy??[];async function _(t,n){if(!v||!D||!M)throw Error("This row is no longer available");let r=Object.fromEntries(v.columns.flatMap(e=>{if(!e.isPrimaryKey)return[];let t=D.indexOf(e.name);if(t<0)throw Error("The row primary key is incomplete");return[[e.name,M[t]??null]]}));E((await g({table:e.table,column:t,primaryKey:r,value:n})).row),d(null)}return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("header",{className:"flex shrink-0 items-center gap-2 border-b bg-muted/20 px-3 py-2.5",children:[t&&(0,r.jsx)(m.$,{type:"button",variant:"ghost",size:"icon-xs","aria-label":"Back",onClick:u,children:(0,r.jsx)(i.SI1,{})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("p",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[(0,r.jsx)(i.WnQ,{className:"size-3 shrink-0"}),(0,r.jsx)("span",{className:"truncate font-mono",children:(0,b.i)(e.table)})]}),(0,r.jsx)("p",{title:R,className:"mt-0.5 truncate font-mono text-sm font-medium",children:R})]}),(0,r.jsxs)(m.$,{type:"button",variant:"outline",size:"sm",onClick:()=>p(e.table,$(e.keyColumns,e.key)),children:["Open",(0,r.jsx)(i.aeF,{"data-icon":"inline-end"})]})]}),(0,r.jsxs)("div",{className:"min-h-0 flex-1 overflow-auto",children:[I.error&&!j?(0,r.jsx)("p",{className:"px-3 py-4 font-mono text-xs text-destructive",children:I.error}):K?(0,r.jsx)("p",{className:"px-3 py-4 text-sm text-muted-foreground",children:"Referenced row was not found."}):D&&M?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"grid grid-cols-[minmax(7rem,38%)_minmax(0,1fr)] gap-4 border-b bg-muted/25 px-3.5 py-1.5 text-[10px] font-medium tracking-wide text-muted-foreground uppercase",children:[(0,r.jsx)("span",{children:"Field"}),(0,r.jsx)("span",{children:"Value"})]}),(0,r.jsx)("dl",{className:"divide-y divide-border/60",children:D.map((e,t)=>{let a=v?.columns.find(t=>t.name===e),u=M[t]??null,m=tg(u),f=w(v,e),x=f?k(f,D,M):null,p=f?y(l,f.referencedTable):void 0,h=f&&x?o.get(N(f.referencedTable,x)):void 0,g=h?S(h.columns,h.row,C(p?.columns??[],f?.referencedColumns??[])):null,j=!!(g&&g!==m),$=!!(f&&x),z=v?"table"!==v.kind?"Views and foreign tables are read-only":v.columns.some(e=>e.isPrimaryKey)?a?a.isGenerated?"Generated columns are read-only":a.isIdentity?"Identity columns are read-only":null:"Column metadata is unavailable":"Editing requires a primary key":"Table metadata is unavailable",E=s?.column===e;return(0,r.jsxs)("div",{className:"group/field grid grid-cols-[minmax(7rem,38%)_minmax(0,1fr)] items-start gap-4 px-3.5 py-2 hover:bg-muted/15",onDoubleClick:t=>{if($||z||E)return;let n=t.currentTarget.querySelector("[data-peek-value]");n&&d({column:e,anchor:n})},children:[(0,r.jsxs)("dt",{className:"flex min-w-0 items-center gap-1.5",children:[a?.isPrimaryKey&&(0,r.jsx)(i.nTY,{"aria-label":"Primary key",className:"size-3 shrink-0 text-muted-foreground"}),(0,r.jsx)("span",{title:e,className:(0,O.cn)("min-w-0 truncate font-mono text-xs",a?.isPrimaryKey&&"font-semibold"),children:e}),a&&(0,r.jsx)("span",{title:a.type,className:"min-w-0 truncate text-[10px] text-muted-foreground/70",children:a.type})]}),(0,r.jsx)("dd",{"data-peek-value":!0,className:"min-w-0 font-mono text-xs leading-5 tabular-nums",children:E&&a&&s?(0,r.jsx)("div",{className:(0,O.cn)(eD(eI(a))&&"h-5"),children:(0,r.jsx)(eA,{anchor:s.anchor,column:a,value:u,foreignKey:f,referencedTable:p,connectionUrl:n,layer:"peek",onClose:()=>d(null),onSave:t=>_(e,t)})}):(0,r.jsxs)("div",{className:"flex min-w-0 items-start gap-1",children:[(0,r.jsx)("div",{className:"min-w-0 flex-1",children:$&&f&&x?(0,r.jsxs)("button",{type:"button",title:`${m} → ${(0,b.i)(f.referencedTable)}`,onClick:()=>c({table:f.referencedTable,keyColumns:f.referencedColumns,key:x}),className:"group -m-1 flex max-w-full cursor-pointer items-center gap-1.5 rounded-md p-1 text-left outline-none hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring/60",children:[(0,r.jsx)(i.WnQ,{className:"size-3 shrink-0 text-muted-foreground"}),(0,r.jsx)("span",{className:"min-w-0 truncate underline decoration-foreground/20 underline-offset-2",children:j?g:m}),j&&(0,r.jsx)("span",{className:"min-w-0 truncate text-muted-foreground/60",children:m}),(0,r.jsx)(i.nNJ,{className:"size-3 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100"})]}):(0,r.jsx)("p",{title:m,className:(0,O.cn)("break-words whitespace-pre-wrap",null===u&&"italic text-muted-foreground/60"),children:m})}),null===z?(0,r.jsx)("button",{type:"button","aria-label":`Edit ${e}`,title:$?`Edit ${e}`:`Edit ${e} \xb7 Double-click`,onClick:t=>{d({column:e,anchor:t.currentTarget.closest("[data-peek-value]")??t.currentTarget})},className:"shrink-0 cursor-pointer rounded-md p-0.5 text-muted-foreground opacity-0 outline-none transition-opacity hover:bg-muted/60 hover:text-foreground focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/60 group-hover/field:opacity-100",children:(0,r.jsx)(i.NOV,{className:"size-3"})}):(0,r.jsx)("span",{title:z,className:"size-4 shrink-0"})]})})]},e)})})]}):(0,r.jsx)("div",{className:"flex flex-col gap-2 p-3.5",children:Array.from({length:8},(e,t)=>(0,r.jsx)(f.E,{className:"h-5 w-full"},t))}),L.length>0&&D&&M&&(0,r.jsxs)("div",{className:"border-t bg-muted/10 px-3 py-2.5",children:[(0,r.jsx)("p",{className:"mb-1.5 px-0.5 text-[10px] font-medium tracking-wide text-muted-foreground uppercase",children:"Referenced by"}),(0,r.jsx)("ul",{className:"flex flex-col gap-1",children:L.map(e=>{let t=e.referencedColumns.map(e=>{let t=D.indexOf(e);return t>=0?M[t]??null:null}),n=$(e.columns,t),a=n.length!==e.columns.length;return(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",disabled:a,onClick:()=>p(e.table,n),className:"flex h-8 w-full cursor-pointer items-center gap-2 rounded-lg px-2 text-left outline-none hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring/60 disabled:pointer-events-none disabled:opacity-50",children:[(0,r.jsxs)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:[(0,b.i)(e.table),".",e.columns.join(", ")]}),(0,r.jsx)(i.aeF,{className:"size-3.5 shrink-0 text-muted-foreground"})]})},`${(0,b.i)(e.table)}:${e.name}`)})})]})]}),I.loading&&j&&(0,r.jsxs)("p",{className:"flex shrink-0 items-center gap-1.5 border-t px-3 py-1.5 text-[10px] text-muted-foreground",children:[(0,r.jsx)(i.gnh,{className:"size-3 animate-spin"}),"Refreshing"]})]})}function tj(e){return Math.min(640,Math.max(80,Math.round(e)))}function ty({value:e,query:t,linkModifier:n=!1}){if(null===e)return(0,r.jsx)("span",{className:"text-muted-foreground/60",children:"null"});if("boolean"==typeof e){let n=e?"true":"false";return(0,r.jsx)("span",{children:(0,r.jsx)(eq,{text:n,query:t})})}let a=String(e),l=G(e);return(0,r.jsx)("span",{title:a,className:l&&n?"underline-offset-2 decoration-foreground group-hover/cell:underline":void 0,children:(0,r.jsx)(eq,{text:a,query:t})})}function tw(e,t){return JSON.stringify(t.map(t=>Object.fromEntries(e.map((e,n)=>[e,t[n]??null]))),null,2)}function tN(e){if(null===e)return"";let t=String(e);return/[",\r\n]/.test(t)?`"${t.replaceAll('"','""')}"`:t}function tk(e,t){return[e.map(tN),...t.map(e=>e.map(tN))].map(e=>e.join(",")).join("\r\n")}async function tC(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 tS({checked:e,mixed:t=!1,label:n,className:a,onClick:l}){return(0,r.jsx)("button",{type:"button",role:"checkbox","aria-checked":t?"mixed":e,"aria-label":n,onClick:l,className:(0,O.cn)("flex size-4 cursor-pointer items-center justify-center rounded-[5px] border border-input bg-background text-transparent outline-none transition-[background-color,border-color,color,opacity] hover:border-foreground/40 focus-visible:ring-2 focus-visible:ring-ring/60",(e||t)&&"border-primary bg-primary text-primary-foreground",a),children:t?(0,r.jsx)(i.uPM,{className:"size-3",strokeWidth:3}):(0,r.jsx)(i.wiW,{className:"size-3",strokeWidth:3})})}function t$({columns:e,columnInfo:t,rows:n,table:l,tableKind:o,fileName:s,dimmed:d,sort:u,columnWidths:c,jumpColumn:f,search:x="",pinnedColumns:p=[],hiddenColumns:h=[],fk:g,onSortChange:v,onColumnWidthsChange:j,onTogglePin:z,onToggleHidden:E,onInsertRow:T,onUpdateCell:I,onUpdateRow:M,onDeleteRows:K}){let[R,L]=(0,a.useState)(()=>({source:n,current:n})),[_,P]=(0,a.useState)(c),[U,F]=(0,a.useState)(()=>new Set),[A,X]=(0,a.useState)(null),[Y,Q]=(0,a.useState)(null),[Z,ee]=(0,a.useState)(null),[et,en]=(0,a.useState)(null),[er,ea]=(0,a.useState)(null),[el,eo]=(0,a.useState)(null),[es,ei]=(0,a.useState)(null),[ed,eu]=(0,a.useState)(!1),[ec,em]=(0,a.useState)(null),[ef,ex]=(0,a.useState)(!1),ep=(0,a.useRef)(null),eh=(0,a.useRef)(null),eg=(0,a.useRef)(c),eb=(0,a.useRef)(null),ev=R.current;R.source!==n&&(ev=n,L({source:n,current:n}));let ej=(0,a.useRef)(null),ey=(0,a.useRef)(new Map),ew=(0,a.useRef)(null),[eN,ek]=(0,a.useState)({}),eC=(0,a.useMemo)(()=>(function(e,t=[],n=[]){let r=new Set(n),a=e.filter(e=>!r.has(e)),l=new Set(a),o=t.filter(e=>l.has(e)),s=new Set(o);return[...o,...a.filter(e=>!s.has(e))]})(e,p,h),[e,p,h]),eS=(0,a.useMemo)(()=>p.filter(e=>eC.includes(e)),[p,eC]),e$=(0,a.useMemo)(()=>new Set(eS),[eS]),ez=eS.at(-1)??null;function eE(e){return 0===eS.length?"checkbox"===e:e===ez}function eT(e){return(0,O.cn)("sticky left-0 isolate bg-frozen-muted","header"===e?"top-0 z-40":"z-10","body"===e&&"group-hover/row:bg-frozen-hover group-data-selected/row:bg-frozen-selected group-data-selected/row:group-hover/row:bg-frozen-selected-hover",eE("checkbox")&&"shadow-[4px_0_8px_-4px_rgba(0,0,0,0.35)]")}function eO(e){let t=function(e){if("number"!=typeof e||!Number.isFinite(e))return;let t=tj(e);return{width:t,minWidth:t,maxWidth:t}}(_[e]);if(!e$.has(e))return t;let n=eN[e];if("number"==typeof n)return{...t,left:n};let r=64;for(let t of eS){if(t===e)break;r+=_[t]??160}return{...t,left:r}}function eM(e,t){return e$.has(e)?(0,O.cn)("sticky isolate bg-frozen","header"===t?"top-0 z-30":"z-[9]","body"===t&&"group-hover/row:bg-frozen-hover group-data-selected/row:bg-frozen-selected group-data-selected/row:group-hover/row:bg-frozen-selected-hover",eE(e)&&"shadow-[4px_0_8px_-4px_rgba(0,0,0,0.35)]"):"relative z-0"}function eK(t){return t.map(t=>eC.map(n=>t[e.indexOf(n)]??null))}(0,a.useLayoutEffect)(()=>{if(!f)return;let e=ey.current.get(f),t=ej.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(n.left>=r.left+24&&n.right<=r.right-24)return;let a=n.left+n.width/2-(r.left+r.width/2);t.scrollBy({left:a,behavior:"auto"})},[f,e,ev]),(0,a.useLayoutEffect)(()=>{let e=ew.current?.getBoundingClientRect().width??40,t={};for(let n of eS)t[n]=e,e+=ey.current.get(n)?.getBoundingClientRect().width??_[n]??80;ek(e=>{let n=Object.keys(t);return n.length===Object.keys(e).length&&n.every(n=>e[n]===t[n])?e:t})},[eS,eC,_,ev]);let eR=[...U].sort((e,t)=>e-t),eL=eR.map(e=>ev[e]).filter(Boolean),e_=ev.length>0&&U.size===ev.length,eP=U.size>0&&!e_;function eU(e,t){let n={...eg.current,[e]:tj(t)};return eg.current=n,P(n),n}function eF(e){let t=eb.current;t&&t.pointerId===e.pointerId&&(e.preventDefault(),eU(t.column,t.startWidth+e.clientX-t.startX))}function eB(e){let t=eb.current;if(!t||t.pointerId!==e.pointerId)return;let n=eU(t.column,t.startWidth+e.clientX-t.startX);eb.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),j(n)}function eq(e){let t=eb.current;t&&t.pointerId===e.pointerId&&(eb.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),j(eg.current))}async function eW(e,t){await tC(e),eo(t),null!==eh.current&&window.clearTimeout(eh.current),eh.current=window.setTimeout(()=>eo(null),1400)}function eJ(e,t=eL){eW("json"===e?tw(eC,eK(t)):tk(eC,eK(t)),e)}function eH(e){let t=new Blob(["json"===e?tw(eC,eK(eL)):tk(eC,eK(eL))],{type:"json"===e?"application/json;charset=utf-8":"text/csv;charset=utf-8"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=`${s.replace(/[^a-z0-9._-]+/gi,"-")||"rows"}.${e}`,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}function eG(e){return d?"Wait for the table to finish loading":"table"!==o?"Views and foreign tables are read-only":[...t.values()].some(e=>e.isPrimaryKey)?e?e.isGenerated?"Generated columns are read-only":e.isIdentity?"Identity columns are read-only":null:"Column metadata is unavailable":"Editing requires a primary key"}function eX(){return d?"Wait for the table to finish loading":"table"!==o?"Views and foreign tables are read-only":[...t.values()].some(e=>e.isPrimaryKey)?null:"Deleting requires a primary key"}function eY(e){eX()||0===e.length||(em(null),ei([...new Set(e)].sort((e,t)=>e-t)))}async function eQ(){if(es){eu(!0),em(null);try{let n=es.flatMap(n=>{let r=ev[n];return r?[Object.fromEntries(e.flatMap((e,n)=>t.get(e)?.isPrimaryKey?[[e,r[n]??null]]:[]))]:[]});if(0===n.length)throw Error("The selected rows are no longer available");await K(n);let r=new Set(es);L(e=>({...e,current:e.current.filter((e,t)=>!r.has(t))})),F(new Set),ep.current=null,Q(null),ee(null),en(null),ea(null),ei(null)}catch(e){em(e instanceof Error?e.message:String(e))}finally{eu(!1)}}}async function eZ(n){if(!Z)return;let r=e[Z.cellIndex],a=ev[Z.rowIndex];if(!r||!a)throw Error("The selected cell is no longer available");let o=Object.fromEntries(e.flatMap((e,n)=>t.get(e)?.isPrimaryKey?[[e,a[n]??null]]:[])),s=await I({table:l,column:r,primaryKey:o,value:n});L(e=>({...e,current:e.current.map((e,t)=>t!==Z.rowIndex?e:s.row)})),ee(null)}async function e0(e){if(!M||!er)throw Error("This row is no longer available");let t=await M(e),{rowIndex:n}=er;return L(e=>({...e,current:e.current.map((e,r)=>r===n?t.row:e)})),ea(null),t}function e1(t,n,r){let a=k(n,e,r);a&&(ee(null),en(e=>e&&(e.anchor.contains(t)||t.contains(e.anchor))?null:{anchor:t,stack:[{table:n.referencedTable,keyColumns:n.referencedColumns,key:a}]}))}function e2(e){return`${(0,b.i)(e.referencedTable)}.${e.referencedColumns.join(", ")}`}(0,a.useEffect)(()=>{function e(e){let t=e instanceof KeyboardEvent&&"keyup"===e.type&&("Meta"===e.key||"Control"===e.key)?"Meta"===e.key?e.ctrlKey:e.metaKey:e.metaKey||e.ctrlKey;ex(e=>e===t?e:t)}function t(){ex(!1)}function n(){document.hidden&&t()}return window.addEventListener("keydown",e),window.addEventListener("keyup",e),window.addEventListener("mousemove",e),window.addEventListener("blur",t),document.addEventListener("visibilitychange",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",e),window.removeEventListener("mousemove",e),window.removeEventListener("blur",t),document.removeEventListener("visibilitychange",n)}},[]),(0,a.useEffect)(()=>{function e(e){if("Backspace"!==e.key&&"Delete"!==e.key||e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||es||Z||0===U.size)return;let t=e.target;if(t instanceof HTMLElement){let e=t.tagName;if("INPUT"===e||"TEXTAREA"===e||"SELECT"===e||t.isContentEditable)return}e.preventDefault(),eY([...U])}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[es,Z,U,d,o,t]);let e5=null!==A&&A.rowIndex>=0,e3=e5&&A?G(A.value):null,e4=A?e[A.cellIndex]:void 0,e6=e5&&A?ev[A.rowIndex]:void 0,e8=!!(e4&&e$.has(e4)),e9=h.filter(t=>e.includes(t)).length,e7=!!e4&&e.length-e9>1,te=e4?w(g?.table,e4):void 0,tt=e5?eG(e4?t.get(e4):void 0):"Select a cell to edit",tn=te&&e6?k(te,e,e6):null,tr=e5&&A&&U.has(A.rowIndex)&&U.size>1?[...U]:e5&&A?[A.rowIndex]:[],ta=eX(),tl=!!M&&!!g?.table&&"table"===o&&[...t.values()].some(e=>e.isPrimaryKey),to=es?.length??0,ts=Z?e[Z.cellIndex]:void 0,ti=ts?t.get(ts):void 0,td=!!(ti&&eD(eI(ti))),tu=ts?w(g?.table,ts):void 0,tc=tu?y(g?.tables??[],tu.referencedTable):void 0;return(0,r.jsxs)("div",{className:(0,O.cn)("flex min-h-0 flex-1 flex-col transition-opacity",d&&"opacity-50"),children:[U.size>0&&(0,r.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b bg-muted/20 px-2.5",children:[(0,r.jsx)(m.$,{variant:"ghost",size:"icon-xs",onClick:()=>{F(new Set),ep.current=null},"aria-label":"Clear row selection",children:(0,r.jsx)(i.yBK,{})}),(0,r.jsxs)("span",{className:"mr-1 text-xs font-medium tabular-nums",children:[U.size," selected"]}),(0,r.jsx)("div",{className:"mx-0.5 h-4 w-px bg-border"}),(0,r.jsxs)(m.$,{variant:"ghost",size:"sm",onClick:()=>eJ("json"),children:[(0,r.jsx)(i.hX7,{"data-icon":"inline-start"}),"json"===el?"Copied":"Copy JSON"]}),(0,r.jsxs)(m.$,{variant:"ghost",size:"sm",onClick:()=>eJ("csv"),children:[(0,r.jsx)(i.hX7,{"data-icon":"inline-start"}),"csv"===el?"Copied":"Copy CSV"]}),(0,r.jsxs)(D.rI,{children:[(0,r.jsxs)(D.ty,{render:(0,r.jsx)(m.$,{variant:"ghost",size:"sm"}),className:"cursor-pointer",children:[(0,r.jsx)(i.Inw,{"data-icon":"inline-start"}),"Export"]}),(0,r.jsxs)(D.SQ,{align:"start",sideOffset:4,className:"min-w-40",children:[(0,r.jsxs)(D._2,{onClick:()=>eH("json"),children:[(0,r.jsx)(i.iC_,{}),"Export JSON"]}),(0,r.jsxs)(D._2,{onClick:()=>eH("csv"),children:[(0,r.jsx)(i.wT6,{}),"Export CSV"]})]})]}),(0,r.jsxs)(m.$,{variant:"destructive",size:"sm",className:"ml-auto",disabled:!!ta,title:ta??void 0,onClick:()=>eY(eR),children:[(0,r.jsx)(i.mYx,{"data-icon":"inline-start"}),"Delete"]})]}),(0,r.jsxs)("div",{ref:ej,className:"min-h-0 flex-1 overflow-auto",children:[(0,r.jsxs)(B,{onOpenChange:e=>!e&&X(null),children:[(0,r.jsx)(q,{onContextMenuCapture:function(e){let t=e.target,n=t.closest("td[data-cell-index]");if(n){let e=Number(n.dataset.rowIndex),t=Number(n.dataset.cellIndex),r=ev[e]?.[t]??null;X({rowIndex:e,cellIndex:t,value:r}),Q({rowIndex:e,cellIndex:t});return}let r=t.closest("th[data-cell-index]");r?X({rowIndex:-1,cellIndex:Number(r.dataset.cellIndex),value:null}):X(null)},className:"w-max min-w-full",children:(0,r.jsxs)("table",{className:"w-max min-w-full border-separate border-spacing-0 font-mono text-xs",children:[(0,r.jsx)("thead",{className:"sticky top-0 z-20 bg-frozen",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{ref:ew,className:(0,O.cn)("h-9 w-16 border-b border-r pr-1.5 pl-2 font-normal text-muted-foreground",eT("header")),children:(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"flex w-6 shrink-0 items-center justify-center",children:(0,r.jsx)(tS,{checked:e_,mixed:eP,label:e_?"Clear all rows on this page":"Select all rows on this page",onClick:function(){F(e_?new Set:new Set(ev.map((e,t)=>t))),ep.current=e_?null:0}})}),tl&&(0,r.jsx)("span",{"aria-hidden":!0,className:"size-5 shrink-0"})]})}),eC.map(n=>{let a=e.indexOf(n),l=t.get(n),o=u?.column===n?u.direction:null,s=null===o?`Sort ${n} ascending`:"asc"===o?`Sort ${n} descending`:`Clear sorting for ${n}`,d=f===n,c=w(g?.table,n);return(0,r.jsxs)("th",{"data-cell-index":a,ref:e=>{e?ey.current.set(n,e):ey.current.delete(n)},"aria-sort":"asc"===o?"ascending":"desc"===o?"descending":"none",style:eO(n),className:(0,O.cn)("relative h-9 max-w-80 border-b border-r p-0 text-left font-normal whitespace-nowrap select-none",eM(n,"header"),d&&(e$.has(n)?"bg-frozen-jump shadow-[inset_0_-2px_0_0_var(--primary)]":"bg-primary/12 shadow-[inset_0_-2px_0_0_var(--primary)]")),children:[(0,r.jsxs)("button",{type:"button","aria-label":s,title:s,onClick:()=>{F(new Set),ep.current=null,Q(null),ee(null),en(null),ea(null),v(u?.column!==n?{column:n,direction:"asc"}:"asc"===u.direction?{column:n,direction:"desc"}:null)},className:"group/sort flex h-full w-full items-center gap-2 overflow-hidden px-3 pr-5 text-left outline-none hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/60",children:[e$.has(n)&&(0,r.jsx)(i.M0d,{className:"size-3 shrink-0 text-muted-foreground"}),(0,r.jsx)("span",{className:(0,O.cn)("truncate",l?.isPrimaryKey&&"font-semibold"),children:n}),c&&(0,r.jsx)("span",{title:`References ${e2(c)}`,className:"shrink-0 text-muted-foreground/70",children:(0,r.jsx)(i.WnQ,{className:"size-3"})}),l&&(0,r.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:l.type}),"asc"===o?(0,r.jsx)(i.IYh,{className:"ml-auto size-3.5 shrink-0"}):"desc"===o?(0,r.jsx)(i.B5$,{className:"ml-auto size-3.5 shrink-0"}):(0,r.jsx)(i.FK4,{className:"ml-auto size-3.5 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/sort:opacity-60 group-focus-visible/sort:opacity-60"})]}),(0,r.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize ${n} column`,"aria-valuemin":80,"aria-valuemax":640,"aria-valuenow":_[n],tabIndex:0,title:"Drag to resize; double-click to reset",onPointerDown:e=>{let t,r;return e.preventDefault(),e.stopPropagation(),t=e.currentTarget.parentElement,void((r=_[n]??t?.getBoundingClientRect().width)&&(eb.current={column:n,pointerId:e.pointerId,startX:e.clientX,startWidth:r},e.currentTarget.setPointerCapture(e.pointerId)))},onPointerMove:eF,onPointerUp:eB,onPointerCancel:eq,onKeyDown:e=>(function(e,t){if("ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.preventDefault(),t.stopPropagation();let n=eg.current[e]??t.currentTarget.parentElement?.getBoundingClientRect().width;n&&j(eU(e,n+("ArrowLeft"===t.key?-1:1)*16))})(n,e),onDoubleClick:e=>{let t;return e.preventDefault(),e.stopPropagation(),t={...eg.current},void(delete t[n],eg.current=t,P(t),j(t))},className:"group/resize absolute inset-y-0 -right-1 z-40 w-2 cursor-col-resize touch-none outline-none after:absolute after:inset-y-1 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"})]},n)})]})}),(0,r.jsx)("tbody",{children:ev.map((n,a)=>{let l=U.has(a);return(0,r.jsxs)("tr",{"data-selected":l||void 0,className:"group/row hover:bg-muted/40 data-selected:bg-primary/[0.07] data-selected:hover:bg-primary/[0.09]",children:[(0,r.jsx)("td",{className:(0,O.cn)("h-8 w-16 border-b border-r pr-1.5 pl-2 text-muted-foreground tabular-nums",eT("body")),children:(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsxs)("span",{className:"relative flex w-6 shrink-0 items-center justify-center",children:[(0,r.jsx)("span",{className:(0,O.cn)("transition-opacity group-hover/row:opacity-0",l&&"opacity-0"),children:a+1}),(0,r.jsx)(tS,{checked:l,label:`${l?"Deselect":"Select"} row ${a+1}`,onClick:e=>{F(t=>{let n=new Set(t);if(e.shiftKey&&null!==ep.current){let e=Math.min(ep.current,a),t=Math.max(ep.current,a);for(let r=e;r<=t;r+=1)n.add(r)}else n.has(a)?n.delete(a):n.add(a);return n}),!e.shiftKey&&(ep.current=a)},className:(0,O.cn)("absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",l?"opacity-100":"opacity-0 group-hover/row:opacity-100")})]}),tl&&(0,r.jsx)("button",{type:"button","aria-label":`Expand row ${a+1}`,title:d?"Wait for the table to finish loading":`Expand row ${a+1}`,disabled:d,onClick:()=>ea({rowIndex:a,row:n,columns:e}),className:"flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground opacity-0 outline-none transition-[opacity,background-color,color] hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/60 disabled:pointer-events-none group-hover/row:opacity-100",children:(0,r.jsx)(i.wGq,{className:"size-3"})})]})}),eC.map(l=>{let o=e.indexOf(l),s=n[o]??null,i=t.get(l),d=eG(i),u=w(g?.table,l),c=!!(u&&null!==s),m=G(s),p=Z?.rowIndex===a&&Z.cellIndex===o&&!!(i&&eD(eI(i)));return(0,r.jsx)("td",{"data-row-index":a,"data-cell-index":o,title:p?void 0:m?`${m} \xb7 ⌘/Ctrl-click to open`:c&&u?`${e2(u)} \xb7 Double-click to edit`:d??"Double-click to edit",onClick:e=>{if(Q({rowIndex:a,cellIndex:o}),e.metaKey||e.ctrlKey){if(m){e.preventDefault(),window.open(m,"_blank","noopener,noreferrer");return}c&&u&&e1(e.currentTarget,u,n)}},onDoubleClick:e=>{Q({rowIndex:a,cellIndex:o}),en(null),d||ee({rowIndex:a,cellIndex:o,anchor:e.currentTarget})},style:eO(l),className:(0,O.cn)("group/cell h-8 max-w-80 border-b border-r px-3 whitespace-nowrap select-none",m&&ef?"cursor-pointer":"cursor-default",p?"overflow-visible":"truncate",eM(l,"body"),f===l&&(e$.has(l)?"bg-frozen-jump":"bg-primary/6"),Y?.rowIndex===a&&Y.cellIndex===o&&(e$.has(l)?"z-[11] bg-frozen-active outline-2 -outline-offset-2 outline-primary/70":"relative z-[3] bg-primary/4 outline-2 -outline-offset-2 outline-primary/70")),children:p&&i&&Z?(0,r.jsx)(eA,{anchor:Z.anchor,column:i,value:s,foreignKey:tu,referencedTable:tc,connectionUrl:g?.connectionUrl,onClose:()=>ee(null),onSave:eZ}):c&&u?(0,r.jsx)(eV,{value:s,label:function(t,n){let r=k(t,e,n);if(!r)return null;let a=g?.relatedRows.get(N(t.referencedTable,r));if(!a)return null;let l=y(g?.tables??[],t.referencedTable);return S(a.columns,a.row,C(l?.columns??[],t.referencedColumns))}(u,n),referenced:e2(u),query:x,onOpen:e=>{e.stopPropagation(),Q({rowIndex:a,cellIndex:o}),e1(e.currentTarget,u,n)}}):(0,r.jsx)(ty,{value:s,query:x,linkModifier:ef})},l)})]},a)})})]})}),(0,r.jsxs)(V,{children:[(0,r.jsxs)(W,{disabled:!e5||!A,onClick:()=>{var e;return A&&void eW(null===(e=A.value)?"null":String(e),"cell")},children:[(0,r.jsx)(i.hX7,{}),"Copy cell",e4&&(0,r.jsx)("span",{className:"ml-auto max-w-24 truncate text-[10px] text-muted-foreground",children:e4})]}),(0,r.jsxs)(W,{disabled:!!tt,title:tt??void 0,onClick:()=>{if(!A||tt)return;let e=ej.current?.querySelector(`td[data-row-index="${A.rowIndex}"][data-cell-index="${A.cellIndex}"]`);e&&(en(null),ee({rowIndex:A.rowIndex,cellIndex:A.cellIndex,anchor:e}))},children:[(0,r.jsx)(i.NOV,{}),"Edit cell"]}),(0,r.jsxs)(W,{disabled:!e3,onClick:()=>{e3&&window.open(e3,"_blank","noopener,noreferrer")},children:[(0,r.jsx)(i.qM8,{}),"Open URL"]}),(0,r.jsxs)(W,{disabled:!te||!tn||!e6||!e5,onClick:()=>{if(!te||!e6||!A)return;let e=ej.current?.querySelector(`td[data-row-index="${A.rowIndex}"][data-cell-index="${A.cellIndex}"]`);e&&(en(null),e1(e,te,e6))},children:[(0,r.jsx)(i.WnQ,{}),"View referenced row"]}),(0,r.jsxs)(W,{disabled:!te||!tn||!g,onClick:()=>{te&&tn&&g&&g.onOpenTable(te.referencedTable,$(te.referencedColumns,tn))},children:[(0,r.jsx)(i.qM8,{}),"Open referenced table"]}),(0,r.jsx)(J,{}),(0,r.jsxs)(W,{disabled:!T,onClick:()=>T?.(),children:[(0,r.jsx)(i.enO,{}),"Insert row"]}),(0,r.jsx)(J,{}),(0,r.jsxs)(W,{disabled:!e4,onClick:()=>e4&&z(e4),children:[e8?(0,r.jsx)(i.M0d,{}):(0,r.jsx)(i.rq5,{}),e8?"Unpin column":"Pin column"]}),(0,r.jsxs)(W,{disabled:!e4||!e7,onClick:()=>e4&&E(e4),children:[(0,r.jsx)(i.E9H,{}),"Hide column"]}),(0,r.jsx)(J,{}),(0,r.jsxs)(W,{disabled:!e5||!A,onClick:()=>A&&eJ("json",[ev[A.rowIndex]]),children:[(0,r.jsx)(i.iC_,{}),"Copy row as JSON"]}),(0,r.jsxs)(W,{disabled:!e5||!A,onClick:()=>A&&eJ("csv",[ev[A.rowIndex]]),children:[(0,r.jsx)(i.wT6,{}),"Copy row as CSV"]}),(0,r.jsx)(J,{}),(0,r.jsxs)(W,{variant:"destructive",disabled:!e5||!A||!!ta,onClick:()=>eY(tr),children:[(0,r.jsx)(i.mYx,{}),tr.length>1?`Delete ${tr.length} selected rows`:"Delete row"]})]})]}),0===ev.length&&(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3 py-10",children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No rows"}),T&&(0,r.jsxs)(m.$,{variant:"outline",size:"sm",onClick:T,children:[(0,r.jsx)(i.enO,{"data-icon":"inline-start"}),"Insert row"]})]})]}),Z&&ti&&!td&&(0,r.jsx)(eA,{anchor:Z.anchor,column:ti,value:ev[Z.rowIndex]?.[Z.cellIndex]??null,foreignKey:tu,referencedTable:tc,connectionUrl:g?.connectionUrl,onClose:()=>ee(null),onSave:eZ},`${Z.rowIndex}:${Z.cellIndex}`),et&&g&&(0,r.jsx)(tb,{peek:et,connectionUrl:g.connectionUrl,tables:g.tables,relatedRows:g.relatedRows,onClose:()=>en(null),onPeek:en,onUpdateCell:I,onOpenTable:(e,t)=>{en(null),g.onOpenTable(e,t)}}),g?.table&&M&&(0,r.jsx)(tp,{target:er,table:g.table,tables:g.tables,connectionUrl:g.connectionUrl,onOpenChange:e=>!e&&ea(null),onUpdate:e0}),(0,r.jsx)(H.lG,{open:null!==es,onOpenChange:e=>{e||ed||(ei(null),em(null))},children:(0,r.jsxs)(H.Cf,{showCloseButton:!ed,className:"sm:max-w-md",children:[(0,r.jsxs)(H.c7,{children:[(0,r.jsx)(H.L3,{children:1===to?"Delete this row?":`Delete ${to} rows?`}),(0,r.jsxs)(H.rr,{children:["This permanently deletes"," ",1===to?"the selected row":`${to} selected rows`," ","from ",(0,b.i)(l),". This cannot be undone."]})]}),ec&&(0,r.jsx)("p",{role:"alert",className:"font-mono text-xs text-destructive",children:ec}),(0,r.jsxs)(H.Es,{children:[(0,r.jsx)(m.$,{type:"button",variant:"outline",disabled:ed,onClick:()=>{ei(null),em(null)},children:"Cancel"}),(0,r.jsxs)(m.$,{type:"button",variant:"destructive",disabled:ed,onClick:()=>void eQ(),children:[ed&&(0,r.jsx)(i.gnh,{className:"animate-spin","data-icon":"inline-start"}),ed?"Deleting…":1===to?"Delete row":`Delete ${to} rows`]})]})]})})]})}var tz=n(85488);function tE({connectionUrl:e,foreignKey:t,referencedTable:n,keyColumn:l,value:o,inputRef:s,onPick:i,onOpenChange:d}){let[u,c]=(0,a.useState)(""),m=p(u,200),f=C(n.columns,t.referencedColumns),g=(0,x.Y)(`${e}:${(0,b.i)(n)}:${m}`,n=>h.F.lookup(e,{table:t.referencedTable,search:m,limit:30},n)),v=(0,a.useMemo)(()=>{let e=[],t=g.data,n=t?t.columns.indexOf(l):-1;if(t&&n>=0)for(let r of t.rows){let a=r[n];if(null==a)continue;let l=String(a);e.push({value:l,label:S(t.columns,r,f)??l,raw:!1})}let r=u.trim();return r&&!e.some(e=>e.value===r)&&e.push({value:r,label:r,raw:!0}),e},[f,l,u,g.data]),j=v.find(e=>e.value===o)??null;return(0,r.jsxs)(tz.G3,{items:v,filter:null,open:!0,value:j,inputValue:u,onInputValueChange:e=>c(e),itemToStringLabel:e=>e.label,itemToStringValue:e=>e.value,isItemEqualToValue:(e,t)=>e.value===t.value,onOpenChange:d,onValueChange:e=>{e&&i(e.value,e.raw||e.label===e.value?null:e.label)},children:[(0,r.jsx)(tz.oK,{inputRef:s,placeholder:`Search ${n.name}`,showTrigger:!1,className:"h-6 min-h-6 w-52 border-0 bg-transparent font-mono shadow-none dark:bg-transparent"}),(0,r.jsxs)(tz.h5,{className:"min-w-72",children:[g.error?(0,r.jsx)("p",{className:"px-2.5 py-2 text-xs text-destructive",children:g.error}):g.loading&&!g.data?(0,r.jsx)("p",{className:"px-2.5 py-2 text-xs text-muted-foreground",children:"Searching…"}):null,(0,r.jsx)(tz.$U,{children:"No matching rows"}),(0,r.jsx)(tz.ex,{children:e=>(0,r.jsxs)(tz.x4,{value:e,className:"font-mono text-xs",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),e.raw?(0,r.jsx)("span",{className:"shrink-0 text-muted-foreground",children:"use raw value"}):e.label!==e.value?(0,r.jsx)("span",{className:"max-w-[45%] shrink-0 truncate text-muted-foreground",children:e.value}):null]},`${e.raw?"raw":"row"}:${e.value}`)})]})]})}function tT({filter:e,onClick:t}){return(0,r.jsx)("button",{type:"button",title:e.label?`${e.label} \xb7 ${e.value}`:void 0,className:(0,O.cn)("flex h-full max-w-72 items-center gap-1.5 px-1.5 font-mono hover:bg-foreground/5",!e.value&&"text-muted-foreground"),onClick:t,children:e.label?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"max-w-40 truncate",children:e.label}),(0,r.jsx)("span",{className:"max-w-28 truncate text-muted-foreground/60",children:e.value})]}):(0,r.jsx)("span",{className:"max-w-48 truncate",children:e.value||"value"})})}function tO({filter:e,columns:t,autoStart:n=!1,table:l,tables:o,connectionUrl:s,onChange:d,onRemove:u,onSettled:c}){let[f,x]=(0,a.useState)(()=>n?e.column?"operator":"column":null),p=(0,a.useRef)(!1),h=(0,a.useRef)(null),b=(0,a.useRef)(null),v=t.map(e=>e.name),j=t.find(t=>t.name===e.column),N=j?eI(j):null,k=j&&N&&eD(N)?eP(N,j).map(e=>e.value):[],C=(0,g.eK)(e),S=s?function(e,t,n){let r=w(e,n);if(!r||1!==r.columns.length)return null;let a=y(t,r.referencedTable),l=r.referencedColumns[0];return a&&l?{foreignKey:r,referencedTable:a,keyColumn:l}:null}(l,o??[],e.column):null,$=!!S&&(0,g.mk)(e.operator);function z(e){p.current=!0,x(e)}function E(e,t){if(t)return void x(e);if(p.current){p.current=!1;return}f===e&&x(null)}function T(){x(null),c?.()}return(0,a.useEffect)(()=>{"column"===f&&h.current?.focus(),"value"===f&&0===k.length&&b.current?.focus()},[f,k.length]),(0,r.jsxs)("div",{"data-filter-chip":"",className:(0,O.cn)("flex h-6 items-center overflow-hidden rounded-md border bg-muted/50 text-xs",!C&&"border-dashed"),onKeyDownCapture:function(e){"Escape"!==e.key||(n||!C)&&(e.preventDefault(),e.stopPropagation(),u())},onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:["column"===f?(0,r.jsxs)(tz.G3,{items:v,value:e.column||null,open:!0,onOpenChange:e=>E("column",e),onValueChange:t=>{d({...e,column:t??"",value:"",label:void 0}),t&&z("operator")},children:[(0,r.jsx)(tz.oK,{inputRef:h,placeholder:"Column",showTrigger:!1,className:"h-6 min-h-6 w-40 border-0 bg-transparent shadow-none dark:bg-transparent"}),(0,r.jsxs)(tz.h5,{children:[(0,r.jsx)(tz.$U,{children:"No columns"}),(0,r.jsx)(tz.ex,{children:e=>(0,r.jsx)(tz.x4,{value:e,children:e},e)})]})]}):(0,r.jsx)("button",{type:"button",className:"h-full px-1.5 font-mono hover:bg-foreground/5",onClick:()=>x("column"),children:e.column||"column"}),(0,r.jsxs)(eh,{items:g.eZ,value:e.operator,open:"operator"===f,onOpenChange:e=>E("operator",e),onValueChange:t=>{t&&(d({...e,operator:t}),(0,g.qm)(t)?(z("value"),c?.()):T())},children:[(0,r.jsx)(ev,{className:"h-6 w-auto gap-0 rounded-none border-0 bg-transparent px-1.5 py-0 font-mono text-xs shadow-none hover:bg-foreground/5 dark:bg-transparent dark:hover:bg-foreground/5 data-[size=default]:h-6 [&_svg]:hidden",children:g.we[e.operator].symbol}),(0,r.jsx)(ej,{align:"start",alignItemWithTrigger:!1,className:"min-w-56",children:g.MM.map(e=>(0,r.jsxs)(eg,{children:[(0,r.jsx)(ey,{className:"px-2 pt-2 pb-1 text-[10px] font-medium tracking-wide text-muted-foreground uppercase",children:e.label}),g.eZ.filter(t=>t.group===e.id).map(e=>(0,r.jsxs)(ew,{value:e.value,className:"pr-2 [&>span:last-of-type]:hidden",children:[(0,r.jsx)("span",{className:"flex-1",children:e.label}),(0,r.jsx)("span",{className:"inline-flex h-5 min-w-5 shrink-0 items-center justify-center self-center rounded-md bg-muted px-1.5 font-mono text-[10px] leading-none text-muted-foreground",children:e.symbol})]},e.value))]},e.id))})]}),(0,g.qm)(e.operator)&&($&&S?"value"===f?(0,r.jsx)(tE,{connectionUrl:s??"",foreignKey:S.foreignKey,referencedTable:S.referencedTable,keyColumn:S.keyColumn,value:e.value,inputRef:b,onPick:(t,n)=>{d({...e,value:t,label:n??void 0}),T()},onOpenChange:e=>E("value",e)}):(0,r.jsx)(tT,{filter:e,onClick:()=>x("value")}):k.length?"value"===f?(0,r.jsxs)(tz.G3,{items:k,value:e.value||null,open:!0,onOpenChange:e=>E("value",e),onValueChange:t=>{d({...e,value:t??"",label:void 0}),T()},children:[(0,r.jsx)(tz.oK,{placeholder:"Value",showTrigger:!1,showClear:!!e.value,className:"h-6 min-h-6 w-40 border-0 bg-transparent font-mono shadow-none dark:bg-transparent"}),(0,r.jsxs)(tz.h5,{children:[(0,r.jsx)(tz.$U,{children:"No values"}),(0,r.jsx)(tz.ex,{children:e=>(0,r.jsx)(tz.x4,{value:e,children:e},e)})]})]}):(0,r.jsx)(tT,{filter:e,onClick:()=>x("value")}):"value"===f?(0,r.jsx)("input",{ref:b,value:e.value,onChange:t=>d({...e,value:t.target.value,label:void 0}),onBlur:()=>T(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),T())},placeholder:"value",spellCheck:!1,autoComplete:"off",autoCorrect:"off",className:"h-6 min-w-16 bg-transparent px-1.5 font-mono outline-none placeholder:text-muted-foreground",style:{width:`${Math.max(6,e.value.length+1)}ch`}}):(0,r.jsx)(tT,{filter:e,onClick:()=>x("value")})),(0,r.jsx)(m.$,{variant:"ghost",size:"icon-xs",onClick:u,"aria-label":"Remove filter",className:"h-6 w-6 rounded-none border-l opacity-60 hover:opacity-100",children:(0,r.jsx)(i.yBK,{})})]})}function tI({filters:e,search:t,columns:n,table:l,tables:o,connectionUrl:s,onFiltersChange:d,onSearchChange:u,onRefresh:c,refreshing:f=!1}){let x=(0,a.useRef)(null),p=(0,a.useRef)(null),[h,b]=(0,a.useState)(!1),[v,j]=(0,a.useState)(0),[y,w]=(0,a.useState)(null),[N,k]=(0,a.useState)(!1),C=(0,a.useMemo)(()=>N&&t.trim()?(0,E.R6)(t,n,e=>e.name).map(e=>e.item):n,[n,t,N]),S=(0,a.useMemo)(()=>{let e=[];for(let n of(N&&t.trim()&&e.push({type:"search",query:t.trim()}),C))e.push({type:"column",column:n});return e},[C,t,N]),$=0===S.length?0:Math.min(v,S.length-1),z=S[$]??null;function T(){let e=p.current;e&&(e.focus(),e.select())}function I(t){switch(t.type){case"search":b(!1),k(!1);return;case"column":var n;let r;n=t.column.name,b(!1),k(!1),N&&u(""),d([...e,r=(0,g.x7)(n)]),w(r.id);return;default:return t}}(0,a.useEffect)(()=>{h&&document.getElementById(`filter-col-${$}`)?.scrollIntoView({block:"nearest"})},[h,$]),(0,a.useEffect)(()=>{if(h)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;x.current?.contains(t)||t instanceof HTMLElement&&t.closest("[data-slot=select-content], [data-slot=combobox-content]")||b(!1)}},[h]),(0,a.useEffect)(()=>{function e(e){if(!document.querySelector("[data-slot=dialog-content], [data-slot=select-content], [data-slot=combobox-content], [data-table-palette], [data-command-palette], [data-row-peek]")&&0!==n.length){if((e.metaKey||e.ctrlKey)&&"f"===e.key.toLowerCase()){e.preventDefault(),T();return}"/"!==e.key&&"f"!==e.key.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.repeat||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)||(e.preventDefault(),T())}}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n.length]);let D=h&&n.length>0,M=!t&&0===e.length&&!h;return(0,r.jsxs)("div",{className:"flex items-start gap-1.5 border-b px-4 py-2",children:[(0,r.jsxs)("div",{ref:x,className:(0,O.cn)("relative flex min-h-8 min-w-0 flex-1 flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2 py-1 text-sm transition-colors","focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 dark:bg-input/30"),onClick:()=>{p.current?.focus(),n.length>0&&b(!0)},onPointerDown:e=>{e.target.closest("[data-filter-chip]")&&b(!1)},children:[e.map(t=>(0,r.jsx)(tO,{filter:t,columns:n,autoStart:t.id===y,table:l,tables:o,connectionUrl:s,onChange:t=>d(e.map(e=>e.id===t.id?t:e)),onRemove:()=>{t.id===y&&w(null),d(e.filter(e=>e.id!==t.id))},onSettled:()=>{t.id===y&&w(null)}},t.id)),(0,r.jsx)("input",{ref:p,value:t,onChange:e=>{k(!0),b(!0),j(+!!e.target.value.trim()),u(e.target.value)},onFocus:()=>{k(!1),j(0),n.length>0&&b(!0)},onKeyDown:function(n){if("ArrowDown"===n.key){if(n.preventDefault(),h||b(!0),0===S.length)return;j(e=>(e+1)%S.length);return}if("ArrowUp"===n.key){if(n.preventDefault(),h||b(!0),0===S.length)return;j(e=>(e-1+S.length)%S.length);return}if("Enter"===n.key){n.preventDefault(),h&&z?(I(z),"column"===z.type&&n.currentTarget.blur()):b(!1);return}if("Escape"===n.key)return(n.preventDefault(),h)?void b(!1):t?void u(""):void n.currentTarget.blur();if("Backspace"===n.key&&!t&&e.length>0){n.preventDefault();let t=e[e.length-1];if(!t)return;t.id===y&&w(null),d(e.slice(0,-1))}},spellCheck:!1,autoComplete:"off",autoCorrect:"off",placeholder:function(e,t){if(t)return"Add more filters...";let n=e.slice(0,3).map(e=>e.name);return 0===n.length?"Filter or search…":`Filter by ${n.join(", ")}${e.length>3?"…":""}`}(n,e.length>0),"aria-label":"Filter or search table","aria-expanded":D,"aria-controls":"filter-column-list","aria-activedescendant":z?`filter-col-${$}`:void 0,"aria-autocomplete":"list",role:"combobox",className:"h-6 min-w-40 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"}),t?(0,r.jsx)(m.$,{type:"button",variant:"ghost",size:"icon-xs","aria-label":"Clear search",className:"ml-auto",onClick:e=>{e.stopPropagation(),u(""),p.current?.focus()},children:(0,r.jsx)(i.yBK,{})}):M?(0,r.jsx)("kbd",{className:"pointer-events-none ml-auto font-mono text-[10px] text-muted-foreground/55",children:"/"}):null,D?(0,r.jsx)("div",{id:"filter-column-list","data-filter-menu":"",role:"listbox","aria-label":"Filter columns",className:"absolute top-[calc(100%+6px)] left-0 z-50 max-h-72 min-w-64 overflow-auto rounded-lg bg-popover py-1 text-popover-foreground shadow-md ring-1 ring-foreground/10",children:0===S.length?(0,r.jsx)("p",{className:"px-3 py-2 text-sm text-muted-foreground",children:"No matching columns"}):S.map((e,n)=>{let a=n===$;switch(e.type){case"search":return(0,r.jsxs)("div",{children:[(0,r.jsxs)("button",{id:`filter-col-${n}`,type:"button",role:"option","aria-selected":a,onMouseEnter:()=>j(n),onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),I(e)},className:(0,O.cn)("flex h-8 w-full cursor-pointer items-center gap-2 px-2.5 text-left text-sm outline-none",a&&"bg-accent text-accent-foreground"),children:[(0,r.jsx)(i.TfF,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:"Search all columns"}),(0,r.jsx)("span",{className:"max-w-32 truncate font-mono text-xs text-muted-foreground",children:e.query})]}),C.length>0?(0,r.jsx)("div",{className:"my-1 h-px bg-border"}):null]},"search");case"column":return(0,r.jsx)("button",{id:`filter-col-${n}`,type:"button",role:"option","aria-selected":a,onMouseEnter:()=>j(n),onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),I(e),p.current?.blur()},className:(0,O.cn)("flex h-8 w-full cursor-pointer items-center px-2.5 text-left font-mono text-[13px] outline-none",a&&"bg-accent text-accent-foreground"),children:(0,r.jsx)(eq,{text:e.column.name,query:N?t:""})},e.column.name);default:return e}})}):null]}),c?(0,r.jsx)(m.$,{type:"button",variant:"ghost",size:"icon-sm",className:"mt-0.5 shrink-0 text-muted-foreground","aria-label":"Refresh rows",title:"Refresh rows",disabled:f,onClick:c,children:(0,r.jsx)(i.oS8,{className:(0,O.cn)(f&&"animate-spin")})}):null]})}var tD=n(30374),tM=n(96532);let tK=[25,50,100,200],tR=new Intl.NumberFormat;function tL({pane:e,onPaneChange:t,page:n,pageSize:a,rowCount:l,total:o,estimated:s,hasMore:d,capped:u,onPageChange:c,onPageSizeChange:f}){var x;let p=0===l?0:n*a+l,h=null==o?null:Math.max(o,p);return(0,r.jsxs)("div",{className:"flex items-center gap-2 border-t px-4 py-1.5 text-xs text-muted-foreground",children:[(0,r.jsx)("span",{className:(0,O.cn)("min-w-0 truncate","data"===e&&"tabular-nums"),title:"data"===e?(x=s,u?`Only the first ${tR.format(tM.d6)} rows can be paged. Add a filter to go further.`:x?"Estimated from Postgres table statistics":void 0):void 0,children:function({pane:e,start:t,end:n,displayTotal:r,estimated:a,hasMore:l,capped:o}){switch(e){case"definition":return"Definition";case"data":{let e=`${tR.format(t)}–${tR.format(n)}`,s=null==r?l||o?"+":"":` of ${a?"~":""}${tR.format(r)}`,i=o?` \xb7 first ${tR.format(tM.d6)} rows`:"";return`${e}${s}${i}`}default:return e}}({pane:e,start:0===l?0:n*a+1,end:p,displayTotal:h,estimated:s,hasMore:d,capped:u})}),(0,r.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:["data"===e?(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsxs)(eh,{value:String(a),onValueChange:e=>e&&f(Number(e)),children:[(0,r.jsx)(ev,{size:"sm",className:"text-xs",children:(0,r.jsx)(eb,{})}),(0,r.jsx)(ej,{children:tK.map(e=>(0,r.jsx)(ew,{value:String(e),children:e},e))})]}),(0,r.jsx)(m.$,{variant:"ghost",size:"icon-sm",disabled:0===n,onClick:()=>c(n-1),"aria-label":"Previous page",children:(0,r.jsx)(i.SI1,{})}),(0,r.jsx)(m.$,{variant:"ghost",size:"icon-sm",disabled:!d,onClick:()=>c(n+1),"aria-label":"Next page",children:(0,r.jsx)(i.nNJ,{})})]}):null,(0,r.jsx)(tD.x,{label:"Table pane",value:e,onChange:t,options:[{value:"data",label:"Data"},{value:"definition",label:"Definition"}]})]})]})}let t_="insert";function tP(e){let[t,n]=(0,a.useState)({open:e.open,id:0}),[l,o]=(0,a.useState)(!1);return t.open!==e.open&&(n({open:e.open,id:e.open?t.id+1:t.id}),o(!1)),(0,r.jsx)(H.lG,{open:e.open,onOpenChange:t=>{(t||!l)&&e.onOpenChange(t)},children:(0,r.jsx)(H.Cf,{showCloseButton:!l,className:"flex max-h-[calc(100dvh-2rem)] flex-col gap-0 overflow-hidden p-0 sm:max-w-lg",children:(0,r.jsx)(tU,{...e,onSavingChange:o},t.id)})})}function tU({table:e,tables:t,connectionUrl:n,onOpenChange:l,onInsert:o,onSavingChange:s}){let d=(0,a.useMemo)(()=>e.columns.filter(tl),[e.columns]),[u,c]=(0,a.useState)(()=>Object.fromEntries(d.map(e=>[e.name,ti(e)]))),[f,x]=(0,a.useState)({}),[p,h]=(0,a.useState)(null),[g,v]=(0,a.useState)(!1),[j,N]=(0,a.useState)(()=>d.find(e=>to(e))?.name??null),k=e.columns.length-d.length;function C(e,t){c(n=>({...n,[e]:{...n[e]??{mode:"value",draft:""},...t}})),h(null),x(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n})}async function S(e){if(e.preventDefault(),g)return;let{values:t,errors:n}=tu(d,u);x(n);let r=d.find(e=>n[e.name]);if(r){h("Some values could not be used. Check the highlighted fields."),document.getElementById(td(t_,r.name))?.focus();return}h(null),v(!0),s(!0);try{await o(t)}catch(e){h(e instanceof Error?e.message:"Could not insert this row")}finally{v(!1),s(!1)}}return(0,r.jsxs)("form",{onSubmit:S,className:"flex min-h-0 flex-1 flex-col",children:[(0,r.jsxs)(H.c7,{className:"shrink-0 gap-1.5 p-4 pr-10",children:[(0,r.jsx)(H.L3,{children:"Insert row"}),(0,r.jsxs)(H.rr,{className:"text-xs",children:[(0,r.jsx)("span",{className:"font-mono",children:(0,b.i)(e)}),k>0&&(0,r.jsxs)(r.Fragment,{children:[" \xb7 ",k," generated ",1===k?"column":"columns"," omitted"]})]})]}),(0,r.jsx)("div",{className:"min-h-0 flex-1 divide-y divide-border/60 overflow-y-auto border-t px-4",children:0===d.length?(0,r.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"Every column is filled in by the database. Insert to add a row of defaults."}):d.map(a=>{let l=w(e,a.name);return(0,r.jsx)(tc,{column:a,field:u[a.name]??ti(a),idPrefix:t_,error:f[a.name],autoFocus:j===a.name,disabled:g,foreignKey:l,referencedTable:l?y(t,l.referencedTable):void 0,connectionUrl:n,onDraftChange:e=>C(a.name,{mode:"value",draft:e}),onModeChange:e=>(function(e,t){let n=d.find(t=>t.name===e);if("value"===t&&n){C(e,u[e]?.draft?{mode:t}:ts(n)),N(e);return}C(e,{mode:t})})(a.name,e)},a.name)})}),p&&(0,r.jsx)("p",{role:"alert",className:"shrink-0 border-t bg-destructive/5 px-4 py-2.5 font-mono text-xs text-destructive",children:p}),(0,r.jsxs)(H.Es,{className:"mx-0 mb-0 shrink-0",children:[(0,r.jsx)(m.$,{type:"button",variant:"outline",disabled:g,onClick:()=>l(!1),children:"Cancel"}),(0,r.jsxs)(m.$,{type:"submit",disabled:g,children:[g&&(0,r.jsx)(i.gnh,{className:"animate-spin","data-icon":"inline-start"}),g?"Inserting…":"Insert row"]})]})]})}function tF({table:e}){let t=(0,s.useRouter)(),{connection:n,tables:l}=(0,d.k)(),[v,j]=(0,z.jn)(n.id,e),[y,w]=(0,a.useState)(null),[k,C]=(0,a.useState)("data"),[S,$]=(0,a.useState)(!1),[E,T]=(0,a.useState)(null),O=(0,a.useRef)(null),D=l.data?.find(t=>t.schema===e.schema&&t.name===e.name),M=(0,a.useMemo)(()=>new Map(D?.columns.map(e=>[e.name,e])??[]),[D]),R=(0,a.useMemo)(()=>{var e,t;let n;return e=v.pinnedColumns,n=new Set((t=D?.columns??[]).map(e=>e.name)),e?e.filter(e=>n.has(e)):t.filter(e=>e.isPrimaryKey).map(e=>e.name)},[v.pinnedColumns,D]),L=p(v.filters.filter(g.eK),300),_=p(v.search.trim(),300),P=(0,b.i)(e),[U,F]=(0,a.useState)(null),A=L.length>0||_.length>0||U===P?v.sort:null,B=(0,a.useMemo)(()=>({table:e,filters:L,search:_,sort:A,page:v.page,pageSize:v.pageSize}),[e,L,_,A,v.page,v.pageSize]),q=(0,x.Y)(`${n.url}:${JSON.stringify(B)}`,e=>h.F.rows(n.url,B,e)),V=(0,a.useMemo)(()=>D&&q.data?function(e,t,n){let r=new Map;for(let a of e.foreignKeys??[]){let e=a.columns.map(e=>t.indexOf(e));if(e.some(e=>e<0))continue;let l=`${(0,b.i)(a.referencedTable)}:${a.referencedColumns.join("\0")}`,o=r.get(l)??{table:a.referencedTable,keyColumns:a.referencedColumns,keys:[]},s=new Set(o.keys.map(e=>JSON.stringify(e)));for(let t of n){let n=e.map(e=>t[e]??null);if(n.some(e=>null===e))continue;let r=JSON.stringify(n);if(!s.has(r)&&(s.add(r),o.keys.push(n),o.keys.length>=500))break}o.keys.length>0&&r.set(l,o)}return[...r.values()]}(D,q.data.columns,q.data.rows):[],[D,q.data]),W=(0,x.Y)(0===V.length?`${n.url}:related:none`:`${n.url}:related:${JSON.stringify(V)}`,e=>0===V.length?Promise.resolve([]):h.F.related(n.url,V,e)),J=(0,a.useMemo)(()=>(function(e){let t=new Map;for(let n of e)for(let e of n.rows)t.set(N(n.table,e.key),{columns:n.columns,row:e.row});return t})(W.data??[]),[W.data]),H=(0,x.Y)("definition"===k?`${n.url}:def:${(0,b.i)(e)}`:`${n.url}:def:idle`,t=>"definition"===k?h.F.definition(n.url,e,t):Promise.resolve({sql:""})),G=D?"table"!==D.kind?"Views and foreign tables are read-only":null:"Table metadata is unavailable";async function X(t){var r;let a,l=await h.F.insertRow(n.url,{table:e,values:t});return $(!1),T(D?(r=l.row,(a=D.columns.flatMap((e,t)=>e.isPrimaryKey?[`${e.name} ${String(r[t]??"null")}`]:[])).length>0?`Inserted ${a.join(", ")}`:"Row inserted"):"Row inserted"),null!==O.current&&window.clearTimeout(O.current),O.current=window.setTimeout(()=>T(null),4e3),q.reload(),l}function Y(e){let t=function(e=[],t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}(R,e),n=t.includes(e);j({pinnedColumns:t,hiddenColumns:n?v.hiddenColumns.filter(t=>t!==e):v.hiddenColumns})}function Q(e){j({hiddenColumns:function(e=[],t,n){return e.includes(t)?e.filter(e=>e!==t):e.length>=n-1?e:[...e,t]}(v.hiddenColumns,e,D?.columns.length??0)})}return l.data&&!D?(0,r.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-1.5 text-muted-foreground",children:[(0,r.jsxs)("p",{className:"text-sm",children:[(0,r.jsxs)("span",{className:"font-medium text-foreground",children:[e.schema,".",e.name]})," ","is not on ",n.name]}),(0,r.jsx)(o(),{href:`/${encodeURIComponent(n.id)}`,className:"text-xs underline underline-offset-4 hover:text-foreground",children:"Browse its tables"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(u.X,{children:[(0,r.jsx)("span",{className:"truncate text-muted-foreground",children:e.schema}),(0,r.jsx)("span",{className:"text-muted-foreground/50",children:"/"}),(0,r.jsx)("span",{className:"truncate font-medium",children:e.name}),(0,r.jsx)("div",{className:"ml-auto flex min-w-0 items-center gap-2",children:"data"===k?(0,r.jsxs)(r.Fragment,{children:[E?(0,r.jsx)("span",{role:"status",title:E,className:"min-w-0 truncate font-mono text-xs text-muted-foreground animate-in fade-in-0",children:E}):null,(0,r.jsxs)(m.$,{variant:"outline",size:"sm",disabled:!!G,title:G??"Insert a new row",onClick:()=>$(!0),children:[(0,r.jsx)(i.enO,{"data-icon":"inline-start"}),"New row"]}),(0,r.jsx)(K,{columns:D?.columns??[],pinnedColumns:R,hiddenColumns:v.hiddenColumns,onTogglePin:Y,onToggleHidden:Q,onReset:()=>j({pinnedColumns:void 0,hiddenColumns:[]})})]}):null})]}),"data"===k?(0,r.jsx)(tI,{filters:v.filters,search:v.search,columns:D?.columns??[],table:D,tables:l.data??[],connectionUrl:n.url,onFiltersChange:e=>{F(null),j({filters:e,page:0})},onSearchChange:e=>{F(null),j({search:e,page:0})},onRefresh:()=>{q.reload(),l.reload()},refreshing:q.loading}):null,(0,r.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:["definition"===k?(0,r.jsx)(c.iX,{sql:H.loading?void 0:H.data?.sql||void 0,error:H.error,loading:H.loading}):q.error?(0,r.jsx)("p",{className:"flex-1 px-4 py-6 font-mono text-xs text-destructive",children:q.error}):q.data?(0,r.jsx)(t$,{columns:q.data.columns,columnInfo:M,rows:q.data.rows,table:e,tableKind:D?.kind??"view",fileName:`${e.schema}-${e.name}-rows`,dimmed:q.loading,sort:A,columnWidths:v.columnWidths,jumpColumn:y,search:_,pinnedColumns:R,hiddenColumns:v.hiddenColumns,fk:{table:D,tables:l.data??[],relatedRows:J,connectionUrl:n.url,onOpenTable:function(e,r){var a;z.lz.getState().setTable(n.id,e,{filters:r,page:0}),t.push((a=n.id,`/${a}/${encodeURIComponent(e.schema)}/${encodeURIComponent(e.name)}`))}},onSortChange:e=>{F(P),j({sort:e})},onColumnWidthsChange:e=>j({columnWidths:e}),onTogglePin:Y,onToggleHidden:Q,onInsertRow:G?void 0:()=>$(!0),onUpdateCell:e=>h.F.updateCell(n.url,e),onUpdateRow:G?void 0:t=>h.F.updateRow(n.url,{table:e,...t}),onDeleteRows:async t=>{let r=await h.F.deleteRows(n.url,{table:e,primaryKeys:t}),a=q.data?.estimated||q.data?.total==null?null:Math.max(0,q.data.total-r.deleted);if(null==a)return q.reload(),r;let l=Math.max(0,Math.ceil(a/v.pageSize)-1);return v.page>l?j({page:l}):q.reload(),r}},JSON.stringify({table:e,filters:L,search:_,page:v.page,pageSize:v.pageSize})):(0,r.jsx)("div",{className:"flex flex-col gap-2 p-4",children:Array.from({length:12},(e,t)=>(0,r.jsx)(f.E,{className:"h-6 w-full"},t))}),"data"===k?(0,r.jsx)(I,{columns:D?.columns??[],resetKey:(0,b.i)(e),onActiveColumn:e=>{w(e),e&&v.hiddenColumns.includes(e)&&j({hiddenColumns:v.hiddenColumns.filter(t=>t!==e)})}}):null]}),D&&"table"===D.kind?(0,r.jsx)(tP,{open:S,table:D,tables:l.data??[],connectionUrl:n.url,onOpenChange:$,onInsert:X}):null,(0,r.jsx)(tL,{pane:k,onPaneChange:C,page:v.page,pageSize:v.pageSize,rowCount:q.data?.rows.length??0,total:q.data?.total??null,estimated:q.data?.estimated??!1,hasMore:q.data?.hasMore??!1,capped:q.data?.capped,onPageChange:e=>j({page:e}),onPageSizeChange:e=>j({pageSize:e,page:0})})]})}},85488:(e,t,n)=>{"use strict";n.d(t,{G3:()=>S,h5:()=>T,$U:()=>D,oK:()=>E,x4:()=>I,ex:()=>O});var r=n(95155);n(12115);var a=n(92953),l=n(66289),o=n(58565),s=n(91075),i=n(2385),d=n(19001),u=n(93313),c=n(29432),m=n(56758),f=n(47028),x=n(63205),p=n(40980),h=n(89239),g=n(18460),b=n(60529);function v({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,p.cn)("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",e),...t})}n(18349);let j=(0,g.F)("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function y({className:e,align:t="inline-start",...n}){return(0,r.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:(0,p.cn)(j({align:t}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}let w=(0,g.F)("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function N({className:e,type:t="button",variant:n="ghost",size:a="xs",...l}){return(0,r.jsx)(h.$,{type:t,"data-size":a,variant:n,className:(0,p.cn)(w({size:a}),e),...l})}function k({className:e,...t}){return(0,r.jsx)(b.p,{"data-slot":"input-group-control",className:(0,p.cn)("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",e),...t})}var C=n(13267);let S=a.i;function $({className:e,children:t,...n}){return(0,r.jsxs)(l.M,{"data-slot":"combobox-trigger",className:(0,p.cn)("[&_svg:not([class*='size-'])]:size-4",e),...n,children:[t,(0,r.jsx)(C.RQe,{className:"pointer-events-none size-4 text-muted-foreground"})]})}function z({className:e,...t}){return(0,r.jsx)(o.V,{"data-slot":"combobox-clear",render:(0,r.jsx)(N,{variant:"ghost",size:"icon-xs"}),className:(0,p.cn)(e),...t,children:(0,r.jsx)(C.yBK,{className:"pointer-events-none"})})}function E({className:e,children:t,disabled:n=!1,showTrigger:a=!0,showClear:l=!1,inputRef:o,...i}){return(0,r.jsxs)(v,{className:(0,p.cn)("w-auto",e),children:[(0,r.jsx)(s.o,{ref:o,render:(0,r.jsx)(k,{disabled:n}),...i}),(0,r.jsxs)(y,{align:"inline-end",children:[a&&(0,r.jsx)(N,{size:"icon-xs",variant:"ghost",render:(0,r.jsx)($,{}),"data-slot":"input-group-button",className:"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",disabled:n}),l&&(0,r.jsx)(z,{disabled:n})]}),t]})}function T({className:e,side:t="bottom",sideOffset:n=6,align:a="start",alignOffset:l=0,anchor:o,...s}){return(0,r.jsx)(i.K,{children:(0,r.jsx)(d.o,{side:t,sideOffset:n,align:a,alignOffset:l,anchor:o,className:"isolate z-80",children:(0,r.jsx)(u.I,{"data-slot":"combobox-content","data-chips":!!o,className:(0,p.cn)("group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...s})})})}function O({className:e,...t}){return(0,r.jsx)(c.e,{"data-slot":"combobox-list",className:(0,p.cn)("no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0",e),...t})}function I({className:e,children:t,...n}){return(0,r.jsxs)(m.x,{"data-slot":"combobox-item",className:(0,p.cn)("relative flex h-8 w-full cursor-pointer items-center gap-2 rounded-lg pr-8 pl-2 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n,children:[t,(0,r.jsx)(f.Q,{render:(0,r.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:(0,r.jsx)(C.wiW,{className:"pointer-events-none"})})]})}function D({className:e,...t}){return(0,r.jsx)(x.$,{"data-slot":"combobox-empty",className:(0,p.cn)("hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex",e),...t})}},96532:(e,t,n)=>{"use strict";n.d(t,{H4:()=>a,d6:()=>r});let r=1e4,a=5e5}},e=>{e.O(0,[4506,6079,1731,8026,2435,8361,9159,3960,801,544,6090,1413,8441,3794,7358],()=>e(e.s=16317)),_N_E=e.O()}]);
|