@sl-material/sl-table-sheet 1.1.2-beta0 → 1.3.0-beta0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/sl-table-sheet.cjs.js +3 -3
- package/sl-table-sheet.es.js +15 -22
- package/sl-table-sheet.umd.umd.js +29 -29
package/package.json
CHANGED
package/sl-table-sheet.cjs.js
CHANGED
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
`),o.bookType=="fods"?c.push("</office:document>"):c.push("</office:document-content>"),c.join("")}}();function Sc(e,r){if(r.bookType=="fods")return u0(e,r);var t=_i(),a="",n=[],i=[];return a="mimetype",Te(t,a,"application/vnd.oasis.opendocument.spreadsheet"),a="content.xml",Te(t,a,u0(e,r)),n.push([a,"text/xml"]),i.push([a,"ContentFile"]),a="styles.xml",Te(t,a,x2(e,r)),n.push([a,"text/xml"]),i.push([a,"StylesFile"]),a="meta.xml",Te(t,a,Qe+uo()),n.push([a,"text/xml"]),i.push([a,"MetadataFile"]),a="manifest.rdf",Te(t,a,zl(i)),n.push([a,"application/rdf+xml"]),a="META-INF/manifest.xml",Te(t,a,Hl(n)),t}/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */function Ht(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function hi(e){return typeof TextDecoder<"u"?new TextDecoder().decode(e):Pe(yt(e))}function p2(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e):Rr(rt(e))}function m2(e,r){e:for(var t=0;t<=e.length-r.length;++t){for(var a=0;a<r.length;++a)if(e[t+a]!=r[a])continue e;return!0}return!1}function kt(e){var r=e.reduce(function(n,i){return n+i.length},0),t=new Uint8Array(r),a=0;return e.forEach(function(n){t.set(n,a),a+=n.length}),t}function d0(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>>24}function g2(e,r){for(var t=(e[r+15]&127)<<7|e[r+14]>>1,a=e[r+14]&1,n=r+13;n>=r;--n)a=a*256+e[n];return(e[r+15]&128?-a:a)*Math.pow(10,t-6176)}function v2(e,r,t){var a=Math.floor(t==0?0:Math.LOG10E*Math.log(Math.abs(t)))+6176-20,n=t/Math.pow(10,a-6176);e[r+15]|=a>>7,e[r+14]|=(a&127)<<1;for(var i=0;n>=1;++i,n/=256)e[r+i]=n&255;e[r+15]|=t>=0?0:128}function Ha(e,r){var t=r?r[0]:0,a=e[t]&127;e:if(e[t++]>=128&&(a|=(e[t]&127)<<7,e[t++]<128||(a|=(e[t]&127)<<14,e[t++]<128)||(a|=(e[t]&127)<<21,e[t++]<128)||(a+=(e[t]&127)*Math.pow(2,28),++t,e[t++]<128)||(a+=(e[t]&127)*Math.pow(2,35),++t,e[t++]<128)||(a+=(e[t]&127)*Math.pow(2,42),++t,e[t++]<128)))break e;return r&&(r[0]=t),a}function De(e){var r=new Uint8Array(7);r[0]=e&127;var t=1;e:if(e>127){if(r[t-1]|=128,r[t]=e>>7&127,++t,e<=16383||(r[t-1]|=128,r[t]=e>>14&127,++t,e<=2097151)||(r[t-1]|=128,r[t]=e>>21&127,++t,e<=268435455)||(r[t-1]|=128,r[t]=e/256>>>21&127,++t,e<=34359738367)||(r[t-1]|=128,r[t]=e/65536>>>21&127,++t,e<=4398046511103))break e;r[t-1]|=128,r[t]=e/16777216>>>21&127,++t}return r.slice(0,t)}function je(e){var r=0,t=e[r]&127;e:if(e[r++]>=128){if(t|=(e[r]&127)<<7,e[r++]<128||(t|=(e[r]&127)<<14,e[r++]<128)||(t|=(e[r]&127)<<21,e[r++]<128))break e;t|=(e[r]&127)<<28}return t}function Re(e){for(var r=[],t=[0];t[0]<e.length;){var a=t[0],n=Ha(e,t),i=n&7;n=Math.floor(n/8);var s=0,o;if(n==0)break;switch(i){case 0:{for(var c=t[0];e[t[0]++]>=128;);o=e.slice(c,t[0])}break;case 5:s=4,o=e.slice(t[0],t[0]+s),t[0]+=s;break;case 1:s=8,o=e.slice(t[0],t[0]+s),t[0]+=s;break;case 2:s=Ha(e,t),o=e.slice(t[0],t[0]+s),t[0]+=s;break;case 3:case 4:default:throw new Error("PB Type ".concat(i," for Field ").concat(n," at offset ").concat(a))}var f={data:o,type:i};r[n]==null?r[n]=[f]:r[n].push(f)}return r}function fr(e){var r=[];return e.forEach(function(t,a){t.forEach(function(n){n.data&&(r.push(De(a*8+n.type)),n.type==2&&r.push(De(n.data.length)),r.push(n.data))})}),kt(r)}function $i(e,r){return(e==null?void 0:e.map(function(t){return r(t.data)}))||[]}function Br(e){for(var r,t=[],a=[0];a[0]<e.length;){var n=Ha(e,a),i=Re(e.slice(a[0],a[0]+n));a[0]+=n;var s={id:je(i[1][0].data),messages:[]};i[2].forEach(function(o){var c=Re(o.data),f=je(c[3][0].data);s.messages.push({meta:c,data:e.slice(a[0],a[0]+f)}),a[0]+=f}),(r=i[3])!=null&&r[0]&&(s.merge=je(i[3][0].data)>>>0>0),t.push(s)}return t}function qt(e){var r=[];return e.forEach(function(t){var a=[];a[1]=[{data:De(t.id),type:0}],a[2]=[],t.merge!=null&&(a[3]=[{data:De(+!!t.merge),type:0}]);var n=[];t.messages.forEach(function(s){n.push(s.data),s.meta[3]=[{type:0,data:De(s.data.length)}],a[2].push({data:fr(s.meta),type:2})});var i=fr(a);r.push(De(i.length)),r.push(i),n.forEach(function(s){return r.push(s)})}),kt(r)}function _2(e,r){if(e!=0)throw new Error("Unexpected Snappy chunk type ".concat(e));for(var t=[0],a=Ha(r,t),n=[];t[0]<r.length;){var i=r[t[0]]&3;if(i==0){var s=r[t[0]++]>>2;if(s<60)++s;else{var o=s-59;s=r[t[0]],o>1&&(s|=r[t[0]+1]<<8),o>2&&(s|=r[t[0]+2]<<16),o>3&&(s|=r[t[0]+3]<<24),s>>>=0,s++,t[0]+=o}n.push(r.slice(t[0],t[0]+s)),t[0]+=s;continue}else{var c=0,f=0;if(i==1?(f=(r[t[0]]>>2&7)+4,c=(r[t[0]++]&224)<<3,c|=r[t[0]++]):(f=(r[t[0]++]>>2)+1,i==2?(c=r[t[0]]|r[t[0]+1]<<8,t[0]+=2):(c=(r[t[0]]|r[t[0]+1]<<8|r[t[0]+2]<<16|r[t[0]+3]<<24)>>>0,t[0]+=4)),n=[kt(n)],c==0)throw new Error("Invalid offset 0");if(c>n[0].length)throw new Error("Invalid offset beyond length");if(f>=c)for(n.push(n[0].slice(-c)),f-=c;f>=n[n.length-1].length;)n.push(n[n.length-1]),f-=n[n.length-1].length;n.push(n[0].slice(-c,-c+f))}}var l=kt(n);if(l.length!=a)throw new Error("Unexpected length: ".concat(l.length," != ").concat(a));return l}function Ur(e){for(var r=[],t=0;t<e.length;){var a=e[t++],n=e[t]|e[t+1]<<8|e[t+2]<<16;t+=3,r.push(_2(a,e.slice(t,t+n))),t+=n}if(t!==e.length)throw new Error("data is not a valid framed stream!");return kt(r)}function Jt(e){for(var r=[],t=0;t<e.length;){var a=Math.min(e.length-t,268435455),n=new Uint8Array(4);r.push(n);var i=De(a),s=i.length;r.push(i),a<=60?(s++,r.push(new Uint8Array([a-1<<2]))):a<=256?(s+=2,r.push(new Uint8Array([240,a-1&255]))):a<=65536?(s+=3,r.push(new Uint8Array([244,a-1&255,a-1>>8&255]))):a<=16777216?(s+=4,r.push(new Uint8Array([248,a-1&255,a-1>>8&255,a-1>>16&255]))):a<=4294967296&&(s+=5,r.push(new Uint8Array([252,a-1&255,a-1>>8&255,a-1>>16&255,a-1>>>24&255]))),r.push(e.slice(t,t+a)),s+=a,n[0]=0,n[1]=s&255,n[2]=s>>8&255,n[3]=s>>16&255,t+=a}return kt(r)}function w2(e,r,t,a){var n=Ht(e),i=n.getUint32(4,!0),s=(a>1?12:8)+d0(i&(a>1?3470:398))*4,o=-1,c=-1,f=NaN,l=new Date(2001,0,1);i&512&&(o=n.getUint32(s,!0),s+=4),s+=d0(i&(a>1?12288:4096))*4,i&16&&(c=n.getUint32(s,!0),s+=4),i&32&&(f=n.getFloat64(s,!0),s+=8),i&64&&(l.setTime(l.getTime()+n.getFloat64(s,!0)*1e3),s+=8);var h;switch(e[2]){case 0:break;case 2:h={t:"n",v:f};break;case 3:h={t:"s",v:r[c]};break;case 5:h={t:"d",v:l};break;case 6:h={t:"b",v:f>0};break;case 7:h={t:"n",v:f/86400};break;case 8:h={t:"e",v:0};break;case 9:if(o>-1)h={t:"s",v:t[o]};else if(c>-1)h={t:"s",v:r[c]};else if(!isNaN(f))h={t:"n",v:f};else throw new Error("Unsupported cell type ".concat(e.slice(0,4)));break;default:throw new Error("Unsupported cell type ".concat(e.slice(0,4)))}return h}function E2(e,r,t){var a=Ht(e),n=a.getUint32(8,!0),i=12,s=-1,o=-1,c=NaN,f=NaN,l=new Date(2001,0,1);n&1&&(c=g2(e,i),i+=16),n&2&&(f=a.getFloat64(i,!0),i+=8),n&4&&(l.setTime(l.getTime()+a.getFloat64(i,!0)*1e3),i+=8),n&8&&(o=a.getUint32(i,!0),i+=4),n&16&&(s=a.getUint32(i,!0),i+=4);var h;switch(e[1]){case 0:break;case 2:h={t:"n",v:c};break;case 3:h={t:"s",v:r[o]};break;case 5:h={t:"d",v:l};break;case 6:h={t:"b",v:f>0};break;case 7:h={t:"n",v:f/86400};break;case 8:h={t:"e",v:0};break;case 9:if(s>-1)h={t:"s",v:t[s]};else throw new Error("Unsupported cell type ".concat(e[1]," : ").concat(n&31," : ").concat(e.slice(0,4)));break;case 10:h={t:"n",v:c};break;default:throw new Error("Unsupported cell type ".concat(e[1]," : ").concat(n&31," : ").concat(e.slice(0,4)))}return h}function Kn(e,r){var t=new Uint8Array(32),a=Ht(t),n=12,i=0;switch(t[0]=5,e.t){case"n":t[1]=2,v2(t,n,e.v),i|=1,n+=16;break;case"b":t[1]=6,a.setFloat64(n,e.v?1:0,!0),i|=2,n+=8;break;case"s":if(r.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));t[1]=3,a.setUint32(n,r.indexOf(e.v),!0),i|=8,n+=4;break;default:throw"unsupported cell type "+e.t}return a.setUint32(8,i,!0),t.slice(0,n)}function Yn(e,r){var t=new Uint8Array(32),a=Ht(t),n=12,i=0;switch(t[0]=3,e.t){case"n":t[2]=2,a.setFloat64(n,e.v,!0),i|=32,n+=8;break;case"b":t[2]=6,a.setFloat64(n,e.v?1:0,!0),i|=32,n+=8;break;case"s":if(r.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));t[2]=3,a.setUint32(n,r.indexOf(e.v),!0),i|=16,n+=4;break;default:throw"unsupported cell type "+e.t}return a.setUint32(4,i,!0),t.slice(0,n)}function T2(e,r,t){switch(e[0]){case 0:case 1:case 2:case 3:return w2(e,r,t,e[0]);case 5:return E2(e,r,t);default:throw new Error("Unsupported payload version ".concat(e[0]))}}function xr(e){var r=Re(e);return Ha(r[1][0].data)}function x0(e,r){var t=Re(r.data),a=je(t[1][0].data),n=t[3],i=[];return(n||[]).forEach(function(s){var o=Re(s.data),c=je(o[1][0].data)>>>0;switch(a){case 1:i[c]=hi(o[3][0].data);break;case 8:{var f=e[xr(o[9][0].data)][0],l=Re(f.data),h=e[xr(l[1][0].data)][0],u=je(h.meta[1][0].data);if(u!=2001)throw new Error("2000 unexpected reference to ".concat(u));var x=Re(h.data);i[c]=x[3].map(function(p){return hi(p.data)}).join("")}break}}),i}function k2(e,r){var t,a,n,i,s,o,c,f,l,h,u,x,p,d,m=Re(e),E=je(m[1][0].data)>>>0,F=je(m[2][0].data)>>>0,v=((a=(t=m[8])==null?void 0:t[0])==null?void 0:a.data)&&je(m[8][0].data)>0||!1,b,N;if((i=(n=m[7])==null?void 0:n[0])!=null&&i.data&&r!=0)b=(o=(s=m[7])==null?void 0:s[0])==null?void 0:o.data,N=(f=(c=m[6])==null?void 0:c[0])==null?void 0:f.data;else if((h=(l=m[4])==null?void 0:l[0])!=null&&h.data&&r!=1)b=(x=(u=m[4])==null?void 0:u[0])==null?void 0:x.data,N=(d=(p=m[3])==null?void 0:p[0])==null?void 0:d.data;else throw"NUMBERS Tile missing ".concat(r," cell storage");for(var R=v?4:1,y=Ht(b),M=[],D=0;D<b.length/2;++D){var G=y.getUint16(D*2,!0);G<65535&&M.push([D,G])}if(M.length!=F)throw"Expected ".concat(F," cells, found ").concat(M.length);var z=[];for(D=0;D<M.length-1;++D)z[M[D][0]]=N.subarray(M[D][1]*R,M[D+1][1]*R);return M.length>=1&&(z[M[M.length-1][0]]=N.subarray(M[M.length-1][1]*R)),{R:E,cells:z}}function y2(e,r){var t,a=Re(r.data),n=(t=a==null?void 0:a[7])!=null&&t[0]?je(a[7][0].data)>>>0>0?1:0:-1,i=$i(a[5],function(s){return k2(s,n)});return{nrows:je(a[4][0].data)>>>0,data:i.reduce(function(s,o){return s[o.R]||(s[o.R]=[]),o.cells.forEach(function(c,f){if(s[o.R][f])throw new Error("Duplicate cell r=".concat(o.R," c=").concat(f));s[o.R][f]=c}),s},[])}}function S2(e,r,t){var a,n=Re(r.data),i={s:{r:0,c:0},e:{r:0,c:0}};if(i.e.r=(je(n[6][0].data)>>>0)-1,i.e.r<0)throw new Error("Invalid row varint ".concat(n[6][0].data));if(i.e.c=(je(n[7][0].data)>>>0)-1,i.e.c<0)throw new Error("Invalid col varint ".concat(n[7][0].data));t["!ref"]=Ee(i);var s=Re(n[4][0].data),o=x0(e,e[xr(s[4][0].data)][0]),c=(a=s[17])!=null&&a[0]?x0(e,e[xr(s[17][0].data)][0]):[],f=Re(s[3][0].data),l=0;f[1].forEach(function(h){var u=Re(h.data),x=e[xr(u[2][0].data)][0],p=je(x.meta[1][0].data);if(p!=6002)throw new Error("6001 unexpected reference to ".concat(p));var d=y2(e,x);d.data.forEach(function(m,E){m.forEach(function(F,v){var b=ge({r:l+E,c:v}),N=T2(F,o,c);N&&(t[b]=N)})}),l+=d.nrows})}function F2(e,r){var t=Re(r.data),a={"!ref":"A1"},n=e[xr(t[2][0].data)],i=je(n[0].meta[1][0].data);if(i!=6001)throw new Error("6000 unexpected reference to ".concat(i));return S2(e,n[0],a),a}function A2(e,r){var t,a=Re(r.data),n={name:(t=a[1])!=null&&t[0]?hi(a[1][0].data):"",sheets:[]},i=$i(a[2],xr);return i.forEach(function(s){e[s].forEach(function(o){var c=je(o.meta[1][0].data);c==6e3&&n.sheets.push(F2(e,o))})}),n}function C2(e,r){var t=Ji(),a=Re(r.data),n=$i(a[1],xr);if(n.forEach(function(i){e[i].forEach(function(s){var o=je(s.meta[1][0].data);if(o==2){var c=A2(e,s);c.sheets.forEach(function(f,l){Zi(t,f,l==0?c.name:c.name+"_"+l,!0)})}})}),t.SheetNames.length==0)throw new Error("Empty NUMBERS file");return t}function qn(e){var r,t,a,n,i={},s=[];if(e.FullPaths.forEach(function(c){if(c.match(/\.iwpv2/))throw new Error("Unsupported password protection")}),e.FileIndex.forEach(function(c){if(c.name.match(/\.iwa$/)){var f;try{f=Ur(c.content)}catch(h){return console.log("?? "+c.content.length+" "+(h.message||h))}var l;try{l=Br(f)}catch(h){return console.log("## "+(h.message||h))}l.forEach(function(h){i[h.id]=h.messages,s.push(h.id)})}}),!s.length)throw new Error("File has no messages");var o=((n=(a=(t=(r=i==null?void 0:i[1])==null?void 0:r[0])==null?void 0:t.meta)==null?void 0:a[1])==null?void 0:n[0].data)&&je(i[1][0].meta[1][0].data)==1&&i[1][0];if(o||s.forEach(function(c){i[c].forEach(function(f){var l=je(f.meta[1][0].data)>>>0;if(l==1)if(!o)o=f;else throw new Error("Document has multiple roots")})}),!o)throw new Error("Cannot find Document root");return C2(i,o)}function b2(e,r,t){var a,n,i,s;if(!((a=e[6])!=null&&a[0])||!((n=e[7])!=null&&n[0]))throw"Mutation only works on post-BNC storages!";var o=((s=(i=e[8])==null?void 0:i[0])==null?void 0:s.data)&&je(e[8][0].data)>0||!1;if(o)throw"Math only works with normal offsets";for(var c=0,f=Ht(e[7][0].data),l=0,h=[],u=Ht(e[4][0].data),x=0,p=[],d=0;d<r.length;++d){if(r[d]==null){f.setUint16(d*2,65535,!0),u.setUint16(d*2,65535);continue}f.setUint16(d*2,l,!0),u.setUint16(d*2,x,!0);var m,E;switch(typeof r[d]){case"string":m=Kn({t:"s",v:r[d]},t),E=Yn({t:"s",v:r[d]},t);break;case"number":m=Kn({t:"n",v:r[d]},t),E=Yn({t:"n",v:r[d]},t);break;case"boolean":m=Kn({t:"b",v:r[d]},t),E=Yn({t:"b",v:r[d]},t);break;default:throw new Error("Unsupported value "+r[d])}h.push(m),l+=m.length,p.push(E),x+=E.length,++c}for(e[2][0].data=De(c);d<e[7][0].data.length/2;++d)f.setUint16(d*2,65535,!0),u.setUint16(d*2,65535,!0);return e[6][0].data=kt(h),e[3][0].data=kt(p),c}function I2(e,r){if(!r||!r.numbers)throw new Error("Must pass a `numbers` option -- check the README");var t=e.Sheets[e.SheetNames[0]];e.SheetNames.length>1&&console.error("The Numbers writer currently writes only the first table");var a=Ar(t["!ref"]);a.s.r=a.s.c=0;var n=!1;a.e.c>9&&(n=!0,a.e.c=9),a.e.r>49&&(n=!0,a.e.r=49),n&&console.error("The Numbers writer is currently limited to ".concat(Ee(a)));var i=yn(t,{range:a,header:1}),s=["~Sh33tJ5~"];i.forEach(function(L){return L.forEach(function(I){typeof I=="string"&&s.push(I)})});var o={},c=[],f=de.read(r.numbers,{type:"base64"});f.FileIndex.map(function(L,I){return[L,f.FullPaths[I]]}).forEach(function(L){var I=L[0],O=L[1];if(I.type==2&&I.name.match(/\.iwa/)){var K=I.content,re=Ur(K),te=Br(re);te.forEach(function(Q){c.push(Q.id),o[Q.id]={deps:[],location:O,type:je(Q.messages[0].meta[1][0].data)}})}}),c.sort(function(L,I){return L-I});var l=c.filter(function(L){return L>1}).map(function(L){return[L,De(L)]});f.FileIndex.map(function(L,I){return[L,f.FullPaths[I]]}).forEach(function(L){var I=L[0];if(L[1],!!I.name.match(/\.iwa/)){var O=Br(Ur(I.content));O.forEach(function(K){K.messages.forEach(function(re){l.forEach(function(te){K.messages.some(function(Q){return je(Q.meta[1][0].data)!=11006&&m2(Q.data,te[1])})&&o[te[0]].deps.push(K.id)})})})}});for(var h=de.find(f,o[1].location),u=Br(Ur(h.content)),x,p=0;p<u.length;++p){var d=u[p];d.id==1&&(x=d)}var m=xr(Re(x.messages[0].data)[1][0].data);for(h=de.find(f,o[m].location),u=Br(Ur(h.content)),p=0;p<u.length;++p)d=u[p],d.id==m&&(x=d);for(m=xr(Re(x.messages[0].data)[2][0].data),h=de.find(f,o[m].location),u=Br(Ur(h.content)),p=0;p<u.length;++p)d=u[p],d.id==m&&(x=d);for(m=xr(Re(x.messages[0].data)[2][0].data),h=de.find(f,o[m].location),u=Br(Ur(h.content)),p=0;p<u.length;++p)d=u[p],d.id==m&&(x=d);var E=Re(x.messages[0].data);{E[6][0].data=De(a.e.r+1),E[7][0].data=De(a.e.c+1);var F=xr(E[46][0].data),v=de.find(f,o[F].location),b=Br(Ur(v.content));{for(var N=0;N<b.length&&b[N].id!=F;++N);if(b[N].id!=F)throw"Bad ColumnRowUIDMapArchive";var R=Re(b[N].messages[0].data);R[1]=[],R[2]=[],R[3]=[];for(var y=0;y<=a.e.c;++y){var M=[];M[1]=M[2]=[{type:0,data:De(y+420690)}],R[1].push({type:2,data:fr(M)}),R[2].push({type:0,data:De(y)}),R[3].push({type:0,data:De(y)})}R[4]=[],R[5]=[],R[6]=[];for(var D=0;D<=a.e.r;++D)M=[],M[1]=M[2]=[{type:0,data:De(D+726270)}],R[4].push({type:2,data:fr(M)}),R[5].push({type:0,data:De(D)}),R[6].push({type:0,data:De(D)});b[N].messages[0].data=fr(R)}v.content=Jt(qt(b)),v.size=v.content.length,delete E[46];var G=Re(E[4][0].data);{G[7][0].data=De(a.e.r+1);var z=Re(G[1][0].data),P=xr(z[2][0].data);v=de.find(f,o[P].location),b=Br(Ur(v.content));{if(b[0].id!=P)throw"Bad HeaderStorageBucket";var q=Re(b[0].messages[0].data);for(D=0;D<i.length;++D){var le=Re(q[2][0].data);le[1][0].data=De(D),le[4][0].data=De(i[D].length),q[2][D]={type:q[2][0].type,data:fr(le)}}b[0].messages[0].data=fr(q)}v.content=Jt(qt(b)),v.size=v.content.length;var ie=xr(G[2][0].data);v=de.find(f,o[ie].location),b=Br(Ur(v.content));{if(b[0].id!=ie)throw"Bad HeaderStorageBucket";for(q=Re(b[0].messages[0].data),y=0;y<=a.e.c;++y)le=Re(q[2][0].data),le[1][0].data=De(y),le[4][0].data=De(a.e.r+1),q[2][y]={type:q[2][0].type,data:fr(le)};b[0].messages[0].data=fr(q)}v.content=Jt(qt(b)),v.size=v.content.length;var ue=xr(G[4][0].data);(function(){for(var L=de.find(f,o[ue].location),I=Br(Ur(L.content)),O,K=0;K<I.length;++K){var re=I[K];re.id==ue&&(O=re)}var te=Re(O.messages[0].data);{te[3]=[];var Q=[];s.forEach(function(A,Be){Q[1]=[{type:0,data:De(Be)}],Q[2]=[{type:0,data:De(1)}],Q[3]=[{type:2,data:p2(A)}],te[3].push({type:2,data:fr(Q)})})}O.messages[0].data=fr(te);var J=qt(I),ke=Jt(J);L.content=ke,L.size=L.content.length})();var ce=Re(G[3][0].data);{var Le=ce[1][0];delete ce[2];var V=Re(Le.data);{var pe=xr(V[2][0].data);(function(){for(var L=de.find(f,o[pe].location),I=Br(Ur(L.content)),O,K=0;K<I.length;++K){var re=I[K];re.id==pe&&(O=re)}var te=Re(O.messages[0].data);{delete te[6],delete ce[7];var Q=new Uint8Array(te[5][0].data);te[5]=[];for(var J=0,ke=0;ke<=a.e.r;++ke){var A=Re(Q);J+=b2(A,i[ke],s),A[1][0].data=De(ke),te[5].push({data:fr(A),type:2})}te[1]=[{type:0,data:De(a.e.c+1)}],te[2]=[{type:0,data:De(a.e.r+1)}],te[3]=[{type:0,data:De(J)}],te[4]=[{type:0,data:De(a.e.r+1)}]}O.messages[0].data=fr(te);var Be=qt(I),Ce=Jt(Be);L.content=Ce,L.size=L.content.length})()}Le.data=fr(V)}G[3][0].data=fr(ce)}E[4][0].data=fr(G)}x.messages[0].data=fr(E);var _e=qt(u),C=Jt(_e);return h.content=C,h.size=h.content.length,f}function Fc(e){return function(t){for(var a=0;a!=e.length;++a){var n=e[a];t[n[0]]===void 0&&(t[n[0]]=n[1]),n[2]==="n"&&(t[n[0]]=Number(t[n[0]]))}}}function ji(e){Fc([["cellNF",!1],["cellHTML",!0],["cellFormula",!0],["cellStyles",!1],["cellText",!0],["cellDates",!1],["sheetStubs",!1],["sheetRows",0,"n"],["bookDeps",!1],["bookSheets",!1],["bookProps",!1],["bookFiles",!1],["bookVBA",!1],["password",""],["WTF",!1]])(e)}function Ki(e){Fc([["cellDates",!1],["bookSST",!1],["bookType","xlsx"],["compression",!1],["WTF",!1]])(e)}function R2(e){return Fe.WS.indexOf(e)>-1?"sheet":e==Fe.CS?"chart":e==Fe.DS?"dialog":e==Fe.MS?"macro":e&&e.length?e:"sheet"}function D2(e,r){if(!e)return 0;try{e=r.map(function(a){return a.id||(a.id=a.strRelID),[a.name,e["!id"][a.id].Target,R2(e["!id"][a.id].Type)]})}catch{return null}return!e||e.length===0?null:e}function O2(e,r,t,a,n,i,s,o,c,f,l,h){try{i[a]=ka(Dr(e,t,!0),r);var u=rr(e,r),x;switch(o){case"sheet":x=rv(u,r,n,c,i[a],f,l,h);break;case"chart":if(x=tv(u,r,n,c,i[a],f,l,h),!x||!x["!drawel"])break;var p=_a(x["!drawel"].Target,r),d=La(p),m=V1(Dr(e,p,!0),ka(Dr(e,d,!0),p)),E=_a(m,p),F=La(E);x=bg(Dr(e,E,!0),E,c,ka(Dr(e,F,!0),E),f,x);break;case"macro":x=av(u,r,n,c,i[a],f,l,h);break;case"dialog":x=nv(u,r,n,c,i[a],f,l,h);break;default:throw new Error("Unrecognized sheet type "+o)}s[a]=x;var v=[];i&&i[a]&&Ke(i[a]).forEach(function(b){var N="";if(i[a][b].Type==Fe.CMNT){N=_a(i[a][b].Target,r);var R=cv(rr(e,N,!0),N,c);if(!R||!R.length)return;Qs(x,R,!1)}i[a][b].Type==Fe.TCMNT&&(N=_a(i[a][b].Target,r),v=v.concat(X1(rr(e,N,!0),c)))}),v&&v.length&&Qs(x,v,!0,c.people||[])}catch(b){if(c.WTF)throw b}}function Pr(e){return e.charAt(0)=="/"?e.slice(1):e}function N2(e,r){if(ca(),r=r||{},ji(r),Wr(e,"META-INF/manifest.xml")||Wr(e,"objectdata.xml"))return l0(e,r);if(Wr(e,"Index/Document.iwa")){if(typeof Uint8Array>"u")throw new Error("NUMBERS file parsing requires Uint8Array support");if(typeof qn<"u"){if(e.FileIndex)return qn(e);var t=de.utils.cfb_new();return ws(e).forEach(function(le){Te(t,le,Gf(e,le))}),qn(t)}throw new Error("Unsupported NUMBERS file")}if(!Wr(e,"[Content_Types].xml"))throw Wr(e,"index.xml.gz")?new Error("Unsupported NUMBERS 08 file"):Wr(e,"index.xml")?new Error("Unsupported NUMBERS 09 file"):new Error("Unsupported ZIP file");var a=ws(e),n=Bl(Dr(e,"[Content_Types].xml")),i=!1,s,o;if(n.workbooks.length===0&&(o="xl/workbook.xml",rr(e,o,!0)&&n.workbooks.push(o)),n.workbooks.length===0){if(o="xl/workbook.bin",!rr(e,o,!0))throw new Error("Could not find workbook");n.workbooks.push(o),i=!0}n.workbooks[0].slice(-3)=="bin"&&(i=!0);var c={},f={};if(!r.bookSheets&&!r.bookProps){if(ya=[],n.sst)try{ya=ov(rr(e,Pr(n.sst)),n.sst,r)}catch(le){if(r.WTF)throw le}r.cellStyles&&n.themes.length&&(c=sv(Dr(e,n.themes[0].replace(/^\//,""),!0)||"",n.themes[0],r)),n.style&&(f=iv(rr(e,Pr(n.style)),n.style,c,r))}n.links.map(function(le){try{var ie=ka(Dr(e,La(Pr(le))),le);return lv(rr(e,Pr(le)),ie,le,r)}catch{}});var l=ev(rr(e,Pr(n.workbooks[0])),n.workbooks[0],r),h={},u="";n.coreprops.length&&(u=rr(e,Pr(n.coreprops[0]),!0),u&&(h=xo(u)),n.extprops.length!==0&&(u=rr(e,Pr(n.extprops[0]),!0),u&&Gl(u,h,r)));var x={};(!r.bookSheets||r.bookProps)&&n.custprops.length!==0&&(u=Dr(e,Pr(n.custprops[0]),!0),u&&(x=jl(u,r)));var p={};if((r.bookSheets||r.bookProps)&&(l.Sheets?s=l.Sheets.map(function(ie){return ie.name}):h.Worksheets&&h.SheetNames.length>0&&(s=h.SheetNames),r.bookProps&&(p.Props=h,p.Custprops=x),r.bookSheets&&typeof s<"u"&&(p.SheetNames=s),r.bookSheets?p.SheetNames:r.bookProps))return p;s={};var d={};r.bookDeps&&n.calcchain&&(d=fv(rr(e,Pr(n.calcchain)),n.calcchain));var m=0,E={},F,v;{var b=l.Sheets;h.Worksheets=b.length,h.SheetNames=[];for(var N=0;N!=b.length;++N)h.SheetNames[N]=b[N].name}var R=i?"bin":"xml",y=n.workbooks[0].lastIndexOf("/"),M=(n.workbooks[0].slice(0,y+1)+"_rels/"+n.workbooks[0].slice(y+1)+".rels").replace(/^\//,"");Wr(e,M)||(M="xl/_rels/workbook."+R+".rels");var D=ka(Dr(e,M,!0),M.replace(/_rels.*/,"s5s"));(n.metadata||[]).length>=1&&(r.xlmeta=hv(rr(e,Pr(n.metadata[0])),n.metadata[0],r)),(n.people||[]).length>=1&&(r.people=$1(rr(e,Pr(n.people[0])),r)),D&&(D=D2(D,l.Sheets));var G=rr(e,"xl/worksheets/sheet.xml",!0)?1:0;e:for(m=0;m!=h.Worksheets;++m){var z="sheet";if(D&&D[m]?(F="xl/"+D[m][1].replace(/[\/]?xl\//,""),Wr(e,F)||(F=D[m][1]),Wr(e,F)||(F=M.replace(/_rels\/.*$/,"")+D[m][1]),z=D[m][2]):(F="xl/worksheets/sheet"+(m+1-G)+"."+R,F=F.replace(/sheet0\./,"sheet.")),v=F.replace(/^(.*)(\/)([^\/]*)$/,"$1/_rels/$3.rels"),r&&r.sheets!=null)switch(typeof r.sheets){case"number":if(m!=r.sheets)continue e;break;case"string":if(h.SheetNames[m].toLowerCase()!=r.sheets.toLowerCase())continue e;break;default:if(Array.isArray&&Array.isArray(r.sheets)){for(var P=!1,q=0;q!=r.sheets.length;++q)typeof r.sheets[q]=="number"&&r.sheets[q]==m&&(P=1),typeof r.sheets[q]=="string"&&r.sheets[q].toLowerCase()==h.SheetNames[m].toLowerCase()&&(P=1);if(!P)continue e}}O2(e,F,v,h.SheetNames[m],m,E,s,z,r,l,c,f)}return p={Directory:n,Workbook:l,Props:h,Custprops:x,Deps:d,Sheets:s,SheetNames:h.SheetNames,Strings:ya,Styles:f,Themes:c,SSF:He(me)},r&&r.bookFiles&&(e.files?(p.keys=a,p.files=e.files):(p.keys=[],p.files={},e.FullPaths.forEach(function(le,ie){le=le.replace(/^Root Entry[\/]/,""),p.keys.push(le),p.files[le]=e.FileIndex[ie]}))),r&&r.bookVBA&&(n.vba.length>0?p.vbaraw=rr(e,Pr(n.vba[0]),!0):n.defaults&&n.defaults.bin===ex&&(p.vbaraw=rr(e,"xl/vbaProject.bin",!0))),p}function L2(e,r){var t=r||{},a="Workbook",n=de.find(e,a);try{if(a="/!DataSpaces/Version",n=de.find(e,a),!n||!n.content)throw new Error("ECMA-376 Encrypted file missing "+a);if(hd(n.content),a="/!DataSpaces/DataSpaceMap",n=de.find(e,a),!n||!n.content)throw new Error("ECMA-376 Encrypted file missing "+a);var i=dd(n.content);if(i.length!==1||i[0].comps.length!==1||i[0].comps[0].t!==0||i[0].name!=="StrongEncryptionDataSpace"||i[0].comps[0].v!=="EncryptedPackage")throw new Error("ECMA-376 Encrypted file bad "+a);if(a="/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace",n=de.find(e,a),!n||!n.content)throw new Error("ECMA-376 Encrypted file missing "+a);var s=xd(n.content);if(s.length!=1||s[0]!="StrongEncryptionTransform")throw new Error("ECMA-376 Encrypted file bad "+a);if(a="/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary",n=de.find(e,a),!n||!n.content)throw new Error("ECMA-376 Encrypted file missing "+a);md(n.content)}catch{}if(a="/EncryptionInfo",n=de.find(e,a),!n||!n.content)throw new Error("ECMA-376 Encrypted file missing "+a);var o=gd(n.content);if(a="/EncryptedPackage",n=de.find(e,a),!n||!n.content)throw new Error("ECMA-376 Encrypted file missing "+a);if(o[0]==4&&typeof decrypt_agile<"u")return decrypt_agile(o[1],n.content,t.password||"",t);if(o[0]==2&&typeof decrypt_std76<"u")return decrypt_std76(o[1],n.content,t.password||"",t);throw new Error("File is password-protected")}function P2(e,r){return r.bookType=="ods"?Sc(e,r):r.bookType=="numbers"?I2(e,r):r.bookType=="xlsb"?M2(e,r):B2(e,r)}function M2(e,r){Qt=1024,e&&!e.SSF&&(e.SSF=He(me)),e&&e.SSF&&(ca(),An(e.SSF),r.revssf=bn(e.SSF),r.revssf[e.SSF[65535]]=0,r.ssf=e.SSF),r.rels={},r.wbrels={},r.Strings=[],r.Strings.Count=0,r.Strings.Unique=0,Sa?r.revStrings=new Map:(r.revStrings={},r.revStrings.foo=[],delete r.revStrings.foo);var t=r.bookType=="xlsb"?"bin":"xml",a=Qo.indexOf(r.bookType)>-1,n=Oi();Ki(r=r||{});var i=_i(),s="",o=0;if(r.cellXfs=[],Ft(r.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),s="docProps/core.xml",Te(i,s,po(e.Props,r)),n.coreprops.push(s),Oe(r.rels,2,s,Fe.CORE_PROPS),s="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var c=[],f=0;f<e.SheetNames.length;++f)(e.Workbook.Sheets[f]||{}).Hidden!=2&&c.push(e.SheetNames[f]);e.Props.SheetNames=c}for(e.Props.Worksheets=e.Props.SheetNames.length,Te(i,s,vo(e.Props)),n.extprops.push(s),Oe(r.rels,3,s,Fe.EXT_PROPS),e.Custprops!==e.Props&&Ke(e.Custprops||{}).length>0&&(s="docProps/custom.xml",Te(i,s,_o(e.Custprops)),n.custprops.push(s),Oe(r.rels,4,s,Fe.CUST_PROPS)),o=1;o<=e.SheetNames.length;++o){var l={"!id":{}},h=e.Sheets[e.SheetNames[o-1]],u=(h||{})["!type"]||"sheet";switch(u){case"chart":default:s="xl/worksheets/sheet"+o+"."+t,Te(i,s,dv(o-1,s,r,e,l)),n.sheets.push(s),Oe(r.wbrels,-1,"worksheets/sheet"+o+"."+t,Fe.WS[0])}if(h){var x=h["!comments"],p=!1,d="";x&&x.length>0&&(d="xl/comments"+o+"."+t,Te(i,d,mv(x,d)),n.comments.push(d),Oe(l,-1,"../comments"+o+"."+t,Fe.CMNT),p=!0),h["!legacy"]&&p&&Te(i,"xl/drawings/vmlDrawing"+o+".vml",Jo(o,h["!comments"])),delete h["!comments"],delete h["!legacy"]}l["!id"].rId1&&Te(i,La(s),ra(l))}return r.Strings!=null&&r.Strings.length>0&&(s="xl/sharedStrings."+t,Te(i,s,pv(r.Strings,s,r)),n.strs.push(s),Oe(r.wbrels,-1,"sharedStrings."+t,Fe.SST)),s="xl/workbook."+t,Te(i,s,uv(e,s)),n.workbooks.push(s),Oe(r.rels,1,s,Fe.WB),s="xl/theme/theme1.xml",Te(i,s,Ui(e.Themes,r)),n.themes.push(s),Oe(r.wbrels,-1,"theme/theme1.xml",Fe.THEME),s="xl/styles."+t,Te(i,s,xv(e,s,r)),n.styles.push(s),Oe(r.wbrels,-1,"styles."+t,Fe.STY),e.vbaraw&&a&&(s="xl/vbaProject.bin",Te(i,s,e.vbaraw),n.vba.push(s),Oe(r.wbrels,-1,"vbaProject.bin",Fe.VBA)),s="xl/metadata."+t,Te(i,s,gv(s)),n.metadata.push(s),Oe(r.wbrels,-1,"metadata."+t,Fe.XLMETA),Te(i,"[Content_Types].xml",ho(n,r)),Te(i,"_rels/.rels",ra(r.rels)),Te(i,"xl/_rels/workbook."+t+".rels",ra(r.wbrels)),delete r.revssf,delete r.ssf,i}function B2(e,r){Qt=1024,e&&!e.SSF&&(e.SSF=He(me)),e&&e.SSF&&(ca(),An(e.SSF),r.revssf=bn(e.SSF),r.revssf[e.SSF[65535]]=0,r.ssf=e.SSF),r.rels={},r.wbrels={},r.Strings=[],r.Strings.Count=0,r.Strings.Unique=0,Sa?r.revStrings=new Map:(r.revStrings={},r.revStrings.foo=[],delete r.revStrings.foo);var t="xml",a=Qo.indexOf(r.bookType)>-1,n=Oi();Ki(r=r||{});var i=_i(),s="",o=0;if(r.cellXfs=[],Ft(r.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),s="docProps/core.xml",Te(i,s,po(e.Props,r)),n.coreprops.push(s),Oe(r.rels,2,s,Fe.CORE_PROPS),s="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var c=[],f=0;f<e.SheetNames.length;++f)(e.Workbook.Sheets[f]||{}).Hidden!=2&&c.push(e.SheetNames[f]);e.Props.SheetNames=c}e.Props.Worksheets=e.Props.SheetNames.length,Te(i,s,vo(e.Props)),n.extprops.push(s),Oe(r.rels,3,s,Fe.EXT_PROPS),e.Custprops!==e.Props&&Ke(e.Custprops||{}).length>0&&(s="docProps/custom.xml",Te(i,s,_o(e.Custprops)),n.custprops.push(s),Oe(r.rels,4,s,Fe.CUST_PROPS));var l=["SheetJ5"];for(r.tcid=0,o=1;o<=e.SheetNames.length;++o){var h={"!id":{}},u=e.Sheets[e.SheetNames[o-1]],x=(u||{})["!type"]||"sheet";switch(x){case"chart":default:s="xl/worksheets/sheet"+o+"."+t,Te(i,s,lc(o-1,r,e,h)),n.sheets.push(s),Oe(r.wbrels,-1,"worksheets/sheet"+o+"."+t,Fe.WS[0])}if(u){var p=u["!comments"],d=!1,m="";if(p&&p.length>0){var E=!1;p.forEach(function(F){F[1].forEach(function(v){v.T==!0&&(E=!0)})}),E&&(m="xl/threadedComments/threadedComment"+o+"."+t,Te(i,m,G1(p,l,r)),n.threadedcomments.push(m),Oe(h,-1,"../threadedComments/threadedComment"+o+"."+t,Fe.TCMNT)),m="xl/comments"+o+"."+t,Te(i,m,Zo(p)),n.comments.push(m),Oe(h,-1,"../comments"+o+"."+t,Fe.CMNT),d=!0}u["!legacy"]&&d&&Te(i,"xl/drawings/vmlDrawing"+o+".vml",Jo(o,u["!comments"])),delete u["!comments"],delete u["!legacy"]}h["!id"].rId1&&Te(i,La(s),ra(h))}return r.Strings!=null&&r.Strings.length>0&&(s="xl/sharedStrings."+t,Te(i,s,Uo(r.Strings,r)),n.strs.push(s),Oe(r.wbrels,-1,"sharedStrings."+t,Fe.SST)),s="xl/workbook."+t,Te(i,s,pc(e)),n.workbooks.push(s),Oe(r.rels,1,s,Fe.WB),s="xl/theme/theme1.xml",Te(i,s,Ui(e.Themes,r)),n.themes.push(s),Oe(r.wbrels,-1,"theme/theme1.xml",Fe.THEME),s="xl/styles."+t,Te(i,s,jo(e,r)),n.styles.push(s),Oe(r.wbrels,-1,"styles."+t,Fe.STY),e.vbaraw&&a&&(s="xl/vbaProject.bin",Te(i,s,e.vbaraw),n.vba.push(s),Oe(r.wbrels,-1,"vbaProject.bin",Fe.VBA)),s="xl/metadata."+t,Te(i,s,qo()),n.metadata.push(s),Oe(r.wbrels,-1,"metadata."+t,Fe.XLMETA),l.length>1&&(s="xl/persons/person.xml",Te(i,s,j1(l)),n.people.push(s),Oe(r.wbrels,-1,"persons/person.xml",Fe.PEOPLE)),Te(i,"[Content_Types].xml",ho(n,r)),Te(i,"_rels/.rels",ra(r.rels)),Te(i,"xl/_rels/workbook."+t+".rels",ra(r.wbrels)),delete r.revssf,delete r.ssf,i}function Yi(e,r){var t="";switch((r||{}).type||"base64"){case"buffer":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];case"base64":t=Or(e.slice(0,12));break;case"binary":t=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 "+(r&&r.type||"undefined"))}return[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3),t.charCodeAt(4),t.charCodeAt(5),t.charCodeAt(6),t.charCodeAt(7)]}function U2(e,r){return de.find(e,"EncryptedPackage")?L2(e,r):_c(e,r)}function W2(e,r){var t,a=e,n=r||{};return n.type||(n.type=ye&&Buffer.isBuffer(e)?"buffer":"base64"),t=W0(a,n),N2(t,n)}function Ac(e,r){var t=0;e:for(;t<e.length;)switch(e.charCodeAt(t)){case 10:case 13:case 32:++t;break;case 60:return fi(e.slice(t),r);default:break e}return ia.to_workbook(e,r)}function H2(e,r){var t="",a=Yi(e,r);switch(r.type){case"base64":t=Or(e);break;case"binary":t=e;break;case"buffer":t=e.toString("binary");break;case"array":t=Mt(e);break;default:throw new Error("Unrecognized type "+r.type)}return a[0]==239&&a[1]==187&&a[2]==191&&(t=Pe(t)),r.type="binary",Ac(t,r)}function V2(e,r){var t=e;return r.type=="base64"&&(t=Or(t)),t=ba.utils.decode(1200,t.slice(2),"str"),r.type="binary",Ac(t,r)}function z2(e){return e.match(/[^\x00-\x7F]/)?rt(e):e}function Jn(e,r,t,a){return a?(t.type="string",ia.to_workbook(e,t)):ia.to_workbook(r,t)}function Ca(e,r){xi();var t=r||{};if(typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer)return Ca(new Uint8Array(e),(t=He(t),t.type="array",t));typeof Uint8Array<"u"&&e instanceof Uint8Array&&!t.type&&(t.type=typeof Deno<"u"?"buffer":"array");var a=e,n=[0,0,0,0],i=!1;if(t.cellStyles&&(t.cellNF=!0,t.sheetStubs=!0),aa={},t.dateNF&&(aa.dateNF=t.dateNF),t.type||(t.type=ye&&Buffer.isBuffer(e)?"buffer":"base64"),t.type=="file"&&(t.type=ye?"buffer":"binary",a=Mf(e),typeof Uint8Array<"u"&&!ye&&(t.type="array")),t.type=="string"&&(i=!0,t.type="binary",t.codepage=65001,a=z2(e)),t.type=="array"&&typeof Uint8Array<"u"&&e instanceof Uint8Array&&typeof ArrayBuffer<"u"){var s=new ArrayBuffer(3),o=new Uint8Array(s);if(o.foo="bar",!o.foo)return t=He(t),t.type="array",Ca(pi(a),t)}switch((n=Yi(a,t))[0]){case 208:if(n[1]===207&&n[2]===17&&n[3]===224&&n[4]===161&&n[5]===177&&n[6]===26&&n[7]===225)return U2(de.read(a,t),t);break;case 9:if(n[1]<=8)return _c(a,t);break;case 60:return fi(a,t);case 73:if(n[1]===73&&n[2]===42&&n[3]===0)throw new Error("TIFF Image File is not a spreadsheet");if(n[1]===68)return Ku(a,t);break;case 84:if(n[1]===65&&n[2]===66&&n[3]===76)return Mo.to_workbook(a,t);break;case 80:return n[1]===75&&n[2]<9&&n[3]<9?W2(a,t):Jn(e,a,t,i);case 239:return n[3]===60?fi(a,t):Jn(e,a,t,i);case 255:if(n[1]===254)return V2(a,t);if(n[1]===0&&n[2]===2&&n[3]===0)return Ot.to_workbook(a,t);break;case 0:if(n[1]===0&&(n[2]>=2&&n[3]===0||n[2]===0&&(n[3]===8||n[3]===9)))return Ot.to_workbook(a,t);break;case 3:case 131:case 139:case 140:return ci.to_workbook(a,t);case 123:if(n[1]===92&&n[2]===114&&n[3]===116)return Xo.to_workbook(a,t);break;case 10:case 13:case 32:return H2(a,t);case 137:if(n[1]===80&&n[2]===78&&n[3]===71)throw new Error("PNG Image File is not a spreadsheet");break}return ju.indexOf(n[0])>-1&&n[2]<=12&&n[3]<=31?ci.to_workbook(a,t):Jn(e,a,t,i)}function Cc(e,r){switch(r.type){case"base64":case"binary":break;case"buffer":case"array":r.type="";break;case"file":return za(r.file,de.write(e,{type:ye?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+r.bookType+"' files");default:throw new Error("Unrecognized type "+r.type)}return de.write(e,r)}function X2(e,r){var t=He(r||{}),a=P2(e,t);return G2(a,t)}function G2(e,r){var t={},a=ye?"nodebuffer":typeof Uint8Array<"u"?"array":"string";if(r.compression&&(t.compression="DEFLATE"),r.password)t.type=a;else switch(r.type){case"base64":t.type="base64";break;case"binary":t.type="string";break;case"string":throw new Error("'string' output type invalid for '"+r.bookType+"' files");case"buffer":case"file":t.type=a;break;default:throw new Error("Unrecognized type "+r.type)}var n=e.FullPaths?de.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[t.type]||t.type,compression:!!r.compression}):e.generate(t);if(typeof Deno<"u"&&typeof n=="string"){if(r.type=="binary"||r.type=="base64")return n;n=new Uint8Array(Fn(n))}return r.password&&typeof encrypt_agile<"u"?Cc(encrypt_agile(n,r.password),r):r.type==="file"?za(r.file,n):r.type=="string"?Pe(n):n}function $2(e,r){var t=r||{},a=zv(e,t);return Cc(a,t)}function et(e,r,t){t||(t="");var a=t+e;switch(r.type){case"base64":return Ia(rt(a));case"binary":return rt(a);case"string":return e;case"file":return za(r.file,a,"utf8");case"buffer":return ye?ut(a,"utf8"):typeof TextEncoder<"u"?new TextEncoder().encode(a):et(a,{type:"binary"}).split("").map(function(n){return n.charCodeAt(0)})}throw new Error("Unrecognized type "+r.type)}function j2(e,r){switch(r.type){case"base64":return Ia(e);case"binary":return e;case"string":return e;case"file":return za(r.file,e,"binary");case"buffer":return ye?ut(e,"binary"):e.split("").map(function(t){return t.charCodeAt(0)})}throw new Error("Unrecognized type "+r.type)}function fn(e,r){switch(r.type){case"string":case"base64":case"binary":for(var t="",a=0;a<e.length;++a)t+=String.fromCharCode(e[a]);return r.type=="base64"?Ia(t):r.type=="string"?Pe(t):t;case"file":return za(r.file,e);case"buffer":return e;default:throw new Error("Unrecognized type "+r.type)}}function bc(e,r){xi(),Ug(e);var t=He(r||{});if(t.cellStyles&&(t.cellNF=!0,t.sheetStubs=!0),t.type=="array"){t.type="binary";var a=bc(e,t);return t.type="array",Fn(a)}var n=0;if(t.sheet&&(typeof t.sheet=="number"?n=t.sheet:n=e.SheetNames.indexOf(t.sheet),!e.SheetNames[n]))throw new Error("Sheet not found: "+t.sheet+" : "+typeof t.sheet);switch(t.bookType||"xlsb"){case"xml":case"xlml":return et(Pv(e,t),t);case"slk":case"sylk":return et(Po.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"htm":case"html":return et(Ec(e.Sheets[e.SheetNames[n]],t),t);case"txt":return j2(Ic(e.Sheets[e.SheetNames[n]],t),t);case"csv":return et(qi(e.Sheets[e.SheetNames[n]],t),t,"\uFEFF");case"dif":return et(Mo.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"dbf":return fn(ci.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"prn":return et(ia.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"rtf":return et(Xo.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"eth":return et(Bo.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"fods":return et(Sc(e,t),t);case"wk1":return fn(Ot.sheet_to_wk1(e.Sheets[e.SheetNames[n]],t),t);case"wk3":return fn(Ot.book_to_wk3(e,t),t);case"biff2":t.biff||(t.biff=2);case"biff3":t.biff||(t.biff=3);case"biff4":return t.biff||(t.biff=4),fn(wc(e,t),t);case"biff5":t.biff||(t.biff=5);case"biff8":case"xla":case"xls":return t.biff||(t.biff=8),$2(e,t);case"xlsx":case"xlsm":case"xlam":case"xlsb":case"numbers":case"ods":return X2(e,t);default:throw new Error("Unrecognized bookType |"+t.bookType+"|")}}function K2(e,r,t,a,n,i,s,o){var c=Ze(t),f=o.defval,l=o.raw||!Object.prototype.hasOwnProperty.call(o,"raw"),h=!0,u=n===1?[]:{};if(n!==1)if(Object.defineProperty)try{Object.defineProperty(u,"__rowNum__",{value:t,enumerable:!1})}catch{u.__rowNum__=t}else u.__rowNum__=t;if(!s||e[t])for(var x=r.s.c;x<=r.e.c;++x){var p=s?e[t][x]:e[a[x]+c];if(p===void 0||p.t===void 0){if(f===void 0)continue;i[x]!=null&&(u[i[x]]=f);continue}var d=p.v;switch(p.t){case"z":if(d==null)break;continue;case"e":d=d==0?null:void 0;break;case"s":case"d":case"b":case"n":break;default:throw new Error("unrecognized type "+p.t)}if(i[x]!=null){if(d==null)if(p.t=="e"&&d===null)u[i[x]]=null;else if(f!==void 0)u[i[x]]=f;else if(l&&d===null)u[i[x]]=null;else continue;else u[i[x]]=l&&(p.t!=="n"||p.t==="n"&&o.rawNumbers!==!1)?d:ht(p,d,o);d!=null&&(h=!1)}}return{row:u,isempty:h}}function yn(e,r){if(e==null||e["!ref"]==null)return[];var t={t:"n",v:0},a=0,n=1,i=[],s=0,o="",c={s:{r:0,c:0},e:{r:0,c:0}},f=r||{},l=f.range!=null?f.range:e["!ref"];switch(f.header===1?a=1:f.header==="A"?a=2:Array.isArray(f.header)?a=3:f.header==null&&(a=0),typeof l){case"string":c=Ie(l);break;case"number":c=Ie(e["!ref"]),c.s.r=l;break;default:c=l}a>0&&(n=0);var h=Ze(c.s.r),u=[],x=[],p=0,d=0,m=Array.isArray(e),E=c.s.r,F=0,v={};m&&!e[E]&&(e[E]=[]);var b=f.skipHidden&&e["!cols"]||[],N=f.skipHidden&&e["!rows"]||[];for(F=c.s.c;F<=c.e.c;++F)if(!(b[F]||{}).hidden)switch(u[F]=Xe(F),t=m?e[E][F]:e[u[F]+h],a){case 1:i[F]=F-c.s.c;break;case 2:i[F]=u[F];break;case 3:i[F]=f.header[F-c.s.c];break;default:if(t==null&&(t={w:"__EMPTY",t:"s"}),o=s=ht(t,null,f),d=v[s]||0,!d)v[s]=1;else{do o=s+"_"+d++;while(v[o]);v[s]=d,v[o]=1}i[F]=o}for(E=c.s.r+n;E<=c.e.r;++E)if(!(N[E]||{}).hidden){var R=K2(e,c,E,u,a,i,m,f);(R.isempty===!1||(a===1?f.blankrows!==!1:f.blankrows))&&(x[p++]=R.row)}return x.length=p,x}var p0=/"/g;function Y2(e,r,t,a,n,i,s,o){for(var c=!0,f=[],l="",h=Ze(t),u=r.s.c;u<=r.e.c;++u)if(a[u]){var x=o.dense?(e[t]||[])[u]:e[a[u]+h];if(x==null)l="";else if(x.v!=null){c=!1,l=""+(o.rawNumbers&&x.t=="n"?x.v:ht(x,null,o));for(var p=0,d=0;p!==l.length;++p)if((d=l.charCodeAt(p))===n||d===i||d===34||o.forceQuotes){l='"'+l.replace(p0,'""')+'"';break}l=="ID"&&(l='"ID"')}else x.f!=null&&!x.F?(c=!1,l="="+x.f,l.indexOf(",")>=0&&(l='"'+l.replace(p0,'""')+'"')):l="";f.push(l)}return o.blankrows===!1&&c?null:f.join(s)}function qi(e,r){var t=[],a=r??{};if(e==null||e["!ref"]==null)return"";var n=Ie(e["!ref"]),i=a.FS!==void 0?a.FS:",",s=i.charCodeAt(0),o=a.RS!==void 0?a.RS:`
|
|
104
104
|
`,c=o.charCodeAt(0),f=new RegExp((i=="|"?"\\|":i)+"+$"),l="",h=[];a.dense=Array.isArray(e);for(var u=a.skipHidden&&e["!cols"]||[],x=a.skipHidden&&e["!rows"]||[],p=n.s.c;p<=n.e.c;++p)(u[p]||{}).hidden||(h[p]=Xe(p));for(var d=0,m=n.s.r;m<=n.e.r;++m)(x[m]||{}).hidden||(l=Y2(e,n,m,h,s,c,i,a),l!=null&&(a.strip&&(l=l.replace(f,"")),(l||a.blankrows!==!1)&&t.push((d++?o:"")+l)));return delete a.dense,t.join("")}function Ic(e,r){r||(r={}),r.FS=" ",r.RS=`
|
|
105
105
|
`;var t=qi(e,r);return t}function q2(e){var r="",t,a="";if(e==null||e["!ref"]==null)return[];var n=Ie(e["!ref"]),i="",s=[],o,c=[],f=Array.isArray(e);for(o=n.s.c;o<=n.e.c;++o)s[o]=Xe(o);for(var l=n.s.r;l<=n.e.r;++l)for(i=Ze(l),o=n.s.c;o<=n.e.c;++o)if(r=s[o]+i,t=f?(e[l]||[])[o]:e[r],a="",t!==void 0){if(t.F!=null){if(r=t.F,!t.f)continue;a=t.f,r.indexOf(":")==-1&&(r=r+":"+r)}if(t.f!=null)a=t.f;else{if(t.t=="z")continue;if(t.t=="n"&&t.v!=null)a=""+t.v;else if(t.t=="b")a=t.v?"TRUE":"FALSE";else if(t.w!==void 0)a="'"+t.w;else{if(t.v===void 0)continue;t.t=="s"?a="'"+t.v:a=""+t.v}}c[c.length]=r+"="+a}return c}function Rc(e,r,t){var a=t||{},n=+!a.skipHeader,i=e||{},s=0,o=0;if(i&&a.origin!=null)if(typeof a.origin=="number")s=a.origin;else{var c=typeof a.origin=="string"?Ge(a.origin):a.origin;s=c.r,o=c.c}var f,l={s:{c:0,r:0},e:{c:o,r:s+r.length-1+n}};if(i["!ref"]){var h=Ie(i["!ref"]);l.e.c=Math.max(l.e.c,h.e.c),l.e.r=Math.max(l.e.r,h.e.r),s==-1&&(s=h.e.r+1,l.e.r=s+r.length-1+n)}else s==-1&&(s=0,l.e.r=r.length-1+n);var u=a.header||[],x=0;r.forEach(function(d,m){Ke(d).forEach(function(E){(x=u.indexOf(E))==-1&&(u[x=u.length]=E);var F=d[E],v="z",b="",N=ge({c:o+x,r:s+m+n});f=Va(i,N),F&&typeof F=="object"&&!(F instanceof Date)?i[N]=F:(typeof F=="number"?v="n":typeof F=="boolean"?v="b":typeof F=="string"?v="s":F instanceof Date?(v="d",a.cellDates||(v="n",F=ir(F)),b=a.dateNF||me[14]):F===null&&a.nullError&&(v="e",F=0),f?(f.t=v,f.v=F,delete f.w,delete f.R,b&&(f.z=b)):i[N]=f={t:v,v:F},b&&(f.z=b))})}),l.e.c=Math.max(l.e.c,o+u.length-1);var p=Ze(s);if(n)for(x=0;x<u.length;++x)i[Xe(x+o)+p]={t:"s",v:u[x]};return i["!ref"]=Ee(l),i}function J2(e,r){return Rc(null,e,r)}function Va(e,r,t){if(typeof r=="string"){if(Array.isArray(e)){var a=Ge(r);return e[a.r]||(e[a.r]=[]),e[a.r][a.c]||(e[a.r][a.c]={t:"z"})}return e[r]||(e[r]={t:"z"})}return typeof r!="number"?Va(e,ge(r)):Va(e,ge({r,c:t||0}))}function Z2(e,r){if(typeof r=="number"){if(r>=0&&e.SheetNames.length>r)return r;throw new Error("Cannot find sheet # "+r)}else if(typeof r=="string"){var t=e.SheetNames.indexOf(r);if(t>-1)return t;throw new Error("Cannot find sheet name |"+r+"|")}else throw new Error("Cannot find sheet |"+r+"|")}function Ji(){return{SheetNames:[],Sheets:{}}}function Zi(e,r,t,a){var n=1;if(!t)for(;n<=65535&&e.SheetNames.indexOf(t="Sheet"+n)!=-1;++n,t=void 0);if(!t||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(a&&e.SheetNames.indexOf(t)>=0){var i=t.match(/(^.*?)(\d+)$/);n=i&&+i[2]||0;var s=i&&i[1]||t;for(++n;n<=65535&&e.SheetNames.indexOf(t=s+n)!=-1;++n);}if(xc(t),e.SheetNames.indexOf(t)>=0)throw new Error("Worksheet with name |"+t+"| already exists!");return e.SheetNames.push(t),e.Sheets[t]=r,t}function Q2(e,r,t){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var a=Z2(e,r);switch(e.Workbook.Sheets[a]||(e.Workbook.Sheets[a]={}),t){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+t)}e.Workbook.Sheets[a].Hidden=t}function e_(e,r){return e.z=r,e}function Dc(e,r,t){return r?(e.l={Target:r},t&&(e.l.Tooltip=t)):delete e.l,e}function r_(e,r,t){return Dc(e,"#"+r,t)}function t_(e,r,t){e.c||(e.c=[]),e.c.push({t:r,a:t||"SheetJS"})}function a_(e,r,t,a){for(var n=typeof r!="string"?r:Ie(r),i=typeof r=="string"?r:Ee(r),s=n.s.r;s<=n.e.r;++s)for(var o=n.s.c;o<=n.e.c;++o){var c=Va(e,s,o);c.t="n",c.F=i,delete c.v,s==n.s.r&&o==n.s.c&&(c.f=t,a&&(c.D=!0))}return e}var Lt={encode_col:Xe,encode_row:Ze,encode_cell:ge,encode_range:Ee,decode_col:Ai,decode_row:Fi,split_cell:pl,decode_cell:Ge,decode_range:Ar,format_cell:ht,sheet_add_aoa:no,sheet_add_json:Rc,sheet_add_dom:Tc,aoa_to_sheet:fa,json_to_sheet:J2,table_to_sheet:kc,table_to_book:h2,sheet_to_csv:qi,sheet_to_txt:Ic,sheet_to_json:yn,sheet_to_html:Ec,sheet_to_formulae:q2,sheet_to_row_object_array:yn,sheet_get_cell:Va,book_new:Ji,book_append_sheet:Zi,book_set_sheet_visibility:Q2,cell_set_number_format:e_,cell_set_hyperlink:Dc,cell_set_internal_link:r_,cell_add_comment:t_,sheet_set_array_formula:a_,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}};class m0{static detectHeaderRows(r,t){const{filteredData:a,filteredEmptyRows:n}=this.filterEmptyLeadingRows(r);let i=1;t!==void 0?i=t:i=this.autoDetectHeaderRows(a);const s=a.slice(0,i),o=this.filterTitleRows(s);return{headerRows:i,dataStartRow:i,effectiveHeaderRows:o,filteredEmptyRows:n}}static filterEmptyLeadingRows(r){if(r.length===0)return{filteredData:r,filteredEmptyRows:0};let t=0;for(let a=0;a<r.length;a++){const n=r[a];if(this.hasContentInFirstThreeColumns(n)){t=a;break}}return t>0?{filteredData:r.slice(t),filteredEmptyRows:t}:{filteredData:r,filteredEmptyRows:0}}static hasContentInFirstThreeColumns(r){if(!r||r.length===0)return!1;const t=Math.min(3,r.length);for(let a=0;a<t;a++){const n=String(r[a]||"").trim();if(n!=="")return!(a===0&&n.length>20&&r.slice(1,t).every(o=>String(o||"").trim()===""))}return!1}static autoDetectHeaderRows(r){const t=Math.min(5,r.length);let a=1;const n=r[0]||[],i=r[1]||[],s=this.getNonEmptyCells(n),o=this.getNonEmptyCells(i),c=this.isTitleRow(s),f=this.isHeaderRow(o);if(c&&f)return 2;if(f&&!c)return 1;for(let l=0;l<t-1;l++){const h=r[l]||[],u=this.getNonEmptyCells(h),x=this.isTitleRow(u),p=this.isHeaderRow(u),d=this.isDataRow(u);if(x&&p)a=Math.max(a,l+2);else if(p&&!d&&l<t-2){const m=r[l+2]||[],E=this.getNonEmptyCells(m);this.isDataRow(E)||(a=Math.max(a,l+2))}}return a}static filterTitleRows(r){for(let t=0;t<r.length;t++){const a=r[t],n=this.getNonEmptyCells(a);if(n.length===1&&n[0].length>20)return r.slice(t+1)}return r}static getNonEmptyCells(r){return r.filter(t=>String(t||"").trim()!=="")}static isTitleRow(r){return r.length===1&&r[0].length>20}static isHeaderRow(r){return r.length>3}static isDataRow(r){return r.length>0&&r.some(t=>{const a=String(t||"").trim();return/^\d+$/.test(a)||/^\d{4}-\d{1,2}-\d{1,2}/.test(a)||a.length<=10})}static mergeHeaders(r,t){const a=[];for(let n=0;n<t;n++){const i=[];let s=!1;for(let o=r.length-1;o>=0;o--){const c=r[o][n],f=String(c||"").trim();f!==""?s||i.unshift(f):s=!0}a.push(i.length>0?i.join(" - "):`列${n+1}`)}return a}}function g0(e){if(e){if(e.length===8)return"#"+e.substring(2);if(e.length===6)return"#"+e}}function n_(e,r){return{0:"#FFFFFF",1:"#000000",2:"#E7E6E6",3:"#44546A",4:"#4472C4",5:"#ED7D31",6:"#A5A5A5",7:"#FFC000",8:"#5B9BD5",9:"#70AD47"}[e]}function ln(e){if(e){if(e.rgb)return g0(e.rgb);if(e.argb)return g0(e.argb);if(e.theme!==void 0)return n_(e.theme,e.tint);if(e.indexed!==void 0)return{64:"#000000",65:"#FFFFFF",8:"#000000",9:"#FFFFFF",10:"#FF0000",11:"#00FF00",12:"#0000FF",13:"#FFFF00",14:"#FF00FF",15:"#00FFFF"}[e.indexed]}}class i_{static extractStyles(r,t,a){const n=new Map,i=t.Styles;if(!i)return;const s=i.Fonts||[],o=i.Fills||[],c=i.CellXf||[],f=Lt.decode_range(r["!ref"]||"A1");for(let l=a;l<=f.e.r;l++)for(let h=f.s.c;h<=f.e.c;h++){const u=Lt.encode_cell({r:l,c:h}),x=r[u];if((x==null?void 0:x.s)!==void 0){const p=this.extractCellStyle(x,s,o,c);if(p&&this.hasNonDefaultStyle(p)){const d=l-a;n.set(`${d}-${h}`,p)}}}return n.size>0?n:void 0}static extractCellStyle(r,t,a,n){var f;const i={};let s=null,o,c;if(typeof r.s=="number")s=n[r.s],o=(s==null?void 0:s.fontId)??(s==null?void 0:s.fontid),c=(s==null?void 0:s.fillId)??(s==null?void 0:s.fillid);else if(typeof r.s=="object"&&(s=r.s,o=s.fontId??s.fontid,c=s.fillId??s.fillid,s.patternType==="solid")){if(s.fgColor&&Object.keys(s.fgColor).length>0){const l=ln(s.fgColor);l&&(i.bgColor=l)}if(!i.bgColor&&((f=s.bgColor)==null?void 0:f.indexed)!==void 0){const l=ln(s.bgColor);l&&(i.bgColor=l)}}return s&&(this.extractFontStyle(i,o,t),this.extractFillStyle(i,c,a)),i}static extractFontStyle(r,t,a){if(t!==void 0&&a[t]){const n=a[t];if(n.color){const i=ln(n.color);i&&i!=="#000000"&&(r.fontColor=i)}n.bold&&(r.bold=!0),n.italic&&(r.italic=!0)}}static extractFillStyle(r,t,a){if(t!==void 0&&a[t]){const n=a[t];if(n.patternType==="solid"&&n.fgColor){const i=ln(n.fgColor);i&&(r.bgColor=i)}}}static hasNonDefaultStyle(r){return!!(r.fontColor||r.bgColor||r.bold||r.italic)}}class s_{static extractComments(r,t){const a=new Map;return this.collectComments(r).forEach(i=>{const s=Lt.decode_cell(i.r),o=s.r-t,c=s.c;if(o>=0){const f=`${o}-${c}`,l=this.cleanCommentText(i.t,i.a);a.set(f,{text:l,author:i.a})}}),a.size>0?a:void 0}static collectComments(r){let t=[];return r["!comments"]&&(t=r["!comments"]),t.length===0&&(t=this.extractCommentsFromCells(r)),t}static extractCommentsFromCells(r){const t=[];return Object.keys(r).forEach(a=>{if(!a.startsWith("!")){const n=r[a];n!=null&&n.c&&Array.isArray(n.c)&&n.c.forEach(i=>{const s=i.t||(i.r&&typeof i.r=="string"?i.r:"");s&&t.push({r:a,t:s,a:i.a})})}}),t}static cleanCommentText(r,t){let a=r;return t&&a.startsWith(t+":")&&(a=a.substring(t.length+1).trim(),a.startsWith(`
|
|
106
|
-
`)&&(a=a.substring(1))),a}}class Qi{static parseBuffer(r,t={}){const{sheetIndex:a=0,headerRow:n=0,headerRows:i,mergeHeaders:s=!0,extractStyles:o=!0,extractComments:c=!0}=t,f=Ca(r,{type:"array",cellStyles:!0,cellNF:!0}),l=f.SheetNames;if(a>=l.length)throw new Error(`Sheet index ${a} out of range. Available sheets: ${l.length}`);const h=f.Sheets[l[a]],u=Lt.sheet_to_json(h,{header:1,defval:""});if(u.length===0)return{columns:[],records:[]};const x=u.slice(n),{headerRows:p,dataStartRow:d,effectiveHeaderRows:m,filteredEmptyRows:E}=m0.detectHeaderRows(x,i),F=n+E,v=F+d,b=this.buildColumns(u,F,p,m,s),N=u.slice(v),R=o?i_.extractStyles(h,f,v):void 0,y=c?s_.extractComments(h,v):void 0;return{columns:b,records:N,cellStyles:R,cellComments:y}}static buildColumns(r,t,a,n,i){if(i&&a>1){const o=r.slice(t,t+a),c=Math.max(...o.map(l=>l.length));return m0.mergeHeaders(n,c).map((l,h)=>({key:`col_${h}`,field:h,title:l,width:120,sort:!1,filter:!1}))}return(r[t]||[]).map((o,c)=>({key:`col_${c}`,field:c,title:String(o||""),width:120,sort:!1,filter:!1}))}static parseAllSheets(r,t={}){const n=Ca(r,{type:"array",cellStyles:!0,cellNF:!0}).SheetNames,i=[];for(let s=0;s<n.length;s++)try{const o=this.parseBuffer(r,{...t,sheetIndex:s});i.push({sheetName:n[s],sheetIndex:s,columns:o.columns,records:o.records,cellStyles:o.cellStyles,cellComments:o.cellComments,hasError:!1,errorCount:0})}catch(o){console.warn(`解析 Sheet "${n[s]}" 失败:`,o),i.push({sheetName:n[s],sheetIndex:s,columns:[],records:[],hasError:!0,errorCount:0})}return{sheets:i,sheetNames:n,activeSheetIndex:0}}static getSheetNames(r){return Ca(r,{type:"array"}).SheetNames}}class Oc{static exportToStream(r,t,a){const{filterEmptyColumns:n=!0}=a||{},i=n?this.filterEmptyColumns(r):r,s=i.map(h=>h.title||h.field||""),o=this.buildDataRows(t,r,i)
|
|
106
|
+
`)&&(a=a.substring(1))),a}}class Qi{static parseBuffer(r,t={}){const{sheetIndex:a=0,headerRow:n=0,headerRows:i,mergeHeaders:s=!0,extractStyles:o=!0,extractComments:c=!0}=t,f=Ca(r,{type:"array",cellStyles:!0,cellNF:!0}),l=f.SheetNames;if(a>=l.length)throw new Error(`Sheet index ${a} out of range. Available sheets: ${l.length}`);const h=f.Sheets[l[a]],u=Lt.sheet_to_json(h,{header:1,defval:""});if(u.length===0)return{columns:[],records:[]};const x=u.slice(n),{headerRows:p,dataStartRow:d,effectiveHeaderRows:m,filteredEmptyRows:E}=m0.detectHeaderRows(x,i),F=n+E,v=F+d,b=this.buildColumns(u,F,p,m,s),N=u.slice(v),R=o?i_.extractStyles(h,f,v):void 0,y=c?s_.extractComments(h,v):void 0;return{columns:b,records:N,cellStyles:R,cellComments:y}}static buildColumns(r,t,a,n,i){if(i&&a>1){const o=r.slice(t,t+a),c=Math.max(...o.map(l=>l.length));return m0.mergeHeaders(n,c).map((l,h)=>({key:`col_${h}`,field:h,title:l,width:120,sort:!1,filter:!1}))}return(r[t]||[]).map((o,c)=>({key:`col_${c}`,field:c,title:String(o||""),width:120,sort:!1,filter:!1}))}static parseAllSheets(r,t={}){const n=Ca(r,{type:"array",cellStyles:!0,cellNF:!0}).SheetNames,i=[];for(let s=0;s<n.length;s++)try{const o=this.parseBuffer(r,{...t,sheetIndex:s});i.push({sheetName:n[s],sheetIndex:s,columns:o.columns,records:o.records,cellStyles:o.cellStyles,cellComments:o.cellComments,hasError:!1,errorCount:0})}catch(o){console.warn(`解析 Sheet "${n[s]}" 失败:`,o),i.push({sheetName:n[s],sheetIndex:s,columns:[],records:[],hasError:!0,errorCount:0})}return{sheets:i,sheetNames:n,activeSheetIndex:0}}static getSheetNames(r){return Ca(r,{type:"array"}).SheetNames}}class Oc{static exportToStream(r,t,a){const{filterEmptyColumns:n=!0}=a||{},i=n?this.filterEmptyColumns(r):r,s=i.map(h=>h.title||h.field||""),o=this.buildDataRows(t,r,i),c=[s,...o],f=Lt.aoa_to_sheet(c),l=Lt.book_new();return Lt.book_append_sheet(l,f,"Sheet1"),bc(l,{bookType:"xlsx",type:"array"})}static download(r,t="export"){const a=new Blob([r],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),n=URL.createObjectURL(a),i=document.createElement("a");i.href=n,i.download=`${t}.xlsx`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n)}static filterEmptyColumns(r){return r.filter(t=>{const a=t.title||t.field||"";return a&&typeof a=="string"&&a.trim()!==""})}static buildDataRows(r,t,a){return r.map(n=>Array.isArray(n)?a.map(i=>{const s=t.indexOf(i);if(s>=0&&s<n.length){const o=n[s];return this.extractCellValue(o)}return""}):a.map(i=>{const s=i.field||i.key,o=s?n[s]:void 0;return this.extractCellValue(o)}))}static extractCellValue(r){return r&&typeof r=="object"&&"value"in r?r.value:r}}async function es(e){const r=await fetch(e);if(!r.ok)throw new Error(`Failed to fetch Excel file: ${r.statusText}`);return r.arrayBuffer()}function Ln(e,r={}){return Qi.parseBuffer(e,r)}async function Nc(e,r={}){const t=await es(e);return Ln(t,r)}async function Lc(e,r={}){const t=await f_(e);return Ln(t,r)}function o_(e,r,t){return Oc.exportToStream(e,r,t)}function c_(e,r="export"){Oc.download(e,r)}function f_(e){return new Promise((r,t)=>{const a=new FileReader;a.onload=n=>{var s;const i=(s=n.target)==null?void 0:s.result;r(i)},a.onerror=()=>t(new Error("Failed to read file")),a.readAsArrayBuffer(e)})}function rs(e,r={}){return Qi.parseAllSheets(e,r)}async function Pc(e,r={}){const t=await es(e);return rs(t,r)}function l_(e){return Qi.getSheetNames(e)}class Mc{constructor(r){xe(this,"container");xe(this,"tabsElement",null);xe(this,"sheets",[]);xe(this,"activeIndex",0);xe(this,"onTabChange");this.container=r.container,this.sheets=r.sheets,this.activeIndex=r.activeIndex??0,this.onTabChange=r.onTabChange,this.init()}init(){this.injectStyles(),this.render()}injectStyles(){const r="sl-sheet-tabs-styles";if(document.getElementById(r))return;const t=document.createElement("style");t.id=r,t.textContent=`
|
|
107
107
|
.sl-sheet-tabs-container{
|
|
108
108
|
margin-top:16px;
|
|
109
109
|
}
|
|
@@ -601,12 +601,12 @@
|
|
|
601
601
|
opacity: 0.8;
|
|
602
602
|
transition: opacity 0.2s;
|
|
603
603
|
margin-top:-3px;
|
|
604
|
-
`,s.onmouseenter=()=>s.style.opacity="1",s.onmouseleave=()=>s.style.opacity="0.8",n.appendChild(s),document.body.appendChild(n);let o,c,f;const l=()=>{clearTimeout(o),clearTimeout(f),n.classList.remove("show"),c=setTimeout(()=>{clearTimeout(c),n.parentNode&&document.body.removeChild(n)},300)};s.onclick=l,f=setTimeout(()=>{clearTimeout(f),n.classList.add("show")},10),o=setTimeout(l,3e3)}setTableInstance(r){this.tableInstance=r,this.state.matches=[],this.state.currentIndex=0,this.clearResults()}setSelectedColumnsOnly(r){this.elements.selectedColumnsOnly&&(this.elements.selectedColumnsOnly.checked=r)}getSelectedColumnsOnly(){var r;return((r=this.elements.selectedColumnsOnly)==null?void 0:r.checked)||!1}setFindText(r){this.state.findText=r,this.elements.findInput&&(this.elements.findInput.value=r)}setReplaceText(r){this.state.replaceText=r,this.elements.replaceInput&&(this.elements.replaceInput.value=r)}destroy(){this.dialog&&(this.dialog.remove(),this.dialog=null)}}class p_{constructor(r={addColumnEnable:!0,addRowEnable:!0}){var t,a,n;this.id="add-row-column",this.name="Add Row Column",this.runTime=[Kt.TABLE_EVENT_TYPE.MOUSEENTER_CELL,Kt.TABLE_EVENT_TYPE.MOUSELEAVE_CELL,Kt.TABLE_EVENT_TYPE.MOUSELEAVE_TABLE],this.id=(t=r.id)!==null&&t!==void 0?t:this.id,this.pluginOptions=r,this.pluginOptions.addColumnEnable=(a=this.pluginOptions.addColumnEnable)===null||a===void 0||a,this.pluginOptions.addRowEnable=(n=this.pluginOptions.addRowEnable)===null||n===void 0||n,this.pluginOptions.addColumnEnable&&(this.initAddColumnDomElement(),this.bindEventForAddColumn()),this.pluginOptions.addRowEnable&&(this.initAddRowDomElement(),this.bindEventForAddRow())}run(...r){const t=r[0],a=r[1],n=r[2];if(this.table=n,a===Kt.TABLE_EVENT_TYPE.MOUSEENTER_CELL){clearTimeout(this.hideAllTimeoutId_addColumn),clearTimeout(this.hideAllTimeoutId_addRow);const i=n.canvas.getBoundingClientRect(),s=n.getCellAtRelativePosition(t.event.clientX-i.left,t.event.clientY-i.top);this.hoverCell=s;const o=n.getCellRelativeRect(s.col,s.row);if(this.pluginOptions.addColumnEnable){const c=n.isSeriesNumber(s.col,0);this.showDotForAddColumn(i.top-6,o.left+i.left,o.right+i.left,!c)}if(this.pluginOptions.addRowEnable){const c=n.isHeader(s.col,s.row);this.showDotForAddRow(o.top+i.top,i.left-6,o.bottom+i.top,!c,!c)}}else a===Kt.TABLE_EVENT_TYPE.MOUSELEAVE_CELL||a===Kt.TABLE_EVENT_TYPE.MOUSELEAVE_TABLE&&(this.pluginOptions.addColumnEnable&&this.delayHideAllForAddColumn(),this.pluginOptions.addRowEnable&&this.delayHideAllForAddRow())}initAddColumnDomElement(){this.leftDotForAddColumn=document.createElement("div"),this.leftDotForAddColumn.style.width="6px",this.leftDotForAddColumn.style.height="6px",this.leftDotForAddColumn.style.backgroundColor="#4A90E2",this.leftDotForAddColumn.style.position="absolute",this.leftDotForAddColumn.style.cursor="pointer",this.leftDotForAddColumn.style.zIndex="1000",this.leftDotForAddColumn.style.borderRadius="50%",this.leftDotForAddColumn.style.border="1px solid white",this.leftDotForAddColumn.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.leftDotForAddColumn),this.rightDotForAddColumn=document.createElement("div"),this.rightDotForAddColumn.style.width="6px",this.rightDotForAddColumn.style.height="6px",this.rightDotForAddColumn.style.backgroundColor="#4A90E2",this.rightDotForAddColumn.style.position="absolute",this.rightDotForAddColumn.style.cursor="pointer",this.rightDotForAddColumn.style.zIndex="1000",this.rightDotForAddColumn.style.borderRadius="50%",this.rightDotForAddColumn.style.border="1px solid white",this.rightDotForAddColumn.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.rightDotForAddColumn),this.addIconForAddColumn=document.createElement("div"),this.addIconForAddColumn.style.width="18px",this.addIconForAddColumn.style.height="18px",this.addIconForAddColumn.style.backgroundColor="#4A90E2",this.addIconForAddColumn.style.position="absolute",this.addIconForAddColumn.style.zIndex="1001",this.addIconForAddColumn.style.display="none",this.addIconForAddColumn.style.borderRadius="50%",this.addIconForAddColumn.style.boxShadow="0 2px 5px rgba(0,0,0,0.2)",this.addIconForAddColumn.style.justifyContent="center",this.addIconForAddColumn.style.alignItems="center",this.addIconForAddColumn.style.border="1px solid white",document.body.appendChild(this.addIconForAddColumn);const r=document.createElement("div");r.textContent="+",r.style.color="white",r.style.fontSize="18px",r.style.fontWeight="bold",r.style.lineHeight="15px",r.style.userSelect="none",r.style.cursor="pointer",r.style.verticalAlign="top",r.style.textAlign="center",this.addIconForAddColumn.appendChild(r),this.addLineForAddColumn=document.createElement("div"),this.addLineForAddColumn.style.width="2px",this.addLineForAddColumn.style.height="10px",this.addLineForAddColumn.style.backgroundColor="#4A90E2",this.addLineForAddColumn.style.position="absolute",this.addLineForAddColumn.style.zIndex="1001",this.addLineForAddColumn.style.display="none",document.body.appendChild(this.addLineForAddColumn)}bindEventForAddColumn(){this.leftDotForAddColumn.addEventListener("mouseenter",()=>{clearTimeout(this.hideAllTimeoutId_addColumn),this.addIconForAddColumn.style.display="block";const r=this.leftDotForAddColumn.offsetWidth,t=this.leftDotForAddColumn.offsetHeight;this.showAddIconForAddColumn(this.leftDotForAddColumn.offsetLeft+r/2,this.leftDotForAddColumn.offsetTop+t/2,!0),this.showSplitLineForAddColumn(this.leftDotForAddColumn.offsetLeft+r/2-1,this.leftDotForAddColumn.offsetTop+t/2+2,this.table.getDrawRange().height)}),this.rightDotForAddColumn.addEventListener("mouseenter",()=>{clearTimeout(this.hideAllTimeoutId_addColumn),this.addIconForAddColumn.style.display="block";const r=this.rightDotForAddColumn.offsetWidth,t=this.rightDotForAddColumn.offsetHeight;this.showAddIconForAddColumn(this.rightDotForAddColumn.offsetLeft+r/2,this.rightDotForAddColumn.offsetTop+t/2,!1),this.showSplitLineForAddColumn(this.rightDotForAddColumn.offsetLeft+r/2-1,this.rightDotForAddColumn.offsetTop+t/2+2,this.table.getDrawRange().height)}),this.addIconForAddColumn.addEventListener("mouseleave",()=>{this.addIconForAddColumn.style.display="none",this.addLineForAddColumn.style.display="none",this.delayHideAllForAddColumn()}),this.addIconForAddColumn.addEventListener("click",r=>{const t=this.addIconForAddColumn.dataset.addIconType==="left",a=(this.table.options.columns,this.hoverCell.col),n=t?a:a+1;this.pluginOptions.addColumnCallback?this.pluginOptions.addColumnCallback(n,this.table):this.table.addColumns([{field:n,title:`New Column ${a}`,width:100}],n,!0),this.delayHideAllForAddColumn(0)})}showDotForAddColumn(r,t,a,n=!0,i=!0){const s=this.leftDotForAddColumn.offsetWidth,o=this.leftDotForAddColumn.offsetHeight;this.leftDotForAddColumn.style.left=t-s/2+"px",this.leftDotForAddColumn.style.top=r-o/2+"px",this.rightDotForAddColumn.style.left=a-s/2+"px",this.rightDotForAddColumn.style.top=r-o/2+"px",this.leftDotForAddColumn.style.display=n?"block":"none",this.rightDotForAddColumn.style.display=i?"block":"none"}showAddIconForAddColumn(r,t,a){const n=this.addIconForAddColumn.offsetWidth,i=this.addIconForAddColumn.offsetHeight,s=this.leftDotForAddColumn.offsetHeight;this.addIconForAddColumn.style.left=r-n/2+"px",this.addIconForAddColumn.style.top=t-i/2-s/2+"px",this.addIconForAddColumn.dataset.addIconType=a?"left":"right"}showSplitLineForAddColumn(r,t,a){this.addLineForAddColumn.style.left=`${r}px`,this.addLineForAddColumn.style.top=`${t}px`,this.addLineForAddColumn.style.height=`${a}px`,this.addLineForAddColumn.style.display="block"}delayHideAllForAddColumn(r=1e3){this.hideAllTimeoutId_addColumn=setTimeout(()=>{this.addIconForAddColumn.style.display="none",this.addLineForAddColumn.style.display="none",this.leftDotForAddColumn.style.display="none",this.rightDotForAddColumn.style.display="none"},r)}initAddRowDomElement(){this.topDotForAddRow=document.createElement("div"),this.topDotForAddRow.style.width="6px",this.topDotForAddRow.style.height="6px",this.topDotForAddRow.style.backgroundColor="#4A90E2",this.topDotForAddRow.style.position="absolute",this.topDotForAddRow.style.cursor="pointer",this.topDotForAddRow.style.zIndex="1000",this.topDotForAddRow.style.borderRadius="50%",this.topDotForAddRow.style.border="1px solid white",this.topDotForAddRow.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.topDotForAddRow),this.bottomDotForAddRow=document.createElement("div"),this.bottomDotForAddRow.style.width="6px",this.bottomDotForAddRow.style.height="6px",this.bottomDotForAddRow.style.backgroundColor="#4A90E2",this.bottomDotForAddRow.style.position="absolute",this.bottomDotForAddRow.style.cursor="pointer",this.bottomDotForAddRow.style.zIndex="1000",this.bottomDotForAddRow.style.borderRadius="50%",this.bottomDotForAddRow.style.border="1px solid white",this.bottomDotForAddRow.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.bottomDotForAddRow),this.addIconForAddRow=document.createElement("div"),this.addIconForAddRow.style.width="18px",this.addIconForAddRow.style.height="18px",this.addIconForAddRow.style.backgroundColor="#4A90E2",this.addIconForAddRow.style.position="absolute",this.addIconForAddRow.style.zIndex="1001",this.addIconForAddRow.style.display="none",this.addIconForAddRow.style.borderRadius="50%",this.addIconForAddRow.style.boxShadow="0 2px 5px rgba(0,0,0,0.2)",this.addIconForAddRow.style.justifyContent="center",this.addIconForAddRow.style.alignItems="center",this.addIconForAddRow.style.border="1px solid white",document.body.appendChild(this.addIconForAddRow);const r=document.createElement("div");r.textContent="+",r.style.color="white",r.style.fontSize="18px",r.style.fontWeight="bold",r.style.lineHeight="15px",r.style.userSelect="none",r.style.cursor="pointer",r.style.verticalAlign="top",r.style.textAlign="center",this.addIconForAddRow.appendChild(r),this.addLineForAddRow=document.createElement("div"),this.addLineForAddRow.style.width="10px",this.addLineForAddRow.style.height="2px",this.addLineForAddRow.style.backgroundColor="#4A90E2",this.addLineForAddRow.style.position="absolute",this.addLineForAddRow.style.zIndex="1001",this.addLineForAddRow.style.display="none",document.body.appendChild(this.addLineForAddRow)}bindEventForAddRow(){this.topDotForAddRow.addEventListener("mouseenter",()=>{clearTimeout(this.hideAllTimeoutId_addRow),this.addIconForAddRow.style.display="block";const r=this.topDotForAddRow.offsetWidth,t=this.topDotForAddRow.offsetHeight;this.showAddIconForAddRow(this.topDotForAddRow.offsetLeft+r/2,this.topDotForAddRow.offsetTop+t/2,!0),this.showSplitLineForAddRow(this.topDotForAddRow.offsetLeft+r+2,this.topDotForAddRow.offsetTop+t/2-1,this.table.getDrawRange().width)}),this.bottomDotForAddRow.addEventListener("mouseenter",()=>{clearTimeout(this.hideAllTimeoutId_addRow),this.addIconForAddRow.style.display="block";const r=this.bottomDotForAddRow.offsetWidth,t=this.bottomDotForAddRow.offsetHeight;this.showAddIconForAddRow(this.bottomDotForAddRow.offsetLeft+r/2,this.bottomDotForAddRow.offsetTop+t/2,!1),this.showSplitLineForAddRow(this.bottomDotForAddRow.offsetLeft+r+2,this.bottomDotForAddRow.offsetTop+t/2-1,this.table.getDrawRange().height)}),this.addIconForAddRow.addEventListener("mouseleave",()=>{this.addIconForAddRow.style.display="none",this.addLineForAddRow.style.display="none",this.delayHideAllForAddRow()}),this.addIconForAddRow.addEventListener("click",r=>{const t=this.addIconForAddRow.dataset.addIconType==="top",a=this.hoverCell.row,n=t?a:a+1;if(this.pluginOptions.addRowCallback)this.pluginOptions.addRowCallback(n,this.table);else{const i=this.table.getRecordIndexByCell(0,n);this.table.addRecord({},i)}this.delayHideAllForAddRow(0)})}showDotForAddRow(r,t,a,n=!0,i=!0){const s=this.topDotForAddRow.offsetWidth,o=this.topDotForAddRow.offsetHeight;this.topDotForAddRow.style.left=t-s/2+"px",this.topDotForAddRow.style.top=r-o/2+"px",this.bottomDotForAddRow.style.left=t-s/2+"px",this.bottomDotForAddRow.style.top=a-o/2+"px",this.topDotForAddRow.style.display=n?"block":"none",this.bottomDotForAddRow.style.display=i?"block":"none"}showAddIconForAddRow(r,t,a){const n=this.addIconForAddRow.offsetWidth,i=this.addIconForAddRow.offsetHeight,s=this.topDotForAddRow.offsetWidth;this.addIconForAddRow.style.left=r-n/2-s/2+"px",this.addIconForAddRow.style.top=t-i/2+"px",this.addIconForAddRow.dataset.addIconType=a?"top":"bottom"}showSplitLineForAddRow(r,t,a){this.addLineForAddRow.style.left=`${r}px`,this.addLineForAddRow.style.top=`${t}px`,this.addLineForAddRow.style.width=`${a}px`,this.addLineForAddRow.style.display="block"}delayHideAllForAddRow(r=1e3){this.hideAllTimeoutId_addRow=setTimeout(()=>{this.addIconForAddRow.style.display="none",this.addLineForAddRow.style.display="none",this.topDotForAddRow.style.display="none",this.bottomDotForAddRow.style.display="none"},r)}release(){this.leftDotForAddColumn.remove(),this.rightDotForAddColumn.remove(),this.addIconForAddColumn.remove(),this.addLineForAddColumn.remove(),this.topDotForAddRow.remove(),this.bottomDotForAddRow.remove(),this.addIconForAddRow.remove(),this.addLineForAddRow.remove()}}class m_{constructor(r,t){xe(this,"customComponentContainers",new Map);xe(this,"activeComponentKey",null);xe(this,"justCreatedComponent",!1);xe(this,"tableInstance",null);xe(this,"container",null);xe(this,"handleOutsideClick",r=>{if(this.justCreatedComponent||!this.activeComponentKey)return;const t=this.customComponentContainers.get(this.activeComponentKey);t&&!t.contains(r.target)&&this.closeActiveComponent()});this.tableInstance=r,this.container=t,this.bindOutsideClickHandler()}showComponent(r,t,a){var p;const{col:n,row:i}=a,s=this.tableInstance.getCellRect(n,i),o=this.tableInstance.getCellValue(n,i),c=(p=this.container)==null?void 0:p.getBoundingClientRect(),f=((c==null?void 0:c.left)||0)+s.left,l=((c==null?void 0:c.top)||0)+s.bottom,h=this.createComponentContainer(f,l,t),u={table:this.tableInstance,row:i,col:n,value:o,dataValue:a.dataValue,rect:s,setValue:d=>{this.tableInstance.changeCellValue(n,i,d),this.closeActiveComponent()},close:()=>{this.closeActiveComponent()}};try{const d=t.render(u);h.appendChild(d),document.body.appendChild(h)}catch(d){console.error("❌ 渲染组件时出错:",d);return}const x=`${r}-${n}-${i}`;this.customComponentContainers.set(x,h),this.activeComponentKey=x,t.onMount&&t.onMount(h,u),h.addEventListener("click",d=>{d.stopPropagation()}),this.justCreatedComponent=!0,setTimeout(()=>{this.justCreatedComponent=!1},100)}createComponentContainer(r,t,a){const n=document.createElement("div");return n.className="vtable-custom-component",n.style.position="fixed",n.style.zIndex="9999",n.style.left=`${r}px`,n.style.top=`${t}px`,n.style.backgroundColor="white",n.style.borderRadius="4px",n.style.boxShadow="0 2px 12px rgba(0, 0, 0, 0.15)",a.containerStyle&&Object.assign(n.style,a.containerStyle),n}closeActiveComponent(){if(!this.activeComponentKey)return;const r=this.customComponentContainers.get(this.activeComponentKey);r&&(r.remove(),this.customComponentContainers.delete(this.activeComponentKey)),this.activeComponentKey=null}bindOutsideClickHandler(){document.addEventListener("click",this.handleOutsideClick)}destroy(){this.closeActiveComponent(),this.customComponentContainers.clear(),document.removeEventListener("click",this.handleOutsideClick)}}class v0{constructor(r,t){xe(this,"markedMap",null);xe(this,"tableInstance",null);xe(this,"markedCellsSet",null);xe(this,"tooltipThrottle",null);this.tableInstance=r,this.markedMap=t||null,t&&t.size>0&&(this.markedCellsSet=new Set(t.keys()),this.tooltipThrottle=new Map)}handleCellMouseEnter(r){if(!this.markedCellsSet||!this.tableInstance)return;const{col:t,row:a}=r,n=this.tableInstance.columnHeaderLevelCount||1,i=a-n;if(i<0)return;const s=`${i}-${t}`;if(!this.markedCellsSet.has(s))return;const o=`${t}-${a}`,c=Date.now(),f=this.tooltipThrottle.get(o)||0;c-f<100||(this.tooltipThrottle.set(o,c),this.showTooltip(t,a,s))}showTooltip(r,t,a){const n=this.tableInstance.getVisibleCellRangeRelativeRect({col:r,row:t}),i=this.markedMap.get(a),s=this.tableInstance.getCellValue(r,t),o=i==null?void 0:i.comment,c=o?`${s}: ${o}`:`${s}`;this.tableInstance.showTooltip(r,t,{content:c,referencePosition:{rect:n,placement:"right"},className:"defineTooltip",disappearDelay:100,style:{bgColor:"black",color:"white",arrowMark:!0,padding:[5,11]}})}getMarkedMap(){return this.markedMap}setMarkedMap(r){this.markedMap=r}destroy(){this.markedMap=null,this.tableInstance=null}}class g_{static registerEditors(r){if(r){if(r.dateEditor!==!1){const t=new ss.DateInputEditor(r.dateEditor||{});hn.VTable.register.editor("dateEditor",t)}if(r.listEditor){const t=new ss.ListEditor(r.listEditor||{values:["技术中心","财务部"]});hn.VTable.register.editor("listEditor",t)}r.customEditors&&Object.entries(r.customEditors).forEach(([t,a])=>{hn.VTable.register.editor(t,a)})}}}class v_{constructor(r,t,a){xe(this,"tableInstance");xe(this,"config");xe(this,"customComponentManager",null);xe(this,"cellMarkManager",null);this.config=r,this.tableInstance=r.tableInstance,this.customComponentManager=t,this.cellMarkManager=a}bindEvents(){this.tableInstance&&(this.tableInstance.on("click_cell",r=>{var t,a;this.handleCellClick(r),(a=(t=this.config).onCellClick)==null||a.call(t,r)}),this.config.onCellChange&&this.tableInstance.on("change_cell_value",this.config.onCellChange),this.tableInstance.on("mouseenter_cell",r=>{var t;(t=this.cellMarkManager)==null||t.handleCellMouseEnter(r)}))}handleCellClick(r){var o,c,f;const{col:t}=r,n=(this.config.columns||[])[t];if(!(n!=null&&n.customComponent))return;const i=n.customComponent,s=(o=this.config.customComponents)==null?void 0:o[i];s!=null&&s.showOnClick&&((c=this.customComponentManager)==null||c.closeActiveComponent(),(f=this.customComponentManager)==null||f.showComponent(i,s,r))}on(r,t){var a;(a=this.tableInstance)==null||a.on(r,t)}off(r,t){var a;(a=this.tableInstance)==null||a.off(r,t)}destroy(){this.tableInstance&&(this.tableInstance.off("click_cell"),this.tableInstance.off("change_cell_value"),this.tableInstance.off("mouseenter_cell")),this.tableInstance=null,this.customComponentManager=null,this.cellMarkManager=null}}class _0{constructor(r,t){xe(this,"sheetInstance");xe(this,"tableInstance");xe(this,"container",null);xe(this,"config");xe(this,"customComponentManager",null);xe(this,"cellMarkManager",null);xe(this,"eventManager",null);xe(this,"lastWidth",0);xe(this,"lastHeight",0);xe(this,"resizeTimeout",null);this.config=r,this.cellMarkManager=new v0(null,t),this.init()}init(){const r=this.config.container;if(this.container=this.getContainer(r),!this.container)throw console.error("TableSheet: Container not found",{input:r}),new Error("Container not found");(this.container.offsetWidth===0||this.container.offsetHeight===0)&&console.warn("TableSheet: Container has zero dimensions",{width:this.container.offsetWidth,height:this.container.offsetHeight}),g_.registerEditors(this.config.editors),this.createSheet()}getContainer(r){return typeof r=="string"?document.getElementById(r)||document.querySelector(r):r}createSheet(){var o;const{columns:r=[],records:t=[],showFormulaBar:a=!0,sheets:n,options:i}=this.config,s={showFormulaBar:a,showSheetTab:!0,sheets:n||[{sheetKey:"sheet1",sheetTitle:"Sheet1",dragOrder:{dragHeaderMode:"all"},columns:r,data:t}],tooltip:{isShowOverflowTextTooltip:!0},autoFillWidth:!0,autoFillHeight:!0,progressiveMode:!0,VTablePluginModules:[{module:p_,disabled:!0,moduleOptions:{addColumnEnable:!1,addRowEnable:!1}}],...i};this.sheetInstance=new hn.VTableSheet(this.container,s),this.tableInstance=(o=this.sheetInstance.getActiveSheet())==null?void 0:o.tableInstance,this.initManagers()}initManagers(){var r;this.customComponentManager=new m_(this.tableInstance,this.container),this.cellMarkManager=new v0(this.tableInstance,((r=this.cellMarkManager)==null?void 0:r.getMarkedMap())||void 0),this.eventManager=new v_({tableInstance:this.tableInstance,columns:this.config.columns,customComponents:this.config.customComponents,onCellClick:this.config.onCellClick,onCellChange:this.config.onCellChange},this.customComponentManager,this.cellMarkManager),this.eventManager.bindEvents()}changeCellValue(r,t,a){this.tableInstance&&this.tableInstance.changeCellValue(r,t,a)}getCellValue(r,t){var a;return(a=this.tableInstance)==null?void 0:a.getCellValue(r,t)}getSelectedCells(){var r;return(r=this.tableInstance)==null?void 0:r.getSelectedCellInfos()}updateData(r){var a;console.log("updateData 调用:",r.length,"条记录");const t=(a=this.sheetInstance)==null?void 0:a.getActiveSheet();if(t)if(typeof t.updateRecords=="function")console.log("使用 updateRecords 方法"),t.updateRecords(r);else if(typeof t.setData=="function")console.log("使用 setData 方法"),t.setData(r);else if(this.tableInstance)if(typeof this.tableInstance.updateOption=="function"){console.log("使用 tableInstance.updateOption 方法");try{this.tableInstance.updateOption({records:r})}catch(n){console.warn("tableInstance.updateOption 失败:",n),console.log("updateOption 失败,跳过数据更新")}}else console.warn("无法更新数据:找不到合适的方法");else console.warn("无法更新数据:找不到合适的方法");else console.warn("无法获取活动工作表")}updateColumns(r){var a;console.log("updateColumns 调用:",r.length,"列");const t=(a=this.sheetInstance)==null?void 0:a.getActiveSheet();if(t)if(typeof t.updateColumns=="function")console.log("使用 activeSheet.updateColumns 方法"),t.updateColumns(r);else if(typeof t.setColumns=="function")console.log("使用 setColumns 方法"),t.setColumns(r);else if(this.tableInstance)if(typeof this.tableInstance.updateOption=="function"){console.log("使用 tableInstance.updateOption 方法更新列");try{this.tableInstance.updateOption({columns:r})}catch(n){console.warn("tableInstance.updateOption 失败:",n),console.log("updateOption 失败,跳过列更新")}}else console.warn("无法更新列配置:找不到合适的方法");else console.warn("无法更新列配置:找不到合适的方法");else console.warn("无法获取活动工作表")}addRow(r,t){var n;const a=(n=this.sheetInstance)==null?void 0:n.getActiveSheet();a&&a.addRecord(r,t)}deleteRow(r){var a;const t=(a=this.sheetInstance)==null?void 0:a.getActiveSheet();t&&t.deleteRecord(r)}exportData(r="csv"){var t,a;return(a=(t=this.sheetInstance)==null?void 0:t.exportData)==null?void 0:a.call(t,r)}switchSheet(r){var t,a;(t=this.sheetInstance)==null||t.switchSheet(r),this.tableInstance=(a=this.sheetInstance.getActiveSheet())==null?void 0:a.tableInstance}getActiveSheet(){var r;return(r=this.sheetInstance)==null?void 0:r.getActiveSheet()}getAllSheets(){var r;return(r=this.sheetInstance)==null?void 0:r.getAllSheets()}refresh(){if(this.tableInstance&&this.tableInstance.option)try{this.tableInstance.updateOption(this.tableInstance.option)}catch(r){console.warn("刷新表格失败:",r);const t=this.tableInstance.container;t&&(t.style.display="none",setTimeout(()=>{t.style.display=""},0))}}setFrozenColCount(r){if(this.tableInstance)try{if(typeof this.tableInstance.setFrozenColCount=="function")this.tableInstance.setFrozenColCount(r);else if(typeof this.tableInstance.updateOption=="function"){const t=this.tableInstance.option||{};this.tableInstance.updateOption({...t,frozenColCount:r})}console.log(`冻结列设置成功: ${r} 列`)}catch(t){console.warn("设置冻结列失败:",t)}}resize(){if(!this.sheetInstance){console.warn("sheetInstance 不存在,无法 resize");return}const r=this.container;if(!r)return;const t=r.clientWidth,a=r.clientHeight;t===this.lastWidth&&a===this.lastHeight||(this.lastWidth=t,this.lastHeight=a,console.log(`resize 调用: 容器尺寸 ${t}x${a}`),typeof this.sheetInstance.resize=="function"?(console.log("使用 sheetInstance.resize()"),this.sheetInstance.resize()):console.warn("sheetInstance.resize 方法不可用"))}resizeDebounced(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.resize(),this.resizeTimeout=null},100)}getSheetInstance(){return this.sheetInstance}getTableInstance(){return this.tableInstance}setColumnCustomRender(r,t){var n;const a=(n=this.sheetInstance)==null?void 0:n.getActiveSheet();if(a){const i=a.columns||[],s=i.find(o=>o.field===r);s&&(s.customRender=t,a.updateColumns(i))}}getMarkedMap(){var r;return((r=this.cellMarkManager)==null?void 0:r.getMarkedMap())||null}getAllRecords(){if(!this.tableInstance)return[];const r=this.tableInstance.rowCount??0,t=this.tableInstance.colCount??0,a=this.tableInstance.columnHeaderLevelCount??1,n=[];for(let i=a;i<r;i++){const s=[];for(let o=0;o<t;o++)s.push(this.tableInstance.getCellValue(o,i));n.push(s)}return n}getColumns(){var r,t;return((t=(r=this.tableInstance)==null?void 0:r.options)==null?void 0:t.columns)||[]}on(r,t){var a;(a=this.eventManager)==null||a.on(r,t)}off(r,t){var a;(a=this.eventManager)==null||a.off(r,t)}destroy(){var r,t,a,n,i;(r=this.eventManager)==null||r.destroy(),(t=this.cellMarkManager)==null||t.destroy(),(a=this.customComponentManager)==null||a.destroy(),this.eventManager=null,this.cellMarkManager=null,this.customComponentManager=null,this.sheetInstance&&((i=(n=this.sheetInstance).destroy)==null||i.call(n),this.sheetInstance=null,this.tableInstance=null),this.container&&(this.container.innerHTML="")}}const __={toolbar:{title:"制表错误",unit:"条",total:"共 {total} 个错误项",hint:"请在错误项里查询对应的数据或在数据里进行搜索",buttons:{search:"查找/替换",freeze:{label:"冻结前",suffix:"列"},list:"仅显示错误列"}},dialog:{find:{label:"查找内容",placeholder:"请输入查找内容"},replace:{label:"替换为",placeholder:"请输入替换内容"},checkbox:{selectedOnly:"只替换选中列"},buttons:{close:"关闭",findPrev:"查找上一个",findNext:"查找下一个",replaceOne:"替换",replaceAll:"全部替换"},messages:{pleaseInputFind:"请输入查找内容",notConnected:"未连接表格实例",pleaseSelectColumns:"请先选中要搜索的列",noMatchFound:"未找到匹配内容",nothingToReplace:"没有可替换的内容",replacedOne:"已替换第 {index} 个匹配项",replacedAll:"已替换全部 {count} 个匹配项"},result:{found:"已找到 {count} 个结果"}},sheet:{defaultTitle:"Sheet1"}},w_={toolbar:{title:"製表錯誤",unit:"筆",total:"共 {total} 個錯誤項",hint:"請在錯誤項裡查詢對應的資料或在資料裡進行搜尋",buttons:{search:"尋找/取代",freeze:{label:"凍結前",suffix:"欄"},list:"僅顯示錯誤欄"}},dialog:{find:{label:"尋找內容",placeholder:"請輸入尋找內容"},replace:{label:"取代為",placeholder:"請輸入取代內容"},checkbox:{selectedOnly:"只取代選中欄"},buttons:{close:"關閉",findPrev:"尋找上一個",findNext:"尋找下一個",replaceOne:"取代",replaceAll:"全部取代"},messages:{pleaseInputFind:"請輸入尋找內容",notConnected:"未連接表格實例",pleaseSelectColumns:"請先選中要搜尋的欄",noMatchFound:"未找到符合內容",nothingToReplace:"沒有可取代的內容",replacedOne:"已取代第 {index} 個符合項",replacedAll:"已取代全部 {count} 個符合項"},result:{found:"已找到 {count} 個結果"}},sheet:{defaultTitle:"Sheet1"}},E_={toolbar:{title:"Table Errors",unit:"items",total:"Total {total} errors",hint:"Please search for the corresponding data in the error items or in the data",buttons:{search:"Find/Replace",freeze:{label:"Freeze first",suffix:"columns"},list:"Show error columns only"}},dialog:{find:{label:"Find content",placeholder:"Please enter content to find"},replace:{label:"Replace with",placeholder:"Please enter replacement content"},checkbox:{selectedOnly:"Replace selected columns only"},buttons:{close:"Close",findPrev:"Find Previous",findNext:"Find Next",replaceOne:"Replace",replaceAll:"Replace All"},messages:{pleaseInputFind:"Please enter content to find",notConnected:"Table instance not connected",pleaseSelectColumns:"Please select columns to search first",noMatchFound:"No matching content found",nothingToReplace:"Nothing to replace",replacedOne:"Replaced match #{index}",replacedAll:"Replaced all {count} matches"},result:{found:"Found {count} result(s)"}},sheet:{defaultTitle:"Sheet1"}},T_={"zh-CN":__,"en-US":E_,"zh-TW":w_};let k_="zh-CN";function y_(){return T_[k_]}function S_(e,r={}){return e.replace(/\{(\w+)\}/g,(t,a)=>r[a]!==void 0?String(r[a]):`{${a}}`)}function Zn(e,r){const t=y_(),a=e.split(".");let n=t;for(const i of a)if(n&&typeof n=="object"&&i in n)n=n[i];else return console.warn(`I18n message not found: ${e}`),e;return typeof n=="string"?S_(n,r||{}):(console.warn(`I18n message is not a string: ${e}`),e)}class F_{constructor(r){xe(this,"container",null);xe(this,"toolbarElement",null);xe(this,"config");xe(this,"elements",{});this.config={freezeCount:0,showErrorList:!1,buttons:{search:!0,freeze:!0,export:!0,refresh:!0,list:!1},...r},this.container=this.getContainer(this.config.container),this.createToolbar(),this.injectStyles()}getContainer(r){return Sn.getContainer(r)}createToolbar(){this.toolbarElement=document.createElement("div"),this.toolbarElement.className="sl-excel-toolbar";const r=this.createLeftSection(),t=this.createRightSection();this.toolbarElement.appendChild(r),this.toolbarElement.appendChild(t),this.container&&this.container.appendChild(this.toolbarElement)}createLeftSection(){const r=document.createElement("div");if(r.className="sl-excel-toolbar-left",this.config.leftSlot){const t=typeof this.config.leftSlot=="function"?this.config.leftSlot():this.config.leftSlot;t&&r.appendChild(t)}return r}createRightSection(){const r=document.createElement("div");r.className="sl-excel-toolbar-right";const{buttons:t}=this.config;if((t==null?void 0:t.search)!==!1){const a=this.createButton({text:Zn("toolbar.buttons.search"),onClick:()=>{var n,i;return(i=(n=this.config).onSearchClick)==null?void 0:i.call(n)}});r.appendChild(a)}if((t==null?void 0:t.freeze)!==!1){const a=this.createFreezeButton();r.appendChild(a)}return r}createButton(r){const t=document.createElement("button");return t.className=r.icon?"sl-excel-toolbar-btn sl-excel-toolbar-btn-icon":"sl-excel-toolbar-btn",t.textContent=r.text,r.title&&(t.title=r.title),r.onClick&&(t.onclick=r.onClick),t}createFreezeButton(){const r=document.createElement("div");r.className="sl-excel-freeze-selector";const t=document.createElement("span");t.className="sl-excel-freeze-label",t.textContent=Zn("toolbar.buttons.freeze.label");const a=document.createElement("div");a.className="sl-excel-freeze-input-wrapper";const n=document.createElement("input");n.type="number",n.className="sl-excel-freeze-input",n.min="0",n.max="100",n.value=String(this.config.freezeCount||0),this.elements.freezeSelect=n;const i=document.createElement("div");i.className="sl-excel-freeze-arrows";const s=document.createElement("button");s.className="sl-excel-freeze-arrow sl-excel-freeze-arrow-up",s.innerHTML="^",s.type="button";const o=document.createElement("button");o.className="sl-excel-freeze-arrow sl-excel-freeze-arrow-down",o.innerHTML="^",o.type="button",i.appendChild(s),i.appendChild(o);const c=document.createElement("span");c.className="sl-excel-freeze-suffix",c.textContent=Zn("toolbar.buttons.freeze.suffix");const f=l=>{var h,u;l<0&&(l=0),l>100&&(l=100),n.value=String(l),this.config.freezeCount=l,(u=(h=this.config).onFreezeChange)==null||u.call(h,l)};return s.onclick=l=>{l.preventDefault();const h=parseInt(n.value,10)||0;f(h+1)},o.onclick=l=>{l.preventDefault();const h=parseInt(n.value,10)||0;f(h-1)},n.oninput=()=>{let l=parseInt(n.value,10);(isNaN(l)||l<0)&&(l=0,n.value="0"),l>100&&(l=100,n.value="100"),this.config.freezeCount=l},n.onblur=()=>{var h,u;const l=parseInt(n.value,10)||0;(u=(h=this.config).onFreezeChange)==null||u.call(h,l)},n.onkeydown=l=>{l.key==="Enter"&&n.blur()},a.appendChild(n),a.appendChild(i),r.appendChild(t),r.appendChild(a),r.appendChild(c),r}injectStyles(){Sn.injectStyles(u_,h_)}updateFreezeCount(r){this.config.freezeCount=r,this.elements.freezeSelect&&(this.elements.freezeSelect.value=String(r))}updateShowErrorList(r){this.config.showErrorList=r,this.elements.errorListCheckbox&&(this.elements.errorListCheckbox.checked=r)}show(){this.toolbarElement&&(this.toolbarElement.style.display="flex")}hide(){this.toolbarElement&&(this.toolbarElement.style.display="none")}getElement(){return this.toolbarElement}setLeftSlot(r){var a;const t=(a=this.toolbarElement)==null?void 0:a.querySelector(".sl-toolbar-left");if(t&&(t.innerHTML="",r)){const n=typeof r=="function"?r():r;n&&t.appendChild(n)}}getLeftSection(){var r;return((r=this.toolbarElement)==null?void 0:r.querySelector(".sl-toolbar-left"))||null}destroy(){this.toolbarElement&&(this.toolbarElement.remove(),this.toolbarElement=null),this.elements={}}}class Qn{static processRecords(r,t){const a=new Map;return{displayRecords:r.map((i,s)=>Array.isArray(i)?this.processArrayRow(i,s,a):this.processObjectRow(i,s,t,a)),markedMap:a}}static processArrayRow(r,t,a){return r.map((n,i)=>n&&typeof n=="object"&&"value"in n?(n.isMarked&&a.set(`${t}-${i}`,{isMarked:!0,comment:n.comment||""}),n.value):n)}static processObjectRow(r,t,a,n){return a.map((i,s)=>{const o=i.field||i.key,c=r[o];return c&&typeof c=="object"&&"value"in c?(c.isMarked&&n.set(`${t}-${s}`,{isMarked:!0,comment:c.comment||""}),c.value):c})}}const A_=(e,r)=>({bgColor:"#FFEBEB",color:"#FF4D50",marked:{shape:"triangle",bgColor:"#FF4D50",size:8}}),w0={color:"#1D2129",fontSize:14,fontWeight:"400",bgColor:"#F9FAFB"},ei={color:"#6B7280",fontSize:14,bgColor:"white"};class E0{static initColumns(r,t,a=1){const n=new Map;if(t.size>0)for(const[i]of t){const[s,o]=i.split("-"),c=parseInt(s,10),f=parseInt(o,10);n.has(f)||n.set(f,new Set),n.get(f).add(c)}return r.map((i,s)=>{const o=i.style,c={...i},f=n.get(s);if(!f||f.size===0)return c.style=o||(()=>ei),c.headerStyle=w0,c;const l=new Map;return c.style=h=>{const u=h.row-a;if(u<0||!f.has(u))return o?o(h):ei;const x=`${u}-${s}`;let p=l.get(x);return p||(p=A_(),l.set(x,p)),{...o?o(h):ei,...p,bgColor:p.bgColor,color:p.color}},c.headerStyle=w0,c})}}class C_{constructor(r){xe(this,"tableSheet",null);xe(this,"findReplaceDialog",null);xe(this,"toolbar",null);xe(this,"sheetTabs",null);xe(this,"container",null);xe(this,"tableContainer",null);xe(this,"toolbarContainer",null);xe(this,"sheetTabsContainer",null);xe(this,"loadingOverlay",null);xe(this,"config");xe(this,"multiSheetData",null);xe(this,"timers",[]);xe(this,"resizeObserver",null);xe(this,"lastObservedWidth",0);xe(this,"lastObservedHeight",0);this.config={showToolbar:!0,autoResize:!1,loading:{show:!0,text:"加载中..."},...r},this.init()}init(){if(this.container=this.getContainer(this.config.container),!this.container)throw new Error("Container not found");if(this.createLayout(),this.config.showToolbar&&this.createToolbar(),this.injectStyles(),this.createTable(),this.config.showSheets===!1&&this.container){this.container.classList.add("hide-native-sheet-tab");const r=setTimeout(()=>{this.container&&this.container.querySelectorAll(".vtable-sheet-tab-bar").forEach(n=>{n.style.display="none"});const t=this.timers.indexOf(r);t>-1&&this.timers.splice(t,1)},0);this.timers.push(r)}!this.config.showFormulaBar&&this.container&&this.container.classList.add("hide-formula-bar"),this.createFindReplaceDialog(),this.config.autoResize&&this.enableAutoResize()}getContainer(r){return typeof r=="string"?document.getElementById(r)||document.querySelector(r):r}createLayout(){this.container&&(this.container.innerHTML="",this.container.className="sl-table-sheet-wrapper",this.container.style.display="flex",this.container.style.flexDirection="column",this.config.showToolbar&&(this.toolbarContainer=document.createElement("div"),this.container.appendChild(this.toolbarContainer)),this.config.showTabs!==!1&&(this.sheetTabsContainer=document.createElement("div"),this.sheetTabsContainer.className="sl-sheet-tabs-container",this.container.appendChild(this.sheetTabsContainer)),this.tableContainer=document.createElement("div"),this.tableContainer.className="sl-table-container",this.tableContainer.style.flex="1",this.tableContainer.style.minHeight="0",this.tableContainer.style.overflow="hidden",this.container.appendChild(this.tableContainer),this.loadingOverlay=document.createElement("div"),this.loadingOverlay.className="sl-loading-overlay",this.loadingOverlay.innerHTML=`
|
|
604
|
+
`,s.onmouseenter=()=>s.style.opacity="1",s.onmouseleave=()=>s.style.opacity="0.8",n.appendChild(s),document.body.appendChild(n);let o,c,f;const l=()=>{clearTimeout(o),clearTimeout(f),n.classList.remove("show"),c=setTimeout(()=>{clearTimeout(c),n.parentNode&&document.body.removeChild(n)},300)};s.onclick=l,f=setTimeout(()=>{clearTimeout(f),n.classList.add("show")},10),o=setTimeout(l,3e3)}setTableInstance(r){this.tableInstance=r,this.state.matches=[],this.state.currentIndex=0,this.clearResults()}setSelectedColumnsOnly(r){this.elements.selectedColumnsOnly&&(this.elements.selectedColumnsOnly.checked=r)}getSelectedColumnsOnly(){var r;return((r=this.elements.selectedColumnsOnly)==null?void 0:r.checked)||!1}setFindText(r){this.state.findText=r,this.elements.findInput&&(this.elements.findInput.value=r)}setReplaceText(r){this.state.replaceText=r,this.elements.replaceInput&&(this.elements.replaceInput.value=r)}destroy(){this.dialog&&(this.dialog.remove(),this.dialog=null)}}class p_{constructor(r={addColumnEnable:!0,addRowEnable:!0}){var t,a,n;this.id="add-row-column",this.name="Add Row Column",this.runTime=[Kt.TABLE_EVENT_TYPE.MOUSEENTER_CELL,Kt.TABLE_EVENT_TYPE.MOUSELEAVE_CELL,Kt.TABLE_EVENT_TYPE.MOUSELEAVE_TABLE],this.id=(t=r.id)!==null&&t!==void 0?t:this.id,this.pluginOptions=r,this.pluginOptions.addColumnEnable=(a=this.pluginOptions.addColumnEnable)===null||a===void 0||a,this.pluginOptions.addRowEnable=(n=this.pluginOptions.addRowEnable)===null||n===void 0||n,this.pluginOptions.addColumnEnable&&(this.initAddColumnDomElement(),this.bindEventForAddColumn()),this.pluginOptions.addRowEnable&&(this.initAddRowDomElement(),this.bindEventForAddRow())}run(...r){const t=r[0],a=r[1],n=r[2];if(this.table=n,a===Kt.TABLE_EVENT_TYPE.MOUSEENTER_CELL){clearTimeout(this.hideAllTimeoutId_addColumn),clearTimeout(this.hideAllTimeoutId_addRow);const i=n.canvas.getBoundingClientRect(),s=n.getCellAtRelativePosition(t.event.clientX-i.left,t.event.clientY-i.top);this.hoverCell=s;const o=n.getCellRelativeRect(s.col,s.row);if(this.pluginOptions.addColumnEnable){const c=n.isSeriesNumber(s.col,0);this.showDotForAddColumn(i.top-6,o.left+i.left,o.right+i.left,!c)}if(this.pluginOptions.addRowEnable){const c=n.isHeader(s.col,s.row);this.showDotForAddRow(o.top+i.top,i.left-6,o.bottom+i.top,!c,!c)}}else a===Kt.TABLE_EVENT_TYPE.MOUSELEAVE_CELL||a===Kt.TABLE_EVENT_TYPE.MOUSELEAVE_TABLE&&(this.pluginOptions.addColumnEnable&&this.delayHideAllForAddColumn(),this.pluginOptions.addRowEnable&&this.delayHideAllForAddRow())}initAddColumnDomElement(){this.leftDotForAddColumn=document.createElement("div"),this.leftDotForAddColumn.style.width="6px",this.leftDotForAddColumn.style.height="6px",this.leftDotForAddColumn.style.backgroundColor="#4A90E2",this.leftDotForAddColumn.style.position="absolute",this.leftDotForAddColumn.style.cursor="pointer",this.leftDotForAddColumn.style.zIndex="1000",this.leftDotForAddColumn.style.borderRadius="50%",this.leftDotForAddColumn.style.border="1px solid white",this.leftDotForAddColumn.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.leftDotForAddColumn),this.rightDotForAddColumn=document.createElement("div"),this.rightDotForAddColumn.style.width="6px",this.rightDotForAddColumn.style.height="6px",this.rightDotForAddColumn.style.backgroundColor="#4A90E2",this.rightDotForAddColumn.style.position="absolute",this.rightDotForAddColumn.style.cursor="pointer",this.rightDotForAddColumn.style.zIndex="1000",this.rightDotForAddColumn.style.borderRadius="50%",this.rightDotForAddColumn.style.border="1px solid white",this.rightDotForAddColumn.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.rightDotForAddColumn),this.addIconForAddColumn=document.createElement("div"),this.addIconForAddColumn.style.width="18px",this.addIconForAddColumn.style.height="18px",this.addIconForAddColumn.style.backgroundColor="#4A90E2",this.addIconForAddColumn.style.position="absolute",this.addIconForAddColumn.style.zIndex="1001",this.addIconForAddColumn.style.display="none",this.addIconForAddColumn.style.borderRadius="50%",this.addIconForAddColumn.style.boxShadow="0 2px 5px rgba(0,0,0,0.2)",this.addIconForAddColumn.style.justifyContent="center",this.addIconForAddColumn.style.alignItems="center",this.addIconForAddColumn.style.border="1px solid white",document.body.appendChild(this.addIconForAddColumn);const r=document.createElement("div");r.textContent="+",r.style.color="white",r.style.fontSize="18px",r.style.fontWeight="bold",r.style.lineHeight="15px",r.style.userSelect="none",r.style.cursor="pointer",r.style.verticalAlign="top",r.style.textAlign="center",this.addIconForAddColumn.appendChild(r),this.addLineForAddColumn=document.createElement("div"),this.addLineForAddColumn.style.width="2px",this.addLineForAddColumn.style.height="10px",this.addLineForAddColumn.style.backgroundColor="#4A90E2",this.addLineForAddColumn.style.position="absolute",this.addLineForAddColumn.style.zIndex="1001",this.addLineForAddColumn.style.display="none",document.body.appendChild(this.addLineForAddColumn)}bindEventForAddColumn(){this.leftDotForAddColumn.addEventListener("mouseenter",()=>{clearTimeout(this.hideAllTimeoutId_addColumn),this.addIconForAddColumn.style.display="block";const r=this.leftDotForAddColumn.offsetWidth,t=this.leftDotForAddColumn.offsetHeight;this.showAddIconForAddColumn(this.leftDotForAddColumn.offsetLeft+r/2,this.leftDotForAddColumn.offsetTop+t/2,!0),this.showSplitLineForAddColumn(this.leftDotForAddColumn.offsetLeft+r/2-1,this.leftDotForAddColumn.offsetTop+t/2+2,this.table.getDrawRange().height)}),this.rightDotForAddColumn.addEventListener("mouseenter",()=>{clearTimeout(this.hideAllTimeoutId_addColumn),this.addIconForAddColumn.style.display="block";const r=this.rightDotForAddColumn.offsetWidth,t=this.rightDotForAddColumn.offsetHeight;this.showAddIconForAddColumn(this.rightDotForAddColumn.offsetLeft+r/2,this.rightDotForAddColumn.offsetTop+t/2,!1),this.showSplitLineForAddColumn(this.rightDotForAddColumn.offsetLeft+r/2-1,this.rightDotForAddColumn.offsetTop+t/2+2,this.table.getDrawRange().height)}),this.addIconForAddColumn.addEventListener("mouseleave",()=>{this.addIconForAddColumn.style.display="none",this.addLineForAddColumn.style.display="none",this.delayHideAllForAddColumn()}),this.addIconForAddColumn.addEventListener("click",r=>{const t=this.addIconForAddColumn.dataset.addIconType==="left",a=(this.table.options.columns,this.hoverCell.col),n=t?a:a+1;this.pluginOptions.addColumnCallback?this.pluginOptions.addColumnCallback(n,this.table):this.table.addColumns([{field:n,title:`New Column ${a}`,width:100}],n,!0),this.delayHideAllForAddColumn(0)})}showDotForAddColumn(r,t,a,n=!0,i=!0){const s=this.leftDotForAddColumn.offsetWidth,o=this.leftDotForAddColumn.offsetHeight;this.leftDotForAddColumn.style.left=t-s/2+"px",this.leftDotForAddColumn.style.top=r-o/2+"px",this.rightDotForAddColumn.style.left=a-s/2+"px",this.rightDotForAddColumn.style.top=r-o/2+"px",this.leftDotForAddColumn.style.display=n?"block":"none",this.rightDotForAddColumn.style.display=i?"block":"none"}showAddIconForAddColumn(r,t,a){const n=this.addIconForAddColumn.offsetWidth,i=this.addIconForAddColumn.offsetHeight,s=this.leftDotForAddColumn.offsetHeight;this.addIconForAddColumn.style.left=r-n/2+"px",this.addIconForAddColumn.style.top=t-i/2-s/2+"px",this.addIconForAddColumn.dataset.addIconType=a?"left":"right"}showSplitLineForAddColumn(r,t,a){this.addLineForAddColumn.style.left=`${r}px`,this.addLineForAddColumn.style.top=`${t}px`,this.addLineForAddColumn.style.height=`${a}px`,this.addLineForAddColumn.style.display="block"}delayHideAllForAddColumn(r=1e3){this.hideAllTimeoutId_addColumn=setTimeout(()=>{this.addIconForAddColumn.style.display="none",this.addLineForAddColumn.style.display="none",this.leftDotForAddColumn.style.display="none",this.rightDotForAddColumn.style.display="none"},r)}initAddRowDomElement(){this.topDotForAddRow=document.createElement("div"),this.topDotForAddRow.style.width="6px",this.topDotForAddRow.style.height="6px",this.topDotForAddRow.style.backgroundColor="#4A90E2",this.topDotForAddRow.style.position="absolute",this.topDotForAddRow.style.cursor="pointer",this.topDotForAddRow.style.zIndex="1000",this.topDotForAddRow.style.borderRadius="50%",this.topDotForAddRow.style.border="1px solid white",this.topDotForAddRow.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.topDotForAddRow),this.bottomDotForAddRow=document.createElement("div"),this.bottomDotForAddRow.style.width="6px",this.bottomDotForAddRow.style.height="6px",this.bottomDotForAddRow.style.backgroundColor="#4A90E2",this.bottomDotForAddRow.style.position="absolute",this.bottomDotForAddRow.style.cursor="pointer",this.bottomDotForAddRow.style.zIndex="1000",this.bottomDotForAddRow.style.borderRadius="50%",this.bottomDotForAddRow.style.border="1px solid white",this.bottomDotForAddRow.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.bottomDotForAddRow),this.addIconForAddRow=document.createElement("div"),this.addIconForAddRow.style.width="18px",this.addIconForAddRow.style.height="18px",this.addIconForAddRow.style.backgroundColor="#4A90E2",this.addIconForAddRow.style.position="absolute",this.addIconForAddRow.style.zIndex="1001",this.addIconForAddRow.style.display="none",this.addIconForAddRow.style.borderRadius="50%",this.addIconForAddRow.style.boxShadow="0 2px 5px rgba(0,0,0,0.2)",this.addIconForAddRow.style.justifyContent="center",this.addIconForAddRow.style.alignItems="center",this.addIconForAddRow.style.border="1px solid white",document.body.appendChild(this.addIconForAddRow);const r=document.createElement("div");r.textContent="+",r.style.color="white",r.style.fontSize="18px",r.style.fontWeight="bold",r.style.lineHeight="15px",r.style.userSelect="none",r.style.cursor="pointer",r.style.verticalAlign="top",r.style.textAlign="center",this.addIconForAddRow.appendChild(r),this.addLineForAddRow=document.createElement("div"),this.addLineForAddRow.style.width="10px",this.addLineForAddRow.style.height="2px",this.addLineForAddRow.style.backgroundColor="#4A90E2",this.addLineForAddRow.style.position="absolute",this.addLineForAddRow.style.zIndex="1001",this.addLineForAddRow.style.display="none",document.body.appendChild(this.addLineForAddRow)}bindEventForAddRow(){this.topDotForAddRow.addEventListener("mouseenter",()=>{clearTimeout(this.hideAllTimeoutId_addRow),this.addIconForAddRow.style.display="block";const r=this.topDotForAddRow.offsetWidth,t=this.topDotForAddRow.offsetHeight;this.showAddIconForAddRow(this.topDotForAddRow.offsetLeft+r/2,this.topDotForAddRow.offsetTop+t/2,!0),this.showSplitLineForAddRow(this.topDotForAddRow.offsetLeft+r+2,this.topDotForAddRow.offsetTop+t/2-1,this.table.getDrawRange().width)}),this.bottomDotForAddRow.addEventListener("mouseenter",()=>{clearTimeout(this.hideAllTimeoutId_addRow),this.addIconForAddRow.style.display="block";const r=this.bottomDotForAddRow.offsetWidth,t=this.bottomDotForAddRow.offsetHeight;this.showAddIconForAddRow(this.bottomDotForAddRow.offsetLeft+r/2,this.bottomDotForAddRow.offsetTop+t/2,!1),this.showSplitLineForAddRow(this.bottomDotForAddRow.offsetLeft+r+2,this.bottomDotForAddRow.offsetTop+t/2-1,this.table.getDrawRange().height)}),this.addIconForAddRow.addEventListener("mouseleave",()=>{this.addIconForAddRow.style.display="none",this.addLineForAddRow.style.display="none",this.delayHideAllForAddRow()}),this.addIconForAddRow.addEventListener("click",r=>{const t=this.addIconForAddRow.dataset.addIconType==="top",a=this.hoverCell.row,n=t?a:a+1;if(this.pluginOptions.addRowCallback)this.pluginOptions.addRowCallback(n,this.table);else{const i=this.table.getRecordIndexByCell(0,n);this.table.addRecord({},i)}this.delayHideAllForAddRow(0)})}showDotForAddRow(r,t,a,n=!0,i=!0){const s=this.topDotForAddRow.offsetWidth,o=this.topDotForAddRow.offsetHeight;this.topDotForAddRow.style.left=t-s/2+"px",this.topDotForAddRow.style.top=r-o/2+"px",this.bottomDotForAddRow.style.left=t-s/2+"px",this.bottomDotForAddRow.style.top=a-o/2+"px",this.topDotForAddRow.style.display=n?"block":"none",this.bottomDotForAddRow.style.display=i?"block":"none"}showAddIconForAddRow(r,t,a){const n=this.addIconForAddRow.offsetWidth,i=this.addIconForAddRow.offsetHeight,s=this.topDotForAddRow.offsetWidth;this.addIconForAddRow.style.left=r-n/2-s/2+"px",this.addIconForAddRow.style.top=t-i/2+"px",this.addIconForAddRow.dataset.addIconType=a?"top":"bottom"}showSplitLineForAddRow(r,t,a){this.addLineForAddRow.style.left=`${r}px`,this.addLineForAddRow.style.top=`${t}px`,this.addLineForAddRow.style.width=`${a}px`,this.addLineForAddRow.style.display="block"}delayHideAllForAddRow(r=1e3){this.hideAllTimeoutId_addRow=setTimeout(()=>{this.addIconForAddRow.style.display="none",this.addLineForAddRow.style.display="none",this.topDotForAddRow.style.display="none",this.bottomDotForAddRow.style.display="none"},r)}release(){this.leftDotForAddColumn.remove(),this.rightDotForAddColumn.remove(),this.addIconForAddColumn.remove(),this.addLineForAddColumn.remove(),this.topDotForAddRow.remove(),this.bottomDotForAddRow.remove(),this.addIconForAddRow.remove(),this.addLineForAddRow.remove()}}class m_{constructor(r,t){xe(this,"customComponentContainers",new Map);xe(this,"activeComponentKey",null);xe(this,"justCreatedComponent",!1);xe(this,"tableInstance",null);xe(this,"container",null);xe(this,"handleOutsideClick",r=>{if(this.justCreatedComponent||!this.activeComponentKey)return;const t=this.customComponentContainers.get(this.activeComponentKey);t&&!t.contains(r.target)&&this.closeActiveComponent()});this.tableInstance=r,this.container=t,this.bindOutsideClickHandler()}showComponent(r,t,a){var p;const{col:n,row:i}=a,s=this.tableInstance.getCellRect(n,i),o=this.tableInstance.getCellValue(n,i),c=(p=this.container)==null?void 0:p.getBoundingClientRect(),f=((c==null?void 0:c.left)||0)+s.left,l=((c==null?void 0:c.top)||0)+s.bottom,h=this.createComponentContainer(f,l,t),u={table:this.tableInstance,row:i,col:n,value:o,dataValue:a.dataValue,rect:s,setValue:d=>{this.tableInstance.changeCellValue(n,i,d),this.closeActiveComponent()},close:()=>{this.closeActiveComponent()}};try{const d=t.render(u);h.appendChild(d),document.body.appendChild(h)}catch(d){console.error("❌ 渲染组件时出错:",d);return}const x=`${r}-${n}-${i}`;this.customComponentContainers.set(x,h),this.activeComponentKey=x,t.onMount&&t.onMount(h,u),h.addEventListener("click",d=>{d.stopPropagation()}),this.justCreatedComponent=!0,setTimeout(()=>{this.justCreatedComponent=!1},100)}createComponentContainer(r,t,a){const n=document.createElement("div");return n.className="vtable-custom-component",n.style.position="fixed",n.style.zIndex="9999",n.style.left=`${r}px`,n.style.top=`${t}px`,n.style.backgroundColor="white",n.style.borderRadius="4px",n.style.boxShadow="0 2px 12px rgba(0, 0, 0, 0.15)",a.containerStyle&&Object.assign(n.style,a.containerStyle),n}closeActiveComponent(){if(!this.activeComponentKey)return;const r=this.customComponentContainers.get(this.activeComponentKey);r&&(r.remove(),this.customComponentContainers.delete(this.activeComponentKey)),this.activeComponentKey=null}bindOutsideClickHandler(){document.addEventListener("click",this.handleOutsideClick)}destroy(){this.closeActiveComponent(),this.customComponentContainers.clear(),document.removeEventListener("click",this.handleOutsideClick)}}class v0{constructor(r,t){xe(this,"markedMap",null);xe(this,"tableInstance",null);xe(this,"markedCellsSet",null);xe(this,"tooltipThrottle",null);this.tableInstance=r,this.markedMap=t||null,t&&t.size>0&&(this.markedCellsSet=new Set(t.keys()),this.tooltipThrottle=new Map)}handleCellMouseEnter(r){if(!this.markedCellsSet||!this.tableInstance)return;const{col:t,row:a}=r,n=this.tableInstance.columnHeaderLevelCount||1,i=a-n;if(i<0)return;const s=`${i}-${t}`;if(!this.markedCellsSet.has(s))return;const o=`${t}-${a}`,c=Date.now(),f=this.tooltipThrottle.get(o)||0;c-f<100||(this.tooltipThrottle.set(o,c),this.showTooltip(t,a,s))}showTooltip(r,t,a){const n=this.tableInstance.getVisibleCellRangeRelativeRect({col:r,row:t}),i=this.markedMap.get(a),s=this.tableInstance.getCellValue(r,t),o=i==null?void 0:i.comment,c=o?`${s}: ${o}`:`${s}`;this.tableInstance.showTooltip(r,t,{content:c,referencePosition:{rect:n,placement:"right"},className:"defineTooltip",disappearDelay:100,style:{bgColor:"black",color:"white",arrowMark:!0,padding:[5,11]}})}getMarkedMap(){return this.markedMap}setMarkedMap(r){this.markedMap=r}destroy(){this.markedMap=null,this.tableInstance=null}}class g_{static registerEditors(r){if(r){if(r.dateEditor!==!1){const t=new ss.DateInputEditor(r.dateEditor||{});hn.VTable.register.editor("dateEditor",t)}if(r.listEditor){const t=new ss.ListEditor(r.listEditor||{values:["技术中心","财务部"]});hn.VTable.register.editor("listEditor",t)}r.customEditors&&Object.entries(r.customEditors).forEach(([t,a])=>{hn.VTable.register.editor(t,a)})}}}class v_{constructor(r,t,a){xe(this,"tableInstance");xe(this,"config");xe(this,"customComponentManager",null);xe(this,"cellMarkManager",null);this.config=r,this.tableInstance=r.tableInstance,this.customComponentManager=t,this.cellMarkManager=a}bindEvents(){this.tableInstance&&(this.tableInstance.on("click_cell",r=>{var t,a;this.handleCellClick(r),(a=(t=this.config).onCellClick)==null||a.call(t,r)}),this.config.onCellChange&&this.tableInstance.on("change_cell_value",this.config.onCellChange),this.tableInstance.on("mouseenter_cell",r=>{var t;(t=this.cellMarkManager)==null||t.handleCellMouseEnter(r)}))}handleCellClick(r){var o,c,f;const{col:t}=r,n=(this.config.columns||[])[t];if(!(n!=null&&n.customComponent))return;const i=n.customComponent,s=(o=this.config.customComponents)==null?void 0:o[i];s!=null&&s.showOnClick&&((c=this.customComponentManager)==null||c.closeActiveComponent(),(f=this.customComponentManager)==null||f.showComponent(i,s,r))}on(r,t){var a;(a=this.tableInstance)==null||a.on(r,t)}off(r,t){var a;(a=this.tableInstance)==null||a.off(r,t)}destroy(){this.tableInstance&&(this.tableInstance.off("click_cell"),this.tableInstance.off("change_cell_value"),this.tableInstance.off("mouseenter_cell")),this.tableInstance=null,this.customComponentManager=null,this.cellMarkManager=null}}class _0{constructor(r,t){xe(this,"sheetInstance");xe(this,"tableInstance");xe(this,"container",null);xe(this,"config");xe(this,"customComponentManager",null);xe(this,"cellMarkManager",null);xe(this,"eventManager",null);xe(this,"lastWidth",0);xe(this,"lastHeight",0);xe(this,"resizeTimeout",null);this.config=r,this.cellMarkManager=new v0(null,t),this.init()}init(){const r=this.config.container;if(this.container=this.getContainer(r),!this.container)throw console.error("TableSheet: Container not found",{input:r}),new Error("Container not found");(this.container.offsetWidth===0||this.container.offsetHeight===0)&&console.warn("TableSheet: Container has zero dimensions",{width:this.container.offsetWidth,height:this.container.offsetHeight}),g_.registerEditors(this.config.editors),this.createSheet()}getContainer(r){return typeof r=="string"?document.getElementById(r)||document.querySelector(r):r}createSheet(){var o;const{columns:r=[],records:t=[],showFormulaBar:a=!0,sheets:n,options:i}=this.config,s={showFormulaBar:a,showSheetTab:!0,sheets:n||[{sheetKey:"sheet1",sheetTitle:"Sheet1",dragOrder:{dragHeaderMode:"all"},columns:r,data:t}],tooltip:{isShowOverflowTextTooltip:!0},autoFillWidth:!0,autoFillHeight:!0,progressiveMode:!0,VTablePluginModules:[{module:p_,disabled:!0,moduleOptions:{addColumnEnable:!1,addRowEnable:!1}}],...i};console.info("[sl-table-sheet]","create--vtableConfig",s),this.sheetInstance=new hn.VTableSheet(this.container,s),this.tableInstance=(o=this.sheetInstance.getActiveSheet())==null?void 0:o.tableInstance,this.initManagers()}initManagers(){var r;this.customComponentManager=new m_(this.tableInstance,this.container),this.cellMarkManager=new v0(this.tableInstance,((r=this.cellMarkManager)==null?void 0:r.getMarkedMap())||void 0),this.eventManager=new v_({tableInstance:this.tableInstance,columns:this.config.columns,customComponents:this.config.customComponents,onCellClick:this.config.onCellClick,onCellChange:this.config.onCellChange},this.customComponentManager,this.cellMarkManager),this.eventManager.bindEvents()}changeCellValue(r,t,a){this.tableInstance&&this.tableInstance.changeCellValue(r,t,a)}getCellValue(r,t){var a;return(a=this.tableInstance)==null?void 0:a.getCellValue(r,t)}getSelectedCells(){var r;return(r=this.tableInstance)==null?void 0:r.getSelectedCellInfos()}updateData(r){var a;const t=(a=this.sheetInstance)==null?void 0:a.getActiveSheet();if(t)if(typeof t.updateRecords=="function")t.updateRecords(r);else if(typeof t.setData=="function")t.setData(r);else if(this.tableInstance)if(typeof this.tableInstance.updateOption=="function")try{this.tableInstance.updateOption({records:r})}catch(n){console.warn("tableInstance.updateOption 失败:",n)}else console.warn("无法更新数据:找不到合适的方法");else console.warn("无法更新数据:找不到合适的方法");else console.warn("无法获取活动工作表")}updateColumns(r){var a;const t=(a=this.sheetInstance)==null?void 0:a.getActiveSheet();if(t)if(typeof t.updateColumns=="function")t.updateColumns(r);else if(typeof t.setColumns=="function")t.setColumns(r);else if(this.tableInstance)if(typeof this.tableInstance.updateOption=="function")try{this.tableInstance.updateOption({columns:r})}catch(n){console.warn("tableInstance.updateOption 失败:",n)}else console.warn("无法更新列配置:找不到合适的方法");else console.warn("无法更新列配置:找不到合适的方法");else console.warn("无法获取活动工作表")}addRow(r,t){var n;const a=(n=this.sheetInstance)==null?void 0:n.getActiveSheet();a&&a.addRecord(r,t)}deleteRow(r){var a;const t=(a=this.sheetInstance)==null?void 0:a.getActiveSheet();t&&t.deleteRecord(r)}exportData(r="csv"){var t,a;return(a=(t=this.sheetInstance)==null?void 0:t.exportData)==null?void 0:a.call(t,r)}switchSheet(r){var t,a;(t=this.sheetInstance)==null||t.switchSheet(r),this.tableInstance=(a=this.sheetInstance.getActiveSheet())==null?void 0:a.tableInstance}getActiveSheet(){var r;return(r=this.sheetInstance)==null?void 0:r.getActiveSheet()}getAllSheets(){var r;return(r=this.sheetInstance)==null?void 0:r.getAllSheets()}refresh(){if(this.tableInstance&&this.tableInstance.option)try{this.tableInstance.updateOption(this.tableInstance.option)}catch(r){console.warn("刷新表格失败:",r);const t=this.tableInstance.container;t&&(t.style.display="none",setTimeout(()=>{t.style.display=""},0))}}setFrozenColCount(r){if(this.tableInstance)try{if(typeof this.tableInstance.setFrozenColCount=="function")this.tableInstance.setFrozenColCount(r);else if(typeof this.tableInstance.updateOption=="function"){const t=this.tableInstance.option||{};this.tableInstance.updateOption({...t,frozenColCount:r})}}catch(t){console.warn("设置冻结列失败:",t)}}resize(){if(!this.sheetInstance){console.warn("sheetInstance 不存在,无法 resize");return}const r=this.container;if(!r)return;const t=r.clientWidth,a=r.clientHeight;t===this.lastWidth&&a===this.lastHeight||(this.lastWidth=t,this.lastHeight=a,typeof this.sheetInstance.resize=="function"?this.sheetInstance.resize():console.warn("sheetInstance.resize 方法不可用"))}resizeDebounced(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.resize(),this.resizeTimeout=null},100)}getSheetInstance(){return this.sheetInstance}getTableInstance(){return this.tableInstance}setColumnCustomRender(r,t){var n;const a=(n=this.sheetInstance)==null?void 0:n.getActiveSheet();if(a){const i=a.columns||[],s=i.find(o=>o.field===r);s&&(s.customRender=t,a.updateColumns(i))}}getMarkedMap(){var r;return((r=this.cellMarkManager)==null?void 0:r.getMarkedMap())||null}getAllRecords(){if(!this.tableInstance)return[];const r=this.tableInstance.rowCount??0,t=this.tableInstance.colCount??0,a=this.tableInstance.columnHeaderLevelCount??1,n=[];for(let i=a;i<r;i++){const s=[];for(let o=0;o<t;o++)s.push(this.tableInstance.getCellValue(o,i));n.push(s)}return n}getColumns(){var r,t;return((t=(r=this.tableInstance)==null?void 0:r.options)==null?void 0:t.columns)||[]}on(r,t){var a;(a=this.eventManager)==null||a.on(r,t)}off(r,t){var a;(a=this.eventManager)==null||a.off(r,t)}destroy(){var r,t,a,n,i;(r=this.eventManager)==null||r.destroy(),(t=this.cellMarkManager)==null||t.destroy(),(a=this.customComponentManager)==null||a.destroy(),this.eventManager=null,this.cellMarkManager=null,this.customComponentManager=null,this.sheetInstance&&((i=(n=this.sheetInstance).destroy)==null||i.call(n),this.sheetInstance=null,this.tableInstance=null),this.container&&(this.container.innerHTML="")}}const __={toolbar:{title:"制表错误",unit:"条",total:"共 {total} 个错误项",hint:"请在错误项里查询对应的数据或在数据里进行搜索",buttons:{search:"查找/替换",freeze:{label:"冻结前",suffix:"列"},list:"仅显示错误列"}},dialog:{find:{label:"查找内容",placeholder:"请输入查找内容"},replace:{label:"替换为",placeholder:"请输入替换内容"},checkbox:{selectedOnly:"只替换选中列"},buttons:{close:"关闭",findPrev:"查找上一个",findNext:"查找下一个",replaceOne:"替换",replaceAll:"全部替换"},messages:{pleaseInputFind:"请输入查找内容",notConnected:"未连接表格实例",pleaseSelectColumns:"请先选中要搜索的列",noMatchFound:"未找到匹配内容",nothingToReplace:"没有可替换的内容",replacedOne:"已替换第 {index} 个匹配项",replacedAll:"已替换全部 {count} 个匹配项"},result:{found:"已找到 {count} 个结果"}},sheet:{defaultTitle:"Sheet1"}},w_={toolbar:{title:"製表錯誤",unit:"筆",total:"共 {total} 個錯誤項",hint:"請在錯誤項裡查詢對應的資料或在資料裡進行搜尋",buttons:{search:"尋找/取代",freeze:{label:"凍結前",suffix:"欄"},list:"僅顯示錯誤欄"}},dialog:{find:{label:"尋找內容",placeholder:"請輸入尋找內容"},replace:{label:"取代為",placeholder:"請輸入取代內容"},checkbox:{selectedOnly:"只取代選中欄"},buttons:{close:"關閉",findPrev:"尋找上一個",findNext:"尋找下一個",replaceOne:"取代",replaceAll:"全部取代"},messages:{pleaseInputFind:"請輸入尋找內容",notConnected:"未連接表格實例",pleaseSelectColumns:"請先選中要搜尋的欄",noMatchFound:"未找到符合內容",nothingToReplace:"沒有可取代的內容",replacedOne:"已取代第 {index} 個符合項",replacedAll:"已取代全部 {count} 個符合項"},result:{found:"已找到 {count} 個結果"}},sheet:{defaultTitle:"Sheet1"}},E_={toolbar:{title:"Table Errors",unit:"items",total:"Total {total} errors",hint:"Please search for the corresponding data in the error items or in the data",buttons:{search:"Find/Replace",freeze:{label:"Freeze first",suffix:"columns"},list:"Show error columns only"}},dialog:{find:{label:"Find content",placeholder:"Please enter content to find"},replace:{label:"Replace with",placeholder:"Please enter replacement content"},checkbox:{selectedOnly:"Replace selected columns only"},buttons:{close:"Close",findPrev:"Find Previous",findNext:"Find Next",replaceOne:"Replace",replaceAll:"Replace All"},messages:{pleaseInputFind:"Please enter content to find",notConnected:"Table instance not connected",pleaseSelectColumns:"Please select columns to search first",noMatchFound:"No matching content found",nothingToReplace:"Nothing to replace",replacedOne:"Replaced match #{index}",replacedAll:"Replaced all {count} matches"},result:{found:"Found {count} result(s)"}},sheet:{defaultTitle:"Sheet1"}},T_={"zh-CN":__,"en-US":E_,"zh-TW":w_};let k_="zh-CN";function y_(){return T_[k_]}function S_(e,r={}){return e.replace(/\{(\w+)\}/g,(t,a)=>r[a]!==void 0?String(r[a]):`{${a}}`)}function Zn(e,r){const t=y_(),a=e.split(".");let n=t;for(const i of a)if(n&&typeof n=="object"&&i in n)n=n[i];else return console.warn(`I18n message not found: ${e}`),e;return typeof n=="string"?S_(n,r||{}):(console.warn(`I18n message is not a string: ${e}`),e)}class F_{constructor(r){xe(this,"container",null);xe(this,"toolbarElement",null);xe(this,"config");xe(this,"elements",{});this.config={freezeCount:0,showErrorList:!1,buttons:{search:!0,freeze:!0,export:!0,refresh:!0,list:!1},...r},this.container=this.getContainer(this.config.container),this.createToolbar(),this.injectStyles()}getContainer(r){return Sn.getContainer(r)}createToolbar(){this.toolbarElement=document.createElement("div"),this.toolbarElement.className="sl-excel-toolbar";const r=this.createLeftSection(),t=this.createRightSection();this.toolbarElement.appendChild(r),this.toolbarElement.appendChild(t),this.container&&this.container.appendChild(this.toolbarElement)}createLeftSection(){const r=document.createElement("div");if(r.className="sl-excel-toolbar-left",this.config.leftSlot){const t=typeof this.config.leftSlot=="function"?this.config.leftSlot():this.config.leftSlot;t&&r.appendChild(t)}return r}createRightSection(){const r=document.createElement("div");r.className="sl-excel-toolbar-right";const{buttons:t}=this.config;if((t==null?void 0:t.search)!==!1){const a=this.createButton({text:Zn("toolbar.buttons.search"),onClick:()=>{var n,i;return(i=(n=this.config).onSearchClick)==null?void 0:i.call(n)}});r.appendChild(a)}if((t==null?void 0:t.freeze)!==!1){const a=this.createFreezeButton();r.appendChild(a)}return r}createButton(r){const t=document.createElement("button");return t.className=r.icon?"sl-excel-toolbar-btn sl-excel-toolbar-btn-icon":"sl-excel-toolbar-btn",t.textContent=r.text,r.title&&(t.title=r.title),r.onClick&&(t.onclick=r.onClick),t}createFreezeButton(){const r=document.createElement("div");r.className="sl-excel-freeze-selector";const t=document.createElement("span");t.className="sl-excel-freeze-label",t.textContent=Zn("toolbar.buttons.freeze.label");const a=document.createElement("div");a.className="sl-excel-freeze-input-wrapper";const n=document.createElement("input");n.type="number",n.className="sl-excel-freeze-input",n.min="0",n.max="100",n.value=String(this.config.freezeCount||0),this.elements.freezeSelect=n;const i=document.createElement("div");i.className="sl-excel-freeze-arrows";const s=document.createElement("button");s.className="sl-excel-freeze-arrow sl-excel-freeze-arrow-up",s.innerHTML="^",s.type="button";const o=document.createElement("button");o.className="sl-excel-freeze-arrow sl-excel-freeze-arrow-down",o.innerHTML="^",o.type="button",i.appendChild(s),i.appendChild(o);const c=document.createElement("span");c.className="sl-excel-freeze-suffix",c.textContent=Zn("toolbar.buttons.freeze.suffix");const f=l=>{var h,u;l<0&&(l=0),l>100&&(l=100),n.value=String(l),this.config.freezeCount=l,(u=(h=this.config).onFreezeChange)==null||u.call(h,l)};return s.onclick=l=>{l.preventDefault();const h=parseInt(n.value,10)||0;f(h+1)},o.onclick=l=>{l.preventDefault();const h=parseInt(n.value,10)||0;f(h-1)},n.oninput=()=>{let l=parseInt(n.value,10);(isNaN(l)||l<0)&&(l=0,n.value="0"),l>100&&(l=100,n.value="100"),this.config.freezeCount=l},n.onblur=()=>{var h,u;const l=parseInt(n.value,10)||0;(u=(h=this.config).onFreezeChange)==null||u.call(h,l)},n.onkeydown=l=>{l.key==="Enter"&&n.blur()},a.appendChild(n),a.appendChild(i),r.appendChild(t),r.appendChild(a),r.appendChild(c),r}injectStyles(){Sn.injectStyles(u_,h_)}updateFreezeCount(r){this.config.freezeCount=r,this.elements.freezeSelect&&(this.elements.freezeSelect.value=String(r))}updateShowErrorList(r){this.config.showErrorList=r,this.elements.errorListCheckbox&&(this.elements.errorListCheckbox.checked=r)}show(){this.toolbarElement&&(this.toolbarElement.style.display="flex")}hide(){this.toolbarElement&&(this.toolbarElement.style.display="none")}getElement(){return this.toolbarElement}setLeftSlot(r){var a;const t=(a=this.toolbarElement)==null?void 0:a.querySelector(".sl-toolbar-left");if(t&&(t.innerHTML="",r)){const n=typeof r=="function"?r():r;n&&t.appendChild(n)}}getLeftSection(){var r;return((r=this.toolbarElement)==null?void 0:r.querySelector(".sl-toolbar-left"))||null}destroy(){this.toolbarElement&&(this.toolbarElement.remove(),this.toolbarElement=null),this.elements={}}}class Qn{static processRecords(r,t){const a=new Map;return{displayRecords:r.map((i,s)=>Array.isArray(i)?this.processArrayRow(i,s,a):this.processObjectRow(i,s,t,a)),markedMap:a}}static processArrayRow(r,t,a){return r.map((n,i)=>n&&typeof n=="object"&&"value"in n?(n.isMarked&&a.set(`${t}-${i}`,{isMarked:!0,comment:n.comment||""}),n.value):n)}static processObjectRow(r,t,a,n){return a.map((i,s)=>{const o=i.field||i.key,c=r[o];return c&&typeof c=="object"&&"value"in c?(c.isMarked&&n.set(`${t}-${s}`,{isMarked:!0,comment:c.comment||""}),c.value):c})}}const A_=(e,r)=>({bgColor:"#FFEBEB",color:"#FF4D50",marked:{shape:"triangle",bgColor:"#FF4D50",size:8}}),w0={color:"#1D2129",fontSize:14,fontWeight:"400",bgColor:"#F9FAFB"},ei={color:"#6B7280",fontSize:14,bgColor:"white"};class E0{static initColumns(r,t,a=1){const n=new Map;if(t.size>0)for(const[i]of t){const[s,o]=i.split("-"),c=parseInt(s,10),f=parseInt(o,10);n.has(f)||n.set(f,new Set),n.get(f).add(c)}return r.map((i,s)=>{const o=i.style,c={...i},f=n.get(s);if(!f||f.size===0)return c.style=o||(()=>ei),c.headerStyle=w0,c;const l=new Map;return c.style=h=>{const u=h.row-a;if(u<0||!f.has(u))return o?o(h):ei;const x=`${u}-${s}`;let p=l.get(x);return p||(p=A_(),l.set(x,p)),{...o?o(h):ei,...p,bgColor:p.bgColor,color:p.color}},c.headerStyle=w0,c})}}class C_{constructor(r){xe(this,"tableSheet",null);xe(this,"findReplaceDialog",null);xe(this,"toolbar",null);xe(this,"sheetTabs",null);xe(this,"container",null);xe(this,"tableContainer",null);xe(this,"toolbarContainer",null);xe(this,"sheetTabsContainer",null);xe(this,"loadingOverlay",null);xe(this,"config");xe(this,"multiSheetData",null);xe(this,"timers",[]);xe(this,"resizeObserver",null);xe(this,"lastObservedWidth",0);xe(this,"lastObservedHeight",0);this.config={showToolbar:!0,autoResize:!1,loading:{show:!0,text:"加载中..."},...r},this.init()}init(){if(this.container=this.getContainer(this.config.container),!this.container)throw new Error("Container not found");if(this.createLayout(),this.config.showToolbar&&this.createToolbar(),this.injectStyles(),this.createTable(),this.config.showSheets===!1&&this.container){this.container.classList.add("hide-native-sheet-tab");const r=setTimeout(()=>{this.container&&this.container.querySelectorAll(".vtable-sheet-tab-bar").forEach(n=>{n.style.display="none"});const t=this.timers.indexOf(r);t>-1&&this.timers.splice(t,1)},0);this.timers.push(r)}!this.config.showFormulaBar&&this.container&&this.container.classList.add("hide-formula-bar"),this.createFindReplaceDialog(),this.config.autoResize&&this.enableAutoResize()}getContainer(r){return typeof r=="string"?document.getElementById(r)||document.querySelector(r):r}createLayout(){this.container&&(this.container.innerHTML="",this.container.className="sl-table-sheet-wrapper",this.container.style.display="flex",this.container.style.flexDirection="column",this.config.showToolbar&&(this.toolbarContainer=document.createElement("div"),this.container.appendChild(this.toolbarContainer)),this.config.showTabs!==!1&&(this.sheetTabsContainer=document.createElement("div"),this.sheetTabsContainer.className="sl-sheet-tabs-container",this.container.appendChild(this.sheetTabsContainer)),this.tableContainer=document.createElement("div"),this.tableContainer.className="sl-table-container",this.tableContainer.style.flex="1",this.tableContainer.style.minHeight="0",this.tableContainer.style.overflow="hidden",this.container.appendChild(this.tableContainer),this.loadingOverlay=document.createElement("div"),this.loadingOverlay.className="sl-loading-overlay",this.loadingOverlay.innerHTML=`
|
|
605
605
|
<div class="sl-loading-spinner">
|
|
606
606
|
<div class="sl-spinner"></div>
|
|
607
607
|
<span class="sl-loading-text">加载中...</span>
|
|
608
608
|
</div>
|
|
609
|
-
`,this.loadingOverlay.style.display="none",this.container.appendChild(this.loadingOverlay))}createToolbar(){this.toolbarContainer&&(this.toolbar=new F_({container:this.toolbarContainer,buttons:{search:!0,freeze:!0,export:!0,refresh:!0,list:!0},onSearchClick:()=>this.openFindReplace(),onFreezeChange:r=>this.freezeColumns(r),...this.config.toolbar}))}createTable(){if(!this.tableContainer){console.error("SlTableSheet: tableContainer is not initialized");return}const r=this.config.columns||[],t=this.config.records||[],a=r.length>0&&t.length>0,n=a?r:[{field:"_placeholder",title:" "}],i=a?t:[[" "]],{displayRecords:s,markedMap:o}=Qn.processRecords(i,n),c=E0.initColumns(n,o);this.tableSheet=new _0({container:this.tableContainer,columns:c,records:s,showFormulaBar:this.config.showFormulaBar,showSheets:this.config.showSheets,sheets:this.config.sheets,editors:this.config.editors,customComponents:this.config.customComponents,options:this.config.options,onCellChange:this.config.onCellChange},o)}createFindReplaceDialog(){var t;const r=(t=this.tableSheet)==null?void 0:t.getTableInstance();r&&(this.findReplaceDialog=new Bc({tableInstance:r,selectedColumnsOnly:!1,onSearch:a=>{console.log(`找到 ${a.length} 个匹配项`)},onReplace:(a,n)=>{console.log("替换成功:",a,"->",n)}}))}openFindReplace(){var r;(r=this.findReplaceDialog)==null||r.open()}freezeColumns(r){this.tableSheet&&this.tableSheet.setFrozenColCount(r)}setFrozenColCount(r){this.freezeColumns(r)}resize(){this.tableSheet&&this.tableSheet.resizeDebounced()}isResizeObserverSupported(){return typeof window<"u"&&"ResizeObserver"in window}enableAutoResize(){if(!this.isResizeObserverSupported())return console.warn("ResizeObserver 不被当前浏览器支持,请使用手动 resize"),!1;if(this.resizeObserver||!this.tableContainer)return!1;try{return this.resizeObserver=new ResizeObserver(r=>{for(const t of r){const{width:a,height:n}=t.contentRect;if(this.lastObservedWidth&&this.lastObservedHeight){const i=Math.abs(a-this.lastObservedWidth),s=Math.abs(n-this.lastObservedHeight);if(i<1&&s<1)return}this.lastObservedWidth=a,this.lastObservedHeight=n,
|
|
609
|
+
`,this.loadingOverlay.style.display="none",this.container.appendChild(this.loadingOverlay))}createToolbar(){this.toolbarContainer&&(this.toolbar=new F_({container:this.toolbarContainer,buttons:{search:!0,freeze:!0,export:!0,refresh:!0,list:!0},onSearchClick:()=>this.openFindReplace(),onFreezeChange:r=>this.freezeColumns(r),...this.config.toolbar}))}createTable(){if(!this.tableContainer){console.error("SlTableSheet: tableContainer is not initialized");return}const r=this.config.columns||[],t=this.config.records||[],a=r.length>0&&t.length>0,n=a?r:[{field:"_placeholder",title:" "}],i=a?t:[[" "]],{displayRecords:s,markedMap:o}=Qn.processRecords(i,n),c=E0.initColumns(n,o);this.tableSheet=new _0({container:this.tableContainer,columns:c,records:s,showFormulaBar:this.config.showFormulaBar,showSheets:this.config.showSheets,sheets:this.config.sheets,editors:this.config.editors,customComponents:this.config.customComponents,options:this.config.options,onCellChange:this.config.onCellChange},o)}createFindReplaceDialog(){var t;const r=(t=this.tableSheet)==null?void 0:t.getTableInstance();r&&(this.findReplaceDialog=new Bc({tableInstance:r,selectedColumnsOnly:!1,onSearch:a=>{console.log(`找到 ${a.length} 个匹配项`)},onReplace:(a,n)=>{console.log("替换成功:",a,"->",n)}}))}openFindReplace(){var r;(r=this.findReplaceDialog)==null||r.open()}freezeColumns(r){this.tableSheet&&this.tableSheet.setFrozenColCount(r)}setFrozenColCount(r){this.freezeColumns(r)}resize(){this.tableSheet&&this.tableSheet.resizeDebounced()}isResizeObserverSupported(){return typeof window<"u"&&"ResizeObserver"in window}enableAutoResize(){if(!this.isResizeObserverSupported())return console.warn("ResizeObserver 不被当前浏览器支持,请使用手动 resize"),!1;if(this.resizeObserver||!this.tableContainer)return!1;try{return this.resizeObserver=new ResizeObserver(r=>{for(const t of r){const{width:a,height:n}=t.contentRect;if(this.lastObservedWidth&&this.lastObservedHeight){const i=Math.abs(a-this.lastObservedWidth),s=Math.abs(n-this.lastObservedHeight);if(i<1&&s<1)return}this.lastObservedWidth=a,this.lastObservedHeight=n,this.tableSheet&&this.tableSheet.resizeDebounced()}}),this.resizeObserver.observe(this.tableContainer),!0}catch(r){return console.warn("启用 ResizeObserver 失败:",r),!1}}disableAutoResize(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}injectStyles(){if(document.getElementById("sl-table-sheet-styles"))return;const r=document.createElement("style");r.id="sl-table-sheet-styles",r.textContent=`
|
|
610
610
|
.sl-table-sheet-wrapper {
|
|
611
611
|
display: flex;
|
|
612
612
|
flex-direction: column;
|
package/sl-table-sheet.es.js
CHANGED
|
@@ -24372,9 +24372,7 @@ class Ic {
|
|
|
24372
24372
|
* 导出为 Excel 流
|
|
24373
24373
|
*/
|
|
24374
24374
|
static exportToStream(r, t, a) {
|
|
24375
|
-
const { filterEmptyColumns: n = !0 } = a || {}, i = n ? this.filterEmptyColumns(r) : r, s = i.map((h) => h.title || h.field || ""), o = this.buildDataRows(t, r, i);
|
|
24376
|
-
console.info("exportToStream>>>dataRows", JSON.stringify(o));
|
|
24377
|
-
const c = [s, ...o], f = Lt.aoa_to_sheet(c), l = Lt.book_new();
|
|
24375
|
+
const { filterEmptyColumns: n = !0 } = a || {}, i = n ? this.filterEmptyColumns(r) : r, s = i.map((h) => h.title || h.field || ""), o = this.buildDataRows(t, r, i), c = [s, ...o], f = Lt.aoa_to_sheet(c), l = Lt.book_new();
|
|
24378
24376
|
return Lt.book_append_sheet(l, f, "Sheet1"), Fc(l, { bookType: "xlsx", type: "array" });
|
|
24379
24377
|
}
|
|
24380
24378
|
/**
|
|
@@ -25775,7 +25773,7 @@ class g0 {
|
|
|
25775
25773
|
// },
|
|
25776
25774
|
...i
|
|
25777
25775
|
};
|
|
25778
|
-
this.sheetInstance = new hn.VTableSheet(
|
|
25776
|
+
console.info("[sl-table-sheet]", "create--vtableConfig", s), this.sheetInstance = new hn.VTableSheet(
|
|
25779
25777
|
this.container,
|
|
25780
25778
|
s
|
|
25781
25779
|
), this.tableInstance = (o = this.sheetInstance.getActiveSheet()) == null ? void 0 : o.tableInstance, this.initManagers();
|
|
@@ -25828,24 +25826,22 @@ class g0 {
|
|
|
25828
25826
|
*/
|
|
25829
25827
|
updateData(r) {
|
|
25830
25828
|
var a;
|
|
25831
|
-
console.log("updateData 调用:", r.length, "条记录");
|
|
25832
25829
|
const t = (a = this.sheetInstance) == null ? void 0 : a.getActiveSheet();
|
|
25833
25830
|
if (t)
|
|
25834
25831
|
if (typeof t.updateRecords == "function")
|
|
25835
|
-
|
|
25832
|
+
t.updateRecords(r);
|
|
25836
25833
|
else if (typeof t.setData == "function")
|
|
25837
|
-
|
|
25834
|
+
t.setData(r);
|
|
25838
25835
|
else if (this.tableInstance)
|
|
25839
|
-
if (typeof this.tableInstance.updateOption == "function")
|
|
25840
|
-
console.log("使用 tableInstance.updateOption 方法");
|
|
25836
|
+
if (typeof this.tableInstance.updateOption == "function")
|
|
25841
25837
|
try {
|
|
25842
25838
|
this.tableInstance.updateOption({
|
|
25843
25839
|
records: r
|
|
25844
25840
|
});
|
|
25845
25841
|
} catch (n) {
|
|
25846
|
-
console.warn("tableInstance.updateOption 失败:", n)
|
|
25842
|
+
console.warn("tableInstance.updateOption 失败:", n);
|
|
25847
25843
|
}
|
|
25848
|
-
|
|
25844
|
+
else
|
|
25849
25845
|
console.warn("无法更新数据:找不到合适的方法");
|
|
25850
25846
|
else
|
|
25851
25847
|
console.warn("无法更新数据:找不到合适的方法");
|
|
@@ -25857,24 +25853,22 @@ class g0 {
|
|
|
25857
25853
|
*/
|
|
25858
25854
|
updateColumns(r) {
|
|
25859
25855
|
var a;
|
|
25860
|
-
console.log("updateColumns 调用:", r.length, "列");
|
|
25861
25856
|
const t = (a = this.sheetInstance) == null ? void 0 : a.getActiveSheet();
|
|
25862
25857
|
if (t)
|
|
25863
25858
|
if (typeof t.updateColumns == "function")
|
|
25864
|
-
|
|
25859
|
+
t.updateColumns(r);
|
|
25865
25860
|
else if (typeof t.setColumns == "function")
|
|
25866
|
-
|
|
25861
|
+
t.setColumns(r);
|
|
25867
25862
|
else if (this.tableInstance)
|
|
25868
|
-
if (typeof this.tableInstance.updateOption == "function")
|
|
25869
|
-
console.log("使用 tableInstance.updateOption 方法更新列");
|
|
25863
|
+
if (typeof this.tableInstance.updateOption == "function")
|
|
25870
25864
|
try {
|
|
25871
25865
|
this.tableInstance.updateOption({
|
|
25872
25866
|
columns: r
|
|
25873
25867
|
});
|
|
25874
25868
|
} catch (n) {
|
|
25875
|
-
console.warn("tableInstance.updateOption 失败:", n)
|
|
25869
|
+
console.warn("tableInstance.updateOption 失败:", n);
|
|
25876
25870
|
}
|
|
25877
|
-
|
|
25871
|
+
else
|
|
25878
25872
|
console.warn("无法更新列配置:找不到合适的方法");
|
|
25879
25873
|
else
|
|
25880
25874
|
console.warn("无法更新列配置:找不到合适的方法");
|
|
@@ -25956,7 +25950,6 @@ class g0 {
|
|
|
25956
25950
|
frozenColCount: r
|
|
25957
25951
|
});
|
|
25958
25952
|
}
|
|
25959
|
-
console.log(`冻结列设置成功: ${r} 列`);
|
|
25960
25953
|
} catch (t) {
|
|
25961
25954
|
console.warn("设置冻结列失败:", t);
|
|
25962
25955
|
}
|
|
@@ -25972,7 +25965,7 @@ class g0 {
|
|
|
25972
25965
|
const r = this.container;
|
|
25973
25966
|
if (!r) return;
|
|
25974
25967
|
const t = r.clientWidth, a = r.clientHeight;
|
|
25975
|
-
t === this.lastWidth && a === this.lastHeight || (this.lastWidth = t, this.lastHeight = a,
|
|
25968
|
+
t === this.lastWidth && a === this.lastHeight || (this.lastWidth = t, this.lastHeight = a, typeof this.sheetInstance.resize == "function" ? this.sheetInstance.resize() : console.warn("sheetInstance.resize 方法不可用"));
|
|
25976
25969
|
}
|
|
25977
25970
|
/**
|
|
25978
25971
|
* 防抖的 resize 方法(用于频繁触发的场景)
|
|
@@ -26677,9 +26670,9 @@ class Aw {
|
|
|
26677
26670
|
if (i < 1 && s < 1)
|
|
26678
26671
|
return;
|
|
26679
26672
|
}
|
|
26680
|
-
this.lastObservedWidth = a, this.lastObservedHeight = n,
|
|
26673
|
+
this.lastObservedWidth = a, this.lastObservedHeight = n, this.tableSheet && this.tableSheet.resizeDebounced();
|
|
26681
26674
|
}
|
|
26682
|
-
}), this.resizeObserver.observe(this.tableContainer),
|
|
26675
|
+
}), this.resizeObserver.observe(this.tableContainer), !0;
|
|
26683
26676
|
} catch (r) {
|
|
26684
26677
|
return console.warn("启用 ResizeObserver 失败:", r), !1;
|
|
26685
26678
|
}
|