vite.config.js splits geotiff and shpjs out so they load only when a user opens a Cloud-Optimized GeoTIFF or imports a shapefile, but the built index.html preloaded both on every visit — about 428 kB (152 kB gzipped) nobody had asked for. Two separate causes, both visible in the entry chunk's first line: - it imported Vite's preload helper, used by every dynamic import(), from the geotiff chunk. The helper is a virtual module with no node_modules path, so Rollup had parked it there; needing it at startup dragged the whole chunk in. It now has a chunk of its own, about 1 kB. - it imported JSZip from the shpjs chunk. JSZip reached the bundle through shp-write, which gis-export.js imports for Shapefile export, so it is needed at startup whatever happens; filing it under shpjs pulled that chunk in too. It is now its own chunk, costing the 31 kB it actually is. dist/ rebuilt: index.html now preloads vite-helpers and jszip instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4 lines
30 KiB
JavaScript
4 lines
30 KiB
JavaScript
import{r as rr}from"./pako-Xa-UToif.js";var V={},me;function ce(){if(me)return V;me=1;var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return V.encode=function(n,i){for(var f="",c,A,p,a,h,e,t,u=0;u<n.length;)c=n.charCodeAt(u++),A=n.charCodeAt(u++),p=n.charCodeAt(u++),a=c>>2,h=(c&3)<<4|A>>4,e=(A&15)<<2|p>>6,t=p&63,isNaN(A)?e=t=64:isNaN(p)&&(t=64),f=f+o.charAt(a)+o.charAt(h)+o.charAt(e)+o.charAt(t);return f},V.decode=function(n,i){var f="",c,A,p,a,h,e,t,u=0;for(n=n.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<n.length;)a=o.indexOf(n.charAt(u++)),h=o.indexOf(n.charAt(u++)),e=o.indexOf(n.charAt(u++)),t=o.indexOf(n.charAt(u++)),c=a<<2|h>>4,A=(h&15)<<4|e>>2,p=(e&3)<<6|t,f=f+String.fromCharCode(c),e!=64&&(f=f+String.fromCharCode(A)),t!=64&&(f=f+String.fromCharCode(p));return f},V}var b={},De;function j(){if(De)return b;if(De=1,b.base64=!0,b.array=!0,b.string=!0,b.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",b.nodebuffer=typeof Buffer<"u",b.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")b.blob=!1;else{var o=new ArrayBuffer(0);try{b.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var n=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,i=new n;i.append(o),b.blob=i.getBlob("application/zip").size===0}catch{b.blob=!1}}}return b}var G={},W={},N={},Ee;function tr(){if(Ee)return N;Ee=1;var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",n=rr();return N.uncompressInputType=o?"uint8array":"array",N.compressInputType=o?"uint8array":"array",N.magic="\b\0",N.compress=function(i,f){return n.deflateRaw(i,{level:f.level||-1})},N.uncompress=function(i){return n.inflateRaw(i)},N}var ge;function le(){return ge||(ge=1,W.STORE={magic:"\0\0",compress:function(o,n){return o},uncompress:function(o){return o},compressInputType:null,uncompressInputType:null},W.DEFLATE=tr()),W}var Y={exports:{}},ve;function xe(){return ve||(ve=1,Y.exports=function(o,n){return new Buffer(o,n)},Y.exports.test=function(o){return Buffer.isBuffer(o)}),Y.exports}var ye;function R(){return ye||(ye=1,(function(o){var n=j(),i=le(),f=xe();o.string2binary=function(e){for(var t="",u=0;u<e.length;u++)t+=String.fromCharCode(e.charCodeAt(u)&255);return t},o.arrayBuffer2Blob=function(e,t){o.checkSupport("blob"),t=t||"application/zip";try{return new Blob([e],{type:t})}catch{try{var u=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,l=new u;return l.append(e),l.getBlob(t)}catch{throw new Error("Bug : can't construct the Blob.")}}};function c(e){return e}function A(e,t){for(var u=0;u<e.length;++u)t[u]=e.charCodeAt(u)&255;return t}function p(e){var t=65536,u=[],l=e.length,B=o.getTypeOf(e),m=0,w=!0;try{switch(B){case"uint8array":String.fromCharCode.apply(null,new Uint8Array(0));break;case"nodebuffer":String.fromCharCode.apply(null,f(0));break}}catch{w=!1}if(!w){for(var E="",k=0;k<e.length;k++)E+=String.fromCharCode(e[k]);return E}for(;m<l&&t>1;)try{B==="array"||B==="nodebuffer"?u.push(String.fromCharCode.apply(null,e.slice(m,Math.min(m+t,l)))):u.push(String.fromCharCode.apply(null,e.subarray(m,Math.min(m+t,l)))),m+=t}catch{t=Math.floor(t/2)}return u.join("")}o.applyFromCharCode=p;function a(e,t){for(var u=0;u<e.length;u++)t[u]=e[u];return t}var h={};h.string={string:c,array:function(e){return A(e,new Array(e.length))},arraybuffer:function(e){return h.string.uint8array(e).buffer},uint8array:function(e){return A(e,new Uint8Array(e.length))},nodebuffer:function(e){return A(e,f(e.length))}},h.array={string:p,array:c,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return f(e)}},h.arraybuffer={string:function(e){return p(new Uint8Array(e))},array:function(e){return a(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:c,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return f(new Uint8Array(e))}},h.uint8array={string:p,array:function(e){return a(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:c,nodebuffer:function(e){return f(e)}},h.nodebuffer={string:p,array:function(e){return a(e,new Array(e.length))},arraybuffer:function(e){return h.nodebuffer.uint8array(e).buffer},uint8array:function(e){return a(e,new Uint8Array(e.length))},nodebuffer:c},o.transformTo=function(e,t){if(t||(t=""),!e)return t;o.checkSupport(e);var u=o.getTypeOf(t),l=h[u][e](t);return l},o.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(n.nodebuffer&&f.test(e))return"nodebuffer";if(n.uint8array&&e instanceof Uint8Array)return"uint8array";if(n.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"},o.checkSupport=function(e){var t=n[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this browser")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(e){var t="",u,l;for(l=0;l<(e||"").length;l++)u=e.charCodeAt(l),t+="\\x"+(u<16?"0":"")+u.toString(16).toUpperCase();return t},o.findCompression=function(e){for(var t in i)if(i.hasOwnProperty(t)&&i[t].magic===e)return i[t];return null},o.isRegExp=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"}})(G)),G}var $,Fe;function nr(){if(Fe)return $;Fe=1;var o=R(),n=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];return $=function(f,c){if(typeof f>"u"||!f.length)return 0;var A=o.getTypeOf(f)!=="string";typeof c>"u"&&(c=0);var p=0,a=0,h=0;c=c^-1;for(var e=0,t=f.length;e<t;e++)h=A?f[e]:f.charCodeAt(e),a=(c^h)&255,p=n[a],c=c>>>8^p;return c^-1},$}var U={},be;function Ze(){return be||(be=1,U.LOCAL_FILE_HEADER="PK",U.CENTRAL_FILE_HEADER="PK",U.CENTRAL_DIRECTORY_END="PK",U.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",U.ZIP64_CENTRAL_DIRECTORY_END="PK",U.DATA_DESCRIPTOR="PK\x07\b"),U}var S={},Se;function je(){return Se||(Se=1,S.base64=!1,S.binary=!1,S.dir=!1,S.createFolders=!1,S.date=null,S.compression=null,S.compressionOptions=null,S.comment=null,S.unixPermissions=null,S.dosPermissions=null),S}var ee,we;function Xe(){if(we)return ee;we=1;function o(){this.compressedSize=0,this.uncompressedSize=0,this.crc32=0,this.compressionMethod=null,this.compressedContent=null}return o.prototype={getContent:function(){return null},getCompressedContent:function(){return null}},ee=o,ee}var H={},Ie;function ir(){if(Ie)return H;Ie=1;for(var o=R(),n=j(),i=xe(),f=new Array(256),c=0;c<256;c++)f[c]=c>=252?6:c>=248?5:c>=240?4:c>=224?3:c>=192?2:1;f[254]=f[254]=1;var A=function(h){var e,t,u,l,B,m=h.length,w=0;for(l=0;l<m;l++)t=h.charCodeAt(l),(t&64512)===55296&&l+1<m&&(u=h.charCodeAt(l+1),(u&64512)===56320&&(t=65536+(t-55296<<10)+(u-56320),l++)),w+=t<128?1:t<2048?2:t<65536?3:4;for(n.uint8array?e=new Uint8Array(w):e=new Array(w),B=0,l=0;B<w;l++)t=h.charCodeAt(l),(t&64512)===55296&&l+1<m&&(u=h.charCodeAt(l+1),(u&64512)===56320&&(t=65536+(t-55296<<10)+(u-56320),l++)),t<128?e[B++]=t:t<2048?(e[B++]=192|t>>>6,e[B++]=128|t&63):t<65536?(e[B++]=224|t>>>12,e[B++]=128|t>>>6&63,e[B++]=128|t&63):(e[B++]=240|t>>>18,e[B++]=128|t>>>12&63,e[B++]=128|t>>>6&63,e[B++]=128|t&63);return e},p=function(h,e){var t;for(e=e||h.length,e>h.length&&(e=h.length),t=e-1;t>=0&&(h[t]&192)===128;)t--;return t<0||t===0?e:t+f[h[t]]>e?t:e},a=function(h){var e,t,u,l,B=h.length,m=new Array(B*2);for(t=0,e=0;e<B;){if(u=h[e++],u<128){m[t++]=u;continue}if(l=f[u],l>4){m[t++]=65533,e+=l-1;continue}for(u&=l===2?31:l===3?15:7;l>1&&e<B;)u=u<<6|h[e++]&63,l--;if(l>1){m[t++]=65533;continue}u<65536?m[t++]=u:(u-=65536,m[t++]=55296|u>>10&1023,m[t++]=56320|u&1023)}return m.length!==t&&(m.subarray?m=m.subarray(0,t):m.length=t),o.applyFromCharCode(m)};return H.utf8encode=function(e){return n.nodebuffer?i(e,"utf-8"):A(e)},H.utf8decode=function(e){if(n.nodebuffer)return o.transformTo("nodebuffer",e).toString("utf-8");e=o.transformTo(n.uint8array?"uint8array":"array",e);for(var t=[],u=0,l=e.length,B=65536;u<l;){var m=p(e,Math.min(u+B,l));n.uint8array?t.push(a(e.subarray(u,m))):t.push(a(e.slice(u,m))),u=m}return t.join("")},H}var re,Re;function ar(){if(Re)return re;Re=1;var o=R(),n=function(){this.data=[]};return n.prototype={append:function(i){i=o.transformTo("string",i),this.data.push(i)},finalize:function(){return this.data.join("")}},re=n,re}var te,Te;function sr(){if(Te)return te;Te=1;var o=R(),n=function(i){this.data=new Uint8Array(i),this.index=0};return n.prototype={append:function(i){i.length!==0&&(i=o.transformTo("uint8array",i),this.data.set(i,this.index),this.index+=i.length)},finalize:function(){return this.data}},te=n,te}var ne,Oe;function pe(){if(Oe)return ne;Oe=1;var o=j(),n=R(),i=nr(),f=Ze(),c=je(),A=ce(),p=le(),a=Xe(),h=xe(),e=ir(),t=ar(),u=sr(),l=function(r){if(r._data instanceof a&&(r._data=r._data.getContent(),r.options.binary=!0,r.options.base64=!1,n.getTypeOf(r._data)==="uint8array")){var s=r._data;r._data=new Uint8Array(s.length),s.length!==0&&r._data.set(s,0)}return r._data},B=function(r){var s=l(r),d=n.getTypeOf(s);return d==="string"?!r.options.binary&&o.nodebuffer?h(s,"utf-8"):r.asBinary():s},m=function(r){var s=l(this);return s===null||typeof s>"u"?"":(this.options.base64&&(s=A.decode(s)),r&&this.options.binary?s=J.utf8decode(s):s=n.transformTo("string",s),!r&&!this.options.binary&&(s=n.transformTo("string",J.utf8encode(s))),s)},w=function(r,s,d){this.name=r,this.dir=d.dir,this.date=d.date,this.comment=d.comment,this.unixPermissions=d.unixPermissions,this.dosPermissions=d.dosPermissions,this._data=s,this.options=d,this._initialMetadata={dir:d.dir,date:d.date}};w.prototype={asText:function(){return m.call(this,!0)},asBinary:function(){return m.call(this,!1)},asNodeBuffer:function(){var r=B(this);return n.transformTo("nodebuffer",r)},asUint8Array:function(){var r=B(this);return n.transformTo("uint8array",r)},asArrayBuffer:function(){return this.asUint8Array().buffer}};var E=function(r,s){var d="",x;for(x=0;x<s;x++)d+=String.fromCharCode(r&255),r=r>>>8;return d},k=function(){var r={},s,d;for(s=0;s<arguments.length;s++)for(d in arguments[s])arguments[s].hasOwnProperty(d)&&typeof r[d]>"u"&&(r[d]=arguments[s][d]);return r},K=function(r){return r=r||{},r.base64===!0&&(r.binary===null||r.binary===void 0)&&(r.binary=!0),r=k(r,c),r.date=r.date||new Date,r.compression!==null&&(r.compression=r.compression.toUpperCase()),r},Ce=function(r,s,d){var x=n.getTypeOf(s),C;if(d=K(d),typeof d.unixPermissions=="string"&&(d.unixPermissions=parseInt(d.unixPermissions,8)),d.unixPermissions&&d.unixPermissions&16384&&(d.dir=!0),d.dosPermissions&&d.dosPermissions&16&&(d.dir=!0),d.dir&&(r=Ae(r)),d.createFolders&&(C=He(r))&&Be.call(this,C,!0),d.dir||s===null||typeof s>"u")d.base64=!1,d.binary=!1,s=null,x=null;else if(x==="string")d.binary&&!d.base64&&d.optimizedBinaryString!==!0&&(s=n.string2binary(s));else{if(d.base64=!1,d.binary=!0,!x&&!(s instanceof a))throw new Error("The data of '"+r+"' is in an unsupported format !");x==="arraybuffer"&&(s=n.transformTo("uint8array",s))}var D=new w(r,s,d);return this.files[r]=D,D},He=function(r){r.slice(-1)=="/"&&(r=r.substring(0,r.length-1));var s=r.lastIndexOf("/");return s>0?r.substring(0,s):""},Ae=function(r){return r.slice(-1)!="/"&&(r+="/"),r},Be=function(r,s){return s=typeof s<"u"?s:!1,r=Ae(r),this.files[r]||Ce.call(this,r,null,{dir:!0,createFolders:s}),this.files[r]},Ke=function(r,s,d){var x=new a,C;return r._data instanceof a?(x.uncompressedSize=r._data.uncompressedSize,x.crc32=r._data.crc32,x.uncompressedSize===0||r.dir?(s=p.STORE,x.compressedContent="",x.crc32=0):r._data.compressionMethod===s.magic?x.compressedContent=r._data.getCompressedContent():(C=r._data.getContent(),x.compressedContent=s.compress(n.transformTo(s.compressInputType,C),d))):(C=B(r),(!C||C.length===0||r.dir)&&(s=p.STORE,C=""),x.uncompressedSize=C.length,x.crc32=i(C),x.compressedContent=s.compress(n.transformTo(s.compressInputType,C),d)),x.compressedSize=x.compressedContent.length,x.compressionMethod=s.magic,x},Je=function(r,s){var d=r;return r||(d=s?16893:33204),(d&65535)<<16},Qe=function(r,s){return(r||0)&63},Ge=function(r,s,d,x,C){d.compressedContent;var D=n.transformTo("string",e.utf8encode(s.name)),q=s.comment||"",T=n.transformTo("string",e.utf8encode(q)),P=D.length!==s.name.length,M=T.length!==q.length,Z=s.options,y,v,O="",_="",L="",I,z;s._initialMetadata.dir!==s.dir?I=s.dir:I=Z.dir,s._initialMetadata.date!==s.date?z=s.date:z=Z.date;var X=0,Q=0;I&&(X|=16),C==="UNIX"?(Q=798,X|=Je(s.unixPermissions,I)):(Q=20,X|=Qe(s.dosPermissions)),y=z.getHours(),y=y<<6,y=y|z.getMinutes(),y=y<<5,y=y|z.getSeconds()/2,v=z.getFullYear()-1980,v=v<<4,v=v|z.getMonth()+1,v=v<<5,v=v|z.getDate(),P&&(_=E(1,1)+E(i(D),4)+D,O+="up"+E(_.length,2)+_),M&&(L=E(1,1)+E(this.crc32(T),4)+T,O+="uc"+E(L.length,2)+L);var F="";F+=`
|
||
\0`,F+=P||M?"\0\b":"\0\0",F+=d.compressionMethod,F+=E(y,2),F+=E(v,2),F+=E(d.crc32,4),F+=E(d.compressedSize,4),F+=E(d.uncompressedSize,4),F+=E(D.length,2),F+=E(O.length,2);var $e=f.LOCAL_FILE_HEADER+F+D+O,er=f.CENTRAL_FILE_HEADER+E(Q,2)+F+E(T.length,2)+"\0\0\0\0"+E(X,4)+E(x,4)+D+O+T;return{fileRecord:$e,dirRecord:er,compressedObject:d}},J={load:function(r,s){throw new Error("Load method is not defined. Is the file jszip-load.js included ?")},filter:function(r){var s=[],d,x,C,D;for(d in this.files)this.files.hasOwnProperty(d)&&(C=this.files[d],D=new w(C.name,C._data,k(C.options)),x=d.slice(this.root.length,d.length),d.slice(0,this.root.length)===this.root&&r(x,D)&&s.push(D));return s},file:function(r,s,d){if(arguments.length===1)if(n.isRegExp(r)){var x=r;return this.filter(function(C,D){return!D.dir&&x.test(C)})}else return this.filter(function(C,D){return!D.dir&&C===r})[0]||null;else r=this.root+r,Ce.call(this,r,s,d);return this},folder:function(r){if(!r)return this;if(n.isRegExp(r))return this.filter(function(C,D){return D.dir&&r.test(C)});var s=this.root+r,d=Be.call(this,s),x=this.clone();return x.root=d.name,x},remove:function(r){r=this.root+r;var s=this.files[r];if(s||(r.slice(-1)!="/"&&(r+="/"),s=this.files[r]),s&&!s.dir)delete this.files[r];else for(var d=this.filter(function(C,D){return D.name.slice(0,r.length)===r}),x=0;x<d.length;x++)delete this.files[d[x].name];return this},generate:function(r){r=k(r||{},{base64:!0,compression:"STORE",compressionOptions:null,type:"base64",platform:"DOS",comment:null,mimeType:"application/zip"}),n.checkSupport(r.type),(r.platform==="darwin"||r.platform==="freebsd"||r.platform==="linux"||r.platform==="sunos")&&(r.platform="UNIX"),r.platform==="win32"&&(r.platform="DOS");var s=[],d=0,x=0,C,D,q=n.transformTo("string",this.utf8encode(r.comment||this.comment||""));for(var T in this.files)if(this.files.hasOwnProperty(T)){var P=this.files[T],M=P.options.compression||r.compression.toUpperCase(),Z=p[M];if(!Z)throw new Error(M+" is not a valid compression method !");var y=P.options.compressionOptions||r.compressionOptions||{},v=Ke.call(this,P,Z,y),O=Ge.call(this,T,P,v,d,r.platform);d+=O.fileRecord.length+v.compressedSize,x+=O.dirRecord.length,s.push(O)}var _="";_=f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+E(s.length,2)+E(s.length,2)+E(x,4)+E(d,4)+E(q.length,2)+q;var L=r.type.toLowerCase();for(L==="uint8array"||L==="arraybuffer"||L==="blob"||L==="nodebuffer"?C=new u(d+x+_.length):C=new t(d+x+_.length),D=0;D<s.length;D++)C.append(s[D].fileRecord),C.append(s[D].compressedObject.compressedContent);for(D=0;D<s.length;D++)C.append(s[D].dirRecord);C.append(_);var I=C.finalize();switch(r.type.toLowerCase()){case"uint8array":case"arraybuffer":case"nodebuffer":return n.transformTo(r.type.toLowerCase(),I);case"blob":return n.arrayBuffer2Blob(n.transformTo("arraybuffer",I),r.mimeType);case"base64":return r.base64?A.encode(I):I;default:return I}},crc32:function(r,s){return i(r,s)},utf8encode:function(r){return n.transformTo("string",e.utf8encode(r))},utf8decode:function(r){return e.utf8decode(r)}};return ne=J,ne}var ie,_e;function Ve(){if(_e)return ie;_e=1;var o=R();function n(i){this.data=null,this.length=0,this.index=0}return n.prototype={checkOffset:function(i){this.checkIndex(this.index+i)},checkIndex:function(i){if(this.length<i||i<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+i+"). Corrupted zip ?")},setIndex:function(i){this.checkIndex(i),this.index=i},skip:function(i){this.setIndex(this.index+i)},byteAt:function(i){},readInt:function(i){var f=0,c;for(this.checkOffset(i),c=this.index+i-1;c>=this.index;c--)f=(f<<8)+this.byteAt(c);return this.index+=i,f},readString:function(i){return o.transformTo("string",this.readData(i))},readData:function(i){},lastIndexOfSignature:function(i){},readDate:function(){var i=this.readInt(4);return new Date((i>>25&127)+1980,(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(i&31)<<1)}},ie=n,ie}var ae,Le;function We(){if(Le)return ae;Le=1;var o=Ve(),n=R();function i(f,c){this.data=f,c||(this.data=n.string2binary(this.data)),this.length=this.data.length,this.index=0}return i.prototype=new o,i.prototype.byteAt=function(f){return this.data.charCodeAt(f)},i.prototype.lastIndexOfSignature=function(f){return this.data.lastIndexOf(f)},i.prototype.readData=function(f){this.checkOffset(f);var c=this.data.slice(this.index,this.index+f);return this.index+=f,c},ae=i,ae}var se,ze;function Ye(){if(ze)return se;ze=1;var o=Ve();function n(i){i&&(this.data=i,this.length=this.data.length,this.index=0)}return n.prototype=new o,n.prototype.byteAt=function(i){return this.data[i]},n.prototype.lastIndexOfSignature=function(i){for(var f=i.charCodeAt(0),c=i.charCodeAt(1),A=i.charCodeAt(2),p=i.charCodeAt(3),a=this.length-4;a>=0;--a)if(this.data[a]===f&&this.data[a+1]===c&&this.data[a+2]===A&&this.data[a+3]===p)return a;return-1},n.prototype.readData=function(i){if(this.checkOffset(i),i===0)return new Uint8Array(0);var f=this.data.subarray(this.index,this.index+i);return this.index+=i,f},se=n,se}var oe,Ue;function or(){if(Ue)return oe;Ue=1;var o=Ye();function n(i){this.data=i,this.length=this.data.length,this.index=0}return n.prototype=new o,n.prototype.readData=function(i){this.checkOffset(i);var f=this.data.slice(this.index,this.index+i);return this.index+=i,f},oe=n,oe}var fe,ke;function fr(){if(ke)return fe;ke=1;var o=We(),n=R(),i=Xe(),f=pe(),c=0,A=3;function p(a,h){this.options=a,this.loadOptions=h}return p.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},prepareCompressedContent:function(a,h,e){return function(){var t=a.index;a.setIndex(h);var u=a.readData(e);return a.setIndex(t),u}},prepareContent:function(a,h,e,t,u){return function(){var l=n.transformTo(t.uncompressInputType,this.getCompressedContent()),B=t.uncompress(l);if(B.length!==u)throw new Error("Bug : uncompressed data size mismatch");return B}},readLocalPart:function(a){var h,e;if(a.skip(22),this.fileNameLength=a.readInt(2),e=a.readInt(2),this.fileName=a.readString(this.fileNameLength),a.skip(e),this.compressedSize==-1||this.uncompressedSize==-1)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize == -1 || uncompressedSize == -1)");if(h=n.findCompression(this.compressionMethod),h===null)throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+this.fileName+")");if(this.decompressed=new i,this.decompressed.compressedSize=this.compressedSize,this.decompressed.uncompressedSize=this.uncompressedSize,this.decompressed.crc32=this.crc32,this.decompressed.compressionMethod=this.compressionMethod,this.decompressed.getCompressedContent=this.prepareCompressedContent(a,a.index,this.compressedSize,h),this.decompressed.getContent=this.prepareContent(a,a.index,this.compressedSize,h,this.uncompressedSize),this.loadOptions.checkCRC32&&(this.decompressed=n.transformTo("string",this.decompressed.getContent()),f.crc32(this.decompressed)!==this.crc32))throw new Error("Corrupted zip : CRC32 mismatch")},readCentralPart:function(a){if(this.versionMadeBy=a.readInt(2),this.versionNeeded=a.readInt(2),this.bitFlag=a.readInt(2),this.compressionMethod=a.readString(2),this.date=a.readDate(),this.crc32=a.readInt(4),this.compressedSize=a.readInt(4),this.uncompressedSize=a.readInt(4),this.fileNameLength=a.readInt(2),this.extraFieldsLength=a.readInt(2),this.fileCommentLength=a.readInt(2),this.diskNumberStart=a.readInt(2),this.internalFileAttributes=a.readInt(2),this.externalFileAttributes=a.readInt(4),this.localHeaderOffset=a.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");this.fileName=a.readString(this.fileNameLength),this.readExtraFields(a),this.parseZIP64ExtraField(a),this.fileComment=a.readString(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var a=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),a===c&&(this.dosPermissions=this.externalFileAttributes&63),a===A&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileName.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(a){if(this.extraFields[1]){var h=new o(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(a){var h=a.index,e,t,u;for(this.extraFields=this.extraFields||{};a.index<h+this.extraFieldsLength;)e=a.readInt(2),t=a.readInt(2),u=a.readString(t),this.extraFields[e]={id:e,length:t,value:u}},handleUTF8:function(){if(this.useUTF8())this.fileName=f.utf8decode(this.fileName),this.fileComment=f.utf8decode(this.fileComment);else{var a=this.findExtraFieldUnicodePath();a!==null&&(this.fileName=a);var h=this.findExtraFieldUnicodeComment();h!==null&&(this.fileComment=h)}},findExtraFieldUnicodePath:function(){var a=this.extraFields[28789];if(a){var h=new o(a.value);return h.readInt(1)!==1||f.crc32(this.fileName)!==h.readInt(4)?null:f.utf8decode(h.readString(a.length-5))}return null},findExtraFieldUnicodeComment:function(){var a=this.extraFields[25461];if(a){var h=new o(a.value);return h.readInt(1)!==1||f.crc32(this.fileComment)!==h.readInt(4)?null:f.utf8decode(h.readString(a.length-5))}return null}},fe=p,fe}var ue,Pe;function ur(){if(Pe)return ue;Pe=1;var o=We(),n=or(),i=Ye(),f=R(),c=Ze(),A=fr(),p=j(),a=pe();function h(e,t){this.files=[],this.loadOptions=t,e&&this.load(e)}return h.prototype={checkSignature:function(e){var t=this.reader.readString(4);if(t!==e)throw new Error("Corrupted zip or bug : unexpected signature ("+f.pretty(t)+", expected "+f.pretty(e)+")")},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2),this.zipComment=this.reader.readString(this.zipCommentLength),this.zipComment=a.utf8decode(this.zipComment)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.versionMadeBy=this.reader.readString(2),this.versionNeeded=this.reader.readInt(2),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e=this.zip64EndOfCentralSize-44,t=0,u,l,B;t<e;)u=this.reader.readInt(2),l=this.reader.readInt(4),B=this.reader.readString(l),this.zip64ExtensibleData[u]={id:u,length:l,value:B}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(c.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readString(4)===c.CENTRAL_FILE_HEADER;)e=new A({zip64:this.zip64},this.loadOptions),e.readCentralPart(this.reader),this.files.push(e)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(c.CENTRAL_DIRECTORY_END);if(e===-1){var t=!0;try{this.reader.setIndex(0),this.checkSignature(c.LOCAL_FILE_HEADER),t=!1}catch{}throw t?new Error("Can't find end of central directory : is this a zip file ? If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip : can't find end of central directory")}if(this.reader.setIndex(e),this.checkSignature(c.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===f.MAX_VALUE_16BITS||this.diskWithCentralDirStart===f.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===f.MAX_VALUE_16BITS||this.centralDirRecords===f.MAX_VALUE_16BITS||this.centralDirSize===f.MAX_VALUE_32BITS||this.centralDirOffset===f.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(c.ZIP64_CENTRAL_DIRECTORY_LOCATOR),e===-1)throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator");this.reader.setIndex(e),this.checkSignature(c.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(c.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}},prepareReader:function(e){var t=f.getTypeOf(e);t==="string"&&!p.uint8array?this.reader=new o(e,this.loadOptions.optimizedBinaryString):t==="nodebuffer"?this.reader=new n(e):this.reader=new i(f.transformTo("uint8array",e))},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},ue=h,ue}var de,Ne;function dr(){if(Ne)return de;Ne=1;var o=ce(),n=ur();return de=function(i,f){var c,A,p,a;for(f=f||{},f.base64&&(i=o.decode(i)),A=new n(i,f),c=A.files,p=0;p<c.length;p++)a=c[p],this.file(a.fileName,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileComment.length?a.fileComment:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:f.createFolders});return A.zipComment.length&&(this.comment=A.zipComment),this},de}var g={},qe;function hr(){if(qe)return g;qe=1;var o=R();return g.string2binary=function(n){return o.string2binary(n)},g.string2Uint8Array=function(n){return o.transformTo("uint8array",n)},g.uint8Array2String=function(n){return o.transformTo("string",n)},g.string2Blob=function(n){var i=o.transformTo("arraybuffer",n);return o.arrayBuffer2Blob(i)},g.arrayBuffer2Blob=function(n){return o.arrayBuffer2Blob(n)},g.transformTo=function(n,i){return o.transformTo(n,i)},g.getTypeOf=function(n){return o.getTypeOf(n)},g.checkSupport=function(n){return o.checkSupport(n)},g.MAX_VALUE_16BITS=o.MAX_VALUE_16BITS,g.MAX_VALUE_32BITS=o.MAX_VALUE_32BITS,g.pretty=function(n){return o.pretty(n)},g.findCompression=function(n){return o.findCompression(n)},g.isRegExp=function(n){return o.isRegExp(n)},g}var he,Me;function lr(){if(Me)return he;Me=1;var o=ce();function n(i,f){if(!(this instanceof n))return new n(i,f);this.files={},this.comment=null,this.root="",i&&this.load(i,f),this.clone=function(){var c=new n;for(var A in this)typeof this[A]!="function"&&(c[A]=this[A]);return c}}return n.prototype=pe(),n.prototype.load=dr(),n.support=j(),n.defaults=je(),n.utils=hr(),n.base64={encode:function(i){return o.encode(i)},decode:function(i){return o.decode(i)}},n.compressions=le(),he=n,he}export{lr as r};
|
||
//# sourceMappingURL=jszip-Dgg-11DP.js.map
|