From 28d3072f45a26c3d5902c1973b2e540266cf00d9 Mon Sep 17 00:00:00 2001 From: teh_coderer Date: Mon, 1 May 2023 11:01:33 -0400 Subject: [PATCH] fix tables --- frontend-components/plotly/src/App.tsx | 1 + frontend-components/tables/src/utils/utils.ts | 5 ++++- openbb_terminal/core/plots/table.html | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend-components/plotly/src/App.tsx b/frontend-components/plotly/src/App.tsx index 11070f77deb..37f3d7827e9 100644 --- a/frontend-components/plotly/src/App.tsx +++ b/frontend-components/plotly/src/App.tsx @@ -5,6 +5,7 @@ import Chart from "./components/Chart"; import { plotlyMockup, candlestickMockup } from "./data/mockup"; declare global { + [Exposed=Window, SecureContext] interface Window { plotly_figure: any; export_image: string; diff --git a/frontend-components/tables/src/utils/utils.ts b/frontend-components/tables/src/utils/utils.ts index d05c86c62f9..e042cb9de82 100644 --- a/frontend-components/tables/src/utils/utils.ts +++ b/frontend-components/tables/src/utils/utils.ts @@ -57,7 +57,7 @@ const exportNativeFileSystem = async ({ blob: Blob; }) => { if (!fileHandle) { - throw new Error("Cannot access filesystem"); + return; } await writeFileHandler({ fileHandle, blob }); @@ -127,6 +127,9 @@ export const saveToFile = ( fileHandle?: FileSystemFileHandle ) => { try { + if (fileHandle === null) { + throw new Error("Cannot access filesystem"); + } exportNativeFileSystem({ fileHandle, blob }); } catch (error) { console.error("oops, something went wrong!", error); diff --git a/openbb_terminal/core/plots/table.html b/openbb_terminal/core/plots/table.html index ded258af924..5a520e43ca3 100644 --- a/openbb_terminal/core/plots/table.html +++ b/openbb_terminal/core/plots/table.html @@ -289,7 +289,7 @@ Add a component higher in the tree to provide a loading `),l.push(` `),s.bookType=="fods"?l.push(""):l.push(""),l.join("")}}();function Fw(e,t){if(t.bookType=="fods")return Xg(e,t);var r=Td(),n="",i=[],o=[];return n="mimetype",Pe(r,n,"application/vnd.oasis.opendocument.spreadsheet"),n="content.xml",Pe(r,n,Xg(e,t)),i.push([n,"text/xml"]),o.push([n,"ContentFile"]),n="styles.xml",Pe(r,n,vD(e,t)),i.push([n,"text/xml"]),o.push([n,"StylesFile"]),n="meta.xml",Pe(r,n,it+Wx()),i.push([n,"text/xml"]),o.push([n,"MetadataFile"]),n="manifest.rdf",Pe(r,n,F3(o)),i.push([n,"application/rdf+xml"]),n="META-INF/manifest.xml",Pe(r,n,R3(i)),r}/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */function Wl(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function xD(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e):wr(Gr(e))}function wD(e,t){e:for(var r=0;r<=e.length-t.length;++r){for(var n=0;n>7,e[t+14]|=(n&127)<<1;for(var o=0;i>=1;++o,i/=256)e[t+o]=i&255;e[t+15]|=r>=0?0:128}function Ba(e,t){var r=t?t[0]:0,n=e[r]&127;e:if(e[r++]>=128&&(n|=(e[r]&127)<<7,e[r++]<128||(n|=(e[r]&127)<<14,e[r++]<128)||(n|=(e[r]&127)<<21,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,28),++r,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,35),++r,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,42),++r,e[r++]<128)))break e;return t&&(t[0]=r),n}function Ne(e){var t=new Uint8Array(7);t[0]=e&127;var r=1;e:if(e>127){if(t[r-1]|=128,t[r]=e>>7&127,++r,e<=16383||(t[r-1]|=128,t[r]=e>>14&127,++r,e<=2097151)||(t[r-1]|=128,t[r]=e>>21&127,++r,e<=268435455)||(t[r-1]|=128,t[r]=e/256>>>21&127,++r,e<=34359738367)||(t[r-1]|=128,t[r]=e/65536>>>21&127,++r,e<=4398046511103))break e;t[r-1]|=128,t[r]=e/16777216>>>21&127,++r}return t.slice(0,r)}function no(e){var t=0,r=e[t]&127;e:if(e[t++]>=128){if(r|=(e[t]&127)<<7,e[t++]<128||(r|=(e[t]&127)<<14,e[t++]<128)||(r|=(e[t]&127)<<21,e[t++]<128))break e;r|=(e[t]&127)<<28}return r}function ot(e){for(var t=[],r=[0];r[0]=128;);s=e.slice(l,r[0])}break;case 5:a=4,s=e.slice(r[0],r[0]+a),r[0]+=a;break;case 1:a=8,s=e.slice(r[0],r[0]+a),r[0]+=a;break;case 2:a=Ba(e,r),s=e.slice(r[0],r[0]+a),r[0]+=a;break;case 3:case 4:default:throw new Error("PB Type ".concat(o," for Field ").concat(i," at offset ").concat(n))}var u={data:s,type:o};t[i]==null?t[i]=[u]:t[i].push(u)}return t}function dt(e){var t=[];return e.forEach(function(r,n){r.forEach(function(i){i.data&&(t.push(Ne(n*8+i.type)),i.type==2&&t.push(Ne(i.data.length)),t.push(i.data))})}),Mn(t)}function gr(e){for(var t,r=[],n=[0];n[0]>>0>0),r.push(a)}return r}function Di(e){var t=[];return e.forEach(function(r){var n=[];n[1]=[{data:Ne(r.id),type:0}],n[2]=[],r.merge!=null&&(n[3]=[{data:Ne(+!!r.merge),type:0}]);var i=[];r.messages.forEach(function(a){i.push(a.data),a.meta[3]=[{type:0,data:Ne(a.data.length)}],n[2].push({data:dt(a.meta),type:2})});var o=dt(n);t.push(Ne(o.length)),t.push(o),i.forEach(function(a){return t.push(a)})}),Mn(t)}function ED(e,t){if(e!=0)throw new Error("Unexpected Snappy chunk type ".concat(e));for(var r=[0],n=Ba(t,r),i=[];r[0]>2;if(a<60)++a;else{var s=a-59;a=t[r[0]],s>1&&(a|=t[r[0]+1]<<8),s>2&&(a|=t[r[0]+2]<<16),s>3&&(a|=t[r[0]+3]<<24),a>>>=0,a++,r[0]+=s}i.push(t.slice(r[0],r[0]+a)),r[0]+=a;continue}else{var l=0,u=0;if(o==1?(u=(t[r[0]]>>2&7)+4,l=(t[r[0]++]&224)<<3,l|=t[r[0]++]):(u=(t[r[0]++]>>2)+1,o==2?(l=t[r[0]]|t[r[0]+1]<<8,r[0]+=2):(l=(t[r[0]]|t[r[0]+1]<<8|t[r[0]+2]<<16|t[r[0]+3]<<24)>>>0,r[0]+=4)),i=[Mn(i)],l==0)throw new Error("Invalid offset 0");if(l>i[0].length)throw new Error("Invalid offset beyond length");if(u>=l)for(i.push(i[0].slice(-l)),u-=l;u>=i[i.length-1].length;)i.push(i[i.length-1]),u-=i[i.length-1].length;i.push(i[0].slice(-l,-l+u))}}var c=Mn(i);if(c.length!=n)throw new Error("Unexpected length: ".concat(c.length," != ").concat(n));return c}function mr(e){for(var t=[],r=0;r>8&255]))):n<=16777216?(a+=4,t.push(new Uint8Array([248,n-1&255,n-1>>8&255,n-1>>16&255]))):n<=4294967296&&(a+=5,t.push(new Uint8Array([252,n-1&255,n-1>>8&255,n-1>>16&255,n-1>>>24&255]))),t.push(e.slice(r,r+n)),a+=n,i[0]=0,i[1]=a&255,i[2]=a>>8&255,i[3]=a>>16&255,r+=n}return Mn(t)}function Fc(e,t){var r=new Uint8Array(32),n=Wl(r),i=12,o=0;switch(r[0]=5,e.t){case"n":r[1]=2,yD(r,i,e.v),o|=1,i+=16;break;case"b":r[1]=6,n.setFloat64(i,e.v?1:0,!0),o|=2,i+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));r[1]=3,n.setUint32(i,t.indexOf(e.v),!0),o|=8,i+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(8,o,!0),r.slice(0,i)}function Dc(e,t){var r=new Uint8Array(32),n=Wl(r),i=12,o=0;switch(r[0]=3,e.t){case"n":r[2]=2,n.setFloat64(i,e.v,!0),o|=32,i+=8;break;case"b":r[2]=6,n.setFloat64(i,e.v?1:0,!0),o|=32,i+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));r[2]=3,n.setUint32(i,t.indexOf(e.v),!0),o|=16,i+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(4,o,!0),r.slice(0,i)}function ln(e){var t=ot(e);return Ba(t[1][0].data)}function _D(e,t,r){var n,i,o,a;if(!((n=e[6])!=null&&n[0])||!((i=e[7])!=null&&i[0]))throw"Mutation only works on post-BNC storages!";var s=((a=(o=e[8])==null?void 0:o[0])==null?void 0:a.data)&&no(e[8][0].data)>0||!1;if(s)throw"Math only works with normal offsets";for(var l=0,u=Wl(e[7][0].data),c=0,f=[],d=Wl(e[4][0].data),h=0,m=[],p=0;p1&&console.error("The Numbers writer currently writes only the first table");var n=Zt(r["!ref"]);n.s.r=n.s.c=0;var i=!1;n.e.c>9&&(i=!0,n.e.c=9),n.e.r>49&&(i=!0,n.e.r=49),i&&console.error("The Numbers writer is currently limited to ".concat(nt(n)));var o=zl(r,{range:n,header:1}),a=["~Sh33tJ5~"];o.forEach(function(M){return M.forEach(function(b){typeof b=="string"&&a.push(b)})});var s={},l=[],u=Ue.read(t.numbers,{type:"base64"});u.FileIndex.map(function(M,b){return[M,u.FullPaths[b]]}).forEach(function(M){var b=M[0],T=M[1];if(b.type==2&&b.name.match(/\.iwa/)){var B=b.content,H=mr(B),q=gr(H);q.forEach(function(ee){l.push(ee.id),s[ee.id]={deps:[],location:T,type:no(ee.messages[0].meta[1][0].data)}})}}),l.sort(function(M,b){return M-b});var c=l.filter(function(M){return M>1}).map(function(M){return[M,Ne(M)]});u.FileIndex.map(function(M,b){return[M,u.FullPaths[b]]}).forEach(function(M){var b=M[0];if(M[1],!!b.name.match(/\.iwa/)){var T=gr(mr(b.content));T.forEach(function(B){B.messages.forEach(function(H){c.forEach(function(q){B.messages.some(function(ee){return no(ee.meta[1][0].data)!=11006&&wD(ee.data,q[1])})&&s[q[0]].deps.push(B.id)})})})}});for(var f=Ue.find(u,s[1].location),d=gr(mr(f.content)),h,m=0;m-1,i=Ux();Ud(t=t||{});var o=Td(),a="",s=0;if(t.cellXfs=[],Un(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),a="docProps/core.xml",Pe(o,a,zx(e.Props,t)),i.coreprops.push(a),Me(t.rels,2,a,ke.CORE_PROPS),a="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var l=[],u=0;u0&&(a="docProps/custom.xml",Pe(o,a,Xx(e.Custprops)),i.custprops.push(a),Me(t.rels,4,a,ke.CUST_PROPS)),s=1;s<=e.SheetNames.length;++s){var c={"!id":{}},f=e.Sheets[e.SheetNames[s-1]],d=(f||{})["!type"]||"sheet";switch(d){case"chart":default:a="xl/worksheets/sheet"+s+"."+r,Pe(o,a,F6(s-1,a,t,e,c)),i.sheets.push(a),Me(t.wbrels,-1,"worksheets/sheet"+s+"."+r,ke.WS[0])}if(f){var h=f["!comments"],m=!1,p="";h&&h.length>0&&(p="xl/comments"+s+"."+r,Pe(o,p,I6(h,p)),i.comments.push(p),Me(c,-1,"../comments"+s+"."+r,ke.CMNT),m=!0),f["!legacy"]&&m&&Pe(o,"xl/drawings/vmlDrawing"+s+".vml",uw(s,f["!comments"])),delete f["!comments"],delete f["!legacy"]}c["!id"].rId1&&Pe(o,Vx(a),to(c))}return t.Strings!=null&&t.Strings.length>0&&(a="xl/sharedStrings."+r,Pe(o,a,P6(t.Strings,a,t)),i.strs.push(a),Me(t.wbrels,-1,"sharedStrings."+r,ke.SST)),a="xl/workbook."+r,Pe(o,a,O6(e,a)),i.workbooks.push(a),Me(t.rels,1,a,ke.WB),a="xl/theme/theme1.xml",Pe(o,a,sw(e.Themes,t)),i.themes.push(a),Me(t.wbrels,-1,"theme/theme1.xml",ke.THEME),a="xl/styles."+r,Pe(o,a,D6(e,a,t)),i.styles.push(a),Me(t.wbrels,-1,"styles."+r,ke.STY),e.vbaraw&&n&&(a="xl/vbaProject.bin",Pe(o,a,e.vbaraw),i.vba.push(a),Me(t.wbrels,-1,"vbaProject.bin",ke.VBA)),a="xl/metadata."+r,Pe(o,a,b6(a)),i.metadata.push(a),Me(t.wbrels,-1,"metadata."+r,ke.XLMETA),Pe(o,"[Content_Types].xml",Hx(i,t)),Pe(o,"_rels/.rels",to(t.rels)),Pe(o,"xl/_rels/workbook."+r+".rels",to(t.wbrels)),delete t.revssf,delete t.ssf,o}function RD(e,t){Wi=1024,e&&!e.SSF&&(e.SSF=Gt(et)),e&&e.SSF&&(wu(),xu(e.SSF),t.revssf=yu(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF),t.rels={},t.wbrels={},t.Strings=[],t.Strings.Count=0,t.Strings.Unique=0,va?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var r="xml",n=fw.indexOf(t.bookType)>-1,i=Ux();Ud(t=t||{});var o=Td(),a="",s=0;if(t.cellXfs=[],Un(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),a="docProps/core.xml",Pe(o,a,zx(e.Props,t)),i.coreprops.push(a),Me(t.rels,2,a,ke.CORE_PROPS),a="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var l=[],u=0;u0&&(a="docProps/custom.xml",Pe(o,a,Xx(e.Custprops)),i.custprops.push(a),Me(t.rels,4,a,ke.CUST_PROPS));var c=["SheetJ5"];for(t.tcid=0,s=1;s<=e.SheetNames.length;++s){var f={"!id":{}},d=e.Sheets[e.SheetNames[s-1]],h=(d||{})["!type"]||"sheet";switch(h){case"chart":default:a="xl/worksheets/sheet"+s+"."+r,Pe(o,a,yw(s-1,t,e,f)),i.sheets.push(a),Me(t.wbrels,-1,"worksheets/sheet"+s+"."+r,ke.WS[0])}if(d){var m=d["!comments"],p=!1,g="";if(m&&m.length>0){var x=!1;m.forEach(function(w){w[1].forEach(function(y){y.T==!0&&(x=!0)})}),x&&(g="xl/threadedComments/threadedComment"+s+"."+r,Pe(o,g,iR(m,c,t)),i.threadedcomments.push(g),Me(f,-1,"../threadedComments/threadedComment"+s+"."+r,ke.TCMNT)),g="xl/comments"+s+"."+r,Pe(o,g,cw(m)),i.comments.push(g),Me(f,-1,"../comments"+s+"."+r,ke.CMNT),p=!0}d["!legacy"]&&p&&Pe(o,"xl/drawings/vmlDrawing"+s+".vml",uw(s,d["!comments"])),delete d["!comments"],delete d["!legacy"]}f["!id"].rId1&&Pe(o,Vx(a),to(f))}return t.Strings!=null&&t.Strings.length>0&&(a="xl/sharedStrings."+r,Pe(o,a,tw(t.Strings,t)),i.strs.push(a),Me(t.wbrels,-1,"sharedStrings."+r,ke.SST)),a="xl/workbook."+r,Pe(o,a,Sw(e)),i.workbooks.push(a),Me(t.rels,1,a,ke.WB),a="xl/theme/theme1.xml",Pe(o,a,sw(e.Themes,t)),i.themes.push(a),Me(t.wbrels,-1,"theme/theme1.xml",ke.THEME),a="xl/styles."+r,Pe(o,a,ow(e,t)),i.styles.push(a),Me(t.wbrels,-1,"styles."+r,ke.STY),e.vbaraw&&n&&(a="xl/vbaProject.bin",Pe(o,a,e.vbaraw),i.vba.push(a),Me(t.wbrels,-1,"vbaProject.bin",ke.VBA)),a="xl/metadata."+r,Pe(o,a,lw()),i.metadata.push(a),Me(t.wbrels,-1,"metadata."+r,ke.XLMETA),c.length>1&&(a="xl/persons/person.xml",Pe(o,a,oR(c)),i.people.push(a),Me(t.wbrels,-1,"persons/person.xml",ke.PEOPLE)),Pe(o,"[Content_Types].xml",Hx(i,t)),Pe(o,"_rels/.rels",to(t.rels)),Pe(o,"xl/_rels/workbook."+r+".rels",to(t.wbrels)),delete t.revssf,delete t.ssf,o}function OD(e,t){var r="";switch((t||{}).type||"base64"){case"buffer":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];case"base64":r=tn(e.slice(0,12));break;case"binary":r=e;break;case"array":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];default:throw new Error("Unrecognized type "+(t&&t.type||"undefined"))}return[r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2),r.charCodeAt(3),r.charCodeAt(4),r.charCodeAt(5),r.charCodeAt(6),r.charCodeAt(7)]}function Dw(e,t){switch(t.type){case"base64":case"binary":break;case"buffer":case"array":t.type="";break;case"file":return Za(t.file,Ue.write(e,{type:$e?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");default:throw new Error("Unrecognized type "+t.type)}return Ue.write(e,t)}function FD(e,t){var r=Gt(t||{}),n=CD(e,r);return DD(n,r)}function DD(e,t){var r={},n=$e?"nodebuffer":typeof Uint8Array<"u"?"array":"string";if(t.compression&&(r.compression="DEFLATE"),t.password)r.type=n;else switch(t.type){case"base64":r.type="base64";break;case"binary":r.type="string";break;case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");case"buffer":case"file":r.type=n;break;default:throw new Error("Unrecognized type "+t.type)}var i=e.FullPaths?Ue.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[r.type]||r.type,compression:!!t.compression}):e.generate(r);if(typeof Deno<"u"&&typeof i=="string"){if(t.type=="binary"||t.type=="base64")return i;i=new Uint8Array(vu(i))}return t.password&&typeof encrypt_agile<"u"?Dw(encrypt_agile(i,t.password),t):t.type==="file"?Za(t.file,i):t.type=="string"?ha(i):i}function PD(e,t){var r=t||{},n=X6(e,r);return Dw(n,r)}function Cr(e,t,r){r||(r="");var n=r+e;switch(t.type){case"base64":return Na(Gr(n));case"binary":return Gr(n);case"string":return e;case"file":return Za(t.file,n,"utf8");case"buffer":return $e?sn(n,"utf8"):typeof TextEncoder<"u"?new TextEncoder().encode(n):Cr(n,{type:"binary"}).split("").map(function(i){return i.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function ID(e,t){switch(t.type){case"base64":return Na(e);case"binary":return e;case"string":return e;case"file":return Za(t.file,e,"binary");case"buffer":return $e?sn(e,"binary"):e.split("").map(function(r){return r.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function bs(e,t){switch(t.type){case"string":case"base64":case"binary":for(var r="",n=0;n0&&(i=0);var f=wt(l.s.r),d=[],h=[],m=0,p=0,g=Array.isArray(e),x=l.s.r,w=0,y={};g&&!e[x]&&(e[x]=[]);var _=u.skipHidden&&e["!cols"]||[],k=u.skipHidden&&e["!rows"]||[];for(w=l.s.c;w<=l.e.c;++w)if(!(_[w]||{}).hidden)switch(d[w]=Rt(w),r=g?e[x][w]:e[d[w]+f],n){case 1:o[w]=w-l.s.c;break;case 2:o[w]=d[w];break;case 3:o[w]=u.header[w-l.s.c];break;default:if(r==null&&(r={w:"__EMPTY",t:"s"}),s=a=rn(r,null,u),p=y[a]||0,!p)y[a]=1;else{do s=a+"_"+p++;while(y[s]);y[a]=p,y[s]=1}o[w]=s}for(x=l.s.r+i;x<=l.e.r;++x)if(!(k[x]||{}).hidden){var N=$D(e,l,x,d,n,o,g,u);(N.isempty===!1||(n===1?u.blankrows!==!1:u.blankrows))&&(h[m++]=N.row)}return h.length=m,h}var Kg=/"/g;function ND(e,t,r,n,i,o,a,s){for(var l=!0,u=[],c="",f=wt(r),d=t.s.c;d<=t.e.c;++d)if(n[d]){var h=s.dense?(e[r]||[])[d]:e[n[d]+f];if(h==null)c="";else if(h.v!=null){l=!1,c=""+(s.rawNumbers&&h.t=="n"?h.v:rn(h,null,s));for(var m=0,p=0;m!==c.length;++m)if((p=c.charCodeAt(m))===i||p===o||p===34||s.forceQuotes){c='"'+c.replace(Kg,'""')+'"';break}c=="ID"&&(c='"ID"')}else h.f!=null&&!h.F?(l=!1,c="="+h.f,c.indexOf(",")>=0&&(c='"'+c.replace(Kg,'""')+'"')):c="";u.push(c)}return s.blankrows===!1&&l?null:u.join(a)}function Hd(e,t){var r=[],n=t??{};if(e==null||e["!ref"]==null)return"";var i=Ge(e["!ref"]),o=n.FS!==void 0?n.FS:",",a=o.charCodeAt(0),s=n.RS!==void 0?n.RS:` `,l=s.charCodeAt(0),u=new RegExp((o=="|"?"\\|":o)+"+$"),c="",f=[];n.dense=Array.isArray(e);for(var d=n.skipHidden&&e["!cols"]||[],h=n.skipHidden&&e["!rows"]||[],m=i.s.c;m<=i.e.c;++m)(d[m]||{}).hidden||(f[m]=Rt(m));for(var p=0,g=i.s.r;g<=i.e.r;++g)(h[g]||{}).hidden||(c=ND(e,i,g,f,a,l,o,n),c!=null&&(n.strip&&(c=c.replace(u,"")),(c||n.blankrows!==!1)&&r.push((p++?s:"")+c)));return delete n.dense,r.join("")}function Iw(e,t){t||(t={}),t.FS=" ",t.RS=` -`;var r=Hd(e,t);return r}function MD(e){var t="",r,n="";if(e==null||e["!ref"]==null)return[];var i=Ge(e["!ref"]),o="",a=[],s,l=[],u=Array.isArray(e);for(s=i.s.c;s<=i.e.c;++s)a[s]=Rt(s);for(var c=i.s.r;c<=i.e.r;++c)for(o=wt(c),s=i.s.c;s<=i.e.c;++s)if(t=a[s]+o,r=u?(e[c]||[])[s]:e[t],n="",r!==void 0){if(r.F!=null){if(t=r.F,!r.f)continue;n=r.f,t.indexOf(":")==-1&&(t=t+":"+t)}if(r.f!=null)n=r.f;else{if(r.t=="z")continue;if(r.t=="n"&&r.v!=null)n=""+r.v;else if(r.t=="b")n=r.v?"TRUE":"FALSE";else if(r.w!==void 0)n="'"+r.w;else{if(r.v===void 0)continue;r.t=="s"?n="'"+r.v:n=""+r.v}}l[l.length]=t+"="+n}return l}function bw(e,t,r){var n=r||{},i=+!n.skipHeader,o=e||{},a=0,s=0;if(o&&n.origin!=null)if(typeof n.origin=="number")a=n.origin;else{var l=typeof n.origin=="string"?ut(n.origin):n.origin;a=l.r,s=l.c}var u,c={s:{c:0,r:0},e:{c:s,r:a+t.length-1+i}};if(o["!ref"]){var f=Ge(o["!ref"]);c.e.c=Math.max(c.e.c,f.e.c),c.e.r=Math.max(c.e.r,f.e.r),a==-1&&(a=f.e.r+1,c.e.r=a+t.length-1+i)}else a==-1&&(a=0,c.e.r=t.length-1+i);var d=n.header||[],h=0;t.forEach(function(p,g){Et(p).forEach(function(x){(h=d.indexOf(x))==-1&&(d[h=d.length]=x);var w=p[x],y="z",_="",k=Be({c:s+h,r:a+g+i});u=Ua(o,k),w&&typeof w=="object"&&!(w instanceof Date)?o[k]=w:(typeof w=="number"?y="n":typeof w=="boolean"?y="b":typeof w=="string"?y="s":w instanceof Date?(y="d",n.cellDates||(y="n",w=zt(w)),_=n.dateNF||et[14]):w===null&&n.nullError&&(y="e",w=0),u?(u.t=y,u.v=w,delete u.w,delete u.R,_&&(u.z=_)):o[k]=u={t:y,v:w},_&&(u.z=_))})}),c.e.c=Math.max(c.e.c,s+d.length-1);var m=wt(a);if(i)for(h=0;h=0&&e.SheetNames.length>t)return t;throw new Error("Cannot find sheet # "+t)}else if(typeof t=="string"){var r=e.SheetNames.indexOf(t);if(r>-1)return r;throw new Error("Cannot find sheet name |"+t+"|")}else throw new Error("Cannot find sheet |"+t+"|")}function UD(){return{SheetNames:[],Sheets:{}}}function HD(e,t,r,n){var i=1;if(!r)for(;i<=65535&&e.SheetNames.indexOf(r="Sheet"+i)!=-1;++i,r=void 0);if(!r||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(n&&e.SheetNames.indexOf(r)>=0){var o=r.match(/(^.*?)(\d+)$/);i=o&&+o[2]||0;var a=o&&o[1]||r;for(++i;i<=65535&&e.SheetNames.indexOf(r=a+i)!=-1;++i);}if(_w(r),e.SheetNames.indexOf(r)>=0)throw new Error("Worksheet with name |"+r+"| already exists!");return e.SheetNames.push(r),e.Sheets[r]=t,r}function VD(e,t,r){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var n=BD(e,t);switch(e.Workbook.Sheets[n]||(e.Workbook.Sheets[n]={}),r){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+r)}e.Workbook.Sheets[n].Hidden=r}function WD(e,t){return e.z=t,e}function kw(e,t,r){return t?(e.l={Target:t},r&&(e.l.Tooltip=r)):delete e.l,e}function zD(e,t,r){return kw(e,"#"+t,r)}function GD(e,t,r){e.c||(e.c=[]),e.c.push({t,a:r||"SheetJS"})}function jD(e,t,r,n){for(var i=typeof t!="string"?t:Ge(t),o=typeof t=="string"?t:nt(t),a=i.s.r;a<=i.e.r;++a)for(var s=i.s.c;s<=i.e.c;++s){var l=Ua(e,a,s);l.t="n",l.F=o,delete l.v,a==i.s.r&&s==i.s.c&&(l.f=r,n&&(l.D=!0))}return e}var Pc={encode_col:Rt,encode_row:wt,encode_cell:Be,encode_range:nt,decode_col:Dd,decode_row:Fd,split_cell:a3,decode_cell:ut,decode_range:Zt,format_cell:rn,sheet_add_aoa:kx,sheet_add_json:bw,sheet_add_dom:Rw,aoa_to_sheet:So,json_to_sheet:LD,table_to_sheet:Ow,table_to_book:gD,sheet_to_csv:Hd,sheet_to_txt:Iw,sheet_to_json:zl,sheet_to_html:Aw,sheet_to_formulae:MD,sheet_to_row_object_array:zl,sheet_get_cell:Ua,book_new:UD,book_append_sheet:HD,book_set_sheet_visibility:VD,cell_set_number_format:WD,cell_set_hyperlink:kw,cell_set_internal_link:zD,cell_add_comment:GD,sheet_set_array_formula:jD,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}};function XD(e){if(e%1!==0){const t=Math.max(2,e.toString().split(".")[1].length),r=Math.min(4,t);if(e<1e3)return e.toFixed(r)||0}if(e>1e3){const t=Math.min(4,Math.floor(Math.log10(Math.abs(e))/3)),r=["","K","M","B","T"][t];return`${(e/10**(t*3)).toFixed(2)} ${r}`}return e}function Vd(e){return["date","day","time","timestamp","year"].some(t=>e.toLowerCase().includes(t))}function KD(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(var r=0;r{const i=YC(e.getValue(t),r);return n(i),i},qD=async({fileHandle:e,blob:t})=>{if(!e)throw new Error("Cannot access filesystem");await QD({fileHandle:e,blob:t})},QD=async({fileHandle:e,blob:t})=>{const r=await e.createWritable();await r.write(t),await r.close()},ZD=[{description:"PNG Image",accept:{"image/png":[".png"]}},{description:"JPEG Image",accept:{"image/jpeg":[".jpeg"]}}],$w=({filename:e,is_image:t})=>{if("showSaveFilePicker"in window){const r={suggestedName:e,types:t?ZD:[{description:"CSV File",accept:{"image/csv":[".csv"]}}],excludeAcceptAllOption:!0};return showSaveFilePicker(r)}return new Promise(r=>{r(null)})},Nw=(e,t,r)=>{try{qD({fileHandle:r,blob:e})}catch(n){console.error("oops, something went wrong!",n);const i=URL.createObjectURL(e),o=document.createElement("a");o.setAttribute("href",i),o.setAttribute("download",t),o.style.visibility="hidden",document.body.appendChild(o),o.click(),document.body.removeChild(o)}},Yg=(e,t,r)=>{const n=t,i=r.map(l=>n.map(u=>l[u])),o=[n,...i];if(e==="csv"){const l=o.map(f=>f.join(",")).join(` +`;var r=Hd(e,t);return r}function MD(e){var t="",r,n="";if(e==null||e["!ref"]==null)return[];var i=Ge(e["!ref"]),o="",a=[],s,l=[],u=Array.isArray(e);for(s=i.s.c;s<=i.e.c;++s)a[s]=Rt(s);for(var c=i.s.r;c<=i.e.r;++c)for(o=wt(c),s=i.s.c;s<=i.e.c;++s)if(t=a[s]+o,r=u?(e[c]||[])[s]:e[t],n="",r!==void 0){if(r.F!=null){if(t=r.F,!r.f)continue;n=r.f,t.indexOf(":")==-1&&(t=t+":"+t)}if(r.f!=null)n=r.f;else{if(r.t=="z")continue;if(r.t=="n"&&r.v!=null)n=""+r.v;else if(r.t=="b")n=r.v?"TRUE":"FALSE";else if(r.w!==void 0)n="'"+r.w;else{if(r.v===void 0)continue;r.t=="s"?n="'"+r.v:n=""+r.v}}l[l.length]=t+"="+n}return l}function bw(e,t,r){var n=r||{},i=+!n.skipHeader,o=e||{},a=0,s=0;if(o&&n.origin!=null)if(typeof n.origin=="number")a=n.origin;else{var l=typeof n.origin=="string"?ut(n.origin):n.origin;a=l.r,s=l.c}var u,c={s:{c:0,r:0},e:{c:s,r:a+t.length-1+i}};if(o["!ref"]){var f=Ge(o["!ref"]);c.e.c=Math.max(c.e.c,f.e.c),c.e.r=Math.max(c.e.r,f.e.r),a==-1&&(a=f.e.r+1,c.e.r=a+t.length-1+i)}else a==-1&&(a=0,c.e.r=t.length-1+i);var d=n.header||[],h=0;t.forEach(function(p,g){Et(p).forEach(function(x){(h=d.indexOf(x))==-1&&(d[h=d.length]=x);var w=p[x],y="z",_="",k=Be({c:s+h,r:a+g+i});u=Ua(o,k),w&&typeof w=="object"&&!(w instanceof Date)?o[k]=w:(typeof w=="number"?y="n":typeof w=="boolean"?y="b":typeof w=="string"?y="s":w instanceof Date?(y="d",n.cellDates||(y="n",w=zt(w)),_=n.dateNF||et[14]):w===null&&n.nullError&&(y="e",w=0),u?(u.t=y,u.v=w,delete u.w,delete u.R,_&&(u.z=_)):o[k]=u={t:y,v:w},_&&(u.z=_))})}),c.e.c=Math.max(c.e.c,s+d.length-1);var m=wt(a);if(i)for(h=0;h=0&&e.SheetNames.length>t)return t;throw new Error("Cannot find sheet # "+t)}else if(typeof t=="string"){var r=e.SheetNames.indexOf(t);if(r>-1)return r;throw new Error("Cannot find sheet name |"+t+"|")}else throw new Error("Cannot find sheet |"+t+"|")}function UD(){return{SheetNames:[],Sheets:{}}}function HD(e,t,r,n){var i=1;if(!r)for(;i<=65535&&e.SheetNames.indexOf(r="Sheet"+i)!=-1;++i,r=void 0);if(!r||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(n&&e.SheetNames.indexOf(r)>=0){var o=r.match(/(^.*?)(\d+)$/);i=o&&+o[2]||0;var a=o&&o[1]||r;for(++i;i<=65535&&e.SheetNames.indexOf(r=a+i)!=-1;++i);}if(_w(r),e.SheetNames.indexOf(r)>=0)throw new Error("Worksheet with name |"+r+"| already exists!");return e.SheetNames.push(r),e.Sheets[r]=t,r}function VD(e,t,r){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var n=BD(e,t);switch(e.Workbook.Sheets[n]||(e.Workbook.Sheets[n]={}),r){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+r)}e.Workbook.Sheets[n].Hidden=r}function WD(e,t){return e.z=t,e}function kw(e,t,r){return t?(e.l={Target:t},r&&(e.l.Tooltip=r)):delete e.l,e}function zD(e,t,r){return kw(e,"#"+t,r)}function GD(e,t,r){e.c||(e.c=[]),e.c.push({t,a:r||"SheetJS"})}function jD(e,t,r,n){for(var i=typeof t!="string"?t:Ge(t),o=typeof t=="string"?t:nt(t),a=i.s.r;a<=i.e.r;++a)for(var s=i.s.c;s<=i.e.c;++s){var l=Ua(e,a,s);l.t="n",l.F=o,delete l.v,a==i.s.r&&s==i.s.c&&(l.f=r,n&&(l.D=!0))}return e}var Pc={encode_col:Rt,encode_row:wt,encode_cell:Be,encode_range:nt,decode_col:Dd,decode_row:Fd,split_cell:a3,decode_cell:ut,decode_range:Zt,format_cell:rn,sheet_add_aoa:kx,sheet_add_json:bw,sheet_add_dom:Rw,aoa_to_sheet:So,json_to_sheet:LD,table_to_sheet:Ow,table_to_book:gD,sheet_to_csv:Hd,sheet_to_txt:Iw,sheet_to_json:zl,sheet_to_html:Aw,sheet_to_formulae:MD,sheet_to_row_object_array:zl,sheet_get_cell:Ua,book_new:UD,book_append_sheet:HD,book_set_sheet_visibility:VD,cell_set_number_format:WD,cell_set_hyperlink:kw,cell_set_internal_link:zD,cell_add_comment:GD,sheet_set_array_formula:jD,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}};function XD(e){if(e%1!==0){const t=Math.max(2,e.toString().split(".")[1].length),r=Math.min(4,t);if(e<1e3)return e.toFixed(r)||0}if(e>1e3){const t=Math.min(4,Math.floor(Math.log10(Math.abs(e))/3)),r=["","K","M","B","T"][t];return`${(e/10**(t*3)).toFixed(2)} ${r}`}return e}function Vd(e){return["date","day","time","timestamp","year"].some(t=>e.toLowerCase().includes(t))}function KD(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(var r=0;r{const i=YC(e.getValue(t),r);return n(i),i},qD=async({fileHandle:e,blob:t})=>{e&&await QD({fileHandle:e,blob:t})},QD=async({fileHandle:e,blob:t})=>{const r=await e.createWritable();await r.write(t),await r.close()},ZD=[{description:"PNG Image",accept:{"image/png":[".png"]}},{description:"JPEG Image",accept:{"image/jpeg":[".jpeg"]}}],$w=({filename:e,is_image:t})=>{if("showSaveFilePicker"in window){const r={suggestedName:e,types:t?ZD:[{description:"CSV File",accept:{"image/csv":[".csv"]}}],excludeAcceptAllOption:!0};return showSaveFilePicker(r)}return new Promise(r=>{r(null)})},Nw=(e,t,r)=>{try{if(r===null)throw new Error("Cannot access filesystem");qD({fileHandle:r,blob:e})}catch(n){console.error("oops, something went wrong!",n);const i=URL.createObjectURL(e),o=document.createElement("a");o.setAttribute("href",i),o.setAttribute("download",t),o.style.visibility="hidden",document.body.appendChild(o),o.click(),document.body.removeChild(o)}},Yg=(e,t,r)=>{const n=t,i=r.map(l=>n.map(u=>l[u])),o=[n,...i];if(e==="csv"){const l=o.map(f=>f.join(",")).join(` `),u=new Blob([l],{type:"text/csv;charset=utf-8;"}),c=`${window.title}.csv`;$w({filename:c}).then(f=>{Nw(u,c,f)});return}const a=Pc.book_new(),s=Pc.aoa_to_sheet(o);Pc.book_append_sheet(a,s,"Sheet1"),kD(a,`${window.title}.xlsx`)},JD=e=>{const t=document.getElementById(e),r=`${window.title}.png`;$w({filename:r,is_image:!0}).then(n=>{r4.toBlob(t).then(function(i){Nw(i,r,n)})})},Mw=v.createContext({dragDropManager:void 0});function tr(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var qg=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Ic=function(){return Math.random().toString(36).substring(7).split("").join(".")},Qg={INIT:"@@redux/INIT"+Ic(),REPLACE:"@@redux/REPLACE"+Ic(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ic()}};function eP(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Lw(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(tr(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(tr(1));return r(Lw)(e,t)}if(typeof e!="function")throw new Error(tr(2));var i=e,o=t,a=[],s=a,l=!1;function u(){s===a&&(s=a.slice())}function c(){if(l)throw new Error(tr(3));return o}function f(p){if(typeof p!="function")throw new Error(tr(4));if(l)throw new Error(tr(5));var g=!0;return u(),s.push(p),function(){if(g){if(l)throw new Error(tr(6));g=!1,u();var w=s.indexOf(p);s.splice(w,1),a=null}}}function d(p){if(!eP(p))throw new Error(tr(7));if(typeof p.type>"u")throw new Error(tr(8));if(l)throw new Error(tr(9));try{l=!0,o=i(o,p)}finally{l=!1}for(var g=a=s,x=0;xn&&n[i]?n[i]:r||null,e)}function nP(e,t){return e.filter(r=>r!==t)}function Bw(e){return typeof e=="object"}function iP(e,t){const r=new Map,n=o=>{r.set(o,r.has(o)?r.get(o)+1:1)};e.forEach(n),t.forEach(n);const i=[];return r.forEach((o,a)=>{o===1&&i.push(a)}),i}function oP(e,t){return e.filter(r=>t.indexOf(r)>-1)}const Wd="dnd-core/INIT_COORDS",Cu="dnd-core/BEGIN_DRAG",zd="dnd-core/PUBLISH_DRAG_SOURCE",Au="dnd-core/HOVER",Ru="dnd-core/DROP",Ou="dnd-core/END_DRAG";function Zg(e,t){return{type:Wd,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const aP={type:Wd,payload:{clientOffset:null,sourceClientOffset:null}};function sP(e){return function(r=[],n={publishSource:!0}){const{publishSource:i=!0,clientOffset:o,getSourceClientOffset:a}=n,s=e.getMonitor(),l=e.getRegistry();e.dispatch(Zg(o)),lP(r,s,l);const u=fP(r,s);if(u==null){e.dispatch(aP);return}let c=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");uP(a),c=a(u)}e.dispatch(Zg(o,c));const d=l.getSource(u).beginDrag(s,u);if(d==null)return;cP(d),l.pinSource(u);const h=l.getSourceType(u);return{type:Cu,payload:{itemType:h,item:d,sourceId:u,clientOffset:o||null,sourceClientOffset:c||null,isSourcePublic:!!i}}}}function lP(e,t,r){Fe(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){Fe(r.getSource(n),"Expected sourceIds to be registered.")})}function uP(e){Fe(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function cP(e){Fe(Bw(e),"Item must be an object.")}function fP(e,t){let r=null;for(let n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}function dP(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hP(e){for(var t=1;t{const l=mP(a,s,i,n),u={type:Ru,payload:{dropResult:hP({},r,l)}};e.dispatch(u)})}}function gP(e){Fe(e.isDragging(),"Cannot call drop while not dragging."),Fe(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function mP(e,t,r,n){const i=r.getTarget(e);let o=i?i.drop(n,e):void 0;return vP(o),typeof o>"u"&&(o=t===0?{}:n.getDropResult()),o}function vP(e){Fe(typeof e>"u"||Bw(e),"Drop result must either be an object or undefined.")}function xP(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function wP(e){return function(){const r=e.getMonitor(),n=e.getRegistry();yP(r);const i=r.getSourceId();return i!=null&&(n.getSource(i,!0).endDrag(r,i),n.unpinSource()),{type:Ou}}}function yP(e){Fe(e.isDragging(),"Cannot call endDrag while not dragging.")}function Xf(e,t){return t===null?e===null:Array.isArray(e)?e.some(r=>r===t):e===t}function EP(e){return function(r,{clientOffset:n}={}){_P(r);const i=r.slice(0),o=e.getMonitor(),a=e.getRegistry(),s=o.getItemType();return TP(i,a,s),SP(i,o,a),CP(i,o,a),{type:Au,payload:{targetIds:i,clientOffset:n||null}}}}function _P(e){Fe(Array.isArray(e),"Expected targetIds to be an array.")}function SP(e,t,r){Fe(t.isDragging(),"Cannot call hover while not dragging."),Fe(!t.didDrop(),"Cannot call hover after drop.");for(let n=0;n=0;n--){const i=e[n],o=t.getTargetType(i);Xf(o,r)||e.splice(n,1)}}function CP(e,t,r){e.forEach(function(n){r.getTarget(n).hover(t,n)})}function AP(e){return function(){if(e.getMonitor().isDragging())return{type:zd}}}function RP(e){return{beginDrag:sP(e),publishDragSource:AP(e),hover:EP(e),drop:pP(e),endDrag:wP(e)}}class OP{receiveBackend(t){this.backend=t}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const t=this,{dispatch:r}=this.store;function n(o){return(...a)=>{const s=o.apply(t,a);typeof s<"u"&&r(s)}}const i=RP(this);return Object.keys(i).reduce((o,a)=>{const s=i[a];return o[a]=n(s),o},{})}dispatch(t){this.store.dispatch(t)}constructor(t,r){this.isSetUp=!1,this.handleRefCountChange=()=>{const n=this.store.getState().refCount>0;this.backend&&(n&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!n&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}}function FP(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Uw(e,t){return{x:e.x-t.x,y:e.y-t.y}}function DP(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:n}=e;return!t||!r||!n?null:Uw(FP(t,n),r)}function PP(e){const{clientOffset:t,initialClientOffset:r}=e;return!t||!r?null:Uw(t,r)}const xa=[],Gd=[];xa.__IS_NONE__=!0;Gd.__IS_ALL__=!0;function IP(e,t){return e===xa?!1:e===Gd||typeof t>"u"?!0:oP(t,e).length>0}class bP{subscribeToStateChange(t,r={}){const{handlerIds:n}=r;Fe(typeof t=="function","listener must be a function."),Fe(typeof n>"u"||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let i=this.store.getState().stateId;const o=()=>{const a=this.store.getState(),s=a.stateId;try{s===i||s===i+1&&!IP(a.dirtyHandlerIds,n)||t()}finally{i=s}};return this.store.subscribe(o)}subscribeToOffsetChange(t){Fe(typeof t=="function","listener must be a function.");let r=this.store.getState().dragOffset;const n=()=>{const i=this.store.getState().dragOffset;i!==r&&(r=i,t())};return this.store.subscribe(n)}canDragSource(t){if(!t)return!1;const r=this.registry.getSource(t);return Fe(r,`Expected to find a valid source. sourceId=${t}`),this.isDragging()?!1:r.canDrag(this,t)}canDropOnTarget(t){if(!t)return!1;const r=this.registry.getTarget(t);if(Fe(r,`Expected to find a valid target. targetId=${t}`),!this.isDragging()||this.didDrop())return!1;const n=this.registry.getTargetType(t),i=this.getItemType();return Xf(n,i)&&r.canDrop(this,t)}isDragging(){return!!this.getItemType()}isDraggingSource(t){if(!t)return!1;const r=this.registry.getSource(t,!0);if(Fe(r,`Expected to find a valid source. sourceId=${t}`),!this.isDragging()||!this.isSourcePublic())return!1;const n=this.registry.getSourceType(t),i=this.getItemType();return n!==i?!1:r.isDragging(this,t)}isOverTarget(t,r={shallow:!1}){if(!t)return!1;const{shallow:n}=r;if(!this.isDragging())return!1;const i=this.registry.getTargetType(t),o=this.getItemType();if(o&&!Xf(i,o))return!1;const a=this.getTargetIds();if(!a.length)return!1;const s=a.indexOf(t);return n?s===a.length-1:s>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return DP(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return PP(this.store.getState().dragOffset)}constructor(t,r){this.store=t,this.registry=r}}const Jg=typeof global<"u"?global:self,Hw=Jg.MutationObserver||Jg.WebKitMutationObserver;function Vw(e){return function(){const r=setTimeout(i,0),n=setInterval(i,50);function i(){clearTimeout(r),clearInterval(n),e()}}}function kP(e){let t=1;const r=new Hw(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const $P=typeof Hw=="function"?kP:Vw;class NP{enqueueTask(t){const{queue:r,requestFlush:n}=this;r.length||(n(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.indexthis.capacity){for(let n=0,i=t.length-this.index;n{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=$P(this.flush),this.requestErrorThrow=Vw(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class MP{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,r){this.onError=t,this.release=r,this.task=null}}class LP{create(t){const r=this.freeTasks,n=r.length?r.pop():new MP(this.onError,i=>r[r.length]=i);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const Ww=new NP,BP=new LP(Ww.registerPendingError);function UP(e){Ww.enqueueTask(BP.create(e))}const jd="dnd-core/ADD_SOURCE",Xd="dnd-core/ADD_TARGET",Kd="dnd-core/REMOVE_SOURCE",Fu="dnd-core/REMOVE_TARGET";function HP(e){return{type:jd,payload:{sourceId:e}}}function VP(e){return{type:Xd,payload:{targetId:e}}}function WP(e){return{type:Kd,payload:{sourceId:e}}}function zP(e){return{type:Fu,payload:{targetId:e}}}function GP(e){Fe(typeof e.canDrag=="function","Expected canDrag to be a function."),Fe(typeof e.beginDrag=="function","Expected beginDrag to be a function."),Fe(typeof e.endDrag=="function","Expected endDrag to be a function.")}function jP(e){Fe(typeof e.canDrop=="function","Expected canDrop to be a function."),Fe(typeof e.hover=="function","Expected hover to be a function."),Fe(typeof e.drop=="function","Expected beginDrag to be a function.")}function Kf(e,t){if(t&&Array.isArray(e)){e.forEach(r=>Kf(r,!1));return}Fe(typeof e=="string"||typeof e=="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var or;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(or||(or={}));let XP=0;function KP(){return XP++}function YP(e){const t=KP().toString();switch(e){case or.SOURCE:return`S${t}`;case or.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function e1(e){switch(e[0]){case"S":return or.SOURCE;case"T":return or.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function t1(e,t){const r=e.entries();let n=!1;do{const{done:i,value:[,o]}=r.next();if(o===t)return!0;n=!!i}while(!n);return!1}class qP{addSource(t,r){Kf(t),GP(r);const n=this.addHandler(or.SOURCE,t,r);return this.store.dispatch(HP(n)),n}addTarget(t,r){Kf(t,!0),jP(r);const n=this.addHandler(or.TARGET,t,r);return this.store.dispatch(VP(n)),n}containsHandler(t){return t1(this.dragSources,t)||t1(this.dropTargets,t)}getSource(t,r=!1){return Fe(this.isSourceId(t),"Expected a valid source ID."),r&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return Fe(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return Fe(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return Fe(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return e1(t)===or.SOURCE}isTargetId(t){return e1(t)===or.TARGET}removeSource(t){Fe(this.getSource(t),"Expected an existing source."),this.store.dispatch(WP(t)),UP(()=>{this.dragSources.delete(t),this.types.delete(t)})}removeTarget(t){Fe(this.getTarget(t),"Expected an existing target."),this.store.dispatch(zP(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const r=this.getSource(t);Fe(r,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=r}unpinSource(){Fe(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,r,n){const i=YP(t);return this.types.set(i,r),t===or.SOURCE?this.dragSources.set(i,n):t===or.TARGET&&this.dropTargets.set(i,n),i}constructor(t){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}}const QP=(e,t)=>e===t;function ZP(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function JP(e,t,r=QP){if(e.length!==t.length)return!1;for(let n=0;n0||!JP(r,n)))return xa;const a=n[n.length-1],s=r[r.length-1];return a!==s&&(a&&i.push(a),s&&i.push(s)),i}function tI(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rI(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function gI(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,o;for(o=0;o=0)&&(r[i]=e[i]);return r}let n1=0;const el=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var mI=v.memo(function(t){var{children:r}=t,n=pI(t,["children"]);const[i,o]=vI(n);return v.useEffect(()=>{if(o){const a=zw();return++n1,()=>{--n1===0&&(a[el]=null)}}},[]),Z(Mw.Provider,{value:i,children:r})});function vI(e){if("manager"in e)return[{dragDropManager:e.manager},!1];const t=xI(e.backend,e.context,e.options,e.debugMode),r=!e.context;return[t,r]}function xI(e,t=zw(),r,n){const i=t;return i[el]||(i[el]={dragDropManager:dI(e,t,r,n)}),i[el]}function zw(){return typeof global<"u"?global:window}var wI=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var a=o[i];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r};const li=typeof window<"u"?v.useLayoutEffect:v.useEffect;function yI(e,t,r){const[n,i]=v.useState(()=>t(e)),o=v.useCallback(()=>{const a=t(e);wI(n,a)||(i(a),r&&r())},[n,e,r]);return li(o),[n,o]}function EI(e,t,r){const[n,i]=yI(e,t,r);return li(function(){const a=e.getHandlerId();if(a!=null)return e.subscribeToStateChange(i,{handlerIds:[a]})},[e,i]),n}function Gw(e,t,r){return EI(t,e||(()=>({})),()=>r.reconnect())}function jw(e,t){const r=[...t||[]];return t==null&&typeof e!="function"&&r.push(e),v.useMemo(()=>typeof e=="function"?e():e,r)}function _I(e){return v.useMemo(()=>e.hooks.dragSource(),[e])}function SI(e){return v.useMemo(()=>e.hooks.dragPreview(),[e])}let bc=!1,kc=!1;class TI{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){Fe(!bc,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return bc=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{bc=!1}}isDragging(){if(!this.sourceId)return!1;Fe(!kc,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return kc=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{kc=!1}}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}isDraggingSource(t){return this.internalMonitor.isDraggingSource(t)}isOverTarget(t,r){return this.internalMonitor.isOverTarget(t,r)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(t){return this.internalMonitor.subscribeToOffsetChange(t)}canDragSource(t){return this.internalMonitor.canDragSource(t)}canDropOnTarget(t){return this.internalMonitor.canDropOnTarget(t)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.sourceId=null,this.internalMonitor=t.getMonitor()}}let $c=!1;class CI{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}canDrop(){if(!this.targetId)return!1;Fe(!$c,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return $c=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{$c=!1}}isOver(t){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,t):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.targetId=null,this.internalMonitor=t.getMonitor()}}function AI(e,t,r){const n=r.getRegistry(),i=n.addTarget(e,t);return[i,()=>n.removeTarget(i)]}function RI(e,t,r){const n=r.getRegistry(),i=n.addSource(e,t);return[i,()=>n.removeSource(i)]}function Yf(e,t,r,n){let i=r?r.call(n,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const o=Object.keys(e),a=Object.keys(t);if(o.length!==a.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let l=0;l, or turn it into a drag source or a drop target itself.`)}function FI(e){return(t=null,r=null)=>{if(!v.isValidElement(t)){const o=t;return e(o,r),o}const n=t;return OI(n),DI(n,r?o=>e(o,r):e)}}function Xw(e){const t={};return Object.keys(e).forEach(r=>{const n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const i=FI(n);t[r]=()=>i}}),t}function i1(e,t){typeof e=="function"?e(t):e.current=t}function DI(e,t){const r=e.ref;return Fe(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a or
. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?v.cloneElement(e,{ref:n=>{i1(r,n),i1(t,n)}}):v.cloneElement(e,{ref:t})}class PI{receiveHandlerId(t){this.handlerId!==t&&(this.handlerId=t,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(t){this.dragSourceOptionsInternal=t}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(t){this.dragPreviewOptionsInternal=t}reconnect(){const t=this.reconnectDragSource();this.reconnectDragPreview(t)}reconnectDragSource(){const t=this.dragSource,r=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return r&&this.disconnectDragSource(),this.handlerId?t?(r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=t,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,t,this.dragSourceOptions)),r):(this.lastConnectedDragSource=t,r):r}reconnectDragPreview(t=!1){const r=this.dragPreview,n=t||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),!!this.handlerId){if(!r){this.lastConnectedDragPreview=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=r,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,r,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!Yf(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!Yf(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(t){this.hooks=Xw({dragSource:(r,n)=>{this.clearDragSource(),this.dragSourceOptions=n||null,qf(r)?this.dragSourceRef=r:this.dragSourceNode=r,this.reconnectDragSource()},dragPreview:(r,n)=>{this.clearDragPreview(),this.dragPreviewOptions=n||null,qf(r)?this.dragPreviewRef=r:this.dragPreviewNode=r,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=t}}class II{get connectTarget(){return this.dropTarget}reconnect(){const t=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();t&&this.disconnectDropTarget();const r=this.dropTarget;if(this.handlerId){if(!r){this.lastConnectedDropTarget=r;return}t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=r,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,r,this.dropTargetOptions))}}receiveHandlerId(t){t!==this.handlerId&&(this.handlerId=t,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(t){this.dropTargetOptionsInternal=t}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!Yf(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(t){this.hooks=Xw({dropTarget:(r,n)=>{this.clearDropTarget(),this.dropTargetOptions=n,qf(r)?this.dropTargetRef=r:this.dropTargetNode=r,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}}function Ao(){const{dragDropManager:e}=v.useContext(Mw);return Fe(e!=null,"Expected drag drop context"),e}function bI(e,t){const r=Ao(),n=v.useMemo(()=>new PI(r.getBackend()),[r]);return li(()=>(n.dragSourceOptions=e||null,n.reconnect(),()=>n.disconnectDragSource()),[n,e]),li(()=>(n.dragPreviewOptions=t||null,n.reconnect(),()=>n.disconnectDragPreview()),[n,t]),n}function kI(){const e=Ao();return v.useMemo(()=>new TI(e),[e])}class $I{beginDrag(){const t=this.spec,r=this.monitor;let n=null;return typeof t.item=="object"?n=t.item:typeof t.item=="function"?n=t.item(r):n={},n??null}canDrag(){const t=this.spec,r=this.monitor;return typeof t.canDrag=="boolean"?t.canDrag:typeof t.canDrag=="function"?t.canDrag(r):!0}isDragging(t,r){const n=this.spec,i=this.monitor,{isDragging:o}=n;return o?o(i):r===t.getSourceId()}endDrag(){const t=this.spec,r=this.monitor,n=this.connector,{end:i}=t;i&&i(r.getItem(),r),n.reconnect()}constructor(t,r,n){this.spec=t,this.monitor=r,this.connector=n}}function NI(e,t,r){const n=v.useMemo(()=>new $I(e,t,r),[t,r]);return v.useEffect(()=>{n.spec=e},[e]),n}function MI(e){return v.useMemo(()=>{const t=e.type;return Fe(t!=null,"spec.type must be defined"),t},[e])}function LI(e,t,r){const n=Ao(),i=NI(e,t,r),o=MI(e);li(function(){if(o!=null){const[s,l]=RI(o,i,n);return t.receiveHandlerId(s),r.receiveHandlerId(s),l}},[n,t,r,i,o])}function BI(e,t){const r=jw(e,t);Fe(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const n=kI(),i=bI(r.options,r.previewOptions);return LI(r,n,i),[Gw(r.collect,n,i),_I(i),SI(i)]}function UI(e){return v.useMemo(()=>e.hooks.dropTarget(),[e])}function HI(e){const t=Ao(),r=v.useMemo(()=>new II(t.getBackend()),[t]);return li(()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget()),[e]),r}function VI(){const e=Ao();return v.useMemo(()=>new CI(e),[e])}function WI(e){const{accept:t}=e;return v.useMemo(()=>(Fe(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}class zI{canDrop(){const t=this.spec,r=this.monitor;return t.canDrop?t.canDrop(r.getItem(),r):!0}hover(){const t=this.spec,r=this.monitor;t.hover&&t.hover(r.getItem(),r)}drop(){const t=this.spec,r=this.monitor;if(t.drop)return t.drop(r.getItem(),r)}constructor(t,r){this.spec=t,this.monitor=r}}function GI(e,t){const r=v.useMemo(()=>new zI(e,t),[t]);return v.useEffect(()=>{r.spec=e},[e]),r}function jI(e,t,r){const n=Ao(),i=GI(e,t),o=WI(e);li(function(){const[s,l]=AI(o,i,n);return t.receiveHandlerId(s),r.receiveHandlerId(s),l},[n,t,i,r,o.map(a=>a.toString()).join("|")])}function XI(e,t){const r=jw(e,t),n=VI(),i=HI(r.options);return jI(r,n,i),[Gw(r.collect,n,i),UI(i)]}function KI(e,t){return v.useReducer((r,n)=>{const i=t[r][n];return i??r},e)}const Ei=e=>{const{present:t,children:r}=e,n=YI(t),i=typeof r=="function"?r({present:n.isPresent}):v.Children.only(r),o=He(n.ref,i.ref);return typeof r=="function"||n.isPresent?v.cloneElement(i,{ref:o}):null};Ei.displayName="Presence";function YI(e){const[t,r]=v.useState(),n=v.useRef({}),i=v.useRef(e),o=v.useRef("none"),a=e?"mounted":"unmounted",[s,l]=KI(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=ks(n.current);o.current=s==="mounted"?u:"none"},[s]),xt(()=>{const u=n.current,c=i.current;if(c!==e){const d=o.current,h=ks(u);e?l("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(c&&d!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),xt(()=>{if(t){const u=f=>{const h=ks(n.current).includes(f.animationName);f.target===t&&h&&Jr.flushSync(()=>l("ANIMATION_END"))},c=f=>{f.target===t&&(o.current=ks(n.current))};return t.addEventListener("animationstart",c),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",c),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:v.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function ks(e){return(e==null?void 0:e.animationName)||"none"}const Nc="rovingFocusGroup.onEntryFocus",qI={bubbles:!1,cancelable:!0},Yd="RovingFocusGroup",[Qf,Kw,QI]=su(Yd),[ZI,Yw]=on(Yd,[QI]),[JI,e5]=ZI(Yd),t5=v.forwardRef((e,t)=>v.createElement(Qf.Provider,{scope:e.__scopeRovingFocusGroup},v.createElement(Qf.Slot,{scope:e.__scopeRovingFocusGroup},v.createElement(r5,de({},e,{ref:t}))))),r5=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:u,...c}=e,f=v.useRef(null),d=He(t,f),h=ld(o),[m=null,p]=lo({prop:a,defaultProp:s,onChange:l}),[g,x]=v.useState(!1),w=Dt(u),y=Kw(r),_=v.useRef(!1),[k,N]=v.useState(0);return v.useEffect(()=>{const S=f.current;if(S)return S.addEventListener(Nc,w),()=>S.removeEventListener(Nc,w)},[w]),v.createElement(JI,{scope:r,orientation:n,dir:h,loop:i,currentTabStopId:m,onItemFocus:v.useCallback(S=>p(S),[p]),onItemShiftTab:v.useCallback(()=>x(!0),[]),onFocusableItemAdd:v.useCallback(()=>N(S=>S+1),[]),onFocusableItemRemove:v.useCallback(()=>N(S=>S-1),[])},v.createElement(Ie.div,de({tabIndex:g||k===0?-1:0,"data-orientation":n},c,{ref:d,style:{outline:"none",...e.style},onMouseDown:Ee(e.onMouseDown,()=>{_.current=!0}),onFocus:Ee(e.onFocus,S=>{const A=!_.current;if(S.target===S.currentTarget&&A&&!g){const R=new CustomEvent(Nc,qI);if(S.currentTarget.dispatchEvent(R),!R.defaultPrevented){const L=y().filter(re=>re.focusable),V=L.find(re=>re.active),U=L.find(re=>re.id===m),Y=[V,U,...L].filter(Boolean).map(re=>re.ref.current);qw(Y)}}_.current=!1}),onBlur:Ee(e.onBlur,()=>x(!1))})))}),n5="RovingFocusGroupItem",i5=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:o,...a}=e,s=Xr(),l=o||s,u=e5(n5,r),c=u.currentTabStopId===l,f=Kw(r),{onFocusableItemAdd:d,onFocusableItemRemove:h}=u;return v.useEffect(()=>{if(n)return d(),()=>h()},[n,d,h]),v.createElement(Qf.ItemSlot,{scope:r,id:l,focusable:n,active:i},v.createElement(Ie.span,de({tabIndex:c?0:-1,"data-orientation":u.orientation},a,{ref:t,onMouseDown:Ee(e.onMouseDown,m=>{n?u.onItemFocus(l):m.preventDefault()}),onFocus:Ee(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Ee(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){u.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const p=s5(m,u.orientation,u.dir);if(p!==void 0){m.preventDefault();let x=f().filter(w=>w.focusable).map(w=>w.ref.current);if(p==="last")x.reverse();else if(p==="prev"||p==="next"){p==="prev"&&x.reverse();const w=x.indexOf(m.currentTarget);x=u.loop?l5(x,w+1):x.slice(w+1)}setTimeout(()=>qw(x))}})})))}),o5={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function a5(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function s5(e,t,r){const n=a5(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return o5[n]}function qw(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function l5(e,t){return e.map((r,n)=>e[(t+n)%e.length])}const u5=t5,c5=i5,f5=["Enter"," "],d5=["ArrowDown","PageUp","Home"],Qw=["ArrowUp","PageDown","End"],h5=[...d5,...Qw],Du="Menu",[Zf,p5,g5]=su(Du),[_i,Pu]=on(Du,[g5,fu,Yw]),qd=fu(),Zw=Yw(),[m5,ns]=_i(Du),[v5,Qd]=_i(Du),x5=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:o,modal:a=!0}=e,s=qd(t),[l,u]=v.useState(null),c=v.useRef(!1),f=Dt(o),d=ld(i);return v.useEffect(()=>{const h=()=>{c.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>c.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),v.createElement(Nv,s,v.createElement(m5,{scope:t,open:r,onOpenChange:f,content:l,onContentChange:u},v.createElement(v5,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:c,dir:d,modal:a},n)))},w5=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=qd(r);return v.createElement(Mv,de({},i,n,{ref:t}))}),Jw="MenuPortal",[y5,E5]=_i(Jw,{forceMount:void 0}),_5=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,o=ns(Jw,t);return v.createElement(y5,{scope:t,forceMount:r},v.createElement(Ei,{present:r||o.open},v.createElement(du,{asChild:!0,container:i},n)))},Rn="MenuContent",[S5,e2]=_i(Rn),T5=v.forwardRef((e,t)=>{const r=E5(Rn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,o=ns(Rn,e.__scopeMenu),a=Qd(Rn,e.__scopeMenu);return v.createElement(Zf.Provider,{scope:e.__scopeMenu},v.createElement(Ei,{present:n||o.open},v.createElement(Zf.Slot,{scope:e.__scopeMenu},a.modal?v.createElement(C5,de({},i,{ref:t})):v.createElement(A5,de({},i,{ref:t})))))}),C5=v.forwardRef((e,t)=>{const r=ns(Rn,e.__scopeMenu),n=v.useRef(null),i=He(t,n);return v.useEffect(()=>{const o=n.current;if(o)return md(o)},[]),v.createElement(t2,de({},e,{ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Ee(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)}))}),A5=v.forwardRef((e,t)=>{const r=ns(Rn,e.__scopeMenu);return v.createElement(t2,de({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)}))}),t2=v.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:f,onInteractOutside:d,onDismiss:h,disableOutsideScroll:m,...p}=e,g=ns(Rn,r),x=Qd(Rn,r),w=qd(r),y=Zw(r),_=p5(r),[k,N]=v.useState(null),S=v.useRef(null),A=He(t,S,g.onContentChange),R=v.useRef(0),L=v.useRef(""),V=v.useRef(0),U=v.useRef(null),W=v.useRef("right"),Y=v.useRef(0),re=m?vd:v.Fragment,ye=m?{as:ii,allowPinchZoom:!0}:void 0,ge=ie=>{var we,Q;const F=L.current+ie,M=_().filter(ee=>!ee.disabled),b=document.activeElement,T=(we=M.find(ee=>ee.ref.current===b))===null||we===void 0?void 0:we.textValue,B=M.map(ee=>ee.textValue),H=M5(B,F,T),q=(Q=M.find(ee=>ee.textValue===H))===null||Q===void 0?void 0:Q.ref.current;(function ee(K){L.current=K,window.clearTimeout(R.current),K!==""&&(R.current=window.setTimeout(()=>ee(""),1e3))})(F),q&&setTimeout(()=>q.focus())};v.useEffect(()=>()=>window.clearTimeout(R.current),[]),cd();const Se=v.useCallback(ie=>{var we,Q;return W.current===((we=U.current)===null||we===void 0?void 0:we.side)&&B5(ie,(Q=U.current)===null||Q===void 0?void 0:Q.area)},[]);return v.createElement(S5,{scope:r,searchRef:L,onItemEnter:v.useCallback(ie=>{Se(ie)&&ie.preventDefault()},[Se]),onItemLeave:v.useCallback(ie=>{var we;Se(ie)||((we=S.current)===null||we===void 0||we.focus(),N(null))},[Se]),onTriggerLeave:v.useCallback(ie=>{Se(ie)&&ie.preventDefault()},[Se]),pointerGraceTimerRef:V,onPointerGraceIntentChange:v.useCallback(ie=>{U.current=ie},[])},v.createElement(re,ye,v.createElement(fd,{asChild:!0,trapped:i,onMountAutoFocus:Ee(o,ie=>{var we;ie.preventDefault(),(we=S.current)===null||we===void 0||we.focus()}),onUnmountAutoFocus:a},v.createElement(lu,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:f,onInteractOutside:d,onDismiss:h},v.createElement(u5,de({asChild:!0},y,{dir:x.dir,orientation:"vertical",loop:n,currentTabStopId:k,onCurrentTabStopIdChange:N,onEntryFocus:Ee(l,ie=>{x.isUsingKeyboardRef.current||ie.preventDefault()})}),v.createElement(Lv,de({role:"menu","aria-orientation":"vertical","data-state":k5(g.open),"data-radix-menu-content":"",dir:x.dir},w,p,{ref:A,style:{outline:"none",...p.style},onKeyDown:Ee(p.onKeyDown,ie=>{const Q=ie.target.closest("[data-radix-menu-content]")===ie.currentTarget,F=ie.ctrlKey||ie.altKey||ie.metaKey,M=ie.key.length===1;Q&&(ie.key==="Tab"&&ie.preventDefault(),!F&&M&&ge(ie.key));const b=S.current;if(ie.target!==b||!h5.includes(ie.key))return;ie.preventDefault();const B=_().filter(H=>!H.disabled).map(H=>H.ref.current);Qw.includes(ie.key)&&B.reverse(),$5(B)}),onBlur:Ee(e.onBlur,ie=>{ie.currentTarget.contains(ie.target)||(window.clearTimeout(R.current),L.current="")}),onPointerMove:Ee(e.onPointerMove,e0(ie=>{const we=ie.target,Q=Y.current!==ie.clientX;if(ie.currentTarget.contains(we)&&Q){const F=ie.clientX>Y.current?"right":"left";W.current=F,Y.current=ie.clientX}}))})))))))}),R5=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return v.createElement(Ie.div,de({role:"group"},n,{ref:t}))}),O5=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return v.createElement(Ie.div,de({},n,{ref:t}))}),Jf="MenuItem",o1="menu.itemSelect",F5=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,o=v.useRef(null),a=Qd(Jf,e.__scopeMenu),s=e2(Jf,e.__scopeMenu),l=He(t,o),u=v.useRef(!1),c=()=>{const f=o.current;if(!r&&f){const d=new CustomEvent(o1,{bubbles:!0,cancelable:!0});f.addEventListener(o1,h=>n==null?void 0:n(h),{once:!0}),ud(f,d),d.defaultPrevented?u.current=!1:a.onClose()}};return v.createElement(D5,de({},i,{ref:l,disabled:r,onClick:Ee(e.onClick,c),onPointerDown:f=>{var d;(d=e.onPointerDown)===null||d===void 0||d.call(e,f),u.current=!0},onPointerUp:Ee(e.onPointerUp,f=>{var d;u.current||(d=f.currentTarget)===null||d===void 0||d.click()}),onKeyDown:Ee(e.onKeyDown,f=>{const d=s.searchRef.current!=="";r||d&&f.key===" "||f5.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})}))}),D5=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...o}=e,a=e2(Jf,r),s=Zw(r),l=v.useRef(null),u=He(t,l),[c,f]=v.useState(!1),[d,h]=v.useState("");return v.useEffect(()=>{const m=l.current;if(m){var p;h(((p=m.textContent)!==null&&p!==void 0?p:"").trim())}},[o.children]),v.createElement(Zf.ItemSlot,{scope:r,disabled:n,textValue:i??d},v.createElement(c5,de({asChild:!0},s,{focusable:!n}),v.createElement(Ie.div,de({role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0},o,{ref:u,onPointerMove:Ee(e.onPointerMove,e0(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus())})),onPointerLeave:Ee(e.onPointerLeave,e0(m=>a.onItemLeave(m))),onFocus:Ee(e.onFocus,()=>f(!0)),onBlur:Ee(e.onBlur,()=>f(!1))}))))}),P5="MenuRadioGroup";_i(P5,{value:void 0,onValueChange:()=>{}});const I5="MenuItemIndicator";_i(I5,{checked:!1});const b5="MenuSub";_i(b5);function k5(e){return e?"open":"closed"}function $5(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function N5(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function M5(e,t,r){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let a=N5(e,Math.max(o,0));i.length===1&&(a=a.filter(u=>u!==r));const l=a.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return l!==r?l:void 0}function L5(e,t){const{x:r,y:n}=e;let i=!1;for(let o=0,a=t.length-1;on!=c>n&&r<(u-s)*(n-l)/(c-l)+s&&(i=!i)}return i}function B5(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return L5(r,t)}function e0(e){return t=>t.pointerType==="mouse"?e(t):void 0}const r2=x5,n2=w5,i2=_5,o2=T5,U5=R5,H5=O5,V5=F5,a2="ContextMenu",[W5,Uk]=on(a2,[Pu]),Iu=Pu(),[z5,s2]=W5(a2),G5=e=>{const{__scopeContextMenu:t,children:r,onOpenChange:n,dir:i,modal:o=!0}=e,[a,s]=v.useState(!1),l=Iu(t),u=Dt(n),c=v.useCallback(f=>{s(f),u(f)},[u]);return v.createElement(z5,{scope:t,open:a,onOpenChange:c,modal:o},v.createElement(r2,de({},l,{dir:i,open:a,onOpenChange:c,modal:o}),r))},j5="ContextMenuTrigger",X5=v.forwardRef((e,t)=>{const{__scopeContextMenu:r,disabled:n=!1,...i}=e,o=s2(j5,r),a=Iu(r),s=v.useRef({x:0,y:0}),l=v.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),u=v.useRef(0),c=v.useCallback(()=>window.clearTimeout(u.current),[]),f=d=>{s.current={x:d.clientX,y:d.clientY},o.onOpenChange(!0)};return v.useEffect(()=>c,[c]),v.useEffect(()=>void(n&&c()),[n,c]),v.createElement(v.Fragment,null,v.createElement(n2,de({},a,{virtualRef:l})),v.createElement(Ie.span,de({"data-state":o.open?"open":"closed","data-disabled":n?"":void 0},i,{ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:n?e.onContextMenu:Ee(e.onContextMenu,d=>{c(),f(d),d.preventDefault()}),onPointerDown:n?e.onPointerDown:Ee(e.onPointerDown,$s(d=>{c(),u.current=window.setTimeout(()=>f(d),700)})),onPointerMove:n?e.onPointerMove:Ee(e.onPointerMove,$s(c)),onPointerCancel:n?e.onPointerCancel:Ee(e.onPointerCancel,$s(c)),onPointerUp:n?e.onPointerUp:Ee(e.onPointerUp,$s(c))})))}),K5=e=>{const{__scopeContextMenu:t,...r}=e,n=Iu(t);return v.createElement(i2,de({},n,r))},Y5="ContextMenuContent",q5=v.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,i=s2(Y5,r),o=Iu(r),a=v.useRef(!1);return v.createElement(o2,de({},o,n,{ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:s=>{var l;(l=e.onCloseAutoFocus)===null||l===void 0||l.call(e,s),!s.defaultPrevented&&a.current&&s.preventDefault(),a.current=!1},onInteractOutside:s=>{var l;(l=e.onInteractOutside)===null||l===void 0||l.call(e,s),!s.defaultPrevented&&!i.modal&&(a.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))});function $s(e){return t=>t.pointerType!=="mouse"?e(t):void 0}const Q5=G5,Z5=X5,J5=K5,e8=q5;function t8({column:e,table:t,numberOfColumns:r}){const n=t.getPreFilteredRowModel().flatRows.map(u=>u.getValue(e.id)),i=n.every(u=>typeof u=="string"||u===null),o=n.every(u=>typeof u=="number"||u===null),a=n.some(u=>typeof u=="string"&&u.includes(" ")),s=e.getFilterValue();if(n.every(u=>typeof u!="string"?!1:u.replace(/[^0-9]/g,"").length>=4&&(Vd(e.id)||e.id.toLowerCase()==="index"&&!a))){let u=function(c){if(!c)return null;const f=new Date(c),d=f.getFullYear(),h=f.getMonth()+1>9?f.getMonth()+1:`0${f.getMonth()+1}`,m=f.getDate()>9?f.getDate():`0${f.getDate()}`;return`${d}-${h}-${m}`};return Te("div",{className:"flex gap-2 h-10",children:[Z("input",{type:"datetime-local",value:u(s==null?void 0:s[0])??"",onChange:c=>{const f=new Date(c.target.value).getTime();e.setFilterValue(d=>[f,d==null?void 0:d[1]])},placeholder:"Start date",className:"_input"}),Z("input",{type:"datetime-local",value:u(s==null?void 0:s[1])??"",onChange:c=>{const f=new Date(c.target.value).getTime();e.setFilterValue(d=>[d==null?void 0:d[0],f])},placeholder:"End date",className:"_input"})]})}return o?Te("div",{className:"flex gap-0.5 h-10",children:[Z("input",{type:"number",value:(s==null?void 0:s[0])??"",onChange:u=>e.setFilterValue(c=>[u.target.value,c==null?void 0:c[1]]),placeholder:"Min",className:"_input p-0.5"}),Z("input",{type:"number",value:(s==null?void 0:s[1])??"",onChange:u=>e.setFilterValue(c=>[c==null?void 0:c[0],u.target.value]),placeholder:"Max",className:"_input p-0.5"})]}):i?Z("div",{className:"h-10",children:Z("input",{type:"text",value:s??"",onChange:u=>e.setFilterValue(u.target.value),placeholder:"Search...",className:"_input"})}):Z("div",{className:"h-10"})}const r8=(e,t,r)=>(r.splice(r.indexOf(t),0,r.splice(r.indexOf(e),1)[0]),[...r]),n8=({header:e,table:t,advanced:r,idx:n,lockFirstColumn:i,setLockFirstColumn:o})=>{const{getState:a,setColumnOrder:s}=t,{columnOrder:l}=a(),{column:u}=e,[,c]=XI({accept:"column",drop:p=>{const g=r8(p.id,u.id,l);s(g)}}),[{isDragging:f},d,h]=BI({collect:p=>({isDragging:p.isDragging()}),item:()=>u,type:"column"}),m=()=>Z("div",{ref:h,className:"flex gap-1 flex-col",children:e.isPlaceholder?null:Te($1,{children:[Te("div",{className:"font-bold uppercase text-grey-700 dark:text-white tracking-widest flex gap-2 whitespace-nowrap justify-between",children:[Te("div",{onClick:e.column.getToggleSortingHandler(),className:bt("flex gap-1",{"cursor-pointer select-none":e.column.getCanSort()}),children:[If(e.column.columnDef.header,e.getContext()),e.column.getCanSort()&&Te("div",{className:"flex flex-col gap-0.5 items-center justify-center",children:[Z("button",{className:bt({"text-[#669DCB]":e.column.getIsSorted()==="asc","text-grey-600":e.column.getIsSorted()!=="asc"}),children:Z("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"4",fill:"none",viewBox:"0 0 11 5",children:Z("path",{fill:"currentColor",d:"M10.333 5l-5-5-5 5"})})}),Z("button",{className:bt({"text-[#669DCB]":e.column.getIsSorted()==="desc","text-grey-600":e.column.getIsSorted()!=="desc"}),children:Z("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"4",fill:"none",viewBox:"0 0 11 5",children:Z("path",{fill:"currentColor",d:"M.333 0l5 5 5-5"})})})]})]}),r&&u.id!=="select"&&Z("button",{ref:d,className:"text-grey-600 hover:text-grey-800 dark:hover:text-white",children:Z("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",fill:"none",viewBox:"0 0 17 16",children:Z("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M3.667 6l-2 2 2 2M6.333 3.333l2-2 2 2M10.333 12.667l-2 2-2-2M13 6l2 2-2 2M1.667 8H15M8.333 1.333v13.334"})})})]}),r&&e.column.getCanFilter()?Z("div",{children:Z(t8,{column:e.column,table:t,numberOfColumns:l.length})}):null]})});return Te("th",{className:bt("h-[70px] p-4 sticky",{"left-0 z-50 bg-white dark:bg-grey-900":n===0&&i}),colSpan:e.colSpan,style:{width:e.getSize(),opacity:f?.5:1},ref:c,children:[n===0?Te(Q5,{children:[Z(Z5,{asChild:!0,children:m()}),Z(J5,{children:Z(e8,{className:"bg-white text-black dark:text-white dark:bg-grey-900 border border-grey-200 dark:border-grey-800 rounded-md shadow-lg p-2 z-50 text-xs",children:Z("div",{className:"flex flex-col gap-2",children:Te("button",{onClick:()=>{o(!i)},className:"hover:bg-grey-300 dark:hover:bg-grey-800 rounded-md p-2",children:[i?"Unlock":"Lock"," first column"]})})})})]}):m(),Z("button",{className:"resizer bg-grey-300/20 dark:hover:bg-white absolute top-0 right-0 w-0.5 h-full",onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler()})]})};function l2(e){return typeof e!="number"?typeof e=="string"&&e.includes("All")?e:i0:e<1?i0:e}function i8({table:e,currentPage:t,setCurrentPage:r}){const n=e.getFilteredRowModel().rows.length;return Te("div",{className:"hidden md:flex items-center gap-8",children:[Z(Vi,{value:t,onChange:i=>{const o=l2(i);r(o),o.toString().includes("All")?e.setPageSize(n):e.setPageSize(o)},labelType:"row",label:"Rows per page",placeholder:"Select rows per page",groups:[{label:"Rows per page",items:[10,20,30,40,50,`All (${n})`].map(i=>({label:`${i}`,value:i}))}]}),Te("span",{className:"flex items-center gap-1",children:[Z("strong",{children:e.getState().pagination.pageIndex+1}),"of",Z("strong",{children:e.getPageCount()})]}),Te("div",{className:"hidden lg:block",children:[Z("button",{className:bt("px-2",{"text-grey-400 dark:text-grey-700":!e.getCanPreviousPage(),"dark:text-white":e.getCanPreviousPage()}),onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:"<<"}),Z("button",{className:bt("px-2",{"text-grey-400 dark:text-grey-700":!e.getCanPreviousPage(),"dark:text-white":e.getCanPreviousPage()}),onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:"<"}),Z("button",{className:bt("px-2",{"text-grey-400 dark:text-grey-700":!e.getCanNextPage(),"dark:text-white":e.getCanNextPage()}),onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:">"}),Z("button",{className:bt("px-2",{"text-grey-400 dark:text-grey-700":!e.getCanNextPage(),"dark:text-white":e.getCanNextPage()}),onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),children:">>"})]})]})}function o8({columns:e,data:t,type:r,setType:n}){const i=()=>{switch(r){case"csv":Yg("csv",e,t);break;case"xlsx":Yg("xlsx",e,t);break;case"png":JD("table");break}};return Te("div",{className:"flex gap-6 items-center",children:[Z(Vi,{labelType:"row",value:r,onChange:o=>{n(o)},label:"Type",placeholder:"Select type",groups:[{label:"Type",items:o0.map(o=>({label:o,value:o}))}]}),Z("button",{onClick:i,className:"_btn",children:"Export"})]})}const u2="DropdownMenu",[a8,Hk]=on(u2,[Pu]),Si=Pu(),[s8,c2]=a8(u2),l8=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:o,onOpenChange:a,modal:s=!0}=e,l=Si(t),u=v.useRef(null),[c=!1,f]=lo({prop:i,defaultProp:o,onChange:a});return v.createElement(s8,{scope:t,triggerId:Xr(),triggerRef:u,contentId:Xr(),open:c,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(d=>!d),[f]),modal:s},v.createElement(r2,de({},l,{open:c,onOpenChange:f,dir:n,modal:s}),r))},u8="DropdownMenuTrigger",c8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,o=c2(u8,r),a=Si(r);return v.createElement(n2,de({asChild:!0},a),v.createElement(Ie.button,de({type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n},i,{ref:sd(t,o.triggerRef),onPointerDown:Ee(e.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(o.onOpenToggle(),o.open||s.preventDefault())}),onKeyDown:Ee(e.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&o.onOpenToggle(),s.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})))}),f8=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Si(t);return v.createElement(i2,de({},n,r))},d8="DropdownMenuContent",h8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=c2(d8,r),o=Si(r),a=v.useRef(!1);return v.createElement(o2,de({id:i.contentId,"aria-labelledby":i.triggerId},o,n,{ref:t,onCloseAutoFocus:Ee(e.onCloseAutoFocus,s=>{var l;a.current||(l=i.triggerRef.current)===null||l===void 0||l.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:Ee(e.onInteractOutside,s=>{const l=s.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,c=l.button===2||u;(!i.modal||c)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),p8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Si(r);return v.createElement(U5,de({},i,n,{ref:t}))}),g8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Si(r);return v.createElement(H5,de({},i,n,{ref:t}))}),m8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Si(r);return v.createElement(V5,de({},i,n,{ref:t}))}),v8=l8,a1=c8,x8=f8,w8=h8,y8=p8,E8=g8,s1=m8;function _8(e,t){v.useEffect(()=>{const r=n=>{!e.current||e.current.contains(n.target)||t(n)};return document.addEventListener("mousedown",r),document.addEventListener("touchstart",r),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("touchstart",r)}},[e,t])}function l1({label:e,table:t,onlyIconTrigger:r=!1}){const[n,i]=v.useState(!1),o=v.useRef(null);return _8(o,()=>i(!1)),v.useEffect(()=>{const a=s=>{s.key==="Escape"&&i(!1)};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[]),Te(v8,{open:n,children:[r?Z(a1,{title:"Filter columns",onClick:()=>i(!n),children:Z("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-7 h-7",children:Z("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z"})})}):Te(y8,{className:"flex flex-row items-center gap-2",children:[Z(E8,{className:"whitespace-nowrap",children:e}),Te(a1,{onClick:()=>i(!n),className:"bg-white text-black dark:bg-grey-900 dark:text-white whitespace-nowrap h-[36px] border-[1.5px] border-grey-700 rounded p-3 inline-flex items-center justify-center leading-none gap-[5px] shadow-[0_2px_10px] shadow-black/10 focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-white outline-none","aria-label":e,children:[Z("span",{children:"Filter columns"}),Z(Hf,{className:bt({"transform rotate-180 duration-200 transition":n})})]})]}),Z(x8,{children:Te(w8,{sideOffset:10,ref:o,className:"z-50 bg-white/80 dark:bg-grey-900/80 backdrop-filter backdrop-blur flex flex-col gap-4 overflow-auto border-[1.5px] border-grey-700 rounded p-3 max-h-[500px] text-black dark:text-white",children:[Z(s1,{children:Te("label",{className:"flex items-center gap-2",children:[Z("input",{type:"checkbox",checked:t.getIsAllColumnsVisible(),onChange:t.getToggleAllColumnsVisibilityHandler()}),"Toggle All"]})}),t.getAllLeafColumns().filter(a=>a.id!=="select").map(a=>Z(s1,{children:Te("label",{className:"flex items-center gap-2",children:[Z("input",{type:"checkbox",checked:a.getIsVisible(),onChange:a.getToggleVisibilityHandler()}),a.id]})},a.id))]})})]})}var Gl={},S8={get exports(){return Gl},set exports(e){Gl=e}},qe={},fo={},T8={get exports(){return fo},set exports(e){fo=e}},Ti={};function f2(){var e={};return e["align-content"]=!1,e["align-items"]=!1,e["align-self"]=!1,e["alignment-adjust"]=!1,e["alignment-baseline"]=!1,e.all=!1,e["anchor-point"]=!1,e.animation=!1,e["animation-delay"]=!1,e["animation-direction"]=!1,e["animation-duration"]=!1,e["animation-fill-mode"]=!1,e["animation-iteration-count"]=!1,e["animation-name"]=!1,e["animation-play-state"]=!1,e["animation-timing-function"]=!1,e.azimuth=!1,e["backface-visibility"]=!1,e.background=!0,e["background-attachment"]=!0,e["background-clip"]=!0,e["background-color"]=!0,e["background-image"]=!0,e["background-origin"]=!0,e["background-position"]=!0,e["background-repeat"]=!0,e["background-size"]=!0,e["baseline-shift"]=!1,e.binding=!1,e.bleed=!1,e["bookmark-label"]=!1,e["bookmark-level"]=!1,e["bookmark-state"]=!1,e.border=!0,e["border-bottom"]=!0,e["border-bottom-color"]=!0,e["border-bottom-left-radius"]=!0,e["border-bottom-right-radius"]=!0,e["border-bottom-style"]=!0,e["border-bottom-width"]=!0,e["border-collapse"]=!0,e["border-color"]=!0,e["border-image"]=!0,e["border-image-outset"]=!0,e["border-image-repeat"]=!0,e["border-image-slice"]=!0,e["border-image-source"]=!0,e["border-image-width"]=!0,e["border-left"]=!0,e["border-left-color"]=!0,e["border-left-style"]=!0,e["border-left-width"]=!0,e["border-radius"]=!0,e["border-right"]=!0,e["border-right-color"]=!0,e["border-right-style"]=!0,e["border-right-width"]=!0,e["border-spacing"]=!0,e["border-style"]=!0,e["border-top"]=!0,e["border-top-color"]=!0,e["border-top-left-radius"]=!0,e["border-top-right-radius"]=!0,e["border-top-style"]=!0,e["border-top-width"]=!0,e["border-width"]=!0,e.bottom=!1,e["box-decoration-break"]=!0,e["box-shadow"]=!0,e["box-sizing"]=!0,e["box-snap"]=!0,e["box-suppress"]=!0,e["break-after"]=!0,e["break-before"]=!0,e["break-inside"]=!0,e["caption-side"]=!1,e.chains=!1,e.clear=!0,e.clip=!1,e["clip-path"]=!1,e["clip-rule"]=!1,e.color=!0,e["color-interpolation-filters"]=!0,e["column-count"]=!1,e["column-fill"]=!1,e["column-gap"]=!1,e["column-rule"]=!1,e["column-rule-color"]=!1,e["column-rule-style"]=!1,e["column-rule-width"]=!1,e["column-span"]=!1,e["column-width"]=!1,e.columns=!1,e.contain=!1,e.content=!1,e["counter-increment"]=!1,e["counter-reset"]=!1,e["counter-set"]=!1,e.crop=!1,e.cue=!1,e["cue-after"]=!1,e["cue-before"]=!1,e.cursor=!1,e.direction=!1,e.display=!0,e["display-inside"]=!0,e["display-list"]=!0,e["display-outside"]=!0,e["dominant-baseline"]=!1,e.elevation=!1,e["empty-cells"]=!1,e.filter=!1,e.flex=!1,e["flex-basis"]=!1,e["flex-direction"]=!1,e["flex-flow"]=!1,e["flex-grow"]=!1,e["flex-shrink"]=!1,e["flex-wrap"]=!1,e.float=!1,e["float-offset"]=!1,e["flood-color"]=!1,e["flood-opacity"]=!1,e["flow-from"]=!1,e["flow-into"]=!1,e.font=!0,e["font-family"]=!0,e["font-feature-settings"]=!0,e["font-kerning"]=!0,e["font-language-override"]=!0,e["font-size"]=!0,e["font-size-adjust"]=!0,e["font-stretch"]=!0,e["font-style"]=!0,e["font-synthesis"]=!0,e["font-variant"]=!0,e["font-variant-alternates"]=!0,e["font-variant-caps"]=!0,e["font-variant-east-asian"]=!0,e["font-variant-ligatures"]=!0,e["font-variant-numeric"]=!0,e["font-variant-position"]=!0,e["font-weight"]=!0,e.grid=!1,e["grid-area"]=!1,e["grid-auto-columns"]=!1,e["grid-auto-flow"]=!1,e["grid-auto-rows"]=!1,e["grid-column"]=!1,e["grid-column-end"]=!1,e["grid-column-start"]=!1,e["grid-row"]=!1,e["grid-row-end"]=!1,e["grid-row-start"]=!1,e["grid-template"]=!1,e["grid-template-areas"]=!1,e["grid-template-columns"]=!1,e["grid-template-rows"]=!1,e["hanging-punctuation"]=!1,e.height=!0,e.hyphens=!1,e.icon=!1,e["image-orientation"]=!1,e["image-resolution"]=!1,e["ime-mode"]=!1,e["initial-letters"]=!1,e["inline-box-align"]=!1,e["justify-content"]=!1,e["justify-items"]=!1,e["justify-self"]=!1,e.left=!1,e["letter-spacing"]=!0,e["lighting-color"]=!0,e["line-box-contain"]=!1,e["line-break"]=!1,e["line-grid"]=!1,e["line-height"]=!1,e["line-snap"]=!1,e["line-stacking"]=!1,e["line-stacking-ruby"]=!1,e["line-stacking-shift"]=!1,e["line-stacking-strategy"]=!1,e["list-style"]=!0,e["list-style-image"]=!0,e["list-style-position"]=!0,e["list-style-type"]=!0,e.margin=!0,e["margin-bottom"]=!0,e["margin-left"]=!0,e["margin-right"]=!0,e["margin-top"]=!0,e["marker-offset"]=!1,e["marker-side"]=!1,e.marks=!1,e.mask=!1,e["mask-box"]=!1,e["mask-box-outset"]=!1,e["mask-box-repeat"]=!1,e["mask-box-slice"]=!1,e["mask-box-source"]=!1,e["mask-box-width"]=!1,e["mask-clip"]=!1,e["mask-image"]=!1,e["mask-origin"]=!1,e["mask-position"]=!1,e["mask-repeat"]=!1,e["mask-size"]=!1,e["mask-source-type"]=!1,e["mask-type"]=!1,e["max-height"]=!0,e["max-lines"]=!1,e["max-width"]=!0,e["min-height"]=!0,e["min-width"]=!0,e["move-to"]=!1,e["nav-down"]=!1,e["nav-index"]=!1,e["nav-left"]=!1,e["nav-right"]=!1,e["nav-up"]=!1,e["object-fit"]=!1,e["object-position"]=!1,e.opacity=!1,e.order=!1,e.orphans=!1,e.outline=!1,e["outline-color"]=!1,e["outline-offset"]=!1,e["outline-style"]=!1,e["outline-width"]=!1,e.overflow=!1,e["overflow-wrap"]=!1,e["overflow-x"]=!1,e["overflow-y"]=!1,e.padding=!0,e["padding-bottom"]=!0,e["padding-left"]=!0,e["padding-right"]=!0,e["padding-top"]=!0,e.page=!1,e["page-break-after"]=!1,e["page-break-before"]=!1,e["page-break-inside"]=!1,e["page-policy"]=!1,e.pause=!1,e["pause-after"]=!1,e["pause-before"]=!1,e.perspective=!1,e["perspective-origin"]=!1,e.pitch=!1,e["pitch-range"]=!1,e["play-during"]=!1,e.position=!1,e["presentation-level"]=!1,e.quotes=!1,e["region-fragment"]=!1,e.resize=!1,e.rest=!1,e["rest-after"]=!1,e["rest-before"]=!1,e.richness=!1,e.right=!1,e.rotation=!1,e["rotation-point"]=!1,e["ruby-align"]=!1,e["ruby-merge"]=!1,e["ruby-position"]=!1,e["shape-image-threshold"]=!1,e["shape-outside"]=!1,e["shape-margin"]=!1,e.size=!1,e.speak=!1,e["speak-as"]=!1,e["speak-header"]=!1,e["speak-numeral"]=!1,e["speak-punctuation"]=!1,e["speech-rate"]=!1,e.stress=!1,e["string-set"]=!1,e["tab-size"]=!1,e["table-layout"]=!1,e["text-align"]=!0,e["text-align-last"]=!0,e["text-combine-upright"]=!0,e["text-decoration"]=!0,e["text-decoration-color"]=!0,e["text-decoration-line"]=!0,e["text-decoration-skip"]=!0,e["text-decoration-style"]=!0,e["text-emphasis"]=!0,e["text-emphasis-color"]=!0,e["text-emphasis-position"]=!0,e["text-emphasis-style"]=!0,e["text-height"]=!0,e["text-indent"]=!0,e["text-justify"]=!0,e["text-orientation"]=!0,e["text-overflow"]=!0,e["text-shadow"]=!0,e["text-space-collapse"]=!0,e["text-transform"]=!0,e["text-underline-position"]=!0,e["text-wrap"]=!0,e.top=!1,e.transform=!1,e["transform-origin"]=!1,e["transform-style"]=!1,e.transition=!1,e["transition-delay"]=!1,e["transition-duration"]=!1,e["transition-property"]=!1,e["transition-timing-function"]=!1,e["unicode-bidi"]=!1,e["vertical-align"]=!1,e.visibility=!1,e["voice-balance"]=!1,e["voice-duration"]=!1,e["voice-family"]=!1,e["voice-pitch"]=!1,e["voice-range"]=!1,e["voice-rate"]=!1,e["voice-stress"]=!1,e["voice-volume"]=!1,e.volume=!1,e["white-space"]=!1,e.widows=!1,e.width=!0,e["will-change"]=!1,e["word-break"]=!0,e["word-spacing"]=!0,e["word-wrap"]=!0,e["wrap-flow"]=!1,e["wrap-through"]=!1,e["writing-mode"]=!1,e["z-index"]=!1,e}function C8(e,t,r){}function A8(e,t,r){}var R8=/javascript\s*\:/img;function O8(e,t){return R8.test(t)?"":t}Ti.whiteList=f2();Ti.getDefaultWhiteList=f2;Ti.onAttr=C8;Ti.onIgnoreAttr=A8;Ti.safeAttrValue=O8;var F8={indexOf:function(e,t){var r,n;if(Array.prototype.indexOf)return e.indexOf(t);for(r=0,n=e.length;r/g,z8=/"/g,G8=/"/g,j8=/&#([a-zA-Z0-9]*);?/gim,X8=/:?/gim,K8=/&newline;?/gim,Ms=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,c1=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,f1=/u\s*r\s*l\s*\(.*/gi;function m2(e){return e.replace(z8,""")}function v2(e){return e.replace(G8,'"')}function x2(e){return e.replace(j8,function(r,n){return n[0]==="x"||n[0]==="X"?String.fromCharCode(parseInt(n.substr(1),16)):String.fromCharCode(parseInt(n,10))})}function w2(e){return e.replace(X8,":").replace(K8," ")}function y2(e){for(var t="",r=0,n=e.length;r",n);if(i===-1)break;r=i+3}return t}function Z8(e){var t=e.split("");return t=t.filter(function(r){var n=r.charCodeAt(0);return n===127?!1:n<=31?n===10||n===13:!0}),t.join("")}qe.whiteList=h2();qe.getDefaultWhiteList=h2;qe.onTag=M8;qe.onIgnoreTag=L8;qe.onTagAttr=B8;qe.onIgnoreTagAttr=U8;qe.safeAttrValue=H8;qe.escapeHtml=g2;qe.escapeQuote=m2;qe.unescapeQuote=v2;qe.escapeHtmlEntities=x2;qe.escapeDangerHtml5Entities=w2;qe.clearNonPrintableCharacter=y2;qe.friendlyAttrValue=E2;qe.escapeAttrValue=_2;qe.onIgnoreTagStripAll=Y8;qe.StripTagBody=q8;qe.stripCommentTag=Q8;qe.stripBlankChar=Z8;qe.cssFilter=p2;qe.getDefaultCSSWhiteList=N8;var bu={},cn=Zd;function J8(e){var t=cn.spaceIndex(e),r;return t===-1?r=e.slice(1,-1):r=e.slice(1,t+1),r=cn.trim(r).toLowerCase(),r.slice(0,1)==="/"&&(r=r.slice(1)),r.slice(-1)==="/"&&(r=r.slice(0,-1)),r}function eb(e){return e.slice(0,2)===""||s===l-1){n+=r(e.slice(i,o)),c=e.slice(o,s+1),u=J8(c),n+=t(o,n.length,u,c,eb(c)),i=s+1,o=!1;continue}if(f==='"'||f==="'")for(var d=1,h=e.charAt(s-d);h.trim()===""||h==="=";){if(h==="="){a=f;continue e}h=e.charAt(s-++d)}}else if(f===a){a=!1;continue}}return i0;t--){var r=e[t];if(r!==" ")return r==="="?t:-1}}function sb(e){return e[0]==='"'&&e[e.length-1]==='"'||e[0]==="'"&&e[e.length-1]==="'"}function d1(e){return sb(e)?e.substr(1,e.length-2):e}bu.parseTag=tb;bu.parseAttr=nb;var lb=fo.FilterCSS,xr=qe,S2=bu,ub=S2.parseTag,cb=S2.parseAttr,tl=Zd;function Ls(e){return e==null}function fb(e){var t=tl.spaceIndex(e);if(t===-1)return{html:"",closing:e[e.length-2]==="/"};e=tl.trim(e.slice(t+1,-1));var r=e[e.length-1]==="/";return r&&(e=tl.trim(e.slice(0,-1))),{html:e,closing:r}}function db(e){var t={};for(var r in e)t[r]=e[r];return t}function hb(e){var t={};for(var r in e)Array.isArray(e[r])?t[r.toLowerCase()]=e[r].map(function(n){return n.toLowerCase()}):t[r.toLowerCase()]=e[r];return t}function T2(e){e=db(e||{}),e.stripIgnoreTag&&(e.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),e.onIgnoreTag=xr.onIgnoreTagStripAll),e.whiteList||e.allowList?e.whiteList=hb(e.whiteList||e.allowList):e.whiteList=xr.whiteList,e.onTag=e.onTag||xr.onTag,e.onTagAttr=e.onTagAttr||xr.onTagAttr,e.onIgnoreTag=e.onIgnoreTag||xr.onIgnoreTag,e.onIgnoreTagAttr=e.onIgnoreTagAttr||xr.onIgnoreTagAttr,e.safeAttrValue=e.safeAttrValue||xr.safeAttrValue,e.escapeHtml=e.escapeHtml||xr.escapeHtml,this.options=e,e.css===!1?this.cssFilter=!1:(e.css=e.css||{},this.cssFilter=new lb(e.css))}T2.prototype.process=function(e){if(e=e||"",e=e.toString(),!e)return"";var t=this,r=t.options,n=r.whiteList,i=r.onTag,o=r.onIgnoreTag,a=r.onTagAttr,s=r.onIgnoreTagAttr,l=r.safeAttrValue,u=r.escapeHtml,c=t.cssFilter;r.stripBlankChar&&(e=xr.stripBlankChar(e)),r.allowCommentTag||(e=xr.stripCommentTag(e));var f=!1;r.stripIgnoreTagBody&&(f=xr.StripTagBody(r.stripIgnoreTagBody,o),o=f.onIgnoreTag);var d=ub(e,function(h,m,p,g,x){var w={sourcePosition:h,position:m,isClosing:x,isWhite:Object.prototype.hasOwnProperty.call(n,p)},y=i(p,g,w);if(!Ls(y))return y;if(w.isWhite){if(w.isClosing)return"";var _=fb(g),k=n[p],N=cb(_.html,function(S,A){var R=tl.indexOf(k,S)!==-1,L=a(p,S,A,R);return Ls(L)?R?(A=l(p,S,A,c),A?S+'="'+A+'"':S):(L=s(p,S,A,R),Ls(L)?void 0:L):L});return g="<"+p,N&&(g+=" "+N),_.closing&&(g+=" /"),g+=">",g}else return y=o(p,g,w),Ls(y)?u(g):y},u);return f&&(d=f.remove(d)),d};var pb=T2;(function(e,t){var r=qe,n=bu,i=pb;function o(s,l){var u=new i(l);return u.process(s)}t=e.exports=o,t.filterXSS=o,t.FilterXSS=i,function(){for(var s in r)t[s]=r[s];for(var l in n)t[l]=n[l]}(),typeof window<"u"&&(window.filterXSS=e.exports);function a(){return typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope}a()&&(self.filterXSS=e.exports)})(S8,Gl);const gb=Gl;function jo(e,t,r){const[n,i]=v.useState(()=>{if(typeof window>"u")return t;try{const a=window.localStorage.getItem(e);return a?r?r(JSON.parse(a)):JSON.parse(a):t}catch(a){return console.log(a),t}});return[n,a=>{try{const s=a instanceof Function?a(n):a;i(s),typeof window<"u"&&window.localStorage.setItem(e,JSON.stringify(s))}catch(s){console.log(s)}}]}const C2="ToastProvider",[Jd,mb,vb]=su("Toast"),[A2,Vk]=on("Toast",[vb]),[xb,ku]=A2(C2),R2=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:i="right",swipeThreshold:o=50,children:a}=e,[s,l]=v.useState(null),[u,c]=v.useState(0),f=v.useRef(!1),d=v.useRef(!1);return v.createElement(Jd.Provider,{scope:t},v.createElement(xb,{scope:t,label:r,duration:n,swipeDirection:i,swipeThreshold:o,toastCount:u,viewport:s,onViewportChange:l,onToastAdd:v.useCallback(()=>c(h=>h+1),[]),onToastRemove:v.useCallback(()=>c(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:d},a))};R2.propTypes={label(e){if(e.label&&typeof e.label=="string"&&!e.label.trim()){const t=`Invalid prop \`label\` supplied to \`${C2}\`. Expected non-empty \`string\`.`;return new Error(t)}return null}};const wb="ToastViewport",yb=["F8"],t0="toast.viewportPause",r0="toast.viewportResume",Eb=v.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=yb,label:i="Notifications ({hotkey})",...o}=e,a=ku(wb,r),s=mb(r),l=v.useRef(null),u=v.useRef(null),c=v.useRef(null),f=v.useRef(null),d=He(t,f,a.onViewportChange),h=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),m=a.toastCount>0;v.useEffect(()=>{const g=x=>{var w;n.every(_=>x[_]||x.code===_)&&((w=f.current)===null||w===void 0||w.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]),v.useEffect(()=>{const g=l.current,x=f.current;if(m&&g&&x){const w=()=>{if(!a.isClosePausedRef.current){const N=new CustomEvent(t0);x.dispatchEvent(N),a.isClosePausedRef.current=!0}},y=()=>{if(a.isClosePausedRef.current){const N=new CustomEvent(r0);x.dispatchEvent(N),a.isClosePausedRef.current=!1}},_=N=>{!g.contains(N.relatedTarget)&&y()},k=()=>{g.contains(document.activeElement)||y()};return g.addEventListener("focusin",w),g.addEventListener("focusout",_),g.addEventListener("pointermove",w),g.addEventListener("pointerleave",k),window.addEventListener("blur",w),window.addEventListener("focus",y),()=>{g.removeEventListener("focusin",w),g.removeEventListener("focusout",_),g.removeEventListener("pointermove",w),g.removeEventListener("pointerleave",k),window.removeEventListener("blur",w),window.removeEventListener("focus",y)}}},[m,a.isClosePausedRef]);const p=v.useCallback(({tabbingDirection:g})=>{const w=s().map(y=>{const _=y.ref.current,k=[_,...Lb(_)];return g==="forwards"?k:k.reverse()});return(g==="forwards"?w.reverse():w).flat()},[s]);return v.useEffect(()=>{const g=f.current;if(g){const x=w=>{const y=w.altKey||w.ctrlKey||w.metaKey;if(w.key==="Tab"&&!y){const A=document.activeElement,R=w.shiftKey;if(w.target===g&&R){var k;(k=u.current)===null||k===void 0||k.focus();return}const U=p({tabbingDirection:R?"backwards":"forwards"}),W=U.findIndex(Y=>Y===A);if(Mc(U.slice(W+1)))w.preventDefault();else{var N,S;R?(N=u.current)===null||N===void 0||N.focus():(S=c.current)===null||S===void 0||S.focus()}}};return g.addEventListener("keydown",x),()=>g.removeEventListener("keydown",x)}},[s,p]),v.createElement(TS,{ref:l,role:"region","aria-label":i.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:m?void 0:"none"}},m&&v.createElement(h1,{ref:u,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"forwards"});Mc(g)}}),v.createElement(Jd.Slot,{scope:r},v.createElement(Ie.ol,de({tabIndex:-1},o,{ref:d}))),m&&v.createElement(h1,{ref:c,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"backwards"});Mc(g)}}))}),_b="ToastFocusProxy",h1=v.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...i}=e,o=ku(_b,r);return v.createElement(gd,de({"aria-hidden":!0,tabIndex:0},i,{ref:t,style:{position:"fixed"},onFocus:a=>{var s;const l=a.relatedTarget;!((s=o.viewport)!==null&&s!==void 0&&s.contains(l))&&n()}}))}),$u="Toast",Sb="toast.swipeStart",Tb="toast.swipeMove",Cb="toast.swipeCancel",Ab="toast.swipeEnd",Rb=v.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:i,onOpenChange:o,...a}=e,[s=!0,l]=lo({prop:n,defaultProp:i,onChange:o});return v.createElement(Ei,{present:r||s},v.createElement(O2,de({open:s},a,{ref:t,onClose:()=>l(!1),onPause:Dt(e.onPause),onResume:Dt(e.onResume),onSwipeStart:Ee(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ee(e.onSwipeMove,u=>{const{x:c,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:Ee(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ee(e.onSwipeEnd,u=>{const{x:c,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),l(!1)})})))}),[Ob,Fb]=A2($u,{onClose(){}}),O2=v.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:i,open:o,onClose:a,onEscapeKeyDown:s,onPause:l,onResume:u,onSwipeStart:c,onSwipeMove:f,onSwipeCancel:d,onSwipeEnd:h,...m}=e,p=ku($u,r),[g,x]=v.useState(null),w=He(t,Y=>x(Y)),y=v.useRef(null),_=v.useRef(null),k=i||p.duration,N=v.useRef(0),S=v.useRef(k),A=v.useRef(0),{onToastAdd:R,onToastRemove:L}=p,V=Dt(()=>{var Y;(g==null?void 0:g.contains(document.activeElement))&&((Y=p.viewport)===null||Y===void 0||Y.focus()),a()}),U=v.useCallback(Y=>{!Y||Y===1/0||(window.clearTimeout(A.current),N.current=new Date().getTime(),A.current=window.setTimeout(V,Y))},[V]);v.useEffect(()=>{const Y=p.viewport;if(Y){const re=()=>{U(S.current),u==null||u()},ye=()=>{const ge=new Date().getTime()-N.current;S.current=S.current-ge,window.clearTimeout(A.current),l==null||l()};return Y.addEventListener(t0,ye),Y.addEventListener(r0,re),()=>{Y.removeEventListener(t0,ye),Y.removeEventListener(r0,re)}}},[p.viewport,k,l,u,U]),v.useEffect(()=>{o&&!p.isClosePausedRef.current&&U(k)},[o,k,p.isClosePausedRef,U]),v.useEffect(()=>(R(),()=>L()),[R,L]);const W=v.useMemo(()=>g?P2(g):null,[g]);return p.viewport?v.createElement(v.Fragment,null,W&&v.createElement(Db,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0},W),v.createElement(Ob,{scope:r,onClose:V},Jr.createPortal(v.createElement(Jd.ItemSlot,{scope:r},v.createElement(SS,{asChild:!0,onEscapeKeyDown:Ee(s,()=>{p.isFocusedToastEscapeKeyDownRef.current||V(),p.isFocusedToastEscapeKeyDownRef.current=!1})},v.createElement(Ie.li,de({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":p.swipeDirection},m,{ref:w,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Ee(e.onKeyDown,Y=>{Y.key==="Escape"&&(s==null||s(Y.nativeEvent),Y.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,V()))}),onPointerDown:Ee(e.onPointerDown,Y=>{Y.button===0&&(y.current={x:Y.clientX,y:Y.clientY})}),onPointerMove:Ee(e.onPointerMove,Y=>{if(!y.current)return;const re=Y.clientX-y.current.x,ye=Y.clientY-y.current.y,ge=!!_.current,Se=["left","right"].includes(p.swipeDirection),ie=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,we=Se?ie(0,re):0,Q=Se?0:ie(0,ye),F=Y.pointerType==="touch"?10:2,M={x:we,y:Q},b={originalEvent:Y,delta:M};ge?(_.current=M,Bs(Tb,f,b,{discrete:!1})):p1(M,p.swipeDirection,F)?(_.current=M,Bs(Sb,c,b,{discrete:!1}),Y.target.setPointerCapture(Y.pointerId)):(Math.abs(re)>F||Math.abs(ye)>F)&&(y.current=null)}),onPointerUp:Ee(e.onPointerUp,Y=>{const re=_.current,ye=Y.target;if(ye.hasPointerCapture(Y.pointerId)&&ye.releasePointerCapture(Y.pointerId),_.current=null,y.current=null,re){const ge=Y.currentTarget,Se={originalEvent:Y,delta:re};p1(re,p.swipeDirection,p.swipeThreshold)?Bs(Ab,h,Se,{discrete:!0}):Bs(Cb,d,Se,{discrete:!0}),ge.addEventListener("click",ie=>ie.preventDefault(),{once:!0})}})})))),p.viewport))):null});O2.propTypes={type(e){if(e.type&&!["foreground","background"].includes(e.type)){const t=`Invalid prop \`type\` supplied to \`${$u}\`. Expected \`foreground | background\`.`;return new Error(t)}return null}};const Db=e=>{const{__scopeToast:t,children:r,...n}=e,i=ku($u,t),[o,a]=v.useState(!1),[s,l]=v.useState(!1);return Nb(()=>a(!0)),v.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),s?null:v.createElement(du,{asChild:!0},v.createElement(gd,n,o&&v.createElement(v.Fragment,null,i.label," ",r)))},Pb=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return v.createElement(Ie.div,de({},n,{ref:t}))}),Ib=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return v.createElement(Ie.div,de({},n,{ref:t}))}),bb="ToastAction",kb=v.forwardRef((e,t)=>{const{altText:r,...n}=e;return r?v.createElement(D2,{altText:r,asChild:!0},v.createElement(F2,de({},n,{ref:t}))):null});kb.propTypes={altText(e){return e.altText?null:new Error(`Missing prop \`altText\` expected on \`${bb}\``)}};const $b="ToastClose",F2=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,i=Fb($b,r);return v.createElement(D2,{asChild:!0},v.createElement(Ie.button,de({type:"button"},n,{ref:t,onClick:Ee(e.onClick,i.onClose)})))}),D2=v.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...i}=e;return v.createElement(Ie.div,de({"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0},i,{ref:t}))});function P2(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),Mb(n)){const i=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!i)if(o){const a=n.dataset.radixToastAnnounceAlt;a&&t.push(a)}else t.push(...P2(n))}}),t}function Bs(e,t,r,{discrete:n}){const i=r.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?ud(i,o):i.dispatchEvent(o)}const p1=(e,t,r=0)=>{const n=Math.abs(e.x),i=Math.abs(e.y),o=n>i;return t==="left"||t==="right"?o&&n>r:!o&&i>r};function Nb(e=()=>{}){const t=Dt(e);xt(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function Mb(e){return e.nodeType===e.ELEMENT_NODE}function Lb(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Mc(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}const Bb=R2,Ub=Eb,Hb=Rb,Vb=Pb,Wb=Ib,zb=F2,I2=({title:e,titleId:t,...r})=>Z("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,...r,children:Z("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),Gb=({title:e,titleId:t,...r})=>Te("svg",{viewBox:"0 0 18 18",width:18,height:18,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...r,children:[e?Z("title",{id:t,children:e}):null,Z("path",{d:"M9 16.5a7.5 7.5 0 1 0 0-15 7.5 7.5 0 0 0 0 15ZM11.25 6.75l-4.5 4.5M6.75 6.75l4.5 4.5",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]}),jb=({title:e,titleId:t,...r})=>Te("svg",{viewBox:"0 0 24 24",width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...r,children:[e?Z("title",{id:t,children:e}):null,Z("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10ZM12 16v-4M12 8h.01",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]}),Xb=({title:e,titleId:t,...r})=>Te("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...r,children:[e?Z("title",{id:t,children:e}):null,Z("path",{d:"M16.5 8.31V9a7.5 7.5 0 1 1-4.447-6.855",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),Z("path",{d:"M16.5 3 9 10.508l-2.25-2.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]}),Kb=({title:e,titleId:t,...r})=>Te("svg",{viewBox:"0 0 18 18",width:18,height:18,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...r,children:[e?Z("title",{id:t,children:e}):null,Z("path",{d:"M7.718 2.895 1.366 13.5a1.5 1.5 0 0 0 1.282 2.25h12.705a1.5 1.5 0 0 0 1.283-2.25L10.283 2.895a1.5 1.5 0 0 0-2.565 0v0ZM9 6.75v3M9 12.75h.008",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]}),Yb=({toast:e,open:t,setOpen:r})=>Te(Bb,{children:[Te(Hb,{open:t,onOpenChange:n=>{e.preventClose||r(n)},className:bt("z-50 fixed bottom-4 md:left-1/2 md:-translate-x-[50%] inset-x-4 w-auto shadow-lg md:max-w-[658px] duration-300","radix-state-open:animate-fade-in","radix-state-closed:animate-toast-hide","radix-swipe-end:animate-toast-swipe-out","translate-x-radix-toast-swipe-move-x","radix-swipe-cancel:translate-x-0 radix-swipe-cancel:duration-200 radix-swipe-cancel:ease-[ease]","px-[40px] md:px-[58px] py-6 flex flex-col border rounded-[4px]",{"bg-green-100 text-green-600 border-green-600":e.status==="success","bg-red-200 text-red-600 border-red-600":e.status==="error","bg-blue-100 text-blue-700 border-blue-600":e.status==="info","bg-orange-200 text-orange-600 border-orange-600":e.status==="warning"},{"h-[72px]":!e.description}),children:[e.status==="success"?Z(Xb,{className:"absolute left-[8px] md:left-[25px] top-[25px]"}):e.status==="warning"?Z(Kb,{className:"absolute left-[8px] md:left-[25px] top-[25px]"}):e.status==="error"?Z(Gb,{className:"absolute left-[8px] md:left-[25px] top-[25px]"}):Z(jb,{className:"absolute left-[8px] md:left-[25px] top-[25px]"}),Z(Vb,{className:"text-grey-900 font-bold text-sm",children:e.title}),e.description&&Z(Wb,{className:"mt-2 text-[10px] md:text-xs text-grey-800",children:e.description}),Z(zb,{className:"absolute top-7 right-5 md:right-7",children:Z(I2,{className:"w-4 h-4 text-grey-900"})})]}),Z(Ub,{})]});function qb(e){const[t,r]=v.useState(e),n=t==="dark"?"light":"dark";return v.useEffect(()=>{const i=window.document.documentElement;i.classList.remove(n),i.classList.add(t)},[t,n]),[n,r]}const b2="Dialog",[k2,Wk]=on(b2),[Qb,$r]=k2(b2),Zb=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:o,modal:a=!0}=e,s=v.useRef(null),l=v.useRef(null),[u=!1,c]=lo({prop:n,defaultProp:i,onChange:o});return v.createElement(Qb,{scope:t,triggerRef:s,contentRef:l,contentId:Xr(),titleId:Xr(),descriptionId:Xr(),open:u,onOpenChange:c,onOpenToggle:v.useCallback(()=>c(f=>!f),[c]),modal:a},r)},Jb="DialogTrigger",ek=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=$r(Jb,r),o=He(t,i.triggerRef);return v.createElement(Ie.button,de({type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":eh(i.open)},n,{ref:o,onClick:Ee(e.onClick,i.onOpenToggle)}))}),$2="DialogPortal",[tk,N2]=k2($2,{forceMount:void 0}),rk=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:i}=e,o=$r($2,t);return v.createElement(tk,{scope:t,forceMount:r},v.Children.map(n,a=>v.createElement(Ei,{present:r||o.open},v.createElement(du,{asChild:!0,container:i},a))))},n0="DialogOverlay",nk=v.forwardRef((e,t)=>{const r=N2(n0,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=$r(n0,e.__scopeDialog);return o.modal?v.createElement(Ei,{present:n||o.open},v.createElement(ik,de({},i,{ref:t}))):null}),ik=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=$r(n0,r);return v.createElement(vd,{as:ii,allowPinchZoom:!0,shards:[i.contentRef]},v.createElement(Ie.div,de({"data-state":eh(i.open)},n,{ref:t,style:{pointerEvents:"auto",...n.style}})))}),Ha="DialogContent",ok=v.forwardRef((e,t)=>{const r=N2(Ha,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=$r(Ha,e.__scopeDialog);return v.createElement(Ei,{present:n||o.open},o.modal?v.createElement(ak,de({},i,{ref:t})):v.createElement(sk,de({},i,{ref:t})))}),ak=v.forwardRef((e,t)=>{const r=$r(Ha,e.__scopeDialog),n=v.useRef(null),i=He(t,r.contentRef,n);return v.useEffect(()=>{const o=n.current;if(o)return md(o)},[]),v.createElement(M2,de({},e,{ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ee(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=r.triggerRef.current)===null||a===void 0||a.focus()}),onPointerDownOutside:Ee(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&o.preventDefault()}),onFocusOutside:Ee(e.onFocusOutside,o=>o.preventDefault())}))}),sk=v.forwardRef((e,t)=>{const r=$r(Ha,e.__scopeDialog),n=v.useRef(!1);return v.createElement(M2,de({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o;if((o=e.onCloseAutoFocus)===null||o===void 0||o.call(e,i),!i.defaultPrevented){var a;n.current||(a=r.triggerRef.current)===null||a===void 0||a.focus(),i.preventDefault()}n.current=!1},onInteractOutside:i=>{var o,a;(o=e.onInteractOutside)===null||o===void 0||o.call(e,i),i.defaultPrevented||(n.current=!0);const s=i.target;((a=r.triggerRef.current)===null||a===void 0?void 0:a.contains(s))&&i.preventDefault()}}))}),M2=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:o,...a}=e,s=$r(Ha,r),l=v.useRef(null),u=He(t,l);return cd(),v.createElement(v.Fragment,null,v.createElement(fd,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:o},v.createElement(lu,de({role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":eh(s.open)},a,{ref:u,onDismiss:()=>s.onOpenChange(!1)}))),!1)}),lk="DialogTitle",uk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=$r(lk,r);return v.createElement(Ie.h2,de({id:i.titleId},n,{ref:t}))}),ck="DialogClose",fk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=$r(ck,r);return v.createElement(Ie.button,de({type:"button"},n,{ref:t,onClick:Ee(e.onClick,()=>i.onOpenChange(!1))}))});function eh(e){return e?"open":"closed"}const dk=Zb,hk=ek,pk=rk,gk=nk,mk=ok,vk=uk,xk=fk,wk=new Date,yk=50,i0=30;function Ek(e,t){try{const r=e.hasOwnProperty("index")?"index":e.hasOwnProperty("Index")?"Index":null,n=r?e[r]:null,i=e[t],o=typeof i,s=(i==null?void 0:i.toString().replace(/[^0-9]/g,"")).length>=4&&(Vd(t)||t.toLowerCase()==="index"||n&&n&&typeof n=="string"&&(n.toLowerCase().includes("date")||n.toLowerCase().includes("day")||n.toLowerCase().includes("time")||n.toLowerCase().includes("timestamp")||n.toLowerCase().includes("year")||n.toLowerCase().includes("month")||n.toLowerCase().includes("week")||n.toLowerCase().includes("hour")||n.toLowerCase().includes("minute")));if(o==="string"&&i.startsWith("http"))return(i==null?void 0:i.toString().length)??0;if(s){if(typeof i=="string")return(i==null?void 0:i.toString().length)??0;try{const u=new Date(i);let c="";return u.getUTCHours()===0&&u.getUTCMinutes()===0&&u.getUTCSeconds()===0&&u.getMilliseconds()===0?c=u.toISOString().split("T")[0]:(c=u.toISOString(),c=c.split("T")[0]+" "+c.split("T")[1].split(".")[0]),(c==null?void 0:c.toString().length)??0}catch{return(i==null?void 0:i.toString().length)??0}}return(i==null?void 0:i.toString().length)??0}catch{return 0}}const o0=["csv","xlsx","png"];function _k({data:e,columns:t,title:r,initialTheme:n,cmd:i=""}){const[o,a]=jo("exportType",o0[0]),[s,l]=qb(n),[u,c]=v.useState(s==="dark"),f=T=>{l(s),c(T)},[d,h]=jo("rowsPerPage",i0,l2),[m,p]=jo("advanced",!1),[g,x]=jo("colors",!1),[w,y]=v.useState([]),[_,k]=v.useState(""),[N,S]=jo("fontSize","1"),[A,R]=v.useState(!1),L=t.reduce((T,B,H)=>(T[B]=H{const K=Math.max(...T.map(ve=>Ek(ve,B)),H.length+8);return Math.min(200,K*12)},Y=v.useMemo(()=>[...t.map((T,B)=>({accessorKey:T,id:T,header:T,size:W(e,T,T),footer:T,cell:({row:H})=>{var je;const q=H.original.hasOwnProperty("index")?"index":H.original.hasOwnProperty("Index")?"Index":t[0],ee=q?H.original[q]:null,K=H.original[T],ve=typeof K,De=(K==null?void 0:K.toString().replace(/[^0-9]/g,"")).length>=4&&(Vd(T)||T.toLowerCase()==="index"||ee&&typeof ee=="string"&&(ee.toLowerCase().includes("date")||ee.toLowerCase().includes("time")||ee.toLowerCase().includes("timestamp")||ee.toLowerCase().includes("year")));if(ve==="string"&&K.startsWith("http"))return Z("a",{className:"_hyper-link",href:K,target:"_blank",rel:"noreferrer",children:K.length>25?K.substring(0,25)+"...":K});if(De){if(typeof K=="string"){const Re=K.split("T")[0],ce=(je=K.split("T")[1])==null?void 0:je.split(".")[0];return ce==="00:00:00"?Z("p",{children:Re}):Te("p",{children:[Re," ",ce]})}if(typeof K=="number"&&K<1e12)return Z("p",{children:K});try{const Re=new Date(K);let ce="";return Re.getUTCHours()===0&&Re.getUTCMinutes()===0&&Re.getUTCSeconds()===0&&Re.getMilliseconds()===0?ce=Re.toISOString().split("T")[0]:(ce=Re.toISOString(),ce=ce.split("T")[0]+" "+ce.split("T")[1].split(".")[0]),Z("p",{children:ce})}catch{return Z("p",{children:K})}}if(ve==="number"){const Re=XD(K);return Z("p",{className:bt("whitespace-nowrap",{"text-black dark:text-white":!g,"text-[#16A34A]":K>0&&g,"text-[#F87171]":K<0&&g,"text-[#404040]":K===0&&g}),children:K!==0?K>0?`${Re}`:`${Re}`:Re})}else if(ve==="string")return Z("div",{dangerouslySetInnerHTML:{__html:gb(K)}});return Z("p",{children:K})}}))],[m,g]),[re,ye]=v.useState(!1),[ge,Se]=v.useState(Y.map(T=>T.id)),ie=()=>Se(t.map(T=>T.id)),we=v.useMemo(()=>{const T=ge.map(H=>H),B=Y.map(H=>H.id);return!KD(T,B)},[ge,Y]),Q=uS({data:e,columns:Y,getCoreRowModel:Z_(),getSortedRowModel:nS(),getFilteredRowModel:rS(),getPaginationRowModel:oS(),columnResizeMode:"onChange",onColumnVisibilityChange:U,onColumnOrderChange:Se,onSortingChange:y,onGlobalFilterChange:k,globalFilterFn:YD,state:{sorting:w,globalFilter:_,columnOrder:ge,columnVisibility:V},initialState:{pagination:{pageIndex:0,pageSize:typeof d=="string"?d.includes("All")?e.length:parseInt(d):d}}}),F=v.useRef(null),{rows:M}=Q.getRowModel(),b=Q.getVisibleFlatColumns();return Te($1,{children:[Z(Yb,{toast:{id:"max-columns",title:"Max 12 columns are visible by default",description:"You can change this by clicking on advanced and then top right 'Filter' button",status:"info"},open:A,setOpen:R}),Te("div",{ref:F,className:bt("overflow-x-hidden h-screen"),children:[Te("div",{className:"relative p-4",id:"table",children:[Z("div",{className:"absolute -inset-0.5 bg-gradient-to-r rounded-md blur-md from-[#072e49]/30 via-[#0d345f]/30 to-[#0d3362]/30"}),Te("div",{className:"border border-grey-500/60 dark:border-grey-200/60 bg-white dark:bg-grey-900 rounded overflow-hidden relative z-20",children:[Te("div",{className:"_header relative gap-4 py-2 text-center text-xs flex items-center justify-between px-4 text-white",style:{fontSize:`${Number(N)*100}%`},children:[Z("div",{className:"w-1/3",children:Z("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"40",fill:"none",viewBox:"0 0 64 40",children:Z("path",{fill:"#fff",d:"M61.283 3.965H33.608v27.757h25.699V19.826H37.561v-3.965H63.26V3.965h-1.977zM39.538 23.792h15.815v3.965H37.561v-3.965h1.977zM59.306 9.913v1.983H37.561V7.931h21.745v1.982zM33.606 0h-3.954v3.965H33.606V0zM25.7 3.966H0V15.86h25.7v3.965H3.953v11.896h25.7V3.966h-3.955zm0 21.808v1.983H7.907v-3.965h17.791v1.982zm0-15.86v1.982H3.953V7.931h21.745v1.982zM37.039 35.693v2.952l-.246-.246-.245-.245-.245-.247-.245-.246-.246-.246-.245-.245-.245-.247-.247-.246-.245-.246-.245-.246-.245-.246-.246-.246h-.49v3.936h.49v-3.198l.246.246.245.246.245.246.245.246.246.246.246.246.245.247.246.245.245.246.245.247.245.246.246.245.245.246h.245v-3.936h-.49zM44.938 37.17h-.491v-1.477h-2.944v3.937h3.93v-2.46h-.495zm-2.944-.246v-.739h1.962v.984h-1.962v-.245zm2.944.984v1.23h-2.944V37.66h2.944v.247zM52.835 37.17h-.49v-1.477h-2.946v3.937h3.925v-2.46h-.489zm-2.944-.246v-.739h1.963v.984h-1.965l.002-.245zm2.944.984v1.23H49.89V37.66h2.946v.247zM29.174 35.693H25.739v3.936H29.663v-.491H26.229v-.984h2.943v-.493H26.229v-1.476h3.434v-.492h-.489zM13.37 35.693H9.934v3.937h3.925v-3.937h-.49zm0 .738v2.709h-2.945v-2.955h2.943l.001.246zM21.276 35.693h-3.435v3.937h.491v-1.476h3.434v-2.461h-.49zm0 .738v1.23h-2.944v-1.476h2.944v.246z"})})}),Z("p",{className:"font-bold w-1/3 flex flex-col gap-0.5 items-center",children:r}),Te("p",{className:"w-1/3 text-right text-xs",children:[new Intl.DateTimeFormat("en-GB",{dateStyle:"full",timeStyle:"long"}).format(wk).replace(/:\d\d /," "),Z("br",{}),Z("span",{className:"text-grey-400",children:i})]})]}),Z("div",{className:"overflow-auto max-h-[calc(100vh-160px)] smh:max-h-[calc(100vh-95px)]",children:Te("table",{className:"text-sm relative",style:{fontSize:`${Number(N)*100}%`},children:[Z("thead",{className:"sticky top-0 bg-white dark:bg-grey-900",children:Q.getHeaderGroups().map((T,B)=>Z("tr",{children:T.headers.map((H,q)=>Z(n8,{setLockFirstColumn:ye,lockFirstColumn:re,idx:q,advanced:m,header:H,table:Q},H.id))},T.id))}),Z("tbody",{children:Q.getRowModel().rows.map((T,B)=>Z("tr",{className:"!h-[64px] border-b border-grey-400",children:T.getVisibleCells().map((H,q)=>Z("td",{className:bt("whitespace-normal p-4 text-black dark:text-white",{"bg-white dark:bg-grey-850":B%2===0,"bg-grey-100 dark:bg-[#202020]":B%2===1,"sticky left-0 z-10":q===0&&re}),style:{width:H.column.getSize()},children:If(H.column.columnDef.cell,H.getContext())},H.id))},T.id))}),M.length>30&&b.length>4&&Z("tfoot",{children:Q.getFooterGroups().map(T=>Z("tr",{children:T.headers.map(B=>Z("th",{colSpan:B.colSpan,className:"text-grey-500 bg-grey-100 dark:bg-grey-850 font-normal text-left text-sm h-10 p-4",style:{width:B.getSize()},children:B.isPlaceholder?null:If(B.column.columnDef.footer,B.getContext())},B.id))},T.id))})]})})]})]}),Te("div",{className:"smh:hidden flex max-h-[68px] overflow-x-auto bg-white/70 dark:bg-grey-900/70 backdrop-filter backdrop-blur z-20 bottom-0 left-0 w-full gap-10 justify-between py-4 px-4 text-sm",children:[Te("div",{className:"flex items-center gap-10",children:[Te(dk,{children:[Z(hk,{className:"_btn",children:"Settings"}),Te(pk,{children:[Z(gk,{className:"_modal-overlay"}),Te(mk,{className:"_modal",children:[Z(xk,{className:"absolute top-[40px] right-[46px] text-grey-200 hover:text-white rounded-[4px] focus:outline focus:outline-2 focus:outline-grey-500",children:Z(I2,{className:"w-6 h-6"})}),Z(vk,{className:"uppercase font-bold tracking-widest",children:"Settings"}),Te("div",{className:"grid grid-cols-2 gap-4 mt-10 text-sm",children:[we&&Z("button",{onClick:()=>ie(),className:"_btn h-9",children:"Reset Order"}),Z(Vi,{labelType:"row",value:u?"light":"dark",onChange:T=>{f(T!=="dark")},label:"Theme",placeholder:"Select theme",groups:[{label:"Theme",items:[{label:"Dark",value:"dark"},{label:"Light",value:"light"}]}]}),Z(Vi,{labelType:"row",value:o,onChange:T=>{a(T)},label:"Export type",placeholder:"Select export type",groups:[{label:"Export type",items:o0.map(T=>({label:T,value:T}))}]}),Z(Vi,{labelType:"row",value:N,onChange:S,label:"Font size",placeholder:"Select font size",groups:[{label:"Font size",items:[{label:"50%",value:"0.5"},{label:"75%",value:"0.75"},{label:"100%",value:"1"},{label:"125%",value:"1.25"},{label:"150%",value:"1.5"},{label:"175%",value:"1.75"},{label:"200%",value:"2"}]}]}),Z(l1,{table:Q,label:"Filter"}),Z("div",{className:"flex gap-2 items-center",children:Z(Vi,{labelType:"row",value:m?"advanced":"simple",onChange:T=>{p(T==="advanced")},label:"Type",placeholder:"Select type",groups:[{label:"Type",items:[{label:"Simple",value:"simple"},{label:"Advanced",value:"advanced"}]}]})}),Te("div",{className:"flex gap-2 items-center",children:[Z("label",{htmlFor:"colors",children:"Colors"}),Z("input",{id:"colors",type:"checkbox",checked:g,onChange:()=>x(!g)})]})]})]})]})]}),Z(l1,{onlyIconTrigger:!0,table:Q,label:""})]}),Z(i8,{currentPage:d,setCurrentPage:h,table:Q}),Z(o8,{setType:a,type:o,columns:t,data:e})]})]})]})}function L2(e){let t=null;return()=>(t==null&&(t=e()),t)}function Sk(e,t){return e.filter(r=>r!==t)}function Tk(e,t){const r=new Set,n=o=>r.add(o);e.forEach(n),t.forEach(n);const i=[];return r.forEach(o=>i.push(o)),i}class Ck{enter(t){const r=this.entered.length,n=i=>this.isNodeInDocument(i)&&(!i.contains||i.contains(t));return this.entered=Tk(this.entered.filter(n),[t]),r===0&&this.entered.length>0}leave(t){const r=this.entered.length;return this.entered=Sk(this.entered.filter(this.isNodeInDocument),t),r>0&&this.entered.length===0}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class Ak{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(t=>{Object.defineProperty(this.item,t,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null}})})}loadDataTransfer(t){if(t){const r={};Object.keys(this.config.exposeProperties).forEach(n=>{const i=this.config.exposeProperties[n];i!=null&&(r[n]={value:i(t,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,r)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(t,r){return r===t.getSourceId()}endDrag(){}constructor(t){this.config=t,this.item={},this.initializeExposedProperties()}}const B2="__NATIVE_FILE__",U2="__NATIVE_URL__",H2="__NATIVE_TEXT__",V2="__NATIVE_HTML__",g1=Object.freeze(Object.defineProperty({__proto__:null,FILE:B2,HTML:V2,TEXT:H2,URL:U2},Symbol.toStringTag,{value:"Module"}));function Lc(e,t,r){const n=t.reduce((i,o)=>i||e.getData(o),"");return n??r}const a0={[B2]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[V2]:{exposeProperties:{html:(e,t)=>Lc(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[U2]:{exposeProperties:{urls:(e,t)=>Lc(e,t,"").split(` `),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[H2]:{exposeProperties:{text:(e,t)=>Lc(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function Rk(e,t){const r=a0[e];if(!r)throw new Error(`native type ${e} has no configuration`);const n=new Ak(r);return n.loadDataTransfer(t),n}function Bc(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(a0).filter(r=>{const n=a0[r];return n!=null&&n.matchesTypes?n.matchesTypes.some(i=>t.indexOf(i)>-1):!1})[0]||null}const Ok=L2(()=>/firefox/i.test(navigator.userAgent)),W2=L2(()=>!!window.safari);class m1{interpolate(t){const{xs:r,ys:n,c1s:i,c2s:o,c3s:a}=this;let s=r.length-1;if(t===r[s])return n[s];let l=0,u=a.length-1,c;for(;l<=u;){c=Math.floor(.5*(l+u));const h=r[c];if(ht)u=c-1;else return n[c]}s=Math.max(0,u);const f=t-r[s],d=f*f;return n[s]+i[s]*f+o[s]*d+a[s]*f*d}constructor(t,r){const{length:n}=t,i=[];for(let h=0;ht[h]{let N=new m1([0,.5,1],[l.y,l.y/c*m,l.y+m-c]).interpolate(d);return W2()&&o&&(N+=(window.devicePixelRatio-1)*m),N},g=()=>new m1([0,.5,1],[l.x,l.x/u*h,l.x+h-u]).interpolate(f),{offsetX:x,offsetY:w}=i,y=x===0||x,_=w===0||w;return{x:y?x:g(),y:_?w:p()}}class bk{get window(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}get document(){var t;return!((t=this.globalContext)===null||t===void 0)&&t.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var t;return((t=this.optionsArgs)===null||t===void 0?void 0:t.rootElement)||this.window}constructor(t,r){this.ownerDocument=null,this.globalContext=t,this.optionsArgs=r}}function kk(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v1(e){for(var t=1;t{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDragSource(t,r,n){this.sourceNodes.set(t,r),this.sourceNodeOptions.set(t,n);const i=a=>this.handleDragStart(a,t),o=a=>this.handleSelectStart(a);return r.setAttribute("draggable","true"),r.addEventListener("dragstart",i),r.addEventListener("selectstart",o),()=>{this.sourceNodes.delete(t),this.sourceNodeOptions.delete(t),r.removeEventListener("dragstart",i),r.removeEventListener("selectstart",o),r.setAttribute("draggable","false")}}connectDropTarget(t,r){const n=a=>this.handleDragEnter(a,t),i=a=>this.handleDragOver(a,t),o=a=>this.handleDrop(a,t);return r.addEventListener("dragenter",n),r.addEventListener("dragover",i),r.addEventListener("drop",o),()=>{r.removeEventListener("dragenter",n),r.removeEventListener("dragover",i),r.removeEventListener("drop",o)}}addEventListeners(t){t.addEventListener&&(t.addEventListener("dragstart",this.handleTopDragStart),t.addEventListener("dragstart",this.handleTopDragStartCapture,!0),t.addEventListener("dragend",this.handleTopDragEndCapture,!0),t.addEventListener("dragenter",this.handleTopDragEnter),t.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.addEventListener("dragover",this.handleTopDragOver),t.addEventListener("dragover",this.handleTopDragOverCapture,!0),t.addEventListener("drop",this.handleTopDrop),t.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(t){t.removeEventListener&&(t.removeEventListener("dragstart",this.handleTopDragStart),t.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),t.removeEventListener("dragend",this.handleTopDragEndCapture,!0),t.removeEventListener("dragenter",this.handleTopDragEnter),t.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.removeEventListener("dragover",this.handleTopDragOver),t.removeEventListener("dragover",this.handleTopDragOverCapture,!0),t.removeEventListener("drop",this.handleTopDrop),t.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const t=this.monitor.getSourceId(),r=this.sourceNodeOptions.get(t);return v1({dropEffect:this.altKeyPressed?"copy":"move"},r||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const t=this.monitor.getSourceId(),r=this.sourcePreviewNodeOptions.get(t);return v1({anchorX:.5,anchorY:.5,captureDraggingState:!1},r||{})}isDraggingNativeItem(){const t=this.monitor.getItemType();return Object.keys(g1).some(r=>g1[r]===t)}beginDragNativeItem(t,r){this.clearCurrentDragSourceNode(),this.currentNativeSource=Rk(t,r),this.currentNativeHandle=this.registry.addSource(t,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(t){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=t;const r=1e3;this.mouseMoveTimeoutTimer=setTimeout(()=>{var n;return(n=this.rootElement)===null||n===void 0?void 0:n.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},r)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var t;(t=this.window)===null||t===void 0||t.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(t,r){t.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(r))}handleDragEnter(t,r){this.dragEnterTargetIds.unshift(r)}handleDragOver(t,r){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(r)}handleDrop(t,r){this.dropTargetIds.unshift(r)}constructor(t,r,n){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=i=>{const o=this.sourceNodes.get(i);return o&&z2(o)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=i=>!!(i&&this.document&&this.document.body&&this.document.body.contains(i)),this.endDragIfSourceWasRemovedFromDOM=()=>{const i=this.currentDragSourceNode;i==null||this.isNodeInDocument(i)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=i=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(i||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=i=>{if(i.defaultPrevented)return;const{dragStartSourceIds:o}=this;this.dragStartSourceIds=null;const a=Us(i);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:a});const{dataTransfer:s}=i,l=Bc(s);if(this.monitor.isDragging()){if(s&&typeof s.setDragImage=="function"){const c=this.monitor.getSourceId(),f=this.sourceNodes.get(c),d=this.sourcePreviewNodes.get(c)||f;if(d){const{anchorX:h,anchorY:m,offsetX:p,offsetY:g}=this.getCurrentSourcePreviewNodeOptions(),y=Ik(f,d,a,{anchorX:h,anchorY:m},{offsetX:p,offsetY:g});s.setDragImage(d,y.x,y.y)}}try{s==null||s.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(i.target);const{captureDraggingState:u}=this.getCurrentSourcePreviewNodeOptions();u?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(l)this.beginDragNativeItem(l);else{if(s&&!s.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=i=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var o;(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}if(!this.enterLeaveCounter.enter(i.target)||this.monitor.isDragging())return;const{dataTransfer:s}=i,l=Bc(s);l&&this.beginDragNativeItem(l,s)},this.handleTopDragEnter=i=>{const{dragEnterTargetIds:o}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=i.altKey,o.length>0&&this.actions.hover(o,{clientOffset:Us(i)}),o.some(s=>this.monitor.canDropOnTarget(s))&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=i=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var o;(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}},this.handleTopDragOver=i=>{const{dragOverTargetIds:o}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}this.altKeyPressed=i.altKey,this.lastClientOffset=Us(i),this.scheduleHover(o),(o||[]).some(s=>this.monitor.canDropOnTarget(s))?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=i=>{this.isDraggingNativeItem()&&i.preventDefault(),this.enterLeaveCounter.leave(i.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=i=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var o;i.preventDefault(),(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else Bc(i.dataTransfer)&&i.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=i=>{const{dropTargetIds:o}=this;this.dropTargetIds=[],this.actions.hover(o,{clientOffset:Us(i)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=i=>{const o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))},this.options=new bk(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new Ck(this.isNodeInDocument)}}const Nk=function(t,r,n){return new $k(t,r,n)};function Mk(){const[e,t]=v.useState(null),[r,n]=v.useState("Interactive Table");v.useEffect(()=>{const a=setInterval(()=>{if(window.json_data){const s=JSON.parse(window.json_data);console.log(s),t(s),s.title&&typeof s.title=="string"&&n(s.title),clearInterval(a)}},100);return()=>clearInterval(a)},[]);const o=(a=>{var h;if(!a)return null;let s=(h=a.title)==null?void 0:h.replace(/|<\/b>/g,"").replace(/ /g,"_"),l=new Date().toISOString().slice(0,10).replace(/-/g,""),u=new Date().toISOString().slice(11,19).replace(/:/g,"");window.title=`openbb_${s}_${l}_${u}`;const c=a.columns;a.index;const d=a.data.map((m,p)=>{const g={};return m.forEach((x,w)=>{g[c[w]]=x||""}),g});return{columns:c,data:d}})(e);return Z("div",{className:"relative h-full bg-white dark:bg-black text-black dark:text-white",children:Z(mI,{backend:Nk,children:o&&Z(_k,{title:r,data:o.data,columns:o.columns,initialTheme:e.theme&&typeof e.theme=="string"&&e.theme==="dark"?"dark":"light",cmd:(e==null?void 0:e.command_location)??""})})})}cv.render(Z(nr.StrictMode,{children:Z(Mk,{})}),document.getElementById("root"));